openwork-server 0.18.50 → 0.18.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/openwork-server.mjs +28 -22
- package/bin/platform.mjs +28 -0
- package/dist/opencode-plugin-deps-1.18.30.tgz +0 -0
- package/dist/opencode-plugins/openwork-context-v2.js +84 -0
- package/dist/opencode-plugins/openwork-extensions-preview.js +589 -268
- package/dist/opencode-plugins/openwork-gateway-quota-v2.js +12 -1
- package/dist/opencode-plugins/openwork-gateway-quota.js +12 -1
- package/dist/opencode-plugins/openwork-mcp-results-v2.js +154 -0
- package/dist/opencode-plugins/openwork-office-attachments.js +135 -130
- package/dist/opencode-plugins/openwork-provider-adapters.js +2 -2
- package/dist/opencode-plugins/openwork-provider-filters-v2.js +69 -0
- package/dist/opencode-plugins/openwork-read-transport.js +2 -0
- package/dist/opencode-plugins/openwork-spreadsheets.js +136 -2
- package/dist/openwork-server.mjs +114735 -0
- package/dist/pdfium.wasm +0 -0
- package/package.json +7 -1
- package/web/assets/{abnfDiagram-VCTEODGH-BgnyE_Jl.js → abnfDiagram-VCTEODGH-Dr1YMfll.js} +1 -1
- package/web/assets/{app-CyCqD289.js → app-D9Nvta88.js} +474 -424
- package/web/assets/{arc-jSgX49-e.js → arc-7SoIBvT7.js} +1 -1
- package/web/assets/{architectureDiagram-5GKGNRK7-DD_aGn4v.js → architectureDiagram-5GKGNRK7-BZwevfH9.js} +1 -1
- package/web/assets/{artifact-code-view-DFIq0k-c.js → artifact-code-view-WLwX_I1h.js} +1 -1
- package/web/assets/{artifact-spreadsheet-editor-DFVCYrL7.js → artifact-spreadsheet-editor-BvEnxKsm.js} +1 -1
- package/web/assets/{artifact-text-editor-DBngc6bx.js → artifact-text-editor-BHyVrNyR.js} +1 -1
- package/web/assets/{blockDiagram-OSKFZWR5-CBcZLjLp.js → blockDiagram-OSKFZWR5-Cvqr9DPi.js} +1 -1
- package/web/assets/{c4Diagram-7LVT6UL2-DMrhFCLj.js → c4Diagram-7LVT6UL2-CWTWC9C1.js} +1 -1
- package/web/assets/channel-BkgEJbR-.js +1 -0
- package/web/assets/{chunk-2Q5K7J3B-Ce1X-FJQ.js → chunk-2Q5K7J3B-DpJkzZ5x.js} +1 -1
- package/web/assets/{chunk-5VM5RSS4-BS48ZtVI.js → chunk-5VM5RSS4-BtTBnr9m.js} +1 -1
- package/web/assets/{chunk-F27PBJKO-COdFZJ-M.js → chunk-F27PBJKO-BbAvFJAg.js} +1 -1
- package/web/assets/{chunk-HLEWEB6X-Cdw4ABX3.js → chunk-HLEWEB6X-DX5mKBrj.js} +1 -1
- package/web/assets/{chunk-JWPE2WC7-FVVDYZmE.js → chunk-JWPE2WC7-CugB1e5O.js} +1 -1
- package/web/assets/{chunk-POPQ4Y6H-C7acdUF3.js → chunk-POPQ4Y6H-BQ-bWmmo.js} +1 -1
- package/web/assets/{chunk-SVP7TREG-BUun0UWD.js → chunk-SVP7TREG-szCI_Kz9.js} +1 -1
- package/web/assets/{chunk-XXDRQBXY-DLgpJmat.js → chunk-XXDRQBXY-C5UTO899.js} +1 -1
- package/web/assets/{chunk-ZLD2IHE6-BdMQ5Cr0.js → chunk-ZLD2IHE6-D5v_jiDg.js} +1 -1
- package/web/assets/classDiagram-CYGNFDIV-BHINh3-f.js +1 -0
- package/web/assets/classDiagram-v2-TLXNO2FR-BHINh3-f.js +1 -0
- package/web/assets/{cose-bilkent-JH36ORCC-CqWy3Swy.js → cose-bilkent-JH36ORCC-BhG_zAfo.js} +1 -1
- package/web/assets/{cynefin-OW5HDTMX-DslesE5Y.js → cynefin-OW5HDTMX-DSTjm6jO.js} +1 -1
- package/web/assets/{cynefinDiagram-5FMLGOSQ-B54uZJn_.js → cynefinDiagram-5FMLGOSQ-Dqkgb6tF.js} +1 -1
- package/web/assets/{dagre-OS7QT2EB-Bkahh4gZ.js → dagre-OS7QT2EB-BZMseQyA.js} +1 -1
- package/web/assets/{diagram-S7CK7UJ4-CXQl7SfF.js → diagram-S7CK7UJ4-Cs2hsmEJ.js} +1 -1
- package/web/assets/{diagram-UQ7AKVKN-BA0V8tjK.js → diagram-UQ7AKVKN-CDnRP_yz.js} +1 -1
- package/web/assets/{diagram-VSXAHHWV-DlcR8qeO.js → diagram-VSXAHHWV-DxKXQXAC.js} +1 -1
- package/web/assets/{diagram-VX7I27RA-ewm16zDI.js → diagram-VX7I27RA-BJKoseDf.js} +1 -1
- package/web/assets/{diagram-Z3DM3KII-Bc2lRc88.js → diagram-Z3DM3KII-DDcMvRxo.js} +1 -1
- package/web/assets/{ebnfDiagram-PWID7BFC-JwCaf6cT.js → ebnfDiagram-PWID7BFC-C2uUm-CC.js} +1 -1
- package/web/assets/{erDiagram-2YWLMYGG-DOqO-9Yf.js → erDiagram-2YWLMYGG-B0Mdv5WO.js} +1 -1
- package/web/assets/{flowDiagram-T62WH6J4-CCZxvIjW.js → flowDiagram-T62WH6J4-CUnt9AMo.js} +1 -1
- package/web/assets/{ganttDiagram-EL5Y4UJY-BczG7RIu.js → ganttDiagram-EL5Y4UJY-CENsUToC.js} +1 -1
- package/web/assets/{gitGraphDiagram-WWUBYQGX-GOecDN3g.js → gitGraphDiagram-WWUBYQGX-CrbKh94B.js} +1 -1
- package/web/assets/index-CyyMNIC_.css +1 -0
- package/web/assets/{infoDiagram-FKFFQAWI-BbgIVsQp.js → infoDiagram-FKFFQAWI-B-U-x_qU.js} +1 -1
- package/web/assets/{ishikawaDiagram-5VMMS53U-xutQo5Ip.js → ishikawaDiagram-5VMMS53U-jNVSJSu1.js} +1 -1
- package/web/assets/{journeyDiagram-EYS64GPL-BIbzPGaa.js → journeyDiagram-EYS64GPL-De3j0gPh.js} +1 -1
- package/web/assets/{kanban-definition-UXKFOSKX-BCTiRzck.js → kanban-definition-UXKFOSKX-Bbc8wjhq.js} +1 -1
- package/web/assets/{layout-Wpfi54TB.js → layout-BIjP2nup.js} +1 -1
- package/web/assets/{linear-DLJHPikh.js → linear-lvQZOiHM.js} +1 -1
- package/web/assets/{mermaid.core-CDRJkis7.js → mermaid.core-LJPf4T7o.js} +5 -5
- package/web/assets/{mindmap-definition-THT77NOG-DtphSFs_.js → mindmap-definition-THT77NOG-DiboHsg8.js} +1 -1
- package/web/assets/{overlay-zA9qjYXH.js → overlay-DA5SOee-.js} +1 -1
- package/web/assets/{pegDiagram-XKGWAZYB-CzbjpqK7.js → pegDiagram-XKGWAZYB-DO_edVtr.js} +1 -1
- package/web/assets/{pieDiagram-E7YTZNPT-tjxtWWT7.js → pieDiagram-E7YTZNPT-bPvBuBuG.js} +1 -1
- package/web/assets/{quadrantDiagram-AXDQQJYC-CFC1qey-.js → quadrantDiagram-AXDQQJYC-BGyrQhlH.js} +1 -1
- package/web/assets/{railroadDiagram-O6MQD6OU-73_BXhNP.js → railroadDiagram-O6MQD6OU-XhPIuoOE.js} +1 -1
- package/web/assets/{requirementDiagram-IS5BZ75X-B8i4BL2A.js → requirementDiagram-IS5BZ75X-atdASt4G.js} +1 -1
- package/web/assets/{sankeyDiagram-P5KCCOFB-Dll4Naj0.js → sankeyDiagram-P5KCCOFB-BV9prEKy.js} +1 -1
- package/web/assets/{sequenceDiagram-WJ2MYXX4-B8Rvjhb5.js → sequenceDiagram-WJ2MYXX4-Csfm-fZ-.js} +1 -1
- package/web/assets/{sizeCapture-INFHLROL-h8YDF-c3.js → sizeCapture-INFHLROL-CLmH-AjF.js} +1 -1
- package/web/assets/{stateDiagram-XQSTLZYL-COorU6Ga.js → stateDiagram-XQSTLZYL-yiSt2fJK.js} +1 -1
- package/web/assets/stateDiagram-v2-IH3M54BS-BEhxOujx.js +1 -0
- package/web/assets/{swimlanes-V6O3JKXN-CAghInFw.js → swimlanes-V6O3JKXN-BpXNggx9.js} +1 -1
- package/web/assets/swimlanesDiagram-JKAHXJPX-DWqwFv9F.js +8 -0
- package/web/assets/{timeline-definition-24CTP7MA-Dum2N-ex.js → timeline-definition-24CTP7MA-C8X71OnL.js} +1 -1
- package/web/assets/{vennDiagram-4TSXK5OY-D-JeJumX.js → vennDiagram-4TSXK5OY-BZo-99ra.js} +1 -1
- package/web/assets/{wardleyDiagram-VM6X3IG4-d99FKQIG.js → wardleyDiagram-VM6X3IG4-BHwH6ZLg.js} +1 -1
- package/web/assets/{workspace-file-tree-CAuhntUr.js → workspace-file-tree-C8iSfvPt.js} +3 -3
- package/web/assets/{xychartDiagram-S5SC5T6Z-DdmevfkD.js → xychartDiagram-S5SC5T6Z-BieEi319.js} +1 -1
- package/web/ext-github.svg +1 -0
- package/web/ext-hubspot.svg +1 -0
- package/web/ext-slack.svg +1 -0
- package/web/index.html +4 -3
- package/web/overlay.html +3 -3
- package/dist/bin/openwork-server +0 -4
- package/web/assets/channel-BE8JEd1U.js +0 -1
- package/web/assets/classDiagram-CYGNFDIV-Cy8V0GW-.js +0 -1
- package/web/assets/classDiagram-v2-TLXNO2FR-Cy8V0GW-.js +0 -1
- package/web/assets/index-BZgplq0g.css +0 -1
- package/web/assets/stateDiagram-v2-IH3M54BS-BAu05WuT.js +0 -1
- package/web/assets/swimlanesDiagram-JKAHXJPX-CpJNl3pn.js +0 -8
- /package/web/assets/{index-_gYIQM_z.js → index-D6FUvVB1.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as U,j as
|
|
1
|
+
import{r as U,j as oe,c as Ul}from"./index-D6FUvVB1.js";import{b as Kl,u as Wl,I as Gl,c as Yl,S as Xl,d as Ql,B as Jl,R as Zl}from"./app-D9Nvta88.js";const cr="file-tree-container",vo="data-file-tree-style",yo="data-file-tree-unsafe-css",ea="data-file-tree-scrollbar-measure",bo="data-file-tree-scrollbar-gutter-measured",ta="--trees-scrollbar-gutter-measured",Vn="header",Yt="context-menu",na="context-menu-trigger",Io=typeof window>"u"?U.useEffect:U.useLayoutEffect;function ra(e,t,n){const r=e!=null?oe.jsx("div",{slot:Vn,children:e}):null,o=t!=null&&n!=null?oe.jsx("div",{slot:Yt,children:t(n.item,n.context)}):null;return r==null&&o==null?null:oe.jsxs(oe.Fragment,{children:[r,o]})}function oa(e,t){return typeof window>"u"&&t!=null?oe.jsxs(oe.Fragment,{children:[oe.jsx("template",{shadowrootmode:"open",dangerouslySetInnerHTML:{__html:t.shadowHtml}}),e]}):oe.jsx(oe.Fragment,{children:e})}function ia(e){const t=e.shadowRoot;return t?.querySelector("[data-file-tree-id]")instanceof HTMLElement||t?.querySelector("[data-file-tree-id]")instanceof SVGElement?!0:e.querySelector('template[shadowrootmode="open"]')instanceof HTMLTemplateElement}function sa(e,t,n,r,o){const i={...e??{}};if(t!=null&&delete i.header,n){const s=e?.contextMenu,l=s?.onClose,a=s?.onOpen;i.contextMenu={...s??{},enabled:!0,onClose:()=>{l?.(),r()},onOpen:(d,h)=>{o(d,h),a?.(d,h)}},delete i.contextMenu.render}return i.header!=null||i.contextMenu!=null?i:void 0}function la({header:e,id:t,model:n,preloadedData:r,renderContextMenu:o,...i}){const[s,l]=U.useState(null),[a,d]=U.useState(null),h=U.useRef(n.getComposition()),f=U.useRef(n);f.current!==n&&(f.current=n,h.current=n.getComposition());const c=o!=null,m=U.useCallback(()=>{l(null)},[]),p=U.useCallback((S,E)=>{l({context:E,item:S})},[]),g=h.current,v=U.useMemo(()=>sa(g,e,c,m,p),[g,m,p,c,e]),w=U.useCallback(S=>{d(S)},[]);U.useEffect(()=>{c||l(null)},[c]),Io(()=>{n.setComposition(v)},[v,n]),Io(()=>{if(a!=null)return r!=null&&ia(a)?n.hydrate({fileTreeContainer:a}):n.render({fileTreeContainer:a}),()=>{n.unmount(),n.setComposition(g)}},[g,a,n,r]);const x=oa(ra(e,o,s),r),b=t??r?.id,I={"--trees-item-height":`${String(n.getItemHeight())}px`,"--trees-density-override":n.getDensityFactor(),...i.style};return oe.jsx(cr,{...i,id:b,ref:w,style:I,suppressHydrationWarning:r!=null,children:x})}const zi=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
2
2
|
<symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
|
|
3
3
|
<path d="M12.4697 5.46973C12.7626 5.17684 13.2374 5.17684 13.5303 5.46973C13.8232 5.76262 13.8232 6.23738 13.5303 6.53028L8.53028 11.5303C8.23738 11.8232 7.76262 11.8232 7.46973 11.5303L2.46973 6.53028C2.17684 6.23738 2.17684 5.76262 2.46973 5.46973C2.76262 5.17684 3.23738 5.17684 3.53028 5.46973L8 9.93946L12.4697 5.46973Z" fill="currentcolor"/>
|
|
4
4
|
</symbol>
|
|
@@ -1265,7 +1265,7 @@ import{r as U,j as ee,c as Ul}from"./index-_gYIQM_z.js";import{b as Kl,u as Wl,I
|
|
|
1265
1265
|
}`}function bc(e){return`${Oi}
|
|
1266
1266
|
@layer unsafe {
|
|
1267
1267
|
${e}
|
|
1268
|
-
}`}const _o=new WeakMap;function Ic(e){const t=_o.get(e);if(t!=null)return t;const n=document.createElement("div");n.setAttribute(ea,"true");const r=document.createElement("div");r.style.position="relative",r.style.height="200%",n.appendChild(r),e.appendChild(n);const o=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),_o.set(e,o),o}function xc(e,t){if(!e.isConnected)return;const n=Ic(t);if(n==null)return;const r=t.querySelector(`style[${bo}]`),o=r instanceof HTMLStyleElement?r:document.createElement("style");r instanceof HTMLStyleElement||(o.setAttribute(bo,""),t.appendChild(o)),o.textContent=`:host { ${ta}: ${n}px; }`}let Sn;function wc(e){if(typeof CSSStyleSheet<"u"&&typeof CSSStyleSheet.prototype.replaceSync=="function"&&"adoptedStyleSheets"in e){Sn==null&&(Sn=new CSSStyleSheet,Sn.replaceSync(Co(So)));let t=!1;try{e.adoptedStyleSheets=[Sn],t=!0}catch{}if(t){e.querySelector(`style[${vo}]`)?.remove();return}}if(e.querySelector("style[data-file-tree-style]")==null){const t=document.createElement("style");t.setAttribute(vo,""),t.textContent=Co(So),e.prepend(t)}}function dr(e,t){Sc(e,t),wc(t),xc(e,t)}function Sc(e,t){const n=e.querySelector('template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]');n instanceof HTMLTemplateElement&&(t.childNodes.length>0||(t.appendChild(n.content.cloneNode(!0)),n.hasAttribute("shadowrootmode")&&n.remove()))}if(typeof HTMLElement<"u"&&customElements.get("file-tree-container")==null){class e extends HTMLElement{constructor(){super()}connectedCallback(){const n=this.shadowRoot??this.attachShadow({mode:"open"});dr(this,n)}}if(customElements.define(cr,e),typeof document<"u")for(const t of Array.from(document.querySelectorAll(cr)))t instanceof HTMLElement&&dr(t,t.shadowRoot??t.attachShadow({mode:"open"}))}const en=5,qn=1<<en,Cc=qn*4;function Xt(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function ko(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function dt(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;const n=new Map;for(const r of t.childIds){const o=e[r];o!=null&&n.set(o.nameId,r)}return t.childIdByNameId=n,n}function On(e){if(e.childPositionById!=null)return e.childPositionById;const t=new Map;for(let n=0;n<e.childIds.length;n++){const r=e.childIds[n];r!=null&&t.set(r,n)}return e.childPositionById=t,t}function $t(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function ji(e,t){if(e.childPositionById!=null)for(let n=t;n<e.childIds.length;n++){const r=e.childIds[n];r!=null&&e.childPositionById.set(r,n)}}function Ln(e,t){let n=0,r=0;for(const o of t.childIds){const i=e[o];i!=null&&(n+=i.subtreeNodeCount,r+=i.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,wt(e,t)}function Dr(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;const o=On(e).get(t);if(o===void 0)return;const i=o>>en;e.childVisibleChunkSums[i]+=r}function hr(e,t,n){const r=t.childVisibleChunkSums;if(r!=null){let i=n,s=0;for(const l of r){if(i<l){const a=kc(e,t,s,i);return{...a,childVisibleIndex:n-a.localVisibleIndex}}i-=l,s+=qn}throw new Error(`Visible child index ${String(n)} is out of range`)}let o=n;for(let i=0;i<t.childIds.length;i++){const s=t.childIds[i];if(s==null)continue;const l=e[s];if(l!=null){if(o<l.visibleSubtreeCount)return{childIndex:i,childVisibleIndex:n-o,localVisibleIndex:o};o-=l.visibleSubtreeCount}}throw new Error(`Visible child index ${String(n)} is out of range`)}function _c(e,t,n){let r=0;const o=t.childVisibleChunkSums;let i=0;if(o!=null){const s=n>>en;for(let l=0;l<s;l+=1)r+=o[l]??0;i=s<<en}for(let s=i;s<n;s+=1){const l=t.childIds[s];if(l==null)continue;const a=e[l];a!=null&&(r+=a.visibleSubtreeCount)}return r}function wt(e,t){if(t.childIds.length<Cc){t.childVisibleChunkSums=null;return}const n=Math.ceil(t.childIds.length/qn),r=new Int32Array(n);for(let o=0;o<t.childIds.length;o++){const i=t.childIds[o];if(i==null)continue;const s=e[i];s!=null&&(r[o>>en]+=s.visibleSubtreeCount)}t.childVisibleChunkSums=r}function kc(e,t,n,r){const o=Math.min(t.childIds.length,n+qn);let i=r;for(let s=n;s<o;s++){const l=t.childIds[s];if(l==null)continue;const a=e[l];if(a!=null){if(i<a.visibleSubtreeCount)return{childIndex:s,localVisibleIndex:i};i-=a.visibleSubtreeCount}}throw new Error(`Visible child index ${String(r)} is out of range`)}const Pc=7,Mr=3,$i=1<<Mr,Ui=4;function _e(e,t,n=0){return e<<Ui|n<<Mr|t}function ze(e){return e.depthAndFlags>>>Ui}function jn(e){return(e.depthAndFlags&$i)>>Mr}function T(e){return(e.depthAndFlags&$i)!==0}function Ki(e){return e.depthAndFlags&Pc}function ae(e,t){return(Ki(e)&t)!==0}function $n(e,t){e.depthAndFlags|=t}function Ec(e,t){e.depthAndFlags=_e(t,Ki(e),jn(e))}const Wi=Symbol("benchmarkInstrumentation");function Dc(e,t){return t==null||Object.defineProperty(e,Wi,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function Tr(e){return e==null?null:e[Wi]??null}function P(e,t,n){return e==null?n():e.measurePhase(t,n)}function En(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function Po(e){return e>=48&&e<=57}function Mc(e){const t=[];let n=0,r=0;for(;r<e.length;){for(;r<e.length&&!Po(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let o=0;for(;r<e.length&&Po(e.charCodeAt(r));)o=o*10+(e.charCodeAt(r)-48),r+=1;t.push(o),n=r}return(n<e.length||t.length===0)&&t.push(e.slice(n)),t}function ln(e){const t=e.toLowerCase();return{lowerValue:t,tokens:Mc(t)}}function Tc(e,t){const n=Math.min(e.length,t.length);for(let r=0;r<n;r++){const o=e[r],i=t[r];if(o===i)continue;if(typeof o=="number"&&typeof i=="number")return o<i?-1:1;const s=String(o),l=String(i);if(s!==l)return s<l?-1:1}return e.length!==t.length?e.length<t.length?-1:1:0}function Nr(e,t){if(e.tokens.length===1&&t.tokens.length===1&&typeof e.tokens[0]=="string"&&typeof t.tokens[0]=="string")return e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1;const n=Tc(e.tokens,t.tokens);return n!==0?n:e.lowerValue!==t.lowerValue?e.lowerValue<t.lowerValue?-1:1:0}function Gi(e,t,n){const r=Nr(n(e),n(t));return r!==0?r:e===t?0:e<t?-1:1}function Nc(e,t){return Gi(e,t,ln)}function Fn(e,t){return t!==e.segments.length-1||e.isDirectory?1:0}function Ac(e,t){const n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){const o=e.segments[r],i=t.segments[r];if(o===i)continue;const s=Fn(e,r);return s!==Fn(t,r)?s===1?-1:1:Nc(o,i)}return e.segments.length!==t.segments.length?e.segments.length<t.segments.length?-1:1:e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1}function Rc(e,t){return Ac(e,t)}function Vc(e,t,n){const r=i=>{const s=n.get(i);if(s!=null)return s;const l=ln(i);return n.set(i,l),l},o=Math.min(e.segments.length,t.segments.length);for(let i=0;i<o;i++){const s=e.segments[i],l=t.segments[i];if(s===l)continue;const a=Fn(e,i);return a!==Fn(t,i)?a===1?-1:1:Gi(s,l,r)}return e.segments.length!==t.segments.length?e.segments.length<t.segments.length?-1:1:e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1}function fr(e,t){const n=e.sortKeyById[t];if(n!==void 0)return n;const r=e.valueById[t],o=ln(r);return e.sortKeyById[t]=o,o}function Yi(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??"default"}}function Xi(e){const t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[];let o=0;for(let i=0;i<n;i++)e.charCodeAt(i)===47&&(r.push(e.slice(o,i)),o=i+1);return r.push(e.slice(o,n)),{hasTrailingSlash:t,segments:r}}function Jt(e){const{hasTrailingSlash:t,segments:n}=Xi(e);return{basename:n[n.length-1]??"",isDirectory:t,path:e,segments:n}}function pr(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};const{hasTrailingSlash:t,segments:n}=Xi(e);return{requiresDirectory:t,segments:n}}function Qi(){const e=new Map;return e.set("",0),{idByValue:e,valueById:[""],sortKeyById:[ln("")]}}function Je(e,t){const n=e.idByValue.get(t);if(n!==void 0)return n;const r=e.valueById.length;return e.idByValue.set(t,r),e.valueById.push(t),r}function He(e,t){const n=e.valueById[t];if(n===void 0)throw new Error(`Unknown segment ID: ${String(t)}`);return n}const Ar=Symbol("pathStorePreparedInputKind");function Ji(e,t){return e[Ar]=t,e}function Eo(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function Zi(e,t,n){return n==="default"?Rc(e,t):n(Eo(e),Eo(t))}function Lc(){return{depthAndFlags:_e(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function Fc(e,t){const n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return r;return n}function Do(e){return e.isDirectory?e.segments.length:e.segments.length-1}function Bc(e){return Array.isArray(e)&&e.every(t=>t!=null&&typeof t=="object"&&typeof t.path=="string"&&Array.isArray(t.segments)&&typeof t.basename=="string"&&typeof t.isDirectory=="boolean")}function zc(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function Hc(e,t={}){return Rr(e,t).map(n=>n.path)}function qc(e,t={}){const n=Rr(e,t);return Ji({paths:n.map(r=>r.path),preparedPaths:n},"prepared")}function Oc(e){const t=e.length;let n=!1;for(let r=0;r<t;r+=1){const o=e[r];if(o.length>0&&o.charCodeAt(o.length-1)===47){n=!0;break}}return Ji({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},"presorted")}function jc(e){const t=e,n=t.preparedPaths;if(t[Ar]==="prepared"&&n!=null)return n;if(!Bc(n))throw new Error("preparedInput must come from PathStore.prepareInput()");return n}function $c(e){const t=e;return t[Ar]==="presorted"&&t.presortedPaths!=null||zc(t.presortedPaths)?t.presortedPaths:null}function Uc(e){const t=e;return typeof t.presortedPathsContainDirectories=="boolean"?t.presortedPathsContainDirectories:null}function Rr(e,t={}){const n=Yi(t),r=Tr(t);En(r,"workload.inputFiles",e.length);const o=P(r,"store.preparePathEntries.parse",()=>e.map(i=>Jt(i)));return P(r,"store.preparePathEntries.sort",()=>o.sort((i,s)=>Zi(i,s,n.sort))),o}var es=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[Lc()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=Qi();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=Tr(e),this.options=Yi(e);const t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{const n=new Set,r=t.length;for(let o=0;o<r;o+=1){const i=t[o],s=i.length;n.add(s>0&&i.charCodeAt(s-1)===47?i.slice(0,s-1):i)}this.initialExpandedPathSet=n,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,Xt())}appendPaths(e){return P(this.instrumentation,"store.builder.appendPaths.parse",()=>this.appendPreparedPaths(e.map(t=>Jt(t))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,P(this.instrumentation,"store.builder.appendPreparedPaths",()=>{for(const n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return P(this.instrumentation,"store.builder.appendPresortedPaths",()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0;const o=this.nodes,i=this.segmentTable,s=i.idByValue,l=i.valueById,a=this.directoryStack;let d=0,h="",f=0;for(const c of e){if(n===c)throw new Error(`Duplicate path: "${c}"`);const m=c.length>0&&c.charCodeAt(c.length-1)===47,p=m?c.length-1:c.length;let g=0,v=0;if(n!=null)if(h.length>0&&c.length>h.length&&c.startsWith(h))g=f,v=h.length;else{const b=Math.min(p,n.length);let I=!0;for(let S=0;S<b;S++){const E=c.charCodeAt(S);if(E!==n.charCodeAt(S)){I=!1;break}E===47&&(g++,v=S+1)}I&&m&&b===p&&n.length>p&&n.charCodeAt(p)===47&&(g++,v=p+1)}d=g,r=g;let w=v,x=c.indexOf("/",w);for(;x>=0&&x<p;){const b=a[d];if(b===void 0)throw new Error("Directory stack underflow while building the path store");r++;const I=c.slice(w,x);let S=s.get(I);S===void 0&&(S=l.length,s.set(I,S),l.push(I));const E=o.length;o.push({depthAndFlags:_e(r,0,1),nameId:S,parentId:b,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(c.slice(0,x)),d++,a[d]=E,w=x+1,x=c.indexOf("/",w)}if(m){if(w<p){const I=a[d];if(I===void 0)throw new Error(`Unable to resolve directory parent for "${c}"`);r++;const S=c.slice(w,p);let E=s.get(S);E===void 0&&(E=l.length,s.set(S,E),l.push(S));const V=o.length;o.push({depthAndFlags:_e(r,0,1),nameId:E,parentId:I,subtreeNodeCount:1,visibleSubtreeCount:1}),d++,a[d]=V,w=p+1}const b=a[d];if(b===void 0)throw new Error(`Unable to resolve directory node for "${c}"`);this.promoteDirectoryToExplicit(b,c)}else{const b=a[d];if(b===void 0)throw new Error(`Unable to resolve file parent for "${c}"`);const I=c.slice(w);let S=s.get(I);S===void 0&&(S=l.length,s.set(I,S),l.push(I)),o.push({depthAndFlags:_e(r+1,0),nameId:S,parentId:b,subtreeNodeCount:1,visibleSubtreeCount:1})}w!==h.length&&(h=c.substring(0,w),f=r),n=c}a.length=d+1,n!=null&&(this.lastPreparedPath=Jt(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0;const r=this.nodes,o=this.segmentTable,i=o.idByValue,s=o.valueById,l=this.directoryStack;let a=0,d="",h=0;for(const f of e){if(t===f)throw new Error(`Duplicate path: "${f}"`);const c=f.length;let m=0,p=0;if(t!=null)if(d.length>0&&f.length>d.length&&f.startsWith(d))m=h,p=d.length;else{const I=Math.min(c,t.length);for(let S=0;S<I;S++){const E=f.charCodeAt(S);if(E!==t.charCodeAt(S))break;E===47&&(m++,p=S+1)}}a=m,n=m;let g=p,v=f.indexOf("/",g);for(;v>=0;){const I=l[a];if(I===void 0)throw new Error("Directory stack underflow while building the path store");n++;const S=f.slice(g,v);let E=i.get(S);E===void 0&&(E=s.length,i.set(S,E),s.push(S));const V=r.length;r.push({depthAndFlags:_e(n,0,1),nameId:E,parentId:I,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(f.slice(0,v)),this.presortedDirectoryNodeIds.push(V),a++,l[a]=V,g=v+1,v=f.indexOf("/",g)}const w=l[a];if(w===void 0)throw new Error(`Unable to resolve file parent for "${f}"`);const x=f.slice(g);let b=i.get(x);b===void 0&&(b=s.length,i.set(x,b),s.push(x)),r.push({depthAndFlags:_e(n+1,0),nameId:b,parentId:w,subtreeNodeCount:1,visibleSubtreeCount:1}),g!==d.length&&(d=f.substring(0,g),h=n),t=f}l.length=a+1,t!=null&&(this.lastPreparedPath=Jt(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){const t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(P(this.instrumentation,"store.builder.buildDirectoryIndexes",()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||P(this.instrumentation,"store.builder.computeSubtreeCounts",()=>this.computeSubtreeCounts(0)),{directories:this.directories,nodes:this.nodes,options:this.options,rootId:0,segmentTable:this.segmentTable,presortedDirectoryNodeIds:this.presortedDirectoryNodeIds.length>0?this.presortedDirectoryNodeIds:null}}didMatchAllInitialExpandedPaths(){return this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&this.createdDirectoryCount===this.initialExpandedPathSet.size}appendPreparedPath(e,t){if(this.hasDeferredDirectoryIndexes&&(this.buildDirectoryIndexes(),this.hasDeferredDirectoryIndexes=!1),this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw new Error(`Duplicate path: "${e.path}"`);if(t&&(this.options.sort==="default"?Vc(this.lastPreparedPath,e,this.segmentSortKeyCache):Zi(this.lastPreparedPath,e,this.options.sort))>0)throw new Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}const n=this.lastPreparedPath,r=Do(e),o=n==null?0:Do(n),i=n==null?0:Fc(n.segments,e.segments),s=Math.min(i,r,o);this.directoryStack.length=s+1;for(let a=s;a<r;a++){const d=this.directoryStack[this.directoryStack.length-1];if(d===void 0)throw new Error("Directory stack underflow while building the path store");const h=t?this.getOrCreateDirectoryChild(d,e.segments[a]):this.createDirectoryChild(d,e.segments[a]);this.directoryStack.push(h)}if(e.isDirectory){const a=this.directoryStack[this.directoryStack.length-1];if(a===void 0)throw new Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(a,e.path),this.lastPreparedPath=e;return}const l=this.directoryStack[this.directoryStack.length-1];if(l===void 0)throw new Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(l,e.basename,e.path):this.createFileChildUnchecked(l,e.basename),this.lastPreparedPath=e}recordCreatedDirectoryPath(e){!this.createdDirectoriesAllExpanded||this.initialExpandedPathSet==null||(this.createdDirectoryCount+=1,this.initialExpandedPathSet.has(e)||(this.createdDirectoriesAllExpanded=!1))}createFileChild(e,t,n){const r=Je(this.segmentTable,t),o=this.getDirectoryIndex(e),i=o.childIdByNameId;if(i!=null&&i.get(r)!==void 0)throw new Error(`Path collides with an existing entry: "${n}"`);const s=this.nodes[e];if(s===void 0)throw new Error(`Unknown parent node ID: ${String(e)}`);const l=this.nodes.length;return this.nodes.push({depthAndFlags:_e(ze(s)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),i?.set(r,l),$t(o,l),l}createFileChildUnchecked(e,t){const n=Je(this.segmentTable,t),r=this.getDirectoryIndex(e),o=this.nodes[e];if(o===void 0)throw new Error(`Unknown parent node ID: ${String(e)}`);const i=this.nodes.length;return this.nodes.push({depthAndFlags:_e(ze(o)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,i),$t(r,i),i}getOrCreateDirectoryChild(e,t){const n=Je(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){const s=r.childIdByNameId.get(n);if(s!==void 0){const l=this.nodes[s];if(l!=null&&!T(l))throw new Error(`Path collides with an existing file while creating directory "${t}"`);return s}}const o=this.nodes[e];if(o===void 0)throw new Error(`Unknown parent node ID: ${String(e)}`);const i=this.nodes.length;return this.nodes.push({depthAndFlags:_e(ze(o)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,i),$t(r,i),this.directories.set(i,Xt()),i}createDirectoryChild(e,t){const n=Je(this.segmentTable,t),r=this.getDirectoryIndex(e),o=this.nodes[e];if(o===void 0)throw new Error(`Unknown parent node ID: ${String(e)}`);const i=this.nodes.length;return this.nodes.push({depthAndFlags:_e(ze(o)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,i),$t(r,i),this.directories.set(i,Xt()),i}promoteDirectoryToExplicit(e,t){const n=this.nodes[e];if(n===void 0)throw new Error(`Unknown directory node ID: ${String(e)}`);if(!T(n))throw new Error(`Path is not a directory: "${t}"`);if(ae(n,1))throw new Error(`Duplicate path: "${t}"`);$n(n,1)}getDirectoryIndex(e){const t=this.directories.get(e);if(t!==void 0)return t;throw new Error(`Unknown directory child index for node ${String(e)}`)}buildPresortedFinish(e){const t=this.nodes,n=this.directories;n.set(0,ko());let r=-1,o=null;for(let i=1;i<t.length;i++){const s=t[i];if(s==null)continue;if(T(s)){const a=ko();n.set(i,a),r=i,o=a}let l;s.parentId===r?l=o:(l=n.get(s.parentId),r=s.parentId,o=l??null),l?.childIds.push(i)}if(!e)for(let i=t.length-1;i>=1;i--){const s=t[i];if(s==null)continue;const l=t[s.parentId];l!=null&&(l.subtreeNodeCount+=s.subtreeNodeCount,l.visibleSubtreeCount+=s.visibleSubtreeCount)}}buildDirectoryIndexes(){const e=this.nodes;for(let t=1;t<e.length;t++){const n=e[t];if(n==null)continue;T(n)&&this.directories.set(t,Xt());const r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),$t(r,t))}}computeSubtreeCounts(e){const t=this.nodes[e];if(t===void 0)throw new Error(`Unknown node ID: ${String(e)}`);if(!T(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;const n=this.getDirectoryIndex(e);let r=1;for(const o of n.childIds)r+=this.computeSubtreeCounts(o);return Ln(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function Kc(e,t="closed",n=null){const r=Gc(t);return{activeNodeCount:e.nodes.length-1,collapsedDirectoryIds:new Set,collapseNewDirectoriesByDefault:!1,defaultExpansion:r,directoriesOpenByDefault:r==="open",hasCollapsedDirectoryOverrides:!1,directoryLoadInfoById:new Map,expandedDirectoryIds:new Set,instrumentation:n,listeners:new Map,pathCacheByNodeId:new Map([[e.rootId,{path:"",version:0}]]),pathCacheVersion:0,snapshot:e,transactionStack:[]}}function Wc(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function Gc(e){if(typeof e!="number")return e;if(!Number.isInteger(e)||e<0)throw new Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(e)}`);return e}function ts(e,t){return ae(t,2)||e.defaultExpansion==="open"?!0:e.defaultExpansion==="closed"?!1:ze(t)<=e.defaultExpansion}function be(e,t,n=e.snapshot.nodes[t]){return n==null||!T(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:ts(e,n)}function tn(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!T(r))return;const o=ts(e,r);if(n){if(o){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t);return}if(o){e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0;return}e.expandedDirectoryIds.delete(t)}function ns(e,t){const n=e.directoryLoadInfoById.get(t);if(n!=null)return n;const r={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:"loaded"};return e.directoryLoadInfoById.set(t,r),r}function nn(e,t){return e.directoryLoadInfoById.get(t)?.state??"loaded"}function Yc(e,t){const n=ns(e,t);if(n.state==="loading"&&n.activeAttemptId!=null)return{attemptId:n.activeAttemptId,nodeId:t,reused:!0};const r=n.nextAttemptId;return n.activeAttemptId=r,n.errorMessage=null,n.nextAttemptId+=1,n.state="loading",{attemptId:r,nodeId:t,reused:!1}}function Xc(e,t){const n=ns(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state="unloaded"}function Qc(e,t,n){const r=e.directoryLoadInfoById.get(t);return r==null||r.activeAttemptId!==n?!1:(r.activeAttemptId=null,r.errorMessage=null,r.state="loaded",!0)}function Jc(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function Zc(e,t,n,r){const o=e.directoryLoadInfoById.get(t);return o==null||o.activeAttemptId!==n?!1:(o.activeAttemptId=null,o.errorMessage=r??null,o.state="error",!0)}function eu(e,t){e.directoryLoadInfoById.delete(t)}function tu(e,t,n){const r=n,o=e.listeners.get(t);return o!=null?o.add(r):e.listeners.set(t,new Set([r])),()=>{const i=e.listeners.get(t);i!=null&&(i.delete(r),i.size===0&&e.listeners.delete(t))}}function nu(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:"add",path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function ru(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:"remove",path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function ou(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:"move",projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function iu(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:"expand",path:e.path,projectionChanged:!0,visibleCountDelta:null}}function su(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:"collapse",path:e.path,projectionChanged:!0,visibleCountDelta:null}}function lu(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:"mark-directory-unloaded",path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function au(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:"begin-child-load",path:e.path,projectionChanged:e.projectionChanged,reused:e.reused,visibleCountDelta:null}}function cu(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some(t=>t.canonicalChanged),childEvents:e.childEvents,operation:"apply-child-patch",path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function uu(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:"complete-child-load",path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function du(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,errorMessage:e.errorMessage,operation:"fail-child-load",path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function hu(e){return{activeNodeCountAfter:e.activeNodeCountAfter,activeNodeCountBefore:e.activeNodeCountBefore,affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],cachedPathEntryCountAfter:e.cachedPathEntryCountAfter,cachedPathEntryCountBefore:e.cachedPathEntryCountBefore,canonicalChanged:!1,idsPreserved:e.idsPreserved,loadInfoEntryCountAfter:e.loadInfoEntryCountAfter,loadInfoEntryCountBefore:e.loadInfoEntryCountBefore,mode:e.mode,operation:"cleanup",projectionChanged:e.projectionChanged,reclaimedCachedPathEntryCount:e.reclaimedCachedPathEntryCount,reclaimedLoadInfoEntryCount:e.reclaimedLoadInfoEntryCount,reclaimedNodeSlotCount:e.reclaimedNodeSlotCount,reclaimedSegmentCount:e.reclaimedSegmentCount,segmentCountAfter:e.segmentCountAfter,segmentCountBefore:e.segmentCountBefore,totalNodeSlotCountAfter:e.totalNodeSlotCountAfter,totalNodeSlotCountBefore:e.totalNodeSlotCountBefore,visibleCountDelta:null}}function we(e,t,n){return{...n,visibleCountDelta:gr(e)-t}}function fu(e,t){const n=gr(e),r=Wc();e.transactionStack.push(r);try{t()}catch(o){throw To(e,r,!1),o}To(e,r,!0,gr(e)-n)}function Ae(e,t){const n=e.instrumentation;if(n==null){Mo(e,t);return}P(n,"store.events.record",()=>Mo(e,t))}function Mo(e,t){const n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){mr(e,t);return}n.events.push(t),gu(n,t)}function To(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw new Error("Transaction stack underflow");if(!n)return;const o=e.transactionStack[e.transactionStack.length-1]??null;if(o!=null){const l=e.instrumentation;l==null?No(o,t):P(l,"store.events.batch.merge",()=>No(o,t));return}const i=pu(t,r),s=e.instrumentation;if(s==null){mr(e,i);return}P(s,"store.events.batch.commit",()=>mr(e,i))}function pu(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some(n=>n.canonicalChanged),events:[...e.events],operation:"batch",projectionChanged:e.events.some(n=>n.projectionChanged),visibleCountDelta:t}}function mu(e,t){for(const n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(const n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function No(e,t){for(const n of t.events)e.events.push(n);mu(e,t)}function gu(e,t){for(const n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(const n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function mr(e,t){const n=e.instrumentation;if(n==null){Ao(e,t);return}P(n,"store.events.emit",()=>Ao(e,t))}function Ao(e,t){e.listeners.get(t.operation)?.forEach(n=>n(t)),e.listeners.get("*")?.forEach(n=>n(t))}function gr(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function kt(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;const n=e.snapshot.nodes[t];if(n==null||!T(n)||ae(n,2))return null;const r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;const o=r.childIds[0];if(o==null)return null;const i=e.snapshot.nodes[o];return i==null||!T(i)?null:o}function ct(e,t){let n=t;for(;;){const r=kt(e,n);if(r==null)return n;n=r}}function Bn(e,t){const n=[t];let r=t;for(;;){const o=kt(e,r);if(o==null)return n;n.push(o),r=o}}function rs(e,t){const n=t==null?e.snapshot.rootId:Ee(e,t);return n==null?[]:yu(e,n)}function Ro(e,t){const n=Jt(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),o=Ze(e,Pu(e,r)),{createdNodeIds:i,directoryId:s}=bu(e,r),l=new Set(i);let a=s;if(n.isDirectory){const h=D(e,s);if(ae(h,1))throw new Error(`Path already exists: "${t}"`);$n(h,1),e.pathCacheByNodeId.set(s,{path:t,version:e.pathCacheVersion}),l.add(s)}else a=xu(e,s,n.basename),l.add(a);ut(e,s);const d=Ze(e,s);return nu({affectedAncestorIds:Re(e,a),affectedNodeIds:[...l],path:t,projectionChanged:ss(o,d)})}function Vo(e,t,n){const r=Ee(e,t);if(r==null)throw new Error(`Path does not exist: "${t}"`);const o=D(e,r);if(ae(o,2))throw new Error("The root node cannot be removed");if(T(o)&&G(e,r).childIds.length>0&&n.recursive!==!0)throw new Error(`Cannot remove a non-empty directory without recursive: "${t}"`);const i=o.parentId,s=Ze(e,i),l=is(e,r);Fr(e,i,r,o.nameId),Br(e,i),ut(e,i);const a=Ze(e,i);return ru({affectedAncestorIds:Re(e,i),affectedNodeIds:l,path:t,projectionChanged:ss(s,a),recursive:n.recursive===!0})}function Lo(e,t,n,r){const o=Ee(e,t);if(o==null)throw new Error(`Source path does not exist: "${t}"`);const i=D(e,o);if(ae(i,2))throw new Error("The root node cannot be moved");const s=r.collision??"error",l=_u(e,o,n),a=Ze(e,i.parentId),d=Ze(e,l.parentId),h=He(e.snapshot.segmentTable,i.nameId),f=Je(e.snapshot.segmentTable,l.basename);if(l.parentId===i.parentId&&h===l.basename)return null;if(T(i)&&Du(e,o,l.parentId))throw new Error("Cannot move a directory into one of its descendants");const c=dt(e.snapshot.nodes,G(e,l.parentId)).get(f),m=l.existingNodeId??c??null;if(m!=null&&m!==o&&ku(e,m,s,jn(i))==="skip")return null;const p=i.parentId;Fr(e,p,o,i.nameId),i.parentId=l.parentId,i.nameId=f,e.pathCacheByNodeId.delete(o),as(e,o),Lr(e,l.parentId,o),Br(e,p),e.pathCacheVersion++,ut(e,p),l.parentId!==p&&ut(e,l.parentId);const g=Ze(e,p),v=Ze(e,l.parentId);return ou({affectedAncestorIds:[...new Set([...Re(e,p),...Re(e,l.parentId)])],affectedNodeIds:[o],from:t,projectionChanged:ls([a,d],[g,v]),to:W(e,o)})}function vu(e,t){const n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function Fo(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function W(e,t){const n=D(e,t),r=vu(e,t);if(r!=null)return r;if(ae(n,2))return Fo(e,t,"");const o=W(e,n.parentId),i=He(e.snapshot.segmentTable,n.nameId),s=o.length===0?i:`${o}${i}`;return Fo(e,t,T(n)?`${s}/`:s)}function ut(e,t){const n=e.instrumentation;if(n==null){zo(e,t);return}P(n,"store.recomputeCountsUpwardFrom",()=>zo(e,t))}function Vr(e,t){const n=[[t,0]],{nodes:r,directories:o}=e.snapshot;for(;n.length>0;){const i=n[n.length-1],s=i[0],l=r[s];if(l==null||!T(l)){vr(e,s,l,!0),n.pop();continue}const a=o.get(s);if(a==null||i[1]>=a.childIds.length){vr(e,s,l,!0),n.pop();continue}const d=a.childIds[i[1]++];n.push([d,0])}}function Re(e,t){const n=[];let r=t;for(;r!=null;){const o=D(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=o.parentId}return n}function Ee(e,t){if(t.length===0)return e.snapshot.rootId;const n=pr(t);return os(e,n.segments,n.requiresDirectory)}function os(e,t,n){let r=e.snapshot.rootId;for(const i of t){const s=e.snapshot.segmentTable.idByValue.get(i);if(s===void 0)return null;const l=G(e,r),a=dt(e.snapshot.nodes,l).get(s);if(a===void 0)return null;r=a}const o=D(e,r);return n&&!T(o)?null:r}function G(e,t){const n=e.snapshot.directories.get(t);if(n===void 0)throw new Error(`Unknown directory child index for node ${String(t)}`);return n}function D(e,t){const n=e.snapshot.nodes[t];if(n===void 0||ae(n,4))throw new Error(`Unknown node ID: ${String(t)}`);return n}function yu(e,t){const n=e.snapshot.nodes[t];if(n===void 0||ae(n,4))return[];if(!T(n))return[W(e,t)];if(G(e,t).childIds.length===0)return ae(n,1)&&!ae(n,2)?[W(e,t)]:[];const r=[],o=[{childIndex:0,nodeId:t}];for(;o.length>0;){const i=o[o.length-1];if(i==null)break;const s=e.snapshot.nodes[i.nodeId];if(s===void 0||ae(s,4)){o.pop();continue}if(!T(s)){r.push(W(e,i.nodeId)),o.pop();continue}const l=G(e,i.nodeId);if(l.childIds.length===0){ae(s,1)&&!ae(s,2)&&r.push(W(e,i.nodeId)),o.pop();continue}const a=l.childIds[i.childIndex];if(a==null){o.pop();continue}i.childIndex++,o.push({childIndex:0,nodeId:a})}return r}function bu(e,t){const n=[];let r=e.snapshot.rootId;for(const o of t){const i=Je(e.snapshot.segmentTable,o),s=G(e,r),l=dt(e.snapshot.nodes,s).get(i);if(l!==void 0){if(!T(D(e,l)))throw new Error(`Cannot create a directory that collides with an existing file: "${o}"`);r=l;continue}r=Iu(e,r,i),n.push(r)}return{createdNodeIds:n,directoryId:r}}function Iu(e,t,n){const r=D(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:_e(ze(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(o,Xt()),Lr(e,t,o),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(o),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,o}function xu(e,t,n){const r=Je(e.snapshot.segmentTable,n),o=G(e,t);if(dt(e.snapshot.nodes,o).has(r))throw new Error(`Path already exists: "${Mu(e,t,n)}"`);const i=D(e,t),s=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:_e(ze(i)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),Lr(e,t,s),e.activeNodeCount++,s}function wu(e,t,n){let r=0,o=t.childIds.length;for(;r<o;){const i=r+o>>>1,s=t.childIds[i];if(s==null){o=i;continue}Su(e,n,s)<0?o=i:r=i+1}return r}function Lr(e,t,n){const r=G(e,t),o=D(e,n);dt(e.snapshot.nodes,r).set(o.nameId,n),Dr(r,n,o.subtreeNodeCount,o.visibleSubtreeCount);const i=wu(e,r,n);r.childIds.splice(i,0,n),ji(r,i),wt(e.snapshot.nodes,r)}function Fr(e,t,n,r){const o=G(e,t),i=On(o),s=i.get(n)??-1;dt(e.snapshot.nodes,o).delete(r),i.delete(n);const l=e.snapshot.nodes[n];l!=null&&Dr(o,n,-l.subtreeNodeCount,-l.visibleSubtreeCount),s>=0&&(o.childIds.splice(s,1),ji(o,s),wt(e.snapshot.nodes,o))}function Su(e,t,n){const r=e.snapshot.options.sort;return r==="default"?Cu(e,t,n):r(Bo(e,t),Bo(e,n))}function Cu(e,t,n){const r=D(e,t),o=D(e,n),i=T(r);if(i!==T(o))return i?-1:1;const s=Nr(fr(e.snapshot.segmentTable,r.nameId),fr(e.snapshot.segmentTable,o.nameId));if(s!==0)return s;const l=He(e.snapshot.segmentTable,r.nameId),a=He(e.snapshot.segmentTable,o.nameId);return l!==a?l<a?-1:1:t<n?-1:1}function Bo(e,t){const n=D(e,t),r=W(e,t),o=T(n),i=o?r.slice(0,-1):r;return{basename:He(e.snapshot.segmentTable,n.nameId),depth:ze(n),isDirectory:o,path:r,segments:i.length===0?[]:i.split("/")}}function _u(e,t,n){const r=D(e,t),o=Ee(e,n);if(o!=null){const d=D(e,o);if(T(d))return{basename:He(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:o};const h=pr(n).segments;return{basename:h[h.length-1]??"",existingNodeId:o,parentId:d.parentId}}const i=pr(n),s=i.segments[i.segments.length-1]??"",l=i.segments.slice(0,-1),a=l.length===0?e.snapshot.rootId:os(e,l,!0);if(a==null)throw new Error(`Destination parent does not exist: "${n}"`);return{basename:s,existingNodeId:null,parentId:a}}function ku(e,t,n,r){if(n==="skip")return"skip";if(n==="error")throw new Error(`Destination already exists: "${W(e,t)}"`);const o=D(e,t);if(jn(o)!==r)throw new Error("replace collision requires the same source and destination kinds");if(T(o)&&G(e,t).childIds.length>0)throw new Error("replace collision does not support non-empty directories");const i=o.parentId,s=o.nameId;return is(e,t),Fr(e,i,t,s),Br(e,i),ut(e,i),"handled"}function is(e,t){const n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){const o=r.pop();if(o==null)break;const i=D(e,o.nodeId);if(o.visitedChildren||!T(i)){T(i)&&e.snapshot.directories.delete(o.nodeId),$n(i,4),e.pathCacheByNodeId.delete(o.nodeId),e.collapsedDirectoryIds.delete(o.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(o.nodeId),eu(e,o.nodeId),e.activeNodeCount--,n.push(o.nodeId);continue}r.push({nodeId:o.nodeId,visitedChildren:!0});const s=G(e,o.nodeId);for(let l=s.childIds.length-1;l>=0;l--){const a=s.childIds[l];a!=null&&r.push({nodeId:a,visitedChildren:!1})}}return n}function Br(e,t){let n=t;for(;n!=null;){const r=D(e,n);if(!T(r)||ae(r,2)||G(e,n).childIds.length>0)return;$n(r,1),n=r.parentId===n?null:r.parentId}}function Pu(e,t){let n=e.snapshot.rootId;for(const r of t){const o=e.snapshot.segmentTable.idByValue.get(r);if(o==null)break;const i=dt(e.snapshot.nodes,G(e,n)).get(o);if(i==null||!T(D(e,i)))break;n=i}return n}function Ze(e,t){const n=Eu(e,t);if(n==null)return null;const r=ct(e,n),o=D(e,r),i=n===r?null:Bn(e,n).map(s=>W(e,s));return JSON.stringify({flattenedSegmentPaths:i,hasChildren:G(e,r).childIds.length>0,path:W(e,r),terminalKind:jn(o)})}function ss(e,t){return ls([e],[t])}function ls(e,t){for(let n=0;n<e.length;n+=1){const r=e[n],o=t[n];if(r==null||o==null||r!==o)return!0}return!1}function Eu(e,t){let n=t;for(;n!=null;){const r=D(e,n);if(!T(r)||ae(r,2))return null;if(!be(e,n,r))return n;n=r.parentId}return null}function as(e,t){const n=D(e,t);if(Ec(n,(t===e.snapshot.rootId?-1:ze(D(e,n.parentId)))+1),!T(n))return;const r=G(e,t);for(const o of r.childIds)as(e,o)}function Du(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;const o=D(e,r);if(r===e.snapshot.rootId)return!1;r=o.parentId}return!1}function vr(e,t,n=D(e,t),r=!1){const o=e.instrumentation;if(o==null){Ho(e,t,n,r);return}P(o,"store.recomputeNodeCounts",()=>Ho(e,t,n,r))}function zo(e,t){let n=t;for(;n!=null;){const r=D(e,n),o=r.subtreeNodeCount,i=r.visibleSubtreeCount;if(vr(e,n,r),n===e.snapshot.rootId)return;const s=r.subtreeNodeCount-o,l=r.visibleSubtreeCount-i,a=r.parentId;(s!==0||l!==0)&&Dr(G(e,a),n,s,l),n=a}}function Ho(e,t,n,r){if(!T(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}const o=G(e,t);if(r){const l=e.instrumentation;l==null?Ln(e.snapshot.nodes,o):P(l,"store.recomputeNodeCounts.rebuildChildAggregates",()=>Ln(e.snapshot.nodes,o))}const i=1+o.totalChildSubtreeNodeCount,s=o.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=i,ae(n,2)){n.visibleSubtreeCount=s;return}n.visibleSubtreeCount=kt(e,t)!=null?s:be(e,t,n)?1+s:1}function Mu(e,t,n){const r=W(e,t);return r.length===0?n:`${r}${n}`}function St(e){return e!=null&&!ae(e,4)}function zn(e,t){const n=e.snapshot.nodes[t];return!St(n)||!T(n)||ae(n,2)?null:n}function Tu(e){let t=0;for(const[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&St(e.snapshot.nodes[n])&&(t+=1);return t}function Nu(e){return Math.max(0,e.valueById.length-1)}function qo(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:Tu(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:Nu(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function Au(e,t,n,r){return{activeNodeCountAfter:r.activeNodeCount,activeNodeCountBefore:n.activeNodeCount,cachedPathEntryCountAfter:r.cachedPathEntryCount,cachedPathEntryCountBefore:n.cachedPathEntryCount,idsPreserved:t,loadInfoEntryCountAfter:r.loadInfoEntryCount,loadInfoEntryCountBefore:n.loadInfoEntryCount,mode:e,reclaimedCachedPathEntryCount:n.cachedPathEntryCount-r.cachedPathEntryCount,reclaimedLoadInfoEntryCount:n.loadInfoEntryCount-r.loadInfoEntryCount,reclaimedNodeSlotCount:n.totalNodeSlotCount-r.totalNodeSlotCount,reclaimedSegmentCount:n.segmentCount-r.segmentCount,segmentCountAfter:r.segmentCount,segmentCountBefore:n.segmentCount,totalNodeSlotCountAfter:r.totalNodeSlotCount,totalNodeSlotCountBefore:n.totalNodeSlotCount}}function cs(e){const t=[],n=[];for(const r of e.collapsedDirectoryIds)zn(e,r)!=null&&t.push(W(e,r));for(const r of e.expandedDirectoryIds)zn(e,r)!=null&&n.push(W(e,r));return{collapsedPaths:t,expandedPaths:n}}function us(e){const t=[];for(const[n,r]of e.directoryLoadInfoById)zn(e,n)==null||nn(e,n)==="loaded"||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:W(e,n)});return t}function ds(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(const n of t.expandedPaths){const r=Ee(e,n);r!=null&&tn(e,r,!0,D(e,r))}for(const n of t.collapsedPaths){const r=Ee(e,n);r!=null&&tn(e,r,!1,D(e,r))}}function hs(e,t){e.directoryLoadInfoById.clear();for(const n of t){const r=Ee(e,n.path);r!=null&&zn(e,r)!=null&&e.directoryLoadInfoById.set(r,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function Ru(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:"",version:e.pathCacheVersion})}function Vu(e){const t=e.snapshot.segmentTable,n=Qi();for(const r of e.snapshot.nodes)if(St(r)){if(ae(r,2)){r.nameId=0;continue}r.nameId=Je(n,He(t,r.nameId))}e.snapshot.segmentTable=n}function Lu(e){for(const[t,n]of e.snapshot.directories){const r=e.snapshot.nodes[t];if(!St(r)||!T(r)){e.snapshot.directories.delete(t);continue}const o=n.childIds.filter(i=>{const s=e.snapshot.nodes[i];return St(s)&&s.parentId===t});n.childIds=o,n.childIdByNameId=new Map(o.map(i=>[D(e,i).nameId,i])),n.childPositionById=new Map(o.map((i,s)=>[i,s])),Ln(e.snapshot.nodes,n)}}function Fu(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){const n=e.snapshot.nodes[t];if(St(n))break;t-=1}e.snapshot.nodes.length=t+1}function Bu(e){const t=cs(e),n=us(e);P(e.instrumentation,"store.cleanup.stable.clearPathCaches",()=>Ru(e)),P(e.instrumentation,"store.cleanup.stable.rebuildSegmentTable",()=>Vu(e)),P(e.instrumentation,"store.cleanup.stable.rebuildDirectoryIndexes",()=>Lu(e)),P(e.instrumentation,"store.cleanup.stable.trimTrailingRemovedNodeSlots",()=>Fu(e)),P(e.instrumentation,"store.cleanup.stable.restoreExpansionOverrides",()=>ds(e,t)),P(e.instrumentation,"store.cleanup.stable.restoreDirectoryLoadInfos",()=>hs(e,n)),P(e.instrumentation,"store.cleanup.stable.recomputeCounts",()=>Vr(e,e.snapshot.rootId))}function zu(e){const t=cs(e),n=us(e),r=P(e.instrumentation,"store.cleanup.aggressive.listPaths",()=>rs(e)),o=Dc({...e.snapshot.options},e.instrumentation),i=P(e.instrumentation,"store.cleanup.aggressive.rebuildSnapshot",()=>{const s=new es(o);return s.appendPaths(r),s.finish()});e.snapshot=i,e.activeNodeCount=i.nodes.length-1,e.pathCacheByNodeId=new Map([[i.rootId,{path:"",version:0}]]),e.pathCacheVersion=0,P(e.instrumentation,"store.cleanup.aggressive.restoreExpansionOverrides",()=>ds(e,t)),P(e.instrumentation,"store.cleanup.aggressive.restoreDirectoryLoadInfos",()=>hs(e,n)),P(e.instrumentation,"store.cleanup.aggressive.recomputeCounts",()=>Vr(e,e.snapshot.rootId))}function Hu(e){for(const t of e.directoryLoadInfoById.values())if(t.state==="loading"&&t.activeAttemptId!=null)return!0;return!1}function qu(e,t){const n=qo(e);t==="stable"?P(e.instrumentation,"store.cleanup.stable",()=>Bu(e)):P(e.instrumentation,"store.cleanup.aggressive",()=>zu(e));const r=qo(e);return Au(t,t==="stable",n,r)}const Ou=64;function ju(e,t){const n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;const o=new Int32Array(r);return o.fill(-1),o.set(e),o}function me(e){return D(e,e.snapshot.rootId).visibleSubtreeCount}function fs(e,t,n,r){const o=D(e,t.terminalNodeId),i=Math.max(1,o.visibleSubtreeCount);return Math.min(r-1,n+i-1)}function $u(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:rn(e,t.cursor),setSize:t.setSize,subtreeEndIndex:fs(e,t.cursor,t.index,n)}}function ps(e,t,n,r,o,i){const s=G(e,t),{childIndex:l,childVisibleIndex:a,localVisibleIndex:d}=hr(e.snapshot.nodes,s,n),h=s.childIds[l];if(h==null)throw new Error(`Visible index ${String(n)} is out of range`);return Uu(e,h,d,r+a,o+1,l,s.childIds.length,i)}function Uu(e,t,n,r,o,i,s,l){if(!T(D(e,t))){if(n===0)return{ancestors:l,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:o},index:r,posInSet:i,setSize:s};throw new Error(`Visible index ${String(n)} is out of range for file`)}const a=vs(e,t,o);if(n===0)return{ancestors:l,cursor:a,index:r,posInSet:i,setSize:s};const d=D(e,a.terminalNodeId);if(!T(d)||!be(e,a.terminalNodeId,d))throw new Error(`Visible index ${String(n)} is out of range for collapsed directory`);return ps(e,a.terminalNodeId,n-1,r+1,a.visibleDepth,[...l,{cursor:a,index:r,posInSet:i,setSize:s}])}function Ku(e,t){const n=me(e);if(t<0||t>=n)return null;const r=ps(e,e.snapshot.rootId,t,0,-1,[]),o=r.ancestors.map(s=>W(e,s.cursor.terminalNodeId));let i=null;return{ancestorPaths:o,get ancestorRows(){if(i!=null)return i;const s=[],l=[];for(const a of r.ancestors){const d=$u(e,a,n,[...l]);s.push(d),l.push(d.row.path)}return i=s,i},index:r.index,posInSet:r.posInSet,row:rn(e,r.cursor),setSize:r.setSize,subtreeEndIndex:fs(e,r.cursor,r.index,n)}}function Wu(e,t,n){const r=e.instrumentation,o=me(e);if(o<=0||n<t)return[];const i=Math.max(0,Math.min(t,o-1)),s=Math.max(i,Math.min(n,o-1));if(r==null){if(i===0)return ed(e,s+1);const f=[];let c=Oo(e,i);for(let m=i;m<=s&&c!=null;m++){const p=rn(e,c);f.push(p),c=jo(e,c)}return f}const l=[];let a=0,d=0,h=P(r,"store.getVisibleSlice.selectFirstRow",()=>Oo(e,i));for(let f=i;f<=s&&h!=null;f++){const c=P(r,"store.getVisibleSlice.materializeRow",()=>rn(e,h));l.push(c),c.isFlattened&&(a++,d+=c.flattenedSegments?.length??0),h=P(r,"store.getVisibleSlice.advanceCursor",()=>jo(e,h))}return En(r,"workload.visibleRowsRead",l.length),En(r,"workload.flattenedRowsRead",a),En(r,"workload.flattenedSegmentsRead",d),l}function ms(e,t=me(e)){const n=e.instrumentation;return n==null?$o(e,t):P(n,"store.getVisibleTreeProjection",()=>$o(e,t))}function Gu(e){return Zu(ms(e))}function Yu(e,t){const n=Ee(e,t);if(n==null||n===e.snapshot.rootId||T(D(e,n))&&ct(e,n)!==n)return null;let r=0,o=n;const{nodes:i,rootId:s}=e.snapshot;for(;o!==s;){const l=D(e,o).parentId,a=G(e,l),d=On(a).get(o);if(d==null)throw new Error(`Child ${String(o)} was not found in its parent index`);if(r+=_c(i,a,d),l!==s){const h=D(e,l),f=kt(e,l);if(!be(e,l,h)&&f!==o)return null;ct(e,l)===l&&(r+=1)}o=l}return r}function Xu(e,t){const n=Ee(e,t);if(n==null)throw new Error(`Path does not exist: "${t}"`);const r=D(e,n);if(!T(r))throw new Error(`Path is not a directory: "${t}"`);return be(e,n,r)?null:(tn(e,n,!0,r),ut(e,n),iu({affectedAncestorIds:Re(e,n),affectedNodeIds:[n],path:t}))}function Qu(e,t){const n=Ee(e,t);if(n==null)throw new Error(`Path does not exist: "${t}"`);const r=D(e,n);if(!T(r))throw new Error(`Path is not a directory: "${t}"`);return be(e,n,r)?(tn(e,n,!1,r),ut(e,n),su({affectedAncestorIds:Re(e,n),affectedNodeIds:[n],path:t})):null}function Oo(e,t){return t<0||t>=me(e)?null:gs(e,e.snapshot.rootId,t,-1)}function gs(e,t,n,r){const o=G(e,t),i=e.instrumentation,{childIndex:s,localVisibleIndex:l}=i==null?hr(e.snapshot.nodes,o,n):P(i,"store.getVisibleSlice.selectChildIndex",()=>hr(e.snapshot.nodes,o,n)),a=o.childIds[s];if(a!=null)return yr(e,a,l,r+1);throw new Error(`Visible index ${String(n)} is out of range`)}function yr(e,t,n,r){if(!T(D(e,t))){if(n===0)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw new Error(`Visible index ${String(n)} is out of range for file`)}const o=vs(e,t,r);if(n===0)return o;const i=D(e,o.terminalNodeId);if(!T(i)||!be(e,o.terminalNodeId,i))throw new Error(`Visible index ${String(n)} is out of range for collapsed directory`);return gs(e,o.terminalNodeId,n-1,o.visibleDepth)}function vs(e,t,n){return T(D(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:ct(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:P(e.instrumentation,"store.getVisibleSlice.flatten.resolveTerminalDirectory",()=>ct(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function Ju(e,t){const n=D(e,t);if(!T(n))return!0;const r=n.parentId;return r===e.snapshot.rootId?!0:kt(e,r)!==t}function jo(e,t){const n=D(e,t.terminalNodeId);if(T(n)){const i=G(e,t.terminalNodeId);if(be(e,t.terminalNodeId,n)&&i.childIds.length>0){const s=i.childIds[0];return s==null?null:yr(e,s,0,t.visibleDepth+1)}}let r=t.terminalNodeId,o=t.visibleDepth;for(;;){const i=D(e,r);if(r===e.snapshot.rootId)return null;const s=i.parentId,l=G(e,s),a=On(l).get(r)??-1;if(a<0)throw new Error(`Child ${String(r)} was not found in its parent index`);const d=l.childIds[a+1]??null;if(d!=null)return yr(e,d,0,o);Ju(e,r)&&o--,r=s}}function Zu(e){const t=e.paths.length,n=new Array(t);for(let r=0;r<t;r+=1){const o=e.getParentIndex(r);n[r]={index:r,parentPath:o>=0?e.paths[o]??null:null,path:e.paths[r]??"",posInSet:e.posInSetByIndex[r]??0,setSize:e.setSizeByIndex[r]??0}}return{getParentIndex:e.getParentIndex,rows:n,get visibleIndexByPath(){return e.visibleIndexByPath}}}function $o(e,t){const n=new Array(t),r=new Int32Array(t),o=new Int32Array(t),i=new Int32Array(t);let s=new Int32Array(Ou);s.fill(-1);let l=0;const{nodes:a,directories:d,segmentTable:h}=e.snapshot,f=[[d.get(e.snapshot.rootId),0,-1,""]],c=e.snapshot.options.flattenEmptyDirectories,m=e.pathCacheByNodeId,p=e.pathCacheVersion,g=h.valueById;for(;f.length>0&&l<t;){const I=f[f.length-1],S=I[0];if(I[1]>=S.childIds.length){f.pop();continue}const E=I[1],V=S.childIds[I[1]++],de=a[V],Y=I[2]+1,fe=I[3];s=ju(s,Y);let Q,ne=V;if(T(de))ne=c?ct(e,V):V,Q=ne===V?`${fe}${g[de.nameId]}/`:W(e,ne);else{const re=m.get(V);Q=re!=null&&re.version===p?re.path:`${fe}${g[de.nameId]}`}r[l]=s[Y],n[l]=Q,o[l]=E,i[l]=S.childIds.length,s[Y+1]=l,l+=1;const ce=a[ne];ce!=null&&T(ce)&&be(e,ne,ce)&&f.push([d.get(ne),0,Y,Q])}l<t&&(n.length=l);const v=r.subarray(0,l),w=o.subarray(0,l),x=i.subarray(0,l);let b=null;return{getParentIndex(I){return I<0||I>=l?-1:v[I]??-1},paths:n,posInSetByIndex:w,setSizeByIndex:x,get visibleIndexByPath(){if(b==null){b=new Map;for(let I=0;I<l;I+=1)b.set(n[I]??"",I)}return b}}}function ed(e,t){const n=new Array(t);let r=0;const{nodes:o,directories:i,segmentTable:s}=e.snapshot,l=[[i.get(e.snapshot.rootId),0,-1]],a=s.valueById,d=e.snapshot.options.flattenEmptyDirectories,h=e.pathCacheByNodeId,f=e.pathCacheVersion;for(;l.length>0&&r<t;){const c=l[l.length-1],m=c[0];if(c[1]>=m.childIds.length){l.pop();continue}const p=m.childIds[c[1]++],g=o[p],v=c[2]+1;if(!T(g)){const I=h.get(p);n[r++]={depth:v,flattenedSegments:void 0,hasChildren:!1,id:p,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:"file",loadState:void 0,name:a[g.nameId],path:I!=null&&I.version===f?I.path:W(e,p)};continue}const w=d?ct(e,p):p,x={headNodeId:p,terminalNodeId:w,visibleDepth:v};n[r++]=rn(e,x);const b=o[w];b!=null&&T(b)&&be(e,w,b)&&l.push([i.get(w),0,v])}return r<t&&(n.length=r),n}function rn(e,t){const n=D(e,t.terminalNodeId),r=T(n)?td(e,t):null,o=W(e,t.terminalNodeId),i=He(e.snapshot.segmentTable,n.nameId),s=T(n)&&G(e,t.terminalNodeId).childIds.length>0,l=t.headNodeId!==t.terminalNodeId,a=e.instrumentation,d=l?a==null?Bn(e,t.headNodeId).map(h=>{const f=D(e,h);return{isTerminal:h===t.terminalNodeId,name:He(e.snapshot.segmentTable,f.nameId),nodeId:h,path:W(e,h)}}):P(a,"store.getVisibleSlice.flatten.collectSegments",()=>Bn(e,t.headNodeId).map(h=>{const f=D(e,h);return{isTerminal:h===t.terminalNodeId,name:He(e.snapshot.segmentTable,f.nameId),nodeId:h,path:W(e,h)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:d,hasChildren:s,id:t.terminalNodeId,isExpanded:T(n)&&be(e,t.terminalNodeId,n),isFlattened:l,isLoading:r==="loading",kind:T(n)?"directory":"file",loadState:r==null||r==="loaded"?void 0:r,name:i,path:o}}function td(e,t){if(t.headNodeId===t.terminalNodeId)return nn(e,t.terminalNodeId);const n=Bn(e,t.headNodeId);let r=!1,o=!1;for(const i of n){const s=nn(e,i);if(s==="loading")return"loading";if(s==="error"){o=!0;continue}s==="unloaded"&&(r=!0)}return o?"error":r?"unloaded":"loaded"}const Uo=8;function nd(e){const{nodes:t,directories:n,rootId:r,options:o}=e,i=t.length,s=new Int32Array(i),l=new Int32Array(i),a=new Int32Array(i),d=new Int32Array(i),h=new Int32Array(i),f=new Int32Array(i),c=new Int32Array(i);for(let v=0;v<i;v+=1){const w=t[v];w!=null&&(s[v]=w.parentId,l[v]=w.nameId,a[v]=w.depthAndFlags,d[v]=w.subtreeNodeCount,h[v]=w.visibleSubtreeCount)}let m=0;for(const v of n.values())m+=v.childIds.length;const p=new Int32Array(m);let g=0;for(const[v,w]of n){const x=w.childIds;f[v]=g,c[v]=x.length;for(let b=0;b<x.length;b+=1)p[g]=x[b],g+=1}return{nodeCount:i,rootId:r,flattenEmptyDirectories:o.flattenEmptyDirectories===!0,parentId:s,nameId:l,depthAndFlags:a,subtreeNodeCount:d,visibleSubtreeCount:h,childStart:f,childCount:c,childIdsFlat:p}}function rd(e){const{nodeCount:t,rootId:n,flattenEmptyDirectories:r,depthAndFlags:o,subtreeNodeCount:i,visibleSubtreeCount:s,childStart:l,childCount:a,childIdsFlat:d}=e;for(let p=t-1;p>=1;p-=1){if((o[p]&Uo)===0)continue;const g=l[p],v=a[p];let w=0,x=0;for(let I=0;I<v;I+=1){const S=d[g+I];w+=i[S],x+=s[S]}i[p]=1+w;let b;r&&v===1?b=(o[d[g]]&Uo)!==0?x:1+x:b=1+x,s[p]=b}const h=l[n],f=a[n];let c=0,m=0;for(let p=0;p<f;p+=1){const g=d[h+p];c+=i[g],m+=s[g]}i[n]=1+c,s[n]=m}function od(e){const{directories:t,nodes:n,options:r,rootId:o,presortedDirectoryNodeIds:i}=e.snapshot,s=r.flattenEmptyDirectories===!0,l=m=>{const p=n[m];if(p==null||!T(p))return;const g=t.get(m);if(g==null)throw new Error(`Unknown directory child index for node ${String(m)}`);const v=g.childIds,w=v.length;let x=0,b=0;for(let S=0;S<w;S++){const E=v[S];if(E==null)continue;const V=n[E];x+=V.subtreeNodeCount,b+=V.visibleSubtreeCount}g.totalChildSubtreeNodeCount=x,g.totalChildVisibleSubtreeCount=b,w>=128&&wt(n,g),p.subtreeNodeCount=1+x;let I;if(s&&w===1){const S=n[v[0]];I=S!=null&&T(S)?b:1+b}else I=1+b;p.visibleSubtreeCount=I};if(i!=null)for(let m=i.length-1;m>=0;m--)l(i[m]);else for(let m=n.length-1;m>=1;m--)l(m);const a=n[o],d=t.get(o);if(a==null||d==null)return;const h=d.childIds;let f=0,c=0;for(let m=0;m<h.length;m++){const p=h[m];if(p==null)continue;const g=n[p];f+=g.subtreeNodeCount,c+=g.visibleSubtreeCount}d.totalChildSubtreeNodeCount=f,d.totalChildVisibleSubtreeCount=c,wt(n,d),a.subtreeNodeCount=1+f,a.visibleSubtreeCount=c}function id(e){const{directories:t,nodes:n,rootId:r}=e.snapshot,o=nd(e.snapshot);rd(o);const i=o.subtreeNodeCount,s=o.visibleSubtreeCount;for(let l=0;l<n.length;l+=1){const a=n[l];a!=null&&(a.subtreeNodeCount=i[l],a.visibleSubtreeCount=s[l])}for(const[l,a]of t){const d=a.childIds,h=d.length;let f=0,c=0;for(let m=0;m<h;m++){const p=d[m];if(p==null)continue;const g=n[p];f+=g.subtreeNodeCount,c+=g.visibleSubtreeCount}a.totalChildSubtreeNodeCount=f,a.totalChildVisibleSubtreeCount=c,(l===r||h>=128)&&wt(n,a)}}function sd(e){return e.initialExpansion==="open"&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var ys=class bs{#e;constructor(t={}){const n=Tr(t),r=P(n,"store.builder.create",()=>new es(t));if(t.preparedInput!=null){const l=$c(t.preparedInput);l!=null?r.appendPresortedPaths(l,Uc(t.preparedInput)):r.appendPreparedPaths(jc(t.preparedInput),!1)}else{const l=t.paths??[];t.presorted===!0?r.appendPaths(l):r.appendPreparedPaths(P(n,"store.preparePathEntries",()=>Rr(l,t)))}const o=P(n,"store.builder.finish",()=>r.finish({skipSubtreeCountPass:!0})),i=P(n,"store.state.detectAllDirectoriesExpanded",()=>(t.initialExpansion??"closed")==="closed"&&r.didMatchAllInitialExpandedPaths());this.#e=P(n,"store.state.create",()=>Kc(o,i?"open":t.initialExpansion??"closed",n)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);const s=i?this.#e.snapshot.directories.size-1:P(n,"store.state.initializeExpandedPaths",()=>this.initializeExpandedPaths(t.initialExpandedPaths));i||sd(t)||(t.initialExpansion??"closed")==="closed"&&s===this.#e.snapshot.directories.size-1||(t.initialExpandedPaths?.length??0)>0&&P(n,"store.state.checkAllDirectoriesExpanded",()=>this.hasAllDirectoriesExpanded())?t.useSoaCountSweep===!0?P(n,"store.state.initializeOpenVisibleCountsViaSoa",()=>id(this.#e)):P(n,"store.state.initializeOpenVisibleCounts",()=>od(this.#e)):P(n,"store.state.recomputeCounts",()=>Vr(this.#e,this.#e.snapshot.rootId))}static preparePaths(t,n={}){return Hc(t,n)}static prepareInput(t,n={}){return qc(t,n)}static preparePresortedInput(t){return Oc(t)}list(t){return P(this.#e.instrumentation,"store.list",()=>rs(this.#e,t))}add(t){P(this.#e.instrumentation,"store.add",()=>{const n=me(this.#e);Ae(this.#e,we(this.#e,n,Ro(this.#e,t)))})}remove(t,n={}){P(this.#e.instrumentation,"store.remove",()=>{const r=me(this.#e);Ae(this.#e,we(this.#e,r,Vo(this.#e,t,n)))})}move(t,n,r={}){P(this.#e.instrumentation,"store.move",()=>{const o=me(this.#e),i=Lo(this.#e,t,n,r);i!=null&&Ae(this.#e,we(this.#e,o,i))})}batch(t){fu(this.#e,()=>{if(typeof t=="function"){t(this);return}for(const n of t)switch(n.type){case"add":this.add(n.path);break;case"remove":this.remove(n.path,{recursive:n.recursive});break;case"move":this.move(n.from,n.to,{collision:n.collision});break}})}getVisibleCount(){return P(this.#e.instrumentation,"store.getVisibleCount",()=>me(this.#e))}getVisibleSlice(t,n){return P(this.#e.instrumentation,"store.getVisibleSlice",()=>Wu(this.#e,t,n))}getVisibleRowContext(t){return P(this.#e.instrumentation,"store.getVisibleRowContext",()=>Ku(this.#e,t))}getVisibleTreeProjection(){return Gu(this.#e)}getVisibleTreeProjectionData(t){return ms(this.#e,t)}getVisibleIndex(t){return P(this.#e.instrumentation,"store.getVisibleIndex",()=>Yu(this.#e,t))}getPathInfo(t){return P(this.#e.instrumentation,"store.getPathInfo",()=>{const n=Ee(this.#e,t);if(n==null)return null;const r=D(this.#e,n);return{depth:ze(r),kind:T(r)?"directory":"file",path:W(this.#e,n)}})}isExpanded(t){return P(this.#e.instrumentation,"store.isExpanded",()=>{const n=this.requireDirectoryNodeId(t),r=D(this.#e,n);return be(this.#e,n,r)})}expand(t){P(this.#e.instrumentation,"store.expand",()=>{const n=me(this.#e),r=Xu(this.#e,t);r!=null&&Ae(this.#e,we(this.#e,n,r))})}collapse(t){P(this.#e.instrumentation,"store.collapse",()=>{const n=me(this.#e),r=Qu(this.#e,t);r!=null&&Ae(this.#e,we(this.#e,n,r))})}on(t,n){return tu(this.#e,t,n)}getDirectoryLoadState(t){const n=this.requireDirectoryNodeId(t);return nn(this.#e,n)}markDirectoryUnloaded(t){P(this.#e.instrumentation,"store.markDirectoryUnloaded",()=>{const n=this.requireDirectoryNodeId(t);if(G(this.#e,n).childIds.length>0)throw new Error(`Cannot mark a directory with known children as unloaded: "${t}"`);const r=me(this.#e);Xc(this.#e,n),Ae(this.#e,we(this.#e,r,lu({affectedAncestorIds:Re(this.#e,n),affectedNodeIds:[n],path:t,projectionChanged:this.isDirectoryProjectionVisible(n)})))})}beginChildLoad(t){return P(this.#e.instrumentation,"store.beginChildLoad",()=>{const n=this.requireDirectoryNodeId(t),r=me(this.#e),o=Yc(this.#e,n);return Ae(this.#e,we(this.#e,r,au({affectedAncestorIds:Re(this.#e,n),affectedNodeIds:[n],attemptId:o.attemptId,path:t,projectionChanged:this.isDirectoryProjectionVisible(n),reused:o.reused}))),o})}applyChildPatch(t,n){return P(this.#e.instrumentation,"store.applyChildPatch",()=>{const r=this.resolveActiveDirectoryNodeId(t.nodeId);if(r==null||nn(this.#e,r)!=="loading"||!Jc(this.#e,r,t.attemptId))return!1;const o=W(this.#e,r);this.validateChildPatch(o,n);const i=me(this.#e),s=[];for(const a of n.operations){ld(o,a);const d=me(this.#e);switch(a.type){case"add":s.push(we(this.#e,d,Ro(this.#e,a.path)));break;case"remove":s.push(we(this.#e,d,Vo(this.#e,a.path,{recursive:a.recursive})));break;case"move":{const h=Lo(this.#e,a.from,a.to,{collision:a.collision});h!=null&&s.push(we(this.#e,d,h));break}}}const l=s.some(a=>a.projectionChanged)||this.isDirectoryProjectionVisible(r);return Ae(this.#e,we(this.#e,i,cu({affectedAncestorIds:Re(this.#e,r),affectedNodeIds:[r],attemptId:t.attemptId,childEvents:s,path:W(this.#e,r),projectionChanged:l}))),!0})}completeChildLoad(t){return P(this.#e.instrumentation,"store.completeChildLoad",()=>{const n=this.resolveActiveDirectoryNodeId(t.nodeId);if(n==null)return!1;const r=me(this.#e),o=Qc(this.#e,n,t.attemptId);return Ae(this.#e,we(this.#e,r,uu({affectedAncestorIds:Re(this.#e,n),affectedNodeIds:[n],attemptId:t.attemptId,path:W(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!o}))),o})}failChildLoad(t,n){return P(this.#e.instrumentation,"store.failChildLoad",()=>{const r=this.resolveActiveDirectoryNodeId(t.nodeId);if(r==null)return!1;const o=me(this.#e),i=Zc(this.#e,r,t.attemptId,n);return Ae(this.#e,we(this.#e,o,du({affectedAncestorIds:Re(this.#e,r),affectedNodeIds:[r],attemptId:t.attemptId,errorMessage:n,path:W(this.#e,r),projectionChanged:this.isDirectoryProjectionVisible(r),stale:!i}))),i})}cleanup(t={}){return P(this.#e.instrumentation,"store.cleanup",()=>{if(this.#e.transactionStack.length>0)throw new Error("Cleanup cannot run during an open batch or transaction.");if(Hu(this.#e))throw new Error("Cleanup cannot run while directory loads are active.");const n=me(this.#e),r=qu(this.#e,t.mode??"stable");return Ae(this.#e,we(this.#e,n,hu({...r,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:r.idsPreserved===!1}))),r})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(t){if(t==null||t.length===0)return 0;let n=0;const r=[],o=[];let i=0,s=null;const l=this.#e.snapshot.segmentTable,a=l.valueById,d=this.#e.snapshot.nodes,h=new Map;for(const f of t){s!=null&&f<s&&(s=null,i=0,r.length=0,o.length=0);const c=f.length>0&&f.charCodeAt(f.length-1)===47?f.length-1:f.length;if(c===0){s=f,i=c,r.length=0,o.length=0;continue}let m=0,p=0;if(s!=null){const b=Math.min(c,i);let I=!0;for(let S=0;S<b;S+=1){const E=f.charCodeAt(S);if(E!==s.charCodeAt(S)){I=!1;break}E===47&&(m+=1,p=S+1)}I&&(b===i&&c>b&&f.charCodeAt(b)===47?(m+=1,p=b+1):b===c&&i>b&&s.charCodeAt(b)===47&&(m+=1,p=c+1)),m=Math.min(m,o.length)}let g=m===0?this.#e.snapshot.rootId:o[m-1]??this.#e.snapshot.rootId,v=m,w=!0,x=p;for(;x<=c;){const b=f.indexOf("/",x),I=b===-1||b>c?c:b,S=f.slice(x,I),E=G(this.#e,g).childIds,V=v===m?r[v]??0:0;let de=V,Y;const fe=h.get(S)??ln(S);h.set(S,fe);const Q=(ne,ce)=>{for(de=ne;de<ce;de+=1){const re=E[de],De=d[re],j=a[De.nameId];if(j===S)return Y=re,!0;const se=Nr(fr(l,De.nameId),fe);if(se>0||se===0&&j>S)return!1}return!1};if(!Q(V,E.length)&&V>0&&Q(0,V),Y===void 0){w=!1;break}if(!T(D(this.#e,Y))){w=!1;break}if(r[v]=de,o[v]=Y,g=Y,v+=1,I===c)break;x=I+1}if(s=f,i=c,r.length=v,o.length=v,!w){s=null,i=0,r.length=0,o.length=0;continue}for(let b=m;b<v;b+=1){const I=o[b];if(I==null)continue;const S=D(this.#e,I);be(this.#e,I,S)||(tn(this.#e,I,!0,S),n+=1)}}return n}hasAllDirectoriesExpanded(){for(const t of this.#e.snapshot.directories.keys()){if(t===this.#e.snapshot.rootId)continue;const n=D(this.#e,t);if(!be(this.#e,t,n))return!1}return!0}requireDirectoryNodeId(t){const n=Ee(this.#e,t);if(n==null)throw new Error(`Path does not exist: "${t}"`);if(!T(D(this.#e,n)))throw new Error(`Path is not a directory: "${t}"`);return n}resolveActiveDirectoryNodeId(t){try{if(!T(D(this.#e,t)))throw new Error(`Node is not a directory: ${String(t)}`);return t}catch{return null}}isDirectoryProjectionVisible(t){let n=t;for(;n!==this.#e.snapshot.rootId;){const r=D(this.#e,n).parentId;if(r!==this.#e.snapshot.rootId){const o=D(this.#e,r),i=kt(this.#e,r);if(!be(this.#e,r,o)&&i!==n)return!1}n=r}return!0}validateChildPatch(t,n){new bs({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function ld(e,t){switch(t.type){case"add":case"remove":if(!t.path.startsWith(e)||t.path===e)throw new Error(`Child patch operation must stay within ${e}: "${t.path}"`);break;case"move":if(!t.from.startsWith(e)||!t.to.startsWith(e)||t.from===e||t.to===e)throw new Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`);break}}const ad=e=>e.startsWith("f::")?e.slice(3):e;function cd(e){const t=e.lastIndexOf("/");return t<0?{parentPath:"",baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function ud(e,t){return e===""?t:`${e}/${t}`}function dd({files:e,path:t,isFolder:n,nextBasename:r}){const o=ad(t),i=r.trim();if(i.length===0)return{error:"Name cannot be empty."};if(i.includes("/"))return{error:'Name cannot include "/".'};const{parentPath:s,baseName:l}=cd(o);if(i===l)return{nextFiles:e,sourcePath:o,destinationPath:o,isFolder:n};const a=ud(s,i),d=new Array(e.length),h=new Set;if(!n){const p=`${a}/`;let g=!1;for(let v=0;v<e.length;v++){const w=e[v];if(w!==o&&w.startsWith(p))return{error:`"${a}" already exists.`};const x=w===o?a:w;if(h.has(x))return{error:`"${a}" already exists.`};h.add(x),d[v]=x,w===o&&(g=!0)}return g?{nextFiles:d,sourcePath:o,destinationPath:a,isFolder:n}:{error:"Could not find the selected file to rename."}}const f=`${o}/`,c=`${a}/`;let m=0;for(let p=0;p<e.length;p++){const g=e[p],v=g===o||g.startsWith(f);if(!v&&(g===a||g.startsWith(c)))return{error:`"${a}" already exists.`};const w=v?`${a}${g.slice(o.length)}`:g;if(h.has(w))return{error:`"${a}" already exists.`};h.add(w),d[p]=w,v&&m++}return m===0?{error:"Could not find the selected folder to rename."}:{nextFiles:d,sourcePath:o,destinationPath:a,isFolder:n}}function hd(e){return e.endsWith("/")}function fd(e){const t=e.endsWith("/")?e.slice(0,-1):e,n=t.lastIndexOf("/"),r=n<0?t:t.slice(n+1);return e.endsWith("/")?`${r}/`:r}function pd(e){const t=[],n=new Set;for(const o of e)n.has(o)||(n.add(o),t.push(o));const r=new Set;for(const o of t.toSorted((i,s)=>i.length!==s.length?i.length-s.length:i.localeCompare(s))){const i=(o.endsWith("/")?o.slice(0,-1):o).split("/");let s=!1;for(let l=0;l<i.length-1;l+=1){const a=`${i.slice(0,l+1).join("/")}/`;if(r.has(a)){s=!0;break}}s||r.add(o)}return t.filter(o=>r.has(o))}function md(e,t){return t.includes(e)?pd(t):[e]}function gd(e,t){return e===t?!0:e==null||t==null?!1:e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function Ko(e,t){return{draggedPaths:e,target:t}}function Wo(e,t){if(t.kind!=="directory"||t.directoryPath==null)return!1;for(const n of e)if(hd(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function vd(e,t){return t.kind==="root"||t.directoryPath==null?fd(e):t.directoryPath}function yd(e,t){const n=e.map(r=>{const o=vd(r,t);return o===r?null:{from:r,to:o,type:"move"}}).filter(r=>r!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?"move":"batch",target:t}}}function bd(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function Go(e,t,n){const{paths:r,preparedInput:o}=e;if(o==null){if(r==null)throw new Error("FileTree requires paths or preparedInput");return{paths:r,preparedInput:void 0}}const i=o.paths;if(r==null)return{paths:i,preparedInput:o};if(!bd(ys.preparePaths(r,n==null?{}:{sort:n}),i))throw new Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:i,preparedInput:o}}function Yo(e){return e.operation==="add"||e.operation==="remove"||e.operation==="move"||e.operation==="batch"}function Id(e,t,n){if(e===t)return n;const r=t.endsWith("/")?t:`${t}/`;return e.startsWith(r)?`${n.endsWith("/")?n:`${n}/`}${e.slice(r.length)}`:e}function xd(e,t){if(e===t)return!0;const n=t.endsWith("/")?t:`${t}/`;return e.startsWith(n)}function Qt(e,t,n=!1){if(e==null)return null;switch(t.operation){case"add":case"expand":case"collapse":case"mark-directory-unloaded":case"begin-child-load":case"apply-child-patch":case"complete-child-load":case"fail-child-load":case"cleanup":return e;case"remove":return xd(e,t.path)?n?e:null:e;case"move":return Id(e,t.from,t.to);case"batch":{let r=e;for(const o of t.events)if(r=Qt(r,o,n),r==null)return null;return r}}}function Dn(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function Is(e){switch(e.operation){case"add":return{...Dn(e),operation:"add",path:e.path};case"remove":return{...Dn(e),operation:"remove",path:e.path,recursive:e.recursive};case"move":return{...Dn(e),from:e.from,operation:"move",to:e.to}}}function wd(e){return{...Dn(e),events:e.events.filter(t=>t.operation==="add"||t.operation==="remove"||t.operation==="move").map(t=>Is(t)),operation:"batch"}}function Sd(e){switch(e.operation){case"add":case"remove":case"move":return Is(e);case"batch":return wd(e);default:return null}}function or(e,t){if(e.size!==t.length)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function Xe(e){const t=e.endsWith("/")?e.slice(0,-1):e;if(t.length===0)return[];const n=t.split("/");return n.slice(0,-1).map((r,o)=>`${n.slice(0,o+1).join("/")}/`)}function ir(e){return Xe(e).at(-1)??null}function Xo(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function Cn(e){return e.endsWith("/")}const Qo=e=>e.toLowerCase();function Cd(e){const t=e.endsWith("/")?e.slice(0,-1):e,n=t.lastIndexOf("/");return n<0?t:t.slice(n+1)}function Jo(e){return e.endsWith("/")?e.slice(0,-1):e}function Zo(e,t){return t&&!e.endsWith("/")?`${e}/`:e}const _d=e=>{const t=e.trim();return t.length===0?"":(t.includes("\\")?t.replaceAll("\\","/"):t).toLowerCase()},xs=Symbol("FILE_TREE_RENAME_VIEW"),kd=512,Pd=512;function Ed(e){return e==="top"||e==="center"?e:"nearest"}function Dd(e,t,n){if(e===0)return-1;if(n!=null){const r=t(n);if(r!=null)return r;const o=Xe(n);for(let i=o.length-1;i>=0;i-=1){const s=o[i];if(s==null)continue;const l=t(s);if(l!=null)return l}}return 0}function Md(e,t,n){if(e.paths.length===0)return{focusedIndex:-1,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};if(t==null)return{focusedIndex:0,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};const r=n??(o=>e.visibleIndexByPath.get(o)??null);return{focusedIndex:Dd(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var Td=class ws{static{Object.defineProperty(ws.prototype,xs,{configurable:!0,value(){return{cancel:()=>{this.#ke()},commit:()=>{this.#Pe()},getPath:()=>this.#s,getValue:()=>this.#g,isActive:()=>this.#s!=null,setValue:t=>{this.#Ee(t)}}},writable:!0})}#e;#t=new Set;#c=new Map;#u=null;#l=null;#z=new Map;#H=new Map;#v=-1;#r=null;#y=!1;#E=t=>-1;#b=new Map;#m=null;#h=null;#I=null;#x=null;#f=null;#q;#O;#R;#o=[];#j=new Int32Array(0);#$=new Int32Array(0);#J=void 0;#D=!1;#s=null;#g="";#M=!1;#_=new Set;#U=[];#K;#W=null;#a=null;#V=null;#N=null;#C=null;#L=null;#Z=null;#_e=0;#w=null;#i=new Set;#G=0;#n;#ne=0;#re=!1;#p=0;#Y;constructor(t){const{dragAndDrop:n,fileTreeSearchMode:r,initialSearchQuery:o,initialSelectedPaths:i,renaming:s,onSearchChange:l,paths:a,preparedInput:d,...h}=t,f=Go({paths:a,preparedInput:d},"constructor",h.sort);this.#e=h,n!=null&&n!==!1&&(this.#u=n===!0?{}:n),this.#D=s!=null&&s!==!1,s!=null&&s!==!1&&s!==!0&&(this.#J=s.canRename,this.#O=s.onError,this.#q=s.onRename),this.#R=l,this.#K=r??"hide-non-matches",this.#n=this.#ie(f.paths,f.preparedInput);const c=i?.map(p=>this.#A(p)).filter(p=>p!=null)??[],m=c.at(-1)??null;c.length>0&&(this.#i=new Set(c),this.#w=m,this.#G=1),this.#B(m,!1),o!=null&&this.#X(o,!1),this.#Y=this.#Se()}destroy(){this.#Y?.(),this.#Y=null,this.#c.clear(),this.#t.clear(),this.#b.clear(),this.#l=null,this.#le()}focusFirstItem(){this.#k().length>0&&this.#P(0)}focusLastItem(){this.#p<=0||(this.#T(),this.#P(this.#p-1))}focusNextItem(){this.#we(1)}focusParentItem(){if(this.#r==null)return;const t=ir(this.#r);if(t==null)return;const n=this.#F(t);n>=0&&this.#P(n)}focusPath(t){const n=this.#n.getPathInfo(t)?.path??null;if(n==null)return;this.#T();const r=this.#F(n);r>=0&&this.#P(r)}scrollToPath(t,n){const r=this.#n.getPathInfo(t)?.path??null;if(r==null)return;this.#T();const o=this.#Be(r);o<0||this.#ae(o)!=null&&(n?.focus!==!1&&this.#P(o,!1),this.#Z={id:this.#_e+=1,offset:Ed(n?.offset),visibleIndex:o},this.#d())}focusMountedPathFromInput(t){const n=this.#n.getPathInfo(t)?.path??null;if(n==null)return;const r=this.#F(n);r>=0&&this.#P(r)}focusNearestPath(t){const n=this.resolveNearestVisiblePath(t);if(n==null)return null;const r=this.#F(n);return r>=0?(this.#P(r),this.#k()[r]??n):null}focusPreviousItem(){this.#we(-1)}getFocusedIndex(){return this.#v}getFocusedItem(){return this.#r==null?null:this.#ce(this.#r)}getFocusedPath(){return this.#r}getScrollRequest(){return this.#Z}clearScrollRequest(t){this.#Z?.id===t&&(this.#Z=null)}resolveNearestVisiblePath(t){const n=this.#k();if(this.#p===0)return null;if(t==null)return this.#r??n[0]??null;const r=this.#n.getPathInfo(t)?.path??t,o=this.#F(r);if(o>=0)return n[o]??r;const i=this.#De(r);return i??this.#r??n[0]??null}getSelectedPaths(){return[...this.#i]}getSelectionVersion(){return this.#G}getVisibleCount(){return this.#p}getVisibleRows(t,n){if(n<t||this.#p===0)return[];const r=Math.max(0,t),o=Math.min(this.#p-1,n);if(o<r)return[];const i=o-r+1;if(this.#C==null&&!this.#y&&o>=this.#o.length&&i<=Pd){const s=[];for(let l=r;l<=o;l+=1){const a=this.#n.getVisibleRowContext(l);if(a==null)break;s.push(this.#ue(a))}return s}if(!this.#y&&o>=this.#o.length&&this.#T(),this.#C!=null){const s=Array.from({length:o-r+1},(h,f)=>this.#ve(r+f)),l=new Map;let a=s[0]??-1,d=a;for(let h=1;h<=s.length;h+=1){const f=s[h];if(f!=null&&f===d+1){d=f;continue}if(a>=0&&this.#n.getVisibleSlice(a,d).forEach((c,m)=>{l.set(a+m,c)}),f==null){a=-1,d=-1;continue}a=f,d=f}return Array.from({length:o-r+1},(h,f)=>{const c=r+f,m=this.#ve(c),p=l.get(m),g=this.#o[m];if(p==null||g==null)throw new Error(`Missing projection row for filtered visible index ${String(c)}`);return this.#oe(p,c,m,{ancestorPaths:this.#fe(m),path:g})})}return this.#n.getVisibleSlice(r,o).map((s,l)=>{const a=r+l,d=this.#o[a];if(d==null)throw new Error(`Missing projection path for visible index ${String(a)}`);return this.#oe(s,a,a,{ancestorPaths:this.#fe(a),path:d})})}getStickyRowCandidates(t,n){if(this.#C!=null)return null;if(this.#p===0||t<=0||n<=0)return[];const r=[];for(let o=0;o<this.#p;o+=1){const i=t+o*n,s=Math.min(this.#p-1,Math.floor(i/n)),l=this.#de(s,o)??(s>0?this.#de(s-1,o):void 0);if(l==null)break;r.push({row:this.#ue(l),subtreeEndIndex:l.subtreeEndIndex})}return r}getItem(t){const n=this.#n.getPathInfo(t);return n==null?null:this.#ce(n.path,n)}resolveMountedDirectoryPathFromInput(t){const n=this.#n.getPathInfo(t);return n?.kind==="directory"?n.path:null}toggleMountedDirectoryFromInput(t){const n=this.resolveMountedDirectoryPathFromInput(t);n!=null&&this.#Ce(n)}selectAllVisiblePaths(){this.#T();const t=[...this.#k()];this.#S(t,this.#r??this.#w)}selectOnlyPath(t){const n=this.#A(t);n!=null&&this.#S([n],n)}selectOnlyMountedPathFromInput(t){this.#S([t],t)}selectPath(t){const n=this.#A(t);n==null||this.#i.has(n)||this.#S([...this.#i,n])}deselectPath(t){const n=this.#A(t);n==null||!this.#i.has(n)||this.#S([...this.#i].filter(r=>r!==n))}toggleFocusedSelection(){this.#r!=null&&this.togglePathSelectionFromInput(this.#r)}togglePathSelection(t){const n=this.#A(t);if(n!=null){if(this.#i.has(n)){this.deselectPath(n);return}this.selectPath(n)}}togglePathSelectionFromInput(t){const n=this.#A(t);if(n!=null){if(this.#i.has(n)){this.#S([...this.#i].filter(r=>r!==n),n);return}this.#S([...this.#i,n],n)}}selectPathRange(t,n){const r=this.#A(t);if(r==null)return;this.#T();const o=this.#w,i=o==null?-1:this.#te(o),s=this.#te(r);if(i===-1||s===-1){const f=n?[...this.#i,r]:[r];this.#S(f,r);return}const[l,a]=i<=s?[i,s]:[s,i],d=this.#k().slice(l,a+1),h=n?[...this.#i,...d]:d;this.#S(h,o)}extendSelectionFromFocused(t){if(this.#r==null)return;const n=this.#v;if(n===-1)return;const r=Math.min(this.#p-1,Math.max(0,n+t));if(r===n)return;!this.#y&&r>=this.#o.length&&this.#T();const o=this.#k(),i=o[n]??null,s=o[r]??null;if(i==null||s==null)return;const l=new Set(this.#i);l.has(i)&&l.has(s)?l.delete(i):l.add(s),this.#S([...l],this.#w??i,!1),this.#P(r)}getDragAndDropConfig(){return this.#u}isDragAndDropEnabled(){return this.#u!=null}getDragSession(){return this.#l==null?null:{draggedPaths:[...this.#l.draggedPaths],primaryPath:this.#l.primaryPath,target:this.#l.target==null?null:{...this.#l.target}}}startDrag(t){if(this.#u==null)return!1;const n=this.#A(t);if(n==null||this.#a!=null&&this.#a.length>0)return!1;const r=this.getSelectedPaths(),o=md(n,r);return this.#u.canDrag?.(o)===!1?!1:(r.includes(n)||this.#S([n],n,!1),this.#Q(n),this.#l={draggedPaths:o,primaryPath:n,target:null},this.#d(),!0)}setDragTarget(t){const n=this.#l;if(n==null)return;let r=t;if(r!=null){const o=Ko(n.draggedPaths,r);(Wo(n.draggedPaths,r)||this.#u?.canDrop?.(o)===!1)&&(r=null)}gd(n.target,r)||(this.#l={...n,target:r},this.#d())}cancelDrag(){this.#l!=null&&(this.#l=null,this.#d())}completeDrag(){const t=this.#l;if(t==null)return!1;this.#l=null;const n=t.target==null?null:{...t.target};if(n==null)return this.#d(),!1;const r=Ko(t.draggedPaths,n);if(Wo(t.draggedPaths,n)||this.#u?.canDrop?.(r)===!1)return this.#d(),!1;const o=yd(t.draggedPaths,n);if(o==null)return this.#d(),!1;try{if(o.operations.length===1){const i=o.operations[0];if(i==null||i.type!=="move")throw new Error("Expected a single move operation for one-item drops");this.#n.move(i.from,i.to,{collision:i.collision})}else this.#Ne(o.operations),this.#n.batch(o.operations)}catch(i){return this.#d(),this.#u?.onDropError?.(i instanceof Error?i.message:String(i),r),!1}return this.#u?.onDropComplete?.(o.result),!0}subscribe(t){return this.#t.add(t),t(),()=>{this.#t.delete(t)}}add(t){this.#n.add(t)}remove(t,n={}){this.#n.remove(t,n)}move(t,n,r={}){this.#n.move(t,n,r)}batch(t){this.#n.batch(t)}onMutation(t,n){const r=t,o=n;let i=this.#c.get(r);return i==null&&(i=new Set,this.#c.set(r,i)),i.add(o),()=>{const s=this.#c.get(r);s?.delete(o),s?.size===0&&this.#c.delete(r)}}setSearch(t){this.#X(t,!0)}openSearch(t=""){this.#X(t,!0)}closeSearch(){this.#X(null,!0)}isSearchOpen(){return this.#a!==null}getSearchValue(){return this.#a??""}getSearchMatchingPaths(){return this.#U}focusNextSearchMatch(){this.#ye(1)}focusPreviousSearchMatch(){this.#ye(-1)}startRenaming(t=this.#r??"",n={}){if(!this.#D)return!1;const r=this.#n.getPathInfo(t);if(r==null)return!1;const o=r.path,i=Cn(o),s=Jo(o);if(this.#J?.({isFolder:i,path:s})===!1)return!1;for(const l of Xe(o))this.#n.isExpanded(l)||this.#n.expand(l);return this.#S([o],o,!1),this.#a!=null&&(this.#X(null,!1),this.#R?.(this.#a)),this.#Q(o),this.#s=o,this.#g=Cd(o),this.#M=n.removeIfCanceled??!1,this.#d(),!0}#ke(){if(this.#s==null)return;const t=this.#s,n=this.#M;if(this.#s=null,this.#g="",this.#M=!1,n){this.remove(t,Cn(t)?{recursive:!0}:void 0);return}this.#Q(t),this.#d()}#Pe(){const t=this.#s;if(t==null)return;if(this.#M&&this.#g.trim().length===0){this.#s=null,this.#g="",this.#M=!1,this.remove(t,Cn(t)?{recursive:!0}:void 0);return}const n=Cn(t),r=dd({files:this.#n.list(),isFolder:n,nextBasename:this.#g,path:Jo(t)});if(this.#s=null,this.#g="",this.#M=!1,"error"in r){this.#Q(t),this.#O?.(r.error),this.#d();return}if(r.sourcePath===r.destinationPath){this.#Q(t),this.#d();return}this.#q?.({destinationPath:r.destinationPath,isFolder:r.isFolder,sourcePath:r.sourcePath}),this.move(Zo(r.sourcePath,n),Zo(r.destinationPath,n))}#Ee(t){this.#s==null||this.#g===t||(this.#g=t,this.#d())}resetPaths(t,n={}){const r=!Array.isArray(t),o=r?void 0:t,i=r?t:n,s=this.#n.list().length,l=this.#p,a=Go({paths:o,preparedInput:i.preparedInput},"resetPaths",this.#e.sort),d=this.#ie(a.paths,a.preparedInput,i.initialExpandedPaths),h=this.#r,f=this.#s,c=this.getSelectedPaths(),m=this.#w;this.#Y?.(),this.#n=d,this.#b.clear(),this.#le();const p=c.map(v=>d.getPathInfo(v)?.path??null).filter(v=>v!=null),g=!or(this.#i,p);this.#i=new Set(p),g&&(this.#G+=1),this.#w=m==null?null:d.getPathInfo(m)?.path??null,this.#s=f==null?null:d.getPathInfo(f)?.path??null,this.#s==null&&(this.#g="",this.#M=!1),this.#B(h,h!=null||p.length>0||this.#w!=null),this.#Y=this.#Se(),this.#d(),this.#Ie({canonicalChanged:!0,operation:"reset",pathCountAfter:a.paths.length,pathCountBefore:s,projectionChanged:!0,usedPreparedInput:i.preparedInput!=null,visibleCountDelta:this.#p-l})}#De(t){this.#T();const n=ir(t),r=Xo(t,n);let o=null,i=null;for(const s of this.#k()){if(ir(s)!==n)continue;const l=Xo(s,n);if(l<r){o=s;continue}if(l>r){i=s;break}}return o??i}#F(t){const n=this.#te(t);if(n!==-1)return n;const r=Xe(t);for(let o=r.length-1;o>=0;o-=1){const i=r[o];if(i==null)continue;const s=this.#te(i);if(s!==-1)return s}return this.#k().length>0?0:-1}#ce(t,n){const r=this.#b.get(t);if(r!=null)return r;const o=n??this.#n.getPathInfo(t);if(o==null)return null;const i=o.kind==="directory"?this.#Me(o.path):this.#Te(o.path);return this.#b.set(o.path,i),i}#oe(t,n,r,o){return{ancestorPaths:o.ancestorPaths,depth:t.depth,flattenedSegments:t.flattenedSegments?.map(i=>({isTerminal:i.isTerminal,name:i.name,path:i.path})),hasChildren:t.hasChildren,index:n,isExpanded:t.isExpanded,isFlattened:t.isFlattened,isFocused:o.path===this.#r,isSelected:this.#i.has(o.path),kind:t.kind,level:t.depth,name:t.name,path:o.path,posInSet:o.posInSet??this.#j[r]??0,setSize:o.setSize??this.#$[r]??0}}#ue(t){return this.#oe(t.row,t.index,t.index,{ancestorPaths:t.ancestorPaths,path:t.row.path,posInSet:t.posInSet,setSize:t.setSize})}#de(t,n){const r=this.#n.getVisibleRowContext(t);if(r==null)return;const o=r.ancestorRows[n];return o??(n===r.ancestorRows.length&&r.row.kind==="directory"&&r.row.isExpanded?r:void 0)}#he(t){const n=this.#z.get(t);if(n!=null)return n;const r=this.#E(t),o=r<0?[]:[...this.#he(r),r];return this.#z.set(t,o),o}#fe(t){const n=this.#H.get(t);if(n!=null)return n;const r=this.#he(t).map(o=>this.#o[o]??"").filter(o=>o!=="");return this.#H.set(t,r),r}#pe(t){this.#n.collapse(t)}#S(t,n=this.#w,r=!0){const o=[...new Set(t)],i=!or(this.#i,o),s=this.#w!==n;!i&&!s||(this.#i=new Set(o),this.#w=n,i&&(this.#G+=1),r&&this.#d())}#Me(t){return{collapse:()=>{this.#pe(t)},deselect:()=>{this.deselectPath(t)},expand:()=>{this.#xe(t)},focus:()=>{this.focusPath(t)},getPath:()=>t,isDirectory:()=>!0,isExpanded:()=>this.#n.isExpanded(t),isFocused:()=>this.#r===t,isSelected:()=>this.#i.has(t),select:()=>{this.selectPath(t)},toggleSelect:()=>{this.togglePathSelection(t)},toggle:()=>{this.#Ce(t)}}}#Te(t){return{deselect:()=>{this.deselectPath(t)},focus:()=>{this.focusPath(t)},getPath:()=>t,isDirectory:()=>!1,isFocused:()=>this.#r===t,isSelected:()=>this.#i.has(t),select:()=>{this.selectPath(t)},toggleSelect:()=>{this.togglePathSelection(t)}}}#Ne(t){const n=this.#n.list();this.#ie(n).batch(t)}#ie(t,n,r){return new ys({...this.#e,paths:t,preparedInput:n??void 0,...r!==void 0?{initialExpandedPaths:r}:{}})}#se(){return this.#x!=null?this.#x:(this.#x=this.#n.list(),this.#x)}#Ae(){if(this.#I!=null)return this.#I;const t=new Set;for(const n of this.#se()){t.add(n);for(const r of Xe(n))t.add(r)}return this.#I=[...t].sort(),this.#I}#Re(){return this.#f!=null?this.#f:(this.#f=this.#se().map(Qo),this.#f)}#ee(){return this.#m!=null?this.#m:(this.#m=this.#Ae().filter(t=>t.endsWith("/")),this.#m)}#Ve(){return this.#h!=null?this.#h:(this.#h=this.#ee().map(Qo),this.#h)}#le(){this.#m=null,this.#h=null,this.#I=null,this.#x=null,this.#f=null}#Le(){return this.#ee().filter(t=>this.#n.isExpanded(t))}#me(t){const n=new Set(this.#W??[]);if(t)for(const r of this.#i)for(const o of Xe(r))n.add(o);this.#ge(n)}#ge(t){this.#re=!0;try{for(const n of this.#ee()){const r=t.has(n),o=this.#n.isExpanded(n);r&&!o?this.#n.expand(n):!r&&o&&this.#n.collapse(n)}}finally{this.#re=!1}}#Fe(){if(this.#a==null||this.#a.length===0){this.#U=[],this.#C=null,this.#L=null,this.#N=null,this.#p=this.#ne;return}const t=this.#o;if(this.#U=t.filter(i=>this.#_.has(i)),this.#K!=="hide-non-matches"||this.#_.size===0){this.#C=null,this.#L=null,this.#N=null,this.#p=this.#ne;return}const n=[],r=[],o=new Map;for(const[i,s]of t.entries())this.#V?.has(s)===!0&&(o.set(s,r.length),n.push(i),r.push(s));this.#C=n,this.#L=r,this.#N=o,this.#p=r.length}#k(){return this.#L??this.#o}#Be(t){return this.#L!=null?this.#N?.get(t)??-1:this.#n.getVisibleIndex(t)??-1}#ve(t){return this.#C?.[t]??t}#te(t){const n=this.#N?.get(t);return n??this.#n.getVisibleIndex(t)??-1}#ye(t){const n=this.#U;if(n.length===0)return;const r=this.#r,o=r==null?-1:n.indexOf(r),i=n[o<0?t>0?0:n.length-1:Math.min(n.length-1,Math.max(0,o+t))];i!=null&&this.focusPath(i)}#X(t,n){const r=t==null?null:_d(t),o=this.#a;if(o!==r){if(o==null&&r!=null&&(this.#W=this.#Le()),this.#a=r,r==null)this.#me(!0),this.#W=null,this.#_.clear(),this.#V=null,this.#B(this.#r,!0);else if(r.length===0)this.#me(!1),this.#_.clear(),this.#V=null,this.#B(this.#r,!0);else{const i=this.#be();this.#B(i,!0)}n&&(this.#R?.(this.#a),this.#d())}}#be(){if(this.#a==null||this.#a.length===0)return this.#_.clear(),this.#r;const t=this.#a,n=this.#se(),r=this.#Re(),o=[],i=new Set;let s=null;for(let f=0;f<n.length;f+=1){if(!r[f].includes(t))continue;const c=n[f];o.push(c),i.add(c),s??=c}const l=this.#ee(),a=this.#Ve();for(let f=0;f<l.length;f+=1){if(!a[f].includes(t))continue;const c=l[f];i.has(c)||(o.push(c),i.add(c),s??=c)}this.#_=i;const d=this.#K==="hide-non-matches"&&o.length>0?new Set:null;this.#V=d;const h=this.#K==="expand-matches"?new Set(this.#W??[]):new Set;for(const f of o){d?.add(f),f.endsWith("/")&&h.add(f);for(const c of Xe(f))h.add(c),d?.add(c)}return this.#ge(h),s??this.#r}#d(){for(const t of this.#t)t()}#Ie(t){this.#c.get(t.operation)?.forEach(n=>{n(t)}),this.#c.get("*")?.forEach(n=>{n(t)})}#xe(t){for(const n of Xe(t))this.#n.isExpanded(n)||this.#n.expand(n);this.#n.isExpanded(t)||this.#n.expand(t)}#we(t){const n=this.#p;if(n===0)return;const r=this.#v===-1?0:this.#v,o=Math.min(n-1,Math.max(0,r+t));(o!==r||this.#v===-1)&&(!this.#y&&this.#C==null&&o>=this.#o.length&&this.#T(),this.#P(o))}#B(t,n=!0){const r=this.#n.getVisibleCount();this.#ne=r;const o=Md(this.#n.getVisibleTreeProjectionData(n?void 0:Math.min(r,kd)),t,n?i=>this.#n.getVisibleIndex(i):void 0);this.#z.clear(),this.#H.clear(),this.#y=o.paths.length>=r,this.#E=o.getParentIndex,this.#o=o.paths,this.#j=o.posInSetByIndex,this.#$=o.setSizeByIndex,this.#Fe(),this.#v=t==null?this.#k().length>0?0:-1:this.#F(t),this.#r=this.#v<0?null:this.#ae(this.#v)}#ae(t){const n=this.#k()[t];return n??(this.#C!=null?null:this.#n.getVisibleRowContext(t)?.row.path??null)}#A(t){return this.#n.getPathInfo(t)?.path??null}#Q(t){if(t==null)return;const n=this.#F(t);n>=0&&this.#P(n,!1)}#P(t,n=!0){const r=this.#ae(t);r!=null&&(this.#v===t&&this.#r===r||(this.#v=t,this.#r=r,n&&this.#d()))}#T(){this.#y||this.#B(this.#r,!0)}#ze(t){const n=Qt(this.#s,t);n==null&&this.#s!=null&&(this.#g=""),this.#s=n;const r=Qt(this.#r,t,!0),o=[...this.#i].map(a=>Qt(a,t)).filter(a=>a!=null).map(a=>this.#n.getPathInfo(a)?.path??null).filter(a=>a!=null),i=Qt(this.#w,t),s=i==null?null:this.#n.getPathInfo(i)?.path??null,l=[...new Set(o)];return or(this.#i,l)||(this.#i=new Set(l),this.#G+=1),this.#w=s,r}#Se(){return this.#n.on("*",t=>{if(this.#re)return;t.canonicalChanged&&(this.#b.clear(),this.#le()),this.#l!=null&&Yo(t)&&(this.#l=null);const n=Yo(t)?this.#ze(t):this.#r,r=this.#a!=null&&this.#a.length>0?this.#be():this.#a===""?this.#r:n,o=this.#a!=null||t.operation!=="expand"&&t.operation!=="collapse";this.#B(r,o),this.#d();const i=Sd(t);i!=null&&this.#Ie(i)})}#Ce(t){if(this.#n.isExpanded(t)){this.#pe(t);return}this.#xe(t)}};const Nd=e=>{if(e==null||e.length===0)return"0";let t=`${e.length}`;for(const n of e)t+=`\0${n.path}\0${n.status}`;return t};function Ad(e){const t=e.endsWith("/");let n="",r=-1;for(let o=0;o<=e.length;o+=1){if(!(e[o]==="/"||o===e.length)){r===-1&&(r=o);continue}r!==-1&&(n!==""&&(n+="/"),n+=e.slice(r,o),r=-1)}return n===""?null:{isDirectory:t,path:n}}function Ss(e){const t=e.endsWith("/")?e.slice(0,-1):e;if(t.length===0)return[];const n=[];let r=0;for(;;){const o=t.indexOf("/",r);if(o===-1)break;n.push(t.slice(0,o+1)),r=o+1}return n}function Rd(e,t){return t?`${e}/`:e}function ei(e,t=null){const n=Nd(e==null?void 0:[...e]);if(n==="0")return null;if(t?.signature===n)return t;const r=new Map,o=new Set,i=new Set,s=new Map;for(const l of e??[]){const a=Cs(l);a!=null&&ks({canonicalPath:a.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:o,ignoredDirectoryPaths:i,isDirectory:a.isDirectory,status:l.status,statusByPath:r})}return r.size===0?null:{changeCountByDirectoryPath:s,directoriesWithChanges:o,ignoredDirectoryPaths:i,signature:n,statusByPath:r}}function Vd(e,t){const n=t?.remove??[],r=t?.set??[];if(n.length===0&&r.length===0)return e;const o=new Map(e?.statusByPath),i=new Set(e?.directoriesWithChanges),s=new Set(e?.ignoredDirectoryPaths),l=new Map(e?.changeCountByDirectoryPath);let a=!1;for(const d of n){const h=_s(d);h!=null&&(a=Ld({canonicalPath:h.canonicalPath,changeCountByDirectoryPath:l,directoriesWithChanges:i,ignoredDirectoryPaths:s,statusByPath:o})||a)}for(const d of r){const h=Cs(d);h!=null&&(a=ks({canonicalPath:h.canonicalPath,changeCountByDirectoryPath:l,directoriesWithChanges:i,ignoredDirectoryPaths:s,isDirectory:h.isDirectory,status:d.status,statusByPath:o})||a)}return a?o.size===0?null:{changeCountByDirectoryPath:l,directoriesWithChanges:i,ignoredDirectoryPaths:s,signature:zd(o),statusByPath:o}:e}function Cs(e){return _s(e.path)}function _s(e){const t=Ad(e);if(t!=null)return{canonicalPath:Rd(t.path,t.isDirectory),isDirectory:t.isDirectory}}function Ld({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,statusByPath:o}){const i=o.get(e);return i==null?!1:(o.delete(e),i==="ignored"&&e.endsWith("/")&&r.delete(e),Bd(t,n,e),!0)}function ks({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,isDirectory:o,status:i,statusByPath:s}){const l=s.get(e);return l===i?!1:(l==null&&Fd(t,n,e),s.set(e,i),i==="ignored"&&o?r.add(e):o&&r.delete(e),!0)}function Fd(e,t,n){for(const r of Ss(n))e.set(r,(e.get(r)??0)+1),t.add(r)}function Bd(e,t,n){for(const r of Ss(n)){const o=(e.get(r)??0)-1;o>0?e.set(r,o):(e.delete(r),t.delete(r))}}function zd(e){let t=`${e.size}`;for(const[n,r]of e)t+=`\0${n}\0${r}`;return t}const Hd=e=>e.trim().toLowerCase(),qd=e=>e.split("/").at(-1)??e,Od=e=>{const t=e.toLowerCase().split("."),n=[];for(let r=1;r<t.length;r+=1)n.push(t.slice(r).join("."));return n};function Ut(e,t){return typeof e=="string"?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function jd(e){const t=Pn(e),n=t.remap,r=new Map;for(const[l,a]of Object.entries(t.byFileName??{}))r.set(l.toLowerCase(),a);const o=new Map;for(const[l,a]of Object.entries(t.byFileExtension??{}))o.set(Hd(l),a);const i=Object.entries(t.byFileNameContains??{}).map(([l,a])=>[l.toLowerCase(),a]);return{resolveIcon:(l,a)=>{if(l==="file-tree-icon-file"&&a!=null){const h=qd(a),f=h.toLowerCase(),c=r.get(f);if(c!=null)return Ut(c,l);for(const[g,v]of i)if(f.includes(g))return Ut(v,l);const m=Od(h);for(const g of m){const v=o.get(g);if(v!=null)return Ut(v,l)}const p=gc(t.set,h,m);if(p!=null&&t.set!=="none"){if(p==="default"){const g=n?.[l];if(g!=null)return Ut(g,l)}return{name:pc(p),remappedFrom:l,token:p}}}const d=n?.[l];return d==null?{name:l}:Ut(d,l)}}}var O,Ps,at,ti,Hn,Es,Ds,zr,br,Ir,on={},Ms=[],Un=Array.isArray,Hr=Ms.slice,et=Object.assign;function qr(e){e&&e.parentNode&&e.remove()}function xr(e,t,n){var r,o,i,s={};for(i in t)i=="key"?r=t[i]:i=="ref"&&typeof e!="function"?o=t[i]:s[i]=t[i];return arguments.length>2&&(s.children=arguments.length>3?Hr.call(arguments,2):n),Mn(e,s,r,o,null)}function Mn(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++Ps,__i:-1,__u:0};return o==null&&O.vnode!=null&&O.vnode(i),i}function Pt(e){return e.children}function Tn(e,t){this.props=e,this.context=t,this.__g=0}function Ct(e,t){if(t==null)return e.__?Ct(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Ct(e):null}function Ts(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=n.__e;break}return Ts(e)}}function ni(e){(8&e.__g||!(e.__g|=8)||!at.push(e)||Hn++)&&ti==O.debounceRendering||((ti=O.debounceRendering)||queueMicrotask)($d)}function $d(){for(var e,t,n,r,o,i,s,l,a=1;at.length;)at.length>a&&at.sort(Es),e=at.shift(),a=at.length,8&e.__g&&(n=void 0,o=(r=(t=e).__v).__e,i=[],s=[],(l=t.__P)&&((n=et({},r)).__v=r.__v+1,O.vnode&&O.vnode(n),Or(l,n,r,t.__n,l.namespaceURI,32&r.__u?[o]:null,i,o??Ct(r),!!(32&r.__u),s,l.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,Rs(i,n,s),n.__e!=o&&Ts(n)));Hn=0}function Ns(e,t,n,r,o,i,s,l,a,d,h,f){var c,m,p,g,v,w,x,b=r&&r.__k||Ms,I=t.length;for(a=Ud(n,t,b,a,I),c=0;c<I;c++)(p=n.__k[c])!=null&&(m=p.__i==-1?on:b[p.__i]||on,p.__i=c,w=Or(e,p,m,o,i,s,l,a,d,h,f),g=p.__e,p.ref&&m.ref!=p.ref&&(m.ref&&jr(m.ref,null,p),h.push(p.ref,p.__c||g,p)),v==null&&g!=null&&(v=g),(x=!!(4&p.__u))||m.__k===p.__k?a=As(p,a,e,x):typeof p.type=="function"&&w!==void 0?a=w:g&&(a=g.nextSibling),p.__u&=-7);return n.__e=v,a}function Ud(e,t,n,r,o){var i,s,l,a,d,h=n.length,f=h,c=0;for(e.__k=new Array(o),i=0;i<o;i++)(s=t[i])!=null&&typeof s!="boolean"&&typeof s!="function"?(a=i+c,(s=e.__k[i]=typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?Mn(null,s,null,null,null):Un(s)?Mn(Pt,{children:s},null,null,null):s.constructor==null&&s.__b>0?Mn(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=e,s.__b=e.__b+1,l=null,(d=s.__i=Kd(s,n,a,f))!=-1&&(f--,(l=n[d])&&(l.__u|=2)),l==null||l.__v==null?(d==-1&&(o>h?c--:o<h&&c++),typeof s.type!="function"&&(s.__u|=4)):d!=a&&(d==a-1?c--:d==a+1?c++:(d>a?c--:c++,s.__u|=4))):e.__k[i]=null;if(f)for(i=0;i<h;i++)(l=n[i])!=null&&(2&l.__u)==0&&(l.__e==r&&(r=Ct(l)),Ls(l,l));return r}function As(e,t,n,r){var o,i;if(typeof e.type=="function"){for(o=e.__k,i=0;o&&i<o.length;i++)o[i]&&(o[i].__=e,t=As(o[i],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=Ct(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Kd(e,t,n,r){var o,i,s,l=e.key,a=e.type,d=t[n],h=d!=null&&(2&d.__u)==0;if(d===null&&e.key==null||h&&l==d.key&&a==d.type)return n;if(r>(h?1:0)){for(o=n-1,i=n+1;o>=0||i<t.length;)if((d=t[s=o>=0?o--:i++])!=null&&(2&d.__u)==0&&l==d.key&&a==d.type)return s}return-1}function ri(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n??""}function _n(e,t,n,r,o){var i;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||ri(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||ri(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(Ds,"$1")),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||(e.__l={}),e.__l[t+i]=n,n?r?n.l=r.l:(n.l=zr,e.addEventListener(t,i?Ir:br,i)):e.removeEventListener(t,i?Ir:br,i);else{if(o=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function oi(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=zr++;else if(t.u<n.l)return;return n(O.event?O.event(t):t)}}}function Or(e,t,n,r,o,i,s,l,a,d,h){var f,c,m,p,g,v,w,x,b,I,S,E,V,de,Y,fe,Q,ne,ce,re,De,j=t.type;if(t.constructor!=null)return null;128&n.__u&&(a=!!(32&n.__u),n.__c.__z&&(l=t.__e=n.__e=(i=n.__c.__z)[0],n.__c.__z=null)),(f=O.__b)&&f(t);e:if(typeof j=="function")try{if(x=t.props,b="prototype"in j&&j.prototype.render,I=(f=j.contextType)&&r[f.__c],S=f?I?I.props.value:f.__:r,n.__c?2&(c=t.__c=n.__c).__g&&(c.__g|=1,w=!0):(b?t.__c=c=new j(x,S):(t.__c=c=new Tn(x,S),c.constructor=j,c.render=Gd),I&&I.sub(c),c.props=x,c.state||(c.state={}),c.context=S,c.__n=r,m=!0,c.__g|=8,c.__h=[],c._sb=[]),b&&c.__s==null&&(c.__s=c.state),b&&j.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=et({},c.__s)),et(c.__s,j.getDerivedStateFromProps(x,c.__s))),p=c.props,g=c.state,c.__v=t,m)b&&j.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),b&&c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(b&&j.getDerivedStateFromProps==null&&x!==p&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(x,S),!(4&c.__g)&&c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(x,c.__s,S)===!1||t.__v==n.__v){for(t.__v!=n.__v&&(c.props=x,c.state=c.__s,c.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(se){se&&(se.__=t)}),E=0;E<c._sb.length;E++)c.__h.push(c._sb[E]);c._sb=[],c.__h.length&&s.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(x,c.__s,S),b&&c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(p,g,v)})}if(c.context=S,c.props=x,c.__P=e,c.__g&=-5,V=O.__r,de=0,b){for(c.state=c.__s,c.__g&=-9,V&&V(t),f=c.render(c.props,c.state,c.context),Y=0;Y<c._sb.length;Y++)c.__h.push(c._sb[Y]);c._sb=[]}else do c.__g&=-9,V&&V(t),f=c.render(c.props,c.state,c.context),c.state=c.__s;while(8&c.__g&&++de<25);c.state=c.__s,c.getChildContext!=null&&(r=et({},r,c.getChildContext())),b&&!m&&c.getSnapshotBeforeUpdate!=null&&(v=c.getSnapshotBeforeUpdate(p,g)),fe=f,f!=null&&f.type===Pt&&f.key==null&&(fe=Vs(f.props.children)),l=Ns(e,Un(fe)?fe:[fe],t,n,r,o,i,s,l,a,d,h),t.__u&=-161,c.__h.length&&s.push(c),w&&(c.__g&=-4)}catch(se){if(t.__v=null,a||i!=null)if(se.then){for(Q=0,ne=!1,t.__u|=a?160:128,t.__c.__z=[],ce=0;ce<i.length;ce++)(re=i[ce])==null||ne||(re.nodeType==8&&re.data=="$s"?(Q>0&&t.__c.__z.push(re),Q++,i[ce]=null):re.nodeType==8&&re.data=="/$s"?(--Q>0&&t.__c.__z.push(re),ne=Q===0,l=i[ce],i[ce]=null):Q>0&&(t.__c.__z.push(re),i[ce]=null));if(!ne){for(;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;i[i.indexOf(l)]=null,t.__c.__z=[l]}t.__e=l}else{for(De=i.length;De--;)qr(i[De]);wr(t)}else t.__e=n.__e,t.__k=n.__k,se.then||wr(t);O.__e(se,t,n)}else l=t.__e=Wd(n.__e,t,n,r,o,i,s,a,d,h);return(f=O.diffed)&&f(t),128&t.__u?void 0:l}function wr(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(wr)}function Rs(e,t,n){for(var r=0;r<n.length;r++)jr(n[r],n[++r],n[++r]);O.__c&&O.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(i){i.call(o)})}catch(i){O.__e(i,o.__v)}})}function Vs(e){return typeof e!="object"||e==null||e.__b&&e.__b>0?e:Un(e)?e.map(Vs):et({},e)}function Wd(e,t,n,r,o,i,s,l,a,d){var h,f,c,m,p,g,v,w,x=n.props,b=t.props,I=t.type;if(I=="svg"?o="http://www.w3.org/2000/svg":I=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),i!=null){for(h=0;h<i.length;h++)if((p=i[h])&&"setAttribute"in p==!!I&&(I?p.localName==I:p.nodeType==3)){e=p,i[h]=null;break}}if(e==null){if(I==null)return d.createTextNode(b);e=d.createElementNS(o,I,b.is&&b),l&&(O.__m&&O.__m(t,i),l=!1),i=null}if(I==null)x===b||l&&e.data==b||(e.data=b);else{if(i=i&&Hr.call(e.childNodes),x=n.props||on,!l&&i!=null)for(x={},h=0;h<e.attributes.length;h++)x[(p=e.attributes[h]).name]=p.value;for(h in x)if(p=x[h],h!="children"){if(h=="dangerouslySetInnerHTML")c=p;else if(!(h in b)){if(h=="value"&&"defaultValue"in b||h=="checked"&&"defaultChecked"in b)continue;_n(e,h,null,p,o)}}for(h in w=1&n.__u,b)p=b[h],h=="children"?m=p:h=="dangerouslySetInnerHTML"?f=p:h=="value"?g=p:h=="checked"?v=p:l&&typeof p!="function"||x[h]===p&&!w||_n(e,h,p,x[h],o);if(f)l||c&&(f.__html==c.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(c&&(e.innerHTML=""),Ns(I=="template"?e.content:e,Un(m)?m:[m],t,n,r,I=="foreignObject"?"http://www.w3.org/1999/xhtml":o,i,s,i?i[0]:n.__k&&Ct(n,0),l,a,d),i!=null)for(h=i.length;h--;)qr(i[h]);l||(h="value",I=="progress"&&g==null?e.removeAttribute("value"):g==null||g===e[h]&&(I!=="progress"||g)||_n(e,h,g,x[h],o),h="checked",v!=null&&v!=e[h]&&_n(e,h,v,x[h],o))}return e}function jr(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(o){O.__e(o,n)}}function Ls(e,t,n){var r,o;if(O.unmount&&O.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||jr(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){O.__e(i,t)}r.__P=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&Ls(r[o],t,n||typeof e.type!="function");n||qr(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function Gd(e,t,n){return this.constructor(e,n)}function Sr(e,t){var n,r,o,i;t==document&&(t=document.documentElement),O.__&&O.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=xr(Pt,null,[e]),o=[],i=[],Or(t,e,r||on,on,t.namespaceURI,r?null:t.firstChild?Hr.call(t.childNodes):null,o,r?r.__e:t.firstChild,n,i,t.ownerDocument),Rs(o,e,i)}function Yd(e,t){e.__u|=32,Sr(e,t)}O={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!(1&o.__g)){o.__g|=4;try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),s=8&o.__g),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),s=8&o.__g),s)return void(o.__g|=2)}catch(l){e=l}}throw Hn=0,e}},Ps=0,Tn.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=et({},this.state),typeof e=="function"&&(e=e(et({},n),this.props)),e&&et(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),ni(this))},Tn.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),ni(this))},Tn.prototype.render=Pt,at=[],Hn=0,Es=function(e,t){return e.__v.__b-t.__v.__b},Ds=/(PointerCapture)$|Capture$/i,zr=0,br=oi(!1),Ir=oi(!0);var Xd=0;function _(e,t,n,r,o,i){t||(t={});var s,l,a=t;if("ref"in a&&typeof e!="function")for(l in a={},t)l=="ref"?s=t[l]:a[l]=t[l];var d={type:e,props:a,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Xd,__i:-1,__u:0,__source:o,__self:i};return O.vnode&&O.vnode(d),d}const Qd=16,Jd=16,Zd={};function Zt({name:e,remappedFrom:t,token:n,width:r,height:o,viewBox:i,label:s,alignCapitals:l=!1}){"use no memo";const a=`#${e.replace(/^#/,"")}`,{width:d,height:h,viewBox:f}=Zd[e]??{width:Qd,height:Jd},c=r??d,m=o??h,p=i??f??`0 0 ${d} ${h}`;return _("svg",{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":l,...s!=null?{"aria-label":s,role:"img"}:{"aria-hidden":!0},viewBox:p,width:c,height:m,children:_("use",{href:a})})}const ii=e=>e!==void 0&&/\s/.test(e),eh=(e,t)=>{const n=r=>ii(e[r-1])||ii(e[r]);if(!n(t))return t;for(let r=1;r<e.length;r++){const o=t-r;if(o>0&&!n(o))return o;const i=t+r;if(i<e.length&&!n(i))return i}return t},Fs=e=>eh(e,Math.ceil(e.length/2)),si=e=>{if(e.length<2)return[e,""];const t=Fs(e);return[e.slice(0,t),e.slice(t)]},th=e=>{if(e.length<4)return[e,""];const t=e.lastIndexOf(".")+1,n=e.length-t>10,r=t>=1&&!n?t:Fs(e);return[e.slice(0,r),e.slice(r)]},nh=e=>{if(e.length<4)return[e,""];const t=e.lastIndexOf("/")+1,n=e.length-t>25,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},rh=(e,{splitIndex:t}={})=>{if(typeof t!="number"){const n=Math.ceil(e.length/2);return[e.slice(0,n),e.slice(n)]}return[e.slice(0,t),e.slice(t)]},oh=(e,{splitOffset:t}={})=>{if(typeof t!="number"||t<=0||t>=e.length){const r=Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]}const n=e.length-t;return[e.slice(0,n),e.slice(n)]},ih=(e,{splitOffset:t}={})=>{if(typeof t!="number"||t<=0||t>=e.length){const r=Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]}const n=t;return[e.slice(0,n),e.slice(n)]};function sh({children:e,marker:t,variant:n="default"}){"use no memo";return _("div",{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:_("div",{"data-truncate-marker":!0,children:typeof t=="function"?t({children:e}):n==="fade"?_("span",{"data-truncate-fade":!0}):t})})}function lh(e){"use no memo";const{mode:t,children:n}=e;return _("div",{children:[_("div",{"data-truncate-content":"visible",children:t==="fruncate"?_("span",{children:n}):n}),_("div",{"data-truncate-content":"overflow","aria-hidden":!0,children:t==="fruncate"?_("span",{children:n}):n})]})}function Bs({children:e,mode:t="truncate",marker:n="…",variant:r="default",...o}){"use no memo";const i=_(lh,{mode:t,children:e},"content"),s=_(sh,{marker:n,mode:t,variant:r},"marker");return _("div",{"data-truncate-container":t,"data-truncate-variant":r,...o,children:_("div",{"data-truncate-grid":!0,children:t==="truncate"?[i,s]:[s,i,_("div",{"data-truncate-fill":!0},"fill")]})})}function Nn({children:e,...t}){"use no memo";return _(Bs,{mode:"truncate",...t,children:e})}function sr({children:e,...t}){"use no memo";return _(Bs,{mode:"fruncate",...t,children:e})}function ah({children:e,contents:t,priority:n="end",split:r="center",minimumLength:o=12,className:i,style:s,...l}){"use no memo";let a=null,d=null;if(Array.isArray(t)){if(t.length!==2)return console.error("MiddleTruncate: contents must be an array of two items"),null;a=_(Nn,{...l,children:t[0]}),d=_(sr,{...l,children:t[1]})}else{if(typeof e!="string")return console.error("MiddleTruncate: children must be a string"),null;if(e.length===0)return _("div",{className:i,style:s});if(e.length<o)return n==="end"?_(sr,{...l,className:i,style:s,children:e}):_(Nn,{...l,className:i,style:s,children:e});let h=null,f=null,c=null;if(typeof r=="string")r==="center"?h=si:r==="extension"?h=th:r==="leaf-path"&&(h=nh);else if(typeof r=="number")h=rh,f=r;else if(Array.isArray(r)){const[I,S]=r;c=S,I==="last"?h=oh:I==="first"&&(h=ih)}else typeof r=="function"&&(h=r);h??=si;const[m,p]=h(e,{priority:n,variant:l.variant,splitIndex:typeof f=="number"?f:void 0,splitOffset:typeof c=="number"?c:void 0}),g=m.length>=p.length,v=n==="equal"&&!g,w=n==="equal"&&g,x={},b={};v&&(x.marker=""),w&&(b.marker=""),a=_(Nn,{...l,...x,children:m}),d=_(sr,{...l,...b,children:p})}return _("div",{"data-truncate-group-container":"middle",className:i,style:s,children:[_("div",{"data-truncate-segment-priority":n==="start"||n==="equal"?"1":"2",children:a}),_("div",{"data-truncate-segment-priority":n==="end"||n==="equal"?"1":"2",children:d})]})}const Cr={endIndex:-1,startIndex:-1};function ch(e,t,n){return Math.min(Math.max(e,t),n)}function li(e,t){return e<0||t<e?Cr:{endIndex:t,startIndex:e}}function _r(e){return e.startIndex<0||e.endIndex<e.startIndex}function uh(e,t){return _r(e)?0:(e.endIndex-e.startIndex+1)*t}function ai(e,t,n){if(t<=0)return-1;const r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function dh(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function hh(e){const t=new Map;return e.forEach((n,r)=>{if(n.kind!=="directory"||!n.isExpanded)return;const o=n.ancestorPaths.length,i=t.get(o);if(i==null){t.set(o,[r]);return}i.push(r)}),t}function fh(e,t){let n=0,r=e.length-1,o=-1;for(;n<=r;){const i=Math.floor((n+r)/2),s=e[i];if(s==null)break;if(s<=t){o=i,n=i+1;continue}r=i-1}return o}function ph(e){const t=new Map,n=[];for(let o=0;o<e.length;o+=1){const i=e[o];if(i==null)continue;const s=i.kind==="directory"&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths;let l=0;for(;l<n.length&&l<s.length&&n[l]===s[l];)l+=1;for(let a=n.length-1;a>=l;a-=1){const d=n[a];d!=null&&t.set(d,o-1)}n.length=l;for(let a=l;a<s.length;a+=1){const d=s[a];d!=null&&n.push(d)}}const r=e.length-1;for(const o of n)t.set(o,r);return t}function zs(e,t,n){if(e.length===0||t<=0)return[];const r=ph(e),o=hh(e),i=[];for(let s=0;s<e.length;s+=1){const l=o.get(s);if(l==null||l.length===0)break;const a=t+s*n;let d=fh(l,Math.min(e.length-1,Math.floor(a/n))),h=null;for(;d>=0;){const f=l[d],c=f==null?null:e[f]??null;if(c!=null&&(s===0||c.ancestorPaths[s-1]===i[s-1]?.path)){h=c;break}d-=1}if(h==null)break;i.push(h)}return i.map((s,l)=>{const a=l*n,d=(r.get(s.path)??e.length-1)+1;if(d>=e.length)return{row:s,top:a};const h=d*n-t;return{row:s,top:Math.min(a,h-n)}}).filter(s=>s.top+n>0)}function mh(e,t){const n=t.totalRowCount??e.length,r=n*t.itemHeight,o=Math.max(0,t.viewportHeight),i=Math.max(0,Math.floor(t.overscan)),s=Math.max(0,r-o),l=ch(t.scrollTop,0,s),a=t.stickyRows??zs(e,l,t.itemHeight),d=a.reduce((E,V)=>Math.max(E,V.top+t.itemHeight),0),h=Math.min(r,l+d),f=Math.max(0,o-d),c=Math.max(0,r-h),m=ai(l,n,t.itemHeight),p=ai(h,n,t.itemHeight),g=d<=0||m<0||m>=n?-1:m,v=g===-1?-1:Math.min(n-1,p-1),w=g===-1||v<g?0:v-g+1,x=f<=0||p>=n?Cr:li(p,dh(h+f,n,t.itemHeight)),b=v+1,I=_r(x)?Cr:li(Math.max(b,x.startIndex-i),Math.min(n-1,x.endIndex+i)),S=uh(I,t.itemHeight);return{occlusion:{firstOccludedIndex:g,lastOccludedIndex:v,occludedCount:w},physical:{itemHeight:t.itemHeight,maxScrollTop:s,overscan:i,scrollTop:l,totalHeight:r,totalRowCount:n,viewportHeight:o},projected:{contentHeight:c,paneHeight:f,paneTop:h},sticky:{height:d,rows:a},visible:x,window:{endIndex:I.endIndex,height:S,offsetTop:_r(I)?0:I.startIndex*t.itemHeight,startIndex:I.startIndex}}}const gh={added:"A",deleted:"D",ignored:null,modified:"M",renamed:"R",untracked:"U"},vh={added:"Git status: added",deleted:"Git status: deleted",ignored:"Git status: ignored",modified:"Git status: modified",renamed:"Git status: renamed",untracked:"Git status: untracked"},yh="Contains git status items";function bh(e){return e.current?!0:(e.current=!0,!1)}function Hs(e){const{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:o=0,viewportHeight:i}=e;if(n<0)return null;const s=Math.max(0,o),l=n*r,a=l+r;if(l<t+s){const d=Math.max(0,l-s);return d===t?null:d}if(a>t+i){const d=a-i;return d===t?null:d}return null}function Ih(e){const{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:o,topInset:i=0,totalHeight:s,viewportHeight:l}=e;if(o==="nearest")return Hs({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i,viewportHeight:l});if(n<0)return null;const a=Math.max(0,i),d=n*r,h=Math.max(0,l-a),f=o==="center"?a+Math.max(0,(h-r)/2):a,c=Math.max(0,s-l),m=Math.max(0,Math.min(d-f,c));return m===t?null:m}function xh(e){const{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:o,totalHeight:i,viewportHeight:s}=e;if(n<0)return null;const l=Math.max(0,o),a=n*r,d=a+r,h=t+l,f=t+s;if(a>=h&&d<=f)return null;const c=Math.max(0,i-s),m=Math.max(0,Math.min(a-l,c));return m===t?null:m}function It(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});const t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function kn(e){const t=e.getRootNode();if(t instanceof ShadowRoot){const r=t.activeElement;return r instanceof HTMLElement?r:null}const n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function Kt(e,t){if(e==null)return t;const n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function ci(e,t){return e!=null&&e>0?e:t}function wh(e){const t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;return n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0?n.blockSize:e.contentRect.height>0?e.contentRect.height:null}function ui(e,t,n,r,o=0){const i=Hs({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:o,viewportHeight:r});return i==null?!1:(e.scrollTop=i,!0)}function Sh(e,t,n,r,o,i,s=0){const l=Ih({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:i,topInset:s,totalHeight:o,viewportHeight:r});return l==null?!1:(e.scrollTop=l,!0)}function Wt(e,t,n,r,o,i){const s=xh({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:i,totalHeight:o,viewportHeight:r});return s==null?!1:(e.scrollTop=s,!0)}function di(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function Ch(e){const{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?"reset":r?n===t?"ignore":"focus-input":"reveal-canonical"}function _h({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:o,onInput:i}){return _("input",{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:o,onInput:i,onClick:s=>s.stopPropagation(),onMouseDown:s=>s.stopPropagation(),onPointerDown:s=>s.stopPropagation()})}function kh(e){const{row:t,mode:n,targetPath:r,ariaLabel:o,domId:i,isParked:s,itemHeight:l,features:a,state:d,extraStyle:h}=e,f=n==="sticky",c=t.ancestorPaths.at(-1)??"",m={};return d.isFocusRinged&&(m["data-item-focused"]=!0),t.isSelected&&(m["data-item-selected"]=!0),d.isContextHovered&&(m["data-item-context-hover"]="true"),d.isDragTarget&&(m["data-item-drag-target"]=!0),d.isDragging&&(m["data-item-dragging"]=!0),d.effectiveGitStatus!=null&&(m["data-item-git-status"]=d.effectiveGitStatus),d.containsGitChange&&(m["data-item-contains-git-change"]="true"),{"aria-expanded":!f&&t.kind==="directory"?t.isExpanded:void 0,"aria-haspopup":a.contextMenuEnabled?"menu":void 0,"aria-label":o,"aria-level":f?void 0:t.level+1,"aria-posinset":f?void 0:t.posInSet+1,"aria-selected":f?void 0:t.isSelected?"true":"false","aria-setsize":f?void 0:t.setSize,"data-file-tree-sticky-path":f?r:void 0,"data-file-tree-sticky-row":f?"true":void 0,"data-item-context-menu-button-visibility":a.actionLaneEnabled?a.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":a.contextMenuEnabled?a.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":a.actionLaneEnabled?"true":void 0,"data-item-has-git-lane":a.gitLaneActive?"true":void 0,"data-item-parent-path":c.length>0?c:void 0,"data-item-parked":s?"true":void 0,"data-item-path":r,"data-item-type":t.kind==="directory"?"folder":"file","data-type":"item",id:f?void 0:i,role:f?void 0:"treeitem",style:{minHeight:`${l}px`,...h},tabIndex:!f&&t.isFocused?0:-1,...m}}function Ph(e){const{event:t,mode:n,isSearchOpen:r,isDirectory:o}=e,i=t.ctrlKey||t.metaKey,s=t.shiftKey||i,l=t.shiftKey?{additive:i,kind:"range"}:i?{kind:"toggle"}:{kind:"single"};return{closeSearch:r,revealCanonical:n==="sticky",selection:l,toggleDirectory:!s&&o}}var _t,te,lr,hi,kr=Object.is,sn=0,qs=[],ie=O,fi=ie.__b,pi=ie.__r,mi=ie.diffed,gi=ie.__c,vi=ie.unmount,yi=ie.__;function Kn(e,t){ie.__h&&ie.__h(te,e,sn||t),sn=0;var n=te.__H||(te.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Be(e){return sn=1,Eh(Os,e)}function Eh(e,t,n){var r=Kn(_t++,2);if(r.t=e,!r.__c&&(r.__=[Os(void 0,t),function(l){var a=r.__N?r.__N[0]:r.__[0],d=r.t(a,l);kr(a,d)||(r.__N=[d,r.__[1]],r.__c.setState({}))}],r.__c=te,!te.__f)){var o=function(l,a,d){if(!r.__c.__H)return!0;var h=r.__c.__H.__.filter(function(c){return!!c.__c});if(h.every(function(c){return!c.__N}))return!i||i.call(this,l,a,d);var f=r.__c.props!==l;return h.forEach(function(c){if(c.__N){var m=c.__[0];c.__=c.__N,c.__N=void 0,kr(m,c.__[0])||(f=!0)}}),i&&i.call(this,l,a,d)||f};te.__f=!0;var i=te.shouldComponentUpdate,s=te.componentWillUpdate;te.componentWillUpdate=function(l,a,d){if(4&this.__g){var h=i;i=void 0,o(l,a,d),i=h}s&&s.call(this,l,a,d)},te.shouldComponentUpdate=o}return r.__N||r.__}function bi(e,t){var n=Kn(_t++,3);!ie.__s&&$r(n.__H,t)&&(n.__=e,n.u=t,te.__H.__h.push(n))}function Ce(e,t){var n=Kn(_t++,4);!ie.__s&&$r(n.__H,t)&&(n.__=e,n.u=t,te.__h.push(n))}function R(e){return sn=5,Qe(function(){return{current:e}},[])}function Qe(e,t){var n=Kn(_t++,7);return $r(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function ve(e,t){return sn=8,Qe(function(){return e},t)}function Dh(){for(var e;e=qs.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(An),e.__H.__h.forEach(Pr),e.__H.__h=[]}catch(t){e.__H.__h=[],ie.__e(t,e.__v)}}ie.__b=function(e){te=null,fi&&fi(e)},ie.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),yi&&yi(e,t)},ie.__r=function(e){pi&&pi(e),_t=0;var t=(te=e.__c).__H;t&&(lr===te?(t.__h=[],te.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.forEach(An),t.__h.forEach(Pr),t.__h=[],_t=0)),lr=te},ie.diffed=function(e){mi&&mi(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(qs.push(t)!==1&&hi===ie.requestAnimationFrame||((hi=ie.requestAnimationFrame)||Mh)(Dh)),t.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0})),lr=te=null},ie.__c=function(e,t){t.some(function(n){try{n.__h.forEach(An),n.__h=n.__h.filter(function(r){return!r.__||Pr(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],ie.__e(r,n.__v)}}),gi&&gi(e,t)},ie.unmount=function(e){vi&&vi(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{An(r)}catch(o){t=o}}),n.__H=void 0,t&&ie.__e(t,n.__v))};var Ii=typeof requestAnimationFrame=="function";function Mh(e){var t,n=function(){clearTimeout(r),Ii&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Ii&&(t=requestAnimationFrame(n))}function An(e){var t=te,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),te=t}function Pr(e){var t=te;e.__c=e.__(),te=t}function $r(e,t){return!e||e.length!==t.length||t.some(function(n,r){return!kr(n,e[r])})}function Os(e,t){return typeof t=="function"?t(e):t}function Th(e,t=null,n=null){"use no memo";const r=e.flattenedSegments;return r==null||r.length===0?t??e.name:_("span",{"data-item-flattened-subitems":!0,children:r.map((o,i)=>{const s=i===r.length-1;return _(Pt,{children:[_("span",{"data-item-flattened-subitem":o.path,"data-item-flattened-subitem-drag-target":n===o.path?"true":void 0,children:s&&t!=null?t:_(Nn,{children:o.name})}),i<r.length-1?" / ":""]},o.path)})})}function xt(e){return e.isFlattened?e.flattenedSegments?.findLast(t=>t.isTerminal)?.path??e.path:e.path}function Er(e){const t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(n=>n.name).join(" / ")}function xi(e,t,n,r){return e.map((o,i)=>{const s=i*n,l=o.subtreeEndIndex+1;if(l>=r)return{row:o.row,top:s};const a=l*n-t;return{row:o.row,top:Math.min(s,a-n)}}).filter(o=>o.top+n>0)}function ar({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:o,viewportHeight:i}){const s=e.getVisibleCount(),l=o&&s>0?e.getStickyRowCandidates(r,t):[],a=l==null&&o&&s>0?e.getVisibleRows(0,s-1):[],d=mh(a,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:l==null?void 0:xi(l,r,t,s),totalRowCount:s,viewportHeight:i}),h=o&&r<=0&&s>0?e.getStickyRowCandidates(1,t):[],f=h!=null&&r<=0?xi(h,1,t,s):o&&r<=0&&a.length>0?zs(a,1,t):d.sticky.rows;return{overlayHeight:f.reduce((c,m)=>Math.max(c,m.top+t),0),overlayRows:f,snapshot:d,visibleRows:a}}const Nh=400,wi=10,bt=40,Si=18;function Ah(e,t,n){const r=e,o=document.elementFromPoint?.bind(document)??null,i=r.elementFromPoint?.(t,n)??o?.(t,n)??null;return e instanceof ShadowRoot&&(i==null||!e.contains(i))?Rh(e,t,n):i instanceof HTMLElement?i:null}function Rh(e,t,n){const r=Array.from(e.querySelectorAll('[data-type="item"], [data-item-flattened-subitem]'));for(let o=r.length-1;o>=0;o--){const i=r[o],s=i.getBoundingClientRect();if(t>=s.left&&t<=s.right&&n>=s.top&&n<=s.bottom)return i}return null}function Ci(e){const t=e?.closest?.('[data-type="item"]');if(!(t instanceof HTMLElement))return null;const n=t.dataset.itemPath??null;if(n==null)return null;const r=e?.closest?.("[data-item-flattened-subitem]"),o=r instanceof HTMLElement?r.getAttribute("data-item-flattened-subitem")??null:null;if(o!=null&&o.endsWith("/"))return{directoryPath:o,flattenedSegmentPath:o,hoveredPath:n,kind:"directory"};if(t.dataset.itemType==="folder")return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:"directory"};const i=t.dataset.itemParentPath??null;return i==null||i.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:"root"}:{directoryPath:i,flattenedSegmentPath:null,hoveredPath:n,kind:"directory"}}function _i(e){const t=e.cloneNode(!0);return t.removeAttribute("id"),t.dataset.fileTreeDragPreview="true",t.setAttribute("aria-hidden","true"),t.tabIndex=-1,Object.assign(t.style,{boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",left:"0px",margin:"0",pointerEvents:"none",position:"fixed",top:"0px",willChange:"transform",zIndex:"10000"}),t}function Vh(){return navigator.vendor!=="Apple Computer, Inc."}function Lh(e,t){const n=e-t.top;if(n<bt)return-Math.ceil((bt-Math.max(0,n))/bt*Si);const r=t.bottom-e;return r<bt?Math.ceil((bt-Math.max(0,r))/bt*Si):0}function Fh(e,t){if(e!=null){const n=gh[e];return n==null?null:{text:n,title:vh[e]}}return t?{icon:{name:"file-tree-icon-dot",width:6,height:6},title:yh}:null}function Bh(e,t,n){if(t==null||t.size===0)return null;const r=[];for(let o=e.length-1;o>=0;o-=1){const i=e[o],s=n.get(i);if(s!=null){for(const l of r)n.set(l,s);return s?"ignored":null}if(t.has(i)){n.set(i,!0);for(const l of r)n.set(l,!0);return"ignored"}r.push(i)}for(const o of r)n.set(o,!1);return null}function ki(e){return e!=null&&"toggle"in e}function js(e){return e.code==="Space"||e.key===" "||e.key==="Spacebar"}function zh(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function Hh(e){return e==null?"":`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll("\\","\\\\").replaceAll('"','\\"')}"] { opacity: 1; }`}function $s(e){return e.shiftKey&&e.key==="F10"||e.key==="ContextMenu"}function qh(e,t){return t&&$s(e)||(e.ctrlKey||e.metaKey)&&js(e)?!0:e.key==="ArrowDown"||e.key==="ArrowLeft"||e.key==="ArrowRight"||e.key==="ArrowUp"}const Oh=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home","PageDown","PageUp"]);function Pi(e){for(const t of e.composedPath())if(t instanceof HTMLElement&&(t.dataset.fileTreeContextMenuRoot==="true"||t.dataset.type==="context-menu-anchor"||t.dataset.type==="context-menu-trigger"||t.getAttribute("slot")==="context-menu"))return!0;return!1}function jh(e){return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width,x:e.x,y:e.y}}function $h(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function Uh(e,t){if(e==null)return t.offsetTop;const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function Ei(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function Di(e,t,n){if(e==null)return null;const r=t.get(e)??null;if(r!=null)return r;const o=n.get(e)??null;return o?.dataset.itemParked==="true"?null:o}function Kh(e){if(e==null)return[];const t=[];for(const n of e.querySelectorAll('button[data-file-tree-sticky-row="true"]')){if(!(n instanceof HTMLElement))continue;const r=n.dataset.fileTreeStickyPath;r!=null&&t.push(r)}return t}function Wh(e,t){if(e==null||t==null)return null;for(const n of e.querySelectorAll('button[data-item-focused="true"][data-item-parked="true"]'))if(n instanceof HTMLElement&&n.dataset.itemPath===t)return n;return null}function Gh(e,t,n,r,o,i,s){const l=Math.max(0,i-o),a=t?.getBoundingClientRect()??null,d=a==null||n==null?null:n.getBoundingClientRect().top-a.top,h=Wh(e,r),f=a==null||h==null?null:h.getBoundingClientRect().top-a.top;return Math.max(0,Math.min(f??Math.max(d??0,l),Math.max(0,s-o)))}function Mi(e,t){return{kind:e.kind,name:Er(e),path:t}}function Yh(e){return e==null?void 0:`${e}__tree`}function Us(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?"__parked":""}`}function Ti(e){return e==="file-tree-icon-chevron"||e==="file-tree-icon-dot"||e==="file-tree-icon-file"||e==="file-tree-icon-lock"}function Ni(e,t){if(e==null)return null;if("text"in e)return e.parts!=null?_("span",{title:e.title,children:e.parts.map((r,o)=>_("span",{style:{color:r.color},children:r.text},o))}):_("span",{title:e.title,children:e.text});const n=typeof e.icon=="string"?Ti(e.icon)?t(e.icon):{name:e.icon}:Ti(e.icon.name)?(()=>{const r=t(e.icon.name),{name:o,...i}=e.icon;return{...r,...i}})():e.icon;return _("span",{title:e.title,children:_(Zt,{...n})})}function Ai(e){e!=null&&It(e.querySelector(["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", "))??e)}function Xh(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:o=!1,dragTargetFlattenedSegmentPath:i=null,gitDecoration:s=null,gitLaneActive:l=!1,renameInput:a=null,showDecorativeActionAffordance:d=!1}={}){const h=xt(e);return _(Pt,{children:[e.depth>0?_("div",{"data-item-section":"spacing",children:Array.from({length:e.depth}).map((f,c)=>_("div",{"data-item-section":"spacing-item","data-ancestor-path":e.ancestorPaths[c]},c))}):null,_("div",{"data-item-section":"icon",children:e.kind==="directory"?_(Zt,{...t("file-tree-icon-chevron")}):_(Zt,{...t("file-tree-icon-file",h)})}),_("div",{"data-item-section":"content",children:e.isFlattened?Th(e,a,i):a??_(ah,{minimumLength:5,split:"extension",children:e.name})}),o?_("div",{"data-item-section":"decoration",children:r!=null?Ni(r,t):null}):null,l?_("div",{"data-item-section":"git",children:Ni(s,t)}):null,n?_("div",{"data-item-section":"action",children:d?_("span",{"aria-hidden":"true","data-item-action-affordance":"decorative",children:_(Zt,{...t("file-tree-icon-ellipsis")})}):null}):null]})}function Rn(e,t,n,r={}){const{controller:o,renameView:i,visualFocusPath:s,contextHoverPath:l,draggedPathSet:a,dragTarget:d,dragAndDropEnabled:h,shouldSuppressContextMenu:f,handleRowDragStart:c,handleRowDragEnd:m,handleRowTouchStart:p,instanceId:g,itemHeight:v,gitStatusByPath:w,ignoredGitDirectories:x,ignoredInheritanceCache:b,directoriesWithGitChanges:I,gitLaneActive:S,contextMenuEnabled:E,contextMenuTriggerMode:V,contextMenuButtonTriggerEnabled:de,contextMenuButtonVisibility:Y,contextMenuRightClickEnabled:fe,registerRenameInput:Q,registerButton:ne,resolveIcon:ce,renderDecorationForRow:re,openContextMenuForRow:De,onRowClick:j,onKeyDown:se}=e,oe=xt(t),{isParked:Se=!1,mode:qe="flow",style:tt}=r,Oe=qe==="sticky",nt=w?.get(oe)??null??Bh(t.ancestorPaths,x,b),ht=t.kind==="directory"&&(I?.has(oe)??!1),je=re(t,oe),Ke=Fh(nt,ht),ke=E&&de,Ve=je!=null||S||ke,Et=ke&&Y==="always",Ie=i.getPath()===oe,rt=Ie?i.getValue():"",Me=Oe||!Ie?null:_(_h,{ref:Q,ariaLabel:`Rename ${Er(t)}`,isFlattened:t.isFlattened,value:rt,onBlur:()=>{i.commit()},onInput:ue=>{i.setValue(ue.currentTarget.value)}}),an=Xh(t,ce,{actionLaneEnabled:ke,customDecoration:je,decorationLaneEnabled:Ve,dragTargetFlattenedSegmentPath:d?.flattenedSegmentPath??null,gitDecoration:Ke,gitLaneActive:S,renameInput:Me,showDecorativeActionAffordance:Et}),$e={...kh({ariaLabel:Er(t),domId:t.isFocused?Us(g,oe,Se):void 0,extraStyle:tt,features:{actionLaneEnabled:ke,contextMenuButtonVisibility:ke?Y:null,contextMenuEnabled:E,contextMenuTriggerMode:E?V:null,gitLaneActive:S},isParked:Se,itemHeight:v,mode:qe,row:t,state:{containsGitChange:ht,effectiveGitStatus:nt,isContextHovered:l===oe,isDragTarget:d?.kind==="directory"&&d.directoryPath===oe,isDragging:a?.has(oe)===!0,isFocusRinged:t.isFocused&&s===oe},targetPath:oe}),key:n,onContextMenu:E||h?ue=>{if(f()){ue.preventDefault();return}E&&(ue.preventDefault(),fe&&(o.focusMountedPathFromInput(oe),De(t,oe,{anchorRect:$h(ue.clientX,ue.clientY),source:"right-click"})))}:void 0,onFocus:Oe?void 0:()=>{o.focusMountedPathFromInput(oe)},onKeyDown:Oe?void 0:se,ref:ue=>{ne(oe,ue)}};return!Oe&&Ie?_("div",{...$e,children:an}):_("button",{...$e,type:"button",draggable:h&&!Se,onDragEnd:h&&!Se?m:void 0,onDragStart:h&&!Se?ue=>{c(ue,t,oe)}:void 0,onMouseDown:ue=>{if(Oe){ue.preventDefault();return}o.isSearchOpen()&&ue.preventDefault()},onTouchStart:h&&!Se?ue=>{p(ue,t,oe)}:void 0,onClick:ue=>{j(ue,t,oe,qe)},children:an})}function Qh(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(r=>!n.has(xt(r))).map((r,o)=>Rn(e,r,t.start+o))}function Ri({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:o,icons:i,instanceId:s,itemHeight:l=qi,overscan:a=10,renamingEnabled:d=!1,renderRowDecoration:h,searchBlurBehavior:f="close",searchEnabled:c=!1,searchFakeFocus:m=!1,slotHost:p,stickyFolders:g=!1,initialViewportHeight:v=420}){"use no memo";const w=R(null),x=R(null),b=R(!1),I=R(null),S=R(null),E=R(null),V=R(null),de=R(null),Y=R(new Map),fe=R(new Map),Q=R(()=>{}),ne=R(null),ce=R(0),re=R(!1),De=R(null);De.current!==t&&(re.current=!1,De.current=t);const j=R(!1),se=R(null),oe=R(null),Se=R(!1),qe=R(null),tt=R(null),Oe=R(null),nt=R(null),ht=R(null),je=R(null),Ke=R(null),ke=R(null),Ve=R(!1),Et=R(null),Ie=R(null),rt=R(null),Me=R(null),an=Qe(()=>new Map,[]),[,$e]=Be(0),ue=R(!1),[Kr,We]=Be(null),[Wn,cn]=Be(null),[Gn,Ks]=Be(null),[Ws,ot]=Be(null),[Gs,Ys]=Be(0),[z,Yn]=Be(null),Dt=R(z);Dt.current=z;const un=R(null),Mt=R(null),Tt=R(null),Nt=R(null),Wr=R(null),dn=R(!1),Xs=()=>{Mt.current=null,Tt.current=null,Nt.current=null},Xn=(u,y)=>{Mt.current=u,Tt.current=null,Nt.current=y==null?null:{path:u,scrollTop:y}},Qs=(u,y)=>{Mt.current=null,Tt.current={path:u,viewportOffset:y},Nt.current=null},Gr=R(f==="retain"&&t.isSearchOpen()),[Js,Yr]=Be(m);bi(()=>{m||Yr(!1)},[m]);const Xr=R(!1),Qn=ve(()=>{Xr.current=!0,Yr(u=>u&&!1)},[]),[Zs,el]=Be(()=>ar({controller:t,itemHeight:l,overscan:a,scrollTop:0,stickyFolders:g,viewportHeight:v})),[tl,nl]=Be(!1);bi(()=>{nl(!0)},[]);const xe=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,ft=e?.contextMenu?.triggerMode??(xe?"right-click":"both"),pt=ft==="both"||ft==="button",Qr=e?.contextMenu?.buttonVisibility??"when-needed",rl=ft==="both"||ft==="right-click";Ce(()=>{const u=E.current;if(u==null)return;const y=C=>{if(!(C instanceof CustomEvent))return;const k=C.detail?.path??null;Wr.current=k,cn(k),ot(k==null?null:"pointer")},M=C=>{C instanceof CustomEvent&&(dn.current=C.detail?.disabled===!0)};return u.addEventListener("file-tree-debug-set-context-menu-trigger",y),u.addEventListener("file-tree-debug-set-scroll-suppression",M),()=>{u.removeEventListener("file-tree-debug-set-context-menu-trigger",y),u.removeEventListener("file-tree-debug-set-scroll-suppression",M)}},[]);const ol=ve((u,y)=>{Ei(Y.current,u,y)},[]),il=ve((u,y)=>{Ei(fe.current,u,y)},[]),sl=ve(u=>{S.current=u},[]),At=ve(u=>Di(u,fe.current,Y.current),[]),Jr=n!=null||r!=null||o!=null,{resolveIcon:Zr}=Qe(()=>jd(i),[i]),Rt=t[xs](),mt=Rt.getPath(),Jn=mt!=null,Le=t.isSearchOpen(),ll=t.getSearchValue(),L=t.getFocusedPath(),H=t.getFocusedIndex(),it=t.getScrollRequest(),Ue=t.isDragAndDropEnabled(),Vt=t.getDragSession(),al=Qe(()=>Vt==null?null:new Set(Vt.draggedPaths),[Vt]),cl=Vt?.target??null,Lt=Vt?.primaryPath??null,eo=Yh(s),{overlayHeight:ul,overlayRows:dl,snapshot:he,visibleRows:hn}=Zs,pe=he.physical.viewportHeight,Te=Qe(()=>({end:he.window.endIndex,start:he.window.startIndex}),[he.window.endIndex,he.window.startIndex]),Ft=dl,to=he.sticky.rows,st=he.physical.totalHeight,gt=he.sticky.height,fn=Qe(()=>new Set(to.map(u=>xt(u.row))),[to]),Zn=H>=0&&H>=Te.start&&H<=Te.end,hl=ve((u,y)=>h?.({item:Mi(u,y),row:u})??null,[h]),no=ve(u=>It(u==null?null:Y.current.get(u)??null)?!0:It(E.current),[]),pn=ve(u=>{no(t.focusNearestPath(u))},[t,no]),ro=R(pn);ro.current=pn;const vt=R(!0),er=R(()=>{}),Pe=ve((u=!0)=>{const y=Dt.current;y!=null&&(vt.current=vt.current&&u,Yn(null),e?.contextMenu?.onClose?.(),vt.current&&pn(y.path))},[e?.contextMenu,pn]);er.current=Pe;const Bt=ve(u=>{const y=u==null?null:Uh(E.current,u);Ks(M=>M===y?M:y)},[]),oo=ve((u,y,M)=>{const C=t.getItem(y);if(C==null)return;const k=At(y);if(k?.dataset.fileTreeStickyRow==="true"){const A=V.current;Xn(y,A?.scrollTop??null),j.current=!0,We(K=>K===y?K:y)}C.focus(),Bt(k),vt.current=!0,Yn({anchorRect:M?.anchorRect??null,item:Mi(u,y),path:y,source:M?.source??"keyboard"})},[t,At,Bt]),fl=ve(u=>{if(d){if(t.isSearchOpen()){const y=V.current,M=Kt(y,pe);qe.current=H<0||y==null?null:Math.max(0,Math.min(H*l-y.scrollTop,Math.max(0,M-l))),Se.current=!0}t.startRenaming(u)!==!1&&(ot("focus"),$e(y=>y+1))}},[t,H,l,d,pe]),mn=ve((u,{restoreTreeFocus:y=!0,targetOffset:M="live-overlay"}={})=>{const C=V.current;if(C==null)return!1;t.focusPath(u);const k=t.getFocusedIndex();if(k<0)return!1;const A=t.getVisibleRows(k,k)[0]??null;if(A==null)return!1;const K=Kt(C,pe),N=t.getVisibleCount()*l,B=M==="sticky-parents"?A.ancestorPaths.length*l:ar({controller:t,itemHeight:l,overscan:a,scrollTop:C.scrollTop,stickyFolders:g,viewportHeight:K}).snapshot.sticky.height;return j.current=!0,Wt(C,k,l,K,N,B),Q.current(),un.current=y?u:null,!0},[t,l,a,pe,g]),pl=()=>b.current===!0||Me.current!=null||Ve.current===!0,io=u=>typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(()=>{u()}):window.setTimeout(u,16),ml=u=>{if(u!=null){if(typeof window.cancelAnimationFrame=="function"){window.cancelAnimationFrame(u);return}window.clearTimeout(u)}},Ge=()=>{nt.current!=null&&(clearTimeout(nt.current),nt.current=null),Oe.current=null},gn=()=>{je.current?.remove(),je.current=null},zt=()=>{ml(tt.current),tt.current=null,ht.current=null},so=u=>{const y=E.current?.getRootNode();if(y instanceof ShadowRoot){y.append(u);return}document.body.append(u)},Ht=()=>{ke.current?.(),ke.current=null,Me.current!=null&&(clearTimeout(Me.current),Me.current=null),Ve.current=!1,Et.current=null,rt.current=null,Ie.current!=null&&(Ie.current.setAttribute("draggable","true"),Ie.current.style.removeProperty("touch-action"),Ie.current=null),gn(),Ge(),zt(),Ke.current=null},vn=(u,y)=>{const M=E.current?.getRootNode(),C=Ci(Ah(M instanceof ShadowRoot?M:document,u,y));return t.setDragTarget(C),t.getDragSession()?.target??null},tr=u=>{const y=t.getDragAndDropConfig()?.openOnDropDelay??800;if(u==null||u.kind!=="directory"||u.directoryPath==null||y<=0){Ge();return}const M=t.getItem(u.directoryPath),C=ki(M)?M:null;if(C==null||C.isExpanded()){Ge();return}const k=`${u.directoryPath}::${u.flattenedSegmentPath??""}`;Oe.current!==k&&(Ge(),Oe.current=k,nt.current=setTimeout(()=>{const A=t.getDragSession()?.target;A?.kind!=="directory"||A.directoryPath!==u.directoryPath||A.flattenedSegmentPath!==u.flattenedSegmentPath||C.expand()},y))},lo=()=>{tt.current=null;const u=ht.current,y=V.current;if(u==null||y==null||t.getDragSession()==null)return;const M=y.getBoundingClientRect(),C=Lh(u.clientY,M);if(C===0)return;const k=Math.max(0,y.scrollHeight-y.clientHeight),A=Math.max(0,Math.min(k,y.scrollTop+C));A!==y.scrollTop&&(y.scrollTop=A,Q.current()),tr(vn(u.clientX,u.clientY)),tt.current=io(lo)},ao=(u,y)=>{ht.current={clientX:u,clientY:y},tt.current??=io(lo)},gl=(u,y,M)=>{const C=u.currentTarget;if(C!=null){if(Ht(),gn(),Ge(),zt(),t.startDrag(M)===!1){u.preventDefault();return}if(Ke.current=y,u.dataTransfer!=null&&(u.dataTransfer.effectAllowed="move",u.dataTransfer.dropEffect="move",u.dataTransfer.setData("text/plain",M),Vh())){const k=_i(C),A=C.getBoundingClientRect();Object.assign(k.style,{height:`${A.height}px`,opacity:"0.85",transform:"translate3d(-9999px, 0px, 0)",width:`${A.width}px`}),so(k),je.current=k,u.dataTransfer.setDragImage(k,Math.max(0,u.clientX-A.left),Math.max(0,u.clientY-A.top))}}},vl=()=>{gn(),Ge(),zt(),Ke.current=null,t.cancelDrag()},yl=(u,y,M)=>{if(Me.current!=null||Ve.current)return;const C=u.touches[0],k=u.currentTarget;if(C==null||k==null)return;rt.current={clientX:C.clientX,clientY:C.clientY},Ie.current=k,k.setAttribute("draggable","false");const A=(B={})=>{const $=B.restoreNativeDraggable??!Ve.current;Me.current!=null&&(clearTimeout(Me.current),Me.current=null),document.removeEventListener("touchmove",K),document.removeEventListener("touchend",N),document.removeEventListener("touchcancel",N),ke.current===A&&(ke.current=null),$&&(k.setAttribute("draggable","true"),Ie.current===k&&(Ie.current=null),rt.current=null)},K=B=>{const $=B.touches[0],q=rt.current;if($==null||q==null)return;const X=$.clientX-q.clientX,ge=$.clientY-q.clientY;X*X+ge*ge<=wi*wi||A()},N=()=>{A()};document.addEventListener("touchmove",K,{passive:!0}),document.addEventListener("touchend",N),document.addEventListener("touchcancel",N),ke.current=A,Me.current=setTimeout(()=>{if(A({restoreNativeDraggable:!1}),t.startDrag(M)===!1){k.setAttribute("draggable","true"),Ie.current===k&&(Ie.current=null),rt.current=null;return}Ve.current=!0,Ie.current=k,k.setAttribute("draggable","false"),k.style.setProperty("touch-action","none"),Ke.current=y;const B=k.getBoundingClientRect(),$=_i(k);Object.assign($.style,{height:`${B.height}px`,opacity:"0.85",transform:`translate3d(${B.left}px, ${B.top}px, 0)`,width:`${B.width}px`}),so($),je.current=$,Et.current={x:C.clientX-B.left,y:C.clientY-B.top};const q=Ne=>{const le=Ne.touches[0];if(le==null)return;Ne.preventDefault();const F=Et.current;F!=null&&je.current!=null&&(je.current.style.transform=`translate3d(${le.clientX-F.x}px, ${le.clientY-F.y}px, 0)`),tr(vn(le.clientX,le.clientY)),ao(le.clientX,le.clientY)},X=Ne=>{const le=Ne.changedTouches[0];le!=null&&vn(le.clientX,le.clientY),t.completeDrag(),Ht()},ge=()=>{t.cancelDrag(),Ht()};ke.current=()=>{document.removeEventListener("touchmove",q),document.removeEventListener("touchend",X),document.removeEventListener("touchcancel",ge)},document.addEventListener("touchmove",q,{passive:!1}),document.addEventListener("touchend",X),document.addEventListener("touchcancel",ge)},Nh)},co=u=>{if(z!=null){if(u.key==="Escape"){Pe(),u.preventDefault(),u.stopPropagation();return}Oh.has(u.key)&&(u.preventDefault(),u.stopPropagation());return}if(Rt.isActive()){if(u.isComposing||u.keyCode===229)return;if(u.key==="Escape")Rt.cancel();else if(u.key==="Enter")Rt.commit();else return;ot("focus"),$e(Z=>Z+1),u.preventDefault(),u.stopPropagation();return}if(d&&u.key==="F2"){fl(L??void 0),u.preventDefault(),u.stopPropagation();return}if(Le){if(u.key==="Escape")Se.current=!1,qe.current=null,t.closeSearch();else if(u.key==="Enter"){const Z=t.getFocusedPath();Z!=null&&t.selectOnlyPath(Z);const Fe=V.current,wn=Kt(Fe,pe);qe.current=H<0||Fe==null?null:Math.max(0,Math.min(H*l-Fe.scrollTop,Math.max(0,wn-l))),Se.current=!0,t.closeSearch()}else if(u.key==="ArrowDown")t.focusNextSearchMatch();else if(u.key==="ArrowUp")t.focusPreviousSearchMatch();else return;ot("focus"),$e(Z=>Z+1),u.preventDefault(),u.stopPropagation();return}if(c&&zh(u)){t.openSearch(u.key),$e(Z=>Z+1),u.preventDefault(),u.stopPropagation();return}const y=xe&&$s(u),M=qh(u,xe),C=M&&E.current!=null?kn(E.current):null,k=M?new Set(Kh(E.current)):new Set,A=C?.dataset.fileTreeStickyPath??null,K=C?.dataset.fileTreeStickyRow==="true"&&A!=null;if(K&&A!==L&&k.has(A)){const Z=V.current;Xn(A,Z?.scrollTop??null),t.focusPath(A)}const N=t.getFocusedPath(),B=t.getFocusedIndex(),$=t.getFocusedItem();if($==null)return;const q=ki($)?$:null,X=N!=null&&(fn.has(N)||K&&A===N&&k.has(N)),ge=u.key==="ArrowDown"||u.key==="ArrowUp"||u.key==="ArrowRight"&&q!=null&&q.isExpanded(),Ne=u.key==="ArrowLeft"&&X&&q!=null&&q.isExpanded(),le=V.current;let F=!0;if(u.shiftKey&&u.key==="ArrowDown")t.extendSelectionFromFocused(1);else if(u.shiftKey&&u.key==="ArrowUp")t.extendSelectionFromFocused(-1);else if(y&&N!=null&&B>=0){const Z=t.getVisibleRows(B,B)[0]??null,Fe=Di(N,fe.current,Y.current);Z==null||Fe==null?F=!1:oo(Z,N)}else if((u.ctrlKey||u.metaKey)&&js(u))t.toggleFocusedSelection();else if((u.ctrlKey||u.metaKey)&&u.key.toLowerCase()==="a")t.selectAllVisiblePaths();else switch(u.key){case"ArrowDown":t.focusNextItem();break;case"ArrowUp":t.focusPreviousItem();break;case"ArrowRight":q==null||q.isExpanded()?t.focusNextItem():q.expand();break;case"ArrowLeft":q!=null&&q.isExpanded()?q.collapse():t.focusParentItem();break;case"Home":t.focusFirstItem();break;case"End":t.focusLastItem();break;default:F=!1}if(!F)return;ot("focus");const J=t.getFocusedPath(),ye=J!=null&&(fn.has(J)||k.has(J)),In=ge&&J!==N,xn=y&&K&&A===N&&J===N;if((X||xn)&&J!=null&&(In&&ye||xn))Xn(J,le?.scrollTop??null),j.current=!0,We(Z=>Z===J?Z:J);else{const Z=u.key==="ArrowUp"&&X&&J!==N;J!=null&&(Z||Ne&&J===N)?(Qs(J,Gh(E.current,le,C,N,l,gt,pe)),j.current=!0,We(Fe=>Fe===J?Fe:J)):Xs()}$e(Z=>Z+1),u.preventDefault(),u.stopPropagation()};Ce(()=>{if(!(!c||!Le)){if(Gr.current){Gr.current=!1;return}It(de.current)}},[Le,c]),Ce(()=>{const u=S.current;switch(Ch({hasRenderedInput:u!=null,previousRenamingPath:oe.current,renamingPath:mt})){case"reset":oe.current=null;return;case"reveal-canonical":mt!=null&&mn(mt,{restoreTreeFocus:!1,targetOffset:"live-overlay"});return;case"ignore":return;case"focus-input":u!=null&&(un.current=null,oe.current=mt,It(u),u.select());return}},[Te.end,Te.start,mt,mn,fn]),Ce(()=>{const u=E.current;if(u==null)return;let y=null;const M=()=>{y!=null&&(clearTimeout(y),y=null)},C=()=>{const K=kn(u)?.dataset.itemPath??null;We(N=>N===K?N:K)},k=()=>{M(),j.current=!0,C()},A=K=>{const N=K.relatedTarget;if(N==null){M(),y=setTimeout(()=>{if(y=null,kn(u)!=null){C();return}j.current=!1,We(null)},0);return}if(!(N instanceof Node)||!u.contains(N)){M(),j.current=!1,We(null);return}const B=N instanceof HTMLElement?N.dataset.itemPath??null:null;We($=>$===B?$:B)};return u.addEventListener("focusin",k),u.addEventListener("focusout",A),()=>{M(),u.removeEventListener("focusin",k),u.removeEventListener("focusout",A)}},[]),Ce(()=>{const u=E.current;u!=null&&(he.physical.scrollTop<=0?u.dataset.scrollAtTop="true":delete u.dataset.scrollAtTop)},[he.physical.scrollTop]),Ce(()=>{let u=null;const y=V.current,M=I.current,C=E.current;if(y==null)return;ne.current=Kt(y,v);const k=()=>{const F=t.getVisibleCount(),J=ci(ne.current,v),ye=Math.max(0,F*l-J);y.scrollTop>ye&&(y.scrollTop=ye),el(ar({controller:t,itemHeight:l,overscan:a,scrollTop:Math.min(y.scrollTop,ye),stickyFolders:g,viewportHeight:J}))};if(!re.current){re.current=!0;const F=t.getFocusedIndex();if(F>=0){const J=ci(ne.current,v),ye=t.getVisibleRows(F,F)[0]??null;ui(y,F,l,J,g&&ye!=null?Math.max(0,Math.min(ye.ancestorPaths.length*l,Math.max(0,J-l))):0)}}Q.current=k;const A=t.subscribe(()=>{bh(ue)&&$e(F=>F+1),k()}),K=()=>{dn.current!==!0&&(M!=null&&(M.dataset.isScrolling??=""),C!=null&&(C.dataset.isScrolling??=""),b.current=!0,u!=null&&clearTimeout(u),u=setTimeout(()=>{M!=null&&delete M.dataset.isScrolling,C!=null&&delete C.dataset.isScrolling,b.current=!1,Ys(F=>F+1),u=null},50))};let N=null;const B=()=>{C!=null&&delete C.dataset.overlayReveal,N!=null&&(clearTimeout(N),N=null)},$=()=>{C==null||dn.current===!0||y.scrollTop>0||(C.dataset.overlayReveal="true",N!=null&&clearTimeout(N),N=setTimeout(()=>{B()},200))},q=()=>{if(k(),y.scrollTop>0&&B(),Dt.current!=null&&b.current&&er.current(),dn.current===!0){b.current=!1;return}cn(F=>F==null?F:null),K()},X=()=>{K(),$()},ge=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"," ","Spacebar"]),Ne=F=>{ge.has(F.key)&&X()};y.addEventListener("scroll",q,{passive:!0}),y.addEventListener("wheel",X,{passive:!0}),y.addEventListener("touchmove",X,{passive:!0}),y.addEventListener("keydown",Ne);const le=typeof ResizeObserver<"u"?new ResizeObserver(F=>{ne.current=(F[0]==null?null:wh(F[0]))??Kt(y,v),k()}):null;return le?.observe(y),()=>{Q.current=()=>{},A(),y.removeEventListener("scroll",q),y.removeEventListener("wheel",X),y.removeEventListener("touchmove",X),y.removeEventListener("keydown",Ne),u!=null&&clearTimeout(u),N!=null&&clearTimeout(N),M!=null&&delete M.dataset.isScrolling,C!=null&&(delete C.dataset.isScrolling,delete C.dataset.overlayReveal),b.current=!1,ne.current=null,le?.disconnect()}},[t,v,l,a,g]),Ce(()=>{xe||z==null||Pe(!1)},[Pe,xe,z]);const uo=Qe(()=>z==null?null:`${z.path}::${z.source}`,[z]);Ce(()=>{if(uo==null){p?.clearSlotContent(Yt);return}const u=Dt.current;if(u==null)return;const y=x.current??w.current;if(y==null)return;const M={anchorElement:y,anchorRect:u.anchorRect??jh(y.getBoundingClientRect()),close:k=>{er.current(k?.restoreFocus??!0)},restoreFocus:()=>{vt.current&&ro.current(Dt.current?.path??null)}},C=e?.contextMenu?.render?.(u.item,M)??null;return p?.setSlotContent(Yt,C),e?.contextMenu?.onOpen?.(u.item,M),Ai(C),queueMicrotask(()=>{C==null||!C.isConnected||document.activeElement===C&&Ai(C)}),()=>{p?.clearSlotContent(Yt)}},[uo,e?.contextMenu,p]),Ce(()=>{z!=null&&t.getItem(z.path)==null&&Pe()},[Pe,z,t]),Ce(()=>{if(z==null)return;const u=E.current?.getRootNode(),y=u instanceof ShadowRoot?u.host:E.current,M=k=>{const A=k.target;A instanceof Node&&(Pi(k)||w.current?.contains(A)!==!0&&y?.contains(A)!==!0&&Pe())},C=k=>{k.key==="Escape"&&(k.preventDefault(),k.stopPropagation(),Pe())};return document.addEventListener("mousedown",M,!0),document.addEventListener("keydown",C,!0),()=>{document.removeEventListener("mousedown",M,!0),document.removeEventListener("keydown",C,!0)}},[Pe,z]),Ce(()=>{const u=V.current,y=E.current;if(u==null||y==null){se.current=L;return}const M=L==null?null:Y.current.get(L)??null,C=kn(y),k=C?.dataset.itemPath??null,A=Jn&&S.current===C,K=c&&de.current===C,N=Se.current&&!Le,B=qe.current??0,$=un.current,q=Mt.current,X=Tt.current,ge=Nt.current,Ne=C!=null,le=j.current||Ne,F=se.current!==L,J=q!=null&&q===L&&L!=null;let ye=!1,In=!1;if(it!=null&&it.id!==ce.current){ce.current=it.id;const rr=it.visibleIndex,go=t.getVisibleRows(rr,rr)[0]??null;if(go!=null){const $l=g?Math.max(0,Math.min(go.ancestorPaths.length*l,Math.max(0,pe-l))):gt;ye=!0,In=Sh(u,rr,l,pe,st,it.offset,$l)}t.clearScrollRequest(it.id)}const xn=!ye&&N&&Wt(u,H,l,pe,st,B),Z=!ye&&$!=null&&$===L&&Wt(u,H,l,pe,st,gt),Fe=!ye&&X!=null&&X.path===L&&Wt(u,H,l,pe,st,X.viewportOffset),wn=!ye&&ge!=null&&ge.path===L&&u.scrollTop!==ge.scrollTop;if(wn&&(u.scrollTop=ge.scrollTop),(wn||In||Z||Fe||xn||le&&F&&$!==L&&!J&&ui(u,H,l,pe,gt))&&Q.current(),ye){se.current=L;return}if(!le){se.current=L;return}if(A){se.current=L;return}if(K&&!N){se.current=L;return}if(M==null){N&&H>=0&&(Wt(u,H,l,pe,st,B),Q.current()),se.current=L;return}(F||N||$===L||q===L||X?.path===L||ge?.path===L||k==null||k!==L)&&(It(M),$===L&&(un.current=null),q===L&&(Mt.current=null),X?.path===L&&(Tt.current=null),ge?.path===L&&(Nt.current=null),Se.current=!1,qe.current=null),se.current=L},[t,H,L,Zn,l,Jn,Le,Te,pe,c,it,g,gt,st,hn]);const bl=H>=0&&H>=he.visible.startIndex&&H<=he.visible.endIndex,Il=L!=null&&Ft.some(u=>xt(u.row)===L),xl=bl||Il,wl=pt&&j.current===!0&&xl?L:null,Sl=Ws==="pointer"?Wn:null,lt=z?.path??Wr.current??Sl??wl??Wn,ho=z?.source==="right-click";Ce(()=>{b.current&&z==null||Bt(At(lt))},[z,At,Te,pe,Gs,Ft,lt,Bt,hn]);const Cl=ve(u=>{if(b.current||Pi(u))return;const y=u.target;if(!(y instanceof HTMLElement)||y.closest?.('[data-type="context-menu-trigger"]')!=null)return;const M=y.closest?.('[data-file-tree-sticky-row="true"]'),C=y.closest?.('[data-type="item"]'),k=M instanceof HTMLElement?M.dataset.fileTreeStickyPath??null:C instanceof HTMLElement?C.dataset.itemPath??null:null;k!=null&&ot(A=>A==="pointer"?A:"pointer"),cn(A=>A===k?A:k)},[]),_l=ve(()=>{cn(null)},[]);Ce(()=>{if(!Ue)return;const u=()=>{Ht(),t.cancelDrag()};return window.addEventListener("dragend",u),()=>{window.removeEventListener("dragend",u),Ht(),t.cancelDrag()}},[t,Ue]);const kl=u=>{if(!Ue||t.getDragSession()==null||Ve.current)return;const y=Ci(u.target instanceof HTMLElement?u.target:null);t.setDragTarget(y),tr(t.getDragSession()?.target??null),ao(u.clientX,u.clientY),u.dataTransfer!=null&&(u.dataTransfer.dropEffect="move"),u.preventDefault()},Pl=u=>{if(!Ue||t.getDragSession()==null||Ve.current)return;const y=u.relatedTarget;y instanceof Node&&E.current?.contains(y)===!0||(Ge(),zt(),t.setDragTarget(null))},El=u=>{!Ue||t.getDragSession()==null||Ve.current||(u.preventDefault(),vn(u.clientX,u.clientY),t.completeDrag(),gn(),Ge(),zt(),Ke.current=null)},qt=he.window.height,Dl=he.window.offsetTop,Ml=Math.min(0,pe-qt),Tl=Math.min(0,pe-qt-gt),Nl=Kr===L||Se.current,yt=L!=null&&Nl&&!Zn&&H>=0?hn[H]??t.getVisibleRows(H,H)[0]??null:null,fo=yt==null?null:di(H,l,Te,qt),Ye=Ke.current,Al=Lt!=null&&Ye!=null&&Ye.path===Lt&&Ye.index>=Te.start&&Ye.index<=Te.end,Ot=Lt!=null&&Ye!=null&&Ye.path===Lt&&!Al&&Ye.path!==yt?.path?Ye:null,po=Ot==null?null:di(Ot.index,l,Te,qt),Rl=Hh((H>=0?hn[H]??t.getVisibleRows(H,H)[0]??null:null)?.ancestorPaths.at(-1)??null),Vl=Le&&L!=null?Us(s,L,!Zn):void 0,Ll=z?.path??(Le?L:Kr),Fl=z?.path??Wn,jt=At(lt),nr=xe&&pt&&!ho&&!Jn&&jt!=null&&Gn!=null&<!=null,Bl=xe&&(nr||z!=null),yn=z?.anchorRect,mo=yn==null&&jt!=null&&Gn!=null&&(z!=null||nr)?Gn:null,zl=yn!=null?{left:`${yn.left}px`,position:"fixed",right:"auto",top:`${yn.top}px`}:mo!=null?{top:`${mo}px`}:void 0,Hl=ho?{opacity:"0"}:void 0,ql=ve((u,y,M,C)=>{const k=Ph({event:{ctrlKey:u.ctrlKey,metaKey:u.metaKey,shiftKey:u.shiftKey},isDirectory:y.kind==="directory",isSearchOpen:Le,mode:C}),A=k.toggleDirectory&&y.kind==="directory",K=A?t.resolveMountedDirectoryPathFromInput(M):null;if(A&&K==null)return;const N=K??M;switch(k.selection.kind){case"range":t.selectPathRange(N,k.selection.additive);break;case"toggle":t.togglePathSelectionFromInput(N);break;case"single":t.selectOnlyMountedPathFromInput(N);break}const B=u.currentTarget instanceof HTMLElement?u.currentTarget:null,$=y.index>=he.visible.startIndex&&y.index<=he.visible.endIndex,q=C==="flow"&&$&&B!=null&&B.dataset.itemParked!=="true";t.focusMountedPathFromInput(N),q&&(j.current=!0,We(X=>X===N?X:N),ot("focus")),A&&t.toggleMountedDirectoryFromInput(N),k.closeSearch&&t.closeSearch(),k.revealCanonical&&mn(N,{targetOffset:"sticky-parents"})},[t,Le,he.visible.endIndex,he.visible.startIndex,mn]),Ol=()=>{if(b.current||!pt||lt==null||jt==null)return;const u=t.getItem(lt);u!=null&&(Bt(jt),vt.current=!0,Yn({anchorRect:null,item:{kind:u.isDirectory()?"directory":"file",name:jt.getAttribute("aria-label")??lt,path:u.getPath()},path:u.getPath(),source:"button"}))},bn={contextHoverPath:Fl,contextMenuButtonTriggerEnabled:pt,contextMenuButtonVisibility:Qr,contextMenuEnabled:xe,contextMenuRightClickEnabled:rl,contextMenuTriggerMode:ft,controller:t,directoriesWithGitChanges:o,dragAndDropEnabled:Ue,draggedPathSet:al,dragTarget:cl,gitLaneActive:Jr,gitStatusByPath:n,handleRowDragEnd:vl,handleRowDragStart:gl,handleRowTouchStart:yl,ignoredGitDirectories:r,ignoredInheritanceCache:an,instanceId:s,itemHeight:l,onKeyDown:co,onRowClick:ql,openContextMenuForRow:oo,registerButton:ol,registerRenameInput:sl,renameView:Rt,renderDecorationForRow:hl,resolveIcon:Zr,shouldSuppressContextMenu:pl,visualFocusPath:Ll},jl={...bn,registerButton:il};return _("div",{ref:E,id:eo,"data-file-tree-context-menu-button-visibility":xe&&pt?Qr:void 0,"data-file-tree-context-menu-trigger-mode":xe?ft:void 0,"data-file-tree-has-context-menu-action-lane":xe&&pt?"true":void 0,"data-file-tree-has-git-lane":Jr?"true":void 0,"data-file-tree-virtualized-root":"true",onDragLeave:Ue?Pl:void 0,onDragOver:Ue?kl:void 0,onDrop:Ue?El:void 0,onKeyDown:co,onPointerLeave:xe?_l:void 0,onPointerOver:xe?Cl:void 0,role:"tree",tabIndex:-1,style:{outline:"none",position:"relative"},children:[_("style",{"data-file-tree-guide-style":"true",dangerouslySetInnerHTML:{__html:Rl}}),_("slot",{name:Vn,"data-type":"header-slot"}),c?_("div",{"data-file-tree-search-container":!0,"data-open":Le?"true":"false",children:_("input",{ref:de,"aria-activedescendant":Vl,"aria-controls":eo,placeholder:"Search…","data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Js?"true":void 0,value:ll,onBlur:()=>{f==="retain"&&!Xr.current||t.closeSearch()},onFocus:Qn,onPointerDown:Qn,onInput:u=>{Qn();const y=u.currentTarget;t.setSearch(y.value)}})}):null,_("div",{ref:V,"data-file-tree-virtualized-scroll":"true",children:[g&&tl&&Ft.length>0?_("div",{"aria-hidden":"true","data-file-tree-sticky-overlay":"true",children:_("div",{"data-file-tree-sticky-overlay-content":"true",style:{height:`${ul}px`},children:Ft.map((u,y)=>Rn(jl,u.row,`sticky:${xt(u.row)}`,{mode:"sticky",style:{left:"0",position:"absolute",right:"0",top:`${u.top}px`,zIndex:`${Ft.length-y}`}}))})}):null,_("div",{ref:I,"data-file-tree-virtualized-list":"true",style:{height:`${st}px`},children:[_("div",{"data-file-tree-virtualized-sticky-offset":"true","aria-hidden":"true",style:{height:`${Dl}px`}}),_("div",{"data-file-tree-virtualized-sticky":"true",style:{height:`${qt}px`,top:`${Ml}px`,bottom:`${Tl}px`},children:[Qh(bn,Te,fn),yt!=null&&fo!=null?Rn(bn,yt,`parked:${yt.path}`,{isParked:!0,style:{left:"0",opacity:"0",pointerEvents:Lt===yt.path?"none":void 0,position:"absolute",right:"0",top:`${fo}px`}}):null,Ot!=null&&po!=null?Rn(bn,Ot,`parked-drag:${Ot.path}`,{isParked:!0,style:{left:"0",opacity:"0",pointerEvents:"none",position:"absolute",right:"0",top:`${po}px`}}):null]})]})]}),xe?_("div",{ref:w,"data-type":"context-menu-anchor","data-visible":Bl?"true":"false",style:zl,children:[_("button",{ref:x,type:"button","data-type":na,"aria-label":"Options","aria-haspopup":"menu","aria-expanded":z!=null?"true":"false","data-visible":nr?"true":"false",onMouseDown:u=>{u.preventDefault()},onClick:u=>{if(u.preventDefault(),u.stopPropagation(),z!=null){Pe();return}Ol()},tabIndex:-1,style:Hl,children:_(Zt,{...Zr("file-tree-icon-ellipsis")})}),z!=null?_("slot",{name:Yt}):null]}):null,z!=null?_("div",{"data-type":"context-menu-wash","aria-hidden":"true",onMouseDownCapture:u=>{u.preventDefault(),Pe()},onTouchStartCapture:u=>{u.preventDefault(),u.stopPropagation(),Pe()},onTouchMoveCapture:u=>{u.preventDefault(),u.stopPropagation()},onWheelCapture:u=>{u.preventDefault(),u.stopPropagation()}}):null]})}const Ur={hydrateRoot:(e,t)=>{Yd(xr(Ri,t),e)},renderRoot:(e,t)=>{Sr(xr(Ri,t),e)},unmountRoot:e=>{Sr(null,e)}};function Gt(e,t){Ur.renderRoot(e,t)}function Jh(e,t){Ur.hydrateRoot(e,t)}function Zh(e){Ur.unmountRoot(e)}var ef=class{#e=new Map;#t=null;clearAll(){for(const e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){const t=this.#c(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#l(e);for(const[t,n]of this.#e)this.#u(t,n)}}setSlotContent(e,t){const n=this.#c(e);if(n===t){t!=null&&(this.#e.set(e,t),this.#u(e,t));return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#u(e,t)}setSlotHtml(e,t){const n=t?.trim()??"";if(n.length===0){this.setSlotContent(e,null);return}const r=this.#c(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#u(e,r);return}const o=document.createElement("div");o.innerHTML=n,this.setSlotContent(e,o)}#c(e){const t=this.#e.get(e)??null;if(t!=null)return t;const n=this.#t;if(n==null)return null;for(const r of Array.from(n.children))if(r instanceof HTMLElement&&r.dataset.fileTreeManagedSlot===e)return r;return null}#u(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#l(e){for(const t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;const n=t.dataset.fileTreeManagedSlot;n==null||this.#e.has(n)||this.#e.set(n,t)}}};let Vi=0;function tf(e){return e!=null&&e.length>0?e:(Vi+=1,`pst_ft_${Vi}`)}function nf({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??qi)}function Li(e){if(typeof document>"u")return;const t=document.createElement("div");t.innerHTML=e;const n=t.querySelector("svg");return n instanceof SVGElement?n:void 0}function Fi(e){return e.querySelector("#file-tree-icon-chevron")instanceof SVGElement&&e.querySelector("#file-tree-icon-file")instanceof SVGElement&&e.querySelector("#file-tree-icon-dot")instanceof SVGElement&&e.querySelector("#file-tree-icon-lock")instanceof SVGElement}function Bi(e){return Array.from(e.children).filter(t=>t instanceof SVGElement)}var rf=class{static LoadedCustomComponent=!0;#e;#t;#c;#u;#l;#z;#H;#v;#r;#y=new ef;#E;#b;#m;#h;#I;#x;#f;#q;#O;#R=null;#o;#j=!1;#$=!1;constructor(e){const{composition:t,density:n,fileTreeSearchMode:r,gitStatus:o,id:i,initialSearchQuery:s,icons:l,itemHeight:a,onSearchChange:d,onSelectionChange:h,overscan:f,renderRowDecoration:c,renaming:m,search:p,searchBlurBehavior:g,searchFakeFocus:v,stickyFolders:w,unsafeCSS:x,initialVisibleRowCount:b,...I}=e;this.#e=t,this.#c=tf(i),this.#h=ei(o),this.#I=l,this.#x=x,this.#u=h,this.#l=c,this.#z=m!=null&&m!==!1,this.#H=g,this.#v=p===!0,this.#r=v===!0,this.#E=yc(n,a),this.#b={itemHeight:this.#E.itemHeight,overscan:f,stickyFolders:w,initialVisibleRowCount:b},this.#t=new Td({...I,fileTreeSearchMode:r,initialSearchQuery:s,onSearchChange:d,renaming:m}),this.#O=this.#t.getSelectionVersion(),this.#R=this.#u==null?null:this.subscribe(()=>{this.#M()})}unmount(){this.#o!=null&&(Zh(this.#o),delete this.#o.dataset.fileTreeVirtualizedWrapper,this.#o=void 0),this.#y.clearAll(),this.#y.setHost(null),this.#m!=null&&(delete this.#m.dataset.fileTreeVirtualized,this.#L(this.#m),this.#m=void 0)}cleanUp(){this.unmount(),this.#R?.(),this.#R=null,this.#t.destroy()}getFileTreeContainer(){return this.#m}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getFocusedIndex(){return this.#t.getFocusedIndex()}getVisibleCount(){return this.#t.getVisibleCount()}getVisibleRows(e,t){return this.#t.getVisibleRows(e,t)}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#E.itemHeight}getDensityFactor(){return this.#E.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}focusFirstItem(){this.#t.focusFirstItem()}focusLastItem(){this.#t.focusLastItem()}focusNextItem(){this.#t.focusNextItem()}focusPreviousItem(){this.#t.focusPreviousItem()}focusParentItem(){this.#t.focusParentItem()}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}applyGitStatusPatch(e){const t=Vd(this.#h,e);if(t===this.#h)return;this.#h=t;const n=this.#s();n!=null&&Gt(n.wrapper,this.#D())}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){Array.isArray(e)?this.#t.resetPaths(e,t):this.#t.resetPaths(e)}setComposition(e){this.#e=e;const t=this.#s();t!=null&&(this.#_(),Gt(t.wrapper,this.#D()))}setGitStatus(e){const t=ei(e,this.#h);if(t===this.#h)return;this.#h=t;const n=this.#s();n!=null&&Gt(n.wrapper,this.#D())}setIcons(e){this.#I=e;const t=this.#s();t!=null&&(this.#g(t.host,t.wrapper),Gt(t.wrapper,this.#D()))}hydrate({fileTreeContainer:e}){const t=this.#N(e),n=this.#V(t);this.#_(),Jh(n,this.#D())}render({containerWrapper:e,fileTreeContainer:t}){const n=this.#N(t??this.#m,e),r=this.#V(n);this.#_(),Gt(r,this.#D())}#J(){return{initialViewportHeight:nf({initialVisibleRowCount:this.#b.initialVisibleRowCount,itemHeight:this.#b.itemHeight}),itemHeight:this.#b.itemHeight,overscan:this.#b.overscan,stickyFolders:this.#b.stickyFolders}}#D(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#h?.statusByPath,ignoredGitDirectories:this.#h?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#h?.directoriesWithChanges,icons:this.#I,instanceId:this.#c,renamingEnabled:this.#z,renderRowDecoration:this.#l,searchBlurBehavior:this.#H,searchEnabled:this.#v,searchFakeFocus:this.#r,slotHost:this.#y,...this.#J()}}#s(){const e=this.#m,t=this.#o;return e==null||t==null?null:{host:e,wrapper:t}}#g(e,t){const n=e.shadowRoot;n!=null&&(this.#U(n),this.#K(n)),this.#W(t)}#M(){const e=this.#u;if(e==null)return;const t=this.#t.getSelectionVersion();t!==this.#O&&(this.#O=t,e(this.#t.getSelectedPaths()))}#_(){const e=this.#e?.header?.render;if(e!=null){this.#y.setSlotContent(Vn,e());return}this.#y.setSlotHtml(Vn,this.#e?.header?.html??null)}#U(e){const t=Bi(e).find(r=>Fi(r)),n=Li(fc(Pn(this.#I).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t!=null?t.replaceWith(n):e.prepend(n)))}#K(e){const t=Bi(e),n=t.find(s=>Fi(s)),r=t.filter(s=>s!==n),o=Pn(this.#I).spriteSheet?.trim()??"";if(o.length===0){for(const s of r)s.remove();return}const i=Li(o);if(i==null){for(const s of r)s.remove();return}if(!(r.length===1&&r[0].outerHTML===i.outerHTML)){for(const s of r)s.remove();e.appendChild(i)}}#W(e){const t=Pn(this.#I);t.colored&&mc(t.set)?e.dataset.fileTreeColoredIcons="true":delete e.dataset.fileTreeColoredIcons}#a(e){const t=e.querySelector(`style[${yo}]`);if(this.#f==null&&t instanceof HTMLStyleElement&&(this.#f=t),this.#x==null||this.#x===""){this.#f?.remove(),this.#f=void 0,this.#q=void 0;return}this.#f?.parentNode===e&&this.#q===this.#x||(this.#f??=document.createElement("style"),this.#f.setAttribute(yo,""),this.#f.parentNode!==e&&e.appendChild(this.#f),this.#f.textContent=bc(this.#x),this.#q=this.#x)}#V(e){if(this.#o!=null)return this.#o;const t=e.shadowRoot;if(t==null)throw new Error("FileTree requires a shadow root");const n=Array.from(t.children).filter(o=>o instanceof HTMLDivElement&&typeof o.dataset.fileTreeId=="string"&&o.dataset.fileTreeId.length>0),r=n.find(o=>o.dataset.fileTreeId===this.#c)??n[0];return r!=null&&(this.#c=r.dataset.fileTreeId??this.#c),this.#o=r??document.createElement("div"),this.#o.dataset.fileTreeId=this.#c,this.#o.dataset.fileTreeVirtualizedWrapper="true",this.#g(e,this.#o),this.#o.parentNode!==t&&t.appendChild(this.#o),this.#o}#N(e,t){const n=e??this.#m??document.createElement("file-tree-container");t!=null&&n.parentNode!==t&&t.appendChild(n);const r=n.shadowRoot??n.attachShadow({mode:"open"});return dr(n,r),this.#a(r),n.dataset.fileTreeVirtualized="true",n.style.display="flex",this.#C(n),this.#y.setHost(n),this.#m=n,n}#C(e){e.style.getPropertyValue("--trees-item-height")===""&&(e.style.setProperty("--trees-item-height",`${String(this.#E.itemHeight)}px`),this.#j=!0),e.style.getPropertyValue("--trees-density-override")===""&&(e.style.setProperty("--trees-density-override",String(this.#E.factor)),this.#$=!0)}#L(e){this.#j&&(e.style.removeProperty("--trees-item-height"),this.#j=!1),this.#$&&(e.style.removeProperty("--trees-density-override"),this.#$=!1)}};function of(e){const[t]=U.useState(()=>new rf(e)),n=U.useRef({timeout:null,model:t});return U.useEffect(()=>{const{current:r}=n;return r.timeout!=null&&(clearTimeout(r.timeout),r.timeout=null),()=>{r.timeout=setTimeout(()=>r.model.cleanUp(),1)}},[]),{model:t}}function sf(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(!Object.is(e[n],t[n]))return!1;return!0}function lf(e,t,n){return Object.is(e,t)||n?.(e,t)===!0}function af(e,t,n){const r=U.useRef({hasValue:!1,model:null,selector:null,value:void 0}),o=U.useCallback(s=>e.subscribe(s),[e]),i=U.useCallback(()=>{const s=r.current,l=t(e);if(s.model!==e||s.selector!==t||!s.hasValue)return s.hasValue=!0,s.model=e,s.selector=t,s.value=l,l;const a=s.value;return lf(a,l,n)?a:(s.value=l,l)},[n,e,t]);return U.useSyncExternalStore(o,i,i)}function cf(e,t){return e.isOpen===t.isOpen&&e.value===t.value&&sf(e.matchingPaths,t.matchingPaths)}function uf(e){const t=af(e,n=>({isOpen:n.isSearchOpen(),matchingPaths:n.getSearchMatchingPaths(),value:n.getSearchValue()}),cf);return U.useMemo(()=>({...t,close:()=>{e.closeSearch()},focusNextMatch:()=>{e.focusNextSearchMatch()},focusPreviousMatch:()=>{e.focusPreviousSearchMatch()},open:n=>{e.openSearch(n)},setValue:n=>{e.setSearch(n)}}),[e,t])}const df=`
|
|
1268
|
+
}`}const _o=new WeakMap;function Ic(e){const t=_o.get(e);if(t!=null)return t;const n=document.createElement("div");n.setAttribute(ea,"true");const r=document.createElement("div");r.style.position="relative",r.style.height="200%",n.appendChild(r),e.appendChild(n);const o=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),_o.set(e,o),o}function xc(e,t){if(!e.isConnected)return;const n=Ic(t);if(n==null)return;const r=t.querySelector(`style[${bo}]`),o=r instanceof HTMLStyleElement?r:document.createElement("style");r instanceof HTMLStyleElement||(o.setAttribute(bo,""),t.appendChild(o)),o.textContent=`:host { ${ta}: ${n}px; }`}let Sn;function wc(e){if(typeof CSSStyleSheet<"u"&&typeof CSSStyleSheet.prototype.replaceSync=="function"&&"adoptedStyleSheets"in e){Sn==null&&(Sn=new CSSStyleSheet,Sn.replaceSync(Co(So)));let t=!1;try{e.adoptedStyleSheets=[Sn],t=!0}catch{}if(t){e.querySelector(`style[${vo}]`)?.remove();return}}if(e.querySelector("style[data-file-tree-style]")==null){const t=document.createElement("style");t.setAttribute(vo,""),t.textContent=Co(So),e.prepend(t)}}function dr(e,t){Sc(e,t),wc(t),xc(e,t)}function Sc(e,t){const n=e.querySelector('template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]');n instanceof HTMLTemplateElement&&(t.childNodes.length>0||(t.appendChild(n.content.cloneNode(!0)),n.hasAttribute("shadowrootmode")&&n.remove()))}if(typeof HTMLElement<"u"&&customElements.get("file-tree-container")==null){class e extends HTMLElement{constructor(){super()}connectedCallback(){const n=this.shadowRoot??this.attachShadow({mode:"open"});dr(this,n)}}if(customElements.define(cr,e),typeof document<"u")for(const t of Array.from(document.querySelectorAll(cr)))t instanceof HTMLElement&&dr(t,t.shadowRoot??t.attachShadow({mode:"open"}))}const en=5,qn=1<<en,Cc=qn*4;function Xt(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function ko(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function dt(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;const n=new Map;for(const r of t.childIds){const o=e[r];o!=null&&n.set(o.nameId,r)}return t.childIdByNameId=n,n}function On(e){if(e.childPositionById!=null)return e.childPositionById;const t=new Map;for(let n=0;n<e.childIds.length;n++){const r=e.childIds[n];r!=null&&t.set(r,n)}return e.childPositionById=t,t}function $t(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function ji(e,t){if(e.childPositionById!=null)for(let n=t;n<e.childIds.length;n++){const r=e.childIds[n];r!=null&&e.childPositionById.set(r,n)}}function Ln(e,t){let n=0,r=0;for(const o of t.childIds){const i=e[o];i!=null&&(n+=i.subtreeNodeCount,r+=i.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,wt(e,t)}function Dr(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;const o=On(e).get(t);if(o===void 0)return;const i=o>>en;e.childVisibleChunkSums[i]+=r}function hr(e,t,n){const r=t.childVisibleChunkSums;if(r!=null){let i=n,s=0;for(const l of r){if(i<l){const a=kc(e,t,s,i);return{...a,childVisibleIndex:n-a.localVisibleIndex}}i-=l,s+=qn}throw new Error(`Visible child index ${String(n)} is out of range`)}let o=n;for(let i=0;i<t.childIds.length;i++){const s=t.childIds[i];if(s==null)continue;const l=e[s];if(l!=null){if(o<l.visibleSubtreeCount)return{childIndex:i,childVisibleIndex:n-o,localVisibleIndex:o};o-=l.visibleSubtreeCount}}throw new Error(`Visible child index ${String(n)} is out of range`)}function _c(e,t,n){let r=0;const o=t.childVisibleChunkSums;let i=0;if(o!=null){const s=n>>en;for(let l=0;l<s;l+=1)r+=o[l]??0;i=s<<en}for(let s=i;s<n;s+=1){const l=t.childIds[s];if(l==null)continue;const a=e[l];a!=null&&(r+=a.visibleSubtreeCount)}return r}function wt(e,t){if(t.childIds.length<Cc){t.childVisibleChunkSums=null;return}const n=Math.ceil(t.childIds.length/qn),r=new Int32Array(n);for(let o=0;o<t.childIds.length;o++){const i=t.childIds[o];if(i==null)continue;const s=e[i];s!=null&&(r[o>>en]+=s.visibleSubtreeCount)}t.childVisibleChunkSums=r}function kc(e,t,n,r){const o=Math.min(t.childIds.length,n+qn);let i=r;for(let s=n;s<o;s++){const l=t.childIds[s];if(l==null)continue;const a=e[l];if(a!=null){if(i<a.visibleSubtreeCount)return{childIndex:s,localVisibleIndex:i};i-=a.visibleSubtreeCount}}throw new Error(`Visible child index ${String(r)} is out of range`)}const Pc=7,Mr=3,$i=1<<Mr,Ui=4;function _e(e,t,n=0){return e<<Ui|n<<Mr|t}function ze(e){return e.depthAndFlags>>>Ui}function jn(e){return(e.depthAndFlags&$i)>>Mr}function T(e){return(e.depthAndFlags&$i)!==0}function Ki(e){return e.depthAndFlags&Pc}function ae(e,t){return(Ki(e)&t)!==0}function $n(e,t){e.depthAndFlags|=t}function Ec(e,t){e.depthAndFlags=_e(t,Ki(e),jn(e))}const Wi=Symbol("benchmarkInstrumentation");function Dc(e,t){return t==null||Object.defineProperty(e,Wi,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function Tr(e){return e==null?null:e[Wi]??null}function P(e,t,n){return e==null?n():e.measurePhase(t,n)}function En(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function Po(e){return e>=48&&e<=57}function Mc(e){const t=[];let n=0,r=0;for(;r<e.length;){for(;r<e.length&&!Po(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let o=0;for(;r<e.length&&Po(e.charCodeAt(r));)o=o*10+(e.charCodeAt(r)-48),r+=1;t.push(o),n=r}return(n<e.length||t.length===0)&&t.push(e.slice(n)),t}function ln(e){const t=e.toLowerCase();return{lowerValue:t,tokens:Mc(t)}}function Tc(e,t){const n=Math.min(e.length,t.length);for(let r=0;r<n;r++){const o=e[r],i=t[r];if(o===i)continue;if(typeof o=="number"&&typeof i=="number")return o<i?-1:1;const s=String(o),l=String(i);if(s!==l)return s<l?-1:1}return e.length!==t.length?e.length<t.length?-1:1:0}function Nr(e,t){if(e.tokens.length===1&&t.tokens.length===1&&typeof e.tokens[0]=="string"&&typeof t.tokens[0]=="string")return e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1;const n=Tc(e.tokens,t.tokens);return n!==0?n:e.lowerValue!==t.lowerValue?e.lowerValue<t.lowerValue?-1:1:0}function Gi(e,t,n){const r=Nr(n(e),n(t));return r!==0?r:e===t?0:e<t?-1:1}function Nc(e,t){return Gi(e,t,ln)}function Fn(e,t){return t!==e.segments.length-1||e.isDirectory?1:0}function Ac(e,t){const n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){const o=e.segments[r],i=t.segments[r];if(o===i)continue;const s=Fn(e,r);return s!==Fn(t,r)?s===1?-1:1:Nc(o,i)}return e.segments.length!==t.segments.length?e.segments.length<t.segments.length?-1:1:e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1}function Rc(e,t){return Ac(e,t)}function Vc(e,t,n){const r=i=>{const s=n.get(i);if(s!=null)return s;const l=ln(i);return n.set(i,l),l},o=Math.min(e.segments.length,t.segments.length);for(let i=0;i<o;i++){const s=e.segments[i],l=t.segments[i];if(s===l)continue;const a=Fn(e,i);return a!==Fn(t,i)?a===1?-1:1:Gi(s,l,r)}return e.segments.length!==t.segments.length?e.segments.length<t.segments.length?-1:1:e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1}function fr(e,t){const n=e.sortKeyById[t];if(n!==void 0)return n;const r=e.valueById[t],o=ln(r);return e.sortKeyById[t]=o,o}function Yi(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??"default"}}function Xi(e){const t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[];let o=0;for(let i=0;i<n;i++)e.charCodeAt(i)===47&&(r.push(e.slice(o,i)),o=i+1);return r.push(e.slice(o,n)),{hasTrailingSlash:t,segments:r}}function Jt(e){const{hasTrailingSlash:t,segments:n}=Xi(e);return{basename:n[n.length-1]??"",isDirectory:t,path:e,segments:n}}function pr(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};const{hasTrailingSlash:t,segments:n}=Xi(e);return{requiresDirectory:t,segments:n}}function Qi(){const e=new Map;return e.set("",0),{idByValue:e,valueById:[""],sortKeyById:[ln("")]}}function Je(e,t){const n=e.idByValue.get(t);if(n!==void 0)return n;const r=e.valueById.length;return e.idByValue.set(t,r),e.valueById.push(t),r}function He(e,t){const n=e.valueById[t];if(n===void 0)throw new Error(`Unknown segment ID: ${String(t)}`);return n}const Ar=Symbol("pathStorePreparedInputKind");function Ji(e,t){return e[Ar]=t,e}function Eo(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function Zi(e,t,n){return n==="default"?Rc(e,t):n(Eo(e),Eo(t))}function Lc(){return{depthAndFlags:_e(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function Fc(e,t){const n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return r;return n}function Do(e){return e.isDirectory?e.segments.length:e.segments.length-1}function Bc(e){return Array.isArray(e)&&e.every(t=>t!=null&&typeof t=="object"&&typeof t.path=="string"&&Array.isArray(t.segments)&&typeof t.basename=="string"&&typeof t.isDirectory=="boolean")}function zc(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function Hc(e,t={}){return Rr(e,t).map(n=>n.path)}function qc(e,t={}){const n=Rr(e,t);return Ji({paths:n.map(r=>r.path),preparedPaths:n},"prepared")}function Oc(e){const t=e.length;let n=!1;for(let r=0;r<t;r+=1){const o=e[r];if(o.length>0&&o.charCodeAt(o.length-1)===47){n=!0;break}}return Ji({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},"presorted")}function jc(e){const t=e,n=t.preparedPaths;if(t[Ar]==="prepared"&&n!=null)return n;if(!Bc(n))throw new Error("preparedInput must come from PathStore.prepareInput()");return n}function $c(e){const t=e;return t[Ar]==="presorted"&&t.presortedPaths!=null||zc(t.presortedPaths)?t.presortedPaths:null}function Uc(e){const t=e;return typeof t.presortedPathsContainDirectories=="boolean"?t.presortedPathsContainDirectories:null}function Rr(e,t={}){const n=Yi(t),r=Tr(t);En(r,"workload.inputFiles",e.length);const o=P(r,"store.preparePathEntries.parse",()=>e.map(i=>Jt(i)));return P(r,"store.preparePathEntries.sort",()=>o.sort((i,s)=>Zi(i,s,n.sort))),o}var es=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[Lc()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=Qi();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=Tr(e),this.options=Yi(e);const t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{const n=new Set,r=t.length;for(let o=0;o<r;o+=1){const i=t[o],s=i.length;n.add(s>0&&i.charCodeAt(s-1)===47?i.slice(0,s-1):i)}this.initialExpandedPathSet=n,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,Xt())}appendPaths(e){return P(this.instrumentation,"store.builder.appendPaths.parse",()=>this.appendPreparedPaths(e.map(t=>Jt(t))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,P(this.instrumentation,"store.builder.appendPreparedPaths",()=>{for(const n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return P(this.instrumentation,"store.builder.appendPresortedPaths",()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0;const o=this.nodes,i=this.segmentTable,s=i.idByValue,l=i.valueById,a=this.directoryStack;let d=0,h="",f=0;for(const c of e){if(n===c)throw new Error(`Duplicate path: "${c}"`);const m=c.length>0&&c.charCodeAt(c.length-1)===47,p=m?c.length-1:c.length;let g=0,v=0;if(n!=null)if(h.length>0&&c.length>h.length&&c.startsWith(h))g=f,v=h.length;else{const b=Math.min(p,n.length);let I=!0;for(let S=0;S<b;S++){const E=c.charCodeAt(S);if(E!==n.charCodeAt(S)){I=!1;break}E===47&&(g++,v=S+1)}I&&m&&b===p&&n.length>p&&n.charCodeAt(p)===47&&(g++,v=p+1)}d=g,r=g;let w=v,x=c.indexOf("/",w);for(;x>=0&&x<p;){const b=a[d];if(b===void 0)throw new Error("Directory stack underflow while building the path store");r++;const I=c.slice(w,x);let S=s.get(I);S===void 0&&(S=l.length,s.set(I,S),l.push(I));const E=o.length;o.push({depthAndFlags:_e(r,0,1),nameId:S,parentId:b,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(c.slice(0,x)),d++,a[d]=E,w=x+1,x=c.indexOf("/",w)}if(m){if(w<p){const I=a[d];if(I===void 0)throw new Error(`Unable to resolve directory parent for "${c}"`);r++;const S=c.slice(w,p);let E=s.get(S);E===void 0&&(E=l.length,s.set(S,E),l.push(S));const V=o.length;o.push({depthAndFlags:_e(r,0,1),nameId:E,parentId:I,subtreeNodeCount:1,visibleSubtreeCount:1}),d++,a[d]=V,w=p+1}const b=a[d];if(b===void 0)throw new Error(`Unable to resolve directory node for "${c}"`);this.promoteDirectoryToExplicit(b,c)}else{const b=a[d];if(b===void 0)throw new Error(`Unable to resolve file parent for "${c}"`);const I=c.slice(w);let S=s.get(I);S===void 0&&(S=l.length,s.set(I,S),l.push(I)),o.push({depthAndFlags:_e(r+1,0),nameId:S,parentId:b,subtreeNodeCount:1,visibleSubtreeCount:1})}w!==h.length&&(h=c.substring(0,w),f=r),n=c}a.length=d+1,n!=null&&(this.lastPreparedPath=Jt(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0;const r=this.nodes,o=this.segmentTable,i=o.idByValue,s=o.valueById,l=this.directoryStack;let a=0,d="",h=0;for(const f of e){if(t===f)throw new Error(`Duplicate path: "${f}"`);const c=f.length;let m=0,p=0;if(t!=null)if(d.length>0&&f.length>d.length&&f.startsWith(d))m=h,p=d.length;else{const I=Math.min(c,t.length);for(let S=0;S<I;S++){const E=f.charCodeAt(S);if(E!==t.charCodeAt(S))break;E===47&&(m++,p=S+1)}}a=m,n=m;let g=p,v=f.indexOf("/",g);for(;v>=0;){const I=l[a];if(I===void 0)throw new Error("Directory stack underflow while building the path store");n++;const S=f.slice(g,v);let E=i.get(S);E===void 0&&(E=s.length,i.set(S,E),s.push(S));const V=r.length;r.push({depthAndFlags:_e(n,0,1),nameId:E,parentId:I,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(f.slice(0,v)),this.presortedDirectoryNodeIds.push(V),a++,l[a]=V,g=v+1,v=f.indexOf("/",g)}const w=l[a];if(w===void 0)throw new Error(`Unable to resolve file parent for "${f}"`);const x=f.slice(g);let b=i.get(x);b===void 0&&(b=s.length,i.set(x,b),s.push(x)),r.push({depthAndFlags:_e(n+1,0),nameId:b,parentId:w,subtreeNodeCount:1,visibleSubtreeCount:1}),g!==d.length&&(d=f.substring(0,g),h=n),t=f}l.length=a+1,t!=null&&(this.lastPreparedPath=Jt(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){const t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(P(this.instrumentation,"store.builder.buildDirectoryIndexes",()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||P(this.instrumentation,"store.builder.computeSubtreeCounts",()=>this.computeSubtreeCounts(0)),{directories:this.directories,nodes:this.nodes,options:this.options,rootId:0,segmentTable:this.segmentTable,presortedDirectoryNodeIds:this.presortedDirectoryNodeIds.length>0?this.presortedDirectoryNodeIds:null}}didMatchAllInitialExpandedPaths(){return this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&this.createdDirectoryCount===this.initialExpandedPathSet.size}appendPreparedPath(e,t){if(this.hasDeferredDirectoryIndexes&&(this.buildDirectoryIndexes(),this.hasDeferredDirectoryIndexes=!1),this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw new Error(`Duplicate path: "${e.path}"`);if(t&&(this.options.sort==="default"?Vc(this.lastPreparedPath,e,this.segmentSortKeyCache):Zi(this.lastPreparedPath,e,this.options.sort))>0)throw new Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}const n=this.lastPreparedPath,r=Do(e),o=n==null?0:Do(n),i=n==null?0:Fc(n.segments,e.segments),s=Math.min(i,r,o);this.directoryStack.length=s+1;for(let a=s;a<r;a++){const d=this.directoryStack[this.directoryStack.length-1];if(d===void 0)throw new Error("Directory stack underflow while building the path store");const h=t?this.getOrCreateDirectoryChild(d,e.segments[a]):this.createDirectoryChild(d,e.segments[a]);this.directoryStack.push(h)}if(e.isDirectory){const a=this.directoryStack[this.directoryStack.length-1];if(a===void 0)throw new Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(a,e.path),this.lastPreparedPath=e;return}const l=this.directoryStack[this.directoryStack.length-1];if(l===void 0)throw new Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(l,e.basename,e.path):this.createFileChildUnchecked(l,e.basename),this.lastPreparedPath=e}recordCreatedDirectoryPath(e){!this.createdDirectoriesAllExpanded||this.initialExpandedPathSet==null||(this.createdDirectoryCount+=1,this.initialExpandedPathSet.has(e)||(this.createdDirectoriesAllExpanded=!1))}createFileChild(e,t,n){const r=Je(this.segmentTable,t),o=this.getDirectoryIndex(e),i=o.childIdByNameId;if(i!=null&&i.get(r)!==void 0)throw new Error(`Path collides with an existing entry: "${n}"`);const s=this.nodes[e];if(s===void 0)throw new Error(`Unknown parent node ID: ${String(e)}`);const l=this.nodes.length;return this.nodes.push({depthAndFlags:_e(ze(s)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),i?.set(r,l),$t(o,l),l}createFileChildUnchecked(e,t){const n=Je(this.segmentTable,t),r=this.getDirectoryIndex(e),o=this.nodes[e];if(o===void 0)throw new Error(`Unknown parent node ID: ${String(e)}`);const i=this.nodes.length;return this.nodes.push({depthAndFlags:_e(ze(o)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,i),$t(r,i),i}getOrCreateDirectoryChild(e,t){const n=Je(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){const s=r.childIdByNameId.get(n);if(s!==void 0){const l=this.nodes[s];if(l!=null&&!T(l))throw new Error(`Path collides with an existing file while creating directory "${t}"`);return s}}const o=this.nodes[e];if(o===void 0)throw new Error(`Unknown parent node ID: ${String(e)}`);const i=this.nodes.length;return this.nodes.push({depthAndFlags:_e(ze(o)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,i),$t(r,i),this.directories.set(i,Xt()),i}createDirectoryChild(e,t){const n=Je(this.segmentTable,t),r=this.getDirectoryIndex(e),o=this.nodes[e];if(o===void 0)throw new Error(`Unknown parent node ID: ${String(e)}`);const i=this.nodes.length;return this.nodes.push({depthAndFlags:_e(ze(o)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,i),$t(r,i),this.directories.set(i,Xt()),i}promoteDirectoryToExplicit(e,t){const n=this.nodes[e];if(n===void 0)throw new Error(`Unknown directory node ID: ${String(e)}`);if(!T(n))throw new Error(`Path is not a directory: "${t}"`);if(ae(n,1))throw new Error(`Duplicate path: "${t}"`);$n(n,1)}getDirectoryIndex(e){const t=this.directories.get(e);if(t!==void 0)return t;throw new Error(`Unknown directory child index for node ${String(e)}`)}buildPresortedFinish(e){const t=this.nodes,n=this.directories;n.set(0,ko());let r=-1,o=null;for(let i=1;i<t.length;i++){const s=t[i];if(s==null)continue;if(T(s)){const a=ko();n.set(i,a),r=i,o=a}let l;s.parentId===r?l=o:(l=n.get(s.parentId),r=s.parentId,o=l??null),l?.childIds.push(i)}if(!e)for(let i=t.length-1;i>=1;i--){const s=t[i];if(s==null)continue;const l=t[s.parentId];l!=null&&(l.subtreeNodeCount+=s.subtreeNodeCount,l.visibleSubtreeCount+=s.visibleSubtreeCount)}}buildDirectoryIndexes(){const e=this.nodes;for(let t=1;t<e.length;t++){const n=e[t];if(n==null)continue;T(n)&&this.directories.set(t,Xt());const r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),$t(r,t))}}computeSubtreeCounts(e){const t=this.nodes[e];if(t===void 0)throw new Error(`Unknown node ID: ${String(e)}`);if(!T(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;const n=this.getDirectoryIndex(e);let r=1;for(const o of n.childIds)r+=this.computeSubtreeCounts(o);return Ln(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function Kc(e,t="closed",n=null){const r=Gc(t);return{activeNodeCount:e.nodes.length-1,collapsedDirectoryIds:new Set,collapseNewDirectoriesByDefault:!1,defaultExpansion:r,directoriesOpenByDefault:r==="open",hasCollapsedDirectoryOverrides:!1,directoryLoadInfoById:new Map,expandedDirectoryIds:new Set,instrumentation:n,listeners:new Map,pathCacheByNodeId:new Map([[e.rootId,{path:"",version:0}]]),pathCacheVersion:0,snapshot:e,transactionStack:[]}}function Wc(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function Gc(e){if(typeof e!="number")return e;if(!Number.isInteger(e)||e<0)throw new Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(e)}`);return e}function ts(e,t){return ae(t,2)||e.defaultExpansion==="open"?!0:e.defaultExpansion==="closed"?!1:ze(t)<=e.defaultExpansion}function be(e,t,n=e.snapshot.nodes[t]){return n==null||!T(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:ts(e,n)}function tn(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!T(r))return;const o=ts(e,r);if(n){if(o){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t);return}if(o){e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0;return}e.expandedDirectoryIds.delete(t)}function ns(e,t){const n=e.directoryLoadInfoById.get(t);if(n!=null)return n;const r={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:"loaded"};return e.directoryLoadInfoById.set(t,r),r}function nn(e,t){return e.directoryLoadInfoById.get(t)?.state??"loaded"}function Yc(e,t){const n=ns(e,t);if(n.state==="loading"&&n.activeAttemptId!=null)return{attemptId:n.activeAttemptId,nodeId:t,reused:!0};const r=n.nextAttemptId;return n.activeAttemptId=r,n.errorMessage=null,n.nextAttemptId+=1,n.state="loading",{attemptId:r,nodeId:t,reused:!1}}function Xc(e,t){const n=ns(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state="unloaded"}function Qc(e,t,n){const r=e.directoryLoadInfoById.get(t);return r==null||r.activeAttemptId!==n?!1:(r.activeAttemptId=null,r.errorMessage=null,r.state="loaded",!0)}function Jc(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function Zc(e,t,n,r){const o=e.directoryLoadInfoById.get(t);return o==null||o.activeAttemptId!==n?!1:(o.activeAttemptId=null,o.errorMessage=r??null,o.state="error",!0)}function eu(e,t){e.directoryLoadInfoById.delete(t)}function tu(e,t,n){const r=n,o=e.listeners.get(t);return o!=null?o.add(r):e.listeners.set(t,new Set([r])),()=>{const i=e.listeners.get(t);i!=null&&(i.delete(r),i.size===0&&e.listeners.delete(t))}}function nu(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:"add",path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function ru(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:"remove",path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function ou(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:"move",projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function iu(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:"expand",path:e.path,projectionChanged:!0,visibleCountDelta:null}}function su(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:"collapse",path:e.path,projectionChanged:!0,visibleCountDelta:null}}function lu(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:"mark-directory-unloaded",path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function au(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:"begin-child-load",path:e.path,projectionChanged:e.projectionChanged,reused:e.reused,visibleCountDelta:null}}function cu(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some(t=>t.canonicalChanged),childEvents:e.childEvents,operation:"apply-child-patch",path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function uu(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:"complete-child-load",path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function du(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,errorMessage:e.errorMessage,operation:"fail-child-load",path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function hu(e){return{activeNodeCountAfter:e.activeNodeCountAfter,activeNodeCountBefore:e.activeNodeCountBefore,affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],cachedPathEntryCountAfter:e.cachedPathEntryCountAfter,cachedPathEntryCountBefore:e.cachedPathEntryCountBefore,canonicalChanged:!1,idsPreserved:e.idsPreserved,loadInfoEntryCountAfter:e.loadInfoEntryCountAfter,loadInfoEntryCountBefore:e.loadInfoEntryCountBefore,mode:e.mode,operation:"cleanup",projectionChanged:e.projectionChanged,reclaimedCachedPathEntryCount:e.reclaimedCachedPathEntryCount,reclaimedLoadInfoEntryCount:e.reclaimedLoadInfoEntryCount,reclaimedNodeSlotCount:e.reclaimedNodeSlotCount,reclaimedSegmentCount:e.reclaimedSegmentCount,segmentCountAfter:e.segmentCountAfter,segmentCountBefore:e.segmentCountBefore,totalNodeSlotCountAfter:e.totalNodeSlotCountAfter,totalNodeSlotCountBefore:e.totalNodeSlotCountBefore,visibleCountDelta:null}}function we(e,t,n){return{...n,visibleCountDelta:gr(e)-t}}function fu(e,t){const n=gr(e),r=Wc();e.transactionStack.push(r);try{t()}catch(o){throw To(e,r,!1),o}To(e,r,!0,gr(e)-n)}function Ae(e,t){const n=e.instrumentation;if(n==null){Mo(e,t);return}P(n,"store.events.record",()=>Mo(e,t))}function Mo(e,t){const n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){mr(e,t);return}n.events.push(t),gu(n,t)}function To(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw new Error("Transaction stack underflow");if(!n)return;const o=e.transactionStack[e.transactionStack.length-1]??null;if(o!=null){const l=e.instrumentation;l==null?No(o,t):P(l,"store.events.batch.merge",()=>No(o,t));return}const i=pu(t,r),s=e.instrumentation;if(s==null){mr(e,i);return}P(s,"store.events.batch.commit",()=>mr(e,i))}function pu(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some(n=>n.canonicalChanged),events:[...e.events],operation:"batch",projectionChanged:e.events.some(n=>n.projectionChanged),visibleCountDelta:t}}function mu(e,t){for(const n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(const n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function No(e,t){for(const n of t.events)e.events.push(n);mu(e,t)}function gu(e,t){for(const n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(const n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function mr(e,t){const n=e.instrumentation;if(n==null){Ao(e,t);return}P(n,"store.events.emit",()=>Ao(e,t))}function Ao(e,t){e.listeners.get(t.operation)?.forEach(n=>n(t)),e.listeners.get("*")?.forEach(n=>n(t))}function gr(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function kt(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;const n=e.snapshot.nodes[t];if(n==null||!T(n)||ae(n,2))return null;const r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;const o=r.childIds[0];if(o==null)return null;const i=e.snapshot.nodes[o];return i==null||!T(i)?null:o}function ct(e,t){let n=t;for(;;){const r=kt(e,n);if(r==null)return n;n=r}}function Bn(e,t){const n=[t];let r=t;for(;;){const o=kt(e,r);if(o==null)return n;n.push(o),r=o}}function rs(e,t){const n=t==null?e.snapshot.rootId:Ee(e,t);return n==null?[]:yu(e,n)}function Ro(e,t){const n=Jt(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),o=Ze(e,Pu(e,r)),{createdNodeIds:i,directoryId:s}=bu(e,r),l=new Set(i);let a=s;if(n.isDirectory){const h=D(e,s);if(ae(h,1))throw new Error(`Path already exists: "${t}"`);$n(h,1),e.pathCacheByNodeId.set(s,{path:t,version:e.pathCacheVersion}),l.add(s)}else a=xu(e,s,n.basename),l.add(a);ut(e,s);const d=Ze(e,s);return nu({affectedAncestorIds:Re(e,a),affectedNodeIds:[...l],path:t,projectionChanged:ss(o,d)})}function Vo(e,t,n){const r=Ee(e,t);if(r==null)throw new Error(`Path does not exist: "${t}"`);const o=D(e,r);if(ae(o,2))throw new Error("The root node cannot be removed");if(T(o)&&G(e,r).childIds.length>0&&n.recursive!==!0)throw new Error(`Cannot remove a non-empty directory without recursive: "${t}"`);const i=o.parentId,s=Ze(e,i),l=is(e,r);Fr(e,i,r,o.nameId),Br(e,i),ut(e,i);const a=Ze(e,i);return ru({affectedAncestorIds:Re(e,i),affectedNodeIds:l,path:t,projectionChanged:ss(s,a),recursive:n.recursive===!0})}function Lo(e,t,n,r){const o=Ee(e,t);if(o==null)throw new Error(`Source path does not exist: "${t}"`);const i=D(e,o);if(ae(i,2))throw new Error("The root node cannot be moved");const s=r.collision??"error",l=_u(e,o,n),a=Ze(e,i.parentId),d=Ze(e,l.parentId),h=He(e.snapshot.segmentTable,i.nameId),f=Je(e.snapshot.segmentTable,l.basename);if(l.parentId===i.parentId&&h===l.basename)return null;if(T(i)&&Du(e,o,l.parentId))throw new Error("Cannot move a directory into one of its descendants");const c=dt(e.snapshot.nodes,G(e,l.parentId)).get(f),m=l.existingNodeId??c??null;if(m!=null&&m!==o&&ku(e,m,s,jn(i))==="skip")return null;const p=i.parentId;Fr(e,p,o,i.nameId),i.parentId=l.parentId,i.nameId=f,e.pathCacheByNodeId.delete(o),as(e,o),Lr(e,l.parentId,o),Br(e,p),e.pathCacheVersion++,ut(e,p),l.parentId!==p&&ut(e,l.parentId);const g=Ze(e,p),v=Ze(e,l.parentId);return ou({affectedAncestorIds:[...new Set([...Re(e,p),...Re(e,l.parentId)])],affectedNodeIds:[o],from:t,projectionChanged:ls([a,d],[g,v]),to:W(e,o)})}function vu(e,t){const n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function Fo(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function W(e,t){const n=D(e,t),r=vu(e,t);if(r!=null)return r;if(ae(n,2))return Fo(e,t,"");const o=W(e,n.parentId),i=He(e.snapshot.segmentTable,n.nameId),s=o.length===0?i:`${o}${i}`;return Fo(e,t,T(n)?`${s}/`:s)}function ut(e,t){const n=e.instrumentation;if(n==null){zo(e,t);return}P(n,"store.recomputeCountsUpwardFrom",()=>zo(e,t))}function Vr(e,t){const n=[[t,0]],{nodes:r,directories:o}=e.snapshot;for(;n.length>0;){const i=n[n.length-1],s=i[0],l=r[s];if(l==null||!T(l)){vr(e,s,l,!0),n.pop();continue}const a=o.get(s);if(a==null||i[1]>=a.childIds.length){vr(e,s,l,!0),n.pop();continue}const d=a.childIds[i[1]++];n.push([d,0])}}function Re(e,t){const n=[];let r=t;for(;r!=null;){const o=D(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=o.parentId}return n}function Ee(e,t){if(t.length===0)return e.snapshot.rootId;const n=pr(t);return os(e,n.segments,n.requiresDirectory)}function os(e,t,n){let r=e.snapshot.rootId;for(const i of t){const s=e.snapshot.segmentTable.idByValue.get(i);if(s===void 0)return null;const l=G(e,r),a=dt(e.snapshot.nodes,l).get(s);if(a===void 0)return null;r=a}const o=D(e,r);return n&&!T(o)?null:r}function G(e,t){const n=e.snapshot.directories.get(t);if(n===void 0)throw new Error(`Unknown directory child index for node ${String(t)}`);return n}function D(e,t){const n=e.snapshot.nodes[t];if(n===void 0||ae(n,4))throw new Error(`Unknown node ID: ${String(t)}`);return n}function yu(e,t){const n=e.snapshot.nodes[t];if(n===void 0||ae(n,4))return[];if(!T(n))return[W(e,t)];if(G(e,t).childIds.length===0)return ae(n,1)&&!ae(n,2)?[W(e,t)]:[];const r=[],o=[{childIndex:0,nodeId:t}];for(;o.length>0;){const i=o[o.length-1];if(i==null)break;const s=e.snapshot.nodes[i.nodeId];if(s===void 0||ae(s,4)){o.pop();continue}if(!T(s)){r.push(W(e,i.nodeId)),o.pop();continue}const l=G(e,i.nodeId);if(l.childIds.length===0){ae(s,1)&&!ae(s,2)&&r.push(W(e,i.nodeId)),o.pop();continue}const a=l.childIds[i.childIndex];if(a==null){o.pop();continue}i.childIndex++,o.push({childIndex:0,nodeId:a})}return r}function bu(e,t){const n=[];let r=e.snapshot.rootId;for(const o of t){const i=Je(e.snapshot.segmentTable,o),s=G(e,r),l=dt(e.snapshot.nodes,s).get(i);if(l!==void 0){if(!T(D(e,l)))throw new Error(`Cannot create a directory that collides with an existing file: "${o}"`);r=l;continue}r=Iu(e,r,i),n.push(r)}return{createdNodeIds:n,directoryId:r}}function Iu(e,t,n){const r=D(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:_e(ze(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(o,Xt()),Lr(e,t,o),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(o),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,o}function xu(e,t,n){const r=Je(e.snapshot.segmentTable,n),o=G(e,t);if(dt(e.snapshot.nodes,o).has(r))throw new Error(`Path already exists: "${Mu(e,t,n)}"`);const i=D(e,t),s=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:_e(ze(i)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),Lr(e,t,s),e.activeNodeCount++,s}function wu(e,t,n){let r=0,o=t.childIds.length;for(;r<o;){const i=r+o>>>1,s=t.childIds[i];if(s==null){o=i;continue}Su(e,n,s)<0?o=i:r=i+1}return r}function Lr(e,t,n){const r=G(e,t),o=D(e,n);dt(e.snapshot.nodes,r).set(o.nameId,n),Dr(r,n,o.subtreeNodeCount,o.visibleSubtreeCount);const i=wu(e,r,n);r.childIds.splice(i,0,n),ji(r,i),wt(e.snapshot.nodes,r)}function Fr(e,t,n,r){const o=G(e,t),i=On(o),s=i.get(n)??-1;dt(e.snapshot.nodes,o).delete(r),i.delete(n);const l=e.snapshot.nodes[n];l!=null&&Dr(o,n,-l.subtreeNodeCount,-l.visibleSubtreeCount),s>=0&&(o.childIds.splice(s,1),ji(o,s),wt(e.snapshot.nodes,o))}function Su(e,t,n){const r=e.snapshot.options.sort;return r==="default"?Cu(e,t,n):r(Bo(e,t),Bo(e,n))}function Cu(e,t,n){const r=D(e,t),o=D(e,n),i=T(r);if(i!==T(o))return i?-1:1;const s=Nr(fr(e.snapshot.segmentTable,r.nameId),fr(e.snapshot.segmentTable,o.nameId));if(s!==0)return s;const l=He(e.snapshot.segmentTable,r.nameId),a=He(e.snapshot.segmentTable,o.nameId);return l!==a?l<a?-1:1:t<n?-1:1}function Bo(e,t){const n=D(e,t),r=W(e,t),o=T(n),i=o?r.slice(0,-1):r;return{basename:He(e.snapshot.segmentTable,n.nameId),depth:ze(n),isDirectory:o,path:r,segments:i.length===0?[]:i.split("/")}}function _u(e,t,n){const r=D(e,t),o=Ee(e,n);if(o!=null){const d=D(e,o);if(T(d))return{basename:He(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:o};const h=pr(n).segments;return{basename:h[h.length-1]??"",existingNodeId:o,parentId:d.parentId}}const i=pr(n),s=i.segments[i.segments.length-1]??"",l=i.segments.slice(0,-1),a=l.length===0?e.snapshot.rootId:os(e,l,!0);if(a==null)throw new Error(`Destination parent does not exist: "${n}"`);return{basename:s,existingNodeId:null,parentId:a}}function ku(e,t,n,r){if(n==="skip")return"skip";if(n==="error")throw new Error(`Destination already exists: "${W(e,t)}"`);const o=D(e,t);if(jn(o)!==r)throw new Error("replace collision requires the same source and destination kinds");if(T(o)&&G(e,t).childIds.length>0)throw new Error("replace collision does not support non-empty directories");const i=o.parentId,s=o.nameId;return is(e,t),Fr(e,i,t,s),Br(e,i),ut(e,i),"handled"}function is(e,t){const n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){const o=r.pop();if(o==null)break;const i=D(e,o.nodeId);if(o.visitedChildren||!T(i)){T(i)&&e.snapshot.directories.delete(o.nodeId),$n(i,4),e.pathCacheByNodeId.delete(o.nodeId),e.collapsedDirectoryIds.delete(o.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(o.nodeId),eu(e,o.nodeId),e.activeNodeCount--,n.push(o.nodeId);continue}r.push({nodeId:o.nodeId,visitedChildren:!0});const s=G(e,o.nodeId);for(let l=s.childIds.length-1;l>=0;l--){const a=s.childIds[l];a!=null&&r.push({nodeId:a,visitedChildren:!1})}}return n}function Br(e,t){let n=t;for(;n!=null;){const r=D(e,n);if(!T(r)||ae(r,2)||G(e,n).childIds.length>0)return;$n(r,1),n=r.parentId===n?null:r.parentId}}function Pu(e,t){let n=e.snapshot.rootId;for(const r of t){const o=e.snapshot.segmentTable.idByValue.get(r);if(o==null)break;const i=dt(e.snapshot.nodes,G(e,n)).get(o);if(i==null||!T(D(e,i)))break;n=i}return n}function Ze(e,t){const n=Eu(e,t);if(n==null)return null;const r=ct(e,n),o=D(e,r),i=n===r?null:Bn(e,n).map(s=>W(e,s));return JSON.stringify({flattenedSegmentPaths:i,hasChildren:G(e,r).childIds.length>0,path:W(e,r),terminalKind:jn(o)})}function ss(e,t){return ls([e],[t])}function ls(e,t){for(let n=0;n<e.length;n+=1){const r=e[n],o=t[n];if(r==null||o==null||r!==o)return!0}return!1}function Eu(e,t){let n=t;for(;n!=null;){const r=D(e,n);if(!T(r)||ae(r,2))return null;if(!be(e,n,r))return n;n=r.parentId}return null}function as(e,t){const n=D(e,t);if(Ec(n,(t===e.snapshot.rootId?-1:ze(D(e,n.parentId)))+1),!T(n))return;const r=G(e,t);for(const o of r.childIds)as(e,o)}function Du(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;const o=D(e,r);if(r===e.snapshot.rootId)return!1;r=o.parentId}return!1}function vr(e,t,n=D(e,t),r=!1){const o=e.instrumentation;if(o==null){Ho(e,t,n,r);return}P(o,"store.recomputeNodeCounts",()=>Ho(e,t,n,r))}function zo(e,t){let n=t;for(;n!=null;){const r=D(e,n),o=r.subtreeNodeCount,i=r.visibleSubtreeCount;if(vr(e,n,r),n===e.snapshot.rootId)return;const s=r.subtreeNodeCount-o,l=r.visibleSubtreeCount-i,a=r.parentId;(s!==0||l!==0)&&Dr(G(e,a),n,s,l),n=a}}function Ho(e,t,n,r){if(!T(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}const o=G(e,t);if(r){const l=e.instrumentation;l==null?Ln(e.snapshot.nodes,o):P(l,"store.recomputeNodeCounts.rebuildChildAggregates",()=>Ln(e.snapshot.nodes,o))}const i=1+o.totalChildSubtreeNodeCount,s=o.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=i,ae(n,2)){n.visibleSubtreeCount=s;return}n.visibleSubtreeCount=kt(e,t)!=null?s:be(e,t,n)?1+s:1}function Mu(e,t,n){const r=W(e,t);return r.length===0?n:`${r}${n}`}function St(e){return e!=null&&!ae(e,4)}function zn(e,t){const n=e.snapshot.nodes[t];return!St(n)||!T(n)||ae(n,2)?null:n}function Tu(e){let t=0;for(const[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&St(e.snapshot.nodes[n])&&(t+=1);return t}function Nu(e){return Math.max(0,e.valueById.length-1)}function qo(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:Tu(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:Nu(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function Au(e,t,n,r){return{activeNodeCountAfter:r.activeNodeCount,activeNodeCountBefore:n.activeNodeCount,cachedPathEntryCountAfter:r.cachedPathEntryCount,cachedPathEntryCountBefore:n.cachedPathEntryCount,idsPreserved:t,loadInfoEntryCountAfter:r.loadInfoEntryCount,loadInfoEntryCountBefore:n.loadInfoEntryCount,mode:e,reclaimedCachedPathEntryCount:n.cachedPathEntryCount-r.cachedPathEntryCount,reclaimedLoadInfoEntryCount:n.loadInfoEntryCount-r.loadInfoEntryCount,reclaimedNodeSlotCount:n.totalNodeSlotCount-r.totalNodeSlotCount,reclaimedSegmentCount:n.segmentCount-r.segmentCount,segmentCountAfter:r.segmentCount,segmentCountBefore:n.segmentCount,totalNodeSlotCountAfter:r.totalNodeSlotCount,totalNodeSlotCountBefore:n.totalNodeSlotCount}}function cs(e){const t=[],n=[];for(const r of e.collapsedDirectoryIds)zn(e,r)!=null&&t.push(W(e,r));for(const r of e.expandedDirectoryIds)zn(e,r)!=null&&n.push(W(e,r));return{collapsedPaths:t,expandedPaths:n}}function us(e){const t=[];for(const[n,r]of e.directoryLoadInfoById)zn(e,n)==null||nn(e,n)==="loaded"||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:W(e,n)});return t}function ds(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(const n of t.expandedPaths){const r=Ee(e,n);r!=null&&tn(e,r,!0,D(e,r))}for(const n of t.collapsedPaths){const r=Ee(e,n);r!=null&&tn(e,r,!1,D(e,r))}}function hs(e,t){e.directoryLoadInfoById.clear();for(const n of t){const r=Ee(e,n.path);r!=null&&zn(e,r)!=null&&e.directoryLoadInfoById.set(r,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function Ru(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:"",version:e.pathCacheVersion})}function Vu(e){const t=e.snapshot.segmentTable,n=Qi();for(const r of e.snapshot.nodes)if(St(r)){if(ae(r,2)){r.nameId=0;continue}r.nameId=Je(n,He(t,r.nameId))}e.snapshot.segmentTable=n}function Lu(e){for(const[t,n]of e.snapshot.directories){const r=e.snapshot.nodes[t];if(!St(r)||!T(r)){e.snapshot.directories.delete(t);continue}const o=n.childIds.filter(i=>{const s=e.snapshot.nodes[i];return St(s)&&s.parentId===t});n.childIds=o,n.childIdByNameId=new Map(o.map(i=>[D(e,i).nameId,i])),n.childPositionById=new Map(o.map((i,s)=>[i,s])),Ln(e.snapshot.nodes,n)}}function Fu(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){const n=e.snapshot.nodes[t];if(St(n))break;t-=1}e.snapshot.nodes.length=t+1}function Bu(e){const t=cs(e),n=us(e);P(e.instrumentation,"store.cleanup.stable.clearPathCaches",()=>Ru(e)),P(e.instrumentation,"store.cleanup.stable.rebuildSegmentTable",()=>Vu(e)),P(e.instrumentation,"store.cleanup.stable.rebuildDirectoryIndexes",()=>Lu(e)),P(e.instrumentation,"store.cleanup.stable.trimTrailingRemovedNodeSlots",()=>Fu(e)),P(e.instrumentation,"store.cleanup.stable.restoreExpansionOverrides",()=>ds(e,t)),P(e.instrumentation,"store.cleanup.stable.restoreDirectoryLoadInfos",()=>hs(e,n)),P(e.instrumentation,"store.cleanup.stable.recomputeCounts",()=>Vr(e,e.snapshot.rootId))}function zu(e){const t=cs(e),n=us(e),r=P(e.instrumentation,"store.cleanup.aggressive.listPaths",()=>rs(e)),o=Dc({...e.snapshot.options},e.instrumentation),i=P(e.instrumentation,"store.cleanup.aggressive.rebuildSnapshot",()=>{const s=new es(o);return s.appendPaths(r),s.finish()});e.snapshot=i,e.activeNodeCount=i.nodes.length-1,e.pathCacheByNodeId=new Map([[i.rootId,{path:"",version:0}]]),e.pathCacheVersion=0,P(e.instrumentation,"store.cleanup.aggressive.restoreExpansionOverrides",()=>ds(e,t)),P(e.instrumentation,"store.cleanup.aggressive.restoreDirectoryLoadInfos",()=>hs(e,n)),P(e.instrumentation,"store.cleanup.aggressive.recomputeCounts",()=>Vr(e,e.snapshot.rootId))}function Hu(e){for(const t of e.directoryLoadInfoById.values())if(t.state==="loading"&&t.activeAttemptId!=null)return!0;return!1}function qu(e,t){const n=qo(e);t==="stable"?P(e.instrumentation,"store.cleanup.stable",()=>Bu(e)):P(e.instrumentation,"store.cleanup.aggressive",()=>zu(e));const r=qo(e);return Au(t,t==="stable",n,r)}const Ou=64;function ju(e,t){const n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;const o=new Int32Array(r);return o.fill(-1),o.set(e),o}function me(e){return D(e,e.snapshot.rootId).visibleSubtreeCount}function fs(e,t,n,r){const o=D(e,t.terminalNodeId),i=Math.max(1,o.visibleSubtreeCount);return Math.min(r-1,n+i-1)}function $u(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:rn(e,t.cursor),setSize:t.setSize,subtreeEndIndex:fs(e,t.cursor,t.index,n)}}function ps(e,t,n,r,o,i){const s=G(e,t),{childIndex:l,childVisibleIndex:a,localVisibleIndex:d}=hr(e.snapshot.nodes,s,n),h=s.childIds[l];if(h==null)throw new Error(`Visible index ${String(n)} is out of range`);return Uu(e,h,d,r+a,o+1,l,s.childIds.length,i)}function Uu(e,t,n,r,o,i,s,l){if(!T(D(e,t))){if(n===0)return{ancestors:l,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:o},index:r,posInSet:i,setSize:s};throw new Error(`Visible index ${String(n)} is out of range for file`)}const a=vs(e,t,o);if(n===0)return{ancestors:l,cursor:a,index:r,posInSet:i,setSize:s};const d=D(e,a.terminalNodeId);if(!T(d)||!be(e,a.terminalNodeId,d))throw new Error(`Visible index ${String(n)} is out of range for collapsed directory`);return ps(e,a.terminalNodeId,n-1,r+1,a.visibleDepth,[...l,{cursor:a,index:r,posInSet:i,setSize:s}])}function Ku(e,t){const n=me(e);if(t<0||t>=n)return null;const r=ps(e,e.snapshot.rootId,t,0,-1,[]),o=r.ancestors.map(s=>W(e,s.cursor.terminalNodeId));let i=null;return{ancestorPaths:o,get ancestorRows(){if(i!=null)return i;const s=[],l=[];for(const a of r.ancestors){const d=$u(e,a,n,[...l]);s.push(d),l.push(d.row.path)}return i=s,i},index:r.index,posInSet:r.posInSet,row:rn(e,r.cursor),setSize:r.setSize,subtreeEndIndex:fs(e,r.cursor,r.index,n)}}function Wu(e,t,n){const r=e.instrumentation,o=me(e);if(o<=0||n<t)return[];const i=Math.max(0,Math.min(t,o-1)),s=Math.max(i,Math.min(n,o-1));if(r==null){if(i===0)return ed(e,s+1);const f=[];let c=Oo(e,i);for(let m=i;m<=s&&c!=null;m++){const p=rn(e,c);f.push(p),c=jo(e,c)}return f}const l=[];let a=0,d=0,h=P(r,"store.getVisibleSlice.selectFirstRow",()=>Oo(e,i));for(let f=i;f<=s&&h!=null;f++){const c=P(r,"store.getVisibleSlice.materializeRow",()=>rn(e,h));l.push(c),c.isFlattened&&(a++,d+=c.flattenedSegments?.length??0),h=P(r,"store.getVisibleSlice.advanceCursor",()=>jo(e,h))}return En(r,"workload.visibleRowsRead",l.length),En(r,"workload.flattenedRowsRead",a),En(r,"workload.flattenedSegmentsRead",d),l}function ms(e,t=me(e)){const n=e.instrumentation;return n==null?$o(e,t):P(n,"store.getVisibleTreeProjection",()=>$o(e,t))}function Gu(e){return Zu(ms(e))}function Yu(e,t){const n=Ee(e,t);if(n==null||n===e.snapshot.rootId||T(D(e,n))&&ct(e,n)!==n)return null;let r=0,o=n;const{nodes:i,rootId:s}=e.snapshot;for(;o!==s;){const l=D(e,o).parentId,a=G(e,l),d=On(a).get(o);if(d==null)throw new Error(`Child ${String(o)} was not found in its parent index`);if(r+=_c(i,a,d),l!==s){const h=D(e,l),f=kt(e,l);if(!be(e,l,h)&&f!==o)return null;ct(e,l)===l&&(r+=1)}o=l}return r}function Xu(e,t){const n=Ee(e,t);if(n==null)throw new Error(`Path does not exist: "${t}"`);const r=D(e,n);if(!T(r))throw new Error(`Path is not a directory: "${t}"`);return be(e,n,r)?null:(tn(e,n,!0,r),ut(e,n),iu({affectedAncestorIds:Re(e,n),affectedNodeIds:[n],path:t}))}function Qu(e,t){const n=Ee(e,t);if(n==null)throw new Error(`Path does not exist: "${t}"`);const r=D(e,n);if(!T(r))throw new Error(`Path is not a directory: "${t}"`);return be(e,n,r)?(tn(e,n,!1,r),ut(e,n),su({affectedAncestorIds:Re(e,n),affectedNodeIds:[n],path:t})):null}function Oo(e,t){return t<0||t>=me(e)?null:gs(e,e.snapshot.rootId,t,-1)}function gs(e,t,n,r){const o=G(e,t),i=e.instrumentation,{childIndex:s,localVisibleIndex:l}=i==null?hr(e.snapshot.nodes,o,n):P(i,"store.getVisibleSlice.selectChildIndex",()=>hr(e.snapshot.nodes,o,n)),a=o.childIds[s];if(a!=null)return yr(e,a,l,r+1);throw new Error(`Visible index ${String(n)} is out of range`)}function yr(e,t,n,r){if(!T(D(e,t))){if(n===0)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw new Error(`Visible index ${String(n)} is out of range for file`)}const o=vs(e,t,r);if(n===0)return o;const i=D(e,o.terminalNodeId);if(!T(i)||!be(e,o.terminalNodeId,i))throw new Error(`Visible index ${String(n)} is out of range for collapsed directory`);return gs(e,o.terminalNodeId,n-1,o.visibleDepth)}function vs(e,t,n){return T(D(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:ct(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:P(e.instrumentation,"store.getVisibleSlice.flatten.resolveTerminalDirectory",()=>ct(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function Ju(e,t){const n=D(e,t);if(!T(n))return!0;const r=n.parentId;return r===e.snapshot.rootId?!0:kt(e,r)!==t}function jo(e,t){const n=D(e,t.terminalNodeId);if(T(n)){const i=G(e,t.terminalNodeId);if(be(e,t.terminalNodeId,n)&&i.childIds.length>0){const s=i.childIds[0];return s==null?null:yr(e,s,0,t.visibleDepth+1)}}let r=t.terminalNodeId,o=t.visibleDepth;for(;;){const i=D(e,r);if(r===e.snapshot.rootId)return null;const s=i.parentId,l=G(e,s),a=On(l).get(r)??-1;if(a<0)throw new Error(`Child ${String(r)} was not found in its parent index`);const d=l.childIds[a+1]??null;if(d!=null)return yr(e,d,0,o);Ju(e,r)&&o--,r=s}}function Zu(e){const t=e.paths.length,n=new Array(t);for(let r=0;r<t;r+=1){const o=e.getParentIndex(r);n[r]={index:r,parentPath:o>=0?e.paths[o]??null:null,path:e.paths[r]??"",posInSet:e.posInSetByIndex[r]??0,setSize:e.setSizeByIndex[r]??0}}return{getParentIndex:e.getParentIndex,rows:n,get visibleIndexByPath(){return e.visibleIndexByPath}}}function $o(e,t){const n=new Array(t),r=new Int32Array(t),o=new Int32Array(t),i=new Int32Array(t);let s=new Int32Array(Ou);s.fill(-1);let l=0;const{nodes:a,directories:d,segmentTable:h}=e.snapshot,f=[[d.get(e.snapshot.rootId),0,-1,""]],c=e.snapshot.options.flattenEmptyDirectories,m=e.pathCacheByNodeId,p=e.pathCacheVersion,g=h.valueById;for(;f.length>0&&l<t;){const I=f[f.length-1],S=I[0];if(I[1]>=S.childIds.length){f.pop();continue}const E=I[1],V=S.childIds[I[1]++],de=a[V],Y=I[2]+1,fe=I[3];s=ju(s,Y);let Q,te=V;if(T(de))te=c?ct(e,V):V,Q=te===V?`${fe}${g[de.nameId]}/`:W(e,te);else{const ne=m.get(V);Q=ne!=null&&ne.version===p?ne.path:`${fe}${g[de.nameId]}`}r[l]=s[Y],n[l]=Q,o[l]=E,i[l]=S.childIds.length,s[Y+1]=l,l+=1;const ce=a[te];ce!=null&&T(ce)&&be(e,te,ce)&&f.push([d.get(te),0,Y,Q])}l<t&&(n.length=l);const v=r.subarray(0,l),w=o.subarray(0,l),x=i.subarray(0,l);let b=null;return{getParentIndex(I){return I<0||I>=l?-1:v[I]??-1},paths:n,posInSetByIndex:w,setSizeByIndex:x,get visibleIndexByPath(){if(b==null){b=new Map;for(let I=0;I<l;I+=1)b.set(n[I]??"",I)}return b}}}function ed(e,t){const n=new Array(t);let r=0;const{nodes:o,directories:i,segmentTable:s}=e.snapshot,l=[[i.get(e.snapshot.rootId),0,-1]],a=s.valueById,d=e.snapshot.options.flattenEmptyDirectories,h=e.pathCacheByNodeId,f=e.pathCacheVersion;for(;l.length>0&&r<t;){const c=l[l.length-1],m=c[0];if(c[1]>=m.childIds.length){l.pop();continue}const p=m.childIds[c[1]++],g=o[p],v=c[2]+1;if(!T(g)){const I=h.get(p);n[r++]={depth:v,flattenedSegments:void 0,hasChildren:!1,id:p,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:"file",loadState:void 0,name:a[g.nameId],path:I!=null&&I.version===f?I.path:W(e,p)};continue}const w=d?ct(e,p):p,x={headNodeId:p,terminalNodeId:w,visibleDepth:v};n[r++]=rn(e,x);const b=o[w];b!=null&&T(b)&&be(e,w,b)&&l.push([i.get(w),0,v])}return r<t&&(n.length=r),n}function rn(e,t){const n=D(e,t.terminalNodeId),r=T(n)?td(e,t):null,o=W(e,t.terminalNodeId),i=He(e.snapshot.segmentTable,n.nameId),s=T(n)&&G(e,t.terminalNodeId).childIds.length>0,l=t.headNodeId!==t.terminalNodeId,a=e.instrumentation,d=l?a==null?Bn(e,t.headNodeId).map(h=>{const f=D(e,h);return{isTerminal:h===t.terminalNodeId,name:He(e.snapshot.segmentTable,f.nameId),nodeId:h,path:W(e,h)}}):P(a,"store.getVisibleSlice.flatten.collectSegments",()=>Bn(e,t.headNodeId).map(h=>{const f=D(e,h);return{isTerminal:h===t.terminalNodeId,name:He(e.snapshot.segmentTable,f.nameId),nodeId:h,path:W(e,h)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:d,hasChildren:s,id:t.terminalNodeId,isExpanded:T(n)&&be(e,t.terminalNodeId,n),isFlattened:l,isLoading:r==="loading",kind:T(n)?"directory":"file",loadState:r==null||r==="loaded"?void 0:r,name:i,path:o}}function td(e,t){if(t.headNodeId===t.terminalNodeId)return nn(e,t.terminalNodeId);const n=Bn(e,t.headNodeId);let r=!1,o=!1;for(const i of n){const s=nn(e,i);if(s==="loading")return"loading";if(s==="error"){o=!0;continue}s==="unloaded"&&(r=!0)}return o?"error":r?"unloaded":"loaded"}const Uo=8;function nd(e){const{nodes:t,directories:n,rootId:r,options:o}=e,i=t.length,s=new Int32Array(i),l=new Int32Array(i),a=new Int32Array(i),d=new Int32Array(i),h=new Int32Array(i),f=new Int32Array(i),c=new Int32Array(i);for(let v=0;v<i;v+=1){const w=t[v];w!=null&&(s[v]=w.parentId,l[v]=w.nameId,a[v]=w.depthAndFlags,d[v]=w.subtreeNodeCount,h[v]=w.visibleSubtreeCount)}let m=0;for(const v of n.values())m+=v.childIds.length;const p=new Int32Array(m);let g=0;for(const[v,w]of n){const x=w.childIds;f[v]=g,c[v]=x.length;for(let b=0;b<x.length;b+=1)p[g]=x[b],g+=1}return{nodeCount:i,rootId:r,flattenEmptyDirectories:o.flattenEmptyDirectories===!0,parentId:s,nameId:l,depthAndFlags:a,subtreeNodeCount:d,visibleSubtreeCount:h,childStart:f,childCount:c,childIdsFlat:p}}function rd(e){const{nodeCount:t,rootId:n,flattenEmptyDirectories:r,depthAndFlags:o,subtreeNodeCount:i,visibleSubtreeCount:s,childStart:l,childCount:a,childIdsFlat:d}=e;for(let p=t-1;p>=1;p-=1){if((o[p]&Uo)===0)continue;const g=l[p],v=a[p];let w=0,x=0;for(let I=0;I<v;I+=1){const S=d[g+I];w+=i[S],x+=s[S]}i[p]=1+w;let b;r&&v===1?b=(o[d[g]]&Uo)!==0?x:1+x:b=1+x,s[p]=b}const h=l[n],f=a[n];let c=0,m=0;for(let p=0;p<f;p+=1){const g=d[h+p];c+=i[g],m+=s[g]}i[n]=1+c,s[n]=m}function od(e){const{directories:t,nodes:n,options:r,rootId:o,presortedDirectoryNodeIds:i}=e.snapshot,s=r.flattenEmptyDirectories===!0,l=m=>{const p=n[m];if(p==null||!T(p))return;const g=t.get(m);if(g==null)throw new Error(`Unknown directory child index for node ${String(m)}`);const v=g.childIds,w=v.length;let x=0,b=0;for(let S=0;S<w;S++){const E=v[S];if(E==null)continue;const V=n[E];x+=V.subtreeNodeCount,b+=V.visibleSubtreeCount}g.totalChildSubtreeNodeCount=x,g.totalChildVisibleSubtreeCount=b,w>=128&&wt(n,g),p.subtreeNodeCount=1+x;let I;if(s&&w===1){const S=n[v[0]];I=S!=null&&T(S)?b:1+b}else I=1+b;p.visibleSubtreeCount=I};if(i!=null)for(let m=i.length-1;m>=0;m--)l(i[m]);else for(let m=n.length-1;m>=1;m--)l(m);const a=n[o],d=t.get(o);if(a==null||d==null)return;const h=d.childIds;let f=0,c=0;for(let m=0;m<h.length;m++){const p=h[m];if(p==null)continue;const g=n[p];f+=g.subtreeNodeCount,c+=g.visibleSubtreeCount}d.totalChildSubtreeNodeCount=f,d.totalChildVisibleSubtreeCount=c,wt(n,d),a.subtreeNodeCount=1+f,a.visibleSubtreeCount=c}function id(e){const{directories:t,nodes:n,rootId:r}=e.snapshot,o=nd(e.snapshot);rd(o);const i=o.subtreeNodeCount,s=o.visibleSubtreeCount;for(let l=0;l<n.length;l+=1){const a=n[l];a!=null&&(a.subtreeNodeCount=i[l],a.visibleSubtreeCount=s[l])}for(const[l,a]of t){const d=a.childIds,h=d.length;let f=0,c=0;for(let m=0;m<h;m++){const p=d[m];if(p==null)continue;const g=n[p];f+=g.subtreeNodeCount,c+=g.visibleSubtreeCount}a.totalChildSubtreeNodeCount=f,a.totalChildVisibleSubtreeCount=c,(l===r||h>=128)&&wt(n,a)}}function sd(e){return e.initialExpansion==="open"&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var ys=class bs{#e;constructor(t={}){const n=Tr(t),r=P(n,"store.builder.create",()=>new es(t));if(t.preparedInput!=null){const l=$c(t.preparedInput);l!=null?r.appendPresortedPaths(l,Uc(t.preparedInput)):r.appendPreparedPaths(jc(t.preparedInput),!1)}else{const l=t.paths??[];t.presorted===!0?r.appendPaths(l):r.appendPreparedPaths(P(n,"store.preparePathEntries",()=>Rr(l,t)))}const o=P(n,"store.builder.finish",()=>r.finish({skipSubtreeCountPass:!0})),i=P(n,"store.state.detectAllDirectoriesExpanded",()=>(t.initialExpansion??"closed")==="closed"&&r.didMatchAllInitialExpandedPaths());this.#e=P(n,"store.state.create",()=>Kc(o,i?"open":t.initialExpansion??"closed",n)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);const s=i?this.#e.snapshot.directories.size-1:P(n,"store.state.initializeExpandedPaths",()=>this.initializeExpandedPaths(t.initialExpandedPaths));i||sd(t)||(t.initialExpansion??"closed")==="closed"&&s===this.#e.snapshot.directories.size-1||(t.initialExpandedPaths?.length??0)>0&&P(n,"store.state.checkAllDirectoriesExpanded",()=>this.hasAllDirectoriesExpanded())?t.useSoaCountSweep===!0?P(n,"store.state.initializeOpenVisibleCountsViaSoa",()=>id(this.#e)):P(n,"store.state.initializeOpenVisibleCounts",()=>od(this.#e)):P(n,"store.state.recomputeCounts",()=>Vr(this.#e,this.#e.snapshot.rootId))}static preparePaths(t,n={}){return Hc(t,n)}static prepareInput(t,n={}){return qc(t,n)}static preparePresortedInput(t){return Oc(t)}list(t){return P(this.#e.instrumentation,"store.list",()=>rs(this.#e,t))}add(t){P(this.#e.instrumentation,"store.add",()=>{const n=me(this.#e);Ae(this.#e,we(this.#e,n,Ro(this.#e,t)))})}remove(t,n={}){P(this.#e.instrumentation,"store.remove",()=>{const r=me(this.#e);Ae(this.#e,we(this.#e,r,Vo(this.#e,t,n)))})}move(t,n,r={}){P(this.#e.instrumentation,"store.move",()=>{const o=me(this.#e),i=Lo(this.#e,t,n,r);i!=null&&Ae(this.#e,we(this.#e,o,i))})}batch(t){fu(this.#e,()=>{if(typeof t=="function"){t(this);return}for(const n of t)switch(n.type){case"add":this.add(n.path);break;case"remove":this.remove(n.path,{recursive:n.recursive});break;case"move":this.move(n.from,n.to,{collision:n.collision});break}})}getVisibleCount(){return P(this.#e.instrumentation,"store.getVisibleCount",()=>me(this.#e))}getVisibleSlice(t,n){return P(this.#e.instrumentation,"store.getVisibleSlice",()=>Wu(this.#e,t,n))}getVisibleRowContext(t){return P(this.#e.instrumentation,"store.getVisibleRowContext",()=>Ku(this.#e,t))}getVisibleTreeProjection(){return Gu(this.#e)}getVisibleTreeProjectionData(t){return ms(this.#e,t)}getVisibleIndex(t){return P(this.#e.instrumentation,"store.getVisibleIndex",()=>Yu(this.#e,t))}getPathInfo(t){return P(this.#e.instrumentation,"store.getPathInfo",()=>{const n=Ee(this.#e,t);if(n==null)return null;const r=D(this.#e,n);return{depth:ze(r),kind:T(r)?"directory":"file",path:W(this.#e,n)}})}isExpanded(t){return P(this.#e.instrumentation,"store.isExpanded",()=>{const n=this.requireDirectoryNodeId(t),r=D(this.#e,n);return be(this.#e,n,r)})}expand(t){P(this.#e.instrumentation,"store.expand",()=>{const n=me(this.#e),r=Xu(this.#e,t);r!=null&&Ae(this.#e,we(this.#e,n,r))})}collapse(t){P(this.#e.instrumentation,"store.collapse",()=>{const n=me(this.#e),r=Qu(this.#e,t);r!=null&&Ae(this.#e,we(this.#e,n,r))})}on(t,n){return tu(this.#e,t,n)}getDirectoryLoadState(t){const n=this.requireDirectoryNodeId(t);return nn(this.#e,n)}markDirectoryUnloaded(t){P(this.#e.instrumentation,"store.markDirectoryUnloaded",()=>{const n=this.requireDirectoryNodeId(t);if(G(this.#e,n).childIds.length>0)throw new Error(`Cannot mark a directory with known children as unloaded: "${t}"`);const r=me(this.#e);Xc(this.#e,n),Ae(this.#e,we(this.#e,r,lu({affectedAncestorIds:Re(this.#e,n),affectedNodeIds:[n],path:t,projectionChanged:this.isDirectoryProjectionVisible(n)})))})}beginChildLoad(t){return P(this.#e.instrumentation,"store.beginChildLoad",()=>{const n=this.requireDirectoryNodeId(t),r=me(this.#e),o=Yc(this.#e,n);return Ae(this.#e,we(this.#e,r,au({affectedAncestorIds:Re(this.#e,n),affectedNodeIds:[n],attemptId:o.attemptId,path:t,projectionChanged:this.isDirectoryProjectionVisible(n),reused:o.reused}))),o})}applyChildPatch(t,n){return P(this.#e.instrumentation,"store.applyChildPatch",()=>{const r=this.resolveActiveDirectoryNodeId(t.nodeId);if(r==null||nn(this.#e,r)!=="loading"||!Jc(this.#e,r,t.attemptId))return!1;const o=W(this.#e,r);this.validateChildPatch(o,n);const i=me(this.#e),s=[];for(const a of n.operations){ld(o,a);const d=me(this.#e);switch(a.type){case"add":s.push(we(this.#e,d,Ro(this.#e,a.path)));break;case"remove":s.push(we(this.#e,d,Vo(this.#e,a.path,{recursive:a.recursive})));break;case"move":{const h=Lo(this.#e,a.from,a.to,{collision:a.collision});h!=null&&s.push(we(this.#e,d,h));break}}}const l=s.some(a=>a.projectionChanged)||this.isDirectoryProjectionVisible(r);return Ae(this.#e,we(this.#e,i,cu({affectedAncestorIds:Re(this.#e,r),affectedNodeIds:[r],attemptId:t.attemptId,childEvents:s,path:W(this.#e,r),projectionChanged:l}))),!0})}completeChildLoad(t){return P(this.#e.instrumentation,"store.completeChildLoad",()=>{const n=this.resolveActiveDirectoryNodeId(t.nodeId);if(n==null)return!1;const r=me(this.#e),o=Qc(this.#e,n,t.attemptId);return Ae(this.#e,we(this.#e,r,uu({affectedAncestorIds:Re(this.#e,n),affectedNodeIds:[n],attemptId:t.attemptId,path:W(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!o}))),o})}failChildLoad(t,n){return P(this.#e.instrumentation,"store.failChildLoad",()=>{const r=this.resolveActiveDirectoryNodeId(t.nodeId);if(r==null)return!1;const o=me(this.#e),i=Zc(this.#e,r,t.attemptId,n);return Ae(this.#e,we(this.#e,o,du({affectedAncestorIds:Re(this.#e,r),affectedNodeIds:[r],attemptId:t.attemptId,errorMessage:n,path:W(this.#e,r),projectionChanged:this.isDirectoryProjectionVisible(r),stale:!i}))),i})}cleanup(t={}){return P(this.#e.instrumentation,"store.cleanup",()=>{if(this.#e.transactionStack.length>0)throw new Error("Cleanup cannot run during an open batch or transaction.");if(Hu(this.#e))throw new Error("Cleanup cannot run while directory loads are active.");const n=me(this.#e),r=qu(this.#e,t.mode??"stable");return Ae(this.#e,we(this.#e,n,hu({...r,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:r.idsPreserved===!1}))),r})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(t){if(t==null||t.length===0)return 0;let n=0;const r=[],o=[];let i=0,s=null;const l=this.#e.snapshot.segmentTable,a=l.valueById,d=this.#e.snapshot.nodes,h=new Map;for(const f of t){s!=null&&f<s&&(s=null,i=0,r.length=0,o.length=0);const c=f.length>0&&f.charCodeAt(f.length-1)===47?f.length-1:f.length;if(c===0){s=f,i=c,r.length=0,o.length=0;continue}let m=0,p=0;if(s!=null){const b=Math.min(c,i);let I=!0;for(let S=0;S<b;S+=1){const E=f.charCodeAt(S);if(E!==s.charCodeAt(S)){I=!1;break}E===47&&(m+=1,p=S+1)}I&&(b===i&&c>b&&f.charCodeAt(b)===47?(m+=1,p=b+1):b===c&&i>b&&s.charCodeAt(b)===47&&(m+=1,p=c+1)),m=Math.min(m,o.length)}let g=m===0?this.#e.snapshot.rootId:o[m-1]??this.#e.snapshot.rootId,v=m,w=!0,x=p;for(;x<=c;){const b=f.indexOf("/",x),I=b===-1||b>c?c:b,S=f.slice(x,I),E=G(this.#e,g).childIds,V=v===m?r[v]??0:0;let de=V,Y;const fe=h.get(S)??ln(S);h.set(S,fe);const Q=(te,ce)=>{for(de=te;de<ce;de+=1){const ne=E[de],De=d[ne],j=a[De.nameId];if(j===S)return Y=ne,!0;const se=Nr(fr(l,De.nameId),fe);if(se>0||se===0&&j>S)return!1}return!1};if(!Q(V,E.length)&&V>0&&Q(0,V),Y===void 0){w=!1;break}if(!T(D(this.#e,Y))){w=!1;break}if(r[v]=de,o[v]=Y,g=Y,v+=1,I===c)break;x=I+1}if(s=f,i=c,r.length=v,o.length=v,!w){s=null,i=0,r.length=0,o.length=0;continue}for(let b=m;b<v;b+=1){const I=o[b];if(I==null)continue;const S=D(this.#e,I);be(this.#e,I,S)||(tn(this.#e,I,!0,S),n+=1)}}return n}hasAllDirectoriesExpanded(){for(const t of this.#e.snapshot.directories.keys()){if(t===this.#e.snapshot.rootId)continue;const n=D(this.#e,t);if(!be(this.#e,t,n))return!1}return!0}requireDirectoryNodeId(t){const n=Ee(this.#e,t);if(n==null)throw new Error(`Path does not exist: "${t}"`);if(!T(D(this.#e,n)))throw new Error(`Path is not a directory: "${t}"`);return n}resolveActiveDirectoryNodeId(t){try{if(!T(D(this.#e,t)))throw new Error(`Node is not a directory: ${String(t)}`);return t}catch{return null}}isDirectoryProjectionVisible(t){let n=t;for(;n!==this.#e.snapshot.rootId;){const r=D(this.#e,n).parentId;if(r!==this.#e.snapshot.rootId){const o=D(this.#e,r),i=kt(this.#e,r);if(!be(this.#e,r,o)&&i!==n)return!1}n=r}return!0}validateChildPatch(t,n){new bs({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function ld(e,t){switch(t.type){case"add":case"remove":if(!t.path.startsWith(e)||t.path===e)throw new Error(`Child patch operation must stay within ${e}: "${t.path}"`);break;case"move":if(!t.from.startsWith(e)||!t.to.startsWith(e)||t.from===e||t.to===e)throw new Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`);break}}const ad=e=>e.startsWith("f::")?e.slice(3):e;function cd(e){const t=e.lastIndexOf("/");return t<0?{parentPath:"",baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function ud(e,t){return e===""?t:`${e}/${t}`}function dd({files:e,path:t,isFolder:n,nextBasename:r}){const o=ad(t),i=r.trim();if(i.length===0)return{error:"Name cannot be empty."};if(i.includes("/"))return{error:'Name cannot include "/".'};const{parentPath:s,baseName:l}=cd(o);if(i===l)return{nextFiles:e,sourcePath:o,destinationPath:o,isFolder:n};const a=ud(s,i),d=new Array(e.length),h=new Set;if(!n){const p=`${a}/`;let g=!1;for(let v=0;v<e.length;v++){const w=e[v];if(w!==o&&w.startsWith(p))return{error:`"${a}" already exists.`};const x=w===o?a:w;if(h.has(x))return{error:`"${a}" already exists.`};h.add(x),d[v]=x,w===o&&(g=!0)}return g?{nextFiles:d,sourcePath:o,destinationPath:a,isFolder:n}:{error:"Could not find the selected file to rename."}}const f=`${o}/`,c=`${a}/`;let m=0;for(let p=0;p<e.length;p++){const g=e[p],v=g===o||g.startsWith(f);if(!v&&(g===a||g.startsWith(c)))return{error:`"${a}" already exists.`};const w=v?`${a}${g.slice(o.length)}`:g;if(h.has(w))return{error:`"${a}" already exists.`};h.add(w),d[p]=w,v&&m++}return m===0?{error:"Could not find the selected folder to rename."}:{nextFiles:d,sourcePath:o,destinationPath:a,isFolder:n}}function hd(e){return e.endsWith("/")}function fd(e){const t=e.endsWith("/")?e.slice(0,-1):e,n=t.lastIndexOf("/"),r=n<0?t:t.slice(n+1);return e.endsWith("/")?`${r}/`:r}function pd(e){const t=[],n=new Set;for(const o of e)n.has(o)||(n.add(o),t.push(o));const r=new Set;for(const o of t.toSorted((i,s)=>i.length!==s.length?i.length-s.length:i.localeCompare(s))){const i=(o.endsWith("/")?o.slice(0,-1):o).split("/");let s=!1;for(let l=0;l<i.length-1;l+=1){const a=`${i.slice(0,l+1).join("/")}/`;if(r.has(a)){s=!0;break}}s||r.add(o)}return t.filter(o=>r.has(o))}function md(e,t){return t.includes(e)?pd(t):[e]}function gd(e,t){return e===t?!0:e==null||t==null?!1:e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function Ko(e,t){return{draggedPaths:e,target:t}}function Wo(e,t){if(t.kind!=="directory"||t.directoryPath==null)return!1;for(const n of e)if(hd(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function vd(e,t){return t.kind==="root"||t.directoryPath==null?fd(e):t.directoryPath}function yd(e,t){const n=e.map(r=>{const o=vd(r,t);return o===r?null:{from:r,to:o,type:"move"}}).filter(r=>r!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?"move":"batch",target:t}}}function bd(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function Go(e,t,n){const{paths:r,preparedInput:o}=e;if(o==null){if(r==null)throw new Error("FileTree requires paths or preparedInput");return{paths:r,preparedInput:void 0}}const i=o.paths;if(r==null)return{paths:i,preparedInput:o};if(!bd(ys.preparePaths(r,n==null?{}:{sort:n}),i))throw new Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:i,preparedInput:o}}function Yo(e){return e.operation==="add"||e.operation==="remove"||e.operation==="move"||e.operation==="batch"}function Id(e,t,n){if(e===t)return n;const r=t.endsWith("/")?t:`${t}/`;return e.startsWith(r)?`${n.endsWith("/")?n:`${n}/`}${e.slice(r.length)}`:e}function xd(e,t){if(e===t)return!0;const n=t.endsWith("/")?t:`${t}/`;return e.startsWith(n)}function Qt(e,t,n=!1){if(e==null)return null;switch(t.operation){case"add":case"expand":case"collapse":case"mark-directory-unloaded":case"begin-child-load":case"apply-child-patch":case"complete-child-load":case"fail-child-load":case"cleanup":return e;case"remove":return xd(e,t.path)?n?e:null:e;case"move":return Id(e,t.from,t.to);case"batch":{let r=e;for(const o of t.events)if(r=Qt(r,o,n),r==null)return null;return r}}}function Dn(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function Is(e){switch(e.operation){case"add":return{...Dn(e),operation:"add",path:e.path};case"remove":return{...Dn(e),operation:"remove",path:e.path,recursive:e.recursive};case"move":return{...Dn(e),from:e.from,operation:"move",to:e.to}}}function wd(e){return{...Dn(e),events:e.events.filter(t=>t.operation==="add"||t.operation==="remove"||t.operation==="move").map(t=>Is(t)),operation:"batch"}}function Sd(e){switch(e.operation){case"add":case"remove":case"move":return Is(e);case"batch":return wd(e);default:return null}}function or(e,t){if(e.size!==t.length)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function Xe(e){const t=e.endsWith("/")?e.slice(0,-1):e;if(t.length===0)return[];const n=t.split("/");return n.slice(0,-1).map((r,o)=>`${n.slice(0,o+1).join("/")}/`)}function ir(e){return Xe(e).at(-1)??null}function Xo(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function Cn(e){return e.endsWith("/")}const Qo=e=>e.toLowerCase();function Cd(e){const t=e.endsWith("/")?e.slice(0,-1):e,n=t.lastIndexOf("/");return n<0?t:t.slice(n+1)}function Jo(e){return e.endsWith("/")?e.slice(0,-1):e}function Zo(e,t){return t&&!e.endsWith("/")?`${e}/`:e}const _d=e=>{const t=e.trim();return t.length===0?"":(t.includes("\\")?t.replaceAll("\\","/"):t).toLowerCase()},xs=Symbol("FILE_TREE_RENAME_VIEW"),kd=512,Pd=512;function Ed(e){return e==="top"||e==="center"?e:"nearest"}function Dd(e,t,n){if(e===0)return-1;if(n!=null){const r=t(n);if(r!=null)return r;const o=Xe(n);for(let i=o.length-1;i>=0;i-=1){const s=o[i];if(s==null)continue;const l=t(s);if(l!=null)return l}}return 0}function Md(e,t,n){if(e.paths.length===0)return{focusedIndex:-1,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};if(t==null)return{focusedIndex:0,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};const r=n??(o=>e.visibleIndexByPath.get(o)??null);return{focusedIndex:Dd(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var Td=class ws{static{Object.defineProperty(ws.prototype,xs,{configurable:!0,value(){return{cancel:()=>{this.#ke()},commit:()=>{this.#Pe()},getPath:()=>this.#s,getValue:()=>this.#g,isActive:()=>this.#s!=null,setValue:t=>{this.#Ee(t)}}},writable:!0})}#e;#t=new Set;#c=new Map;#u=null;#l=null;#z=new Map;#H=new Map;#v=-1;#r=null;#y=!1;#E=t=>-1;#b=new Map;#m=null;#h=null;#I=null;#x=null;#f=null;#q;#O;#R;#o=[];#j=new Int32Array(0);#$=new Int32Array(0);#J=void 0;#D=!1;#s=null;#g="";#M=!1;#_=new Set;#U=[];#K;#W=null;#a=null;#V=null;#N=null;#C=null;#L=null;#Z=null;#_e=0;#w=null;#i=new Set;#G=0;#n;#ne=0;#re=!1;#p=0;#Y;constructor(t){const{dragAndDrop:n,fileTreeSearchMode:r,initialSearchQuery:o,initialSelectedPaths:i,renaming:s,onSearchChange:l,paths:a,preparedInput:d,...h}=t,f=Go({paths:a,preparedInput:d},"constructor",h.sort);this.#e=h,n!=null&&n!==!1&&(this.#u=n===!0?{}:n),this.#D=s!=null&&s!==!1,s!=null&&s!==!1&&s!==!0&&(this.#J=s.canRename,this.#O=s.onError,this.#q=s.onRename),this.#R=l,this.#K=r??"hide-non-matches",this.#n=this.#ie(f.paths,f.preparedInput);const c=i?.map(p=>this.#A(p)).filter(p=>p!=null)??[],m=c.at(-1)??null;c.length>0&&(this.#i=new Set(c),this.#w=m,this.#G=1),this.#B(m,!1),o!=null&&this.#X(o,!1),this.#Y=this.#Se()}destroy(){this.#Y?.(),this.#Y=null,this.#c.clear(),this.#t.clear(),this.#b.clear(),this.#l=null,this.#le()}focusFirstItem(){this.#k().length>0&&this.#P(0)}focusLastItem(){this.#p<=0||(this.#T(),this.#P(this.#p-1))}focusNextItem(){this.#we(1)}focusParentItem(){if(this.#r==null)return;const t=ir(this.#r);if(t==null)return;const n=this.#F(t);n>=0&&this.#P(n)}focusPath(t){const n=this.#n.getPathInfo(t)?.path??null;if(n==null)return;this.#T();const r=this.#F(n);r>=0&&this.#P(r)}scrollToPath(t,n){const r=this.#n.getPathInfo(t)?.path??null;if(r==null)return;this.#T();const o=this.#Be(r);o<0||this.#ae(o)!=null&&(n?.focus!==!1&&this.#P(o,!1),this.#Z={id:this.#_e+=1,offset:Ed(n?.offset),visibleIndex:o},this.#d())}focusMountedPathFromInput(t){const n=this.#n.getPathInfo(t)?.path??null;if(n==null)return;const r=this.#F(n);r>=0&&this.#P(r)}focusNearestPath(t){const n=this.resolveNearestVisiblePath(t);if(n==null)return null;const r=this.#F(n);return r>=0?(this.#P(r),this.#k()[r]??n):null}focusPreviousItem(){this.#we(-1)}getFocusedIndex(){return this.#v}getFocusedItem(){return this.#r==null?null:this.#ce(this.#r)}getFocusedPath(){return this.#r}getScrollRequest(){return this.#Z}clearScrollRequest(t){this.#Z?.id===t&&(this.#Z=null)}resolveNearestVisiblePath(t){const n=this.#k();if(this.#p===0)return null;if(t==null)return this.#r??n[0]??null;const r=this.#n.getPathInfo(t)?.path??t,o=this.#F(r);if(o>=0)return n[o]??r;const i=this.#De(r);return i??this.#r??n[0]??null}getSelectedPaths(){return[...this.#i]}getSelectionVersion(){return this.#G}getVisibleCount(){return this.#p}getVisibleRows(t,n){if(n<t||this.#p===0)return[];const r=Math.max(0,t),o=Math.min(this.#p-1,n);if(o<r)return[];const i=o-r+1;if(this.#C==null&&!this.#y&&o>=this.#o.length&&i<=Pd){const s=[];for(let l=r;l<=o;l+=1){const a=this.#n.getVisibleRowContext(l);if(a==null)break;s.push(this.#ue(a))}return s}if(!this.#y&&o>=this.#o.length&&this.#T(),this.#C!=null){const s=Array.from({length:o-r+1},(h,f)=>this.#ve(r+f)),l=new Map;let a=s[0]??-1,d=a;for(let h=1;h<=s.length;h+=1){const f=s[h];if(f!=null&&f===d+1){d=f;continue}if(a>=0&&this.#n.getVisibleSlice(a,d).forEach((c,m)=>{l.set(a+m,c)}),f==null){a=-1,d=-1;continue}a=f,d=f}return Array.from({length:o-r+1},(h,f)=>{const c=r+f,m=this.#ve(c),p=l.get(m),g=this.#o[m];if(p==null||g==null)throw new Error(`Missing projection row for filtered visible index ${String(c)}`);return this.#oe(p,c,m,{ancestorPaths:this.#fe(m),path:g})})}return this.#n.getVisibleSlice(r,o).map((s,l)=>{const a=r+l,d=this.#o[a];if(d==null)throw new Error(`Missing projection path for visible index ${String(a)}`);return this.#oe(s,a,a,{ancestorPaths:this.#fe(a),path:d})})}getStickyRowCandidates(t,n){if(this.#C!=null)return null;if(this.#p===0||t<=0||n<=0)return[];const r=[];for(let o=0;o<this.#p;o+=1){const i=t+o*n,s=Math.min(this.#p-1,Math.floor(i/n)),l=this.#de(s,o)??(s>0?this.#de(s-1,o):void 0);if(l==null)break;r.push({row:this.#ue(l),subtreeEndIndex:l.subtreeEndIndex})}return r}getItem(t){const n=this.#n.getPathInfo(t);return n==null?null:this.#ce(n.path,n)}resolveMountedDirectoryPathFromInput(t){const n=this.#n.getPathInfo(t);return n?.kind==="directory"?n.path:null}toggleMountedDirectoryFromInput(t){const n=this.resolveMountedDirectoryPathFromInput(t);n!=null&&this.#Ce(n)}selectAllVisiblePaths(){this.#T();const t=[...this.#k()];this.#S(t,this.#r??this.#w)}selectOnlyPath(t){const n=this.#A(t);n!=null&&this.#S([n],n)}selectOnlyMountedPathFromInput(t){this.#S([t],t)}selectPath(t){const n=this.#A(t);n==null||this.#i.has(n)||this.#S([...this.#i,n])}deselectPath(t){const n=this.#A(t);n==null||!this.#i.has(n)||this.#S([...this.#i].filter(r=>r!==n))}toggleFocusedSelection(){this.#r!=null&&this.togglePathSelectionFromInput(this.#r)}togglePathSelection(t){const n=this.#A(t);if(n!=null){if(this.#i.has(n)){this.deselectPath(n);return}this.selectPath(n)}}togglePathSelectionFromInput(t){const n=this.#A(t);if(n!=null){if(this.#i.has(n)){this.#S([...this.#i].filter(r=>r!==n),n);return}this.#S([...this.#i,n],n)}}selectPathRange(t,n){const r=this.#A(t);if(r==null)return;this.#T();const o=this.#w,i=o==null?-1:this.#te(o),s=this.#te(r);if(i===-1||s===-1){const f=n?[...this.#i,r]:[r];this.#S(f,r);return}const[l,a]=i<=s?[i,s]:[s,i],d=this.#k().slice(l,a+1),h=n?[...this.#i,...d]:d;this.#S(h,o)}extendSelectionFromFocused(t){if(this.#r==null)return;const n=this.#v;if(n===-1)return;const r=Math.min(this.#p-1,Math.max(0,n+t));if(r===n)return;!this.#y&&r>=this.#o.length&&this.#T();const o=this.#k(),i=o[n]??null,s=o[r]??null;if(i==null||s==null)return;const l=new Set(this.#i);l.has(i)&&l.has(s)?l.delete(i):l.add(s),this.#S([...l],this.#w??i,!1),this.#P(r)}getDragAndDropConfig(){return this.#u}isDragAndDropEnabled(){return this.#u!=null}getDragSession(){return this.#l==null?null:{draggedPaths:[...this.#l.draggedPaths],primaryPath:this.#l.primaryPath,target:this.#l.target==null?null:{...this.#l.target}}}startDrag(t){if(this.#u==null)return!1;const n=this.#A(t);if(n==null||this.#a!=null&&this.#a.length>0)return!1;const r=this.getSelectedPaths(),o=md(n,r);return this.#u.canDrag?.(o)===!1?!1:(r.includes(n)||this.#S([n],n,!1),this.#Q(n),this.#l={draggedPaths:o,primaryPath:n,target:null},this.#d(),!0)}setDragTarget(t){const n=this.#l;if(n==null)return;let r=t;if(r!=null){const o=Ko(n.draggedPaths,r);(Wo(n.draggedPaths,r)||this.#u?.canDrop?.(o)===!1)&&(r=null)}gd(n.target,r)||(this.#l={...n,target:r},this.#d())}cancelDrag(){this.#l!=null&&(this.#l=null,this.#d())}completeDrag(){const t=this.#l;if(t==null)return!1;this.#l=null;const n=t.target==null?null:{...t.target};if(n==null)return this.#d(),!1;const r=Ko(t.draggedPaths,n);if(Wo(t.draggedPaths,n)||this.#u?.canDrop?.(r)===!1)return this.#d(),!1;const o=yd(t.draggedPaths,n);if(o==null)return this.#d(),!1;try{if(o.operations.length===1){const i=o.operations[0];if(i==null||i.type!=="move")throw new Error("Expected a single move operation for one-item drops");this.#n.move(i.from,i.to,{collision:i.collision})}else this.#Ne(o.operations),this.#n.batch(o.operations)}catch(i){return this.#d(),this.#u?.onDropError?.(i instanceof Error?i.message:String(i),r),!1}return this.#u?.onDropComplete?.(o.result),!0}subscribe(t){return this.#t.add(t),t(),()=>{this.#t.delete(t)}}add(t){this.#n.add(t)}remove(t,n={}){this.#n.remove(t,n)}move(t,n,r={}){this.#n.move(t,n,r)}batch(t){this.#n.batch(t)}onMutation(t,n){const r=t,o=n;let i=this.#c.get(r);return i==null&&(i=new Set,this.#c.set(r,i)),i.add(o),()=>{const s=this.#c.get(r);s?.delete(o),s?.size===0&&this.#c.delete(r)}}setSearch(t){this.#X(t,!0)}openSearch(t=""){this.#X(t,!0)}closeSearch(){this.#X(null,!0)}isSearchOpen(){return this.#a!==null}getSearchValue(){return this.#a??""}getSearchMatchingPaths(){return this.#U}focusNextSearchMatch(){this.#ye(1)}focusPreviousSearchMatch(){this.#ye(-1)}startRenaming(t=this.#r??"",n={}){if(!this.#D)return!1;const r=this.#n.getPathInfo(t);if(r==null)return!1;const o=r.path,i=Cn(o),s=Jo(o);if(this.#J?.({isFolder:i,path:s})===!1)return!1;for(const l of Xe(o))this.#n.isExpanded(l)||this.#n.expand(l);return this.#S([o],o,!1),this.#a!=null&&(this.#X(null,!1),this.#R?.(this.#a)),this.#Q(o),this.#s=o,this.#g=Cd(o),this.#M=n.removeIfCanceled??!1,this.#d(),!0}#ke(){if(this.#s==null)return;const t=this.#s,n=this.#M;if(this.#s=null,this.#g="",this.#M=!1,n){this.remove(t,Cn(t)?{recursive:!0}:void 0);return}this.#Q(t),this.#d()}#Pe(){const t=this.#s;if(t==null)return;if(this.#M&&this.#g.trim().length===0){this.#s=null,this.#g="",this.#M=!1,this.remove(t,Cn(t)?{recursive:!0}:void 0);return}const n=Cn(t),r=dd({files:this.#n.list(),isFolder:n,nextBasename:this.#g,path:Jo(t)});if(this.#s=null,this.#g="",this.#M=!1,"error"in r){this.#Q(t),this.#O?.(r.error),this.#d();return}if(r.sourcePath===r.destinationPath){this.#Q(t),this.#d();return}this.#q?.({destinationPath:r.destinationPath,isFolder:r.isFolder,sourcePath:r.sourcePath}),this.move(Zo(r.sourcePath,n),Zo(r.destinationPath,n))}#Ee(t){this.#s==null||this.#g===t||(this.#g=t,this.#d())}resetPaths(t,n={}){const r=!Array.isArray(t),o=r?void 0:t,i=r?t:n,s=this.#n.list().length,l=this.#p,a=Go({paths:o,preparedInput:i.preparedInput},"resetPaths",this.#e.sort),d=this.#ie(a.paths,a.preparedInput,i.initialExpandedPaths),h=this.#r,f=this.#s,c=this.getSelectedPaths(),m=this.#w;this.#Y?.(),this.#n=d,this.#b.clear(),this.#le();const p=c.map(v=>d.getPathInfo(v)?.path??null).filter(v=>v!=null),g=!or(this.#i,p);this.#i=new Set(p),g&&(this.#G+=1),this.#w=m==null?null:d.getPathInfo(m)?.path??null,this.#s=f==null?null:d.getPathInfo(f)?.path??null,this.#s==null&&(this.#g="",this.#M=!1),this.#B(h,h!=null||p.length>0||this.#w!=null),this.#Y=this.#Se(),this.#d(),this.#Ie({canonicalChanged:!0,operation:"reset",pathCountAfter:a.paths.length,pathCountBefore:s,projectionChanged:!0,usedPreparedInput:i.preparedInput!=null,visibleCountDelta:this.#p-l})}#De(t){this.#T();const n=ir(t),r=Xo(t,n);let o=null,i=null;for(const s of this.#k()){if(ir(s)!==n)continue;const l=Xo(s,n);if(l<r){o=s;continue}if(l>r){i=s;break}}return o??i}#F(t){const n=this.#te(t);if(n!==-1)return n;const r=Xe(t);for(let o=r.length-1;o>=0;o-=1){const i=r[o];if(i==null)continue;const s=this.#te(i);if(s!==-1)return s}return this.#k().length>0?0:-1}#ce(t,n){const r=this.#b.get(t);if(r!=null)return r;const o=n??this.#n.getPathInfo(t);if(o==null)return null;const i=o.kind==="directory"?this.#Me(o.path):this.#Te(o.path);return this.#b.set(o.path,i),i}#oe(t,n,r,o){return{ancestorPaths:o.ancestorPaths,depth:t.depth,flattenedSegments:t.flattenedSegments?.map(i=>({isTerminal:i.isTerminal,name:i.name,path:i.path})),hasChildren:t.hasChildren,index:n,isExpanded:t.isExpanded,isFlattened:t.isFlattened,isFocused:o.path===this.#r,isSelected:this.#i.has(o.path),kind:t.kind,level:t.depth,name:t.name,path:o.path,posInSet:o.posInSet??this.#j[r]??0,setSize:o.setSize??this.#$[r]??0}}#ue(t){return this.#oe(t.row,t.index,t.index,{ancestorPaths:t.ancestorPaths,path:t.row.path,posInSet:t.posInSet,setSize:t.setSize})}#de(t,n){const r=this.#n.getVisibleRowContext(t);if(r==null)return;const o=r.ancestorRows[n];return o??(n===r.ancestorRows.length&&r.row.kind==="directory"&&r.row.isExpanded?r:void 0)}#he(t){const n=this.#z.get(t);if(n!=null)return n;const r=this.#E(t),o=r<0?[]:[...this.#he(r),r];return this.#z.set(t,o),o}#fe(t){const n=this.#H.get(t);if(n!=null)return n;const r=this.#he(t).map(o=>this.#o[o]??"").filter(o=>o!=="");return this.#H.set(t,r),r}#pe(t){this.#n.collapse(t)}#S(t,n=this.#w,r=!0){const o=[...new Set(t)],i=!or(this.#i,o),s=this.#w!==n;!i&&!s||(this.#i=new Set(o),this.#w=n,i&&(this.#G+=1),r&&this.#d())}#Me(t){return{collapse:()=>{this.#pe(t)},deselect:()=>{this.deselectPath(t)},expand:()=>{this.#xe(t)},focus:()=>{this.focusPath(t)},getPath:()=>t,isDirectory:()=>!0,isExpanded:()=>this.#n.isExpanded(t),isFocused:()=>this.#r===t,isSelected:()=>this.#i.has(t),select:()=>{this.selectPath(t)},toggleSelect:()=>{this.togglePathSelection(t)},toggle:()=>{this.#Ce(t)}}}#Te(t){return{deselect:()=>{this.deselectPath(t)},focus:()=>{this.focusPath(t)},getPath:()=>t,isDirectory:()=>!1,isFocused:()=>this.#r===t,isSelected:()=>this.#i.has(t),select:()=>{this.selectPath(t)},toggleSelect:()=>{this.togglePathSelection(t)}}}#Ne(t){const n=this.#n.list();this.#ie(n).batch(t)}#ie(t,n,r){return new ys({...this.#e,paths:t,preparedInput:n??void 0,...r!==void 0?{initialExpandedPaths:r}:{}})}#se(){return this.#x!=null?this.#x:(this.#x=this.#n.list(),this.#x)}#Ae(){if(this.#I!=null)return this.#I;const t=new Set;for(const n of this.#se()){t.add(n);for(const r of Xe(n))t.add(r)}return this.#I=[...t].sort(),this.#I}#Re(){return this.#f!=null?this.#f:(this.#f=this.#se().map(Qo),this.#f)}#ee(){return this.#m!=null?this.#m:(this.#m=this.#Ae().filter(t=>t.endsWith("/")),this.#m)}#Ve(){return this.#h!=null?this.#h:(this.#h=this.#ee().map(Qo),this.#h)}#le(){this.#m=null,this.#h=null,this.#I=null,this.#x=null,this.#f=null}#Le(){return this.#ee().filter(t=>this.#n.isExpanded(t))}#me(t){const n=new Set(this.#W??[]);if(t)for(const r of this.#i)for(const o of Xe(r))n.add(o);this.#ge(n)}#ge(t){this.#re=!0;try{for(const n of this.#ee()){const r=t.has(n),o=this.#n.isExpanded(n);r&&!o?this.#n.expand(n):!r&&o&&this.#n.collapse(n)}}finally{this.#re=!1}}#Fe(){if(this.#a==null||this.#a.length===0){this.#U=[],this.#C=null,this.#L=null,this.#N=null,this.#p=this.#ne;return}const t=this.#o;if(this.#U=t.filter(i=>this.#_.has(i)),this.#K!=="hide-non-matches"||this.#_.size===0){this.#C=null,this.#L=null,this.#N=null,this.#p=this.#ne;return}const n=[],r=[],o=new Map;for(const[i,s]of t.entries())this.#V?.has(s)===!0&&(o.set(s,r.length),n.push(i),r.push(s));this.#C=n,this.#L=r,this.#N=o,this.#p=r.length}#k(){return this.#L??this.#o}#Be(t){return this.#L!=null?this.#N?.get(t)??-1:this.#n.getVisibleIndex(t)??-1}#ve(t){return this.#C?.[t]??t}#te(t){const n=this.#N?.get(t);return n??this.#n.getVisibleIndex(t)??-1}#ye(t){const n=this.#U;if(n.length===0)return;const r=this.#r,o=r==null?-1:n.indexOf(r),i=n[o<0?t>0?0:n.length-1:Math.min(n.length-1,Math.max(0,o+t))];i!=null&&this.focusPath(i)}#X(t,n){const r=t==null?null:_d(t),o=this.#a;if(o!==r){if(o==null&&r!=null&&(this.#W=this.#Le()),this.#a=r,r==null)this.#me(!0),this.#W=null,this.#_.clear(),this.#V=null,this.#B(this.#r,!0);else if(r.length===0)this.#me(!1),this.#_.clear(),this.#V=null,this.#B(this.#r,!0);else{const i=this.#be();this.#B(i,!0)}n&&(this.#R?.(this.#a),this.#d())}}#be(){if(this.#a==null||this.#a.length===0)return this.#_.clear(),this.#r;const t=this.#a,n=this.#se(),r=this.#Re(),o=[],i=new Set;let s=null;for(let f=0;f<n.length;f+=1){if(!r[f].includes(t))continue;const c=n[f];o.push(c),i.add(c),s??=c}const l=this.#ee(),a=this.#Ve();for(let f=0;f<l.length;f+=1){if(!a[f].includes(t))continue;const c=l[f];i.has(c)||(o.push(c),i.add(c),s??=c)}this.#_=i;const d=this.#K==="hide-non-matches"&&o.length>0?new Set:null;this.#V=d;const h=this.#K==="expand-matches"?new Set(this.#W??[]):new Set;for(const f of o){d?.add(f),f.endsWith("/")&&h.add(f);for(const c of Xe(f))h.add(c),d?.add(c)}return this.#ge(h),s??this.#r}#d(){for(const t of this.#t)t()}#Ie(t){this.#c.get(t.operation)?.forEach(n=>{n(t)}),this.#c.get("*")?.forEach(n=>{n(t)})}#xe(t){for(const n of Xe(t))this.#n.isExpanded(n)||this.#n.expand(n);this.#n.isExpanded(t)||this.#n.expand(t)}#we(t){const n=this.#p;if(n===0)return;const r=this.#v===-1?0:this.#v,o=Math.min(n-1,Math.max(0,r+t));(o!==r||this.#v===-1)&&(!this.#y&&this.#C==null&&o>=this.#o.length&&this.#T(),this.#P(o))}#B(t,n=!0){const r=this.#n.getVisibleCount();this.#ne=r;const o=Md(this.#n.getVisibleTreeProjectionData(n?void 0:Math.min(r,kd)),t,n?i=>this.#n.getVisibleIndex(i):void 0);this.#z.clear(),this.#H.clear(),this.#y=o.paths.length>=r,this.#E=o.getParentIndex,this.#o=o.paths,this.#j=o.posInSetByIndex,this.#$=o.setSizeByIndex,this.#Fe(),this.#v=t==null?this.#k().length>0?0:-1:this.#F(t),this.#r=this.#v<0?null:this.#ae(this.#v)}#ae(t){const n=this.#k()[t];return n??(this.#C!=null?null:this.#n.getVisibleRowContext(t)?.row.path??null)}#A(t){return this.#n.getPathInfo(t)?.path??null}#Q(t){if(t==null)return;const n=this.#F(t);n>=0&&this.#P(n,!1)}#P(t,n=!0){const r=this.#ae(t);r!=null&&(this.#v===t&&this.#r===r||(this.#v=t,this.#r=r,n&&this.#d()))}#T(){this.#y||this.#B(this.#r,!0)}#ze(t){const n=Qt(this.#s,t);n==null&&this.#s!=null&&(this.#g=""),this.#s=n;const r=Qt(this.#r,t,!0),o=[...this.#i].map(a=>Qt(a,t)).filter(a=>a!=null).map(a=>this.#n.getPathInfo(a)?.path??null).filter(a=>a!=null),i=Qt(this.#w,t),s=i==null?null:this.#n.getPathInfo(i)?.path??null,l=[...new Set(o)];return or(this.#i,l)||(this.#i=new Set(l),this.#G+=1),this.#w=s,r}#Se(){return this.#n.on("*",t=>{if(this.#re)return;t.canonicalChanged&&(this.#b.clear(),this.#le()),this.#l!=null&&Yo(t)&&(this.#l=null);const n=Yo(t)?this.#ze(t):this.#r,r=this.#a!=null&&this.#a.length>0?this.#be():this.#a===""?this.#r:n,o=this.#a!=null||t.operation!=="expand"&&t.operation!=="collapse";this.#B(r,o),this.#d();const i=Sd(t);i!=null&&this.#Ie(i)})}#Ce(t){if(this.#n.isExpanded(t)){this.#pe(t);return}this.#xe(t)}};const Nd=e=>{if(e==null||e.length===0)return"0";let t=`${e.length}`;for(const n of e)t+=`\0${n.path}\0${n.status}`;return t};function Ad(e){const t=e.endsWith("/");let n="",r=-1;for(let o=0;o<=e.length;o+=1){if(!(e[o]==="/"||o===e.length)){r===-1&&(r=o);continue}r!==-1&&(n!==""&&(n+="/"),n+=e.slice(r,o),r=-1)}return n===""?null:{isDirectory:t,path:n}}function Ss(e){const t=e.endsWith("/")?e.slice(0,-1):e;if(t.length===0)return[];const n=[];let r=0;for(;;){const o=t.indexOf("/",r);if(o===-1)break;n.push(t.slice(0,o+1)),r=o+1}return n}function Rd(e,t){return t?`${e}/`:e}function ei(e,t=null){const n=Nd(e==null?void 0:[...e]);if(n==="0")return null;if(t?.signature===n)return t;const r=new Map,o=new Set,i=new Set,s=new Map;for(const l of e??[]){const a=Cs(l);a!=null&&ks({canonicalPath:a.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:o,ignoredDirectoryPaths:i,isDirectory:a.isDirectory,status:l.status,statusByPath:r})}return r.size===0?null:{changeCountByDirectoryPath:s,directoriesWithChanges:o,ignoredDirectoryPaths:i,signature:n,statusByPath:r}}function Vd(e,t){const n=t?.remove??[],r=t?.set??[];if(n.length===0&&r.length===0)return e;const o=new Map(e?.statusByPath),i=new Set(e?.directoriesWithChanges),s=new Set(e?.ignoredDirectoryPaths),l=new Map(e?.changeCountByDirectoryPath);let a=!1;for(const d of n){const h=_s(d);h!=null&&(a=Ld({canonicalPath:h.canonicalPath,changeCountByDirectoryPath:l,directoriesWithChanges:i,ignoredDirectoryPaths:s,statusByPath:o})||a)}for(const d of r){const h=Cs(d);h!=null&&(a=ks({canonicalPath:h.canonicalPath,changeCountByDirectoryPath:l,directoriesWithChanges:i,ignoredDirectoryPaths:s,isDirectory:h.isDirectory,status:d.status,statusByPath:o})||a)}return a?o.size===0?null:{changeCountByDirectoryPath:l,directoriesWithChanges:i,ignoredDirectoryPaths:s,signature:zd(o),statusByPath:o}:e}function Cs(e){return _s(e.path)}function _s(e){const t=Ad(e);if(t!=null)return{canonicalPath:Rd(t.path,t.isDirectory),isDirectory:t.isDirectory}}function Ld({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,statusByPath:o}){const i=o.get(e);return i==null?!1:(o.delete(e),i==="ignored"&&e.endsWith("/")&&r.delete(e),Bd(t,n,e),!0)}function ks({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,isDirectory:o,status:i,statusByPath:s}){const l=s.get(e);return l===i?!1:(l==null&&Fd(t,n,e),s.set(e,i),i==="ignored"&&o?r.add(e):o&&r.delete(e),!0)}function Fd(e,t,n){for(const r of Ss(n))e.set(r,(e.get(r)??0)+1),t.add(r)}function Bd(e,t,n){for(const r of Ss(n)){const o=(e.get(r)??0)-1;o>0?e.set(r,o):(e.delete(r),t.delete(r))}}function zd(e){let t=`${e.size}`;for(const[n,r]of e)t+=`\0${n}\0${r}`;return t}const Hd=e=>e.trim().toLowerCase(),qd=e=>e.split("/").at(-1)??e,Od=e=>{const t=e.toLowerCase().split("."),n=[];for(let r=1;r<t.length;r+=1)n.push(t.slice(r).join("."));return n};function Ut(e,t){return typeof e=="string"?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function jd(e){const t=Pn(e),n=t.remap,r=new Map;for(const[l,a]of Object.entries(t.byFileName??{}))r.set(l.toLowerCase(),a);const o=new Map;for(const[l,a]of Object.entries(t.byFileExtension??{}))o.set(Hd(l),a);const i=Object.entries(t.byFileNameContains??{}).map(([l,a])=>[l.toLowerCase(),a]);return{resolveIcon:(l,a)=>{if(l==="file-tree-icon-file"&&a!=null){const h=qd(a),f=h.toLowerCase(),c=r.get(f);if(c!=null)return Ut(c,l);for(const[g,v]of i)if(f.includes(g))return Ut(v,l);const m=Od(h);for(const g of m){const v=o.get(g);if(v!=null)return Ut(v,l)}const p=gc(t.set,h,m);if(p!=null&&t.set!=="none"){if(p==="default"){const g=n?.[l];if(g!=null)return Ut(g,l)}return{name:pc(p),remappedFrom:l,token:p}}}const d=n?.[l];return d==null?{name:l}:Ut(d,l)}}}var O,Ps,at,ti,Hn,Es,Ds,zr,br,Ir,on={},Ms=[],Un=Array.isArray,Hr=Ms.slice,et=Object.assign;function qr(e){e&&e.parentNode&&e.remove()}function xr(e,t,n){var r,o,i,s={};for(i in t)i=="key"?r=t[i]:i=="ref"&&typeof e!="function"?o=t[i]:s[i]=t[i];return arguments.length>2&&(s.children=arguments.length>3?Hr.call(arguments,2):n),Mn(e,s,r,o,null)}function Mn(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++Ps,__i:-1,__u:0};return o==null&&O.vnode!=null&&O.vnode(i),i}function Pt(e){return e.children}function Tn(e,t){this.props=e,this.context=t,this.__g=0}function Ct(e,t){if(t==null)return e.__?Ct(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Ct(e):null}function Ts(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=n.__e;break}return Ts(e)}}function ni(e){(8&e.__g||!(e.__g|=8)||!at.push(e)||Hn++)&&ti==O.debounceRendering||((ti=O.debounceRendering)||queueMicrotask)($d)}function $d(){for(var e,t,n,r,o,i,s,l,a=1;at.length;)at.length>a&&at.sort(Es),e=at.shift(),a=at.length,8&e.__g&&(n=void 0,o=(r=(t=e).__v).__e,i=[],s=[],(l=t.__P)&&((n=et({},r)).__v=r.__v+1,O.vnode&&O.vnode(n),Or(l,n,r,t.__n,l.namespaceURI,32&r.__u?[o]:null,i,o??Ct(r),!!(32&r.__u),s,l.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,Rs(i,n,s),n.__e!=o&&Ts(n)));Hn=0}function Ns(e,t,n,r,o,i,s,l,a,d,h,f){var c,m,p,g,v,w,x,b=r&&r.__k||Ms,I=t.length;for(a=Ud(n,t,b,a,I),c=0;c<I;c++)(p=n.__k[c])!=null&&(m=p.__i==-1?on:b[p.__i]||on,p.__i=c,w=Or(e,p,m,o,i,s,l,a,d,h,f),g=p.__e,p.ref&&m.ref!=p.ref&&(m.ref&&jr(m.ref,null,p),h.push(p.ref,p.__c||g,p)),v==null&&g!=null&&(v=g),(x=!!(4&p.__u))||m.__k===p.__k?a=As(p,a,e,x):typeof p.type=="function"&&w!==void 0?a=w:g&&(a=g.nextSibling),p.__u&=-7);return n.__e=v,a}function Ud(e,t,n,r,o){var i,s,l,a,d,h=n.length,f=h,c=0;for(e.__k=new Array(o),i=0;i<o;i++)(s=t[i])!=null&&typeof s!="boolean"&&typeof s!="function"?(a=i+c,(s=e.__k[i]=typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?Mn(null,s,null,null,null):Un(s)?Mn(Pt,{children:s},null,null,null):s.constructor==null&&s.__b>0?Mn(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=e,s.__b=e.__b+1,l=null,(d=s.__i=Kd(s,n,a,f))!=-1&&(f--,(l=n[d])&&(l.__u|=2)),l==null||l.__v==null?(d==-1&&(o>h?c--:o<h&&c++),typeof s.type!="function"&&(s.__u|=4)):d!=a&&(d==a-1?c--:d==a+1?c++:(d>a?c--:c++,s.__u|=4))):e.__k[i]=null;if(f)for(i=0;i<h;i++)(l=n[i])!=null&&(2&l.__u)==0&&(l.__e==r&&(r=Ct(l)),Ls(l,l));return r}function As(e,t,n,r){var o,i;if(typeof e.type=="function"){for(o=e.__k,i=0;o&&i<o.length;i++)o[i]&&(o[i].__=e,t=As(o[i],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=Ct(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Kd(e,t,n,r){var o,i,s,l=e.key,a=e.type,d=t[n],h=d!=null&&(2&d.__u)==0;if(d===null&&e.key==null||h&&l==d.key&&a==d.type)return n;if(r>(h?1:0)){for(o=n-1,i=n+1;o>=0||i<t.length;)if((d=t[s=o>=0?o--:i++])!=null&&(2&d.__u)==0&&l==d.key&&a==d.type)return s}return-1}function ri(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n??""}function _n(e,t,n,r,o){var i;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||ri(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||ri(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(Ds,"$1")),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||(e.__l={}),e.__l[t+i]=n,n?r?n.l=r.l:(n.l=zr,e.addEventListener(t,i?Ir:br,i)):e.removeEventListener(t,i?Ir:br,i);else{if(o=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function oi(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=zr++;else if(t.u<n.l)return;return n(O.event?O.event(t):t)}}}function Or(e,t,n,r,o,i,s,l,a,d,h){var f,c,m,p,g,v,w,x,b,I,S,E,V,de,Y,fe,Q,te,ce,ne,De,j=t.type;if(t.constructor!=null)return null;128&n.__u&&(a=!!(32&n.__u),n.__c.__z&&(l=t.__e=n.__e=(i=n.__c.__z)[0],n.__c.__z=null)),(f=O.__b)&&f(t);e:if(typeof j=="function")try{if(x=t.props,b="prototype"in j&&j.prototype.render,I=(f=j.contextType)&&r[f.__c],S=f?I?I.props.value:f.__:r,n.__c?2&(c=t.__c=n.__c).__g&&(c.__g|=1,w=!0):(b?t.__c=c=new j(x,S):(t.__c=c=new Tn(x,S),c.constructor=j,c.render=Gd),I&&I.sub(c),c.props=x,c.state||(c.state={}),c.context=S,c.__n=r,m=!0,c.__g|=8,c.__h=[],c._sb=[]),b&&c.__s==null&&(c.__s=c.state),b&&j.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=et({},c.__s)),et(c.__s,j.getDerivedStateFromProps(x,c.__s))),p=c.props,g=c.state,c.__v=t,m)b&&j.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),b&&c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(b&&j.getDerivedStateFromProps==null&&x!==p&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(x,S),!(4&c.__g)&&c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(x,c.__s,S)===!1||t.__v==n.__v){for(t.__v!=n.__v&&(c.props=x,c.state=c.__s,c.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(se){se&&(se.__=t)}),E=0;E<c._sb.length;E++)c.__h.push(c._sb[E]);c._sb=[],c.__h.length&&s.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(x,c.__s,S),b&&c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(p,g,v)})}if(c.context=S,c.props=x,c.__P=e,c.__g&=-5,V=O.__r,de=0,b){for(c.state=c.__s,c.__g&=-9,V&&V(t),f=c.render(c.props,c.state,c.context),Y=0;Y<c._sb.length;Y++)c.__h.push(c._sb[Y]);c._sb=[]}else do c.__g&=-9,V&&V(t),f=c.render(c.props,c.state,c.context),c.state=c.__s;while(8&c.__g&&++de<25);c.state=c.__s,c.getChildContext!=null&&(r=et({},r,c.getChildContext())),b&&!m&&c.getSnapshotBeforeUpdate!=null&&(v=c.getSnapshotBeforeUpdate(p,g)),fe=f,f!=null&&f.type===Pt&&f.key==null&&(fe=Vs(f.props.children)),l=Ns(e,Un(fe)?fe:[fe],t,n,r,o,i,s,l,a,d,h),t.__u&=-161,c.__h.length&&s.push(c),w&&(c.__g&=-4)}catch(se){if(t.__v=null,a||i!=null)if(se.then){for(Q=0,te=!1,t.__u|=a?160:128,t.__c.__z=[],ce=0;ce<i.length;ce++)(ne=i[ce])==null||te||(ne.nodeType==8&&ne.data=="$s"?(Q>0&&t.__c.__z.push(ne),Q++,i[ce]=null):ne.nodeType==8&&ne.data=="/$s"?(--Q>0&&t.__c.__z.push(ne),te=Q===0,l=i[ce],i[ce]=null):Q>0&&(t.__c.__z.push(ne),i[ce]=null));if(!te){for(;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;i[i.indexOf(l)]=null,t.__c.__z=[l]}t.__e=l}else{for(De=i.length;De--;)qr(i[De]);wr(t)}else t.__e=n.__e,t.__k=n.__k,se.then||wr(t);O.__e(se,t,n)}else l=t.__e=Wd(n.__e,t,n,r,o,i,s,a,d,h);return(f=O.diffed)&&f(t),128&t.__u?void 0:l}function wr(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(wr)}function Rs(e,t,n){for(var r=0;r<n.length;r++)jr(n[r],n[++r],n[++r]);O.__c&&O.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(i){i.call(o)})}catch(i){O.__e(i,o.__v)}})}function Vs(e){return typeof e!="object"||e==null||e.__b&&e.__b>0?e:Un(e)?e.map(Vs):et({},e)}function Wd(e,t,n,r,o,i,s,l,a,d){var h,f,c,m,p,g,v,w,x=n.props,b=t.props,I=t.type;if(I=="svg"?o="http://www.w3.org/2000/svg":I=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),i!=null){for(h=0;h<i.length;h++)if((p=i[h])&&"setAttribute"in p==!!I&&(I?p.localName==I:p.nodeType==3)){e=p,i[h]=null;break}}if(e==null){if(I==null)return d.createTextNode(b);e=d.createElementNS(o,I,b.is&&b),l&&(O.__m&&O.__m(t,i),l=!1),i=null}if(I==null)x===b||l&&e.data==b||(e.data=b);else{if(i=i&&Hr.call(e.childNodes),x=n.props||on,!l&&i!=null)for(x={},h=0;h<e.attributes.length;h++)x[(p=e.attributes[h]).name]=p.value;for(h in x)if(p=x[h],h!="children"){if(h=="dangerouslySetInnerHTML")c=p;else if(!(h in b)){if(h=="value"&&"defaultValue"in b||h=="checked"&&"defaultChecked"in b)continue;_n(e,h,null,p,o)}}for(h in w=1&n.__u,b)p=b[h],h=="children"?m=p:h=="dangerouslySetInnerHTML"?f=p:h=="value"?g=p:h=="checked"?v=p:l&&typeof p!="function"||x[h]===p&&!w||_n(e,h,p,x[h],o);if(f)l||c&&(f.__html==c.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(c&&(e.innerHTML=""),Ns(I=="template"?e.content:e,Un(m)?m:[m],t,n,r,I=="foreignObject"?"http://www.w3.org/1999/xhtml":o,i,s,i?i[0]:n.__k&&Ct(n,0),l,a,d),i!=null)for(h=i.length;h--;)qr(i[h]);l||(h="value",I=="progress"&&g==null?e.removeAttribute("value"):g==null||g===e[h]&&(I!=="progress"||g)||_n(e,h,g,x[h],o),h="checked",v!=null&&v!=e[h]&&_n(e,h,v,x[h],o))}return e}function jr(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(o){O.__e(o,n)}}function Ls(e,t,n){var r,o;if(O.unmount&&O.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||jr(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){O.__e(i,t)}r.__P=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&Ls(r[o],t,n||typeof e.type!="function");n||qr(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function Gd(e,t,n){return this.constructor(e,n)}function Sr(e,t){var n,r,o,i;t==document&&(t=document.documentElement),O.__&&O.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=xr(Pt,null,[e]),o=[],i=[],Or(t,e,r||on,on,t.namespaceURI,r?null:t.firstChild?Hr.call(t.childNodes):null,o,r?r.__e:t.firstChild,n,i,t.ownerDocument),Rs(o,e,i)}function Yd(e,t){e.__u|=32,Sr(e,t)}O={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!(1&o.__g)){o.__g|=4;try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),s=8&o.__g),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),s=8&o.__g),s)return void(o.__g|=2)}catch(l){e=l}}throw Hn=0,e}},Ps=0,Tn.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=et({},this.state),typeof e=="function"&&(e=e(et({},n),this.props)),e&&et(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),ni(this))},Tn.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),ni(this))},Tn.prototype.render=Pt,at=[],Hn=0,Es=function(e,t){return e.__v.__b-t.__v.__b},Ds=/(PointerCapture)$|Capture$/i,zr=0,br=oi(!1),Ir=oi(!0);var Xd=0;function _(e,t,n,r,o,i){t||(t={});var s,l,a=t;if("ref"in a&&typeof e!="function")for(l in a={},t)l=="ref"?s=t[l]:a[l]=t[l];var d={type:e,props:a,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Xd,__i:-1,__u:0,__source:o,__self:i};return O.vnode&&O.vnode(d),d}const Qd=16,Jd=16,Zd={};function Zt({name:e,remappedFrom:t,token:n,width:r,height:o,viewBox:i,label:s,alignCapitals:l=!1}){"use no memo";const a=`#${e.replace(/^#/,"")}`,{width:d,height:h,viewBox:f}=Zd[e]??{width:Qd,height:Jd},c=r??d,m=o??h,p=i??f??`0 0 ${d} ${h}`;return _("svg",{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":l,...s!=null?{"aria-label":s,role:"img"}:{"aria-hidden":!0},viewBox:p,width:c,height:m,children:_("use",{href:a})})}const ii=e=>e!==void 0&&/\s/.test(e),eh=(e,t)=>{const n=r=>ii(e[r-1])||ii(e[r]);if(!n(t))return t;for(let r=1;r<e.length;r++){const o=t-r;if(o>0&&!n(o))return o;const i=t+r;if(i<e.length&&!n(i))return i}return t},Fs=e=>eh(e,Math.ceil(e.length/2)),si=e=>{if(e.length<2)return[e,""];const t=Fs(e);return[e.slice(0,t),e.slice(t)]},th=e=>{if(e.length<4)return[e,""];const t=e.lastIndexOf(".")+1,n=e.length-t>10,r=t>=1&&!n?t:Fs(e);return[e.slice(0,r),e.slice(r)]},nh=e=>{if(e.length<4)return[e,""];const t=e.lastIndexOf("/")+1,n=e.length-t>25,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},rh=(e,{splitIndex:t}={})=>{if(typeof t!="number"){const n=Math.ceil(e.length/2);return[e.slice(0,n),e.slice(n)]}return[e.slice(0,t),e.slice(t)]},oh=(e,{splitOffset:t}={})=>{if(typeof t!="number"||t<=0||t>=e.length){const r=Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]}const n=e.length-t;return[e.slice(0,n),e.slice(n)]},ih=(e,{splitOffset:t}={})=>{if(typeof t!="number"||t<=0||t>=e.length){const r=Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]}const n=t;return[e.slice(0,n),e.slice(n)]};function sh({children:e,marker:t,variant:n="default"}){"use no memo";return _("div",{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:_("div",{"data-truncate-marker":!0,children:typeof t=="function"?t({children:e}):n==="fade"?_("span",{"data-truncate-fade":!0}):t})})}function lh(e){"use no memo";const{mode:t,children:n}=e;return _("div",{children:[_("div",{"data-truncate-content":"visible",children:t==="fruncate"?_("span",{children:n}):n}),_("div",{"data-truncate-content":"overflow","aria-hidden":!0,children:t==="fruncate"?_("span",{children:n}):n})]})}function Bs({children:e,mode:t="truncate",marker:n="…",variant:r="default",...o}){"use no memo";const i=_(lh,{mode:t,children:e},"content"),s=_(sh,{marker:n,mode:t,variant:r},"marker");return _("div",{"data-truncate-container":t,"data-truncate-variant":r,...o,children:_("div",{"data-truncate-grid":!0,children:t==="truncate"?[i,s]:[s,i,_("div",{"data-truncate-fill":!0},"fill")]})})}function Nn({children:e,...t}){"use no memo";return _(Bs,{mode:"truncate",...t,children:e})}function sr({children:e,...t}){"use no memo";return _(Bs,{mode:"fruncate",...t,children:e})}function ah({children:e,contents:t,priority:n="end",split:r="center",minimumLength:o=12,className:i,style:s,...l}){"use no memo";let a=null,d=null;if(Array.isArray(t)){if(t.length!==2)return console.error("MiddleTruncate: contents must be an array of two items"),null;a=_(Nn,{...l,children:t[0]}),d=_(sr,{...l,children:t[1]})}else{if(typeof e!="string")return console.error("MiddleTruncate: children must be a string"),null;if(e.length===0)return _("div",{className:i,style:s});if(e.length<o)return n==="end"?_(sr,{...l,className:i,style:s,children:e}):_(Nn,{...l,className:i,style:s,children:e});let h=null,f=null,c=null;if(typeof r=="string")r==="center"?h=si:r==="extension"?h=th:r==="leaf-path"&&(h=nh);else if(typeof r=="number")h=rh,f=r;else if(Array.isArray(r)){const[I,S]=r;c=S,I==="last"?h=oh:I==="first"&&(h=ih)}else typeof r=="function"&&(h=r);h??=si;const[m,p]=h(e,{priority:n,variant:l.variant,splitIndex:typeof f=="number"?f:void 0,splitOffset:typeof c=="number"?c:void 0}),g=m.length>=p.length,v=n==="equal"&&!g,w=n==="equal"&&g,x={},b={};v&&(x.marker=""),w&&(b.marker=""),a=_(Nn,{...l,...x,children:m}),d=_(sr,{...l,...b,children:p})}return _("div",{"data-truncate-group-container":"middle",className:i,style:s,children:[_("div",{"data-truncate-segment-priority":n==="start"||n==="equal"?"1":"2",children:a}),_("div",{"data-truncate-segment-priority":n==="end"||n==="equal"?"1":"2",children:d})]})}const Cr={endIndex:-1,startIndex:-1};function ch(e,t,n){return Math.min(Math.max(e,t),n)}function li(e,t){return e<0||t<e?Cr:{endIndex:t,startIndex:e}}function _r(e){return e.startIndex<0||e.endIndex<e.startIndex}function uh(e,t){return _r(e)?0:(e.endIndex-e.startIndex+1)*t}function ai(e,t,n){if(t<=0)return-1;const r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function dh(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function hh(e){const t=new Map;return e.forEach((n,r)=>{if(n.kind!=="directory"||!n.isExpanded)return;const o=n.ancestorPaths.length,i=t.get(o);if(i==null){t.set(o,[r]);return}i.push(r)}),t}function fh(e,t){let n=0,r=e.length-1,o=-1;for(;n<=r;){const i=Math.floor((n+r)/2),s=e[i];if(s==null)break;if(s<=t){o=i,n=i+1;continue}r=i-1}return o}function ph(e){const t=new Map,n=[];for(let o=0;o<e.length;o+=1){const i=e[o];if(i==null)continue;const s=i.kind==="directory"&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths;let l=0;for(;l<n.length&&l<s.length&&n[l]===s[l];)l+=1;for(let a=n.length-1;a>=l;a-=1){const d=n[a];d!=null&&t.set(d,o-1)}n.length=l;for(let a=l;a<s.length;a+=1){const d=s[a];d!=null&&n.push(d)}}const r=e.length-1;for(const o of n)t.set(o,r);return t}function zs(e,t,n){if(e.length===0||t<=0)return[];const r=ph(e),o=hh(e),i=[];for(let s=0;s<e.length;s+=1){const l=o.get(s);if(l==null||l.length===0)break;const a=t+s*n;let d=fh(l,Math.min(e.length-1,Math.floor(a/n))),h=null;for(;d>=0;){const f=l[d],c=f==null?null:e[f]??null;if(c!=null&&(s===0||c.ancestorPaths[s-1]===i[s-1]?.path)){h=c;break}d-=1}if(h==null)break;i.push(h)}return i.map((s,l)=>{const a=l*n,d=(r.get(s.path)??e.length-1)+1;if(d>=e.length)return{row:s,top:a};const h=d*n-t;return{row:s,top:Math.min(a,h-n)}}).filter(s=>s.top+n>0)}function mh(e,t){const n=t.totalRowCount??e.length,r=n*t.itemHeight,o=Math.max(0,t.viewportHeight),i=Math.max(0,Math.floor(t.overscan)),s=Math.max(0,r-o),l=ch(t.scrollTop,0,s),a=t.stickyRows??zs(e,l,t.itemHeight),d=a.reduce((E,V)=>Math.max(E,V.top+t.itemHeight),0),h=Math.min(r,l+d),f=Math.max(0,o-d),c=Math.max(0,r-h),m=ai(l,n,t.itemHeight),p=ai(h,n,t.itemHeight),g=d<=0||m<0||m>=n?-1:m,v=g===-1?-1:Math.min(n-1,p-1),w=g===-1||v<g?0:v-g+1,x=f<=0||p>=n?Cr:li(p,dh(h+f,n,t.itemHeight)),b=v+1,I=_r(x)?Cr:li(Math.max(b,x.startIndex-i),Math.min(n-1,x.endIndex+i)),S=uh(I,t.itemHeight);return{occlusion:{firstOccludedIndex:g,lastOccludedIndex:v,occludedCount:w},physical:{itemHeight:t.itemHeight,maxScrollTop:s,overscan:i,scrollTop:l,totalHeight:r,totalRowCount:n,viewportHeight:o},projected:{contentHeight:c,paneHeight:f,paneTop:h},sticky:{height:d,rows:a},visible:x,window:{endIndex:I.endIndex,height:S,offsetTop:_r(I)?0:I.startIndex*t.itemHeight,startIndex:I.startIndex}}}const gh={added:"A",deleted:"D",ignored:null,modified:"M",renamed:"R",untracked:"U"},vh={added:"Git status: added",deleted:"Git status: deleted",ignored:"Git status: ignored",modified:"Git status: modified",renamed:"Git status: renamed",untracked:"Git status: untracked"},yh="Contains git status items";function bh(e){return e.current?!0:(e.current=!0,!1)}function Hs(e){const{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:o=0,viewportHeight:i}=e;if(n<0)return null;const s=Math.max(0,o),l=n*r,a=l+r;if(l<t+s){const d=Math.max(0,l-s);return d===t?null:d}if(a>t+i){const d=a-i;return d===t?null:d}return null}function Ih(e){const{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:o,topInset:i=0,totalHeight:s,viewportHeight:l}=e;if(o==="nearest")return Hs({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i,viewportHeight:l});if(n<0)return null;const a=Math.max(0,i),d=n*r,h=Math.max(0,l-a),f=o==="center"?a+Math.max(0,(h-r)/2):a,c=Math.max(0,s-l),m=Math.max(0,Math.min(d-f,c));return m===t?null:m}function xh(e){const{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:o,totalHeight:i,viewportHeight:s}=e;if(n<0)return null;const l=Math.max(0,o),a=n*r,d=a+r,h=t+l,f=t+s;if(a>=h&&d<=f)return null;const c=Math.max(0,i-s),m=Math.max(0,Math.min(a-l,c));return m===t?null:m}function It(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});const t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function kn(e){const t=e.getRootNode();if(t instanceof ShadowRoot){const r=t.activeElement;return r instanceof HTMLElement?r:null}const n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function Kt(e,t){if(e==null)return t;const n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function ci(e,t){return e!=null&&e>0?e:t}function wh(e){const t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;return n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0?n.blockSize:e.contentRect.height>0?e.contentRect.height:null}function ui(e,t,n,r,o=0){const i=Hs({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:o,viewportHeight:r});return i==null?!1:(e.scrollTop=i,!0)}function Sh(e,t,n,r,o,i,s=0){const l=Ih({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:i,topInset:s,totalHeight:o,viewportHeight:r});return l==null?!1:(e.scrollTop=l,!0)}function Wt(e,t,n,r,o,i){const s=xh({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:i,totalHeight:o,viewportHeight:r});return s==null?!1:(e.scrollTop=s,!0)}function di(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function Ch(e){const{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?"reset":r?n===t?"ignore":"focus-input":"reveal-canonical"}function _h({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:o,onInput:i}){return _("input",{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:o,onInput:i,onClick:s=>s.stopPropagation(),onMouseDown:s=>s.stopPropagation(),onPointerDown:s=>s.stopPropagation()})}function kh(e){const{row:t,mode:n,targetPath:r,ariaLabel:o,domId:i,isParked:s,itemHeight:l,features:a,state:d,extraStyle:h}=e,f=n==="sticky",c=t.ancestorPaths.at(-1)??"",m={};return d.isFocusRinged&&(m["data-item-focused"]=!0),t.isSelected&&(m["data-item-selected"]=!0),d.isContextHovered&&(m["data-item-context-hover"]="true"),d.isDragTarget&&(m["data-item-drag-target"]=!0),d.isDragging&&(m["data-item-dragging"]=!0),d.effectiveGitStatus!=null&&(m["data-item-git-status"]=d.effectiveGitStatus),d.containsGitChange&&(m["data-item-contains-git-change"]="true"),{"aria-expanded":!f&&t.kind==="directory"?t.isExpanded:void 0,"aria-haspopup":a.contextMenuEnabled?"menu":void 0,"aria-label":o,"aria-level":f?void 0:t.level+1,"aria-posinset":f?void 0:t.posInSet+1,"aria-selected":f?void 0:t.isSelected?"true":"false","aria-setsize":f?void 0:t.setSize,"data-file-tree-sticky-path":f?r:void 0,"data-file-tree-sticky-row":f?"true":void 0,"data-item-context-menu-button-visibility":a.actionLaneEnabled?a.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":a.contextMenuEnabled?a.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":a.actionLaneEnabled?"true":void 0,"data-item-has-git-lane":a.gitLaneActive?"true":void 0,"data-item-parent-path":c.length>0?c:void 0,"data-item-parked":s?"true":void 0,"data-item-path":r,"data-item-type":t.kind==="directory"?"folder":"file","data-type":"item",id:f?void 0:i,role:f?void 0:"treeitem",style:{minHeight:`${l}px`,...h},tabIndex:!f&&t.isFocused?0:-1,...m}}function Ph(e){const{event:t,mode:n,isSearchOpen:r,isDirectory:o}=e,i=t.ctrlKey||t.metaKey,s=t.shiftKey||i,l=t.shiftKey?{additive:i,kind:"range"}:i?{kind:"toggle"}:{kind:"single"};return{closeSearch:r,revealCanonical:n==="sticky",selection:l,toggleDirectory:!s&&o}}var _t,ee,lr,hi,kr=Object.is,sn=0,qs=[],ie=O,fi=ie.__b,pi=ie.__r,mi=ie.diffed,gi=ie.__c,vi=ie.unmount,yi=ie.__;function Kn(e,t){ie.__h&&ie.__h(ee,e,sn||t),sn=0;var n=ee.__H||(ee.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Be(e){return sn=1,Eh(Os,e)}function Eh(e,t,n){var r=Kn(_t++,2);if(r.t=e,!r.__c&&(r.__=[Os(void 0,t),function(l){var a=r.__N?r.__N[0]:r.__[0],d=r.t(a,l);kr(a,d)||(r.__N=[d,r.__[1]],r.__c.setState({}))}],r.__c=ee,!ee.__f)){var o=function(l,a,d){if(!r.__c.__H)return!0;var h=r.__c.__H.__.filter(function(c){return!!c.__c});if(h.every(function(c){return!c.__N}))return!i||i.call(this,l,a,d);var f=r.__c.props!==l;return h.forEach(function(c){if(c.__N){var m=c.__[0];c.__=c.__N,c.__N=void 0,kr(m,c.__[0])||(f=!0)}}),i&&i.call(this,l,a,d)||f};ee.__f=!0;var i=ee.shouldComponentUpdate,s=ee.componentWillUpdate;ee.componentWillUpdate=function(l,a,d){if(4&this.__g){var h=i;i=void 0,o(l,a,d),i=h}s&&s.call(this,l,a,d)},ee.shouldComponentUpdate=o}return r.__N||r.__}function bi(e,t){var n=Kn(_t++,3);!ie.__s&&$r(n.__H,t)&&(n.__=e,n.u=t,ee.__H.__h.push(n))}function Ce(e,t){var n=Kn(_t++,4);!ie.__s&&$r(n.__H,t)&&(n.__=e,n.u=t,ee.__h.push(n))}function R(e){return sn=5,Qe(function(){return{current:e}},[])}function Qe(e,t){var n=Kn(_t++,7);return $r(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function ve(e,t){return sn=8,Qe(function(){return e},t)}function Dh(){for(var e;e=qs.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(An),e.__H.__h.forEach(Pr),e.__H.__h=[]}catch(t){e.__H.__h=[],ie.__e(t,e.__v)}}ie.__b=function(e){ee=null,fi&&fi(e)},ie.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),yi&&yi(e,t)},ie.__r=function(e){pi&&pi(e),_t=0;var t=(ee=e.__c).__H;t&&(lr===ee?(t.__h=[],ee.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.forEach(An),t.__h.forEach(Pr),t.__h=[],_t=0)),lr=ee},ie.diffed=function(e){mi&&mi(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(qs.push(t)!==1&&hi===ie.requestAnimationFrame||((hi=ie.requestAnimationFrame)||Mh)(Dh)),t.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0})),lr=ee=null},ie.__c=function(e,t){t.some(function(n){try{n.__h.forEach(An),n.__h=n.__h.filter(function(r){return!r.__||Pr(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],ie.__e(r,n.__v)}}),gi&&gi(e,t)},ie.unmount=function(e){vi&&vi(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{An(r)}catch(o){t=o}}),n.__H=void 0,t&&ie.__e(t,n.__v))};var Ii=typeof requestAnimationFrame=="function";function Mh(e){var t,n=function(){clearTimeout(r),Ii&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Ii&&(t=requestAnimationFrame(n))}function An(e){var t=ee,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),ee=t}function Pr(e){var t=ee;e.__c=e.__(),ee=t}function $r(e,t){return!e||e.length!==t.length||t.some(function(n,r){return!kr(n,e[r])})}function Os(e,t){return typeof t=="function"?t(e):t}function Th(e,t=null,n=null){"use no memo";const r=e.flattenedSegments;return r==null||r.length===0?t??e.name:_("span",{"data-item-flattened-subitems":!0,children:r.map((o,i)=>{const s=i===r.length-1;return _(Pt,{children:[_("span",{"data-item-flattened-subitem":o.path,"data-item-flattened-subitem-drag-target":n===o.path?"true":void 0,children:s&&t!=null?t:_(Nn,{children:o.name})}),i<r.length-1?" / ":""]},o.path)})})}function xt(e){return e.isFlattened?e.flattenedSegments?.findLast(t=>t.isTerminal)?.path??e.path:e.path}function Er(e){const t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(n=>n.name).join(" / ")}function xi(e,t,n,r){return e.map((o,i)=>{const s=i*n,l=o.subtreeEndIndex+1;if(l>=r)return{row:o.row,top:s};const a=l*n-t;return{row:o.row,top:Math.min(s,a-n)}}).filter(o=>o.top+n>0)}function ar({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:o,viewportHeight:i}){const s=e.getVisibleCount(),l=o&&s>0?e.getStickyRowCandidates(r,t):[],a=l==null&&o&&s>0?e.getVisibleRows(0,s-1):[],d=mh(a,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:l==null?void 0:xi(l,r,t,s),totalRowCount:s,viewportHeight:i}),h=o&&r<=0&&s>0?e.getStickyRowCandidates(1,t):[],f=h!=null&&r<=0?xi(h,1,t,s):o&&r<=0&&a.length>0?zs(a,1,t):d.sticky.rows;return{overlayHeight:f.reduce((c,m)=>Math.max(c,m.top+t),0),overlayRows:f,snapshot:d,visibleRows:a}}const Nh=400,wi=10,bt=40,Si=18;function Ah(e,t,n){const r=e,o=document.elementFromPoint?.bind(document)??null,i=r.elementFromPoint?.(t,n)??o?.(t,n)??null;return e instanceof ShadowRoot&&(i==null||!e.contains(i))?Rh(e,t,n):i instanceof HTMLElement?i:null}function Rh(e,t,n){const r=Array.from(e.querySelectorAll('[data-type="item"], [data-item-flattened-subitem]'));for(let o=r.length-1;o>=0;o--){const i=r[o],s=i.getBoundingClientRect();if(t>=s.left&&t<=s.right&&n>=s.top&&n<=s.bottom)return i}return null}function Ci(e){const t=e?.closest?.('[data-type="item"]');if(!(t instanceof HTMLElement))return null;const n=t.dataset.itemPath??null;if(n==null)return null;const r=e?.closest?.("[data-item-flattened-subitem]"),o=r instanceof HTMLElement?r.getAttribute("data-item-flattened-subitem")??null:null;if(o!=null&&o.endsWith("/"))return{directoryPath:o,flattenedSegmentPath:o,hoveredPath:n,kind:"directory"};if(t.dataset.itemType==="folder")return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:"directory"};const i=t.dataset.itemParentPath??null;return i==null||i.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:"root"}:{directoryPath:i,flattenedSegmentPath:null,hoveredPath:n,kind:"directory"}}function _i(e){const t=e.cloneNode(!0);return t.removeAttribute("id"),t.dataset.fileTreeDragPreview="true",t.setAttribute("aria-hidden","true"),t.tabIndex=-1,Object.assign(t.style,{boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",left:"0px",margin:"0",pointerEvents:"none",position:"fixed",top:"0px",willChange:"transform",zIndex:"10000"}),t}function Vh(){return navigator.vendor!=="Apple Computer, Inc."}function Lh(e,t){const n=e-t.top;if(n<bt)return-Math.ceil((bt-Math.max(0,n))/bt*Si);const r=t.bottom-e;return r<bt?Math.ceil((bt-Math.max(0,r))/bt*Si):0}function Fh(e,t){if(e!=null){const n=gh[e];return n==null?null:{text:n,title:vh[e]}}return t?{icon:{name:"file-tree-icon-dot",width:6,height:6},title:yh}:null}function Bh(e,t,n){if(t==null||t.size===0)return null;const r=[];for(let o=e.length-1;o>=0;o-=1){const i=e[o],s=n.get(i);if(s!=null){for(const l of r)n.set(l,s);return s?"ignored":null}if(t.has(i)){n.set(i,!0);for(const l of r)n.set(l,!0);return"ignored"}r.push(i)}for(const o of r)n.set(o,!1);return null}function ki(e){return e!=null&&"toggle"in e}function js(e){return e.code==="Space"||e.key===" "||e.key==="Spacebar"}function zh(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function Hh(e){return e==null?"":`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll("\\","\\\\").replaceAll('"','\\"')}"] { opacity: 1; }`}function $s(e){return e.shiftKey&&e.key==="F10"||e.key==="ContextMenu"}function qh(e,t){return t&&$s(e)||(e.ctrlKey||e.metaKey)&&js(e)?!0:e.key==="ArrowDown"||e.key==="ArrowLeft"||e.key==="ArrowRight"||e.key==="ArrowUp"}const Oh=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home","PageDown","PageUp"]);function Pi(e){for(const t of e.composedPath())if(t instanceof HTMLElement&&(t.dataset.fileTreeContextMenuRoot==="true"||t.dataset.type==="context-menu-anchor"||t.dataset.type==="context-menu-trigger"||t.getAttribute("slot")==="context-menu"))return!0;return!1}function jh(e){return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width,x:e.x,y:e.y}}function $h(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function Uh(e,t){if(e==null)return t.offsetTop;const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function Ei(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function Di(e,t,n){if(e==null)return null;const r=t.get(e)??null;if(r!=null)return r;const o=n.get(e)??null;return o?.dataset.itemParked==="true"?null:o}function Kh(e){if(e==null)return[];const t=[];for(const n of e.querySelectorAll('button[data-file-tree-sticky-row="true"]')){if(!(n instanceof HTMLElement))continue;const r=n.dataset.fileTreeStickyPath;r!=null&&t.push(r)}return t}function Wh(e,t){if(e==null||t==null)return null;for(const n of e.querySelectorAll('button[data-item-focused="true"][data-item-parked="true"]'))if(n instanceof HTMLElement&&n.dataset.itemPath===t)return n;return null}function Gh(e,t,n,r,o,i,s){const l=Math.max(0,i-o),a=t?.getBoundingClientRect()??null,d=a==null||n==null?null:n.getBoundingClientRect().top-a.top,h=Wh(e,r),f=a==null||h==null?null:h.getBoundingClientRect().top-a.top;return Math.max(0,Math.min(f??Math.max(d??0,l),Math.max(0,s-o)))}function Mi(e,t){return{kind:e.kind,name:Er(e),path:t}}function Yh(e){return e==null?void 0:`${e}__tree`}function Us(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?"__parked":""}`}function Ti(e){return e==="file-tree-icon-chevron"||e==="file-tree-icon-dot"||e==="file-tree-icon-file"||e==="file-tree-icon-lock"}function Ni(e,t){if(e==null)return null;if("text"in e)return e.parts!=null?_("span",{title:e.title,children:e.parts.map((r,o)=>_("span",{style:{color:r.color},children:r.text},o))}):_("span",{title:e.title,children:e.text});const n=typeof e.icon=="string"?Ti(e.icon)?t(e.icon):{name:e.icon}:Ti(e.icon.name)?(()=>{const r=t(e.icon.name),{name:o,...i}=e.icon;return{...r,...i}})():e.icon;return _("span",{title:e.title,children:_(Zt,{...n})})}function Ai(e){e!=null&&It(e.querySelector(["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", "))??e)}function Xh(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:o=!1,dragTargetFlattenedSegmentPath:i=null,gitDecoration:s=null,gitLaneActive:l=!1,renameInput:a=null,showDecorativeActionAffordance:d=!1}={}){const h=xt(e);return _(Pt,{children:[e.depth>0?_("div",{"data-item-section":"spacing",children:Array.from({length:e.depth}).map((f,c)=>_("div",{"data-item-section":"spacing-item","data-ancestor-path":e.ancestorPaths[c]},c))}):null,_("div",{"data-item-section":"icon",children:e.kind==="directory"?_(Zt,{...t("file-tree-icon-chevron")}):_(Zt,{...t("file-tree-icon-file",h)})}),_("div",{"data-item-section":"content",children:e.isFlattened?Th(e,a,i):a??_(ah,{minimumLength:5,split:"extension",children:e.name})}),o?_("div",{"data-item-section":"decoration",children:r!=null?Ni(r,t):null}):null,l?_("div",{"data-item-section":"git",children:Ni(s,t)}):null,n?_("div",{"data-item-section":"action",children:d?_("span",{"aria-hidden":"true","data-item-action-affordance":"decorative",children:_(Zt,{...t("file-tree-icon-ellipsis")})}):null}):null]})}function Rn(e,t,n,r={}){const{controller:o,renameView:i,visualFocusPath:s,contextHoverPath:l,draggedPathSet:a,dragTarget:d,dragAndDropEnabled:h,shouldSuppressContextMenu:f,handleRowDragStart:c,handleRowDragEnd:m,handleRowTouchStart:p,instanceId:g,itemHeight:v,gitStatusByPath:w,ignoredGitDirectories:x,ignoredInheritanceCache:b,directoriesWithGitChanges:I,gitLaneActive:S,contextMenuEnabled:E,contextMenuTriggerMode:V,contextMenuButtonTriggerEnabled:de,contextMenuButtonVisibility:Y,contextMenuRightClickEnabled:fe,registerRenameInput:Q,registerButton:te,resolveIcon:ce,renderDecorationForRow:ne,openContextMenuForRow:De,onRowClick:j,onKeyDown:se}=e,re=xt(t),{isParked:Se=!1,mode:qe="flow",style:tt}=r,Oe=qe==="sticky",nt=w?.get(re)??null??Bh(t.ancestorPaths,x,b),ht=t.kind==="directory"&&(I?.has(re)??!1),je=ne(t,re),Ke=Fh(nt,ht),ke=E&&de,Ve=je!=null||S||ke,Et=ke&&Y==="always",Ie=i.getPath()===re,rt=Ie?i.getValue():"",Me=Oe||!Ie?null:_(_h,{ref:Q,ariaLabel:`Rename ${Er(t)}`,isFlattened:t.isFlattened,value:rt,onBlur:()=>{i.commit()},onInput:ue=>{i.setValue(ue.currentTarget.value)}}),an=Xh(t,ce,{actionLaneEnabled:ke,customDecoration:je,decorationLaneEnabled:Ve,dragTargetFlattenedSegmentPath:d?.flattenedSegmentPath??null,gitDecoration:Ke,gitLaneActive:S,renameInput:Me,showDecorativeActionAffordance:Et}),$e={...kh({ariaLabel:Er(t),domId:t.isFocused?Us(g,re,Se):void 0,extraStyle:tt,features:{actionLaneEnabled:ke,contextMenuButtonVisibility:ke?Y:null,contextMenuEnabled:E,contextMenuTriggerMode:E?V:null,gitLaneActive:S},isParked:Se,itemHeight:v,mode:qe,row:t,state:{containsGitChange:ht,effectiveGitStatus:nt,isContextHovered:l===re,isDragTarget:d?.kind==="directory"&&d.directoryPath===re,isDragging:a?.has(re)===!0,isFocusRinged:t.isFocused&&s===re},targetPath:re}),key:n,onContextMenu:E||h?ue=>{if(f()){ue.preventDefault();return}E&&(ue.preventDefault(),fe&&(o.focusMountedPathFromInput(re),De(t,re,{anchorRect:$h(ue.clientX,ue.clientY),source:"right-click"})))}:void 0,onFocus:Oe?void 0:()=>{o.focusMountedPathFromInput(re)},onKeyDown:Oe?void 0:se,ref:ue=>{te(re,ue)}};return!Oe&&Ie?_("div",{...$e,children:an}):_("button",{...$e,type:"button",draggable:h&&!Se,onDragEnd:h&&!Se?m:void 0,onDragStart:h&&!Se?ue=>{c(ue,t,re)}:void 0,onMouseDown:ue=>{if(Oe){ue.preventDefault();return}o.isSearchOpen()&&ue.preventDefault()},onTouchStart:h&&!Se?ue=>{p(ue,t,re)}:void 0,onClick:ue=>{j(ue,t,re,qe)},children:an})}function Qh(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(r=>!n.has(xt(r))).map((r,o)=>Rn(e,r,t.start+o))}function Ri({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:o,icons:i,instanceId:s,itemHeight:l=qi,overscan:a=10,renamingEnabled:d=!1,renderRowDecoration:h,searchBlurBehavior:f="close",searchEnabled:c=!1,searchFakeFocus:m=!1,slotHost:p,stickyFolders:g=!1,initialViewportHeight:v=420}){"use no memo";const w=R(null),x=R(null),b=R(!1),I=R(null),S=R(null),E=R(null),V=R(null),de=R(null),Y=R(new Map),fe=R(new Map),Q=R(()=>{}),te=R(null),ce=R(0),ne=R(!1),De=R(null);De.current!==t&&(ne.current=!1,De.current=t);const j=R(!1),se=R(null),re=R(null),Se=R(!1),qe=R(null),tt=R(null),Oe=R(null),nt=R(null),ht=R(null),je=R(null),Ke=R(null),ke=R(null),Ve=R(!1),Et=R(null),Ie=R(null),rt=R(null),Me=R(null),an=Qe(()=>new Map,[]),[,$e]=Be(0),ue=R(!1),[Kr,We]=Be(null),[Wn,cn]=Be(null),[Gn,Ks]=Be(null),[Ws,ot]=Be(null),[Gs,Ys]=Be(0),[z,Yn]=Be(null),Dt=R(z);Dt.current=z;const un=R(null),Mt=R(null),Tt=R(null),Nt=R(null),Wr=R(null),dn=R(!1),Xs=()=>{Mt.current=null,Tt.current=null,Nt.current=null},Xn=(u,y)=>{Mt.current=u,Tt.current=null,Nt.current=y==null?null:{path:u,scrollTop:y}},Qs=(u,y)=>{Mt.current=null,Tt.current={path:u,viewportOffset:y},Nt.current=null},Gr=R(f==="retain"&&t.isSearchOpen()),[Js,Yr]=Be(m);bi(()=>{m||Yr(!1)},[m]);const Xr=R(!1),Qn=ve(()=>{Xr.current=!0,Yr(u=>u&&!1)},[]),[Zs,el]=Be(()=>ar({controller:t,itemHeight:l,overscan:a,scrollTop:0,stickyFolders:g,viewportHeight:v})),[tl,nl]=Be(!1);bi(()=>{nl(!0)},[]);const xe=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,ft=e?.contextMenu?.triggerMode??(xe?"right-click":"both"),pt=ft==="both"||ft==="button",Qr=e?.contextMenu?.buttonVisibility??"when-needed",rl=ft==="both"||ft==="right-click";Ce(()=>{const u=E.current;if(u==null)return;const y=C=>{if(!(C instanceof CustomEvent))return;const k=C.detail?.path??null;Wr.current=k,cn(k),ot(k==null?null:"pointer")},M=C=>{C instanceof CustomEvent&&(dn.current=C.detail?.disabled===!0)};return u.addEventListener("file-tree-debug-set-context-menu-trigger",y),u.addEventListener("file-tree-debug-set-scroll-suppression",M),()=>{u.removeEventListener("file-tree-debug-set-context-menu-trigger",y),u.removeEventListener("file-tree-debug-set-scroll-suppression",M)}},[]);const ol=ve((u,y)=>{Ei(Y.current,u,y)},[]),il=ve((u,y)=>{Ei(fe.current,u,y)},[]),sl=ve(u=>{S.current=u},[]),At=ve(u=>Di(u,fe.current,Y.current),[]),Jr=n!=null||r!=null||o!=null,{resolveIcon:Zr}=Qe(()=>jd(i),[i]),Rt=t[xs](),mt=Rt.getPath(),Jn=mt!=null,Le=t.isSearchOpen(),ll=t.getSearchValue(),L=t.getFocusedPath(),H=t.getFocusedIndex(),it=t.getScrollRequest(),Ue=t.isDragAndDropEnabled(),Vt=t.getDragSession(),al=Qe(()=>Vt==null?null:new Set(Vt.draggedPaths),[Vt]),cl=Vt?.target??null,Lt=Vt?.primaryPath??null,eo=Yh(s),{overlayHeight:ul,overlayRows:dl,snapshot:he,visibleRows:hn}=Zs,pe=he.physical.viewportHeight,Te=Qe(()=>({end:he.window.endIndex,start:he.window.startIndex}),[he.window.endIndex,he.window.startIndex]),Ft=dl,to=he.sticky.rows,st=he.physical.totalHeight,gt=he.sticky.height,fn=Qe(()=>new Set(to.map(u=>xt(u.row))),[to]),Zn=H>=0&&H>=Te.start&&H<=Te.end,hl=ve((u,y)=>h?.({item:Mi(u,y),row:u})??null,[h]),no=ve(u=>It(u==null?null:Y.current.get(u)??null)?!0:It(E.current),[]),pn=ve(u=>{no(t.focusNearestPath(u))},[t,no]),ro=R(pn);ro.current=pn;const vt=R(!0),er=R(()=>{}),Pe=ve((u=!0)=>{const y=Dt.current;y!=null&&(vt.current=vt.current&&u,Yn(null),e?.contextMenu?.onClose?.(),vt.current&&pn(y.path))},[e?.contextMenu,pn]);er.current=Pe;const Bt=ve(u=>{const y=u==null?null:Uh(E.current,u);Ks(M=>M===y?M:y)},[]),oo=ve((u,y,M)=>{const C=t.getItem(y);if(C==null)return;const k=At(y);if(k?.dataset.fileTreeStickyRow==="true"){const A=V.current;Xn(y,A?.scrollTop??null),j.current=!0,We(K=>K===y?K:y)}C.focus(),Bt(k),vt.current=!0,Yn({anchorRect:M?.anchorRect??null,item:Mi(u,y),path:y,source:M?.source??"keyboard"})},[t,At,Bt]),fl=ve(u=>{if(d){if(t.isSearchOpen()){const y=V.current,M=Kt(y,pe);qe.current=H<0||y==null?null:Math.max(0,Math.min(H*l-y.scrollTop,Math.max(0,M-l))),Se.current=!0}t.startRenaming(u)!==!1&&(ot("focus"),$e(y=>y+1))}},[t,H,l,d,pe]),mn=ve((u,{restoreTreeFocus:y=!0,targetOffset:M="live-overlay"}={})=>{const C=V.current;if(C==null)return!1;t.focusPath(u);const k=t.getFocusedIndex();if(k<0)return!1;const A=t.getVisibleRows(k,k)[0]??null;if(A==null)return!1;const K=Kt(C,pe),N=t.getVisibleCount()*l,B=M==="sticky-parents"?A.ancestorPaths.length*l:ar({controller:t,itemHeight:l,overscan:a,scrollTop:C.scrollTop,stickyFolders:g,viewportHeight:K}).snapshot.sticky.height;return j.current=!0,Wt(C,k,l,K,N,B),Q.current(),un.current=y?u:null,!0},[t,l,a,pe,g]),pl=()=>b.current===!0||Me.current!=null||Ve.current===!0,io=u=>typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(()=>{u()}):window.setTimeout(u,16),ml=u=>{if(u!=null){if(typeof window.cancelAnimationFrame=="function"){window.cancelAnimationFrame(u);return}window.clearTimeout(u)}},Ge=()=>{nt.current!=null&&(clearTimeout(nt.current),nt.current=null),Oe.current=null},gn=()=>{je.current?.remove(),je.current=null},zt=()=>{ml(tt.current),tt.current=null,ht.current=null},so=u=>{const y=E.current?.getRootNode();if(y instanceof ShadowRoot){y.append(u);return}document.body.append(u)},Ht=()=>{ke.current?.(),ke.current=null,Me.current!=null&&(clearTimeout(Me.current),Me.current=null),Ve.current=!1,Et.current=null,rt.current=null,Ie.current!=null&&(Ie.current.setAttribute("draggable","true"),Ie.current.style.removeProperty("touch-action"),Ie.current=null),gn(),Ge(),zt(),Ke.current=null},vn=(u,y)=>{const M=E.current?.getRootNode(),C=Ci(Ah(M instanceof ShadowRoot?M:document,u,y));return t.setDragTarget(C),t.getDragSession()?.target??null},tr=u=>{const y=t.getDragAndDropConfig()?.openOnDropDelay??800;if(u==null||u.kind!=="directory"||u.directoryPath==null||y<=0){Ge();return}const M=t.getItem(u.directoryPath),C=ki(M)?M:null;if(C==null||C.isExpanded()){Ge();return}const k=`${u.directoryPath}::${u.flattenedSegmentPath??""}`;Oe.current!==k&&(Ge(),Oe.current=k,nt.current=setTimeout(()=>{const A=t.getDragSession()?.target;A?.kind!=="directory"||A.directoryPath!==u.directoryPath||A.flattenedSegmentPath!==u.flattenedSegmentPath||C.expand()},y))},lo=()=>{tt.current=null;const u=ht.current,y=V.current;if(u==null||y==null||t.getDragSession()==null)return;const M=y.getBoundingClientRect(),C=Lh(u.clientY,M);if(C===0)return;const k=Math.max(0,y.scrollHeight-y.clientHeight),A=Math.max(0,Math.min(k,y.scrollTop+C));A!==y.scrollTop&&(y.scrollTop=A,Q.current()),tr(vn(u.clientX,u.clientY)),tt.current=io(lo)},ao=(u,y)=>{ht.current={clientX:u,clientY:y},tt.current??=io(lo)},gl=(u,y,M)=>{const C=u.currentTarget;if(C!=null){if(Ht(),gn(),Ge(),zt(),t.startDrag(M)===!1){u.preventDefault();return}if(Ke.current=y,u.dataTransfer!=null&&(u.dataTransfer.effectAllowed="move",u.dataTransfer.dropEffect="move",u.dataTransfer.setData("text/plain",M),Vh())){const k=_i(C),A=C.getBoundingClientRect();Object.assign(k.style,{height:`${A.height}px`,opacity:"0.85",transform:"translate3d(-9999px, 0px, 0)",width:`${A.width}px`}),so(k),je.current=k,u.dataTransfer.setDragImage(k,Math.max(0,u.clientX-A.left),Math.max(0,u.clientY-A.top))}}},vl=()=>{gn(),Ge(),zt(),Ke.current=null,t.cancelDrag()},yl=(u,y,M)=>{if(Me.current!=null||Ve.current)return;const C=u.touches[0],k=u.currentTarget;if(C==null||k==null)return;rt.current={clientX:C.clientX,clientY:C.clientY},Ie.current=k,k.setAttribute("draggable","false");const A=(B={})=>{const $=B.restoreNativeDraggable??!Ve.current;Me.current!=null&&(clearTimeout(Me.current),Me.current=null),document.removeEventListener("touchmove",K),document.removeEventListener("touchend",N),document.removeEventListener("touchcancel",N),ke.current===A&&(ke.current=null),$&&(k.setAttribute("draggable","true"),Ie.current===k&&(Ie.current=null),rt.current=null)},K=B=>{const $=B.touches[0],q=rt.current;if($==null||q==null)return;const X=$.clientX-q.clientX,ge=$.clientY-q.clientY;X*X+ge*ge<=wi*wi||A()},N=()=>{A()};document.addEventListener("touchmove",K,{passive:!0}),document.addEventListener("touchend",N),document.addEventListener("touchcancel",N),ke.current=A,Me.current=setTimeout(()=>{if(A({restoreNativeDraggable:!1}),t.startDrag(M)===!1){k.setAttribute("draggable","true"),Ie.current===k&&(Ie.current=null),rt.current=null;return}Ve.current=!0,Ie.current=k,k.setAttribute("draggable","false"),k.style.setProperty("touch-action","none"),Ke.current=y;const B=k.getBoundingClientRect(),$=_i(k);Object.assign($.style,{height:`${B.height}px`,opacity:"0.85",transform:`translate3d(${B.left}px, ${B.top}px, 0)`,width:`${B.width}px`}),so($),je.current=$,Et.current={x:C.clientX-B.left,y:C.clientY-B.top};const q=Ne=>{const le=Ne.touches[0];if(le==null)return;Ne.preventDefault();const F=Et.current;F!=null&&je.current!=null&&(je.current.style.transform=`translate3d(${le.clientX-F.x}px, ${le.clientY-F.y}px, 0)`),tr(vn(le.clientX,le.clientY)),ao(le.clientX,le.clientY)},X=Ne=>{const le=Ne.changedTouches[0];le!=null&&vn(le.clientX,le.clientY),t.completeDrag(),Ht()},ge=()=>{t.cancelDrag(),Ht()};ke.current=()=>{document.removeEventListener("touchmove",q),document.removeEventListener("touchend",X),document.removeEventListener("touchcancel",ge)},document.addEventListener("touchmove",q,{passive:!1}),document.addEventListener("touchend",X),document.addEventListener("touchcancel",ge)},Nh)},co=u=>{if(z!=null){if(u.key==="Escape"){Pe(),u.preventDefault(),u.stopPropagation();return}Oh.has(u.key)&&(u.preventDefault(),u.stopPropagation());return}if(Rt.isActive()){if(u.isComposing||u.keyCode===229)return;if(u.key==="Escape")Rt.cancel();else if(u.key==="Enter")Rt.commit();else return;ot("focus"),$e(Z=>Z+1),u.preventDefault(),u.stopPropagation();return}if(d&&u.key==="F2"){fl(L??void 0),u.preventDefault(),u.stopPropagation();return}if(Le){if(u.key==="Escape")Se.current=!1,qe.current=null,t.closeSearch();else if(u.key==="Enter"){const Z=t.getFocusedPath();Z!=null&&t.selectOnlyPath(Z);const Fe=V.current,wn=Kt(Fe,pe);qe.current=H<0||Fe==null?null:Math.max(0,Math.min(H*l-Fe.scrollTop,Math.max(0,wn-l))),Se.current=!0,t.closeSearch()}else if(u.key==="ArrowDown")t.focusNextSearchMatch();else if(u.key==="ArrowUp")t.focusPreviousSearchMatch();else return;ot("focus"),$e(Z=>Z+1),u.preventDefault(),u.stopPropagation();return}if(c&&zh(u)){t.openSearch(u.key),$e(Z=>Z+1),u.preventDefault(),u.stopPropagation();return}const y=xe&&$s(u),M=qh(u,xe),C=M&&E.current!=null?kn(E.current):null,k=M?new Set(Kh(E.current)):new Set,A=C?.dataset.fileTreeStickyPath??null,K=C?.dataset.fileTreeStickyRow==="true"&&A!=null;if(K&&A!==L&&k.has(A)){const Z=V.current;Xn(A,Z?.scrollTop??null),t.focusPath(A)}const N=t.getFocusedPath(),B=t.getFocusedIndex(),$=t.getFocusedItem();if($==null)return;const q=ki($)?$:null,X=N!=null&&(fn.has(N)||K&&A===N&&k.has(N)),ge=u.key==="ArrowDown"||u.key==="ArrowUp"||u.key==="ArrowRight"&&q!=null&&q.isExpanded(),Ne=u.key==="ArrowLeft"&&X&&q!=null&&q.isExpanded(),le=V.current;let F=!0;if(u.shiftKey&&u.key==="ArrowDown")t.extendSelectionFromFocused(1);else if(u.shiftKey&&u.key==="ArrowUp")t.extendSelectionFromFocused(-1);else if(y&&N!=null&&B>=0){const Z=t.getVisibleRows(B,B)[0]??null,Fe=Di(N,fe.current,Y.current);Z==null||Fe==null?F=!1:oo(Z,N)}else if((u.ctrlKey||u.metaKey)&&js(u))t.toggleFocusedSelection();else if((u.ctrlKey||u.metaKey)&&u.key.toLowerCase()==="a")t.selectAllVisiblePaths();else switch(u.key){case"ArrowDown":t.focusNextItem();break;case"ArrowUp":t.focusPreviousItem();break;case"ArrowRight":q==null||q.isExpanded()?t.focusNextItem():q.expand();break;case"ArrowLeft":q!=null&&q.isExpanded()?q.collapse():t.focusParentItem();break;case"Home":t.focusFirstItem();break;case"End":t.focusLastItem();break;default:F=!1}if(!F)return;ot("focus");const J=t.getFocusedPath(),ye=J!=null&&(fn.has(J)||k.has(J)),In=ge&&J!==N,xn=y&&K&&A===N&&J===N;if((X||xn)&&J!=null&&(In&&ye||xn))Xn(J,le?.scrollTop??null),j.current=!0,We(Z=>Z===J?Z:J);else{const Z=u.key==="ArrowUp"&&X&&J!==N;J!=null&&(Z||Ne&&J===N)?(Qs(J,Gh(E.current,le,C,N,l,gt,pe)),j.current=!0,We(Fe=>Fe===J?Fe:J)):Xs()}$e(Z=>Z+1),u.preventDefault(),u.stopPropagation()};Ce(()=>{if(!(!c||!Le)){if(Gr.current){Gr.current=!1;return}It(de.current)}},[Le,c]),Ce(()=>{const u=S.current;switch(Ch({hasRenderedInput:u!=null,previousRenamingPath:re.current,renamingPath:mt})){case"reset":re.current=null;return;case"reveal-canonical":mt!=null&&mn(mt,{restoreTreeFocus:!1,targetOffset:"live-overlay"});return;case"ignore":return;case"focus-input":u!=null&&(un.current=null,re.current=mt,It(u),u.select());return}},[Te.end,Te.start,mt,mn,fn]),Ce(()=>{const u=E.current;if(u==null)return;let y=null;const M=()=>{y!=null&&(clearTimeout(y),y=null)},C=()=>{const K=kn(u)?.dataset.itemPath??null;We(N=>N===K?N:K)},k=()=>{M(),j.current=!0,C()},A=K=>{const N=K.relatedTarget;if(N==null){M(),y=setTimeout(()=>{if(y=null,kn(u)!=null){C();return}j.current=!1,We(null)},0);return}if(!(N instanceof Node)||!u.contains(N)){M(),j.current=!1,We(null);return}const B=N instanceof HTMLElement?N.dataset.itemPath??null:null;We($=>$===B?$:B)};return u.addEventListener("focusin",k),u.addEventListener("focusout",A),()=>{M(),u.removeEventListener("focusin",k),u.removeEventListener("focusout",A)}},[]),Ce(()=>{const u=E.current;u!=null&&(he.physical.scrollTop<=0?u.dataset.scrollAtTop="true":delete u.dataset.scrollAtTop)},[he.physical.scrollTop]),Ce(()=>{let u=null;const y=V.current,M=I.current,C=E.current;if(y==null)return;te.current=Kt(y,v);const k=()=>{const F=t.getVisibleCount(),J=ci(te.current,v),ye=Math.max(0,F*l-J);y.scrollTop>ye&&(y.scrollTop=ye),el(ar({controller:t,itemHeight:l,overscan:a,scrollTop:Math.min(y.scrollTop,ye),stickyFolders:g,viewportHeight:J}))};if(!ne.current){ne.current=!0;const F=t.getFocusedIndex();if(F>=0){const J=ci(te.current,v),ye=t.getVisibleRows(F,F)[0]??null;ui(y,F,l,J,g&&ye!=null?Math.max(0,Math.min(ye.ancestorPaths.length*l,Math.max(0,J-l))):0)}}Q.current=k;const A=t.subscribe(()=>{bh(ue)&&$e(F=>F+1),k()}),K=()=>{dn.current!==!0&&(M!=null&&(M.dataset.isScrolling??=""),C!=null&&(C.dataset.isScrolling??=""),b.current=!0,u!=null&&clearTimeout(u),u=setTimeout(()=>{M!=null&&delete M.dataset.isScrolling,C!=null&&delete C.dataset.isScrolling,b.current=!1,Ys(F=>F+1),u=null},50))};let N=null;const B=()=>{C!=null&&delete C.dataset.overlayReveal,N!=null&&(clearTimeout(N),N=null)},$=()=>{C==null||dn.current===!0||y.scrollTop>0||(C.dataset.overlayReveal="true",N!=null&&clearTimeout(N),N=setTimeout(()=>{B()},200))},q=()=>{if(k(),y.scrollTop>0&&B(),Dt.current!=null&&b.current&&er.current(),dn.current===!0){b.current=!1;return}cn(F=>F==null?F:null),K()},X=()=>{K(),$()},ge=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"," ","Spacebar"]),Ne=F=>{ge.has(F.key)&&X()};y.addEventListener("scroll",q,{passive:!0}),y.addEventListener("wheel",X,{passive:!0}),y.addEventListener("touchmove",X,{passive:!0}),y.addEventListener("keydown",Ne);const le=typeof ResizeObserver<"u"?new ResizeObserver(F=>{te.current=(F[0]==null?null:wh(F[0]))??Kt(y,v),k()}):null;return le?.observe(y),()=>{Q.current=()=>{},A(),y.removeEventListener("scroll",q),y.removeEventListener("wheel",X),y.removeEventListener("touchmove",X),y.removeEventListener("keydown",Ne),u!=null&&clearTimeout(u),N!=null&&clearTimeout(N),M!=null&&delete M.dataset.isScrolling,C!=null&&(delete C.dataset.isScrolling,delete C.dataset.overlayReveal),b.current=!1,te.current=null,le?.disconnect()}},[t,v,l,a,g]),Ce(()=>{xe||z==null||Pe(!1)},[Pe,xe,z]);const uo=Qe(()=>z==null?null:`${z.path}::${z.source}`,[z]);Ce(()=>{if(uo==null){p?.clearSlotContent(Yt);return}const u=Dt.current;if(u==null)return;const y=x.current??w.current;if(y==null)return;const M={anchorElement:y,anchorRect:u.anchorRect??jh(y.getBoundingClientRect()),close:k=>{er.current(k?.restoreFocus??!0)},restoreFocus:()=>{vt.current&&ro.current(Dt.current?.path??null)}},C=e?.contextMenu?.render?.(u.item,M)??null;return p?.setSlotContent(Yt,C),e?.contextMenu?.onOpen?.(u.item,M),Ai(C),queueMicrotask(()=>{C==null||!C.isConnected||document.activeElement===C&&Ai(C)}),()=>{p?.clearSlotContent(Yt)}},[uo,e?.contextMenu,p]),Ce(()=>{z!=null&&t.getItem(z.path)==null&&Pe()},[Pe,z,t]),Ce(()=>{if(z==null)return;const u=E.current?.getRootNode(),y=u instanceof ShadowRoot?u.host:E.current,M=k=>{const A=k.target;A instanceof Node&&(Pi(k)||w.current?.contains(A)!==!0&&y?.contains(A)!==!0&&Pe())},C=k=>{k.key==="Escape"&&(k.preventDefault(),k.stopPropagation(),Pe())};return document.addEventListener("mousedown",M,!0),document.addEventListener("keydown",C,!0),()=>{document.removeEventListener("mousedown",M,!0),document.removeEventListener("keydown",C,!0)}},[Pe,z]),Ce(()=>{const u=V.current,y=E.current;if(u==null||y==null){se.current=L;return}const M=L==null?null:Y.current.get(L)??null,C=kn(y),k=C?.dataset.itemPath??null,A=Jn&&S.current===C,K=c&&de.current===C,N=Se.current&&!Le,B=qe.current??0,$=un.current,q=Mt.current,X=Tt.current,ge=Nt.current,Ne=C!=null,le=j.current||Ne,F=se.current!==L,J=q!=null&&q===L&&L!=null;let ye=!1,In=!1;if(it!=null&&it.id!==ce.current){ce.current=it.id;const rr=it.visibleIndex,go=t.getVisibleRows(rr,rr)[0]??null;if(go!=null){const $l=g?Math.max(0,Math.min(go.ancestorPaths.length*l,Math.max(0,pe-l))):gt;ye=!0,In=Sh(u,rr,l,pe,st,it.offset,$l)}t.clearScrollRequest(it.id)}const xn=!ye&&N&&Wt(u,H,l,pe,st,B),Z=!ye&&$!=null&&$===L&&Wt(u,H,l,pe,st,gt),Fe=!ye&&X!=null&&X.path===L&&Wt(u,H,l,pe,st,X.viewportOffset),wn=!ye&&ge!=null&&ge.path===L&&u.scrollTop!==ge.scrollTop;if(wn&&(u.scrollTop=ge.scrollTop),(wn||In||Z||Fe||xn||le&&F&&$!==L&&!J&&ui(u,H,l,pe,gt))&&Q.current(),ye){se.current=L;return}if(!le){se.current=L;return}if(A){se.current=L;return}if(K&&!N){se.current=L;return}if(M==null){N&&H>=0&&(Wt(u,H,l,pe,st,B),Q.current()),se.current=L;return}(F||N||$===L||q===L||X?.path===L||ge?.path===L||k==null||k!==L)&&(It(M),$===L&&(un.current=null),q===L&&(Mt.current=null),X?.path===L&&(Tt.current=null),ge?.path===L&&(Nt.current=null),Se.current=!1,qe.current=null),se.current=L},[t,H,L,Zn,l,Jn,Le,Te,pe,c,it,g,gt,st,hn]);const bl=H>=0&&H>=he.visible.startIndex&&H<=he.visible.endIndex,Il=L!=null&&Ft.some(u=>xt(u.row)===L),xl=bl||Il,wl=pt&&j.current===!0&&xl?L:null,Sl=Ws==="pointer"?Wn:null,lt=z?.path??Wr.current??Sl??wl??Wn,ho=z?.source==="right-click";Ce(()=>{b.current&&z==null||Bt(At(lt))},[z,At,Te,pe,Gs,Ft,lt,Bt,hn]);const Cl=ve(u=>{if(b.current||Pi(u))return;const y=u.target;if(!(y instanceof HTMLElement)||y.closest?.('[data-type="context-menu-trigger"]')!=null)return;const M=y.closest?.('[data-file-tree-sticky-row="true"]'),C=y.closest?.('[data-type="item"]'),k=M instanceof HTMLElement?M.dataset.fileTreeStickyPath??null:C instanceof HTMLElement?C.dataset.itemPath??null:null;k!=null&&ot(A=>A==="pointer"?A:"pointer"),cn(A=>A===k?A:k)},[]),_l=ve(()=>{cn(null)},[]);Ce(()=>{if(!Ue)return;const u=()=>{Ht(),t.cancelDrag()};return window.addEventListener("dragend",u),()=>{window.removeEventListener("dragend",u),Ht(),t.cancelDrag()}},[t,Ue]);const kl=u=>{if(!Ue||t.getDragSession()==null||Ve.current)return;const y=Ci(u.target instanceof HTMLElement?u.target:null);t.setDragTarget(y),tr(t.getDragSession()?.target??null),ao(u.clientX,u.clientY),u.dataTransfer!=null&&(u.dataTransfer.dropEffect="move"),u.preventDefault()},Pl=u=>{if(!Ue||t.getDragSession()==null||Ve.current)return;const y=u.relatedTarget;y instanceof Node&&E.current?.contains(y)===!0||(Ge(),zt(),t.setDragTarget(null))},El=u=>{!Ue||t.getDragSession()==null||Ve.current||(u.preventDefault(),vn(u.clientX,u.clientY),t.completeDrag(),gn(),Ge(),zt(),Ke.current=null)},qt=he.window.height,Dl=he.window.offsetTop,Ml=Math.min(0,pe-qt),Tl=Math.min(0,pe-qt-gt),Nl=Kr===L||Se.current,yt=L!=null&&Nl&&!Zn&&H>=0?hn[H]??t.getVisibleRows(H,H)[0]??null:null,fo=yt==null?null:di(H,l,Te,qt),Ye=Ke.current,Al=Lt!=null&&Ye!=null&&Ye.path===Lt&&Ye.index>=Te.start&&Ye.index<=Te.end,Ot=Lt!=null&&Ye!=null&&Ye.path===Lt&&!Al&&Ye.path!==yt?.path?Ye:null,po=Ot==null?null:di(Ot.index,l,Te,qt),Rl=Hh((H>=0?hn[H]??t.getVisibleRows(H,H)[0]??null:null)?.ancestorPaths.at(-1)??null),Vl=Le&&L!=null?Us(s,L,!Zn):void 0,Ll=z?.path??(Le?L:Kr),Fl=z?.path??Wn,jt=At(lt),nr=xe&&pt&&!ho&&!Jn&&jt!=null&&Gn!=null&<!=null,Bl=xe&&(nr||z!=null),yn=z?.anchorRect,mo=yn==null&&jt!=null&&Gn!=null&&(z!=null||nr)?Gn:null,zl=yn!=null?{left:`${yn.left}px`,position:"fixed",right:"auto",top:`${yn.top}px`}:mo!=null?{top:`${mo}px`}:void 0,Hl=ho?{opacity:"0"}:void 0,ql=ve((u,y,M,C)=>{const k=Ph({event:{ctrlKey:u.ctrlKey,metaKey:u.metaKey,shiftKey:u.shiftKey},isDirectory:y.kind==="directory",isSearchOpen:Le,mode:C}),A=k.toggleDirectory&&y.kind==="directory",K=A?t.resolveMountedDirectoryPathFromInput(M):null;if(A&&K==null)return;const N=K??M;switch(k.selection.kind){case"range":t.selectPathRange(N,k.selection.additive);break;case"toggle":t.togglePathSelectionFromInput(N);break;case"single":t.selectOnlyMountedPathFromInput(N);break}const B=u.currentTarget instanceof HTMLElement?u.currentTarget:null,$=y.index>=he.visible.startIndex&&y.index<=he.visible.endIndex,q=C==="flow"&&$&&B!=null&&B.dataset.itemParked!=="true";t.focusMountedPathFromInput(N),q&&(j.current=!0,We(X=>X===N?X:N),ot("focus")),A&&t.toggleMountedDirectoryFromInput(N),k.closeSearch&&t.closeSearch(),k.revealCanonical&&mn(N,{targetOffset:"sticky-parents"})},[t,Le,he.visible.endIndex,he.visible.startIndex,mn]),Ol=()=>{if(b.current||!pt||lt==null||jt==null)return;const u=t.getItem(lt);u!=null&&(Bt(jt),vt.current=!0,Yn({anchorRect:null,item:{kind:u.isDirectory()?"directory":"file",name:jt.getAttribute("aria-label")??lt,path:u.getPath()},path:u.getPath(),source:"button"}))},bn={contextHoverPath:Fl,contextMenuButtonTriggerEnabled:pt,contextMenuButtonVisibility:Qr,contextMenuEnabled:xe,contextMenuRightClickEnabled:rl,contextMenuTriggerMode:ft,controller:t,directoriesWithGitChanges:o,dragAndDropEnabled:Ue,draggedPathSet:al,dragTarget:cl,gitLaneActive:Jr,gitStatusByPath:n,handleRowDragEnd:vl,handleRowDragStart:gl,handleRowTouchStart:yl,ignoredGitDirectories:r,ignoredInheritanceCache:an,instanceId:s,itemHeight:l,onKeyDown:co,onRowClick:ql,openContextMenuForRow:oo,registerButton:ol,registerRenameInput:sl,renameView:Rt,renderDecorationForRow:hl,resolveIcon:Zr,shouldSuppressContextMenu:pl,visualFocusPath:Ll},jl={...bn,registerButton:il};return _("div",{ref:E,id:eo,"data-file-tree-context-menu-button-visibility":xe&&pt?Qr:void 0,"data-file-tree-context-menu-trigger-mode":xe?ft:void 0,"data-file-tree-has-context-menu-action-lane":xe&&pt?"true":void 0,"data-file-tree-has-git-lane":Jr?"true":void 0,"data-file-tree-virtualized-root":"true",onDragLeave:Ue?Pl:void 0,onDragOver:Ue?kl:void 0,onDrop:Ue?El:void 0,onKeyDown:co,onPointerLeave:xe?_l:void 0,onPointerOver:xe?Cl:void 0,role:"tree",tabIndex:-1,style:{outline:"none",position:"relative"},children:[_("style",{"data-file-tree-guide-style":"true",dangerouslySetInnerHTML:{__html:Rl}}),_("slot",{name:Vn,"data-type":"header-slot"}),c?_("div",{"data-file-tree-search-container":!0,"data-open":Le?"true":"false",children:_("input",{ref:de,"aria-activedescendant":Vl,"aria-controls":eo,placeholder:"Search…","data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Js?"true":void 0,value:ll,onBlur:()=>{f==="retain"&&!Xr.current||t.closeSearch()},onFocus:Qn,onPointerDown:Qn,onInput:u=>{Qn();const y=u.currentTarget;t.setSearch(y.value)}})}):null,_("div",{ref:V,"data-file-tree-virtualized-scroll":"true",children:[g&&tl&&Ft.length>0?_("div",{"aria-hidden":"true","data-file-tree-sticky-overlay":"true",children:_("div",{"data-file-tree-sticky-overlay-content":"true",style:{height:`${ul}px`},children:Ft.map((u,y)=>Rn(jl,u.row,`sticky:${xt(u.row)}`,{mode:"sticky",style:{left:"0",position:"absolute",right:"0",top:`${u.top}px`,zIndex:`${Ft.length-y}`}}))})}):null,_("div",{ref:I,"data-file-tree-virtualized-list":"true",style:{height:`${st}px`},children:[_("div",{"data-file-tree-virtualized-sticky-offset":"true","aria-hidden":"true",style:{height:`${Dl}px`}}),_("div",{"data-file-tree-virtualized-sticky":"true",style:{height:`${qt}px`,top:`${Ml}px`,bottom:`${Tl}px`},children:[Qh(bn,Te,fn),yt!=null&&fo!=null?Rn(bn,yt,`parked:${yt.path}`,{isParked:!0,style:{left:"0",opacity:"0",pointerEvents:Lt===yt.path?"none":void 0,position:"absolute",right:"0",top:`${fo}px`}}):null,Ot!=null&&po!=null?Rn(bn,Ot,`parked-drag:${Ot.path}`,{isParked:!0,style:{left:"0",opacity:"0",pointerEvents:"none",position:"absolute",right:"0",top:`${po}px`}}):null]})]})]}),xe?_("div",{ref:w,"data-type":"context-menu-anchor","data-visible":Bl?"true":"false",style:zl,children:[_("button",{ref:x,type:"button","data-type":na,"aria-label":"Options","aria-haspopup":"menu","aria-expanded":z!=null?"true":"false","data-visible":nr?"true":"false",onMouseDown:u=>{u.preventDefault()},onClick:u=>{if(u.preventDefault(),u.stopPropagation(),z!=null){Pe();return}Ol()},tabIndex:-1,style:Hl,children:_(Zt,{...Zr("file-tree-icon-ellipsis")})}),z!=null?_("slot",{name:Yt}):null]}):null,z!=null?_("div",{"data-type":"context-menu-wash","aria-hidden":"true",onMouseDownCapture:u=>{u.preventDefault(),Pe()},onTouchStartCapture:u=>{u.preventDefault(),u.stopPropagation(),Pe()},onTouchMoveCapture:u=>{u.preventDefault(),u.stopPropagation()},onWheelCapture:u=>{u.preventDefault(),u.stopPropagation()}}):null]})}const Ur={hydrateRoot:(e,t)=>{Yd(xr(Ri,t),e)},renderRoot:(e,t)=>{Sr(xr(Ri,t),e)},unmountRoot:e=>{Sr(null,e)}};function Gt(e,t){Ur.renderRoot(e,t)}function Jh(e,t){Ur.hydrateRoot(e,t)}function Zh(e){Ur.unmountRoot(e)}var ef=class{#e=new Map;#t=null;clearAll(){for(const e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){const t=this.#c(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#l(e);for(const[t,n]of this.#e)this.#u(t,n)}}setSlotContent(e,t){const n=this.#c(e);if(n===t){t!=null&&(this.#e.set(e,t),this.#u(e,t));return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#u(e,t)}setSlotHtml(e,t){const n=t?.trim()??"";if(n.length===0){this.setSlotContent(e,null);return}const r=this.#c(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#u(e,r);return}const o=document.createElement("div");o.innerHTML=n,this.setSlotContent(e,o)}#c(e){const t=this.#e.get(e)??null;if(t!=null)return t;const n=this.#t;if(n==null)return null;for(const r of Array.from(n.children))if(r instanceof HTMLElement&&r.dataset.fileTreeManagedSlot===e)return r;return null}#u(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#l(e){for(const t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;const n=t.dataset.fileTreeManagedSlot;n==null||this.#e.has(n)||this.#e.set(n,t)}}};let Vi=0;function tf(e){return e!=null&&e.length>0?e:(Vi+=1,`pst_ft_${Vi}`)}function nf({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??qi)}function Li(e){if(typeof document>"u")return;const t=document.createElement("div");t.innerHTML=e;const n=t.querySelector("svg");return n instanceof SVGElement?n:void 0}function Fi(e){return e.querySelector("#file-tree-icon-chevron")instanceof SVGElement&&e.querySelector("#file-tree-icon-file")instanceof SVGElement&&e.querySelector("#file-tree-icon-dot")instanceof SVGElement&&e.querySelector("#file-tree-icon-lock")instanceof SVGElement}function Bi(e){return Array.from(e.children).filter(t=>t instanceof SVGElement)}var rf=class{static LoadedCustomComponent=!0;#e;#t;#c;#u;#l;#z;#H;#v;#r;#y=new ef;#E;#b;#m;#h;#I;#x;#f;#q;#O;#R=null;#o;#j=!1;#$=!1;constructor(e){const{composition:t,density:n,fileTreeSearchMode:r,gitStatus:o,id:i,initialSearchQuery:s,icons:l,itemHeight:a,onSearchChange:d,onSelectionChange:h,overscan:f,renderRowDecoration:c,renaming:m,search:p,searchBlurBehavior:g,searchFakeFocus:v,stickyFolders:w,unsafeCSS:x,initialVisibleRowCount:b,...I}=e;this.#e=t,this.#c=tf(i),this.#h=ei(o),this.#I=l,this.#x=x,this.#u=h,this.#l=c,this.#z=m!=null&&m!==!1,this.#H=g,this.#v=p===!0,this.#r=v===!0,this.#E=yc(n,a),this.#b={itemHeight:this.#E.itemHeight,overscan:f,stickyFolders:w,initialVisibleRowCount:b},this.#t=new Td({...I,fileTreeSearchMode:r,initialSearchQuery:s,onSearchChange:d,renaming:m}),this.#O=this.#t.getSelectionVersion(),this.#R=this.#u==null?null:this.subscribe(()=>{this.#M()})}unmount(){this.#o!=null&&(Zh(this.#o),delete this.#o.dataset.fileTreeVirtualizedWrapper,this.#o=void 0),this.#y.clearAll(),this.#y.setHost(null),this.#m!=null&&(delete this.#m.dataset.fileTreeVirtualized,this.#L(this.#m),this.#m=void 0)}cleanUp(){this.unmount(),this.#R?.(),this.#R=null,this.#t.destroy()}getFileTreeContainer(){return this.#m}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getFocusedIndex(){return this.#t.getFocusedIndex()}getVisibleCount(){return this.#t.getVisibleCount()}getVisibleRows(e,t){return this.#t.getVisibleRows(e,t)}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#E.itemHeight}getDensityFactor(){return this.#E.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}focusFirstItem(){this.#t.focusFirstItem()}focusLastItem(){this.#t.focusLastItem()}focusNextItem(){this.#t.focusNextItem()}focusPreviousItem(){this.#t.focusPreviousItem()}focusParentItem(){this.#t.focusParentItem()}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}applyGitStatusPatch(e){const t=Vd(this.#h,e);if(t===this.#h)return;this.#h=t;const n=this.#s();n!=null&&Gt(n.wrapper,this.#D())}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){Array.isArray(e)?this.#t.resetPaths(e,t):this.#t.resetPaths(e)}setComposition(e){this.#e=e;const t=this.#s();t!=null&&(this.#_(),Gt(t.wrapper,this.#D()))}setGitStatus(e){const t=ei(e,this.#h);if(t===this.#h)return;this.#h=t;const n=this.#s();n!=null&&Gt(n.wrapper,this.#D())}setIcons(e){this.#I=e;const t=this.#s();t!=null&&(this.#g(t.host,t.wrapper),Gt(t.wrapper,this.#D()))}hydrate({fileTreeContainer:e}){const t=this.#N(e),n=this.#V(t);this.#_(),Jh(n,this.#D())}render({containerWrapper:e,fileTreeContainer:t}){const n=this.#N(t??this.#m,e),r=this.#V(n);this.#_(),Gt(r,this.#D())}#J(){return{initialViewportHeight:nf({initialVisibleRowCount:this.#b.initialVisibleRowCount,itemHeight:this.#b.itemHeight}),itemHeight:this.#b.itemHeight,overscan:this.#b.overscan,stickyFolders:this.#b.stickyFolders}}#D(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#h?.statusByPath,ignoredGitDirectories:this.#h?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#h?.directoriesWithChanges,icons:this.#I,instanceId:this.#c,renamingEnabled:this.#z,renderRowDecoration:this.#l,searchBlurBehavior:this.#H,searchEnabled:this.#v,searchFakeFocus:this.#r,slotHost:this.#y,...this.#J()}}#s(){const e=this.#m,t=this.#o;return e==null||t==null?null:{host:e,wrapper:t}}#g(e,t){const n=e.shadowRoot;n!=null&&(this.#U(n),this.#K(n)),this.#W(t)}#M(){const e=this.#u;if(e==null)return;const t=this.#t.getSelectionVersion();t!==this.#O&&(this.#O=t,e(this.#t.getSelectedPaths()))}#_(){const e=this.#e?.header?.render;if(e!=null){this.#y.setSlotContent(Vn,e());return}this.#y.setSlotHtml(Vn,this.#e?.header?.html??null)}#U(e){const t=Bi(e).find(r=>Fi(r)),n=Li(fc(Pn(this.#I).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t!=null?t.replaceWith(n):e.prepend(n)))}#K(e){const t=Bi(e),n=t.find(s=>Fi(s)),r=t.filter(s=>s!==n),o=Pn(this.#I).spriteSheet?.trim()??"";if(o.length===0){for(const s of r)s.remove();return}const i=Li(o);if(i==null){for(const s of r)s.remove();return}if(!(r.length===1&&r[0].outerHTML===i.outerHTML)){for(const s of r)s.remove();e.appendChild(i)}}#W(e){const t=Pn(this.#I);t.colored&&mc(t.set)?e.dataset.fileTreeColoredIcons="true":delete e.dataset.fileTreeColoredIcons}#a(e){const t=e.querySelector(`style[${yo}]`);if(this.#f==null&&t instanceof HTMLStyleElement&&(this.#f=t),this.#x==null||this.#x===""){this.#f?.remove(),this.#f=void 0,this.#q=void 0;return}this.#f?.parentNode===e&&this.#q===this.#x||(this.#f??=document.createElement("style"),this.#f.setAttribute(yo,""),this.#f.parentNode!==e&&e.appendChild(this.#f),this.#f.textContent=bc(this.#x),this.#q=this.#x)}#V(e){if(this.#o!=null)return this.#o;const t=e.shadowRoot;if(t==null)throw new Error("FileTree requires a shadow root");const n=Array.from(t.children).filter(o=>o instanceof HTMLDivElement&&typeof o.dataset.fileTreeId=="string"&&o.dataset.fileTreeId.length>0),r=n.find(o=>o.dataset.fileTreeId===this.#c)??n[0];return r!=null&&(this.#c=r.dataset.fileTreeId??this.#c),this.#o=r??document.createElement("div"),this.#o.dataset.fileTreeId=this.#c,this.#o.dataset.fileTreeVirtualizedWrapper="true",this.#g(e,this.#o),this.#o.parentNode!==t&&t.appendChild(this.#o),this.#o}#N(e,t){const n=e??this.#m??document.createElement("file-tree-container");t!=null&&n.parentNode!==t&&t.appendChild(n);const r=n.shadowRoot??n.attachShadow({mode:"open"});return dr(n,r),this.#a(r),n.dataset.fileTreeVirtualized="true",n.style.display="flex",this.#C(n),this.#y.setHost(n),this.#m=n,n}#C(e){e.style.getPropertyValue("--trees-item-height")===""&&(e.style.setProperty("--trees-item-height",`${String(this.#E.itemHeight)}px`),this.#j=!0),e.style.getPropertyValue("--trees-density-override")===""&&(e.style.setProperty("--trees-density-override",String(this.#E.factor)),this.#$=!0)}#L(e){this.#j&&(e.style.removeProperty("--trees-item-height"),this.#j=!1),this.#$&&(e.style.removeProperty("--trees-density-override"),this.#$=!1)}};function of(e){const[t]=U.useState(()=>new rf(e)),n=U.useRef({timeout:null,model:t});return U.useEffect(()=>{const{current:r}=n;return r.timeout!=null&&(clearTimeout(r.timeout),r.timeout=null),()=>{r.timeout=setTimeout(()=>r.model.cleanUp(),1)}},[]),{model:t}}function sf(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(!Object.is(e[n],t[n]))return!1;return!0}function lf(e,t,n){return Object.is(e,t)||n?.(e,t)===!0}function af(e,t,n){const r=U.useRef({hasValue:!1,model:null,selector:null,value:void 0}),o=U.useCallback(s=>e.subscribe(s),[e]),i=U.useCallback(()=>{const s=r.current,l=t(e);if(s.model!==e||s.selector!==t||!s.hasValue)return s.hasValue=!0,s.model=e,s.selector=t,s.value=l,l;const a=s.value;return lf(a,l,n)?a:(s.value=l,l)},[n,e,t]);return U.useSyncExternalStore(o,i,i)}function cf(e,t){return e.isOpen===t.isOpen&&e.value===t.value&&sf(e.matchingPaths,t.matchingPaths)}function uf(e){const t=af(e,n=>({isOpen:n.isSearchOpen(),matchingPaths:n.getSearchMatchingPaths(),value:n.getSearchValue()}),cf);return U.useMemo(()=>({...t,close:()=>{e.closeSearch()},focusNextMatch:()=>{e.focusNextSearchMatch()},focusPreviousMatch:()=>{e.focusPreviousSearchMatch()},open:n=>{e.openSearch(n)},setValue:n=>{e.setSearch(n)}}),[e,t])}const df=`
|
|
1269
1269
|
:host {
|
|
1270
1270
|
--trees-bg-override: transparent;
|
|
1271
1271
|
--trees-selected-bg-override: color-mix(in srgb, currentColor 12%, transparent);
|
|
@@ -1275,4 +1275,4 @@ import{r as U,j as ee,c as Ul}from"./index-_gYIQM_z.js";import{b as Kl,u as Wl,I
|
|
|
1275
1275
|
--trees-font-size-override: 12px;
|
|
1276
1276
|
}
|
|
1277
1277
|
button[data-type='item'] { border-radius: 5px; }
|
|
1278
|
-
`;function hf(e,t,n){const r=document.createElement("div");r.setAttribute("role","menu"),r.className="bg-popover text-popover-foreground min-w-36 rounded-lg border border-border p-1 shadow-md";for(const o of t){const i=document.createElement("button");i.type="button",i.setAttribute("role","menuitem"),i.className="hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:text-accent-foreground flex w-full items-center rounded-md px-2 py-1.5 text-start text-xs outline-none",i.textContent=o.label,i.addEventListener("click",()=>{n(),o.run(e)}),r.appendChild(i)}return r}function ff(e){return e.kind==="dir"?`${e.path}/`:e.path}function gf({client:e,workspaceId:t,workspaceName:n,selectedPath:r,onOpenFile:o,fileActions:i}){const s=Kl(),l=U.useRef(s);l.current=s;const a=Wl({queryKey:["workspace-file-tree",t],queryFn:()=>e.listWorkspaceFiles(t),staleTime:3e4,refetchOnWindowFocus:!1}),d=a.data?.items??[],h=U.useMemo(()=>new Map(d.map(v=>[v.path,v])),[d]),f=U.useRef(h);f.current=h;const c=U.useRef(i);c.current=i;const m=U.useMemo(()=>d.map(ff),[d]),{model:p}=of({composition:{contextMenu:{triggerMode:"both",buttonVisibility:"when-needed",onOpen:(v,w)=>{const x=l.current;if(!x||(w.close(),v.kind!=="file"))return;const b=f.current.get(v.path.replace(/\/$/,"")),I=c.current??[];!b||b.kind!=="file"||I.length===0||x(I.map(S=>({type:"item",id:S.id,label:S.label,onSelect:()=>S.run(b)})),{point:{x:w.anchorRect.left,y:w.anchorRect.bottom}})},render:(v,w)=>{if(l.current||v.kind!=="file")return null;const x=f.current.get(v.path.replace(/\/$/,"")),b=c.current??[];return!x||x.kind!=="file"||b.length===0?null:hf(x,b,()=>w.close())}}},density:"compact",fileTreeSearchMode:"hide-non-matches",flattenEmptyDirectories:!0,initialExpansion:1,onSelectionChange:v=>{const w=v.at(-1)?.replace(/\/$/,""),x=w?f.current.get(w):void 0;x?.kind==="file"&&o(x)},paths:[],search:!1,unsafeCSS:df}),g=uf(p);return U.useEffect(()=>p.resetPaths(m),[p,m]),U.useEffect(()=>{const v=p.getItem(r);if(v){for(const w of p.getSelectedPaths())p.getItem(w)?.deselect();v.select()}},[p,m,r]),
|
|
1278
|
+
`;function hf(e,t,n){const r=document.createElement("div");r.setAttribute("role","menu"),r.className="bg-popover text-popover-foreground min-w-36 rounded-lg border border-border p-1 shadow-md";for(const o of t){const i=document.createElement("button");i.type="button",i.setAttribute("role","menuitem"),i.className="hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:text-accent-foreground flex w-full items-center rounded-md px-2 py-1.5 text-start text-xs outline-none",i.textContent=o.label,i.addEventListener("click",()=>{n(),o.run(e)}),r.appendChild(i)}return r}function ff(e){return e.kind==="dir"?`${e.path}/`:e.path}function gf({client:e,workspaceId:t,workspaceName:n,selectedPath:r,onOpenFile:o,fileActions:i}){const s=Kl(),l=U.useRef(s);l.current=s;const a=Wl({queryKey:["workspace-file-tree",t],queryFn:()=>e.listWorkspaceFiles(t),staleTime:3e4,refetchOnWindowFocus:!1}),d=a.data?.items??[],h=U.useMemo(()=>new Map(d.map(v=>[v.path,v])),[d]),f=U.useRef(h);f.current=h;const c=U.useRef(i);c.current=i;const m=U.useMemo(()=>d.map(ff),[d]),{model:p}=of({composition:{contextMenu:{triggerMode:"both",buttonVisibility:"when-needed",onOpen:(v,w)=>{const x=l.current;if(!x||(w.close(),v.kind!=="file"))return;const b=f.current.get(v.path.replace(/\/$/,"")),I=c.current??[];!b||b.kind!=="file"||I.length===0||x(I.map(S=>({type:"item",id:S.id,label:S.label,onSelect:()=>S.run(b)})),{point:{x:w.anchorRect.left,y:w.anchorRect.bottom}})},render:(v,w)=>{if(l.current||v.kind!=="file")return null;const x=f.current.get(v.path.replace(/\/$/,"")),b=c.current??[];return!x||x.kind!=="file"||b.length===0?null:hf(x,b,()=>w.close())}}},density:"compact",fileTreeSearchMode:"hide-non-matches",flattenEmptyDirectories:!0,initialExpansion:1,onSelectionChange:v=>{const w=v.at(-1)?.replace(/\/$/,""),x=w?f.current.get(w):void 0;x?.kind==="file"&&o(x)},paths:[],search:!1,unsafeCSS:df}),g=uf(p);return U.useEffect(()=>p.resetPaths(m),[p,m]),U.useEffect(()=>{const v=p.getItem(r);if(v){for(const w of p.getSelectedPaths())p.getItem(w)?.deselect();v.select()}},[p,m,r]),oe.jsxs("aside",{className:"flex h-full min-h-0 w-40 shrink-0 flex-col border-r border-border bg-muted/20","data-workspace-file-tree":!0,"data-workspace-file-count":d.length,children:[oe.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border px-1.5",children:[oe.jsxs(Gl,{className:"h-7 min-w-0 flex-1 bg-background",children:[oe.jsx(Yl,{align:"inline-start",children:oe.jsx(Xl,{})}),oe.jsx(Ql,{"aria-label":`Search ${n} files`,placeholder:"Search files",value:g.value,onChange:v=>{const w=v.target.value;w.trim()?g.setValue(w):g.close()}})]}),oe.jsx(Jl,{variant:"ghost",size:"icon-xs","aria-label":"Refresh workspace files",onClick:()=>void a.refetch(),children:oe.jsx(Zl,{className:Ul(a.isFetching&&"animate-spin")})})]}),a.isError?oe.jsx("p",{role:"alert",className:"p-3 text-xs text-dls-secondary",children:"Could not load workspace files. Use Refresh to try again."}):oe.jsx(la,{model:p,"aria-label":`${n} files`,className:"min-h-0 flex-1 overflow-hidden",style:{"--trees-fg-override":"var(--foreground)"}}),a.data?.incomplete?oe.jsx("p",{role:"status",className:"border-t border-border px-2 py-1 text-[10px] text-muted-foreground",children:"Some folders could not be read. Check their permissions and refresh."}):null]})}export{gf as WorkspaceFileTree};
|