@aiquants/markdown-explorer 0.12.1 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -1
- package/README.md +20 -12
- package/dist/EditSurface-DheIbHJi.js +705 -0
- package/dist/EditSurface-omuATGni.cjs +2 -0
- package/dist/{ExplorerSplit-CqmbUSZ7.cjs → ExplorerSplit-DMizcKaY.cjs} +1 -1
- package/dist/{ExplorerSplit-BjjqNRtj.js → ExplorerSplit-DvcNMIjl.js} +109 -109
- package/dist/{MultiLayout-BYXoD1aS.js → MultiLayout-C2R85L4x.js} +25 -25
- package/dist/{MultiLayout-BZbEl73E.cjs → MultiLayout-Cq4y1I1g.cjs} +1 -1
- package/dist/{NativeScrollBar-RP37nwmY.js → NativeScrollBar-CKfD2qpM.js} +1 -1
- package/dist/{NativeScrollBar-B7jTbQmn.cjs → NativeScrollBar-qvtXkNTx.cjs} +1 -1
- package/dist/{TreeLayout-CEp5oKly.cjs → TreeLayout-8_V4L9s6.cjs} +1 -1
- package/dist/{TreeLayout-Uo6RG7lq.js → TreeLayout-FCp9WPFO.js} +3 -3
- package/dist/core/contracts.d.cts +7 -1
- package/dist/core/contracts.d.ts +7 -1
- package/dist/core/labels.d.cts +14 -1
- package/dist/core/labels.d.ts +14 -1
- package/dist/{dataRoute-CH3yOKR0.cjs → dataRoute-BONacTPi.cjs} +1 -1
- package/dist/{dataRoute-Pm_0ue_4.js → dataRoute-CObbjNxG.js} +14 -12
- package/dist/index-CdydPdP7.js +3463 -0
- package/dist/index-afZWk187.cjs +13 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +21 -21
- package/dist/{location-BUNWJ4eB.cjs → location-D6RE3wAN.cjs} +1 -1
- package/dist/{location-DWd6SQhN.js → location-IRD9h42r.js} +1 -1
- package/dist/{merge-q-5i8qsn.js → merge-Bb7YRgn4.js} +1 -1
- package/dist/{merge-DRGBbLuR.cjs → merge-Dm_uFthw.cjs} +1 -1
- package/dist/{sanitizePolicy-djLC3fRN.js → sanitizePolicy-DlrakwA4.js} +1 -1
- package/dist/{sanitizePolicy-BfUlXI5E.cjs → sanitizePolicy-DrIMuYCb.cjs} +1 -1
- package/dist/sanitizeWorker.cjs +1 -1
- package/dist/sanitizeWorker.js +1 -1
- package/dist/server/ports.d.cts +3 -0
- package/dist/server/ports.d.ts +3 -0
- package/dist/server.cjs +1 -1
- package/dist/server.js +93 -83
- package/dist/styles/markdown-explorer.css +1 -1
- package/docs/behavior/dom-hooks.md +6 -5
- package/docs/behavior/layout.md +10 -3
- package/package.json +1 -1
- package/dist/EditSurface-By6NPcD7.js +0 -633
- package/dist/EditSurface-BztcpQPW.cjs +0 -2
- package/dist/index-CGBl3fYT.cjs +0 -13
- package/dist/index-CjCr8czx.js +0 -3356
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("react/jsx-runtime"),E=require("react"),L=require("./index-CGBl3fYT.cjs"),W=require("@codemirror/commands"),Y=require("@codemirror/lang-markdown"),se=require("@codemirror/language"),J=require("@codemirror/search"),B=require("@codemirror/state"),C=require("@codemirror/view"),R=require("@lezer/highlight"),fe=require("@aiquants/markdown"),K=require("@aiquants/markdown/source-lines"),F=require("./dataRoute-CH3yOKR0.cjs"),$=require("./sanitizePolicy-BfUlXI5E.cjs"),me=require("isomorphic-dompurify"),ie={history:W.historyField},pe=se.HighlightStyle.define([{tag:[R.tags.heading1,R.tags.heading2,R.tags.heading3,R.tags.heading4,R.tags.heading5,R.tags.heading6,R.tags.heading],color:"var(--aqmx-syntax-heading)",fontWeight:"700"},{tag:R.tags.strong,fontWeight:"700"},{tag:R.tags.emphasis,fontStyle:"italic"},{tag:R.tags.strikethrough,textDecoration:"line-through"},{tag:R.tags.link,color:"var(--aqmx-syntax-link)",textDecoration:"underline"},{tag:R.tags.url,color:"var(--aqmx-syntax-url)"},{tag:R.tags.monospace,color:"var(--aqmx-syntax-code)"},{tag:R.tags.quote,color:"var(--aqmx-syntax-quote)"},{tag:[R.tags.processingInstruction,R.tags.contentSeparator,R.tags.labelName,R.tags.meta],color:"var(--aqmx-syntax-mark)"}]),he=C.EditorView.theme({"&":{height:"100%",color:"var(--aqmx-text)",backgroundColor:"var(--aqmx-surface)",fontSize:"var(--aqmx-font-size-title)"},"&.cm-focused":{outline:"none"},".cm-scroller":{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace',lineHeight:"var(--aqmx-line-height-prose)"},".cm-content":{caretColor:"var(--aqmx-text)",paddingBlock:"var(--aqmx-space-6)"},".cm-line":{paddingInline:"var(--aqmx-space-6)"},"&.cm-focused .cm-cursor":{borderLeftColor:"var(--aqmx-text)"},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"var(--aqmx-editor-selection)"},".cm-activeLine":{backgroundColor:"var(--aqmx-editor-active-line)"},".cm-gutters":{backgroundColor:"var(--aqmx-surface-raised)",color:"var(--aqmx-editor-gutter)",borderInlineEnd:"var(--aqmx-space-1) solid var(--aqmx-border)"},".cm-activeLineGutter":{backgroundColor:"var(--aqmx-editor-active-line)"},".cm-searchMatch":{outline:"var(--aqmx-space-1) solid var(--aqmx-border-strong)"},".cm-panels":{backgroundColor:"var(--aqmx-surface-raised)",color:"var(--aqmx-text)"}}),le="data-aqmx-conflict-actions",ge=C.Decoration.line({attributes:{"data-aqmx-conflict-line":"marker"}}),ve=C.Decoration.line({attributes:{"data-aqmx-conflict-line":"ours"}}),we=C.Decoration.line({attributes:{"data-aqmx-conflict-line":"theirs"}});class Ee extends C.WidgetType{constructor(t,r){super(),this.index=t,this.labels=r}index;labels;eq(t){return t.index===this.index&&t.labels===this.labels}toDOM(t){const r=document.createElement("div");r.setAttribute(le,String(this.index));for(const[s,l]of[["ours",this.labels.useOurs],["theirs",this.labels.useTheirs],["both",this.labels.keepBoth]]){const i=document.createElement("button");i.type="button",i.textContent=l,i.setAttribute("data-aqmx-conflict-choice",s),i.addEventListener("mousedown",a=>a.preventDefault()),i.addEventListener("click",()=>{const a=U(t.state.doc)[this.index];a!==void 0&&(ae(t,a,s),t.focus())}),r.append(i)}return r}ignoreEvent(){return!0}}const U=e=>L.findConflictsInLines(e.iterLines()),Q=(e,t)=>{const r=new B.RangeSetBuilder;return U(e).forEach((s,l)=>{const i=e.line(s.start);r.add(i.from,i.from,C.Decoration.widget({widget:new Ee(l,t),block:!0,side:-1}));for(let a=s.start;a<=s.end;a+=1){const o=e.line(a).from,c=a===s.start||a===s.separator||a===s.end?ge:a<s.separator?ve:we;r.add(o,o,c)}}),r.finish()},be=e=>B.StateField.define({create:t=>Q(t.doc,e),update:(t,r)=>r.docChanged?Q(r.state.doc,e):t,provide:t=>C.EditorView.decorations.from(t)}),ae=(e,t,r)=>{const{doc:s}=e.state,l=(u,d)=>{const f=[];for(let m=u;m<=d;m+=1)f.push(s.line(m).text);return f},i=l(t.start+1,t.separator-1),a=l(t.separator+1,t.end-1),o=r==="ours"?i:r==="theirs"?a:[...i,...a];let c=s.line(t.start).from,p=s.line(t.end).to;o.length===0&&(t.end<s.lines?p+=1:t.start>1&&(c-=1));const n=o.join(`
|
|
2
|
-
`);e.dispatch({changes:{from:c,to:p,insert:n},selection:B.EditorSelection.cursor(c),scrollIntoView:!0,userEvent:"input.resolve"})},xe=({parent:e,scroll:t,text:r,saved:s,labels:l,onChange:i,onGeometry:a,onSave:o})=>{const c=[C.EditorView.scrollHandler.of((u,d,f)=>(ye(u,d.head,f,t),!0)),C.lineNumbers(),C.highlightActiveLineGutter(),W.history(),C.drawSelection(),C.highlightActiveLine(),J.highlightSelectionMatches(),C.EditorView.lineWrapping,Y.markdown({base:Y.markdownLanguage}),se.syntaxHighlighting(pe),be(l),C.keymap.of([{key:"Mod-s",preventDefault:!0,run:()=>(o(),!0)},...J.searchKeymap,...W.historyKeymap,...W.defaultKeymap]),C.EditorView.contentAttributes.of({"aria-label":l.editor,"aria-multiline":"true"}),C.EditorView.updateListener.of(u=>{u.docChanged&&i(),(u.docChanged||u.heightChanged||u.geometryChanged)&&a(u.docChanged)}),he],p=Te(s,c)??B.EditorState.create({doc:r,extensions:c}),n=new C.EditorView({state:p,parent:e});return{text:()=>n.state.doc.toString(),replaceText:u=>{const d=n.state.doc.toString();if(d===u)return;let f=0;const m=Math.min(d.length,u.length);for(;f<m&&d.charCodeAt(f)===u.charCodeAt(f);)f+=1;let w=0;for(;w<m-f&&d.charCodeAt(d.length-1-w)===u.charCodeAt(u.length-1-w);)w+=1;n.dispatch({changes:{from:f,to:d.length-w,insert:u.slice(f,u.length-w)},userEvent:"input.replace"})},reveal:({line:u,column:d},f)=>{const{doc:m}=n.state,w=m.line(Math.min(Math.max(u,1),m.lines)),b=Math.min(w.from+d,w.to);n.dispatch({selection:B.EditorSelection.cursor(b),effects:Z(n,b,f,t)})},showLine:u=>{const{doc:d}=n.state,f=d.line(Math.min(Math.max(u,1),d.lines)).from;n.dispatch({effects:Z(n,f,null,t)})},topLine:()=>{const u=t.scrollerOf(n.scrollDOM),d=L.visibleTopOf(u,n.contentDOM),f=L.frameTopOf(u)+u.clientHeight,{documentTop:m}=n,{doc:w}=n.state;let b=n.lineBlockAtHeight(Math.max(d-m,0));for(;w.lineAt(b.from).text.trim()===""&&b.to<w.length;){const A=n.lineBlockAt(b.to+1);if(m+A.top>=f)break;b=A}const S=n.coordsAtPos(b.from),T=S===null?m+b.top:S.top;return{line:n.state.doc.lineAt(b.from).number,clientTop:T,offset:T-d}},lineSpans:u=>{const d=n.scrollDOM,f=d.scrollTop+n.documentTop-L.visibleTopOf(d,n.contentDOM),{doc:m}=n.state,w=b=>m.line(Math.min(Math.max(b,1),m.lines)).from;return u.map(({first:b,last:S})=>({top:f+n.lineBlockAt(w(b)).top,bottom:f+n.lineBlockAt(w(S)).bottom}))},scrollElement:n.scrollDOM,focus:()=>n.focus(),conflicts:()=>U(n.state.doc),resolveAtCursor:u=>{const d=U(n.state.doc),f=n.state.doc.lineAt(n.state.selection.main.head).number,m=d.find(w=>w.end>=f);return m===void 0?!1:(ae(n,m,u),!0)},nextConflict:()=>{const u=U(n.state.doc);if(u[0]===void 0)return!1;const f=n.state.doc.lineAt(n.state.selection.main.head).number,m=u.findIndex(T=>T.start>f),w=m<0?0:m,b=n.state.doc.line(u[w].start).from;n.dispatch({selection:B.EditorSelection.cursor(b),effects:C.EditorView.scrollIntoView(b,{y:"center"})});const S=n.contentDOM.querySelector(`[${le}="${String(w)}"] button`);return S instanceof HTMLElement?S.focus({preventScroll:!0}):n.focus(),!0},save:()=>n.state.toJSON(ie),destroy:()=>n.destroy()}},Z=(e,t,r,s)=>{const l=s.scrollerOf(e.scrollDOM),i=(r===null?L.visibleTopOf(l,e.contentDOM):r)-L.frameTopOf(l);return C.EditorView.scrollIntoView(t,{y:"start",yMargin:i})},ye=(e,t,r,s)=>{const l=Se(e,t),i=s.scrollerOf(e.scrollDOM),a=L.frameTopOf(i),o=L.visibleTopOf(i,e.contentDOM),c=a+i.clientHeight;let p=0;switch(r.y){case"start":p=l.top-(a+r.yMargin);break;case"center":p=(l.top+l.bottom)/2-(o+c)/2;break;case"end":p=l.bottom-(c-r.yMargin);break;default:l.top<o+r.yMargin?p=l.top-(o+r.yMargin):l.bottom>c-r.yMargin&&(p=Math.min(l.bottom-(c-r.yMargin),l.top-(o+r.yMargin)))}if(p!==0&&(i.scrollTop+=p),r.y==="start")return;const n=ke(e,t);n!==null&&s.reveal(n)},Se=(e,t)=>{const{node:r,offset:s}=e.domAtPos(t);if(r.nodeType===Node.TEXT_NODE){const a=r.ownerDocument?.createRange();if(a!==void 0){a.setStart(r,s),a.setEnd(r,s);const[o]=a.getClientRects();if(o!==void 0&&o.height>0)return{top:o.top,bottom:o.bottom}}}const l=e.lineBlockAt(t),i=e.documentTop+l.top;return{top:i,bottom:i+l.height}},ke=(e,t)=>{const{node:r}=e.domAtPos(t);for(let s=r instanceof Element?r:r.parentElement;s!==null;s=s.parentElement)if(s.parentElement===e.contentDOM)return s;return null},Te=(e,t)=>{if(e==null)return null;try{return B.EditorState.fromJSON(e,{extensions:t},ie)}catch{return null}},Me=610,qe=987,ee=Object.freeze({kind:"unavailable"}),Le="true",Oe="false",Ce=e=>e===Le?!0:e===Oe?!1:null,Re=e=>{const t=new DOMParser().parseFromString(e,"text/html"),r=[];for(const s of t.querySelectorAll("img[data-asset-src], a[data-doc-path]")){const l=s.localName==="img",i=s.getAttribute(l?"data-asset-src":"data-doc-path");i!==null&&r.push({target:{kind:l?"asset":"doc",path:i},exists:Ce(s.getAttribute(l?"data-asset-exists":"data-doc-exists"))})}return r},Ae=({path:e,instant:t,preview:r,initial:s,onView:l})=>{const i=new AbortController,a={asset:new Map,doc:new Map};let o=s,c=null,p=!1,n=!1,u=null,d=null,f=[],m,w=!1,b,S=null;const T=v=>{v.parsed===o.parsed&&v.failure===o.failure&&v.busy===o.busy&&v.tier===o.tier||(o=v,l(v))},A=(v,x)=>{p||(p=!0,console.error(`[markdown-explorer] ${v}`,...x===void 0?[]:[x]))},j=v=>{if(t!==null)for(const{target:x,exists:y}of t.marksOf(v))a[x.kind].set(x.path,y)},h=()=>{clearTimeout(b),b=void 0,S?.abort(),S=null},k=()=>{d=null,f=[],clearTimeout(m),m=void 0},M=(v,x)=>{T({parsed:o.parsed,failure:v,busy:!1,tier:x})},N=()=>{clearTimeout(m),m=f.length===0?void 0:setTimeout(D,qe)},H=()=>{if(t===null||d===null)return;const v=d,x=[],y={asset:new Set,doc:new Set};let V;try{V=t.sanitize(v.html,P=>{const X=a[P.kind].get(P.path);return X===void 0&&!y[P.kind].has(P.path)&&(y[P.kind].add(P.path),x.push(P)),X??void 0})}catch(P){k(),P instanceof $.HtmlNestingLimitError?M(F.failureOf("too-large"),"instant"):(A("the draft sanitizer failed",P),M(F.failureOf("failed"),"instant"));return}f=x;const z=o.parsed!==null&&o.parsed.htmlContent===V&&o.parsed.headings===v.headings?o.parsed:{htmlContent:V,headings:v.headings};T({parsed:z,failure:null,busy:!1,tier:"instant"}),N()},D=()=>{if(m=void 0,w||d===null||f.length===0)return;w=!0;const v=f;r(e,d.text,i.signal).then(x=>{if(w=!1,!(i.signal.aborted||!("kind"in x))){x.kind==="preview"&&j(x.htmlContent);for(const y of v)a[y.kind].has(y.path)||a[y.kind].set(y.path,null);H()}})},g=v=>{h(),k(),T({...o,busy:!0,tier:"server"});const x=new AbortController;S=x,b=setTimeout(()=>{b=void 0,r(e,v,x.signal).then(y=>{if(!(x.signal.aborted||!("kind"in y))){if(S=null,y.kind==="failure"){M(y.failure,"server");return}j(y.htmlContent),T({parsed:{htmlContent:y.htmlContent,headings:y.headings},failure:null,busy:!1,tier:"server"})}})},Me)},q=async(v,x)=>{let y;try{y=await v.convert({path:e,text:x},i.signal)}catch(z){return i.signal.aborted||A("the draft converter rejected a conversion, which its contract allows only once the signal aborted",z),ee}const V=F.draftAnswerViolation(y);return V===null?y:(A(`the draft converter answered outside its contract: ${V}`),ee)},_=(v,x)=>{switch(x.kind){case"preview":if(h(),x.headings.length>F.EXPLORER_MAX_HEADINGS){k(),M(F.failureOf("too-large"),"instant");return}d={text:v,html:x.htmlContent,headings:x.headings.map(({text:y,depth:V,id:z})=>({text:y,depth:V,id:z}))},H();return;case"failure":h(),k(),M(F.failureOf(x.failure.reason,x.failure.code),"instant");return;case"unavailable":g(v);return}},I=async v=>{n=!0;try{for(;u!==null&&!i.signal.aborted;){const x=u;u=null;const y=await q(v,x);if(i.signal.aborted)return;_(x,y)}}finally{n=!1}};return t!==null&&t.seed!==null&&j(t.seed),{update:v=>{if(!(i.signal.aborted||v===c)){if(c=v,clearTimeout(m),m=void 0,t===null){g(v);return}u=v,n||I(t.converter)}},dispose:()=>{i.abort(),u=null,clearTimeout(m),m=void 0,h()}}},Ie=(e,t)=>$.createHtmlSanitizer(me(window),e,t,$.MAX_HTML_NESTING_DEPTH),Ne=(e,t)=>e.flatMap((r,s)=>{const l=t[s];return l===void 0?[]:[{editor:l.top,preview:r.top},{editor:l.bottom,preview:r.bottom}]}),De=e=>{const t=[],r=[];e.forEach((l,i)=>{let a=0,o=t.length;for(;a<o;){const c=a+o>>1;(e[t[c]??0]?.preview??0)<=l.preview?a=c+1:o=c}r[i]=a>0?t[a-1]??-1:-1,t[a]=i});const s=[];for(let l=t.at(-1)??-1;l>=0;l=r[l]??-1){const i=e[l];i!==void 0&&s.push(i)}return s.reverse()},_e=(e,t)=>{const r=Math.max(t.editorMax,0),s=Math.max(t.previewMax,0),l=r-t.editorViewport,i=s-t.previewViewport,a=e.filter(c=>c.editor>0&&c.editor<l&&c.preview>0&&c.preview<i).sort((c,p)=>c.editor-p.editor||c.preview-p.preview),o=[{editor:0,preview:0}];for(const c of De(a)){const p=o.at(-1);(p===void 0||c.editor>p.editor&&c.preview>p.preview)&&o.push(c)}return o.push({editor:r,preview:s}),{toPreview:c=>te(o,"editor","preview",c),toEditor:c=>te(o,"preview","editor",c)}},te=(e,t,r,s)=>{const l=e[0],i=e.at(-1);if(l===void 0||i===void 0||Number.isNaN(s)||s<=l[t])return l?.[r]??0;if(s>=i[t])return i[r];let a=0,o=e.length-1;for(;o-a>1;){const n=a+o>>1;(e[n]?.[t]??0)<=s?a=n:o=n}const c=e[a]??l,p=e[o]??i;return c[r]+(p[r]-c[r])*(s-c[t])/(p[t]-c[t])},Ve=610,re=89,ne=.5,Pe=({editor:e,preview:t,previewBlocks:r,editorSpans:s,requestFrame:l,cancelFrame:i,now:a})=>{let o="editor",c=0,p=null,n=!1,u=null,d=null;const f={editor:0,preview:0},m={editor:null,preview:null};let w=null,b=()=>{};const S=g=>{o=g,c=a()+Ve},T=(g,q)=>{g!==o&&a()>=c&&!A(g,q)&&(o=g),N()},A=(g,q)=>{const _=m[g];return a()<f[g]||_!==null&&Math.abs(q.position()-_)<ne},j=e.onScroll(()=>T("editor",e)),h=e.onIntent(()=>S("editor")),k=()=>{const g=t();return g!==w&&(b(),w=g,b=g===null?()=>{}:M(g)),g},M=g=>{const q=g.onScroll(()=>T("preview",g)),_=g.onIntent(()=>S("preview"));return()=>{q(),_()}},N=()=>{!n&&p===null&&(p=l(H))},H=()=>{p=null;const g=k();g!==null&&(u??=r(),d??=_e(Ne(u,s(u)),{editorMax:e.max(),previewMax:g.max(),editorViewport:e.viewport(),previewViewport:g.viewport()}),o==="editor"?D(g,"preview",d.toPreview(e.position())):D(e,"editor",d.toEditor(g.position())))},D=(g,q,_)=>{if(Math.abs(g.position()-_)<ne){m[q]=g.position();return}f[q]=a()+re,m[q]=g.scrollTo(_)};return N(),{editorChanged:g=>{d=null,g&&S("editor"),N()},previewChanged:()=>{u=null,d=null,f.preview=a()+re,N()},dispose:()=>{n=!0,p!==null&&i(p),p=null,j(),h(),b()}}},oe=Object.freeze(["wheel","pointerdown","keydown","focusin"]),ce=e=>({position:()=>e.scrollTop,max:()=>Math.max(e.scrollHeight-e.clientHeight,0),viewport:()=>e.clientHeight,scrollTo:t=>(e.scrollTo({top:t,behavior:"instant"}),e.scrollTop),onScroll:t=>(e.addEventListener("scroll",t,{passive:!0}),()=>e.removeEventListener("scroll",t)),onIntent:t=>{for(const r of oe)e.addEventListener(r,t,{capture:!0,passive:!0});return()=>{for(const r of oe)e.removeEventListener(r,t,{capture:!0})}}}),G="[data-aqmd-scroll-container]",je="[data-aqmd-content]",He=`[${K.SOURCE_LINES_ATTRIBUTE}]`,Be=Object.freeze(["p1","p2","p3","p4","p5","p6","p7","p8"]),ue=(e,t)=>{const r=L.loadedOf(e.peek(t));return r!==null&&r.document.kind==="markdown"?{htmlContent:r.document.htmlContent,headings:r.document.headings}:null},Fe=(e,t,r,s,l)=>{if(r===void 0)return null;let i;try{i=Ie(e,t)}catch(a){return console.error("[markdown-explorer] the draft sanitizer cannot run in this browser, so the server renders the preview",a),null}return{converter:r,sanitize:i,marksOf:Re,seed:ue(s,l)?.htmlContent??null}},ze=e=>{const t=[];let r=null;for(const s of e.querySelectorAll(He)){const l=K.parseSourceLines(s.getAttribute(K.SOURCE_LINES_ATTRIBUTE));if(l===null||s.getClientRects().length===0)continue;r??=e.scrollTop-L.visibleTopOf(e,s);const{top:i,bottom:a}=s.getBoundingClientRect();t.push({first:l.first,last:l.last,top:r+i,bottom:r+a})}return t},Ue=({path:e,readDraft:t,viewer:r,onLayout:s,handleRef:l})=>{const{config:i,data:a,documents:o,draftConverter:c,labels:p}=L.useExplorer(),[n,u]=E.useState(()=>({parsed:ue(o,e),failure:null,busy:!0,tier:c===void 0?"server":"instant"})),d=E.useRef(null),f=E.useRef(null),m=E.useRef(n);E.useLayoutEffect(()=>{m.current=n});const w=E.useEffectEvent(()=>t());E.useEffect(()=>{const h=Fe(i.iframeHosts,i.dataPath,c,o,e),k=Ae({path:e,instant:h,preview:a.preview,initial:m.current,onView:M=>E.startTransition(()=>u(M))});return f.current=k,k.update(w()),()=>{k.dispose(),f.current=null}},[i,a,o,c,e]);const b=E.useEffectEvent(()=>s());E.useLayoutEffect(()=>{n.parsed!==null&&b()},[n.parsed]);const S=n.parsed!==null;E.useEffect(()=>{const h=S?d.current?.querySelector(G):null;if(!(h instanceof HTMLElement))return;const k=new ResizeObserver(()=>b());k.observe(h);const M=h.querySelector(je);return M!==null&&k.observe(M),()=>k.disconnect()},[S]);const T=E.useRef(null);E.useImperativeHandle(l,()=>({draft:h=>{f.current?.update(h)},scrollPort:()=>{const h=d.current?.querySelector(G);return h instanceof HTMLElement?(T.current?.scroller!==h&&(T.current={scroller:h,port:ce(h)}),T.current.port):null},blocks:()=>{const h=d.current?.querySelector(G);return h instanceof HTMLElement?ze(h):[]}}),[]);const A=E.useMemo(()=>({...r,showToc:!1,showStyle:!1,showAlign:!1,renderScrollBar:void 0}),[r]),j=E.useMemo(()=>n.parsed===null?null:O.jsx("div",{className:"aqmx-document-viewer",children:O.jsx(fe.MarkdownViewer,{...A,parseResult:n.parsed,content:null})}),[A,n.parsed]);return O.jsxs("section",{ref:d,className:"aqmx-edit-preview","aria-label":p.previewRegion,"aria-busy":n.busy,"data-aqmx-preview-tier":n.tier,"data-testid":"markdown-explorer-edit-preview",children:[n.failure===null?null:O.jsx("p",{className:"aqmx-callout aqmx-document-notice","data-aqmx-tone":"warning","data-testid":"markdown-explorer-edit-preview-failure",children:p.previewFailed(L.failureTitleOf(p,n.failure.reason))}),j??(n.failure===null?O.jsx("div",{className:"aqmx-skeleton","aria-hidden":"true","data-testid":"markdown-explorer-edit-preview-skeleton",children:Be.map(h=>O.jsx("span",{},h))}):null),n.busy?O.jsx("p",{className:"aqmx-sr-only",children:p.previewUpdating}):null]})},de=144,We=Object.freeze(["e1","e2","e3","e4","e5","e6","e7","e8"]),Ge=e=>{if(typeof e!="object"||e===null)return!1;const{generation:t,topLine:r}=e;return"state"in e&&typeof t=="number"&&typeof r=="number"},Ke=e=>{e.key==="Escape"&&L.consumeKey(e)},$e=e=>{e.stopPropagation()},Xe=e=>{const{path:t,name:r,session:s}=e,{edits:l,labels:i,announcer:a}=L.useExplorer(),{phase:o}=s,c=E.useCallback(()=>l.retry(t),[l,t]);switch(E.useEffect(()=>{o.kind==="failed"&&a.announce(i.documentFailed(r,L.failureTitleOf(i,o.failure.reason)))},[o,a,i,r]),o.kind){case"opening":return O.jsxs(O.Fragment,{children:[O.jsx("div",{className:"aqmx-skeleton","aria-hidden":"true","data-testid":"markdown-explorer-edit-skeleton",children:We.map(p=>O.jsx("span",{},p))}),O.jsx("p",{className:"aqmx-sr-only",children:i.editLoading})]});case"grant":return O.jsx("div",{className:"aqmx-edit-message",children:O.jsx(L.EditGrantNotice,{href:o.href,onRetry:c,testId:"markdown-explorer-edit-grant"})});case"failed":return O.jsx("div",{className:"aqmx-edit-message",children:O.jsx(L.FailureView,{failure:o.failure,alert:!1,onRetry:c,testId:"markdown-explorer-edit-failure"})});case"editing":return O.jsx(Ye,{...e})}},Ye=({path:e,name:t,session:r,layout:s,viewer:l,region:i,paneScroll:a})=>{const{edits:o,labels:c}=L.useExplorer(),p=E.useRef(null),n=E.useRef(null),u=E.useRef(null),d=E.useRef(null),f=L.usePreviewShown()&&s==="fill",m=E.useRef({layout:s,region:i,paneScroll:a});E.useLayoutEffect(()=>{m.current={layout:s,region:i,paneScroll:a}});const w=E.useRef(r.generation);E.useLayoutEffect(()=>{w.current=r.generation});const b=E.useRef(f);E.useLayoutEffect(()=>{b.current=f});const S=E.useMemo(()=>({editor:c.editorLabel(t),useOurs:c.conflictUseOurs,useTheirs:c.conflictUseTheirs,keepBoth:c.conflictKeepBoth}),[c,t]);E.useLayoutEffect(()=>{const h=p.current,k=o.draft(e);if(h===null||k===null)return;const M=o.editorState.get(e),N=Ge(M)&&M.generation===w.current?M:null;let H=null,D=null;const g=()=>{H!==null&&clearTimeout(H),H=null,D!==null&&o.setDraft(e,D.text())},q=xe({parent:h,scroll:{scrollerOf:I=>{const{layout:v,region:x,paneScroll:y}=m.current,V=x();return v==="fill"||V===null?I:y.scrollerOf(V,I)},reveal:I=>m.current.paneScroll.reveal(I)},text:k,saved:N===null?void 0:N.state,labels:S,onGeometry:I=>d.current?.editorChanged(I),onChange:()=>{H??=setTimeout(g,de),b.current&&D!==null&&u.current?.draft(D.text())},onSave:()=>{o.save(e)}});D=q,n.current=q;const _=o.bindEditor(e,{flush:g,adopt:I=>q.replaceText(I),returnPoint:()=>{const I=q.topLine();return{line:I.line,clientTop:I.clientTop}},nextConflict:()=>q.nextConflict()});return N!==null&&q.showLine(N.topLine),()=>{g(),o.editorState.set(e,{state:q.save(),generation:w.current,topLine:q.topLine().line}),_(),q.destroy(),D=null,n.current=null}},[o,e,S]);const{request:T}=r;E.useLayoutEffect(()=>{const h=n.current,k=o.draft(e);h===null||k===null||T===null||(T.anchor!==null&&h.reveal(L.positionInSource(k,T.anchor),T.anchor.clientTop),h.focus(),o.consumeRequest(e))},[o,e,T,S]);const A=E.useCallback(()=>{const h=n.current;if(h===null)throw new Error("[markdown-explorer] the preview read the draft before the editor was mounted");return h.text()},[]);E.useLayoutEffect(()=>{const h=n.current;if(!f||h===null)return;const k=Pe({editor:ce(h.scrollElement),preview:()=>u.current?.scrollPort()??null,previewBlocks:()=>u.current?.blocks()??[],editorSpans:M=>h.lineSpans(M),requestFrame:M=>requestAnimationFrame(M),cancelFrame:M=>cancelAnimationFrame(M),now:()=>performance.now()});return d.current=k,()=>{k.dispose(),d.current=null}},[f,o,e,S]);const j=E.useCallback(()=>d.current?.previewChanged(),[]);return O.jsxs("div",{className:"aqmx-edit","data-aqmx-edit-layout":s,"data-testid":"markdown-explorer-edit",onKeyDown:Ke,onDoubleClick:$e,children:[O.jsx("div",{ref:p,className:"aqmx-edit-editor","data-testid":"markdown-explorer-editor",...L.ALLOW_KEY_REPEAT}),f?O.jsx(Ue,{path:e,readDraft:A,viewer:l,onLayout:j,handleRef:u}):null]})};exports.DRAFT_WRITE_INTERVAL_MS=de;exports.default=Xe;
|
package/dist/index-CGBl3fYT.cjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";const l=require("react/jsx-runtime"),i=require("react"),X=require("react-router"),q=require("./location-BUNWJ4eB.cjs"),N=require("./dataRoute-CH3yOKR0.cjs"),de=require("@aiquants/markdown"),$e=require("@aiquants/markdown/source-lines"),xn=require("@aiquants/markdown/viewer-settings"),Q=require("./storage-Dgi4JXaB.cjs");function En(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 b=En(i),qe=Object.freeze(["en","ja"]),Tt="en",Ct=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"])}),bn=/\{(\w+)\}/gu,Ot={explorerRegion:"Explorer",sourceLabel:"Source",refreshTreeLabel:"Refresh tree",refreshTree:"Reload the tree and the open documents from the source",treeRefreshed:"Reloaded the tree from the source",treeRefreshFailed:e=>`Could not reload the tree: ${e}`,refreshDocumentLabel:"Refresh document",refreshDocument:"Reload the document from the source",refreshDocumentNamed:e=>`Refresh ${e}`,documentRefreshed:e=>`Reloaded ${e}`,documentRefreshFailed:e=>`Could not reload the document: ${e}`,showMarkupLabel:"Source",showMarkup:"Show the document's Markdown as written",showMarkupNamed:e=>`Source of ${e}`,editDocumentLabel:"Edit",editDocument:"Edit the document's Markdown (or double-click the document)",editDocumentNamed:e=>`Edit ${e}`,editExternallyLabel:"Open in its editor",editExternally:"Open the document in its own editor, in a new tab",editExternallyNamed:e=>`Open ${e} in its editor`,editorRegion:e=>`Editing ${e}`,editorLabel:e=>`Markdown of ${e}`,editLoading:"Loading the source for editing…",editToolbar:"Editor",saveDraft:"Save",saveDraftTooltip:"Save the draft (Ctrl+S, or ⌘S on a Mac)",closeEditor:"Close editor",previewToggle:"Preview",historyOpen:"History",draftUnsaved:"Unsaved changes",draftSaving:"Saving…",draftSaved:"Saved",draftSavedMerged:"Saved, merged with changes saved elsewhere",draftConflicts:e=>e===1?"1 conflict with changes saved elsewhere: choose what to keep, then save":`${e} conflicts with changes saved elsewhere: choose what to keep, then save`,draftSaveFailed:e=>`Could not save: ${e}`,documentSaved:e=>`Saved ${e}`,documentSavedMerged:e=>`Saved ${e}, merged with changes saved elsewhere`,conflictOurs:"your draft",conflictTheirs:"saved elsewhere",conflictUseOurs:"Use my lines",conflictUseTheirs:"Use the saved lines",conflictKeepBoth:"Keep both",conflictNext:"Next conflict",editGrantTitle:"Editing needs your permission",editGrantBody:"Allow this site to change documents on your behalf. You are asked once; signing out asks again.",editGrantAction:"Grant permission",editGrantRetry:"Try again",unsavedTitle:"Discard unsaved changes?",unsavedBody:e=>`${e} has changes that are not saved.`,unsavedDiscard:"Discard changes",unsavedStay:"Keep editing",historyTitle:e=>`Revisions of ${e}`,historyLoading:"Loading the revisions…",historyEmpty:"No revisions are kept for this document.",historyCurrent:"Current",historyKept:"Kept",historyEntry:(e,t)=>t===""?e:`${e} by ${t}`,historyRestore:"Put into the draft",historyClose:"Close",historyRestored:e=>`Put the revision into the draft of ${e}; save to keep it`,previewRegion:"Preview",previewUpdating:"Updating the preview…",previewFailed:e=>`Could not preview: ${e}`,expandAll:"Expand all folders",collapseAll:"Collapse all folders",treeSettings:"Tree settings",switchToMulti:"Open in the multi-panel view",switchToTree:"Open in the tree view",resizeExplorer:"Resize the explorer",showExplorer:"Show the explorer",hideExplorer:"Close the explorer",treeRegion:"Documents",treeLoading:"Loading the tree…",treeEmptyTitle:"Nothing to show",treeEmptyBody:"This source has no documents you can open.",folderLoadFailed:"This folder could not be loaded.",loopFolderName:e=>`${e} (already open above)`,foldersLoadFailedNamed:e=>`${new Intl.ListFormat("en",{type:"conjunction"}).format(e)} could not be loaded`,foldersLoading:e=>e===1?"Loading 1 folder…":`Loading ${String(e)} folders…`,expandAllStarted:"Opening all folders…",expandAllProgress:(e,t)=>`Opening all folders (${String(e)} opened, ${String(t)} loading)…`,expandAllDone:(e,t,n)=>{const r=`Opened ${String(e)} ${e===1?"folder":"folders"}`;return t>0?`${r}; ${String(t)} could not be loaded`:n?e===0?"All folders are already open":`${r}; every folder is open`:r},expandAllFolderLimit:(e,t,n)=>`Opened ${String(e)} ${e===1?"folder":"folders"} and stopped at the limit of ${String(t)} ${t===1?"folder":"folders"} to load. Choose "${n}" again to continue`,expandAllDepthLimit:(e,t)=>`Opened ${String(e)} ${e===1?"folder":"folders"}; folders more than ${String(t)} ${t===1?"level":"levels"} deep stay closed`,treeEntryKindDirectory:"directory",treeEntryKindFile:"file",treeScrollUp:"Scroll up",treeScrollDown:"Scroll down",treeScrollToTop:"Top",treeScrollToBottom:"Bottom",selectionTitle:e=>`Selected (${String(e)})`,clearSelection:"Clear the selection",openSelectionInMulti:e=>`Open ${String(e)} in panels`,removeFromSelection:e=>`Remove ${e} from the selection`,settingSortMode:"Sort order",sortNative:"Source order",sortAscending:"Name A→Z",sortDescending:"Name Z→A",sortOldest:"Modified old→new",sortNewest:"Modified new→old",settingFolderPlacement:"Folders",folderPlacementMixed:"Mixed",folderPlacementFirst:"First",folderPlacementLast:"Last",settingSelectionMode:"Selection",selectionSingle:"Single",selectionMultiple:"Multiple",selectionNone:"Off",settingDoubleClick:"Double-click",doubleClickRecursive:"Expand all levels",doubleClickToggle:"Toggle",settingExpandIconSize:"Expander size",expandIconSizeValue:e=>`${String(e)} px`,settingAlwaysExpanded:"Always expanded",settingRevealDocument:"Reveal the open document",settingRemoveRootIndent:"No root indent",settingTreeLines:"Tree lines",settingExpandIcons:"Expanders",settingDirectoryIcons:"Folder icons",settingFileIcons:"File icons",settingOn:"On",settingOff:"Off",settingAnnouncement:(e,t)=>`${e}: ${t}`,documentRegion:"Document",documentEmpty:"Select a document in the explorer.",documentLoading:"Loading the document…",markupLoading:"Loading the source…",documentShown:e=>`Showing ${e}`,documentFailed:(e,t)=>`${e}: ${t}`,announcementSequence:e=>e.map(t=>/[.!?]$/u.test(t)?t:`${t}.`).join(" "),textTruncated:"Only the beginning of this file is shown.",inertLink:"This link points outside the source and cannot be opened.",failureUnauthorizedTitle:"Your session has expired",failureUnauthorizedBody:"Reload the page to sign in again.",failureForbiddenTitle:"Access denied",failureForbiddenBody:"You do not have permission to open this.",failureNotFoundTitle:"Not found",failureNotFoundBody:"It may have been moved or deleted.",failureNotConfiguredTitle:"This source is not set up",failureNotConfiguredBody:"Ask your administrator to configure it.",failureInvalidTitle:"Invalid address",failureInvalidBody:"The document path in this address cannot be used.",failureTooLargeTitle:"Too large to display",failureTooLargeBody:"This file exceeds the size that can be displayed.",failureUnsupportedTitle:"Cannot be displayed",failureUnsupportedBody:"This type of file cannot be shown here.",failureFailedTitle:"Something went wrong",failureFailedBody:"Try again in a moment.",retry:"Try again",reloadPage:"Reload the page",imageZoomIn:"Zoom in",imageZoomOut:"Zoom out",imageFit:"Fit to the view",imageFitLevel:"Fit",imageZoomLevel:e=>`${String(e)}%`,openInNewTab:"Open in a new tab",download:"Download",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.",viewerLoading:"Loading data...",viewerErrorPrefix:"Error: ",viewerStyleTitle:"Display Style",viewerSelectStyle:"Select display style",viewerPinStyle:"Pin style selector",viewerUnpinStyle:"Unpin style selector",viewerErrorTitle:"An error occurred",viewerMissingImage:"Image not found",viewerOpenToc:"Open table of contents",viewerTocTitle:"Table of contents",viewerPinToc:"Pin table of contents",viewerUnpinToc:"Unpin table of contents",viewerSelectAlign:"Select alignment",viewerAlignTitle:"Alignment",viewerPinAlign:"Pin alignment selector",viewerUnpinAlign:"Unpin alignment selector",viewerAlignLeft:"Align left",viewerAlignCenter:"Align center",viewerAlignRight:"Align right",viewerMermaidInteractionMode:"Mouse interaction mode",viewerMermaidModeNone:"No interaction",viewerMermaidModeZoom:"Zoom only",viewerMermaidModePan:"Pan only (drag)",viewerMermaidModePanShift:"Pan only (Shift+drag)",viewerMermaidModeBoth:"Zoom and pan (drag)",viewerMermaidModeBothShift:"Zoom and pan (Shift+drag)",viewerMermaidZoomIn:"Zoom In",viewerMermaidZoomOut:"Zoom Out",viewerMermaidResetView:"Reset View",viewerMermaidRetry:"Try again",viewerEmbeddedVideo:"embedded video",viewerEmbeddedPost:"embedded post",viewerEmbeddedFrame:"Embedded content",multiRegion:"Panels",multiEmpty:"Select documents in the explorer to open them side by side.",panelLimit:e=>`You can open up to ${String(e)} panels at once.`,panelOpened:e=>`Opened ${e}`,panelClosed:e=>`Closed ${e}`,panelAlreadyOpen:e=>`${e} is already open`,panelHidden:e=>`Hid ${e}`,panelShown:e=>`Showed ${e}`,panelMaximized:e=>`Maximized ${e}`,panelRestored:e=>`Restored ${e} to its size`,panelHide:"Hide the panel",panelMaximize:"Maximize the panel",panelRestore:"Restore the panel to its size",panelClose:"Close the panel",panelSwitchToCustomDrag:"Switch to the custom drag mode",panelSwitchToNormalDrag:"Back to the normal drag mode",panelCustomDragBadge:"Custom",panelMovePreviousColumn:"Move to the previous column",panelMoveNextColumn:"Move to the next column",panelMoveUp:"Move up",panelMoveDown:"Move down",panelMoved:"Moved {title} to column {column}, position {position}",panelMoveUnavailable:"{move} is not available for {title}",panelDragStarted:"Picked up {title}",panelDragCancelled:"Kept {title} where it was",hiddenPanelsTitle:"Hidden panels:",hiddenPanelBadge:"Hidden",hiddenPanelNotice:"This panel is hidden",multiColumnEmpty:"This column is empty",multiColumnRegion:"Column {column}",panelDropHere:"Drop the panel here"},yn={explorerRegion:"エクスプローラー",sourceLabel:"ソース",refreshTreeLabel:"ツリーを更新",refreshTree:"ソースからツリーと開いている文書を読み込み直す",treeRefreshed:"ツリーをソースから読み込み直しました",treeRefreshFailed:e=>`ツリーを読み込み直せませんでした: ${e}`,refreshDocumentLabel:"文書を更新",refreshDocument:"ソースから文書を読み込み直す",refreshDocumentNamed:e=>`${e} を更新`,documentRefreshed:e=>`${e} を読み込み直しました`,documentRefreshFailed:e=>`文書を読み込み直せませんでした: ${e}`,showMarkupLabel:"ソース",showMarkup:"文書の Markdown を書いたまま表示",showMarkupNamed:e=>`${e} のソース`,editDocumentLabel:"編集",editDocument:"文書の Markdown を編集 (文書のダブルクリックでも)",editDocumentNamed:e=>`${e} を編集`,editExternallyLabel:"元のエディタで開く",editExternally:"文書を元のエディタで、新しいタブに開く",editExternallyNamed:e=>`${e} を元のエディタで開く`,editorRegion:e=>`${e} を編集中`,editorLabel:e=>`${e} の Markdown`,editLoading:"編集のためにソースを読み込み中…",editToolbar:"エディタ",saveDraft:"保存",saveDraftTooltip:"下書きを保存 (Ctrl+S、Mac は ⌘S)",closeEditor:"編集を閉じる",previewToggle:"プレビュー",historyOpen:"履歴",draftUnsaved:"保存していない変更があります",draftSaving:"保存中…",draftSaved:"保存しました",draftSavedMerged:"ほかで保存された変更と統合して保存しました",draftConflicts:e=>`ほかで保存された変更と ${e} か所が重なりました。残す方を選んでから保存してください`,draftSaveFailed:e=>`保存できませんでした: ${e}`,documentSaved:e=>`${e} を保存しました`,documentSavedMerged:e=>`${e} を、ほかで保存された変更と統合して保存しました`,conflictOurs:"あなたの下書き",conflictTheirs:"ほかで保存された版",conflictUseOurs:"自分の行を使う",conflictUseTheirs:"保存された行を使う",conflictKeepBoth:"両方を残す",conflictNext:"次の衝突へ",editGrantTitle:"編集には許可が必要です",editGrantBody:"このサイトがあなたに代わって文書を変えることを許可してください。尋ねるのは 1 回だけで、サインアウトすると次にまた尋ねます。",editGrantAction:"許可する",editGrantRetry:"もう一度試す",unsavedTitle:"保存していない変更を破棄しますか?",unsavedBody:e=>`${e} に保存していない変更があります。`,unsavedDiscard:"変更を破棄",unsavedStay:"編集を続ける",historyTitle:e=>`${e} の版`,historyLoading:"版の一覧を読み込み中…",historyEmpty:"この文書の版は残っていません。",historyCurrent:"現在の版",historyKept:"保持",historyEntry:(e,t)=>t===""?e:`${e} (${t})`,historyRestore:"下書きに戻す",historyClose:"閉じる",historyRestored:e=>`${e} の下書きに版を戻しました。残すには保存してください`,previewRegion:"プレビュー",previewUpdating:"プレビューを更新中…",previewFailed:e=>`プレビューできませんでした: ${e}`,expandAll:"すべてのフォルダーを展開",collapseAll:"すべてのフォルダーを折りたたむ",treeSettings:"ツリーの設定",switchToMulti:"マルチビューで開く",switchToTree:"ツリービューで開く",resizeExplorer:"エクスプローラーの幅を変更",showExplorer:"エクスプローラーを開く",hideExplorer:"エクスプローラーを閉じる",treeRegion:"文書の一覧",treeLoading:"ツリーを読み込み中…",treeEmptyTitle:"表示できるファイルがありません",treeEmptyBody:"このソースには開ける文書がありません。",folderLoadFailed:"このフォルダーを読み込めませんでした。",loopFolderName:e=>`${e} (上の階層で開いています)`,foldersLoadFailedNamed:e=>`${new Intl.ListFormat("ja",{type:"conjunction"}).format(e)} を読み込めませんでした`,foldersLoading:e=>`フォルダーを ${String(e)} 件読み込み中…`,expandAllStarted:"すべてのフォルダーを展開しています…",expandAllProgress:(e,t)=>`すべてのフォルダーを展開中 (展開 ${String(e)} 件、読み込み中 ${String(t)} 件)…`,expandAllDone:(e,t,n)=>{const r=`${String(e)} 件のフォルダーを展開しました`;return t>0?`${r}。うち ${String(t)} 件は読み込めませんでした`:n?e===0?"すべてのフォルダーが既に開いています":`${r}。すべてのフォルダーが開いています`:r},expandAllFolderLimit:(e,t,n)=>`${String(e)} 件のフォルダーを展開し、読み込みの上限 (${String(t)} 件) で止めました。続けるには「${n}」をもう一度押してください`,expandAllDepthLimit:(e,t)=>`${String(e)} 件のフォルダーを展開しました。深さ ${String(t)} 階層より下のフォルダーは閉じたままです`,treeEntryKindDirectory:"ディレクトリ",treeEntryKindFile:"ファイル",treeScrollUp:"上へスクロール",treeScrollDown:"下へスクロール",treeScrollToTop:"先頭へ",treeScrollToBottom:"末尾へ",selectionTitle:e=>`選択中 (${String(e)})`,clearSelection:"選択を解除",openSelectionInMulti:e=>`${String(e)} 件をパネルで開く`,removeFromSelection:e=>`${e} を選択から外す`,settingSortMode:"並び順",sortNative:"取得順",sortAscending:"名前の昇順",sortDescending:"名前の降順",sortOldest:"更新日時の昇順 (古い順)",sortNewest:"更新日時の降順 (新しい順)",settingFolderPlacement:"フォルダーの位置",folderPlacementMixed:"混ぜる",folderPlacementFirst:"先に",folderPlacementLast:"後に",settingSelectionMode:"選択",selectionSingle:"1 件",selectionMultiple:"複数",selectionNone:"オフ",settingDoubleClick:"ダブルクリック",doubleClickRecursive:"下の階層まで展開",doubleClickToggle:"開閉",settingExpandIconSize:"展開アイコンの大きさ",expandIconSizeValue:e=>`${String(e)} px`,settingAlwaysExpanded:"常に展開",settingRevealDocument:"開いた文書をツリーで表示",settingRemoveRootIndent:"最上位の字下げなし",settingTreeLines:"ツリーの線",settingExpandIcons:"展開アイコン",settingDirectoryIcons:"フォルダーのアイコン",settingFileIcons:"ファイルのアイコン",settingOn:"オン",settingOff:"オフ",settingAnnouncement:(e,t)=>`${e}: ${t}`,documentRegion:"文書",documentEmpty:"エクスプローラーで文書を選んでください。",documentLoading:"文書を読み込み中…",markupLoading:"ソースを読み込み中…",documentShown:e=>`${e} を表示しています`,documentFailed:(e,t)=>`${e}: ${t}`,announcementSequence:e=>e.map(t=>/[。!?]$/u.test(t)?t:`${t}。`).join(""),textTruncated:"このファイルは先頭だけを表示しています。",inertLink:"リンク先がソースの外にあるため開けません。",failureUnauthorizedTitle:"セッションの有効期限が切れました",failureUnauthorizedBody:"ページを再読み込みして、もう一度サインインしてください。",failureForbiddenTitle:"アクセスが許可されていません",failureForbiddenBody:"これを開く権限がありません。",failureNotFoundTitle:"見つかりません",failureNotFoundBody:"移動または削除された可能性があります。",failureNotConfiguredTitle:"このソースは設定されていません",failureNotConfiguredBody:"管理者に設定を依頼してください。",failureInvalidTitle:"アドレスが正しくありません",failureInvalidBody:"このアドレスに含まれる文書の経路は使えません。",failureTooLargeTitle:"大きすぎて表示できません",failureTooLargeBody:"このファイルは表示できる大きさを超えています。",failureUnsupportedTitle:"表示できない形式です",failureUnsupportedBody:"この種類のファイルはここでは表示できません。",failureFailedTitle:"読み込みに失敗しました",failureFailedBody:"しばらくしてからもう一度お試しください。",retry:"再試行",reloadPage:"ページを再読み込み",imageZoomIn:"拡大",imageZoomOut:"縮小",imageFit:"画面に合わせる",imageFitLevel:"全体",imageZoomLevel:e=>`${String(e)}%`,openInNewTab:"新しいタブで開く",download:"ダウンロード",copyText:"テキストをコピー",copiedText:"テキストをコピーしました",copyTextFailed:"テキストをコピーできませんでした",mediaUnsupported:"このブラウザではこのファイルを再生できません。",fileNotShown:"このファイルはここでは表示できません。ダウンロードして開いてください。",viewerLoading:"データを読み込み中...",viewerErrorPrefix:"エラー: ",viewerStyleTitle:"表示スタイル",viewerSelectStyle:"表示スタイルを選択",viewerPinStyle:"スタイル選択をピン留め",viewerUnpinStyle:"スタイル選択のピン留めを解除",viewerErrorTitle:"エラーが発生しました",viewerMissingImage:"画像が見つかりません",viewerOpenToc:"目次を開く",viewerTocTitle:"目次",viewerPinToc:"目次をピン留め",viewerUnpinToc:"目次のピン留めを解除",viewerSelectAlign:"揃えを選択",viewerAlignTitle:"揃え",viewerPinAlign:"揃え選択をピン留め",viewerUnpinAlign:"揃え選択のピン留めを解除",viewerAlignLeft:"左揃え",viewerAlignCenter:"中央揃え",viewerAlignRight:"右揃え",viewerMermaidInteractionMode:"マウス操作モード",viewerMermaidModeNone:"操作なし",viewerMermaidModeZoom:"拡大縮小のみ",viewerMermaidModePan:"移動のみ (左ドラッグ)",viewerMermaidModePanShift:"移動のみ (Shift+ドラッグ)",viewerMermaidModeBoth:"拡大縮小+移動 (左ドラッグ)",viewerMermaidModeBothShift:"拡大縮小+移動 (Shift+ドラッグ)",viewerMermaidZoomIn:"拡大",viewerMermaidZoomOut:"縮小",viewerMermaidResetView:"表示を元に戻す",viewerMermaidRetry:"再試行",viewerEmbeddedVideo:"埋め込みの動画",viewerEmbeddedPost:"埋め込みの投稿",viewerEmbeddedFrame:"埋め込みのコンテンツ",multiRegion:"パネル",multiEmpty:"エクスプローラーで文書を選ぶと、ここに並べて開きます。",panelLimit:e=>`同時に開けるのは ${String(e)} パネルまでです。`,panelOpened:e=>`${e} を開きました`,panelClosed:e=>`${e} を閉じました`,panelAlreadyOpen:e=>`${e} は既に開いています`,panelHidden:e=>`${e} を隠しました`,panelShown:e=>`${e} を表示しました`,panelMaximized:e=>`${e} を最大化しました`,panelRestored:e=>`${e} を元のサイズに戻しました`,panelHide:"パネルを隠す",panelMaximize:"パネルを最大化",panelRestore:"パネルを元のサイズに戻す",panelClose:"パネルを閉じる",panelSwitchToCustomDrag:"カスタムのドラッグの方式に切り替え",panelSwitchToNormalDrag:"通常のドラッグの方式に戻す",panelCustomDragBadge:"カスタム",panelMovePreviousColumn:"前の列へ移動",panelMoveNextColumn:"次の列へ移動",panelMoveUp:"上へ移動",panelMoveDown:"下へ移動",panelMoved:"{title} を {column} 列目の {position} 番目へ移動しました",panelMoveUnavailable:"{title} は「{move}」できません",panelDragStarted:"{title} を持ち上げました",panelDragCancelled:"{title} の移動を取り消しました",hiddenPanelsTitle:"隠したパネル:",hiddenPanelBadge:"非表示",hiddenPanelNotice:"このパネルは隠しています",multiColumnEmpty:"この列は空です",multiColumnRegion:"{column} 列目",panelDropHere:"ここへパネルをドロップ"},At=Object.freeze({en:Object.freeze(Ot),ja:Object.freeze(yn)}),Ze=Object.freeze(Object.keys(Ot)),Sn=new Set(Ze),kn=e=>Sn.has(e),we=e=>e===null?"null":typeof e=="string"?JSON.stringify(e.length>40?`${e.slice(0,40)}…`:e):typeof e=="function"?"a function":Array.isArray(e)?"an array":typeof e,Lt=e=>{if(e===void 0)return Tt;if(qe.includes(e))return e;throw new RangeError(`[markdown-explorer] locale is the UI language (${qe.map(t=>JSON.stringify(t)).join(" or ")}), not a BCP 47 tag; got ${we(e)}`)},Ie=(e,t)=>{const n=At[Lt(e)];if(t===void 0)return n;if(t===null||typeof t!="object")throw new RangeError(`[markdown-explorer] labels must be an object; got ${we(t)}`);if(!q.isPlainObject(t))throw new RangeError(`[markdown-explorer] labels must be a plain object; got ${we(t)}`);const r=t,o={...n};for(const s of Object.keys(r)){if(!kn(s))throw new RangeError(`[markdown-explorer] labels.${s} is not a known label key; expected one of ${Ze.join(", ")}`);const a=r[s];if(a===void 0)continue;const u=typeof n[s];if(typeof a!==u)throw new TypeError(`[markdown-explorer] labels.${s} must be a ${u}; got ${we(a)}`);if(typeof a=="string"&&a.trim()==="")throw new RangeError(`[markdown-explorer] labels.${s} must be a non-blank string`);const v=Ct[s];if(typeof a=="string"&&v!==void 0){for(const[,m]of a.matchAll(bn))if(!v.includes(m??""))throw new RangeError(`[markdown-explorer] labels.${s} uses the unknown placeholder {${String(m)}}; it accepts ${v.map(f=>`{${f}}`).join(", ")}`)}o[s]=a}return Object.freeze(o)},Rn=(e,t)=>{if(Object.is(e,t))return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object")return!1;const n=e,r=t,o=Object.keys(n),s=Object.keys(r);return o.length===s.length&&s.every(a=>Object.hasOwn(n,a)&&Object.is(n[a],r[a]))},Be=Object.freeze(["light","dark"]),Tn=e=>{if(e===void 0)return"light";if(Be.includes(e))return e;throw new RangeError(`[markdown-explorer] theme must be ${Be.map(t=>JSON.stringify(t)).join(" or ")}; got ${typeof e=="string"?JSON.stringify(e):typeof e}`)},jt=i.createContext(null),P=()=>{const e=i.use(jt);if(e===null)throw new Error("[markdown-explorer] explorer components must be rendered inside <MarkdownExplorer>");return e},ue=e=>{const{viewSettings:t}=P(),n=()=>e(t.getSnapshot());return i.useSyncExternalStore(t.subscribe,n,n)},Se=()=>{const{config:e}=P(),t=X.useParams()["*"],[n]=X.useSearchParams(),r=n.toString();return i.useMemo(()=>q.resolveExplorerLocation(e,t,new URLSearchParams(r)),[e,t,r])},Mt={unauthorized:["failureUnauthorizedTitle","failureUnauthorizedBody"],forbidden:["failureForbiddenTitle","failureForbiddenBody"],"not-found":["failureNotFoundTitle","failureNotFoundBody"],"not-configured":["failureNotConfiguredTitle","failureNotConfiguredBody"],invalid:["failureInvalidTitle","failureInvalidBody"],"too-large":["failureTooLargeTitle","failureTooLargeBody"],unsupported:["failureUnsupportedTitle","failureUnsupportedBody"],failed:["failureFailedTitle","failureFailedBody"]},te=(e,t)=>e[Mt[t][0]],le=({failure:e,alert:t,onRetry:n,testId:r})=>{const{labels:o}=P(),s=te(o,e.reason),a=o[Mt[e.reason][1]],u=e.reason==="unauthorized"||e.reason==="forbidden"||e.reason==="failed"?"danger":"warning";return l.jsxs("div",{className:"aqmx-callout",role:t?"alert":void 0,"data-aqmx-tone":u,"data-testid":r===null?void 0:r,"data-aqmx-failure":r===null?void 0:e.reason,children:[l.jsx("p",{className:"aqmx-callout-title",children:s}),l.jsx("p",{className:"aqmx-callout-body",children:a}),e.reason==="unauthorized"?l.jsx("button",{type:"button",className:"aqmx-callout-action",onClick:()=>window.location.reload(),children:o.reloadPage}):n!==void 0&&e.reason==="failed"?l.jsx("button",{type:"button",className:"aqmx-callout-action",onClick:n,children:o.retry}):null]})},Cn=(e,t)=>{const{phase:n,save:r,dirty:o}=t;switch(n.kind){case"opening":return e.editLoading;case"grant":return e.editGrantTitle;case"failed":return te(e,n.failure.reason)}switch(r.kind){case"saving":return e.draftSaving;case"conflicts":return e.draftConflicts(r.count);case"grant":return e.editGrantTitle;case"failed":return e.draftSaveFailed(te(e,r.failure.reason));case"saved":if(!o)return r.merged?e.draftSavedMerged:e.draftSaved;break}return o?e.draftUnsaved:""},On=(e,t,n)=>{switch(t.kind){case"saved":return t.merged?e.documentSavedMerged(n):e.documentSaved(n);case"conflicts":return e.draftConflicts(t.count);case"grant":return e.editGrantTitle;case"failed":return e.draftSaveFailed(te(e,t.failure.reason));case"idle":case"saving":return null}},ae=()=>{const e=new Set;return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),emit:()=>{for(const t of[...e])t()}}},Nt="<<<<<<<",Dt="=======",Pt=">>>>>>>",rt=(e,t)=>e===t||e.startsWith(`${t} `),ot=e=>_t(e.split(`
|
|
2
|
-
`)),_t=e=>{const t=[];let n=null,r=null,o=0;for(const s of e){o+=1;const a=s.charCodeAt(0);a!==60&&a!==61&&a!==62||(rt(s,Nt)?(n=o,r=null):s===Dt?n!==null&&r===null?r=o:n=null:rt(s,Pt)&&(n!==null&&r!==null&&t.push({start:n,separator:r,end:o}),n=null,r=null))}return t},st=e=>e.includes(`\r
|
|
3
|
-
`)?`\r
|
|
4
|
-
`:`
|
|
5
|
-
`,je=e=>e.replace(/\r\n?/gu,`
|
|
6
|
-
`),An=(e,t)=>t===`
|
|
7
|
-
`?e:e.replaceAll(`
|
|
8
|
-
`,`\r
|
|
9
|
-
`),Ln=3,Me=Object.freeze({kind:"idle"}),jn=({data:e,conflictLabels:t,onSaveSettled:n,previewSetting:r})=>{const o=new Map,s=new Map,a=new Map,u=new Map,v=new Map,m=ae();let f=null,p=null;const h=(c,d)=>{c.value={...c.value,...d},m.emit()},R=(c,d)=>o.get(c)===d,L=async(c,d)=>{d.controller.abort(),d.controller=new AbortController;const{signal:g}=d.controller;h(d,{phase:{kind:"opening"}});const x=await e.edit(c,g);if(!R(c,d)||g.aborted||!("kind"in x))return;if(x.kind==="grant"){h(d,{phase:{kind:"grant",href:x.href}});return}if(x.kind==="failure"){h(d,{phase:{kind:"failed",failure:x.failure}});return}const k=je(x.text);d.base={text:k,version:x.version},d.draft=k,d.ending=st(x.text),h(d,{phase:{kind:"editing"},history:x.history,dirty:!1,save:Me,generation:d.value.generation+1})},S=c=>{const d=o.get(c);d!==void 0&&(d.controller.abort(),o.delete(c),a.delete(c))},C=(c,d,g)=>(c.set(d,g),()=>{c.get(d)===g&&c.delete(d)}),M=(c,d,g,x={})=>{h(d,{...x,save:g}),n(c,g)},O=async c=>{u.get(c)?.flush();const d=o.get(c);if(d===void 0||d.value.phase.kind!=="editing"||d.base===null||d.value.save.kind==="saving")return;const g=ot(d.draft).length;if(g>0){M(c,d,{kind:"conflicts",count:g});return}d.controller.abort(),d.controller=new AbortController;const{signal:x}=d.controller;let k=d.base,j=d.draft,A=!1;h(d,{save:{kind:"saving"}});for(let D=0;D<Ln;D+=1){const F=await e.save(c,k.version,An(j,d.ending),x);if(!R(c,d)||x.aborted||!("kind"in F))return;if(F.kind==="saved"){u.get(c)?.flush(),d.base={text:j,version:F.version},M(c,d,{kind:"saved",merged:A},{dirty:d.draft!==j});return}if(F.kind==="grant"){M(c,d,{kind:"grant",href:F.href});return}if(F.kind==="failure"){M(c,d,{kind:"failed",failure:F.failure});return}const{mergeDraft:z}=await Promise.resolve().then(()=>require("./merge-DRGBbLuR.cjs"));if(!R(c,d)||x.aborted)return;const V=u.get(c);V?.flush();const W=je(F.text),Z=z(k.text,d.draft,W,t());if(k={text:W,version:F.version},d.base=k,d.ending=st(F.text),d.draft=Z.text,V?.adopt(Z.text),Z.kind==="conflicts"){M(c,d,{kind:"conflicts",count:Z.conflicts},{dirty:!0,generation:d.value.generation+1});return}if(A=!0,j=Z.text,j===k.text){M(c,d,{kind:"saved",merged:A},{dirty:!1,generation:d.value.generation+1});return}h(d,{dirty:!0,generation:d.value.generation+1})}M(c,d,{kind:"failed",failure:{reason:"failed"}})};return{session:c=>o.get(c)?.value,subscribe:m.subscribe,start:(c,d)=>{const g=o.get(c);if(g!==void 0){h(g,{request:{anchor:d}}),(g.value.phase.kind==="failed"||g.value.phase.kind==="grant")&&L(c,g);return}s.delete(c);const x={value:{path:c,phase:{kind:"opening"},history:!1,dirty:!1,save:Me,generation:0,request:{anchor:d}},base:null,draft:"",ending:`
|
|
10
|
-
`,controller:new AbortController};o.set(c,x),L(c,x)},retry:c=>{const d=o.get(c);d===void 0||d.value.phase.kind==="editing"||L(c,d)},draft:c=>{const d=o.get(c);return d===void 0||d.base===null?null:d.draft},setDraft:(c,d)=>{const g=o.get(c);if(g===void 0||g.base===null)return;g.draft=d;const x={},k=d!==g.base.text;k!==g.value.dirty&&(x.dirty=k);const{save:j}=g.value;if(j.kind==="conflicts"){const A=ot(d).length;A===0?x.save=Me:A!==j.count&&(x.save={kind:"conflicts",count:A})}(x.dirty!==void 0||x.save!==void 0)&&h(g,x)},consumeRequest:c=>{const d=o.get(c);d!==void 0&&d.value.request!==null&&h(d,{request:null})},save:O,replaceDraft:(c,d)=>{const g=u.get(c);g?.flush();const x=o.get(c);if(x===void 0||x.base===null)return;const k=je(d);x.draft=k,g?.adopt(k),h(x,{dirty:k!==x.base.text,generation:x.value.generation+1})},close:c=>{if(!o.has(c))return;const d=u.get(c),g=d===void 0?null:d.returnPoint();S(c),g===null?s.delete(c):s.set(c,g),m.emit()},takeReturn:c=>{const d=s.get(c)??null;return s.delete(c),d},dirtyPaths:()=>[...o.values()].filter(c=>c.value.dirty).map(c=>c.value.path),discard:c=>{for(const d of c)S(d);c.length>0&&m.emit()},editorState:{get:c=>a.get(c),set:(c,d)=>{o.has(c)&&a.set(c,d)}},bindEditor:(c,d)=>C(u,c,d),bindView:(c,d)=>C(v,c,d),viewAnchor:c=>{const d=v.get(c);return d===void 0?null:d.anchor()},flush:c=>u.get(c)?.flush(),flushDrafts:()=>{for(const c of u.values())c.flush()},nextConflict:c=>u.get(c)?.nextConflict()===!0,hasSessions:()=>o.size>0,unsavedAmong:c=>{for(const d of u.values())d.flush();return c.filter(d=>o.get(d)?.value.dirty===!0)},askToDiscard:c=>new Promise(d=>{p?.settle(!1);const g={paths:c,settle:x=>{if(p===g){if(p=null,x)for(const k of c)S(k);m.emit(),d(x)}}};p=g,m.emit()}),discardRequest:()=>p,previewShown:()=>(f??=r.read(),f),setPreviewShown:c=>{f!==c&&(f=c,r.write(c),m.emit())}}},Ve=e=>{e.preventDefault(),e.stopPropagation()},Ft=({open:e,title:t,body:n,confirmLabel:r,cancelLabel:o,onConfirm:s,onCancel:a,testId:u})=>{const v=i.useRef(null),m=i.useRef(null),f=i.useRef(null),p=i.useId(),h=i.useId();i.useLayoutEffect(()=>{const S=v.current;if(S!==null)if(e&&!S.open){const C=S.ownerDocument.activeElement;f.current=C instanceof HTMLElement?C:null,S.showModal(),m.current?.focus()}else!e&&S.open&&(S.close(),f.current?.isConnected===!0&&f.current.focus(),f.current=null)},[e]);const R=S=>{S.key!=="Escape"||S.defaultPrevented||(Ve(S),a())},L=S=>{S.target===S.currentTarget&&a()};return l.jsx("dialog",{ref:v,className:"aqmx-confirm","aria-labelledby":p,"aria-describedby":h,"data-testid":u,onKeyDown:R,onClick:L,onCancel:S=>S.preventDefault(),children:l.jsxs("div",{className:"aqmx-confirm-panel",children:[l.jsx("p",{id:p,className:"aqmx-confirm-title",children:t}),l.jsx("p",{id:h,className:"aqmx-confirm-body",children:n}),l.jsxs("div",{className:"aqmx-confirm-actions",children:[l.jsx("button",{ref:m,type:"button",className:"aqmx-callout-action","data-testid":`${u}-cancel`,onClick:a,children:o}),l.jsx("button",{type:"button",className:"aqmx-callout-action","data-aqmx-tone":"danger","data-testid":`${u}-confirm`,onClick:s,children:r})]})]})})},Mn=(e,t)=>{const n=X.matchPath({path:`${e.basePath}/*`,end:!0},t.pathname);if(n===null)return new Set;const{location:r}=q.resolveExplorerLocation(e,n.params["*"],new URLSearchParams(t.search));switch(r.view){case"tree":return new Set(r.doc===null?[]:[r.doc]);case"single":return new Set([r.doc]);case"multi":return new Set(r.docs)}},$t=e=>{const{edits:t}=P(),n=i.useCallback(()=>t.session(e),[t,e]);return i.useSyncExternalStore(t.subscribe,n,Nn)},qt=()=>!1,Nn=()=>{},Dn=()=>{const{edits:e}=P();return i.useSyncExternalStore(e.subscribe,e.hasSessions,qt)},It=()=>{const{edits:e}=P();return i.useSyncExternalStore(e.subscribe,e.previewShown,qt)},Pn=()=>null,_n=()=>{const{edits:e,labels:t,config:n}=P(),r=i.useRef([]),o=i.useCallback(({nextLocation:p})=>{const h=Mn(n,p);return e.flushDrafts(),r.current=e.dirtyPaths().filter(R=>!h.has(R)),r.current.length>0},[e,n]),s=X.useBlocker(o),a=Dn();i.useEffect(()=>{if(!a)return;const p=h=>{e.flushDrafts(),e.dirtyPaths().length!==0&&(h.preventDefault(),h.returnValue=!0)};return window.addEventListener("beforeunload",p),()=>window.removeEventListener("beforeunload",p)},[a,e]);const u=i.useSyncExternalStore(e.subscribe,e.discardRequest,Pn),v=s.state==="blocked",f=(v?r.current:u===null?[]:u.paths).map(p=>N.lastPathSegment(p)).join(", ");return l.jsx(Ft,{open:v||u!==null,title:t.unsavedTitle,body:t.unsavedBody(f),confirmLabel:t.unsavedDiscard,cancelLabel:t.unsavedStay,testId:"markdown-explorer-unsaved-guard",onConfirm:()=>{if(s.state==="blocked"){e.discard(r.current),s.proceed();return}u?.settle(!0)},onCancel:()=>{if(s.state==="blocked"){s.reset();return}u?.settle(!1)}})};function Fn({title:e,titleId:t,...n},r){return b.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?b.createElement("title",{id:t},e):null,b.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 $n=b.forwardRef(Fn);let Ne=null;const Bt=()=>(Ne??=Promise.resolve().then(()=>require("./EditSurface-BztcpQPW.cjs")).catch(e=>{throw Ne=null,e}),Ne),qn=()=>{Bt().catch(()=>{})},In=e=>{const{default:t}=i.use(Bt());return l.jsx(t,{...e})};class Bn extends i.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}retry=()=>this.setState({failed:!1});render(){return this.state.failed?this.props.fallback(this.retry):this.props.children}}const Ge=`[${$e.SOURCE_LINES_ATTRIBUTE}]`,Hn="[data-aqmd-content]",Un='a[href], button, input, select, textarea, summary, label, [contenteditable], [role="menu"], iframe, video, audio, object, embed, svg',zn=200,fe=e=>$e.parseSourceLines(e.getAttribute($e.SOURCE_LINES_ATTRIBUTE)),Zn=(e,t)=>{for(let r=e;r!==null&&t.contains(r);r=r.parentElement){const o=fe(r);if(o!==null)return{block:r,lines:o,own:!0}}let n=null;for(const r of t.querySelectorAll(Ge)){if(!(r.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING))break;const o=fe(r);o!==null&&(n={block:r,lines:o})}return n===null?null:{...n,own:!1}},Vn=(e,t)=>{let n=0;for(let r=e.indexOf(t);r>=0;r=e.indexOf(t,r+t.length))n+=1;return n},Gn=e=>e.closest(Hn)!==null&&e.closest(Un)===null,Kn=(e,t,n)=>{const r=Zn(e,t);if(r===null)return null;const{block:o,own:s}=r;if(!s){const u=r.lines.last+1;return{lines:{first:u,last:u},word:null,occurrence:0,clientTop:Ee(e)}}const a=Xn(o,n);return a===null?{lines:r.lines,word:null,occurrence:0,clientTop:Ee(o)}:{lines:r.lines,word:a.text,occurrence:a.occurrence,clientTop:a.clientTop}},Wn=(e,t)=>{let n=null,r=null,o=null;for(const a of e.querySelectorAll(Ge)){const u=fe(a);if(u===null)continue;n??=Ut(t,a);const{top:v,bottom:m}=a.getBoundingClientRect();v<=n&&n<m?r={lines:u,block:a}:o===null&&v>=n&&(o={lines:u,block:a})}const s=r===null?o:r;return s===null?null:{lines:s.lines,word:null,occurrence:0,clientTop:Ee(s.block)}},Ht=e=>e===e.ownerDocument.scrollingElement?0:e.getBoundingClientRect().top+e.clientTop,Ut=(e,t)=>{const n=Number.parseFloat(getComputedStyle(t).scrollMarginTop);return Ht(e)+(Number.isFinite(n)?n:0)},Xn=(e,t)=>{if(t===null||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(!(e.contains(n.startContainer)&&e.contains(n.endContainer)))return null;const r=n.toString().trim();if(r===""||r.length>zn||/[\r\n]/u.test(r))return null;const o=e.ownerDocument.createRange();return o.setStart(e,0),o.setEnd(n.startContainer,n.startOffset),{text:r,occurrence:Vn(o.toString(),r),clientTop:n.getBoundingClientRect().top}},Yn=(e,t)=>{const n=e.split(`
|
|
11
|
-
`),r=Math.min(t.lines.first,n.length),o=Math.min(t.lines.last,n.length),s={line:r,column:0};if(t.word===null)return s;let a=0;for(let u=r;u<=o;u+=1){const v=n[u-1]??"";for(let m=v.indexOf(t.word);m>=0;m=v.indexOf(t.word,m+t.word.length)){if(a===t.occurrence)return{line:u,column:m};a+=1}}return a>0?Qn(n,r,o,t.word)??s:s},Qn=(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},Jn=(e,t)=>{let n=null,r=null;for(const o of e.querySelectorAll(Ge)){const s=fe(o);s===null||s.first>t||(s.last>=t?n=o:(r===null||s.last>=r.last)&&(r={element:o,last:s.last}))}return n!==null?n:r===null?null:r.element},er=(e,t)=>{const{bottom:n}=e.getBoundingClientRect(),r=Ee(e),o=fe(e);if(o===null)return r;const s=Math.min(Math.max(t-o.first,0)/(o.last-o.first+1),1);return r+(n-r)*s},Ee=e=>{const t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(let n=t.nextNode();n!==null;n=t.nextNode()){const o=(n.textContent??"").search(/\S/u);if(o<0)continue;const s=e.ownerDocument.createRange();s.setStart(n,o),s.setEnd(n,o+1);const{top:a,height:u}=s.getBoundingClientRect();if(u>0)return a}return e.getBoundingClientRect().top},Ke=Object.freeze({browse:Object.freeze({replace:!0,preventScrollReset:!0,defaultShouldRevalidate:!1}),"switch-source":Object.freeze({replace:!1,preventScrollReset:!0,defaultShouldRevalidate:!1}),"switch-view":Object.freeze({replace:!1,preventScrollReset:!1,defaultShouldRevalidate:!1}),"follow-link":Object.freeze({replace:!1,preventScrollReset:!1,defaultShouldRevalidate:!1})}),tr=e=>Ke[e],he=()=>{const e=X.useNavigate();return i.useCallback((t,n)=>{e(t,Ke[n])},[e])},zt=({navigation:e,...t})=>l.jsx(X.Link,{...t,...Ke[e]}),We=e=>{const t=e.ownerDocument;if(e.focus({preventScroll:!0}),t.activeElement===e)return!0;if(e.hasAttribute("tabindex"))return!1;if(e.setAttribute("tabindex","-1"),e.focus({preventScroll:!0}),t.activeElement!==e)return e.removeAttribute("tabindex"),!1;const n=()=>{t.activeElement!==e&&(e.removeAttribute("tabindex"),e.removeEventListener("blur",n))};return e.addEventListener("blur",n),!0},Zt=(e,t)=>{const n=i.useRef(null),r=i.useRef(null),o=i.useRef(null),s=i.useCallback(()=>{n.current!==null&&window.clearTimeout(n.current),n.current=null,r.current=null},[]);i.useEffect(()=>s,[s]);const a=i.useCallback(m=>{if(r.current!==m)return;const f=o.current;if(f!==null){f.then(()=>a(m));return}e.prefetch(m);const p=e.peek(m);if(p?.status!=="pending")return;const h=Promise.allSettled([p.promise]);o.current=h,h.then(()=>{o.current===h&&(o.current=null)})},[e]),u=i.useCallback(m=>{const f=t(m);f!==r.current&&(s(),f!==null&&(r.current=f,n.current=window.setTimeout(()=>{n.current=null,a(f)},q.PREFETCH_DWELL_MS)))},[s,t,a]),v=i.useCallback(m=>{t(m)!==r.current&&s()},[s,t]);return i.useMemo(()=>({onPointerOver:m=>u(m.target),onPointerOut:m=>v(m.relatedTarget),onFocus:m=>u(m.target),onBlur:m=>v(m.relatedTarget)}),[u,v])},nr=i.lazy(()=>Promise.resolve().then(()=>require("./NativeScrollBar-B7jTbQmn.cjs")).then(e=>({default:e.NativeScrollBar})));class rr extends i.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(t){console.error("[markdown-explorer] a scroll bar failed to load or render; its scroller keeps its native scrolling without it.",t)}render(){return this.state.failed?null:this.props.children}}const Vt=({scroller:e,withCircle:t})=>l.jsx(rr,{children:l.jsx(i.Suspense,{fallback:null,children:l.jsx(nr,{scroller:e,withCircle:t})})}),Gt=e=>l.jsx(Vt,{scroller:e,withCircle:!0}),Kt=()=>{const e=new Map,t=new Set;let n=!1;const r=o=>{t.add(o),!n&&(n=!0,queueMicrotask(()=>{n=!1,t.clear()}))};return{hold:o=>{e.set(o,(e.get(o)??0)+1);let s=!1;return()=>{if(s)return;s=!0;const a=e.get(o);if(a!==void 0&&a>1){e.set(o,a-1);return}e.delete(o),r(o)}},isHeld:o=>e.has(o),resumes:o=>t.delete(o),heldKeys:()=>[...e.keys()]}},be=(e,t)=>{if(Object.is(e,t))return!0;if(typeof e!="object"||typeof t!="object"||e===null||t===null)return!1;if(Array.isArray(e)||Array.isArray(t))return!(Array.isArray(e)&&Array.isArray(t))||e.length!==t.length?!1:e.every((s,a)=>be(s,t[a]));const n=e,r=t,o=Object.keys(n);return o.length!==Object.keys(r).length?!1:o.every(s=>Object.hasOwn(r,s)&&be(n[s],r[s]))},me=e=>{const t=e;return t.status===void 0&&(t.status="pending",e.then(n=>{t.status="fulfilled",t.value=n},n=>{t.status="rejected",t.reason=n})),t},Wt=e=>Object.assign(Promise.resolve(e),{status:"fulfilled",value:e}),ge=e=>e.status==="fulfilled"?e.value:void 0,or=55e3,lt=Object.freeze({status:"deferred"}),it=Object.freeze({status:"refreshed"}),De=Object.freeze({status:"superseded"}),re=e=>e===void 0||e.status==="deferred"?null:e.status==="loaded"?e:e.previous,Xt=e=>e!==void 0&&e.status==="loaded"&&e.document.kind!=="failure",sr=({client:e,capacity:t})=>{if(!Number.isInteger(t)||t<1)throw new RangeError(`[markdown-explorer] the document cache capacity must be a positive integer; got ${String(t)}`);const n=new Map,r=Kt(),o=ae(),s=new WeakSet;let a=0;const u=o.emit,v=()=>(a+=1,a),m=()=>{if(!(n.size<=t))for(const c of[...n.keys()]){if(n.size<=t)return;r.isHeld(c)||n.delete(c)}},f=(c,d)=>{n.delete(c),n.set(c,d)},p=c=>performance.now()-c.validatedAt>=or,h=(c,d,g)=>{const x=n.get(c),k=re(x?.snapshot),j=g||x?.refreshPending===!0,A=me(e.document(c,{refresh:j}).then(F=>({status:"loaded",document:F}))),D={snapshot:{status:"pending",promise:A,previous:k},validatedAt:performance.now(),opened:d,background:null,refreshPending:!1,seeded:void 0,stamp:v()};return f(c,D),m(),A.then(F=>{n.get(c)===D&&(D.snapshot=F,D.stamp=v(),u())}),D},R=(c,d,g,x,k,j)=>{d.background===g&&(d.background=null,!(n.get(c)!==d||d.snapshot!==x)&&(k.kind==="failure"&&x.document.kind!=="failure"||(d.validatedAt=j,d.stamp=v(),be(x.document,k)||(d.snapshot={status:"loaded",document:k}),u())))},L=async(c,d)=>{const g=d.snapshot;if(g.status!=="loaded")return null;const x={};d.background=x;const k=performance.now(),j=e.document(c,{refresh:d.refreshPending});d.refreshPending=!1;const A=await j,D=d.background===x&&n.get(c)===d&&d.snapshot===g;return R(c,d,x,g,A,k),D?A:null},S=(c,d)=>{const{snapshot:g}=d;return g.status==="pending"?!1:g.status==="loaded"&&g.document.kind!=="failure"?(L(c,d),!1):(g.status==="loaded"&&s.add(g),h(c,!0,!1),!0)},C=c=>{const d=r.hold(c);let g=!1;return()=>{if(g)return;g=!0,d();const x=n.get(c);x!==void 0&&f(c,x),m()}};return{peek:c=>n.get(c)?.snapshot,peekSeeded:c=>n.get(c)?.seeded,answerStampOf:c=>n.get(c)?.stamp,prefetch:c=>{const d=n.get(c);d!==void 0&&d.snapshot.status!=="deferred"||(h(c,!1,!1),u())},open:c=>{const d=r.resumes(c),g=C(c),x=n.get(c);if(x===void 0||x.snapshot.status==="deferred")return h(c,!0,!1),u(),g;if(f(c,x),d)return g;const{snapshot:k}=x;return k.status==="pending"?(x.opened=!0,g):k.document.kind==="failure"?(x.opened||p(x)?(s.add(k),h(c,!0,!1),u()):x.opened=!0,g):(x.opened=!0,x.background===null&&p(x)&&L(c,x),g)},retain:C,retry:c=>{const d=n.get(c);d===void 0||d.snapshot.status!=="loaded"||d.snapshot.document.kind!=="failure"||(h(c,!0,!1),u())},seed:(c,d)=>{const g=performance.now(),x=me(d.then(F=>F===null?lt:{status:"loaded",document:F},()=>lt)),k=n.get(c);if(k!==void 0&&k.snapshot.status==="loaded"){const F=k.snapshot,z={};k.background=z,x.then(V=>{if(V.status==="loaded"){R(c,k,z,F,V.document,g);return}k.background===z&&(k.background=null)});return}const j=k!==void 0&&k.snapshot.status==="pending"?k.snapshot.previous:null,A={status:"pending",promise:x,previous:j},D={snapshot:A,validatedAt:g,opened:k?.opened===!0,background:null,refreshPending:k?.refreshPending===!0,seeded:A,stamp:v()};f(c,D),m(),x.then(F=>{n.get(c)===D&&(F.status==="deferred"&&r.isHeld(c)?h(c,D.opened,!1):(D.snapshot=F,D.stamp=v()),u())})},invalidate:()=>{let c=!1;for(const[d,g]of[...n]){if(g.validatedAt=Number.NEGATIVE_INFINITY,g.opened=!0,g.refreshPending=!0,!r.isHeld(d))continue;const{snapshot:x}=g;if(x.status!=="pending"){S(d,g)&&(c=!0);continue}x.promise.then(()=>{n.get(d)===g&&g.refreshPending&&r.isHeld(d)&&S(d,g)&&u()})}c&&u()},refresh:async c=>{const d=n.get(c);if(d!==void 0&&Xt(d.snapshot)){d.refreshPending=!0;const x=await L(c,d);return x===null?De:x.kind==="failure"?{status:"failed",failure:x.failure}:it}const g=h(c,!0,!0);return u(),g.snapshot.status!=="pending"?De:(await g.snapshot.promise,n.get(c)===g?it:De)},clear:()=>{n.clear();for(const c of r.heldKeys())h(c,!0,!1);u()},subscribe:o.subscribe,noteFailureShown:c=>s.has(c)?!1:(s.add(c),!0)}};function lr({title:e,titleId:t,...n},r){return b.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?b.createElement("title",{id:t},e):null,b.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"}),b.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 ir=b.forwardRef(lr);function ar({title:e,titleId:t,...n},r){return b.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?b.createElement("title",{id:t},e):null,b.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"}),b.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 cr=b.forwardRef(ar);function dr({title:e,titleId:t,...n},r){return b.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?b.createElement("title",{id:t},e):null,b.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 ur=b.forwardRef(dr),fr=2e3,at=Object.freeze({outcome:"idle"}),mr=e=>{const t=navigator.clipboard;return t===void 0?Promise.reject(new Error("[markdown-explorer] this browser has no asynchronous clipboard")):t.writeText(e)},hr=({text:e})=>{const{announcer:t,labels:n}=P(),[r,o]=i.useState(at);i.useEffect(()=>{if(r.outcome==="idle")return;const v=setTimeout(()=>o(at),fr);return()=>clearTimeout(v)},[r]);const s=v=>{o({outcome:v}),t.announce(v==="copied"?n.copiedText:n.copyTextFailed)},a=()=>{mr(e).then(()=>s("copied"),()=>s("failed"))},u=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:u,onClick:a,"data-aqmx-copy-outcome":r.outcome,"data-testid":"markdown-explorer-file-copy",children:r.outcome==="copied"?l.jsx(ir,{}):r.outcome==="failed"?l.jsx(ur,{}):l.jsx(cr,{})})},ie=i.createContext("fill"),pr=Object.freeze({blockSize:"100%"}),pe=({scrollerProps:e,children:t})=>i.use(ie)==="content"?l.jsx(de.HostedScrollArea,{scrollerProps:e,children:t}):l.jsx(de.HostedScrollArea,{scrollerProps:{...e,style:pr},rowClassName:"aqmx-document-scroll-row",renderScrollBar:Gt,children:t});function gr({title:e,titleId:t,...n},r){return b.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?b.createElement("title",{id:t},e):null,b.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"}),b.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 vr=b.forwardRef(gr);function wr({title:e,titleId:t,...n},r){return b.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?b.createElement("title",{id:t},e):null,b.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"}),b.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 xr=b.forwardRef(wr),ke=({name:e,openUrl:t,downloadUrl:n,icon:r,children:o})=>{const{labels:s}=P();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(xr,{})}),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(vr,{})})]})};function Er({title:e,titleId:t,...n},r){return b.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?b.createElement("title",{id:t},e):null,b.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 br=b.forwardRef(Er),yr=Object.freeze({className:"aqmx-document-stage"}),Sr=({document:e})=>{const{labels:t}=P();return l.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-file-view",children:[l.jsx(ke,{name:e.name,openUrl:e.url,downloadUrl:e.url,icon:l.jsx(br,{})}),l.jsx(pe,{scrollerProps:yr,children:l.jsxs("div",{className:"aqmx-callout",role:"note","data-testid":"markdown-explorer-file-not-shown",children:[l.jsx("p",{className:"aqmx-callout-body",children:t.fileNotShown}),l.jsx("a",{className:"aqmx-callout-action",href:e.url,download:e.name,"data-testid":"markdown-explorer-file-not-shown-download",children:t.download})]})})]})},Re="[data-aqmd-scroll-container], [data-aqmx-document-scroller]",kr=e=>{const t=e.indexOf("#");return t===-1?"":e.slice(t)},Rr=/(%[0-9A-Fa-f]{2})/u,Xe=e=>{if(!e.startsWith("#")||e.length===1)return null;const t=new TextEncoder,n=e.slice(1).split(Rr).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))},Yt=e=>`#${encodeURIComponent(e)}`,Tr=e=>{if(e==="#")return!0;const t=Xe(e);return t!==null&&t.replace(/[A-Z]/gu,n=>n.toLowerCase())==="top"},Qt=(e,t)=>{if(t==="")return null;for(const n of e.querySelectorAll("[id]"))if(n.id===t)return n;return null},Cr="http://www.w3.org/1999/xhtml",ct=(e,t)=>{if(t==="")return null;const n=Qt(e,t);if(n!==null)return n;for(const r of e.querySelectorAll("a[name]"))if(r.localName==="a"&&r.namespaceURI===Cr&&r.getAttribute("name")===t)return r;return null},Jt=(e,t)=>{if(e===null||!t.startsWith("#"))return null;const n=ct(e,t.slice(1));if(n!==null)return n;const r=Xe(t);return r===null?null:ct(e,r)},dt=e=>{const{body:t,documentElement:n}=e.ownerDocument;if(e===t){const o=getComputedStyle(n);if(o.overflowX==="visible"&&o.overflowY==="visible")return!1}const{overflowY:r}=getComputedStyle(e);return r==="auto"||r==="scroll"},Or=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"},Ar=(e,t)=>{const n=t.closest(Re),r=n!==null&&e.contains(n)?n:e;if(r.scrollHeight>r.clientHeight&&dt(r))return r;const o=e.getBoundingClientRect().height,{documentElement:s,scrollingElement:a}=e.ownerDocument;for(let u=e.parentElement;u!==null&&u!==s;u=u.parentElement)if(dt(u)&&u.scrollHeight>u.clientHeight&&u.clientHeight<o)return u;return a instanceof Element&&Or(e.ownerDocument)&&a.scrollHeight>a.clientHeight&&a.clientHeight<o?a:r},Lr=Object.freeze({scrollerOf:Ar,reveal:e=>{e.scrollIntoView(He)}}),He=Object.freeze({block:"nearest",inline:"nearest",behavior:"instant"}),jr=(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")}}},Mr=(e,t)=>{if(t.getClientRects().length===0)return;const n=e===e.ownerDocument.scrollingElement?0:e.getBoundingClientRect().top+e.clientTop,{scrollMarginTop:r,scrollMarginBottom:o}=getComputedStyle(t),s=Number.parseFloat(r),a=t.getBoundingClientRect(),u=a.height+s+Number.parseFloat(o)>e.clientHeight;if(!u&&Math.abs(a.top-s-n)<1){t.scrollIntoView(He);return}e.scrollBy({top:u?a.top-n-e.clientHeight:a.bottom-n+e.clientHeight,behavior:"instant"}),t.scrollIntoView(He)},Nr=(e,t)=>{const n=t.scrollerOf(e,e.querySelector(Re)??e);n.getClientRects().length!==0&&(n.scrollTo({top:0,left:0,behavior:"instant"}),t.reveal(n))},ut=(e,t,n)=>{if(e===null)return null;const r=Jt(e,t);return r===null?(Tr(t)&&Nr(e,n),null):(jr(e,r),Mr(n.scrollerOf(e,r),r),n.reveal(r),r)};function Dr({title:e,titleId:t,...n},r){return b.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?b.createElement("title",{id:t},e):null,b.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 Pr=b.forwardRef(Dr);function _r({title:e,titleId:t,...n},r){return b.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?b.createElement("title",{id:t},e):null,b.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"}),b.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 Fr=b.forwardRef(_r);function $r({title:e,titleId:t,...n},r){return b.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?b.createElement("title",{id:t},e):null,b.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"}),b.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 qr=b.forwardRef($r);function Ir({title:e,titleId:t,...n},r){return b.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?b.createElement("title",{id:t},e):null,b.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 Br=b.forwardRef(Ir),Ue="data-aqmx-key-repeat",ye=Object.freeze({[Ue]:"allow"}),Hr=`[${Ue}="${ye[Ue]}"]`,Ur=()=>{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(Hr)!==null||(t.preventDefault(),t.stopPropagation())}},onKeyUpCapture:t=>{t.key==="Enter"&&(e=null)},onBlurCapture:t=>{t.target===e&&(e=null)}}},xe=Object.freeze([1/q.GOLDEN_RATIO**2,1/q.GOLDEN_RATIO,1,q.GOLDEN_RATIO,q.GOLDEN_RATIO**2]),ft=Object.freeze({mode:"fit"}),zr=1,Zr=Object.freeze({className:"aqmx-document-canvas","data-testid":"markdown-explorer-image-canvas"}),en=i.createContext(null),Vr=(e,t)=>e.width>0&&e.height>0&&t.width-e.width<=zr?{base:e,scale:t.width/e.width}:t.width>0&&t.height>0?{base:t,scale:1}:null,mt=(e,t,n)=>{if(e.mode==="level"){const o=e.index+n;return o>=0&&o<xe.length?o:null}if(t===null||!Number.isFinite(t)||t<=0)return null;const r=n===1?xe.findIndex(o=>o>t):xe.findLastIndex(o=>o<t);return r===-1?null:r},ht=(e,t,n)=>{if(e.mode==="level"){const o=mt(e,null,n);return o===null?null:{mode:"level",index:o,base:e.base}}if(t===null)return null;const r=mt(e,t.scale,n);return r===null?null:{mode:"level",index:r,base:t.base}},Gr=e=>{const t=xe[e];if(t===void 0)throw new RangeError(`[markdown-explorer] no image zoom step ${String(e)}`);return t},pt=(e,t,n)=>e!==null&&e.width===t&&e.height===n?e:{width:t,height:n},Kr=({document:e})=>{const{labels:t}=P(),n=i.use(en),[r]=i.useState(()=>n===null?null:n.read(e.url)),[o,s]=i.useState(r===null?ft:r.zoom),[a,u]=i.useState(r===null?null:r.reported),[v,m]=i.useState(null),f=i.useRef(null),p=i.useCallback(O=>{const{naturalWidth:c,naturalHeight:d}=O;u(g=>pt(g,c,d))},[]),h=i.useCallback(O=>{f.current=O,!(O===null||!O.complete)&&(O.naturalWidth>0||O.naturalHeight>0?p(O):O.decode().then(()=>p(O),()=>{}))},[p]);i.useEffect(()=>{n!==null&&a!==null&&n.save(e.url,{zoom:o,reported:a})},[n,e.url,o,a]),i.useLayoutEffect(()=>{const O=f.current;if(O===null||a===null||o.mode!=="fit")return;const c=()=>m(g=>pt(g,O.clientWidth,O.clientHeight));if(c(),typeof ResizeObserver>"u")return;const d=new ResizeObserver(c);return d.observe(O),()=>d.disconnect()},[a,o.mode]);const R=a===null||v===null?null:Vr(a,v),L=ht(o,R,-1),S=ht(o,R,1),C=o.mode==="level"?Gr(o.index):null,M=o.mode==="level"&&C!==null?{width:`${o.base.width*C}px`,height:`${o.base.height*C}px`}:void 0;return l.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-image-view",children:[l.jsxs(ke,{name:e.name,openUrl:e.url,downloadUrl:e.url,icon:l.jsx(Br,{}),children:[l.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageZoomOut,title:t.imageZoomOut,"aria-disabled":L===null,onClick:()=>{L!==null&&s(L)},...ye,children:l.jsx(Fr,{})}),l.jsx("output",{className:"aqmx-document-level","aria-live":"polite","data-testid":"markdown-explorer-image-level",children:C===null?t.imageFitLevel:t.imageZoomLevel(Math.round(C*100))}),l.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageZoomIn,title:t.imageZoomIn,"aria-disabled":S===null,onClick:()=>{S!==null&&s(S)},...ye,children:l.jsx(qr,{})}),l.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageFit,title:t.imageFit,"aria-pressed":o.mode==="fit",onClick:()=>s(ft),children:l.jsx(Pr,{})})]}),l.jsx(pe,{scrollerProps:Zr,children:l.jsx("img",{ref:h,className:"aqmx-document-image",src:e.url,alt:e.name,"data-aqmx-image-mode":o.mode,style:M,onLoad:O=>p(O.currentTarget),"data-testid":"markdown-explorer-image"})})]})},tn=i.createContext(null),Te=i.createContext(void 0),nn=i.createContext(null),Ce=()=>{const e=i.use(tn);if(e===null)throw new Error("[markdown-explorer] document links must be rendered inside a document pane");return e},Wr=()=>{const e=i.use(nn);if(e===null)throw new Error("[markdown-explorer] table-of-contents entries must be rendered inside a document pane's links");return e},Oe=(e,t,n,r)=>t.kind==="panel"?q.explorerHref(e,{view:"tree",source:n,doc:r}):t.view==="single"?q.explorerHref(e,{view:"single",source:n,doc:r,overrides:t.overrides,embed:t.embed}):q.explorerHref(e,{view:"tree",source:n,doc:r,overrides:t.overrides}),Xr=({children:e})=>{const{config:t}=P(),n=Ce(),r=Se(),o=r.kind==="location"?r.location.source:void 0,s=X.useHref(Oe(t,n.navigation,o,n.currentPath));return l.jsx(Te,{value:o,children:l.jsx(nn,{value:s,children:e})})},Yr='a[data-link-kind="doc"][data-doc-path]:not([data-doc-exists="false"])',Qr=e=>{const t=e instanceof Element?e.closest(Yr):null;return t===null?null:t.getAttribute("data-doc-path")},Ae=e=>!e.defaultPrevented&&e.button===0&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey,Jr=({to:e,docPath:t,fragment:n,exists:r,className:o,attributes:s,onDocumentLink:a,scope:u,children:v})=>{const m=X.useHref(e),f=p=>{if(Ae(p)){if(p.preventDefault(),t===u.currentPath&&n!==""){u.scrollWithin(n);return}a(t,n)}};return l.jsx("a",{...s,href:m,className:o,"data-link-kind":"doc","data-doc-path":t,"data-doc-exists":r,onClick:f,children:v})},eo=({href:e,docPath:t,docExists:n,className:r,attributes:o,children:s})=>{const{config:a}=P(),u=Ce(),v=i.use(Te),m=kr(e),{navigation:f}=u,p=`${Oe(a,f,v,t)}${m}`,h=n===!1?"false":void 0;return f.kind==="page"?l.jsx(zt,{...o,to:p,navigation:"follow-link",className:r,"data-link-kind":"doc","data-doc-path":t,"data-doc-exists":h,children:s}):l.jsx(Jr,{to:p,docPath:t,fragment:m,exists:h,className:r,attributes:o,onDocumentLink:f.onDocumentLink,scope:u,children:s})},to=({className:e,attributes:t,children:n})=>{const{labels:r}=P();return l.jsxs("a",{...t,className:e===void 0?"aqmx-document-inert-link":`${e} aqmx-document-inert-link`,title:r.inertLink,"data-link-kind":"doc","data-doc-exists":"false",children:[n,l.jsxs("span",{className:"aqmx-sr-only",children:[" (",r.inertLink,")"]})]})},no=({href:e,className:t,attributes:n,scope:r,children:o})=>{const{config:s}=P(),a=i.use(Te),u=X.useHref(`${Oe(s,r.navigation,a,r.currentPath)}${e}`),v=m=>{Ae(m)&&(m.preventDefault(),r.scrollWithin(e))};return l.jsx("a",{...n,href:u,className:t,onClick:v,children:o})},ro=({href:e,className:t,attributes:n,children:r})=>{const o=Ce();if(o.navigation.kind==="page"){const s=a=>{if(!Ae(a))return;const u=a.currentTarget;e==="#"?o.followEmptyFragment(a.nativeEvent):u.href===u.ownerDocument.URL&&o.followSameUrlJump(e,a.nativeEvent)};return l.jsx("a",{...n,href:e,className:t,onClick:s,children:r})}return l.jsx(no,{href:e,className:t,attributes:n,scope:o,children:r})},oo=({href:e,kind:t,docPath:n,docExists:r,className:o,attributes:s,children:a})=>t==="doc"?n===void 0||!N.isAcceptableDocumentPath(n)?l.jsx(to,{className:o,attributes:s,children:a}):l.jsx(eo,{href:e,docPath:n,docExists:r,className:o,attributes:s,children:a}):e.startsWith("#")?l.jsx(ro,{href:e,className:o,attributes:s,children:a}):l.jsx("a",{...s,href:e,className:o,children:a}),so=()=>{const{config:e}=P(),t=Ce(),n=i.use(Te),r=he();return i.useCallback((o,s)=>{if(!Ae(s))return!0;s.preventDefault();const a=Yt(o.id),{navigation:u}=t;return u.kind==="panel"||Xe(s.currentTarget.ownerDocument.location.hash)===o.id?(t.scrollWithin(a),!0):(r(`${Oe(e,u,n,t.currentPath)}${a}`,"follow-link"),!0)},[e,t,n,r])},lo=()=>{const e=Wr();return i.useCallback(t=>`${e}${Yt(t.id)}`,[e])};function io({title:e,titleId:t,...n},r){return b.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?b.createElement("title",{id:t},e):null,b.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 ao=b.forwardRef(io);function co({title:e,titleId:t,...n},r){return b.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?b.createElement("title",{id:t},e):null,b.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 uo=b.forwardRef(co);function fo({title:e,titleId:t,...n},r){return b.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?b.createElement("title",{id:t},e):null,b.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 mo=b.forwardRef(fo),ho=Object.freeze({className:"aqmx-document-stage"}),po=e=>{switch(e){case"video":return l.jsx(uo,{});case"audio":return l.jsx(mo,{});case"pdf":return l.jsx(ao,{});default:{const t=e;throw new RangeError(`[markdown-explorer] unknown media type ${String(t)}`)}}},go=({document:e})=>{const{labels:t}=P();switch(e.mediaType){case"video":return l.jsx("video",{className:"aqmx-document-video",src:e.url,controls:!0,preload:"metadata","aria-label":e.name,"data-testid":"markdown-explorer-media-player",children:t.mediaUnsupported});case"audio":return l.jsx("audio",{className:"aqmx-document-audio",src:e.url,controls:!0,preload:"metadata","aria-label":e.name,"data-testid":"markdown-explorer-media-player",children:t.mediaUnsupported});case"pdf":return l.jsx("iframe",{className:"aqmx-document-frame",src:e.url,title:e.name,"data-testid":"markdown-explorer-media-player"});default:{const n=e.mediaType;throw new RangeError(`[markdown-explorer] unknown media type ${String(n)}`)}}},vo=({document:e})=>l.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-media-view","data-aqmx-media-type":e.mediaType,children:[l.jsx(ke,{name:e.name,openUrl:e.url,downloadUrl:e.url,icon:po(e.mediaType)}),l.jsx(pe,{scrollerProps:ho,children:l.jsx(go,{document:e})})]}),wo=e=>({loading:e.viewerLoading,errorPrefix:e.viewerErrorPrefix,styleTitle:e.viewerStyleTitle,selectStyleAria:e.viewerSelectStyle,pinStyleAria:e.viewerPinStyle,unpinStyleAria:e.viewerUnpinStyle,defaultErrorTitle:e.viewerErrorTitle,missingImage:e.viewerMissingImage,openTocAria:e.viewerOpenToc,tocTitle:e.viewerTocTitle,pinTocAria:e.viewerPinToc,unpinTocAria:e.viewerUnpinToc,selectAlignAria:e.viewerSelectAlign,alignTitle:e.viewerAlignTitle,pinAlignAria:e.viewerPinAlign,unpinAlignAria:e.viewerUnpinAlign,alignLeft:e.viewerAlignLeft,alignCenter:e.viewerAlignCenter,alignRight:e.viewerAlignRight,mermaidInteractionMode:e.viewerMermaidInteractionMode,mermaidModeNone:e.viewerMermaidModeNone,mermaidModeZoom:e.viewerMermaidModeZoom,mermaidModePan:e.viewerMermaidModePan,mermaidModePanShift:e.viewerMermaidModePanShift,mermaidModeBoth:e.viewerMermaidModeBoth,mermaidModeBothShift:e.viewerMermaidModeBothShift,mermaidZoomIn:e.viewerMermaidZoomIn,mermaidZoomOut:e.viewerMermaidZoomOut,mermaidResetView:e.viewerMermaidResetView,mermaidRetry:e.viewerMermaidRetry,embeddedVideo:e.viewerEmbeddedVideo,embeddedPost:e.viewerEmbeddedPost,embeddedFrame:e.viewerEmbeddedFrame}),rn=(e,t,n)=>{if(t!==void 0)return t;if(n!==void 0)return n;const[r]=e.documentStyles;if(r===void 0)throw new Error("[markdown-explorer] the configuration has no document style");return r.name},on=(e,t)=>e!==void 0?e:t!==void 0?t:xn.DEFAULT_CONTENT_ALIGN,Ye=Object.freeze(["l1","l2","l3","l4","l5","l6","l7","l8"]),xo=(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 q.explorerHref(e,{...t,overrides:r})},Qe=({kind:e,view:t,label:n,stale:r,busy:o,frameRef:s,intent:a,children:u})=>{const v=i.use(ie);return l.jsxs("section",{ref:s,role:"region","aria-label":n,"aria-busy":o,"data-testid":"markdown-explorer-document","data-aqmx-document-kind":e,"data-aqmx-document-view":t,"data-aqmx-document-flow":v,className:"aqmx-document",...a,children:[r?l.jsx("div",{className:"aqmx-progress","aria-hidden":"true","data-testid":"markdown-explorer-document-progress"}):null,u]})},Eo=()=>{const{labels:e}=P();return l.jsx(Qe,{kind:"empty",label:e.documentRegion,stale:!1,busy:!1,children:l.jsx("div",{className:"aqmx-empty","data-testid":"markdown-explorer-document-empty",children:l.jsx("p",{className:"aqmx-empty-title",children:e.documentEmpty})})})},sn=({label:e})=>{const{labels:t}=P();return l.jsxs(Qe,{kind:"loading",label:e,stale:!1,busy:!0,children:[l.jsx("div",{className:"aqmx-skeleton","aria-hidden":"true","data-testid":"markdown-explorer-document-skeleton",children:Ye.map(n=>l.jsx("span",{},n))}),l.jsx("p",{className:"aqmx-sr-only",children:t.documentLoading})]})},gt=Object.freeze(["wheel","touchstart","pointerdown","keydown"]),bo=({path:e,document:t,viewer:n,editing:r})=>{const{reportMathDiagnostics:o,edits:s}=P(),a=i.useMemo(()=>({htmlContent:t.htmlContent,headings:[...t.headings]}),[t]),u=so(),v=lo(),m=i.useMemo(()=>o===void 0?void 0:g=>o(e,g),[o,e]),f=i.useRef(null),{editable:p,doubleClick:h,region:R,paneScroll:L,stale:S}=r;i.useLayoutEffect(()=>{if(p)return s.bindView(e,{anchor:()=>{const g=f.current,x=R(),k=g===null?null:g.querySelector(Re);return g===null||x===null||k===null?null:Wn(g,L.scrollerOf(x,k))}})},[s,e,p,R,L]);const C=g=>{const x=f.current,{target:k}=g;!h||x===null||!(k instanceof Element)||!Gn(k)||(g.stopPropagation(),s.start(e,Kn(k,x,x.ownerDocument.getSelection())))},M=i.useRef(null),O=i.useRef(S);i.useLayoutEffect(()=>{O.current=S});const c=i.useEffectEvent(g=>{const x=f.current,k=R(),j=x===null?null:Jn(x,g.line);if(k===null||j===null)return!1;const A=L.scrollerOf(k,j);return A.scrollTop+=er(j,g.line)-g.clientTop,!0}),d=i.useEffectEvent(g=>{const x=R();if(x===null)return;const k=()=>{for(const A of gt)x.removeEventListener(A,j,!0);M.current?.release===k&&(M.current=null)},j=()=>k();for(const A of gt)x.addEventListener(A,j,{capture:!0,passive:!0});M.current={point:g,release:k}});return i.useLayoutEffect(()=>{const g=s.takeReturn(e);if(g!==null)return queueMicrotask(()=>{c(g)&&O.current&&d(g)}),()=>M.current?.release()},[s,e]),i.useLayoutEffect(()=>{const g=M.current;g===null||S||(g.release(),c(g.point))},[t,S]),l.jsx("div",{ref:f,className:"aqmx-document-viewer",onDoubleClick:C,children:l.jsx(de.MarkdownViewer,{...n,onHeadingSelect:u,headingHref:v,onMathDiagnostics:m,parseResult:a,content:null})})},ln=({document:e,viewer:t})=>{const{labels:n}=P();return l.jsxs(l.Fragment,{children:[l.jsx(ke,{name:e.name,openUrl:N.explorerPlainTextHref(e.url),downloadUrl:e.url,icon:l.jsx($n,{}),children:e.truncated?null:l.jsx(hr,{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(de.MarkdownViewer,{...t,parseResult:null,content:e.text})})]})},yo=({path:e,name:t,viewer:n})=>{const{data:r,documents:o,announcer:s,labels:a}=P(),u=i.useCallback(()=>o.answerStampOf(e),[o,e]),v=i.useSyncExternalStore(o.subscribe,u,u),[m,f]=i.useState(0),p=i.useMemo(()=>({path:e,stamp:v,attempt:m}),[e,v,m]),[h,R]=i.useState(null),L=i.useEffectEvent(C=>{R(C),C.kind==="failure"&&s.announce(a.documentFailed(t,te(a,C.failure.reason)))});i.useEffect(()=>{const C=new AbortController;return r.text(p.path,C.signal).then(M=>{"kind"in M&&L(M)}),()=>C.abort()},[r,p]);const S=i.useCallback(()=>f(C=>C+1),[]);return h===null?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"aqmx-skeleton","aria-hidden":"true","data-testid":"markdown-explorer-markup-skeleton",children:Ye.map(C=>l.jsx("span",{},C))}),l.jsx("p",{className:"aqmx-sr-only",children:a.markupLoading})]}):h.kind==="failure"?l.jsx(pe,{scrollerProps:an,children:l.jsx(le,{failure:h.failure,alert:!1,onRetry:S,testId:"markdown-explorer-markup-failure"})}):l.jsx(ln,{document:h,viewer:n})},an=Object.freeze({className:"aqmx-document-failure","data-aqmx-document-scroller":""}),So=Object.freeze({reason:"failed"}),ko=e=>l.jsx(Bn,{fallback:t=>l.jsx("div",{className:"aqmx-edit-message",children:l.jsx(le,{failure:So,alert:!1,onRetry:t,testId:"markdown-explorer-edit-load-failure"})}),children:l.jsx(i.Suspense,{fallback:l.jsx("div",{className:"aqmx-skeleton","aria-hidden":"true","data-testid":"markdown-explorer-edit-skeleton",children:Ye.map(t=>l.jsx("span",{},t))}),children:l.jsx(In,{...e})})}),Ro=({path:e,document:t,view:n,viewer:r,onRetry:o,editing:s})=>{switch(t.kind){case"markdown":{const{session:a,layout:u,region:v,paneScroll:m,stale:f}=s;if(n==="edit"&&a!==void 0)return l.jsx(ko,{path:e,name:t.name,session:a,layout:u,viewer:r,region:v,paneScroll:m});if(n==="markup")return l.jsx(yo,{path:e,name:t.name,viewer:r});const p=t.edit!==null&&t.edit.kind==="inline";return l.jsx(bo,{path:e,document:t,viewer:r,editing:{editable:p,doubleClick:p&&u==="fill",region:v,paneScroll:m,stale:f}})}case"text":return l.jsx(ln,{document:t,viewer:r});case"image":return l.jsx(Kr,{document:t});case"media":return l.jsx(vo,{document:t});case"file":return l.jsx(Sr,{document:t});case"failure":return l.jsx(pe,{scrollerProps:an,children:l.jsx(le,{failure:t.failure,alert:!1,onRetry:o,testId:"markdown-explorer-document-failure"})});default:{const a=t;throw new RangeError(`[markdown-explorer] unknown document kind in ${JSON.stringify(a)}`)}}},To='a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), iframe, audio[controls], video[controls], [tabindex]:not([tabindex="-1"])',Co=(e,t,n)=>{const[r]=t.kind==="markdown"?t.headings:[],o=[n===null?null:Jt(e,n),r===void 0?null:Qt(e,r.id),e.querySelector(Re),e.querySelector(To)];for(const s of o)if(s instanceof HTMLElement&&We(s))return s;return null},vt=(e,t,n)=>{const{activeElement:r,body:o}=e.ownerDocument,s=r===null||r===o;t instanceof HTMLElement&&n&&(s||e.contains(r))&&We(t)},Oo=e=>{const t=i.useRef(!1);return i.useLayoutEffect(()=>{const n=e.current;if(n===null)throw new Error("[markdown-explorer] the document region is not mounted");const r=n.ownerDocument,o=r.defaultView;if(o===null)throw new Error("[markdown-explorer] the document region's document has no window");let s=!1,a;const u=h=>{s=!(h.target instanceof Node&&n.contains(h.target)),s&&!n.contains(r.activeElement)&&(t.current=!1),clearTimeout(a),a=setTimeout(()=>{s=!1},0)},v=h=>{t.current=h.target instanceof Node&&n.contains(h.target)},m=h=>{h.relatedTarget===null&&s&&(t.current=!1)},f=()=>{const{activeElement:h,body:R}=r;h!==null&&h!==R&&(t.current=n.contains(h))},p=()=>{s&&!n.contains(r.activeElement)&&(t.current=!1)};return o.addEventListener("pointerdown",u,!0),o.addEventListener("mousedown",u,!0),o.addEventListener("focusin",v,!0),o.addEventListener("blur",f),o.addEventListener("focus",p),n.addEventListener("focusout",m),()=>{clearTimeout(a),o.removeEventListener("pointerdown",u,!0),o.removeEventListener("mousedown",u,!0),o.removeEventListener("focusin",v,!0),o.removeEventListener("blur",f),o.removeEventListener("focus",p),n.removeEventListener("focusout",m)}},[e]),t},Ao=({path:e,snapshot:t,markup:n,stale:r,viewer:o,editLayout:s,regionLabel:a,navigation:u,fragment:v,paneScroll:m,announces:f,announceFailure:p,onDocumentShown:h})=>{const{labels:R,announcer:L,documents:S}=P(),{document:C}=t,M=i.useRef(null),O=i.useRef(null),c=i.useRef(null),d=i.useRef(0),g=Oo(M),x=i.useRef({path:e,document:C}),k=i.useRef(null),j=i.useCallback(B=>{const U=M.current,K=ut(U,B,m);U!==null&&K!==null&&vt(U,K,g.current)},[m,g]),A=i.useCallback((B,U)=>{const K=d.current;setTimeout(()=>{!U.defaultPrevented&&d.current===K&&j(B)},0)},[j]),D=i.useCallback(B=>{setTimeout(()=>{B.defaultPrevented||j("#")},0)},[j]),F=i.useMemo(()=>({navigation:u,currentPath:e,scrollWithin:j,followSameUrlJump:A,followEmptyFragment:D}),[u,e,j,A,D]),z=i.useCallback(()=>S.retry(e),[S,e]),V=Zt(S,Qr),W=$t(e),Z=W!==void 0?"edit":n?"markup":"rendered",G=C.kind==="markdown"?Z:void 0,J=i.useCallback(()=>M.current,[]),w=i.useMemo(()=>({session:W,layout:s,region:J,paneScroll:m,stale:r}),[W,s,J,m,r]),E=G==="edit"?!1:r,y=i.use(ie),T=G==="edit"&&s==="fill"?"fill":y,_=i.useEffectEvent((B,U)=>{const K=O.current;if(K!==null&&K.path===B&&K.snapshot===U)return;O.current={path:B,snapshot:U};const Y=U.document;if(Y.kind==="failure"){S.noteFailureShown(U)&&p(R.documentFailed(N.lastPathSegment(B),te(R,Y.failure.reason)));return}h?.(B,Y),f&&(K===null||K.path!==B||K.snapshot.document.kind==="failure")&&L.announce(R.documentShown(Y.name))});i.useEffect(()=>{_(e,t)},[e,t]);const $=i.useEffectEvent(()=>{v.kind==="panel"&&v.consume()}),H=i.useEffectEvent(B=>{const U=M.current;if(U===null||!g.current)return null;const{activeElement:K,body:Y}=U.ownerDocument;return K!==null&&K!==Y?null:Co(U,C,B)}),I=i.useEffectEvent(B=>{const U=M.current;U!==null&&vt(U,B,g.current)}),ee=i.useEffectEvent(B=>m.reveal(B)),et=i.useEffectEvent(B=>ut(M.current,B,m));return i.useEffect(()=>{if(r)return;const B=x.current.path!==e,U=B||x.current.document!==C;x.current={path:e,document:C};const K=k.current!==e;k.current=e;let Y=null;v.kind==="page"?c.current!==v.navigation&&(c.current=v.navigation,d.current+=1,Y=v.fragment):v.fragment!==null&&(Y=v.fragment,$());const tt=()=>{const Le=Y===null?null:et(Y);if(!U){Le!==null&&I(Le);return}const nt=H(v.fragment);B&&Le===null&&nt!==null&&ee(nt)};K?queueMicrotask(tt):tt()},[v,e,C,r]),l.jsx(ie,{value:T,children:l.jsx(Qe,{kind:C.kind,view:G,label:a(e,C),stale:E,busy:E,frameRef:M,intent:V,children:l.jsx(tn,{value:F,children:l.jsx(Xr,{children:l.jsx(Ro,{path:e,document:C,view:Z,viewer:o,onRetry:z,editing:w},e)})})})})},Je=Object.freeze({kind:"skeleton"}),Lo=(e,t,n,r,o)=>{if(t?.status==="loaded")return{kind:"document",path:e,snapshot:t,stale:!1};const s=re(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:re(r);return n===null||a===null?Je:{kind:"document",path:n,snapshot:a,stale:!0}},jo=(e,t)=>t.status==="deferred"?Je:{kind:"document",path:e,snapshot:t,stale:!1},Mo=({requestedPath:e,content:t,markup:n,...r})=>{const o=t.kind==="streaming"?jo(t.path,i.use(t.promise)):t;return o.kind!=="document"?l.jsx(sn,{label:r.regionLabel(e,null)}):l.jsx(Ao,{path:o.path,snapshot:o.snapshot,markup:n,stale:o.stale,...r})},cn=({path:e,markup:t,display:n,navigation:r,fragment:o,paneScroll:s,announces:a,announceFailure:u,onDocumentShown:v})=>{const{config:m,labels:f,theme:p,documents:h}=P(),R=de.useMarkdownToolbarState(),L=i.useRef(!1);i.useLayoutEffect(()=>{L.current=!0},[]);const[S,C]=i.useState(null),[M,O]=i.useState(t),c=i.useCallback(()=>e===null?void 0:h.peek(e),[h,e]),d=i.useSyncExternalStore(h.subscribe,c,c),g=i.useCallback(()=>S===null?void 0:h.peek(S),[h,S]),x=i.useSyncExternalStore(h.subscribe,g,g);i.useLayoutEffect(()=>e===null?void 0:h.open(e),[h,e]),i.useLayoutEffect(()=>S===null?void 0:h.retain(S),[h,S]);const k=e===null?Je:Lo(e,d,S,x,!L.current),j=e===null?null:k.kind==="document"&&!k.stale?k.path:S;j!==S&&C(j);const A=k.kind!=="document"||k.path===e;A&&t!==M&&O(t);const D=i.useMemo(()=>wo(f),[f]),F=i.useMemo(()=>[...m.iframeHosts],[m]),z=r.kind==="panel",V=i.useMemo(()=>({labels:D,emptyMessage:f.documentEmpty,theme:p,availableStyles:m.documentStyles,iFrameAllowedDomains:F,embeds:m.embeds,linkComponent:oo,toolbar:R,style:n.style,onStyleChange:n.onStyleChange,align:n.align,onAlignChange:n.onAlignChange,showToc:n.showToc,showStyle:n.showStyle,showAlign:n.showAlign,padding:n.padding,width:n.width===void 0?void 0:`min(${n.width}, 100%)`,maxWidth:n.maxWidth===void 0?void 0:`min(${n.maxWidth}, 100%)`,renderScrollBar:z?void 0:Gt}),[D,f.documentEmpty,p,m.documentStyles,F,m.embeds,R,n,z]),W=i.useCallback((G,J)=>z?J===null||J.kind==="failure"?N.lastPathSegment(G):J.name:f.documentRegion,[z,f.documentRegion]),Z=z?"content":"fill";return e===null?l.jsx(ie,{value:Z,children:l.jsx(Eo,{})}):l.jsx(ie,{value:Z,children:l.jsx(i.Suspense,{fallback:l.jsx(sn,{label:W(e,null)}),children:l.jsx(Mo,{requestedPath:e,content:k,markup:A?t:M,viewer:V,editLayout:n.editLayout,regionLabel:W,navigation:r,fragment:o,paneScroll:s,announces:a,announceFailure:u,onDocumentShown:v})})})},No=({path:e,markup:t,variant:n,onDocumentShown:r})=>{const{config:o,viewSettings:s,announcer:a}=P(),u=ue(j=>j.style),v=ue(j=>j.align),m=he(),f=X.useLocation(),p=Se(),{view:h,overrides:R,embed:L}=n,S=i.useCallback(j=>{if(p.kind!=="location")return;const A=xo(o,p.location,j);A!==null&&m(A,"browse")},[o,m,p]),C=i.useCallback(j=>{s.update({style:j}),S("style")},[s,S]),M=i.useCallback(j=>{s.update({align:j}),S("align")},[s,S]),O=rn(o,R.style,u),c=on(R.align,v),d=i.useMemo(()=>({style:O,onStyleChange:C,align:c,onAlignChange:M,showToc:L.showToc!==!1,showStyle:L.showStyle!==!1,showAlign:L.showAlign!==!1,padding:L.padding,width:L.width,maxWidth:L.maxWidth,editLayout:"fill"}),[O,C,c,M,L]),g=i.useMemo(()=>({kind:"page",view:h,overrides:R,embed:L}),[h,R,L]),x=i.useMemo(()=>({kind:"page",fragment:f.hash,navigation:f}),[f]),k=i.useCallback(j=>a.announce(j),[a]);return l.jsx(cn,{path:e,markup:t,display:d,navigation:g,fragment:x,paneScroll:Lr,announces:!0,announceFailure:k,onDocumentShown:r})},Do=({path:e,markup:t,variant:n,onDocumentShown:r})=>{const{config:o,viewSettings:s}=P(),a=ue(g=>g.style),u=ue(g=>g.align),[v,m]=i.useState(()=>rn(o,void 0,a)),f=on(void 0,u),p=i.useCallback(g=>s.update({align:g}),[s]),{maximized:h,onDocumentLink:R,pendingHash:L,onHashConsumed:S,announceFailure:C,paneScroll:M}=n,O=i.useMemo(()=>({style:v,onStyleChange:m,align:f,onAlignChange:p,showToc:h,showStyle:h,showAlign:h,padding:void 0,width:void 0,maxWidth:void 0,editLayout:h?"fill":"content"}),[v,f,p,h]),c=i.useMemo(()=>({kind:"panel",onDocumentLink:R}),[R]),d=i.useMemo(()=>({kind:"panel",fragment:L,consume:S}),[L,S]);return l.jsx(cn,{path:e,markup:t,display:O,navigation:c,fragment:d,paneScroll:M,announces:!1,announceFailure:C,onDocumentShown:r})},dn=({path:e,markup:t,variant:n,onDocumentShown:r})=>n.kind==="page"?l.jsx(No,{path:e,markup:t,variant:n,onDocumentShown:r}):l.jsx(Do,{path:e,markup:t,variant:n,onDocumentShown:r});function Po({title:e,titleId:t,...n},r){return b.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?b.createElement("title",{id:t},e):null,b.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 un=b.forwardRef(Po);function _o({title:e,titleId:t,...n},r){return b.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?b.createElement("title",{id:t},e):null,b.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 Fo=b.forwardRef(_o);function $o({title:e,titleId:t,...n},r){return b.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?b.createElement("title",{id:t},e):null,b.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 qo=b.forwardRef($o);function Io({title:e,titleId:t,...n},r){return b.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?b.createElement("title",{id:t},e):null,b.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"}),b.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 Bo=b.forwardRef(Io);function Ho({title:e,titleId:t,...n},r){return b.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?b.createElement("title",{id:t},e):null,b.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 Uo=b.forwardRef(Ho);function zo({title:e,titleId:t,...n},r){return b.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?b.createElement("title",{id:t},e):null,b.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"}),b.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 Zo=b.forwardRef(zo);function Vo({title:e,titleId:t,...n},r){return b.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?b.createElement("title",{id:t},e):null,b.createElement("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"}),b.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 fn=b.forwardRef(Vo);function Go({title:e,titleId:t,...n},r){return b.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?b.createElement("title",{id:t},e):null,b.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"}),b.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 Ko=b.forwardRef(Go),mn=({href:e,onRetry:t,testId:n})=>{const{labels:r,onEditGrant:o}=P(),[s,a]=i.useState(!1),u=()=>{o===void 0||s||(a(!0),o(e).then(v=>{v&&t()}).finally(()=>a(!1)))};return l.jsxs("div",{className:"aqmx-callout aqmx-edit-grant","data-testid":n,children:[l.jsx("p",{className:"aqmx-callout-title",children:r.editGrantTitle}),l.jsx("p",{className:"aqmx-callout-body",children:r.editGrantBody}),l.jsxs("div",{className:"aqmx-edit-grant-actions",children:[o===void 0?l.jsx("a",{className:"aqmx-callout-action",href:e,target:"_blank",rel:"noopener","data-testid":`${n}-open`,children:r.editGrantAction}):l.jsx("button",{type:"button",className:"aqmx-callout-action","aria-disabled":s,"data-testid":`${n}-open`,onClick:u,children:r.editGrantAction}),l.jsx("button",{type:"button",className:"aqmx-callout-action","data-testid":`${n}-retry`,onClick:t,children:r.editGrantRetry})]})]})},wt=(e,t,n)=>{const r=e.modifiedAt===null?Number.NaN:Date.parse(e.modifiedAt);return n(Number.isNaN(r)?e.id:t.format(r),e.author===null?"":e.author)},Wo=({path:e,documentName:t,open:n,onClose:r})=>{const{data:o,edits:s,labels:a,locale:u,announcer:v}=P(),m=i.useRef(null),f=i.useRef(null),p=i.useId(),[h,R]=i.useState(null),[L,S]=i.useState(0),[C,M]=i.useState(null),[O,c]=i.useState(null),d=i.useMemo(()=>new Intl.DateTimeFormat(u,{dateStyle:"medium",timeStyle:"short"}),[u]);i.useLayoutEffect(()=>{const A=m.current;if(A!==null)if(n&&!A.open){const D=A.ownerDocument.activeElement;f.current=D instanceof HTMLElement?D:null,M(null),c(null),A.showModal()}else!n&&A.open&&(A.close(),f.current?.isConnected===!0&&f.current.focus(),f.current=null)},[n]),i.useEffect(()=>{if(!n)return;const A=new AbortController;return R(null),o.revisions(e,A.signal).then(D=>{"kind"in D&&R(D)}),()=>A.abort()},[n,o,e,L]),i.useEffect(()=>{if(!n||C===null)return;const A=new AbortController;return c(null),o.revision(e,C,A.signal).then(D=>{"kind"in D&&c(D)}),()=>A.abort()},[n,o,e,C]);const g=()=>{O===null||O.kind!=="revision"||(s.replaceDraft(e,O.text),v.announce(a.historyRestored(t)),r())},x=A=>{A.key!=="Escape"||A.defaultPrevented||(Ve(A),r())},k=A=>{A.target===A.currentTarget&&r()},j=h!==null&&h.kind==="revisions"?h.revisions.find(A=>A.id===C):void 0;return l.jsx("dialog",{ref:m,className:"aqmx-confirm aqmx-history","aria-labelledby":p,"data-testid":"markdown-explorer-history",onKeyDown:x,onClick:k,onCancel:A=>A.preventDefault(),children:l.jsxs("div",{className:"aqmx-confirm-panel aqmx-history-panel",children:[l.jsx("p",{id:p,className:"aqmx-confirm-title",children:a.historyTitle(t)}),h===null?l.jsx("p",{className:"aqmx-history-note","data-testid":"markdown-explorer-history-loading",children:a.historyLoading}):h.kind==="failure"?l.jsx(le,{failure:h.failure,alert:!1,onRetry:()=>S(A=>A+1),testId:"markdown-explorer-history-failure"}):h.revisions.length===0?l.jsx("p",{className:"aqmx-history-note","data-testid":"markdown-explorer-history-empty",children:a.historyEmpty}):l.jsx("ul",{className:"aqmx-history-list","data-testid":"markdown-explorer-history-list",children:h.revisions.map(A=>l.jsx("li",{children:l.jsxs("button",{type:"button",className:"aqmx-history-entry","aria-pressed":A.id===C,"data-testid":"markdown-explorer-history-entry",onClick:()=>M(A.id),children:[l.jsx("span",{children:wt(A,d,a.historyEntry)}),A.current?l.jsx("span",{className:"aqmx-history-mark",children:a.historyCurrent}):null,A.kept?l.jsx("span",{className:"aqmx-history-mark",children:a.historyKept}):null]})},A.id))}),C===null?null:O===null?l.jsx("p",{className:"aqmx-history-note",children:a.historyLoading}):O.kind==="failure"?l.jsx(le,{failure:O.failure,alert:!1,testId:"markdown-explorer-history-revision-failure"}):l.jsx("section",{className:"aqmx-history-text",tabIndex:0,"aria-label":j===void 0?a.historyTitle(t):wt(j,d,a.historyEntry),"data-testid":"markdown-explorer-history-text",children:l.jsx("pre",{children:O.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":O===null||O.kind!=="revision","data-testid":"markdown-explorer-history-restore",onClick:g,children:a.historyRestore})]})]})})},Xo=e=>{const{documents:t}=P(),n=i.useCallback(()=>t.peek(e),[t,e]),r=i.useCallback(()=>t.peekSeeded(e),[t,e]),o=i.useSyncExternalStore(t.subscribe,n,r),s=re(o)?.document;return s===void 0||s.kind==="failure"?{edit:null,name:N.lastPathSegment(e)}:{edit:s.kind==="markdown"?s.edit:null,name:s.name}},ne=e=>{e.stopPropagation()},Yo=({path:e,documentName:t,iconOnly:n,previewAvailable:r})=>{const{draftConverter:o,edits:s,labels:a}=P(),u=i.useSyncExternalStore(s.subscribe,()=>s.session(e)!==void 0,()=>!1),[v,m]=i.useState(!1),f=()=>{if(!u){s.start(e,s.viewAnchor(e));return}s.flush(e),s.session(e)?.dirty===!0?m(!0):s.close(e)},p=()=>{u||(qn(),r&&s.previewShown()&&o?.prepare?.())},h=n?a.editDocumentNamed(t):null;return l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",className:h===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",title:u?a.closeEditor:h===null?a.editDocument:h,"aria-label":h===null?void 0:h,"aria-pressed":u,"data-testid":"markdown-explorer-document-edit",onClick:f,onDoubleClick:ne,onPointerEnter:p,onFocus:p,children:[l.jsx(Ko,{"aria-hidden":"true"}),h===null?l.jsx("span",{children:a.editDocumentLabel}):null]}),l.jsx(Ft,{open:v,title:a.unsavedTitle,body:a.unsavedBody(t),confirmLabel:a.unsavedDiscard,cancelLabel:a.unsavedStay,testId:"markdown-explorer-edit-close-confirm",onConfirm:()=>{m(!1),s.close(e)},onCancel:()=>m(!1)})]})},Qo=({href:e,documentName:t,iconOnly:n})=>{const{labels:r}=P(),o=n?r.editExternallyNamed(t):null;return l.jsxs("a",{className:o===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",href:e,target:"_blank",rel:"noopener noreferrer",title:o===null?r.editExternally:o,"aria-label":o===null?void 0:o,"data-testid":"markdown-explorer-document-edit-external",onDoubleClick:ne,children:[l.jsx(qo,{"aria-hidden":"true"}),o===null?l.jsx("span",{children:r.editExternallyLabel}):null]})},Jo=({session:e})=>{const{labels:t}=P(),n=Cn(t,e);return l.jsx("p",{className:"aqmx-edit-status",title:n===""?void 0:n,"data-testid":"markdown-explorer-edit-status","data-aqmx-save":e.save.kind,children:n})},es=({path:e,documentName:t,iconOnly:n,session:r,previewAvailable:o})=>{const{draftConverter:s,edits:a,labels:u}=P(),v=It(),[m,f]=i.useState(!1);if(r.phase.kind!=="editing")return null;const p=r.save.kind==="saving",h=p||!r.dirty,R=()=>{a.flush(e);const C=a.session(e);C===void 0||!C.dirty||C.save.kind==="saving"||a.save(e)},L=C=>n?{className:"aqmx-icon-button","aria-label":C}:{className:"aqmx-icon-button aqmx-labelled-button"},S=()=>{v||s?.prepare?.()};return l.jsxs(l.Fragment,{children:[r.save.kind==="conflicts"?l.jsxs("button",{type:"button",...L(u.conflictNext),title:u.conflictNext,"data-testid":"markdown-explorer-edit-next-conflict",onClick:()=>a.nextConflict(e),onDoubleClick:ne,children:[l.jsx(Bo,{"aria-hidden":"true"}),n?null:l.jsx("span",{children:u.conflictNext})]}):null,o?l.jsxs("button",{type:"button",...L(u.previewToggle),title:u.previewToggle,"aria-pressed":v,"data-testid":"markdown-explorer-edit-preview-toggle",onClick:()=>a.setPreviewShown(!v),onDoubleClick:ne,onPointerEnter:S,onFocus:S,children:[l.jsx(fn,{"aria-hidden":"true"}),n?null:l.jsx("span",{children:u.previewToggle})]}):null,r.history?l.jsxs("button",{type:"button",...L(u.historyOpen),title:u.historyOpen,"aria-haspopup":"dialog","data-testid":"markdown-explorer-edit-history",onClick:()=>f(!0),onDoubleClick:ne,children:[l.jsx(Uo,{"aria-hidden":"true"}),n?null:l.jsx("span",{children:u.historyOpen})]}):null,l.jsxs("button",{type:"button",...L(u.saveDraft),title:u.saveDraftTooltip,"aria-disabled":h,"aria-busy":p,"aria-keyshortcuts":"Control+S Meta+S","data-testid":"markdown-explorer-edit-save",onClick:R,onDoubleClick:ne,children:[l.jsx(Zo,{"aria-hidden":"true"}),n?null:l.jsx("span",{children:u.saveDraft})]}),r.history?l.jsx(Wo,{path:e,documentName:t,open:m,onClose:()=>f(!1)}):null]})},ts=({path:e,session:t})=>{const{edits:n}=P();return t.save.kind!=="grant"?null:l.jsx(mn,{href:t.save.href,onRetry:()=>{n.save(e)},testId:"markdown-explorer-save-grant"})},ns=e=>{const{documents:t}=P(),n=i.useCallback(()=>t.peek(e),[t,e]),r=i.useCallback(()=>t.peekSeeded(e),[t,e]),o=i.useSyncExternalStore(t.subscribe,n,r);return re(o)?.document.kind==="markdown"},hn=e=>{const{config:t}=P(),n=he(),r=i.useCallback(()=>n(q.explorerHref(t,{...e,markup:!e.markup}),"browse"),[t,n,e]);return i.useMemo(()=>({shown:e.markup,toggle:r}),[e.markup,r])},rs=new Set,os=(e,t)=>{const{documents:n,announcer:r,labels:o}=P(),s=i.useCallback(()=>n.peek(e),[n,e]),a=i.useCallback(()=>n.peekSeeded(e),[n,e]),u=i.useSyncExternalStore(n.subscribe,s,a),v=i.useCallback(()=>n.answerStampOf(e),[n,e]),m=i.useSyncExternalStore(n.subscribe,v,v),[f]=i.useState(()=>new Set),[p,h]=i.useState(rs),[R,L]=i.useState(null);R!==null&&R.path!==e&&L(null);const S=i.useRef(null);i.useLayoutEffect(()=>(S.current=e,()=>{S.current=null}),[e]);const C=i.useCallback(()=>{const c=e,d=n.peek(c);if(f.has(c)||d?.status==="pending")return;const g=t&&!Xt(d);f.add(c),h(new Set(f)),L(null),(async()=>{try{const x=await n.refresh(c);if(S.current!==c||x.status==="superseded")return;if(x.status==="failed"){L({path:c,failure:x.failure,stamp:n.answerStampOf(c)}),r.announce(o.documentRefreshFailed(te(o,x.failure.reason)));return}const k=re(n.peek(c));if(g||k===null||k.document.kind==="failure")return;r.announce(o.documentRefreshed(k.document.name))}finally{f.delete(c),h(new Set(f))}})()},[e,t,f,n,r,o]),M=p.has(e),O=R!==null&&R.path===e&&R.stamp===m?R.failure:null;return{refreshing:M,unavailable:M||u?.status==="pending",failure:O,refresh:C}},pn=Object.freeze({kind:"page"}),gn=({path:e,placement:t,markup:n})=>{const{labels:r}=P(),{refreshing:o,unavailable:s,failure:a,refresh:u}=os(e,t.kind==="page"),v=ns(e),m=Xo(e),f=$t(e),p=t.kind==="panel"?r.refreshDocumentNamed(t.documentName):null,h=t.kind==="panel"?r.showMarkupNamed(t.documentName):null,R=t.kind==="panel",L=t.kind==="panel"?t.documentName:m.name,S=t.kind==="page"||t.maximized;return l.jsxs("div",{className:"aqmx-document-refresh-bar","data-testid":"markdown-explorer-document-refresh-bar","data-aqmx-editing":f===void 0?void 0:"true",children:[l.jsxs("div",{className:"aqmx-document-refresh-row",children:[f===void 0?null:l.jsx(Jo,{session:f}),f===void 0?null:l.jsx(es,{path:e,documentName:L,iconOnly:R,session:f,previewAvailable:S}),f===void 0&&v?l.jsxs("button",{type:"button",className:h===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",title:h===null?r.showMarkup:h,"aria-label":h===null?void 0:h,"aria-pressed":n.shown,"data-testid":"markdown-explorer-document-markup",onClick:n.toggle,onDoubleClick:ne,children:[l.jsx(Fo,{"aria-hidden":"true"}),h===null?l.jsx("span",{children:r.showMarkupLabel}):null]}):null,f!==void 0||m.edit?.kind==="inline"?l.jsx(Yo,{path:e,documentName:L,iconOnly:R,previewAvailable:S}):m.edit?.kind==="external"?l.jsx(Qo,{href:m.edit.href,documentName:L,iconOnly:R}):null,f===void 0?l.jsxs("button",{type:"button",className:p===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",title:p===null?r.refreshDocument:p,"aria-label":p===null?void 0:p,"aria-disabled":s,"aria-busy":o,"data-aqmx-busy":o?"true":void 0,"data-testid":"markdown-explorer-document-refresh",onClick:u,onDoubleClick:ne,children:[l.jsx(un,{"aria-hidden":"true"}),p===null?l.jsx("span",{children:r.refreshDocumentLabel}):null]}):null]}),f!==void 0||a===null?null:l.jsx("p",{className:"aqmx-document-refresh-failure","data-testid":"markdown-explorer-document-refresh-failure","data-aqmx-failure":a.reason,children:r.documentRefreshFailed(te(r,a.reason))}),f===void 0?null:l.jsx(ts,{path:e,session:f})]})},ss=({location:e})=>{const t=e.doc,n=i.useMemo(()=>({kind:"page",view:"single",overrides:e.overrides,embed:e.embed}),[e.overrides,e.embed]),r=hn(e);return l.jsxs("div",{className:"aqmx-single aqmx-document-column","data-testid":"markdown-explorer-single",children:[l.jsx(gn,{path:t,placement:pn,markup:r}),l.jsx(dn,{path:t,markup:e.markup,variant:n})]})},vn=({holds:e,testId:t})=>{const{labels:n,announcer:r}=P(),o=i.useId();i.useLayoutEffect(()=>e?r.claim(o):void 0,[e,r,o]);const s=i.useCallback(()=>r.shownIn(o),[r,o]),a=i.useSyncExternalStore(r.subscribe,s,s);return l.jsx("div",{className:"aqmx-sr-only",role:"status","aria-live":"polite","aria-atomic":"true","data-testid":t,children:a.length>1?n.announcementSequence(a):a[0]})},se=Object.freeze([]),ls=e=>{const t=new Set;let n=se,r=[],o=!1;const s=[],a=f=>{n=f;for(const p of[...t])p()},u=()=>s.at(-1)?.region,v=f=>{const p=u();f(),u()!==p&&n!==se&&a(se)},m=()=>{o=!1;const f=r.map(p=>"sentence"in p?p.sentence:p.list(p.items));r=[],a(Object.freeze(f))};return{announce:f=>{if(typeof f=="string")r.push({sentence:f});else{const p=r.find(h=>"list"in h&&h.list===f.list);p!==void 0&&"items"in p?p.items.push(f.item):r.push({list:f.list,items:[f.item]})}o||(o=!0,n!==se&&a(se),e.request(m))},subscribe:f=>(t.add(f),()=>{t.delete(f)}),claim:f=>{const p={region:f};return v(()=>s.push(p)),()=>v(()=>{const h=s.indexOf(p);h!==-1&&s.splice(h,1)})},shownIn:f=>u()===f?n:se}},ce=Object.freeze({status:"cancelled"}),is=e=>{if(e===null||typeof e!="object")return null;const{failure:t}=e;if(N.failureViolation(t)!==null)return null;const{reason:n,code:r}=t;return N.failureOf(n,r)},as=({dataPath:e,onScope:t,fetch:n})=>{const r=n??((m,f)=>globalThis.fetch(m,f)),o=(m,f)=>`${e}/${m}?${new URLSearchParams(f).toString()}`,s=async(m,f,p,h)=>{let R;try{R=await r(m,{credentials:"same-origin",...f,headers:{Accept:"application/json",...f.headers}})}catch{return h({reason:"failed"})}R.status===401&&t(null);const L=R.headers.get(N.EXPLORER_SCOPE_HEADER);L!==null&&t(L);let S;try{S=await R.json()}catch{return h({reason:N.failureReasonOfStatus(R.status)})}let C;try{C=p(S)}catch{C=!1}if(C)return S;const M=is(S);return h(M!==null?M:{reason:R.status===200?"failed":N.failureReasonOfStatus(R.status)})},a={[N.EXPLORER_PROOF_HEADER]:N.EXPLORER_REFRESH_PROOF},u={[N.EXPLORER_PROOF_HEADER]:N.EXPLORER_EDIT_PROOF,"Content-Type":`${N.EXPLORER_DRAFT_MEDIA_TYPE}; charset=utf-8`},v=async(m,f,p)=>{const h=await s(m,f,p,R=>N.failureDocument(R.reason,R.code));return f.signal.aborted?ce:h};return{tree:m=>s(o("tree",{[N.EXPLORER_DATA_QUERY.source]:m}),{method:"GET"},N.isExplorerTreeResult,f=>({status:"error",failure:f})),children:async(m,f,p)=>{const h=await s(o("children",{[N.EXPLORER_DATA_QUERY.source]:m,[N.EXPLORER_DATA_QUERY.path]:f}),{method:"GET",signal:p},N.isExplorerChildrenResult,R=>({status:"error",failure:R}));return p.aborted?ce:h},ancestors:async(m,f,p)=>{const h=await s(o("ancestors",{[N.EXPLORER_DATA_QUERY.source]:m,[N.EXPLORER_DATA_QUERY.path]:f}),{method:"GET",signal:p},N.isExplorerAncestorsResult,R=>({status:"error",failure:R}));return p.aborted?ce:h},reveal:async(m,f,p)=>{const h=await s(o("reveal",{[N.EXPLORER_DATA_QUERY.source]:m,[N.EXPLORER_DATA_QUERY.path]:f}),{method:"GET",signal:p},N.isExplorerRevealResult,R=>({status:"error",failure:R}));return p.aborted?ce:h},document:(m,{refresh:f})=>s(o("document",{[N.EXPLORER_DATA_QUERY.path]:m}),f?{method:"GET",headers:a}:{method:"GET"},N.isExplorerDocument,p=>N.failureDocument(p.reason,p.code)),text:async(m,f)=>{const p=await s(o("text",{[N.EXPLORER_DATA_QUERY.path]:m}),{method:"GET",signal:f},N.isExplorerTextAnswer,h=>N.failureDocument(h.reason,h.code));return f.aborted?ce:p},edit:(m,f)=>v(o("edit",{[N.EXPLORER_DATA_QUERY.path]:m}),{method:"GET",signal:f},N.isExplorerEditAnswer),save:(m,f,p,h)=>v(o("save",{[N.EXPLORER_DATA_QUERY.path]:m,[N.EXPLORER_DATA_QUERY.base]:f}),{method:"POST",headers:u,body:p,signal:h},N.isExplorerSaveAnswer),preview:(m,f,p)=>v(o("preview",{[N.EXPLORER_DATA_QUERY.path]:m}),{method:"POST",headers:u,body:f,signal:p},N.isExplorerPreviewAnswer),revisions:(m,f)=>v(o("revisions",{[N.EXPLORER_DATA_QUERY.path]:m}),{method:"GET",signal:f},N.isExplorerRevisionsAnswer),revision:(m,f,p)=>v(o("revision",{[N.EXPLORER_DATA_QUERY.path]:m,[N.EXPLORER_DATA_QUERY.revision]:f}),{method:"GET",signal:p},N.isExplorerRevisionAnswer),refresh:m=>s(o("refresh",{[N.EXPLORER_DATA_QUERY.source]:m}),{method:"POST",headers:a},N.isExplorerTreeResult,f=>({status:"error",failure:f}))}},cs=()=>{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}}},ds=e=>{const t=Q.readStorage(e);if(t===null)return q.NO_TREE_SETTING_CHANGES;try{return q.readTreeSettingChanges(JSON.parse(t))}catch(n){return console.warn(`[markdown-explorer] localStorage key ${JSON.stringify(e)} does not hold JSON; using the default tree settings.`,n),q.NO_TREE_SETTING_CHANGES}},xt=(e,t)=>{let n=null;const r=()=>{if(n===null){const s=ds(e);n={changes:s,settings:q.applyTreeSettingChanges(t,s)}}return n},o=ae();return{storageKey:e,defaults:t,getSnapshot:()=>r().settings,getServerSnapshot:()=>t,subscribe:o.subscribe,advance:s=>{const{changes:a,settings:u}=r(),v=q.recordTreeSettingChange(a,s,q.advanceTreeSetting(u,s)[s],t);return n={changes:v,settings:q.applyTreeSettingChanges(t,v)},o.emit(),Q.writeStorage(e,q.serializeTreeSettingChanges(v)),n.settings}}},us=Object.freeze({status:"refreshed"}),fs=Object.freeze({status:"superseded"}),ze=Object.freeze({status:"deferred"}),ms=Wt(ze),wn=4,hs=wn-1,Et=Object.freeze({status:"loading"}),ps=Object.freeze({status:"error",failure:Object.freeze({reason:"failed"})}),gs=e=>{const t=new Map,n=Kt(),r=new Map,o=new Map,s=new Map,a=new Map,u=ae(),v=new Set;let m=0,f=0;const p={direct:null,bulk:null},h=new Set;let R=!1,L=0;const S=()=>{L+=1,u.emit()},C=w=>o.get(w)??0,M=w=>{let E=a.get(w);return E===void 0&&(E={claims:new Map,unclaimed:new Set,direct:new Set,bulk:new Set,inFlight:new Map},a.set(w,E)),E},O=(w,E,y)=>{w.inFlight.delete(E),m-=1,y.lane==="bulk"&&(f-=1)},c=w=>{const E=a.get(w);if(E!==void 0){for(const[y,T]of[...E.inFlight])O(E,y,T),T.controller.abort();E.direct.clear(),E.bulk.clear(),E.unclaimed.clear()}},d=w=>{const E=C(w)+1;return o.set(w,E),c(w),E},g=(w,E)=>{const y=ge(w),T={promise:w,opened:E,stale:!1,loadedAt:y?.status==="ok"?y.loadedAt:null};return w.status==="pending"&&w.then(_=>{_.status==="ok"&&(T.loadedAt=_.loadedAt)}),T},x=w=>{let E=r.get(w);return E===void 0&&(E=new Map,r.set(w,E)),E},k=w=>{const E=[...a.keys()],y=p[w],T=y===null?0:E.indexOf(y)+1;for(let _=0;_<E.length;_+=1){const $=E[(T+_)%E.length],H=$===void 0?void 0:a.get($);if(!($===void 0||H===void 0)){for(const I of H[w])if((H.claims.get(I)??0)!==0)return H[w].delete(I),p[w]=$,{sourceId:$,path:I}}}return null},j=(w,E,y,T)=>{const _=a.get(w);if(_===void 0||_.inFlight.get(E)!==y)return;O(_,E,y);const $=(_.claims.get(E)??0)>0,H=x(w);if(T.status==="ok"?H.set(E,{status:"loaded",entries:T.entries}):T.status==="error"&&$?H.set(E,{status:"failed",failure:T.failure}):H.delete(E),S(),T.status==="error"&&$){const I={sourceId:w,path:E,failure:T.failure};for(const ee of[...v])ee(I)}D()},A=(w,E,y)=>{const T={controller:new AbortController,lane:y};M(w).inFlight.set(E,T),m+=1,y==="bulk"&&(f+=1),e.children(w,E,T.controller.signal).then(_=>j(w,E,T,_),()=>j(w,E,T,ps))},D=()=>{for(;m<wn;){const w=k("direct");if(w!==null){A(w.sourceId,w.path,"direct");continue}const E=f<hs?k("bulk"):null;if(E===null)return;A(E.sourceId,E.path,"bulk")}},F=(w,E,y)=>{if(!(E.direct.delete(y)||E.bulk.delete(y))){const _=E.inFlight.get(y);if(_===void 0)return!1;O(E,y,_),_.controller.abort()}return r.get(w)?.delete(y),!0},z=()=>{R=!1;let w=!1;for(const E of h){const y=M(E);for(const T of y.unclaimed)(y.claims.get(T)??0)===0&&F(E,y,T)&&(w=!0);y.unclaimed.clear()}h.clear(),w&&(S(),D())},V=(w,E)=>{t.set(w,g(me(e.tree(w)),E))},W=(w,E,y)=>{d(w);const T=g(Wt(E),y);return t.set(w,T),r.delete(w),S(),D(),T},Z=(w,E,y,T)=>{if(y!==C(w)||t.get(w)!==E)return;const _=ge(E.promise);if(!(T.status!=="ok"||_?.status!=="ok"||E.loadedAt===null||T.loadedAt<=E.loadedAt)){if(be(_.entries,T.entries)){E.loadedAt=T.loadedAt;return}W(w,T,E.opened)}},G=(w,E)=>{const y=t.get(w);return y!==void 0&&ge(y.promise)?.status===E},J=(w,E)=>{E.stale=!1;const y=C(w);e.tree(w).then(T=>Z(w,E,y,T))};return{read:w=>t.get(w)?.promise??ms,open:w=>{const E=n.resumes(w),y=n.hold(w),T=t.get(w);return T===void 0||G(w,"deferred")?(V(w,!0),S()):E||(T.opened&&G(w,"error")?(V(w,!0),S()):(T.opened=!0,T.stale&&G(w,"ok")&&J(w,T))),y},retry:w=>{G(w,"error")&&(V(w,!0),S())},seed:(w,E)=>{const y=E.then($=>$===null?ze:$,()=>ze),T=t.get(w);if(T!==void 0&&G(w,"ok")){const $=C(w);y.then(H=>Z(w,T,$,H));return}d(w);const _=g(me(y),T?.opened===!0);t.set(w,_),r.delete(w),D(),y.then($=>{t.get(w)===_&&($.status==="deferred"&&n.isHeld(w)&&V(w,_.opened),S())})},refresh:async w=>{const E=(s.get(w)??0)+1;s.set(w,E);const y=await e.refresh(w);if(s.get(w)!==E)return fs;if(y.status==="error")return{status:"failed",failure:y.failure};const T=t.get(w);if(!(T!==void 0&&T.loadedAt!==null&&G(w,"ok")&&T.loadedAt>y.loadedAt)){const $=W(w,y,!0);if(T!==void 0&&T.promise.status==="pending"){const H=C(w);T.promise.then(I=>Z(w,$,H,I))}}for(const[$,H]of t)$!==w&&ge(H.promise)?.status==="ok"&&(H.stale=!0);return us},children:(w,E)=>r.get(w)?.get(E),claimChildren:(w,E)=>{const y=M(w),T=x(w);let _=!1,$=!1;for(const[I,ee]of E)y.claims.set(I,(y.claims.get(I)??0)+1),T.get(I)===void 0?(T.set(I,Et),y[ee].add(I),_=!0,$=!0):ee==="direct"&&y.bulk.delete(I)&&(y.direct.add(I),$=!0);_&&S(),$&&D();let H=!1;return()=>{if(!H){H=!0;for(const I of E.keys()){const ee=(y.claims.get(I)??0)-1;ee>0?y.claims.set(I,ee):(y.claims.delete(I),y.unclaimed.add(I))}h.add(w),!R&&(R=!0,queueMicrotask(z))}}},retryChildren:(w,E)=>{const y=r.get(w);if(y===void 0||y.get(E)?.status!=="failed")return;const T=M(w);if((T.claims.get(E)??0)>0){y.set(E,Et),T.direct.add(E),S(),D();return}y.delete(E),S()},pendingChildren:w=>{const E=a.get(w);return E===void 0?0:E.direct.size+E.bulk.size+E.inFlight.size},clear:()=>{for(const w of new Set([...t.keys(),...r.keys(),...o.keys(),...a.keys()]))d(w);for(const[w,E]of s)s.set(w,E+1);t.clear(),r.clear(),S()},subscribeChildrenFailures:w=>(v.add(w),()=>{v.delete(w)}),subscribe:u.subscribe,version:()=>L}},vs=(e,t)=>{let n=e;const r=ae();return{getSnapshot:()=>n,subscribe:r.subscribe,update:o=>{n={...n,...o},t(n),r.emit()}}},ws=1;let ve=0,oe=null;const xs=()=>{const{documentElement:e,body:t}=document;ve===0&&(oe={htmlOverflow:e.style.overflow,bodyOverflow:t.style.overflow,htmlGutter:e.style.scrollbarGutter,bodyGutter:t.style.scrollbarGutter},e.style.overflow="hidden",t.style.overflow="hidden",e.style.scrollbarGutter="auto",t.style.scrollbarGutter="auto"),ve+=1;let n=!1;return()=>{n||(n=!0,ve-=1,!(ve>0||oe===null)&&(e.style.overflow=oe.htmlOverflow,t.style.overflow=oe.bodyOverflow,e.style.scrollbarGutter=oe.htmlGutter,t.style.scrollbarGutter=oe.bodyGutter,oe=null))}},Es=[{selector:'[data-aqmx-document-flow="fill"]',name:"document region"},{selector:"[data-aqmx-explorer-body]",name:"tree area"}],bt=1,yt=e=>e.getClientRects().length>0,Pe="Give the explorer's container a definite block size (for example height: 100dvh, or a flex column of definite height whose item has flex: 1 and min-height: 0; in a fresh React Router app also html and body at height: 100%) instead of an auto or only a minimum height.",bs=e=>{if(!yt(e))return null;const t=e.getBoundingClientRect(),n=window.innerHeight;if(t.bottom>n+ws)return`[markdown-explorer] the explorer ends ${String(Math.round(t.bottom))}px down a ${String(n)}px viewport while lockDocumentScroll stops the page from scrolling, so the rest cannot be reached. ${Pe}`;if(t.height<bt)return`[markdown-explorer] the explorer collapsed to ${String(Math.round(t.height))}px while lockDocumentScroll stops the page from scrolling, so nothing can be read. ${Pe}`;for(const{selector:r,name:o}of Es)for(const s of e.querySelectorAll(r)){if(!yt(s))continue;const a=s.getBoundingClientRect().height;if(a<bt)return`[markdown-explorer] the explorer's ${o} collapsed to ${String(Math.round(a))}px while lockDocumentScroll stops the page from scrolling, so it cannot be read. ${Pe}`}return null},ys=e=>{let t=!1;const n=()=>{if(t)return;const o=bs(e);o!==null&&(t=!0,console.error(o))},r=typeof ResizeObserver>"u"?null:new ResizeObserver(n);return r?.observe(e),window.addEventListener("resize",n),n(),()=>{r?.disconnect(),window.removeEventListener("resize",n)}},Ss=(e,t)=>{i.useEffect(()=>e?xs():void 0,[e]),i.useEffect(()=>{const n=t.current;if(!(!e||n===null))return ys(n)},[e,t])},St='[data-testid="markdown-explorer-view-switch"]',ks=[{control:St,successors:[St,'[data-testid="markdown-explorer-sheet-toggle"]']},{control:'[data-testid="markdown-explorer-selection-open"]',successors:['[data-testid="markdown-explorer-panel-frame"]']}],Rs=e=>{for(const t of ks){const n=e.closest(t.control);if(n!==null)return{element:n,control:t}}return null},Ts=(e,t)=>{const n=i.useRef(null);i.useEffect(()=>{const o=u=>{const v=e.current;n.current=v!==null&&u instanceof Element&&v.contains(u)?Rs(u):null},s=u=>o(u.target);o(document.activeElement);const a=u=>{const v=u.target;u.relatedTarget!==null||!(v instanceof Element)||queueMicrotask(()=>{n.current?.element===v&&v.isConnected&&document.activeElement!==v&&(n.current=null)})};return document.addEventListener("focusin",s),document.addEventListener("focusout",a),()=>{document.removeEventListener("focusin",s),document.removeEventListener("focusout",a)}},[e]);const r=i.useRef(t);i.useLayoutEffect(()=>{if(r.current===t)return;r.current=t;const o=n.current;if(o===null)return;const s=()=>{const v=document.activeElement;if(v!==null&&v!==document.body&&v!==o.element)return!0;const m=e.current;if(m===null)return!0;for(const f of o.control.successors)for(const p of m.querySelectorAll(f))if(p!==o.element&&(p.focus({preventScroll:!0}),document.activeElement===p))return!0;return!1};if(s())return;const a=e.current;if(a===null)return;const u=new MutationObserver(()=>{s()&&u.disconnect()});return u.observe(a,{childList:!0,subtree:!0}),()=>u.disconnect()},[t,e])},Cs=i.lazy(()=>Promise.resolve().then(()=>require("./TreeLayout-CEp5oKly.cjs")).then(e=>({default:e.TreeLayout}))),Os=i.lazy(()=>Promise.resolve().then(()=>require("./MultiLayout-BZbEl73E.cjs")).then(e=>({default:e.MultiLayout}))),As=64,Ls={request:e=>{requestAnimationFrame(e)}},kt=e=>{e.documents.clear(),e.trees.clear()},_e=(e,t)=>{t.tree!==null&&e.trees.seed(t.tree.sourceId,t.tree.result);for(const{path:n,document:r}of t.documents)e.documents.seed(n,r)},js=(e,t)=>{const[n,r]=i.useState(()=>({overrides:t,locale:e,labels:Ie(e,t)}));if(n.locale===e&&Rn(n.overrides,t))return n.labels;const o={overrides:t,locale:e,labels:Ie(e,t)};return r(o),o.labels},Ms=(e,t,n)=>{const[r,o]=i.useState(()=>({scope:t,store:xt(e,n)}));if(r.scope===t&&r.store.storageKey===e&&r.store.defaults===n)return r.store;const s={scope:t,store:xt(e,n)};return o(s),s.store},Fe=(e,t)=>{const[n,r]=i.useState(()=>({scope:e,value:t()}));if(n.scope===e)return n.value;const o={scope:e,value:t()};return r(o),o.value},Ns=()=>ls(Ls),Rt="on",Ds="off",Ps=Object.freeze({kind:"unavailable"}),_s=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")},Fs=(e,t)=>{const n=re(e.peek(t));return n===null||n.document.kind==="failure"?N.lastPathSegment(t):n.document.name},$s=({data:e,config:t,storageNamespace:n,locale:r,labels:o,theme:s,renderFrame:a,renderTreeFailure:u,lockDocumentScroll:v=!1,onMathDiagnostics:m,onEditGrant:f,draftConverter:p})=>{Q.assertStorageNamespace(n),_s(p);const h=Lt(r),R=Tn(s),L=js(h,o),{revalidate:S}=X.useRevalidator(),C=i.useRef(()=>{}),M=X.useHref(t.dataPath),[O]=i.useState(()=>{const y=as({dataPath:M,onScope:_=>C.current(_)}),T={documents:sr({client:y,capacity:Math.max(As,t.multiView.maxPanels*2)}),trees:gs(y)};return _e(T,e),Q.syncStorageScope(n,e.scope),{data:y,...T,aligned:{pageData:e,storageNamespace:n,pendingReader:null}}});if(O.aligned.pageData!==e||O.aligned.storageNamespace!==n){const y=O.aligned.pageData;O.aligned.pageData=e,O.aligned.storageNamespace=n,y!==e&&(y.scope!==e.scope?O.aligned.pendingReader=e:_e(O,e)),Q.syncStorageScope(n,e.scope)}const c=Ms(Q.storageKeys(n).treeSettings,e.scope,t.defaultTreeSettings);i.useLayoutEffect(()=>{const y=O.aligned.pendingReader;y!==null&&(O.aligned.pendingReader=null,kt(O),_e(O,y))},[e,O]),i.useLayoutEffect(()=>{let y=!1;return C.current=T=>{T===e.scope||y||(y=!0,T!==null&&(kt(O),Q.clearExplorerStorage(n)),S())},()=>{C.current=()=>{}}},[e,S,O,n]);const d=i.useRef(t.settingsCookie);i.useLayoutEffect(()=>{d.current=t.settingsCookie},[t.settingsCookie]);const[g]=i.useState(()=>vs(e.settings,y=>{document.cookie=q.viewSettingsCookieString(d.current,y,window.location.protocol==="https:")})),x=Fe(e.scope,Ns),k=Fe(e.scope,cs),j=i.useRef(L);i.useLayoutEffect(()=>{j.current=L},[L]);const A=Fe(e.scope,()=>jn({data:O.data,conflictLabels:()=>({ours:j.current.conflictOurs,theirs:j.current.conflictTheirs}),onSaveSettled:(y,T)=>{T.kind==="saved"&&O.documents.refresh(y);const _=On(j.current,T,Fs(O.documents,y));_!==null&&x.announce(_)},previewSetting:{read:()=>Q.readStorage(Q.storageKeys(n).editPreview)===Rt,write:y=>Q.writeStorage(Q.storageKeys(n).editPreview,y?Rt:Ds)}})),D=i.useMemo(()=>me(e.notices.catch(()=>[])),[e.notices]),F=e.sources.map(y=>y.id).join(`
|
|
12
|
-
`),z=i.useMemo(()=>q.withExplorerSources(t,F.split(`
|
|
13
|
-
`)),[t,F]),V=i.useRef(m);i.useLayoutEffect(()=>{V.current=m},[m]);const[W]=i.useState(()=>(y,T)=>{V.current?.(y,T)}),Z=m===void 0?void 0:W,G=i.useRef(p);i.useLayoutEffect(()=>{G.current=p},[p]);const[J]=i.useState(()=>{let y=!1;return{convert:(T,_)=>{const $=G.current;return $===void 0?Promise.resolve(Ps):$.convert(T,_)},prepare:()=>{try{G.current?.prepare?.()}catch(T){if(y)return;y=!0,console.error("[markdown-explorer] the draft converter's prepare threw",T)}}}}),w=p===void 0?void 0:J,E=i.useMemo(()=>({config:z,labels:L,locale:h,theme:R,storageNamespace:n,scope:e.scope,sources:e.sources,notices:D,documents:O.documents,trees:O.trees,data:O.data,viewSettings:g,treeSettings:c,announcer:x,reveals:k,edits:A,onEditGrant:f,draftConverter:w,renderTreeFailure:u,reportMathDiagnostics:Z}),[z,L,h,R,n,e.scope,e.sources,D,O,g,c,x,k,A,f,w,u,Z]);return l.jsx(jt,{value:E,children:l.jsx(Is,{renderFrame:a,lockDocumentScroll:v},e.scope)})},qs=({ref:e,theme:t,view:n,children:r})=>{const[o]=i.useState(Ur);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})},Is=({renderFrame:e,lockDocumentScroll:t})=>{const{theme:n,labels:r}=P(),o=Se(),{hash:s}=X.useLocation(),a=he(),u=i.useRef(null);Ss(t,u),i.useLayoutEffect(()=>{o.kind==="redirect"&&a(`${o.href}${s}`,"browse")},[o,s,a]);const{location:v}=o,m=v.view;Ts(u,m);const f=v.view==="tree"?l.jsx(i.Suspense,{fallback:l.jsx("section",{className:"aqmx-split-fallback","aria-label":r.explorerRegion,"aria-busy":"true","data-testid":"markdown-explorer-split-loading"}),children:l.jsx(Cs,{location:v})}):v.view==="multi"?l.jsx(i.Suspense,{fallback:l.jsx("section",{className:"aqmx-stage-fallback","aria-label":r.multiRegion,"aria-busy":"true","data-testid":"markdown-explorer-stage-loading"}),children:l.jsx(Os,{location:v})}):l.jsx(ss,{location:v}),p=l.jsxs(qs,{ref:u,theme:n,view:m,children:[f,l.jsx(_n,{}),l.jsx(vn,{holds:!0,testId:"markdown-explorer-announcer"})]});return e===void 0?p:e({view:m,children:p})},Bs=({currentUrl:e,nextUrl:t,formMethod:n,defaultShouldRevalidate:r})=>n===void 0&&e.href===t.href&&r;exports.ALLOW_KEY_REPEAT=ye;exports.CONFLICT_OURS_MARKER=Nt;exports.CONFLICT_SEPARATOR=Dt;exports.CONFLICT_THEIRS_MARKER=Pt;exports.DEFAULT_MARKDOWN_EXPLORER_LOCALE=Tt;exports.DocumentPane=dn;exports.DocumentRefreshBar=gn;exports.EXPLORER_THEMES=Be;exports.EditGrantNotice=mn;exports.ExplorerLink=zt;exports.FailureView=le;exports.ForwardRef=un;exports.ForwardRef$1=fn;exports.ImageViewMemoryContext=en;exports.LazyNativeScrollBar=Vt;exports.LiveRegion=vn;exports.MARKDOWN_EXPLORER_LABEL_CATALOGS=At;exports.MARKDOWN_EXPLORER_LABEL_KEYS=Ze;exports.MARKDOWN_EXPLORER_LABEL_TEMPLATES=Ct;exports.MARKDOWN_EXPLORER_LOCALES=qe;exports.MarkdownExplorer=$s;exports.PAGE_DOCUMENT_REFRESH=pn;exports.consumeKey=Ve;exports.createEmitter=ae;exports.explorerNavigationOptions=tr;exports.failureTitleOf=te;exports.findConflictsInLines=_t;exports.focusWithoutScroll=We;exports.frameTopOf=Ht;exports.loadedOf=re;exports.positionInSource=Yn;exports.resolveMarkdownExplorerLabels=Ie;exports.shouldRevalidateExplorer=Bs;exports.useExplorer=P;exports.useExplorerLocation=Se;exports.useExplorerNavigate=he;exports.useIntentPrefetch=Zt;exports.usePageMarkupToggle=hn;exports.usePreviewShown=It;exports.useViewSetting=ue;exports.visibleTopOf=Ut;
|