@aiquants/markdown-explorer 0.30.0 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +12 -8
  3. package/dist/{EditSurface-Cw0kbedj.cjs → EditSurface-BBHPQhf3.cjs} +3 -3
  4. package/dist/{EditSurface-DY1VNM9L.js → EditSurface-N7HkpyJA.js} +187 -187
  5. package/dist/{ExplorerSplit-x9Qkldh6.cjs → ExplorerSplit-C7GvlQ-G.cjs} +1 -1
  6. package/dist/{ExplorerSplit-D3f1FiZ7.js → ExplorerSplit-DMqbSL3i.js} +4 -4
  7. package/dist/{MultiLayout-B0dfZlpx.js → MultiLayout-9g9_IBi5.js} +237 -232
  8. package/dist/MultiLayout-mDzolCaK.cjs +1 -0
  9. package/dist/{NativeScrollBar-C2UoYO3i.cjs → NativeScrollBar-B0QLIVf3.cjs} +1 -1
  10. package/dist/{NativeScrollBar-C4vkvdGz.js → NativeScrollBar-BiLLVz18.js} +2 -2
  11. package/dist/{TreeLayout-DsFH17x_.cjs → TreeLayout-DKq_aXBx.cjs} +1 -1
  12. package/dist/{TreeLayout-Bak1y1m4.js → TreeLayout-OjVoHBDI.js} +3 -3
  13. package/dist/core/config.d.cts +2 -0
  14. package/dist/core/config.d.ts +2 -0
  15. package/dist/core/labels.d.cts +6 -0
  16. package/dist/core/labels.d.ts +6 -0
  17. package/dist/{index-auQVKY4M.js → index-C8yNTkdV.js} +917 -903
  18. package/dist/{index-DgaTEKsI.cjs → index-CT-daekP.cjs} +6 -6
  19. package/dist/index.cjs +1 -1
  20. package/dist/index.js +6 -6
  21. package/dist/location-BxiJRTyw.cjs +1 -0
  22. package/dist/{location-CKuabtKl.js → location-perTmwct.js} +253 -245
  23. package/dist/{merge-D1jbIOPw.js → merge-Be3mcQZD.js} +1 -1
  24. package/dist/{merge-BEa-lale.cjs → merge-Cv6zPoVK.cjs} +1 -1
  25. package/dist/server.cjs +1 -1
  26. package/dist/server.js +2 -2
  27. package/dist/{tapScrollCircle-BSb6lisN.cjs → tapScrollCircle-37FU6daT.cjs} +1 -1
  28. package/dist/{tapScrollCircle-DYQ8P2ag.js → tapScrollCircle-Cy1KyTg2.js} +1 -1
  29. package/dist/{useSplitPersistence-Bf4M35Il.js → useSplitPersistence-Du01PHNg.js} +1 -1
  30. package/dist/{useSplitPersistence-9Nu6J1WF.cjs → useSplitPersistence-pPmE4GTT.cjs} +1 -1
  31. package/docs/behavior/layout.md +8 -4
  32. package/docs/behavior/localization.md +3 -3
  33. package/docs/behavior/url-contract.md +1 -1
  34. package/package.json +6 -6
  35. package/dist/MultiLayout-BXr2UAvl.cjs +0 -1
  36. package/dist/location-l_HysaZR.cjs +0 -1
@@ -1 +1 @@
1
- "use strict";const c=require("react/jsx-runtime"),v=require("./index-DgaTEKsI.cjs"),r=require("react"),A=require("./location-l_HysaZR.cjs"),He=require("@aiquants/directory-tree"),mt=require("./tapScrollCircle-BSb6lisN.cjs"),pt=require("./storage-DM0EvkVf.cjs"),xe=require("@aiquants/resize-panels"),Ae=require("./useSplitPersistence-9Nu6J1WF.cjs"),ht=require("react-router");function xt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const p=xt(r);function wt({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M19.5 21a3 3 0 0 0 3-3V9a3 3 0 0 0-3-3h-5.379a.75.75 0 0 1-.53-.22L11.47 3.66A2.25 2.25 0 0 0 9.879 3H4.5a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3h15ZM9 12.75a.75.75 0 0 0 0 1.5h6a.75.75 0 0 0 0-1.5H9Z",clipRule:"evenodd"}))}const gt=p.forwardRef(wt);function Et({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M19.5 21a3 3 0 0 0 3-3V9a3 3 0 0 0-3-3h-5.379a.75.75 0 0 1-.53-.22L11.47 3.66A2.25 2.25 0 0 0 9.879 3H4.5a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3h15Zm-6.75-10.5a.75.75 0 0 0-1.5 0v2.25H9a.75.75 0 0 0 0 1.5h2.25v2.25a.75.75 0 0 0 1.5 0v-2.25H15a.75.75 0 0 0 0-1.5h-2.25V10.5Z",clipRule:"evenodd"}))}const bt=p.forwardRef(Et);function vt({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{d:"M16.5 6a3 3 0 0 0-3-3H6a3 3 0 0 0-3 3v7.5a3 3 0 0 0 3 3v-6A4.5 4.5 0 0 1 10.5 6h6Z"}),p.createElement("path",{d:"M18 7.5a3 3 0 0 1 3 3V18a3 3 0 0 1-3 3h-7.5a3 3 0 0 1-3-3v-7.5a3 3 0 0 1 3-3H18Z"}))}const Rt=p.forwardRef(vt);function yt({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M3 6a3 3 0 0 1 3-3h2.25a3 3 0 0 1 3 3v2.25a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6Zm9.75 0a3 3 0 0 1 3-3H18a3 3 0 0 1 3 3v2.25a3 3 0 0 1-3 3h-2.25a3 3 0 0 1-3-3V6ZM3 15.75a3 3 0 0 1 3-3h2.25a3 3 0 0 1 3 3V18a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3v-2.25Zm9.75 0a3 3 0 0 1 3-3H18a3 3 0 0 1 3 3V18a3 3 0 0 1-3 3h-2.25a3 3 0 0 1-3-3v-2.25Z",clipRule:"evenodd"}))}const St=p.forwardRef(yt),kt=()=>{const{notices:e}=v.useExplorer(),t=r.use(e);return t.length===0?null:c.jsx("div",{className:"aqmx-explorer-notices",children:t.map(n=>c.jsxs("div",{className:"aqmx-callout","data-aqmx-tone":n.tone,"data-testid":"markdown-explorer-notice","data-aqmx-notice":n.id,children:[c.jsx("p",{className:"aqmx-callout-title",children:n.title}),n.body===void 0?null:c.jsx("p",{className:"aqmx-callout-body",children:n.body}),n.action===void 0?null:c.jsx("a",{className:"aqmx-callout-action",href:n.action.href,children:n.action.label})]},n.id))})};function Ct({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M6.912 3a3 3 0 0 0-2.868 2.118l-2.411 7.838a3 3 0 0 0-.133.882V18a3 3 0 0 0 3 3h15a3 3 0 0 0 3-3v-4.162c0-.299-.045-.596-.133-.882l-2.412-7.838A3 3 0 0 0 17.088 3H6.912Zm13.823 9.75-2.213-7.191A1.5 1.5 0 0 0 17.088 4.5H6.912a1.5 1.5 0 0 0-1.434 1.059L3.265 12.75H6.11a3 3 0 0 1 2.684 1.658l.256.513a1.5 1.5 0 0 0 1.342.829h3.218a1.5 1.5 0 0 0 1.342-.83l.256-.512a3 3 0 0 1 2.684-1.658h2.844Z",clipRule:"evenodd"}))}const Tt=p.forwardRef(Ct),ye=r.createContext(!0),Ze="\0loop\0",$e="\0",Lt=()=>{const e=new WeakMap,t=new WeakMap,n=new WeakMap,a=o=>{const l=e.get(o);if(l!==void 0)return l;const i=Object.freeze({type:"loop",name:o.name,path:o.path});return e.set(o,i),i},s=(o,l,i)=>{let f=!1;const m=o.map(h=>{const x=u(h,l,i);return x!==h&&(f=!0),x});if(!f)return o;const d=n.get(o);return d!==void 0&&d.length===m.length&&d.every((h,x)=>h===m[x])?d:(n.set(o,m),m)},u=(o,l,i)=>{if(o.type!=="directory")return o;if(i.has(o.path))return a(o);const f=o.lazy===!0?l(o.path):void 0,m=f?.status==="loaded",d=m?f.entries:o.children;if(d===void 0)return o;i.add(o.path);const h=s(d,l,i);if(i.delete(o.path),!m&&h===o.children)return o;const x=t.get(o);if(x!==void 0&&x.state===f&&x.children===h)return x.grafted;const g={...o,children:h,lazy:m?!1:o.lazy};return t.set(o,{state:f,children:h,grafted:g}),g};return(o,l)=>s(o,l,new Set)},jt=(e,t)=>`${Ze}${e}${$e}${t}`,ie=e=>e.startsWith(Ze),Pt=e=>e.slice(e.lastIndexOf($e)+1),re="data-aqmx-path",Nt=(e,t,n,a,s)=>{const u={aqmxPath:e.path};return e.modifiedAt!==void 0&&(u.aqmxModifiedAt=e.modifiedAt),n&&(u.aqmxOpen=!0),(a==="loading"||a==="failed")&&(u.aqmxChildren=a),{name:e.name,type:e.type,absolutePath:e.path,relativePath:e.path,mimeType:e.mimeType,children:t,label:s,data:u}},Ot=(e,t,n,a)=>{const s=jt(t,e.path);return{name:n,type:"directory",absolutePath:s,relativePath:s,children:a,data:{aqmxLoop:e.path}}},At=()=>{const e=new WeakMap,t=new WeakMap,n=new WeakMap,a=[],s=(l,i,f)=>{const m=l.map(h=>h.type==="loop"?u(h,i,f):o(h,i)),d=n.get(l);return d!==void 0&&d.length===m.length&&d.every((h,x)=>h===m[x])?d:(n.set(l,m),m)},u=(l,i,f)=>{const m=t.get(l);if(m!==void 0&&m.parentKey===f&&m.loopFolderName===i.loopFolderName)return m.row;const d=Ot(l,f,i.loopFolderName(l.name),a);return t.set(l,{row:d,parentKey:f,loopFolderName:i.loopFolderName}),d},o=(l,i)=>{const f=l.type==="directory"?l.children===void 0?a:s(l.children,i,l.path):void 0,m=i.openPaths.has(l.path),d=l.type==="directory"&&l.lazy===!0?i.childrenOf(l.path)?.status:void 0,h=d==="failed"?i.renderFailedFolder:void 0,x=e.get(l);if(x!==void 0&&x.open===m&&x.childrenStatus===d&&x.children===f&&x.renderFailedFolder===h)return x.row;const g=Nt(l,f,m,d,h===void 0?void 0:h(l));return e.set(l,{row:g,open:m,childrenStatus:d,children:f,renderFailedFolder:h}),g};return(l,i)=>s(l,i,"")},qt=e=>{if(e===void 0)return;const t=n=>{const a=n.data?.aqmxModifiedAt;return typeof a=="number"?{name:n.name,path:n.absolutePath,type:n.type,modifiedAt:a}:{name:n.name,path:n.absolutePath,type:n.type}};return(n,a)=>e(t(n),t(a))},Re=(e,t)=>{const n=e.filter(a=>a.type==="directory");return t===void 0?n:n.sort(t)},Mt=(e,t)=>{const n=new Map;let a=0;const s=u=>{for(const o of Re(u,t.compare))if(t.isShownExpanded(o.path)){if(o.lazy!==!0){o.children!==void 0&&s(o.children);continue}n.has(o.path)||(n.set(o.path,t.isDirect(o.path)?"direct":"bulk"),t.childrenOf(o.path)?.status!=="failed"&&(a+=1))}};return s(e),{folders:n,waiting:a}},Ft=e=>{const t=new Set,n=a=>{for(const s of a)s.type==="directory"&&(s.lazy===!0&&t.add(s.path),s.children!==void 0&&n(s.children))};return n(e),t},Be=(e,t)=>{for(const n of e){if(n.type!=="directory")continue;if(n.path===t)return n;const a=n.children===void 0?null:Be(n.children,t);if(a!==null)return a}return null},_t=(e,t,n,a)=>{let s=e;for(const u of t){const o=s.find(l=>l.type==="directory"&&l.path===u);if(o===void 0)return"missing";if(o.lazy===!0)return a.childrenOf(o.path)?.status==="failed"?"failed":"loading";if(!a.isShownExpanded(o.path))return"loading";s=o.children??[]}return s.some(u=>u.type==="file"&&u.path===n)?"ready":"missing"},qe=new Set,It=(e,t)=>e.has(t)?e:new Set(e).add(t),Dt=(e,t)=>{if(!t.some(a=>e.has(a)))return e;const n=new Set(t);return new Set([...e].filter(a=>!n.has(a)))},Ht=(e,t)=>[...e].every(n=>t.has(n))?e:new Set([...e].filter(n=>t.has(n))),Zt=()=>{const[e,t]=r.useState(qe),n=r.useCallback(o=>t(l=>It(l,o)),[]),a=r.useCallback(o=>t(l=>Dt(l,o)),[]),s=r.useCallback(o=>t(l=>Ht(l,o)),[]),u=r.useCallback(()=>t(qe),[]);return r.useMemo(()=>({direct:e,markDirect:n,unmarkDirect:a,pruneDirect:s,clearDirect:u}),[e,n,a,s,u])},$t=e=>({budget:e,handled:new Set,loads:new Set,opened:0,folderLimited:!1,depthLimited:!1,announcedStart:!1,issuedAgainst:null}),Bt=(e,t)=>{const n=[];let a=Re(t.entries,t.compare);for(let s=1;a.length>0;s+=1){const u=[];for(const o of a){const{path:l}=o;if(t.isShownExpanded(l))e.handled.add(l);else{if(e.handled.has(l))continue;if(e.handled.add(l),o.lazy===!0&&t.childrenOf(l)===void 0){if(s>e.budget.maxDepth){e.depthLimited=!0;continue}if(e.loads.size>=e.budget.maxFolders){e.folderLimited=!0;continue}e.loads.add(l)}n.push(l),e.opened+=1}o.lazy!==!0&&o.children!==void 0&&u.push(...Re(o.children,t.compare))}a=u}return n},ze=(e,t)=>e.every(n=>n.type!=="directory"||t(n.path)&&(n.lazy===!0||n.children===void 0||ze(n.children,t))),zt=(e,t)=>{if(e.folderLimited)return{kind:"folder-limit",opened:e.opened};if(e.depthLimited)return{kind:"depth-limit",opened:e.opened};let n=0;for(const a of e.loads)t.childrenOf(a)?.status==="failed"&&(n+=1);return{kind:"done",opened:e.opened,failed:n,complete:ze(t.entries,t.isShownExpanded)}},ve=Object.freeze({state:"idle"}),Vt=e=>{const t=r.useRef(null),n=r.useRef(e),[a,s]=r.useState(ve);r.useLayoutEffect(()=>{n.current=e});const u=r.useCallback(()=>{t.current===null&&(t.current=$t(n.current.budget),s({state:"running",opened:0}))},[]),o=r.useCallback(()=>{t.current=null,s(ve)},[]),l=r.useCallback(i=>{const f=t.current;if(f===null)return;const m=Bt(f,i);if(m.length>0&&(f.issuedAgainst=i.expanded,n.current.expandMultiple([...m])),!f.announcedStart&&(f.loads.size>0||i.waiting>0)&&(f.announcedStart=!0,n.current.onStart()),m.length===0&&!i.expansionPending&&i.expanded!==f.issuedAgainst&&i.waiting===0){t.current=null;const h=zt(f,i);s(h.kind==="done"?ve:{state:"stopped",stop:h.kind,opened:h.opened}),n.current.onFinish(h);return}const{opened:d}=f;s(h=>h.state==="running"&&h.opened===d?h:{state:"running",opened:d})},[]);return r.useMemo(()=>({status:a,start:u,end:o,advance:l}),[a,u,o,l])},Me=["pointerdown","wheel","touchstart","keydown","focusin"],Kt=8,Fe={least:Number.POSITIVE_INFINITY,stalled:0},Xt=({tree:e,container:t,path:n,chain:a,rows:s,cancel:u,displayed:o,placement:l})=>{const i=r.useRef(null),f=r.useRef(!0),m=r.useRef(Fe),d=r.useRef(null),h=r.useRef(null),x=r.useRef(a),g=r.useRef(l);r.useLayoutEffect(()=>{x.current=a,g.current=l},[a,l]);const E=r.useCallback(()=>{const y=d.current;y!==null&&(d.current=null,y.phase==="asking"?y.controller.abort():x.current?.open(null))},[]),j=r.useCallback(()=>{i.current=null,E()},[E]),L=r.useCallback(()=>{const y=t.current;i.current===null||h.current!==null||y===null||y.getClientRects().length===0||(h.current=requestAnimationFrame(()=>{h.current=null;const T=i.current;if(T===null)return;const S=g.current(T);if(S===0){f.current=!0,d.current?.phase==="opening"&&E();return}if(e.current?.scrollToPath(T,{align:"nearest"})===!0){d.current?.phase==="opening"&&E();const{least:q,stalled:_}=m.current;m.current=S<q?{least:S,stalled:0}:{least:q,stalled:_+1},m.current.stalled<Kt&&L();return}const b=d.current;if(b===null){i.current=null;return}b.phase==="opening"&&x.current?.progress(b.folders,T)!=="loading"&&j()}))},[e,t,E,j]),N=r.useCallback(()=>{f.current=!1,m.current=Fe,L()},[L]);r.useEffect(()=>{const y=t.current;if(y===null)return;const T=typeof ResizeObserver>"u"?null:new ResizeObserver(N);T?.observe(y);for(const S of Me)y.addEventListener(S,j,{passive:!0});return()=>{T?.disconnect();for(const S of Me)y.removeEventListener(S,j);h.current!==null&&cancelAnimationFrame(h.current),h.current=null,E()}},[t,N,j,E]);const R=a!==null;r.useEffect(()=>{const y=t.current;if(j(),n===null||y===null||y.contains(y.ownerDocument.activeElement))return;i.current=n;const T=x.current;if(R&&T!==null){const S=new AbortController,b={phase:"asking",controller:S};d.current=b,T.ancestors(n,S.signal).then(q=>{d.current===b&&(q===null?d.current=null:(d.current={phase:"opening",folders:q},x.current?.open(q)),N())})}N()},[n,R,t,j,N]),r.useEffect(()=>{(d.current?.phase==="opening"||i.current!==null&&!f.current)&&N()},[s,N]);const F=r.useRef(u);r.useEffect(()=>{F.current!==u&&(F.current=u,j())},[u,j]);const C=r.useRef(o);r.useEffect(()=>{C.current&&!o&&E(),C.current=o},[o,E])},Wt="--aqmx-tree-line",Gt=Object.freeze(["(forced-colors: active)","(prefers-color-scheme: dark)"]),Ut="data-aqmx-tree-probe",Yt=Object.freeze({rowHeight:A.CONTROL_BLOCK_PIXELS,lineColor:null}),Qt=/^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/u,Jt=e=>{const t=Qt.exec(e);return t===null?e:`#${t.slice(1).map(n=>Number(n).toString(16).padStart(2,"0")).join("")}`},en=(e,t)=>{const[n,a]=r.useState(Yt);return r.useLayoutEffect(()=>{const s=e.current;if(s===null)return;const u=()=>{const i=Math.round(s.getBoundingClientRect().height),f=getComputedStyle(s),m=f.getPropertyValue(Wt).trim()===""?null:Jt(f.color);a(d=>{const h=Number.isFinite(i)&&i>0?i:d.rowHeight;return d.rowHeight===h&&d.lineColor===m?d:{rowHeight:h,lineColor:m}})};u();const o=Gt.map(i=>window.matchMedia(i));for(const i of o)i.addEventListener("change",u);const l=typeof ResizeObserver>"u"?null:new ResizeObserver(u);return l?.observe(s),()=>{for(const i of o)i.removeEventListener("change",u);l?.disconnect()}},[e,t]),n},Ve="markdown-explorer-tree-scroll",tn=.5,Ke=(e,t)=>[...e.querySelectorAll(`[role="treeitem"][${re}]`)].find(n=>n.getAttribute(re)===t),nn=(e,t)=>{const n=Ke(e,t),a=n?.closest(`[data-testid="${Ve}"]`);if(n===void 0||a===null||a===void 0)return Number.POSITIVE_INFINITY;const s=a.getBoundingClientRect(),u=n.getBoundingClientRect(),o=s.top-u.top,l=u.height>s.height?Math.abs(o):Math.max(0,o)+Math.max(0,u.bottom-s.bottom);return l<=tn?0:l},rn={testId:Ve,overscanCount:13,callbackThrottleMs:13,scrollBarOptions:{width:8,enableTrackClick:!0,enableThumbDrag:!0,enableArrowButtons:!0,enableArrowButtonTabStops:!1,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:mt.TAP_SCROLL_CIRCLE},behaviorOptions:{enablePointerDrag:!0}},an={hoverClassName:"",directorySelectedClassName:"",itemSelectedClassName:""},ln={color:"inherit",fontSize:"inherit"},on={fontSize:"inherit"},sn=new Set,cn=new Map,un={color:"var(--aqmx-tree-line)"},dn=e=>{const t=e instanceof Element?e.closest(`[${re}]`):null;return t===null||t.getAttribute("data-entry-type")!=="file"?null:t.getAttribute(re)},Xe=(e,t,n,a)=>n==="folder-limit"?e.expandAllFolderLimit(a,t.maxFolders,e.expandAll):e.expandAllDepthLimit(a,t.maxDepth),fn=(e,t,n)=>n.kind==="done"?e.expandAllDone(n.opened,n.failed,n.complete):Xe(e,t,n.kind,n.opened),We=()=>{const{labels:e}=v.useExplorer();return c.jsxs("div",{className:"aqmx-explorer-loading","aria-busy":"true","data-testid":"markdown-explorer-tree-loading",children:[c.jsx("p",{className:"aqmx-explorer-loading-text",children:e.treeLoading}),c.jsxs("div",{className:"aqmx-skeleton","aria-hidden":"true",children:[c.jsx("span",{}),c.jsx("span",{}),c.jsx("span",{}),c.jsx("span",{}),c.jsx("span",{})]})]})},mn=()=>{const{labels:e}=v.useExplorer();return c.jsxs("div",{className:"aqmx-empty","data-testid":"markdown-explorer-tree-empty",children:[c.jsx(Tt,{className:"aqmx-explorer-empty-icon","aria-hidden":"true"}),c.jsx("p",{className:"aqmx-empty-title",children:e.treeEmptyTitle}),c.jsx("p",{className:"aqmx-explorer-empty-body",children:e.treeEmptyBody})]})},pn=({name:e,onRetry:t})=>{const{labels:n}=v.useExplorer(),a=r.useId();return c.jsxs("span",{className:"aqmx-explorer-folder-failed",children:[c.jsx("span",{className:"aqmx-explorer-folder-name",children:e}),c.jsx("span",{id:a,className:"aqmx-explorer-folder-error",children:n.folderLoadFailed}),c.jsxs("button",{type:"button",className:"aqmx-explorer-folder-retry","aria-describedby":a,"data-testid":"markdown-explorer-folder-retry",onClick:s=>{s.stopPropagation();const u=s.currentTarget,o=u.ownerDocument.activeElement===u?u.closest('[role="treeitem"]'):null;o instanceof HTMLElement&&v.focusWithoutScroll(o),t()},onKeyDown:s=>{s.key!=="Escape"&&s.stopPropagation()},children:[c.jsx(v.ForwardRef,{className:"aqmx-explorer-folder-retry-icon","aria-hidden":"true"}),c.jsx("span",{className:"aqmx-explorer-folder-retry-text",children:n.retry})]})]})},hn=({entries:e,version:t,mode:n,sourceId:a,settings:s,reveal:u,openPaths:o,selection:l,onOpenDocument:i,folders:f,onRevealSource:m,expansion:d,onShown:h,marks:x,claimsHeld:g,expandAll:E,revealCancel:j})=>{const{trees:L,documents:N,labels:R,locale:F,theme:C,data:y,config:T,sources:S,reveals:b}=v.useExplorer(),q=r.use(ye),[_]=r.useState(At),ae=r.useRef(null),{rowHeight:Q,lineColor:Z}=en(ae,C),{isExpanded:$,toggle:J,expandMultiple:I,collapseMultiple:X,expanded:W,isPending:G}=d,{alwaysExpanded:O,sortMode:ee,folderPlacement:le,readmePlacement:ue}=s,{direct:te,markDirect:B,unmarkDirect:U,pruneDirect:fe}=x,{running:oe,advance:se}=E,de=r.useRef(null),ne=r.useRef(null),z=r.useMemo(()=>A.createEntryComparator({sortMode:ee,folderPlacement:le,readmePlacement:ue}),[ee,le,ue]),P=r.useMemo(()=>qt(z),[z]),M=r.useCallback(w=>L.children(a,w),[L,a]),D=r.useMemo(()=>Ft(e),[e]),Y=r.useCallback(w=>!ie(w)&&($(w)||O&&!D.has(w)),[$,O,D]),V=r.useRef({shownExpanded:Y,isExpanded:$,unloadedFolders:D,entries:e,childrenOf:M});r.useLayoutEffect(()=>{V.current={shownExpanded:Y,isExpanded:$,unloadedFolders:D,entries:e,childrenOf:M}},[Y,$,D,e,M]);const Ce=r.useCallback(w=>{de.current?.scrollToPath(w,{align:"nearest"}),requestAnimationFrame(()=>{const k=ne.current,H=k===null?void 0:Ke(k,w);H!==void 0&&v.focusWithoutScroll(H)})},[]),tt=r.useCallback(w=>{if(ie(w)){Ce(Pt(w));return}V.current.isExpanded(w)?U([w]):V.current.unloadedFolders.has(w)&&B(w),J(w)},[Ce,B,U,J]),ge=r.useCallback(w=>{const k=w.filter(H=>!ie(H));k.length!==0&&(U(k),X(k))},[U,X]),nt=r.useCallback(w=>{const k=w.filter(H=>!ie(H));k.length!==0&&(k.length<w.length&&k.every(H=>V.current.shownExpanded(H))?ge(k):I(k))},[I,ge]),Te=r.useCallback(w=>c.jsx(pn,{name:w.name,onRetry:()=>{B(w.path),L.retryChildren(a,w.path),V.current.shownExpanded(w.path)||I([w.path])}}),[L,a,B,I]),Le=n==="multi"?o:sn,{loopFolderName:je}=R,rt=r.useMemo(()=>_(e,{openPaths:Le,childrenOf:M,renderFailedFolder:Te,loopFolderName:je}),[_,e,Le,M,Te,je,t]),at=v.useIntentPrefetch(N,dn),Pe=r.useRef([]),me=r.useCallback(()=>{for(const w of Pe.current)V.current.unloadedFolders.has(w)&&B(w)},[B]),{maxDepth:Ee}=T.revealDocument,Ne=r.useRef(m);r.useLayoutEffect(()=>{Ne.current=m},[m]);const lt=r.useMemo(()=>({ancestors:async(w,k)=>{const H=b.take(a,w);if(H!==null)return H;if(!b.mayMove(w)){const ce=await y.ancestors(a,w,k);return ce.status!=="ok"||ce.ancestors===null||ce.ancestors.length>Ee?null:ce.ancestors}const K=await y.reveal(a,w,k);return K.status!=="ok"||K.source===null||K.ancestors.length>Ee?null:K.source===a?K.ancestors:(k.aborted||!S.some(ce=>ce.id===K.source)||(b.move(K.source,w,K.ancestors),Ne.current(K.source)),null)},open:w=>{Pe.current=w??[],w!==null&&(me(),I([...w]))},progress:(w,k)=>_t(V.current.entries,w,k,{isShownExpanded:V.current.shownExpanded,childrenOf:V.current.childrenOf})}),[y,a,S,b,Ee,me,I]);r.useEffect(()=>me(),[me,D]);const ot=r.useMemo(()=>[e,t,W],[e,t,W]),st=r.useCallback(w=>ne.current===null?Number.POSITIVE_INFINITY:nn(ne.current,w),[]);Xt({tree:de,container:ne,path:u.path,chain:u.openFolders?lt:null,rows:ot,cancel:j,displayed:q,placement:st});const Oe=r.useCallback(w=>te.has(w),[te]),pe=r.useMemo(()=>Mt(e,{isShownExpanded:Y,childrenOf:M,compare:z,isDirect:Oe}),[e,Y,M,z,Oe,t]),he=q&&g;r.useLayoutEffect(()=>{h(e)},[e,h]),r.useLayoutEffect(()=>()=>h(null),[h]),r.useEffect(()=>L.claimChildren(a,he?pe.folders:cn),[L,a,he,pe]),r.useEffect(()=>fe(D),[fe,D]),r.useEffect(()=>{he&&oe&&se({entries:e,isShownExpanded:Y,childrenOf:M,compare:z,expanded:W,waiting:pe.waiting,expansionPending:G})},[he,oe,se,e,Y,M,z,W,pe,G]);const ct=r.useCallback(w=>{const k=w.entry.absolutePath;if(w.isDirectory){if(f===null||ie(k)||k===f.current)return;w.isExpanded&&w.preventDefault(),b.settle(k),f.open(k);return}b.settle(k),i(k)},[b,i,f]),{onChange:be}=l,it=r.useMemo(()=>be===null?void 0:(w,k)=>{ie(w.absolutePath)||be({path:w.absolutePath,name:w.name,selected:k})},[be]),ut=r.useMemo(()=>new Set(l.items),[l.items]),dt=r.useMemo(()=>({entryKindDirectory:R.treeEntryKindDirectory,entryKindFile:R.treeEntryKindFile,scrollUp:R.treeScrollUp,scrollDown:R.treeScrollDown,scrollToTop:R.treeScrollToTop,scrollToBottom:R.treeScrollToBottom}),[R]),ft=Z===null?{showTreeLines:!1}:{showTreeLines:s.lines,lineColor:Z};return c.jsxs("div",{ref:ne,className:"aqmx-explorer-tree","data-testid":"markdown-explorer-tree",...at,children:[c.jsx("span",{ref:ae,className:"aqmx-explorer-tree-probe","aria-hidden":"true",[Ut]:""}),c.jsx(He.DirectoryTree,{ref:de,entries:rt,expansion:{toggle:tt,isExpanded:Y,expandMultiple:nt,collapseMultiple:ge,isPending:G&&!oe,doubleClickAction:s.doubleClickAction},selection:{mode:l.mode,selectedPath:l.shownPath,currentPath:l.shownPath,selectedItems:ut,onEntryClick:ct,onSelectionChange:it},visual:{className:"aqmx-explorer-tree-view",ariaLabel:R.treeRegion,...ft,showExpandIcons:s.expandIcons,expandIconStyle:un,showDirectoryIcons:s.directoryIcons,showFileIcons:s.fileIcons,expandIconSize:s.expandIconSize,itemHeight:Q,removeRootIndent:s.removeRootIndent,highlightStyles:an,entryStyle:on,nameStyle:ln},virtualScroll:rn,sort:P,locale:F,labels:dt})]})},xn=({pending:e,status:t})=>{const{labels:n}=v.useExplorer(),a=t.state!=="running",[s,u]=r.useState(0),o=r.useRef(!0);r.useLayoutEffect(()=>{const i=o.current;if(o.current=a,!a||e>0&&!i){u(0);return}if(e>0){u(e);return}if(s===0)return;const f=setTimeout(()=>u(0),0);return()=>clearTimeout(f)},[a,e,s]);const l=a&&e===0?s:e;return l===0&&a?null:c.jsxs("p",{className:"aqmx-explorer-tree-progress","data-testid":"markdown-explorer-tree-progress","data-aqmx-loading":String(l),"data-aqmx-expand-all":t.state,children:[l>0?c.jsx(v.ForwardRef,{className:"aqmx-explorer-tree-progress-icon","aria-hidden":"true"}):null,c.jsx("span",{children:t.state==="running"?n.expandAllProgress(t.opened,l):n.foldersLoading(l)})]})},wn=({stop:e,opened:t,budget:n})=>{const{labels:a}=v.useExplorer();return c.jsx("p",{className:"aqmx-explorer-expand-all-stop","data-testid":"markdown-explorer-expand-all-stop","data-aqmx-stop":e,children:Xe(a,n,e,t)})},gn=({entries:e,...t})=>{const{trees:n}=v.useExplorer(),a=r.useSyncExternalStore(n.subscribe,n.version,n.version),{sourceId:s}=t,[u]=r.useState(Lt),o=r.useMemo(()=>u(e,l=>n.children(s,l)),[u,e,n,s,a]);return o.length===0?c.jsx(mn,{}):c.jsx(hn,{entries:o,version:a,...t})},En=({result:e,onRetry:t,...n})=>{const{renderTreeFailure:a}=v.useExplorer(),s=r.use(e);if(s.status==="deferred")return c.jsx(We,{});if(s.status==="ok")return c.jsx(gn,{entries:s.entries,...n});const u=a?.(s.failure);return c.jsx("div",{className:"aqmx-explorer-tree-message","data-testid":"markdown-explorer-tree-failure","data-aqmx-failure":s.failure.reason,children:u!==void 0?u:c.jsx(v.FailureView,{failure:s.failure,alert:!0,onRetry:t,testId:null})})},bn=({onControls:e,...t})=>{const{trees:n,storageNamespace:a,labels:s,announcer:u,config:o}=v.useExplorer(),{sourceId:l}=t,i=He.useDirectoryTreeState({storageKey:pt.storageKeys(a).treeExpansion(l)});r.useSyncExternalStore(n.subscribe,n.version,n.version);const f=n.read(l),m=r.useCallback(()=>n.retry(l),[n,l]);r.useLayoutEffect(()=>n.open(l),[n,l]);const d=Zt(),{expanded:h,expandMultiple:x,collapseAll:g}=i,[E,j]=r.useState(null),L=E!==h,N=r.useRef(h);r.useLayoutEffect(()=>{N.current=h},[h]);const R=o.expandAll,F=r.useCallback(()=>u.announce(s.expandAllStarted),[u,s]),C=r.useCallback(O=>u.announce(fn(s,R,O)),[u,s,R]),y=Vt({budget:R,expandMultiple:x,onStart:F,onFinish:C}),{status:T,start:S,end:b,advance:q}=y,_=T.state==="running",ae=r.useMemo(()=>({running:_,advance:q}),[_,q]),Q=r.useRef(null),[Z,$]=r.useState(!1),J=r.useCallback(O=>{Q.current=O,$(O!==null)},[]);r.useEffect(()=>n.subscribeChildrenFailures(O=>{const ee=O.sourceId===l&&Q.current!==null?Be(Q.current,O.path):null;ee!==null&&u.announce({list:s.foldersLoadFailedNamed,item:ee.name})}),[n,l,u,s]);const{clearDirect:I}=d,[X,W]=r.useState(0),G=r.useCallback(()=>{W(O=>O+1),b(),I(),j(N.current),g()},[b,I,g]);return r.useEffect(()=>{e({collapseAll:G,expandAll:Z?S:null,expanding:_})},[e,G,S,Z,_]),r.useEffect(()=>()=>e(null),[e]),r.useEffect(()=>{Z||b()},[Z,b]),c.jsxs(c.Fragment,{children:[T.state==="stopped"?c.jsx(wn,{stop:T.stop,opened:T.opened,budget:R}):null,c.jsxs("div",{className:"aqmx-explorer-tree-area",children:[c.jsx(r.Suspense,{fallback:c.jsx(We,{}),children:c.jsx(En,{result:f,onRetry:m,expansion:i,onShown:J,marks:d,claimsHeld:L,expandAll:ae,revealCancel:X,...t})}),c.jsx(xn,{pending:n.pendingChildren(l),status:T})]})]})};function vn({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const Ge=p.forwardRef(vn),_e="markdown-explorer-selection-remove",Rn=({selection:e,onRemove:t,onClear:n,onOpenSelection:a,onLeave:s})=>{const{labels:u}=v.useExplorer(),o=r.useId(),l=r.useRef(null),i=[...e],f=(d,h)=>{if(h.ownerDocument.activeElement===h){const x=l.current===null?[]:[...l.current.querySelectorAll(`[data-testid="${_e}"]`)],g=x.indexOf(h),E=[x[g+1],x[g-1]].find(j=>j!==void 0);E===void 0?s():E.focus()}t(d)},m=()=>{const d=l.current;d!==null&&d.contains(d.ownerDocument.activeElement)&&s(),n()};return c.jsxs("section",{ref:l,className:"aqmx-explorer-tray","aria-labelledby":o,"data-testid":"markdown-explorer-selection-tray",children:[c.jsxs("div",{className:"aqmx-explorer-tray-header",children:[c.jsx("p",{id:o,className:"aqmx-explorer-tray-title",children:u.selectionTitle(i.length)}),c.jsx("button",{type:"button",className:"aqmx-explorer-tray-button","data-testid":"markdown-explorer-selection-clear",onClick:m,children:u.clearSelection})]}),c.jsx("ul",{className:"aqmx-explorer-tray-list",children:i.map(([d,h])=>c.jsxs("li",{className:"aqmx-explorer-tray-item",children:[c.jsx("span",{className:"aqmx-explorer-tray-name",title:d,children:h}),c.jsx("button",{type:"button",className:"aqmx-icon-button aqmx-explorer-tray-remove","aria-label":u.removeFromSelection(h),title:u.removeFromSelection(h),"data-testid":_e,"data-aqmx-path":d,onClick:x=>f(d,x.currentTarget),children:c.jsx(Ge,{"aria-hidden":"true"})})]},d))}),a===void 0?null:c.jsx("button",{type:"button",className:"aqmx-explorer-tray-open","data-testid":"markdown-explorer-selection-open",onClick:()=>a(i.map(([d])=>d)),children:u.openSelectionInMulti(i.length)})]})},we=new Map,yn=(e,t)=>{if(t.selected===e.has(t.path))return e;const n=new Map(e);return t.selected?n.set(t.path,t.name):n.delete(t.path),n},Sn=(e,t)=>{if(!e.has(t))return e;const n=new Map(e);return n.delete(t),n},Ue=r.createContext(null),kn=e=>{const t=r.use(Ue);r.useLayoutEffect(()=>{if(t!==null)return t(e),()=>t(!1)},[t,e])};function Cn({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M15 3.75a.75.75 0 0 1 .75-.75h4.5a.75.75 0 0 1 .75.75v4.5a.75.75 0 0 1-1.5 0V5.56l-3.97 3.97a.75.75 0 1 1-1.06-1.06l3.97-3.97h-2.69a.75.75 0 0 1-.75-.75Zm-12 0A.75.75 0 0 1 3.75 3h4.5a.75.75 0 0 1 0 1.5H5.56l3.97 3.97a.75.75 0 0 1-1.06 1.06L4.5 5.56v2.69a.75.75 0 0 1-1.5 0v-4.5Zm11.47 11.78a.75.75 0 1 1 1.06-1.06l3.97 3.97v-2.69a.75.75 0 0 1 1.5 0v4.5a.75.75 0 0 1-.75.75h-4.5a.75.75 0 0 1 0-1.5h2.69l-3.97-3.97Zm-4.94-1.06a.75.75 0 0 1 0 1.06L5.56 19.5h2.69a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1-.75-.75v-4.5a.75.75 0 0 1 1.5 0v2.69l3.97-3.97a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"}))}const Tn=p.forwardRef(Cn);function Ln({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M6.97 2.47a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1-1.06 1.06L8.25 4.81V16.5a.75.75 0 0 1-1.5 0V4.81L3.53 8.03a.75.75 0 0 1-1.06-1.06l4.5-4.5Zm9.53 4.28a.75.75 0 0 1 .75.75v11.69l3.22-3.22a.75.75 0 1 1 1.06 1.06l-4.5 4.5a.75.75 0 0 1-1.06 0l-4.5-4.5a.75.75 0 1 1 1.06-1.06l3.22 3.22V7.5a.75.75 0 0 1 .75-.75Z",clipRule:"evenodd"}))}const jn=p.forwardRef(Ln);function Pn({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{d:"M11.25 4.533A9.707 9.707 0 0 0 6 3a9.735 9.735 0 0 0-3.25.555.75.75 0 0 0-.5.707v14.25a.75.75 0 0 0 1 .707A8.237 8.237 0 0 1 6 18.75c1.995 0 3.823.707 5.25 1.886V4.533ZM12.75 20.636A8.214 8.214 0 0 1 18 18.75c.966 0 1.89.166 2.75.47a.75.75 0 0 0 1-.708V4.262a.75.75 0 0 0-.5-.707A9.735 9.735 0 0 0 18 3a9.707 9.707 0 0 0-5.25 1.533v16.103Z"}))}const Nn=p.forwardRef(Pn);function On({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm13.36-1.814a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 12.22a.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"}))}const An=p.forwardRef(On);function qn({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M7.72 12.53a.75.75 0 0 1 0-1.06l7.5-7.5a.75.75 0 1 1 1.06 1.06L9.31 12l6.97 6.97a.75.75 0 1 1-1.06 1.06l-7.5-7.5Z",clipRule:"evenodd"}))}const Mn=p.forwardRef(qn);function Fn({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M11.47 4.72a.75.75 0 0 1 1.06 0l3.75 3.75a.75.75 0 0 1-1.06 1.06L12 6.31 8.78 9.53a.75.75 0 0 1-1.06-1.06l3.75-3.75Zm-3.75 9.75a.75.75 0 0 1 1.06 0L12 17.69l3.22-3.22a.75.75 0 1 1 1.06 1.06l-3.75 3.75a.75.75 0 0 1-1.06 0l-3.75-3.75a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const _n=p.forwardRef(Fn);function In({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M11.078 2.25c-.917 0-1.699.663-1.85 1.567L9.05 4.889c-.02.12-.115.26-.297.348a7.493 7.493 0 0 0-.986.57c-.166.115-.334.126-.45.083L6.3 5.508a1.875 1.875 0 0 0-2.282.819l-.922 1.597a1.875 1.875 0 0 0 .432 2.385l.84.692c.095.078.17.229.154.43a7.598 7.598 0 0 0 0 1.139c.015.2-.059.352-.153.43l-.841.692a1.875 1.875 0 0 0-.432 2.385l.922 1.597a1.875 1.875 0 0 0 2.282.818l1.019-.382c.115-.043.283-.031.45.082.312.214.641.405.985.57.182.088.277.228.297.35l.178 1.071c.151.904.933 1.567 1.85 1.567h1.844c.916 0 1.699-.663 1.85-1.567l.178-1.072c.02-.12.114-.26.297-.349.344-.165.673-.356.985-.57.167-.114.335-.125.45-.082l1.02.382a1.875 1.875 0 0 0 2.28-.819l.923-1.597a1.875 1.875 0 0 0-.432-2.385l-.84-.692c-.095-.078-.17-.229-.154-.43a7.614 7.614 0 0 0 0-1.139c-.016-.2.059-.352.153-.43l.84-.692c.708-.582.891-1.59.433-2.385l-.922-1.597a1.875 1.875 0 0 0-2.282-.818l-1.02.382c-.114.043-.282.031-.449-.083a7.49 7.49 0 0 0-.985-.57c-.183-.087-.277-.227-.297-.348l-.179-1.072a1.875 1.875 0 0 0-1.85-1.567h-1.843ZM12 15.75a3.75 3.75 0 1 0 0-7.5 3.75 3.75 0 0 0 0 7.5Z",clipRule:"evenodd"}))}const Dn=p.forwardRef(In);function Hn({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M12 1.5a.75.75 0 0 1 .75.75V4.5a.75.75 0 0 1-1.5 0V2.25A.75.75 0 0 1 12 1.5ZM5.636 4.136a.75.75 0 0 1 1.06 0l1.592 1.591a.75.75 0 0 1-1.061 1.06l-1.591-1.59a.75.75 0 0 1 0-1.061Zm12.728 0a.75.75 0 0 1 0 1.06l-1.591 1.592a.75.75 0 0 1-1.06-1.061l1.59-1.591a.75.75 0 0 1 1.061 0Zm-6.816 4.496a.75.75 0 0 1 .82.311l5.228 7.917a.75.75 0 0 1-.777 1.148l-2.097-.43 1.045 3.9a.75.75 0 0 1-1.45.388l-1.044-3.899-1.601 1.42a.75.75 0 0 1-1.247-.606l.569-9.47a.75.75 0 0 1 .554-.68ZM3 10.5a.75.75 0 0 1 .75-.75H6a.75.75 0 0 1 0 1.5H3.75A.75.75 0 0 1 3 10.5Zm14.25 0a.75.75 0 0 1 .75-.75h2.25a.75.75 0 0 1 0 1.5H18a.75.75 0 0 1-.75-.75Zm-8.962 3.712a.75.75 0 0 1 0 1.061l-1.591 1.591a.75.75 0 1 1-1.061-1.06l1.591-1.592a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"}))}const Zn=p.forwardRef(Hn);function $n({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M5.625 1.5c-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.5H5.625ZM7.5 15a.75.75 0 0 1 .75-.75h7.5a.75.75 0 0 1 0 1.5h-7.5A.75.75 0 0 1 7.5 15Zm.75 2.25a.75.75 0 0 0 0 1.5H12a.75.75 0 0 0 0-1.5H8.25Z",clipRule:"evenodd"}),p.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 Bn=p.forwardRef($n);function zn({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{d:"M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z"}))}const Vn=p.forwardRef(zn);function Kn({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{d:"M19.906 9c.382 0 .749.057 1.094.162V9a3 3 0 0 0-3-3h-3.879a.75.75 0 0 1-.53-.22L11.47 3.66A2.25 2.25 0 0 0 9.879 3H6a3 3 0 0 0-3 3v3.162A3.756 3.756 0 0 1 4.094 9h15.812ZM4.094 10.5a2.25 2.25 0 0 0-2.227 2.568l.857 6A2.25 2.25 0 0 0 4.951 21H19.05a2.25 2.25 0 0 0 2.227-1.932l.857-6a2.25 2.25 0 0 0-2.227-2.568H4.094Z"}))}const Xn=p.forwardRef(Kn);function Wn({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M10.5 3.75a6.75 6.75 0 1 0 0 13.5 6.75 6.75 0 0 0 0-13.5ZM2.25 10.5a8.25 8.25 0 1 1 14.59 5.28l4.69 4.69a.75.75 0 1 1-1.06 1.06l-4.69-4.69A8.25 8.25 0 0 1 2.25 10.5Zm8.25-3.75a.75.75 0 0 1 .75.75v2.25h2.25a.75.75 0 0 1 0 1.5h-2.25v2.25a.75.75 0 0 1-1.5 0v-2.25H7.5a.75.75 0 0 1 0-1.5h2.25V7.5a.75.75 0 0 1 .75-.75Z",clipRule:"evenodd"}))}const Gn=p.forwardRef(Wn);function Un({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{d:"M5.625 3.75a2.625 2.625 0 1 0 0 5.25h12.75a2.625 2.625 0 0 0 0-5.25H5.625ZM3.75 11.25a.75.75 0 0 0 0 1.5h16.5a.75.75 0 0 0 0-1.5H3.75ZM3 15.75a.75.75 0 0 1 .75-.75h16.5a.75.75 0 0 1 0 1.5H3.75a.75.75 0 0 1-.75-.75ZM3.75 18.75a.75.75 0 0 0 0 1.5h16.5a.75.75 0 0 0 0-1.5H3.75Z"}))}const Yn=p.forwardRef(Un),Qn=Object.freeze({sortMode:jn,folderPlacement:Vn,readmePlacement:Nn,selectionMode:An,doubleClickAction:Zn,expandIconSize:Gn,alwaysExpanded:Tn,revealDocument:v.ForwardRef$1,removeRootIndent:Mn,lines:Yn,expandIcons:_n,directoryIcons:Xn,fileIcons:Bn}),Ye=(e,t)=>{const n=e[t.labelKey];if(typeof n!="string")throw new TypeError(`[markdown-explorer] the tree setting ${t.key} must name a string label; labels.${t.labelKey} is a ${typeof n}`);return n},Jn=({id:e,settings:t,descriptors:n,onAdvance:a,onClose:s,ref:u})=>{const{labels:o}=v.useExplorer(),l=r.useRef([]);r.useEffect(()=>{l.current[0]?.focus()},[]);const i=r.useCallback(m=>{const d=n.length;l.current[(m%d+d)%d]?.focus()},[n.length]),f=r.useCallback((m,d)=>{switch(m.key){case"ArrowDown":m.preventDefault(),i(d+1);break;case"ArrowUp":m.preventDefault(),i(d-1);break;case"Home":m.preventDefault(),i(0);break;case"End":m.preventDefault(),i(n.length-1);break;case"Escape":v.consumeKey(m),s();break;case"Tab":s();break}},[n.length,i,s]);return c.jsx("div",{ref:u,id:e,role:"menu","aria-label":o.treeSettings,className:"aqmx-explorer-menu","data-testid":"markdown-explorer-tree-settings-menu",children:n.map((m,d)=>{const h=Qn[m.key],x=Ye(o,m),g=A.formatTreeSettingValue(o,t,m.key),E=t[m.key],j=typeof E=="boolean"?{role:"menuitemcheckbox","aria-checked":E,"aria-label":x}:{role:"menuitem","aria-label":`${x}: ${g}`};return c.jsxs("button",{ref:L=>{l.current[d]=L},type:"button",tabIndex:-1,...j,title:`${x}: ${g}`,className:"aqmx-explorer-menu-item","data-testid":"markdown-explorer-tree-settings-item","data-aqmx-setting":m.key,onClick:()=>a(m),onKeyDown:L=>f(L,d),children:[c.jsx(h,{className:"aqmx-explorer-menu-icon","aria-hidden":"true"}),c.jsx("span",{className:"aqmx-explorer-menu-name",children:x}),c.jsx("span",{className:"aqmx-explorer-menu-value",children:g})]},m.key)})})},er=({settings:e,descriptors:t,onAdvance:n})=>{const{labels:a,announcer:s}=v.useExplorer(),[u,o]=r.useState(!1),l=r.useRef(null),i=r.useRef(null),f=r.useRef(null),m=r.useId(),d=r.useCallback(()=>{l.current?.focus(),o(!1)},[]);r.useEffect(()=>{if(!u)return;const g=E=>{E.target instanceof Node&&(l.current?.contains(E.target)===!0||i.current?.contains(E.target)===!0)||(o(!1),f.current!==null&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>{f.current=null,(document.activeElement===null||document.activeElement===document.body)&&l.current?.focus()},0))};return document.addEventListener("pointerdown",g),()=>document.removeEventListener("pointerdown",g)},[u]),r.useEffect(()=>()=>{f.current!==null&&window.clearTimeout(f.current)},[]);const h=r.useCallback(g=>{g.key!=="Escape"||!u||(v.consumeKey(g),d())},[u,d]),x=r.useCallback(g=>{const E=n(g.key);s.announce(a.settingAnnouncement(Ye(a,g),A.formatTreeSettingValue(a,E,g.key)))},[s,a,n]);return{trigger:c.jsx("button",{ref:l,type:"button",className:"aqmx-icon-button","aria-haspopup":"menu","aria-expanded":u,"aria-controls":u?m:void 0,"aria-label":a.treeSettings,title:a.treeSettings,"data-testid":"markdown-explorer-tree-settings",onClick:()=>o(g=>!g),onKeyDown:h,children:c.jsx(Dn,{"aria-hidden":"true"})}),menu:u?c.jsx(Jn,{ref:i,id:m,settings:e,descriptors:t,onAdvance:x,onClose:d}):null}},tr=()=>{const{treeSettings:e}=v.useExplorer();return{settings:r.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot),advance:e.advance}},Ie=new Set,nr='[role="tree"] [role="treeitem"][tabindex="0"]',rr="[data-directory-tree-tab-stop]",ar=e=>{const{mode:t,sourceId:n,currentPath:a,openPaths:s,onOpenDocument:u,onSourceChange:o,onRevealSource:l,viewSwitch:i}=e,{labels:f,sources:m,trees:d,documents:h,announcer:x,reveals:g}=v.useExplorer(),{settings:E,advance:j}=tr(),L=r.useMemo(()=>A.visibleTreeSettingDescriptors(t==="tree"),[t]),N=t==="tree"&&E.selectionMode==="multiple";kn(N);const R=e.mode==="tree"?e.tray.onGatheredChange:null,F=e.mode==="tree"?e.onOpenSelection:void 0,C=e.mode==="tree"?e.onOpenFolder:null,y=e.mode==="tree"&&e.currentFolder,T=r.useMemo(()=>C===null?null:{current:a,open:C},[C,a]),S=e.mode==="tree"&&N?e.tray.gathered:we,b=r.useCallback(P=>{const M=j(P);return M.selectionMode!=="multiple"&&R?.(we),M},[j,R]),q=er({settings:E,descriptors:L,onAdvance:b}),_=r.useCallback(P=>R?.(M=>yn(M,P)),[R]),ae=r.useCallback(P=>R?.(M=>Sn(M,P)),[R]),Q=r.useCallback(()=>R?.(we),[R]),Z=r.useRef(null),$=r.useCallback(()=>{const P=Z.current;if(P===null)return;[nr,rr,'[data-testid="markdown-explorer-tree-settings"]'].map(D=>P.querySelector(D)).find(D=>D!==null)?.focus()},[]),J=r.useMemo(()=>new Set(S.keys()),[S]),I=r.useMemo(()=>a===null?Ie:new Set([a]),[a]),X=r.useMemo(()=>{if(t==="multi")return{mode:"multiple",items:s,shownPath:null,onChange:null};switch(E.selectionMode){case"single":return{mode:"single",items:I,shownPath:a,onChange:null};case"multiple":return{mode:"multiple",items:J,shownPath:a,onChange:_};case"none":return{mode:"none",items:Ie,shownPath:null,onChange:null}}},[t,s,E.selectionMode,I,a,J,_]),W=r.useMemo(()=>E.revealDocument?{path:a,openFolders:!y}:{path:X.shownPath,openFolders:!1},[E.revealDocument,a,y,X.shownPath]),G=r.useCallback(P=>{a!==null&&g.settle(a),o(P)},[a,g,o]),[O,ee]=r.useState(null),[le,ue]=r.useState(!1),[te,B]=r.useState(null),U=r.useRef(!1),fe=r.useCallback(async()=>{if(!U.current){U.current=!0,ue(!0),B(null);try{const P=await d.refresh(n);if(P.status==="superseded")return;h.invalidate(),P.status==="failed"?B({sourceId:n,failure:P.failure}):x.announce(f.treeRefreshed)}finally{U.current=!1,ue(!1)}}},[d,h,n,x,f]),oe=O===null?null:O.expandAll,se=O?.expanding===!0,de=m.find(P=>P.id===n),ne=i.target==="multi"?St:Rt,z=i.target==="multi"?f.switchToMulti:f.switchToTree;return c.jsxs("nav",{ref:Z,"aria-label":f.explorerRegion,className:"aqmx-explorer","data-testid":"markdown-explorer-explorer","data-aqmx-mode":t,children:[c.jsxs("div",{className:"aqmx-explorer-header",children:[m.length>1?c.jsx("select",{className:"aqmx-explorer-source","aria-label":f.sourceLabel,title:de?.label,value:n,onChange:P=>G(P.currentTarget.value),"data-testid":"markdown-explorer-source-select",children:m.map(P=>c.jsx("option",{value:P.id,children:P.label},P.id))}):null,c.jsxs("div",{className:"aqmx-explorer-actions",children:[c.jsx(v.ExplorerLink,{to:i.href,navigation:"switch-view",className:"aqmx-icon-button","aria-label":z,title:z,"data-testid":"markdown-explorer-view-switch","data-aqmx-target":i.target,children:c.jsx(ne,{"aria-hidden":"true"})}),c.jsxs("button",{type:"button",className:"aqmx-icon-button aqmx-labelled-button",title:f.refreshTree,"aria-disabled":le,"aria-busy":le,"data-aqmx-busy":le?"true":void 0,"data-testid":"markdown-explorer-refresh",onClick:()=>{fe()},children:[c.jsx(v.ForwardRef,{"aria-hidden":"true"}),c.jsx("span",{children:f.refreshTreeLabel})]}),c.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":f.expandAll,title:f.expandAll,"aria-disabled":oe===null||se,"aria-busy":se,"data-aqmx-busy":se?"true":void 0,"data-testid":"markdown-explorer-expand-all",onClick:()=>oe?.(),children:c.jsx(bt,{"aria-hidden":"true"})}),c.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":f.collapseAll,title:f.collapseAll,"aria-disabled":O===null,"data-testid":"markdown-explorer-collapse-all",onClick:()=>O?.collapseAll(),children:c.jsx(gt,{"aria-hidden":"true"})}),q.trigger]})]}),c.jsxs("div",{className:"aqmx-explorer-body","data-aqmx-explorer-body":"",children:[te!==null&&te.sourceId===n?c.jsx("p",{role:"alert",className:"aqmx-explorer-refresh-failure","data-testid":"markdown-explorer-refresh-failure","data-aqmx-failure":te.failure.reason,children:f.treeRefreshFailed(v.failureTitleOf(f,te.failure.reason))}):null,c.jsx(r.Suspense,{fallback:null,children:c.jsx(kt,{})}),c.jsx(bn,{mode:t,sourceId:n,settings:E,reveal:W,openPaths:s,selection:X,onOpenDocument:u,folders:T,onRevealSource:l,onControls:ee},n),N&&S.size>0?c.jsx(Rn,{selection:S,onRemove:ae,onClear:Q,onOpenSelection:F,onLeave:$}):null,q.menu]})]})};function lr({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M3 6.75A.75.75 0 0 1 3.75 6h16.5a.75.75 0 0 1 0 1.5H3.75A.75.75 0 0 1 3 6.75ZM3 12a.75.75 0 0 1 .75-.75h16.5a.75.75 0 0 1 0 1.5H3.75A.75.75 0 0 1 3 12Zm0 5.25a.75.75 0 0 1 .75-.75h16.5a.75.75 0 0 1 0 1.5H3.75a.75.75 0 0 1-.75-.75Z",clipRule:"evenodd"}))}const or=p.forwardRef(lr),sr=({explorer:e,toggleRef:t,covered:n,onNoticeSlotChange:a,dismissals:s})=>{const{labels:u}=v.useExplorer(),o=ht.useLocation(),{location:l}=v.useExplorerLocation(),[i,f]=r.useState(!1),[m,d]=r.useState({navigated:o,source:l.source}),[h,x]=r.useState(!1);m.navigated!==o&&(d({navigated:o,source:l.source}),m.source===l.source&&!h&&f(!1));const[g,E]=r.useState(s);g!==s&&(E(s),f(!1));const j=r.useRef(null),L=r.useRef(null),N=r.useRef(null),R=r.useRef(!1),F=r.useId();r.useLayoutEffect(()=>{const b=j.current;b!==null&&(i&&!b.open?(b.showModal(),L.current?.focus()):!i&&b.open&&(b.close(),t.current?.focus()),a(i?N.current:null))},[i,t,a]),r.useLayoutEffect(()=>()=>a(null),[a]);const C=r.useCallback(b=>{b.key!=="Escape"||b.defaultPrevented||(v.consumeKey(b),f(!1))},[]),y=r.useCallback(b=>{R.current=b.target===b.currentTarget},[]),T=r.useCallback(b=>{const q=R.current;R.current=!1,q&&b.target===b.currentTarget&&f(!1)},[]),S=r.useCallback(()=>{f(!1)},[]);return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"aqmx-sheet-bar",inert:n,children:c.jsxs("button",{ref:t,type:"button",className:"aqmx-sheet-toggle","aria-haspopup":"dialog","aria-expanded":i,"aria-controls":F,"data-testid":"markdown-explorer-sheet-toggle",onClick:()=>f(!0),children:[c.jsx(or,{"aria-hidden":"true"}),c.jsx("span",{children:u.showExplorer})]})}),c.jsx("dialog",{ref:j,id:F,className:"aqmx-sheet","aria-label":u.explorerRegion,"data-testid":"markdown-explorer-sheet",onKeyDown:C,onPointerDown:y,onClick:T,onClose:S,children:c.jsxs("div",{className:"aqmx-sheet-panel",children:[c.jsxs("div",{className:"aqmx-sheet-header",children:[c.jsx("div",{ref:N,className:"aqmx-sheet-notice-slot"}),c.jsx("button",{ref:L,type:"button",className:"aqmx-sheet-close","aria-label":u.hideExplorer,title:u.hideExplorer,"data-testid":"markdown-explorer-sheet-close",onClick:()=>f(!1),children:c.jsx(Ge,{"aria-hidden":"true"})})]}),c.jsx("div",{className:"aqmx-sheet-body",children:c.jsx(ye,{value:i,children:c.jsx(Ue,{value:x,children:e})})}),c.jsx(v.LiveRegion,{holds:i,testId:"markdown-explorer-sheet-announcer"})]})})]})},Qe=r.createContext(null),Se="aqmx-explorer",Je="aqmx-content",cr="--aqmx-split-band",ke='[role="tree"] [role="treeitem"]',ir=`${ke}[tabindex="0"]`,ur="[data-directory-tree-tab-stop]",dr=(e,t)=>{for(const n of e.querySelectorAll(`[data-panel-id="${Se}"] ${ke}`))if(n.getAttribute(re)===t)return n;return null},De=(e,t)=>({inlineSize:e>0?e:null,rootFontPixels:t>0?t:A.ASSUMED_ROOT_FONT_PIXELS}),fr=(e,t)=>{const[n,a]=r.useState(()=>De(0,0));return r.useLayoutEffect(()=>{const s=e.current,u=t.current;if(s===null||u===null)throw new Error("[markdown-explorer] the split frame is not mounted");const o={frame:s.getBoundingClientRect().width,rem:u.getBoundingClientRect().width},l=()=>{const f=De(o.frame,o.rem);a(m=>m.inlineSize===f.inlineSize&&m.rootFontPixels===f.rootFontPixels?m:f)};l();const i=new ResizeObserver(f=>{for(const m of f){const[d]=m.borderBoxSize;d!==void 0&&(m.target===s&&(o.frame=d.inlineSize),m.target===u&&(o.rem=d.inlineSize))}l()});return i.observe(s),i.observe(u),()=>i.disconnect()},[e,t]),n},et=e=>`aqmx-split-handle-${e}`,mr=(e,{frameRef:t,sheetToggleRef:n,handleId:a})=>{const s=r.useRef(!1),u=r.useRef(null),o=r.useRef(!1);r.useLayoutEffect(()=>{const i=t.current;if(i===null)throw new Error("[markdown-explorer] the split frame is not mounted");const f=d=>{const h=d.target instanceof Element?d.target:null;s.current=h!==null&&h.closest(`[data-panel-id="${Je}"]`)===null,!o.current&&(u.current=h?.closest(`${ke}[${re}]`)?.getAttribute(re)??null)},m=d=>{d.relatedTarget instanceof Node&&!i.contains(d.relatedTarget)&&(s.current=!1)};return i.addEventListener("focusin",f),i.addEventListener("focusout",m),()=>{i.removeEventListener("focusin",f),i.removeEventListener("focusout",m)}},[t]);const l=r.useRef(e);r.useLayoutEffect(()=>{if(l.current===e)return;l.current=e;const i=t.current;if(i===null||!s.current)return;const f=m=>{const{activeElement:d,body:h}=i.ownerDocument;if(d!==null&&d!==h)return;const x=m.find(g=>g!==null);if(x!=null){o.current=!0;try{x.focus()}finally{o.current=!1}}};if(e){f([n.current]);return}queueMicrotask(()=>{if(l.current!==e||!s.current)return;const m=u.current,d=`[data-panel-id="${Se}"]`;f([m===null?null:dr(i,m),i.querySelector(`${d} ${ir}`),i.querySelector(`${d} ${ur}`),i.querySelector(`[data-resize-handle-id="${a}"]`)])})},[e,t,n,a])},pr=({view:e,explorer:t,content:n,contentCoversPage:a=!1,sheetDismissals:s=0,onDraggingChange:u})=>{const o=r.useRef(null),[l,i]=r.useState(null),f=r.useRef(null),m=r.useRef(null),{inlineSize:d,rootFontPixels:h}=fr(o,f),x=d!==null&&d<A.explorerSheetBelowPixels(h);return mr(x,{frameRef:o,sheetToggleRef:m,handleId:et(e)}),c.jsxs("div",{ref:o,className:"aqmx-split-frame","data-aqmx-explorer-mode":x?"sheet":"split",children:[c.jsx("span",{ref:f,className:"aqmx-rem-probe","aria-hidden":"true","data-aqmx-rem-probe":""}),x?c.jsx(sr,{explorer:t,toggleRef:m,covered:a,onNoticeSlotChange:i,dismissals:s}):null,c.jsx(Qe,{value:x?l:null,children:c.jsx(hr,{view:e,sheet:x,explorer:t,content:n,contentCoversPage:a,onDraggingChange:u,explorerMinPixels:A.explorerMinPixels(h)})})]})},hr=({view:e,sheet:t,explorer:n,content:a,contentCoversPage:s,onDraggingChange:u,explorerMinPixels:o})=>{const{viewSettings:l,labels:i}=v.useExplorer(),m=v.useViewSetting(C=>e==="tree"?C.treeExplorer:C.multiExplorer)??(e==="tree"?A.EXPLORER_DEFAULT_PERCENT:A.EXPLORER_MULTI_DEFAULT_PERCENT),d=r.useRef(!1),[h,x]=r.useState(!1),g=r.useRef(u);r.useLayoutEffect(()=>{g.current=u},[u]);const E=Ae.useSplitPersistence(r.useCallback(C=>{if(C.length!==2)return;const[y=0,T=0]=C,S=y+T;if(S<=0||y<=0)return;const b=Math.min(A.EXPLORER_MAX_PERCENT,y/S*100);l.update(e==="tree"?{treeExplorer:b}:{multiExplorer:b})},[l,e]));r.useEffect(()=>()=>{d.current&&g.current?.(!1)},[]);const L=Ae.useCoarsePointer()?A.COARSE_TARGET_PIXELS:A.FINE_TARGET_PIXELS,N=r.useMemo(()=>({[cr]:`${String(t?0:L)}px`}),[t,L]),R=r.useCallback((C,y)=>{const[T=0,S=0]=C;C.length===2&&S>0&&x(T<=0),E.layoutChanged(C,y)},[E]),F=r.useCallback(C=>{d.current=C,u?.(C),E.draggingChanged(C)},[u,E]);return c.jsxs(xe.PanelGroup,{id:`aqmx-split-${e}`,direction:"horizontal",onLayout:R,className:"aqmx-split",style:N,"data-aqmx-split":e,children:[t?null:c.jsx(xe.Panel,{id:Se,defaultSize:{value:m,unit:"percentage"},minSize:{value:o,unit:"pixels"},maxSize:{value:A.EXPLORER_MAX_PERCENT,unit:"percentage"},collapsible:{from:"end"},pixelAdjustPriority:1,inert:s,className:"aqmx-split-explorer",children:c.jsx(ye,{value:!h,children:n})}),t?null:c.jsx(xe.PanelResizeHandle,{id:et(e),thickness:L,indicator:{visible:!0,thickness:A.SPLIT_HANDLE_PIXELS.gripThickness,length:A.SPLIT_HANDLE_PIXELS.gripLength,barThickness:A.SPLIT_HANDLE_PIXELS.barThickness,barLength:A.SPLIT_HANDLE_PIXELS.barLength},title:i.resizeExplorer,"aria-label":i.resizeExplorer,onDragging:F,inert:s,className:"aqmx-split-handle"}),c.jsx(xe.Panel,{id:Je,defaultSize:{value:100-m,unit:"percentage"},contentOverflow:"hidden",className:"aqmx-split-content",...s?{style:{isolation:"auto"}}:{},children:a})]})};exports.EMPTY_SELECTION=we;exports.ExplorerPane=ar;exports.ExplorerSplit=pr;exports.SheetNoticeSlotContext=Qe;
1
+ "use strict";const c=require("react/jsx-runtime"),v=require("./index-CT-daekP.cjs"),r=require("react"),A=require("./location-BxiJRTyw.cjs"),He=require("@aiquants/directory-tree"),mt=require("./tapScrollCircle-37FU6daT.cjs"),pt=require("./storage-DM0EvkVf.cjs"),xe=require("@aiquants/resize-panels"),Ae=require("./useSplitPersistence-pPmE4GTT.cjs"),ht=require("react-router");function xt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const p=xt(r);function wt({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M19.5 21a3 3 0 0 0 3-3V9a3 3 0 0 0-3-3h-5.379a.75.75 0 0 1-.53-.22L11.47 3.66A2.25 2.25 0 0 0 9.879 3H4.5a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3h15ZM9 12.75a.75.75 0 0 0 0 1.5h6a.75.75 0 0 0 0-1.5H9Z",clipRule:"evenodd"}))}const gt=p.forwardRef(wt);function Et({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M19.5 21a3 3 0 0 0 3-3V9a3 3 0 0 0-3-3h-5.379a.75.75 0 0 1-.53-.22L11.47 3.66A2.25 2.25 0 0 0 9.879 3H4.5a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3h15Zm-6.75-10.5a.75.75 0 0 0-1.5 0v2.25H9a.75.75 0 0 0 0 1.5h2.25v2.25a.75.75 0 0 0 1.5 0v-2.25H15a.75.75 0 0 0 0-1.5h-2.25V10.5Z",clipRule:"evenodd"}))}const bt=p.forwardRef(Et);function vt({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{d:"M16.5 6a3 3 0 0 0-3-3H6a3 3 0 0 0-3 3v7.5a3 3 0 0 0 3 3v-6A4.5 4.5 0 0 1 10.5 6h6Z"}),p.createElement("path",{d:"M18 7.5a3 3 0 0 1 3 3V18a3 3 0 0 1-3 3h-7.5a3 3 0 0 1-3-3v-7.5a3 3 0 0 1 3-3H18Z"}))}const Rt=p.forwardRef(vt);function yt({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M3 6a3 3 0 0 1 3-3h2.25a3 3 0 0 1 3 3v2.25a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6Zm9.75 0a3 3 0 0 1 3-3H18a3 3 0 0 1 3 3v2.25a3 3 0 0 1-3 3h-2.25a3 3 0 0 1-3-3V6ZM3 15.75a3 3 0 0 1 3-3h2.25a3 3 0 0 1 3 3V18a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3v-2.25Zm9.75 0a3 3 0 0 1 3-3H18a3 3 0 0 1 3 3V18a3 3 0 0 1-3 3h-2.25a3 3 0 0 1-3-3v-2.25Z",clipRule:"evenodd"}))}const St=p.forwardRef(yt),kt=()=>{const{notices:e}=v.useExplorer(),t=r.use(e);return t.length===0?null:c.jsx("div",{className:"aqmx-explorer-notices",children:t.map(n=>c.jsxs("div",{className:"aqmx-callout","data-aqmx-tone":n.tone,"data-testid":"markdown-explorer-notice","data-aqmx-notice":n.id,children:[c.jsx("p",{className:"aqmx-callout-title",children:n.title}),n.body===void 0?null:c.jsx("p",{className:"aqmx-callout-body",children:n.body}),n.action===void 0?null:c.jsx("a",{className:"aqmx-callout-action",href:n.action.href,children:n.action.label})]},n.id))})};function Ct({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M6.912 3a3 3 0 0 0-2.868 2.118l-2.411 7.838a3 3 0 0 0-.133.882V18a3 3 0 0 0 3 3h15a3 3 0 0 0 3-3v-4.162c0-.299-.045-.596-.133-.882l-2.412-7.838A3 3 0 0 0 17.088 3H6.912Zm13.823 9.75-2.213-7.191A1.5 1.5 0 0 0 17.088 4.5H6.912a1.5 1.5 0 0 0-1.434 1.059L3.265 12.75H6.11a3 3 0 0 1 2.684 1.658l.256.513a1.5 1.5 0 0 0 1.342.829h3.218a1.5 1.5 0 0 0 1.342-.83l.256-.512a3 3 0 0 1 2.684-1.658h2.844Z",clipRule:"evenodd"}))}const Tt=p.forwardRef(Ct),ye=r.createContext(!0),Ze="\0loop\0",$e="\0",Lt=()=>{const e=new WeakMap,t=new WeakMap,n=new WeakMap,a=o=>{const l=e.get(o);if(l!==void 0)return l;const i=Object.freeze({type:"loop",name:o.name,path:o.path});return e.set(o,i),i},s=(o,l,i)=>{let f=!1;const m=o.map(h=>{const x=u(h,l,i);return x!==h&&(f=!0),x});if(!f)return o;const d=n.get(o);return d!==void 0&&d.length===m.length&&d.every((h,x)=>h===m[x])?d:(n.set(o,m),m)},u=(o,l,i)=>{if(o.type!=="directory")return o;if(i.has(o.path))return a(o);const f=o.lazy===!0?l(o.path):void 0,m=f?.status==="loaded",d=m?f.entries:o.children;if(d===void 0)return o;i.add(o.path);const h=s(d,l,i);if(i.delete(o.path),!m&&h===o.children)return o;const x=t.get(o);if(x!==void 0&&x.state===f&&x.children===h)return x.grafted;const g={...o,children:h,lazy:m?!1:o.lazy};return t.set(o,{state:f,children:h,grafted:g}),g};return(o,l)=>s(o,l,new Set)},jt=(e,t)=>`${Ze}${e}${$e}${t}`,ie=e=>e.startsWith(Ze),Pt=e=>e.slice(e.lastIndexOf($e)+1),re="data-aqmx-path",Nt=(e,t,n,a,s)=>{const u={aqmxPath:e.path};return e.modifiedAt!==void 0&&(u.aqmxModifiedAt=e.modifiedAt),n&&(u.aqmxOpen=!0),(a==="loading"||a==="failed")&&(u.aqmxChildren=a),{name:e.name,type:e.type,absolutePath:e.path,relativePath:e.path,mimeType:e.mimeType,children:t,label:s,data:u}},Ot=(e,t,n,a)=>{const s=jt(t,e.path);return{name:n,type:"directory",absolutePath:s,relativePath:s,children:a,data:{aqmxLoop:e.path}}},At=()=>{const e=new WeakMap,t=new WeakMap,n=new WeakMap,a=[],s=(l,i,f)=>{const m=l.map(h=>h.type==="loop"?u(h,i,f):o(h,i)),d=n.get(l);return d!==void 0&&d.length===m.length&&d.every((h,x)=>h===m[x])?d:(n.set(l,m),m)},u=(l,i,f)=>{const m=t.get(l);if(m!==void 0&&m.parentKey===f&&m.loopFolderName===i.loopFolderName)return m.row;const d=Ot(l,f,i.loopFolderName(l.name),a);return t.set(l,{row:d,parentKey:f,loopFolderName:i.loopFolderName}),d},o=(l,i)=>{const f=l.type==="directory"?l.children===void 0?a:s(l.children,i,l.path):void 0,m=i.openPaths.has(l.path),d=l.type==="directory"&&l.lazy===!0?i.childrenOf(l.path)?.status:void 0,h=d==="failed"?i.renderFailedFolder:void 0,x=e.get(l);if(x!==void 0&&x.open===m&&x.childrenStatus===d&&x.children===f&&x.renderFailedFolder===h)return x.row;const g=Nt(l,f,m,d,h===void 0?void 0:h(l));return e.set(l,{row:g,open:m,childrenStatus:d,children:f,renderFailedFolder:h}),g};return(l,i)=>s(l,i,"")},qt=e=>{if(e===void 0)return;const t=n=>{const a=n.data?.aqmxModifiedAt;return typeof a=="number"?{name:n.name,path:n.absolutePath,type:n.type,modifiedAt:a}:{name:n.name,path:n.absolutePath,type:n.type}};return(n,a)=>e(t(n),t(a))},Re=(e,t)=>{const n=e.filter(a=>a.type==="directory");return t===void 0?n:n.sort(t)},Mt=(e,t)=>{const n=new Map;let a=0;const s=u=>{for(const o of Re(u,t.compare))if(t.isShownExpanded(o.path)){if(o.lazy!==!0){o.children!==void 0&&s(o.children);continue}n.has(o.path)||(n.set(o.path,t.isDirect(o.path)?"direct":"bulk"),t.childrenOf(o.path)?.status!=="failed"&&(a+=1))}};return s(e),{folders:n,waiting:a}},Ft=e=>{const t=new Set,n=a=>{for(const s of a)s.type==="directory"&&(s.lazy===!0&&t.add(s.path),s.children!==void 0&&n(s.children))};return n(e),t},Be=(e,t)=>{for(const n of e){if(n.type!=="directory")continue;if(n.path===t)return n;const a=n.children===void 0?null:Be(n.children,t);if(a!==null)return a}return null},_t=(e,t,n,a)=>{let s=e;for(const u of t){const o=s.find(l=>l.type==="directory"&&l.path===u);if(o===void 0)return"missing";if(o.lazy===!0)return a.childrenOf(o.path)?.status==="failed"?"failed":"loading";if(!a.isShownExpanded(o.path))return"loading";s=o.children??[]}return s.some(u=>u.type==="file"&&u.path===n)?"ready":"missing"},qe=new Set,It=(e,t)=>e.has(t)?e:new Set(e).add(t),Dt=(e,t)=>{if(!t.some(a=>e.has(a)))return e;const n=new Set(t);return new Set([...e].filter(a=>!n.has(a)))},Ht=(e,t)=>[...e].every(n=>t.has(n))?e:new Set([...e].filter(n=>t.has(n))),Zt=()=>{const[e,t]=r.useState(qe),n=r.useCallback(o=>t(l=>It(l,o)),[]),a=r.useCallback(o=>t(l=>Dt(l,o)),[]),s=r.useCallback(o=>t(l=>Ht(l,o)),[]),u=r.useCallback(()=>t(qe),[]);return r.useMemo(()=>({direct:e,markDirect:n,unmarkDirect:a,pruneDirect:s,clearDirect:u}),[e,n,a,s,u])},$t=e=>({budget:e,handled:new Set,loads:new Set,opened:0,folderLimited:!1,depthLimited:!1,announcedStart:!1,issuedAgainst:null}),Bt=(e,t)=>{const n=[];let a=Re(t.entries,t.compare);for(let s=1;a.length>0;s+=1){const u=[];for(const o of a){const{path:l}=o;if(t.isShownExpanded(l))e.handled.add(l);else{if(e.handled.has(l))continue;if(e.handled.add(l),o.lazy===!0&&t.childrenOf(l)===void 0){if(s>e.budget.maxDepth){e.depthLimited=!0;continue}if(e.loads.size>=e.budget.maxFolders){e.folderLimited=!0;continue}e.loads.add(l)}n.push(l),e.opened+=1}o.lazy!==!0&&o.children!==void 0&&u.push(...Re(o.children,t.compare))}a=u}return n},ze=(e,t)=>e.every(n=>n.type!=="directory"||t(n.path)&&(n.lazy===!0||n.children===void 0||ze(n.children,t))),zt=(e,t)=>{if(e.folderLimited)return{kind:"folder-limit",opened:e.opened};if(e.depthLimited)return{kind:"depth-limit",opened:e.opened};let n=0;for(const a of e.loads)t.childrenOf(a)?.status==="failed"&&(n+=1);return{kind:"done",opened:e.opened,failed:n,complete:ze(t.entries,t.isShownExpanded)}},ve=Object.freeze({state:"idle"}),Vt=e=>{const t=r.useRef(null),n=r.useRef(e),[a,s]=r.useState(ve);r.useLayoutEffect(()=>{n.current=e});const u=r.useCallback(()=>{t.current===null&&(t.current=$t(n.current.budget),s({state:"running",opened:0}))},[]),o=r.useCallback(()=>{t.current=null,s(ve)},[]),l=r.useCallback(i=>{const f=t.current;if(f===null)return;const m=Bt(f,i);if(m.length>0&&(f.issuedAgainst=i.expanded,n.current.expandMultiple([...m])),!f.announcedStart&&(f.loads.size>0||i.waiting>0)&&(f.announcedStart=!0,n.current.onStart()),m.length===0&&!i.expansionPending&&i.expanded!==f.issuedAgainst&&i.waiting===0){t.current=null;const h=zt(f,i);s(h.kind==="done"?ve:{state:"stopped",stop:h.kind,opened:h.opened}),n.current.onFinish(h);return}const{opened:d}=f;s(h=>h.state==="running"&&h.opened===d?h:{state:"running",opened:d})},[]);return r.useMemo(()=>({status:a,start:u,end:o,advance:l}),[a,u,o,l])},Me=["pointerdown","wheel","touchstart","keydown","focusin"],Kt=8,Fe={least:Number.POSITIVE_INFINITY,stalled:0},Xt=({tree:e,container:t,path:n,chain:a,rows:s,cancel:u,displayed:o,placement:l})=>{const i=r.useRef(null),f=r.useRef(!0),m=r.useRef(Fe),d=r.useRef(null),h=r.useRef(null),x=r.useRef(a),g=r.useRef(l);r.useLayoutEffect(()=>{x.current=a,g.current=l},[a,l]);const E=r.useCallback(()=>{const y=d.current;y!==null&&(d.current=null,y.phase==="asking"?y.controller.abort():x.current?.open(null))},[]),j=r.useCallback(()=>{i.current=null,E()},[E]),L=r.useCallback(()=>{const y=t.current;i.current===null||h.current!==null||y===null||y.getClientRects().length===0||(h.current=requestAnimationFrame(()=>{h.current=null;const T=i.current;if(T===null)return;const S=g.current(T);if(S===0){f.current=!0,d.current?.phase==="opening"&&E();return}if(e.current?.scrollToPath(T,{align:"nearest"})===!0){d.current?.phase==="opening"&&E();const{least:q,stalled:_}=m.current;m.current=S<q?{least:S,stalled:0}:{least:q,stalled:_+1},m.current.stalled<Kt&&L();return}const b=d.current;if(b===null){i.current=null;return}b.phase==="opening"&&x.current?.progress(b.folders,T)!=="loading"&&j()}))},[e,t,E,j]),N=r.useCallback(()=>{f.current=!1,m.current=Fe,L()},[L]);r.useEffect(()=>{const y=t.current;if(y===null)return;const T=typeof ResizeObserver>"u"?null:new ResizeObserver(N);T?.observe(y);for(const S of Me)y.addEventListener(S,j,{passive:!0});return()=>{T?.disconnect();for(const S of Me)y.removeEventListener(S,j);h.current!==null&&cancelAnimationFrame(h.current),h.current=null,E()}},[t,N,j,E]);const R=a!==null;r.useEffect(()=>{const y=t.current;if(j(),n===null||y===null||y.contains(y.ownerDocument.activeElement))return;i.current=n;const T=x.current;if(R&&T!==null){const S=new AbortController,b={phase:"asking",controller:S};d.current=b,T.ancestors(n,S.signal).then(q=>{d.current===b&&(q===null?d.current=null:(d.current={phase:"opening",folders:q},x.current?.open(q)),N())})}N()},[n,R,t,j,N]),r.useEffect(()=>{(d.current?.phase==="opening"||i.current!==null&&!f.current)&&N()},[s,N]);const F=r.useRef(u);r.useEffect(()=>{F.current!==u&&(F.current=u,j())},[u,j]);const C=r.useRef(o);r.useEffect(()=>{C.current&&!o&&E(),C.current=o},[o,E])},Wt="--aqmx-tree-line",Gt=Object.freeze(["(forced-colors: active)","(prefers-color-scheme: dark)"]),Ut="data-aqmx-tree-probe",Yt=Object.freeze({rowHeight:A.CONTROL_BLOCK_PIXELS,lineColor:null}),Qt=/^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/u,Jt=e=>{const t=Qt.exec(e);return t===null?e:`#${t.slice(1).map(n=>Number(n).toString(16).padStart(2,"0")).join("")}`},en=(e,t)=>{const[n,a]=r.useState(Yt);return r.useLayoutEffect(()=>{const s=e.current;if(s===null)return;const u=()=>{const i=Math.round(s.getBoundingClientRect().height),f=getComputedStyle(s),m=f.getPropertyValue(Wt).trim()===""?null:Jt(f.color);a(d=>{const h=Number.isFinite(i)&&i>0?i:d.rowHeight;return d.rowHeight===h&&d.lineColor===m?d:{rowHeight:h,lineColor:m}})};u();const o=Gt.map(i=>window.matchMedia(i));for(const i of o)i.addEventListener("change",u);const l=typeof ResizeObserver>"u"?null:new ResizeObserver(u);return l?.observe(s),()=>{for(const i of o)i.removeEventListener("change",u);l?.disconnect()}},[e,t]),n},Ve="markdown-explorer-tree-scroll",tn=.5,Ke=(e,t)=>[...e.querySelectorAll(`[role="treeitem"][${re}]`)].find(n=>n.getAttribute(re)===t),nn=(e,t)=>{const n=Ke(e,t),a=n?.closest(`[data-testid="${Ve}"]`);if(n===void 0||a===null||a===void 0)return Number.POSITIVE_INFINITY;const s=a.getBoundingClientRect(),u=n.getBoundingClientRect(),o=s.top-u.top,l=u.height>s.height?Math.abs(o):Math.max(0,o)+Math.max(0,u.bottom-s.bottom);return l<=tn?0:l},rn={testId:Ve,overscanCount:13,callbackThrottleMs:13,scrollBarOptions:{width:8,enableTrackClick:!0,enableThumbDrag:!0,enableArrowButtons:!0,enableArrowButtonTabStops:!1,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:mt.TAP_SCROLL_CIRCLE},behaviorOptions:{enablePointerDrag:!0}},an={hoverClassName:"",directorySelectedClassName:"",itemSelectedClassName:""},ln={color:"inherit",fontSize:"inherit"},on={fontSize:"inherit"},sn=new Set,cn=new Map,un={color:"var(--aqmx-tree-line)"},dn=e=>{const t=e instanceof Element?e.closest(`[${re}]`):null;return t===null||t.getAttribute("data-entry-type")!=="file"?null:t.getAttribute(re)},Xe=(e,t,n,a)=>n==="folder-limit"?e.expandAllFolderLimit(a,t.maxFolders,e.expandAll):e.expandAllDepthLimit(a,t.maxDepth),fn=(e,t,n)=>n.kind==="done"?e.expandAllDone(n.opened,n.failed,n.complete):Xe(e,t,n.kind,n.opened),We=()=>{const{labels:e}=v.useExplorer();return c.jsxs("div",{className:"aqmx-explorer-loading","aria-busy":"true","data-testid":"markdown-explorer-tree-loading",children:[c.jsx("p",{className:"aqmx-explorer-loading-text",children:e.treeLoading}),c.jsxs("div",{className:"aqmx-skeleton","aria-hidden":"true",children:[c.jsx("span",{}),c.jsx("span",{}),c.jsx("span",{}),c.jsx("span",{}),c.jsx("span",{})]})]})},mn=()=>{const{labels:e}=v.useExplorer();return c.jsxs("div",{className:"aqmx-empty","data-testid":"markdown-explorer-tree-empty",children:[c.jsx(Tt,{className:"aqmx-explorer-empty-icon","aria-hidden":"true"}),c.jsx("p",{className:"aqmx-empty-title",children:e.treeEmptyTitle}),c.jsx("p",{className:"aqmx-explorer-empty-body",children:e.treeEmptyBody})]})},pn=({name:e,onRetry:t})=>{const{labels:n}=v.useExplorer(),a=r.useId();return c.jsxs("span",{className:"aqmx-explorer-folder-failed",children:[c.jsx("span",{className:"aqmx-explorer-folder-name",children:e}),c.jsx("span",{id:a,className:"aqmx-explorer-folder-error",children:n.folderLoadFailed}),c.jsxs("button",{type:"button",className:"aqmx-explorer-folder-retry","aria-describedby":a,"data-testid":"markdown-explorer-folder-retry",onClick:s=>{s.stopPropagation();const u=s.currentTarget,o=u.ownerDocument.activeElement===u?u.closest('[role="treeitem"]'):null;o instanceof HTMLElement&&v.focusWithoutScroll(o),t()},onKeyDown:s=>{s.key!=="Escape"&&s.stopPropagation()},children:[c.jsx(v.ForwardRef,{className:"aqmx-explorer-folder-retry-icon","aria-hidden":"true"}),c.jsx("span",{className:"aqmx-explorer-folder-retry-text",children:n.retry})]})]})},hn=({entries:e,version:t,mode:n,sourceId:a,settings:s,reveal:u,openPaths:o,selection:l,onOpenDocument:i,folders:f,onRevealSource:m,expansion:d,onShown:h,marks:x,claimsHeld:g,expandAll:E,revealCancel:j})=>{const{trees:L,documents:N,labels:R,locale:F,theme:C,data:y,config:T,sources:S,reveals:b}=v.useExplorer(),q=r.use(ye),[_]=r.useState(At),ae=r.useRef(null),{rowHeight:Q,lineColor:Z}=en(ae,C),{isExpanded:$,toggle:J,expandMultiple:I,collapseMultiple:X,expanded:W,isPending:G}=d,{alwaysExpanded:O,sortMode:ee,folderPlacement:le,readmePlacement:ue}=s,{direct:te,markDirect:B,unmarkDirect:U,pruneDirect:fe}=x,{running:oe,advance:se}=E,de=r.useRef(null),ne=r.useRef(null),z=r.useMemo(()=>A.createEntryComparator({sortMode:ee,folderPlacement:le,readmePlacement:ue}),[ee,le,ue]),P=r.useMemo(()=>qt(z),[z]),M=r.useCallback(w=>L.children(a,w),[L,a]),D=r.useMemo(()=>Ft(e),[e]),Y=r.useCallback(w=>!ie(w)&&($(w)||O&&!D.has(w)),[$,O,D]),V=r.useRef({shownExpanded:Y,isExpanded:$,unloadedFolders:D,entries:e,childrenOf:M});r.useLayoutEffect(()=>{V.current={shownExpanded:Y,isExpanded:$,unloadedFolders:D,entries:e,childrenOf:M}},[Y,$,D,e,M]);const Ce=r.useCallback(w=>{de.current?.scrollToPath(w,{align:"nearest"}),requestAnimationFrame(()=>{const k=ne.current,H=k===null?void 0:Ke(k,w);H!==void 0&&v.focusWithoutScroll(H)})},[]),tt=r.useCallback(w=>{if(ie(w)){Ce(Pt(w));return}V.current.isExpanded(w)?U([w]):V.current.unloadedFolders.has(w)&&B(w),J(w)},[Ce,B,U,J]),ge=r.useCallback(w=>{const k=w.filter(H=>!ie(H));k.length!==0&&(U(k),X(k))},[U,X]),nt=r.useCallback(w=>{const k=w.filter(H=>!ie(H));k.length!==0&&(k.length<w.length&&k.every(H=>V.current.shownExpanded(H))?ge(k):I(k))},[I,ge]),Te=r.useCallback(w=>c.jsx(pn,{name:w.name,onRetry:()=>{B(w.path),L.retryChildren(a,w.path),V.current.shownExpanded(w.path)||I([w.path])}}),[L,a,B,I]),Le=n==="multi"?o:sn,{loopFolderName:je}=R,rt=r.useMemo(()=>_(e,{openPaths:Le,childrenOf:M,renderFailedFolder:Te,loopFolderName:je}),[_,e,Le,M,Te,je,t]),at=v.useIntentPrefetch(N,dn),Pe=r.useRef([]),me=r.useCallback(()=>{for(const w of Pe.current)V.current.unloadedFolders.has(w)&&B(w)},[B]),{maxDepth:Ee}=T.revealDocument,Ne=r.useRef(m);r.useLayoutEffect(()=>{Ne.current=m},[m]);const lt=r.useMemo(()=>({ancestors:async(w,k)=>{const H=b.take(a,w);if(H!==null)return H;if(!b.mayMove(w)){const ce=await y.ancestors(a,w,k);return ce.status!=="ok"||ce.ancestors===null||ce.ancestors.length>Ee?null:ce.ancestors}const K=await y.reveal(a,w,k);return K.status!=="ok"||K.source===null||K.ancestors.length>Ee?null:K.source===a?K.ancestors:(k.aborted||!S.some(ce=>ce.id===K.source)||(b.move(K.source,w,K.ancestors),Ne.current(K.source)),null)},open:w=>{Pe.current=w??[],w!==null&&(me(),I([...w]))},progress:(w,k)=>_t(V.current.entries,w,k,{isShownExpanded:V.current.shownExpanded,childrenOf:V.current.childrenOf})}),[y,a,S,b,Ee,me,I]);r.useEffect(()=>me(),[me,D]);const ot=r.useMemo(()=>[e,t,W],[e,t,W]),st=r.useCallback(w=>ne.current===null?Number.POSITIVE_INFINITY:nn(ne.current,w),[]);Xt({tree:de,container:ne,path:u.path,chain:u.openFolders?lt:null,rows:ot,cancel:j,displayed:q,placement:st});const Oe=r.useCallback(w=>te.has(w),[te]),pe=r.useMemo(()=>Mt(e,{isShownExpanded:Y,childrenOf:M,compare:z,isDirect:Oe}),[e,Y,M,z,Oe,t]),he=q&&g;r.useLayoutEffect(()=>{h(e)},[e,h]),r.useLayoutEffect(()=>()=>h(null),[h]),r.useEffect(()=>L.claimChildren(a,he?pe.folders:cn),[L,a,he,pe]),r.useEffect(()=>fe(D),[fe,D]),r.useEffect(()=>{he&&oe&&se({entries:e,isShownExpanded:Y,childrenOf:M,compare:z,expanded:W,waiting:pe.waiting,expansionPending:G})},[he,oe,se,e,Y,M,z,W,pe,G]);const ct=r.useCallback(w=>{const k=w.entry.absolutePath;if(w.isDirectory){if(f===null||ie(k)||k===f.current)return;w.isExpanded&&w.preventDefault(),b.settle(k),f.open(k);return}b.settle(k),i(k)},[b,i,f]),{onChange:be}=l,it=r.useMemo(()=>be===null?void 0:(w,k)=>{ie(w.absolutePath)||be({path:w.absolutePath,name:w.name,selected:k})},[be]),ut=r.useMemo(()=>new Set(l.items),[l.items]),dt=r.useMemo(()=>({entryKindDirectory:R.treeEntryKindDirectory,entryKindFile:R.treeEntryKindFile,scrollUp:R.treeScrollUp,scrollDown:R.treeScrollDown,scrollToTop:R.treeScrollToTop,scrollToBottom:R.treeScrollToBottom}),[R]),ft=Z===null?{showTreeLines:!1}:{showTreeLines:s.lines,lineColor:Z};return c.jsxs("div",{ref:ne,className:"aqmx-explorer-tree","data-testid":"markdown-explorer-tree",...at,children:[c.jsx("span",{ref:ae,className:"aqmx-explorer-tree-probe","aria-hidden":"true",[Ut]:""}),c.jsx(He.DirectoryTree,{ref:de,entries:rt,expansion:{toggle:tt,isExpanded:Y,expandMultiple:nt,collapseMultiple:ge,isPending:G&&!oe,doubleClickAction:s.doubleClickAction},selection:{mode:l.mode,selectedPath:l.shownPath,currentPath:l.shownPath,selectedItems:ut,onEntryClick:ct,onSelectionChange:it},visual:{className:"aqmx-explorer-tree-view",ariaLabel:R.treeRegion,...ft,showExpandIcons:s.expandIcons,expandIconStyle:un,showDirectoryIcons:s.directoryIcons,showFileIcons:s.fileIcons,expandIconSize:s.expandIconSize,itemHeight:Q,removeRootIndent:s.removeRootIndent,highlightStyles:an,entryStyle:on,nameStyle:ln},virtualScroll:rn,sort:P,locale:F,labels:dt})]})},xn=({pending:e,status:t})=>{const{labels:n}=v.useExplorer(),a=t.state!=="running",[s,u]=r.useState(0),o=r.useRef(!0);r.useLayoutEffect(()=>{const i=o.current;if(o.current=a,!a||e>0&&!i){u(0);return}if(e>0){u(e);return}if(s===0)return;const f=setTimeout(()=>u(0),0);return()=>clearTimeout(f)},[a,e,s]);const l=a&&e===0?s:e;return l===0&&a?null:c.jsxs("p",{className:"aqmx-explorer-tree-progress","data-testid":"markdown-explorer-tree-progress","data-aqmx-loading":String(l),"data-aqmx-expand-all":t.state,children:[l>0?c.jsx(v.ForwardRef,{className:"aqmx-explorer-tree-progress-icon","aria-hidden":"true"}):null,c.jsx("span",{children:t.state==="running"?n.expandAllProgress(t.opened,l):n.foldersLoading(l)})]})},wn=({stop:e,opened:t,budget:n})=>{const{labels:a}=v.useExplorer();return c.jsx("p",{className:"aqmx-explorer-expand-all-stop","data-testid":"markdown-explorer-expand-all-stop","data-aqmx-stop":e,children:Xe(a,n,e,t)})},gn=({entries:e,...t})=>{const{trees:n}=v.useExplorer(),a=r.useSyncExternalStore(n.subscribe,n.version,n.version),{sourceId:s}=t,[u]=r.useState(Lt),o=r.useMemo(()=>u(e,l=>n.children(s,l)),[u,e,n,s,a]);return o.length===0?c.jsx(mn,{}):c.jsx(hn,{entries:o,version:a,...t})},En=({result:e,onRetry:t,...n})=>{const{renderTreeFailure:a}=v.useExplorer(),s=r.use(e);if(s.status==="deferred")return c.jsx(We,{});if(s.status==="ok")return c.jsx(gn,{entries:s.entries,...n});const u=a?.(s.failure);return c.jsx("div",{className:"aqmx-explorer-tree-message","data-testid":"markdown-explorer-tree-failure","data-aqmx-failure":s.failure.reason,children:u!==void 0?u:c.jsx(v.FailureView,{failure:s.failure,alert:!0,onRetry:t,testId:null})})},bn=({onControls:e,...t})=>{const{trees:n,storageNamespace:a,labels:s,announcer:u,config:o}=v.useExplorer(),{sourceId:l}=t,i=He.useDirectoryTreeState({storageKey:pt.storageKeys(a).treeExpansion(l)});r.useSyncExternalStore(n.subscribe,n.version,n.version);const f=n.read(l),m=r.useCallback(()=>n.retry(l),[n,l]);r.useLayoutEffect(()=>n.open(l),[n,l]);const d=Zt(),{expanded:h,expandMultiple:x,collapseAll:g}=i,[E,j]=r.useState(null),L=E!==h,N=r.useRef(h);r.useLayoutEffect(()=>{N.current=h},[h]);const R=o.expandAll,F=r.useCallback(()=>u.announce(s.expandAllStarted),[u,s]),C=r.useCallback(O=>u.announce(fn(s,R,O)),[u,s,R]),y=Vt({budget:R,expandMultiple:x,onStart:F,onFinish:C}),{status:T,start:S,end:b,advance:q}=y,_=T.state==="running",ae=r.useMemo(()=>({running:_,advance:q}),[_,q]),Q=r.useRef(null),[Z,$]=r.useState(!1),J=r.useCallback(O=>{Q.current=O,$(O!==null)},[]);r.useEffect(()=>n.subscribeChildrenFailures(O=>{const ee=O.sourceId===l&&Q.current!==null?Be(Q.current,O.path):null;ee!==null&&u.announce({list:s.foldersLoadFailedNamed,item:ee.name})}),[n,l,u,s]);const{clearDirect:I}=d,[X,W]=r.useState(0),G=r.useCallback(()=>{W(O=>O+1),b(),I(),j(N.current),g()},[b,I,g]);return r.useEffect(()=>{e({collapseAll:G,expandAll:Z?S:null,expanding:_})},[e,G,S,Z,_]),r.useEffect(()=>()=>e(null),[e]),r.useEffect(()=>{Z||b()},[Z,b]),c.jsxs(c.Fragment,{children:[T.state==="stopped"?c.jsx(wn,{stop:T.stop,opened:T.opened,budget:R}):null,c.jsxs("div",{className:"aqmx-explorer-tree-area",children:[c.jsx(r.Suspense,{fallback:c.jsx(We,{}),children:c.jsx(En,{result:f,onRetry:m,expansion:i,onShown:J,marks:d,claimsHeld:L,expandAll:ae,revealCancel:X,...t})}),c.jsx(xn,{pending:n.pendingChildren(l),status:T})]})]})};function vn({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const Ge=p.forwardRef(vn),_e="markdown-explorer-selection-remove",Rn=({selection:e,onRemove:t,onClear:n,onOpenSelection:a,onLeave:s})=>{const{labels:u}=v.useExplorer(),o=r.useId(),l=r.useRef(null),i=[...e],f=(d,h)=>{if(h.ownerDocument.activeElement===h){const x=l.current===null?[]:[...l.current.querySelectorAll(`[data-testid="${_e}"]`)],g=x.indexOf(h),E=[x[g+1],x[g-1]].find(j=>j!==void 0);E===void 0?s():E.focus()}t(d)},m=()=>{const d=l.current;d!==null&&d.contains(d.ownerDocument.activeElement)&&s(),n()};return c.jsxs("section",{ref:l,className:"aqmx-explorer-tray","aria-labelledby":o,"data-testid":"markdown-explorer-selection-tray",children:[c.jsxs("div",{className:"aqmx-explorer-tray-header",children:[c.jsx("p",{id:o,className:"aqmx-explorer-tray-title",children:u.selectionTitle(i.length)}),c.jsx("button",{type:"button",className:"aqmx-explorer-tray-button","data-testid":"markdown-explorer-selection-clear",onClick:m,children:u.clearSelection})]}),c.jsx("ul",{className:"aqmx-explorer-tray-list",children:i.map(([d,h])=>c.jsxs("li",{className:"aqmx-explorer-tray-item",children:[c.jsx("span",{className:"aqmx-explorer-tray-name",title:d,children:h}),c.jsx("button",{type:"button",className:"aqmx-icon-button aqmx-explorer-tray-remove","aria-label":u.removeFromSelection(h),title:u.removeFromSelection(h),"data-testid":_e,"data-aqmx-path":d,onClick:x=>f(d,x.currentTarget),children:c.jsx(Ge,{"aria-hidden":"true"})})]},d))}),a===void 0?null:c.jsx("button",{type:"button",className:"aqmx-explorer-tray-open","data-testid":"markdown-explorer-selection-open",onClick:()=>a(i.map(([d])=>d)),children:u.openSelectionInMulti(i.length)})]})},we=new Map,yn=(e,t)=>{if(t.selected===e.has(t.path))return e;const n=new Map(e);return t.selected?n.set(t.path,t.name):n.delete(t.path),n},Sn=(e,t)=>{if(!e.has(t))return e;const n=new Map(e);return n.delete(t),n},Ue=r.createContext(null),kn=e=>{const t=r.use(Ue);r.useLayoutEffect(()=>{if(t!==null)return t(e),()=>t(!1)},[t,e])};function Cn({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M15 3.75a.75.75 0 0 1 .75-.75h4.5a.75.75 0 0 1 .75.75v4.5a.75.75 0 0 1-1.5 0V5.56l-3.97 3.97a.75.75 0 1 1-1.06-1.06l3.97-3.97h-2.69a.75.75 0 0 1-.75-.75Zm-12 0A.75.75 0 0 1 3.75 3h4.5a.75.75 0 0 1 0 1.5H5.56l3.97 3.97a.75.75 0 0 1-1.06 1.06L4.5 5.56v2.69a.75.75 0 0 1-1.5 0v-4.5Zm11.47 11.78a.75.75 0 1 1 1.06-1.06l3.97 3.97v-2.69a.75.75 0 0 1 1.5 0v4.5a.75.75 0 0 1-.75.75h-4.5a.75.75 0 0 1 0-1.5h2.69l-3.97-3.97Zm-4.94-1.06a.75.75 0 0 1 0 1.06L5.56 19.5h2.69a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1-.75-.75v-4.5a.75.75 0 0 1 1.5 0v2.69l3.97-3.97a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"}))}const Tn=p.forwardRef(Cn);function Ln({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M6.97 2.47a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1-1.06 1.06L8.25 4.81V16.5a.75.75 0 0 1-1.5 0V4.81L3.53 8.03a.75.75 0 0 1-1.06-1.06l4.5-4.5Zm9.53 4.28a.75.75 0 0 1 .75.75v11.69l3.22-3.22a.75.75 0 1 1 1.06 1.06l-4.5 4.5a.75.75 0 0 1-1.06 0l-4.5-4.5a.75.75 0 1 1 1.06-1.06l3.22 3.22V7.5a.75.75 0 0 1 .75-.75Z",clipRule:"evenodd"}))}const jn=p.forwardRef(Ln);function Pn({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{d:"M11.25 4.533A9.707 9.707 0 0 0 6 3a9.735 9.735 0 0 0-3.25.555.75.75 0 0 0-.5.707v14.25a.75.75 0 0 0 1 .707A8.237 8.237 0 0 1 6 18.75c1.995 0 3.823.707 5.25 1.886V4.533ZM12.75 20.636A8.214 8.214 0 0 1 18 18.75c.966 0 1.89.166 2.75.47a.75.75 0 0 0 1-.708V4.262a.75.75 0 0 0-.5-.707A9.735 9.735 0 0 0 18 3a9.707 9.707 0 0 0-5.25 1.533v16.103Z"}))}const Nn=p.forwardRef(Pn);function On({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm13.36-1.814a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 12.22a.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"}))}const An=p.forwardRef(On);function qn({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M7.72 12.53a.75.75 0 0 1 0-1.06l7.5-7.5a.75.75 0 1 1 1.06 1.06L9.31 12l6.97 6.97a.75.75 0 1 1-1.06 1.06l-7.5-7.5Z",clipRule:"evenodd"}))}const Mn=p.forwardRef(qn);function Fn({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M11.47 4.72a.75.75 0 0 1 1.06 0l3.75 3.75a.75.75 0 0 1-1.06 1.06L12 6.31 8.78 9.53a.75.75 0 0 1-1.06-1.06l3.75-3.75Zm-3.75 9.75a.75.75 0 0 1 1.06 0L12 17.69l3.22-3.22a.75.75 0 1 1 1.06 1.06l-3.75 3.75a.75.75 0 0 1-1.06 0l-3.75-3.75a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const _n=p.forwardRef(Fn);function In({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M11.078 2.25c-.917 0-1.699.663-1.85 1.567L9.05 4.889c-.02.12-.115.26-.297.348a7.493 7.493 0 0 0-.986.57c-.166.115-.334.126-.45.083L6.3 5.508a1.875 1.875 0 0 0-2.282.819l-.922 1.597a1.875 1.875 0 0 0 .432 2.385l.84.692c.095.078.17.229.154.43a7.598 7.598 0 0 0 0 1.139c.015.2-.059.352-.153.43l-.841.692a1.875 1.875 0 0 0-.432 2.385l.922 1.597a1.875 1.875 0 0 0 2.282.818l1.019-.382c.115-.043.283-.031.45.082.312.214.641.405.985.57.182.088.277.228.297.35l.178 1.071c.151.904.933 1.567 1.85 1.567h1.844c.916 0 1.699-.663 1.85-1.567l.178-1.072c.02-.12.114-.26.297-.349.344-.165.673-.356.985-.57.167-.114.335-.125.45-.082l1.02.382a1.875 1.875 0 0 0 2.28-.819l.923-1.597a1.875 1.875 0 0 0-.432-2.385l-.84-.692c-.095-.078-.17-.229-.154-.43a7.614 7.614 0 0 0 0-1.139c-.016-.2.059-.352.153-.43l.84-.692c.708-.582.891-1.59.433-2.385l-.922-1.597a1.875 1.875 0 0 0-2.282-.818l-1.02.382c-.114.043-.282.031-.449-.083a7.49 7.49 0 0 0-.985-.57c-.183-.087-.277-.227-.297-.348l-.179-1.072a1.875 1.875 0 0 0-1.85-1.567h-1.843ZM12 15.75a3.75 3.75 0 1 0 0-7.5 3.75 3.75 0 0 0 0 7.5Z",clipRule:"evenodd"}))}const Dn=p.forwardRef(In);function Hn({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M12 1.5a.75.75 0 0 1 .75.75V4.5a.75.75 0 0 1-1.5 0V2.25A.75.75 0 0 1 12 1.5ZM5.636 4.136a.75.75 0 0 1 1.06 0l1.592 1.591a.75.75 0 0 1-1.061 1.06l-1.591-1.59a.75.75 0 0 1 0-1.061Zm12.728 0a.75.75 0 0 1 0 1.06l-1.591 1.592a.75.75 0 0 1-1.06-1.061l1.59-1.591a.75.75 0 0 1 1.061 0Zm-6.816 4.496a.75.75 0 0 1 .82.311l5.228 7.917a.75.75 0 0 1-.777 1.148l-2.097-.43 1.045 3.9a.75.75 0 0 1-1.45.388l-1.044-3.899-1.601 1.42a.75.75 0 0 1-1.247-.606l.569-9.47a.75.75 0 0 1 .554-.68ZM3 10.5a.75.75 0 0 1 .75-.75H6a.75.75 0 0 1 0 1.5H3.75A.75.75 0 0 1 3 10.5Zm14.25 0a.75.75 0 0 1 .75-.75h2.25a.75.75 0 0 1 0 1.5H18a.75.75 0 0 1-.75-.75Zm-8.962 3.712a.75.75 0 0 1 0 1.061l-1.591 1.591a.75.75 0 1 1-1.061-1.06l1.591-1.592a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"}))}const Zn=p.forwardRef(Hn);function $n({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M5.625 1.5c-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.5H5.625ZM7.5 15a.75.75 0 0 1 .75-.75h7.5a.75.75 0 0 1 0 1.5h-7.5A.75.75 0 0 1 7.5 15Zm.75 2.25a.75.75 0 0 0 0 1.5H12a.75.75 0 0 0 0-1.5H8.25Z",clipRule:"evenodd"}),p.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 Bn=p.forwardRef($n);function zn({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{d:"M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z"}))}const Vn=p.forwardRef(zn);function Kn({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{d:"M19.906 9c.382 0 .749.057 1.094.162V9a3 3 0 0 0-3-3h-3.879a.75.75 0 0 1-.53-.22L11.47 3.66A2.25 2.25 0 0 0 9.879 3H6a3 3 0 0 0-3 3v3.162A3.756 3.756 0 0 1 4.094 9h15.812ZM4.094 10.5a2.25 2.25 0 0 0-2.227 2.568l.857 6A2.25 2.25 0 0 0 4.951 21H19.05a2.25 2.25 0 0 0 2.227-1.932l.857-6a2.25 2.25 0 0 0-2.227-2.568H4.094Z"}))}const Xn=p.forwardRef(Kn);function Wn({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M10.5 3.75a6.75 6.75 0 1 0 0 13.5 6.75 6.75 0 0 0 0-13.5ZM2.25 10.5a8.25 8.25 0 1 1 14.59 5.28l4.69 4.69a.75.75 0 1 1-1.06 1.06l-4.69-4.69A8.25 8.25 0 0 1 2.25 10.5Zm8.25-3.75a.75.75 0 0 1 .75.75v2.25h2.25a.75.75 0 0 1 0 1.5h-2.25v2.25a.75.75 0 0 1-1.5 0v-2.25H7.5a.75.75 0 0 1 0-1.5h2.25V7.5a.75.75 0 0 1 .75-.75Z",clipRule:"evenodd"}))}const Gn=p.forwardRef(Wn);function Un({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{d:"M5.625 3.75a2.625 2.625 0 1 0 0 5.25h12.75a2.625 2.625 0 0 0 0-5.25H5.625ZM3.75 11.25a.75.75 0 0 0 0 1.5h16.5a.75.75 0 0 0 0-1.5H3.75ZM3 15.75a.75.75 0 0 1 .75-.75h16.5a.75.75 0 0 1 0 1.5H3.75a.75.75 0 0 1-.75-.75ZM3.75 18.75a.75.75 0 0 0 0 1.5h16.5a.75.75 0 0 0 0-1.5H3.75Z"}))}const Yn=p.forwardRef(Un),Qn=Object.freeze({sortMode:jn,folderPlacement:Vn,readmePlacement:Nn,selectionMode:An,doubleClickAction:Zn,expandIconSize:Gn,alwaysExpanded:Tn,revealDocument:v.ForwardRef$1,removeRootIndent:Mn,lines:Yn,expandIcons:_n,directoryIcons:Xn,fileIcons:Bn}),Ye=(e,t)=>{const n=e[t.labelKey];if(typeof n!="string")throw new TypeError(`[markdown-explorer] the tree setting ${t.key} must name a string label; labels.${t.labelKey} is a ${typeof n}`);return n},Jn=({id:e,settings:t,descriptors:n,onAdvance:a,onClose:s,ref:u})=>{const{labels:o}=v.useExplorer(),l=r.useRef([]);r.useEffect(()=>{l.current[0]?.focus()},[]);const i=r.useCallback(m=>{const d=n.length;l.current[(m%d+d)%d]?.focus()},[n.length]),f=r.useCallback((m,d)=>{switch(m.key){case"ArrowDown":m.preventDefault(),i(d+1);break;case"ArrowUp":m.preventDefault(),i(d-1);break;case"Home":m.preventDefault(),i(0);break;case"End":m.preventDefault(),i(n.length-1);break;case"Escape":v.consumeKey(m),s();break;case"Tab":s();break}},[n.length,i,s]);return c.jsx("div",{ref:u,id:e,role:"menu","aria-label":o.treeSettings,className:"aqmx-explorer-menu","data-testid":"markdown-explorer-tree-settings-menu",children:n.map((m,d)=>{const h=Qn[m.key],x=Ye(o,m),g=A.formatTreeSettingValue(o,t,m.key),E=t[m.key],j=typeof E=="boolean"?{role:"menuitemcheckbox","aria-checked":E,"aria-label":x}:{role:"menuitem","aria-label":`${x}: ${g}`};return c.jsxs("button",{ref:L=>{l.current[d]=L},type:"button",tabIndex:-1,...j,title:`${x}: ${g}`,className:"aqmx-explorer-menu-item","data-testid":"markdown-explorer-tree-settings-item","data-aqmx-setting":m.key,onClick:()=>a(m),onKeyDown:L=>f(L,d),children:[c.jsx(h,{className:"aqmx-explorer-menu-icon","aria-hidden":"true"}),c.jsx("span",{className:"aqmx-explorer-menu-name",children:x}),c.jsx("span",{className:"aqmx-explorer-menu-value",children:g})]},m.key)})})},er=({settings:e,descriptors:t,onAdvance:n})=>{const{labels:a,announcer:s}=v.useExplorer(),[u,o]=r.useState(!1),l=r.useRef(null),i=r.useRef(null),f=r.useRef(null),m=r.useId(),d=r.useCallback(()=>{l.current?.focus(),o(!1)},[]);r.useEffect(()=>{if(!u)return;const g=E=>{E.target instanceof Node&&(l.current?.contains(E.target)===!0||i.current?.contains(E.target)===!0)||(o(!1),f.current!==null&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>{f.current=null,(document.activeElement===null||document.activeElement===document.body)&&l.current?.focus()},0))};return document.addEventListener("pointerdown",g),()=>document.removeEventListener("pointerdown",g)},[u]),r.useEffect(()=>()=>{f.current!==null&&window.clearTimeout(f.current)},[]);const h=r.useCallback(g=>{g.key!=="Escape"||!u||(v.consumeKey(g),d())},[u,d]),x=r.useCallback(g=>{const E=n(g.key);s.announce(a.settingAnnouncement(Ye(a,g),A.formatTreeSettingValue(a,E,g.key)))},[s,a,n]);return{trigger:c.jsx("button",{ref:l,type:"button",className:"aqmx-icon-button","aria-haspopup":"menu","aria-expanded":u,"aria-controls":u?m:void 0,"aria-label":a.treeSettings,title:a.treeSettings,"data-testid":"markdown-explorer-tree-settings",onClick:()=>o(g=>!g),onKeyDown:h,children:c.jsx(Dn,{"aria-hidden":"true"})}),menu:u?c.jsx(Jn,{ref:i,id:m,settings:e,descriptors:t,onAdvance:x,onClose:d}):null}},tr=()=>{const{treeSettings:e}=v.useExplorer();return{settings:r.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot),advance:e.advance}},Ie=new Set,nr='[role="tree"] [role="treeitem"][tabindex="0"]',rr="[data-directory-tree-tab-stop]",ar=e=>{const{mode:t,sourceId:n,currentPath:a,openPaths:s,onOpenDocument:u,onSourceChange:o,onRevealSource:l,viewSwitch:i}=e,{labels:f,sources:m,trees:d,documents:h,announcer:x,reveals:g}=v.useExplorer(),{settings:E,advance:j}=tr(),L=r.useMemo(()=>A.visibleTreeSettingDescriptors(t==="tree"),[t]),N=t==="tree"&&E.selectionMode==="multiple";kn(N);const R=e.mode==="tree"?e.tray.onGatheredChange:null,F=e.mode==="tree"?e.onOpenSelection:void 0,C=e.mode==="tree"?e.onOpenFolder:null,y=e.mode==="tree"&&e.currentFolder,T=r.useMemo(()=>C===null?null:{current:a,open:C},[C,a]),S=e.mode==="tree"&&N?e.tray.gathered:we,b=r.useCallback(P=>{const M=j(P);return M.selectionMode!=="multiple"&&R?.(we),M},[j,R]),q=er({settings:E,descriptors:L,onAdvance:b}),_=r.useCallback(P=>R?.(M=>yn(M,P)),[R]),ae=r.useCallback(P=>R?.(M=>Sn(M,P)),[R]),Q=r.useCallback(()=>R?.(we),[R]),Z=r.useRef(null),$=r.useCallback(()=>{const P=Z.current;if(P===null)return;[nr,rr,'[data-testid="markdown-explorer-tree-settings"]'].map(D=>P.querySelector(D)).find(D=>D!==null)?.focus()},[]),J=r.useMemo(()=>new Set(S.keys()),[S]),I=r.useMemo(()=>a===null?Ie:new Set([a]),[a]),X=r.useMemo(()=>{if(t==="multi")return{mode:"multiple",items:s,shownPath:null,onChange:null};switch(E.selectionMode){case"single":return{mode:"single",items:I,shownPath:a,onChange:null};case"multiple":return{mode:"multiple",items:J,shownPath:a,onChange:_};case"none":return{mode:"none",items:Ie,shownPath:null,onChange:null}}},[t,s,E.selectionMode,I,a,J,_]),W=r.useMemo(()=>E.revealDocument?{path:a,openFolders:!y}:{path:X.shownPath,openFolders:!1},[E.revealDocument,a,y,X.shownPath]),G=r.useCallback(P=>{a!==null&&g.settle(a),o(P)},[a,g,o]),[O,ee]=r.useState(null),[le,ue]=r.useState(!1),[te,B]=r.useState(null),U=r.useRef(!1),fe=r.useCallback(async()=>{if(!U.current){U.current=!0,ue(!0),B(null);try{const P=await d.refresh(n);if(P.status==="superseded")return;h.invalidate(),P.status==="failed"?B({sourceId:n,failure:P.failure}):x.announce(f.treeRefreshed)}finally{U.current=!1,ue(!1)}}},[d,h,n,x,f]),oe=O===null?null:O.expandAll,se=O?.expanding===!0,de=m.find(P=>P.id===n),ne=i.target==="multi"?St:Rt,z=i.target==="multi"?f.switchToMulti:f.switchToTree;return c.jsxs("nav",{ref:Z,"aria-label":f.explorerRegion,className:"aqmx-explorer","data-testid":"markdown-explorer-explorer","data-aqmx-mode":t,children:[c.jsxs("div",{className:"aqmx-explorer-header",children:[m.length>1?c.jsx("select",{className:"aqmx-explorer-source","aria-label":f.sourceLabel,title:de?.label,value:n,onChange:P=>G(P.currentTarget.value),"data-testid":"markdown-explorer-source-select",children:m.map(P=>c.jsx("option",{value:P.id,children:P.label},P.id))}):null,c.jsxs("div",{className:"aqmx-explorer-actions",children:[c.jsx(v.ExplorerLink,{to:i.href,navigation:"switch-view",className:"aqmx-icon-button","aria-label":z,title:z,"data-testid":"markdown-explorer-view-switch","data-aqmx-target":i.target,children:c.jsx(ne,{"aria-hidden":"true"})}),c.jsxs("button",{type:"button",className:"aqmx-icon-button aqmx-labelled-button",title:f.refreshTree,"aria-disabled":le,"aria-busy":le,"data-aqmx-busy":le?"true":void 0,"data-testid":"markdown-explorer-refresh",onClick:()=>{fe()},children:[c.jsx(v.ForwardRef,{"aria-hidden":"true"}),c.jsx("span",{children:f.refreshTreeLabel})]}),c.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":f.expandAll,title:f.expandAll,"aria-disabled":oe===null||se,"aria-busy":se,"data-aqmx-busy":se?"true":void 0,"data-testid":"markdown-explorer-expand-all",onClick:()=>oe?.(),children:c.jsx(bt,{"aria-hidden":"true"})}),c.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":f.collapseAll,title:f.collapseAll,"aria-disabled":O===null,"data-testid":"markdown-explorer-collapse-all",onClick:()=>O?.collapseAll(),children:c.jsx(gt,{"aria-hidden":"true"})}),q.trigger]})]}),c.jsxs("div",{className:"aqmx-explorer-body","data-aqmx-explorer-body":"",children:[te!==null&&te.sourceId===n?c.jsx("p",{role:"alert",className:"aqmx-explorer-refresh-failure","data-testid":"markdown-explorer-refresh-failure","data-aqmx-failure":te.failure.reason,children:f.treeRefreshFailed(v.failureTitleOf(f,te.failure.reason))}):null,c.jsx(r.Suspense,{fallback:null,children:c.jsx(kt,{})}),c.jsx(bn,{mode:t,sourceId:n,settings:E,reveal:W,openPaths:s,selection:X,onOpenDocument:u,folders:T,onRevealSource:l,onControls:ee},n),N&&S.size>0?c.jsx(Rn,{selection:S,onRemove:ae,onClear:Q,onOpenSelection:F,onLeave:$}):null,q.menu]})]})};function lr({title:e,titleId:t,...n},a){return p.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:a,"aria-labelledby":t},n),e?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M3 6.75A.75.75 0 0 1 3.75 6h16.5a.75.75 0 0 1 0 1.5H3.75A.75.75 0 0 1 3 6.75ZM3 12a.75.75 0 0 1 .75-.75h16.5a.75.75 0 0 1 0 1.5H3.75A.75.75 0 0 1 3 12Zm0 5.25a.75.75 0 0 1 .75-.75h16.5a.75.75 0 0 1 0 1.5H3.75a.75.75 0 0 1-.75-.75Z",clipRule:"evenodd"}))}const or=p.forwardRef(lr),sr=({explorer:e,toggleRef:t,covered:n,onNoticeSlotChange:a,dismissals:s})=>{const{labels:u}=v.useExplorer(),o=ht.useLocation(),{location:l}=v.useExplorerLocation(),[i,f]=r.useState(!1),[m,d]=r.useState({navigated:o,source:l.source}),[h,x]=r.useState(!1);m.navigated!==o&&(d({navigated:o,source:l.source}),m.source===l.source&&!h&&f(!1));const[g,E]=r.useState(s);g!==s&&(E(s),f(!1));const j=r.useRef(null),L=r.useRef(null),N=r.useRef(null),R=r.useRef(!1),F=r.useId();r.useLayoutEffect(()=>{const b=j.current;b!==null&&(i&&!b.open?(b.showModal(),L.current?.focus()):!i&&b.open&&(b.close(),t.current?.focus()),a(i?N.current:null))},[i,t,a]),r.useLayoutEffect(()=>()=>a(null),[a]);const C=r.useCallback(b=>{b.key!=="Escape"||b.defaultPrevented||(v.consumeKey(b),f(!1))},[]),y=r.useCallback(b=>{R.current=b.target===b.currentTarget},[]),T=r.useCallback(b=>{const q=R.current;R.current=!1,q&&b.target===b.currentTarget&&f(!1)},[]),S=r.useCallback(()=>{f(!1)},[]);return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"aqmx-sheet-bar",inert:n,children:c.jsxs("button",{ref:t,type:"button",className:"aqmx-sheet-toggle","aria-haspopup":"dialog","aria-expanded":i,"aria-controls":F,"data-testid":"markdown-explorer-sheet-toggle",onClick:()=>f(!0),children:[c.jsx(or,{"aria-hidden":"true"}),c.jsx("span",{children:u.showExplorer})]})}),c.jsx("dialog",{ref:j,id:F,className:"aqmx-sheet","aria-label":u.explorerRegion,"data-testid":"markdown-explorer-sheet",onKeyDown:C,onPointerDown:y,onClick:T,onClose:S,children:c.jsxs("div",{className:"aqmx-sheet-panel",children:[c.jsxs("div",{className:"aqmx-sheet-header",children:[c.jsx("div",{ref:N,className:"aqmx-sheet-notice-slot"}),c.jsx("button",{ref:L,type:"button",className:"aqmx-sheet-close","aria-label":u.hideExplorer,title:u.hideExplorer,"data-testid":"markdown-explorer-sheet-close",onClick:()=>f(!1),children:c.jsx(Ge,{"aria-hidden":"true"})})]}),c.jsx("div",{className:"aqmx-sheet-body",children:c.jsx(ye,{value:i,children:c.jsx(Ue,{value:x,children:e})})}),c.jsx(v.LiveRegion,{holds:i,testId:"markdown-explorer-sheet-announcer"})]})})]})},Qe=r.createContext(null),Se="aqmx-explorer",Je="aqmx-content",cr="--aqmx-split-band",ke='[role="tree"] [role="treeitem"]',ir=`${ke}[tabindex="0"]`,ur="[data-directory-tree-tab-stop]",dr=(e,t)=>{for(const n of e.querySelectorAll(`[data-panel-id="${Se}"] ${ke}`))if(n.getAttribute(re)===t)return n;return null},De=(e,t)=>({inlineSize:e>0?e:null,rootFontPixels:t>0?t:A.ASSUMED_ROOT_FONT_PIXELS}),fr=(e,t)=>{const[n,a]=r.useState(()=>De(0,0));return r.useLayoutEffect(()=>{const s=e.current,u=t.current;if(s===null||u===null)throw new Error("[markdown-explorer] the split frame is not mounted");const o={frame:s.getBoundingClientRect().width,rem:u.getBoundingClientRect().width},l=()=>{const f=De(o.frame,o.rem);a(m=>m.inlineSize===f.inlineSize&&m.rootFontPixels===f.rootFontPixels?m:f)};l();const i=new ResizeObserver(f=>{for(const m of f){const[d]=m.borderBoxSize;d!==void 0&&(m.target===s&&(o.frame=d.inlineSize),m.target===u&&(o.rem=d.inlineSize))}l()});return i.observe(s),i.observe(u),()=>i.disconnect()},[e,t]),n},et=e=>`aqmx-split-handle-${e}`,mr=(e,{frameRef:t,sheetToggleRef:n,handleId:a})=>{const s=r.useRef(!1),u=r.useRef(null),o=r.useRef(!1);r.useLayoutEffect(()=>{const i=t.current;if(i===null)throw new Error("[markdown-explorer] the split frame is not mounted");const f=d=>{const h=d.target instanceof Element?d.target:null;s.current=h!==null&&h.closest(`[data-panel-id="${Je}"]`)===null,!o.current&&(u.current=h?.closest(`${ke}[${re}]`)?.getAttribute(re)??null)},m=d=>{d.relatedTarget instanceof Node&&!i.contains(d.relatedTarget)&&(s.current=!1)};return i.addEventListener("focusin",f),i.addEventListener("focusout",m),()=>{i.removeEventListener("focusin",f),i.removeEventListener("focusout",m)}},[t]);const l=r.useRef(e);r.useLayoutEffect(()=>{if(l.current===e)return;l.current=e;const i=t.current;if(i===null||!s.current)return;const f=m=>{const{activeElement:d,body:h}=i.ownerDocument;if(d!==null&&d!==h)return;const x=m.find(g=>g!==null);if(x!=null){o.current=!0;try{x.focus()}finally{o.current=!1}}};if(e){f([n.current]);return}queueMicrotask(()=>{if(l.current!==e||!s.current)return;const m=u.current,d=`[data-panel-id="${Se}"]`;f([m===null?null:dr(i,m),i.querySelector(`${d} ${ir}`),i.querySelector(`${d} ${ur}`),i.querySelector(`[data-resize-handle-id="${a}"]`)])})},[e,t,n,a])},pr=({view:e,explorer:t,content:n,contentCoversPage:a=!1,sheetDismissals:s=0,onDraggingChange:u})=>{const o=r.useRef(null),[l,i]=r.useState(null),f=r.useRef(null),m=r.useRef(null),{inlineSize:d,rootFontPixels:h}=fr(o,f),x=d!==null&&d<A.explorerSheetBelowPixels(h);return mr(x,{frameRef:o,sheetToggleRef:m,handleId:et(e)}),c.jsxs("div",{ref:o,className:"aqmx-split-frame","data-aqmx-explorer-mode":x?"sheet":"split",children:[c.jsx("span",{ref:f,className:"aqmx-rem-probe","aria-hidden":"true","data-aqmx-rem-probe":""}),x?c.jsx(sr,{explorer:t,toggleRef:m,covered:a,onNoticeSlotChange:i,dismissals:s}):null,c.jsx(Qe,{value:x?l:null,children:c.jsx(hr,{view:e,sheet:x,explorer:t,content:n,contentCoversPage:a,onDraggingChange:u,explorerMinPixels:A.explorerMinPixels(h)})})]})},hr=({view:e,sheet:t,explorer:n,content:a,contentCoversPage:s,onDraggingChange:u,explorerMinPixels:o})=>{const{viewSettings:l,labels:i}=v.useExplorer(),m=v.useViewSetting(C=>e==="tree"?C.treeExplorer:C.multiExplorer)??(e==="tree"?A.EXPLORER_DEFAULT_PERCENT:A.EXPLORER_MULTI_DEFAULT_PERCENT),d=r.useRef(!1),[h,x]=r.useState(!1),g=r.useRef(u);r.useLayoutEffect(()=>{g.current=u},[u]);const E=Ae.useSplitPersistence(r.useCallback(C=>{if(C.length!==2)return;const[y=0,T=0]=C,S=y+T;if(S<=0||y<=0)return;const b=Math.min(A.EXPLORER_MAX_PERCENT,y/S*100);l.update(e==="tree"?{treeExplorer:b}:{multiExplorer:b})},[l,e]));r.useEffect(()=>()=>{d.current&&g.current?.(!1)},[]);const L=Ae.useCoarsePointer()?A.COARSE_TARGET_PIXELS:A.FINE_TARGET_PIXELS,N=r.useMemo(()=>({[cr]:`${String(t?0:L)}px`}),[t,L]),R=r.useCallback((C,y)=>{const[T=0,S=0]=C;C.length===2&&S>0&&x(T<=0),E.layoutChanged(C,y)},[E]),F=r.useCallback(C=>{d.current=C,u?.(C),E.draggingChanged(C)},[u,E]);return c.jsxs(xe.PanelGroup,{id:`aqmx-split-${e}`,direction:"horizontal",onLayout:R,className:"aqmx-split",style:N,"data-aqmx-split":e,children:[t?null:c.jsx(xe.Panel,{id:Se,defaultSize:{value:m,unit:"percentage"},minSize:{value:o,unit:"pixels"},maxSize:{value:A.EXPLORER_MAX_PERCENT,unit:"percentage"},collapsible:{from:"end"},pixelAdjustPriority:1,inert:s,className:"aqmx-split-explorer",children:c.jsx(ye,{value:!h,children:n})}),t?null:c.jsx(xe.PanelResizeHandle,{id:et(e),thickness:L,indicator:{visible:!0,thickness:A.SPLIT_HANDLE_PIXELS.gripThickness,length:A.SPLIT_HANDLE_PIXELS.gripLength,barThickness:A.SPLIT_HANDLE_PIXELS.barThickness,barLength:A.SPLIT_HANDLE_PIXELS.barLength},title:i.resizeExplorer,"aria-label":i.resizeExplorer,onDragging:F,inert:s,className:"aqmx-split-handle"}),c.jsx(xe.Panel,{id:Je,defaultSize:{value:100-m,unit:"percentage"},contentOverflow:"hidden",className:"aqmx-split-content",...s?{style:{isolation:"auto"}}:{},children:a})]})};exports.EMPTY_SELECTION=we;exports.ExplorerPane=ar;exports.ExplorerSplit=pr;exports.SheetNoticeSlotContext=Qe;
@@ -1,13 +1,13 @@
1
1
  import { jsx as m, jsxs as L, Fragment as Qe } from "react/jsx-runtime";
2
- import { u as $, t as At, Z as Pe, R as Je, _ as kt, G as Oe, $ as Lt, a0 as Pt, o as Ot, a1 as qt, a2 as Ct, a3 as Ft } from "./index-auQVKY4M.js";
2
+ import { u as $, t as At, _ as Pe, S as Je, $ as kt, H as Oe, a0 as Lt, a1 as Pt, o as Ot, a2 as qt, a3 as Ct, a4 as Ft } from "./index-C8yNTkdV.js";
3
3
  import * as f from "react";
4
4
  import { use as ye, createContext as qe, useState as F, useCallback as w, useMemo as C, useRef as E, useLayoutEffect as H, useEffect as D, useSyncExternalStore as Ce, Suspense as et, useId as Re } from "react";
5
- import { s as Mt, u as _t, v as tt, x as It, y as Dt, z as Ht, C as $t, F as Zt, A as Ve, B as Bt, D as zt, b as Ee, G as Vt } from "./location-CKuabtKl.js";
5
+ import { s as Mt, u as _t, v as tt, x as It, y as Dt, z as Ht, C as $t, F as Zt, A as Ve, B as Bt, D as zt, b as Ee, G as Vt } from "./location-perTmwct.js";
6
6
  import { useDirectoryTreeState as jt, DirectoryTree as Kt } from "@aiquants/directory-tree";
7
- import { TAP_SCROLL_CIRCLE as Gt } from "./tapScrollCircle-DYQ8P2ag.js";
7
+ import { TAP_SCROLL_CIRCLE as Gt } from "./tapScrollCircle-Cy1KyTg2.js";
8
8
  import { s as Ut } from "./storage-CmGHg7OA.js";
9
9
  import { PanelGroup as Wt, Panel as je, PanelResizeHandle as Xt } from "@aiquants/resize-panels";
10
- import { a as Yt, u as Qt } from "./useSplitPersistence-Bf4M35Il.js";
10
+ import { a as Yt, u as Qt } from "./useSplitPersistence-Du01PHNg.js";
11
11
  import { useLocation as Jt } from "react-router";
12
12
  function en({
13
13
  title: e,