@aiquants/markdown-explorer 0.11.0 → 0.12.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 (40) hide show
  1. package/CHANGELOG.md +18 -1
  2. package/README.md +64 -5
  3. package/dist/EditSurface-BTAhzvHi.js +509 -0
  4. package/dist/EditSurface-Dfj6Sxxb.cjs +2 -0
  5. package/dist/{ExplorerSplit-51frK8xf.cjs → ExplorerSplit-DekOjAUZ.cjs} +1 -1
  6. package/dist/{ExplorerSplit-DwlWWfRv.js → ExplorerSplit-MPHjw3nW.js} +52 -52
  7. package/dist/{MultiLayout-CeR_l6Rb.js → MultiLayout-DtSW4rEQ.js} +4 -4
  8. package/dist/{MultiLayout-B4PtS45V.cjs → MultiLayout-HMzVDYWq.cjs} +1 -1
  9. package/dist/{NativeScrollBar-Dp4YWBp7.cjs → NativeScrollBar-B0AkVF3E.cjs} +1 -1
  10. package/dist/{NativeScrollBar-CVWeTlHC.js → NativeScrollBar-CNQr7JY1.js} +1 -1
  11. package/dist/{TreeLayout-min5AOhr.js → TreeLayout-CJO9tOPq.js} +3 -3
  12. package/dist/{TreeLayout-D-NyhuVM.cjs → TreeLayout-_XQR-9tV.cjs} +1 -1
  13. package/dist/client/MarkdownExplorer.d.cts +3 -2
  14. package/dist/client/MarkdownExplorer.d.ts +3 -2
  15. package/dist/core/contracts.d.cts +16 -0
  16. package/dist/core/contracts.d.ts +16 -0
  17. package/dist/dataRoute-CH3yOKR0.cjs +1 -0
  18. package/dist/{dataRoute-CU9CKP44.js → dataRoute-Pm_0ue_4.js} +93 -92
  19. package/dist/{index-DJ_FUtYM.cjs → index-DpIVKG8Y.cjs} +8 -8
  20. package/dist/{index-BPj19kIo.js → index-o6OpR4ND.js} +963 -907
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.d.cts +1 -1
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.js +9 -9
  25. package/dist/{location-LNl0QOXI.cjs → location-BUNWJ4eB.cjs} +1 -1
  26. package/dist/{location-BT23fKeh.js → location-DWd6SQhN.js} +1 -1
  27. package/dist/{merge-AnqxGn__.cjs → merge-Bs7o3GyP.cjs} +1 -1
  28. package/dist/{merge-hyUGPGbJ.js → merge-DDJaJmMU.js} +1 -1
  29. package/dist/sanitizePolicy-BfUlXI5E.cjs +1 -0
  30. package/dist/sanitizePolicy-djLC3fRN.js +96 -0
  31. package/dist/sanitizeWorker.cjs +1 -1
  32. package/dist/sanitizeWorker.js +143 -226
  33. package/dist/server.cjs +1 -1
  34. package/dist/server.js +3 -3
  35. package/docs/behavior/dom-hooks.md +1 -1
  36. package/docs/behavior/security.md +2 -0
  37. package/package.json +3 -3
  38. package/dist/EditSurface-BK_Pz_LF.js +0 -371
  39. package/dist/EditSurface-CfbYYXrc.cjs +0 -2
  40. package/dist/dataRoute-CIFFX5bd.cjs +0 -1
@@ -1 +1 @@
1
- "use strict";const c=require("react/jsx-runtime"),R=require("./index-DJ_FUtYM.cjs"),r=require("react"),O=require("./location-LNl0QOXI.cjs"),_e=require("@aiquants/directory-tree"),dt=require("./tapScrollCircle-C5DGI-0H.cjs"),ft=require("./storage-Dgi4JXaB.cjs"),pe=require("@aiquants/resize-panels"),mt=require("react-router");function pt(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 h=pt(r);function ht({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 xt=h.forwardRef(ht);function wt({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 gt=h.forwardRef(wt);function Et({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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"}),h.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 bt=h.forwardRef(Et);function vt({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 Rt=h.forwardRef(vt),yt=()=>{const{notices:e}=R.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 St({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 kt=h.forwardRef(St),ve=r.createContext(!0),Ie="\0loop\0",De="\0",Ct=()=>{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(p=>{const x=u(p,l,i);return x!==p&&(f=!0),x});if(!f)return o;const d=n.get(o);return d!==void 0&&d.length===m.length&&d.every((p,x)=>p===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 p=s(d,l,i);if(i.delete(o.path),!m&&p===o.children)return o;const x=t.get(o);if(x!==void 0&&x.state===f&&x.children===p)return x.grafted;const g={...o,children:p,lazy:m?!1:o.lazy};return t.set(o,{state:f,children:p,grafted:g}),g};return(o,l)=>s(o,l,new Set)},Tt=(e,t)=>`${Ie}${e}${De}${t}`,ie=e=>e.startsWith(Ie),Lt=e=>e.slice(e.lastIndexOf(De)+1),ne="data-aqmx-path",jt=(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}},Nt=(e,t,n,a)=>{const s=Tt(t,e.path);return{name:n,type:"directory",absolutePath:s,relativePath:s,children:a,data:{aqmxLoop:e.path}}},Pt=()=>{const e=new WeakMap,t=new WeakMap,n=new WeakMap,a=[],s=(l,i,f)=>{const m=l.map(p=>p.type==="loop"?u(p,i,f):o(p,i)),d=n.get(l);return d!==void 0&&d.length===m.length&&d.every((p,x)=>p===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=Nt(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,p=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===p)return x.row;const g=jt(l,f,m,d,p===void 0?void 0:p(l));return e.set(l,{row:g,open:m,childrenStatus:d,children:f,renderFailedFolder:p}),g};return(l,i)=>s(l,i,"")},Ot=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))},be=(e,t)=>{const n=e.filter(a=>a.type==="directory");return t===void 0?n:n.sort(t)},qt=(e,t)=>{const n=new Map;let a=0;const s=u=>{for(const o of be(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}},At=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},He=(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:He(n.children,t);if(a!==null)return a}return null},Mt=(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"},Pe=new Set,Ft=(e,t)=>e.has(t)?e:new Set(e).add(t),_t=(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)))},It=(e,t)=>[...e].every(n=>t.has(n))?e:new Set([...e].filter(n=>t.has(n))),Dt=()=>{const[e,t]=r.useState(Pe),n=r.useCallback(o=>t(l=>Ft(l,o)),[]),a=r.useCallback(o=>t(l=>_t(l,o)),[]),s=r.useCallback(o=>t(l=>It(l,o)),[]),u=r.useCallback(()=>t(Pe),[]);return r.useMemo(()=>({direct:e,markDirect:n,unmarkDirect:a,pruneDirect:s,clearDirect:u}),[e,n,a,s,u])},Ht=e=>({budget:e,handled:new Set,loads:new Set,opened:0,folderLimited:!1,depthLimited:!1,announcedStart:!1,issuedAgainst:null}),Zt=(e,t)=>{const n=[];let a=be(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(...be(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))),$t=(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)}},Ee=Object.freeze({state:"idle"}),Bt=e=>{const t=r.useRef(null),n=r.useRef(e),[a,s]=r.useState(Ee);r.useLayoutEffect(()=>{n.current=e});const u=r.useCallback(()=>{t.current===null&&(t.current=Ht(n.current.budget),s({state:"running",opened:0}))},[]),o=r.useCallback(()=>{t.current=null,s(Ee)},[]),l=r.useCallback(i=>{const f=t.current;if(f===null)return;const m=Zt(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 p=$t(f,i);s(p.kind==="done"?Ee:{state:"stopped",stop:p.kind,opened:p.opened}),n.current.onFinish(p);return}const{opened:d}=f;s(p=>p.state==="running"&&p.opened===d?p:{state:"running",opened:d})},[]);return r.useMemo(()=>({status:a,start:u,end:o,advance:l}),[a,u,o,l])},Oe=["pointerdown","wheel","touchstart","keydown","focusin"],zt=8,qe={least:Number.POSITIVE_INFINITY,stalled:0},Vt=({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(qe),d=r.useRef(null),p=r.useRef(null),x=r.useRef(a),g=r.useRef(l);r.useLayoutEffect(()=>{x.current=a,g.current=l},[a,l]);const b=r.useCallback(()=>{const L=d.current;L!==null&&(d.current=null,L.phase==="asking"?L.controller.abort():x.current?.open(null))},[]),S=r.useCallback(()=>{i.current=null,b()},[b]),P=r.useCallback(()=>{const L=t.current;i.current===null||p.current!==null||L===null||L.getClientRects().length===0||(p.current=requestAnimationFrame(()=>{p.current=null;const E=i.current;if(E===null)return;const y=g.current(E);if(y===0){f.current=!0,d.current?.phase==="opening"&&b();return}if(e.current?.scrollToPath(E,{align:"nearest"})===!0){d.current?.phase==="opening"&&b();const{least:j,stalled:A}=m.current;m.current=y<j?{least:y,stalled:0}:{least:j,stalled:A+1},m.current.stalled<zt&&P();return}const v=d.current;if(v===null){i.current=null;return}v.phase==="opening"&&x.current?.progress(v.folders,E)!=="loading"&&S()}))},[e,t,b,S]),k=r.useCallback(()=>{f.current=!1,m.current=qe,P()},[P]);r.useEffect(()=>{const L=t.current;if(L===null)return;const E=typeof ResizeObserver>"u"?null:new ResizeObserver(k);E?.observe(L);for(const y of Oe)L.addEventListener(y,S,{passive:!0});return()=>{E?.disconnect();for(const y of Oe)L.removeEventListener(y,S);p.current!==null&&cancelAnimationFrame(p.current),p.current=null,b()}},[t,k,S,b]);const T=a!==null;r.useEffect(()=>{const L=t.current;if(S(),n===null||L===null||L.contains(L.ownerDocument.activeElement))return;i.current=n;const E=x.current;if(T&&E!==null){const y=new AbortController,v={phase:"asking",controller:y};d.current=v,E.ancestors(n,y.signal).then(j=>{d.current===v&&(j===null?d.current=null:(d.current={phase:"opening",folders:j},x.current?.open(j)),k())})}k()},[n,T,t,S,k]),r.useEffect(()=>{(d.current?.phase==="opening"||i.current!==null&&!f.current)&&k()},[s,k]);const F=r.useRef(u);r.useEffect(()=>{F.current!==u&&(F.current=u,S())},[u,S]);const q=r.useRef(o);r.useEffect(()=>{q.current&&!o&&b(),q.current=o},[o,b])},Kt="--aqmx-tree-line",Xt=Object.freeze(["(forced-colors: active)","(prefers-color-scheme: dark)"]),Wt="data-aqmx-tree-probe",Ut=Object.freeze({rowHeight:O.CONTROL_BLOCK_PIXELS,lineColor:null}),Gt=/^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/u,Yt=e=>{const t=Gt.exec(e);return t===null?e:`#${t.slice(1).map(n=>Number(n).toString(16).padStart(2,"0")).join("")}`},Qt=(e,t)=>{const[n,a]=r.useState(Ut);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(Kt).trim()===""?null:Yt(f.color);a(d=>{const p=Number.isFinite(i)&&i>0?i:d.rowHeight;return d.rowHeight===p&&d.lineColor===m?d:{rowHeight:p,lineColor:m}})};u();const o=Xt.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},$e="markdown-explorer-tree-scroll",Jt=.5,Be=(e,t)=>[...e.querySelectorAll(`[role="treeitem"][${ne}]`)].find(n=>n.getAttribute(ne)===t),en=(e,t)=>{const n=Be(e,t),a=n?.closest(`[data-testid="${$e}"]`);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<=Jt?0:l},tn={testId:$e,overscanCount:13,callbackThrottleMs:13,scrollBarOptions:{width:8,enableTrackClick:!0,enableThumbDrag:!0,enableArrowButtons:!0,enableArrowButtonTabStops:!1,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:dt.TAP_SCROLL_CIRCLE},behaviorOptions:{enablePointerDrag:!0}},nn={hoverClassName:"",directorySelectedClassName:"",itemSelectedClassName:""},rn={color:"inherit"},an={paddingBlock:0},ln=new Set,on=new Map,sn={color:"var(--aqmx-tree-line)"},cn=e=>{const t=e instanceof Element?e.closest(`[${ne}]`):null;return t===null||t.getAttribute("data-entry-type")!=="file"?null:t.getAttribute(ne)},ze=(e,t,n,a)=>n==="folder-limit"?e.expandAllFolderLimit(a,t.maxFolders,e.expandAll):e.expandAllDepthLimit(a,t.maxDepth),un=(e,t,n)=>n.kind==="done"?e.expandAllDone(n.opened,n.failed,n.complete):ze(e,t,n.kind,n.opened),Ve=()=>{const{labels:e}=R.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",{})]})]})},dn=()=>{const{labels:e}=R.useExplorer();return c.jsxs("div",{className:"aqmx-empty","data-testid":"markdown-explorer-tree-empty",children:[c.jsx(kt,{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})]})},fn=({name:e,onRetry:t})=>{const{labels:n}=R.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&&R.focusWithoutScroll(o),t()},onKeyDown:s=>{s.key!=="Escape"&&s.stopPropagation()},children:[c.jsx(R.ForwardRef,{className:"aqmx-explorer-folder-retry-icon","aria-hidden":"true"}),c.jsx("span",{className:"aqmx-explorer-folder-retry-text",children:n.retry})]})]})},mn=({entries:e,version:t,mode:n,sourceId:a,settings:s,reveal:u,openPaths:o,selection:l,onOpenDocument:i,onRevealSource:f,expansion:m,onShown:d,marks:p,claimsHeld:x,expandAll:g,revealCancel:b})=>{const{trees:S,documents:P,labels:k,locale:T,theme:F,data:q,config:L,sources:E,reveals:y}=R.useExplorer(),v=r.use(ve),[j]=r.useState(Pt),A=r.useRef(null),{rowHeight:le,lineColor:z}=Qt(A,F),{isExpanded:_,toggle:U,expandMultiple:Z,collapseMultiple:J,expanded:D,isPending:ee}=m,{alwaysExpanded:V,sortMode:M,folderPlacement:$}=s,{direct:oe,markDirect:B,unmarkDirect:re,pruneDirect:se}=p,{running:te,advance:ue}=g,ce=r.useRef(null),G=r.useRef(null),C=r.useMemo(()=>O.createEntryComparator({sortMode:M,folderPlacement:$}),[M,$]),K=r.useMemo(()=>Ot(C),[C]),I=r.useCallback(w=>S.children(a,w),[S,a]),Y=r.useMemo(()=>At(e),[e]),Q=r.useCallback(w=>!ie(w)&&(_(w)||V&&!Y.has(w)),[_,V,Y]),X=r.useRef({shownExpanded:Q,isExpanded:_,unloadedFolders:Y,entries:e,childrenOf:I});r.useLayoutEffect(()=>{X.current={shownExpanded:Q,isExpanded:_,unloadedFolders:Y,entries:e,childrenOf:I}},[Q,_,Y,e,I]);const Se=r.useCallback(w=>{ce.current?.scrollToPath(w,{align:"nearest"}),requestAnimationFrame(()=>{const N=G.current,H=N===null?void 0:Be(N,w);H!==void 0&&R.focusWithoutScroll(H)})},[]),Je=r.useCallback(w=>{if(ie(w)){Se(Lt(w));return}X.current.isExpanded(w)?re([w]):X.current.unloadedFolders.has(w)&&B(w),U(w)},[Se,B,re,U]),xe=r.useCallback(w=>{const N=w.filter(H=>!ie(H));N.length!==0&&(re(N),J(N))},[re,J]),et=r.useCallback(w=>{const N=w.filter(H=>!ie(H));N.length!==0&&(N.length<w.length&&N.every(H=>X.current.shownExpanded(H))?xe(N):Z(N))},[Z,xe]),ke=r.useCallback(w=>c.jsx(fn,{name:w.name,onRetry:()=>{B(w.path),S.retryChildren(a,w.path),X.current.shownExpanded(w.path)||Z([w.path])}}),[S,a,B,Z]),Ce=n==="multi"?o:ln,{loopFolderName:Te}=k,tt=r.useMemo(()=>j(e,{openPaths:Ce,childrenOf:I,renderFailedFolder:ke,loopFolderName:Te}),[j,e,Ce,I,ke,Te,t]),nt=R.useIntentPrefetch(P,cn),Le=r.useRef([]),de=r.useCallback(()=>{for(const w of Le.current)X.current.unloadedFolders.has(w)&&B(w)},[B]),{maxDepth:we}=L.revealDocument,je=r.useRef(f);r.useLayoutEffect(()=>{je.current=f},[f]);const rt=r.useMemo(()=>({ancestors:async(w,N)=>{const H=y.take(a,w);if(H!==null)return H;if(!y.mayMove(w)){const ae=await q.ancestors(a,w,N);return ae.status!=="ok"||ae.ancestors===null||ae.ancestors.length>we?null:ae.ancestors}const W=await q.reveal(a,w,N);return W.status!=="ok"||W.source===null||W.ancestors.length>we?null:W.source===a?W.ancestors:(N.aborted||!E.some(ae=>ae.id===W.source)||(y.move(W.source,w,W.ancestors),je.current(W.source)),null)},open:w=>{Le.current=w??[],w!==null&&(de(),Z([...w]))},progress:(w,N)=>Mt(X.current.entries,w,N,{isShownExpanded:X.current.shownExpanded,childrenOf:X.current.childrenOf})}),[q,a,E,y,we,de,Z]);r.useEffect(()=>de(),[de,Y]);const at=r.useMemo(()=>[e,t,D],[e,t,D]),lt=r.useCallback(w=>G.current===null?Number.POSITIVE_INFINITY:en(G.current,w),[]);Vt({tree:ce,container:G,path:u.path,chain:u.openFolders?rt:null,rows:at,cancel:b,displayed:v,placement:lt});const Ne=r.useCallback(w=>oe.has(w),[oe]),fe=r.useMemo(()=>qt(e,{isShownExpanded:Q,childrenOf:I,compare:C,isDirect:Ne}),[e,Q,I,C,Ne,t]),me=v&&x;r.useLayoutEffect(()=>{d(e)},[e,d]),r.useLayoutEffect(()=>()=>d(null),[d]),r.useEffect(()=>S.claimChildren(a,me?fe.folders:on),[S,a,me,fe]),r.useEffect(()=>se(Y),[se,Y]),r.useEffect(()=>{me&&te&&ue({entries:e,isShownExpanded:Q,childrenOf:I,compare:C,expanded:D,waiting:fe.waiting,expansionPending:ee})},[me,te,ue,e,Q,I,C,D,fe,ee]);const ot=r.useCallback(w=>{w.isDirectory||(y.settle(w.entry.absolutePath),i(w.entry.absolutePath))},[y,i]),{onChange:ge}=l,st=r.useMemo(()=>ge===null?void 0:(w,N)=>{ie(w.absolutePath)||ge({path:w.absolutePath,name:w.name,selected:N})},[ge]),ct=r.useMemo(()=>new Set(l.items),[l.items]),it=r.useMemo(()=>({entryKindDirectory:k.treeEntryKindDirectory,entryKindFile:k.treeEntryKindFile,scrollUp:k.treeScrollUp,scrollDown:k.treeScrollDown,scrollToTop:k.treeScrollToTop,scrollToBottom:k.treeScrollToBottom}),[k]),ut=z===null?{showTreeLines:!1}:{showTreeLines:s.lines,lineColor:z};return c.jsxs("div",{ref:G,className:"aqmx-explorer-tree","data-testid":"markdown-explorer-tree",...nt,children:[c.jsx("span",{ref:A,className:"aqmx-explorer-tree-probe","aria-hidden":"true",[Wt]:""}),c.jsx(_e.DirectoryTree,{ref:ce,entries:tt,expansion:{toggle:Je,isExpanded:Q,expandMultiple:et,collapseMultiple:xe,isPending:ee&&!te,doubleClickAction:s.doubleClickAction},selection:{mode:l.mode,selectedPath:l.shownPath,currentPath:l.shownPath,selectedItems:ct,onEntryClick:ot,onSelectionChange:st},visual:{className:"aqmx-explorer-tree-view",ariaLabel:k.treeRegion,...ut,showExpandIcons:s.expandIcons,expandIconStyle:sn,showDirectoryIcons:s.directoryIcons,showFileIcons:s.fileIcons,expandIconSize:s.expandIconSize,itemHeight:le,removeRootIndent:s.removeRootIndent,highlightStyles:nn,entryStyle:an,nameStyle:rn},virtualScroll:tn,sort:K,locale:T,labels:it})]})},pn=({pending:e,status:t})=>{const{labels:n}=R.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(R.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)})]})},hn=({stop:e,opened:t,budget:n})=>{const{labels:a}=R.useExplorer();return c.jsx("p",{className:"aqmx-explorer-expand-all-stop","data-testid":"markdown-explorer-expand-all-stop","data-aqmx-stop":e,children:ze(a,n,e,t)})},xn=({entries:e,...t})=>{const{trees:n}=R.useExplorer(),a=r.useSyncExternalStore(n.subscribe,n.version,n.version),{sourceId:s}=t,[u]=r.useState(Ct),o=r.useMemo(()=>u(e,l=>n.children(s,l)),[u,e,n,s,a]);return o.length===0?c.jsx(dn,{}):c.jsx(mn,{entries:o,version:a,...t})},wn=({result:e,onRetry:t,...n})=>{const{renderTreeFailure:a}=R.useExplorer(),s=r.use(e);if(s.status==="deferred")return c.jsx(Ve,{});if(s.status==="ok")return c.jsx(xn,{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(R.FailureView,{failure:s.failure,alert:!0,onRetry:t,testId:null})})},gn=({onControls:e,...t})=>{const{trees:n,storageNamespace:a,labels:s,announcer:u,config:o}=R.useExplorer(),{sourceId:l}=t,i=_e.useDirectoryTreeState({storageKey:ft.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=Dt(),{expanded:p,expandMultiple:x,collapseAll:g}=i,[b,S]=r.useState(null),P=b!==p,k=r.useRef(p);r.useLayoutEffect(()=>{k.current=p},[p]);const T=o.expandAll,F=r.useCallback(()=>u.announce(s.expandAllStarted),[u,s]),q=r.useCallback(M=>u.announce(un(s,T,M)),[u,s,T]),L=Bt({budget:T,expandMultiple:x,onStart:F,onFinish:q}),{status:E,start:y,end:v,advance:j}=L,A=E.state==="running",le=r.useMemo(()=>({running:A,advance:j}),[A,j]),z=r.useRef(null),[_,U]=r.useState(!1),Z=r.useCallback(M=>{z.current=M,U(M!==null)},[]);r.useEffect(()=>n.subscribeChildrenFailures(M=>{const $=M.sourceId===l&&z.current!==null?He(z.current,M.path):null;$!==null&&u.announce({list:s.foldersLoadFailedNamed,item:$.name})}),[n,l,u,s]);const{clearDirect:J}=d,[D,ee]=r.useState(0),V=r.useCallback(()=>{ee(M=>M+1),v(),J(),S(k.current),g()},[v,J,g]);return r.useEffect(()=>{e({collapseAll:V,expandAll:_?y:null,expanding:A})},[e,V,y,_,A]),r.useEffect(()=>()=>e(null),[e]),r.useEffect(()=>{_||v()},[_,v]),c.jsxs(c.Fragment,{children:[E.state==="stopped"?c.jsx(hn,{stop:E.stop,opened:E.opened,budget:T}):null,c.jsxs("div",{className:"aqmx-explorer-tree-area",children:[c.jsx(r.Suspense,{fallback:c.jsx(Ve,{}),children:c.jsx(wn,{result:f,onRetry:m,expansion:i,onShown:Z,marks:d,claimsHeld:P,expandAll:le,revealCancel:D,...t})}),c.jsx(pn,{pending:n.pendingChildren(l),status:E})]})]})};function En({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 Ke=h.forwardRef(En),Ae="markdown-explorer-selection-remove",bn=({selection:e,onRemove:t,onClear:n,onOpenSelection:a,onLeave:s})=>{const{labels:u}=R.useExplorer(),o=r.useId(),l=r.useRef(null),i=[...e],f=(d,p)=>{if(p.ownerDocument.activeElement===p){const x=l.current===null?[]:[...l.current.querySelectorAll(`[data-testid="${Ae}"]`)],g=x.indexOf(p),b=[x[g+1],x[g-1]].find(S=>S!==void 0);b===void 0?s():b.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,p])=>c.jsxs("li",{className:"aqmx-explorer-tray-item",children:[c.jsx("span",{className:"aqmx-explorer-tray-name",title:d,children:p}),c.jsx("button",{type:"button",className:"aqmx-icon-button aqmx-explorer-tray-remove","aria-label":u.removeFromSelection(p),title:u.removeFromSelection(p),"data-testid":Ae,"data-aqmx-path":d,onClick:x=>f(d,x.currentTarget),children:c.jsx(Ke,{"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)})]})},he=new Map,vn=(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},Rn=(e,t)=>{if(!e.has(t))return e;const n=new Map(e);return n.delete(t),n},Xe=r.createContext(null),yn=e=>{const t=r.use(Xe);r.useLayoutEffect(()=>{if(t!==null)return t(e),()=>t(!1)},[t,e])};function Sn({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 kn=h.forwardRef(Sn);function Cn({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 Tn=h.forwardRef(Cn);function Ln({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 jn=h.forwardRef(Ln);function Nn({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 Pn=h.forwardRef(Nn);function On({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 qn=h.forwardRef(On);function An({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 Mn=h.forwardRef(An);function Fn({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 _n=h.forwardRef(Fn);function In({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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"}),h.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 Dn=h.forwardRef(In);function Hn({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 Zn=h.forwardRef(Hn);function $n({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 Bn=h.forwardRef($n);function zn({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 Vn=h.forwardRef(zn);function Kn({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 Xn=h.forwardRef(Kn),Wn=Object.freeze({sortMode:Tn,folderPlacement:Zn,selectionMode:jn,doubleClickAction:_n,expandIconSize:Vn,alwaysExpanded:kn,revealDocument:R.ForwardRef$1,removeRootIndent:Pn,lines:Xn,expandIcons:qn,directoryIcons:Bn,fileIcons:Dn}),We=(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},Un=({id:e,settings:t,descriptors:n,onAdvance:a,onClose:s,ref:u})=>{const{labels:o}=R.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":R.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 p=Wn[m.key],x=We(o,m),g=O.formatTreeSettingValue(o,t,m.key),b=t[m.key],S=typeof b=="boolean"?{role:"menuitemcheckbox","aria-checked":b,"aria-label":x}:{role:"menuitem","aria-label":`${x}: ${g}`};return c.jsxs("button",{ref:P=>{l.current[d]=P},type:"button",tabIndex:-1,...S,title:`${x}: ${g}`,className:"aqmx-explorer-menu-item","data-testid":"markdown-explorer-tree-settings-item","data-aqmx-setting":m.key,onClick:()=>a(m),onKeyDown:P=>f(P,d),children:[c.jsx(p,{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)})})},Gn=({settings:e,descriptors:t,onAdvance:n})=>{const{labels:a,announcer:s}=R.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=b=>{b.target instanceof Node&&(l.current?.contains(b.target)===!0||i.current?.contains(b.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 p=r.useCallback(g=>{g.key!=="Escape"||!u||(R.consumeKey(g),d())},[u,d]),x=r.useCallback(g=>{const b=n(g.key);s.announce(a.settingAnnouncement(We(a,g),O.formatTreeSettingValue(a,b,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:p,children:c.jsx(Mn,{"aria-hidden":"true"})}),menu:u?c.jsx(Un,{ref:i,id:m,settings:e,descriptors:t,onAdvance:x,onClose:d}):null}},Yn=()=>{const{treeSettings:e}=R.useExplorer();return{settings:r.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot),advance:e.advance}},Me=new Set,Qn='[role="tree"] [role="treeitem"][tabindex="0"]',Jn="[data-directory-tree-tab-stop]",er=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:p,announcer:x,reveals:g}=R.useExplorer(),{settings:b,advance:S}=Yn(),P=r.useMemo(()=>O.visibleTreeSettingDescriptors(t==="tree"),[t]),k=t==="tree"&&b.selectionMode==="multiple";yn(k);const T=e.mode==="tree"?e.tray.onGatheredChange:null,F=e.mode==="tree"?e.onOpenSelection:void 0,q=e.mode==="tree"&&k?e.tray.gathered:he,L=r.useCallback(C=>{const K=S(C);return K.selectionMode!=="multiple"&&T?.(he),K},[S,T]),E=Gn({settings:b,descriptors:P,onAdvance:L}),y=r.useCallback(C=>T?.(K=>vn(K,C)),[T]),v=r.useCallback(C=>T?.(K=>Rn(K,C)),[T]),j=r.useCallback(()=>T?.(he),[T]),A=r.useRef(null),le=r.useCallback(()=>{const C=A.current;if(C===null)return;[Qn,Jn,'[data-testid="markdown-explorer-tree-settings"]'].map(I=>C.querySelector(I)).find(I=>I!==null)?.focus()},[]),z=r.useMemo(()=>new Set(q.keys()),[q]),_=r.useMemo(()=>a===null?Me:new Set([a]),[a]),U=r.useMemo(()=>{if(t==="multi")return{mode:"multiple",items:s,shownPath:null,onChange:null};switch(b.selectionMode){case"single":return{mode:"single",items:_,shownPath:a,onChange:null};case"multiple":return{mode:"multiple",items:z,shownPath:a,onChange:y};case"none":return{mode:"none",items:Me,shownPath:null,onChange:null}}},[t,s,b.selectionMode,_,a,z,y]),Z=r.useMemo(()=>b.revealDocument?{path:a,openFolders:!0}:{path:U.shownPath,openFolders:!1},[b.revealDocument,a,U.shownPath]),J=r.useCallback(C=>{a!==null&&g.settle(a),o(C)},[a,g,o]),[D,ee]=r.useState(null),[V,M]=r.useState(!1),[$,oe]=r.useState(null),B=r.useRef(!1),re=r.useCallback(async()=>{if(!B.current){B.current=!0,M(!0),oe(null);try{const C=await d.refresh(n);if(C.status==="superseded")return;p.invalidate(),C.status==="failed"?oe({sourceId:n,failure:C.failure}):x.announce(f.treeRefreshed)}finally{B.current=!1,M(!1)}}},[d,p,n,x,f]),se=D===null?null:D.expandAll,te=D?.expanding===!0,ue=m.find(C=>C.id===n),ce=i.target==="multi"?Rt:bt,G=i.target==="multi"?f.switchToMulti:f.switchToTree;return c.jsxs("nav",{ref:A,"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:ue?.label,value:n,onChange:C=>J(C.currentTarget.value),"data-testid":"markdown-explorer-source-select",children:m.map(C=>c.jsx("option",{value:C.id,children:C.label},C.id))}):null,c.jsxs("div",{className:"aqmx-explorer-actions",children:[c.jsx(R.ExplorerLink,{to:i.href,navigation:"switch-view",className:"aqmx-icon-button","aria-label":G,title:G,"data-testid":"markdown-explorer-view-switch","data-aqmx-target":i.target,children:c.jsx(ce,{"aria-hidden":"true"})}),c.jsxs("button",{type:"button",className:"aqmx-icon-button aqmx-labelled-button",title:f.refreshTree,"aria-disabled":V,"aria-busy":V,"data-aqmx-busy":V?"true":void 0,"data-testid":"markdown-explorer-refresh",onClick:()=>{re()},children:[c.jsx(R.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":se===null||te,"aria-busy":te,"data-aqmx-busy":te?"true":void 0,"data-testid":"markdown-explorer-expand-all",onClick:()=>se?.(),children:c.jsx(gt,{"aria-hidden":"true"})}),c.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":f.collapseAll,title:f.collapseAll,"aria-disabled":D===null,"data-testid":"markdown-explorer-collapse-all",onClick:()=>D?.collapseAll(),children:c.jsx(xt,{"aria-hidden":"true"})}),E.trigger]})]}),c.jsxs("div",{className:"aqmx-explorer-body","data-aqmx-explorer-body":"",children:[$!==null&&$.sourceId===n?c.jsx("p",{role:"alert",className:"aqmx-explorer-refresh-failure","data-testid":"markdown-explorer-refresh-failure","data-aqmx-failure":$.failure.reason,children:f.treeRefreshFailed(R.failureTitleOf(f,$.failure.reason))}):null,c.jsx(r.Suspense,{fallback:null,children:c.jsx(yt,{})}),c.jsx(gn,{mode:t,sourceId:n,settings:b,reveal:Z,openPaths:s,selection:U,onOpenDocument:u,onRevealSource:l,onControls:ee},n),k&&q.size>0?c.jsx(bn,{selection:q,onRemove:v,onClear:j,onOpenSelection:F,onLeave:le}):null,E.menu]})]})},Ue="(pointer: coarse)",tr=e=>{const t=window.matchMedia(Ue);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},nr=()=>window.matchMedia(Ue).matches,rr=()=>!1,ar=()=>r.useSyncExternalStore(tr,nr,rr);function lr({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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=h.forwardRef(lr),sr=({explorer:e,toggleRef:t,covered:n,onNoticeSlotChange:a,dismissals:s})=>{const{labels:u}=R.useExplorer(),o=mt.useLocation(),{location:l}=R.useExplorerLocation(),[i,f]=r.useState(!1),[m,d]=r.useState({navigated:o,source:l.source}),[p,x]=r.useState(!1);m.navigated!==o&&(d({navigated:o,source:l.source}),m.source===l.source&&!p&&f(!1));const[g,b]=r.useState(s);g!==s&&(b(s),f(!1));const S=r.useRef(null),P=r.useRef(null),k=r.useRef(null),T=r.useRef(!1),F=r.useId();r.useLayoutEffect(()=>{const v=S.current;v!==null&&(i&&!v.open?(v.showModal(),P.current?.focus()):!i&&v.open&&(v.close(),t.current?.focus()),a(i?k.current:null))},[i,t,a]),r.useLayoutEffect(()=>()=>a(null),[a]);const q=r.useCallback(v=>{v.key!=="Escape"||v.defaultPrevented||(R.consumeKey(v),f(!1))},[]),L=r.useCallback(v=>{T.current=v.target===v.currentTarget},[]),E=r.useCallback(v=>{const j=T.current;T.current=!1,j&&v.target===v.currentTarget&&f(!1)},[]),y=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:S,id:F,className:"aqmx-sheet","aria-label":u.explorerRegion,"data-testid":"markdown-explorer-sheet",onKeyDown:q,onPointerDown:L,onClick:E,onClose:y,children:c.jsxs("div",{className:"aqmx-sheet-panel",children:[c.jsxs("div",{className:"aqmx-sheet-header",children:[c.jsx("div",{ref:k,className:"aqmx-sheet-notice-slot"}),c.jsx("button",{ref:P,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(Ke,{"aria-hidden":"true"})})]}),c.jsx("div",{className:"aqmx-sheet-body",children:c.jsx(ve,{value:i,children:c.jsx(Xe,{value:x,children:e})})}),c.jsx(R.LiveRegion,{holds:i,testId:"markdown-explorer-sheet-announcer"})]})})]})},Ge=r.createContext(null),Re="aqmx-explorer",Ye="aqmx-content",ye='[role="tree"] [role="treeitem"]',cr=`${ye}[tabindex="0"]`,ir="[data-directory-tree-tab-stop]",ur=(e,t)=>{for(const n of e.querySelectorAll(`[data-panel-id="${Re}"] ${ye}`))if(n.getAttribute(ne)===t)return n;return null},Fe=(e,t)=>({inlineSize:e>0?e:null,rootFontPixels:t>0?t:O.ASSUMED_ROOT_FONT_PIXELS}),dr=(e,t)=>{const[n,a]=r.useState(()=>Fe(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=Fe(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},Qe=e=>`aqmx-split-handle-${e}`,fr=(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 p=d.target instanceof Element?d.target:null;s.current=p!==null&&p.closest(`[data-panel-id="${Ye}"]`)===null,!o.current&&(u.current=p?.closest(`${ye}[${ne}]`)?.getAttribute(ne)??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:p}=i.ownerDocument;if(d!==null&&d!==p)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="${Re}"]`;f([m===null?null:ur(i,m),i.querySelector(`${d} ${cr}`),i.querySelector(`${d} ${ir}`),i.querySelector(`[data-resize-handle-id="${a}"]`)])})},[e,t,n,a])},mr=({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:p}=dr(o,f),x=d!==null&&d<O.explorerSheetBelowPixels(p);return fr(x,{frameRef:o,sheetToggleRef:m,handleId:Qe(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(Ge,{value:x?l:null,children:c.jsx(pr,{view:e,sheet:x,explorer:t,content:n,contentCoversPage:a,onDraggingChange:u,explorerMinPixels:O.explorerMinPixels(p)})})]})},pr=({view:e,sheet:t,explorer:n,content:a,contentCoversPage:s,onDraggingChange:u,explorerMinPixels:o})=>{const{viewSettings:l,labels:i}=R.useExplorer(),m=R.useViewSetting(E=>e==="tree"?E.treeExplorer:E.multiExplorer)??(e==="tree"?O.EXPLORER_DEFAULT_PERCENT:O.EXPLORER_MULTI_DEFAULT_PERCENT),d=r.useRef(null),p=r.useRef(null),x=r.useRef(!1),g=r.useRef(!1),[b,S]=r.useState(!1),P=r.useRef(u);r.useLayoutEffect(()=>{P.current=u},[u]);const k=r.useCallback(()=>{const E=d.current;if(E===null||E.length!==2)return;const[y=0,v=0]=E,j=y+v;if(j<=0||y<=0)return;const A=Math.min(O.EXPLORER_MAX_PERCENT,y/j*100);l.update(e==="tree"?{treeExplorer:A}:{multiExplorer:A})},[l,e]),T=r.useCallback(()=>{p.current!==null&&clearTimeout(p.current),p.current=setTimeout(()=>{p.current=null,k()},O.EXPLORER_WIDTH_PERSIST_DELAY_MS)},[k]);r.useEffect(()=>()=>{p.current!==null&&clearTimeout(p.current),g.current&&P.current?.(!1)},[]);const F=ar(),q=r.useCallback((E,y)=>{d.current=E;const[v=0,j=0]=E;E.length===2&&j>0&&S(v<=0),y.source==="keyboard"?T():y.source==="pointer"&&(x.current=!0)},[T]),L=r.useCallback(E=>{if(g.current=E,u?.(E),E){x.current=!1;return}x.current&&(x.current=!1,T())},[u,T]);return c.jsxs(pe.PanelGroup,{id:`aqmx-split-${e}`,direction:"horizontal",onLayout:q,className:"aqmx-split","data-aqmx-split":e,children:[t?null:c.jsx(pe.Panel,{id:Re,defaultSize:{value:m,unit:"percentage"},minSize:{value:o,unit:"pixels"},maxSize:{value:O.EXPLORER_MAX_PERCENT,unit:"percentage"},collapsible:{from:"end"},pixelAdjustPriority:1,inert:s,className:"aqmx-split-explorer",children:c.jsx(ve,{value:!b,children:n})}),t?null:c.jsx(pe.PanelResizeHandle,{id:Qe(e),thickness:F?O.COARSE_TARGET_PIXELS:O.FINE_TARGET_PIXELS,indicator:{visible:!0,thickness:O.SPLIT_HANDLE_PIXELS.gripThickness,length:O.SPLIT_HANDLE_PIXELS.gripLength,barThickness:O.SPLIT_HANDLE_PIXELS.barThickness,barLength:O.SPLIT_HANDLE_PIXELS.barLength},title:i.resizeExplorer,"aria-label":i.resizeExplorer,onDragging:L,inert:s,className:"aqmx-split-handle"}),c.jsx(pe.Panel,{id:Ye,defaultSize:{value:100-m,unit:"percentage"},contentOverflow:"hidden",className:"aqmx-split-content",...s?{style:{isolation:"auto"}}:{},children:a})]})};exports.EMPTY_SELECTION=he;exports.ExplorerPane=er;exports.ExplorerSplit=mr;exports.SheetNoticeSlotContext=Ge;
1
+ "use strict";const c=require("react/jsx-runtime"),R=require("./index-DpIVKG8Y.cjs"),r=require("react"),O=require("./location-BUNWJ4eB.cjs"),_e=require("@aiquants/directory-tree"),dt=require("./tapScrollCircle-C5DGI-0H.cjs"),ft=require("./storage-Dgi4JXaB.cjs"),pe=require("@aiquants/resize-panels"),mt=require("react-router");function pt(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 h=pt(r);function ht({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 xt=h.forwardRef(ht);function wt({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 gt=h.forwardRef(wt);function Et({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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"}),h.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 bt=h.forwardRef(Et);function vt({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 Rt=h.forwardRef(vt),yt=()=>{const{notices:e}=R.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 St({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 kt=h.forwardRef(St),ve=r.createContext(!0),Ie="\0loop\0",De="\0",Ct=()=>{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(p=>{const x=u(p,l,i);return x!==p&&(f=!0),x});if(!f)return o;const d=n.get(o);return d!==void 0&&d.length===m.length&&d.every((p,x)=>p===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 p=s(d,l,i);if(i.delete(o.path),!m&&p===o.children)return o;const x=t.get(o);if(x!==void 0&&x.state===f&&x.children===p)return x.grafted;const g={...o,children:p,lazy:m?!1:o.lazy};return t.set(o,{state:f,children:p,grafted:g}),g};return(o,l)=>s(o,l,new Set)},Tt=(e,t)=>`${Ie}${e}${De}${t}`,ie=e=>e.startsWith(Ie),Lt=e=>e.slice(e.lastIndexOf(De)+1),ne="data-aqmx-path",jt=(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}},Nt=(e,t,n,a)=>{const s=Tt(t,e.path);return{name:n,type:"directory",absolutePath:s,relativePath:s,children:a,data:{aqmxLoop:e.path}}},Pt=()=>{const e=new WeakMap,t=new WeakMap,n=new WeakMap,a=[],s=(l,i,f)=>{const m=l.map(p=>p.type==="loop"?u(p,i,f):o(p,i)),d=n.get(l);return d!==void 0&&d.length===m.length&&d.every((p,x)=>p===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=Nt(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,p=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===p)return x.row;const g=jt(l,f,m,d,p===void 0?void 0:p(l));return e.set(l,{row:g,open:m,childrenStatus:d,children:f,renderFailedFolder:p}),g};return(l,i)=>s(l,i,"")},Ot=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))},be=(e,t)=>{const n=e.filter(a=>a.type==="directory");return t===void 0?n:n.sort(t)},qt=(e,t)=>{const n=new Map;let a=0;const s=u=>{for(const o of be(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}},At=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},He=(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:He(n.children,t);if(a!==null)return a}return null},Mt=(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"},Pe=new Set,Ft=(e,t)=>e.has(t)?e:new Set(e).add(t),_t=(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)))},It=(e,t)=>[...e].every(n=>t.has(n))?e:new Set([...e].filter(n=>t.has(n))),Dt=()=>{const[e,t]=r.useState(Pe),n=r.useCallback(o=>t(l=>Ft(l,o)),[]),a=r.useCallback(o=>t(l=>_t(l,o)),[]),s=r.useCallback(o=>t(l=>It(l,o)),[]),u=r.useCallback(()=>t(Pe),[]);return r.useMemo(()=>({direct:e,markDirect:n,unmarkDirect:a,pruneDirect:s,clearDirect:u}),[e,n,a,s,u])},Ht=e=>({budget:e,handled:new Set,loads:new Set,opened:0,folderLimited:!1,depthLimited:!1,announcedStart:!1,issuedAgainst:null}),Zt=(e,t)=>{const n=[];let a=be(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(...be(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))),$t=(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)}},Ee=Object.freeze({state:"idle"}),Bt=e=>{const t=r.useRef(null),n=r.useRef(e),[a,s]=r.useState(Ee);r.useLayoutEffect(()=>{n.current=e});const u=r.useCallback(()=>{t.current===null&&(t.current=Ht(n.current.budget),s({state:"running",opened:0}))},[]),o=r.useCallback(()=>{t.current=null,s(Ee)},[]),l=r.useCallback(i=>{const f=t.current;if(f===null)return;const m=Zt(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 p=$t(f,i);s(p.kind==="done"?Ee:{state:"stopped",stop:p.kind,opened:p.opened}),n.current.onFinish(p);return}const{opened:d}=f;s(p=>p.state==="running"&&p.opened===d?p:{state:"running",opened:d})},[]);return r.useMemo(()=>({status:a,start:u,end:o,advance:l}),[a,u,o,l])},Oe=["pointerdown","wheel","touchstart","keydown","focusin"],zt=8,qe={least:Number.POSITIVE_INFINITY,stalled:0},Vt=({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(qe),d=r.useRef(null),p=r.useRef(null),x=r.useRef(a),g=r.useRef(l);r.useLayoutEffect(()=>{x.current=a,g.current=l},[a,l]);const b=r.useCallback(()=>{const L=d.current;L!==null&&(d.current=null,L.phase==="asking"?L.controller.abort():x.current?.open(null))},[]),S=r.useCallback(()=>{i.current=null,b()},[b]),P=r.useCallback(()=>{const L=t.current;i.current===null||p.current!==null||L===null||L.getClientRects().length===0||(p.current=requestAnimationFrame(()=>{p.current=null;const E=i.current;if(E===null)return;const y=g.current(E);if(y===0){f.current=!0,d.current?.phase==="opening"&&b();return}if(e.current?.scrollToPath(E,{align:"nearest"})===!0){d.current?.phase==="opening"&&b();const{least:j,stalled:A}=m.current;m.current=y<j?{least:y,stalled:0}:{least:j,stalled:A+1},m.current.stalled<zt&&P();return}const v=d.current;if(v===null){i.current=null;return}v.phase==="opening"&&x.current?.progress(v.folders,E)!=="loading"&&S()}))},[e,t,b,S]),k=r.useCallback(()=>{f.current=!1,m.current=qe,P()},[P]);r.useEffect(()=>{const L=t.current;if(L===null)return;const E=typeof ResizeObserver>"u"?null:new ResizeObserver(k);E?.observe(L);for(const y of Oe)L.addEventListener(y,S,{passive:!0});return()=>{E?.disconnect();for(const y of Oe)L.removeEventListener(y,S);p.current!==null&&cancelAnimationFrame(p.current),p.current=null,b()}},[t,k,S,b]);const T=a!==null;r.useEffect(()=>{const L=t.current;if(S(),n===null||L===null||L.contains(L.ownerDocument.activeElement))return;i.current=n;const E=x.current;if(T&&E!==null){const y=new AbortController,v={phase:"asking",controller:y};d.current=v,E.ancestors(n,y.signal).then(j=>{d.current===v&&(j===null?d.current=null:(d.current={phase:"opening",folders:j},x.current?.open(j)),k())})}k()},[n,T,t,S,k]),r.useEffect(()=>{(d.current?.phase==="opening"||i.current!==null&&!f.current)&&k()},[s,k]);const F=r.useRef(u);r.useEffect(()=>{F.current!==u&&(F.current=u,S())},[u,S]);const q=r.useRef(o);r.useEffect(()=>{q.current&&!o&&b(),q.current=o},[o,b])},Kt="--aqmx-tree-line",Xt=Object.freeze(["(forced-colors: active)","(prefers-color-scheme: dark)"]),Wt="data-aqmx-tree-probe",Ut=Object.freeze({rowHeight:O.CONTROL_BLOCK_PIXELS,lineColor:null}),Gt=/^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/u,Yt=e=>{const t=Gt.exec(e);return t===null?e:`#${t.slice(1).map(n=>Number(n).toString(16).padStart(2,"0")).join("")}`},Qt=(e,t)=>{const[n,a]=r.useState(Ut);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(Kt).trim()===""?null:Yt(f.color);a(d=>{const p=Number.isFinite(i)&&i>0?i:d.rowHeight;return d.rowHeight===p&&d.lineColor===m?d:{rowHeight:p,lineColor:m}})};u();const o=Xt.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},$e="markdown-explorer-tree-scroll",Jt=.5,Be=(e,t)=>[...e.querySelectorAll(`[role="treeitem"][${ne}]`)].find(n=>n.getAttribute(ne)===t),en=(e,t)=>{const n=Be(e,t),a=n?.closest(`[data-testid="${$e}"]`);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<=Jt?0:l},tn={testId:$e,overscanCount:13,callbackThrottleMs:13,scrollBarOptions:{width:8,enableTrackClick:!0,enableThumbDrag:!0,enableArrowButtons:!0,enableArrowButtonTabStops:!1,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:dt.TAP_SCROLL_CIRCLE},behaviorOptions:{enablePointerDrag:!0}},nn={hoverClassName:"",directorySelectedClassName:"",itemSelectedClassName:""},rn={color:"inherit"},an={paddingBlock:0},ln=new Set,on=new Map,sn={color:"var(--aqmx-tree-line)"},cn=e=>{const t=e instanceof Element?e.closest(`[${ne}]`):null;return t===null||t.getAttribute("data-entry-type")!=="file"?null:t.getAttribute(ne)},ze=(e,t,n,a)=>n==="folder-limit"?e.expandAllFolderLimit(a,t.maxFolders,e.expandAll):e.expandAllDepthLimit(a,t.maxDepth),un=(e,t,n)=>n.kind==="done"?e.expandAllDone(n.opened,n.failed,n.complete):ze(e,t,n.kind,n.opened),Ve=()=>{const{labels:e}=R.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",{})]})]})},dn=()=>{const{labels:e}=R.useExplorer();return c.jsxs("div",{className:"aqmx-empty","data-testid":"markdown-explorer-tree-empty",children:[c.jsx(kt,{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})]})},fn=({name:e,onRetry:t})=>{const{labels:n}=R.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&&R.focusWithoutScroll(o),t()},onKeyDown:s=>{s.key!=="Escape"&&s.stopPropagation()},children:[c.jsx(R.ForwardRef,{className:"aqmx-explorer-folder-retry-icon","aria-hidden":"true"}),c.jsx("span",{className:"aqmx-explorer-folder-retry-text",children:n.retry})]})]})},mn=({entries:e,version:t,mode:n,sourceId:a,settings:s,reveal:u,openPaths:o,selection:l,onOpenDocument:i,onRevealSource:f,expansion:m,onShown:d,marks:p,claimsHeld:x,expandAll:g,revealCancel:b})=>{const{trees:S,documents:P,labels:k,locale:T,theme:F,data:q,config:L,sources:E,reveals:y}=R.useExplorer(),v=r.use(ve),[j]=r.useState(Pt),A=r.useRef(null),{rowHeight:le,lineColor:z}=Qt(A,F),{isExpanded:_,toggle:U,expandMultiple:Z,collapseMultiple:J,expanded:D,isPending:ee}=m,{alwaysExpanded:V,sortMode:M,folderPlacement:$}=s,{direct:oe,markDirect:B,unmarkDirect:re,pruneDirect:se}=p,{running:te,advance:ue}=g,ce=r.useRef(null),G=r.useRef(null),C=r.useMemo(()=>O.createEntryComparator({sortMode:M,folderPlacement:$}),[M,$]),K=r.useMemo(()=>Ot(C),[C]),I=r.useCallback(w=>S.children(a,w),[S,a]),Y=r.useMemo(()=>At(e),[e]),Q=r.useCallback(w=>!ie(w)&&(_(w)||V&&!Y.has(w)),[_,V,Y]),X=r.useRef({shownExpanded:Q,isExpanded:_,unloadedFolders:Y,entries:e,childrenOf:I});r.useLayoutEffect(()=>{X.current={shownExpanded:Q,isExpanded:_,unloadedFolders:Y,entries:e,childrenOf:I}},[Q,_,Y,e,I]);const Se=r.useCallback(w=>{ce.current?.scrollToPath(w,{align:"nearest"}),requestAnimationFrame(()=>{const N=G.current,H=N===null?void 0:Be(N,w);H!==void 0&&R.focusWithoutScroll(H)})},[]),Je=r.useCallback(w=>{if(ie(w)){Se(Lt(w));return}X.current.isExpanded(w)?re([w]):X.current.unloadedFolders.has(w)&&B(w),U(w)},[Se,B,re,U]),xe=r.useCallback(w=>{const N=w.filter(H=>!ie(H));N.length!==0&&(re(N),J(N))},[re,J]),et=r.useCallback(w=>{const N=w.filter(H=>!ie(H));N.length!==0&&(N.length<w.length&&N.every(H=>X.current.shownExpanded(H))?xe(N):Z(N))},[Z,xe]),ke=r.useCallback(w=>c.jsx(fn,{name:w.name,onRetry:()=>{B(w.path),S.retryChildren(a,w.path),X.current.shownExpanded(w.path)||Z([w.path])}}),[S,a,B,Z]),Ce=n==="multi"?o:ln,{loopFolderName:Te}=k,tt=r.useMemo(()=>j(e,{openPaths:Ce,childrenOf:I,renderFailedFolder:ke,loopFolderName:Te}),[j,e,Ce,I,ke,Te,t]),nt=R.useIntentPrefetch(P,cn),Le=r.useRef([]),de=r.useCallback(()=>{for(const w of Le.current)X.current.unloadedFolders.has(w)&&B(w)},[B]),{maxDepth:we}=L.revealDocument,je=r.useRef(f);r.useLayoutEffect(()=>{je.current=f},[f]);const rt=r.useMemo(()=>({ancestors:async(w,N)=>{const H=y.take(a,w);if(H!==null)return H;if(!y.mayMove(w)){const ae=await q.ancestors(a,w,N);return ae.status!=="ok"||ae.ancestors===null||ae.ancestors.length>we?null:ae.ancestors}const W=await q.reveal(a,w,N);return W.status!=="ok"||W.source===null||W.ancestors.length>we?null:W.source===a?W.ancestors:(N.aborted||!E.some(ae=>ae.id===W.source)||(y.move(W.source,w,W.ancestors),je.current(W.source)),null)},open:w=>{Le.current=w??[],w!==null&&(de(),Z([...w]))},progress:(w,N)=>Mt(X.current.entries,w,N,{isShownExpanded:X.current.shownExpanded,childrenOf:X.current.childrenOf})}),[q,a,E,y,we,de,Z]);r.useEffect(()=>de(),[de,Y]);const at=r.useMemo(()=>[e,t,D],[e,t,D]),lt=r.useCallback(w=>G.current===null?Number.POSITIVE_INFINITY:en(G.current,w),[]);Vt({tree:ce,container:G,path:u.path,chain:u.openFolders?rt:null,rows:at,cancel:b,displayed:v,placement:lt});const Ne=r.useCallback(w=>oe.has(w),[oe]),fe=r.useMemo(()=>qt(e,{isShownExpanded:Q,childrenOf:I,compare:C,isDirect:Ne}),[e,Q,I,C,Ne,t]),me=v&&x;r.useLayoutEffect(()=>{d(e)},[e,d]),r.useLayoutEffect(()=>()=>d(null),[d]),r.useEffect(()=>S.claimChildren(a,me?fe.folders:on),[S,a,me,fe]),r.useEffect(()=>se(Y),[se,Y]),r.useEffect(()=>{me&&te&&ue({entries:e,isShownExpanded:Q,childrenOf:I,compare:C,expanded:D,waiting:fe.waiting,expansionPending:ee})},[me,te,ue,e,Q,I,C,D,fe,ee]);const ot=r.useCallback(w=>{w.isDirectory||(y.settle(w.entry.absolutePath),i(w.entry.absolutePath))},[y,i]),{onChange:ge}=l,st=r.useMemo(()=>ge===null?void 0:(w,N)=>{ie(w.absolutePath)||ge({path:w.absolutePath,name:w.name,selected:N})},[ge]),ct=r.useMemo(()=>new Set(l.items),[l.items]),it=r.useMemo(()=>({entryKindDirectory:k.treeEntryKindDirectory,entryKindFile:k.treeEntryKindFile,scrollUp:k.treeScrollUp,scrollDown:k.treeScrollDown,scrollToTop:k.treeScrollToTop,scrollToBottom:k.treeScrollToBottom}),[k]),ut=z===null?{showTreeLines:!1}:{showTreeLines:s.lines,lineColor:z};return c.jsxs("div",{ref:G,className:"aqmx-explorer-tree","data-testid":"markdown-explorer-tree",...nt,children:[c.jsx("span",{ref:A,className:"aqmx-explorer-tree-probe","aria-hidden":"true",[Wt]:""}),c.jsx(_e.DirectoryTree,{ref:ce,entries:tt,expansion:{toggle:Je,isExpanded:Q,expandMultiple:et,collapseMultiple:xe,isPending:ee&&!te,doubleClickAction:s.doubleClickAction},selection:{mode:l.mode,selectedPath:l.shownPath,currentPath:l.shownPath,selectedItems:ct,onEntryClick:ot,onSelectionChange:st},visual:{className:"aqmx-explorer-tree-view",ariaLabel:k.treeRegion,...ut,showExpandIcons:s.expandIcons,expandIconStyle:sn,showDirectoryIcons:s.directoryIcons,showFileIcons:s.fileIcons,expandIconSize:s.expandIconSize,itemHeight:le,removeRootIndent:s.removeRootIndent,highlightStyles:nn,entryStyle:an,nameStyle:rn},virtualScroll:tn,sort:K,locale:T,labels:it})]})},pn=({pending:e,status:t})=>{const{labels:n}=R.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(R.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)})]})},hn=({stop:e,opened:t,budget:n})=>{const{labels:a}=R.useExplorer();return c.jsx("p",{className:"aqmx-explorer-expand-all-stop","data-testid":"markdown-explorer-expand-all-stop","data-aqmx-stop":e,children:ze(a,n,e,t)})},xn=({entries:e,...t})=>{const{trees:n}=R.useExplorer(),a=r.useSyncExternalStore(n.subscribe,n.version,n.version),{sourceId:s}=t,[u]=r.useState(Ct),o=r.useMemo(()=>u(e,l=>n.children(s,l)),[u,e,n,s,a]);return o.length===0?c.jsx(dn,{}):c.jsx(mn,{entries:o,version:a,...t})},wn=({result:e,onRetry:t,...n})=>{const{renderTreeFailure:a}=R.useExplorer(),s=r.use(e);if(s.status==="deferred")return c.jsx(Ve,{});if(s.status==="ok")return c.jsx(xn,{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(R.FailureView,{failure:s.failure,alert:!0,onRetry:t,testId:null})})},gn=({onControls:e,...t})=>{const{trees:n,storageNamespace:a,labels:s,announcer:u,config:o}=R.useExplorer(),{sourceId:l}=t,i=_e.useDirectoryTreeState({storageKey:ft.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=Dt(),{expanded:p,expandMultiple:x,collapseAll:g}=i,[b,S]=r.useState(null),P=b!==p,k=r.useRef(p);r.useLayoutEffect(()=>{k.current=p},[p]);const T=o.expandAll,F=r.useCallback(()=>u.announce(s.expandAllStarted),[u,s]),q=r.useCallback(M=>u.announce(un(s,T,M)),[u,s,T]),L=Bt({budget:T,expandMultiple:x,onStart:F,onFinish:q}),{status:E,start:y,end:v,advance:j}=L,A=E.state==="running",le=r.useMemo(()=>({running:A,advance:j}),[A,j]),z=r.useRef(null),[_,U]=r.useState(!1),Z=r.useCallback(M=>{z.current=M,U(M!==null)},[]);r.useEffect(()=>n.subscribeChildrenFailures(M=>{const $=M.sourceId===l&&z.current!==null?He(z.current,M.path):null;$!==null&&u.announce({list:s.foldersLoadFailedNamed,item:$.name})}),[n,l,u,s]);const{clearDirect:J}=d,[D,ee]=r.useState(0),V=r.useCallback(()=>{ee(M=>M+1),v(),J(),S(k.current),g()},[v,J,g]);return r.useEffect(()=>{e({collapseAll:V,expandAll:_?y:null,expanding:A})},[e,V,y,_,A]),r.useEffect(()=>()=>e(null),[e]),r.useEffect(()=>{_||v()},[_,v]),c.jsxs(c.Fragment,{children:[E.state==="stopped"?c.jsx(hn,{stop:E.stop,opened:E.opened,budget:T}):null,c.jsxs("div",{className:"aqmx-explorer-tree-area",children:[c.jsx(r.Suspense,{fallback:c.jsx(Ve,{}),children:c.jsx(wn,{result:f,onRetry:m,expansion:i,onShown:Z,marks:d,claimsHeld:P,expandAll:le,revealCancel:D,...t})}),c.jsx(pn,{pending:n.pendingChildren(l),status:E})]})]})};function En({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 Ke=h.forwardRef(En),Ae="markdown-explorer-selection-remove",bn=({selection:e,onRemove:t,onClear:n,onOpenSelection:a,onLeave:s})=>{const{labels:u}=R.useExplorer(),o=r.useId(),l=r.useRef(null),i=[...e],f=(d,p)=>{if(p.ownerDocument.activeElement===p){const x=l.current===null?[]:[...l.current.querySelectorAll(`[data-testid="${Ae}"]`)],g=x.indexOf(p),b=[x[g+1],x[g-1]].find(S=>S!==void 0);b===void 0?s():b.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,p])=>c.jsxs("li",{className:"aqmx-explorer-tray-item",children:[c.jsx("span",{className:"aqmx-explorer-tray-name",title:d,children:p}),c.jsx("button",{type:"button",className:"aqmx-icon-button aqmx-explorer-tray-remove","aria-label":u.removeFromSelection(p),title:u.removeFromSelection(p),"data-testid":Ae,"data-aqmx-path":d,onClick:x=>f(d,x.currentTarget),children:c.jsx(Ke,{"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)})]})},he=new Map,vn=(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},Rn=(e,t)=>{if(!e.has(t))return e;const n=new Map(e);return n.delete(t),n},Xe=r.createContext(null),yn=e=>{const t=r.use(Xe);r.useLayoutEffect(()=>{if(t!==null)return t(e),()=>t(!1)},[t,e])};function Sn({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 kn=h.forwardRef(Sn);function Cn({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 Tn=h.forwardRef(Cn);function Ln({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 jn=h.forwardRef(Ln);function Nn({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 Pn=h.forwardRef(Nn);function On({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 qn=h.forwardRef(On);function An({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 Mn=h.forwardRef(An);function Fn({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 _n=h.forwardRef(Fn);function In({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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"}),h.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 Dn=h.forwardRef(In);function Hn({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 Zn=h.forwardRef(Hn);function $n({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 Bn=h.forwardRef($n);function zn({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 Vn=h.forwardRef(zn);function Kn({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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 Xn=h.forwardRef(Kn),Wn=Object.freeze({sortMode:Tn,folderPlacement:Zn,selectionMode:jn,doubleClickAction:_n,expandIconSize:Vn,alwaysExpanded:kn,revealDocument:R.ForwardRef$1,removeRootIndent:Pn,lines:Xn,expandIcons:qn,directoryIcons:Bn,fileIcons:Dn}),We=(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},Un=({id:e,settings:t,descriptors:n,onAdvance:a,onClose:s,ref:u})=>{const{labels:o}=R.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":R.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 p=Wn[m.key],x=We(o,m),g=O.formatTreeSettingValue(o,t,m.key),b=t[m.key],S=typeof b=="boolean"?{role:"menuitemcheckbox","aria-checked":b,"aria-label":x}:{role:"menuitem","aria-label":`${x}: ${g}`};return c.jsxs("button",{ref:P=>{l.current[d]=P},type:"button",tabIndex:-1,...S,title:`${x}: ${g}`,className:"aqmx-explorer-menu-item","data-testid":"markdown-explorer-tree-settings-item","data-aqmx-setting":m.key,onClick:()=>a(m),onKeyDown:P=>f(P,d),children:[c.jsx(p,{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)})})},Gn=({settings:e,descriptors:t,onAdvance:n})=>{const{labels:a,announcer:s}=R.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=b=>{b.target instanceof Node&&(l.current?.contains(b.target)===!0||i.current?.contains(b.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 p=r.useCallback(g=>{g.key!=="Escape"||!u||(R.consumeKey(g),d())},[u,d]),x=r.useCallback(g=>{const b=n(g.key);s.announce(a.settingAnnouncement(We(a,g),O.formatTreeSettingValue(a,b,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:p,children:c.jsx(Mn,{"aria-hidden":"true"})}),menu:u?c.jsx(Un,{ref:i,id:m,settings:e,descriptors:t,onAdvance:x,onClose:d}):null}},Yn=()=>{const{treeSettings:e}=R.useExplorer();return{settings:r.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot),advance:e.advance}},Me=new Set,Qn='[role="tree"] [role="treeitem"][tabindex="0"]',Jn="[data-directory-tree-tab-stop]",er=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:p,announcer:x,reveals:g}=R.useExplorer(),{settings:b,advance:S}=Yn(),P=r.useMemo(()=>O.visibleTreeSettingDescriptors(t==="tree"),[t]),k=t==="tree"&&b.selectionMode==="multiple";yn(k);const T=e.mode==="tree"?e.tray.onGatheredChange:null,F=e.mode==="tree"?e.onOpenSelection:void 0,q=e.mode==="tree"&&k?e.tray.gathered:he,L=r.useCallback(C=>{const K=S(C);return K.selectionMode!=="multiple"&&T?.(he),K},[S,T]),E=Gn({settings:b,descriptors:P,onAdvance:L}),y=r.useCallback(C=>T?.(K=>vn(K,C)),[T]),v=r.useCallback(C=>T?.(K=>Rn(K,C)),[T]),j=r.useCallback(()=>T?.(he),[T]),A=r.useRef(null),le=r.useCallback(()=>{const C=A.current;if(C===null)return;[Qn,Jn,'[data-testid="markdown-explorer-tree-settings"]'].map(I=>C.querySelector(I)).find(I=>I!==null)?.focus()},[]),z=r.useMemo(()=>new Set(q.keys()),[q]),_=r.useMemo(()=>a===null?Me:new Set([a]),[a]),U=r.useMemo(()=>{if(t==="multi")return{mode:"multiple",items:s,shownPath:null,onChange:null};switch(b.selectionMode){case"single":return{mode:"single",items:_,shownPath:a,onChange:null};case"multiple":return{mode:"multiple",items:z,shownPath:a,onChange:y};case"none":return{mode:"none",items:Me,shownPath:null,onChange:null}}},[t,s,b.selectionMode,_,a,z,y]),Z=r.useMemo(()=>b.revealDocument?{path:a,openFolders:!0}:{path:U.shownPath,openFolders:!1},[b.revealDocument,a,U.shownPath]),J=r.useCallback(C=>{a!==null&&g.settle(a),o(C)},[a,g,o]),[D,ee]=r.useState(null),[V,M]=r.useState(!1),[$,oe]=r.useState(null),B=r.useRef(!1),re=r.useCallback(async()=>{if(!B.current){B.current=!0,M(!0),oe(null);try{const C=await d.refresh(n);if(C.status==="superseded")return;p.invalidate(),C.status==="failed"?oe({sourceId:n,failure:C.failure}):x.announce(f.treeRefreshed)}finally{B.current=!1,M(!1)}}},[d,p,n,x,f]),se=D===null?null:D.expandAll,te=D?.expanding===!0,ue=m.find(C=>C.id===n),ce=i.target==="multi"?Rt:bt,G=i.target==="multi"?f.switchToMulti:f.switchToTree;return c.jsxs("nav",{ref:A,"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:ue?.label,value:n,onChange:C=>J(C.currentTarget.value),"data-testid":"markdown-explorer-source-select",children:m.map(C=>c.jsx("option",{value:C.id,children:C.label},C.id))}):null,c.jsxs("div",{className:"aqmx-explorer-actions",children:[c.jsx(R.ExplorerLink,{to:i.href,navigation:"switch-view",className:"aqmx-icon-button","aria-label":G,title:G,"data-testid":"markdown-explorer-view-switch","data-aqmx-target":i.target,children:c.jsx(ce,{"aria-hidden":"true"})}),c.jsxs("button",{type:"button",className:"aqmx-icon-button aqmx-labelled-button",title:f.refreshTree,"aria-disabled":V,"aria-busy":V,"data-aqmx-busy":V?"true":void 0,"data-testid":"markdown-explorer-refresh",onClick:()=>{re()},children:[c.jsx(R.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":se===null||te,"aria-busy":te,"data-aqmx-busy":te?"true":void 0,"data-testid":"markdown-explorer-expand-all",onClick:()=>se?.(),children:c.jsx(gt,{"aria-hidden":"true"})}),c.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":f.collapseAll,title:f.collapseAll,"aria-disabled":D===null,"data-testid":"markdown-explorer-collapse-all",onClick:()=>D?.collapseAll(),children:c.jsx(xt,{"aria-hidden":"true"})}),E.trigger]})]}),c.jsxs("div",{className:"aqmx-explorer-body","data-aqmx-explorer-body":"",children:[$!==null&&$.sourceId===n?c.jsx("p",{role:"alert",className:"aqmx-explorer-refresh-failure","data-testid":"markdown-explorer-refresh-failure","data-aqmx-failure":$.failure.reason,children:f.treeRefreshFailed(R.failureTitleOf(f,$.failure.reason))}):null,c.jsx(r.Suspense,{fallback:null,children:c.jsx(yt,{})}),c.jsx(gn,{mode:t,sourceId:n,settings:b,reveal:Z,openPaths:s,selection:U,onOpenDocument:u,onRevealSource:l,onControls:ee},n),k&&q.size>0?c.jsx(bn,{selection:q,onRemove:v,onClear:j,onOpenSelection:F,onLeave:le}):null,E.menu]})]})},Ue="(pointer: coarse)",tr=e=>{const t=window.matchMedia(Ue);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},nr=()=>window.matchMedia(Ue).matches,rr=()=>!1,ar=()=>r.useSyncExternalStore(tr,nr,rr);function lr({title:e,titleId:t,...n},a){return h.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?h.createElement("title",{id:t},e):null,h.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=h.forwardRef(lr),sr=({explorer:e,toggleRef:t,covered:n,onNoticeSlotChange:a,dismissals:s})=>{const{labels:u}=R.useExplorer(),o=mt.useLocation(),{location:l}=R.useExplorerLocation(),[i,f]=r.useState(!1),[m,d]=r.useState({navigated:o,source:l.source}),[p,x]=r.useState(!1);m.navigated!==o&&(d({navigated:o,source:l.source}),m.source===l.source&&!p&&f(!1));const[g,b]=r.useState(s);g!==s&&(b(s),f(!1));const S=r.useRef(null),P=r.useRef(null),k=r.useRef(null),T=r.useRef(!1),F=r.useId();r.useLayoutEffect(()=>{const v=S.current;v!==null&&(i&&!v.open?(v.showModal(),P.current?.focus()):!i&&v.open&&(v.close(),t.current?.focus()),a(i?k.current:null))},[i,t,a]),r.useLayoutEffect(()=>()=>a(null),[a]);const q=r.useCallback(v=>{v.key!=="Escape"||v.defaultPrevented||(R.consumeKey(v),f(!1))},[]),L=r.useCallback(v=>{T.current=v.target===v.currentTarget},[]),E=r.useCallback(v=>{const j=T.current;T.current=!1,j&&v.target===v.currentTarget&&f(!1)},[]),y=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:S,id:F,className:"aqmx-sheet","aria-label":u.explorerRegion,"data-testid":"markdown-explorer-sheet",onKeyDown:q,onPointerDown:L,onClick:E,onClose:y,children:c.jsxs("div",{className:"aqmx-sheet-panel",children:[c.jsxs("div",{className:"aqmx-sheet-header",children:[c.jsx("div",{ref:k,className:"aqmx-sheet-notice-slot"}),c.jsx("button",{ref:P,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(Ke,{"aria-hidden":"true"})})]}),c.jsx("div",{className:"aqmx-sheet-body",children:c.jsx(ve,{value:i,children:c.jsx(Xe,{value:x,children:e})})}),c.jsx(R.LiveRegion,{holds:i,testId:"markdown-explorer-sheet-announcer"})]})})]})},Ge=r.createContext(null),Re="aqmx-explorer",Ye="aqmx-content",ye='[role="tree"] [role="treeitem"]',cr=`${ye}[tabindex="0"]`,ir="[data-directory-tree-tab-stop]",ur=(e,t)=>{for(const n of e.querySelectorAll(`[data-panel-id="${Re}"] ${ye}`))if(n.getAttribute(ne)===t)return n;return null},Fe=(e,t)=>({inlineSize:e>0?e:null,rootFontPixels:t>0?t:O.ASSUMED_ROOT_FONT_PIXELS}),dr=(e,t)=>{const[n,a]=r.useState(()=>Fe(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=Fe(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},Qe=e=>`aqmx-split-handle-${e}`,fr=(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 p=d.target instanceof Element?d.target:null;s.current=p!==null&&p.closest(`[data-panel-id="${Ye}"]`)===null,!o.current&&(u.current=p?.closest(`${ye}[${ne}]`)?.getAttribute(ne)??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:p}=i.ownerDocument;if(d!==null&&d!==p)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="${Re}"]`;f([m===null?null:ur(i,m),i.querySelector(`${d} ${cr}`),i.querySelector(`${d} ${ir}`),i.querySelector(`[data-resize-handle-id="${a}"]`)])})},[e,t,n,a])},mr=({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:p}=dr(o,f),x=d!==null&&d<O.explorerSheetBelowPixels(p);return fr(x,{frameRef:o,sheetToggleRef:m,handleId:Qe(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(Ge,{value:x?l:null,children:c.jsx(pr,{view:e,sheet:x,explorer:t,content:n,contentCoversPage:a,onDraggingChange:u,explorerMinPixels:O.explorerMinPixels(p)})})]})},pr=({view:e,sheet:t,explorer:n,content:a,contentCoversPage:s,onDraggingChange:u,explorerMinPixels:o})=>{const{viewSettings:l,labels:i}=R.useExplorer(),m=R.useViewSetting(E=>e==="tree"?E.treeExplorer:E.multiExplorer)??(e==="tree"?O.EXPLORER_DEFAULT_PERCENT:O.EXPLORER_MULTI_DEFAULT_PERCENT),d=r.useRef(null),p=r.useRef(null),x=r.useRef(!1),g=r.useRef(!1),[b,S]=r.useState(!1),P=r.useRef(u);r.useLayoutEffect(()=>{P.current=u},[u]);const k=r.useCallback(()=>{const E=d.current;if(E===null||E.length!==2)return;const[y=0,v=0]=E,j=y+v;if(j<=0||y<=0)return;const A=Math.min(O.EXPLORER_MAX_PERCENT,y/j*100);l.update(e==="tree"?{treeExplorer:A}:{multiExplorer:A})},[l,e]),T=r.useCallback(()=>{p.current!==null&&clearTimeout(p.current),p.current=setTimeout(()=>{p.current=null,k()},O.EXPLORER_WIDTH_PERSIST_DELAY_MS)},[k]);r.useEffect(()=>()=>{p.current!==null&&clearTimeout(p.current),g.current&&P.current?.(!1)},[]);const F=ar(),q=r.useCallback((E,y)=>{d.current=E;const[v=0,j=0]=E;E.length===2&&j>0&&S(v<=0),y.source==="keyboard"?T():y.source==="pointer"&&(x.current=!0)},[T]),L=r.useCallback(E=>{if(g.current=E,u?.(E),E){x.current=!1;return}x.current&&(x.current=!1,T())},[u,T]);return c.jsxs(pe.PanelGroup,{id:`aqmx-split-${e}`,direction:"horizontal",onLayout:q,className:"aqmx-split","data-aqmx-split":e,children:[t?null:c.jsx(pe.Panel,{id:Re,defaultSize:{value:m,unit:"percentage"},minSize:{value:o,unit:"pixels"},maxSize:{value:O.EXPLORER_MAX_PERCENT,unit:"percentage"},collapsible:{from:"end"},pixelAdjustPriority:1,inert:s,className:"aqmx-split-explorer",children:c.jsx(ve,{value:!b,children:n})}),t?null:c.jsx(pe.PanelResizeHandle,{id:Qe(e),thickness:F?O.COARSE_TARGET_PIXELS:O.FINE_TARGET_PIXELS,indicator:{visible:!0,thickness:O.SPLIT_HANDLE_PIXELS.gripThickness,length:O.SPLIT_HANDLE_PIXELS.gripLength,barThickness:O.SPLIT_HANDLE_PIXELS.barThickness,barLength:O.SPLIT_HANDLE_PIXELS.barLength},title:i.resizeExplorer,"aria-label":i.resizeExplorer,onDragging:L,inert:s,className:"aqmx-split-handle"}),c.jsx(pe.Panel,{id:Ye,defaultSize:{value:100-m,unit:"percentage"},contentOverflow:"hidden",className:"aqmx-split-content",...s?{style:{isolation:"auto"}}:{},children:a})]})};exports.EMPTY_SELECTION=he;exports.ExplorerPane=er;exports.ExplorerSplit=mr;exports.SheetNoticeSlotContext=Ge;
@@ -1,8 +1,8 @@
1
1
  import { jsx as m, jsxs as A, Fragment as Ge } from "react/jsx-runtime";
2
- import { u as D, F as Nt, q as Ae, o as Ye, r as kt, k as Oe, s as Lt, t as At, h as Ot, w as Pt, x as qt, y as Ct } from "./index-BPj19kIo.js";
2
+ import { u as D, F as Nt, r as Ae, q as Ye, s as Lt, m as Oe, t as kt, w as At, h as Ot, x as Pt, y as qt, z as Ct } from "./index-o6OpR4ND.js";
3
3
  import * as p from "react";
4
4
  import { use as be, createContext as Pe, useState as q, useCallback as w, useMemo as F, useRef as g, useLayoutEffect as I, useEffect as _, useSyncExternalStore as Ee, Suspense as Qe, useId as ye } from "react";
5
- import { C as Ft, k as Mt, l as Je, v as _t, m as It, n as Dt, E as Ht, o as Be, q as $t, s as Zt, S as ve, t as Bt, F as zt, A as Vt } from "./location-BT23fKeh.js";
5
+ import { C as Ft, k as Mt, l as Je, v as _t, m as It, n as Dt, E as Ht, o as Be, q as $t, s as Zt, S as ve, t as Bt, F as zt, A as Vt } from "./location-DWd6SQhN.js";
6
6
  import { useDirectoryTreeState as jt, DirectoryTree as Kt } from "@aiquants/directory-tree";
7
7
  import { T as Ut } from "./tapScrollCircle-u4EXeLhx.js";
8
8
  import { s as Wt } from "./storage-BSthKLSG.js";
@@ -194,14 +194,14 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
194
194
  return typeof r == "number" ? { name: n.name, path: n.absolutePath, type: n.type, modifiedAt: r } : { name: n.name, path: n.absolutePath, type: n.type };
195
195
  };
196
196
  return (n, r) => e(t(n), t(r));
197
- }, Le = (e, t) => {
197
+ }, ke = (e, t) => {
198
198
  const n = e.filter((r) => r.type === "directory");
199
199
  return t === void 0 ? n : n.sort(t);
200
200
  }, wn = (e, t) => {
201
201
  const n = /* @__PURE__ */ new Map();
202
202
  let r = 0;
203
203
  const o = (c) => {
204
- for (const l of Le(c, t.compare))
204
+ for (const l of ke(c, t.compare))
205
205
  if (t.isShownExpanded(l.path)) {
206
206
  if (l.lazy !== !0) {
207
207
  l.children !== void 0 && o(l.children);
@@ -253,7 +253,7 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
253
253
  issuedAgainst: null
254
254
  }), Tn = (e, t) => {
255
255
  const n = [];
256
- let r = Le(t.entries, t.compare);
256
+ let r = ke(t.entries, t.compare);
257
257
  for (let o = 1; r.length > 0; o += 1) {
258
258
  const c = [];
259
259
  for (const l of r) {
@@ -275,7 +275,7 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
275
275
  }
276
276
  n.push(a), e.opened += 1;
277
277
  }
278
- l.lazy !== !0 && l.children !== void 0 && c.push(...Le(l.children, t.compare));
278
+ l.lazy !== !0 && l.children !== void 0 && c.push(...ke(l.children, t.compare));
279
279
  }
280
280
  r = c;
281
281
  }
@@ -286,7 +286,7 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
286
286
  let n = 0;
287
287
  for (const r of e.loads) t.childrenOf(r)?.status === "failed" && (n += 1);
288
288
  return { kind: "done", opened: e.opened, failed: n, complete: rt(t.entries, t.isShownExpanded) };
289
- }, Ne = Object.freeze({ state: "idle" }), kn = (e) => {
289
+ }, Ne = Object.freeze({ state: "idle" }), Ln = (e) => {
290
290
  const t = g(null), n = g(e), [r, o] = q(Ne);
291
291
  I(() => {
292
292
  n.current = e;
@@ -309,19 +309,19 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
309
309
  o((f) => f.state === "running" && f.opened === i ? f : { state: "running", opened: i });
310
310
  }, []);
311
311
  return F(() => ({ status: r, start: c, end: l, advance: a }), [r, c, l, a]);
312
- }, je = ["pointerdown", "wheel", "touchstart", "keydown", "focusin"], Ln = 8, Ke = { least: Number.POSITIVE_INFINITY, stalled: 0 }, An = ({ tree: e, container: t, path: n, chain: r, rows: o, cancel: c, displayed: l, placement: a }) => {
312
+ }, je = ["pointerdown", "wheel", "touchstart", "keydown", "focusin"], kn = 8, Ke = { least: Number.POSITIVE_INFINITY, stalled: 0 }, An = ({ tree: e, container: t, path: n, chain: r, rows: o, cancel: c, displayed: l, placement: a }) => {
313
313
  const s = g(null), d = g(!0), u = g(Ke), i = g(null), f = g(null), h = g(r), v = g(a);
314
314
  I(() => {
315
315
  h.current = r, v.current = a;
316
316
  }, [r, a]);
317
317
  const E = w(() => {
318
- const L = i.current;
319
- L !== null && (i.current = null, L.phase === "asking" ? L.controller.abort() : h.current?.open(null));
318
+ const k = i.current;
319
+ k !== null && (i.current = null, k.phase === "asking" ? k.controller.abort() : h.current?.open(null));
320
320
  }, []), S = w(() => {
321
321
  s.current = null, E();
322
322
  }, [E]), C = w(() => {
323
- const L = t.current;
324
- s.current === null || f.current !== null || L === null || L.getClientRects().length === 0 || (f.current = requestAnimationFrame(() => {
323
+ const k = t.current;
324
+ s.current === null || f.current !== null || k === null || k.getClientRects().length === 0 || (f.current = requestAnimationFrame(() => {
325
325
  f.current = null;
326
326
  const b = s.current;
327
327
  if (b === null) return;
@@ -333,7 +333,7 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
333
333
  if (e.current?.scrollToPath(b, { align: "nearest" }) === !0) {
334
334
  i.current?.phase === "opening" && E();
335
335
  const { least: O, stalled: H } = u.current;
336
- u.current = R < O ? { least: R, stalled: 0 } : { least: O, stalled: H + 1 }, u.current.stalled < Ln && C();
336
+ u.current = R < O ? { least: R, stalled: 0 } : { least: O, stalled: H + 1 }, u.current.stalled < kn && C();
337
337
  return;
338
338
  }
339
339
  const y = i.current;
@@ -347,31 +347,31 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
347
347
  d.current = !1, u.current = Ke, C();
348
348
  }, [C]);
349
349
  _(() => {
350
- const L = t.current;
351
- if (L === null) return;
350
+ const k = t.current;
351
+ if (k === null) return;
352
352
  const b = typeof ResizeObserver > "u" ? null : new ResizeObserver(T);
353
- b?.observe(L);
354
- for (const R of je) L.addEventListener(R, S, { passive: !0 });
353
+ b?.observe(k);
354
+ for (const R of je) k.addEventListener(R, S, { passive: !0 });
355
355
  return () => {
356
356
  b?.disconnect();
357
- for (const R of je) L.removeEventListener(R, S);
357
+ for (const R of je) k.removeEventListener(R, S);
358
358
  f.current !== null && cancelAnimationFrame(f.current), f.current = null, E();
359
359
  };
360
360
  }, [t, T, S, E]);
361
- const k = r !== null;
361
+ const L = r !== null;
362
362
  _(() => {
363
- const L = t.current;
364
- if (S(), n === null || L === null || L.contains(L.ownerDocument.activeElement)) return;
363
+ const k = t.current;
364
+ if (S(), n === null || k === null || k.contains(k.ownerDocument.activeElement)) return;
365
365
  s.current = n;
366
366
  const b = h.current;
367
- if (k && b !== null) {
367
+ if (L && b !== null) {
368
368
  const R = new AbortController(), y = { phase: "asking", controller: R };
369
369
  i.current = y, b.ancestors(n, R.signal).then((O) => {
370
370
  i.current === y && (O === null ? i.current = null : (i.current = { phase: "opening", folders: O }, h.current?.open(O)), T());
371
371
  });
372
372
  }
373
373
  T();
374
- }, [n, k, t, S, T]), _(() => {
374
+ }, [n, L, t, S, T]), _(() => {
375
375
  (i.current?.phase === "opening" || s.current !== null && !d.current) && T();
376
376
  }, [o, T]);
377
377
  const Z = g(c);
@@ -492,7 +492,7 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
492
492
  expandAll: v,
493
493
  revealCancel: E
494
494
  }) => {
495
- const { trees: S, documents: C, labels: T, locale: k, theme: Z, data: M, config: L, sources: b, reveals: R } = D(), y = be(qe), [O] = q(hn), H = g(null), { rowHeight: de, lineColor: X } = _n(H, Z), { isExpanded: B, toggle: ee, expandMultiple: K, collapseMultiple: ae, expanded: V, isPending: le } = u, { alwaysExpanded: G, sortMode: $, folderPlacement: U } = o, { direct: ue, markDirect: W, unmarkDirect: ce, pruneDirect: me } = f, { running: oe, advance: he } = v, fe = g(null), te = g(null), N = F(() => Mt({ sortMode: $, folderPlacement: U }), [$, U]), Y = F(() => xn(N), [N]), z = w((x) => S.children(r, x), [S, r]), ne = F(() => gn(e), [e]), re = w((x) => !pe(x) && (B(x) || G && !ne.has(x)), [B, G, ne]), Q = g({ shownExpanded: re, isExpanded: B, unloadedFolders: ne, entries: e, childrenOf: z });
495
+ const { trees: S, documents: C, labels: T, locale: L, theme: Z, data: M, config: k, sources: b, reveals: R } = D(), y = be(qe), [O] = q(hn), H = g(null), { rowHeight: de, lineColor: X } = _n(H, Z), { isExpanded: B, toggle: ee, expandMultiple: K, collapseMultiple: ae, expanded: V, isPending: le } = u, { alwaysExpanded: G, sortMode: $, folderPlacement: U } = o, { direct: ue, markDirect: W, unmarkDirect: ce, pruneDirect: me } = f, { running: oe, advance: he } = v, fe = g(null), te = g(null), N = F(() => Mt({ sortMode: $, folderPlacement: U }), [$, U]), Y = F(() => xn(N), [N]), z = w((x) => S.children(r, x), [S, r]), ne = F(() => gn(e), [e]), re = w((x) => !pe(x) && (B(x) || G && !ne.has(x)), [B, G, ne]), Q = g({ shownExpanded: re, isExpanded: B, unloadedFolders: ne, entries: e, childrenOf: z });
496
496
  I(() => {
497
497
  Q.current = { shownExpanded: re, isExpanded: B, unloadedFolders: ne, entries: e, childrenOf: z };
498
498
  }, [re, B, ne, e, z]);
@@ -533,9 +533,9 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
533
533
  }
534
534
  ),
535
535
  [S, r, W, K]
536
- ), Ie = n === "multi" ? l : zn, { loopFolderName: De } = T, xt = F(() => O(e, { openPaths: Ie, childrenOf: z, renderFailedFolder: _e, loopFolderName: De }), [O, e, Ie, z, _e, De, t]), wt = kt(C, Kn), He = g([]), xe = w(() => {
536
+ ), Ie = n === "multi" ? l : zn, { loopFolderName: De } = T, xt = F(() => O(e, { openPaths: Ie, childrenOf: z, renderFailedFolder: _e, loopFolderName: De }), [O, e, Ie, z, _e, De, t]), wt = Lt(C, Kn), He = g([]), xe = w(() => {
537
537
  for (const x of He.current) Q.current.unloadedFolders.has(x) && W(x);
538
- }, [W]), { maxDepth: Se } = L.revealDocument, $e = g(d);
538
+ }, [W]), { maxDepth: Se } = k.revealDocument, $e = g(d);
539
539
  I(() => {
540
540
  $e.current = d;
541
541
  }, [d]);
@@ -621,7 +621,7 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
621
621
  },
622
622
  virtualScroll: Hn,
623
623
  sort: Y,
624
- locale: k,
624
+ locale: L,
625
625
  labels: St
626
626
  }
627
627
  )
@@ -668,7 +668,7 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
668
668
  I(() => {
669
669
  T.current = f;
670
670
  }, [f]);
671
- const k = l.expandAll, Z = w(() => c.announce(o.expandAllStarted), [c, o]), M = w(($) => c.announce(Un(o, k, $)), [c, o, k]), L = kn({ budget: k, expandMultiple: h, onStart: Z, onFinish: M }), { status: b, start: R, end: y, advance: O } = L, H = b.state === "running", de = F(() => ({ running: H, advance: O }), [H, O]), X = g(null), [B, ee] = q(!1), K = w(($) => {
671
+ const L = l.expandAll, Z = w(() => c.announce(o.expandAllStarted), [c, o]), M = w(($) => c.announce(Un(o, L, $)), [c, o, L]), k = Ln({ budget: L, expandMultiple: h, onStart: Z, onFinish: M }), { status: b, start: R, end: y, advance: O } = k, H = b.state === "running", de = F(() => ({ running: H, advance: O }), [H, O]), X = g(null), [B, ee] = q(!1), K = w(($) => {
672
672
  X.current = $, ee($ !== null);
673
673
  }, []);
674
674
  _(
@@ -686,7 +686,7 @@ const cn = /* @__PURE__ */ p.forwardRef(sn), qe = Pe(!0), et = "\0loop\0", tt =
686
686
  }, [e, G, R, B, H]), _(() => () => e(null), [e]), _(() => {
687
687
  B || y();
688
688
  }, [B, y]), /* @__PURE__ */ A(Ge, { children: [
689
- b.state === "stopped" ? /* @__PURE__ */ m(Qn, { stop: b.stop, opened: b.opened, budget: k }) : null,
689
+ b.state === "stopped" ? /* @__PURE__ */ m(Qn, { stop: b.stop, opened: b.opened, budget: L }) : null,
690
690
  /* @__PURE__ */ A("div", { className: "aqmx-explorer-tree-area", children: [
691
691
  /* @__PURE__ */ m(Qe, { fallback: /* @__PURE__ */ m(st, {}), children: /* @__PURE__ */ m(er, { result: d, onRetry: u, expansion: s, onShown: K, marks: i, claimsHeld: C, expandAll: de, revealCancel: V, ...t }) }),
692
692
  /* @__PURE__ */ m(Yn, { pending: n.pendingChildren(a), status: b })
@@ -748,7 +748,7 @@ const ct = /* @__PURE__ */ p.forwardRef(nr), Ue = "markdown-explorer-selection-r
748
748
  ] }, i)) }),
749
749
  r === void 0 ? null : /* @__PURE__ */ m("button", { type: "button", className: "aqmx-explorer-tray-open", "data-testid": "markdown-explorer-selection-open", onClick: () => r(s.map(([i]) => i)), children: c.openSelectionInMulti(s.length) })
750
750
  ] });
751
- }, ke = /* @__PURE__ */ new Map(), ar = (e, t) => {
751
+ }, Le = /* @__PURE__ */ new Map(), ar = (e, t) => {
752
752
  if (t.selected === e.has(t.path)) return e;
753
753
  const n = new Map(e);
754
754
  return t.selected ? n.set(t.path, t.name) : n.delete(t.path), n;
@@ -981,7 +981,7 @@ function Tr({
981
981
  }));
982
982
  }
983
983
  const Nr = /* @__PURE__ */ p.forwardRef(Tr);
984
- function kr({
984
+ function Lr({
985
985
  title: e,
986
986
  titleId: t,
987
987
  ...n
@@ -1002,7 +1002,7 @@ function kr({
1002
1002
  clipRule: "evenodd"
1003
1003
  }));
1004
1004
  }
1005
- const Lr = /* @__PURE__ */ p.forwardRef(kr);
1005
+ const kr = /* @__PURE__ */ p.forwardRef(Lr);
1006
1006
  function Ar({
1007
1007
  title: e,
1008
1008
  titleId: t,
@@ -1027,9 +1027,9 @@ const Or = /* @__PURE__ */ p.forwardRef(Ar), Pr = Object.freeze({
1027
1027
  folderPlacement: Sr,
1028
1028
  selectionMode: mr,
1029
1029
  doubleClickAction: br,
1030
- expandIconSize: Lr,
1030
+ expandIconSize: kr,
1031
1031
  alwaysExpanded: cr,
1032
- revealDocument: Lt,
1032
+ revealDocument: kt,
1033
1033
  removeRootIndent: pr,
1034
1034
  lines: Or,
1035
1035
  expandIcons: xr,
@@ -1157,13 +1157,13 @@ const Or = /* @__PURE__ */ p.forwardRef(Ar), Pr = Object.freeze({
1157
1157
  }, We = /* @__PURE__ */ new Set(), Mr = '[role="tree"] [role="treeitem"][tabindex="0"]', _r = "[data-directory-tree-tab-stop]", oa = (e) => {
1158
1158
  const { mode: t, sourceId: n, currentPath: r, openPaths: o, onOpenDocument: c, onSourceChange: l, onRevealSource: a, viewSwitch: s } = e, { labels: d, sources: u, trees: i, documents: f, announcer: h, reveals: v } = D(), { settings: E, advance: S } = Fr(), C = F(() => _t(t === "tree"), [t]), T = t === "tree" && E.selectionMode === "multiple";
1159
1159
  or(T);
1160
- const k = e.mode === "tree" ? e.tray.onGatheredChange : null, Z = e.mode === "tree" ? e.onOpenSelection : void 0, M = e.mode === "tree" && T ? e.tray.gathered : ke, L = w(
1160
+ const L = e.mode === "tree" ? e.tray.onGatheredChange : null, Z = e.mode === "tree" ? e.onOpenSelection : void 0, M = e.mode === "tree" && T ? e.tray.gathered : Le, k = w(
1161
1161
  (N) => {
1162
1162
  const Y = S(N);
1163
- return Y.selectionMode !== "multiple" && k?.(ke), Y;
1163
+ return Y.selectionMode !== "multiple" && L?.(Le), Y;
1164
1164
  },
1165
- [S, k]
1166
- ), b = Cr({ settings: E, descriptors: C, onAdvance: L }), R = w((N) => k?.((Y) => ar(Y, N)), [k]), y = w((N) => k?.((Y) => lr(Y, N)), [k]), O = w(() => k?.(ke), [k]), H = g(null), de = w(() => {
1165
+ [S, L]
1166
+ ), b = Cr({ settings: E, descriptors: C, onAdvance: k }), R = w((N) => L?.((Y) => ar(Y, N)), [L]), y = w((N) => L?.((Y) => lr(Y, N)), [L]), O = w(() => L?.(Le), [L]), H = g(null), de = w(() => {
1167
1167
  const N = H.current;
1168
1168
  if (N === null) return;
1169
1169
  [Mr, _r, '[data-testid="markdown-explorer-tree-settings"]'].map((z) => N.querySelector(z)).find((z) => z !== null)?.focus();
@@ -1275,18 +1275,18 @@ const Br = /* @__PURE__ */ p.forwardRef(Zr), zr = ({ explorer: e, toggleRef: t,
1275
1275
  u.navigated !== l && (i({ navigated: l, source: a.source }), u.source === a.source && !f && d(!1));
1276
1276
  const [v, E] = q(o);
1277
1277
  v !== o && (E(o), d(!1));
1278
- const S = g(null), C = g(null), T = g(null), k = g(!1), Z = ye();
1278
+ const S = g(null), C = g(null), T = g(null), L = g(!1), Z = ye();
1279
1279
  I(() => {
1280
1280
  const y = S.current;
1281
1281
  y !== null && (s && !y.open ? (y.showModal(), C.current?.focus()) : !s && y.open && (y.close(), t.current?.focus()), r(s ? T.current : null));
1282
1282
  }, [s, t, r]), I(() => () => r(null), [r]);
1283
1283
  const M = w((y) => {
1284
1284
  y.key !== "Escape" || y.defaultPrevented || (Oe(y), d(!1));
1285
- }, []), L = w((y) => {
1286
- k.current = y.target === y.currentTarget;
1285
+ }, []), k = w((y) => {
1286
+ L.current = y.target === y.currentTarget;
1287
1287
  }, []), b = w((y) => {
1288
- const O = k.current;
1289
- k.current = !1, O && y.target === y.currentTarget && d(!1);
1288
+ const O = L.current;
1289
+ L.current = !1, O && y.target === y.currentTarget && d(!1);
1290
1290
  }, []), R = w(() => {
1291
1291
  d(!1);
1292
1292
  }, []);
@@ -1295,7 +1295,7 @@ const Br = /* @__PURE__ */ p.forwardRef(Zr), zr = ({ explorer: e, toggleRef: t,
1295
1295
  /* @__PURE__ */ m(Br, { "aria-hidden": "true" }),
1296
1296
  /* @__PURE__ */ m("span", { children: c.showExplorer })
1297
1297
  ] }) }),
1298
- /* @__PURE__ */ m("dialog", { ref: S, id: Z, className: "aqmx-sheet", "aria-label": c.explorerRegion, "data-testid": "markdown-explorer-sheet", onKeyDown: M, onPointerDown: L, onClick: b, onClose: R, children: /* @__PURE__ */ A("div", { className: "aqmx-sheet-panel", children: [
1298
+ /* @__PURE__ */ m("dialog", { ref: S, id: Z, className: "aqmx-sheet", "aria-label": c.explorerRegion, "data-testid": "markdown-explorer-sheet", onKeyDown: M, onPointerDown: k, onClick: b, onClose: R, children: /* @__PURE__ */ A("div", { className: "aqmx-sheet-panel", children: [
1299
1299
  /* @__PURE__ */ A("div", { className: "aqmx-sheet-header", children: [
1300
1300
  /* @__PURE__ */ m("div", { ref: T, className: "aqmx-sheet-notice-slot" }),
1301
1301
  /* @__PURE__ */ m("button", { ref: C, type: "button", className: "aqmx-sheet-close", "aria-label": c.hideExplorer, title: c.hideExplorer, "data-testid": "markdown-explorer-sheet-close", onClick: () => d(!1), children: /* @__PURE__ */ m(ct, { "aria-hidden": "true" }) })
@@ -1405,7 +1405,7 @@ const Br = /* @__PURE__ */ p.forwardRef(Zr), zr = ({ explorer: e, toggleRef: t,
1405
1405
  if (O <= 0 || R <= 0) return;
1406
1406
  const H = Math.min(Be, R / O * 100);
1407
1407
  a.update(e === "tree" ? { treeExplorer: H } : { multiExplorer: H });
1408
- }, [a, e]), k = w(() => {
1408
+ }, [a, e]), L = w(() => {
1409
1409
  f.current !== null && clearTimeout(f.current), f.current = setTimeout(() => {
1410
1410
  f.current = null, T();
1411
1411
  }, Ht);
@@ -1420,18 +1420,18 @@ const Br = /* @__PURE__ */ p.forwardRef(Zr), zr = ({ explorer: e, toggleRef: t,
1420
1420
  (b, R) => {
1421
1421
  i.current = b;
1422
1422
  const [y = 0, O = 0] = b;
1423
- b.length === 2 && O > 0 && S(y <= 0), R.source === "keyboard" ? k() : R.source === "pointer" && (h.current = !0);
1423
+ b.length === 2 && O > 0 && S(y <= 0), R.source === "keyboard" ? L() : R.source === "pointer" && (h.current = !0);
1424
1424
  },
1425
- [k]
1426
- ), L = w(
1425
+ [L]
1426
+ ), k = w(
1427
1427
  (b) => {
1428
1428
  if (v.current = b, c?.(b), b) {
1429
1429
  h.current = !1;
1430
1430
  return;
1431
1431
  }
1432
- h.current && (h.current = !1, k());
1432
+ h.current && (h.current = !1, L());
1433
1433
  },
1434
- [c, k]
1434
+ [c, L]
1435
1435
  );
1436
1436
  return /* @__PURE__ */ A(Xt, { id: `aqmx-split-${e}`, direction: "horizontal", onLayout: M, className: "aqmx-split", "data-aqmx-split": e, children: [
1437
1437
  t ? null : /* @__PURE__ */ m(
@@ -1456,7 +1456,7 @@ const Br = /* @__PURE__ */ p.forwardRef(Zr), zr = ({ explorer: e, toggleRef: t,
1456
1456
  indicator: { visible: !0, thickness: ve.gripThickness, length: ve.gripLength, barThickness: ve.barThickness, barLength: ve.barLength },
1457
1457
  title: s.resizeExplorer,
1458
1458
  "aria-label": s.resizeExplorer,
1459
- onDragging: L,
1459
+ onDragging: k,
1460
1460
  inert: o,
1461
1461
  className: "aqmx-split-handle"
1462
1462
  }
@@ -1465,7 +1465,7 @@ const Br = /* @__PURE__ */ p.forwardRef(Zr), zr = ({ explorer: e, toggleRef: t,
1465
1465
  ] });
1466
1466
  };
1467
1467
  export {
1468
- ke as E,
1468
+ Le as E,
1469
1469
  Vr as S,
1470
1470
  sa as a,
1471
1471
  oa as b