@p4code/cli 0.0.46 → 0.0.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist/bin.mjs +1 -1
  2. package/dist/client/assets/{DiffPanel-oKTj1djF.js → DiffPanel-ChInQIhf.js} +3 -3
  3. package/dist/client/assets/{FilePreviewPanel-CuP4WCgv.js → FilePreviewPanel-CjUtAiI6.js} +5 -5
  4. package/dist/client/assets/PreviewPanel-CXa85HZu.js +2 -0
  5. package/dist/client/assets/{angular-html-BwUZQlj7.js → angular-html-CvITUhcj.js} +2 -2
  6. package/dist/client/assets/{angular-ts-8EX8ZNeQ.js → angular-ts-CI8oh2Bi.js} +2 -2
  7. package/dist/client/assets/{apl-DYm7AarA.js → apl-BewkNmrv.js} +2 -2
  8. package/dist/client/assets/arrow-right-BG7cUHWK.js +2 -0
  9. package/dist/client/assets/{astro-DFaFMvm9.js → astro-CNN681lo.js} +2 -2
  10. package/dist/client/assets/{blade-D9aigeeZ.js → blade-X4RszKFf.js} +2 -2
  11. package/dist/client/assets/{c-BvAsa11Y.js → c-C8AJe2jK.js} +2 -2
  12. package/dist/client/assets/{cobol-BZwY3--F.js → cobol-DQjALrRk.js} +2 -2
  13. package/dist/client/assets/{coffee-vNqcHwuy.js → coffee-uHbL69mO.js} +2 -2
  14. package/dist/client/assets/{cpp-D3Xet0_6.js → cpp-D3rb3O4A.js} +2 -2
  15. package/dist/client/assets/{crystal-D-UW0VhN.js → crystal-spyqFjYj.js} +2 -2
  16. package/dist/client/assets/{css-B1CDNsy0.js → css-CbxXkRaq.js} +2 -2
  17. package/dist/client/assets/{edge-B_geUcoi.js → edge-YESgrh6X.js} +2 -2
  18. package/dist/client/assets/{elixir-BzK0Ks1B.js → elixir-7069ioPL.js} +2 -2
  19. package/dist/client/assets/{elm-BvlMiaGz.js → elm-Eb4zNBLt.js} +2 -2
  20. package/dist/client/assets/{erb-OFCHFHP8.js → erb-Ddb27xlO.js} +2 -2
  21. package/dist/client/assets/{fileCommentAnnotations-KGEG7lCT.js → fileCommentAnnotations-dnvCAKlJ.js} +2 -2
  22. package/dist/client/assets/{git-rebase-Xc_wijNW.js → git-rebase-CdERns2w.js} +2 -2
  23. package/dist/client/assets/{glimmer-js-D-GpFszK.js → glimmer-js-C6s5Isxr.js} +2 -2
  24. package/dist/client/assets/{glimmer-ts-_MmK7qB5.js → glimmer-ts-BV7NBmEc.js} +2 -2
  25. package/dist/client/assets/{glsl-Cm_ctoze.js → glsl-jd9QEV4q.js} +2 -2
  26. package/dist/client/assets/{graphql-De_-LrEt.js → graphql-CXqIl6Zm.js} +2 -2
  27. package/dist/client/assets/{hack-qUzK29KK.js → hack-lLvPp6HR.js} +2 -2
  28. package/dist/client/assets/{haml-mqyUpOBj.js → haml-DfPUmRcz.js} +2 -2
  29. package/dist/client/assets/{handlebars-DS3jjsXS.js → handlebars-QzjSM_We.js} +2 -2
  30. package/dist/client/assets/{html-ippoHerj.js → html-BySpIsKh.js} +2 -2
  31. package/dist/client/assets/{html-derivative-BPRW_sHn.js → html-derivative-CkX2Wmz3.js} +2 -2
  32. package/dist/client/assets/{http-xrFfvFRg.js → http-CD7dw1li.js} +2 -2
  33. package/dist/client/assets/{hurl-DSL-wjHh.js → hurl-nzp7hSsy.js} +2 -2
  34. package/dist/client/assets/{index-Cxz8lImj.js → index-DjvMZjfP.js} +200 -197
  35. package/dist/client/assets/{java-B8xLHoVB.js → java-D2TcotRb.js} +2 -2
  36. package/dist/client/assets/{javascript-DkxetjtW.js → javascript-CpW0WD7L.js} +2 -2
  37. package/dist/client/assets/{jinja-DrlmZXOI.js → jinja-BL1anCEN.js} +2 -2
  38. package/dist/client/assets/{jison-CBYMCWiZ.js → jison-B-sCtmJb.js} +2 -2
  39. package/dist/client/assets/{json-aobk_LSd.js → json-BXeO84aE.js} +2 -2
  40. package/dist/client/assets/{jsx-BTcIKPoF.js → jsx-CgueyhKv.js} +2 -2
  41. package/dist/client/assets/{julia-BwUvFb1K.js → julia-PMog-fIJ.js} +2 -2
  42. package/dist/client/assets/{just-2GL8m28O.js → just-Bi73ZAuY.js} +2 -2
  43. package/dist/client/assets/{latex-BwWZNh8B.js → latex-D6Hw5PyK.js} +2 -2
  44. package/dist/client/assets/{liquid-j8UWR5fn.js → liquid-CuvsknsU.js} +2 -2
  45. package/dist/client/assets/{lua-BiEJazUk.js → lua-6tqLQzzk.js} +2 -2
  46. package/dist/client/assets/{marko-BrkuG9X9.js → marko-Bv1DHr8G.js} +2 -2
  47. package/dist/client/assets/{mdc-CbE9Gm1n.js → mdc-DIKkjN2a.js} +2 -2
  48. package/dist/client/assets/{nginx-C-gcDf_H.js → nginx-B2JFBlIu.js} +2 -2
  49. package/dist/client/assets/{nim-9X20IMJZ.js → nim-D8qC29Zr.js} +2 -2
  50. package/dist/client/assets/{perl-Dqj-SUzY.js → perl-De_VpaHg.js} +2 -2
  51. package/dist/client/assets/{php-CQymwCam.js → php-zSI5z7ZS.js} +2 -2
  52. package/dist/client/assets/{pug-DIOYJ7Tj.js → pug-rUGxU82h.js} +2 -2
  53. package/dist/client/assets/{qml-BpdlPbMh.js → qml-CXAY6cUl.js} +2 -2
  54. package/dist/client/assets/{r-BdXpML7C.js → r-Cm15VoHH.js} +2 -2
  55. package/dist/client/assets/{razor-CmGIbQUz.js → razor-DkcxdUAy.js} +2 -2
  56. package/dist/client/assets/{regexp-udR9FXf8.js → regexp-BOilP6p2.js} +2 -2
  57. package/dist/client/assets/{rst-C81pNvVo.js → rst-BfN2oPCh.js} +2 -2
  58. package/dist/client/assets/{ruby-D5xBAIVx.js → ruby-B1jLvIIs.js} +2 -2
  59. package/dist/client/assets/{sas-pegDgwhF.js → sas-CF03ALyS.js} +2 -2
  60. package/dist/client/assets/{scss-Dx_Aq9w8.js → scss-BrFzdYUJ.js} +2 -2
  61. package/dist/client/assets/{shellscript-Bl-HTaUh.js → shellscript-B_6ownRV.js} +2 -2
  62. package/dist/client/assets/{shellsession-CezqakSW.js → shellsession-D9grZ02W.js} +2 -2
  63. package/dist/client/assets/{soy-DclELXc7.js → soy-Ca44AVp-.js} +2 -2
  64. package/dist/client/assets/{sql-DAsY-zzx.js → sql-CkHELsvP.js} +2 -2
  65. package/dist/client/assets/{stata-DjQ16uuy.js → stata-C9ALGlol.js} +2 -2
  66. package/dist/client/assets/{surrealql-BLzgjzgE.js → surrealql-Cta1X2o7.js} +2 -2
  67. package/dist/client/assets/{svelte-DFGwC3eP.js → svelte-BogBuioE.js} +2 -2
  68. package/dist/client/assets/{templ-BiFbdCJD.js → templ-C4v7sOsC.js} +2 -2
  69. package/dist/client/assets/{tex-DQCF2PEO.js → tex-KXY3LBOg.js} +2 -2
  70. package/dist/client/assets/{textarea-lBMORu4g.js → textarea-DHdA8g53.js} +9 -9
  71. package/dist/client/assets/{ts-tags-CkQC6ekt.js → ts-tags-BUzdov0d.js} +2 -2
  72. package/dist/client/assets/{tsx-m7HWHXfL.js → tsx-DCEZNbvU.js} +2 -2
  73. package/dist/client/assets/{twig-B5P5jotH.js → twig-lX5bLK2U.js} +2 -2
  74. package/dist/client/assets/{typescript-DmGwuo7e.js → typescript-D0XyCzdv.js} +2 -2
  75. package/dist/client/assets/{vue-Rn_gU7Px.js → vue-BVUKhxXR.js} +2 -2
  76. package/dist/client/assets/{vue-html-DbKQF2OX.js → vue-html-BFZ9Hu9Q.js} +2 -2
  77. package/dist/client/assets/{vue-vine-C13tIrLE.js → vue-vine-DwK9p9S2.js} +2 -2
  78. package/dist/client/assets/{xml-D7fQm-eG.js → xml-BZnktucc.js} +2 -2
  79. package/dist/client/assets/{xsl-Bv743my_.js → xsl-BQvXVv3K.js} +2 -2
  80. package/dist/client/assets/{yaml--h7pPfkH.js → yaml-CjmvH72q.js} +2 -2
  81. package/dist/client/index.html +2 -2
  82. package/package.json +1 -1
  83. package/dist/client/assets/PreviewPanel-B5G_VRJZ.js +0 -2
  84. package/dist/client/assets/arrow-right-BNeeftk2.js +0 -2
@@ -1,4 +1,4 @@
1
- import{$t as e,C as t,E as n,Go as r,Ho as i,Jt as a,Kl as o,Pf as s,Pt as c,Ts as l,Uf as u,as as d,b as f,bs as p,g as m,is as h,lp as g,m as _,op as v,p as y,v as b}from"./textarea-lBMORu4g.js";import{a as x,c as S,i as C,n as ee,o as w,r as T,s as E,t as te}from"./fileCommentAnnotations-KGEG7lCT.js";import{C as ne,Cn as D,Ct as O,D as k,Dn as A,Dt as j,En as M,Fr as re,Gn as ie,H as ae,Hn as oe,Nr as se,Qn as ce,Qt as le,Rt as ue,S as de,Sn as fe,Sr as pe,Tn as me,Tr as N,Tt as he,U as ge,V as _e,W as ve,Wn as ye,X as be,b as xe,bn as Se,d as Ce,dr as we,f as Te,fr as Ee,jr as De,l as P,ln as Oe,lr as ke,m as Ae,mr as je,p as Me,pn as Ne,pr as Pe,qn as Fe,u as Ie,ur as Le,v as Re,vr as ze,w as Be,x as Ve,xn as He,y as Ue,yn as We,yr as Ge,z as Ke,zt as qe}from"./index-Cxz8lImj.js";var Je=r(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),Ye=r(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),Xe=`file-tree-container`,Ze=`data-file-tree-style`,Qe=`data-file-tree-unsafe-css`,$e=`data-file-tree-scrollbar-measure`,et=`data-file-tree-scrollbar-gutter-measured`,tt=`--trees-scrollbar-gutter-measured`,nt=`header`,rt=`context-menu`,it=`context-menu-trigger`,at=5,ot=1<<at,st=ot*4;function ct(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function lt(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function ut(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;let n=new Map;for(let r of t.childIds){let t=e[r];t!=null&&n.set(t.nameId,r)}return t.childIdByNameId=n,n}function dt(e){if(e.childPositionById!=null)return e.childPositionById;let t=new Map;for(let n=0;n<e.childIds.length;n++){let r=e.childIds[n];r!=null&&t.set(r,n)}return e.childPositionById=t,t}function ft(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function F(e,t){if(e.childPositionById!=null)for(let n=t;n<e.childIds.length;n++){let t=e.childIds[n];t!=null&&e.childPositionById.set(t,n)}}function I(e,t){let n=0,r=0;for(let i of t.childIds){let t=e[i];t!=null&&(n+=t.subtreeNodeCount,r+=t.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,gt(e,t)}function pt(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=dt(e).get(t);if(i===void 0)return;let a=i>>at;e.childVisibleChunkSums[a]+=r}function mt(e,t,n){let r=t.childVisibleChunkSums;if(r!=null){let i=n,a=0;for(let o of r){if(i<o){let r=_t(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=ot}throw Error(`Visible child index ${String(n)} is out of range`)}let i=n;for(let r=0;r<t.childIds.length;r++){let a=t.childIds[r];if(a==null)continue;let o=e[a];if(o!=null){if(i<o.visibleSubtreeCount)return{childIndex:r,childVisibleIndex:n-i,localVisibleIndex:i};i-=o.visibleSubtreeCount}}throw Error(`Visible child index ${String(n)} is out of range`)}function ht(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>at;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<at}for(let i=a;i<n;i+=1){let n=t.childIds[i];if(n==null)continue;let a=e[n];a!=null&&(r+=a.visibleSubtreeCount)}return r}function gt(e,t){if(t.childIds.length<st){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/ot),r=new Int32Array(n);for(let n=0;n<t.childIds.length;n++){let i=t.childIds[n];if(i==null)continue;let a=e[i];a!=null&&(r[n>>at]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function _t(e,t,n,r){let i=Math.min(t.childIds.length,n+ot),a=r;for(let r=n;r<i;r++){let n=t.childIds[r];if(n==null)continue;let i=e[n];if(i!=null){if(a<i.visibleSubtreeCount)return{childIndex:r,localVisibleIndex:a};a-=i.visibleSubtreeCount}}throw Error(`Visible child index ${String(r)} is out of range`)}var vt=7,yt=3,bt=1<<yt,xt=4;function L(e,t,n=0){return e<<xt|n<<yt|t}function St(e){return e.depthAndFlags>>>xt}function R(e){return(e.depthAndFlags&bt)>>yt}function z(e){return(e.depthAndFlags&bt)!==0}function Ct(e){return e.depthAndFlags&vt}function B(e,t){return(Ct(e)&t)!==0}function wt(e,t){e.depthAndFlags|=t}function Tt(e,t){e.depthAndFlags=L(t,Ct(e),R(e))}var Et=Symbol(`benchmarkInstrumentation`);function Dt(e,t){return t==null||Object.defineProperty(e,Et,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function Ot(e){return e==null?null:e[Et]??null}function V(e,t,n){return e==null?n():e.measurePhase(t,n)}function kt(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function At(e){return e>=48&&e<=57}function jt(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!At(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let i=0;for(;r<e.length&&At(e.charCodeAt(r));)i=i*10+(e.charCodeAt(r)-48),r+=1;t.push(i),n=r}return(n<e.length||t.length===0)&&t.push(e.slice(n)),t}function Mt(e){let t=e.toLowerCase();return{lowerValue:t,tokens:jt(t)}}function Nt(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===i)continue;if(typeof n==`number`&&typeof i==`number`)return n<i?-1:1;let a=String(n),o=String(i);if(a!==o)return a<o?-1:1}return e.length===t.length?0:e.length<t.length?-1:1}function Pt(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;let n=Nt(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function Ft(e,t,n){let r=Pt(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function It(e,t){return Ft(e,t,Mt)}function Lt(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function Rt(e,t){let n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let n=e.segments[r],i=t.segments[r];if(n===i)continue;let a=Lt(e,r);return a===Lt(t,r)?It(n,i):a===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function zt(e,t){return Rt(e,t)}function Bt(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=Mt(e);return n.set(e,r),r},i=Math.min(e.segments.length,t.segments.length);for(let n=0;n<i;n++){let i=e.segments[n],a=t.segments[n];if(i===a)continue;let o=Lt(e,n);return o===Lt(t,n)?Ft(i,a,r):o===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function Vt(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=Mt(r);return e.sortKeyById[t]=i,i}function Ht(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function Ut(e){let t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[],i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===47&&(r.push(e.slice(i,t)),i=t+1);return r.push(e.slice(i,n)),{hasTrailingSlash:t,segments:r}}function Wt(e){let{hasTrailingSlash:t,segments:n}=Ut(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function Gt(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=Ut(e);return{requiresDirectory:t,segments:n}}var Kt=``;function qt(){let e=new Map;return e.set(Kt,0),{idByValue:e,valueById:[Kt],sortKeyById:[Mt(Kt)]}}function Jt(e,t){let n=e.idByValue.get(t);if(n!==void 0)return n;let r=e.valueById.length;return e.idByValue.set(t,r),e.valueById.push(t),r}function Yt(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var Xt=Symbol(`pathStorePreparedInputKind`);function Zt(e,t){return e[Xt]=t,e}function Qt(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function $t(e,t,n){return n==="default"?zt(e,t):n(Qt(e),Qt(t))}function en(){return{depthAndFlags:L(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function tn(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return r;return n}function nn(e){return e.isDirectory?e.segments.length:e.segments.length-1}function rn(e){return Array.isArray(e)&&e.every(e=>typeof e==`object`&&!!e&&typeof e.path==`string`&&Array.isArray(e.segments)&&typeof e.basename==`string`&&typeof e.isDirectory==`boolean`)}function an(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function on(e,t={}){return fn(e,t).map(e=>e.path)}function sn(e,t={}){let n=fn(e,t);return Zt({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function cn(e){let t=e.length,n=!1;for(let r=0;r<t;r+=1){let t=e[r];if(t.length>0&&t.charCodeAt(t.length-1)===47){n=!0;break}}return Zt({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function ln(e){let t=e,n=t.preparedPaths;if(t[Xt]===`prepared`&&n!=null)return n;if(!rn(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function un(e){let t=e;return t[Xt]===`presorted`&&t.presortedPaths!=null||an(t.presortedPaths)?t.presortedPaths:null}function dn(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function fn(e,t={}){let n=Ht(t),r=Ot(t);kt(r,`workload.inputFiles`,e.length);let i=V(r,`store.preparePathEntries.parse`,()=>e.map(e=>Wt(e)));return V(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>$t(e,t,n.sort))),i}var pn=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[en()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=qt();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=Ot(e),this.options=Ht(e);let t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{let e=new Set,n=t.length;for(let r=0;r<n;r+=1){let n=t[r],i=n.length;e.add(i>0&&n.charCodeAt(i-1)===47?n.slice(0,i-1):n)}this.initialExpandedPathSet=e,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,ct())}appendPaths(e){return V(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>Wt(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,V(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return V(this.instrumentation,`store.builder.appendPresortedPaths`,()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0,i=this.nodes,a=this.segmentTable,o=a.idByValue,s=a.valueById,c=this.directoryStack,l=0,u=``,d=0;for(let t of e){if(n===t)throw Error(`Duplicate path: "${t}"`);let e=t.length>0&&t.charCodeAt(t.length-1)===47,a=e?t.length-1:t.length,f=0,p=0;if(n!=null)if(u.length>0&&t.length>u.length&&t.startsWith(u))f=d,p=u.length;else{let r=Math.min(a,n.length),i=!0;for(let e=0;e<r;e++){let r=t.charCodeAt(e);if(r!==n.charCodeAt(e)){i=!1;break}r===47&&(f++,p=e+1)}i&&e&&r===a&&n.length>a&&n.charCodeAt(a)===47&&(f++,p=a+1)}l=f,r=f;let m=p,h=t.indexOf(`/`,m);for(;h>=0&&h<a;){let e=c[l];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);r++;let n=t.slice(m,h),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n));let u=i.length;i.push({depthAndFlags:L(r,0,1),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(t.slice(0,h)),l++,c[l]=u,m=h+1,h=t.indexOf(`/`,m)}if(e){if(m<a){let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory parent for "${t}"`);r++;let n=t.slice(m,a),u=o.get(n);u===void 0&&(u=s.length,o.set(n,u),s.push(n));let d=i.length;i.push({depthAndFlags:L(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d}let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{let e=c[l];if(e===void 0)throw Error(`Unable to resolve file parent for "${t}"`);let n=t.slice(m),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n)),i.push({depthAndFlags:L(r+1,0),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1})}m!==u.length&&(u=t.substring(0,m),d=r),n=t}c.length=l+1,n!=null&&(this.lastPreparedPath=Wt(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0,r=this.nodes,i=this.segmentTable,a=i.idByValue,o=i.valueById,s=this.directoryStack,c=0,l=``,u=0;for(let i of e){if(t===i)throw Error(`Duplicate path: "${i}"`);let e=i.length,d=0,f=0;if(t!=null)if(l.length>0&&i.length>l.length&&i.startsWith(l))d=u,f=l.length;else{let n=Math.min(e,t.length);for(let e=0;e<n;e++){let n=i.charCodeAt(e);if(n!==t.charCodeAt(e))break;n===47&&(d++,f=e+1)}}c=d,n=d;let p=f,m=i.indexOf(`/`,p);for(;m>=0;){let e=s[c];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);n++;let t=i.slice(p,m),l=a.get(t);l===void 0&&(l=o.length,a.set(t,l),o.push(t));let u=r.length;r.push({depthAndFlags:L(n,0,1),nameId:l,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(i.slice(0,m)),this.presortedDirectoryNodeIds.push(u),c++,s[c]=u,p=m+1,m=i.indexOf(`/`,p)}let h=s[c];if(h===void 0)throw Error(`Unable to resolve file parent for "${i}"`);let g=i.slice(p),_=a.get(g);_===void 0&&(_=o.length,a.set(g,_),o.push(g)),r.push({depthAndFlags:L(n+1,0),nameId:_,parentId:h,subtreeNodeCount:1,visibleSubtreeCount:1}),p!==l.length&&(l=i.substring(0,p),u=n),t=i}s.length=c+1,t!=null&&(this.lastPreparedPath=Wt(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(V(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||V(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(),!1),this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${e.path}"`);if(t&&(this.options.sort==="default"?Bt(this.lastPreparedPath,e,this.segmentSortKeyCache):$t(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=nn(e),i=n==null?0:nn(n),a=n==null?0:tn(n.segments,e.segments),o=Math.min(a,r,i);this.directoryStack.length=o+1;for(let n=o;n<r;n++){let r=this.directoryStack[this.directoryStack.length-1];if(r===void 0)throw Error(`Directory stack underflow while building the path store`);let i=t?this.getOrCreateDirectoryChild(r,e.segments[n]):this.createDirectoryChild(r,e.segments[n]);this.directoryStack.push(i)}if(e.isDirectory){let t=this.directoryStack[this.directoryStack.length-1];if(t===void 0)throw Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(t,e.path),this.lastPreparedPath=e;return}let s=this.directoryStack[this.directoryStack.length-1];if(s===void 0)throw Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(s,e.basename,e.path):this.createFileChildUnchecked(s,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){let r=Jt(this.segmentTable,t),i=this.getDirectoryIndex(e),a=i.childIdByNameId;if(a!=null&&a.get(r)!==void 0)throw Error(`Path collides with an existing entry: "${n}"`);let o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let s=this.nodes.length;return this.nodes.push({depthAndFlags:L(St(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),ft(i,s),s}createFileChildUnchecked(e,t){let n=Jt(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:L(St(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),ft(r,a),a}getOrCreateDirectoryChild(e,t){let n=Jt(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){let e=r.childIdByNameId.get(n);if(e!==void 0){let n=this.nodes[e];if(n!=null&&!z(n))throw Error(`Path collides with an existing file while creating directory "${t}"`);return e}}let i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:L(St(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),ft(r,a),this.directories.set(a,ct()),a}createDirectoryChild(e,t){let n=Jt(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:L(St(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),ft(r,a),this.directories.set(a,ct()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!z(n))throw Error(`Path is not a directory: "${t}"`);if(B(n,1))throw Error(`Duplicate path: "${t}"`);wt(n,1)}getDirectoryIndex(e){let t=this.directories.get(e);if(t!==void 0)return t;throw Error(`Unknown directory child index for node ${String(e)}`)}buildPresortedFinish(e){let t=this.nodes,n=this.directories;n.set(0,lt());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(z(a)){let t=lt();n.set(e,t),r=e,i=t}let o;a.parentId===r?o=i:(o=n.get(a.parentId),r=a.parentId,i=o??null),o?.childIds.push(e)}if(!e)for(let e=t.length-1;e>=1;e--){let n=t[e];if(n==null)continue;let r=t[n.parentId];r!=null&&(r.subtreeNodeCount+=n.subtreeNodeCount,r.visibleSubtreeCount+=n.visibleSubtreeCount)}}buildDirectoryIndexes(){let e=this.nodes;for(let t=1;t<e.length;t++){let n=e[t];if(n==null)continue;z(n)&&this.directories.set(t,ct());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),ft(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!z(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;let n=this.getDirectoryIndex(e),r=1;for(let e of n.childIds)r+=this.computeSubtreeCounts(e);return I(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function mn(e,t=`closed`,n=null){let r=gn(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 hn(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function gn(e){if(typeof e!=`number`)return e;if(!Number.isInteger(e)||e<0)throw Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(e)}`);return e}function _n(e,t){return B(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:St(t)<=e.defaultExpansion}function vn(e,t,n=e.snapshot.nodes[t]){return n==null||!z(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:_n(e,n)}function yn(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!z(r))return;let i=_n(e,r);if(n){if(i){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t);return}if(i){e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0;return}e.expandedDirectoryIds.delete(t)}function bn(e,t){let n=e.directoryLoadInfoById.get(t);if(n!=null)return n;let r={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:`loaded`};return e.directoryLoadInfoById.set(t,r),r}function xn(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function Sn(e,t){let n=bn(e,t);if(n.state===`loading`&&n.activeAttemptId!=null)return{attemptId:n.activeAttemptId,nodeId:t,reused:!0};let r=n.nextAttemptId;return n.activeAttemptId=r,n.errorMessage=null,n.nextAttemptId+=1,n.state=`loading`,{attemptId:r,nodeId:t,reused:!1}}function Cn(e,t){let n=bn(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function wn(e,t,n){let r=e.directoryLoadInfoById.get(t);return r==null||r.activeAttemptId!==n?!1:(r.activeAttemptId=null,r.errorMessage=null,r.state=`loaded`,!0)}function Tn(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function En(e,t,n,r){let i=e.directoryLoadInfoById.get(t);return i==null||i.activeAttemptId!==n?!1:(i.activeAttemptId=null,i.errorMessage=r??null,i.state=`error`,!0)}function Dn(e,t){e.directoryLoadInfoById.delete(t)}function On(e,t,n){let r=n,i=e.listeners.get(t);return i==null?e.listeners.set(t,new Set([r])):i.add(r),()=>{let n=e.listeners.get(t);n!=null&&(n.delete(r),n.size===0&&e.listeners.delete(t))}}function kn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function An(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function jn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function Mn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Nn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Pn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Fn(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 In(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some(e=>e.canonicalChanged),childEvents:e.childEvents,operation:`apply-child-patch`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Ln(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 Rn(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 zn(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 Bn(e,t,n){return{...n,visibleCountDelta:Zn(e)-t}}function Vn(e,t){let n=Zn(e),r=hn();e.transactionStack.push(r);try{t()}catch(t){throw Wn(e,r,!1),t}Wn(e,r,!0,Zn(e)-n)}function Hn(e,t){let n=e.instrumentation;if(n==null){Un(e,t);return}V(n,`store.events.record`,()=>Un(e,t))}function Un(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){Yn(e,t);return}n.events.push(t),Jn(n,t)}function Wn(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw Error(`Transaction stack underflow`);if(!n)return;let i=e.transactionStack[e.transactionStack.length-1]??null;if(i!=null){let n=e.instrumentation;n==null?qn(i,t):V(n,`store.events.batch.merge`,()=>qn(i,t));return}let a=Gn(t,r),o=e.instrumentation;if(o==null){Yn(e,a);return}V(o,`store.events.batch.commit`,()=>Yn(e,a))}function Gn(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some(e=>e.canonicalChanged),events:[...e.events],operation:`batch`,projectionChanged:e.events.some(e=>e.projectionChanged),visibleCountDelta:t}}function Kn(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function qn(e,t){for(let n of t.events)e.events.push(n);Kn(e,t)}function Jn(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function Yn(e,t){let n=e.instrumentation;if(n==null){Xn(e,t);return}V(n,`store.events.emit`,()=>Xn(e,t))}function Xn(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function Zn(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function Qn(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!z(n)||B(n,2))return null;let r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;let i=r.childIds[0];if(i==null)return null;let a=e.snapshot.nodes[i];return a==null||!z(a)?null:i}function $n(e,t){let n=t;for(;;){let t=Qn(e,n);if(t==null)return n;n=t}}function er(e,t){let n=[t],r=t;for(;;){let t=Qn(e,r);if(t==null)return n;n.push(t),r=t}}function tr(e,t){let n=t==null?e.snapshot.rootId:ur(e,t);return n==null?[]:fr(e,n)}function nr(e,t){let n=Wt(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=Dr(e,Er(e,r)),{createdNodeIds:a,directoryId:o}=pr(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=W(e,o);if(B(n,1))throw Error(`Path already exists: "${t}"`);wt(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=hr(e,o,n.basename),s.add(c);sr(e,o);let l=Dr(e,o);return kn({affectedAncestorIds:lr(e,c),affectedNodeIds:[...s],path:t,projectionChanged:Or(i,l)})}function rr(e,t,n){let r=ur(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=W(e,r);if(B(i,2))throw Error(`The root node cannot be removed`);if(z(i)&&U(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=Dr(e,a),s=wr(e,r);vr(e,a,r,i.nameId),Tr(e,a),sr(e,a);let c=Dr(e,a);return An({affectedAncestorIds:lr(e,a),affectedNodeIds:s,path:t,projectionChanged:Or(o,c),recursive:n.recursive===!0})}function ir(e,t,n,r){let i=ur(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=W(e,i);if(B(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=Sr(e,i,n),c=Dr(e,a.parentId),l=Dr(e,s.parentId),u=Yt(e.snapshot.segmentTable,a.nameId),d=Jt(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(z(a)&&Mr(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=ut(e.snapshot.nodes,U(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&Cr(e,p,o,R(a))===`skip`)return null;let m=a.parentId;vr(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),jr(e,i),_r(e,s.parentId,i),Tr(e,m),e.pathCacheVersion++,sr(e,m),s.parentId!==m&&sr(e,s.parentId);let h=Dr(e,m),g=Dr(e,s.parentId);return jn({affectedAncestorIds:[...new Set([...lr(e,m),...lr(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:kr([c,l],[h,g]),to:H(e,i)})}function ar(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function or(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function H(e,t){let n=W(e,t),r=ar(e,t);if(r!=null)return r;if(B(n,2))return or(e,t,``);let i=H(e,n.parentId),a=Yt(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return or(e,t,z(n)?`${o}/`:o)}function sr(e,t){let n=e.instrumentation;if(n==null){Pr(e,t);return}V(n,`store.recomputeCountsUpwardFrom`,()=>Pr(e,t))}function cr(e,t){let n=[[t,0]],{nodes:r,directories:i}=e.snapshot;for(;n.length>0;){let t=n[n.length-1],a=t[0],o=r[a];if(o==null||!z(o)){Nr(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){Nr(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function lr(e,t){let n=[],r=t;for(;r!=null;){let t=W(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function ur(e,t){if(t.length===0)return e.snapshot.rootId;let n=Gt(t);return dr(e,n.segments,n.requiresDirectory)}function dr(e,t,n){let r=e.snapshot.rootId;for(let n of t){let t=e.snapshot.segmentTable.idByValue.get(n);if(t===void 0)return null;let i=U(e,r),a=ut(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=W(e,r);return n&&!z(i)?null:r}function U(e,t){let n=e.snapshot.directories.get(t);if(n===void 0)throw Error(`Unknown directory child index for node ${String(t)}`);return n}function W(e,t){let n=e.snapshot.nodes[t];if(n===void 0||B(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function fr(e,t){let n=e.snapshot.nodes[t];if(n===void 0||B(n,4))return[];if(!z(n))return[H(e,t)];if(U(e,t).childIds.length===0)return B(n,1)&&!B(n,2)?[H(e,t)]:[];let r=[],i=[{childIndex:0,nodeId:t}];for(;i.length>0;){let t=i[i.length-1];if(t==null)break;let n=e.snapshot.nodes[t.nodeId];if(n===void 0||B(n,4)){i.pop();continue}if(!z(n)){r.push(H(e,t.nodeId)),i.pop();continue}let a=U(e,t.nodeId);if(a.childIds.length===0){B(n,1)&&!B(n,2)&&r.push(H(e,t.nodeId)),i.pop();continue}let o=a.childIds[t.childIndex];if(o==null){i.pop();continue}t.childIndex++,i.push({childIndex:0,nodeId:o})}return r}function pr(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=Jt(e.snapshot.segmentTable,i),a=U(e,r),o=ut(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!z(W(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=mr(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function mr(e,t,n){let r=W(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:L(St(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,ct()),_r(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function hr(e,t,n){let r=Jt(e.snapshot.segmentTable,n),i=U(e,t);if(ut(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${Ir(e,t,n)}"`);let a=W(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:L(St(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),_r(e,t,o),e.activeNodeCount++,o}function gr(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];if(o==null){i=a;continue}yr(e,n,o)<0?i=a:r=a+1}return r}function _r(e,t,n){let r=U(e,t),i=W(e,n);ut(e.snapshot.nodes,r).set(i.nameId,n),pt(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=gr(e,r,n);r.childIds.splice(a,0,n),F(r,a),gt(e.snapshot.nodes,r)}function vr(e,t,n,r){let i=U(e,t),a=dt(i),o=a.get(n)??-1;ut(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&pt(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),F(i,o),gt(e.snapshot.nodes,i))}function yr(e,t,n){let r=e.snapshot.options.sort;return r==="default"?br(e,t,n):r(xr(e,t),xr(e,n))}function br(e,t,n){let r=W(e,t),i=W(e,n),a=z(r);if(a!==z(i))return a?-1:1;let o=Pt(Vt(e.snapshot.segmentTable,r.nameId),Vt(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=Yt(e.snapshot.segmentTable,r.nameId),c=Yt(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function xr(e,t){let n=W(e,t),r=H(e,t),i=z(n),a=i?r.slice(0,-1):r;return{basename:Yt(e.snapshot.segmentTable,n.nameId),depth:St(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function Sr(e,t,n){let r=W(e,t),i=ur(e,n);if(i!=null){let t=W(e,i);if(z(t))return{basename:Yt(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=Gt(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=Gt(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:dr(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function Cr(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${H(e,t)}"`);let i=W(e,t);if(R(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(z(i)&&U(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return wr(e,t),vr(e,a,t,o),Tr(e,a),sr(e,a),`handled`}function wr(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=W(e,t.nodeId);if(t.visitedChildren||!z(i)){z(i)&&e.snapshot.directories.delete(t.nodeId),wt(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),Dn(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=U(e,t.nodeId);for(let e=a.childIds.length-1;e>=0;e--){let t=a.childIds[e];t!=null&&r.push({nodeId:t,visitedChildren:!1})}}return n}function Tr(e,t){let n=t;for(;n!=null;){let t=W(e,n);if(!z(t)||B(t,2)||U(e,n).childIds.length>0)return;wt(t,1),n=t.parentId===n?null:t.parentId}}function Er(e,t){let n=e.snapshot.rootId;for(let r of t){let t=e.snapshot.segmentTable.idByValue.get(r);if(t==null)break;let i=ut(e.snapshot.nodes,U(e,n)).get(t);if(i==null||!z(W(e,i)))break;n=i}return n}function Dr(e,t){let n=Ar(e,t);if(n==null)return null;let r=$n(e,n),i=W(e,r),a=n===r?null:er(e,n).map(t=>H(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:U(e,r).childIds.length>0,path:H(e,r),terminalKind:R(i)})}function Or(e,t){return kr([e],[t])}function kr(e,t){for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(r==null||i==null||r!==i)return!0}return!1}function Ar(e,t){let n=t;for(;n!=null;){let t=W(e,n);if(!z(t)||B(t,2))return null;if(!vn(e,n,t))return n;n=t.parentId}return null}function jr(e,t){let n=W(e,t);if(Tt(n,(t===e.snapshot.rootId?-1:St(W(e,n.parentId)))+1),!z(n))return;let r=U(e,t);for(let t of r.childIds)jr(e,t)}function Mr(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=W(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function Nr(e,t,n=W(e,t),r=!1){let i=e.instrumentation;if(i==null){Fr(e,t,n,r);return}V(i,`store.recomputeNodeCounts`,()=>Fr(e,t,n,r))}function Pr(e,t){let n=t;for(;n!=null;){let t=W(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(Nr(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&pt(U(e,s),n,a,o),n=s}}function Fr(e,t,n,r){if(!z(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=U(e,t);if(r){let t=e.instrumentation;t==null?I(e.snapshot.nodes,i):V(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>I(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,B(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=Qn(e,t)==null?vn(e,t,n)?1+o:1:o}function Ir(e,t,n){let r=H(e,t);return r.length===0?n:`${r}${n}`}function Lr(e){return e!=null&&!B(e,4)}function Rr(e,t){let n=e.snapshot.nodes[t];return!Lr(n)||!z(n)||B(n,2)?null:n}function zr(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&Lr(e.snapshot.nodes[n])&&(t+=1);return t}function Br(e){return Math.max(0,e.valueById.length-1)}function Vr(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:zr(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:Br(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function Hr(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 Ur(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)Rr(e,n)!=null&&t.push(H(e,n));for(let t of e.expandedDirectoryIds)Rr(e,t)!=null&&n.push(H(e,t));return{collapsedPaths:t,expandedPaths:n}}function Wr(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)Rr(e,n)==null||xn(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:H(e,n)});return t}function Gr(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=ur(e,n);t!=null&&yn(e,t,!0,W(e,t))}for(let n of t.collapsedPaths){let t=ur(e,n);t!=null&&yn(e,t,!1,W(e,t))}}function Kr(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=ur(e,n.path);t!=null&&Rr(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function qr(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function Jr(e){let t=e.snapshot.segmentTable,n=qt();for(let r of e.snapshot.nodes)if(Lr(r)){if(B(r,2)){r.nameId=0;continue}r.nameId=Jt(n,Yt(t,r.nameId))}e.snapshot.segmentTable=n}function Yr(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!Lr(r)||!z(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return Lr(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[W(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),I(e.snapshot.nodes,n)}}function Xr(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(Lr(n))break;--t}e.snapshot.nodes.length=t+1}function Zr(e){let t=Ur(e),n=Wr(e);V(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>qr(e)),V(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>Jr(e)),V(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>Yr(e)),V(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>Xr(e)),V(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>Gr(e,t)),V(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>Kr(e,n)),V(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>cr(e,e.snapshot.rootId))}function Qr(e){let t=Ur(e),n=Wr(e),r=V(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>tr(e)),i=Dt({...e.snapshot.options},e.instrumentation),a=V(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new pn(i);return e.appendPaths(r),e.finish()});e.snapshot=a,e.activeNodeCount=a.nodes.length-1,e.pathCacheByNodeId=new Map([[a.rootId,{path:``,version:0}]]),e.pathCacheVersion=0,V(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>Gr(e,t)),V(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>Kr(e,n)),V(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>cr(e,e.snapshot.rootId))}function $r(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function ei(e,t){let n=Vr(e);t===`stable`?V(e.instrumentation,`store.cleanup.stable`,()=>Zr(e)):V(e.instrumentation,`store.cleanup.aggressive`,()=>Qr(e));let r=Vr(e);return Hr(t,t===`stable`,n,r)}var ti=64;function ni(e,t){let n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;let i=new Int32Array(r);return i.fill(-1),i.set(e),i}function ri(e){return W(e,e.snapshot.rootId).visibleSubtreeCount}function ii(e,t,n,r){let i=W(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function ai(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:wi(e,t.cursor),setSize:t.setSize,subtreeEndIndex:ii(e,t.cursor,t.index,n)}}function oi(e,t,n,r,i,a){let o=U(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=mt(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return si(e,u,l,r+c,i+1,s,o.childIds.length,a)}function si(e,t,n,r,i,a,o,s){if(!z(W(e,t))){if(n===0)return{ancestors:s,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:i},index:r,posInSet:a,setSize:o};throw Error(`Visible index ${String(n)} is out of range for file`)}let c=vi(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=W(e,c.terminalNodeId);if(!z(l)||!vn(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return oi(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function ci(e,t){let n=ri(e);if(t<0||t>=n)return null;let r=oi(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>H(e,t.cursor.terminalNodeId)),a=null;return{ancestorPaths:i,get ancestorRows(){if(a!=null)return a;let t=[],i=[];for(let a of r.ancestors){let r=ai(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:wi(e,r.cursor),setSize:r.setSize,subtreeEndIndex:ii(e,r.cursor,r.index,n)}}function li(e,t,n){let r=e.instrumentation,i=ri(e);if(i<=0||n<t)return[];let a=Math.max(0,Math.min(t,i-1)),o=Math.max(a,Math.min(n,i-1));if(r==null){if(a===0)return Ci(e,o+1);let t=[],n=hi(e,a);for(let r=a;r<=o&&n!=null;r++){let r=wi(e,n);t.push(r),n=bi(e,n)}return t}let s=[],c=0,l=0,u=V(r,`store.getVisibleSlice.selectFirstRow`,()=>hi(e,a));for(let t=a;t<=o&&u!=null;t++){let t=V(r,`store.getVisibleSlice.materializeRow`,()=>wi(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=V(r,`store.getVisibleSlice.advanceCursor`,()=>bi(e,u))}return kt(r,`workload.visibleRowsRead`,s.length),kt(r,`workload.flattenedRowsRead`,c),kt(r,`workload.flattenedSegmentsRead`,l),s}function ui(e,t=ri(e)){let n=e.instrumentation;return n==null?Si(e,t):V(n,`store.getVisibleTreeProjection`,()=>Si(e,t))}function di(e){return xi(ui(e))}function fi(e,t){let n=ur(e,t);if(n==null||n===e.snapshot.rootId||z(W(e,n))&&$n(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=W(e,i).parentId,n=U(e,t),s=dt(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=ht(a,n,s),t!==o){let n=W(e,t),a=Qn(e,t);if(!vn(e,t,n)&&a!==i)return null;$n(e,t)===t&&(r+=1)}i=t}return r}function pi(e,t){let n=ur(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=W(e,n);if(!z(r))throw Error(`Path is not a directory: "${t}"`);return vn(e,n,r)?null:(yn(e,n,!0,r),sr(e,n),Mn({affectedAncestorIds:lr(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function mi(e,t){let n=ur(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=W(e,n);if(!z(r))throw Error(`Path is not a directory: "${t}"`);return vn(e,n,r)?(yn(e,n,!1,r),sr(e,n),Nn({affectedAncestorIds:lr(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function hi(e,t){return t<0||t>=ri(e)?null:gi(e,e.snapshot.rootId,t,-1)}function gi(e,t,n,r){let i=U(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?mt(e.snapshot.nodes,i,n):V(a,`store.getVisibleSlice.selectChildIndex`,()=>mt(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return _i(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function _i(e,t,n,r){if(!z(W(e,t))){if(n===0)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw Error(`Visible index ${String(n)} is out of range for file`)}let i=vi(e,t,r);if(n===0)return i;let a=W(e,i.terminalNodeId);if(!z(a)||!vn(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return gi(e,i.terminalNodeId,n-1,i.visibleDepth)}function vi(e,t,n){return z(W(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:$n(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:V(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>$n(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function yi(e,t){let n=W(e,t);if(!z(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:Qn(e,r)!==t}function bi(e,t){let n=W(e,t.terminalNodeId);if(z(n)){let r=U(e,t.terminalNodeId);if(vn(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:_i(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=W(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=U(e,n),o=dt(a).get(r)??-1;if(o<0)throw Error(`Child ${String(r)} was not found in its parent index`);let s=a.childIds[o+1]??null;if(s!=null)return _i(e,s,0,i);yi(e,r)&&i--,r=n}}function xi(e){let t=e.paths.length,n=Array(t);for(let r=0;r<t;r+=1){let t=e.getParentIndex(r);n[r]={index:r,parentPath:t>=0?e.paths[t]??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 Si(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(ti);o.fill(-1);let s=0,{nodes:c,directories:l,segmentTable:u}=e.snapshot,d=[[l.get(e.snapshot.rootId),0,-1,``]],f=e.snapshot.options.flattenEmptyDirectories,p=e.pathCacheByNodeId,m=e.pathCacheVersion,h=u.valueById;for(;d.length>0&&s<t;){let t=d[d.length-1],u=t[0];if(t[1]>=u.childIds.length){d.pop();continue}let g=t[1],_=u.childIds[t[1]++],v=c[_],y=t[2]+1,b=t[3];o=ni(o,y);let x,S=_;if(z(v))S=f?$n(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:H(e,S);else{let e=p.get(_);x=e!=null&&e.version===m?e.path:`${b}${h[v.nameId]}`}r[s]=o[y],n[s]=x,i[s]=g,a[s]=u.childIds.length,o[y+1]=s,s+=1;let C=c[S];C!=null&&z(C)&&vn(e,S,C)&&d.push([l.get(S),0,y,x])}s<t&&(n.length=s);let g=r.subarray(0,s),_=i.subarray(0,s),v=a.subarray(0,s),y=null;return{getParentIndex(e){return e<0||e>=s?-1:g[e]??-1},paths:n,posInSetByIndex:_,setSizeByIndex:v,get visibleIndexByPath(){if(y==null){y=new Map;for(let e=0;e<s;e+=1)y.set(n[e]??``,e)}return y}}}function Ci(e,t){let n=Array(t),r=0,{nodes:i,directories:a,segmentTable:o}=e.snapshot,s=[[a.get(e.snapshot.rootId),0,-1]],c=o.valueById,l=e.snapshot.options.flattenEmptyDirectories,u=e.pathCacheByNodeId,d=e.pathCacheVersion;for(;s.length>0&&r<t;){let t=s[s.length-1],o=t[0];if(t[1]>=o.childIds.length){s.pop();continue}let f=o.childIds[t[1]++],p=i[f],m=t[2]+1;if(!z(p)){let t=u.get(f);n[r++]={depth:m,flattenedSegments:void 0,hasChildren:!1,id:f,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:`file`,loadState:void 0,name:c[p.nameId],path:t!=null&&t.version===d?t.path:H(e,f)};continue}let h=l?$n(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=wi(e,g);let _=i[h];_!=null&&z(_)&&vn(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function wi(e,t){let n=W(e,t.terminalNodeId),r=z(n)?Ti(e,t):null,i=H(e,t.terminalNodeId),a=Yt(e.snapshot.segmentTable,n.nameId),o=z(n)&&U(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?er(e,t.headNodeId).map(n=>{let r=W(e,n);return{isTerminal:n===t.terminalNodeId,name:Yt(e.snapshot.segmentTable,r.nameId),nodeId:n,path:H(e,n)}}):V(c,`store.getVisibleSlice.flatten.collectSegments`,()=>er(e,t.headNodeId).map(n=>{let r=W(e,n);return{isTerminal:n===t.terminalNodeId,name:Yt(e.snapshot.segmentTable,r.nameId),nodeId:n,path:H(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:z(n)&&vn(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:z(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function Ti(e,t){if(t.headNodeId===t.terminalNodeId)return xn(e,t.terminalNodeId);let n=er(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=xn(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function Ei(e){let{directories:t,nodes:n,options:r,rootId:i,presortedDirectoryNodeIds:a}=e.snapshot,o=r.flattenEmptyDirectories===!0,s=e=>{let r=n[e];if(r==null||!z(r))return;let i=t.get(e);if(i==null)throw Error(`Unknown directory child index for node ${String(e)}`);let a=i.childIds,s=a.length,c=0,l=0;for(let e=0;e<s;e++){let t=a[e];if(t==null)continue;let r=n[t];c+=r.subtreeNodeCount,l+=r.visibleSubtreeCount}i.totalChildSubtreeNodeCount=c,i.totalChildVisibleSubtreeCount=l,s>=128&&gt(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&z(e)?l:1+l}else u=1+l;r.visibleSubtreeCount=u};if(a!=null)for(let e=a.length-1;e>=0;e--)s(a[e]);else for(let e=n.length-1;e>=1;e--)s(e);let c=n[i],l=t.get(i);if(c==null||l==null)return;let u=l.childIds,d=0,f=0;for(let e=0;e<u.length;e++){let t=u[e];if(t==null)continue;let r=n[t];d+=r.subtreeNodeCount,f+=r.visibleSubtreeCount}l.totalChildSubtreeNodeCount=d,l.totalChildVisibleSubtreeCount=f,gt(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function Di(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var Oi=class e{#e;constructor(e={}){let t=Ot(e),n=V(t,`store.builder.create`,()=>new pn(e));if(e.preparedInput!=null){let t=un(e.preparedInput);t==null?n.appendPreparedPaths(ln(e.preparedInput),!1):n.appendPresortedPaths(t,dn(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(V(t,`store.preparePathEntries`,()=>fn(r,e)))}let r=V(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=V(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=V(t,`store.state.create`,()=>mn(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:V(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||Di(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&V(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?V(t,`store.state.initializeOpenVisibleCounts`,()=>Ei(this.#e)):V(t,`store.state.recomputeCounts`,()=>cr(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return on(e,t)}static prepareInput(e,t={}){return sn(e,t)}static preparePresortedInput(e){return cn(e)}list(e){return V(this.#e.instrumentation,`store.list`,()=>tr(this.#e,e))}add(e){V(this.#e.instrumentation,`store.add`,()=>{let t=ri(this.#e);Hn(this.#e,Bn(this.#e,t,nr(this.#e,e)))})}remove(e,t={}){V(this.#e.instrumentation,`store.remove`,()=>{let n=ri(this.#e);Hn(this.#e,Bn(this.#e,n,rr(this.#e,e,t)))})}move(e,t,n={}){V(this.#e.instrumentation,`store.move`,()=>{let r=ri(this.#e),i=ir(this.#e,e,t,n);i!=null&&Hn(this.#e,Bn(this.#e,r,i))})}batch(e){Vn(this.#e,()=>{if(typeof e==`function`){e(this);return}for(let t of e)switch(t.type){case`add`:this.add(t.path);break;case`remove`:this.remove(t.path,{recursive:t.recursive});break;case`move`:this.move(t.from,t.to,{collision:t.collision});break}})}getVisibleCount(){return V(this.#e.instrumentation,`store.getVisibleCount`,()=>ri(this.#e))}getVisibleSlice(e,t){return V(this.#e.instrumentation,`store.getVisibleSlice`,()=>li(this.#e,e,t))}getVisibleRowContext(e){return V(this.#e.instrumentation,`store.getVisibleRowContext`,()=>ci(this.#e,e))}getVisibleTreeProjection(){return di(this.#e)}getVisibleTreeProjectionData(e){return ui(this.#e,e)}getVisibleIndex(e){return V(this.#e.instrumentation,`store.getVisibleIndex`,()=>fi(this.#e,e))}getPathInfo(e){return V(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=ur(this.#e,e);if(t==null)return null;let n=W(this.#e,t);return{depth:St(n),kind:z(n)?`directory`:`file`,path:H(this.#e,t)}})}isExpanded(e){return V(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=W(this.#e,t);return vn(this.#e,t,n)})}expand(e){V(this.#e.instrumentation,`store.expand`,()=>{let t=ri(this.#e),n=pi(this.#e,e);n!=null&&Hn(this.#e,Bn(this.#e,t,n))})}collapse(e){V(this.#e.instrumentation,`store.collapse`,()=>{let t=ri(this.#e),n=mi(this.#e,e);n!=null&&Hn(this.#e,Bn(this.#e,t,n))})}on(e,t){return On(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return xn(this.#e,t)}markDirectoryUnloaded(e){V(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(U(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=ri(this.#e);Cn(this.#e,t),Hn(this.#e,Bn(this.#e,n,Pn({affectedAncestorIds:lr(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return V(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=ri(this.#e),r=Sn(this.#e,t);return Hn(this.#e,Bn(this.#e,n,Fn({affectedAncestorIds:lr(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return V(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||xn(this.#e,n)!==`loading`||!Tn(this.#e,n,e.attemptId))return!1;let r=H(this.#e,n);this.validateChildPatch(r,t);let i=ri(this.#e),a=[];for(let e of t.operations){ki(r,e);let t=ri(this.#e);switch(e.type){case`add`:a.push(Bn(this.#e,t,nr(this.#e,e.path)));break;case`remove`:a.push(Bn(this.#e,t,rr(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=ir(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(Bn(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return Hn(this.#e,Bn(this.#e,i,In({affectedAncestorIds:lr(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:H(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return V(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=ri(this.#e),r=wn(this.#e,t,e.attemptId);return Hn(this.#e,Bn(this.#e,n,Ln({affectedAncestorIds:lr(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:H(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return V(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=ri(this.#e),i=En(this.#e,n,e.attemptId,t);return Hn(this.#e,Bn(this.#e,r,Rn({affectedAncestorIds:lr(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:H(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return V(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if($r(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=ri(this.#e),n=ei(this.#e,e.mode??`stable`);return Hn(this.#e,Bn(this.#e,t,zn({...n,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:n.idsPreserved===!1}))),n})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(e){if(e==null||e.length===0)return 0;let t=0,n=[],r=[],i=0,a=null,o=this.#e.snapshot.segmentTable,s=o.valueById,c=this.#e.snapshot.nodes,l=new Map;for(let u of e){a!=null&&u<a&&(a=null,i=0,n.length=0,r.length=0);let e=u.length>0&&u.charCodeAt(u.length-1)===47?u.length-1:u.length;if(e===0){a=u,i=e,n.length=0,r.length=0;continue}let d=0,f=0;if(a!=null){let t=Math.min(e,i),n=!0;for(let e=0;e<t;e+=1){let t=u.charCodeAt(e);if(t!==a.charCodeAt(e)){n=!1;break}t===47&&(d+=1,f=e+1)}n&&(t===i&&e>t&&u.charCodeAt(t)===47?(d+=1,f=t+1):t===e&&i>t&&a.charCodeAt(t)===47&&(d+=1,f=e+1)),d=Math.min(d,r.length)}let p=d===0?this.#e.snapshot.rootId:r[d-1]??this.#e.snapshot.rootId,m=d,h=!0,g=f;for(;g<=e;){let t=u.indexOf(`/`,g),i=t===-1||t>e?e:t,a=u.slice(g,i),f=U(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??Mt(a);l.set(a,b);let x=(e,t)=>{for(v=e;v<t;v+=1){let e=f[v],t=c[e],n=s[t.nameId];if(n===a)return y=e,!0;let r=Pt(Vt(o,t.nameId),b);if(r>0||r===0&&n>a)return!1}return!1};if(!x(_,f.length)&&_>0&&x(0,_),y===void 0){h=!1;break}if(!z(W(this.#e,y))){h=!1;break}if(n[m]=v,r[m]=y,p=y,m+=1,i===e)break;g=i+1}if(a=u,i=e,n.length=m,r.length=m,!h){a=null,i=0,n.length=0,r.length=0;continue}for(let e=d;e<m;e+=1){let n=r[e];if(n==null)continue;let i=W(this.#e,n);vn(this.#e,n,i)||(yn(this.#e,n,!0,i),t+=1)}}return t}hasAllDirectoriesExpanded(){for(let e of this.#e.snapshot.directories.keys()){if(e===this.#e.snapshot.rootId)continue;let t=W(this.#e,e);if(!vn(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=ur(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!z(W(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!z(W(this.#e,e)))throw Error(`Node is not a directory: ${String(e)}`);return e}catch{return null}}isDirectoryProjectionVisible(e){let t=e;for(;t!==this.#e.snapshot.rootId;){let e=W(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=W(this.#e,e),r=Qn(this.#e,e);if(!vn(this.#e,e,n)&&r!==t)return!1}t=e}return!0}validateChildPatch(t,n){new e({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function ki(e,t){switch(t.type){case`add`:case`remove`:if(!t.path.startsWith(e)||t.path===e)throw 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 Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`);break}}var Ai={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function ji(e,t){if(typeof e==`number`)return{itemHeight:t??Ai.default.itemHeight,factor:e};let n=Ai[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var Mi=Ai.default.itemHeight,Ni=`@layer base, theme, unsafe;
1
+ import{$t as e,C as t,E as n,Ff as r,Go as i,Ho as a,Jt as o,Pt as s,Ts as c,Wf as l,as as u,b as d,bs as f,g as p,is as m,m as h,p as g,ql as _,sp as v,up as y,v as b}from"./textarea-DHdA8g53.js";import{a as x,c as S,i as C,n as ee,o as w,r as T,s as E,t as te}from"./fileCommentAnnotations-dnvCAKlJ.js";import{C as ne,Cn as D,Ct as O,D as k,Dn as A,Dt as j,En as M,Fr as re,Gn as ie,H as ae,Hn as oe,Nr as se,Qn as ce,Qt as le,Rt as ue,S as de,Sn as fe,Sr as pe,Tn as me,Tr as N,Tt as he,U as ge,V as _e,W as ve,Wn as ye,X as be,b as xe,bn as Se,d as Ce,dr as we,f as Te,fr as Ee,jr as De,l as P,ln as Oe,lr as ke,m as Ae,mr as je,p as Me,pn as Ne,pr as Pe,qn as Fe,u as Ie,ur as Le,v as Re,vr as ze,w as Be,x as Ve,xn as He,y as Ue,yn as We,yr as Ge,z as Ke,zt as qe}from"./index-DjvMZjfP.js";var Je=i(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),Ye=i(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),Xe=`file-tree-container`,Ze=`data-file-tree-style`,Qe=`data-file-tree-unsafe-css`,$e=`data-file-tree-scrollbar-measure`,et=`data-file-tree-scrollbar-gutter-measured`,tt=`--trees-scrollbar-gutter-measured`,nt=`header`,rt=`context-menu`,it=`context-menu-trigger`,at=5,ot=1<<at,st=ot*4;function ct(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function lt(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function ut(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;let n=new Map;for(let r of t.childIds){let t=e[r];t!=null&&n.set(t.nameId,r)}return t.childIdByNameId=n,n}function dt(e){if(e.childPositionById!=null)return e.childPositionById;let t=new Map;for(let n=0;n<e.childIds.length;n++){let r=e.childIds[n];r!=null&&t.set(r,n)}return e.childPositionById=t,t}function ft(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function F(e,t){if(e.childPositionById!=null)for(let n=t;n<e.childIds.length;n++){let t=e.childIds[n];t!=null&&e.childPositionById.set(t,n)}}function I(e,t){let n=0,r=0;for(let i of t.childIds){let t=e[i];t!=null&&(n+=t.subtreeNodeCount,r+=t.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,gt(e,t)}function pt(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=dt(e).get(t);if(i===void 0)return;let a=i>>at;e.childVisibleChunkSums[a]+=r}function mt(e,t,n){let r=t.childVisibleChunkSums;if(r!=null){let i=n,a=0;for(let o of r){if(i<o){let r=_t(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=ot}throw Error(`Visible child index ${String(n)} is out of range`)}let i=n;for(let r=0;r<t.childIds.length;r++){let a=t.childIds[r];if(a==null)continue;let o=e[a];if(o!=null){if(i<o.visibleSubtreeCount)return{childIndex:r,childVisibleIndex:n-i,localVisibleIndex:i};i-=o.visibleSubtreeCount}}throw Error(`Visible child index ${String(n)} is out of range`)}function ht(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>at;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<at}for(let i=a;i<n;i+=1){let n=t.childIds[i];if(n==null)continue;let a=e[n];a!=null&&(r+=a.visibleSubtreeCount)}return r}function gt(e,t){if(t.childIds.length<st){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/ot),r=new Int32Array(n);for(let n=0;n<t.childIds.length;n++){let i=t.childIds[n];if(i==null)continue;let a=e[i];a!=null&&(r[n>>at]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function _t(e,t,n,r){let i=Math.min(t.childIds.length,n+ot),a=r;for(let r=n;r<i;r++){let n=t.childIds[r];if(n==null)continue;let i=e[n];if(i!=null){if(a<i.visibleSubtreeCount)return{childIndex:r,localVisibleIndex:a};a-=i.visibleSubtreeCount}}throw Error(`Visible child index ${String(r)} is out of range`)}var vt=7,yt=3,bt=1<<yt,xt=4;function L(e,t,n=0){return e<<xt|n<<yt|t}function St(e){return e.depthAndFlags>>>xt}function R(e){return(e.depthAndFlags&bt)>>yt}function z(e){return(e.depthAndFlags&bt)!==0}function Ct(e){return e.depthAndFlags&vt}function B(e,t){return(Ct(e)&t)!==0}function wt(e,t){e.depthAndFlags|=t}function Tt(e,t){e.depthAndFlags=L(t,Ct(e),R(e))}var Et=Symbol(`benchmarkInstrumentation`);function Dt(e,t){return t==null||Object.defineProperty(e,Et,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function Ot(e){return e==null?null:e[Et]??null}function V(e,t,n){return e==null?n():e.measurePhase(t,n)}function kt(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function At(e){return e>=48&&e<=57}function jt(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!At(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let i=0;for(;r<e.length&&At(e.charCodeAt(r));)i=i*10+(e.charCodeAt(r)-48),r+=1;t.push(i),n=r}return(n<e.length||t.length===0)&&t.push(e.slice(n)),t}function Mt(e){let t=e.toLowerCase();return{lowerValue:t,tokens:jt(t)}}function Nt(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===i)continue;if(typeof n==`number`&&typeof i==`number`)return n<i?-1:1;let a=String(n),o=String(i);if(a!==o)return a<o?-1:1}return e.length===t.length?0:e.length<t.length?-1:1}function Pt(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;let n=Nt(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function Ft(e,t,n){let r=Pt(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function It(e,t){return Ft(e,t,Mt)}function Lt(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function Rt(e,t){let n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let n=e.segments[r],i=t.segments[r];if(n===i)continue;let a=Lt(e,r);return a===Lt(t,r)?It(n,i):a===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function zt(e,t){return Rt(e,t)}function Bt(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=Mt(e);return n.set(e,r),r},i=Math.min(e.segments.length,t.segments.length);for(let n=0;n<i;n++){let i=e.segments[n],a=t.segments[n];if(i===a)continue;let o=Lt(e,n);return o===Lt(t,n)?Ft(i,a,r):o===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function Vt(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=Mt(r);return e.sortKeyById[t]=i,i}function Ht(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function Ut(e){let t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[],i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===47&&(r.push(e.slice(i,t)),i=t+1);return r.push(e.slice(i,n)),{hasTrailingSlash:t,segments:r}}function Wt(e){let{hasTrailingSlash:t,segments:n}=Ut(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function Gt(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=Ut(e);return{requiresDirectory:t,segments:n}}var Kt=``;function qt(){let e=new Map;return e.set(Kt,0),{idByValue:e,valueById:[Kt],sortKeyById:[Mt(Kt)]}}function Jt(e,t){let n=e.idByValue.get(t);if(n!==void 0)return n;let r=e.valueById.length;return e.idByValue.set(t,r),e.valueById.push(t),r}function Yt(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var Xt=Symbol(`pathStorePreparedInputKind`);function Zt(e,t){return e[Xt]=t,e}function Qt(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function $t(e,t,n){return n==="default"?zt(e,t):n(Qt(e),Qt(t))}function en(){return{depthAndFlags:L(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function tn(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return r;return n}function nn(e){return e.isDirectory?e.segments.length:e.segments.length-1}function rn(e){return Array.isArray(e)&&e.every(e=>typeof e==`object`&&!!e&&typeof e.path==`string`&&Array.isArray(e.segments)&&typeof e.basename==`string`&&typeof e.isDirectory==`boolean`)}function an(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function on(e,t={}){return fn(e,t).map(e=>e.path)}function sn(e,t={}){let n=fn(e,t);return Zt({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function cn(e){let t=e.length,n=!1;for(let r=0;r<t;r+=1){let t=e[r];if(t.length>0&&t.charCodeAt(t.length-1)===47){n=!0;break}}return Zt({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function ln(e){let t=e,n=t.preparedPaths;if(t[Xt]===`prepared`&&n!=null)return n;if(!rn(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function un(e){let t=e;return t[Xt]===`presorted`&&t.presortedPaths!=null||an(t.presortedPaths)?t.presortedPaths:null}function dn(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function fn(e,t={}){let n=Ht(t),r=Ot(t);kt(r,`workload.inputFiles`,e.length);let i=V(r,`store.preparePathEntries.parse`,()=>e.map(e=>Wt(e)));return V(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>$t(e,t,n.sort))),i}var pn=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[en()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=qt();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=Ot(e),this.options=Ht(e);let t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{let e=new Set,n=t.length;for(let r=0;r<n;r+=1){let n=t[r],i=n.length;e.add(i>0&&n.charCodeAt(i-1)===47?n.slice(0,i-1):n)}this.initialExpandedPathSet=e,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,ct())}appendPaths(e){return V(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>Wt(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,V(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return V(this.instrumentation,`store.builder.appendPresortedPaths`,()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0,i=this.nodes,a=this.segmentTable,o=a.idByValue,s=a.valueById,c=this.directoryStack,l=0,u=``,d=0;for(let t of e){if(n===t)throw Error(`Duplicate path: "${t}"`);let e=t.length>0&&t.charCodeAt(t.length-1)===47,a=e?t.length-1:t.length,f=0,p=0;if(n!=null)if(u.length>0&&t.length>u.length&&t.startsWith(u))f=d,p=u.length;else{let r=Math.min(a,n.length),i=!0;for(let e=0;e<r;e++){let r=t.charCodeAt(e);if(r!==n.charCodeAt(e)){i=!1;break}r===47&&(f++,p=e+1)}i&&e&&r===a&&n.length>a&&n.charCodeAt(a)===47&&(f++,p=a+1)}l=f,r=f;let m=p,h=t.indexOf(`/`,m);for(;h>=0&&h<a;){let e=c[l];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);r++;let n=t.slice(m,h),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n));let u=i.length;i.push({depthAndFlags:L(r,0,1),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(t.slice(0,h)),l++,c[l]=u,m=h+1,h=t.indexOf(`/`,m)}if(e){if(m<a){let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory parent for "${t}"`);r++;let n=t.slice(m,a),u=o.get(n);u===void 0&&(u=s.length,o.set(n,u),s.push(n));let d=i.length;i.push({depthAndFlags:L(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d}let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{let e=c[l];if(e===void 0)throw Error(`Unable to resolve file parent for "${t}"`);let n=t.slice(m),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n)),i.push({depthAndFlags:L(r+1,0),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1})}m!==u.length&&(u=t.substring(0,m),d=r),n=t}c.length=l+1,n!=null&&(this.lastPreparedPath=Wt(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0,r=this.nodes,i=this.segmentTable,a=i.idByValue,o=i.valueById,s=this.directoryStack,c=0,l=``,u=0;for(let i of e){if(t===i)throw Error(`Duplicate path: "${i}"`);let e=i.length,d=0,f=0;if(t!=null)if(l.length>0&&i.length>l.length&&i.startsWith(l))d=u,f=l.length;else{let n=Math.min(e,t.length);for(let e=0;e<n;e++){let n=i.charCodeAt(e);if(n!==t.charCodeAt(e))break;n===47&&(d++,f=e+1)}}c=d,n=d;let p=f,m=i.indexOf(`/`,p);for(;m>=0;){let e=s[c];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);n++;let t=i.slice(p,m),l=a.get(t);l===void 0&&(l=o.length,a.set(t,l),o.push(t));let u=r.length;r.push({depthAndFlags:L(n,0,1),nameId:l,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(i.slice(0,m)),this.presortedDirectoryNodeIds.push(u),c++,s[c]=u,p=m+1,m=i.indexOf(`/`,p)}let h=s[c];if(h===void 0)throw Error(`Unable to resolve file parent for "${i}"`);let g=i.slice(p),_=a.get(g);_===void 0&&(_=o.length,a.set(g,_),o.push(g)),r.push({depthAndFlags:L(n+1,0),nameId:_,parentId:h,subtreeNodeCount:1,visibleSubtreeCount:1}),p!==l.length&&(l=i.substring(0,p),u=n),t=i}s.length=c+1,t!=null&&(this.lastPreparedPath=Wt(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(V(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||V(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(),!1),this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${e.path}"`);if(t&&(this.options.sort==="default"?Bt(this.lastPreparedPath,e,this.segmentSortKeyCache):$t(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=nn(e),i=n==null?0:nn(n),a=n==null?0:tn(n.segments,e.segments),o=Math.min(a,r,i);this.directoryStack.length=o+1;for(let n=o;n<r;n++){let r=this.directoryStack[this.directoryStack.length-1];if(r===void 0)throw Error(`Directory stack underflow while building the path store`);let i=t?this.getOrCreateDirectoryChild(r,e.segments[n]):this.createDirectoryChild(r,e.segments[n]);this.directoryStack.push(i)}if(e.isDirectory){let t=this.directoryStack[this.directoryStack.length-1];if(t===void 0)throw Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(t,e.path),this.lastPreparedPath=e;return}let s=this.directoryStack[this.directoryStack.length-1];if(s===void 0)throw Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(s,e.basename,e.path):this.createFileChildUnchecked(s,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){let r=Jt(this.segmentTable,t),i=this.getDirectoryIndex(e),a=i.childIdByNameId;if(a!=null&&a.get(r)!==void 0)throw Error(`Path collides with an existing entry: "${n}"`);let o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let s=this.nodes.length;return this.nodes.push({depthAndFlags:L(St(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),ft(i,s),s}createFileChildUnchecked(e,t){let n=Jt(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:L(St(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),ft(r,a),a}getOrCreateDirectoryChild(e,t){let n=Jt(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){let e=r.childIdByNameId.get(n);if(e!==void 0){let n=this.nodes[e];if(n!=null&&!z(n))throw Error(`Path collides with an existing file while creating directory "${t}"`);return e}}let i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:L(St(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),ft(r,a),this.directories.set(a,ct()),a}createDirectoryChild(e,t){let n=Jt(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:L(St(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),ft(r,a),this.directories.set(a,ct()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!z(n))throw Error(`Path is not a directory: "${t}"`);if(B(n,1))throw Error(`Duplicate path: "${t}"`);wt(n,1)}getDirectoryIndex(e){let t=this.directories.get(e);if(t!==void 0)return t;throw Error(`Unknown directory child index for node ${String(e)}`)}buildPresortedFinish(e){let t=this.nodes,n=this.directories;n.set(0,lt());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(z(a)){let t=lt();n.set(e,t),r=e,i=t}let o;a.parentId===r?o=i:(o=n.get(a.parentId),r=a.parentId,i=o??null),o?.childIds.push(e)}if(!e)for(let e=t.length-1;e>=1;e--){let n=t[e];if(n==null)continue;let r=t[n.parentId];r!=null&&(r.subtreeNodeCount+=n.subtreeNodeCount,r.visibleSubtreeCount+=n.visibleSubtreeCount)}}buildDirectoryIndexes(){let e=this.nodes;for(let t=1;t<e.length;t++){let n=e[t];if(n==null)continue;z(n)&&this.directories.set(t,ct());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),ft(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!z(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;let n=this.getDirectoryIndex(e),r=1;for(let e of n.childIds)r+=this.computeSubtreeCounts(e);return I(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function mn(e,t=`closed`,n=null){let r=gn(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 hn(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function gn(e){if(typeof e!=`number`)return e;if(!Number.isInteger(e)||e<0)throw Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(e)}`);return e}function _n(e,t){return B(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:St(t)<=e.defaultExpansion}function vn(e,t,n=e.snapshot.nodes[t]){return n==null||!z(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:_n(e,n)}function yn(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!z(r))return;let i=_n(e,r);if(n){if(i){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t);return}if(i){e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0;return}e.expandedDirectoryIds.delete(t)}function bn(e,t){let n=e.directoryLoadInfoById.get(t);if(n!=null)return n;let r={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:`loaded`};return e.directoryLoadInfoById.set(t,r),r}function xn(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function Sn(e,t){let n=bn(e,t);if(n.state===`loading`&&n.activeAttemptId!=null)return{attemptId:n.activeAttemptId,nodeId:t,reused:!0};let r=n.nextAttemptId;return n.activeAttemptId=r,n.errorMessage=null,n.nextAttemptId+=1,n.state=`loading`,{attemptId:r,nodeId:t,reused:!1}}function Cn(e,t){let n=bn(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function wn(e,t,n){let r=e.directoryLoadInfoById.get(t);return r==null||r.activeAttemptId!==n?!1:(r.activeAttemptId=null,r.errorMessage=null,r.state=`loaded`,!0)}function Tn(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function En(e,t,n,r){let i=e.directoryLoadInfoById.get(t);return i==null||i.activeAttemptId!==n?!1:(i.activeAttemptId=null,i.errorMessage=r??null,i.state=`error`,!0)}function Dn(e,t){e.directoryLoadInfoById.delete(t)}function On(e,t,n){let r=n,i=e.listeners.get(t);return i==null?e.listeners.set(t,new Set([r])):i.add(r),()=>{let n=e.listeners.get(t);n!=null&&(n.delete(r),n.size===0&&e.listeners.delete(t))}}function kn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function An(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function jn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function Mn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Nn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Pn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Fn(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 In(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some(e=>e.canonicalChanged),childEvents:e.childEvents,operation:`apply-child-patch`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Ln(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 Rn(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 zn(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 Bn(e,t,n){return{...n,visibleCountDelta:Zn(e)-t}}function Vn(e,t){let n=Zn(e),r=hn();e.transactionStack.push(r);try{t()}catch(t){throw Wn(e,r,!1),t}Wn(e,r,!0,Zn(e)-n)}function Hn(e,t){let n=e.instrumentation;if(n==null){Un(e,t);return}V(n,`store.events.record`,()=>Un(e,t))}function Un(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){Yn(e,t);return}n.events.push(t),Jn(n,t)}function Wn(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw Error(`Transaction stack underflow`);if(!n)return;let i=e.transactionStack[e.transactionStack.length-1]??null;if(i!=null){let n=e.instrumentation;n==null?qn(i,t):V(n,`store.events.batch.merge`,()=>qn(i,t));return}let a=Gn(t,r),o=e.instrumentation;if(o==null){Yn(e,a);return}V(o,`store.events.batch.commit`,()=>Yn(e,a))}function Gn(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some(e=>e.canonicalChanged),events:[...e.events],operation:`batch`,projectionChanged:e.events.some(e=>e.projectionChanged),visibleCountDelta:t}}function Kn(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function qn(e,t){for(let n of t.events)e.events.push(n);Kn(e,t)}function Jn(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function Yn(e,t){let n=e.instrumentation;if(n==null){Xn(e,t);return}V(n,`store.events.emit`,()=>Xn(e,t))}function Xn(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function Zn(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function Qn(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!z(n)||B(n,2))return null;let r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;let i=r.childIds[0];if(i==null)return null;let a=e.snapshot.nodes[i];return a==null||!z(a)?null:i}function $n(e,t){let n=t;for(;;){let t=Qn(e,n);if(t==null)return n;n=t}}function er(e,t){let n=[t],r=t;for(;;){let t=Qn(e,r);if(t==null)return n;n.push(t),r=t}}function tr(e,t){let n=t==null?e.snapshot.rootId:ur(e,t);return n==null?[]:fr(e,n)}function nr(e,t){let n=Wt(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=Dr(e,Er(e,r)),{createdNodeIds:a,directoryId:o}=pr(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=W(e,o);if(B(n,1))throw Error(`Path already exists: "${t}"`);wt(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=hr(e,o,n.basename),s.add(c);sr(e,o);let l=Dr(e,o);return kn({affectedAncestorIds:lr(e,c),affectedNodeIds:[...s],path:t,projectionChanged:Or(i,l)})}function rr(e,t,n){let r=ur(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=W(e,r);if(B(i,2))throw Error(`The root node cannot be removed`);if(z(i)&&U(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=Dr(e,a),s=wr(e,r);vr(e,a,r,i.nameId),Tr(e,a),sr(e,a);let c=Dr(e,a);return An({affectedAncestorIds:lr(e,a),affectedNodeIds:s,path:t,projectionChanged:Or(o,c),recursive:n.recursive===!0})}function ir(e,t,n,r){let i=ur(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=W(e,i);if(B(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=Sr(e,i,n),c=Dr(e,a.parentId),l=Dr(e,s.parentId),u=Yt(e.snapshot.segmentTable,a.nameId),d=Jt(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(z(a)&&Mr(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=ut(e.snapshot.nodes,U(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&Cr(e,p,o,R(a))===`skip`)return null;let m=a.parentId;vr(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),jr(e,i),_r(e,s.parentId,i),Tr(e,m),e.pathCacheVersion++,sr(e,m),s.parentId!==m&&sr(e,s.parentId);let h=Dr(e,m),g=Dr(e,s.parentId);return jn({affectedAncestorIds:[...new Set([...lr(e,m),...lr(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:kr([c,l],[h,g]),to:H(e,i)})}function ar(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function or(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function H(e,t){let n=W(e,t),r=ar(e,t);if(r!=null)return r;if(B(n,2))return or(e,t,``);let i=H(e,n.parentId),a=Yt(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return or(e,t,z(n)?`${o}/`:o)}function sr(e,t){let n=e.instrumentation;if(n==null){Pr(e,t);return}V(n,`store.recomputeCountsUpwardFrom`,()=>Pr(e,t))}function cr(e,t){let n=[[t,0]],{nodes:r,directories:i}=e.snapshot;for(;n.length>0;){let t=n[n.length-1],a=t[0],o=r[a];if(o==null||!z(o)){Nr(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){Nr(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function lr(e,t){let n=[],r=t;for(;r!=null;){let t=W(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function ur(e,t){if(t.length===0)return e.snapshot.rootId;let n=Gt(t);return dr(e,n.segments,n.requiresDirectory)}function dr(e,t,n){let r=e.snapshot.rootId;for(let n of t){let t=e.snapshot.segmentTable.idByValue.get(n);if(t===void 0)return null;let i=U(e,r),a=ut(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=W(e,r);return n&&!z(i)?null:r}function U(e,t){let n=e.snapshot.directories.get(t);if(n===void 0)throw Error(`Unknown directory child index for node ${String(t)}`);return n}function W(e,t){let n=e.snapshot.nodes[t];if(n===void 0||B(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function fr(e,t){let n=e.snapshot.nodes[t];if(n===void 0||B(n,4))return[];if(!z(n))return[H(e,t)];if(U(e,t).childIds.length===0)return B(n,1)&&!B(n,2)?[H(e,t)]:[];let r=[],i=[{childIndex:0,nodeId:t}];for(;i.length>0;){let t=i[i.length-1];if(t==null)break;let n=e.snapshot.nodes[t.nodeId];if(n===void 0||B(n,4)){i.pop();continue}if(!z(n)){r.push(H(e,t.nodeId)),i.pop();continue}let a=U(e,t.nodeId);if(a.childIds.length===0){B(n,1)&&!B(n,2)&&r.push(H(e,t.nodeId)),i.pop();continue}let o=a.childIds[t.childIndex];if(o==null){i.pop();continue}t.childIndex++,i.push({childIndex:0,nodeId:o})}return r}function pr(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=Jt(e.snapshot.segmentTable,i),a=U(e,r),o=ut(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!z(W(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=mr(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function mr(e,t,n){let r=W(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:L(St(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,ct()),_r(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function hr(e,t,n){let r=Jt(e.snapshot.segmentTable,n),i=U(e,t);if(ut(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${Ir(e,t,n)}"`);let a=W(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:L(St(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),_r(e,t,o),e.activeNodeCount++,o}function gr(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];if(o==null){i=a;continue}yr(e,n,o)<0?i=a:r=a+1}return r}function _r(e,t,n){let r=U(e,t),i=W(e,n);ut(e.snapshot.nodes,r).set(i.nameId,n),pt(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=gr(e,r,n);r.childIds.splice(a,0,n),F(r,a),gt(e.snapshot.nodes,r)}function vr(e,t,n,r){let i=U(e,t),a=dt(i),o=a.get(n)??-1;ut(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&pt(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),F(i,o),gt(e.snapshot.nodes,i))}function yr(e,t,n){let r=e.snapshot.options.sort;return r==="default"?br(e,t,n):r(xr(e,t),xr(e,n))}function br(e,t,n){let r=W(e,t),i=W(e,n),a=z(r);if(a!==z(i))return a?-1:1;let o=Pt(Vt(e.snapshot.segmentTable,r.nameId),Vt(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=Yt(e.snapshot.segmentTable,r.nameId),c=Yt(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function xr(e,t){let n=W(e,t),r=H(e,t),i=z(n),a=i?r.slice(0,-1):r;return{basename:Yt(e.snapshot.segmentTable,n.nameId),depth:St(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function Sr(e,t,n){let r=W(e,t),i=ur(e,n);if(i!=null){let t=W(e,i);if(z(t))return{basename:Yt(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=Gt(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=Gt(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:dr(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function Cr(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${H(e,t)}"`);let i=W(e,t);if(R(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(z(i)&&U(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return wr(e,t),vr(e,a,t,o),Tr(e,a),sr(e,a),`handled`}function wr(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=W(e,t.nodeId);if(t.visitedChildren||!z(i)){z(i)&&e.snapshot.directories.delete(t.nodeId),wt(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),Dn(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=U(e,t.nodeId);for(let e=a.childIds.length-1;e>=0;e--){let t=a.childIds[e];t!=null&&r.push({nodeId:t,visitedChildren:!1})}}return n}function Tr(e,t){let n=t;for(;n!=null;){let t=W(e,n);if(!z(t)||B(t,2)||U(e,n).childIds.length>0)return;wt(t,1),n=t.parentId===n?null:t.parentId}}function Er(e,t){let n=e.snapshot.rootId;for(let r of t){let t=e.snapshot.segmentTable.idByValue.get(r);if(t==null)break;let i=ut(e.snapshot.nodes,U(e,n)).get(t);if(i==null||!z(W(e,i)))break;n=i}return n}function Dr(e,t){let n=Ar(e,t);if(n==null)return null;let r=$n(e,n),i=W(e,r),a=n===r?null:er(e,n).map(t=>H(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:U(e,r).childIds.length>0,path:H(e,r),terminalKind:R(i)})}function Or(e,t){return kr([e],[t])}function kr(e,t){for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(r==null||i==null||r!==i)return!0}return!1}function Ar(e,t){let n=t;for(;n!=null;){let t=W(e,n);if(!z(t)||B(t,2))return null;if(!vn(e,n,t))return n;n=t.parentId}return null}function jr(e,t){let n=W(e,t);if(Tt(n,(t===e.snapshot.rootId?-1:St(W(e,n.parentId)))+1),!z(n))return;let r=U(e,t);for(let t of r.childIds)jr(e,t)}function Mr(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=W(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function Nr(e,t,n=W(e,t),r=!1){let i=e.instrumentation;if(i==null){Fr(e,t,n,r);return}V(i,`store.recomputeNodeCounts`,()=>Fr(e,t,n,r))}function Pr(e,t){let n=t;for(;n!=null;){let t=W(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(Nr(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&pt(U(e,s),n,a,o),n=s}}function Fr(e,t,n,r){if(!z(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=U(e,t);if(r){let t=e.instrumentation;t==null?I(e.snapshot.nodes,i):V(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>I(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,B(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=Qn(e,t)==null?vn(e,t,n)?1+o:1:o}function Ir(e,t,n){let r=H(e,t);return r.length===0?n:`${r}${n}`}function Lr(e){return e!=null&&!B(e,4)}function Rr(e,t){let n=e.snapshot.nodes[t];return!Lr(n)||!z(n)||B(n,2)?null:n}function zr(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&Lr(e.snapshot.nodes[n])&&(t+=1);return t}function Br(e){return Math.max(0,e.valueById.length-1)}function Vr(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:zr(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:Br(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function Hr(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 Ur(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)Rr(e,n)!=null&&t.push(H(e,n));for(let t of e.expandedDirectoryIds)Rr(e,t)!=null&&n.push(H(e,t));return{collapsedPaths:t,expandedPaths:n}}function Wr(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)Rr(e,n)==null||xn(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:H(e,n)});return t}function Gr(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=ur(e,n);t!=null&&yn(e,t,!0,W(e,t))}for(let n of t.collapsedPaths){let t=ur(e,n);t!=null&&yn(e,t,!1,W(e,t))}}function Kr(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=ur(e,n.path);t!=null&&Rr(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function qr(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function Jr(e){let t=e.snapshot.segmentTable,n=qt();for(let r of e.snapshot.nodes)if(Lr(r)){if(B(r,2)){r.nameId=0;continue}r.nameId=Jt(n,Yt(t,r.nameId))}e.snapshot.segmentTable=n}function Yr(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!Lr(r)||!z(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return Lr(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[W(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),I(e.snapshot.nodes,n)}}function Xr(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(Lr(n))break;--t}e.snapshot.nodes.length=t+1}function Zr(e){let t=Ur(e),n=Wr(e);V(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>qr(e)),V(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>Jr(e)),V(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>Yr(e)),V(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>Xr(e)),V(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>Gr(e,t)),V(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>Kr(e,n)),V(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>cr(e,e.snapshot.rootId))}function Qr(e){let t=Ur(e),n=Wr(e),r=V(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>tr(e)),i=Dt({...e.snapshot.options},e.instrumentation),a=V(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new pn(i);return e.appendPaths(r),e.finish()});e.snapshot=a,e.activeNodeCount=a.nodes.length-1,e.pathCacheByNodeId=new Map([[a.rootId,{path:``,version:0}]]),e.pathCacheVersion=0,V(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>Gr(e,t)),V(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>Kr(e,n)),V(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>cr(e,e.snapshot.rootId))}function $r(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function ei(e,t){let n=Vr(e);t===`stable`?V(e.instrumentation,`store.cleanup.stable`,()=>Zr(e)):V(e.instrumentation,`store.cleanup.aggressive`,()=>Qr(e));let r=Vr(e);return Hr(t,t===`stable`,n,r)}var ti=64;function ni(e,t){let n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;let i=new Int32Array(r);return i.fill(-1),i.set(e),i}function ri(e){return W(e,e.snapshot.rootId).visibleSubtreeCount}function ii(e,t,n,r){let i=W(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function ai(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:wi(e,t.cursor),setSize:t.setSize,subtreeEndIndex:ii(e,t.cursor,t.index,n)}}function oi(e,t,n,r,i,a){let o=U(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=mt(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return si(e,u,l,r+c,i+1,s,o.childIds.length,a)}function si(e,t,n,r,i,a,o,s){if(!z(W(e,t))){if(n===0)return{ancestors:s,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:i},index:r,posInSet:a,setSize:o};throw Error(`Visible index ${String(n)} is out of range for file`)}let c=vi(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=W(e,c.terminalNodeId);if(!z(l)||!vn(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return oi(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function ci(e,t){let n=ri(e);if(t<0||t>=n)return null;let r=oi(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>H(e,t.cursor.terminalNodeId)),a=null;return{ancestorPaths:i,get ancestorRows(){if(a!=null)return a;let t=[],i=[];for(let a of r.ancestors){let r=ai(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:wi(e,r.cursor),setSize:r.setSize,subtreeEndIndex:ii(e,r.cursor,r.index,n)}}function li(e,t,n){let r=e.instrumentation,i=ri(e);if(i<=0||n<t)return[];let a=Math.max(0,Math.min(t,i-1)),o=Math.max(a,Math.min(n,i-1));if(r==null){if(a===0)return Ci(e,o+1);let t=[],n=hi(e,a);for(let r=a;r<=o&&n!=null;r++){let r=wi(e,n);t.push(r),n=bi(e,n)}return t}let s=[],c=0,l=0,u=V(r,`store.getVisibleSlice.selectFirstRow`,()=>hi(e,a));for(let t=a;t<=o&&u!=null;t++){let t=V(r,`store.getVisibleSlice.materializeRow`,()=>wi(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=V(r,`store.getVisibleSlice.advanceCursor`,()=>bi(e,u))}return kt(r,`workload.visibleRowsRead`,s.length),kt(r,`workload.flattenedRowsRead`,c),kt(r,`workload.flattenedSegmentsRead`,l),s}function ui(e,t=ri(e)){let n=e.instrumentation;return n==null?Si(e,t):V(n,`store.getVisibleTreeProjection`,()=>Si(e,t))}function di(e){return xi(ui(e))}function fi(e,t){let n=ur(e,t);if(n==null||n===e.snapshot.rootId||z(W(e,n))&&$n(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=W(e,i).parentId,n=U(e,t),s=dt(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=ht(a,n,s),t!==o){let n=W(e,t),a=Qn(e,t);if(!vn(e,t,n)&&a!==i)return null;$n(e,t)===t&&(r+=1)}i=t}return r}function pi(e,t){let n=ur(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=W(e,n);if(!z(r))throw Error(`Path is not a directory: "${t}"`);return vn(e,n,r)?null:(yn(e,n,!0,r),sr(e,n),Mn({affectedAncestorIds:lr(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function mi(e,t){let n=ur(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=W(e,n);if(!z(r))throw Error(`Path is not a directory: "${t}"`);return vn(e,n,r)?(yn(e,n,!1,r),sr(e,n),Nn({affectedAncestorIds:lr(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function hi(e,t){return t<0||t>=ri(e)?null:gi(e,e.snapshot.rootId,t,-1)}function gi(e,t,n,r){let i=U(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?mt(e.snapshot.nodes,i,n):V(a,`store.getVisibleSlice.selectChildIndex`,()=>mt(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return _i(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function _i(e,t,n,r){if(!z(W(e,t))){if(n===0)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw Error(`Visible index ${String(n)} is out of range for file`)}let i=vi(e,t,r);if(n===0)return i;let a=W(e,i.terminalNodeId);if(!z(a)||!vn(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return gi(e,i.terminalNodeId,n-1,i.visibleDepth)}function vi(e,t,n){return z(W(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:$n(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:V(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>$n(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function yi(e,t){let n=W(e,t);if(!z(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:Qn(e,r)!==t}function bi(e,t){let n=W(e,t.terminalNodeId);if(z(n)){let r=U(e,t.terminalNodeId);if(vn(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:_i(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=W(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=U(e,n),o=dt(a).get(r)??-1;if(o<0)throw Error(`Child ${String(r)} was not found in its parent index`);let s=a.childIds[o+1]??null;if(s!=null)return _i(e,s,0,i);yi(e,r)&&i--,r=n}}function xi(e){let t=e.paths.length,n=Array(t);for(let r=0;r<t;r+=1){let t=e.getParentIndex(r);n[r]={index:r,parentPath:t>=0?e.paths[t]??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 Si(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(ti);o.fill(-1);let s=0,{nodes:c,directories:l,segmentTable:u}=e.snapshot,d=[[l.get(e.snapshot.rootId),0,-1,``]],f=e.snapshot.options.flattenEmptyDirectories,p=e.pathCacheByNodeId,m=e.pathCacheVersion,h=u.valueById;for(;d.length>0&&s<t;){let t=d[d.length-1],u=t[0];if(t[1]>=u.childIds.length){d.pop();continue}let g=t[1],_=u.childIds[t[1]++],v=c[_],y=t[2]+1,b=t[3];o=ni(o,y);let x,S=_;if(z(v))S=f?$n(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:H(e,S);else{let e=p.get(_);x=e!=null&&e.version===m?e.path:`${b}${h[v.nameId]}`}r[s]=o[y],n[s]=x,i[s]=g,a[s]=u.childIds.length,o[y+1]=s,s+=1;let C=c[S];C!=null&&z(C)&&vn(e,S,C)&&d.push([l.get(S),0,y,x])}s<t&&(n.length=s);let g=r.subarray(0,s),_=i.subarray(0,s),v=a.subarray(0,s),y=null;return{getParentIndex(e){return e<0||e>=s?-1:g[e]??-1},paths:n,posInSetByIndex:_,setSizeByIndex:v,get visibleIndexByPath(){if(y==null){y=new Map;for(let e=0;e<s;e+=1)y.set(n[e]??``,e)}return y}}}function Ci(e,t){let n=Array(t),r=0,{nodes:i,directories:a,segmentTable:o}=e.snapshot,s=[[a.get(e.snapshot.rootId),0,-1]],c=o.valueById,l=e.snapshot.options.flattenEmptyDirectories,u=e.pathCacheByNodeId,d=e.pathCacheVersion;for(;s.length>0&&r<t;){let t=s[s.length-1],o=t[0];if(t[1]>=o.childIds.length){s.pop();continue}let f=o.childIds[t[1]++],p=i[f],m=t[2]+1;if(!z(p)){let t=u.get(f);n[r++]={depth:m,flattenedSegments:void 0,hasChildren:!1,id:f,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:`file`,loadState:void 0,name:c[p.nameId],path:t!=null&&t.version===d?t.path:H(e,f)};continue}let h=l?$n(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=wi(e,g);let _=i[h];_!=null&&z(_)&&vn(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function wi(e,t){let n=W(e,t.terminalNodeId),r=z(n)?Ti(e,t):null,i=H(e,t.terminalNodeId),a=Yt(e.snapshot.segmentTable,n.nameId),o=z(n)&&U(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?er(e,t.headNodeId).map(n=>{let r=W(e,n);return{isTerminal:n===t.terminalNodeId,name:Yt(e.snapshot.segmentTable,r.nameId),nodeId:n,path:H(e,n)}}):V(c,`store.getVisibleSlice.flatten.collectSegments`,()=>er(e,t.headNodeId).map(n=>{let r=W(e,n);return{isTerminal:n===t.terminalNodeId,name:Yt(e.snapshot.segmentTable,r.nameId),nodeId:n,path:H(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:z(n)&&vn(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:z(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function Ti(e,t){if(t.headNodeId===t.terminalNodeId)return xn(e,t.terminalNodeId);let n=er(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=xn(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function Ei(e){let{directories:t,nodes:n,options:r,rootId:i,presortedDirectoryNodeIds:a}=e.snapshot,o=r.flattenEmptyDirectories===!0,s=e=>{let r=n[e];if(r==null||!z(r))return;let i=t.get(e);if(i==null)throw Error(`Unknown directory child index for node ${String(e)}`);let a=i.childIds,s=a.length,c=0,l=0;for(let e=0;e<s;e++){let t=a[e];if(t==null)continue;let r=n[t];c+=r.subtreeNodeCount,l+=r.visibleSubtreeCount}i.totalChildSubtreeNodeCount=c,i.totalChildVisibleSubtreeCount=l,s>=128&&gt(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&z(e)?l:1+l}else u=1+l;r.visibleSubtreeCount=u};if(a!=null)for(let e=a.length-1;e>=0;e--)s(a[e]);else for(let e=n.length-1;e>=1;e--)s(e);let c=n[i],l=t.get(i);if(c==null||l==null)return;let u=l.childIds,d=0,f=0;for(let e=0;e<u.length;e++){let t=u[e];if(t==null)continue;let r=n[t];d+=r.subtreeNodeCount,f+=r.visibleSubtreeCount}l.totalChildSubtreeNodeCount=d,l.totalChildVisibleSubtreeCount=f,gt(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function Di(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var Oi=class e{#e;constructor(e={}){let t=Ot(e),n=V(t,`store.builder.create`,()=>new pn(e));if(e.preparedInput!=null){let t=un(e.preparedInput);t==null?n.appendPreparedPaths(ln(e.preparedInput),!1):n.appendPresortedPaths(t,dn(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(V(t,`store.preparePathEntries`,()=>fn(r,e)))}let r=V(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=V(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=V(t,`store.state.create`,()=>mn(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:V(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||Di(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&V(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?V(t,`store.state.initializeOpenVisibleCounts`,()=>Ei(this.#e)):V(t,`store.state.recomputeCounts`,()=>cr(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return on(e,t)}static prepareInput(e,t={}){return sn(e,t)}static preparePresortedInput(e){return cn(e)}list(e){return V(this.#e.instrumentation,`store.list`,()=>tr(this.#e,e))}add(e){V(this.#e.instrumentation,`store.add`,()=>{let t=ri(this.#e);Hn(this.#e,Bn(this.#e,t,nr(this.#e,e)))})}remove(e,t={}){V(this.#e.instrumentation,`store.remove`,()=>{let n=ri(this.#e);Hn(this.#e,Bn(this.#e,n,rr(this.#e,e,t)))})}move(e,t,n={}){V(this.#e.instrumentation,`store.move`,()=>{let r=ri(this.#e),i=ir(this.#e,e,t,n);i!=null&&Hn(this.#e,Bn(this.#e,r,i))})}batch(e){Vn(this.#e,()=>{if(typeof e==`function`){e(this);return}for(let t of e)switch(t.type){case`add`:this.add(t.path);break;case`remove`:this.remove(t.path,{recursive:t.recursive});break;case`move`:this.move(t.from,t.to,{collision:t.collision});break}})}getVisibleCount(){return V(this.#e.instrumentation,`store.getVisibleCount`,()=>ri(this.#e))}getVisibleSlice(e,t){return V(this.#e.instrumentation,`store.getVisibleSlice`,()=>li(this.#e,e,t))}getVisibleRowContext(e){return V(this.#e.instrumentation,`store.getVisibleRowContext`,()=>ci(this.#e,e))}getVisibleTreeProjection(){return di(this.#e)}getVisibleTreeProjectionData(e){return ui(this.#e,e)}getVisibleIndex(e){return V(this.#e.instrumentation,`store.getVisibleIndex`,()=>fi(this.#e,e))}getPathInfo(e){return V(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=ur(this.#e,e);if(t==null)return null;let n=W(this.#e,t);return{depth:St(n),kind:z(n)?`directory`:`file`,path:H(this.#e,t)}})}isExpanded(e){return V(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=W(this.#e,t);return vn(this.#e,t,n)})}expand(e){V(this.#e.instrumentation,`store.expand`,()=>{let t=ri(this.#e),n=pi(this.#e,e);n!=null&&Hn(this.#e,Bn(this.#e,t,n))})}collapse(e){V(this.#e.instrumentation,`store.collapse`,()=>{let t=ri(this.#e),n=mi(this.#e,e);n!=null&&Hn(this.#e,Bn(this.#e,t,n))})}on(e,t){return On(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return xn(this.#e,t)}markDirectoryUnloaded(e){V(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(U(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=ri(this.#e);Cn(this.#e,t),Hn(this.#e,Bn(this.#e,n,Pn({affectedAncestorIds:lr(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return V(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=ri(this.#e),r=Sn(this.#e,t);return Hn(this.#e,Bn(this.#e,n,Fn({affectedAncestorIds:lr(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return V(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||xn(this.#e,n)!==`loading`||!Tn(this.#e,n,e.attemptId))return!1;let r=H(this.#e,n);this.validateChildPatch(r,t);let i=ri(this.#e),a=[];for(let e of t.operations){ki(r,e);let t=ri(this.#e);switch(e.type){case`add`:a.push(Bn(this.#e,t,nr(this.#e,e.path)));break;case`remove`:a.push(Bn(this.#e,t,rr(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=ir(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(Bn(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return Hn(this.#e,Bn(this.#e,i,In({affectedAncestorIds:lr(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:H(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return V(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=ri(this.#e),r=wn(this.#e,t,e.attemptId);return Hn(this.#e,Bn(this.#e,n,Ln({affectedAncestorIds:lr(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:H(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return V(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=ri(this.#e),i=En(this.#e,n,e.attemptId,t);return Hn(this.#e,Bn(this.#e,r,Rn({affectedAncestorIds:lr(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:H(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return V(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if($r(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=ri(this.#e),n=ei(this.#e,e.mode??`stable`);return Hn(this.#e,Bn(this.#e,t,zn({...n,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:n.idsPreserved===!1}))),n})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(e){if(e==null||e.length===0)return 0;let t=0,n=[],r=[],i=0,a=null,o=this.#e.snapshot.segmentTable,s=o.valueById,c=this.#e.snapshot.nodes,l=new Map;for(let u of e){a!=null&&u<a&&(a=null,i=0,n.length=0,r.length=0);let e=u.length>0&&u.charCodeAt(u.length-1)===47?u.length-1:u.length;if(e===0){a=u,i=e,n.length=0,r.length=0;continue}let d=0,f=0;if(a!=null){let t=Math.min(e,i),n=!0;for(let e=0;e<t;e+=1){let t=u.charCodeAt(e);if(t!==a.charCodeAt(e)){n=!1;break}t===47&&(d+=1,f=e+1)}n&&(t===i&&e>t&&u.charCodeAt(t)===47?(d+=1,f=t+1):t===e&&i>t&&a.charCodeAt(t)===47&&(d+=1,f=e+1)),d=Math.min(d,r.length)}let p=d===0?this.#e.snapshot.rootId:r[d-1]??this.#e.snapshot.rootId,m=d,h=!0,g=f;for(;g<=e;){let t=u.indexOf(`/`,g),i=t===-1||t>e?e:t,a=u.slice(g,i),f=U(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??Mt(a);l.set(a,b);let x=(e,t)=>{for(v=e;v<t;v+=1){let e=f[v],t=c[e],n=s[t.nameId];if(n===a)return y=e,!0;let r=Pt(Vt(o,t.nameId),b);if(r>0||r===0&&n>a)return!1}return!1};if(!x(_,f.length)&&_>0&&x(0,_),y===void 0){h=!1;break}if(!z(W(this.#e,y))){h=!1;break}if(n[m]=v,r[m]=y,p=y,m+=1,i===e)break;g=i+1}if(a=u,i=e,n.length=m,r.length=m,!h){a=null,i=0,n.length=0,r.length=0;continue}for(let e=d;e<m;e+=1){let n=r[e];if(n==null)continue;let i=W(this.#e,n);vn(this.#e,n,i)||(yn(this.#e,n,!0,i),t+=1)}}return t}hasAllDirectoriesExpanded(){for(let e of this.#e.snapshot.directories.keys()){if(e===this.#e.snapshot.rootId)continue;let t=W(this.#e,e);if(!vn(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=ur(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!z(W(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!z(W(this.#e,e)))throw Error(`Node is not a directory: ${String(e)}`);return e}catch{return null}}isDirectoryProjectionVisible(e){let t=e;for(;t!==this.#e.snapshot.rootId;){let e=W(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=W(this.#e,e),r=Qn(this.#e,e);if(!vn(this.#e,e,n)&&r!==t)return!1}t=e}return!0}validateChildPatch(t,n){new e({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function ki(e,t){switch(t.type){case`add`:case`remove`:if(!t.path.startsWith(e)||t.path===e)throw 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 Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`);break}}var Ai={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function ji(e,t){if(typeof e==`number`)return{itemHeight:t??Ai.default.itemHeight,factor:e};let n=Ai[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var Mi=Ai.default.itemHeight,Ni=`@layer base, theme, unsafe;
2
2
 
3
3
  @layer base {
4
4
  :host {
@@ -1668,7 +1668,7 @@ import{$t as e,C as t,E as n,Go as r,Ho as i,Jt as a,Kl as o,Pf as s,Pt as c,Ts
1668
1668
  }`}function Ii(e){return`${Pi}
1669
1669
  @layer unsafe {
1670
1670
  ${e}
1671
- }`}var Li=new WeakMap;function Ri(e){let t=Li.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute($e,`true`);let r=document.createElement(`div`);r.style.position=`relative`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n);let i=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),Li.set(e,i),i}function zi(e,t){if(!e.isConnected)return;let n=Ri(t);if(n==null)return;let r=t.querySelector(`style[${et}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(et,``),t.appendChild(i)),i.textContent=`:host { ${tt}: ${n}px; }`}var Bi;function Vi(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){Bi??(Bi=new CSSStyleSheet,Bi.replaceSync(Fi(Ni)));let t=!1;try{e.adoptedStyleSheets=[Bi],t=!0}catch{}if(t){e.querySelector(`style[${Ze}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(Ze,``),t.textContent=Fi(Ni),e.prepend(t)}}function Hi(e,t){Ui(e,t),Vi(t),zi(e,t)}function Ui(e,t){let 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(){let e=this.shadowRoot??this.attachShadow({mode:`open`});Hi(this,e)}}if(customElements.define(Xe,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(Xe)))e instanceof HTMLElement&&Hi(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var Wi=e=>e.startsWith(`f::`)?e.slice(3):e;function Gi(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function Ki(e,t){return e===``?t:`${e}/${t}`}function qi({files:e,path:t,isFolder:n,nextBasename:r}){let i=Wi(t),a=r.trim();if(a.length===0)return{error:`Name cannot be empty.`};if(a.includes(`/`))return{error:`Name cannot include "/".`};let{parentPath:o,baseName:s}=Gi(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=Ki(o,a),l=Array(e.length),u=new Set;if(!n){let t=`${c}/`,r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(a!==i&&a.startsWith(t))return{error:`"${c}" already exists.`};let o=a===i?c:a;if(u.has(o))return{error:`"${c}" already exists.`};u.add(o),l[n]=o,a===i&&(r=!0)}return r?{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}:{error:`Could not find the selected file to rename.`}}let d=`${i}/`,f=`${c}/`,p=0;for(let t=0;t<e.length;t++){let n=e[t],r=n===i||n.startsWith(d);if(!r&&(n===c||n.startsWith(f)))return{error:`"${c}" already exists.`};let a=r?`${c}${n.slice(i.length)}`:n;if(u.has(a))return{error:`"${c}" already exists.`};u.add(a),l[t]=a,r&&p++}return p===0?{error:`Could not find the selected folder to rename.`}:{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}}function Ji(e){return e.endsWith(`/`)}function Yi(e){let 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 Xi(e){let t=[],n=new Set;for(let r of e)n.has(r)||(n.add(r),t.push(r));let r=new Set;for(let e of t.toSorted((e,t)=>e.length===t.length?e.localeCompare(t):e.length-t.length)){let t=(e.endsWith(`/`)?e.slice(0,-1):e).split(`/`),n=!1;for(let e=0;e<t.length-1;e+=1){let i=`${t.slice(0,e+1).join(`/`)}/`;if(r.has(i)){n=!0;break}}n||r.add(e)}return t.filter(e=>r.has(e))}function Zi(e,t){return t.includes(e)?Xi(t):[e]}function Qi(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 $i(e,t){return{draggedPaths:e,target:t}}function ea(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(Ji(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function ta(e,t){return t.kind===`root`||t.directoryPath==null?Yi(e):t.directoryPath}function na(e,t){let n=e.map(e=>{let n=ta(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}function ra(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 ia(e,t,n){let{paths:r,preparedInput:i}=e;if(i==null){if(r==null)throw Error(`FileTree requires paths or preparedInput`);return{paths:r,preparedInput:void 0}}let a=i.paths;if(r==null)return{paths:a,preparedInput:i};if(!ra(Oi.preparePaths(r,n==null?{}:{sort:n}),a))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:a,preparedInput:i}}function aa(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function oa(e,t,n){if(e===t)return n;let r=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(r)?`${n.endsWith(`/`)?n:`${n}/`}${e.slice(r.length)}`:e}function sa(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function ca(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 sa(e,t.path)?n?e:null:e;case`move`:return oa(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=ca(r,e,n),r==null)return null;return r}}}function la(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function ua(e){switch(e.operation){case`add`:return{...la(e),operation:`add`,path:e.path};case`remove`:return{...la(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...la(e),from:e.from,operation:`move`,to:e.to}}}function da(e){return{...la(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>ua(e)),operation:`batch`}}function fa(e){switch(e.operation){case`add`:case`remove`:case`move`:return ua(e);case`batch`:return da(e);default:return null}}function pa(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function ma(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function ha(e){return ma(e).at(-1)??null}function ga(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function _a(e){return e.endsWith(`/`)}var va=e=>e.toLowerCase();function ya(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function ba(e){return e.endsWith(`/`)?e.slice(0,-1):e}function xa(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var Sa=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},Ca=Symbol(`FILE_TREE_RENAME_VIEW`),wa=512,Ta=512;function Ea(e){return e===`top`||e===`center`?e:`nearest`}function Da(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=ma(n);for(let e=r.length-1;e>=0;--e){let n=r[e];if(n==null)continue;let i=t(n);if(i!=null)return i}}return 0}function Oa(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};let r=n??(t=>e.visibleIndexByPath.get(t)??null);return{focusedIndex:Da(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var ka=class{#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=0;#z=null;#B=new Set;#V=0;#H;#U=0;#W=!1;#G=0;#K;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=ia({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#A=n??`hide-non-matches`,this.#H=this.#le(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ne(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#B=new Set(d),this.#z=f,this.#V=1),this.#je(f,!1),r!=null&&this.#Te(r,!1),this.#K=this.#Re()}destroy(){this.#K?.(),this.#K=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#he()}focusFirstItem(){this.#be().length>0&&this.#Fe(0)}focusLastItem(){this.#G<=0||(this.#Ie(),this.#Fe(this.#G-1))}focusNextItem(){this.#Ae(1)}focusParentItem(){if(this.#c==null)return;let e=ha(this.#c);if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t)}focusPath(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;this.#Ie();let n=this.#Z(t);n>=0&&this.#Fe(n)}scrollToPath(e,t){let n=this.#H.getPathInfo(e)?.path??null;if(n==null)return;this.#Ie();let r=this.#xe(n);r<0||this.#Me(r)!=null&&(t?.focus!==!1&&this.#Fe(r,!1),this.#L={id:this.#R+=1,offset:Ea(t?.offset),visibleIndex:r},this.#De())}focusMountedPathFromInput(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;let n=this.#Z(t);n>=0&&this.#Fe(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Z(t);return n>=0?(this.#Fe(n),this.#be()[n]??t):null}focusPreviousItem(){this.#Ae(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#Q(this.#c)}getFocusedPath(){return this.#c}getScrollRequest(){return this.#L}clearScrollRequest(e){this.#L?.id===e&&(this.#L=null)}resolveNearestVisiblePath(e){let t=this.#be();if(this.#G===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#H.getPathInfo(e)?.path??e,r=this.#Z(n);return r>=0?t[r]??n:this.#X(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#B]}getSelectionVersion(){return this.#V}getVisibleCount(){return this.#G}getVisibleRows(e,t){if(t<e||this.#G===0)return[];let n=Math.max(0,e),r=Math.min(this.#G-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=Ta){let e=[];for(let t=n;t<=r;t+=1){let n=this.#H.getVisibleRowContext(t);if(n==null)break;e.push(this.#ee(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ie(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#Se(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];if(r!=null&&r===a+1){a=r;continue}if(i>=0&&this.#H.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null){i=-1,a=-1;continue}i=r,a=r}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#Se(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#$(o,i,a,{ancestorPaths:this.#re(a),path:s})})}return this.#H.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#$(e,r,r,{ancestorPaths:this.#re(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#G===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#G;r+=1){let i=e+r*t,a=Math.min(this.#G-1,Math.floor(i/t)),o=this.#te(a,r)??(a>0?this.#te(a-1,r):void 0);if(o==null)break;n.push({row:this.#ee(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#H.getPathInfo(e);return t==null?null:this.#Q(t.path,t)}resolveMountedDirectoryPathFromInput(e){let t=this.#H.getPathInfo(e);return t?.kind===`directory`?t.path:null}toggleMountedDirectoryFromInput(e){let t=this.resolveMountedDirectoryPathFromInput(e);t!=null&&this.#ze(t)}selectAllVisiblePaths(){this.#Ie();let e=[...this.#be()];this.#ae(e,this.#c??this.#z)}selectOnlyPath(e){let t=this.#Ne(e);t!=null&&this.#ae([t],t)}selectOnlyMountedPathFromInput(e){this.#ae([e],e)}selectPath(e){let t=this.#Ne(e);t==null||this.#B.has(t)||this.#ae([...this.#B,t])}deselectPath(e){let t=this.#Ne(e);t==null||!this.#B.has(t)||this.#ae([...this.#B].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.#ae([...this.#B].filter(e=>e!==t),t);return}this.#ae([...this.#B,t],t)}}selectPathRange(e,t){let n=this.#Ne(e);if(n==null)return;this.#Ie();let r=this.#z,i=r==null?-1:this.#Ce(r),a=this.#Ce(n);if(i===-1||a===-1){let e=t?[...this.#B,n]:[n];this.#ae(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#be().slice(o,s+1),l=t?[...this.#B,...c]:c;this.#ae(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#G-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ie();let r=this.#be(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#B);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#ae([...o],this.#z??i,!1),this.#Fe(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Ne(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=Zi(t,n);return this.#r.canDrag?.(r)===!1?!1:(n.includes(t)||this.#ae([t],t,!1),this.#Pe(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#De(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=$i(t.draggedPaths,n);(ea(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}Qi(t.target,n)||(this.#i={...t,target:n},this.#De())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#De())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#De(),!1;let n=$i(e.draggedPaths,t);if(ea(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=na(e.draggedPaths,t);if(r==null)return this.#De(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#H.move(e.from,e.to,{collision:e.collision})}else this.#ce(r.operations),this.#H.batch(r.operations)}catch(e){return this.#De(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#H.add(e)}remove(e,t={}){this.#H.remove(e,t)}move(e,t,n={}){this.#H.move(e,t,n)}batch(e){this.#H.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Te(e,!0)}openSearch(e=``){this.#Te(e,!0)}closeSearch(){this.#Te(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#we(1)}focusPreviousSearchMatch(){this.#we(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#H.getPathInfo(e);if(n==null)return!1;let r=n.path,i=_a(r),a=ba(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of ma(r))this.#H.isExpanded(e)||this.#H.expand(e);return this.#ae([r],r,!1),this.#M!=null&&(this.#Te(null,!1),this.#y?.(this.#M)),this.#Pe(r),this.#T=r,this.#E=ya(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}[Ca](){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}}#q(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,_a(e)?{recursive:!0}:void 0);return}this.#Pe(e),this.#De()}#J(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,_a(e)?{recursive:!0}:void 0);return}let t=_a(e),n=qi({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:ba(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#Pe(e),this.#v?.(n.error),this.#De();return}if(n.sourcePath===n.destinationPath){this.#Pe(e),this.#De();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(xa(n.sourcePath,t),xa(n.destinationPath,t))}#Y(e){this.#T==null||this.#E===e||(this.#E=e,this.#De())}resetPaths(e,t={}){let n=this.#H.list().length,r=this.#G,i=ia({paths:e,preparedInput:t.preparedInput},`resetPaths`,this.#e.sort),a=this.#le(i.paths,i.preparedInput,t.initialExpandedPaths),o=this.#c,s=this.#T,c=this.getSelectedPaths(),l=this.#z;this.#K?.(),this.#H=a,this.#d.clear(),this.#he();let u=c.map(e=>a.getPathInfo(e)?.path??null).filter(e=>e!=null),d=!pa(this.#B,u);this.#B=new Set(u),d&&(this.#V+=1),this.#z=l==null?null:a.getPathInfo(l)?.path??null,this.#T=s==null?null:a.getPathInfo(s)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(o,o!=null||u.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:i.paths.length,pathCountBefore:n,projectionChanged:!0,usedPreparedInput:t.preparedInput!=null,visibleCountDelta:this.#G-r})}#X(e){this.#Ie();let t=ha(e),n=ga(e,t),r=null,i=null;for(let e of this.#be()){if(ha(e)!==t)continue;let a=ga(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Z(e){let t=this.#Ce(e);if(t!==-1)return t;let n=ma(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#Ce(t);if(r!==-1)return r}return this.#be().length>0?0:-1}#Q(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#H.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#oe(r.path):this.#se(r.path);return this.#d.set(r.path,i),i}#$(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===this.#c,isSelected:this.#B.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#ee(e){return this.#$(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#te(e,t){let n=this.#H.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ne(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ne(n),n];return this.#a.set(e,r),r}#re(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ne(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ie(e){this.#H.collapse(e)}#ae(e,t=this.#z,n=!0){let r=[...new Set(e)],i=!pa(this.#B,r),a=this.#z!==t;!i&&!a||(this.#B=new Set(r),this.#z=t,i&&(this.#V+=1),n&&this.#De())}#oe(e){return{collapse:()=>{this.#ie(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#ke(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#H.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#ze(e)}}}#se(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#ce(e){let t=this.#H.list();this.#le(t).batch(e)}#le(e,t,n){return new Oi({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ue(){return this.#h??=this.#H.list(),this.#h}#de(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ue()){e.add(t);for(let n of ma(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(va),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(va),this.#p}#he(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#ge(){return this.#pe().filter(e=>this.#H.isExpanded(e))}#_e(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#B)for(let n of ma(e))t.add(n);this.#ve(t)}#ve(e){this.#W=!0;try{for(let t of this.#pe()){let n=e.has(t),r=this.#H.isExpanded(t);n&&!r?this.#H.expand(t):!n&&r&&this.#H.collapse(t)}}finally{this.#W=!1}}#ye(){if(this.#M==null||this.#M.length===0){this.#k=[],this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let t=[],n=[],r=new Map;for(let[i,a]of e.entries())this.#N?.has(a)===!0&&(r.set(a,n.length),t.push(i),n.push(a));this.#F=t,this.#I=n,this.#P=r,this.#G=n.length}#be(){return this.#I??this.#b}#xe(e){return this.#I==null?this.#H.getVisibleIndex(e)??-1:this.#P?.get(e)??-1}#Se(e){return this.#F?.[e]??e}#Ce(e){return this.#P?.get(e)??this.#H.getVisibleIndex(e)??-1}#we(e){let t=this.#k;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Te(e,t){let n=e==null?null:Sa(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#ge()),this.#M=n,n==null)this.#_e(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else if(n.length===0)this.#_e(!1),this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else{let e=this.#Ee();this.#je(e,!0)}t&&(this.#y?.(this.#M),this.#De())}}#Ee(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ue(),n=this.#fe(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#pe(),s=this.#me();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#O=i;let c=this.#A===`hide-non-matches`&&r.length>0?new Set:null;this.#N=c;let l=this.#A===`expand-matches`?new Set(this.#j??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of ma(e))l.add(t),c?.add(t)}return this.#ve(l),a??this.#c}#De(){for(let e of this.#t)e()}#Oe(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#ke(e){for(let t of ma(e))this.#H.isExpanded(t)||this.#H.expand(t);this.#H.isExpanded(e)||this.#H.expand(e)}#Ae(e){let t=this.#G;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#F==null&&r>=this.#b.length&&this.#Ie(),this.#Fe(r))}#je(e,t=!0){let n=this.#H.getVisibleCount();this.#U=n;let r=Oa(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,wa)),e,t?e=>this.#H.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#ye(),this.#s=e==null?this.#be().length>0?0:-1:this.#Z(e),this.#c=this.#s<0?null:this.#Me(this.#s)}#Me(e){return this.#be()[e]??(this.#F==null?this.#H.getVisibleRowContext(e)?.row.path??null:null)}#Ne(e){return this.#H.getPathInfo(e)?.path??null}#Pe(e){if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t,!1)}#Fe(e,t=!0){let n=this.#Me(e);n!=null&&(this.#s===e&&this.#c===n||(this.#s=e,this.#c=n,t&&this.#De()))}#Ie(){this.#l||this.#je(this.#c,!0)}#Le(e){let t=ca(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=ca(this.#c,e,!0),r=[...this.#B].map(t=>ca(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=ca(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return pa(this.#B,o)||(this.#B=new Set(o),this.#V+=1),this.#z=a,n}#Re(){return this.#H.on(`*`,e=>{if(this.#W)return;e.canonicalChanged&&(this.#d.clear(),this.#he()),this.#i!=null&&aa(e)&&(this.#i=null);let t=aa(e)?this.#Le(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ee():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#je(n,r),this.#De();let i=fa(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},Aa=e=>{if(e==null||e.length===0)return`0`;let t=`${e.length}`;for(let n of e)t+=`\0${n.path}\0${n.status}`;return t};function ja(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1){if(!(e[t]===`/`||t===e.length)){r===-1&&(r=t);continue}r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1)}return n===``?null:{isDirectory:t,path:n}}function Ma(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function Na(e,t){return t?`${e}/`:e}function Pa(e,t=null){let n=Aa(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set;for(let t of e??[]){let e=ja(t.path);if(e==null)continue;let n=Na(e.path,e.isDirectory);r.set(n,t.status),t.status===`ignored`&&e.isDirectory?a.add(n):e.isDirectory&&a.delete(n);for(let t of Ma(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var G,Fa,Ia,La,Ra,za,Ba,Va,Ha,Ua,Wa={},Ga=[],Ka=Array.isArray,qa=Ga.slice,Ja=Object.assign;function Ya(e){e&&e.parentNode&&e.remove()}function Xa(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?qa.call(arguments,2):n),Za(e,o,r,i,null)}function Za(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Fa,__i:-1,__u:0};return i==null&&G.vnode!=null&&G.vnode(a),a}function Qa(e){return e.children}function $a(e,t){this.props=e,this.context=t,this.__g=0}function eo(e,t){if(t==null)return e.__?eo(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`?eo(e):null}function to(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 to(e)}}function no(e){(8&e.__g||!(e.__g|=8)||!Ia.push(e)||Ra++)&&La==G.debounceRendering||((La=G.debounceRendering)||queueMicrotask)(ro)}function ro(){for(var e,t,n,r,i,a,o,s,c=1;Ia.length;)Ia.length>c&&Ia.sort(za),e=Ia.shift(),c=Ia.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=Ja({},r)).__v=r.__v+1,G.vnode&&G.vnode(n),fo(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??eo(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,mo(a,n,o),n.__e!=i&&to(n)));Ra=0}function io(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||Ga,b=t.length;for(c=ao(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?Wa:y[m.__i]||Wa,m.__i=f,_=fo(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&_o(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=oo(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function ao(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?Za(null,o,null,null,null):Ka(o)?Za(Qa,{children:o},null,null,null):o.constructor==null&&o.__b>0?Za(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=so(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=eo(s)),vo(s,s));return r}function oo(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=oo(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=eo(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function so(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function co(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function lo(e,t,n,r,i){var a;n: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||co(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||co(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(Ba,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||={},e.__l[t+a]=n,n?r?n.l=r.l:(n.l=Va,e.addEventListener(t,a?Ua:Ha,a)):e.removeEventListener(t,a?Ua:Ha,a);else{if(i==`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 n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function uo(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=Va++;else if(t.u<n.l)return;return n(G.event?G.event(t):t)}}}function fo(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,ee,w,T,E,te,ne,D,O,k=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=G.__b)&&d(t);n:if(typeof k==`function`)try{if(v=t.props,y=`prototype`in k&&k.prototype.render,b=(d=k.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new k(v,x):(t.__c=f=new $a(v,x),f.constructor=k,f.render=yo),b&&b.sub(f),f.props=v,f.state||={},f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&k.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Ja({},f.__s)),Ja(f.__s,k.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&k.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&k.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,C=G.__r,ee=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),w=0;w<f._sb.length;w++)f.__h.push(f._sb[w]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++ee<25);f.state=f.__s,f.getChildContext!=null&&(r=Ja({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),T=d,d!=null&&d.type===Qa&&d.key==null&&(T=ho(d.props.children)),s=io(e,Ka(T)?T:[T],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null)if(e.then){for(E=0,te=!1,t.__u|=c?160:128,t.__c.__z=[],ne=0;ne<a.length;ne++)(D=a[ne])==null||te||(D.nodeType==8&&D.data==`$s`?(E>0&&t.__c.__z.push(D),E++,a[ne]=null):D.nodeType==8&&D.data==`/$s`?(--E>0&&t.__c.__z.push(D),te=E===0,s=a[ne],a[ne]=null):E>0&&(t.__c.__z.push(D),a[ne]=null));if(!te){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(O=a.length;O--;)Ya(a[O]);po(t)}else t.__e=n.__e,t.__k=n.__k,e.then||po(t);G.__e(e,t,n)}else s=t.__e=go(n.__e,t,n,r,i,a,o,c,l,u);return(d=G.diffed)&&d(t),128&t.__u?void 0:s}function po(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(po)}function mo(e,t,n){for(var r=0;r<n.length;r++)_o(n[r],n[++r],n[++r]);G.__c&&G.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){G.__e(e,t.__v)}})}function ho(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:Ka(e)?e.map(ho):Ja({},e)}function go(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&=(G.__m&&G.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=qa.call(e.childNodes),v=n.props||Wa,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;lo(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||lo(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),io(b==`template`?e.content:e,Ka(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&eo(n,0),s,c,l),a!=null)for(u=a.length;u--;)Ya(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||lo(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&lo(e,u,g,v[u],i))}return e}function _o(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(e){G.__e(e,n)}}function vo(e,t,n){var r,i;if(G.unmount&&G.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||_o(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){G.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&vo(r[i],t,n||typeof e.type!=`function`);n||Ya(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function yo(e,t,n){return this.constructor(e,n)}function bo(e,t){var n,r,i,a;t==document&&(t=document.documentElement),G.__&&G.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=Xa(Qa,null,[e]),i=[],a=[],fo(t,e,r||Wa,Wa,t.namespaceURI,r?null:t.firstChild?qa.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),mo(i,e,a)}function xo(e,t){e.__u|=32,bo(e,t)}G={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw Ra=0,e}},Fa=0,$a.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Ja({},this.state);typeof e==`function`&&(e=e(Ja({},n),this.props)),e&&Ja(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),no(this))},$a.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),no(this))},$a.prototype.render=Qa,Ia=[],Ra=0,za=function(e,t){return e.__v.__b-t.__v.__b},Ba=/(PointerCapture)$|Capture$/i,Va=0,Ha=uo(!1),Ua=uo(!0);var So=0;Array.isArray;function K(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--So,__i:-1,__u:0,__source:i,__self:a};return G.vnode&&G.vnode(l),l}var Co=16,wo=16,To={};function Eo({name:e,remappedFrom:t,token:n,width:r,height:i,viewBox:a,label:o,alignCapitals:s=!1}){"use no memo";let c=`#${e.replace(/^#/,``)}`,{width:l,height:u,viewBox:d}=To[e]??{width:Co,height:wo},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return K(`svg`,{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":s,...o==null?{"aria-hidden":!0}:{"aria-label":o,role:`img`},viewBox:m,width:f,height:p,children:K(`use`,{href:c})})}var Do=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},Oo=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},ko=e=>{if(e.length<4)return[e,``];let 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)]},Ao=(e,{splitIndex:t}={})=>{if(typeof t!=`number`){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}return[e.slice(0,t),e.slice(t)]},jo=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},Mo=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=t;return[e.slice(0,n),e.slice(n)]};function No({children:e,marker:t,variant:n=`default`}){"use no memo";return K(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:K(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?K(`span`,{"data-truncate-fade":!0}):t})})}function Po(e){"use no memo";let{mode:t,children:n}=e;return K(`div`,{children:[K(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?K(`span`,{children:n}):n}),K(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?K(`span`,{children:n}):n})]})}function Fo({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=K(Po,{mode:t,children:e},`content`),o=K(No,{marker:n,mode:t,variant:r},`marker`),s=K(`div`,{"data-truncate-fill":!0},`fill`);return K(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:K(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function Io({children:e,...t}){"use no memo";return K(Fo,{mode:`truncate`,...t,children:e})}function Lo({children:e,...t}){"use no memo";return K(Fo,{mode:`fruncate`,...t,children:e})}function Ro({children:e,contents:t,priority:n=`end`,split:r=`center`,minimumLength:i=12,className:a,style:o,...s}){"use no memo";let c=null,l=null;if(Array.isArray(t)){if(t.length!==2)return console.error(`MiddleTruncate: contents must be an array of two items`),null;c=K(Io,{...s,children:t[0]}),l=K(Lo,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return K(`div`,{className:a,style:o});if(e.length<i)return K(n===`end`?Lo:Io,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=Do:r===`extension`?t=Oo:r===`leaf-path`&&(t=ko);else if(typeof r==`number`)t=Ao,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=jo:e===`first`&&(t=Mo)}else typeof r==`function`&&(t=r);t??=Do;let[f,p]=t(e,{priority:n,variant:s.variant,splitIndex:typeof u==`number`?u:void 0,splitOffset:typeof d==`number`?d:void 0}),m=f.length>=p.length,h=n===`equal`&&!m,g=n===`equal`&&m,_={},v={};h&&(_.marker=``),g&&(v.marker=``),c=K(Io,{...s,..._,children:f}),l=K(Lo,{...s,...v,children:p})}return K(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[K(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),K(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var zo={endIndex:-1,startIndex:-1};function Bo(e,t,n){return Math.min(Math.max(e,t),n)}function Vo(e,t){return e<0||t<e?zo:{endIndex:t,startIndex:e}}function Ho(e){return e.startIndex<0||e.endIndex<e.startIndex}function Uo(e,t){return Ho(e)?0:(e.endIndex-e.startIndex+1)*t}function Wo(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function Go(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function Ko(e){let t=new Map;return e.forEach((e,n)=>{if(e.kind!==`directory`||!e.isExpanded)return;let r=e.ancestorPaths.length,i=t.get(r);if(i==null){t.set(r,[n]);return}i.push(n)}),t}function qo(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o==null)break;if(o<=t){i=a,n=a+1;continue}r=a-1}return i}function Jo(e){let t=new Map,n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=i.kind===`directory`&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths,o=0;for(;o<n.length&&o<a.length&&n[o]===a[o];)o+=1;for(let e=n.length-1;e>=o;--e){let i=n[e];i!=null&&t.set(i,r-1)}n.length=o;for(let e=o;e<a.length;e+=1){let t=a[e];t!=null&&n.push(t)}}let r=e.length-1;for(let e of n)t.set(e,r);return t}function Yo(e,t,n){if(e.length===0||t<=0)return[];let r=Jo(e),i=Ko(e),a=[];for(let r=0;r<e.length;r+=1){let o=i.get(r);if(o==null||o.length===0)break;let s=t+r*n,c=qo(o,Math.min(e.length-1,Math.floor(s/n))),l=null;for(;c>=0;){let t=o[c],n=t==null?null:e[t]??null;if(n!=null&&(r===0||n.ancestorPaths[r-1]===a[r-1]?.path)){l=n;break}--c}if(l==null)break;a.push(l)}return a.map((i,a)=>{let o=a*n,s=(r.get(i.path)??e.length-1)+1;if(s>=e.length)return{row:i,top:o};let c=s*n-t;return{row:i,top:Math.min(o,c-n)}}).filter(e=>e.top+n>0)}function Xo(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,i=Math.max(0,t.viewportHeight),a=Math.max(0,Math.floor(t.overscan)),o=Math.max(0,r-i),s=Bo(t.scrollTop,0,o),c=t.stickyRows??Yo(e,s,t.itemHeight),l=c.reduce((e,n)=>Math.max(e,n.top+t.itemHeight),0),u=Math.min(r,s+l),d=Math.max(0,i-l),f=Math.max(0,r-u),p=Wo(s,n,t.itemHeight),m=Wo(u,n,t.itemHeight),h=l<=0||p<0||p>=n?-1:p,g=h===-1?-1:Math.min(n-1,m-1),_=h===-1||g<h?0:g-h+1,v=d<=0||m>=n?zo:Vo(m,Go(u+d,n,t.itemHeight)),y=g+1,b=Ho(v)?zo:Vo(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=Uo(b,t.itemHeight);return{occlusion:{firstOccludedIndex:h,lastOccludedIndex:g,occludedCount:_},physical:{itemHeight:t.itemHeight,maxScrollTop:o,overscan:a,scrollTop:s,totalHeight:r,totalRowCount:n,viewportHeight:i},projected:{contentHeight:f,paneHeight:d,paneTop:u},sticky:{height:l,rows:c},visible:v,window:{endIndex:b.endIndex,height:x,offsetTop:Ho(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var Zo={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},Qo={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},$o=`Contains git status items`;function es(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i=0,viewportHeight:a}=e;if(n<0)return null;let o=Math.max(0,i),s=n*r,c=s+r;if(s<t+o){let e=Math.max(0,s-o);return e===t?null:e}if(c>t+a){let e=c-a;return e===t?null:e}return null}function ts(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return es({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:a,viewportHeight:s});if(n<0)return null;let c=Math.max(0,a),l=n*r,u=Math.max(0,s-c),d=i===`center`?c+Math.max(0,(u-r)/2):c,f=Math.max(0,o-s),p=Math.max(0,Math.min(l-d,f));return p===t?null:p}function ns(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}function rs(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function is(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let e=t.activeElement;return e instanceof HTMLElement?e:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function as(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function os(e,t){return e!=null&&e>0?e:t}function ss(e){let 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 cs(e,t,n,r,i=0){let a=es({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function ls(e,t,n,r,i,a,o=0){let s=ts({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s==null?!1:(e.scrollTop=s,!0)}function us(e,t,n,r,i,a){let o=ns({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function ds(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function fs(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function ps({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return K(`input`,{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:i,onInput:a,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}function ms(e){let{row:t,mode:n,targetPath:r,ariaLabel:i,domId:a,isParked:o,itemHeight:s,features:c,state:l,extraStyle:u}=e,d=n===`sticky`,f=t.ancestorPaths.at(-1)??``,p={};return l.isFocusRinged&&(p[`data-item-focused`]=!0),t.isSelected&&(p[`data-item-selected`]=!0),l.isContextHovered&&(p[`data-item-context-hover`]=`true`),l.isDragTarget&&(p[`data-item-drag-target`]=!0),l.isDragging&&(p[`data-item-dragging`]=!0),l.effectiveGitStatus!=null&&(p[`data-item-git-status`]=l.effectiveGitStatus),l.containsGitChange&&(p[`data-item-contains-git-change`]=`true`),{"aria-expanded":!d&&t.kind===`directory`?t.isExpanded:void 0,"aria-haspopup":c.contextMenuEnabled?`menu`:void 0,"aria-label":i,"aria-level":d?void 0:t.level+1,"aria-posinset":d?void 0:t.posInSet+1,"aria-selected":d?void 0:t.isSelected?`true`:`false`,"aria-setsize":d?void 0:t.setSize,"data-file-tree-sticky-path":d?r:void 0,"data-file-tree-sticky-row":d?`true`:void 0,"data-item-context-menu-button-visibility":c.actionLaneEnabled?c.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":c.contextMenuEnabled?c.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":c.actionLaneEnabled?`true`:void 0,"data-item-has-git-lane":c.gitLaneActive?`true`:void 0,"data-item-parent-path":f.length>0?f:void 0,"data-item-parked":o?`true`:void 0,"data-item-path":r,"data-item-type":t.kind===`directory`?`folder`:`file`,"data-type":`item`,id:d?void 0:a,role:d?void 0:`treeitem`,style:{minHeight:`${s}px`,...u},tabIndex:!d&&t.isFocused?0:-1,...p}}function hs(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:i}=e,a=t.ctrlKey||t.metaKey,o=t.shiftKey||a,s=t.shiftKey?{additive:a,kind:`range`}:a?{kind:`toggle`}:{kind:`single`};return{closeSearch:r,revealCanonical:n===`sticky`,selection:s,toggleDirectory:!o&&i}}var gs,q,_s,vs,ys=Object.is,bs=0,xs=[],J=G,Ss=J.__b,Cs=J.__r,ws=J.diffed,Ts=J.__c,Es=J.unmount,Ds=J.__;function Os(e,t){J.__h&&J.__h(q,e,bs||t),bs=0;var n=q.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function ks(e){return bs=1,As(Vs,e)}function As(e,t,n){var r=Os(gs++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Vs(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);ys(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=q,!q.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,ys(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};q.__f=!0;var a=q.shouldComponentUpdate,o=q.componentWillUpdate;q.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},q.shouldComponentUpdate=i}return r.__N||r.__}function js(e,t){var n=Os(gs++,3);!J.__s&&Bs(n.__H,t)&&(n.__=e,n.u=t,q.__H.__h.push(n))}function Ms(e,t){var n=Os(gs++,4);!J.__s&&Bs(n.__H,t)&&(n.__=e,n.u=t,q.__h.push(n))}function Y(e){return bs=5,Ns(function(){return{current:e}},[])}function Ns(e,t){var n=Os(gs++,7);return Bs(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Ps(e,t){return bs=8,Ns(function(){return e},t)}function Fs(){for(var e;e=xs.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Rs),e.__H.__h.forEach(zs),e.__H.__h=[]}catch(t){e.__H.__h=[],J.__e(t,e.__v)}}J.__b=function(e){q=null,Ss&&Ss(e)},J.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ds&&Ds(e,t)},J.__r=function(e){Cs&&Cs(e),gs=0;var t=(q=e.__c).__H;t&&(_s===q?(t.__h=[],q.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(Rs),t.__h.forEach(zs),t.__h=[],gs=0)),_s=q},J.diffed=function(e){ws&&ws(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(xs.push(t)!==1&&vs===J.requestAnimationFrame||((vs=J.requestAnimationFrame)||Ls)(Fs)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),_s=q=null},J.__c=function(e,t){t.some(function(e){try{e.__h.forEach(Rs),e.__h=e.__h.filter(function(e){return!e.__||zs(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],J.__e(n,e.__v)}}),Ts&&Ts(e,t)},J.unmount=function(e){Es&&Es(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{Rs(e)}catch(e){t=e}}),n.__H=void 0,t&&J.__e(t,n.__v))};var Is=typeof requestAnimationFrame==`function`;function Ls(e){var t,n=function(){clearTimeout(r),Is&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Is&&(t=requestAnimationFrame(n))}function Rs(e){var t=q,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),q=t}function zs(e){var t=q;e.__c=e.__(),q=t}function Bs(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!ys(t,e[n])})}function Vs(e,t){return typeof t==`function`?t(e):t}function Hs(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:K(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return K(Qa,{children:[K(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:K(Io,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function Us(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function Ws(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function Gs(e,t,n,r){return e.map((e,i)=>{let a=i*n,o=e.subtreeEndIndex+1;if(o>=r)return{row:e.row,top:a};let s=o*n-t;return{row:e.row,top:Math.min(a,s-n)}}).filter(e=>e.top+n>0)}function Ks({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:i,viewportHeight:a}){let o=e.getVisibleCount(),s=i&&o>0?e.getStickyRowCandidates(r,t):[],c=s==null&&i&&o>0?e.getVisibleRows(0,o-1):[],l=Xo(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:Gs(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?Gs(u,1,t,o):i&&r<=0&&c.length>0?Yo(c,1,t):l.sticky.rows;return{overlayHeight:d.reduce((e,n)=>Math.max(e,n.top+t),0),overlayRows:d,snapshot:l,visibleRows:c}}var qs=400,Js=10,Ys=40,Xs=18;function Zs(e,t,n){let r=e,i=document.elementFromPoint?.bind(document)??null,a=r.elementFromPoint?.(t,n)??i?.(t,n)??null;return e instanceof ShadowRoot&&(a==null||!e.contains(a))?Qs(e,t,n):a instanceof HTMLElement?a:null}function Qs(e,t,n){let r=Array.from(e.querySelectorAll(`[data-type="item"], [data-item-flattened-subitem]`));for(let e=r.length-1;e>=0;e--){let i=r[e],a=i.getBoundingClientRect();if(t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom)return i}return null}function $s(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function ec(e){let 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 tc(){return navigator.vendor!==`Apple Computer, Inc.`}function nc(e,t){let n=e-t.top;if(n<Ys)return-Math.ceil((Ys-Math.max(0,n))/Ys*Xs);let r=t.bottom-e;return r<Ys?Math.ceil((Ys-Math.max(0,r))/Ys*Xs):0}function rc(e,t){if(e!=null){let t=Zo[e];return t==null?null:{text:t,title:Qo[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:$o}:null}function ic(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=n.get(a);if(o!=null){for(let e of r)n.set(e,o);return o?`ignored`:null}if(t.has(a)){n.set(a,!0);for(let e of r)n.set(e,!0);return`ignored`}r.push(a)}for(let e of r)n.set(e,!1);return null}function ac(e){return e!=null&&`toggle`in e}function oc(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function sc(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function cc(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function lc(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function uc(e,t){return t&&lc(e)||(e.ctrlKey||e.metaKey)&&oc(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var dc=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function fc(e){for(let 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 pc(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 mc(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function hc(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function gc(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function _c(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let i=n.get(e)??null;return i?.dataset.itemParked===`true`?null:i}function vc(e){if(e==null)return[];let t=[];for(let n of e.querySelectorAll(`button[data-file-tree-sticky-row="true"]`)){if(!(n instanceof HTMLElement))continue;let e=n.dataset.fileTreeStickyPath;e!=null&&t.push(e)}return t}function yc(e,t){if(e==null||t==null)return null;for(let 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 bc(e,t,n,r,i,a,o){let s=Math.max(0,a-i),c=t?.getBoundingClientRect()??null,l=c==null||n==null?null:n.getBoundingClientRect().top-c.top,u=yc(e,r),d=c==null||u==null?null:u.getBoundingClientRect().top-c.top;return Math.max(0,Math.min(d??Math.max(l??0,s),Math.max(0,o-i)))}function xc(e,t){return{kind:e.kind,name:Ws(e),path:t}}function Sc(e){return e==null?void 0:`${e}__tree`}function Cc(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function wc(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function Tc(e,t){if(e==null)return null;if(`text`in e)return K(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?wc(e.icon)?t(e.icon):{name:e.icon}:wc(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return K(`span`,{title:e.title,children:K(Eo,{...n})})}function Ec(e){e!=null&&rs(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function Dc(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:i=!1,dragTargetFlattenedSegmentPath:a=null,gitDecoration:o=null,gitLaneActive:s=!1,renameInput:c=null,showDecorativeActionAffordance:l=!1}={}){let u=Us(e);return K(Qa,{children:[e.depth>0?K(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>K(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,K(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?K(Eo,{...t(`file-tree-icon-chevron`)}):K(Eo,{...t(`file-tree-icon-file`,u)})}),K(`div`,{"data-item-section":`content`,children:e.isFlattened?Hs(e,c,a):c??K(Ro,{minimumLength:5,split:`extension`,children:e.name})}),i?K(`div`,{"data-item-section":`decoration`,children:r==null?null:Tc(r,t)}):null,s?K(`div`,{"data-item-section":`git`,children:Tc(o,t)}):null,n?K(`div`,{"data-item-section":`action`,children:l?K(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:K(Eo,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function Oc(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,contextMenuEnabled:S,contextMenuTriggerMode:C,contextMenuButtonTriggerEnabled:ee,contextMenuButtonVisibility:w,contextMenuRightClickEnabled:T,registerRenameInput:E,registerButton:te,resolveIcon:ne,renderDecorationForRow:D,openContextMenuForRow:O,onRowClick:k,onKeyDown:A}=e,j=Us(t),{isParked:M=!1,mode:re=`flow`,style:ie}=r,ae=re===`sticky`,oe=_?.get(j)??null??ic(t.ancestorPaths,v,y),se=t.kind===`directory`&&(b?.has(j)??!1),ce=D(t,j),le=rc(oe,se),ue=S&&ee,de=ce!=null||x||ue,fe=ue&&w===`always`,pe=a.getPath()===j,me=pe?a.getValue():``,N=ae||!pe?null:K(ps,{ref:E,ariaLabel:`Rename ${Ws(t)}`,isFlattened:t.isFlattened,value:me,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),he=Dc(t,ne,{actionLaneEnabled:ue,customDecoration:ce,decorationLaneEnabled:de,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:le,gitLaneActive:x,renameInput:N,showDecorativeActionAffordance:fe}),ge={...ms({ariaLabel:Ws(t),domId:t.isFocused?Cc(h,j,M):void 0,extraStyle:ie,features:{actionLaneEnabled:ue,contextMenuButtonVisibility:ue?w:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:M,itemHeight:g,mode:re,row:t,state:{containsGitChange:se,effectiveGitStatus:oe,isContextHovered:s===j,isDragTarget:l?.kind===`directory`&&l.directoryPath===j,isDragging:c?.has(j)===!0,isFocusRinged:t.isFocused&&o===j},targetPath:j}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),T&&(i.focusMountedPathFromInput(j),O(t,j,{anchorRect:mc(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:ae?void 0:()=>{i.focusMountedPathFromInput(j)},onKeyDown:ae?void 0:A,ref:e=>{te(j,e)}};return!ae&&pe?K(`div`,{...ge,children:he}):K(`button`,{...ge,type:`button`,draggable:u&&!M,onDragEnd:u&&!M?p:void 0,onDragStart:u&&!M?e=>{f(e,t,j)}:void 0,onMouseDown:e=>{if(ae){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!M?e=>{m(e,t,j)}:void 0,onClick:e=>{k(e,t,j,re)},children:he})}function kc(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(Us(e))).map((n,r)=>Oc(e,n,t.start+r))}function Ac({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=Mi,overscan:c=10,renamingEnabled:l=!1,renderRowDecoration:u,searchBlurBehavior:d=`close`,searchEnabled:f=!1,searchFakeFocus:p=!1,slotHost:m,stickyFolders:h=!1,initialViewportHeight:g=420}){"use no memo";let _=Y(null),v=Y(null),y=Y(!1),b=Y(null),x=Y(null),S=Y(null),C=Y(null),ee=Y(null),w=Y(new Map),T=Y(new Map),E=Y(()=>{}),te=Y(null),ne=Y(0),D=Y(!1),O=Y(null);O.current!==t&&(D.current=!1,O.current=t);let k=Y(!1),A=Y(null),j=Y(null),M=Y(!1),re=Y(null),ie=Y(null),ae=Y(null),oe=Y(null),se=Y(null),ce=Y(null),le=Y(null),ue=Y(null),de=Y(!1),fe=Y(null),pe=Y(null),me=Y(null),N=Y(null),he=Ns(()=>new Map,[]),[,ge]=ks(0),[_e,ve]=ks(null),[ye,be]=ks(null),[xe,Ce]=ks(null),[we,Te]=ks(null),[Ee,De]=ks(0),[P,Oe]=ks(null),ke=Y(P);ke.current=P;let Ae=Y(null),je=Y(null),Me=Y(null),Ne=Y(null),Pe=Y(null),Fe=Y(!1),Ie=()=>{je.current=null,Me.current=null,Ne.current=null},Le=(e,t)=>{je.current=e,Me.current=null,Ne.current=t==null?null:{path:e,scrollTop:t}},Re=(e,t)=>{je.current=null,Me.current={path:e,viewportOffset:t},Ne.current=null},ze=Y(d===`retain`&&t.isSearchOpen()),[Be,Ve]=ks(p);js(()=>{p||Ve(!1)},[p]);let He=Y(!1),Ue=Ps(()=>{He.current=!0,Ve(e=>e&&!1)},[]),[We,Ge]=ks(()=>Ks({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Ke,qe]=ks(!1);js(()=>{qe(!0)},[]);let Je=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Ye=e?.contextMenu?.triggerMode??(Je?`right-click`:`both`),Xe=Ye===`both`||Ye===`button`,Ze=e?.contextMenu?.buttonVisibility??`when-needed`,Qe=Ye===`both`||Ye===`right-click`;Ms(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;Pe.current=t,be(t),Te(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(Fe.current=e.detail?.disabled===!0)};return e.addEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.addEventListener(`file-tree-debug-set-scroll-suppression`,n),()=>{e.removeEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.removeEventListener(`file-tree-debug-set-scroll-suppression`,n)}},[]);let $e=Ps((e,t)=>{gc(w.current,e,t)},[]),et=Ps((e,t)=>{gc(T.current,e,t)},[]),tt=Ps(e=>{x.current=e},[]),at=Ps(e=>_c(e,T.current,w.current),[]),ot=n!=null||r!=null||i!=null,{resolveIcon:st}=Ns(()=>Se(a),[a]),ct=t[Ca](),lt=ct.getPath(),ut=lt!=null,dt=t.isSearchOpen(),ft=t.getSearchValue(),F=t.getFocusedPath(),I=t.getFocusedIndex(),pt=t.getScrollRequest(),mt=t.isDragAndDropEnabled(),ht=t.getDragSession(),gt=Ns(()=>ht==null?null:new Set(ht.draggedPaths),[ht]),_t=ht?.target??null,vt=ht?.primaryPath??null,yt=Sc(o),{overlayHeight:bt,overlayRows:xt,snapshot:L,visibleRows:St}=We,R=L.physical.viewportHeight,z=Ns(()=>({end:L.window.endIndex,start:L.window.startIndex}),[L.window.endIndex,L.window.startIndex]),Ct=xt,B=L.sticky.rows,wt=L.physical.totalHeight,Tt=L.sticky.height,Et=Ns(()=>new Set(B.map(e=>Us(e.row))),[B]),Dt=I>=0&&I>=z.start&&I<=z.end,Ot=Ps((e,t)=>u?.({item:xc(e,t),row:e})??null,[u]),V=Ps(e=>rs(e==null?null:w.current.get(e)??null)?!0:rs(S.current),[]),kt=Ps(e=>{V(t.focusNearestPath(e))},[t,V]),At=Y(kt);At.current=kt;let jt=Y(!0),Mt=Y(()=>{}),Nt=Ps((t=!0)=>{let n=ke.current;n!=null&&(jt.current=jt.current&&t,Oe(null),e?.contextMenu?.onClose?.(),jt.current&&kt(n.path))},[e?.contextMenu,kt]);Mt.current=Nt;let Pt=Ps(e=>{let t=e==null?null:hc(S.current,e);Ce(e=>e===t?e:t)},[]),Ft=Ps((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=at(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Le(n,e?.scrollTop??null),k.current=!0,ve(e=>e===n?e:n)}i.focus(),Pt(a),jt.current=!0,Oe({anchorRect:r?.anchorRect??null,item:xc(e,n),path:n,source:r?.source??`keyboard`})},[t,at,Pt]),It=Ps(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=as(e,R);re.current=I<0||e==null?null:Math.max(0,Math.min(I*s-e.scrollTop,Math.max(0,t-s))),M.current=!0}t.startRenaming(e)!==!1&&(Te(`focus`),ge(e=>e+1))}},[t,I,s,l,R]),Lt=Ps((e,{restoreTreeFocus:n=!0,targetOffset:r=`live-overlay`}={})=>{let i=C.current;if(i==null)return!1;t.focusPath(e);let a=t.getFocusedIndex();if(a<0)return!1;let o=t.getVisibleRows(a,a)[0]??null;if(o==null)return!1;let l=as(i,R),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:Ks({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return k.current=!0,us(i,a,s,l,u,d),E.current(),Ae.current=n?e:null,!0},[t,s,c,R,h]),Rt=()=>y.current===!0||N.current!=null||de.current===!0,zt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Bt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},Vt=()=>{oe.current!=null&&(clearTimeout(oe.current),oe.current=null),ae.current=null},Ht=()=>{ce.current?.remove(),ce.current=null},Ut=()=>{Bt(ie.current),ie.current=null,se.current=null},Wt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Gt=()=>{ue.current?.(),ue.current=null,N.current!=null&&(clearTimeout(N.current),N.current=null),de.current=!1,fe.current=null,me.current=null,pe.current!=null&&(pe.current.setAttribute(`draggable`,`true`),pe.current.style.removeProperty(`touch-action`),pe.current=null),Ht(),Vt(),Ut(),le.current=null},Kt=(e,n)=>{let r=S.current?.getRootNode(),i=$s(Zs(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},qt=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Vt();return}let r=t.getItem(e.directoryPath),i=ac(r)?r:null;if(i==null||i.isExpanded()){Vt();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;ae.current!==a&&(Vt(),ae.current=a,oe.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind!==`directory`||n.directoryPath!==e.directoryPath||n.flattenedSegmentPath!==e.flattenedSegmentPath||i.expand()},n))},Jt=()=>{ie.current=null;let e=se.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=nc(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,E.current()),qt(Kt(e.clientX,e.clientY)),ie.current=zt(Jt)},Yt=(e,t)=>{se.current={clientX:e,clientY:t},ie.current??=zt(Jt)},Xt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Gt(),Ht(),Vt(),Ut(),t.startDrag(r)===!1){e.preventDefault();return}if(le.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),tc())){let t=ec(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Wt(t),ce.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Zt=()=>{Ht(),Vt(),Ut(),le.current=null,t.cancelDrag()},Qt=(e,n,r)=>{if(N.current!=null||de.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;me.current={clientX:i.clientX,clientY:i.clientY},pe.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!de.current;N.current!=null&&(clearTimeout(N.current),N.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),ue.current===o&&(ue.current=null),t&&(a.setAttribute(`draggable`,`true`),pe.current===a&&(pe.current=null),me.current=null)},s=e=>{let t=e.touches[0],n=me.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=Js*Js||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),ue.current=o,N.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),pe.current===a&&(pe.current=null),me.current=null;return}de.current=!0,pe.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),le.current=n;let e=a.getBoundingClientRect(),s=ec(a);Object.assign(s.style,{height:`${e.height}px`,opacity:`0.85`,transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),Wt(s),ce.current=s,fe.current={x:i.clientX-e.left,y:i.clientY-e.top};let c=e=>{let t=e.touches[0];if(t==null)return;e.preventDefault();let n=fe.current;n!=null&&ce.current!=null&&(ce.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),qt(Kt(t.clientX,t.clientY)),Yt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Kt(n.clientX,n.clientY),t.completeDrag(),Gt()},u=()=>{t.cancelDrag(),Gt()};ue.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},qs)},$t=e=>{if(P!=null){if(e.key===`Escape`){Nt(),e.preventDefault(),e.stopPropagation();return}dc.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(ct.isActive()){if(e.key===`Escape`)ct.cancel();else if(e.key===`Enter`)ct.commit();else return;Te(`focus`),ge(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){It(F??void 0),e.preventDefault(),e.stopPropagation();return}if(dt){if(e.key===`Escape`)M.current=!1,re.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=as(n,R);re.current=I<0||n==null?null:Math.max(0,Math.min(I*s-n.scrollTop,Math.max(0,r-s))),M.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;Te(`focus`),ge(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&sc(e)){t.openSearch(e.key),ge(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Je&&lc(e),r=uc(e,Je),i=r&&S.current!=null?is(S.current):null,a=r?new Set(vc(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==F&&a.has(o)){let e=C.current;Le(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=ac(p)?p:null,h=u!=null&&(Et.has(u)||c&&o===u&&a.has(u)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=C.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&u!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=_c(u,T.current,w.current);e==null||n==null?y=!1:Ft(e,u)}else if((e.ctrlKey||e.metaKey)&&oc(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;Te(`focus`);let b=t.getFocusedPath(),x=b!=null&&(Et.has(b)||a.has(b)),ee=g&&b!==u,E=n&&c&&o===u&&b===u;if((h||E)&&b!=null&&(ee&&x||E))Le(b,v?.scrollTop??null),k.current=!0,ve(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Re(b,bc(S.current,v,i,u,s,Tt,R)),k.current=!0,ve(e=>e===b?e:b)):Ie()}ge(e=>e+1),e.preventDefault(),e.stopPropagation()};Ms(()=>{if(!(!f||!dt)){if(ze.current){ze.current=!1;return}rs(ee.current)}},[dt,f]),Ms(()=>{let e=x.current;switch(fs({hasRenderedInput:e!=null,previousRenamingPath:j.current,renamingPath:lt})){case`reset`:j.current=null;return;case`reveal-canonical`:lt!=null&&Lt(lt,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(Ae.current=null,j.current=lt,rs(e),e.select());return}},[z.end,z.start,lt,Lt,Et]),Ms(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=is(e)?.dataset.itemPath??null;ve(e=>e===t?e:t)},i=()=>{n(),k.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,is(e)!=null){r();return}k.current=!1,ve(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),k.current=!1,ve(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;ve(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),Ms(()=>{let e=S.current;e!=null&&(L.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[L.physical.scrollTop]),Ms(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;te.current=as(n,g);let a=()=>{let e=t.getVisibleCount(),r=os(te.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Ge(Ks({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!D.current){D.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=os(te.current,g),i=t.getVisibleRows(e,e)[0]??null;cs(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}E.current=a;let o=!1,l=t.subscribe(()=>{o?ge(e=>e+1):o=!0,a()}),u=()=>{Fe.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,De(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||Fe.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),ke.current!=null&&y.current&&Mt.current(),Fe.current===!0){y.current=!1;return}be(e=>e==null?e:null),u()},_=()=>{u(),p()},v=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),x=e=>{v.has(e.key)&&_()};n.addEventListener(`scroll`,m,{passive:!0}),n.addEventListener(`wheel`,_,{passive:!0}),n.addEventListener(`touchmove`,_,{passive:!0}),n.addEventListener(`keydown`,x);let ee=typeof ResizeObserver<`u`?new ResizeObserver(e=>{te.current=(e[0]==null?null:ss(e[0]))??as(n,g),a()}):null;return ee?.observe(n),()=>{E.current=()=>{},l(),n.removeEventListener(`scroll`,m),n.removeEventListener(`wheel`,_),n.removeEventListener(`touchmove`,_),n.removeEventListener(`keydown`,x),e!=null&&clearTimeout(e),d!=null&&clearTimeout(d),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,te.current=null,ee?.disconnect()}},[t,g,s,c,h]),Ms(()=>{Je||P==null||Nt(!1)},[Nt,Je,P]);let en=Ns(()=>P==null?null:`${P.path}::${P.source}`,[P]);Ms(()=>{if(en==null){m?.clearSlotContent(rt);return}let t=ke.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??pc(n.getBoundingClientRect()),close:e=>{Mt.current(e?.restoreFocus??!0)},restoreFocus:()=>{jt.current&&At.current(ke.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(rt,i),e?.contextMenu?.onOpen?.(t.item,r),Ec(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&Ec(i)}),()=>{m?.clearSlotContent(rt)}},[en,e?.contextMenu,m]),Ms(()=>{P!=null&&t.getItem(P.path)==null&&Nt()},[Nt,P,t]),Ms(()=>{if(P==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(fc(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&Nt())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Nt())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[Nt,P]),Ms(()=>{let e=C.current,n=S.current;if(e==null||n==null){A.current=F;return}let r=F==null?null:w.current.get(F)??null,i=is(n),a=i?.dataset.itemPath??null,o=ut&&x.current===i,c=f&&ee.current===i,l=M.current&&!dt,u=re.current??0,d=Ae.current,p=je.current,m=Me.current,g=Ne.current,_=i!=null,v=k.current||_,y=A.current!==F,b=p!=null&&p===F&&F!=null,T=!1,te=!1;if(pt!=null&&pt.id!==ne.current){ne.current=pt.id;let n=pt.visibleIndex,r=t.getVisibleRows(n,n)[0]??null;if(r!=null){let t=h?Math.max(0,Math.min(r.ancestorPaths.length*s,Math.max(0,R-s))):Tt;T=!0,te=ls(e,n,s,R,wt,pt.offset,t)}t.clearScrollRequest(pt.id)}let D=!T&&l&&us(e,I,s,R,wt,u),O=!T&&d!=null&&d===F&&us(e,I,s,R,wt,Tt),j=!T&&m!=null&&m.path===F&&us(e,I,s,R,wt,m.viewportOffset),ie=!T&&g!=null&&g.path===F&&e.scrollTop!==g.scrollTop;if(ie&&(e.scrollTop=g.scrollTop),(ie||te||O||j||D||v&&y&&d!==F&&!b&&cs(e,I,s,R,Tt))&&E.current(),T){A.current=F;return}if(!v){A.current=F;return}if(o){A.current=F;return}if(c&&!l){A.current=F;return}if(r==null){l&&I>=0&&(us(e,I,s,R,wt,u),E.current()),A.current=F;return}(y||l||d===F||p===F||m?.path===F||g?.path===F||a==null||a!==F)&&(rs(r),d===F&&(Ae.current=null),p===F&&(je.current=null),m?.path===F&&(Me.current=null),g?.path===F&&(Ne.current=null),M.current=!1,re.current=null),A.current=F},[t,I,F,Dt,s,ut,dt,z,R,f,pt,h,Tt,wt,St]);let tn=I>=0&&I>=L.visible.startIndex&&I<=L.visible.endIndex,nn=F!=null&&Ct.some(e=>Us(e.row)===F),rn=tn||nn,an=Xe&&k.current===!0&&rn?F:null,on=we===`pointer`?ye:null,sn=P?.path??Pe.current??on??an??ye,cn=P?.source===`right-click`;Ms(()=>{y.current&&P==null||Pt(at(sn))},[P,at,z,R,Ee,Ct,sn,Pt,St]);let ln=Ps(e=>{if(y.current||fc(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&Te(e=>e===`pointer`?e:`pointer`),be(e=>e===i?e:i)},[]),un=Ps(()=>{be(null)},[]);Ms(()=>{if(!mt)return;let e=()=>{Gt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Gt(),t.cancelDrag()}},[t,mt]);let dn=e=>{if(!mt||t.getDragSession()==null||de.current)return;let n=$s(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),qt(t.getDragSession()?.target??null),Yt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},fn=e=>{if(!mt||t.getDragSession()==null||de.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Vt(),Ut(),t.setDragTarget(null))},pn=e=>{!mt||t.getDragSession()==null||de.current||(e.preventDefault(),Kt(e.clientX,e.clientY),t.completeDrag(),Ht(),Vt(),Ut(),le.current=null)},mn=L.window.height,hn=L.window.offsetTop,gn=Math.min(0,R-mn),_n=Math.min(0,R-mn-Tt),vn=_e===F||M.current,yn=F!=null&&vn&&!Dt&&I>=0?St[I]??t.getVisibleRows(I,I)[0]??null:null,bn=yn==null?null:ds(I,s,z,mn),xn=le.current,Sn=vt!=null&&xn!=null&&xn.path===vt&&xn.index>=z.start&&xn.index<=z.end,Cn=vt!=null&&xn!=null&&xn.path===vt&&!Sn&&xn.path!==yn?.path?xn:null,wn=Cn==null?null:ds(Cn.index,s,z,mn),Tn=cc((I>=0?St[I]??t.getVisibleRows(I,I)[0]??null:null)?.ancestorPaths.at(-1)??null),En=dt&&F!=null?Cc(o,F,!Dt):void 0,Dn=P?.path??(dt?F:_e),On=P?.path??ye,kn=at(sn),An=Je&&Xe&&!cn&&!ut&&kn!=null&&xe!=null&&sn!=null,jn=Je&&(An||P!=null),Mn=P?.anchorRect,Nn=Mn==null&&kn!=null&&xe!=null&&(P!=null||An)?xe:null,Pn=Mn==null?Nn==null?void 0:{top:`${Nn}px`}:{left:`${Mn.left}px`,position:`fixed`,right:`auto`,top:`${Mn.top}px`},Fn=cn?{opacity:`0`}:void 0,In=Ps((e,n,r,i)=>{let a=hs({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:dt,mode:i}),o=a.toggleDirectory&&n.kind===`directory`,s=o?t.resolveMountedDirectoryPathFromInput(r):null;if(o&&s==null)return;let c=s??r;switch(a.selection.kind){case`range`:t.selectPathRange(c,a.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(c);break;case`single`:t.selectOnlyMountedPathFromInput(c);break}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=L.visible.startIndex&&n.index<=L.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(k.current=!0,ve(e=>e===c?e:c),Te(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&Lt(c,{targetOffset:`sticky-parents`})},[t,dt,L.visible.endIndex,L.visible.startIndex,Lt]),Ln=()=>{if(y.current||!Xe||sn==null||kn==null)return;let e=t.getItem(sn);e!=null&&(Pt(kn),jt.current=!0,Oe({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:kn.getAttribute(`aria-label`)??sn,path:e.getPath()},path:e.getPath(),source:`button`}))},Rn={contextHoverPath:On,contextMenuButtonTriggerEnabled:Xe,contextMenuButtonVisibility:Ze,contextMenuEnabled:Je,contextMenuRightClickEnabled:Qe,contextMenuTriggerMode:Ye,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:mt,draggedPathSet:gt,dragTarget:_t,gitLaneActive:ot,gitStatusByPath:n,handleRowDragEnd:Zt,handleRowDragStart:Xt,handleRowTouchStart:Qt,ignoredGitDirectories:r,ignoredInheritanceCache:he,instanceId:o,itemHeight:s,onKeyDown:$t,onRowClick:In,openContextMenuForRow:Ft,registerButton:$e,registerRenameInput:tt,renameView:ct,renderDecorationForRow:Ot,resolveIcon:st,shouldSuppressContextMenu:Rt,visualFocusPath:Dn},zn={...Rn,registerButton:et};return K(`div`,{ref:S,id:yt,"data-file-tree-context-menu-button-visibility":Je&&Xe?Ze:void 0,"data-file-tree-context-menu-trigger-mode":Je?Ye:void 0,"data-file-tree-has-context-menu-action-lane":Je&&Xe?`true`:void 0,"data-file-tree-has-git-lane":ot?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:mt?fn:void 0,onDragOver:mt?dn:void 0,onDrop:mt?pn:void 0,onKeyDown:$t,onPointerLeave:Je?un:void 0,onPointerOver:Je?ln:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[K(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:Tn}}),K(`slot`,{name:nt,"data-type":`header-slot`}),f?K(`div`,{"data-file-tree-search-container":!0,"data-open":dt?`true`:`false`,children:K(`input`,{ref:ee,"aria-activedescendant":En,"aria-controls":yt,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Be?`true`:void 0,value:ft,onBlur:()=>{d===`retain`&&!He.current||t.closeSearch()},onFocus:Ue,onPointerDown:Ue,onInput:e=>{Ue();let n=e.currentTarget;t.setSearch(n.value)}})}):null,K(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Ke&&Ct.length>0?K(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:K(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${bt}px`},children:Ct.map((e,t)=>Oc(zn,e.row,`sticky:${Us(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${Ct.length-t}`}}))})}):null,K(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${wt}px`},children:[K(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${hn}px`}}),K(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${mn}px`,top:`${gn}px`,bottom:`${_n}px`},children:[kc(Rn,z,Et),yn!=null&&bn!=null?Oc(Rn,yn,`parked:${yn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:vt===yn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${bn}px`}}):null,Cn!=null&&wn!=null?Oc(Rn,Cn,`parked-drag:${Cn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${wn}px`}}):null]})]})]}),Je?K(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":jn?`true`:`false`,style:Pn,children:[K(`button`,{ref:v,type:`button`,"data-type":it,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":P==null?`false`:`true`,"data-visible":An?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),P!=null){Nt();return}Ln()},tabIndex:-1,style:Fn,children:K(Eo,{...st(`file-tree-icon-ellipsis`)})}),P==null?null:K(`slot`,{name:rt})]}):null,P==null?null:K(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),Nt()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),Nt()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var jc={hydrateRoot:(e,t)=>{xo(Xa(Ac,t),e)},renderRoot:(e,t)=>{bo(Xa(Ac,t),e)},unmountRoot:e=>{bo(null,e)}};function Mc(e,t){jc.renderRoot(e,t)}function Nc(e,t){jc.hydrateRoot(e,t)}function Pc(e){jc.unmountRoot(e)}var Fc=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#n(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#i(e);for(let[e,t]of this.#e)this.#r(e,t)}}setSlotContent(e,t){let n=this.#n(e);if(n===t){t!=null&&(this.#e.set(e,t),this.#r(e,t));return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#r(e,t)}setSlotHtml(e,t){let n=t?.trim()??``;if(n.length===0){this.setSlotContent(e,null);return}let r=this.#n(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#r(e,r);return}let i=document.createElement(`div`);i.innerHTML=n,this.setSlotContent(e,i)}#n(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let t of Array.from(n.children))if(t instanceof HTMLElement&&t.dataset.fileTreeManagedSlot===e)return t;return null}#r(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#i(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let e=t.dataset.fileTreeManagedSlot;e==null||this.#e.has(e)||this.#e.set(e,t)}}},Ic=`__c`,Lc=`__k`,Rc=`__d`,zc=`__s`,Bc=/[\s\n\\/='"\0<>]/,Vc=/^(xlink|xmlns|xml)([A-Z])/,Hc=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,Uc=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,Wc=new Set([`draggable`,`spellcheck`]);function Gc(e){e.__g===void 0?e[Rc]=!0:e.__g|=8}function Kc(e){e.__g===void 0?e[Rc]=!1:e.__g&=-9}function qc(e){return e.__g===void 0?!0===e[Rc]:!!(8&e.__g)}var Jc=/["&<]/;function Yc(e){if(e.length===0||!1===Jc.test(e))return e;for(var t=0,n=0,r=``,i=``;n<e.length;n++){switch(e.charCodeAt(n)){case 34:i=`&quot;`;break;case 38:i=`&amp;`;break;case 60:i=`&lt;`;break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=i,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var Xc={},Zc=new Set(`animation-iteration-count.border-image-outset.border-image-slice.border-image-width.box-flex.box-flex-group.box-ordinal-group.column-count.fill-opacity.flex.flex-grow.flex-negative.flex-order.flex-positive.flex-shrink.flood-opacity.font-weight.grid-column.grid-row.line-clamp.line-height.opacity.order.orphans.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.widows.z-index.zoom`.split(`.`)),Qc=/[A-Z]/g;function $c(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:Xc[n]||(Xc[n]=n.replace(Qc,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||Zc.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function el(){this.__d=!0}function tl(e,t){return{__v:e,context:t,props:e.props,setState:el,forceUpdate:el,__d:!0,__h:[]}}function nl(e,t,n){if(!e.s){if(n instanceof rl){if(!n.s)return void(n.o=nl.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(nl.bind(null,e,t),nl.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var rl=function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var a=1&i?t:n;if(a){try{nl(r,1,a(this.v))}catch(e){nl(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?nl(r,1,t?t(i):i):n?nl(r,1,n(i)):nl(r,2,i)}catch(e){nl(r,2,e)}},r},e}(),il,al,ol,sl,cl={},ll=Array.isArray,ul=Object.assign,dl=``,fl=`<!--$s-->`,pl=`<!--/$s-->`;function ml(e,t){var n,r=e.type,i=!0;return e[Ic]?(i=!1,(n=e[Ic]).state=n[zc]):n=new r(e.props,t),e[Ic]=n,n.__v=e,n.props=e.props,n.context=t,Gc(n),n.state??=cl,n[zc]??(n[zc]=n.state),r.getDerivedStateFromProps?n.state=ul({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[zc]===n.state?n.state:n[zc]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),ol&&ol(e),n.render(n.props,n.state,t)}function hl(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===dl)return dl;var s=typeof e;if(s!=`object`)return s==`function`?dl:s==`string`?Yc(e):e+dl;if(ll(e)){var c,l=dl;i[Lc]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=hl(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=dl,ll(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return dl;e.__=i,il&&il(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===Qa){if(`tpl`in g){for(var x=dl,S=0;S<g.tpl.length;S++)if(x+=g.tpl[S],g.exprs&&S<g.exprs.length){var C=g.exprs[S];if(C==null)continue;typeof C!=`object`||C.constructor!==void 0&&!ll(C)?x+=C:x+=hl(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+Yc(g.UNSTABLE_comment)+`-->`;v=g.children}else{if((_=h.contextType)!=null){var ee=t[_.__c];b=ee?ee.props.value:_.__}var w=h.prototype&&typeof h.prototype.render==`function`;if(w)v=ml(e,b),y=e[Ic];else{e[Ic]=y=tl(e,b);for(var T=0;qc(y)&&T++<25;){Kc(y),ol&&ol(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}Gc(y)}if(y.getChildContext!=null&&(t=ul({},t,y.getChildContext())),w&&G.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===Qa&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return hl(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[zc]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,cl),qc(y)?(v=ml(e,t),(y=e[Ic]).getChildContext!=null&&(t=ul({},t,y.getChildContext())),hl(v=v!=null&&v.type===Qa&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):dl}finally{al&&al(e),sl&&sl(e)}}}v=v!=null&&v.type===Qa&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var E=hl(v,t,n,r,e,a,o);return al&&al(e),G.unmount&&G.unmount(e),e._suspended?typeof E==`string`?fl+E+pl:ll(E)?(E.unshift(fl),E.push(pl),E):E.then(function(e){return fl+e+pl}):E}catch(i){if(!a&&o&&o.onError){var te=function i(s){return o.onError(s,e,function(e,s){try{return hl(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(te!==void 0)return te;var ne=G.__e;return ne&&ne(i,e),dl}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=hl(v,t,n,r,e,a,o);return e._suspended?fl+s+pl:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var D,O=`<`+h,k=dl;for(var A in g){var j=g[A];if(typeof(j=_l(j)?j.value:j)!=`function`||A===`class`||A===`className`){switch(A){case`children`:D=j;continue;case`key`:case`ref`:case`__self`:case`__source`:continue;case`htmlFor`:if(`for`in g)continue;A=`for`;break;case`className`:if(`class`in g)continue;A=`class`;break;case`defaultChecked`:A=`checked`;break;case`defaultSelected`:A=`selected`;break;case`defaultValue`:case`value`:switch(A=`value`,h){case`textarea`:D=j;continue;case`select`:r=j;continue;case`option`:r!=j||`selected`in g||(O+=` selected`)}break;case`dangerouslySetInnerHTML`:k=j&&j.__html;continue;case`style`:typeof j==`object`&&(j=$c(j));break;case`acceptCharset`:A=`accept-charset`;break;case`httpEquiv`:A=`http-equiv`;break;default:if(Vc.test(A))A=A.replace(Vc,`$1:$2`).toLowerCase();else{if(Bc.test(A))continue;A[4]!==`-`&&!Wc.has(A)||j==null?n?Uc.test(A)&&(A=A===`panose1`?`panose-1`:A.replace(/([A-Z])/g,`-$1`).toLowerCase()):Hc.test(A)&&(A=A.toLowerCase()):j+=dl}}j!=null&&!1!==j&&(O=!0===j||j===dl?O+` `+A:O+` `+A+`="`+(typeof j==`string`?Yc(j):j+dl)+`"`)}}if(Bc.test(h))throw Error(h+` is not a valid HTML tag name in `+O+`>`);if(k||(typeof D==`string`?k=Yc(D):D!=null&&!1!==D&&!0!==D&&(k=hl(D,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),al&&al(e),sl&&sl(e),!k&&gl.has(h))return O+`/>`;var M=`</`+h+`>`,re=O+`>`;return ll(k)?[re].concat(k,[M]):typeof k==`string`?re+k+M:[re,k,M]}var gl=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function _l(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var vl=0;function yl(e){return e!=null&&e.length>0?e:(vl+=1,`pst_ft_${vl}`)}function bl({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??Mi)}function xl(e){if(typeof document>`u`)return;let t=document.createElement(`div`);t.innerHTML=e;let n=t.querySelector(`svg`);return n instanceof SVGElement?n:void 0}function Sl(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 Cl(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var wl=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new Fc;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y=null;#b;#x=!1;#S=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:i,id:a,initialSearchQuery:o,icons:s,itemHeight:c,onSearchChange:l,onSelectionChange:u,overscan:d,renderRowDecoration:f,renaming:p,search:m,searchBlurBehavior:h,searchFakeFocus:g,stickyFolders:_,unsafeCSS:v,initialVisibleRowCount:y,...b}=e;this.#e=t,this.#n=yl(a),this.#p=Pa(i),this.#m=s,this.#h=v,this.#r=u,this.#i=f,this.#a=p!=null&&p!==!1,this.#o=h,this.#s=m===!0,this.#c=g===!0,this.#u=ji(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new ka({...b,fileTreeSearchMode:r,initialSearchQuery:o,onSearchChange:l,renaming:p}),this.#v=this.#t.getSelectionVersion(),this.#y=this.#r==null?null:this.subscribe(()=>{this.#D()})}unmount(){this.#b!=null&&(Pc(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}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)}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){this.#t.resetPaths(e,t)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),Mc(t.wrapper,this.#w()))}setGitStatus(e){this.#p=Pa(e,this.#p);let t=this.#T();t!=null&&Mc(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),Mc(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),Nc(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),Mc(r,this.#w())}#C(){return{initialViewportHeight:bl({initialVisibleRowCount:this.#d.initialVisibleRowCount,itemHeight:this.#d.itemHeight}),itemHeight:this.#d.itemHeight,overscan:this.#d.overscan,stickyFolders:this.#d.stickyFolders}}#w(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#m,instanceId:this.#n,renamingEnabled:this.#a,renderRowDecoration:this.#i,searchBlurBehavior:this.#o,searchEnabled:this.#s,searchFakeFocus:this.#c,slotHost:this.#l,...this.#C()}}#T(){let e=this.#f,t=this.#b;return e==null||t==null?null:{host:e,wrapper:t}}#E(e,t){let n=e.shadowRoot;n!=null&&(this.#k(n),this.#A(n)),this.#j(t)}#D(){let e=this.#r;if(e==null)return;let t=this.#t.getSelectionVersion();t!==this.#v&&(this.#v=t,e(this.#t.getSelectedPaths()))}#O(){let e=this.#e?.header?.render;if(e!=null){this.#l.setSlotContent(nt,e());return}this.#l.setSlotHtml(nt,this.#e?.header?.html??null)}#k(e){let t=Cl(e).find(e=>Sl(e)),n=xl(fe(He(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=Cl(e),n=t.find(e=>Sl(e)),r=t.filter(e=>e!==n),i=He(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=xl(i);if(a==null){for(let e of r)e.remove();return}if(!(r.length===1&&r[0].outerHTML===a.outerHTML)){for(let e of r)e.remove();e.appendChild(a)}}#j(e){let t=He(this.#m);t.colored&&D(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${Qe}]`);if(this.#g==null&&t instanceof HTMLStyleElement&&(this.#g=t),this.#h==null||this.#h===``){this.#g?.remove(),this.#g=void 0,this.#_=void 0;return}this.#g?.parentNode===e&&this.#_===this.#h||(this.#g??=document.createElement(`style`),this.#g.setAttribute(Qe,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=Ii(this.#h),this.#_=this.#h)}#N(e){if(this.#b!=null)return this.#b;let t=e.shadowRoot;if(t==null)throw Error(`FileTree requires a shadow root`);let n=Array.from(t.children).filter(e=>e instanceof HTMLDivElement&&typeof e.dataset.fileTreeId==`string`&&e.dataset.fileTreeId.length>0),r=n.find(e=>e.dataset.fileTreeId===this.#n)??n[0];return r!=null&&(this.#n=r.dataset.fileTreeId??this.#n),this.#b=r??document.createElement(`div`),this.#b.dataset.fileTreeId=this.#n,this.#b.dataset.fileTreeVirtualizedWrapper=`true`,this.#E(e,this.#b),this.#b.parentNode!==t&&t.appendChild(this.#b),this.#b}#P(e,t){let n=e??this.#f??document.createElement(`file-tree-container`);t!=null&&n.parentNode!==t&&t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:`open`});return Hi(n,r),this.#M(r),n.dataset.fileTreeVirtualized=`true`,n.style.display=`flex`,this.#F(n),this.#l.setHost(n),this.#f=n,n}#F(e){e.style.getPropertyValue(`--trees-item-height`)===``&&(e.style.setProperty(`--trees-item-height`,`${String(this.#u.itemHeight)}px`),this.#x=!0),e.style.getPropertyValue(`--trees-density-override`)===``&&(e.style.setProperty(`--trees-density-override`,String(this.#u.factor)),this.#S=!0)}#I(e){this.#x&&=(e.style.removeProperty(`--trees-item-height`),!1),this.#S&&=(e.style.removeProperty(`--trees-density-override`),!1)}},X=g(v(),1),Tl=typeof window>`u`?X.useEffect:X.useLayoutEffect;function El({file:e,options:t,lineAnnotations:n,selectedLines:r,prerenderedHTML:i,metrics:a,hasGutterRenderUtility:o,hasCustomHeader:s,disableWorkerPool:c,contentEditable:l}){let u=Ue(),d=r!==void 0,f=(0,X.useContext)(ne),p=de(),m=(0,X.useRef)(null),h=Be(r=>{if(r!=null){if(m.current!=null)throw Error(`File: An instance should not already exist when a node is created`);u==null?m.current=new S(Dl({controlledSelection:d,contentEditable:l,hasCustomHeader:s,hasEditor:p!==void 0,hasGutterRenderUtility:o,options:t}),c?void 0:f,!0):m.current=new E(Dl({controlledSelection:d,contentEditable:l,hasCustomHeader:s,hasEditor:p!==void 0,hasGutterRenderUtility:o,options:t}),u,a,c?void 0:f,!0),m.current.hydrate({file:e,fileContainer:r,lineAnnotations:n,prerenderedHTML:i})}else{if(m.current==null)throw Error(`File: A File instance should exist when unmounting`);m.current.cleanUp(),m.current=null}});return Tl(()=>{if(m.current==null)return;let i=Dl({controlledSelection:d,contentEditable:l,hasCustomHeader:s,hasEditor:p!==void 0,hasGutterRenderUtility:o,options:t}),a=!le(m.current.options,i);m.current.setOptions(i),m.current.render({file:e,lineAnnotations:n,forceRender:a}),r!==void 0&&m.current.setSelectedLines(r)}),Tl(()=>{if(l&&m.current!=null){if(p===void 0)throw Error(`File: Editor is not attached`);return p.edit(m.current)}},[l,p]),{ref:h,getHoveredLine:(0,X.useCallback)(()=>m.current?.getHoveredLine(),[])}}function Dl({options:e,controlledSelection:t,contentEditable:n,hasCustomHeader:r,hasEditor:i,hasGutterRenderUtility:a}){let o=n&&i,s=t||a||r;if(!s&&!o)return e;let c={...e};return s&&(c={...c,controlledSelection:t,renderCustomHeader:r?k:e?.renderCustomHeader,renderGutterUtility:a?k:e?.renderGutterUtility}),o&&(c={...c,useTokenTransformer:!0}),c}var Z=u();function Ol({file:e,lineAnnotations:t,selectedLines:n,options:r,metrics:i,className:a,style:o,renderAnnotation:s,renderCustomHeader:c,renderHeaderPrefix:l,renderHeaderMetadata:u,prerenderedHTML:d,renderGutterUtility:f,disableWorkerPool:p=!1,contentEditable:m=!1}){let{ref:h,getHoveredLine:g}=El({file:e,options:r,metrics:i,lineAnnotations:t,selectedLines:n,prerenderedHTML:d,hasGutterRenderUtility:f!=null,hasCustomHeader:c!=null,disableWorkerPool:p,contentEditable:m});return(0,Z.jsx)(Ne,{ref:h,className:a,style:o,children:xe(w({file:e,renderAnnotation:s,renderCustomHeader:c,renderHeaderPrefix:l,renderHeaderMetadata:u,renderGutterUtility:f,lineAnnotations:t,getHoveredLine:g}),d)})}var kl=s(),Al=[`.avif`,`.gif`,`.ico`,`.jpeg`,`.jpg`,`.png`,`.svg`,`.webp`];function jl(e,t){let n=e.split(/[?#]/,1)[0]?.toLowerCase()??``;return t.some(e=>n.endsWith(e))}function Ml(e){return jl(e,Al)}var Nl=100,Pl=class{#e=[];#t=[];#n;constructor(e){this.#n=Math.max(1,e?.maxEntries??Nl)}get canUndo(){return this.#e.length>0}get canRedo(){return this.#t.length>0}clear(){this.#e.length=0,this.#t.length=0}clearRedo(){this.#t.length=0}push(e){this.#e.push(e),this.clearRedo(),this.#e.length>this.#n&&this.#e.shift()}setLastUndoSelectionsAfter(e){let t=this.#e[this.#e.length-1];t!==void 0&&(t.selectionsAfter=e.map(e=>({...e})))}setLastUndoLineAnnotations(e,t){let n=this.#e[this.#e.length-1];n!==void 0&&(n.lineAnnotationsBefore=e.slice(),n.lineAnnotationsAfter=t.slice())}peekUndo(){return this.#e[this.#e.length-1]}replaceLastUndo(e){if(this.#e.length===0){this.push(e);return}this.#e[this.#e.length-1]=e,this.clearRedo()}popUndoToRedo(){let e=this.#e.pop();if(e!==void 0)return this.#t.push(e),e}popRedoToUndo(){let e=this.#t.pop();if(e!==void 0)return this.#e.push(e),e}};function Fl(e,t,n,r,i,a,o,s){let c=[...t].sort((e,t)=>e.start-t.start),l=[];for(let t=0,n=0;t<c.length;t++){let r=c[t],i=e.getTextSlice(r.start,r.end),a=r.start+n;l.push({start:a,end:a+r.text.length,text:i}),n+=r.text.length-(r.end-r.start)}return{forwardEdits:c.map(e=>({...e})),inverseEdits:l,versionBefore:n,versionAfter:r,selectionsBefore:i?.map(e=>({...e})),selectionsAfter:a?.map(e=>({...e})),lineAnnotationsBefore:o?.slice(),lineAnnotationsAfter:s?.slice()}}function Il(e,t){if(e===void 0||e.forwardEdits.length===0||e.forwardEdits.length!==e.inverseEdits.length||e.forwardEdits.length!==t.forwardEdits.length||t.forwardEdits.length!==t.inverseEdits.length)return!1;let n;for(let r=0;r<e.forwardEdits.length;r++){let i=e.forwardEdits[r],a=e.inverseEdits[r],o=t.forwardEdits[r],s=t.inverseEdits[r],c=zl(o.start,e.forwardEdits),l=i.start<=i.end&&i.text.length>0&&!i.text.includes(`
1671
+ }`}var Li=new WeakMap;function Ri(e){let t=Li.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute($e,`true`);let r=document.createElement(`div`);r.style.position=`relative`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n);let i=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),Li.set(e,i),i}function zi(e,t){if(!e.isConnected)return;let n=Ri(t);if(n==null)return;let r=t.querySelector(`style[${et}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(et,``),t.appendChild(i)),i.textContent=`:host { ${tt}: ${n}px; }`}var Bi;function Vi(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){Bi??(Bi=new CSSStyleSheet,Bi.replaceSync(Fi(Ni)));let t=!1;try{e.adoptedStyleSheets=[Bi],t=!0}catch{}if(t){e.querySelector(`style[${Ze}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(Ze,``),t.textContent=Fi(Ni),e.prepend(t)}}function Hi(e,t){Ui(e,t),Vi(t),zi(e,t)}function Ui(e,t){let 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(){let e=this.shadowRoot??this.attachShadow({mode:`open`});Hi(this,e)}}if(customElements.define(Xe,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(Xe)))e instanceof HTMLElement&&Hi(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var Wi=e=>e.startsWith(`f::`)?e.slice(3):e;function Gi(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function Ki(e,t){return e===``?t:`${e}/${t}`}function qi({files:e,path:t,isFolder:n,nextBasename:r}){let i=Wi(t),a=r.trim();if(a.length===0)return{error:`Name cannot be empty.`};if(a.includes(`/`))return{error:`Name cannot include "/".`};let{parentPath:o,baseName:s}=Gi(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=Ki(o,a),l=Array(e.length),u=new Set;if(!n){let t=`${c}/`,r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(a!==i&&a.startsWith(t))return{error:`"${c}" already exists.`};let o=a===i?c:a;if(u.has(o))return{error:`"${c}" already exists.`};u.add(o),l[n]=o,a===i&&(r=!0)}return r?{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}:{error:`Could not find the selected file to rename.`}}let d=`${i}/`,f=`${c}/`,p=0;for(let t=0;t<e.length;t++){let n=e[t],r=n===i||n.startsWith(d);if(!r&&(n===c||n.startsWith(f)))return{error:`"${c}" already exists.`};let a=r?`${c}${n.slice(i.length)}`:n;if(u.has(a))return{error:`"${c}" already exists.`};u.add(a),l[t]=a,r&&p++}return p===0?{error:`Could not find the selected folder to rename.`}:{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}}function Ji(e){return e.endsWith(`/`)}function Yi(e){let 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 Xi(e){let t=[],n=new Set;for(let r of e)n.has(r)||(n.add(r),t.push(r));let r=new Set;for(let e of t.toSorted((e,t)=>e.length===t.length?e.localeCompare(t):e.length-t.length)){let t=(e.endsWith(`/`)?e.slice(0,-1):e).split(`/`),n=!1;for(let e=0;e<t.length-1;e+=1){let i=`${t.slice(0,e+1).join(`/`)}/`;if(r.has(i)){n=!0;break}}n||r.add(e)}return t.filter(e=>r.has(e))}function Zi(e,t){return t.includes(e)?Xi(t):[e]}function Qi(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 $i(e,t){return{draggedPaths:e,target:t}}function ea(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(Ji(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function ta(e,t){return t.kind===`root`||t.directoryPath==null?Yi(e):t.directoryPath}function na(e,t){let n=e.map(e=>{let n=ta(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}function ra(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 ia(e,t,n){let{paths:r,preparedInput:i}=e;if(i==null){if(r==null)throw Error(`FileTree requires paths or preparedInput`);return{paths:r,preparedInput:void 0}}let a=i.paths;if(r==null)return{paths:a,preparedInput:i};if(!ra(Oi.preparePaths(r,n==null?{}:{sort:n}),a))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:a,preparedInput:i}}function aa(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function oa(e,t,n){if(e===t)return n;let r=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(r)?`${n.endsWith(`/`)?n:`${n}/`}${e.slice(r.length)}`:e}function sa(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function ca(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 sa(e,t.path)?n?e:null:e;case`move`:return oa(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=ca(r,e,n),r==null)return null;return r}}}function la(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function ua(e){switch(e.operation){case`add`:return{...la(e),operation:`add`,path:e.path};case`remove`:return{...la(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...la(e),from:e.from,operation:`move`,to:e.to}}}function da(e){return{...la(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>ua(e)),operation:`batch`}}function fa(e){switch(e.operation){case`add`:case`remove`:case`move`:return ua(e);case`batch`:return da(e);default:return null}}function pa(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function ma(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function ha(e){return ma(e).at(-1)??null}function ga(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function _a(e){return e.endsWith(`/`)}var va=e=>e.toLowerCase();function ya(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function ba(e){return e.endsWith(`/`)?e.slice(0,-1):e}function xa(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var Sa=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},Ca=Symbol(`FILE_TREE_RENAME_VIEW`),wa=512,Ta=512;function Ea(e){return e===`top`||e===`center`?e:`nearest`}function Da(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=ma(n);for(let e=r.length-1;e>=0;--e){let n=r[e];if(n==null)continue;let i=t(n);if(i!=null)return i}}return 0}function Oa(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};let r=n??(t=>e.visibleIndexByPath.get(t)??null);return{focusedIndex:Da(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var ka=class{#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=0;#z=null;#B=new Set;#V=0;#H;#U=0;#W=!1;#G=0;#K;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=ia({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#A=n??`hide-non-matches`,this.#H=this.#le(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ne(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#B=new Set(d),this.#z=f,this.#V=1),this.#je(f,!1),r!=null&&this.#Te(r,!1),this.#K=this.#Re()}destroy(){this.#K?.(),this.#K=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#he()}focusFirstItem(){this.#be().length>0&&this.#Fe(0)}focusLastItem(){this.#G<=0||(this.#Ie(),this.#Fe(this.#G-1))}focusNextItem(){this.#Ae(1)}focusParentItem(){if(this.#c==null)return;let e=ha(this.#c);if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t)}focusPath(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;this.#Ie();let n=this.#Z(t);n>=0&&this.#Fe(n)}scrollToPath(e,t){let n=this.#H.getPathInfo(e)?.path??null;if(n==null)return;this.#Ie();let r=this.#xe(n);r<0||this.#Me(r)!=null&&(t?.focus!==!1&&this.#Fe(r,!1),this.#L={id:this.#R+=1,offset:Ea(t?.offset),visibleIndex:r},this.#De())}focusMountedPathFromInput(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;let n=this.#Z(t);n>=0&&this.#Fe(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Z(t);return n>=0?(this.#Fe(n),this.#be()[n]??t):null}focusPreviousItem(){this.#Ae(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#Q(this.#c)}getFocusedPath(){return this.#c}getScrollRequest(){return this.#L}clearScrollRequest(e){this.#L?.id===e&&(this.#L=null)}resolveNearestVisiblePath(e){let t=this.#be();if(this.#G===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#H.getPathInfo(e)?.path??e,r=this.#Z(n);return r>=0?t[r]??n:this.#X(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#B]}getSelectionVersion(){return this.#V}getVisibleCount(){return this.#G}getVisibleRows(e,t){if(t<e||this.#G===0)return[];let n=Math.max(0,e),r=Math.min(this.#G-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=Ta){let e=[];for(let t=n;t<=r;t+=1){let n=this.#H.getVisibleRowContext(t);if(n==null)break;e.push(this.#ee(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ie(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#Se(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];if(r!=null&&r===a+1){a=r;continue}if(i>=0&&this.#H.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null){i=-1,a=-1;continue}i=r,a=r}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#Se(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#$(o,i,a,{ancestorPaths:this.#re(a),path:s})})}return this.#H.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#$(e,r,r,{ancestorPaths:this.#re(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#G===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#G;r+=1){let i=e+r*t,a=Math.min(this.#G-1,Math.floor(i/t)),o=this.#te(a,r)??(a>0?this.#te(a-1,r):void 0);if(o==null)break;n.push({row:this.#ee(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#H.getPathInfo(e);return t==null?null:this.#Q(t.path,t)}resolveMountedDirectoryPathFromInput(e){let t=this.#H.getPathInfo(e);return t?.kind===`directory`?t.path:null}toggleMountedDirectoryFromInput(e){let t=this.resolveMountedDirectoryPathFromInput(e);t!=null&&this.#ze(t)}selectAllVisiblePaths(){this.#Ie();let e=[...this.#be()];this.#ae(e,this.#c??this.#z)}selectOnlyPath(e){let t=this.#Ne(e);t!=null&&this.#ae([t],t)}selectOnlyMountedPathFromInput(e){this.#ae([e],e)}selectPath(e){let t=this.#Ne(e);t==null||this.#B.has(t)||this.#ae([...this.#B,t])}deselectPath(e){let t=this.#Ne(e);t==null||!this.#B.has(t)||this.#ae([...this.#B].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.#ae([...this.#B].filter(e=>e!==t),t);return}this.#ae([...this.#B,t],t)}}selectPathRange(e,t){let n=this.#Ne(e);if(n==null)return;this.#Ie();let r=this.#z,i=r==null?-1:this.#Ce(r),a=this.#Ce(n);if(i===-1||a===-1){let e=t?[...this.#B,n]:[n];this.#ae(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#be().slice(o,s+1),l=t?[...this.#B,...c]:c;this.#ae(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#G-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ie();let r=this.#be(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#B);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#ae([...o],this.#z??i,!1),this.#Fe(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Ne(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=Zi(t,n);return this.#r.canDrag?.(r)===!1?!1:(n.includes(t)||this.#ae([t],t,!1),this.#Pe(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#De(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=$i(t.draggedPaths,n);(ea(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}Qi(t.target,n)||(this.#i={...t,target:n},this.#De())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#De())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#De(),!1;let n=$i(e.draggedPaths,t);if(ea(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=na(e.draggedPaths,t);if(r==null)return this.#De(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#H.move(e.from,e.to,{collision:e.collision})}else this.#ce(r.operations),this.#H.batch(r.operations)}catch(e){return this.#De(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#H.add(e)}remove(e,t={}){this.#H.remove(e,t)}move(e,t,n={}){this.#H.move(e,t,n)}batch(e){this.#H.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Te(e,!0)}openSearch(e=``){this.#Te(e,!0)}closeSearch(){this.#Te(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#we(1)}focusPreviousSearchMatch(){this.#we(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#H.getPathInfo(e);if(n==null)return!1;let r=n.path,i=_a(r),a=ba(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of ma(r))this.#H.isExpanded(e)||this.#H.expand(e);return this.#ae([r],r,!1),this.#M!=null&&(this.#Te(null,!1),this.#y?.(this.#M)),this.#Pe(r),this.#T=r,this.#E=ya(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}[Ca](){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}}#q(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,_a(e)?{recursive:!0}:void 0);return}this.#Pe(e),this.#De()}#J(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,_a(e)?{recursive:!0}:void 0);return}let t=_a(e),n=qi({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:ba(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#Pe(e),this.#v?.(n.error),this.#De();return}if(n.sourcePath===n.destinationPath){this.#Pe(e),this.#De();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(xa(n.sourcePath,t),xa(n.destinationPath,t))}#Y(e){this.#T==null||this.#E===e||(this.#E=e,this.#De())}resetPaths(e,t={}){let n=this.#H.list().length,r=this.#G,i=ia({paths:e,preparedInput:t.preparedInput},`resetPaths`,this.#e.sort),a=this.#le(i.paths,i.preparedInput,t.initialExpandedPaths),o=this.#c,s=this.#T,c=this.getSelectedPaths(),l=this.#z;this.#K?.(),this.#H=a,this.#d.clear(),this.#he();let u=c.map(e=>a.getPathInfo(e)?.path??null).filter(e=>e!=null),d=!pa(this.#B,u);this.#B=new Set(u),d&&(this.#V+=1),this.#z=l==null?null:a.getPathInfo(l)?.path??null,this.#T=s==null?null:a.getPathInfo(s)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(o,o!=null||u.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:i.paths.length,pathCountBefore:n,projectionChanged:!0,usedPreparedInput:t.preparedInput!=null,visibleCountDelta:this.#G-r})}#X(e){this.#Ie();let t=ha(e),n=ga(e,t),r=null,i=null;for(let e of this.#be()){if(ha(e)!==t)continue;let a=ga(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Z(e){let t=this.#Ce(e);if(t!==-1)return t;let n=ma(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#Ce(t);if(r!==-1)return r}return this.#be().length>0?0:-1}#Q(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#H.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#oe(r.path):this.#se(r.path);return this.#d.set(r.path,i),i}#$(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===this.#c,isSelected:this.#B.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#ee(e){return this.#$(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#te(e,t){let n=this.#H.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ne(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ne(n),n];return this.#a.set(e,r),r}#re(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ne(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ie(e){this.#H.collapse(e)}#ae(e,t=this.#z,n=!0){let r=[...new Set(e)],i=!pa(this.#B,r),a=this.#z!==t;!i&&!a||(this.#B=new Set(r),this.#z=t,i&&(this.#V+=1),n&&this.#De())}#oe(e){return{collapse:()=>{this.#ie(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#ke(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#H.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#ze(e)}}}#se(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#ce(e){let t=this.#H.list();this.#le(t).batch(e)}#le(e,t,n){return new Oi({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ue(){return this.#h??=this.#H.list(),this.#h}#de(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ue()){e.add(t);for(let n of ma(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(va),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(va),this.#p}#he(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#ge(){return this.#pe().filter(e=>this.#H.isExpanded(e))}#_e(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#B)for(let n of ma(e))t.add(n);this.#ve(t)}#ve(e){this.#W=!0;try{for(let t of this.#pe()){let n=e.has(t),r=this.#H.isExpanded(t);n&&!r?this.#H.expand(t):!n&&r&&this.#H.collapse(t)}}finally{this.#W=!1}}#ye(){if(this.#M==null||this.#M.length===0){this.#k=[],this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let t=[],n=[],r=new Map;for(let[i,a]of e.entries())this.#N?.has(a)===!0&&(r.set(a,n.length),t.push(i),n.push(a));this.#F=t,this.#I=n,this.#P=r,this.#G=n.length}#be(){return this.#I??this.#b}#xe(e){return this.#I==null?this.#H.getVisibleIndex(e)??-1:this.#P?.get(e)??-1}#Se(e){return this.#F?.[e]??e}#Ce(e){return this.#P?.get(e)??this.#H.getVisibleIndex(e)??-1}#we(e){let t=this.#k;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Te(e,t){let n=e==null?null:Sa(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#ge()),this.#M=n,n==null)this.#_e(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else if(n.length===0)this.#_e(!1),this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else{let e=this.#Ee();this.#je(e,!0)}t&&(this.#y?.(this.#M),this.#De())}}#Ee(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ue(),n=this.#fe(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#pe(),s=this.#me();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#O=i;let c=this.#A===`hide-non-matches`&&r.length>0?new Set:null;this.#N=c;let l=this.#A===`expand-matches`?new Set(this.#j??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of ma(e))l.add(t),c?.add(t)}return this.#ve(l),a??this.#c}#De(){for(let e of this.#t)e()}#Oe(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#ke(e){for(let t of ma(e))this.#H.isExpanded(t)||this.#H.expand(t);this.#H.isExpanded(e)||this.#H.expand(e)}#Ae(e){let t=this.#G;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#F==null&&r>=this.#b.length&&this.#Ie(),this.#Fe(r))}#je(e,t=!0){let n=this.#H.getVisibleCount();this.#U=n;let r=Oa(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,wa)),e,t?e=>this.#H.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#ye(),this.#s=e==null?this.#be().length>0?0:-1:this.#Z(e),this.#c=this.#s<0?null:this.#Me(this.#s)}#Me(e){return this.#be()[e]??(this.#F==null?this.#H.getVisibleRowContext(e)?.row.path??null:null)}#Ne(e){return this.#H.getPathInfo(e)?.path??null}#Pe(e){if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t,!1)}#Fe(e,t=!0){let n=this.#Me(e);n!=null&&(this.#s===e&&this.#c===n||(this.#s=e,this.#c=n,t&&this.#De()))}#Ie(){this.#l||this.#je(this.#c,!0)}#Le(e){let t=ca(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=ca(this.#c,e,!0),r=[...this.#B].map(t=>ca(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=ca(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return pa(this.#B,o)||(this.#B=new Set(o),this.#V+=1),this.#z=a,n}#Re(){return this.#H.on(`*`,e=>{if(this.#W)return;e.canonicalChanged&&(this.#d.clear(),this.#he()),this.#i!=null&&aa(e)&&(this.#i=null);let t=aa(e)?this.#Le(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ee():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#je(n,r),this.#De();let i=fa(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},Aa=e=>{if(e==null||e.length===0)return`0`;let t=`${e.length}`;for(let n of e)t+=`\0${n.path}\0${n.status}`;return t};function ja(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1){if(!(e[t]===`/`||t===e.length)){r===-1&&(r=t);continue}r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1)}return n===``?null:{isDirectory:t,path:n}}function Ma(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function Na(e,t){return t?`${e}/`:e}function Pa(e,t=null){let n=Aa(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set;for(let t of e??[]){let e=ja(t.path);if(e==null)continue;let n=Na(e.path,e.isDirectory);r.set(n,t.status),t.status===`ignored`&&e.isDirectory?a.add(n):e.isDirectory&&a.delete(n);for(let t of Ma(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var G,Fa,Ia,La,Ra,za,Ba,Va,Ha,Ua,Wa={},Ga=[],Ka=Array.isArray,qa=Ga.slice,Ja=Object.assign;function Ya(e){e&&e.parentNode&&e.remove()}function Xa(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?qa.call(arguments,2):n),Za(e,o,r,i,null)}function Za(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Fa,__i:-1,__u:0};return i==null&&G.vnode!=null&&G.vnode(a),a}function Qa(e){return e.children}function $a(e,t){this.props=e,this.context=t,this.__g=0}function eo(e,t){if(t==null)return e.__?eo(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`?eo(e):null}function to(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 to(e)}}function no(e){(8&e.__g||!(e.__g|=8)||!Ia.push(e)||Ra++)&&La==G.debounceRendering||((La=G.debounceRendering)||queueMicrotask)(ro)}function ro(){for(var e,t,n,r,i,a,o,s,c=1;Ia.length;)Ia.length>c&&Ia.sort(za),e=Ia.shift(),c=Ia.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=Ja({},r)).__v=r.__v+1,G.vnode&&G.vnode(n),fo(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??eo(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,mo(a,n,o),n.__e!=i&&to(n)));Ra=0}function io(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||Ga,b=t.length;for(c=ao(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?Wa:y[m.__i]||Wa,m.__i=f,_=fo(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&_o(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=oo(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function ao(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?Za(null,o,null,null,null):Ka(o)?Za(Qa,{children:o},null,null,null):o.constructor==null&&o.__b>0?Za(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=so(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=eo(s)),vo(s,s));return r}function oo(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=oo(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=eo(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function so(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function co(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function lo(e,t,n,r,i){var a;n: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||co(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||co(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(Ba,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||={},e.__l[t+a]=n,n?r?n.l=r.l:(n.l=Va,e.addEventListener(t,a?Ua:Ha,a)):e.removeEventListener(t,a?Ua:Ha,a);else{if(i==`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 n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function uo(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=Va++;else if(t.u<n.l)return;return n(G.event?G.event(t):t)}}}function fo(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,ee,w,T,E,te,ne,D,O,k=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=G.__b)&&d(t);n:if(typeof k==`function`)try{if(v=t.props,y=`prototype`in k&&k.prototype.render,b=(d=k.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new k(v,x):(t.__c=f=new $a(v,x),f.constructor=k,f.render=yo),b&&b.sub(f),f.props=v,f.state||={},f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&k.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Ja({},f.__s)),Ja(f.__s,k.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&k.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&k.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,C=G.__r,ee=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),w=0;w<f._sb.length;w++)f.__h.push(f._sb[w]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++ee<25);f.state=f.__s,f.getChildContext!=null&&(r=Ja({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),T=d,d!=null&&d.type===Qa&&d.key==null&&(T=ho(d.props.children)),s=io(e,Ka(T)?T:[T],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null)if(e.then){for(E=0,te=!1,t.__u|=c?160:128,t.__c.__z=[],ne=0;ne<a.length;ne++)(D=a[ne])==null||te||(D.nodeType==8&&D.data==`$s`?(E>0&&t.__c.__z.push(D),E++,a[ne]=null):D.nodeType==8&&D.data==`/$s`?(--E>0&&t.__c.__z.push(D),te=E===0,s=a[ne],a[ne]=null):E>0&&(t.__c.__z.push(D),a[ne]=null));if(!te){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(O=a.length;O--;)Ya(a[O]);po(t)}else t.__e=n.__e,t.__k=n.__k,e.then||po(t);G.__e(e,t,n)}else s=t.__e=go(n.__e,t,n,r,i,a,o,c,l,u);return(d=G.diffed)&&d(t),128&t.__u?void 0:s}function po(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(po)}function mo(e,t,n){for(var r=0;r<n.length;r++)_o(n[r],n[++r],n[++r]);G.__c&&G.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){G.__e(e,t.__v)}})}function ho(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:Ka(e)?e.map(ho):Ja({},e)}function go(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&=(G.__m&&G.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=qa.call(e.childNodes),v=n.props||Wa,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;lo(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||lo(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),io(b==`template`?e.content:e,Ka(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&eo(n,0),s,c,l),a!=null)for(u=a.length;u--;)Ya(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||lo(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&lo(e,u,g,v[u],i))}return e}function _o(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(e){G.__e(e,n)}}function vo(e,t,n){var r,i;if(G.unmount&&G.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||_o(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){G.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&vo(r[i],t,n||typeof e.type!=`function`);n||Ya(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function yo(e,t,n){return this.constructor(e,n)}function bo(e,t){var n,r,i,a;t==document&&(t=document.documentElement),G.__&&G.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=Xa(Qa,null,[e]),i=[],a=[],fo(t,e,r||Wa,Wa,t.namespaceURI,r?null:t.firstChild?qa.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),mo(i,e,a)}function xo(e,t){e.__u|=32,bo(e,t)}G={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw Ra=0,e}},Fa=0,$a.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Ja({},this.state);typeof e==`function`&&(e=e(Ja({},n),this.props)),e&&Ja(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),no(this))},$a.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),no(this))},$a.prototype.render=Qa,Ia=[],Ra=0,za=function(e,t){return e.__v.__b-t.__v.__b},Ba=/(PointerCapture)$|Capture$/i,Va=0,Ha=uo(!1),Ua=uo(!0);var So=0;Array.isArray;function K(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--So,__i:-1,__u:0,__source:i,__self:a};return G.vnode&&G.vnode(l),l}var Co=16,wo=16,To={};function Eo({name:e,remappedFrom:t,token:n,width:r,height:i,viewBox:a,label:o,alignCapitals:s=!1}){"use no memo";let c=`#${e.replace(/^#/,``)}`,{width:l,height:u,viewBox:d}=To[e]??{width:Co,height:wo},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return K(`svg`,{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":s,...o==null?{"aria-hidden":!0}:{"aria-label":o,role:`img`},viewBox:m,width:f,height:p,children:K(`use`,{href:c})})}var Do=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},Oo=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},ko=e=>{if(e.length<4)return[e,``];let 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)]},Ao=(e,{splitIndex:t}={})=>{if(typeof t!=`number`){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}return[e.slice(0,t),e.slice(t)]},jo=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},Mo=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=t;return[e.slice(0,n),e.slice(n)]};function No({children:e,marker:t,variant:n=`default`}){"use no memo";return K(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:K(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?K(`span`,{"data-truncate-fade":!0}):t})})}function Po(e){"use no memo";let{mode:t,children:n}=e;return K(`div`,{children:[K(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?K(`span`,{children:n}):n}),K(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?K(`span`,{children:n}):n})]})}function Fo({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=K(Po,{mode:t,children:e},`content`),o=K(No,{marker:n,mode:t,variant:r},`marker`),s=K(`div`,{"data-truncate-fill":!0},`fill`);return K(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:K(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function Io({children:e,...t}){"use no memo";return K(Fo,{mode:`truncate`,...t,children:e})}function Lo({children:e,...t}){"use no memo";return K(Fo,{mode:`fruncate`,...t,children:e})}function Ro({children:e,contents:t,priority:n=`end`,split:r=`center`,minimumLength:i=12,className:a,style:o,...s}){"use no memo";let c=null,l=null;if(Array.isArray(t)){if(t.length!==2)return console.error(`MiddleTruncate: contents must be an array of two items`),null;c=K(Io,{...s,children:t[0]}),l=K(Lo,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return K(`div`,{className:a,style:o});if(e.length<i)return K(n===`end`?Lo:Io,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=Do:r===`extension`?t=Oo:r===`leaf-path`&&(t=ko);else if(typeof r==`number`)t=Ao,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=jo:e===`first`&&(t=Mo)}else typeof r==`function`&&(t=r);t??=Do;let[f,p]=t(e,{priority:n,variant:s.variant,splitIndex:typeof u==`number`?u:void 0,splitOffset:typeof d==`number`?d:void 0}),m=f.length>=p.length,h=n===`equal`&&!m,g=n===`equal`&&m,_={},v={};h&&(_.marker=``),g&&(v.marker=``),c=K(Io,{...s,..._,children:f}),l=K(Lo,{...s,...v,children:p})}return K(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[K(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),K(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var zo={endIndex:-1,startIndex:-1};function Bo(e,t,n){return Math.min(Math.max(e,t),n)}function Vo(e,t){return e<0||t<e?zo:{endIndex:t,startIndex:e}}function Ho(e){return e.startIndex<0||e.endIndex<e.startIndex}function Uo(e,t){return Ho(e)?0:(e.endIndex-e.startIndex+1)*t}function Wo(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function Go(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function Ko(e){let t=new Map;return e.forEach((e,n)=>{if(e.kind!==`directory`||!e.isExpanded)return;let r=e.ancestorPaths.length,i=t.get(r);if(i==null){t.set(r,[n]);return}i.push(n)}),t}function qo(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o==null)break;if(o<=t){i=a,n=a+1;continue}r=a-1}return i}function Jo(e){let t=new Map,n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=i.kind===`directory`&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths,o=0;for(;o<n.length&&o<a.length&&n[o]===a[o];)o+=1;for(let e=n.length-1;e>=o;--e){let i=n[e];i!=null&&t.set(i,r-1)}n.length=o;for(let e=o;e<a.length;e+=1){let t=a[e];t!=null&&n.push(t)}}let r=e.length-1;for(let e of n)t.set(e,r);return t}function Yo(e,t,n){if(e.length===0||t<=0)return[];let r=Jo(e),i=Ko(e),a=[];for(let r=0;r<e.length;r+=1){let o=i.get(r);if(o==null||o.length===0)break;let s=t+r*n,c=qo(o,Math.min(e.length-1,Math.floor(s/n))),l=null;for(;c>=0;){let t=o[c],n=t==null?null:e[t]??null;if(n!=null&&(r===0||n.ancestorPaths[r-1]===a[r-1]?.path)){l=n;break}--c}if(l==null)break;a.push(l)}return a.map((i,a)=>{let o=a*n,s=(r.get(i.path)??e.length-1)+1;if(s>=e.length)return{row:i,top:o};let c=s*n-t;return{row:i,top:Math.min(o,c-n)}}).filter(e=>e.top+n>0)}function Xo(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,i=Math.max(0,t.viewportHeight),a=Math.max(0,Math.floor(t.overscan)),o=Math.max(0,r-i),s=Bo(t.scrollTop,0,o),c=t.stickyRows??Yo(e,s,t.itemHeight),l=c.reduce((e,n)=>Math.max(e,n.top+t.itemHeight),0),u=Math.min(r,s+l),d=Math.max(0,i-l),f=Math.max(0,r-u),p=Wo(s,n,t.itemHeight),m=Wo(u,n,t.itemHeight),h=l<=0||p<0||p>=n?-1:p,g=h===-1?-1:Math.min(n-1,m-1),_=h===-1||g<h?0:g-h+1,v=d<=0||m>=n?zo:Vo(m,Go(u+d,n,t.itemHeight)),y=g+1,b=Ho(v)?zo:Vo(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=Uo(b,t.itemHeight);return{occlusion:{firstOccludedIndex:h,lastOccludedIndex:g,occludedCount:_},physical:{itemHeight:t.itemHeight,maxScrollTop:o,overscan:a,scrollTop:s,totalHeight:r,totalRowCount:n,viewportHeight:i},projected:{contentHeight:f,paneHeight:d,paneTop:u},sticky:{height:l,rows:c},visible:v,window:{endIndex:b.endIndex,height:x,offsetTop:Ho(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var Zo={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},Qo={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},$o=`Contains git status items`;function es(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i=0,viewportHeight:a}=e;if(n<0)return null;let o=Math.max(0,i),s=n*r,c=s+r;if(s<t+o){let e=Math.max(0,s-o);return e===t?null:e}if(c>t+a){let e=c-a;return e===t?null:e}return null}function ts(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return es({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:a,viewportHeight:s});if(n<0)return null;let c=Math.max(0,a),l=n*r,u=Math.max(0,s-c),d=i===`center`?c+Math.max(0,(u-r)/2):c,f=Math.max(0,o-s),p=Math.max(0,Math.min(l-d,f));return p===t?null:p}function ns(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}function rs(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function is(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let e=t.activeElement;return e instanceof HTMLElement?e:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function as(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function os(e,t){return e!=null&&e>0?e:t}function ss(e){let 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 cs(e,t,n,r,i=0){let a=es({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function ls(e,t,n,r,i,a,o=0){let s=ts({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s==null?!1:(e.scrollTop=s,!0)}function us(e,t,n,r,i,a){let o=ns({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function ds(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function fs(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function ps({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return K(`input`,{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:i,onInput:a,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}function ms(e){let{row:t,mode:n,targetPath:r,ariaLabel:i,domId:a,isParked:o,itemHeight:s,features:c,state:l,extraStyle:u}=e,d=n===`sticky`,f=t.ancestorPaths.at(-1)??``,p={};return l.isFocusRinged&&(p[`data-item-focused`]=!0),t.isSelected&&(p[`data-item-selected`]=!0),l.isContextHovered&&(p[`data-item-context-hover`]=`true`),l.isDragTarget&&(p[`data-item-drag-target`]=!0),l.isDragging&&(p[`data-item-dragging`]=!0),l.effectiveGitStatus!=null&&(p[`data-item-git-status`]=l.effectiveGitStatus),l.containsGitChange&&(p[`data-item-contains-git-change`]=`true`),{"aria-expanded":!d&&t.kind===`directory`?t.isExpanded:void 0,"aria-haspopup":c.contextMenuEnabled?`menu`:void 0,"aria-label":i,"aria-level":d?void 0:t.level+1,"aria-posinset":d?void 0:t.posInSet+1,"aria-selected":d?void 0:t.isSelected?`true`:`false`,"aria-setsize":d?void 0:t.setSize,"data-file-tree-sticky-path":d?r:void 0,"data-file-tree-sticky-row":d?`true`:void 0,"data-item-context-menu-button-visibility":c.actionLaneEnabled?c.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":c.contextMenuEnabled?c.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":c.actionLaneEnabled?`true`:void 0,"data-item-has-git-lane":c.gitLaneActive?`true`:void 0,"data-item-parent-path":f.length>0?f:void 0,"data-item-parked":o?`true`:void 0,"data-item-path":r,"data-item-type":t.kind===`directory`?`folder`:`file`,"data-type":`item`,id:d?void 0:a,role:d?void 0:`treeitem`,style:{minHeight:`${s}px`,...u},tabIndex:!d&&t.isFocused?0:-1,...p}}function hs(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:i}=e,a=t.ctrlKey||t.metaKey,o=t.shiftKey||a,s=t.shiftKey?{additive:a,kind:`range`}:a?{kind:`toggle`}:{kind:`single`};return{closeSearch:r,revealCanonical:n===`sticky`,selection:s,toggleDirectory:!o&&i}}var gs,q,_s,vs,ys=Object.is,bs=0,xs=[],J=G,Ss=J.__b,Cs=J.__r,ws=J.diffed,Ts=J.__c,Es=J.unmount,Ds=J.__;function Os(e,t){J.__h&&J.__h(q,e,bs||t),bs=0;var n=q.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function ks(e){return bs=1,As(Vs,e)}function As(e,t,n){var r=Os(gs++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Vs(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);ys(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=q,!q.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,ys(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};q.__f=!0;var a=q.shouldComponentUpdate,o=q.componentWillUpdate;q.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},q.shouldComponentUpdate=i}return r.__N||r.__}function js(e,t){var n=Os(gs++,3);!J.__s&&Bs(n.__H,t)&&(n.__=e,n.u=t,q.__H.__h.push(n))}function Ms(e,t){var n=Os(gs++,4);!J.__s&&Bs(n.__H,t)&&(n.__=e,n.u=t,q.__h.push(n))}function Y(e){return bs=5,Ns(function(){return{current:e}},[])}function Ns(e,t){var n=Os(gs++,7);return Bs(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Ps(e,t){return bs=8,Ns(function(){return e},t)}function Fs(){for(var e;e=xs.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Rs),e.__H.__h.forEach(zs),e.__H.__h=[]}catch(t){e.__H.__h=[],J.__e(t,e.__v)}}J.__b=function(e){q=null,Ss&&Ss(e)},J.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ds&&Ds(e,t)},J.__r=function(e){Cs&&Cs(e),gs=0;var t=(q=e.__c).__H;t&&(_s===q?(t.__h=[],q.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(Rs),t.__h.forEach(zs),t.__h=[],gs=0)),_s=q},J.diffed=function(e){ws&&ws(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(xs.push(t)!==1&&vs===J.requestAnimationFrame||((vs=J.requestAnimationFrame)||Ls)(Fs)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),_s=q=null},J.__c=function(e,t){t.some(function(e){try{e.__h.forEach(Rs),e.__h=e.__h.filter(function(e){return!e.__||zs(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],J.__e(n,e.__v)}}),Ts&&Ts(e,t)},J.unmount=function(e){Es&&Es(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{Rs(e)}catch(e){t=e}}),n.__H=void 0,t&&J.__e(t,n.__v))};var Is=typeof requestAnimationFrame==`function`;function Ls(e){var t,n=function(){clearTimeout(r),Is&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Is&&(t=requestAnimationFrame(n))}function Rs(e){var t=q,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),q=t}function zs(e){var t=q;e.__c=e.__(),q=t}function Bs(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!ys(t,e[n])})}function Vs(e,t){return typeof t==`function`?t(e):t}function Hs(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:K(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return K(Qa,{children:[K(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:K(Io,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function Us(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function Ws(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function Gs(e,t,n,r){return e.map((e,i)=>{let a=i*n,o=e.subtreeEndIndex+1;if(o>=r)return{row:e.row,top:a};let s=o*n-t;return{row:e.row,top:Math.min(a,s-n)}}).filter(e=>e.top+n>0)}function Ks({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:i,viewportHeight:a}){let o=e.getVisibleCount(),s=i&&o>0?e.getStickyRowCandidates(r,t):[],c=s==null&&i&&o>0?e.getVisibleRows(0,o-1):[],l=Xo(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:Gs(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?Gs(u,1,t,o):i&&r<=0&&c.length>0?Yo(c,1,t):l.sticky.rows;return{overlayHeight:d.reduce((e,n)=>Math.max(e,n.top+t),0),overlayRows:d,snapshot:l,visibleRows:c}}var qs=400,Js=10,Ys=40,Xs=18;function Zs(e,t,n){let r=e,i=document.elementFromPoint?.bind(document)??null,a=r.elementFromPoint?.(t,n)??i?.(t,n)??null;return e instanceof ShadowRoot&&(a==null||!e.contains(a))?Qs(e,t,n):a instanceof HTMLElement?a:null}function Qs(e,t,n){let r=Array.from(e.querySelectorAll(`[data-type="item"], [data-item-flattened-subitem]`));for(let e=r.length-1;e>=0;e--){let i=r[e],a=i.getBoundingClientRect();if(t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom)return i}return null}function $s(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function ec(e){let 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 tc(){return navigator.vendor!==`Apple Computer, Inc.`}function nc(e,t){let n=e-t.top;if(n<Ys)return-Math.ceil((Ys-Math.max(0,n))/Ys*Xs);let r=t.bottom-e;return r<Ys?Math.ceil((Ys-Math.max(0,r))/Ys*Xs):0}function rc(e,t){if(e!=null){let t=Zo[e];return t==null?null:{text:t,title:Qo[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:$o}:null}function ic(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=n.get(a);if(o!=null){for(let e of r)n.set(e,o);return o?`ignored`:null}if(t.has(a)){n.set(a,!0);for(let e of r)n.set(e,!0);return`ignored`}r.push(a)}for(let e of r)n.set(e,!1);return null}function ac(e){return e!=null&&`toggle`in e}function oc(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function sc(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function cc(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function lc(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function uc(e,t){return t&&lc(e)||(e.ctrlKey||e.metaKey)&&oc(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var dc=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function fc(e){for(let 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 pc(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 mc(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function hc(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function gc(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function _c(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let i=n.get(e)??null;return i?.dataset.itemParked===`true`?null:i}function vc(e){if(e==null)return[];let t=[];for(let n of e.querySelectorAll(`button[data-file-tree-sticky-row="true"]`)){if(!(n instanceof HTMLElement))continue;let e=n.dataset.fileTreeStickyPath;e!=null&&t.push(e)}return t}function yc(e,t){if(e==null||t==null)return null;for(let 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 bc(e,t,n,r,i,a,o){let s=Math.max(0,a-i),c=t?.getBoundingClientRect()??null,l=c==null||n==null?null:n.getBoundingClientRect().top-c.top,u=yc(e,r),d=c==null||u==null?null:u.getBoundingClientRect().top-c.top;return Math.max(0,Math.min(d??Math.max(l??0,s),Math.max(0,o-i)))}function xc(e,t){return{kind:e.kind,name:Ws(e),path:t}}function Sc(e){return e==null?void 0:`${e}__tree`}function Cc(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function wc(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function Tc(e,t){if(e==null)return null;if(`text`in e)return K(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?wc(e.icon)?t(e.icon):{name:e.icon}:wc(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return K(`span`,{title:e.title,children:K(Eo,{...n})})}function Ec(e){e!=null&&rs(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function Dc(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:i=!1,dragTargetFlattenedSegmentPath:a=null,gitDecoration:o=null,gitLaneActive:s=!1,renameInput:c=null,showDecorativeActionAffordance:l=!1}={}){let u=Us(e);return K(Qa,{children:[e.depth>0?K(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>K(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,K(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?K(Eo,{...t(`file-tree-icon-chevron`)}):K(Eo,{...t(`file-tree-icon-file`,u)})}),K(`div`,{"data-item-section":`content`,children:e.isFlattened?Hs(e,c,a):c??K(Ro,{minimumLength:5,split:`extension`,children:e.name})}),i?K(`div`,{"data-item-section":`decoration`,children:r==null?null:Tc(r,t)}):null,s?K(`div`,{"data-item-section":`git`,children:Tc(o,t)}):null,n?K(`div`,{"data-item-section":`action`,children:l?K(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:K(Eo,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function Oc(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,contextMenuEnabled:S,contextMenuTriggerMode:C,contextMenuButtonTriggerEnabled:ee,contextMenuButtonVisibility:w,contextMenuRightClickEnabled:T,registerRenameInput:E,registerButton:te,resolveIcon:ne,renderDecorationForRow:D,openContextMenuForRow:O,onRowClick:k,onKeyDown:A}=e,j=Us(t),{isParked:M=!1,mode:re=`flow`,style:ie}=r,ae=re===`sticky`,oe=_?.get(j)??null??ic(t.ancestorPaths,v,y),se=t.kind===`directory`&&(b?.has(j)??!1),ce=D(t,j),le=rc(oe,se),ue=S&&ee,de=ce!=null||x||ue,fe=ue&&w===`always`,pe=a.getPath()===j,me=pe?a.getValue():``,N=ae||!pe?null:K(ps,{ref:E,ariaLabel:`Rename ${Ws(t)}`,isFlattened:t.isFlattened,value:me,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),he=Dc(t,ne,{actionLaneEnabled:ue,customDecoration:ce,decorationLaneEnabled:de,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:le,gitLaneActive:x,renameInput:N,showDecorativeActionAffordance:fe}),ge={...ms({ariaLabel:Ws(t),domId:t.isFocused?Cc(h,j,M):void 0,extraStyle:ie,features:{actionLaneEnabled:ue,contextMenuButtonVisibility:ue?w:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:M,itemHeight:g,mode:re,row:t,state:{containsGitChange:se,effectiveGitStatus:oe,isContextHovered:s===j,isDragTarget:l?.kind===`directory`&&l.directoryPath===j,isDragging:c?.has(j)===!0,isFocusRinged:t.isFocused&&o===j},targetPath:j}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),T&&(i.focusMountedPathFromInput(j),O(t,j,{anchorRect:mc(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:ae?void 0:()=>{i.focusMountedPathFromInput(j)},onKeyDown:ae?void 0:A,ref:e=>{te(j,e)}};return!ae&&pe?K(`div`,{...ge,children:he}):K(`button`,{...ge,type:`button`,draggable:u&&!M,onDragEnd:u&&!M?p:void 0,onDragStart:u&&!M?e=>{f(e,t,j)}:void 0,onMouseDown:e=>{if(ae){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!M?e=>{m(e,t,j)}:void 0,onClick:e=>{k(e,t,j,re)},children:he})}function kc(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(Us(e))).map((n,r)=>Oc(e,n,t.start+r))}function Ac({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=Mi,overscan:c=10,renamingEnabled:l=!1,renderRowDecoration:u,searchBlurBehavior:d=`close`,searchEnabled:f=!1,searchFakeFocus:p=!1,slotHost:m,stickyFolders:h=!1,initialViewportHeight:g=420}){"use no memo";let _=Y(null),v=Y(null),y=Y(!1),b=Y(null),x=Y(null),S=Y(null),C=Y(null),ee=Y(null),w=Y(new Map),T=Y(new Map),E=Y(()=>{}),te=Y(null),ne=Y(0),D=Y(!1),O=Y(null);O.current!==t&&(D.current=!1,O.current=t);let k=Y(!1),A=Y(null),j=Y(null),M=Y(!1),re=Y(null),ie=Y(null),ae=Y(null),oe=Y(null),se=Y(null),ce=Y(null),le=Y(null),ue=Y(null),de=Y(!1),fe=Y(null),pe=Y(null),me=Y(null),N=Y(null),he=Ns(()=>new Map,[]),[,ge]=ks(0),[_e,ve]=ks(null),[ye,be]=ks(null),[xe,Ce]=ks(null),[we,Te]=ks(null),[Ee,De]=ks(0),[P,Oe]=ks(null),ke=Y(P);ke.current=P;let Ae=Y(null),je=Y(null),Me=Y(null),Ne=Y(null),Pe=Y(null),Fe=Y(!1),Ie=()=>{je.current=null,Me.current=null,Ne.current=null},Le=(e,t)=>{je.current=e,Me.current=null,Ne.current=t==null?null:{path:e,scrollTop:t}},Re=(e,t)=>{je.current=null,Me.current={path:e,viewportOffset:t},Ne.current=null},ze=Y(d===`retain`&&t.isSearchOpen()),[Be,Ve]=ks(p);js(()=>{p||Ve(!1)},[p]);let He=Y(!1),Ue=Ps(()=>{He.current=!0,Ve(e=>e&&!1)},[]),[We,Ge]=ks(()=>Ks({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Ke,qe]=ks(!1);js(()=>{qe(!0)},[]);let Je=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Ye=e?.contextMenu?.triggerMode??(Je?`right-click`:`both`),Xe=Ye===`both`||Ye===`button`,Ze=e?.contextMenu?.buttonVisibility??`when-needed`,Qe=Ye===`both`||Ye===`right-click`;Ms(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;Pe.current=t,be(t),Te(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(Fe.current=e.detail?.disabled===!0)};return e.addEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.addEventListener(`file-tree-debug-set-scroll-suppression`,n),()=>{e.removeEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.removeEventListener(`file-tree-debug-set-scroll-suppression`,n)}},[]);let $e=Ps((e,t)=>{gc(w.current,e,t)},[]),et=Ps((e,t)=>{gc(T.current,e,t)},[]),tt=Ps(e=>{x.current=e},[]),at=Ps(e=>_c(e,T.current,w.current),[]),ot=n!=null||r!=null||i!=null,{resolveIcon:st}=Ns(()=>Se(a),[a]),ct=t[Ca](),lt=ct.getPath(),ut=lt!=null,dt=t.isSearchOpen(),ft=t.getSearchValue(),F=t.getFocusedPath(),I=t.getFocusedIndex(),pt=t.getScrollRequest(),mt=t.isDragAndDropEnabled(),ht=t.getDragSession(),gt=Ns(()=>ht==null?null:new Set(ht.draggedPaths),[ht]),_t=ht?.target??null,vt=ht?.primaryPath??null,yt=Sc(o),{overlayHeight:bt,overlayRows:xt,snapshot:L,visibleRows:St}=We,R=L.physical.viewportHeight,z=Ns(()=>({end:L.window.endIndex,start:L.window.startIndex}),[L.window.endIndex,L.window.startIndex]),Ct=xt,B=L.sticky.rows,wt=L.physical.totalHeight,Tt=L.sticky.height,Et=Ns(()=>new Set(B.map(e=>Us(e.row))),[B]),Dt=I>=0&&I>=z.start&&I<=z.end,Ot=Ps((e,t)=>u?.({item:xc(e,t),row:e})??null,[u]),V=Ps(e=>rs(e==null?null:w.current.get(e)??null)?!0:rs(S.current),[]),kt=Ps(e=>{V(t.focusNearestPath(e))},[t,V]),At=Y(kt);At.current=kt;let jt=Y(!0),Mt=Y(()=>{}),Nt=Ps((t=!0)=>{let n=ke.current;n!=null&&(jt.current=jt.current&&t,Oe(null),e?.contextMenu?.onClose?.(),jt.current&&kt(n.path))},[e?.contextMenu,kt]);Mt.current=Nt;let Pt=Ps(e=>{let t=e==null?null:hc(S.current,e);Ce(e=>e===t?e:t)},[]),Ft=Ps((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=at(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Le(n,e?.scrollTop??null),k.current=!0,ve(e=>e===n?e:n)}i.focus(),Pt(a),jt.current=!0,Oe({anchorRect:r?.anchorRect??null,item:xc(e,n),path:n,source:r?.source??`keyboard`})},[t,at,Pt]),It=Ps(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=as(e,R);re.current=I<0||e==null?null:Math.max(0,Math.min(I*s-e.scrollTop,Math.max(0,t-s))),M.current=!0}t.startRenaming(e)!==!1&&(Te(`focus`),ge(e=>e+1))}},[t,I,s,l,R]),Lt=Ps((e,{restoreTreeFocus:n=!0,targetOffset:r=`live-overlay`}={})=>{let i=C.current;if(i==null)return!1;t.focusPath(e);let a=t.getFocusedIndex();if(a<0)return!1;let o=t.getVisibleRows(a,a)[0]??null;if(o==null)return!1;let l=as(i,R),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:Ks({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return k.current=!0,us(i,a,s,l,u,d),E.current(),Ae.current=n?e:null,!0},[t,s,c,R,h]),Rt=()=>y.current===!0||N.current!=null||de.current===!0,zt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Bt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},Vt=()=>{oe.current!=null&&(clearTimeout(oe.current),oe.current=null),ae.current=null},Ht=()=>{ce.current?.remove(),ce.current=null},Ut=()=>{Bt(ie.current),ie.current=null,se.current=null},Wt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Gt=()=>{ue.current?.(),ue.current=null,N.current!=null&&(clearTimeout(N.current),N.current=null),de.current=!1,fe.current=null,me.current=null,pe.current!=null&&(pe.current.setAttribute(`draggable`,`true`),pe.current.style.removeProperty(`touch-action`),pe.current=null),Ht(),Vt(),Ut(),le.current=null},Kt=(e,n)=>{let r=S.current?.getRootNode(),i=$s(Zs(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},qt=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Vt();return}let r=t.getItem(e.directoryPath),i=ac(r)?r:null;if(i==null||i.isExpanded()){Vt();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;ae.current!==a&&(Vt(),ae.current=a,oe.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind!==`directory`||n.directoryPath!==e.directoryPath||n.flattenedSegmentPath!==e.flattenedSegmentPath||i.expand()},n))},Jt=()=>{ie.current=null;let e=se.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=nc(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,E.current()),qt(Kt(e.clientX,e.clientY)),ie.current=zt(Jt)},Yt=(e,t)=>{se.current={clientX:e,clientY:t},ie.current??=zt(Jt)},Xt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Gt(),Ht(),Vt(),Ut(),t.startDrag(r)===!1){e.preventDefault();return}if(le.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),tc())){let t=ec(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Wt(t),ce.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Zt=()=>{Ht(),Vt(),Ut(),le.current=null,t.cancelDrag()},Qt=(e,n,r)=>{if(N.current!=null||de.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;me.current={clientX:i.clientX,clientY:i.clientY},pe.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!de.current;N.current!=null&&(clearTimeout(N.current),N.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),ue.current===o&&(ue.current=null),t&&(a.setAttribute(`draggable`,`true`),pe.current===a&&(pe.current=null),me.current=null)},s=e=>{let t=e.touches[0],n=me.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=Js*Js||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),ue.current=o,N.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),pe.current===a&&(pe.current=null),me.current=null;return}de.current=!0,pe.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),le.current=n;let e=a.getBoundingClientRect(),s=ec(a);Object.assign(s.style,{height:`${e.height}px`,opacity:`0.85`,transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),Wt(s),ce.current=s,fe.current={x:i.clientX-e.left,y:i.clientY-e.top};let c=e=>{let t=e.touches[0];if(t==null)return;e.preventDefault();let n=fe.current;n!=null&&ce.current!=null&&(ce.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),qt(Kt(t.clientX,t.clientY)),Yt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Kt(n.clientX,n.clientY),t.completeDrag(),Gt()},u=()=>{t.cancelDrag(),Gt()};ue.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},qs)},$t=e=>{if(P!=null){if(e.key===`Escape`){Nt(),e.preventDefault(),e.stopPropagation();return}dc.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(ct.isActive()){if(e.key===`Escape`)ct.cancel();else if(e.key===`Enter`)ct.commit();else return;Te(`focus`),ge(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){It(F??void 0),e.preventDefault(),e.stopPropagation();return}if(dt){if(e.key===`Escape`)M.current=!1,re.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=as(n,R);re.current=I<0||n==null?null:Math.max(0,Math.min(I*s-n.scrollTop,Math.max(0,r-s))),M.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;Te(`focus`),ge(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&sc(e)){t.openSearch(e.key),ge(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Je&&lc(e),r=uc(e,Je),i=r&&S.current!=null?is(S.current):null,a=r?new Set(vc(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==F&&a.has(o)){let e=C.current;Le(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=ac(p)?p:null,h=u!=null&&(Et.has(u)||c&&o===u&&a.has(u)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=C.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&u!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=_c(u,T.current,w.current);e==null||n==null?y=!1:Ft(e,u)}else if((e.ctrlKey||e.metaKey)&&oc(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;Te(`focus`);let b=t.getFocusedPath(),x=b!=null&&(Et.has(b)||a.has(b)),ee=g&&b!==u,E=n&&c&&o===u&&b===u;if((h||E)&&b!=null&&(ee&&x||E))Le(b,v?.scrollTop??null),k.current=!0,ve(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Re(b,bc(S.current,v,i,u,s,Tt,R)),k.current=!0,ve(e=>e===b?e:b)):Ie()}ge(e=>e+1),e.preventDefault(),e.stopPropagation()};Ms(()=>{if(!(!f||!dt)){if(ze.current){ze.current=!1;return}rs(ee.current)}},[dt,f]),Ms(()=>{let e=x.current;switch(fs({hasRenderedInput:e!=null,previousRenamingPath:j.current,renamingPath:lt})){case`reset`:j.current=null;return;case`reveal-canonical`:lt!=null&&Lt(lt,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(Ae.current=null,j.current=lt,rs(e),e.select());return}},[z.end,z.start,lt,Lt,Et]),Ms(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=is(e)?.dataset.itemPath??null;ve(e=>e===t?e:t)},i=()=>{n(),k.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,is(e)!=null){r();return}k.current=!1,ve(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),k.current=!1,ve(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;ve(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),Ms(()=>{let e=S.current;e!=null&&(L.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[L.physical.scrollTop]),Ms(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;te.current=as(n,g);let a=()=>{let e=t.getVisibleCount(),r=os(te.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Ge(Ks({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!D.current){D.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=os(te.current,g),i=t.getVisibleRows(e,e)[0]??null;cs(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}E.current=a;let o=!1,l=t.subscribe(()=>{o?ge(e=>e+1):o=!0,a()}),u=()=>{Fe.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,De(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||Fe.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),ke.current!=null&&y.current&&Mt.current(),Fe.current===!0){y.current=!1;return}be(e=>e==null?e:null),u()},_=()=>{u(),p()},v=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),x=e=>{v.has(e.key)&&_()};n.addEventListener(`scroll`,m,{passive:!0}),n.addEventListener(`wheel`,_,{passive:!0}),n.addEventListener(`touchmove`,_,{passive:!0}),n.addEventListener(`keydown`,x);let ee=typeof ResizeObserver<`u`?new ResizeObserver(e=>{te.current=(e[0]==null?null:ss(e[0]))??as(n,g),a()}):null;return ee?.observe(n),()=>{E.current=()=>{},l(),n.removeEventListener(`scroll`,m),n.removeEventListener(`wheel`,_),n.removeEventListener(`touchmove`,_),n.removeEventListener(`keydown`,x),e!=null&&clearTimeout(e),d!=null&&clearTimeout(d),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,te.current=null,ee?.disconnect()}},[t,g,s,c,h]),Ms(()=>{Je||P==null||Nt(!1)},[Nt,Je,P]);let en=Ns(()=>P==null?null:`${P.path}::${P.source}`,[P]);Ms(()=>{if(en==null){m?.clearSlotContent(rt);return}let t=ke.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??pc(n.getBoundingClientRect()),close:e=>{Mt.current(e?.restoreFocus??!0)},restoreFocus:()=>{jt.current&&At.current(ke.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(rt,i),e?.contextMenu?.onOpen?.(t.item,r),Ec(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&Ec(i)}),()=>{m?.clearSlotContent(rt)}},[en,e?.contextMenu,m]),Ms(()=>{P!=null&&t.getItem(P.path)==null&&Nt()},[Nt,P,t]),Ms(()=>{if(P==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(fc(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&Nt())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Nt())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[Nt,P]),Ms(()=>{let e=C.current,n=S.current;if(e==null||n==null){A.current=F;return}let r=F==null?null:w.current.get(F)??null,i=is(n),a=i?.dataset.itemPath??null,o=ut&&x.current===i,c=f&&ee.current===i,l=M.current&&!dt,u=re.current??0,d=Ae.current,p=je.current,m=Me.current,g=Ne.current,_=i!=null,v=k.current||_,y=A.current!==F,b=p!=null&&p===F&&F!=null,T=!1,te=!1;if(pt!=null&&pt.id!==ne.current){ne.current=pt.id;let n=pt.visibleIndex,r=t.getVisibleRows(n,n)[0]??null;if(r!=null){let t=h?Math.max(0,Math.min(r.ancestorPaths.length*s,Math.max(0,R-s))):Tt;T=!0,te=ls(e,n,s,R,wt,pt.offset,t)}t.clearScrollRequest(pt.id)}let D=!T&&l&&us(e,I,s,R,wt,u),O=!T&&d!=null&&d===F&&us(e,I,s,R,wt,Tt),j=!T&&m!=null&&m.path===F&&us(e,I,s,R,wt,m.viewportOffset),ie=!T&&g!=null&&g.path===F&&e.scrollTop!==g.scrollTop;if(ie&&(e.scrollTop=g.scrollTop),(ie||te||O||j||D||v&&y&&d!==F&&!b&&cs(e,I,s,R,Tt))&&E.current(),T){A.current=F;return}if(!v){A.current=F;return}if(o){A.current=F;return}if(c&&!l){A.current=F;return}if(r==null){l&&I>=0&&(us(e,I,s,R,wt,u),E.current()),A.current=F;return}(y||l||d===F||p===F||m?.path===F||g?.path===F||a==null||a!==F)&&(rs(r),d===F&&(Ae.current=null),p===F&&(je.current=null),m?.path===F&&(Me.current=null),g?.path===F&&(Ne.current=null),M.current=!1,re.current=null),A.current=F},[t,I,F,Dt,s,ut,dt,z,R,f,pt,h,Tt,wt,St]);let tn=I>=0&&I>=L.visible.startIndex&&I<=L.visible.endIndex,nn=F!=null&&Ct.some(e=>Us(e.row)===F),rn=tn||nn,an=Xe&&k.current===!0&&rn?F:null,on=we===`pointer`?ye:null,sn=P?.path??Pe.current??on??an??ye,cn=P?.source===`right-click`;Ms(()=>{y.current&&P==null||Pt(at(sn))},[P,at,z,R,Ee,Ct,sn,Pt,St]);let ln=Ps(e=>{if(y.current||fc(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&Te(e=>e===`pointer`?e:`pointer`),be(e=>e===i?e:i)},[]),un=Ps(()=>{be(null)},[]);Ms(()=>{if(!mt)return;let e=()=>{Gt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Gt(),t.cancelDrag()}},[t,mt]);let dn=e=>{if(!mt||t.getDragSession()==null||de.current)return;let n=$s(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),qt(t.getDragSession()?.target??null),Yt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},fn=e=>{if(!mt||t.getDragSession()==null||de.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Vt(),Ut(),t.setDragTarget(null))},pn=e=>{!mt||t.getDragSession()==null||de.current||(e.preventDefault(),Kt(e.clientX,e.clientY),t.completeDrag(),Ht(),Vt(),Ut(),le.current=null)},mn=L.window.height,hn=L.window.offsetTop,gn=Math.min(0,R-mn),_n=Math.min(0,R-mn-Tt),vn=_e===F||M.current,yn=F!=null&&vn&&!Dt&&I>=0?St[I]??t.getVisibleRows(I,I)[0]??null:null,bn=yn==null?null:ds(I,s,z,mn),xn=le.current,Sn=vt!=null&&xn!=null&&xn.path===vt&&xn.index>=z.start&&xn.index<=z.end,Cn=vt!=null&&xn!=null&&xn.path===vt&&!Sn&&xn.path!==yn?.path?xn:null,wn=Cn==null?null:ds(Cn.index,s,z,mn),Tn=cc((I>=0?St[I]??t.getVisibleRows(I,I)[0]??null:null)?.ancestorPaths.at(-1)??null),En=dt&&F!=null?Cc(o,F,!Dt):void 0,Dn=P?.path??(dt?F:_e),On=P?.path??ye,kn=at(sn),An=Je&&Xe&&!cn&&!ut&&kn!=null&&xe!=null&&sn!=null,jn=Je&&(An||P!=null),Mn=P?.anchorRect,Nn=Mn==null&&kn!=null&&xe!=null&&(P!=null||An)?xe:null,Pn=Mn==null?Nn==null?void 0:{top:`${Nn}px`}:{left:`${Mn.left}px`,position:`fixed`,right:`auto`,top:`${Mn.top}px`},Fn=cn?{opacity:`0`}:void 0,In=Ps((e,n,r,i)=>{let a=hs({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:dt,mode:i}),o=a.toggleDirectory&&n.kind===`directory`,s=o?t.resolveMountedDirectoryPathFromInput(r):null;if(o&&s==null)return;let c=s??r;switch(a.selection.kind){case`range`:t.selectPathRange(c,a.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(c);break;case`single`:t.selectOnlyMountedPathFromInput(c);break}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=L.visible.startIndex&&n.index<=L.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(k.current=!0,ve(e=>e===c?e:c),Te(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&Lt(c,{targetOffset:`sticky-parents`})},[t,dt,L.visible.endIndex,L.visible.startIndex,Lt]),Ln=()=>{if(y.current||!Xe||sn==null||kn==null)return;let e=t.getItem(sn);e!=null&&(Pt(kn),jt.current=!0,Oe({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:kn.getAttribute(`aria-label`)??sn,path:e.getPath()},path:e.getPath(),source:`button`}))},Rn={contextHoverPath:On,contextMenuButtonTriggerEnabled:Xe,contextMenuButtonVisibility:Ze,contextMenuEnabled:Je,contextMenuRightClickEnabled:Qe,contextMenuTriggerMode:Ye,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:mt,draggedPathSet:gt,dragTarget:_t,gitLaneActive:ot,gitStatusByPath:n,handleRowDragEnd:Zt,handleRowDragStart:Xt,handleRowTouchStart:Qt,ignoredGitDirectories:r,ignoredInheritanceCache:he,instanceId:o,itemHeight:s,onKeyDown:$t,onRowClick:In,openContextMenuForRow:Ft,registerButton:$e,registerRenameInput:tt,renameView:ct,renderDecorationForRow:Ot,resolveIcon:st,shouldSuppressContextMenu:Rt,visualFocusPath:Dn},zn={...Rn,registerButton:et};return K(`div`,{ref:S,id:yt,"data-file-tree-context-menu-button-visibility":Je&&Xe?Ze:void 0,"data-file-tree-context-menu-trigger-mode":Je?Ye:void 0,"data-file-tree-has-context-menu-action-lane":Je&&Xe?`true`:void 0,"data-file-tree-has-git-lane":ot?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:mt?fn:void 0,onDragOver:mt?dn:void 0,onDrop:mt?pn:void 0,onKeyDown:$t,onPointerLeave:Je?un:void 0,onPointerOver:Je?ln:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[K(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:Tn}}),K(`slot`,{name:nt,"data-type":`header-slot`}),f?K(`div`,{"data-file-tree-search-container":!0,"data-open":dt?`true`:`false`,children:K(`input`,{ref:ee,"aria-activedescendant":En,"aria-controls":yt,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Be?`true`:void 0,value:ft,onBlur:()=>{d===`retain`&&!He.current||t.closeSearch()},onFocus:Ue,onPointerDown:Ue,onInput:e=>{Ue();let n=e.currentTarget;t.setSearch(n.value)}})}):null,K(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Ke&&Ct.length>0?K(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:K(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${bt}px`},children:Ct.map((e,t)=>Oc(zn,e.row,`sticky:${Us(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${Ct.length-t}`}}))})}):null,K(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${wt}px`},children:[K(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${hn}px`}}),K(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${mn}px`,top:`${gn}px`,bottom:`${_n}px`},children:[kc(Rn,z,Et),yn!=null&&bn!=null?Oc(Rn,yn,`parked:${yn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:vt===yn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${bn}px`}}):null,Cn!=null&&wn!=null?Oc(Rn,Cn,`parked-drag:${Cn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${wn}px`}}):null]})]})]}),Je?K(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":jn?`true`:`false`,style:Pn,children:[K(`button`,{ref:v,type:`button`,"data-type":it,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":P==null?`false`:`true`,"data-visible":An?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),P!=null){Nt();return}Ln()},tabIndex:-1,style:Fn,children:K(Eo,{...st(`file-tree-icon-ellipsis`)})}),P==null?null:K(`slot`,{name:rt})]}):null,P==null?null:K(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),Nt()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),Nt()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var jc={hydrateRoot:(e,t)=>{xo(Xa(Ac,t),e)},renderRoot:(e,t)=>{bo(Xa(Ac,t),e)},unmountRoot:e=>{bo(null,e)}};function Mc(e,t){jc.renderRoot(e,t)}function Nc(e,t){jc.hydrateRoot(e,t)}function Pc(e){jc.unmountRoot(e)}var Fc=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#n(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#i(e);for(let[e,t]of this.#e)this.#r(e,t)}}setSlotContent(e,t){let n=this.#n(e);if(n===t){t!=null&&(this.#e.set(e,t),this.#r(e,t));return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#r(e,t)}setSlotHtml(e,t){let n=t?.trim()??``;if(n.length===0){this.setSlotContent(e,null);return}let r=this.#n(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#r(e,r);return}let i=document.createElement(`div`);i.innerHTML=n,this.setSlotContent(e,i)}#n(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let t of Array.from(n.children))if(t instanceof HTMLElement&&t.dataset.fileTreeManagedSlot===e)return t;return null}#r(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#i(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let e=t.dataset.fileTreeManagedSlot;e==null||this.#e.has(e)||this.#e.set(e,t)}}},Ic=`__c`,Lc=`__k`,Rc=`__d`,zc=`__s`,Bc=/[\s\n\\/='"\0<>]/,Vc=/^(xlink|xmlns|xml)([A-Z])/,Hc=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,Uc=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,Wc=new Set([`draggable`,`spellcheck`]);function Gc(e){e.__g===void 0?e[Rc]=!0:e.__g|=8}function Kc(e){e.__g===void 0?e[Rc]=!1:e.__g&=-9}function qc(e){return e.__g===void 0?!0===e[Rc]:!!(8&e.__g)}var Jc=/["&<]/;function Yc(e){if(e.length===0||!1===Jc.test(e))return e;for(var t=0,n=0,r=``,i=``;n<e.length;n++){switch(e.charCodeAt(n)){case 34:i=`&quot;`;break;case 38:i=`&amp;`;break;case 60:i=`&lt;`;break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=i,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var Xc={},Zc=new Set(`animation-iteration-count.border-image-outset.border-image-slice.border-image-width.box-flex.box-flex-group.box-ordinal-group.column-count.fill-opacity.flex.flex-grow.flex-negative.flex-order.flex-positive.flex-shrink.flood-opacity.font-weight.grid-column.grid-row.line-clamp.line-height.opacity.order.orphans.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.widows.z-index.zoom`.split(`.`)),Qc=/[A-Z]/g;function $c(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:Xc[n]||(Xc[n]=n.replace(Qc,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||Zc.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function el(){this.__d=!0}function tl(e,t){return{__v:e,context:t,props:e.props,setState:el,forceUpdate:el,__d:!0,__h:[]}}function nl(e,t,n){if(!e.s){if(n instanceof rl){if(!n.s)return void(n.o=nl.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(nl.bind(null,e,t),nl.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var rl=function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var a=1&i?t:n;if(a){try{nl(r,1,a(this.v))}catch(e){nl(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?nl(r,1,t?t(i):i):n?nl(r,1,n(i)):nl(r,2,i)}catch(e){nl(r,2,e)}},r},e}(),il,al,ol,sl,cl={},ll=Array.isArray,ul=Object.assign,dl=``,fl=`<!--$s-->`,pl=`<!--/$s-->`;function ml(e,t){var n,r=e.type,i=!0;return e[Ic]?(i=!1,(n=e[Ic]).state=n[zc]):n=new r(e.props,t),e[Ic]=n,n.__v=e,n.props=e.props,n.context=t,Gc(n),n.state??=cl,n[zc]??(n[zc]=n.state),r.getDerivedStateFromProps?n.state=ul({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[zc]===n.state?n.state:n[zc]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),ol&&ol(e),n.render(n.props,n.state,t)}function hl(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===dl)return dl;var s=typeof e;if(s!=`object`)return s==`function`?dl:s==`string`?Yc(e):e+dl;if(ll(e)){var c,l=dl;i[Lc]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=hl(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=dl,ll(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return dl;e.__=i,il&&il(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===Qa){if(`tpl`in g){for(var x=dl,S=0;S<g.tpl.length;S++)if(x+=g.tpl[S],g.exprs&&S<g.exprs.length){var C=g.exprs[S];if(C==null)continue;typeof C!=`object`||C.constructor!==void 0&&!ll(C)?x+=C:x+=hl(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+Yc(g.UNSTABLE_comment)+`-->`;v=g.children}else{if((_=h.contextType)!=null){var ee=t[_.__c];b=ee?ee.props.value:_.__}var w=h.prototype&&typeof h.prototype.render==`function`;if(w)v=ml(e,b),y=e[Ic];else{e[Ic]=y=tl(e,b);for(var T=0;qc(y)&&T++<25;){Kc(y),ol&&ol(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}Gc(y)}if(y.getChildContext!=null&&(t=ul({},t,y.getChildContext())),w&&G.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===Qa&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return hl(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[zc]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,cl),qc(y)?(v=ml(e,t),(y=e[Ic]).getChildContext!=null&&(t=ul({},t,y.getChildContext())),hl(v=v!=null&&v.type===Qa&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):dl}finally{al&&al(e),sl&&sl(e)}}}v=v!=null&&v.type===Qa&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var E=hl(v,t,n,r,e,a,o);return al&&al(e),G.unmount&&G.unmount(e),e._suspended?typeof E==`string`?fl+E+pl:ll(E)?(E.unshift(fl),E.push(pl),E):E.then(function(e){return fl+e+pl}):E}catch(i){if(!a&&o&&o.onError){var te=function i(s){return o.onError(s,e,function(e,s){try{return hl(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(te!==void 0)return te;var ne=G.__e;return ne&&ne(i,e),dl}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=hl(v,t,n,r,e,a,o);return e._suspended?fl+s+pl:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var D,O=`<`+h,k=dl;for(var A in g){var j=g[A];if(typeof(j=_l(j)?j.value:j)!=`function`||A===`class`||A===`className`){switch(A){case`children`:D=j;continue;case`key`:case`ref`:case`__self`:case`__source`:continue;case`htmlFor`:if(`for`in g)continue;A=`for`;break;case`className`:if(`class`in g)continue;A=`class`;break;case`defaultChecked`:A=`checked`;break;case`defaultSelected`:A=`selected`;break;case`defaultValue`:case`value`:switch(A=`value`,h){case`textarea`:D=j;continue;case`select`:r=j;continue;case`option`:r!=j||`selected`in g||(O+=` selected`)}break;case`dangerouslySetInnerHTML`:k=j&&j.__html;continue;case`style`:typeof j==`object`&&(j=$c(j));break;case`acceptCharset`:A=`accept-charset`;break;case`httpEquiv`:A=`http-equiv`;break;default:if(Vc.test(A))A=A.replace(Vc,`$1:$2`).toLowerCase();else{if(Bc.test(A))continue;A[4]!==`-`&&!Wc.has(A)||j==null?n?Uc.test(A)&&(A=A===`panose1`?`panose-1`:A.replace(/([A-Z])/g,`-$1`).toLowerCase()):Hc.test(A)&&(A=A.toLowerCase()):j+=dl}}j!=null&&!1!==j&&(O=!0===j||j===dl?O+` `+A:O+` `+A+`="`+(typeof j==`string`?Yc(j):j+dl)+`"`)}}if(Bc.test(h))throw Error(h+` is not a valid HTML tag name in `+O+`>`);if(k||(typeof D==`string`?k=Yc(D):D!=null&&!1!==D&&!0!==D&&(k=hl(D,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),al&&al(e),sl&&sl(e),!k&&gl.has(h))return O+`/>`;var M=`</`+h+`>`,re=O+`>`;return ll(k)?[re].concat(k,[M]):typeof k==`string`?re+k+M:[re,k,M]}var gl=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function _l(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var vl=0;function yl(e){return e!=null&&e.length>0?e:(vl+=1,`pst_ft_${vl}`)}function bl({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??Mi)}function xl(e){if(typeof document>`u`)return;let t=document.createElement(`div`);t.innerHTML=e;let n=t.querySelector(`svg`);return n instanceof SVGElement?n:void 0}function Sl(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 Cl(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var wl=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new Fc;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y=null;#b;#x=!1;#S=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:i,id:a,initialSearchQuery:o,icons:s,itemHeight:c,onSearchChange:l,onSelectionChange:u,overscan:d,renderRowDecoration:f,renaming:p,search:m,searchBlurBehavior:h,searchFakeFocus:g,stickyFolders:_,unsafeCSS:v,initialVisibleRowCount:y,...b}=e;this.#e=t,this.#n=yl(a),this.#p=Pa(i),this.#m=s,this.#h=v,this.#r=u,this.#i=f,this.#a=p!=null&&p!==!1,this.#o=h,this.#s=m===!0,this.#c=g===!0,this.#u=ji(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new ka({...b,fileTreeSearchMode:r,initialSearchQuery:o,onSearchChange:l,renaming:p}),this.#v=this.#t.getSelectionVersion(),this.#y=this.#r==null?null:this.subscribe(()=>{this.#D()})}unmount(){this.#b!=null&&(Pc(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}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)}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){this.#t.resetPaths(e,t)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),Mc(t.wrapper,this.#w()))}setGitStatus(e){this.#p=Pa(e,this.#p);let t=this.#T();t!=null&&Mc(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),Mc(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),Nc(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),Mc(r,this.#w())}#C(){return{initialViewportHeight:bl({initialVisibleRowCount:this.#d.initialVisibleRowCount,itemHeight:this.#d.itemHeight}),itemHeight:this.#d.itemHeight,overscan:this.#d.overscan,stickyFolders:this.#d.stickyFolders}}#w(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#m,instanceId:this.#n,renamingEnabled:this.#a,renderRowDecoration:this.#i,searchBlurBehavior:this.#o,searchEnabled:this.#s,searchFakeFocus:this.#c,slotHost:this.#l,...this.#C()}}#T(){let e=this.#f,t=this.#b;return e==null||t==null?null:{host:e,wrapper:t}}#E(e,t){let n=e.shadowRoot;n!=null&&(this.#k(n),this.#A(n)),this.#j(t)}#D(){let e=this.#r;if(e==null)return;let t=this.#t.getSelectionVersion();t!==this.#v&&(this.#v=t,e(this.#t.getSelectedPaths()))}#O(){let e=this.#e?.header?.render;if(e!=null){this.#l.setSlotContent(nt,e());return}this.#l.setSlotHtml(nt,this.#e?.header?.html??null)}#k(e){let t=Cl(e).find(e=>Sl(e)),n=xl(fe(He(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=Cl(e),n=t.find(e=>Sl(e)),r=t.filter(e=>e!==n),i=He(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=xl(i);if(a==null){for(let e of r)e.remove();return}if(!(r.length===1&&r[0].outerHTML===a.outerHTML)){for(let e of r)e.remove();e.appendChild(a)}}#j(e){let t=He(this.#m);t.colored&&D(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${Qe}]`);if(this.#g==null&&t instanceof HTMLStyleElement&&(this.#g=t),this.#h==null||this.#h===``){this.#g?.remove(),this.#g=void 0,this.#_=void 0;return}this.#g?.parentNode===e&&this.#_===this.#h||(this.#g??=document.createElement(`style`),this.#g.setAttribute(Qe,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=Ii(this.#h),this.#_=this.#h)}#N(e){if(this.#b!=null)return this.#b;let t=e.shadowRoot;if(t==null)throw Error(`FileTree requires a shadow root`);let n=Array.from(t.children).filter(e=>e instanceof HTMLDivElement&&typeof e.dataset.fileTreeId==`string`&&e.dataset.fileTreeId.length>0),r=n.find(e=>e.dataset.fileTreeId===this.#n)??n[0];return r!=null&&(this.#n=r.dataset.fileTreeId??this.#n),this.#b=r??document.createElement(`div`),this.#b.dataset.fileTreeId=this.#n,this.#b.dataset.fileTreeVirtualizedWrapper=`true`,this.#E(e,this.#b),this.#b.parentNode!==t&&t.appendChild(this.#b),this.#b}#P(e,t){let n=e??this.#f??document.createElement(`file-tree-container`);t!=null&&n.parentNode!==t&&t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:`open`});return Hi(n,r),this.#M(r),n.dataset.fileTreeVirtualized=`true`,n.style.display=`flex`,this.#F(n),this.#l.setHost(n),this.#f=n,n}#F(e){e.style.getPropertyValue(`--trees-item-height`)===``&&(e.style.setProperty(`--trees-item-height`,`${String(this.#u.itemHeight)}px`),this.#x=!0),e.style.getPropertyValue(`--trees-density-override`)===``&&(e.style.setProperty(`--trees-density-override`,String(this.#u.factor)),this.#S=!0)}#I(e){this.#x&&=(e.style.removeProperty(`--trees-item-height`),!1),this.#S&&=(e.style.removeProperty(`--trees-density-override`),!1)}},X=y(v(),1),Tl=typeof window>`u`?X.useEffect:X.useLayoutEffect;function El({file:e,options:t,lineAnnotations:n,selectedLines:r,prerenderedHTML:i,metrics:a,hasGutterRenderUtility:o,hasCustomHeader:s,disableWorkerPool:c,contentEditable:l}){let u=Ue(),d=r!==void 0,f=(0,X.useContext)(ne),p=de(),m=(0,X.useRef)(null),h=Be(r=>{if(r!=null){if(m.current!=null)throw Error(`File: An instance should not already exist when a node is created`);u==null?m.current=new S(Dl({controlledSelection:d,contentEditable:l,hasCustomHeader:s,hasEditor:p!==void 0,hasGutterRenderUtility:o,options:t}),c?void 0:f,!0):m.current=new E(Dl({controlledSelection:d,contentEditable:l,hasCustomHeader:s,hasEditor:p!==void 0,hasGutterRenderUtility:o,options:t}),u,a,c?void 0:f,!0),m.current.hydrate({file:e,fileContainer:r,lineAnnotations:n,prerenderedHTML:i})}else{if(m.current==null)throw Error(`File: A File instance should exist when unmounting`);m.current.cleanUp(),m.current=null}});return Tl(()=>{if(m.current==null)return;let i=Dl({controlledSelection:d,contentEditable:l,hasCustomHeader:s,hasEditor:p!==void 0,hasGutterRenderUtility:o,options:t}),a=!le(m.current.options,i);m.current.setOptions(i),m.current.render({file:e,lineAnnotations:n,forceRender:a}),r!==void 0&&m.current.setSelectedLines(r)}),Tl(()=>{if(l&&m.current!=null){if(p===void 0)throw Error(`File: Editor is not attached`);return p.edit(m.current)}},[l,p]),{ref:h,getHoveredLine:(0,X.useCallback)(()=>m.current?.getHoveredLine(),[])}}function Dl({options:e,controlledSelection:t,contentEditable:n,hasCustomHeader:r,hasEditor:i,hasGutterRenderUtility:a}){let o=n&&i,s=t||a||r;if(!s&&!o)return e;let c={...e};return s&&(c={...c,controlledSelection:t,renderCustomHeader:r?k:e?.renderCustomHeader,renderGutterUtility:a?k:e?.renderGutterUtility}),o&&(c={...c,useTokenTransformer:!0}),c}var Z=l();function Ol({file:e,lineAnnotations:t,selectedLines:n,options:r,metrics:i,className:a,style:o,renderAnnotation:s,renderCustomHeader:c,renderHeaderPrefix:l,renderHeaderMetadata:u,prerenderedHTML:d,renderGutterUtility:f,disableWorkerPool:p=!1,contentEditable:m=!1}){let{ref:h,getHoveredLine:g}=El({file:e,options:r,metrics:i,lineAnnotations:t,selectedLines:n,prerenderedHTML:d,hasGutterRenderUtility:f!=null,hasCustomHeader:c!=null,disableWorkerPool:p,contentEditable:m});return(0,Z.jsx)(Ne,{ref:h,className:a,style:o,children:xe(w({file:e,renderAnnotation:s,renderCustomHeader:c,renderHeaderPrefix:l,renderHeaderMetadata:u,renderGutterUtility:f,lineAnnotations:t,getHoveredLine:g}),d)})}var kl=r(),Al=[`.avif`,`.gif`,`.ico`,`.jpeg`,`.jpg`,`.png`,`.svg`,`.webp`];function jl(e,t){let n=e.split(/[?#]/,1)[0]?.toLowerCase()??``;return t.some(e=>n.endsWith(e))}function Ml(e){return jl(e,Al)}var Nl=100,Pl=class{#e=[];#t=[];#n;constructor(e){this.#n=Math.max(1,e?.maxEntries??Nl)}get canUndo(){return this.#e.length>0}get canRedo(){return this.#t.length>0}clear(){this.#e.length=0,this.#t.length=0}clearRedo(){this.#t.length=0}push(e){this.#e.push(e),this.clearRedo(),this.#e.length>this.#n&&this.#e.shift()}setLastUndoSelectionsAfter(e){let t=this.#e[this.#e.length-1];t!==void 0&&(t.selectionsAfter=e.map(e=>({...e})))}setLastUndoLineAnnotations(e,t){let n=this.#e[this.#e.length-1];n!==void 0&&(n.lineAnnotationsBefore=e.slice(),n.lineAnnotationsAfter=t.slice())}peekUndo(){return this.#e[this.#e.length-1]}replaceLastUndo(e){if(this.#e.length===0){this.push(e);return}this.#e[this.#e.length-1]=e,this.clearRedo()}popUndoToRedo(){let e=this.#e.pop();if(e!==void 0)return this.#t.push(e),e}popRedoToUndo(){let e=this.#t.pop();if(e!==void 0)return this.#e.push(e),e}};function Fl(e,t,n,r,i,a,o,s){let c=[...t].sort((e,t)=>e.start-t.start),l=[];for(let t=0,n=0;t<c.length;t++){let r=c[t],i=e.getTextSlice(r.start,r.end),a=r.start+n;l.push({start:a,end:a+r.text.length,text:i}),n+=r.text.length-(r.end-r.start)}return{forwardEdits:c.map(e=>({...e})),inverseEdits:l,versionBefore:n,versionAfter:r,selectionsBefore:i?.map(e=>({...e})),selectionsAfter:a?.map(e=>({...e})),lineAnnotationsBefore:o?.slice(),lineAnnotationsAfter:s?.slice()}}function Il(e,t){if(e===void 0||e.forwardEdits.length===0||e.forwardEdits.length!==e.inverseEdits.length||e.forwardEdits.length!==t.forwardEdits.length||t.forwardEdits.length!==t.inverseEdits.length)return!1;let n;for(let r=0;r<e.forwardEdits.length;r++){let i=e.forwardEdits[r],a=e.inverseEdits[r],o=t.forwardEdits[r],s=t.inverseEdits[r],c=zl(o.start,e.forwardEdits),l=i.start<=i.end&&i.text.length>0&&!i.text.includes(`
1672
1672
  `)&&!a.text.includes(`
1673
1673
  `),u=o.start===o.end&&o.text.length>0&&s.text.length===0;if(l&&u){if(c!==i.end||(n??=`insert`,n!==`insert`))return!1;continue}let d=i.text.length===0&&i.end>i.start&&a.text.length>0,f=o.text.length===0&&o.end>o.start&&s.text.length>0;if(d&&f){if(c===i.end){if(n??=`delete`,n!==`delete`)return!1;continue}if(c+(o.end-o.start)!==i.start||(n??=`backspace`,n!==`backspace`))return!1;continue}return!1}return n!==void 0}function Ll(e,t){let n=[],r=[];for(let i=0;i<e.forwardEdits.length;i++){let a=e.forwardEdits[i],o=e.inverseEdits[i],s=t.forwardEdits[i],c=t.inverseEdits[i],l=zl(s.start,e.forwardEdits);if(a.text.length>0){n.push({start:a.start,end:a.end,text:a.text+s.text}),r.push(o.text);continue}if(l===a.end){n.push({start:a.start,end:l+(s.end-s.start),text:``}),r.push(o.text+c.text);continue}n.push({start:Math.min(a.start,l),end:a.end,text:``}),r.push(c.text+o.text)}return{forwardEdits:n,inverseEdits:Rl(n,r),versionBefore:e.versionBefore,versionAfter:t.versionAfter,selectionsBefore:e.selectionsBefore?.slice(),selectionsAfter:t.selectionsAfter?.slice(),lineAnnotationsBefore:e.lineAnnotationsBefore?.slice(),lineAnnotationsAfter:t.lineAnnotationsAfter?.slice()}}function Rl(e,t){let n=[];for(let r=0,i=0;r<e.length;r++){let a=e[r],o=a.start+i;n.push({start:o,end:o+a.text.length,text:t[r]}),i+=a.text.length-(a.end-a.start)}return n}function zl(e,t){let n=e;for(let e of t){let t=e.end-e.start,r=e.text.length,i=r-t;if(!(n<e.start)){if(n>=e.start+r){n-=i;continue}n=e.start+Math.min(n-e.start,t)}}return n}var Bl=1e5,Vl=`\`~!@#$%^&*()-=+[{]}\\|;:'",.<>/?`,Hl=class{static Original=0;static Added=1;constructor(e,t,n,r,i){this.source=e,this.offset=t,this.length=n,this.lineOffsetStart=r,this.lineOffsetEnd=i}get lineBreakCount(){return this.lineOffsetEnd-this.lineOffsetStart}},Ul=class{lineOffsets;constructor(e){this.text=e,this.lineOffsets=O(e)}append(e){let t=this.text.length,n=O(e);for(let e=1;e<n.length;e++)this.lineOffsets.push(t+n[e]);return this.text+=e,t}},Wl=class{left=null;right=null;parent=null;constructor(e,t=e.length,n=e.lineBreakCount){this.piece=e,this.subtreeLength=t,this.subtreeLineBreakCount=n}updateSubtreeLength(){this.subtreeLength=(this.left?.subtreeLength??0)+this.piece.length+(this.right?.subtreeLength??0),this.subtreeLineBreakCount=(this.left?.subtreeLineBreakCount??0)+this.piece.lineBreakCount+(this.right?.subtreeLineBreakCount??0)}},Gl=class{#e;#t=new Ul(``);#n=null;#r=[];#i=0;#a=0;#o=null;#s=null;constructor(e){this.#e=new Ul(e),this.#y([this.#_(Hl.Original,0,e.length)])}get lineCount(){return this.#a}getText(e){if(e===void 0)return this.#m();let t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this.getTextSlice(t,n)}getLineText(e,t=!1){if(this.#o!==null&&this.#o[0]===e&&this.#o[1]===t)return this.#o[2];let n=this.#d(e);if(n===void 0)throw Error(`Line index out of range: ${e}`);let r=this.getTextSlice(n[0],n[1],!t);return this.#o=[e,t,r],this.#s=[e,t,r.length],r}getLineLength(e,t=!1){let n=this.#s,r=this.#o;if(n!==null&&n[0]===e&&n[1]===t)return n[2];if(r!==null&&r[0]===e&&r[1]===t){let n=r[2].length;return this.#s=[e,t,n],n}let i=this.#d(e);if(i===void 0)throw Error(`Line index out of range: ${e}`);let[a,o]=i,s=o-a;if(!t)for(;s>0&&Kl(this.charAt(a+s-1).charCodeAt(0));)s--;return this.#s=[e,t,s],s}getTextSlice(e,t,n=!1){if(e>=t)return``;let r=ql(e,0,this.#i),i=ql(t,r,this.#i);if(r>=i)return``;let a=this.#l(r);if(a===void 0)return``;let o=[],[s,c]=a,l=i-r;for(;s!==null&&l>0;){let e=Math.min(s.piece.length-c,l),t=this.#g(s.piece.source),r=s.piece.offset+c,i=r+e;if(n)for(;i>r&&Kl(t.text.charCodeAt(i-1));)i--;o.push(t.text.slice(r,i)),l-=e,c=0,s=this.#u(s)}return o.join(``)}charAt(e){let t=this.#l(e);if(t===void 0)return``;let[n,r]=t;return this.#g(n.piece.source).text.charAt(n.piece.offset+r)}includes(e){if(e.length===0)return!0;let t=Jl(e),n=0,r=!1;return this.#h(i=>{for(let a=i.start;a<i.end;a++){let o=i.text.charCodeAt(a);for(;n>0&&o!==e.charCodeAt(n);)n=t[n-1];if(o===e.charCodeAt(n)&&n++,n===e.length)return r=!0,!1}return!0}),r}findNextNonOverlappingSubstring(e,t){if(e.length===0||e.length>this.#i)return;let n=Yl(t,this.#i),r=n.reduce((e,[,t])=>Math.max(e,t),0),i=Jl(e),a=0,o=0,s,c;return this.#h(t=>{for(let l=t.start;l<t.end;l++){let u=t.text.charCodeAt(l);for(;a>0&&u!==e.charCodeAt(a);)a=i[a-1];if(u===e.charCodeAt(a)&&a++,a===e.length){let t=o-e.length+1;if(!Xl(n,t,t+e.length)){if(t>=r)return c=t,!1;s??=t}a=i[a-1]}o++}return!0}),c??s}search(e){if(e.text.length===0||this.#i===0||e.text.includes(`
1674
1674
  `)||e.text.includes(`\r`)||e.regex&&(e.text.includes(`\\n`)||e.text.includes(`\\r`)))return[];let t;try{t=ru(e.text,e.regex,e.caseSensitive)}catch{return[]}return this.#c(t,e.wholeWord,Bl)}#c(e,t,n){let r=[],i=this.#i,a=e=>this.charAt(e);for(let o=0;o<this.#a;o++){let s=this.getLineText(o),c=this.offsetAt({line:o,character:0}),l=new RegExp(e.source,e.flags);l.lastIndex=0;let u;for(;(u=l.exec(s))!==null;){let e=u.index,o=u[0];if(o.length===0){l.lastIndex=ou(s,e);continue}let d=c+e;if((!t||tu(d,o.length,i,a))&&(r.push([d,d+o.length]),r.length>=n))return r;e===l.lastIndex&&(l.lastIndex=ou(s,e))}}return r}insert(e,t){if(e.length===0)return;let n=ql(t,0,this.#i),r=this.#t.append(e),i=this.#_(Hl.Added,r,e.length),a=this.#v(),o=[],s=0,c=!1;for(let e of a){let t=s+e.length;if(!c&&n<=t){let t=n-s;t>0&&o.push(this.#_(e.source,e.offset,t)),o.push(i),t<e.length&&o.push(this.#_(e.source,e.offset+t,e.length-t)),c=!0}else o.push(e);s=t}c||o.push(i),this.#y(o),this.#o=null,this.#s=null}delete(e,t){if(t<=0||this.#i===0)return;let n=ql(e,0,this.#i),r=ql(n+t,n,this.#i);if(n===r)return;let i=[],a=0;for(let e of this.#v()){let t=a,o=a+e.length,s=ql(n-t,0,e.length),c=ql(o-r,0,e.length);s>0&&i.push(this.#_(e.source,e.offset,s)),c>0&&i.push(this.#_(e.source,e.offset+e.length-c,c)),a=o}this.#y(i),this.#o=null,this.#s=null}applyEdits(e){if(e.length===0)return;let t=0,n=0,r=0,i=this.#v(),a=e.map(e=>e.text.length===0?void 0:this.#_(Hl.Added,this.#t.append(e.text),e.text.length)),o=[],s=()=>{let e=i[t];e!==void 0&&(n+=e.length,t++)},c=(e,r)=>{let a=ql(e,0,this.#i),c=ql(r,a,this.#i);for(;t<i.length&&n+i[t].length<=a;)s();for(;t<i.length&&a<c;){let e=i[t],r=n+e.length,l=ql(a-n,0,e.length),u=Math.min(r,c),d=u-(n+l);d>0&&o.push(l===0&&d===e.length?e:this.#_(e.source,e.offset+l,d)),a=u,a>=r&&s()}};for(let t=0;t<e.length;t++){let n=e[t],i=ql(n.start,r,this.#i),s=ql(n.end,i,this.#i);c(r,i);let l=a[t];l!==void 0&&o.push(l),r=s}c(r,this.#i),this.#y(o),this.#o=null,this.#s=null}positionAt(e){let t=ql(e,0,this.#i);if(this.#i===0)return{line:0,character:0};let n=this.#f(t);return{line:n,character:t-(n===0?0:this.#p(n-1))}}positionsAt(e){let t=Array.from({length:e.length});if(e.length===0)return t;if(this.#i===0)return t.fill({line:0,character:0});for(let n=0;n<e.length;n++)t[n]=this.positionAt(e[n]);return t}offsetAt(e){if(e.line<0||this.#i===0)return 0;if(e.line>=this.#a)throw Error(`Line index out of range: ${e.line}`);let t=this.#d(e.line);if(t===void 0)throw Error(`Line index out of range: ${e.line}`);let n=ql(e.character,0,t[1]-t[0]);return t[0]+n}#l(e){if(e<0||e>=this.#i)return;let t=this.#n,n=e;for(;t!==null;){let e=t.left?.subtreeLength??0;if(n<e){t=t.left;continue}if(n-=e,n<t.piece.length)return[t,n];n-=t.piece.length,t=t.right}}#u(e){if(e.right!==null){let t=e.right;for(;t.left!==null;)t=t.left;return t}let t=e;for(;t.parent!==null&&t===t.parent.right;)t=t.parent;return t.parent}#d(e){if(e<0)throw Error(`Line index out of range: ${e}`);if(this.#i===0){if(e===0)return[0,0];throw Error(`Line index out of range: ${e}`)}if(e>=this.#a)throw Error(`Line index out of range: ${e}`);return[e===0?0:this.#p(e-1),e<this.#a-1?this.#p(e):this.#i]}#f(e){let t=this.#n,n=ql(e,0,this.#i),r=0;for(;t!==null;){let e=t.left?.subtreeLength??0;if(n<e){t=t.left;continue}if(r+=t.left?.subtreeLineBreakCount??0,n-=e,n<=t.piece.length){let e=this.#g(t.piece.source);return r+=Ql(e.lineOffsets,t.piece.offset+n)-t.piece.lineOffsetStart,r}r+=t.piece.lineBreakCount,n-=t.piece.length,t=t.right}return this.#a-1}#p(e){let t=this.#n,n=e,r=0;for(;t!==null;){let e=t.left?.subtreeLineBreakCount??0;if(n<e){t=t.left;continue}let i=t.left?.subtreeLength??0;if(r+=i,n-=e,n<t.piece.lineBreakCount){let e=this.#g(t.piece.source).lineOffsets[t.piece.lineOffsetStart+n];return r+(e-t.piece.offset)}r+=t.piece.length,n-=t.piece.lineBreakCount,t=t.right}return this.#i}#m(){let e=[];return this.#h(t=>{e.push(t.text.slice(t.start,t.end))}),e.join(``)}#h(e){this.#x(this.#n,t=>{let n=this.#g(t.piece.source);return e({text:n.text,lineOffsets:n.lineOffsets,lineOffsetStart:t.piece.lineOffsetStart,lineOffsetEnd:t.piece.lineOffsetEnd,start:t.piece.offset,end:t.piece.offset+t.piece.length})})}#g(e){return e===Hl.Original?this.#e:this.#t}#_(e,t,n){let r=this.#g(e);return new Hl(e,t,n,Ql(r.lineOffsets,t),Ql(r.lineOffsets,t+n))}#v(){return this.#r}#y(e){let t=Zl(e);this.#r=t;let n=0,r=0;for(let e of t)n+=e.length,r+=e.lineBreakCount;this.#n=this.#b(t,0,t.length,null),this.#i=n,this.#a=r+1}#b(e,t,n,r){if(t>=n)return null;let i=t+Math.floor((n-t)/2),a=new Wl(e[i]);return a.parent=r,a.left=this.#b(e,t,i,a),a.right=this.#b(e,i+1,n,a),a.updateSubtreeLength(),a}#x(e,t){return e===null?!0:!this.#x(e.left,t)||t(e)===!1?!1:this.#x(e.right,t)}};function Kl(e){return e===10||e===13}function ql(e,t,n){return Math.min(Math.max(e,t),n)}function Jl(e){let t=Array.from({length:e.length}).fill(0),n=0;for(let r=1;r<e.length;r++){let i=e.charCodeAt(r);for(;n>0&&i!==e.charCodeAt(n);)n=t[n-1];i===e.charCodeAt(n)&&n++,t[r]=n}return t}function Yl(e,t){let n=[];for(let[r,i]of e){let e=ql(r,0,t),a=ql(i,e,t);e<a&&n.push([e,a])}n.sort((e,t)=>e[0]-t[0]);let r=[];for(let e of n){let t=r[r.length-1];if(t!==void 0&&e[0]<=t[1]){t[1]=Math.max(t[1],e[1]);continue}r.push(e)}return r}function Xl(e,t,n){let r=0,i=e.length;for(;r<i;){let n=r+Math.floor((i-r)/2);e[n][1]<=t?r=n+1:i=n}let a=e[r];return a!==void 0&&a[0]<n}function Zl(e){let t=[];for(let n of e){if(n.length===0)continue;let e=t[t.length-1];if(e!==void 0&&e.source===n.source&&e.offset+e.length===n.offset){t[t.length-1]=new Hl(e.source,e.offset,e.length+n.length,e.lineOffsetStart,n.lineOffsetEnd);continue}t.push(n)}return t}function Ql(e,t){let n=0,r=e.length;for(;n<r;){let i=n+Math.floor((r-n)/2);e[i]<=t?n=i+1:r=i}return n}function $l(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function eu(e){if(e<=32||e===127)return!0;let t=String.fromCharCode(e);return Vl.includes(t)}function tu(e,t,n,r){let i=e<=0||eu(nu(r,e-1)),a=e+t>=n||eu(nu(r,e+t));return i&&a}function nu(e,t){let n=e(t);return n.length===0?0:n.charCodeAt(0)}function ru(e,t,n){let r=t?e:$l(e);return new RegExp(r,`g${n?``:`i`}${t?`m`:``}`)}function iu(e,t){return e.replace(/\$([$&]|\d+)/g,(e,n)=>n===`$`?`$`:n===`&`?t[0]??``:t[Number(n)]??``)}function au(e,t,n,r,i,a){if(!r.regex)return r.replaceText;let o=e(i),s=n(o.line),c=i-t({line:o.line,character:0}),l=s.slice(c,c+(a-i)),u;try{u=ru(r.text,!0,r.caseSensitive)}catch{return r.replaceText}let d=new RegExp(u.source,u.flags.replace(`g`,``)).exec(l);return d===null||d[0].length!==l.length?r.replaceText:iu(r.replaceText,d)}function ou(e,t){if(t+1<e.length){let n=e.charCodeAt(t),r=e.charCodeAt(t+1);if(n>=55296&&n<=56319&&r>=56320&&r<=57343)return t+2}return t+1}var su=class{#e;#t;#n;#r;#i;constructor(e,t,n=`plaintext`,r=0,i=new Pl){this.#e=new URL(e,`file://`).toString(),this.#t=n,this.#n=r,this.#r=new Gl(t),this.#i=i}get uri(){return this.#e}get languageId(){return this.#t}get version(){return this.#n}get lineCount(){return this.#r.lineCount}get canUndo(){return this.#i.canUndo}get canRedo(){return this.#i.canRedo}positionAt(e){return this.#r.positionAt(e)}positionsAt(e){return this.#r.positionsAt(e)}offsetAt(e){return this.#r.offsetAt(this.normalizePosition(e))}getText(e){return this.#r.getText(e)}getLineText(e,t){return this.#r.getLineText(e,t)}getLineLength(e,t){return this.#r.getLineLength(e,t)}charAt(e){return typeof e==`number`?this.#r.charAt(e):this.#r.charAt(this.offsetAt(e))}getTextSlice(e,t){return this.#r.getTextSlice(e,t)}findNextNonOverlappingSubstring(e,t){return this.#r.findNextNonOverlappingSubstring(e,t)}search(e){return this.#r.search(e)}applyEdits(e,t=!1,n,r){if(e.length!==0)return this.applyResolvedEdits(e.map(e=>this.#a(e)),t,n,r)}applyResolvedEdits(e,t=!1,n,r){if(e.length===0)return;let i=this.#o(e);if(t){let e=Fl(this,i,this.#n,this.#n+1,n,r),t=this.#i.peekUndo(),a=this.#s(i);return this.#n++,a.lineDelta===0&&Il(t,e)?this.#i.replaceLastUndo(Ll(t,e)):this.#i.push(e),a}let a=this.#s(i);return this.#n++,a}setLastUndoSelectionsAfter(e){this.#i.setLastUndoSelectionsAfter(e)}setLastUndoLineAnnotations(e,t){this.#i.setLastUndoLineAnnotations(e,t)}undo(){let e=this.#i.popUndoToRedo();if(e===void 0)return;let t=this.#s(e.inverseEdits);if(t!==void 0)return this.#n=e.versionBefore,[t,e.selectionsBefore?.slice(),e.lineAnnotationsBefore?.slice()]}redo(){let e=this.#i.popRedoToUndo();if(e===void 0)return;let t=this.#s(e.forwardEdits);if(t!==void 0)return this.#n=e.versionAfter,[t,e.selectionsAfter?.slice(),e.lineAnnotationsAfter?.slice()]}normalizePosition(e){let t=Math.max(0,Math.min(e.line,this.lineCount-1));return{line:t,character:Math.max(0,Math.min(e.character,this.getLineLength(t)))}}#a(e){let t=this.offsetAt(e.range.start),n=this.offsetAt(e.range.end);if(t>n){let e=t;t=n,n=e}return{start:t,end:n,text:e.newText}}#o(e){let t=[...e].sort((e,t)=>e.start-t.start);for(let e=0;e<t.length-1;e++)if(t[e].end>t[e+1].start)throw Error(`Overlapping text edits are not supported`);return t}#s(e){let t=this.#r.lineCount,n=this.positionsAt(e.flatMap(e=>[e.start,e.end])),r=this.#c(e,n),i=n[0];this.#r.applyEdits(e);let a=this.#r.lineCount;return{startLine:r.startLine,startCharacter:i.character,endLine:Math.min(r.endLine,Math.max(0,a-1)),previousLineCount:t,lineCount:a,lineDelta:a-t,changedLineRanges:r.ranges}}#c(e,t){let n=1/0,r=0,i=0,a=[];for(let o=0;o<e.length;o++){let s=e[o],c=t[o*2].line,l=t[o*2+1].line,u=cu(s.text),d=c+i,f=d+u;n=Math.min(n,c),r=Math.max(r,f);let p=a[a.length-1];p!==void 0&&d<=p[1]+1?a[a.length-1]=[p[0],Math.max(p[1],f)]:a.push([d,f]),i+=u-(l-c)}return n===1/0?{startLine:0,endLine:0,ranges:[[0,0]]}:{startLine:n,endLine:r,ranges:a}}};function cu(e){let t=0;for(let n=0;n<e.length;n++)e.charCodeAt(n)===10&&t++;return t}var lu=void 0,uu=void 0,du=void 0;function fu(){return lu??=/macOS|MacIntel|iPhone|iPad|iPod/i.test(_u())}function pu(){return uu??=/Linux/i.test(_u())}function mu(){return du??=`safari`in window&&`pushNotification`in window.safari||/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function hu({metaKey:e,ctrlKey:t},n=fu()){return n?e&&!t:t&&!e}function gu(e){if((fu()||pu())&&e.ctrlKey&&!e.altKey&&!e.metaKey)switch(e.key){case`a`:return`start`;case`e`:return`end`;case`p`:return`up`;case`n`:return`down`;case`f`:return`right`;case`b`:return`left`}if(!e.altKey&&!e.ctrlKey&&!e.metaKey){if(e.key===`ArrowUp`)return`up`;if(e.key===`ArrowDown`)return`down`;if(e.key===`ArrowLeft`)return`left`;if(e.key===`ArrowRight`)return`right`}if(hu(e)){if(e.key===`ArrowLeft`)return`textStart`;if(e.key===`ArrowRight`)return`end`}}function _u(){let e=globalThis.navigator;return e?.platform??e?.userAgentData?.platform??`unknown`}var vu={a:`selectAll`,d:`findNextMatch`};function yu(e,t=fu()){let n=hu(e,t),{shiftKey:r,altKey:i,key:a}=e,o=a.length===1?a.toLowerCase():a;if(n&&(o===`f`||e.code===`KeyF`))return i?`openSearchReplacePanel`:`openSearchPanel`;if(!i){if(!n&&o===`Tab`)return r?`outdent`:`indent`;if(n)return o===`z`?r?`redo`:`undo`:!t&&o===`y`?`redo`:o===`Home`||t&&o===`ArrowUp`?r?`expandSelectionDocStart`:`moveCursorToDocStart`:o===`End`||t&&o===`ArrowDown`?r?`expandSelectionDocEnd`:`moveCursorToDocEnd`:vu[o]}}var bu=`@layer base,theme,rendered,unsafe;::selection{background-color:#0000}@keyframes blinking{0%{opacity:1}50%{opacity:0}to{opacity:1}}:host,[data-code],[data-content]{position:relative}[data-content]{caret-color:var(--diffs-bg-caret);background-color:#0000;outline:none}[data-gutter-buffer],[data-line]:not([data-selected-line]),[data-line]:not([data-selected-line]) span,[data-line-annotation]{background-color:#0000}[data-column-number]{color:var(--diffs-editor-line-number-fg)}[data-column-number][data-selected-line]{background-color:var(--diffs-editor-line-number-active-bg);color:var(--diffs-editor-line-number-active-fg)}[data-column-number][data-active]{color:var(--diffs-editor-line-number-active-fg)}[data-line]{cursor:text}[data-line][data-selected-line]{background-color:var(--diffs-editor-line-highlight-bg)}[data-line][data-line-type=change-deletion]{background-color:var(--diffs-line-bg)}[data-editor-overlay]{display:contents}[data-caret],[data-selection-range],[data-match-range],[data-marker-range]{height:1lh;line-height:var(--diffs-line-height);pointer-events:none;position:absolute;top:0;left:0}[data-caret]{background-color:var(--diffs-bg-caret-override,var(--diffs-editor-cursor-fg,light-dark(color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg)),color-mix(in lab, var(--diffs-fg) 75%, var(--diffs-bg)))));visibility:hidden;width:2px;animation:1.2s .8s infinite blinking}[data-selection-range]{z-index:-10;background-color:var(--diffs-editor-selection-bg)}[data-selection-corner]{background-color:var(--diffs-bg);width:100%;height:100%}[data-match-range]{z-index:-10;background-color:var(--diffs-editor-match-bg,var(--diffs-editor-selection-bg))}[data-match-range]:not([data-focus]){background-color:var(--diffs-editor-match-highlight-bg,light-dark(#ff963288,#ff963266))}[data-marker-range]{z-index:1;mask-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2IiBoZWlnaHQ9IjMiPjxwYXRoIGQ9Im0wIDIuNSBsMiAtMS41IGwxIDAgbDIgMS41IGwxIDAiIHN0cm9rZT0iI2ZmZiIgZmlsbD0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIi8+PC9zdmc+);mask-position:0 100%;mask-size:6px 3px;mask-repeat:repeat-x}[data-marker-error]{background-color:var(--diffs-editor-error-fg,red)}[data-marker-warning]{background-color:var(--diffs-editor-warning-fg,#cca700)}[data-marker-info]{background-color:var(--diffs-editor-info-fg,#3794ff)}[data-marker-hint]{background-color:var(--diffs-editor-hint-fg,#6a6a6a)}[data-rtl]{border-top-left-radius:3px}[data-rtr]{border-top-right-radius:3px}[data-rbl]{border-bottom-left-radius:3px}[data-rbr]{border-bottom-right-radius:3px}@media (width>=480px){[data-content]{caret-color:#0000}[data-selection-action]{caret-color:currentColor}[data-content]:focus~[data-editor-overlay] [data-caret]{visibility:visible}}[data-editor-widget]{--diffs-widget-bg:color-mix(in lab, var(--diffs-fg) 4%, var(--diffs-bg));--diffs-widget-border:color-mix(in lab, var(--diffs-fg) 20%, transparent);--diffs-widget-shadow:inset 0 0 0 1px var(--diffs-bg), 0 4px 8px #00000013, 0 6px 18px #00000013;z-index:100;border:1px solid var(--diffs-widget-border);background-color:var(--diffs-widget-bg);width:fit-content;max-width:calc(100% - 24px);box-shadow:var(--diffs-widget-shadow);background-clip:padding-box;border-radius:9px;position:absolute;top:0;left:0}[data-marker-popup]{pointer-events:auto;min-width:180px;font-family:var(--diffs-header-font-fallback);padding:8px 12px;font-size:14px;line-height:1.4}[data-marker-popup] code{background-color:#0000;display:inline}[data-selection-action-icon]{z-index:10;width:1lh;height:1lh;color:color-mix(in lab, var(--diffs-fg) 40%, var(--diffs-bg));cursor:pointer;visibility:hidden;border-radius:4px;justify-content:center;align-items:center;transition:background-color .1s ease-in-out,color .1s ease-in-out;display:flex;position:absolute;top:0;left:-1lh}[data-selection-action-icon][data-visible=true]{visibility:visible}[data-selection-action-icon]:hover{background-color:color-mix(in lab, var(--diffs-fg) 8%, var(--diffs-bg));color:var(--diffs-fg)}[data-selection-action]{padding-inline-end:1ch}[data-search-panel]{z-index:100;flex-direction:column;justify-content:right;width:100%;height:fit-content;margin-bottom:4px;display:flex;position:sticky;top:12px;right:12px}[data-search-panel] [data-editor-widget]{z-index:100;max-width:100%;font-family:var(--diffs-header-font-fallback);align-items:flex-start;gap:8px;margin-inline:auto 12px;padding:4px;font-size:14px;display:flex;position:relative}[data-search-grid]{grid-template-columns:auto auto auto;align-items:center;gap:4px 6px;display:grid}[data-search-grid][data-mode=find] [data-replace-cell]{display:none}[data-input-box]{align-items:center;width:200px;display:flex;position:relative}[data-input-box] input{width:100%;min-width:0;color:var(--diffs-fg);background-color:var(--diffs-bg);border:1px solid color-mix(in lab, var(--diffs-fg) 12%, var(--diffs-bg));border-radius:6px;outline:none;flex-grow:1;padding-inline:6px;font-size:13px;line-height:24px}[data-input-box][data-find] input{padding-inline-end:72px}[data-input-box] input::selection{background-color:color-mix(in lab, var(--diffs-fg) 8%, var(--diffs-bg))}[data-search-toggles]{align-items:center;gap:1px;display:flex;position:absolute;top:50%;right:4px;transform:translateY(-50%)}[data-matches]{white-space:nowrap;min-width:50px;color:color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg));flex-shrink:0;font-size:12px;font-weight:500;line-height:20px}[data-matches][data-no-matches]{color:color-mix(in lab, var(--diffs-fg) 35%, var(--diffs-bg))}[data-replace-actions],[data-search-nav]{align-items:center;display:flex}[data-search-panel] svg{fill:currentColor;display:block}[data-search-panel] [data-icon]{width:24px;height:24px;color:color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg));cursor:pointer;border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;transition:background-color .1s ease-in-out,color .1s ease-in-out;display:flex}[data-search-panel] [data-icon][data-disabled=true]{opacity:.25;pointer-events:none}[data-search-panel] [data-icon]:hover{color:var(--diffs-fg)}[data-search-panel] [data-icon][data-active=true]{color:light-dark(var(--diffs-modified-light),var(--diffs-modified-dark))}`;function Q(e,t,n){let{style:r,dataset:i,children:a,...o}=t??{},s=document.createElement(e);return Object.assign(s,o),r!==void 0&&(typeof r==`string`?s.style.cssText=r:Object.assign(s.style,r)),i!==void 0&&(typeof i==`string`?s.dataset[i]=``:Array.isArray(i)?i.forEach(e=>{s.dataset[e]=``}):Object.assign(s.dataset,i)),a!==void 0&&s.replaceChildren(...a),n!==void 0&&n.appendChild(s),s}function $(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function xu(e,t=`line`){let n=e.dataset[t];if(n===void 0)return;let r=parseInt(n,10);if(!Number.isNaN(r))return r}function Su(e,t){if(e.nodeType===3){let n=e.textContent?.length??0;return Math.max(0,Math.min(t,n))}return e.nodeType===1?Math.max(0,Math.min(t,e.childNodes.length)):0}function Cu(e,t){return Object.assign(e,t)}function wu(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout(()=>e.apply(this,r),t)}}function Tu(e,t=1e3){return Math.round(e*t)/t}function Eu(e,t){if(e.lineDelta===0)return;let n=e.startCharacter,r=Math.max(0,-e.lineDelta),i=r===0?void 0:e.startLine+(n===0?0:1),a=i===void 0?void 0:i+r,o=r>0?e.startLine+r:e.startLine+(n===0?0:1),s=[],c=!1;for(let n of t){if(n.side===`deletions`){s.push(n);continue}let t=n.lineNumber-1;if(i!==void 0&&a!==void 0&&t>=i&&t<a){c=!0;continue}if(t>=o){s.push({...n,lineNumber:t+e.lineDelta+1}),c=!0;continue}s.push(n)}return c?s:void 0}function Du(e,t,n){let r=new Map,i=new Map;for(let t of e){let e=t.lineNumber;r.has(e)||r.set(e,[]),i.has(e)||i.set(e,[]),(t.side===`deletions`?i:r).get(e).push(he(t))}let a=t.parentElement?.previousElementSibling,o,s;if(a!=null&&a instanceof HTMLElement&&a.dataset.deletions!==void 0)for(let e of a.children){let t=e,{gutter:n,content:r}=t.dataset;n===void 0?r!==void 0&&(s=t):o=t}Ou(t,n),s!==void 0&&Ou(s,o);let c=ku(r,t,n);if(s===void 0)return;let l=ku(i,s,o);requestAnimationFrame(()=>{Au(r,i,c,l)})}function Ou(e,t){let n=[];for(let r=1;r<e.childElementCount;r++){let i=e.children[r];i.dataset.lineAnnotation!==void 0&&(n.push(i),t!==void 0&&n.push(t.children[r]))}for(let e of n)e.remove()}function ku(e,t,n){let r=new Map;for(let n of t.children){let t=xu(n);if(t!==void 0){let i=e.get(t);if(i!==void 0){let e=Q(`div`,{dataset:{lineAnnotation:`0,`+(t-1)},children:[Q(`div`,{dataset:`annotationContent`,children:i.map(e=>Q(`slot`,{name:e}))})]});n.after(e),r.set(t,e)}}}if(n!==void 0)for(let t of n.children){let n=xu(t,`columnNumber`);if(n!==void 0&&e.has(n)){let e=Q(`div`,{dataset:{gutterBuffer:`annotation`,bufferSize:`1`},style:{gridRow:`span 1`}});t.after(e)}}return r}function Au(e,t,n,r){let i=new Map;for(let[t,n]of e.entries()){let e=r.get(t);if(n.length===0&&e!==void 0){let n=ju(e);n>0&&i.set(t,n)}}for(let[e,r]of t.entries()){let t=n.get(e);if(r.length===0&&t!==void 0){let n=ju(t);n>0&&i.set(e,n)}}Mu(e,n,i),Mu(t,r,i)}function ju(e){let t=e.firstElementChild;return t instanceof HTMLElement?t.getBoundingClientRect().height:0}function Mu(e,t,n){for(let[r,i]of t.entries()){let t=e.get(r),a=n.get(r);t?.length===0&&a!==void 0&&i.style.setProperty(`--diffs-annotation-min-height`,`${a}px`)}}function Nu(e,t=0){let n=md(e.startContainer,e.startOffset),r=md(e.endContainer,e.endOffset);if(!(n===null||r===null))return{start:n,end:r,direction:t}}function Pu(e,t,n,r){if(e===void 0)return[[],t];let{start:i,end:a}=t,o=[],s={...t},c=a.line;i.line<a.line&&a.character===0&&c--;for(let t=i.line;t<=c;t++){let c=e.getLineText(t);if(c===void 0)continue;let l=c.startsWith(` `)?` `:` `.repeat(n),u=0,d=l;if(r){if(c.startsWith(` `))u=1;else if(c.startsWith(` `)){let e=c.length-c.trimStart().length;u=Math.min(l.length,e)}if(u===0)continue;d=``}o.push({range:{start:{line:t,character:0},end:{line:t,character:u}},newText:d});let f=d.length-u;t===i.line&&(s={...s,start:{...i,character:Math.max(0,i.character+f)}}),t===a.line&&(s={...s,end:{...a,character:Math.max(0,a.character+f)}})}return[o,s]}function Fu(e,t,n){let r=e.lineCount;return t.map(t=>{let{line:i,character:a}=n===`up`||n===`left`?t.start:t.end;if(n===`textStart`||n===`start`||n===`end`){if(n===`textStart`){let t=dd(e.getLineText(i));a=a===t?0:t}else a=n===`start`?0:e.getLineLength(i);i=t.direction===-1?t.start.line:t.end.line}else if(n===`up`)i=Math.max(0,i-1);else if(n===`down`)i=Math.min(Math.max(r-1,0),i+1);else if(Uu(t)){let t=e.getLineLength(i);a=Math.min(a,t),n===`left`?(a--,a<0&&(i===0?a=0:(i=Math.max(0,i-1),a=e.getLineLength(i)))):(a++,a>t&&(i===r-1?a--:(i=Math.min(Math.max(r-1,0),i+1),a=0)))}let o={line:i,character:a};return{start:o,end:o,direction:0}})}function Iu(e,t,n){return t.map(t=>{let[r,i]=cd(e,t),a=e.positionAt(i),[o]=Fu(e,[{start:a,end:a,direction:0}],n);return Ju(e,r,e.offsetAt(o.start))})}function Lu(e,t,n,r,i=2){if(t[t.length-1]===void 0)return{nextSelections:[]};let a=[];for(let e of t)a.push(e.start,e.end);let o=a.map(t=>e.offsetAt(t)),s=o[(t.length-1)*2],c=o[(t.length-1)*2+1],l=[],u=!0;for(let e=0;e<t.length;e++){let t={index:e,start:o[e*2],end:o[e*2+1]},n=l[l.length-1];n!==void 0&&(t.start<n.start||t.start===n.start&&t.end<n.end)&&(u=!1),l.push(t)}u||l.sort((e,t)=>{let n=e.start-t.start;if(n!==0)return n;let r=e.end-t.end;return r===0?e.index-t.index:r});let d=pd(e,n,i),f=[],p=Array.from({length:t.length}),m=0,h,g=()=>{if(h===void 0)return;let t=pd(e,{start:h.start,end:h.end,text:d.text},i),n=ud(e,t.text,t.start);f.push({start:t.start,end:t.end,text:n});let r=[h.start+m+n.length,h.start+m+n.length];for(let e of h.indices)p[e]=r;m+=n.length-(t.end-t.start),h=void 0};for(let e of l){let t=Math.max(0,e.start+(d.start-s)),n=Math.max(t,e.end+(d.end-c));if(h!==void 0&&t<h.end){h.end=Math.max(h.end,n),h.indices.push(e.index);continue}g(),h={start:t,end:n,indices:[e.index]}}g();let _=e.applyResolvedEdits(f,!0,t),v=fd(e,p.map(e=>{if(e===void 0)throw Error(`Missing next selection offsets`);return e}));if(e.setLastUndoSelectionsAfter(v),_!==void 0&&r!==void 0){let t=Eu(_,r);t!==void 0&&e.setLastUndoLineAnnotations(r,t)}return{nextSelections:v,change:_}}function Ru(e,t,n,r){if(t.length!==n.length)throw Error(`Selection text replacements must match the selection count`);let i=[];for(let e of t)i.push(e.start,e.end);let a=i.map(t=>e.offsetAt(t)),o=[],s=!0;for(let e=0;e<t.length;e++){let t={index:e,start:a[e*2],end:a[e*2+1],text:n[e]},r=o[o.length-1];r!==void 0&&(t.start<r.start||t.start===r.start&&t.end<r.end)&&(s=!1),o.push(t)}s||o.sort((e,t)=>{let n=e.start-t.start;if(n!==0)return n;let r=e.end-t.end;return r===0?e.index-t.index:r});let c=n.every(e=>e===``),l,u=Array.from({length:t.length});if(c){l=[];let e=!1;for(let t of o){if(u[t.index]=t.end,t.start>=t.end)continue;e=!0;let n=l[l.length-1];n!==void 0&&t.start<n.end?l[l.length-1]={start:n.start,end:Math.max(n.end,t.end),text:``}:l.push({start:t.start,end:t.end,text:``})}if(!e)return{nextSelections:t};for(let e of o){let t=e.end,n=0,r=t;for(let e of l){if(t<=e.start)break;if(t>=e.end){n-=e.end-e.start;continue}r=e.start+n;break}r===t&&(r+=n),u[e.index]=r}}else{l=[];let t=0,n=-1;for(let r of o){if(r.start<n)throw Error(`Overlapping multi-selection edits are not supported`);n=r.end;let i=ud(e,r.text,r.start);l.push({start:r.start,end:r.end,text:i}),u[r.index]=r.start+t+i.length,t+=i.length-(r.end-r.start)}}let d=e.applyResolvedEdits(l,!0,t),f=fd(e,u.map(e=>[e,e]));if(e.setLastUndoSelectionsAfter(f),d!==void 0&&r!==void 0){let t=Eu(d,r);t!==void 0&&e.setLastUndoLineAnnotations(r,t)}return{nextSelections:f,change:d}}function zu(e,t,n){let r=e.getText(),i=[],a=[];for(let n of t){let[t,o]=cd(e,n);if(!Uu(n)){a.push([t,o]);continue}let{line:s,character:c}=n.start,l=t,u=e.getLineLength(s),d;if(c>0&&c<u)d={start:l-1,end:l+1,text:r[l]+r[l-1]},a.push([l+1,l+1]);else if(c===u&&u>=2)d={start:l-2,end:l,text:r[l-1]+r[l-2]},a.push([l,l]);else if(c===0&&s>0&&u>0){let t=s-1,n=e.getLineLength(t),i=e.offsetAt({line:t,character:n}),o=n>0?i-1:i;d={start:o,end:l+1,text:r[l]+r.slice(i,l)+r.slice(o,i)},a.push([l+1,l+1])}else{a.push([t,o]);continue}i.push(d)}if(i.length===0)return{nextSelections:t};i.sort((e,t)=>e.start-t.start);for(let e=1;e<i.length;e++)if(i[e].start<i[e-1].end)throw Error(`Overlapping multi-selection edits are not supported`);let o=e.applyResolvedEdits(i,!0,t),s=fd(e,a);if(e.setLastUndoSelectionsAfter(s),o!==void 0&&n!==void 0){let t=Eu(o,n);t!==void 0&&e.setLastUndoLineAnnotations(n,t)}return{nextSelections:s,change:o}}function Bu(e,t,n){let r=t.map(t=>{let n=ld(e,t);return{start:n.start,end:n.end,direction:0}});return Ru(e,r,r.map(()=>``),n)}function Vu(e,t,n,r){let i=t.map(t=>{if(!Uu(t))return{start:t.start,end:t.end,direction:0};let r=Wu(t),{line:i,character:a}=r,o=n?.(i,a)??0;if(a>o)return{start:{line:i,character:o},end:{line:i,character:a},direction:0};if(i===0)return{start:r,end:r,direction:0};let s=e.getLineLength(i-1);return{start:{line:i-1,character:s},end:{line:i,character:0},direction:0}});return Ru(e,i,i.map(()=>``),r)}function Hu(e,t,n){let r=t.map(t=>{let[n,r]=od(e,t);return{start:n,end:r,direction:0}});return Ru(e,r,r.map(()=>``),n)}function Uu(e){return e.start.line===e.end.line&&e.start.character===e.end.character}function Wu(e){let{start:t,end:n,direction:r}=e;return r===-1?t:n}function Gu(e){return e===`context`||e===`context-expanded`||e===`change-addition`}function Ku(e,t){let n=Uu(e),r=Uu(t);return n&&r?qu(e.start,t.start)===0:n?qu(t.start,e.start)<=0&&qu(e.start,t.end)<=0:r?qu(e.start,t.start)<=0&&qu(t.start,e.end)<=0:qu(e.start,t.end)<0&&qu(t.start,e.end)<0}function qu(e,t){return e.line===t.line?e.character-t.character:e.line-t.line}function Ju(e,t,n){let r=t===n?0:t<n?1:-1,i=Math.min(t,n),a=Math.max(t,n);return{start:e.positionAt(i),end:e.positionAt(a),direction:r}}function Yu(e,t){let n=e.direction===-1?e.end:e.start,r=qu(n,t.start),i=qu(n,t.end),a=t.end;a=r<=0?t.end:i>=0?t.start:r===0?t.end:t.start;let o=qu(n,a);return{start:o<=0?n:a,end:o<=0?a:n,direction:o===0?0:o<0?1:-1}}function Xu(e,t){let n=qu(t.start,e.start)<0,r=qu(t.end,e.end)>0;return n&&!r?{start:t.start,end:e.end,direction:-1}:r&&!n?{start:e.start,end:t.end,direction:1}:e.direction===-1?{start:t.start,end:e.end,direction:qu(t.start,e.end)===0?0:-1}:{start:e.start,end:t.end,direction:qu(e.start,t.end)===0?0:1}}function Zu(e,t){return Qu(e.map(e=>Xu(e,t)))}function Qu(e){if(e.length<=1)return e;let t=new Set,n=[];for(let r=e.length-1;r>=0;r--){let i=e[r];if(i===void 0)continue;let a=0,o=n.length;for(;a<o;){let e=Math.floor((a+o)/2),t=n[e]?.selection;if(t===void 0)break;qu(t.start,i.start)<0?a=e+1:o=e}let s=n[a-1]?.selection,c=n[a]?.selection;s!==void 0&&Ku(s,i)||c!==void 0&&Ku(c,i)||(n.splice(a,0,{index:r,selection:i}),t.add(r))}return e.filter((e,n)=>t.has(n))}function $u(e,t){if(t.length===0)return;let n=t.map(t=>Uu(t)?id(e,t):t),r=n.map(t=>e.getText(t)),i=r[0];if(i.length===0||r.some(e=>e!==i))return;let a=n.map(t=>[e.offsetAt(t.start),e.offsetAt(t.end)]),o=e.findNextNonOverlappingSubstring(i,a);if(o===void 0)return n.some((e,n)=>{let r=t[n];return qu(e.start,r.start)!==0||qu(e.end,r.end)!==0||e.direction!==r.direction})?n:void 0;let s=Ju(e,o,o+i.length);return[...n,s]}function ed(e){let t=e.lineCount-1;return{start:{line:0,character:0},end:{line:t,character:e.getLineLength(t)},direction:1}}function td(e,t){let n=t?e.lineCount-1:0,r={line:n,character:t?e.getLineLength(n):0};return{start:r,end:r,direction:1}}function nd(e,t){return[...t].sort((e,t)=>{let n=qu(e.start,t.start);return n===0?qu(e.end,t.end):n}).map(t=>Uu(t)?e.getLineText(t.start.line,!1):e.getText(t)).join(`
@@ -1743,7 +1743,7 @@ import{$t as e,C as t,E as n,Go as r,Ho as i,Jt as a,Kl as o,Pf as s,Pt as c,Ts
1743
1743
  --trees-font-size-override: 12px;
1744
1744
  }
1745
1745
  button[data-type='item'] { border-radius: 5px; }
1746
- `;function ef(e){return e.kind===`directory`?`${e.path}/`:e.path}function tf({environmentId:e,cwd:t,projectName:r,onOpenFile:i}){let{resolvedTheme:a}=oe(),o=ye(),s=Te(e,t),l=s.data?.entries??[],u=(0,X.useMemo)(()=>new Map(l.map(e=>[e.path,e.kind])),[l]),d=(0,X.useRef)(u),f=(0,X.useMemo)(()=>l.map(ef),[l]),p=(0,X.useRef)([]),m=(0,X.useRef)(null);(0,X.useEffect)(()=>{let e=e=>{m.current={x:e.clientX,y:e.clientY,at:e.timeStamp}};return document.addEventListener(`contextmenu`,e,!0),()=>document.removeEventListener(`contextmenu`,e,!0)},[]);let h=async(e,t)=>{let r=n();if(!r){t.close();return}let i=e.path.replace(/\/$/,``),a=A(i),s=m.current,c=s!==null&&performance.now()-s.at<1e3,l=t.anchorElement.getBoundingClientRect(),u=c?{x:s.x,y:s.y}:{x:l.left,y:l.bottom};try{let e=await r.contextMenu.show([{id:`copy-mention`,label:`Copy mention`},{id:`add-to-chat`,label:`Add to chat`}],u);if(e===`copy-mention`){try{await Ee(a),Le.add({type:`success`,title:`Mention copied`,description:i})}catch(e){Le.add({type:`error`,title:`Failed to copy mention`,description:e instanceof Error?e.message:`An error occurred.`})}return}if(e===`add-to-chat`){let e=o?.current;if(!e){Le.add({type:`error`,title:`Unable to add to chat`,description:`Open a chat for this project and try again.`});return}e.insertTextAtEnd(`${a} `,{ensureLeadingBoundary:!0})||Le.add({type:`error`,title:`Unable to add to chat`,description:`The chat isn't ready to accept input right now.`})}}finally{t.close()}},g=(0,X.useRef)(h);(0,X.useEffect)(()=>{g.current=h});let _=(0,X.useRef)(null),v=(0,X.useMemo)(()=>Qd({deselect:e=>_.current?.getItem(e)?.deselect()}),[]),{model:y}=Xd({composition:{contextMenu:{triggerMode:`right-click`,onOpen:(e,t)=>{g.current(e,t)}}},dragAndDrop:{canDrop:()=>!1},density:`compact`,fileTreeSearchMode:`hide-non-matches`,flattenEmptyDirectories:!0,initialExpansion:1,icons:We,onSelectionChange:e=>{if(v.handleSelectionChange(e),v.isDragInProgress())return;let t=e.at(-1)?.replace(/\/$/,``);t&&d.current.get(t)===`file`&&i(t)},paths:[],search:!0,unsafeCSS:$d});(0,X.useEffect)(()=>{p.current!==f&&(d.current=u,p.current=f,y.resetPaths(f))},[u,y,f]);let b=(0,X.useMemo)(()=>l.reduce((e,t)=>e+ +(t.kind===`file`),0),[l]),x=(0,X.useRef)(null);return(0,X.useEffect)(()=>{_.current=y},[y]),(0,X.useEffect)(()=>{let e=x.current;if(e===null)return;let t=e=>v.handleDragStart(e),n=()=>v.handleDragEnd();return e.addEventListener(`dragstart`,t,!0),e.addEventListener(`dragend`,n),()=>{e.removeEventListener(`dragstart`,t,!0),e.removeEventListener(`dragend`,n)}},[v]),(0,Z.jsxs)(`div`,{ref:x,className:`flex min-h-0 flex-1 flex-col bg-background`,"data-file-browser-panel":`${e}:${t}`,children:[(0,Z.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b border-border/60 px-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`truncate text-xs font-medium text-foreground`,children:r}),(0,Z.jsxs)(`div`,{className:`truncate text-[10px] leading-none text-muted-foreground`,children:[s.isPending&&s.data===null?`Indexing…`:`${b.toLocaleString()} files`,s.data?.truncated?` · partial`:``]})]}),(0,Z.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground hover:bg-accent hover:text-foreground`,"aria-label":`Search workspace files`,onClick:()=>y.openSearch(),children:(0,Z.jsx)(pe,{className:`size-3.5`})}),(0,Z.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground hover:bg-accent hover:text-foreground`,"aria-label":`Refresh workspace files`,onClick:s.refresh,children:(0,Z.jsx)(N,{className:c(`size-3.5`,s.isPending&&`animate-spin`)})})]}),s.error&&s.data===null?(0,Z.jsx)(`div`,{className:`p-4 text-xs leading-relaxed text-destructive`,children:s.error}):(0,Z.jsx)(Yd,{model:y,"aria-label":`${r} files`,className:`min-h-0 flex-1 overflow-hidden`,style:{colorScheme:a,"--trees-fg-override":`var(--foreground)`}})]})}function nf({root:e,editor:t,onDismiss:n}){n(),t.setSelections([]);let r=e.querySelector(`diffs-container`)?.shadowRoot?.activeElement;r instanceof HTMLElement&&r.blur()}function rf(e){return e.querySelector(`diffs-container`)?.shadowRoot?.activeElement?.hasAttribute(`data-content`)===!0}function af({root:e,editor:t,isBlocked:n,onDismiss:r}){let i=i=>{n()||i.composedPath().includes(e)||nf({root:e,editor:t,onDismiss:r})},a=i=>{i.key!==`Escape`||n()||!rf(e)||(i.preventDefault(),i.stopImmediatePropagation(),nf({root:e,editor:t,onDismiss:r}))};return document.addEventListener(`pointerdown`,i,!0),document.addEventListener(`keydown`,a,!0),()=>{document.removeEventListener(`pointerdown`,i,!0),document.removeEventListener(`keydown`,a,!0)}}function of(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return`${e.length}:${(t>>>0).toString(36)}`}function sf(e,t,n){return`${e}:${t}:${of(n)}`}function cf(e,t){let n=t.split(`/`).filter(Boolean);return[{label:e,path:``,kind:`project`},...n.map((e,t)=>({label:e,path:n.slice(0,t+1).join(`/`),kind:t===n.length-1?`file`:`directory`}))]}var lf=e=>/\.(?:md|mdx)$/i.test(e);function uf(e,t,n){return t<0||e[t]!==`[`||!/[ xX]/.test(e[t+1]??``)||e[t+2]!==`]`?e:`${e.slice(0,t+1)}${n?`x`:` `}${e.slice(t+2)}`}var df=class{options;timer=null;latestContents=``;latestRevision=0;lastChangeAt=0;saving=!1;disposed=!1;constructor(e){this.options=e}change(e){this.latestContents=e,this.latestRevision+=1,this.lastChangeAt=Date.now(),this.options.onPendingChange(!0),this.schedule(this.options.debounceMs)}dispose(){this.disposed=!0,this.clearTimer(),this.latestRevision>0&&this.persistLatest()}schedule(e){this.clearTimer(),this.timer=setTimeout(()=>{this.timer=null,this.persistLatest()},e)}clearTimer(){this.timer!==null&&(clearTimeout(this.timer),this.timer=null)}async persistLatest(){if(this.saving||this.latestRevision===0)return;this.saving=!0;let e=this.latestContents,t=this.latestRevision,n=(await this.options.persist(e))._tag===`Success`;if(n&&this.options.onConfirmed(e),this.saving=!1,t===this.latestRevision){n&&this.options.onPendingChange(!1);return}let r=Math.max(0,this.options.debounceMs-(Date.now()-this.lastChangeAt));this.disposed?this.persistLatest():this.schedule(r)}},ff=`p4code.fileExplorerOpen`,pf=500,mf=`data-file-link-reveal`,hf=`
1746
+ `;function ef(e){return e.kind===`directory`?`${e.path}/`:e.path}function tf({environmentId:e,cwd:t,projectName:r,onOpenFile:i}){let{resolvedTheme:a}=oe(),o=ye(),c=Te(e,t),l=c.data?.entries??[],u=(0,X.useMemo)(()=>new Map(l.map(e=>[e.path,e.kind])),[l]),d=(0,X.useRef)(u),f=(0,X.useMemo)(()=>l.map(ef),[l]),p=(0,X.useRef)([]),m=(0,X.useRef)(null);(0,X.useEffect)(()=>{let e=e=>{m.current={x:e.clientX,y:e.clientY,at:e.timeStamp}};return document.addEventListener(`contextmenu`,e,!0),()=>document.removeEventListener(`contextmenu`,e,!0)},[]);let h=async(e,t)=>{let r=n();if(!r){t.close();return}let i=e.path.replace(/\/$/,``),a=A(i),s=m.current,c=s!==null&&performance.now()-s.at<1e3,l=t.anchorElement.getBoundingClientRect(),u=c?{x:s.x,y:s.y}:{x:l.left,y:l.bottom};try{let e=await r.contextMenu.show([{id:`copy-mention`,label:`Copy mention`},{id:`add-to-chat`,label:`Add to chat`}],u);if(e===`copy-mention`){try{await Ee(a),Le.add({type:`success`,title:`Mention copied`,description:i})}catch(e){Le.add({type:`error`,title:`Failed to copy mention`,description:e instanceof Error?e.message:`An error occurred.`})}return}if(e===`add-to-chat`){let e=o?.current;if(!e){Le.add({type:`error`,title:`Unable to add to chat`,description:`Open a chat for this project and try again.`});return}e.insertTextAtEnd(`${a} `,{ensureLeadingBoundary:!0})||Le.add({type:`error`,title:`Unable to add to chat`,description:`The chat isn't ready to accept input right now.`})}}finally{t.close()}},g=(0,X.useRef)(h);(0,X.useEffect)(()=>{g.current=h});let _=(0,X.useRef)(null),v=(0,X.useMemo)(()=>Qd({deselect:e=>_.current?.getItem(e)?.deselect()}),[]),{model:y}=Xd({composition:{contextMenu:{triggerMode:`right-click`,onOpen:(e,t)=>{g.current(e,t)}}},dragAndDrop:{canDrop:()=>!1},density:`compact`,fileTreeSearchMode:`hide-non-matches`,flattenEmptyDirectories:!0,initialExpansion:1,icons:We,onSelectionChange:e=>{if(v.handleSelectionChange(e),v.isDragInProgress())return;let t=e.at(-1)?.replace(/\/$/,``);t&&d.current.get(t)===`file`&&i(t)},paths:[],search:!0,unsafeCSS:$d});(0,X.useEffect)(()=>{p.current!==f&&(d.current=u,p.current=f,y.resetPaths(f))},[u,y,f]);let b=(0,X.useMemo)(()=>l.reduce((e,t)=>e+ +(t.kind===`file`),0),[l]),x=(0,X.useRef)(null);return(0,X.useEffect)(()=>{_.current=y},[y]),(0,X.useEffect)(()=>{let e=x.current;if(e===null)return;let t=e=>v.handleDragStart(e),n=()=>v.handleDragEnd();return e.addEventListener(`dragstart`,t,!0),e.addEventListener(`dragend`,n),()=>{e.removeEventListener(`dragstart`,t,!0),e.removeEventListener(`dragend`,n)}},[v]),(0,Z.jsxs)(`div`,{ref:x,className:`flex min-h-0 flex-1 flex-col bg-background`,"data-file-browser-panel":`${e}:${t}`,children:[(0,Z.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b border-border/60 px-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`truncate text-xs font-medium text-foreground`,children:r}),(0,Z.jsxs)(`div`,{className:`truncate text-[10px] leading-none text-muted-foreground`,children:[c.isPending&&c.data===null?`Indexing…`:`${b.toLocaleString()} files`,c.data?.truncated?` · partial`:``]})]}),(0,Z.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground hover:bg-accent hover:text-foreground`,"aria-label":`Search workspace files`,onClick:()=>y.openSearch(),children:(0,Z.jsx)(pe,{className:`size-3.5`})}),(0,Z.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground hover:bg-accent hover:text-foreground`,"aria-label":`Refresh workspace files`,onClick:c.refresh,children:(0,Z.jsx)(N,{className:s(`size-3.5`,c.isPending&&`animate-spin`)})})]}),c.error&&c.data===null?(0,Z.jsx)(`div`,{className:`p-4 text-xs leading-relaxed text-destructive`,children:c.error}):(0,Z.jsx)(Yd,{model:y,"aria-label":`${r} files`,className:`min-h-0 flex-1 overflow-hidden`,style:{colorScheme:a,"--trees-fg-override":`var(--foreground)`}})]})}function nf({root:e,editor:t,onDismiss:n}){n(),t.setSelections([]);let r=e.querySelector(`diffs-container`)?.shadowRoot?.activeElement;r instanceof HTMLElement&&r.blur()}function rf(e){return e.querySelector(`diffs-container`)?.shadowRoot?.activeElement?.hasAttribute(`data-content`)===!0}function af({root:e,editor:t,isBlocked:n,onDismiss:r}){let i=i=>{n()||i.composedPath().includes(e)||nf({root:e,editor:t,onDismiss:r})},a=i=>{i.key!==`Escape`||n()||!rf(e)||(i.preventDefault(),i.stopImmediatePropagation(),nf({root:e,editor:t,onDismiss:r}))};return document.addEventListener(`pointerdown`,i,!0),document.addEventListener(`keydown`,a,!0),()=>{document.removeEventListener(`pointerdown`,i,!0),document.removeEventListener(`keydown`,a,!0)}}function of(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return`${e.length}:${(t>>>0).toString(36)}`}function sf(e,t,n){return`${e}:${t}:${of(n)}`}function cf(e,t){let n=t.split(`/`).filter(Boolean);return[{label:e,path:``,kind:`project`},...n.map((e,t)=>({label:e,path:n.slice(0,t+1).join(`/`),kind:t===n.length-1?`file`:`directory`}))]}var lf=e=>/\.(?:md|mdx)$/i.test(e);function uf(e,t,n){return t<0||e[t]!==`[`||!/[ xX]/.test(e[t+1]??``)||e[t+2]!==`]`?e:`${e.slice(0,t+1)}${n?`x`:` `}${e.slice(t+2)}`}var df=class{options;timer=null;latestContents=``;latestRevision=0;lastChangeAt=0;saving=!1;disposed=!1;constructor(e){this.options=e}change(e){this.latestContents=e,this.latestRevision+=1,this.lastChangeAt=Date.now(),this.options.onPendingChange(!0),this.schedule(this.options.debounceMs)}dispose(){this.disposed=!0,this.clearTimer(),this.latestRevision>0&&this.persistLatest()}schedule(e){this.clearTimer(),this.timer=setTimeout(()=>{this.timer=null,this.persistLatest()},e)}clearTimer(){this.timer!==null&&(clearTimeout(this.timer),this.timer=null)}async persistLatest(){if(this.saving||this.latestRevision===0)return;this.saving=!0;let e=this.latestContents,t=this.latestRevision,n=(await this.options.persist(e))._tag===`Success`;if(n&&this.options.onConfirmed(e),this.saving=!1,t===this.latestRevision){n&&this.options.onPendingChange(!1);return}let r=Math.max(0,this.options.debounceMs-(Date.now()-this.lastChangeAt));this.disposed?this.persistLatest():this.schedule(r)}},ff=`p4code.fileExplorerOpen`,pf=500,mf=`data-file-link-reveal`,hf=`
1747
1747
  [${mf}][data-line] {
1748
1748
  background-color: light-dark(
1749
1749
  color-mix(
@@ -1774,5 +1774,5 @@ import{$t as e,C as t,E as n,Go as r,Ho as i,Jt as a,Kl as o,Pf as s,Pt as c,Ts
1774
1774
  ) !important;
1775
1775
  color: var(--diffs-selection-number-fg) !important;
1776
1776
  }
1777
- `;function gf(e){let t=(0,kl.c)(8),n;t[0]!==e.absolutePath||t[1]!==e.threadRef.threadId?(n={_tag:`workspace-file`,threadId:e.threadRef.threadId,path:e.absolutePath},t[0]=e.absolutePath,t[1]=e.threadRef.threadId,t[2]=n):n=t[2];let r=Pe(e.environmentId,n),[i,a]=(0,X.useState)(null);if(r._tag===`Failure`||r._tag===`Success`&&i===r.url){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs leading-relaxed text-destructive`,children:`Unable to load workspace image.`}),t[3]=e):e=t[3],e}let o;return t[4]!==r._tag||t[5]!==r.url||t[6]!==e.alt?(o=r._tag===`Success`?(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:(0,Z.jsx)(`img`,{className:`max-h-full max-w-full object-contain`,src:r.url,alt:e.alt,onError:()=>a(r.url)})}):(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,Z.jsx)(De,{className:`size-5 animate-spin`})}),t[4]=r._tag,t[5]=r.url,t[6]=e.alt,t[7]=o):o=t[7],o}function _f(e,t){let n=1;for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);r===10?n+=1:r===13&&(n+=1,e.charCodeAt(t+1)===10&&(t+=1))}return Math.min(Math.max(1,t),n)}function vf(e,t){let n=e.shadowRoot??e;for(let e of n.querySelectorAll(`[${mf}]`))e.removeAttribute(mf);t!==null&&(n.querySelector(`[data-line="${t}"]`)?.setAttribute(mf,``),n.querySelector(`[data-column-number="${t}"]`)?.setAttribute(mf,``))}function yf(e,t,n){let r=(0,kl.c)(7),[i]=(0,X.useState)(Sf),[a]=(0,X.useState)(xf),[o]=(0,X.useState)(bf),s;return r[0]!==i||r[1]!==a||r[2]!==o||r[3]!==e||r[4]!==t||r[5]!==n?(s=(r,s,c)=>{if(e===null)return;let l=()=>{let t=o.get(e);t!==void 0&&(cancelAnimationFrame(t),o.delete(e))};if(c===`unmount`){l();return}let u=t===null?null:_f(s.file?.contents??``,t);if(vf(r,u),!(s instanceof E))return;if(a.get(e)!==n&&(l(),a.set(e,n)),u===null){r.style.minHeight=``;return}let d=r.closest(`.file-preview-virtualizer`);!d||(r.style.minHeight=`${Math.ceil(Math.max(s.height,d.clientHeight))}px`,i.get(e)===n||o.has(e))||o.set(e,requestAnimationFrame(()=>{if(o.delete(e),a.get(e)!==n||!r.isConnected)return;let t=s.getLinePosition(u);if(!t)return;let c=d.scrollTop+r.getBoundingClientRect().top-d.getBoundingClientRect().top,l=Math.max(0,c+t.top-Math.max(0,(d.clientHeight-t.height)/2)),f=Math.max(0,d.scrollHeight-d.clientHeight);d.scrollTop=Math.min(l,f),i.set(e,n)}))},r[0]=i,r[1]=a,r[2]=o,r[3]=e,r[4]=t,r[5]=n,r[6]=s):s=r[6],s}function bf(){return new Map}function xf(){return new Map}function Sf(){return new Map}function Cf(e){let t=(0,kl.c)(19),{environmentId:n,cwd:r,relativePath:i,onPendingChange:a}=e,o=b(ze.writeFile),s;t[0]!==a||t[1]!==i?(s=e=>a(i,e),t[0]=a,t[1]=i,t[2]=s):s=t[2];let c;t[3]!==r||t[4]!==n||t[5]!==i||t[6]!==o?(c=e=>o({environmentId:n,input:{cwd:r,relativePath:i,contents:e}}),t[3]=r,t[4]=n,t[5]=i,t[6]=o,t[7]=c):c=t[7];let l;t[8]!==r||t[9]!==n||t[10]!==i?(l=e=>{P(n,r,i,e)},t[8]=r,t[9]=n,t[10]=i,t[11]=l):l=t[11];let u;t[12]!==s||t[13]!==c||t[14]!==l?(u=new df({debounceMs:pf,onPendingChange:s,persist:c,onConfirmed:l}),t[12]=s,t[13]=c,t[14]=l,t[15]=u):u=t[15];let d=u,f,p;return t[16]===d?(f=t[17],p=t[18]):(f=()=>()=>d.dispose(),p=[d],t[16]=d,t[17]=f,t[18]=p),(0,X.useEffect)(f,p),d}function wf(t){let n=(0,kl.c)(74),{environmentId:r,cwd:i,relativePath:o,composerDraftTarget:s,contents:c,resolvedTheme:l,revealRequestId:u,wordWrap:d,onPostRender:f,onPendingChange:p}=t,m=a(jf),h=a(Af),g;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=[],n[0]=g):g=n[0];let[_,v]=(0,X.useState)(g),[y,b]=(0,X.useState)(null),S=y?.revealRequestId===u?y.range:null,w;n[1]===u?w=n[2]:(w=e=>{b({revealRequestId:u,range:e})},n[1]=u,n[2]=w);let E=w,ne=(0,X.useRef)(null),D=(0,X.useRef)(null),O;n[3]!==i||n[4]!==r||n[5]!==p||n[6]!==o?(O={environmentId:r,cwd:i,relativePath:o,onPendingChange:p},n[3]=i,n[4]=r,n[5]=p,n[6]=o,n[7]=O):O=n[7];let k=Cf(O),A;n[8]!==m||n[9]!==s||n[10]!==i||n[11]!==r||n[12]!==o||n[13]!==k?(A=new Ud({onChange:(t,n)=>{if(Ce(r,i,o,t.contents),k.change(t.contents),n){let r=C(n);v(r);for(let n of r)for(let r of n.metadata.entries)r.kind===`comment`&&m(s,e({id:r.id,filePath:o,startLine:r.startLine,endLine:r.endLine,text:r.text,contents:t.contents}))}}}),n[8]=m,n[9]=s,n[10]=i,n[11]=r,n[12]=o,n[13]=k,n[14]=A):A=n[14];let j=A,M,re;n[15]===j?(M=n[16],re=n[17]):(M=()=>()=>{j.cleanUp()},re=[j],n[15]=j,n[16]=M,n[17]=re),(0,X.useEffect)(M,re);let ie;n[18]!==s||n[19]!==h||n[20]!==E?(ie=e=>{E(null),h(s,e),v(t=>t.flatMap(t=>{let n=t.metadata.entries.filter(t=>t.id!==e);return n.length>0?[{...t,metadata:{entries:n}}]:[]}))},n[18]=s,n[19]=h,n[20]=E,n[21]=ie):ie=n[21];let ae=ie,oe;n[22]!==m||n[23]!==s||n[24]!==c||n[25]!==_||n[26]!==o||n[27]!==E?(oe=(t,n)=>{E(null);let r=_.flatMap(kf).find(e=>e.id===t);r&&m(s,e({id:r.id,filePath:o,startLine:r.startLine,endLine:r.endLine,text:n,contents:c})),v(e=>e.map(e=>({...e,metadata:{entries:e.metadata.entries.map(e=>e.id===t?{...e,kind:`comment`,text:n}:e)}})))},n[22]=m,n[23]=s,n[24]=c,n[25]=_,n[26]=o,n[27]=E,n[28]=oe):oe=n[28];let se=oe,ce;n[29]===Symbol.for(`react.memo_cache_sentinel`)?(ce=e=>{let{startLine:t,endLine:n}=T(e),r={id:ee(),kind:`draft`,startLine:t,endLine:n,text:``};v(e=>{let t=e.flatMap(Df),i=t.findIndex(e=>e.lineNumber===n);return i<0?[...t,{lineNumber:n,metadata:{entries:[r]}}]:t.map((e,t)=>t===i?{...e,metadata:{entries:[...e.metadata.entries,r]}}:e)})},n[29]=ce):ce=n[29];let le=ce,ue;n[30]===_?ue=n[31]:(ue=_.some(Tf),n[30]=_,n[31]=ue);let de=ue,fe,pe;n[32]!==j||n[33]!==de||n[34]!==E?(fe=()=>{let e=ne.current;if(e)return af({root:e,editor:j,isBlocked:()=>de,onDismiss:()=>E(null)})},pe=[j,de,E],n[32]=j,n[33]=de,n[34]=E,n[35]=fe,n[36]=pe):(fe=n[35],pe=n[36]),(0,X.useEffect)(fe,pe);let me;n[37]===E?me=n[38]:(me=e=>{E(e),e&&le(e)},n[37]=E,n[38]=me);let N=me,he;n[39]!==f||n[40]!==S?(he=(e,t,n)=>{f(e,t,n),D.current!==null&&(cancelAnimationFrame(D.current),D.current=null),n!==`unmount`&&(D.current=requestAnimationFrame(()=>{D.current=null,e.isConnected&&t.setSelectedLines(S,{notify:!1})}))},n[39]=f,n[40]=S,n[41]=he):he=n[41];let ge=he,_e;n[42]===Symbol.for(`react.memo_cache_sentinel`)?(_e={overscrollSize:600,intersectionObserverMargin:1200},n[42]=_e):_e=n[42];let ve;n[43]!==c||n[44]!==i||n[45]!==o?(ve=sf(i,o,c),n[43]=c,n[44]=i,n[45]=o,n[46]=ve):ve=n[46];let ye;n[47]!==c||n[48]!==o||n[49]!==ve?(ye={name:o,contents:c,cacheKey:ve},n[47]=c,n[48]=o,n[49]=ve,n[50]=ye):ye=n[50];let xe=!de,Se=!de,we=d?`wrap`:`scroll`,Te;n[51]===l?Te=n[52]:(Te=be(l),n[51]=l,n[52]=Te);let Ee;n[53]!==N||n[54]!==ge||n[55]!==l||n[56]!==E||n[57]!==xe||n[58]!==Se||n[59]!==we||n[60]!==Te?(Ee={disableFileHeader:!0,enableGutterUtility:xe,enableLineSelection:Se,onGutterUtilityClick:E,onLineSelectionChange:E,onLineSelectionEnd:N,overflow:we,theme:Te,themeType:l,unsafeCSS:hf,onPostRender:ge},n[53]=N,n[54]=ge,n[55]=l,n[56]=E,n[57]=xe,n[58]=Se,n[59]=we,n[60]=Te,n[61]=Ee):Ee=n[61];let De;n[62]!==ae||n[63]!==se?(De=e=>(0,Z.jsx)(`div`,{className:`py-1`,children:e.metadata.entries.map(e=>(0,Z.jsx)(x,{kind:e.kind,rangeLabel:te(e.startLine,e.endLine),text:e.text,onCancel:()=>ae(e.id),onComment:t=>se(e.id,t),onDelete:()=>ae(e.id)},e.id))}),n[62]=ae,n[63]=se,n[64]=De):De=n[64];let P;n[65]!==_||n[66]!==S||n[67]!==ye||n[68]!==Ee||n[69]!==De?(P=(0,Z.jsx)(`div`,{ref:ne,className:`flex min-h-0 flex-1`,children:(0,Z.jsx)(Re,{className:`file-preview-virtualizer min-h-0 flex-1 overflow-auto`,config:_e,children:(0,Z.jsx)(Ol,{file:ye,options:Ee,selectedLines:S,lineAnnotations:_,renderAnnotation:De,className:`min-h-full`,contentEditable:!0})})}),n[65]=_,n[66]=S,n[67]=ye,n[68]=Ee,n[69]=De,n[70]=P):P=n[70];let Oe;return n[71]!==j||n[72]!==P?(Oe=(0,Z.jsx)(Ve,{editor:j,children:P}),n[71]=j,n[72]=P,n[73]=Oe):Oe=n[73],Oe}function Tf(e){return e.metadata.entries.some(Ef)}function Ef(e){return e.kind===`draft`}function Df(e){let t=e.metadata.entries.filter(Of);return t.length>0?[{...e,metadata:{entries:t}}]:[]}function Of(e){return e.kind!==`draft`}function kf(e){return e.metadata.entries}function Af(e){return e.removeReviewComment}function jf(e){return e.addReviewComment}function Mf(e){let t=(0,kl.c)(16),{environmentId:n,cwd:r,relativePath:i,contents:a,threadRef:o,onPendingChange:s}=e,c;t[0]!==r||t[1]!==n||t[2]!==s||t[3]!==i?(c={environmentId:n,cwd:r,relativePath:i,onPendingChange:s},t[0]=r,t[1]=n,t[2]=s,t[3]=i,t[4]=c):c=t[4];let l=Cf(c),u;t[5]!==a||t[6]!==r||t[7]!==n||t[8]!==i||t[9]!==l?(u=e=>{let{markerOffset:t,checked:o}=e,s=Ie(n,r,i)?.contents??a,c=uf(s,t,o);c!==s&&(Ce(n,r,i,c),l.change(c))},t[5]=a,t[6]=r,t[7]=n,t[8]=i,t[9]=l,t[10]=u):u=t[10];let d;return t[11]!==a||t[12]!==r||t[13]!==u||t[14]!==o?(d=(0,Z.jsx)(Fe,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(_e,{text:a,cwd:r,threadRef:o,className:`mx-auto max-w-4xl px-6 py-5`,onTaskListChange:u})}),t[11]=a,t[12]=r,t[13]=u,t[14]=o,t[15]=d):d=t[15],d}function Nf(){try{return h(ff,o)??!0}catch(e){return console.error(e),!0}}function Pf(e){let n=(0,kl.c)(78),{environmentId:r,cwd:a,projectName:o,relativePath:s,threadRef:u,composerDraftTarget:d,keybindings:h,availableEditors:g,revealLine:v,revealRequestId:x,onOpenFile:S,onPendingChange:C}=e,{resolvedTheme:ee}=oe(),w=Ge(If),T=t(),E=f(r),te;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(te={reportFailure:!1},n[0]=te):te=n[0];let ne=ie(je.createUrl,te),D;n[1]===Symbol.for(`react.memo_cache_sentinel`)?(D={reportFailure:!1},n[1]=D):D=n[1];let O=b(ke.open,D),k;n[2]===s?k=n[3]:(k=s!==null&&Ml(s),n[2]=s,n[3]=k);let A=k,j=Me(r,a,s,!A),[M,le]=(0,X.useState)(Nf),ue;n[4]===Symbol.for(`react.memo_cache_sentinel`)?(ue={path:null,revealRequestId:null},n[4]=ue):ue=n[4];let[de,fe]=(0,X.useState)(ue),pe=(0,X.useRef)(null),me;n[5]===s?me=n[6]:(me=s?lf(s):!1,n[5]=s,n[6]=me);let N=me,he=N&&de.path===s&&(v===null||de.revealRequestId===x),_e;n[7]===s?_e=n[8]:(_e=s!==null&&ce()&&ae(s),n[7]=s,n[8]=_e);let ye=_e,xe;n[9]!==a||n[10]!==s?(xe=s?ve(s,a):null,n[9]=a,n[10]=s,n[11]=xe):xe=n[11];let Se=xe,Ce;n[12]!==o||n[13]!==s?(Ce=s?cf(o,s):[],n[12]=o,n[13]=s,n[14]=Ce):Ce=n[14];let Te=Ce,Ee=yf(s,v,x),P;n[15]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{(pe.current?.querySelector(`[data-current-file-crumb='true']`))?.scrollIntoView({block:`nearest`,inline:`end`})},n[15]=P):P=n[15];let Oe;n[16]===s?Oe=n[17]:(Oe=[s],n[16]=s,n[17]=Oe),(0,X.useEffect)(P,Oe);let Ne;n[18]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=()=>{le(Ff)},n[18]=Ne):Ne=n[18];let Pe=Ne,Ie;n[19]!==Se||n[20]!==ne||n[21]!==E||n[22]!==O||n[23]!==u?(Ie=()=>{!Se||!E||(async()=>{let e=await ge({threadRef:u,filePath:Se,httpBaseUrl:E,createAssetUrl:ne,openPreview:O});if(e._tag===`Success`||p(e))return;let t=l(e);Le.add(we({type:`error`,title:`Unable to open file in browser`,description:t instanceof Error?t.message:`An error occurred.`}))})()},n[19]=Se,n[20]=ne,n[21]=E,n[22]=O,n[23]=u,n[24]=Ie):Ie=n[24];let ze=Ie,Be;n[25]!==Se||n[26]!==g||n[27]!==Te||n[28]!==ye||n[29]!==r||n[30]!==M||n[31]!==ze||n[32]!==N||n[33]!==h||n[34]!==T||n[35]!==o||n[36]!==s||n[37]!==he||n[38]!==x?(Be=s?(0,Z.jsxs)(`div`,{className:`surface-subheader gap-2 px-3`,"data-surface-subheader":!0,children:[(0,Z.jsx)(Fe,{ref:pe,hideScrollbars:!0,scrollFade:!0,className:`min-w-0 flex-1 rounded-none`,"data-file-breadcrumbs":!0,children:(0,Z.jsx)(`div`,{className:`flex h-full w-max min-w-full items-center text-xs`,children:Te.map((e,t)=>(0,Z.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center`,"data-current-file-crumb":e.kind===`file`,children:[t>0?(0,Z.jsx)(i,{className:`mx-1 size-3.5 shrink-0 text-muted-foreground/60`}):null,(0,Z.jsx)(`span`,{className:c(`max-w-40 truncate`,e.kind===`file`?`font-medium text-foreground`:`text-muted-foreground`),title:e.path||o,children:e.label})]},e.path||`project`))})}),Se&&r===T?(0,Z.jsx)(Ae,{environmentId:r,keybindings:h,availableEditors:g,openInCwd:Se,compact:!0,enableShortcut:!1}):null,N?(0,Z.jsxs)(y,{children:[(0,Z.jsx)(m,{render:(0,Z.jsx)(Ke,{className:`shrink-0`,pressed:he,onPressedChange:e=>{fe({path:e?s:null,revealRequestId:e?x:null})},"aria-label":he?`Show markdown source`:`Show rendered markdown`,variant:`ghost`,size:`sm`,children:he?(0,Z.jsx)(Je,{className:`size-3.5`}):(0,Z.jsx)(se,{className:`size-3.5`})})}),(0,Z.jsx)(_,{children:he?`Show markdown source`:`Show rendered markdown`})]}):null,ye?(0,Z.jsxs)(y,{children:[(0,Z.jsx)(m,{render:(0,Z.jsx)(Ke,{className:`shrink-0`,pressed:!1,onPressedChange:ze,"aria-label":`Open file in preview browser`,variant:`ghost`,size:`sm`,children:(0,Z.jsx)(re,{className:`size-3.5`})})}),(0,Z.jsx)(_,{children:`Open file in preview browser`})]}):null,(0,Z.jsxs)(y,{children:[(0,Z.jsx)(m,{render:(0,Z.jsx)(Ke,{className:`shrink-0`,pressed:M,onPressedChange:Pe,"aria-label":M?`Hide file explorer`:`Show file explorer`,variant:`ghost`,size:`sm`,children:(0,Z.jsx)(Ye,{className:`size-3.5`})})}),(0,Z.jsx)(_,{children:M?`Hide file explorer`:`Show file explorer`})]})]}):null,n[25]=Se,n[26]=g,n[27]=Te,n[28]=ye,n[29]=r,n[30]=M,n[31]=ze,n[32]=N,n[33]=h,n[34]=T,n[35]=o,n[36]=s,n[37]=he,n[38]=x,n[39]=Be):Be=n[39];let Ve;n[40]!==j||n[41]!==s?(Ve=s&&j.data?.truncated?(0,Z.jsxs)(`div`,{className:`shrink-0 border-b border-amber-500/20 bg-amber-500/8 px-3 py-1.5 text-[11px] text-amber-700 dark:text-amber-300`,children:[`Preview limited to the first 1 MB of a `,j.data.byteLength.toLocaleString(),` byte file.`]}):null,n[40]=j,n[41]=s,n[42]=Ve):Ve=n[42];let He=s?`flex`:`hidden`,Ue;n[43]===He?Ue=n[44]:(Ue=c(`min-w-0 flex-1 flex-col overflow-hidden`,He),n[43]=He,n[44]=Ue);let We;n[45]!==Se||n[46]!==d||n[47]!==a||n[48]!==r||n[49]!==j||n[50]!==A||n[51]!==N||n[52]!==Ee||n[53]!==C||n[54]!==s||n[55]!==he||n[56]!==ee||n[57]!==x||n[58]!==u||n[59]!==w?(We=s&&A&&Se?(0,Z.jsx)(gf,{environmentId:r,threadRef:u,absolutePath:Se,alt:s},Se):s&&j.error&&j.data===null?(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs leading-relaxed text-destructive`,children:j.error}):s&&j.data===null?(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,Z.jsx)(De,{className:`size-5 animate-spin`})}):s&&j.data?N&&he?(0,Z.jsx)(Mf,{environmentId:r,cwd:a,relativePath:s,threadRef:u,contents:j.data.contents,onPendingChange:C}):j.data.truncated?(0,Z.jsx)(Re,{className:`file-preview-virtualizer min-h-0 flex-1 overflow-auto`,config:{overscrollSize:600,intersectionObserverMargin:1200},children:(0,Z.jsx)(Ol,{file:{name:s,contents:j.data.contents,cacheKey:sf(a,s,j.data.contents)},options:{disableFileHeader:!0,overflow:w?`wrap`:`scroll`,theme:be(ee),themeType:ee,unsafeCSS:hf,onPostRender:Ee},className:`min-h-full`})},`${s}:${ee}:${j.data.byteLength}`):(0,Z.jsx)(wf,{environmentId:r,cwd:a,relativePath:s,composerDraftTarget:d,contents:j.data.contents,resolvedTheme:ee,revealRequestId:x,wordWrap:w,onPostRender:Ee,onPendingChange:C},`${s}:${ee}`):null,n[45]=Se,n[46]=d,n[47]=a,n[48]=r,n[49]=j,n[50]=A,n[51]=N,n[52]=Ee,n[53]=C,n[54]=s,n[55]=he,n[56]=ee,n[57]=x,n[58]=u,n[59]=w,n[60]=We):We=n[60];let qe;n[61]!==Ue||n[62]!==We?(qe=(0,Z.jsx)(`div`,{className:Ue,children:We}),n[61]=Ue,n[62]=We,n[63]=qe):qe=n[63];let Xe;n[64]!==a||n[65]!==r||n[66]!==M||n[67]!==S||n[68]!==o||n[69]!==s?(Xe=M||s===null?(0,Z.jsx)(`aside`,{className:c(`flex min-h-0 shrink-0 bg-background`,s?`w-[min(22rem,46%)] min-w-64 border-l border-border/60`:`min-w-0 flex-1`),children:(0,Z.jsx)(tf,{environmentId:r,cwd:a,projectName:o,onOpenFile:S},`${r}:${a}`)}):null,n[64]=a,n[65]=r,n[66]=M,n[67]=S,n[68]=o,n[69]=s,n[70]=Xe):Xe=n[70];let Ze;n[71]!==qe||n[72]!==Xe?(Ze=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[qe,Xe]}),n[71]=qe,n[72]=Xe,n[73]=Ze):Ze=n[73];let Qe;return n[74]!==Be||n[75]!==Ve||n[76]!==Ze?(Qe=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:[Be,Ve,Ze]}),n[74]=Be,n[75]=Ve,n[76]=Ze,n[77]=Qe):Qe=n[77],Qe}function Ff(e){let t=!e;try{d(ff,t,o)}catch(e){console.error(e)}return t}function If(e){return e.wordWrap}export{Pf as default};
1778
- //# sourceMappingURL=FilePreviewPanel-CuP4WCgv.js.map
1777
+ `;function gf(e){let t=(0,kl.c)(8),n;t[0]!==e.absolutePath||t[1]!==e.threadRef.threadId?(n={_tag:`workspace-file`,threadId:e.threadRef.threadId,path:e.absolutePath},t[0]=e.absolutePath,t[1]=e.threadRef.threadId,t[2]=n):n=t[2];let r=Pe(e.environmentId,n),[i,a]=(0,X.useState)(null);if(r._tag===`Failure`||r._tag===`Success`&&i===r.url){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs leading-relaxed text-destructive`,children:`Unable to load workspace image.`}),t[3]=e):e=t[3],e}let o;return t[4]!==r._tag||t[5]!==r.url||t[6]!==e.alt?(o=r._tag===`Success`?(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:(0,Z.jsx)(`img`,{className:`max-h-full max-w-full object-contain`,src:r.url,alt:e.alt,onError:()=>a(r.url)})}):(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,Z.jsx)(De,{className:`size-5 animate-spin`})}),t[4]=r._tag,t[5]=r.url,t[6]=e.alt,t[7]=o):o=t[7],o}function _f(e,t){let n=1;for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);r===10?n+=1:r===13&&(n+=1,e.charCodeAt(t+1)===10&&(t+=1))}return Math.min(Math.max(1,t),n)}function vf(e,t){let n=e.shadowRoot??e;for(let e of n.querySelectorAll(`[${mf}]`))e.removeAttribute(mf);t!==null&&(n.querySelector(`[data-line="${t}"]`)?.setAttribute(mf,``),n.querySelector(`[data-column-number="${t}"]`)?.setAttribute(mf,``))}function yf(e,t,n){let r=(0,kl.c)(7),[i]=(0,X.useState)(Sf),[a]=(0,X.useState)(xf),[o]=(0,X.useState)(bf),s;return r[0]!==i||r[1]!==a||r[2]!==o||r[3]!==e||r[4]!==t||r[5]!==n?(s=(r,s,c)=>{if(e===null)return;let l=()=>{let t=o.get(e);t!==void 0&&(cancelAnimationFrame(t),o.delete(e))};if(c===`unmount`){l();return}let u=t===null?null:_f(s.file?.contents??``,t);if(vf(r,u),!(s instanceof E))return;if(a.get(e)!==n&&(l(),a.set(e,n)),u===null){r.style.minHeight=``;return}let d=r.closest(`.file-preview-virtualizer`);!d||(r.style.minHeight=`${Math.ceil(Math.max(s.height,d.clientHeight))}px`,i.get(e)===n||o.has(e))||o.set(e,requestAnimationFrame(()=>{if(o.delete(e),a.get(e)!==n||!r.isConnected)return;let t=s.getLinePosition(u);if(!t)return;let c=d.scrollTop+r.getBoundingClientRect().top-d.getBoundingClientRect().top,l=Math.max(0,c+t.top-Math.max(0,(d.clientHeight-t.height)/2)),f=Math.max(0,d.scrollHeight-d.clientHeight);d.scrollTop=Math.min(l,f),i.set(e,n)}))},r[0]=i,r[1]=a,r[2]=o,r[3]=e,r[4]=t,r[5]=n,r[6]=s):s=r[6],s}function bf(){return new Map}function xf(){return new Map}function Sf(){return new Map}function Cf(e){let t=(0,kl.c)(19),{environmentId:n,cwd:r,relativePath:i,onPendingChange:a}=e,o=b(ze.writeFile),s;t[0]!==a||t[1]!==i?(s=e=>a(i,e),t[0]=a,t[1]=i,t[2]=s):s=t[2];let c;t[3]!==r||t[4]!==n||t[5]!==i||t[6]!==o?(c=e=>o({environmentId:n,input:{cwd:r,relativePath:i,contents:e}}),t[3]=r,t[4]=n,t[5]=i,t[6]=o,t[7]=c):c=t[7];let l;t[8]!==r||t[9]!==n||t[10]!==i?(l=e=>{P(n,r,i,e)},t[8]=r,t[9]=n,t[10]=i,t[11]=l):l=t[11];let u;t[12]!==s||t[13]!==c||t[14]!==l?(u=new df({debounceMs:pf,onPendingChange:s,persist:c,onConfirmed:l}),t[12]=s,t[13]=c,t[14]=l,t[15]=u):u=t[15];let d=u,f,p;return t[16]===d?(f=t[17],p=t[18]):(f=()=>()=>d.dispose(),p=[d],t[16]=d,t[17]=f,t[18]=p),(0,X.useEffect)(f,p),d}function wf(t){let n=(0,kl.c)(74),{environmentId:r,cwd:i,relativePath:a,composerDraftTarget:s,contents:c,resolvedTheme:l,revealRequestId:u,wordWrap:d,onPostRender:f,onPendingChange:p}=t,m=o(jf),h=o(Af),g;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=[],n[0]=g):g=n[0];let[_,v]=(0,X.useState)(g),[y,b]=(0,X.useState)(null),S=y?.revealRequestId===u?y.range:null,w;n[1]===u?w=n[2]:(w=e=>{b({revealRequestId:u,range:e})},n[1]=u,n[2]=w);let E=w,ne=(0,X.useRef)(null),D=(0,X.useRef)(null),O;n[3]!==i||n[4]!==r||n[5]!==p||n[6]!==a?(O={environmentId:r,cwd:i,relativePath:a,onPendingChange:p},n[3]=i,n[4]=r,n[5]=p,n[6]=a,n[7]=O):O=n[7];let k=Cf(O),A;n[8]!==m||n[9]!==s||n[10]!==i||n[11]!==r||n[12]!==a||n[13]!==k?(A=new Ud({onChange:(t,n)=>{if(Ce(r,i,a,t.contents),k.change(t.contents),n){let r=C(n);v(r);for(let n of r)for(let r of n.metadata.entries)r.kind===`comment`&&m(s,e({id:r.id,filePath:a,startLine:r.startLine,endLine:r.endLine,text:r.text,contents:t.contents}))}}}),n[8]=m,n[9]=s,n[10]=i,n[11]=r,n[12]=a,n[13]=k,n[14]=A):A=n[14];let j=A,M,re;n[15]===j?(M=n[16],re=n[17]):(M=()=>()=>{j.cleanUp()},re=[j],n[15]=j,n[16]=M,n[17]=re),(0,X.useEffect)(M,re);let ie;n[18]!==s||n[19]!==h||n[20]!==E?(ie=e=>{E(null),h(s,e),v(t=>t.flatMap(t=>{let n=t.metadata.entries.filter(t=>t.id!==e);return n.length>0?[{...t,metadata:{entries:n}}]:[]}))},n[18]=s,n[19]=h,n[20]=E,n[21]=ie):ie=n[21];let ae=ie,oe;n[22]!==m||n[23]!==s||n[24]!==c||n[25]!==_||n[26]!==a||n[27]!==E?(oe=(t,n)=>{E(null);let r=_.flatMap(kf).find(e=>e.id===t);r&&m(s,e({id:r.id,filePath:a,startLine:r.startLine,endLine:r.endLine,text:n,contents:c})),v(e=>e.map(e=>({...e,metadata:{entries:e.metadata.entries.map(e=>e.id===t?{...e,kind:`comment`,text:n}:e)}})))},n[22]=m,n[23]=s,n[24]=c,n[25]=_,n[26]=a,n[27]=E,n[28]=oe):oe=n[28];let se=oe,ce;n[29]===Symbol.for(`react.memo_cache_sentinel`)?(ce=e=>{let{startLine:t,endLine:n}=T(e),r={id:ee(),kind:`draft`,startLine:t,endLine:n,text:``};v(e=>{let t=e.flatMap(Df),i=t.findIndex(e=>e.lineNumber===n);return i<0?[...t,{lineNumber:n,metadata:{entries:[r]}}]:t.map((e,t)=>t===i?{...e,metadata:{entries:[...e.metadata.entries,r]}}:e)})},n[29]=ce):ce=n[29];let le=ce,ue;n[30]===_?ue=n[31]:(ue=_.some(Tf),n[30]=_,n[31]=ue);let de=ue,fe,pe;n[32]!==j||n[33]!==de||n[34]!==E?(fe=()=>{let e=ne.current;if(e)return af({root:e,editor:j,isBlocked:()=>de,onDismiss:()=>E(null)})},pe=[j,de,E],n[32]=j,n[33]=de,n[34]=E,n[35]=fe,n[36]=pe):(fe=n[35],pe=n[36]),(0,X.useEffect)(fe,pe);let me;n[37]===E?me=n[38]:(me=e=>{E(e),e&&le(e)},n[37]=E,n[38]=me);let N=me,he;n[39]!==f||n[40]!==S?(he=(e,t,n)=>{f(e,t,n),D.current!==null&&(cancelAnimationFrame(D.current),D.current=null),n!==`unmount`&&(D.current=requestAnimationFrame(()=>{D.current=null,e.isConnected&&t.setSelectedLines(S,{notify:!1})}))},n[39]=f,n[40]=S,n[41]=he):he=n[41];let ge=he,_e;n[42]===Symbol.for(`react.memo_cache_sentinel`)?(_e={overscrollSize:600,intersectionObserverMargin:1200},n[42]=_e):_e=n[42];let ve;n[43]!==c||n[44]!==i||n[45]!==a?(ve=sf(i,a,c),n[43]=c,n[44]=i,n[45]=a,n[46]=ve):ve=n[46];let ye;n[47]!==c||n[48]!==a||n[49]!==ve?(ye={name:a,contents:c,cacheKey:ve},n[47]=c,n[48]=a,n[49]=ve,n[50]=ye):ye=n[50];let xe=!de,Se=!de,we=d?`wrap`:`scroll`,Te;n[51]===l?Te=n[52]:(Te=be(l),n[51]=l,n[52]=Te);let Ee;n[53]!==N||n[54]!==ge||n[55]!==l||n[56]!==E||n[57]!==xe||n[58]!==Se||n[59]!==we||n[60]!==Te?(Ee={disableFileHeader:!0,enableGutterUtility:xe,enableLineSelection:Se,onGutterUtilityClick:E,onLineSelectionChange:E,onLineSelectionEnd:N,overflow:we,theme:Te,themeType:l,unsafeCSS:hf,onPostRender:ge},n[53]=N,n[54]=ge,n[55]=l,n[56]=E,n[57]=xe,n[58]=Se,n[59]=we,n[60]=Te,n[61]=Ee):Ee=n[61];let De;n[62]!==ae||n[63]!==se?(De=e=>(0,Z.jsx)(`div`,{className:`py-1`,children:e.metadata.entries.map(e=>(0,Z.jsx)(x,{kind:e.kind,rangeLabel:te(e.startLine,e.endLine),text:e.text,onCancel:()=>ae(e.id),onComment:t=>se(e.id,t),onDelete:()=>ae(e.id)},e.id))}),n[62]=ae,n[63]=se,n[64]=De):De=n[64];let P;n[65]!==_||n[66]!==S||n[67]!==ye||n[68]!==Ee||n[69]!==De?(P=(0,Z.jsx)(`div`,{ref:ne,className:`flex min-h-0 flex-1`,children:(0,Z.jsx)(Re,{className:`file-preview-virtualizer min-h-0 flex-1 overflow-auto`,config:_e,children:(0,Z.jsx)(Ol,{file:ye,options:Ee,selectedLines:S,lineAnnotations:_,renderAnnotation:De,className:`min-h-full`,contentEditable:!0})})}),n[65]=_,n[66]=S,n[67]=ye,n[68]=Ee,n[69]=De,n[70]=P):P=n[70];let Oe;return n[71]!==j||n[72]!==P?(Oe=(0,Z.jsx)(Ve,{editor:j,children:P}),n[71]=j,n[72]=P,n[73]=Oe):Oe=n[73],Oe}function Tf(e){return e.metadata.entries.some(Ef)}function Ef(e){return e.kind===`draft`}function Df(e){let t=e.metadata.entries.filter(Of);return t.length>0?[{...e,metadata:{entries:t}}]:[]}function Of(e){return e.kind!==`draft`}function kf(e){return e.metadata.entries}function Af(e){return e.removeReviewComment}function jf(e){return e.addReviewComment}function Mf(e){let t=(0,kl.c)(16),{environmentId:n,cwd:r,relativePath:i,contents:a,threadRef:o,onPendingChange:s}=e,c;t[0]!==r||t[1]!==n||t[2]!==s||t[3]!==i?(c={environmentId:n,cwd:r,relativePath:i,onPendingChange:s},t[0]=r,t[1]=n,t[2]=s,t[3]=i,t[4]=c):c=t[4];let l=Cf(c),u;t[5]!==a||t[6]!==r||t[7]!==n||t[8]!==i||t[9]!==l?(u=e=>{let{markerOffset:t,checked:o}=e,s=Ie(n,r,i)?.contents??a,c=uf(s,t,o);c!==s&&(Ce(n,r,i,c),l.change(c))},t[5]=a,t[6]=r,t[7]=n,t[8]=i,t[9]=l,t[10]=u):u=t[10];let d;return t[11]!==a||t[12]!==r||t[13]!==u||t[14]!==o?(d=(0,Z.jsx)(Fe,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(_e,{text:a,cwd:r,threadRef:o,className:`mx-auto max-w-4xl px-6 py-5`,onTaskListChange:u})}),t[11]=a,t[12]=r,t[13]=u,t[14]=o,t[15]=d):d=t[15],d}function Nf(){try{return m(ff,_)??!0}catch(e){return console.error(e),!0}}function Pf(e){let n=(0,kl.c)(78),{environmentId:r,cwd:i,projectName:o,relativePath:l,threadRef:u,composerDraftTarget:m,keybindings:_,availableEditors:v,revealLine:y,revealRequestId:x,onOpenFile:S,onPendingChange:C}=e,{resolvedTheme:ee}=oe(),w=Ge(If),T=t(),E=d(r),te;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(te={reportFailure:!1},n[0]=te):te=n[0];let ne=ie(je.createUrl,te),D;n[1]===Symbol.for(`react.memo_cache_sentinel`)?(D={reportFailure:!1},n[1]=D):D=n[1];let O=b(ke.open,D),k;n[2]===l?k=n[3]:(k=l!==null&&Ml(l),n[2]=l,n[3]=k);let A=k,j=Me(r,i,l,!A),[M,le]=(0,X.useState)(Nf),ue;n[4]===Symbol.for(`react.memo_cache_sentinel`)?(ue={path:null,revealRequestId:null},n[4]=ue):ue=n[4];let[de,fe]=(0,X.useState)(ue),pe=(0,X.useRef)(null),me;n[5]===l?me=n[6]:(me=l?lf(l):!1,n[5]=l,n[6]=me);let N=me,he=N&&de.path===l&&(y===null||de.revealRequestId===x),_e;n[7]===l?_e=n[8]:(_e=l!==null&&ce()&&ae(l),n[7]=l,n[8]=_e);let ye=_e,xe;n[9]!==i||n[10]!==l?(xe=l?ve(l,i):null,n[9]=i,n[10]=l,n[11]=xe):xe=n[11];let Se=xe,Ce;n[12]!==o||n[13]!==l?(Ce=l?cf(o,l):[],n[12]=o,n[13]=l,n[14]=Ce):Ce=n[14];let Te=Ce,Ee=yf(l,y,x),P;n[15]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{(pe.current?.querySelector(`[data-current-file-crumb='true']`))?.scrollIntoView({block:`nearest`,inline:`end`})},n[15]=P):P=n[15];let Oe;n[16]===l?Oe=n[17]:(Oe=[l],n[16]=l,n[17]=Oe),(0,X.useEffect)(P,Oe);let Ne;n[18]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=()=>{le(Ff)},n[18]=Ne):Ne=n[18];let Pe=Ne,Ie;n[19]!==Se||n[20]!==ne||n[21]!==E||n[22]!==O||n[23]!==u?(Ie=()=>{!Se||!E||(async()=>{let e=await ge({threadRef:u,filePath:Se,httpBaseUrl:E,createAssetUrl:ne,openPreview:O});if(e._tag===`Success`||f(e))return;let t=c(e);Le.add(we({type:`error`,title:`Unable to open file in browser`,description:t instanceof Error?t.message:`An error occurred.`}))})()},n[19]=Se,n[20]=ne,n[21]=E,n[22]=O,n[23]=u,n[24]=Ie):Ie=n[24];let ze=Ie,Be;n[25]!==Se||n[26]!==v||n[27]!==Te||n[28]!==ye||n[29]!==r||n[30]!==M||n[31]!==ze||n[32]!==N||n[33]!==_||n[34]!==T||n[35]!==o||n[36]!==l||n[37]!==he||n[38]!==x?(Be=l?(0,Z.jsxs)(`div`,{className:`surface-subheader gap-2 px-3`,"data-surface-subheader":!0,children:[(0,Z.jsx)(Fe,{ref:pe,hideScrollbars:!0,scrollFade:!0,className:`min-w-0 flex-1 rounded-none`,"data-file-breadcrumbs":!0,children:(0,Z.jsx)(`div`,{className:`flex h-full w-max min-w-full items-center text-xs`,children:Te.map((e,t)=>(0,Z.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center`,"data-current-file-crumb":e.kind===`file`,children:[t>0?(0,Z.jsx)(a,{className:`mx-1 size-3.5 shrink-0 text-muted-foreground/60`}):null,(0,Z.jsx)(`span`,{className:s(`max-w-40 truncate`,e.kind===`file`?`font-medium text-foreground`:`text-muted-foreground`),title:e.path||o,children:e.label})]},e.path||`project`))})}),Se&&r===T?(0,Z.jsx)(Ae,{environmentId:r,keybindings:_,availableEditors:v,openInCwd:Se,compact:!0,enableShortcut:!1}):null,N?(0,Z.jsxs)(g,{children:[(0,Z.jsx)(p,{render:(0,Z.jsx)(Ke,{className:`shrink-0`,pressed:he,onPressedChange:e=>{fe({path:e?l:null,revealRequestId:e?x:null})},"aria-label":he?`Show markdown source`:`Show rendered markdown`,variant:`ghost`,size:`sm`,children:he?(0,Z.jsx)(Je,{className:`size-3.5`}):(0,Z.jsx)(se,{className:`size-3.5`})})}),(0,Z.jsx)(h,{children:he?`Show markdown source`:`Show rendered markdown`})]}):null,ye?(0,Z.jsxs)(g,{children:[(0,Z.jsx)(p,{render:(0,Z.jsx)(Ke,{className:`shrink-0`,pressed:!1,onPressedChange:ze,"aria-label":`Open file in preview browser`,variant:`ghost`,size:`sm`,children:(0,Z.jsx)(re,{className:`size-3.5`})})}),(0,Z.jsx)(h,{children:`Open file in preview browser`})]}):null,(0,Z.jsxs)(g,{children:[(0,Z.jsx)(p,{render:(0,Z.jsx)(Ke,{className:`shrink-0`,pressed:M,onPressedChange:Pe,"aria-label":M?`Hide file explorer`:`Show file explorer`,variant:`ghost`,size:`sm`,children:(0,Z.jsx)(Ye,{className:`size-3.5`})})}),(0,Z.jsx)(h,{children:M?`Hide file explorer`:`Show file explorer`})]})]}):null,n[25]=Se,n[26]=v,n[27]=Te,n[28]=ye,n[29]=r,n[30]=M,n[31]=ze,n[32]=N,n[33]=_,n[34]=T,n[35]=o,n[36]=l,n[37]=he,n[38]=x,n[39]=Be):Be=n[39];let Ve;n[40]!==j||n[41]!==l?(Ve=l&&j.data?.truncated?(0,Z.jsxs)(`div`,{className:`shrink-0 border-b border-amber-500/20 bg-amber-500/8 px-3 py-1.5 text-[11px] text-amber-700 dark:text-amber-300`,children:[`Preview limited to the first 1 MB of a `,j.data.byteLength.toLocaleString(),` byte file.`]}):null,n[40]=j,n[41]=l,n[42]=Ve):Ve=n[42];let He=l?`flex`:`hidden`,Ue;n[43]===He?Ue=n[44]:(Ue=s(`min-w-0 flex-1 flex-col overflow-hidden`,He),n[43]=He,n[44]=Ue);let We;n[45]!==Se||n[46]!==m||n[47]!==i||n[48]!==r||n[49]!==j||n[50]!==A||n[51]!==N||n[52]!==Ee||n[53]!==C||n[54]!==l||n[55]!==he||n[56]!==ee||n[57]!==x||n[58]!==u||n[59]!==w?(We=l&&A&&Se?(0,Z.jsx)(gf,{environmentId:r,threadRef:u,absolutePath:Se,alt:l},Se):l&&j.error&&j.data===null?(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs leading-relaxed text-destructive`,children:j.error}):l&&j.data===null?(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,Z.jsx)(De,{className:`size-5 animate-spin`})}):l&&j.data?N&&he?(0,Z.jsx)(Mf,{environmentId:r,cwd:i,relativePath:l,threadRef:u,contents:j.data.contents,onPendingChange:C}):j.data.truncated?(0,Z.jsx)(Re,{className:`file-preview-virtualizer min-h-0 flex-1 overflow-auto`,config:{overscrollSize:600,intersectionObserverMargin:1200},children:(0,Z.jsx)(Ol,{file:{name:l,contents:j.data.contents,cacheKey:sf(i,l,j.data.contents)},options:{disableFileHeader:!0,overflow:w?`wrap`:`scroll`,theme:be(ee),themeType:ee,unsafeCSS:hf,onPostRender:Ee},className:`min-h-full`})},`${l}:${ee}:${j.data.byteLength}`):(0,Z.jsx)(wf,{environmentId:r,cwd:i,relativePath:l,composerDraftTarget:m,contents:j.data.contents,resolvedTheme:ee,revealRequestId:x,wordWrap:w,onPostRender:Ee,onPendingChange:C},`${l}:${ee}`):null,n[45]=Se,n[46]=m,n[47]=i,n[48]=r,n[49]=j,n[50]=A,n[51]=N,n[52]=Ee,n[53]=C,n[54]=l,n[55]=he,n[56]=ee,n[57]=x,n[58]=u,n[59]=w,n[60]=We):We=n[60];let qe;n[61]!==Ue||n[62]!==We?(qe=(0,Z.jsx)(`div`,{className:Ue,children:We}),n[61]=Ue,n[62]=We,n[63]=qe):qe=n[63];let Xe;n[64]!==i||n[65]!==r||n[66]!==M||n[67]!==S||n[68]!==o||n[69]!==l?(Xe=M||l===null?(0,Z.jsx)(`aside`,{className:s(`flex min-h-0 shrink-0 bg-background`,l?`w-[min(22rem,46%)] min-w-64 border-l border-border/60`:`min-w-0 flex-1`),children:(0,Z.jsx)(tf,{environmentId:r,cwd:i,projectName:o,onOpenFile:S},`${r}:${i}`)}):null,n[64]=i,n[65]=r,n[66]=M,n[67]=S,n[68]=o,n[69]=l,n[70]=Xe):Xe=n[70];let Ze;n[71]!==qe||n[72]!==Xe?(Ze=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[qe,Xe]}),n[71]=qe,n[72]=Xe,n[73]=Ze):Ze=n[73];let Qe;return n[74]!==Be||n[75]!==Ve||n[76]!==Ze?(Qe=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:[Be,Ve,Ze]}),n[74]=Be,n[75]=Ve,n[76]=Ze,n[77]=Qe):Qe=n[77],Qe}function Ff(e){let t=!e;try{u(ff,t,_)}catch(e){console.error(e)}return t}function If(e){return e.wordWrap}export{Pf as default};
1778
+ //# sourceMappingURL=FilePreviewPanel-CjUtAiI6.js.map