@fabiofiorita/porcelain 0.82.2 → 0.82.3

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 (39) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/server/src/cli/main.mjs +145 -71
  4. package/web/dist/assets/_-CjuX8204.js +1 -0
  5. package/web/dist/assets/_paired-CsufHhzG.js +1 -0
  6. package/web/dist/assets/{_paired-CqcR1ikJ.js → _paired-DGwd1y4R.js} +1 -1
  7. package/web/dist/assets/_paired-Uw-2dNDo.js +1 -0
  8. package/web/dist/assets/{_paired--LzhIV8q.js → _paired-dxbWzSKv.js} +1 -1
  9. package/web/dist/assets/{_section-C3rzCQs1.js → _section-BVyF13W-.js} +1 -1
  10. package/web/dist/assets/_worktreeId-CHJpLdGv.js +1 -0
  11. package/web/dist/assets/_worktreeId-CsufHhzG.js +1 -0
  12. package/web/dist/assets/_worktreeId-Uw-2dNDo.js +1 -0
  13. package/web/dist/assets/{_worktreeId-BDJbQ5Cn.js → _worktreeId-jnE7LHzn.js} +1 -1
  14. package/web/dist/assets/{access-WT1uwdZk.js → access-Be5-I3uN.js} +1 -1
  15. package/web/dist/assets/connected-workspace-bG1owcgt.js +1 -0
  16. package/web/dist/assets/{desktop-actions-WJQHB849.js → desktop-actions-BF1FmtLQ.js} +22 -22
  17. package/web/dist/assets/{edit-file-CG3WhqLS.js → edit-file-C2FNFMOI.js} +1 -1
  18. package/web/dist/assets/{file-editor-DGtg0rP2.js → file-editor-oLgfLZbs.js} +1 -1
  19. package/web/dist/assets/index-HBCxqMtr.css +2 -0
  20. package/web/dist/assets/{index-Bk8Ig0Ne.js → index-jwdWY-Oe.js} +3 -3
  21. package/web/dist/assets/{lazyRouteComponent-DpO3HGey.js → lazyRouteComponent-jhdvs2sU.js} +1 -1
  22. package/web/dist/assets/{pair-CqLMCfsc.js → pair-FC2KSEZT.js} +1 -1
  23. package/web/dist/assets/pair-Uw-2dNDo.js +1 -0
  24. package/web/dist/assets/{settings-page-RYnO3e6i.js → settings-page-_25QMUsD.js} +108 -108
  25. package/web/dist/assets/{useMatch-Dht53RCg.js → useMatch-BNfVF2UU.js} +1 -1
  26. package/web/dist/assets/useRouterState-GOqQRnzK.js +1 -0
  27. package/web/dist/assets/{workspace-error-CIsCnenX.js → workspace-error-BtARcbMJ.js} +1 -1
  28. package/web/dist/assets/{workspace-pending-oH5nDvO6.js → workspace-pending-CF3GKXTj.js} +1 -1
  29. package/web/dist/index.html +8 -8
  30. package/web/dist/assets/_-b1prKmSp.js +0 -1
  31. package/web/dist/assets/_paired-B07BAuB3.js +0 -1
  32. package/web/dist/assets/_paired-D-U8zru5.js +0 -1
  33. package/web/dist/assets/_worktreeId-B07BAuB3.js +0 -1
  34. package/web/dist/assets/_worktreeId-D-U8zru5.js +0 -1
  35. package/web/dist/assets/_worktreeId-D1NaqSVx.js +0 -1
  36. package/web/dist/assets/connected-workspace-DcS6e5zB.js +0 -1
  37. package/web/dist/assets/index-BoONRxa4.css +0 -2
  38. package/web/dist/assets/pair-D-U8zru5.js +0 -1
  39. package/web/dist/assets/useRouterState-DCsGUMtp.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/file-editor-DGtg0rP2.js","assets/rolldown-runtime-XKyaHtl9.js","assets/access-WT1uwdZk.js","assets/edit-file-CG3WhqLS.js","assets/preload-helper-7y9sWmk5.js","assets/hastToHtml-yWaxTNYJ.js","assets/unwrapDefault-ByDmBtHB.js","assets/lib-6HYXi0_j.js","assets/constants-CmGPilXJ.js","assets/formatCSSVariablePrefix-KRh9vnZf.js","assets/cloneFileDiffMetadata-OfK4h7R8.js","assets/utils-C9Glzetk.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$ as t,$c as n,$i as r,$s as i,$t as a,A as o,Ac as s,An as c,Ao as l,Ar as u,Bc as d,Bi as f,Bo as p,Bs as m,Bt as h,C as g,Ca as _,Ci as v,Cn as y,Co as b,Cr as x,D as S,Dc as C,Di as w,Dr as T,E,Ea as D,Ec as O,Ei as k,Er as A,F as j,Fc as M,Fi as N,Fs as P,Ft as F,Gi as I,Go as L,Gr as R,Gs as ee,H as te,Hc as z,Hi as ne,Ho as B,Hs as re,I as ie,Ia as V,Ic as ae,Ii as oe,Io as se,Ir as ce,It as le,Ja as ue,Jc as de,Ji as fe,Jr as pe,Js as me,Kc as he,Ki as ge,La as _e,Li as ve,Lo as ye,Lr as be,Ls as xe,Lt as Se,M as Ce,Ma as H,Mi as we,Ms as Te,Mt as Ee,Na as De,Ni as Oe,O as ke,Oa as U,Oc as Ae,Oi as je,On as Me,Oo as Ne,Pi as Pe,Pt as Fe,Q as Ie,Qc as Le,Qi as Re,Qo as ze,Qt as Be,Rc as Ve,Ri as He,Ro as Ue,Rt as We,S as Ge,Sa as Ke,Sc as qe,So as Je,Sr as Ye,T as Xe,Ta as Ze,Ti as Qe,Tr as $e,U as et,Ua as W,Uc as tt,Ui as nt,Vc as rt,Vi as it,Wc as at,Wo as ot,Wr as st,Ws as ct,Xc as lt,Xo as ut,Xr as dt,Xs as ft,Ya as pt,Yo as mt,Yr as ht,Ys as gt,Zi as _t,Zs as vt,Zt as yt,_a as bt,_i as xt,_n as St,_r as Ct,_t as wt,ac as Tt,at as Et,bc as Dt,bi as Ot,bl as kt,bn as At,bo as jt,br as Mt,bt as Nt,c as Pt,ca as Ft,cc as It,cn as Lt,cr as Rt,ct as zt,d as Bt,da as Vt,dc as Ht,dl as Ut,dn as Wt,do as Gt,dt as Kt,ec as qt,ei as Jt,el as Yt,eo as Xt,et as Zt,f as Qt,fl as $t,fn as en,ft as tn,g as nn,ga as rn,gc as an,gi as on,gn as sn,gr as cn,h as ln,ha as un,hc as dn,hi as fn,hl as pn,hr as mn,ht as hn,ia as gn,ii as _n,it as vn,ja as yn,jc as bn,jr as xn,jt as Sn,k as Cn,ka as wn,kc as Tn,ki as En,kn as Dn,ko as On,l as kn,lc as An,ll as jn,ln as Mn,lr as Nn,lt as Pn,m as Fn,ma as In,mc as Ln,mi as Rn,ml as zn,nc as Bn,nl as Vn,nt as Hn,oa as Un,oc as Wn,oi as Gn,ol as Kn,on as qn,ot as Jn,p as Yn,pa as Xn,pi as Zn,po as Qn,pr as $n,pt as er,qi as tr,qs as nr,rc as rr,rl as ir,rn as ar,rt as or,sc as sr,si as cr,sr as lr,st as ur,t as dr,ti as fr,tl as pr,tn as mr,to as hr,ts as gr,tt as _r,u as vr,ua as yr,uc as br,ul as xr,ur as Sr,ut as Cr,va as wr,vi as Tr,vo as Er,vr as Dr,vt as Or,w as kr,wi as Ar,wo as jr,wr as Mr,xi as Nr,xl as Pr,xn as Fr,xr as Ir,xt as Lr,yc as Rr,yi as zr,yl as Br,yo as Vr,yr as Hr,za as Ur,zc as Wr,zi as Gr,zo as Kr,zt as qr}from"./access-WT1uwdZk.js";import{n as Jr}from"./useMatch-Dht53RCg.js";import{An as Yr,Ar as Xr,B as Zr,Br as Qr,C as $r,Cn as ei,Dn as ti,Dr as ni,En as ri,Er as ii,F as ai,Fr as oi,Gr as si,H as ci,I as li,Ir as ui,Jn as di,Jt as fi,L as pi,Ln as mi,Lr as hi,Mr as gi,Nn as _i,Nr as vi,On as yi,Or as bi,Pn as xi,Pr as Si,Q as Ci,Qn as wi,R as Ti,Rn as Ei,Rr as Di,Sn as Oi,Sr as ki,Tn as Ai,Tr as ji,Ur as Mi,V as Ni,Vr as Pi,W as Fi,Wn as Ii,Wr as Li,X as Ri,Xr as zi,Y as Bi,Yn as Vi,Zn as Hi,Zr as Ui,_ as Wi,_n as Gi,_r as Ki,a as qi,an as Ji,br as Yi,c as Xi,ct as Zi,d as Qi,dn as $i,dt as ea,f as ta,fn as na,g as ra,gn as ia,gr as aa,h as oa,hn as sa,hr as ca,jr as la,kn as ua,kr as da,l as fa,lt as pa,m as ma,mn as ha,mr as ga,n as _a,nr as va,o as ya,p as ba,pn as xa,pr as Sa,rn as Ca,sn as wa,u as Ta,ut as Ea,v as Da,vn as Oa,vr as ka,wn as Aa,yr as ja,z as Ma,zr as Na}from"./edit-file-CG3WhqLS.js";import{t as Pa}from"./preload-helper-7y9sWmk5.js";import{d as Fa,m as Ia,n as La,r as Ra,u as za,v as Ba}from"./hastToHtml-yWaxTNYJ.js";import{r as Va}from"./constants-CmGPilXJ.js";import{t as Ha}from"./resolveLanguages-BkDrap64.js";function Ua(e){let t=ze();return ut(t.stores.location,Jr(e,t))}function Wa(){let e=ze();return ut(e.stores.location,e=>e.state.__TSR_index!==0)}var G=e(Te(),1),K=gr(),Ga=class{attachedStores=[];attachedStoreValue=null;storeListeners=new Set;constructor(e,t,n=!0){this.fallbackStore=e,this.componentName=t,this.throwOnMissingTrigger=n}get attachedStore(){return this.attachedStoreValue}get store(){return this.attachedStoreValue??this.fallbackStore}get serverStore(){return this.fallbackStore}subscribeStore(e){return this.storeListeners.add(e),()=>{this.storeListeners.delete(e)}}attachStore(e){return this.attachedStores.push(e),this.setActiveStore(e),()=>{let t=this.attachedStores.lastIndexOf(e);t!==-1&&this.attachedStores.splice(t,1),this.setActiveStore(this.attachedStores[this.attachedStores.length-1]??null)}}setActiveStore(e){this.attachedStoreValue!==e&&(this.attachedStoreValue=e,this.storeListeners.forEach(e=>{e()}))}openByTrigger(e){let t=this.attachedStore;if(t===null)return;let n;if(e){for(let t=this.attachedStores.length-1;t>=0&&!n;--t)n=this.attachedStores[t].context.triggerElements.getById(e);n??=this.fallbackStore.context.triggerElements.getById(e)}if(e&&!n&&this.throwOnMissingTrigger)throw Error(On(99,this.componentName,e,this.componentName));t.setOpen(!0,V(Ur,void 0,n))}closePopup(){let e=this.attachedStore;e!==null&&e.setOpen(!1,V(Ur))}},Ka={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};Ka.node;var qa=U(Ka),Ja={name:`circle-alert`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]],aliases:[`alert-circle`]};Ja.node;var Ya=U(Ja),Xa={name:`clipboard`,size:24,node:[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}]]};Xa.node;var Za=U(Xa),Qa={name:`columns-2`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]],aliases:[`columns`]};Qa.node;var $a=U(Qa),eo={name:`copy-plus`,size:24,node:[[`line`,{x1:`15`,x2:`15`,y1:`12`,y2:`18`,key:`1p7wdc`}],[`line`,{x1:`12`,x2:`18`,y1:`15`,y2:`15`,key:`1nscbv`}],[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};eo.node;var to=U(eo),no={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};no.node;var ro=U(no),io={name:`eye-off`,size:24,node:[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};io.node;var ao=U(io),oo={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};oo.node;var so=U(oo),co={name:`file-code`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]};co.node;var lo=U(co),uo={name:`file-diff`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]};uo.node;var fo=U(uo),po={name:`file-plus`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]};po.node;var mo=U(po),ho={name:`folder-git-2`,size:24,node:[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]};ho.node;var go=U(ho),_o={name:`folder-minus`,size:24,node:[[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};_o.node;var vo=U(_o),yo={name:`folder-plus`,size:24,node:[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};yo.node;var bo=U(yo),xo={name:`folder`,size:24,node:[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};xo.node;var So=U(xo),Co={name:`git-branch`,size:24,node:[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]};Co.node;var wo=U(Co),To={name:`house`,size:24,node:[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]],aliases:[`home`]};To.node;var Eo=U(To),Do={name:`keyboard`,size:24,node:[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]};Do.node;var Oo=U(Do),ko={name:`list-chevrons-up-down`,size:24,node:[[`path`,{d:`M3 5h8`,key:`18g2rq`}],[`path`,{d:`M3 12h8`,key:`1xfjp6`}],[`path`,{d:`M3 19h8`,key:`fpbke4`}],[`path`,{d:`m15 8 3-3 3 3`,key:`bc4io6`}],[`path`,{d:`m15 16 3 3 3-3`,key:`9wmg1l`}]]};ko.node;var Ao=U(ko),jo={name:`list-filter`,size:24,node:[[`path`,{d:`M2 5h20`,key:`1fs1ex`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M9 19h6`,key:`456am0`}]]};jo.node;var Mo=U(jo),No={name:`pin`,size:24,node:[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]};No.node;var Po=U(No),Fo={name:`pin-off`,size:24,node:[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]};Fo.node;var Io=U(Fo),Lo={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};Lo.node;var Ro=U(Lo),zo={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};zo.node;var Bo=U(zo),Vo={name:`rotate-ccw-clock`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]],aliases:[`history`]};Vo.node;var Ho=U(Vo),Uo={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};Uo.node;var Wo=U(Uo),Go={name:`settings`,size:24,node:[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Go.node;var Ko=U(Go),qo={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};qo.node;var Jo=U(qo),Yo={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};Yo.node;var Xo=U(Yo),Zo=`160000`;function Qo(e){return e.oldMode===Zo||e.newMode===Zo}function $o(e){return e.kind===`text`||e.kind===`metadata-only`}function es(e,t){return Qo(e)||t?.kind!==`text`?null:e.newPath??e.oldPath??null}function ts(e){return`path`in e?e.path:e.newPath??e.oldPath??``}function ns(e){return`${e.scope}\n${e.oldPath}\n${e.newPath}`}function rs(e){return`change:${e.scope}:${ts(e)}`}var is=e(L(),1),q=ot(),as=e=>e.newPath??e.oldPath??``;function os(e,t,n){if(t.length===0)return[];let r=new Map,i=e=>{let t=r.get(e)??{expectedFiles:[],selections:[]};return r.set(e,t),t};for(let t of e)i(t.path).expectedFiles.push(t);for(let e of t)i(as(e)).selections.push(e);let a=[],o={expectedFiles:[],selections:[]};for(let e of[...r.keys()].sort((e,t)=>e.localeCompare(t))){let t=r.get(e)??{expectedFiles:[],selections:[]};o.selections.length>0&&(o.expectedFiles.length+t.expectedFiles.length>n||o.selections.length+t.selections.length>n)&&(a.push(o),o={expectedFiles:[],selections:[]}),o.expectedFiles.push(...t.expectedFiles),o.selections.push(...[...t.selections].sort((e,t)=>ns(e).localeCompare(ns(t))))}return a.push(o),a}function ss(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}function cs(e,t){let n=new Map(e.map(e=>[e.path,e])),r=[];for(let e of t){let t=n.get(e.path);t&&(r.push(t),n.delete(e.path))}return[...r,...n.values()]}function ls(e,t){if(e.fingerprint===null||e.fingerprint===void 0)return`unreviewed`;let n=t.find(t=>t.path===e.path);return n?n.fingerprint===e.fingerprint?`reviewed`:`stale`:`unreviewed`}function us(e,t){return t.find(t=>t.path===e.path)}function ds(e,t,n){let r=n==null?null:new Set(n);return e.changes.flatMap(n=>{if(r&&!r.has(n.path))return[];let i=us(n,t.marks);return[{...n,environmentId:e.environmentId,worktreeId:e.worktreeId,statusToken:e.statusToken,reviewStatus:ls(n,t.marks),...i?{mark:i}:{}}]})}function fs(e,t,n){let r=n==null?null:new Set(n);return e.flatMap(e=>{if(r&&!r.has(e.path))return[];let n=us(e,t.marks);return[{...e,reviewStatus:ls(e,t.marks),...n?{mark:n}:{}}]})}function ps(e){return e instanceof Error&&(e.name===`ConnectionError`||e.name===`WriteNotSentError`)?e.message:`These changes could not be loaded. Try again.`}function ms(e){return e.fingerprint!==null&&e.fingerprint!==void 0}function hs(e){return e.split(`/`).at(-1)??e}var gs={kind:`worktree`};function _s(e){return{kind:`branch`,base:e?.base?.ref??``,branch:e?.head.branch}}function vs(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}function ys(e){return[...new Map(e.map(e=>[e.path,e])).values()]}function bs(e){let t={marked:[],skipped:[],failed:[]},n=[];for(let r of ys(e))r.reviewStatus===`reviewed`?t.skipped.push({path:r.path,reason:`already-reviewed`}):!ms(r)||r.fingerprint===null||r.fingerprint===void 0?t.skipped.push({path:r.path,reason:`not-fingerprintable`}):n.push({path:r.path,fingerprint:r.fingerprint});return{report:t,files:n}}function xs(e,t){return{...e,marked:[...e.marked,...t.marked],failed:[...e.failed,...t.conflicts.map(e=>({path:e.path,error:Error(e.reason===`missing`?`That file is no longer in the change list.`:`The file changed since it was shown.`)}))]}}function Ss(e){let t=e.failed.length,n=e.skipped.filter(e=>e.reason===`not-fingerprintable`).length,r=e.skipped.length-n;return[e.marked.length>0?`Marked ${ce(e.marked.length,`file`)}.`:`No files marked.`,n>0?`Skipped ${n}.`:``,r>0?`${r} already reviewed.`:``,t>0?`${t} failed.`:``].filter(Boolean).join(` `)}function Cs(e){return`${e.join(`, `)} cannot be marked reviewed because ${be(e.length,`its fingerprint is`,`their fingerprints are`)} unavailable (too large or unreadable).`}function ws(e){let t=ys(e),n=t.filter(ms),r=n.filter(e=>e.fingerprint!==null&&e.fingerprint!==void 0&&e.reviewStatus!==`reviewed`),i=n.filter(e=>e.reviewStatus===`reviewed`),a=t.length-n.length,o=r.length===0&&i.length>0,s=a>0?`${n.length} reviewed · ${a} unavailable`:`All reviewed`,c=n.length===0?null:o?`Unmark all`:r.length===0?s:null;return{entries:t,reviewedPaths:i.map(e=>e.path),unmarking:o,blocked:n.length===0||r.length===0&&i.length===0,label:n.length===0?`No files can be marked reviewed`:c??`Mark all ${ce(r.length,`file`)} reviewed`,text:n.length===0?`No reviewable files`:c??`Mark all reviewed`}}function Ts(e,t){return t===`reviewed`?`Unmark ${e} as unreviewed`:t===`stale`?`Mark changed ${e} as reviewed`:`Mark ${e} as reviewed`}function Es(e,t){return!e?.fingerprint||t?null:e.reviewed?{kind:`unmark`,path:e.path}:{kind:`mark`,input:{path:e.path,fingerprint:e.fingerprint}}}function Ds(e){return e.kind===`branch`?{kind:`branch`,branch:e.branch}:{kind:`worktree`}}function Os(e){return[`reviewed`,...e.kind===`branch`?[`branch`,e.branch??``]:[]]}function ks(e,t){let n=new Map(e.marks.map(e=>[e.path,e]));for(let e of t)for(let t of e.changes)t.fingerprint?n.set(t.path,{path:t.path,fingerprint:t.fingerprint,reviewedAt:e.reviewedAt}):n.delete(t.path);return{...e,marks:[...n.values()]}}var As=class extends Ga{constructor(){super(Xe(),`Dialog`,!1)}open(e){this.openByTrigger(e)}openWithPayload(e){let t=this.attachedStore;t!==null&&(t.set(`payload`,e),t.setOpen(!0,V(Ur)))}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select(`open`)??!1}};function js(){return new As}var Ms=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/file-editor-oLgfLZbs.js","assets/rolldown-runtime-XKyaHtl9.js","assets/access-Be5-I3uN.js","assets/edit-file-C2FNFMOI.js","assets/preload-helper-7y9sWmk5.js","assets/hastToHtml-yWaxTNYJ.js","assets/unwrapDefault-ByDmBtHB.js","assets/lib-6HYXi0_j.js","assets/constants-CmGPilXJ.js","assets/formatCSSVariablePrefix-KRh9vnZf.js","assets/cloneFileDiffMetadata-OfK4h7R8.js","assets/utils-C9Glzetk.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$ as t,$c as n,$i as r,$s as i,$t as a,A as o,Ac as s,An as c,Ao as l,Ar as u,Bc as d,Bi as f,Bo as p,Bs as m,Bt as h,C as g,Ca as _,Ci as v,Cn as y,Co as b,Cr as x,D as S,Dc as C,Di as w,Dr as T,E,Ea as D,Ec as O,Ei as k,Er as A,F as j,Fc as M,Fi as N,Fs as P,Ft as F,Gi as I,Go as L,Gr as R,Gs as ee,H as te,Hc as z,Hi as ne,Ho as B,Hs as re,I as ie,Ia as V,Ic as ae,Ii as oe,Io as se,Ir as ce,It as le,Ja as ue,Jc as de,Ji as fe,Jr as pe,Js as me,Kc as he,Ki as ge,La as _e,Li as ve,Lo as ye,Lr as be,Ls as xe,Lt as Se,M as Ce,Ma as H,Mi as we,Ms as Te,Mt as Ee,Na as De,Ni as Oe,O as ke,Oa as U,Oc as Ae,Oi as je,On as Me,Oo as Ne,Pi as Pe,Pt as Fe,Q as Ie,Qc as Le,Qi as Re,Qo as ze,Qt as Be,Rc as Ve,Ri as He,Ro as Ue,Rt as We,S as Ge,Sa as Ke,Sc as qe,So as Je,Sr as Ye,T as Xe,Ta as Ze,Ti as Qe,Tr as $e,U as et,Ua as W,Uc as tt,Ui as nt,Vc as rt,Vi as it,Wc as at,Wo as ot,Wr as st,Ws as ct,Xc as lt,Xo as ut,Xr as dt,Xs as ft,Ya as pt,Yo as mt,Yr as ht,Ys as gt,Zi as _t,Zs as vt,Zt as yt,_a as bt,_i as xt,_n as St,_r as Ct,_t as wt,ac as Tt,at as Et,bc as Dt,bi as Ot,bl as kt,bn as At,bo as jt,br as Mt,bt as Nt,c as Pt,ca as Ft,cc as It,cn as Lt,cr as Rt,ct as zt,d as Bt,da as Vt,dc as Ht,dl as Ut,dn as Wt,do as Gt,dt as Kt,ec as qt,ei as Jt,el as Yt,eo as Xt,et as Zt,f as Qt,fl as $t,fn as en,ft as tn,g as nn,ga as rn,gc as an,gi as on,gn as sn,gr as cn,h as ln,ha as un,hc as dn,hi as fn,hl as pn,hr as mn,ht as hn,ia as gn,ii as _n,it as vn,ja as yn,jc as bn,jr as xn,jt as Sn,k as Cn,ka as wn,kc as Tn,ki as En,kn as Dn,ko as On,l as kn,lc as An,ll as jn,ln as Mn,lr as Nn,lt as Pn,m as Fn,ma as In,mc as Ln,mi as Rn,ml as zn,nc as Bn,nl as Vn,nt as Hn,oa as Un,oc as Wn,oi as Gn,ol as Kn,on as qn,ot as Jn,p as Yn,pa as Xn,pi as Zn,po as Qn,pr as $n,pt as er,qi as tr,qs as nr,rc as rr,rl as ir,rn as ar,rt as or,sc as sr,si as cr,sr as lr,st as ur,t as dr,ti as fr,tl as pr,tn as mr,to as hr,ts as gr,tt as _r,u as vr,ua as yr,uc as br,ul as xr,ur as Sr,ut as Cr,va as wr,vi as Tr,vo as Er,vr as Dr,vt as Or,w as kr,wi as Ar,wo as jr,wr as Mr,xi as Nr,xl as Pr,xn as Fr,xr as Ir,xt as Lr,yc as Rr,yi as zr,yl as Br,yo as Vr,yr as Hr,za as Ur,zc as Wr,zi as Gr,zo as Kr,zt as qr}from"./access-Be5-I3uN.js";import{n as Jr}from"./useMatch-BNfVF2UU.js";import{An as Yr,Ar as Xr,B as Zr,Br as Qr,C as $r,Cn as ei,Dn as ti,Dr as ni,En as ri,Er as ii,F as ai,Fr as oi,Gr as si,H as ci,I as li,Ir as ui,Jn as di,Jt as fi,L as pi,Ln as mi,Lr as hi,Mr as gi,Nn as _i,Nr as vi,On as yi,Or as bi,Pn as xi,Pr as Si,Q as Ci,Qn as wi,R as Ti,Rn as Ei,Rr as Di,Sn as Oi,Sr as ki,Tn as Ai,Tr as ji,Ur as Mi,V as Ni,Vr as Pi,W as Fi,Wn as Ii,Wr as Li,X as Ri,Xr as zi,Y as Bi,Yn as Vi,Zn as Hi,Zr as Ui,_ as Wi,_n as Gi,_r as Ki,a as qi,an as Ji,br as Yi,c as Xi,ct as Zi,d as Qi,dn as $i,dt as ea,f as ta,fn as na,g as ra,gn as ia,gr as aa,h as oa,hn as sa,hr as ca,jr as la,kn as ua,kr as da,l as fa,lt as pa,m as ma,mn as ha,mr as ga,n as _a,nr as va,o as ya,p as ba,pn as xa,pr as Sa,rn as Ca,sn as wa,u as Ta,ut as Ea,v as Da,vn as Oa,vr as ka,wn as Aa,yr as ja,z as Ma,zr as Na}from"./edit-file-C2FNFMOI.js";import{t as Pa}from"./preload-helper-7y9sWmk5.js";import{d as Fa,m as Ia,n as La,r as Ra,u as za,v as Ba}from"./hastToHtml-yWaxTNYJ.js";import{r as Va}from"./constants-CmGPilXJ.js";import{t as Ha}from"./resolveLanguages-BkDrap64.js";function Ua(e){let t=ze();return ut(t.stores.location,Jr(e,t))}function Wa(){let e=ze();return ut(e.stores.location,e=>e.state.__TSR_index!==0)}var G=e(Te(),1),K=gr(),Ga=class{attachedStores=[];attachedStoreValue=null;storeListeners=new Set;constructor(e,t,n=!0){this.fallbackStore=e,this.componentName=t,this.throwOnMissingTrigger=n}get attachedStore(){return this.attachedStoreValue}get store(){return this.attachedStoreValue??this.fallbackStore}get serverStore(){return this.fallbackStore}subscribeStore(e){return this.storeListeners.add(e),()=>{this.storeListeners.delete(e)}}attachStore(e){return this.attachedStores.push(e),this.setActiveStore(e),()=>{let t=this.attachedStores.lastIndexOf(e);t!==-1&&this.attachedStores.splice(t,1),this.setActiveStore(this.attachedStores[this.attachedStores.length-1]??null)}}setActiveStore(e){this.attachedStoreValue!==e&&(this.attachedStoreValue=e,this.storeListeners.forEach(e=>{e()}))}openByTrigger(e){let t=this.attachedStore;if(t===null)return;let n;if(e){for(let t=this.attachedStores.length-1;t>=0&&!n;--t)n=this.attachedStores[t].context.triggerElements.getById(e);n??=this.fallbackStore.context.triggerElements.getById(e)}if(e&&!n&&this.throwOnMissingTrigger)throw Error(On(99,this.componentName,e,this.componentName));t.setOpen(!0,V(Ur,void 0,n))}closePopup(){let e=this.attachedStore;e!==null&&e.setOpen(!1,V(Ur))}},Ka={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};Ka.node;var qa=U(Ka),Ja={name:`circle-alert`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]],aliases:[`alert-circle`]};Ja.node;var Ya=U(Ja),Xa={name:`clipboard`,size:24,node:[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}]]};Xa.node;var Za=U(Xa),Qa={name:`columns-2`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]],aliases:[`columns`]};Qa.node;var $a=U(Qa),eo={name:`copy-plus`,size:24,node:[[`line`,{x1:`15`,x2:`15`,y1:`12`,y2:`18`,key:`1p7wdc`}],[`line`,{x1:`12`,x2:`18`,y1:`15`,y2:`15`,key:`1nscbv`}],[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};eo.node;var to=U(eo),no={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};no.node;var ro=U(no),io={name:`eye-off`,size:24,node:[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};io.node;var ao=U(io),oo={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};oo.node;var so=U(oo),co={name:`file-code`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]};co.node;var lo=U(co),uo={name:`file-diff`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]};uo.node;var fo=U(uo),po={name:`file-plus`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]};po.node;var mo=U(po),ho={name:`folder-git-2`,size:24,node:[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]};ho.node;var go=U(ho),_o={name:`folder-minus`,size:24,node:[[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};_o.node;var vo=U(_o),yo={name:`folder-plus`,size:24,node:[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};yo.node;var bo=U(yo),xo={name:`folder`,size:24,node:[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};xo.node;var So=U(xo),Co={name:`git-branch`,size:24,node:[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]};Co.node;var wo=U(Co),To={name:`house`,size:24,node:[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]],aliases:[`home`]};To.node;var Eo=U(To),Do={name:`keyboard`,size:24,node:[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]};Do.node;var Oo=U(Do),ko={name:`list-chevrons-up-down`,size:24,node:[[`path`,{d:`M3 5h8`,key:`18g2rq`}],[`path`,{d:`M3 12h8`,key:`1xfjp6`}],[`path`,{d:`M3 19h8`,key:`fpbke4`}],[`path`,{d:`m15 8 3-3 3 3`,key:`bc4io6`}],[`path`,{d:`m15 16 3 3 3-3`,key:`9wmg1l`}]]};ko.node;var Ao=U(ko),jo={name:`list-filter`,size:24,node:[[`path`,{d:`M2 5h20`,key:`1fs1ex`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M9 19h6`,key:`456am0`}]]};jo.node;var Mo=U(jo),No={name:`pin`,size:24,node:[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]};No.node;var Po=U(No),Fo={name:`pin-off`,size:24,node:[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]};Fo.node;var Io=U(Fo),Lo={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};Lo.node;var Ro=U(Lo),zo={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};zo.node;var Bo=U(zo),Vo={name:`rotate-ccw-clock`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]],aliases:[`history`]};Vo.node;var Ho=U(Vo),Uo={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};Uo.node;var Wo=U(Uo),Go={name:`settings`,size:24,node:[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Go.node;var Ko=U(Go),qo={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};qo.node;var Jo=U(qo),Yo={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};Yo.node;var Xo=U(Yo),Zo=`160000`;function Qo(e){return e.oldMode===Zo||e.newMode===Zo}function $o(e){return e.kind===`text`||e.kind===`metadata-only`}function es(e,t){return Qo(e)||t?.kind!==`text`?null:e.newPath??e.oldPath??null}function ts(e){return`path`in e?e.path:e.newPath??e.oldPath??``}function ns(e){return`${e.scope}\n${e.oldPath}\n${e.newPath}`}function rs(e){return`change:${e.scope}:${ts(e)}`}var is=e(L(),1),q=ot(),as=e=>e.newPath??e.oldPath??``;function os(e,t,n){if(t.length===0)return[];let r=new Map,i=e=>{let t=r.get(e)??{expectedFiles:[],selections:[]};return r.set(e,t),t};for(let t of e)i(t.path).expectedFiles.push(t);for(let e of t)i(as(e)).selections.push(e);let a=[],o={expectedFiles:[],selections:[]};for(let e of[...r.keys()].sort((e,t)=>e.localeCompare(t))){let t=r.get(e)??{expectedFiles:[],selections:[]};o.selections.length>0&&(o.expectedFiles.length+t.expectedFiles.length>n||o.selections.length+t.selections.length>n)&&(a.push(o),o={expectedFiles:[],selections:[]}),o.expectedFiles.push(...t.expectedFiles),o.selections.push(...[...t.selections].sort((e,t)=>ns(e).localeCompare(ns(t))))}return a.push(o),a}function ss(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}function cs(e,t){let n=new Map(e.map(e=>[e.path,e])),r=[];for(let e of t){let t=n.get(e.path);t&&(r.push(t),n.delete(e.path))}return[...r,...n.values()]}function ls(e,t){if(e.fingerprint===null||e.fingerprint===void 0)return`unreviewed`;let n=t.find(t=>t.path===e.path);return n?n.fingerprint===e.fingerprint?`reviewed`:`stale`:`unreviewed`}function us(e,t){return t.find(t=>t.path===e.path)}function ds(e,t,n){let r=n==null?null:new Set(n);return e.changes.flatMap(n=>{if(r&&!r.has(n.path))return[];let i=us(n,t.marks);return[{...n,environmentId:e.environmentId,worktreeId:e.worktreeId,statusToken:e.statusToken,reviewStatus:ls(n,t.marks),...i?{mark:i}:{}}]})}function fs(e,t,n){let r=n==null?null:new Set(n);return e.flatMap(e=>{if(r&&!r.has(e.path))return[];let n=us(e,t.marks);return[{...e,reviewStatus:ls(e,t.marks),...n?{mark:n}:{}}]})}function ps(e){return e instanceof Error&&(e.name===`ConnectionError`||e.name===`WriteNotSentError`)?e.message:`These changes could not be loaded. Try again.`}function ms(e){return e.fingerprint!==null&&e.fingerprint!==void 0}function hs(e){return e.split(`/`).at(-1)??e}var gs={kind:`worktree`};function _s(e){return{kind:`branch`,base:e?.base?.ref??``,branch:e?.head.branch}}function vs(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}function ys(e){return[...new Map(e.map(e=>[e.path,e])).values()]}function bs(e){let t={marked:[],skipped:[],failed:[]},n=[];for(let r of ys(e))r.reviewStatus===`reviewed`?t.skipped.push({path:r.path,reason:`already-reviewed`}):!ms(r)||r.fingerprint===null||r.fingerprint===void 0?t.skipped.push({path:r.path,reason:`not-fingerprintable`}):n.push({path:r.path,fingerprint:r.fingerprint});return{report:t,files:n}}function xs(e,t){return{...e,marked:[...e.marked,...t.marked],failed:[...e.failed,...t.conflicts.map(e=>({path:e.path,error:Error(e.reason===`missing`?`That file is no longer in the change list.`:`The file changed since it was shown.`)}))]}}function Ss(e){let t=e.failed.length,n=e.skipped.filter(e=>e.reason===`not-fingerprintable`).length,r=e.skipped.length-n;return[e.marked.length>0?`Marked ${ce(e.marked.length,`file`)}.`:`No files marked.`,n>0?`Skipped ${n}.`:``,r>0?`${r} already reviewed.`:``,t>0?`${t} failed.`:``].filter(Boolean).join(` `)}function Cs(e){return`${e.join(`, `)} cannot be marked reviewed because ${be(e.length,`its fingerprint is`,`their fingerprints are`)} unavailable (too large or unreadable).`}function ws(e){return`${Cs(e)} This stop stays open until every file can be marked reviewed.`}function Ts(e){let t=e.skipped.filter(e=>e.reason===`not-fingerprintable`).map(e=>e.path);if(t.length>0)return{title:`Some files cannot be marked reviewed`,description:`${Ss(e)} ${ws(t)}`,type:e.failed.length>0?`error`:`warning`};if(e.failed.length>0)return{title:`Some files changed before they were marked`,description:Ss(e),type:`error`}}function Es(e){let t=ys(e),n=t.filter(ms),r=n.filter(e=>e.fingerprint!==null&&e.fingerprint!==void 0&&e.reviewStatus!==`reviewed`),i=n.filter(e=>e.reviewStatus===`reviewed`),a=t.length-n.length,o=r.length===0&&i.length>0,s=a>0?`${n.length} reviewed · ${a} unavailable`:`All reviewed`,c=n.length===0?null:o?`Unmark all`:r.length===0?s:null;return{entries:t,reviewedPaths:i.map(e=>e.path),unmarking:o,blocked:n.length===0||r.length===0&&i.length===0,label:n.length===0?`No files can be marked reviewed`:c??`Mark all ${ce(r.length,`file`)} reviewed`,text:n.length===0?`No reviewable files`:c??`Mark all reviewed`}}function Ds(e,t){return t===`reviewed`?`Unmark ${e} as unreviewed`:t===`stale`?`Mark changed ${e} as reviewed`:`Mark ${e} as reviewed`}function Os(e,t){return!e?.fingerprint||t?null:e.reviewed?{kind:`unmark`,path:e.path}:{kind:`mark`,input:{path:e.path,fingerprint:e.fingerprint}}}function ks(e){return e.kind===`branch`?{kind:`branch`,branch:e.branch}:{kind:`worktree`}}function As(e){return[`reviewed`,...e.kind===`branch`?[`branch`,e.branch??``]:[]]}function js(e,t){let n=new Map(e.marks.map(e=>[e.path,e]));for(let e of t)for(let t of e.changes)t.fingerprint?n.set(t.path,{path:t.path,fingerprint:t.fingerprint,reviewedAt:e.reviewedAt}):n.delete(t.path);return{...e,marks:[...n.values()]}}var Ms=class extends Ga{constructor(){super(Xe(),`Dialog`,!1)}open(e){this.openByTrigger(e)}openWithPayload(e){let t=this.attachedStore;t!==null&&(t.set(`payload`,e),t.setOpen(!0,V(Ur)))}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select(`open`)??!1}};function Ns(){return new Ms}var Ps=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
3
3
  <symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
4
4
  <path d="M12.4697 5.46973C12.7626 5.17684 13.2374 5.17684 13.5303 5.46973C13.8232 5.76262 13.8232 6.23738 13.5303 6.53028L8.53028 11.5303C8.23738 11.8232 7.76262 11.8232 7.46973 11.5303L2.46973 6.53028C2.17684 6.23738 2.17684 5.76262 2.46973 5.46973C2.76262 5.17684 3.23738 5.17684 3.53028 5.46973L8 9.93946L12.4697 5.46973Z" fill="currentcolor"/>
5
5
  </symbol>
@@ -16,72 +16,72 @@ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$ as t,$c as n,$i as r
16
16
  <symbol id="file-tree-icon-ellipsis" viewBox="0 0 16 16">
17
17
  <path d="M5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M9.5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M14 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0" />
18
18
  </symbol>
19
- </svg>`,Ns=`<symbol id="file-tree-builtin-astro" viewBox="0 0 16 16">
19
+ </svg>`,Fs=`<symbol id="file-tree-builtin-astro" viewBox="0 0 16 16">
20
20
  <path fill="currentColor" d="M6.08 13.92c-.63-.57-.81-1.79-.55-2.67.45.56 1.08.73 1.73.83 1 .15 1.99.1 2.92-.37l.32-.19q.13.38.08.78a2.1 2.1 0 0 1-.9 1.5q-.3.24-.61.43c-.64.44-.81.95-.57 1.69l.02.08a1.7 1.7 0 0 1-.74-.64 2 2 0 0 1-.3-.98q0-.27-.02-.52-.07-.61-.61-.62a.7.7 0 0 0-.75.6z" class="bg" opacity=".6"/>
21
21
  <path fill="currentColor" d="M2.5 11.1s1.86-.9 3.72-.9l1.4-4.39c.05-.21.2-.36.38-.36s.33.15.38.36l1.4 4.38c2.2 0 3.72.92 3.72.92l-3.16-8.69q-.13-.4-.45-.42H6.11q-.3.02-.45.42z" class="fg"/>
22
- </symbol>`,Ps=`<symbol id="file-tree-builtin-babel" viewBox="0 0 16 16">
22
+ </symbol>`,Is=`<symbol id="file-tree-builtin-babel" viewBox="0 0 16 16">
23
23
  <path fill="currentColor" fill-rule="evenodd" d="M9.49.5q1.92.05 2.66.54 1.27.6 1.35 1.52v.23a4 4 0 0 1-.53 1.9l-1.38 1.24q-.74.38-.72.63c.77.82 1.33 1.29.85 2.42q-.47 1.1-2.04 2.28c-.5.32-1.88 1.35-2.96 1.86-1.64.77-3.1 1.4-4.65 1.89-.51.16-1.5.16-1.5.16L.5 15A76 76 0 0 0 5.76 3.49q-.1-.08-.1-.2.1 0 .32-.35l-.03-.09q-1.17.39-2.38 1.3l-.13.03q0-.1-.21-.16-.46.31-.82.7l-.13-.19.16-.06-.03-.16-.34.29L2 4.5q.36-.48.72-.54l.04-.1V3.8q.16 0 .15-.06l.13-.06a6 6 0 0 0 1.13-.9v-.03H4.1l-.12.07q0-.1-.1-.1l-.15.07-.04-.1q.93-.52 1.63-1.05Q7.89.65 9.5.5M8.46 7.83l-.32.04c-1.31.54-2.31.82-2.91.88a71 71 0 0 0-2.2 4.54h.07q.58-.04 3.04-1.42.13 0 1.66-1.05L9.18 9.7v.03q.45-.2.81-1.3v-.2q-.5-.46-1.53-.4m.28-5.75c-.5.1-.75.19-.72.38l-1.16 2.6q-.17.1-.34.95-.3.48-.25.77v.1l.22.05A15 15 0 0 1 8.86 6c1.1-.71 2.12-1.38 2.8-2.54q.24-.33.21-.54-.02-.33-.4-.54c-.54 0-1.07-.34-1.63-.28l-.94-.03z" clip-rule="evenodd"/>
24
- </symbol>`,Fs=`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
24
+ </symbol>`,Ls=`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
25
25
  <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
26
26
  <path fill="currentColor" d="M11.5 11a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1zM7 6.75C7 6.42 6.64 6 6 6s-1 .42-1 .75q-.01.25.22.41.26.21.89.35.74.14 1.28.53c.37.29.61.7.61 1.21 0 .87-.68 1.5-1.5 1.7v.55a.5.5 0 0 1-1 0v-.56c-.82-.18-1.5-.82-1.5-1.69a.5.5 0 0 1 1 0c0 .33.36.75 1 .75s1-.42 1-.75q.01-.25-.22-.41a2 2 0 0 0-.89-.35q-.74-.14-1.28-.53A1.5 1.5 0 0 1 4 6.75c0-.87.68-1.5 1.5-1.7V4.5a.5.5 0 0 1 1 0v.56c.82.18 1.5.82 1.5 1.69a.5.5 0 0 1-1 0" class="fg-stroke"/>
27
- </symbol>`,Is=`<symbol id="file-tree-builtin-biome" viewBox="0 0 16 16">
27
+ </symbol>`,Rs=`<symbol id="file-tree-builtin-biome" viewBox="0 0 16 16">
28
28
  <path fill="currentColor" d="M8 2 4.88 7.35a7 7 0 0 1 3.7-.13l1.04.25-.99 4.16-1.05-.25a2.7 2.7 0 0 0-3.07 1.45l-.98-.47a4 4 0 0 1 1.07-1.31 3.8 3.8 0 0 1 3.23-.71l.5-2.08a6 6 0 0 0-5.07 1.12A5.9 5.9 0 0 0 1 14h14z"/>
29
- </symbol>`,Ls=`<symbol id="file-tree-builtin-bootstrap" viewBox="0 0 16 16">
29
+ </symbol>`,zs=`<symbol id="file-tree-builtin-bootstrap" viewBox="0 0 16 16">
30
30
  <path fill="currentColor" fill-rule="evenodd" d="M11.72 1.5A2.5 2.5 0 0 1 14.2 4q.02 1.08.3 2.09c.22.73.56 1.24 1.08 1.45.22.08.4.27.4.5s-.18.43-.4.51q-.76.34-1.08 1.45c-.2.65-.27 1.32-.3 2a2.5 2.5 0 0 1-2.48 2.5H4.25A2.6 2.6 0 0 1 1.7 12c-.04-.85-.1-1.68-.22-2.04C1.26 9.23.92 8.7.4 8.5.18 8.42 0 8.23 0 8s.18-.42.4-.5q.77-.35 1.09-1.46c.1-.36.17-1.19.2-2.04a2.6 2.6 0 0 1 2.56-2.5z" class="bg" clip-rule="evenodd" opacity=".2"/>
31
31
  <path fill="currentColor" fill-rule="evenodd" d="M8.47 4.54c1.23 0 2.04.68 2.04 1.73 0 .73-.55 1.39-1.24 1.5v.04c.94.1 1.58.77 1.58 1.7 0 1.2-.9 1.95-2.37 1.95H5.97a.3.3 0 0 1-.2-.08.3.3 0 0 1-.08-.2V4.82a.3.3 0 0 1 .08-.2.3.3 0 0 1 .2-.08zm-1.7 6.04h1.49q1.47-.01 1.49-1.15Q9.74 8.31 8.2 8.3H6.77zm0-5.16v2.06h1.21c.93 0 1.45-.38 1.45-1.06 0-.65-.44-1-1.22-1z" class="fg" clip-rule="evenodd"/>
32
- </symbol>`,Rs=`<symbol id="file-tree-builtin-browserslist" viewBox="0 0 16 16">
32
+ </symbol>`,Bs=`<symbol id="file-tree-builtin-browserslist" viewBox="0 0 16 16">
33
33
  <path fill="currentColor" d="M8.88 6.96c0 3.82 3.72 4.7 5.7 3.74-.23.9-1.04 1.67-2.35 1.93-.02.4.42 1.28.82 1.63-.9.35-1.94-.12-2.51-.48a5 5 0 0 0-.32 1.87c-.68 0-1.57-1-1.8-1.37-.3.18-.85 1.15-.96 1.72a2.4 2.4 0 0 1-.81-.86 2.4 2.4 0 0 1-.3-1.15c-.38.27-1.48.95-1.99 1.18-.25-.58-.15-1.3 0-2.06-.21.12-1.8.27-2.43.12.32-.36.75-1.19.94-1.57A4.5 4.5 0 0 1 .44 10.6c.48-.22.97-.53 1.49-1.06C1.26 9.17.24 8.64 0 7.7a6 6 0 0 0 1.79-.32C1.28 7.08.44 6.15.6 5.01c.42.21 1.3.37 1.73.3a3.4 3.4 0 0 1-.25-2.75 5 5 0 0 0 1.48 1c-.08-.8.3-2.31.8-2.71.2.46.73 1.21 1.08 1.4.09-.61.87-2.06 1.57-2.25 0 .5.27 1.4.5 1.67.51-.54 2.25-1.44 3.64-1.13-.43.45-.75.61-.86.98 1.05 0 2.78.34 4.27 1.93-2.34-.89-5.69.56-5.69 3.5" class="bg" opacity=".5"/>
34
34
  <path fill="currentColor" d="M11.21 3.59a4.1 4.1 0 0 0 2.47 2.89c.24-.22.61-.38.95-.19.76.44.2 1.26-.34 1.66l-.07.06a13 13 0 0 1-4.49 1.61l-.3-.43a10.5 10.5 0 0 0 4.13-1.31 1 1 0 0 0 .23-.25.5.5 0 0 0-.21-.69l-.15-.06a4.5 4.5 0 0 1-1.77-1.31 4.5 4.5 0 0 1-.88-1.77q.2-.12.43-.21"/>
35
35
  <path fill="currentColor" d="M10.36 5.18a.4.4 0 0 0-.03.38c.09.2.3.3.46.23s.24-.3.15-.5l-.01-.02q.23.13.34.39a.83.83 0 0 1-.43 1.08.8.8 0 0 1-1.08-.43.83.83 0 0 1 .6-1.13"/>
36
- </symbol>`,zs=`<symbol id="file-tree-builtin-bun" viewBox="0 0 16 16">
36
+ </symbol>`,Vs=`<symbol id="file-tree-builtin-bun" viewBox="0 0 16 16">
37
37
  <path fill="currentColor" d="M8 14c3.87 0 7-2.46 7-5.49 0-1.88-1.2-3.53-3.04-4.52q-1.1-.61-1.84-1.07C9.2 2.35 8.64 2 8 2s-1.36.45-2.31 1.03A29 29 0 0 1 4.04 4C2.2 4.98 1 6.63 1 8.51 1 11.54 4.13 14 8 14M7.18 3.88q.3-.66.3-1.37c0-.08.11-.1.13-.01.38 1.57-.53 2.35-1.2 2.61-.08.03-.12-.07-.06-.12a3 3 0 0 0 .83-1.12m1.2-.05a3 3 0 0 0-.45-1.3V2.5c-.04-.07.05-.15.1-.1 1.15 1.2.77 2.3.33 2.87-.05.05-.13 0-.11-.08q.21-.67.13-1.37m1.04-.32a3 3 0 0 0-.94-1.02v-.01c-.06-.05-.01-.16.07-.12 1.51.61 1.61 1.8 1.43 2.5l-.03.03a.07.07 0 0 1-.1-.06 3 3 0 0 0-.43-1.32m-2.97.32c-.36.3-.74.43-1.2.56q-.11 0-.1-.1a3.5 3.5 0 0 0 1.76-1.57s.09-.07.1.04c0 .18-.2.76-.56 1.07m2.89 6.36q-.13.52-.55.88a1.3 1.3 0 0 1-.75.35 1.3 1.3 0 0 1-.77-.35 1.7 1.7 0 0 1-.54-.88.13.13 0 0 1 .15-.15h2.31a.14.14 0 0 1 .15.15M6.15 8.95a1.1 1.1 0 0 1-1.39-.14A1.1 1.1 0 0 1 5.12 7a1.1 1.1 0 0 1 1.2.25 1.1 1.1 0 0 1-.17 1.69m4.96 0a1.1 1.1 0 0 1-1.4-.14 1.1 1.1 0 0 1 .37-1.8 1.1 1.1 0 0 1 1.2.25 1.1 1.1 0 0 1 .24 1.2 1 1 0 0 1-.41.5"/>
38
- </symbol>`,Bs=`<symbol id="file-tree-builtin-c" viewBox="0 0 16 16">
38
+ </symbol>`,Hs=`<symbol id="file-tree-builtin-c" viewBox="0 0 16 16">
39
39
  <path fill="currentColor" fill-rule="evenodd" d="M8 1q.084 0 .166.021.098.023.186.075c1.055.624 4.22 2.486 5.277 3.11.085.05.15.112.209.192h-.002l.028.037a.5.5 0 0 1 .103.21q.031.102.033.21v6.29a.71.71 0 0 1-.347.616l-5.307 3.144a.68.68 0 0 1-.693 0l-5.307-3.144A.72.72 0 0 1 2 11.145V4.832a.71.71 0 0 1 .346-.612l5.288-3.126A.7.7 0 0 1 7.992 1zm2.901 4.349a3.75 3.75 0 1 0 0 5.302l-1.06-1.06a2.25 2.25 0 1 1 0-3.182z" clip-rule="evenodd"/>
40
- </symbol>`,Vs=`<symbol id="file-tree-builtin-claude" viewBox="0 0 16 16">
40
+ </symbol>`,Us=`<symbol id="file-tree-builtin-claude" viewBox="0 0 16 16">
41
41
  <path fill="currentColor" d="M3.75 10.31 6.5 8.77l.04-.14-.04-.07h-.14l-.46-.03-1.57-.04-1.38-.07-1.33-.07-.34-.07L1 7.86l.03-.21.28-.18.4.03.89.07 1.33.08.97.06 1.43.16h.22l.03-.1-.07-.05-.06-.06-1.39-.92-1.48-.98-.79-.57-.42-.28-.2-.28-.1-.6.39-.41.52.04.12.03.52.4 1.12.86L6.2 6.04l.2.17.09-.06.01-.04-.1-.15-.76-1.46-.85-1.46-.37-.6-.1-.36a1 1 0 0 1-.06-.42l.42-.59.25-.07.6.08.22.2.36.84.58 1.3.9 1.77.29.53.14.47.04.14h.1v-.07l.07-1 .14-1.22.14-1.57.04-.45.23-.53.42-.28.36.15.28.41-.04.25-.16 1.08-.36 1.7-.21 1.14h.12l.14-.15.58-.76.97-1.2.42-.5.5-.51.32-.25h.6l.44.66-.2.68-.61.79-.52.65-.74 1-.45.8.04.05h.1l1.68-.36.9-.16 1.06-.18.5.23.05.22-.2.48-1.15.28-1.34.28-2 .46-.04.01.03.04.9.09.4.03h.94l1.77.14.46.28.27.37-.04.28-.72.37-.95-.23-2.24-.53-.76-.18h-.11v.06l.64.63L12 10.86l1.48 1.35.07.34-.18.28-.2-.03-1.29-.98-.5-.42-1.12-.95h-.07v.1l.25.38 1.37 2.05.07.63-.1.2-.36.14-.38-.08-.8-1.12-.85-1.26-.66-1.15-.07.05-.4 4.23-.19.21-.42.17-.35-.28-.2-.42.2-.87.23-1.12.18-.9.17-1.1.1-.36v-.03h-.1l-.84 1.16-1.27 1.72-1 1.07-.24.1-.42-.22.04-.39.22-.32 1.4-1.8.84-1.1.57-.64-.02-.07h-.04l-3.7 2.4-.66.09-.28-.28.03-.42.14-.14 1.12-.77z"/>
42
- </symbol>`,Hs=`<symbol id="file-tree-builtin-cpp" viewBox="0 0 16 16">
42
+ </symbol>`,Ws=`<symbol id="file-tree-builtin-cpp" viewBox="0 0 16 16">
43
43
  <path fill="currentColor" fill-rule="evenodd" d="M8 1q.084 0 .166.021.098.023.186.075c1.055.624 4.22 2.486 5.277 3.11.085.05.15.112.209.192h-.002l.028.037a.5.5 0 0 1 .103.21q.031.102.033.21v6.29a.71.71 0 0 1-.347.616l-5.307 3.144a.68.68 0 0 1-.693 0l-5.307-3.144A.72.72 0 0 1 2 11.145V4.832a.71.71 0 0 1 .346-.612l5.288-3.126A.7.7 0 0 1 7.992 1zm2.901 4.349a3.75 3.75 0 1 0 0 5.302l-1.06-1.06a2.25 2.25 0 1 1 0-3.182z" clip-rule="evenodd"/>
44
- </symbol>`,Us=`<symbol id="file-tree-builtin-css" viewBox="0 0 16 16">
44
+ </symbol>`,Gs=`<symbol id="file-tree-builtin-css" viewBox="0 0 16 16">
45
45
  <path fill="currentColor" d="M8 15c-5.76 0-7-1.24-7-7V2a1 1 0 0 1 1-1h6c5.77 0 7 1.24 7 7s-1.24 7-7 7" class="vector" opacity=".2"/>
46
46
  <path fill="currentColor" d="M10.1 9.19h.73c.03.49.22.6 1 .6.76 0 .93-.12.93-.68 0-.52-.17-.67-.94-.85-1.38-.3-1.68-.56-1.68-1.47 0-1.05.3-1.29 1.67-1.29 1.29 0 1.57.2 1.6 1.13h-.74c-.01-.34-.17-.42-.85-.42-.77 0-.94.1-.94.58 0 .42.17.55.96.73 1.36.3 1.66.58 1.66 1.59 0 1.14-.31 1.39-1.73 1.39-1.39 0-1.69-.24-1.67-1.31m-3.9 0h.74c.03.49.21.6.99.6.76 0 .93-.12.93-.68 0-.52-.17-.67-.93-.85-1.39-.3-1.69-.56-1.69-1.47 0-1.05.3-1.29 1.67-1.29 1.3 0 1.58.2 1.6 1.13h-.73c-.02-.34-.18-.42-.85-.42-.78 0-.95.1-.95.58 0 .42.17.55.96.73 1.37.3 1.67.58 1.67 1.59 0 1.14-.32 1.39-1.74 1.39-1.38 0-1.68-.24-1.66-1.31m-1.22 0h.75c-.09 1.07-.37 1.31-1.56 1.31-1.37 0-1.68-.45-1.68-2.5 0-1.96.36-2.5 1.68-2.5 1.16 0 1.44.25 1.52 1.35h-.76c-.08-.52-.22-.64-.76-.64-.74 0-.9.33-.9 1.78 0 1.47.16 1.8.9 1.8.58 0 .74-.11.8-.6"/>
47
- </symbol>`,Ws=`<symbol id="file-tree-builtin-database" viewBox="0 0 16 16">
47
+ </symbol>`,Ks=`<symbol id="file-tree-builtin-database" viewBox="0 0 16 16">
48
48
  <path fill="currentColor" d="M14.953 9.733a12.4 12.4 0 0 1-.244 1.936c-.207.933-.532 1.58-.996 2.044s-1.11.789-2.044.996C10.73 14.918 9.533 15 8 15s-2.73-.082-3.669-.291c-.933-.207-1.58-.532-2.044-.996s-.789-1.11-.996-2.044c-.122-.547-.2-1.182-.244-1.92q.23.364.532.667c.64.639 1.482 1.031 2.533 1.265 1.046.232 2.33.315 3.884.315 1.555 0 2.838-.083 3.884-.315 1.051-.234 1.893-.626 2.532-1.265a4 4 0 0 0 .541-.683"/>
49
49
  <path fill="currentColor" d="M14.93 5.924c-.046.663-.118 1.24-.23 1.743-.207.932-.532 1.579-.995 2.042s-1.11.789-2.042.996c-.938.209-2.135.291-3.667.291-1.531 0-2.729-.082-3.667-.29-.932-.208-1.579-.534-2.042-.997s-.789-1.11-.996-2.042a12 12 0 0 1-.227-1.683l.016-.188a4 4 0 0 0 .5.62c.638.639 1.48 1.031 2.532 1.265 1.046.232 2.33.315 3.884.315 1.555 0 2.838-.083 3.884-.315 1.051-.234 1.893-.626 2.532-1.265.192-.192.357-.404.506-.633z"/>
50
50
  <path fill="currentColor" d="M8 1c1.533 0 2.73.082 3.669.291.933.207 1.58.533 2.044.996.403.404.904.944.91 1.695.004.764-.509 1.318-.918 1.727-.463.463-1.11.789-2.042.996-.938.209-2.135.291-3.667.291-1.531 0-2.729-.082-3.667-.29-.932-.208-1.579-.534-2.042-.997-.406-.406-.915-.953-.915-1.71 0-.758.509-1.305.915-1.712.464-.463 1.11-.789 2.044-.996C5.27 1.082 6.467 1 8 1"/>
51
- </symbol>`,Gs=`<symbol id="file-tree-builtin-default" viewBox="0 0 16 16">
51
+ </symbol>`,qs=`<symbol id="file-tree-builtin-default" viewBox="0 0 16 16">
52
52
  <path fill="currentColor" d="M8 1v3a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1z" class="bg" opacity=".4"/>
53
53
  <path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
54
- </symbol>`,Ks=`<symbol id="file-tree-builtin-docker" viewBox="0 0 16 16">
54
+ </symbol>`,Js=`<symbol id="file-tree-builtin-docker" viewBox="0 0 16 16">
55
55
  <path fill="currentColor" d="M15.85 6.54c-.05-.04-.45-.36-1.31-.36q-.34 0-.68.06a2.7 2.7 0 0 0-1.14-1.79l-.23-.14-.15.23a3 3 0 0 0-.4 1q-.24 1.01.26 1.84c-.4.24-1.03.3-1.17.3H.5a.5.5 0 0 0-.5.52q-.01 1.46.46 2.83.55 1.5 1.6 2.18c.79.5 2.08.79 3.54.79q.96 0 1.94-.18a8 8 0 0 0 2.55-.97 7 7 0 0 0 1.73-1.5 10 10 0 0 0 1.7-3.06h.15a2.4 2.4 0 0 0 1.8-.7 2 2 0 0 0 .47-.74l.06-.2z"/>
56
56
  <path fill="currentColor" d="M1.48 7.36h1.4a.14.14 0 0 0 .14-.13V5.91q-.01-.12-.13-.14H1.48a.13.13 0 0 0-.13.14v1.32q.02.13.13.13m1.94 0h1.41a.14.14 0 0 0 .13-.13V5.91q-.01-.12-.13-.14h-1.4a.13.13 0 0 0-.13.14v1.32q0 .13.12.13m1.98 0h1.4q.13 0 .14-.13V5.91a.13.13 0 0 0-.14-.14H5.4q-.1.01-.12.14v1.32q0 .13.12.13m1.95 0h1.42q.1 0 .12-.13V5.91q0-.12-.12-.14H7.35q-.1.01-.12.14v1.32q.01.13.12.13M3.42 5.5h1.41c.07 0 .13-.08.13-.15V4.03a.13.13 0 0 0-.13-.14h-1.4q-.12 0-.13.14v1.31q0 .13.12.15m1.98 0h1.4c.08 0 .14-.08.14-.15V4.03q0-.13-.14-.14H5.4q-.1 0-.12.14v1.31q0 .13.12.15m1.95 0h1.42c.06 0 .12-.08.12-.15V4.03q-.01-.13-.12-.14H7.35q-.1 0-.12.14v1.31q.01.13.12.15m0-1.9h1.42q.1-.02.12-.14v-1.3Q8.88 2 8.77 2H7.35q-.1 0-.12.14v1.3q.01.13.12.14m1.97 3.78h1.4a.13.13 0 0 0 .14-.13V5.91q-.01-.12-.13-.14H9.32q-.1.01-.12.14v1.32q.01.13.12.13" opacity=".5"/>
57
- </symbol>`,qs=`<symbol id="file-tree-builtin-eslint" viewBox="0 0 16 16">
57
+ </symbol>`,Ys=`<symbol id="file-tree-builtin-eslint" viewBox="0 0 16 16">
58
58
  <path fill="currentColor" d="M11.16 6.1 8.12 4.35a.3.3 0 0 0-.24 0L4.84 6.1a.3.3 0 0 0-.12.2v3.5q0 .14.12.22l3.04 1.74q.12.08.24 0l3.04-1.74a.2.2 0 0 0 .13-.22V6.3a.3.3 0 0 0-.13-.2" opacity=".5"/>
59
59
  <path fill="currentColor" d="m.1 7.69 3.63-6.3A.8.8 0 0 1 4.37 1h7.26c.26 0 .5.17.64.4l3.63 6.27a.8.8 0 0 1 0 .75l-3.63 6.24a.7.7 0 0 1-.64.34H4.37a.7.7 0 0 1-.64-.34L.1 8.41a.7.7 0 0 1 0-.72m3 3.02q.01.15.14.23l4.63 2.66q.13.06.26 0l4.63-2.66a.3.3 0 0 0 .14-.23V5.4a.3.3 0 0 0-.14-.23L8.13 2.52a.3.3 0 0 0-.26 0L3.24 5.17a.3.3 0 0 0-.14.23z"/>
60
- </symbol>`,Js=`<symbol id="file-tree-builtin-font" viewBox="0 0 16 16">
60
+ </symbol>`,Xs=`<symbol id="file-tree-builtin-font" viewBox="0 0 16 16">
61
61
  <path fill="currentColor" d="M12.3 13c-1.59 0-2.68-.99-2.68-2.5 0-1.43 1-2.34 2.88-2.35h2.16v-.83c0-1.08-.62-1.68-1.73-1.68-1.05 0-1.66.54-1.73 1.36H9.93c.09-1.43 1.06-2.48 3.05-2.48 1.75 0 3.02.95 3.02 2.68v5.66h-1.29v-1.02h-.04c-.41.66-1.16 1.16-2.37 1.16m.36-1.12c1.14 0 2-.72 2-1.74v-.96H12.6c-1.12 0-1.6.54-1.6 1.28 0 .97.8 1.42 1.66 1.42m-11.24.98H0L3.8 2h1.39l3.8 10.86H7.54l-1.08-3.2H2.5zm3.09-9.25h-.04l-1.6 4.95H6.1z"/>
62
- </symbol>`,Ys=`<symbol id="file-tree-builtin-git" viewBox="0 0 16 16">
62
+ </symbol>`,Zs=`<symbol id="file-tree-builtin-git" viewBox="0 0 16 16">
63
63
  <path fill="currentColor" d="M14.74 7.38 8.62 1.26a.9.9 0 0 0-1.27 0L6.08 2.53l1.61 1.61a1.07 1.07 0 0 1 1.36 1.37l1.55 1.55a1.07 1.07 0 0 1 1.1 1.77 1.07 1.07 0 0 1-1.74-1.16L8.5 6.22v3.8a1.07 1.07 0 1 1-.89-.02V6.15a1.07 1.07 0 0 1-.58-1.4l-1.58-1.6-4.2 4.2a.9.9 0 0 0 0 1.27l6.12 6.12a.9.9 0 0 0 1.27 0l6.09-6.09a.9.9 0 0 0 0-1.27"/>
64
- </symbol>`,Xs=`<symbol id="file-tree-builtin-go" viewBox="0 0 16 16">
64
+ </symbol>`,Qs=`<symbol id="file-tree-builtin-go" viewBox="0 0 16 16">
65
65
  <path fill="currentColor" fill-rule="evenodd" d="M4.41 4.57A3.2 3.2 0 0 1 6.87 5q.74.49 1.08 1.29.08.12-.1.16l-1.55.4c-.14.03-.15.04-.27-.1a1 1 0 0 0-.44-.34 1.6 1.6 0 0 0-1.68.14q-.95.61-.94 1.73c0 .73.52 1.33 1.25 1.43q.95.1 1.58-.6l.25-.34h-1.8c-.19 0-.24-.12-.17-.27.12-.28.34-.76.47-1a.3.3 0 0 1 .24-.14h2.98a4 4 0 0 1 .64-1.19 4 4 0 0 1 2.6-1.52 3.5 3.5 0 0 1 2.64.46q1.13.73 1.31 2.04a3.5 3.5 0 0 1-1.06 3.09q-.93.92-2.23 1.17l-.74.08a3.5 3.5 0 0 1-2.27-.8 3 3 0 0 1-.93-1.42 4 4 0 0 1-.39.61 4 4 0 0 1-2.64 1.56 3.3 3.3 0 0 1-2.5-.6 3 3 0 0 1-1.18-2.03 3.5 3.5 0 0 1 .8-2.67 4 4 0 0 1 2.6-1.58M13.1 7.5a1.53 1.53 0 0 0-1.9-1.21q-1.3.3-1.62 1.59a1.5 1.5 0 0 0 .85 1.72q.77.33 1.52-.05a2 2 0 0 0 1.18-1.74q0-.17-.03-.3" clip-rule="evenodd"/>
66
- </symbol>`,Zs=`<symbol id="file-tree-builtin-graphql" viewBox="0 0 16 16">
66
+ </symbol>`,$s=`<symbol id="file-tree-builtin-graphql" viewBox="0 0 16 16">
67
67
  <path fill="currentColor" fill-rule="evenodd" d="M8 1a1.25 1.25 0 0 1 1.18 1.65l2.8 1.61q.33-.25.77-.26a1.25 1.25 0 0 1 .48 2.4v3.2a1.25 1.25 0 1 1-1.25 2.13l-2.8 1.62A1.25 1.25 0 0 1 8 15a1.25 1.25 0 0 1-1.18-1.65l-2.8-1.62q-.33.26-.77.27a1.25 1.25 0 0 1-.48-2.4V6.4a1.25 1.25 0 1 1 1.25-2.14l2.8-1.61A1.25 1.25 0 0 1 8 1M4.44 11.14l-.06.13 2.75 1.58a1.25 1.25 0 0 1 1.74 0l2.74-1.58-.05-.13zm3.89-7.68a1.3 1.3 0 0 1-.66 0L4.03 9.77q.37.3.45.78h7.04q.08-.48.45-.78zM4.38 4.73a1.24 1.24 0 0 1-1.02 1.76v3.02l.13.01 3.67-6.35-.03-.02zm4.46-1.56 3.67 6.35.13-.01V6.49a1.25 1.25 0 0 1-1.03-1.76L8.87 3.15z" clip-rule="evenodd"/>
68
- </symbol>`,Qs=`<symbol id="file-tree-builtin-html" viewBox="0 0 16 16">
68
+ </symbol>`,ec=`<symbol id="file-tree-builtin-html" viewBox="0 0 16 16">
69
69
  <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
70
70
  <path fill="currentColor" d="M10.48 3.76a.5.5 0 0 1 .4.58L10.6 5.8h1.14a.5.5 0 0 1 0 1h-1.32L10 9.2h1.08a.5.5 0 0 1 0 1H9.8l-.3 1.64a.5.5 0 1 1-.98-.18l.27-1.46H6.4l-.3 1.64a.5.5 0 1 1-.98-.18l.27-1.46H4.25a.5.5 0 0 1 0-1h1.32L6 6.8H4.93a.5.5 0 0 1 0-1H6.2l.3-1.64a.5.5 0 1 1 .98.18L7.2 5.8h2.4l.3-1.64a.5.5 0 0 1 .58-.4M6.58 9.2h2.4l.44-2.4h-2.4z" class="fg"/>
71
- </symbol>`,$s=`<symbol id="file-tree-builtin-image" viewBox="0 0 16 16">
71
+ </symbol>`,tc=`<symbol id="file-tree-builtin-image" viewBox="0 0 16 16">
72
72
  <path fill="currentColor" d="M12.5 2A2.5 2.5 0 0 1 15 4.5v4.67l-4.05-3.54-4.08 4.08-3-2L1 10.6V4.5A2.5 2.5 0 0 1 3.5 2z" opacity=".3"/>
73
73
  <path fill="currentColor" d="M15 10.5v1a2.5 2.5 0 0 1-2.5 2.5h-9a2.5 2.5 0 0 1-2.46-2.04L4 9l3 2 4-4zm-7-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0"/>
74
- </symbol>`,ec=`<symbol id="file-tree-builtin-javascript" viewBox="0 0 16 16">
74
+ </symbol>`,nc=`<symbol id="file-tree-builtin-javascript" viewBox="0 0 16 16">
75
75
  <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
76
76
  <path fill="currentColor" d="M8.1 9.64h.95c.04.62.28.76 1.28.76s1.2-.14 1.2-.85c0-.66-.2-.85-1.2-1.07-1.79-.38-2.18-.7-2.18-1.86C8.15 5.3 8.54 5 10.31 5c1.67 0 2.04.26 2.07 1.42h-.95c-.02-.43-.23-.53-1.1-.53-1 0-1.22.14-1.22.74 0 .52.22.7 1.24.92 1.76.38 2.15.73 2.15 2 0 1.44-.4 1.75-2.24 1.75-1.8 0-2.18-.3-2.15-1.66M3.5 9.5h.98c0 .76.15.92.85.92.77 0 .94-.18.94-1.02V5.1h1v4.34c0 1.54-.35 1.87-1.92 1.87-1.55 0-1.89-.32-1.86-1.8"/>
77
- </symbol>`,tc=`<symbol id="file-tree-builtin-json" viewBox="0 0 16 16">
77
+ </symbol>`,rc=`<symbol id="file-tree-builtin-json" viewBox="0 0 16 16">
78
78
  <path fill="currentColor" d="M13.25 11.5V9.75a.5.5 0 0 1 .36-.48l.55-.15a1.16 1.16 0 0 0 0-2.24l-.55-.15a.5.5 0 0 1-.36-.48V4.5a2.5 2.5 0 0 0-2.5-2.5h-.25a.5.5 0 0 0 0 1h.25a1.5 1.5 0 0 1 1.5 1.5v1.75a1.5 1.5 0 0 0 1.09 1.44l.54.15a.16.16 0 0 1 0 .32l-.54.15a1.5 1.5 0 0 0-1.09 1.44v1.75a1.5 1.5 0 0 1-1.5 1.5h-.25a.5.5 0 0 0 0 1h.25a2.5 2.5 0 0 0 2.5-2.5m-10.5 0V9.75a.5.5 0 0 0-.36-.48l-.55-.15a1.16 1.16 0 0 1 0-2.24l.55-.15a.5.5 0 0 0 .36-.48V4.5A2.5 2.5 0 0 1 5.25 2h.25a.5.5 0 0 1 0 1h-.25a1.5 1.5 0 0 0-1.5 1.5v1.75a1.5 1.5 0 0 1-1.09 1.44l-.54.15a.16.16 0 0 0 0 .32l.54.15a1.5 1.5 0 0 1 1.09 1.45v1.74a1.5 1.5 0 0 0 1.5 1.5h.25a.5.5 0 0 1 0 1h-.25a2.5 2.5 0 0 1-2.5-2.5"/>
79
- </symbol>`,nc=`<symbol id="file-tree-builtin-markdown" viewBox="0 0 16 16">
79
+ </symbol>`,ic=`<symbol id="file-tree-builtin-markdown" viewBox="0 0 16 16">
80
80
  <path fill="currentColor" d="M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z"/>
81
- </symbol>`,rc=`<symbol id="file-tree-builtin-mcp" viewBox="0 0 16 16">
81
+ </symbol>`,ac=`<symbol id="file-tree-builtin-mcp" viewBox="0 0 16 16">
82
82
  <path fill="currentColor" d="M9.26-.04a3 3 0 0 1 2 .82 2.8 2.8 0 0 1 .8 2.35 2.9 2.9 0 0 1 2.41.8l.03.02a2.74 2.74 0 0 1 0 3.94l-5.8 5.69-.04.06-.02.07q0 .04.02.07.01.04.04.06l1.2 1.17a.55.55 0 0 1 0 .79.6.6 0 0 1-.81 0l-1.2-1.17a1.3 1.3 0 0 1 0-1.84L13.7 7.1a1.65 1.65 0 0 0 .37-1.82 2 2 0 0 0-.37-.54l-.03-.03a1.73 1.73 0 0 0-2.4 0L6.47 9.4l-.07.06a.58.58 0 0 1-.92-.18.6.6 0 0 1 .12-.6l4.85-4.76a1.65 1.65 0 0 0 0-2.36 1.73 1.73 0 0 0-2.4 0l-6.43 6.3a.6.6 0 0 1-.8 0 .55.55 0 0 1 0-.8L7.25.79a3 3 0 0 1 2-.82"/>
83
83
  <path fill="currentColor" d="M9.26 2.19a.6.6 0 0 1 .52.34.6.6 0 0 1 0 .43l-.12.18L4.9 7.79a1.65 1.65 0 0 0 0 2.36 1.73 1.73 0 0 0 2.4 0l4.75-4.66a.58.58 0 0 1 .93.18.6.6 0 0 1-.12.61l-4.75 4.66a2.9 2.9 0 0 1-4.01 0 2.75 2.75 0 0 1-.62-3.04A3 3 0 0 1 4.1 7l4.74-4.65a.6.6 0 0 1 .4-.16"/>
84
- </symbol>`,ic=`<symbol id="file-tree-builtin-nextjs" viewBox="0 0 16 16">
84
+ </symbol>`,oc=`<symbol id="file-tree-builtin-nextjs" viewBox="0 0 16 16">
85
85
  <defs>
86
86
  <linearGradient id="a" x1="4.522" x2="14" y1="3.943" y2="16" gradientUnits="userSpaceOnUse">
87
87
  <stop stop-color="currentColor"/>
@@ -91,82 +91,82 @@ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$ as t,$c as n,$i as r
91
91
  <path fill="currentColor" d="M3 2h1.522v9.09H3z"/>
92
92
  <path fill="url(#a)" d="M4.903 2 15 15.075q-.565.5-1.195.925L4.522 3.943z"/>
93
93
  <path fill="currentColor" d="M12.172 2h-1.508v9.094h1.508z"/>
94
- </symbol>`,ac=`<symbol id="file-tree-builtin-npm" viewBox="0 0 16 16">
94
+ </symbol>`,sc=`<symbol id="file-tree-builtin-npm" viewBox="0 0 16 16">
95
95
  <path fill="currentColor" d="M2 1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1z" class="vector" opacity=".2"/>
96
96
  <path fill="currentColor" d="M10.5 13H13V3H3v10h5V5.5h2.5z"/>
97
- </symbol>`,oc=`<symbol id="file-tree-builtin-oxc" viewBox="0 0 16 16">
97
+ </symbol>`,cc=`<symbol id="file-tree-builtin-oxc" viewBox="0 0 16 16">
98
98
  <path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .5.5V3h3.5a.5.5 0 0 1 .38.83L10.5 7.69v1.44q.41.04.95-.16a4 4 0 0 0 .72-.35l.04-.03h.01a.5.5 0 0 1 .67.1l2 2.5a.5.5 0 0 1 0 .62c-.76.96-3.14 2.69-6.89 2.69s-6.13-1.73-6.89-2.69a.5.5 0 0 1 0-.62l2-2.5a.5.5 0 0 1 .67-.1l.05.03.16.09q.22.13.56.26.54.2.95.16V7.69L2.12 3.83A.5.5 0 0 1 2.5 3H6V1.5a.5.5 0 0 1 .5-.5zM7 3.5a.5.5 0 0 1-.5.5H3.6l2.78 3.17a.5.5 0 0 1 .12.33v2a.5.5 0 0 1-.28.45c-.7.35-1.5.15-2.02-.05a5 5 0 0 1-.58-.26l-1.46 1.84c.82.78 2.8 2.02 5.84 2.02s5.02-1.24 5.84-2.02l-1.46-1.83a5 5 0 0 1-.58.26c-.52.2-1.33.39-2.02.04a.5.5 0 0 1-.28-.45v-2a.5.5 0 0 1 .12-.33L12.4 4H9.5a.5.5 0 0 1-.5-.5V2H7z"/>
99
- </symbol>`,sc=`<symbol id="file-tree-builtin-postcss" viewBox="0 0 16 16">
99
+ </symbol>`,lc=`<symbol id="file-tree-builtin-postcss" viewBox="0 0 16 16">
100
100
  <path fill="currentColor" d="M14.5 8a6.5 6.5 0 0 0-5.9-6.47l5.42 8.93A7 7 0 0 0 14.5 8M2.88 12A6.5 6.5 0 0 0 8 14.5c2.08 0 3.93-.98 5.12-2.5zm8.62-1h1.68L11.5 8.24zm-1-.55a4 4 0 0 1-.7.55h.7zM8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5M5.5 11h.7a4 4 0 0 1-.7-.55zm-2.68 0H4.5V8.24zm3.76-6.2A4 4 0 0 1 8 4.5q.76 0 1.42.3L8 2.46zM1.5 8q0 1.31.48 2.46L7.4 1.53A6.5 6.5 0 0 0 1.5 8m14 0a7.5 7.5 0 0 1-.99 3.72l-.01.03-.02.03A7.5 7.5 0 0 1 8 15.5a7.5 7.5 0 0 1-6.5-3.75l-.01-.03A7.5 7.5 0 1 1 15.5 8"/>
101
- </symbol>`,cc=`<symbol id="file-tree-builtin-prettier" viewBox="0 0 16 16">
101
+ </symbol>`,uc=`<symbol id="file-tree-builtin-prettier" viewBox="0 0 16 16">
102
102
  <path fill="currentColor" d="M6 12v1H4.93v-1zm1-2v1H2v-1zm6-4v1h-3V6zm-1-4v1H9V2z"/>
103
103
  <path fill="currentColor" d="M11.5 10v1H8v-1zM5 6v1H2V6zm5-2v1H9V4z" opacity=".8"/>
104
104
  <path fill="currentColor" d="M6 14v1H2v-1zm-.5-6v1H2V8zM13 4v1h-3V4zM4.93 2v1H2V2z" opacity=".6"/>
105
105
  <path fill="currentColor" d="M4.93 12v1H2v-1zM13 8v1H9V8zM5.5 4v1H2V4zM9 2v1H4.93V2z" opacity=".4"/>
106
- </symbol>`,lc=`<symbol id="file-tree-builtin-python" viewBox="0 0 16 16">
106
+ </symbol>`,dc=`<symbol id="file-tree-builtin-python" viewBox="0 0 16 16">
107
107
  <path fill="currentColor" d="M8.33 8.4H10c1.16 0 1.9-.73 1.9-1.86V5.08q0-.24.25-.24h.74c.75 0 1.33.32 1.66.97q.4.73.41 1.46c.09.9.09 1.78-.24 2.67-.25.73-.75 1.3-1.58 1.46h-4.8c-.08 0-.25 0-.25.08v.4s.17.09.25.09h2.82q.34-.02.33.32v1.06c0 .56-.25.97-.75 1.13-.41.16-.83.33-1.24.4a7 7 0 0 1-2.98-.07 3 3 0 0 1-1.16-.49c-.33-.32-.58-.65-.5-1.14v-2.91c0-1.13.67-1.78 1.82-1.78q.89-.1 1.66-.08m2.32 4.86a.65.65 0 0 0-.66-.65c-.34 0-.67.33-.67.65s.33.57.67.65a.65.65 0 0 0 .66-.65" class="bg" opacity=".8"/>
108
108
  <path fill="currentColor" d="M7.67 7.6H6c-1.16 0-1.9.73-1.9 1.86v1.46q0 .24-.25.24h-.74c-.75 0-1.33-.32-1.66-.97a3 3 0 0 1-.41-1.46 6 6 0 0 1 .24-2.67c.25-.73.75-1.3 1.58-1.46h4.8c.08 0 .25 0 .25-.08v-.4s-.17-.09-.25-.09H4.85c-.24 0-.33-.08-.33-.32V2.65c0-.56.25-.97.75-1.13.41-.16.83-.33 1.24-.4a7 7 0 0 1 2.98.07c.41.09.83.25 1.16.49.33.32.58.65.5 1.13v2.92c0 1.14-.67 1.78-1.82 1.78-.58.08-1.16.08-1.66.08M5.35 2.73c0 .33.25.65.66.65.33 0 .66-.32.66-.65 0-.32-.33-.56-.66-.64a.65.65 0 0 0-.66.64" class="fg"/>
109
- </symbol>`,uc=`<symbol id="file-tree-builtin-react" viewBox="0 0 16 16">
109
+ </symbol>`,fc=`<symbol id="file-tree-builtin-react" viewBox="0 0 16 16">
110
110
  <path fill="currentColor" d="M8 6.65c.73 0 1.31.6 1.31 1.35S8.73 9.35 8 9.35 6.69 8.75 6.69 8 7.27 6.65 8 6.65"/>
111
111
  <path fill="currentColor" fill-rule="evenodd" d="M8 2.55c1.3-.99 2.59-1.34 3.5-.8.92.55 1.27 1.87 1.08 3.53C14.06 5.94 15 6.9 15 8s-.94 2.06-2.42 2.72c.19 1.65-.16 2.98-1.08 3.52-.91.55-2.2.2-3.5-.8-1.3 1-2.58 1.35-3.5.8-.91-.54-1.27-1.87-1.08-3.52C1.94 10.06 1 9.1 1 8s.94-2.06 2.42-2.72c-.19-1.66.17-2.98 1.08-3.52s2.2-.2 3.5.8M4.26 11.2c-.08 1.34.28 2.03.68 2.26s1.15.22 2.25-.52l.11-.09a12 12 0 0 1-1.24-1.39 11 11 0 0 1-1.8-.41zm7.47-.15q-.83.27-1.79.41-.6.8-1.24 1.4l.11.08c1.1.74 1.86.76 2.25.52.4-.23.76-.92.68-2.26zm-3.04.54a14 14 0 0 1-1.38 0q.34.38.69.7.35-.32.7-.7M8 5.29q-.76 0-1.47.1A13 13 0 0 0 5.07 8a14 14 0 0 0 1.46 2.62 13 13 0 0 0 2.94 0A13 13 0 0 0 10.93 8a14 14 0 0 0-1.46-2.62A13 13 0 0 0 8 5.3M4.64 9.18q-.15.5-.25.96.44.16.94.27a15 15 0 0 1-.7-1.23m6.73 0a15 15 0 0 1-.7 1.23q.5-.11.95-.27a10 10 0 0 0-.25-.96M3.44 6.26C2.27 6.86 1.87 7.53 1.87 8s.4 1.14 1.57 1.74l.13.07q.18-.88.55-1.81a12 12 0 0 1-.55-1.8q-.07.02-.13.06m8.99-.07A12 12 0 0 1 11.88 8q.36.94.55 1.8l.13-.06c1.17-.6 1.56-1.27 1.56-1.74s-.39-1.14-1.56-1.74zm-7.1-.6q-.5.11-.94.27.1.46.25.96a15 15 0 0 1 .69-1.23m5.34 0a15 15 0 0 1 .7 1.23q.14-.5.24-.96-.44-.15-.94-.27M7.18 3.06c-1.09-.74-1.85-.76-2.24-.52s-.76.92-.69 2.26l.01.15a11 11 0 0 1 1.8-.41q.6-.8 1.24-1.4zm3.88-.52c-.4-.24-1.15-.22-2.25.52l-.12.08q.65.6 1.25 1.4.96.15 1.8.41v-.14c.08-1.35-.28-2.04-.68-2.27M8 3.7a10 10 0 0 0-.7.7 14 14 0 0 1 1.4 0 10 10 0 0 0-.7-.7" clip-rule="evenodd"/>
112
- </symbol>`,dc=`<symbol id="file-tree-builtin-ruby" viewBox="0 0 16 16">
112
+ </symbol>`,pc=`<symbol id="file-tree-builtin-ruby" viewBox="0 0 16 16">
113
113
  <path fill="currentColor" fill-rule="evenodd" d="M11.04 2c.48 0 .92.23 1.18.6l2.54 3.65c.37.52.3 1.23-.15 1.69l-5.58 5.64a1.47 1.47 0 0 1-2.06 0L1.39 7.94a1.3 1.3 0 0 1-.15-1.7l2.54-3.63q.2-.3.5-.45.33-.16.68-.16zm.84 2.17a.5.5 0 0 0-.7-.05L8 6.84 4.83 4.12a.5.5 0 0 0-.65.76L6.65 7H3.5a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1H9.35l2.48-2.12a.5.5 0 0 0 .05-.7" clip-rule="evenodd"/>
114
- </symbol>`,fc=`<symbol id="file-tree-builtin-rust" viewBox="0 0 16 16">
114
+ </symbol>`,mc=`<symbol id="file-tree-builtin-rust" viewBox="0 0 16 16">
115
115
  <path fill="currentColor" fill-rule="evenodd" d="M8 .8a.2.2 0 0 1 .18.1l.38.6.16.02.5-.53.01-.01a.2.2 0 0 1 .33.08l.25.68.16.05.59-.43h.02a.2.2 0 0 1 .3.14l.12.71.15.08.65-.3a.2.2 0 0 1 .2.02.2.2 0 0 1 .1.18l-.03.72.12.1.71-.16a.2.2 0 0 1 .25.25l-.17.7q.06.06.1.13l.73-.03A.2.2 0 0 1 14 4a.2.2 0 0 1 .02.2l-.3.66.08.14.71.12a.2.2 0 0 1 .14.32l-.43.59.05.16.68.25a.2.2 0 0 1 .07.35l-.53.49.01.16.62.38a.2.2 0 0 1 0 .36l-.62.38-.01.16.53.5a.2.2 0 0 1-.07.34l-.68.25-.05.16.43.59a.2.2 0 0 1-.14.32l-.72.12-.07.15.3.65a.2.2 0 0 1-.02.2.2.2 0 0 1-.18.1l-.72-.03-.1.13.16.7a.2.2 0 0 1-.25.25l-.7-.17-.13.1.03.73a.2.2 0 0 1-.1.18.2.2 0 0 1-.2.02l-.66-.3-.14.08-.12.71a.2.2 0 0 1-.32.14l-.59-.43-.16.05-.25.68a.2.2 0 0 1-.34.07l-.5-.53-.16.01-.38.62a.2.2 0 0 1-.36 0l-.38-.62-.16-.01-.5.53a.2.2 0 0 1-.34-.07l-.25-.68-.16-.05-.59.43a.2.2 0 0 1-.32-.14L5 13.78l-.15-.07-.65.3a.2.2 0 0 1-.2-.02.2.2 0 0 1-.1-.18l.03-.72-.13-.1-.7.16a.2.2 0 0 1-.25-.25l.17-.7-.1-.13-.73.03a.2.2 0 0 1-.2-.3l.3-.66-.08-.14-.71-.12a.2.2 0 0 1-.14-.32l.43-.59-.05-.16-.68-.25A.2.2 0 0 1 1 9.22l.53-.5-.02-.16-.6-.38A.2.2 0 0 1 .8 8a.2.2 0 0 1 .1-.18l.6-.38.02-.16-.53-.5a.2.2 0 0 1 .07-.34l.68-.25.05-.16-.43-.59a.2.2 0 0 1 .14-.32L2.2 5l.08-.15L2 4.2a.2.2 0 0 1 .2-.3l.72.03.1-.13-.16-.7a.2.2 0 0 1 .25-.25l.7.16.13-.1-.03-.72A.2.2 0 0 1 4 2a.2.2 0 0 1 .2-.02l.65.3L5 2.2l.12-.71v-.03a.2.2 0 0 1 .32-.1l.59.41.16-.04.25-.68.01-.02A.2.2 0 0 1 6.8.99l.49.53.16-.02.38-.61.02-.02A.2.2 0 0 1 8 .79M6.8 9.45h1.26l.06.01q.03.01.03.05v1.52q0 .07-.09.06h-4.5A5.4 5.4 0 0 0 8 13.42a5.4 5.4 0 0 0 4.45-2.33h-2.42c-.36 0-.68-.5-.77-.75-.08-.22-.2-.91-.25-1.12-.15-.61-.59-.71-.78-.73H6.8zM8 2.58a5.4 5.4 0 0 0-4.07 1.85h5.74l.17.02c.23.03.6.12.96.35.34.23.83.68.83 1.4 0 .66-.55 1.16-1.08 1.5.42.33.7.53.86 1.44.04.17.34.32.62.29.29-.03.62-.16.62-.75v-.24q0-.1.07-.1h.68A5.43 5.43 0 0 0 8 2.59M2.96 6.03a5.4 5.4 0 0 0-.19 3.37h1.66V6.03zM6.8 7.06h1.66c.35 0 .77-.12.77-.47 0-.42-.55-.53-.65-.53H6.8z" clip-rule="evenodd"/>
116
- </symbol>`,pc=`<symbol id="file-tree-builtin-sass" viewBox="0 0 16 16">
116
+ </symbol>`,hc=`<symbol id="file-tree-builtin-sass" viewBox="0 0 16 16">
117
117
  <path fill="currentColor" fill-rule="evenodd" d="M8.08 1.44c2.41-.91 4.96-.37 5.35 1.27.39 1.62-.92 3.56-2.6 4.25a5 5 0 0 1-3.26.35c-.58-.2-.92-.62-1-.85-.03-.09-.09-.24 0-.3.05-.03.08-.02.22.15s.7.6 1.75.48c2.78-.34 4.45-2.64 3.92-3.88-.37-.87-2.5-1.26-5.18.16C4.03 4.81 3.85 6.24 3.82 6.8c-.08 1.5 1.73 2.28 2.7 3.4q.04.03.07.08c.3-.12.7-.19 1.35-.2 1.58-.03 2.47 1.08 2.43 2.08-.03.78-.7 1.1-.82 1.13-.1.01-.14.02-.15-.06q-.03-.06.13-.15c.16-.09.42-.3.48-.72.05-.43-.24-1.44-1.76-1.63a3 3 0 0 0-1.33.08c.27.62.32 1.87-.29 2.83-.63 1-1.8 1.61-2.93 1.27-.37-.1-.93-.92-.45-2.05.46-1.07 2.4-2.12 2.66-2.26-.9-.83-3.08-1.95-3.4-3.65-.08-.49.13-1.65 1.46-2.98a12 12 0 0 1 4.11-2.52m-1.88 9.7c-.01.01-.9.47-1.52 1.17-.59.66-.75 1.48-.43 1.69.3.18 1-.04 1.51-.62a3 3 0 0 0 .5-.9q.2-.64.02-1.39z" clip-rule="evenodd"/>
118
- </symbol>`,mc=`<symbol id="file-tree-builtin-stylelint" viewBox="0 0 16 16">
118
+ </symbol>`,gc=`<symbol id="file-tree-builtin-stylelint" viewBox="0 0 16 16">
119
119
  <path fill="currentColor" d="M4 3v3.5l1.5-1L7 15 .5 6l1-1.5L0 3l2.5-2h1zm12 0-1.5 1.5 1 1.5L9 15l1.5-9.5 1.5 1V3l.5-2h1zm-8 8.5a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1m0-3a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1m0-3a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1"/>
120
120
  <path fill="currentColor" d="M6.5 2.5V4l-2 1.5v-4zm5 3L9.5 4V2.5l2-1zM9 4H7V2.5h2z"/>
121
- </symbol>`,hc=`<symbol id="file-tree-builtin-svelte" viewBox="0 0 16 16">
121
+ </symbol>`,_c=`<symbol id="file-tree-builtin-svelte" viewBox="0 0 16 16">
122
122
  <path fill="currentColor" d="m3.98 3.7 3.36-2.08a4.5 4.5 0 0 1 5.9 1.23 4 4 0 0 1 .7 3.02q-.16.75-.58 1.4c.42.77.56 1.66.4 2.52a3.7 3.7 0 0 1-1.57 2.4l-.17.1-3.36 2.09a4.5 4.5 0 0 1-5.9-1.23 4 4 0 0 1-.66-1.44 4 4 0 0 1-.04-1.58 4 4 0 0 1 .58-1.4 4 4 0 0 1-.4-2.52 3.7 3.7 0 0 1 1.57-2.4zl3.36-2.08zm7.87 0a2.7 2.7 0 0 0-1.26-.95 2.7 2.7 0 0 0-1.6-.07 3 3 0 0 0-.52.2l-.16.09-3.36 2.08a2 2 0 0 0-.69.64 2 2 0 0 0-.36.86 2.3 2.3 0 0 0 .42 1.81A2.7 2.7 0 0 0 7.18 9.4q.28-.06.53-.2l.16-.09 1.28-.79.2-.09a.8.8 0 0 1 .87.31.7.7 0 0 1 .13.55.7.7 0 0 1-.24.4l-.08.05-3.36 2.08-.2.09a1 1 0 0 1-.49-.02 1 1 0 0 1-.38-.3 1 1 0 0 1-.13-.37v-.1l.01-.13-.13-.03a4 4 0 0 1-1.1-.5l-.2-.14-.18-.12-.07.18-.08.3a2.3 2.3 0 0 0 .43 1.82q.45.64 1.19.93.73.28 1.51.14l.16-.04q.27-.07.52-.2l.16-.09 3.36-2.08q.4-.25.69-.64.27-.4.36-.86a2.3 2.3 0 0 0-.42-1.82 2.7 2.7 0 0 0-1.27-.95 2.7 2.7 0 0 0-1.6-.08q-.27.07-.52.2l-.16.1-1.28.79-.2.09a1 1 0 0 1-.49-.03 1 1 0 0 1-.38-.29.7.7 0 0 1-.13-.54.7.7 0 0 1 .24-.4l.08-.06L9.33 4.4l.2-.1a.8.8 0 0 1 .87.32 1 1 0 0 1 .13.38v.22l.11.04q.6.18 1.12.5l.2.14.17.12.06-.19.08-.3a2.3 2.3 0 0 0-.42-1.81z"/>
123
- </symbol>`,gc=`<symbol id="file-tree-builtin-svg" viewBox="0 0 16 16">
123
+ </symbol>`,vc=`<symbol id="file-tree-builtin-svg" viewBox="0 0 16 16">
124
124
  <path fill="currentColor" d="M5 7a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2z"/>
125
125
  <path fill="currentColor" d="M6 1a5 5 0 0 1 4.58 3H7a3 3 0 0 0-3 3v3.58A5 5 0 0 1 6 1" opacity=".5"/>
126
- </symbol>`,_c=`<symbol id="file-tree-builtin-svgo" viewBox="0 0 16 16">
126
+ </symbol>`,yc=`<symbol id="file-tree-builtin-svgo" viewBox="0 0 16 16">
127
127
  <path fill="currentColor" d="M9.43 4.8A.6.6 0 1 1 9.19 6l-.56.96a1.2 1.2 0 0 1 .32 1.58l.7.53a.89.89 0 1 1-.17.22l-.7-.52a1.2 1.2 0 0 1-1.4.25l-.56.87a.75.75 0 1 1-.57-.2 1 1 0 0 1 .32.05l.56-.87a1.2 1.2 0 0 1-.4-1.24l-1.2-.47a.56.56 0 1 1 .1-.28v.02l1.2.47a1.2 1.2 0 0 1 1.56-.55l.56-.97a.6.6 0 0 1-.15-.64.6.6 0 0 1 .63-.4"/>
128
128
  <path fill="currentColor" fill-rule="evenodd" d="M9.17 1q.16.63.27 1.26a6 6 0 0 1 1.61.67q.52-.38 1.08-.71l1.65 1.64q-.32.56-.68 1.05.48.78.72 1.67.6.09 1.18.25v2.32q-.55.15-1.11.24a6 6 0 0 1-.7 1.82q.31.44.59.91l-1.65 1.65-.85-.55a6 6 0 0 1-1.9.83q-.08.47-.2.95H6.84q-.12-.46-.2-.93a6 6 0 0 1-1.96-.81q-.39.27-.8.51l-1.65-1.65q.25-.43.53-.84a6 6 0 0 1-.75-1.9L1 9.16V6.83q.54-.14 1.09-.24a6 6 0 0 1 .77-1.74q-.33-.47-.63-.98l1.65-1.65q.54.32 1.03.68a6 6 0 0 1 1.66-.66q.1-.61.26-1.24zM7.96 3.73a4 4 0 0 0-1.74.36 4.5 4.5 0 0 0-2.3 2.3 4.4 4.4 0 0 0-.1 3.29l.03.06a4.4 4.4 0 0 0 2.4 2.47 4.4 4.4 0 0 0 3.48-.02l.03-.02a4.4 4.4 0 0 0 2.3-2.42l.06-.14a4.4 4.4 0 0 0-.2-3.4 4.4 4.4 0 0 0-2.13-2.07L9.47 4a4 4 0 0 0-1.51-.27" clip-rule="evenodd"/>
129
- </symbol>`,vc=`<symbol id="file-tree-builtin-swift" viewBox="0 0 16 16">
129
+ </symbol>`,bc=`<symbol id="file-tree-builtin-swift" viewBox="0 0 16 16">
130
130
  <path fill="currentColor" d="M9.63 1c6.15 4.35 4.16 9.15 4.16 9.15s1.75 2.05 1.04 3.85c0 0-.72-1.26-1.93-1.26-1.17 0-1.85 1.26-4.2 1.26C3.47 14 1 9.46 1 9.46c4.71 3.22 7.93.94 7.93.94C6.8 9.12 2.29 3 2.29 3c3.93 3.47 5.63 4.39 5.63 4.39-1.01-.87-3.86-5.13-3.86-5.13C6.34 4.66 10.86 8 10.86 8c1.28-3.7-1.23-7-1.23-7"/>
131
- </symbol>`,yc=`<symbol id="file-tree-builtin-table" viewBox="0 0 16 16">
131
+ </symbol>`,xc=`<symbol id="file-tree-builtin-table" viewBox="0 0 16 16">
132
132
  <path fill="currentColor" d="M8 4a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1H8z" class="bg" opacity=".4"/>
133
133
  <path fill="currentColor" d="M11.5 8a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5v-4a.5.5 0 0 1 .5-.5zM5 12h2.5v-1H5zm3.5 0H11v-1H8.5zM5 10h2.5V9H5zm3.5 0H11V9H8.5zm1-9a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
134
- </symbol>`,bc=`<symbol id="file-tree-builtin-tailwind" viewBox="0 0 16 16">
134
+ </symbol>`,Sc=`<symbol id="file-tree-builtin-tailwind" viewBox="0 0 16 16">
135
135
  <path fill="currentColor" fill-rule="evenodd" d="M8 4Q5.2 4 4.5 6.67q1.05-1.34 2.45-1c.53.12.91.5 1.33.9C8.98 7.23 9.77 8 11.5 8q2.8 0 3.5-2.67-1.05 1.34-2.45 1c-.53-.12-.91-.5-1.33-.9C10.52 4.77 9.73 4 8 4M4.5 8Q1.7 8 1 10.67q1.05-1.34 2.45-1c.53.12.91.5 1.33.9C5.48 11.23 6.26 12 8 12q2.8 0 3.5-2.67-1.05 1.34-2.45 1c-.53-.12-.91-.5-1.33-.9C7.02 8.77 6.24 8 4.5 8" clip-rule="evenodd"/>
136
- </symbol>`,xc=`<symbol id="file-tree-builtin-terraform" viewBox="0 0 16 16">
136
+ </symbol>`,Cc=`<symbol id="file-tree-builtin-terraform" viewBox="0 0 16 16">
137
137
  <path fill="currentColor" d="M1 0v5.05l4.35 2.53V2.53zm9.18 5.34L5.83 2.82v5.05l4.35 2.53zm.47 5.06V5.34L15 2.82v5.05zm-.48 5.6-4.35-2.53V8.42l4.35 2.53z"/>
138
- </symbol>`,Sc=`<symbol id="file-tree-builtin-text" viewBox="0 0 16 16">
138
+ </symbol>`,wc=`<symbol id="file-tree-builtin-text" viewBox="0 0 16 16">
139
139
  <path fill="currentColor" fill-rule="evenodd" d="M8 4a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1H8z" class="bg" clip-rule="evenodd" opacity=".4"/>
140
140
  <path fill="currentColor" d="M8.5 11a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1zm2-2a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1zm-1-8a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z"/>
141
- </symbol>`,Cc=`<symbol id="file-tree-builtin-typescript" viewBox="0 0 16 16">
141
+ </symbol>`,Tc=`<symbol id="file-tree-builtin-typescript" viewBox="0 0 16 16">
142
142
  <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
143
143
  <path fill="currentColor" d="M8.1 9.64h.95c.04.62.28.76 1.28.76s1.2-.14 1.2-.85c0-.66-.2-.85-1.2-1.07-1.79-.38-2.18-.7-2.18-1.86C8.15 5.3 8.54 5 10.31 5c1.67 0 2.04.26 2.07 1.42h-.95c-.02-.43-.23-.53-1.1-.53-1 0-1.22.14-1.22.74 0 .52.22.7 1.24.92 1.76.38 2.15.73 2.15 2 0 1.44-.4 1.75-2.24 1.75-1.8 0-2.18-.3-2.15-1.66m-3 1.57V5.99H3.5v-.9h4.21v.9H6.1v5.22z"/>
144
- </symbol>`,wc=`<symbol id="file-tree-builtin-vite" viewBox="0 0 16 16">
144
+ </symbol>`,Ec=`<symbol id="file-tree-builtin-vite" viewBox="0 0 16 16">
145
145
  <path fill="currentColor" d="M8.57 14.87c-.18.26-.55.11-.55-.22v-3.18l-.05-.27-.13-.22-.2-.15-.24-.06H4.29c-.26 0-.4-.32-.26-.55L6.08 7c.3-.46 0-1.1-.5-1.1H1.8c-.25 0-.4-.32-.25-.56l2.65-4.2A.3.3 0 0 1 4.46 1h7.9c.26 0 .4.32.26.55l-2.05 3.23c-.29.46 0 1.1.5 1.1h3.12c.26 0 .4.34.24.57z"/>
146
- </symbol>`,Tc=`<symbol id="file-tree-builtin-vscode" viewBox="0 0 16 16">
146
+ </symbol>`,Dc=`<symbol id="file-tree-builtin-vscode" viewBox="0 0 16 16">
147
147
  <path fill="currentColor" d="m5.11 9.68-2.4 1.84a.6.6 0 0 1-.75-.04l-.77-.7a.6.6 0 0 1 0-.87L3.28 8zm5.52-8.42a.51.51 0 0 1 .87.36V4.8L7.32 8 5.1 6.32z" opacity=".75"/>
148
148
  <path fill="currentColor" d="M11.1 14.99h.03zM1.96 4.52a.6.6 0 0 1 .75-.04l8.8 6.71v3.19a.51.51 0 0 1-.88.36L1.19 6.1a.6.6 0 0 1 0-.87z" opacity=".65"/>
149
149
  <path fill="currentColor" d="M11.62 14.91a.9.9 0 0 1-1-.17.51.51 0 0 0 .88-.36V1.62a.51.51 0 0 0-.87-.36.9.9 0 0 1 1-.17l2.87 1.39a.9.9 0 0 1 .5.8v9.44a.9.9 0 0 1-.5.8z"/>
150
- </symbol>`,Ec=`<symbol id="file-tree-builtin-vue" viewBox="0 0 16 16">
150
+ </symbol>`,Oc=`<symbol id="file-tree-builtin-vue" viewBox="0 0 16 16">
151
151
  <path fill="currentColor" d="M9.62 2.25 8 5.02 6.38 2.25H1l7 12 7-12z" opacity=".5"/>
152
152
  <path fill="currentColor" d="M9.54 2.25 8 4.95l-1.54-2.7H4l4 7 4-7z"/>
153
- </symbol>`,Dc=`<symbol id="file-tree-builtin-wasm" viewBox="0 0 16 16">
153
+ </symbol>`,kc=`<symbol id="file-tree-builtin-wasm" viewBox="0 0 16 16">
154
154
  <path fill="currentColor" d="M13 1a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h3a2 2 0 1 0 4 0z" class="subtract" opacity=".2"/>
155
155
  <path fill="currentColor" d="M4.64 11.4h.02l.8-3.4h.91l.73 3.45L7.88 8h.96l-1.25 5h-.97L5.9 9.6 5.1 13h-1L3 8h.98z"/>
156
156
  <path fill="currentColor" fill-rule="evenodd" d="M13 13h-1.02l-.33-1.11H9.9L9.64 13h-.97l1.26-5h1.54zm-2.49-3.77-.42 1.84h1.32l-.49-1.84z" clip-rule="evenodd"/>
157
- </symbol>`,Oc=`<symbol id="file-tree-builtin-webpack" viewBox="0 0 16 16">
157
+ </symbol>`,Ac=`<symbol id="file-tree-builtin-webpack" viewBox="0 0 16 16">
158
158
  <path fill="currentColor" d="M14.1 11.79 8.26 15v-2.5l3.64-1.94zm.4-.35V4.73l-2.14 1.2v4.3zm-12.6.35L7.74 15v-2.5L4.1 10.56zm-.4-.35V4.73l2.14 1.2v4.3zm.25-7.15 6-3.29v2.42L3.9 5.47l-.03.01zm12.5 0L8.25 1v2.42l3.85 2.05.03.01z" class="bg" opacity=".4"/>
159
159
  <path fill="currentColor" d="m7.74 11.93-3.59-1.92v-3.8l3.6 2.02zm.52 0 3.59-1.92v-3.8l-3.6 2.02zM4.4 5.77 8 3.85l3.6 1.93L8 7.8z" class="fg"/>
160
- </symbol>`,kc=`<symbol id="file-tree-builtin-yml" viewBox="0 0 16 16">
160
+ </symbol>`,jc=`<symbol id="file-tree-builtin-yml" viewBox="0 0 16 16">
161
161
  <path fill="currentColor" d="M7.5 2A1.5 1.5 0 0 1 9 3.5v3A1.5 1.5 0 0 1 7.5 8h-2v2A1.5 1.5 0 0 0 7 11.5v-1A1.5 1.5 0 0 1 8.5 9h5a1.5 1.5 0 0 1 1.5 1.5v3a1.5 1.5 0 0 1-1.5 1.5h-5A1.5 1.5 0 0 1 7 13.5v-1A2.5 2.5 0 0 1 4.5 10V8h-2A1.5 1.5 0 0 1 1 6.5v-3A1.5 1.5 0 0 1 2.5 2zm1 8a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5zm-6-7a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5z"/>
162
- </symbol>`,Ac=`<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">
162
+ </symbol>`,Mc=`<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">
163
163
  <path fill="currentColor" d="m14.73 1.5-7.29 8.82h4.17l-1.73 2.04H5.76L1.27 14.5l7.3-8.91H4.39l1.73-2.05h4.12z"/>
164
164
  <path fill="currentColor" d="M5.21 3.54 3.56 5.6h-.55v4.73h.83L2.1 12.36H1V3.54zm9.79 0v8.82h-4.3l1.74-2.04h.55V5.68h-.83l1.74-2.14z"/>
165
- </symbol>`,jc=[Fs,Bs,Hs,Us,Ws,Gs,Js,Ys,Xs,Qs,$s,ec,tc,nc,rc,lc,dc,fc,vc,yc,Sc,Cc,`<symbol id="file-tree-builtin-zip" viewBox="0 0 16 16">
165
+ </symbol>`,Nc=[Ls,Hs,Ws,Gs,Ks,qs,Xs,Zs,Qs,ec,tc,nc,rc,ic,ac,dc,pc,mc,bc,xc,wc,Tc,`<symbol id="file-tree-builtin-zip" viewBox="0 0 16 16">
166
166
  <path fill="currentColor" d="M4.585 2a2 2 0 0 1 1.028.285l1.788 1.072a1 1 0 0 0 .514.143H12A2 2 0 0 1 13.935 5H0V4a2 2 0 0 1 2-2z" class="bg" opacity=".5"/>
167
167
  <path fill="currentColor" fill-rule="evenodd" d="M14 12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-1.25h1v-1H0V6h14zM9.9 8.25c-.883 0-1.9.5-1.9.5H7v1h1v1s1.017.5 1.9.5c.884 0 1.6-.672 1.6-1.5s-.716-1.5-1.6-1.5M2 9.75v1h1v-1zm2 0v1h1v-1zm2 0v1h1v-1zm-5-1v1h1v-1zm2 0v1h1v-1zm2 0v1h1v-1z" class="fg" clip-rule="evenodd"/>
168
- </symbol>`],Mc=[Ns,Ps,Is,Ls,Rs,zs,Vs,Ks,qs,Zs,ic,ac,oc,sc,cc,uc,pc,mc,hc,gc,_c,bc,xc,wc,Tc,Ec,Dc,Oc,kc,Ac];function Nc(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
169
- `)}\n</svg>`)}var Pc=Nc(Ms,jc),Fc={minimal:Ms,standard:Pc,complete:Nc(Pc,Mc)},Ic={".babelrc":`babel`,".babelrc.json":`babel`,".bash_profile":`bash`,".bashrc":`bash`,".browserslistrc":`browserslist`,".dockerignore":`docker`,".eslintignore":`eslint`,".eslintrc":`eslint`,".eslintrc.cjs":`eslint`,".eslintrc.js":`eslint`,".eslintrc.json":`eslint`,".eslintrc.yaml":`eslint`,".eslintrc.yml":`eslint`,".gitattributes":`git`,".gitignore":`git`,".gitkeep":`git`,".gitmodules":`git`,".oxlintrc.json":`oxc`,".postcssrc":`postcss`,".postcssrc.json":`postcss`,".postcssrc.yaml":`postcss`,".postcssrc.yml":`postcss`,".prettierignore":`prettier`,".prettierrc":`prettier`,".prettierrc.cjs":`prettier`,".prettierrc.js":`prettier`,".prettierrc.json":`prettier`,".prettierrc.mjs":`prettier`,".prettierrc.toml":`prettier`,".prettierrc.yaml":`prettier`,".prettierrc.yml":`prettier`,".stylelintignore":`stylelint`,".stylelintrc":`stylelint`,".stylelintrc.cjs":`stylelint`,".stylelintrc.js":`stylelint`,".stylelintrc.json":`stylelint`,".stylelintrc.mjs":`stylelint`,".stylelintrc.yaml":`stylelint`,".stylelintrc.yml":`stylelint`,".terraform.lock.hcl":`terraform`,".zprofile":`bash`,".zshenv":`bash`,".zshrc":`bash`,"babel.config.cjs":`babel`,"babel.config.js":`babel`,"babel.config.json":`babel`,"babel.config.mjs":`babel`,"biome.json":`biome`,"biome.jsonc":`biome`,"bootstrap.bundle.js":`bootstrap`,"bootstrap.bundle.min.js":`bootstrap`,"bootstrap.css":`bootstrap`,"bootstrap.js":`bootstrap`,"bootstrap.min.css":`bootstrap`,"bootstrap.min.js":`bootstrap`,"bun.lock":`bun`,"bun.lockb":`bun`,"bunfig.toml":`bun`,"claude.md":`claude`,"compose.yaml":`docker`,"compose.yml":`docker`,"docker-compose.override.yml":`docker`,"docker-compose.yaml":`docker`,"docker-compose.yml":`docker`,dockerfile:`docker`,"eslint.config.cjs":`eslint`,"eslint.config.js":`eslint`,"eslint.config.mjs":`eslint`,"eslint.config.mts":`eslint`,"eslint.config.ts":`eslint`,gemfile:`ruby`,"next.config.js":`nextjs`,"next.config.mjs":`nextjs`,"next.config.mts":`nextjs`,"next.config.ts":`nextjs`,"postcss.config.cjs":`postcss`,"postcss.config.js":`postcss`,"postcss.config.mjs":`postcss`,"postcss.config.ts":`postcss`,"prettier.config.cjs":`prettier`,"prettier.config.js":`prettier`,"prettier.config.mjs":`prettier`,rakefile:`ruby`,"readme.md":`markdown`,"stylelint.config.cjs":`stylelint`,"stylelint.config.js":`stylelint`,"stylelint.config.mjs":`stylelint`,"svgo.config.cjs":`svgo`,"svgo.config.js":`svgo`,"svgo.config.mjs":`svgo`,"svgo.config.ts":`svgo`,"tailwind.config.cjs":`tailwind`,"tailwind.config.js":`tailwind`,"tailwind.config.mjs":`tailwind`,"tailwind.config.ts":`tailwind`,"vite.config.js":`vite`,"vite.config.mjs":`vite`,"vite.config.mts":`vite`,"vite.config.ts":`vite`,"webpack.config.babel.js":`webpack`,"webpack.config.cjs":`webpack`,"webpack.config.js":`webpack`,"webpack.config.mjs":`webpack`,"webpack.config.ts":`webpack`},Lc={"7z":`zip`,astro:`astro`,AUTHORS:`text`,avif:`image`,bash:`bash`,bmp:`image`,bz2:`zip`,c:`c`,cc:`cpp`,cfg:`text`,CHANGELOG:`text`,cjs:`javascript`,"code-workspace":`vscode`,conf:`text`,CONTRIBUTORS:`text`,cpp:`cpp`,csh:`bash`,css:`css`,csv:`table`,cts:`typescript`,cxx:`cpp`,db:`database`,editorconfig:`text`,env:`text`,"env.development":`text`,"env.local":`text`,"env.production":`text`,eot:`font`,erb:`ruby`,fish:`bash`,gemspec:`ruby`,gif:`image`,go:`go`,gql:`graphql`,graphql:`graphql`,gz:`zip`,h:`c`,hh:`cpp`,hpp:`cpp`,htm:`html`,html:`html`,hxx:`cpp`,icns:`image`,ico:`image`,ini:`text`,inl:`cpp`,jar:`zip`,jpeg:`image`,jpg:`image`,js:`javascript`,json:`json`,json5:`json`,jsonc:`json`,jsonl:`json`,jsx:`javascript`,ksh:`bash`,less:`css`,LICENSE:`text`,log:`text`,markdown:`markdown`,mcp:`mcp`,md:`markdown`,mdx:`markdown`,"mdx.tsx":`markdown`,mjs:`javascript`,mm:`cpp`,mts:`typescript`,ods:`table`,otf:`font`,png:`image`,postcss:`css`,py:`python`,pyi:`python`,pyw:`python`,pyx:`python`,rake:`ruby`,rar:`zip`,rb:`ruby`,rs:`rust`,rst:`text`,rtf:`text`,sass:`css`,scss:`css`,sh:`bash`,sql:`database`,sqlite:`database`,sqlite3:`database`,styl:`css`,svelte:`svelte`,svg:`svg`,swift:`swift`,tar:`zip`,tf:`terraform`,tfstate:`terraform`,tfvars:`terraform`,tgz:`zip`,tif:`image`,tiff:`image`,ts:`typescript`,tsv:`table`,tsx:`typescript`,ttf:`font`,txt:`text`,vue:`vue`,war:`zip`,wasm:`wasm`,wast:`wasm`,wat:`wasm`,webp:`image`,woff:`font`,woff2:`font`,xhtml:`html`,xls:`table`,xlsx:`table`,xz:`zip`,yaml:`yml`,yml:`yml`,zig:`zig`,zip:`zip`,zsh:`bash`},Rc={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},zc=new Set([`bash`,`c`,`cpp`,`css`,`database`,`default`,`font`,`git`,`go`,`html`,`image`,`javascript`,`json`,`markdown`,`mcp`,`python`,`ruby`,`rust`,`swift`,`table`,`text`,`typescript`,`zip`]),Bc=new Set([`complete`]);function Vc(e){return Fc[e===`none`?`minimal`:e]}function Hc(e){return`file-tree-builtin-${e}`}function Uc(e){return e!==`none`&&Bc.has(e)}function Wc(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=Ic[t.toLowerCase()];if(i!=null&&(r||zc.has(i)))return i;for(let e of n){if(r){let t=Rc[e];if(t!=null)return t}let t=Lc[e];if(t!=null&&(r||zc.has(t)))return t}return`default`}var Gc=`file-tree-container`,Kc=`data-file-tree-style`,qc=`data-file-tree-unsafe-css`,Jc=`data-file-tree-scrollbar-measure`,Yc=`data-file-tree-scrollbar-gutter-measured`,Xc=`--trees-scrollbar-gutter-measured`,Zc=`header`,Qc=`context-menu`,$c=`context-menu-trigger`;function el(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function tl(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(el(e)?`none`:`complete`),colored:e.colored??!0}}var nl=e=>e.trim().toLowerCase(),rl=e=>e.split(`/`).at(-1)??e,il=e=>{let t=e.toLowerCase().split(`.`),n=[];for(let e=1;e<t.length;e+=1)n.push(t.slice(e).join(`.`));return n};function al(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function ol(e){let t=tl(e),n=t.remap,r=new Map;for(let[e,n]of Object.entries(t.byFileName??{}))r.set(e.toLowerCase(),n);let i=new Map;for(let[e,n]of Object.entries(t.byFileExtension??{}))i.set(nl(e),n);let a=Object.entries(t.byFileNameContains??{}).map(([e,t])=>[e.toLowerCase(),t]);return{resolveIcon:(e,o)=>{if(e===`file-tree-icon-file`&&o!=null){let s=rl(o),c=s.toLowerCase(),l=r.get(c);if(l!=null)return al(l,e);for(let[t,n]of a)if(c.includes(t))return al(n,e);let u=il(s);for(let t of u){let n=i.get(t);if(n!=null)return al(n,e)}let d=Wc(t.set,s,u);if(d!=null&&t.set!==`none`){if(d==="default"){let t=n?.[e];if(t!=null)return al(t,e)}return{name:Hc(d),remappedFrom:e,token:d}}}let s=n?.[e];return s==null?{name:e}:al(s,e)}}}var sl=5,cl=32,ll=128;function ul(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function dl(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function fl(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 pl(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 ml(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function hl(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 gl(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,bl(e,t)}function _l(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=pl(e).get(t);if(i===void 0)return;let a=i>>sl;e.childVisibleChunkSums[a]+=r}function vl(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=xl(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=cl}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 yl(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>sl;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<sl}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 bl(e,t){if(t.childIds.length<ll){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/cl),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>>sl]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function xl(e,t,n,r){let i=Math.min(t.childIds.length,n+cl),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 Sl=7,Cl=3,wl=8,Tl=4;function El(e,t,n=0){return e<<Tl|n<<Cl|t}function Dl(e){return e.depthAndFlags>>>Tl}function Ol(e){return(e.depthAndFlags&wl)>>Cl}function J(e){return(e.depthAndFlags&wl)!==0}function kl(e){return e.depthAndFlags&Sl}function Al(e,t){return(kl(e)&t)!==0}function jl(e,t){e.depthAndFlags|=t}function Ml(e,t){e.depthAndFlags=El(t,kl(e),Ol(e))}var Nl=Symbol(`benchmarkInstrumentation`);function Pl(e,t){return t==null||Object.defineProperty(e,Nl,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function Fl(e){return e==null?null:e[Nl]??null}function Y(e,t,n){return e==null?n():e.measurePhase(t,n)}function Il(e,t,n){Number.isFinite(n)&&e!=null&&e.setCounter(t,n)}function Ll(e){return e>=48&&e<=57}function Rl(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!Ll(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&&Ll(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 zl(e){let t=e.toLowerCase();return{lowerValue:t,tokens:Rl(t)}}function Bl(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 Vl(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=Bl(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function Hl(e,t,n){let r=Vl(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function Ul(e,t){return Hl(e,t,zl)}function Wl(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function Gl(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=Wl(e,r);return a===Wl(t,r)?Ul(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 Kl(e,t){return Gl(e,t)}function ql(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=zl(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=Wl(e,n);return o===Wl(t,n)?Hl(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 Jl(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=zl(r);return e.sortKeyById[t]=i,i}function Yl(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function Xl(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 Zl(e){let{hasTrailingSlash:t,segments:n}=Xl(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function Ql(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=Xl(e);return{requiresDirectory:t,segments:n}}function $l(){let e=new Map;return e.set(``,0),{idByValue:e,valueById:[``],sortKeyById:[zl(``)]}}function eu(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 tu(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var nu=Symbol(`pathStorePreparedInputKind`);function ru(e,t){return e[nu]=t,e}function iu(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function au(e,t,n){return n==="default"?Kl(e,t):n(iu(e),iu(t))}function ou(){return{depthAndFlags:El(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function su(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 cu(e){return e.isDirectory?e.segments.length:e.segments.length-1}function lu(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 uu(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function du(e,t={}){return _u(e,t).map(e=>e.path)}function fu(e,t={}){let n=_u(e,t);return ru({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function pu(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 ru({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function mu(e){let t=e,n=t.preparedPaths;if(t[nu]===`prepared`&&n!=null)return n;if(!lu(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function hu(e){let t=e;return t[nu]===`presorted`&&t.presortedPaths!=null||uu(t.presortedPaths)?t.presortedPaths:null}function gu(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function _u(e,t={}){let n=Yl(t),r=Fl(t);Il(r,`workload.inputFiles`,e.length);let i=Y(r,`store.preparePathEntries.parse`,()=>e.map(e=>Zl(e)));return Y(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>au(e,t,n.sort))),i}var vu=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[ou()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=$l();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=Fl(e),this.options=Yl(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,ul())}appendPaths(e){return Y(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>Zl(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,Y(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return Y(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:El(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:El(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d,m=a+1}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:El(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=Zl(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:El(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:El(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=Zl(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(Y(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||Y(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"?ql(this.lastPreparedPath,e,this.segmentSortKeyCache):au(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=cu(e),i=n==null?0:cu(n),a=n==null?0:su(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=eu(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:El(Dl(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),ml(i,s),s}createFileChildUnchecked(e,t){let n=eu(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:El(Dl(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),ml(r,a),a}getOrCreateDirectoryChild(e,t){let n=eu(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&&!J(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:El(Dl(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),ml(r,a),this.directories.set(a,ul()),a}createDirectoryChild(e,t){let n=eu(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:El(Dl(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),ml(r,a),this.directories.set(a,ul()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!J(n))throw Error(`Path is not a directory: "${t}"`);if(Al(n,1))throw Error(`Duplicate path: "${t}"`);jl(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,dl());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(J(a)){let t=dl();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;J(n)&&this.directories.set(t,ul());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),ml(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!J(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 gl(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function yu(e,t=`closed`,n=null){let r=xu(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 bu(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function xu(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 Su(e,t){return Al(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion!==`closed`&&Dl(t)<=e.defaultExpansion}function Cu(e,t,n=e.snapshot.nodes[t]){return n==null||!J(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:Su(e,n)}function wu(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!J(r))return;let i=Su(e,r);if(n){if(i){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t)}else i?(e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0):e.expandedDirectoryIds.delete(t)}function Tu(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 Eu(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function Du(e,t){let n=Tu(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 Ou(e,t){let n=Tu(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function ku(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 Au(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function ju(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 Mu(e,t){e.directoryLoadInfoById.delete(t)}function Nu(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 Pu(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Fu(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function Iu(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function Lu(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Ru(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function zu(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Bu(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 Vu(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 Hu(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 Uu(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 Wu(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 Gu(e,t,n){return{...n,visibleCountDelta:nd(e)-t}}function Ku(e,t){let n=nd(e),r=bu();e.transactionStack.push(r);try{t()}catch(t){throw Yu(e,r,!1),t}Yu(e,r,!0,nd(e)-n)}function qu(e,t){let n=e.instrumentation;n==null?Ju(e,t):Y(n,`store.events.record`,()=>Ju(e,t))}function Ju(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;n==null?ed(e,t):(n.events.push(t),$u(n,t))}function Yu(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?Qu(i,t):Y(n,`store.events.batch.merge`,()=>Qu(i,t));return}let a=Xu(t,r),o=e.instrumentation;o==null?ed(e,a):Y(o,`store.events.batch.commit`,()=>ed(e,a))}function Xu(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 Zu(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function Qu(e,t){for(let n of t.events)e.events.push(n);Zu(e,t)}function $u(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function ed(e,t){let n=e.instrumentation;n==null?td(e,t):Y(n,`store.events.emit`,()=>td(e,t))}function td(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function nd(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function rd(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!J(n)||Al(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||!J(a)?null:i}function id(e,t){let n=t;for(;;){let t=rd(e,n);if(t==null)return n;n=t}}function ad(e,t){let n=[t],r=t;for(;;){let t=rd(e,r);if(t==null)return n;n.push(t),r=t}}function od(e,t){let n=t==null?e.snapshot.rootId:gd(e,t);return n==null?[]:yd(e,n)}function sd(e,t){let n=Zl(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=Pd(e,Nd(e,r)),{createdNodeIds:a,directoryId:o}=bd(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=X(e,o);if(Al(n,1))throw Error(`Path already exists: "${t}"`);jl(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=Sd(e,o,n.basename),s.add(c);pd(e,o);let l=Pd(e,o);return Pu({affectedAncestorIds:hd(e,c),affectedNodeIds:[...s],path:t,projectionChanged:Fd(i,l)})}function cd(e,t,n){let r=gd(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=X(e,r);if(Al(i,2))throw Error(`The root node cannot be removed`);if(J(i)&&vd(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=Pd(e,a),s=jd(e,r);Td(e,a,r,i.nameId),Md(e,a),pd(e,a);let c=Pd(e,a);return Fu({affectedAncestorIds:hd(e,a),affectedNodeIds:s,path:t,projectionChanged:Fd(o,c),recursive:n.recursive===!0})}function ld(e,t,n,r){let i=gd(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=X(e,i);if(Al(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=kd(e,i,n),c=Pd(e,a.parentId),l=Pd(e,s.parentId),u=tu(e.snapshot.segmentTable,a.nameId),d=eu(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(J(a)&&zd(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=fl(e.snapshot.nodes,vd(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&Ad(e,p,o,Ol(a))===`skip`)return null;let m=a.parentId;Td(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),Rd(e,i),wd(e,s.parentId,i),Md(e,m),e.pathCacheVersion++,pd(e,m),s.parentId!==m&&pd(e,s.parentId);let h=Pd(e,m),g=Pd(e,s.parentId);return Iu({affectedAncestorIds:[...new Set([...hd(e,m),...hd(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:Id([c,l],[h,g]),to:fd(e,i)})}function ud(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function dd(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function fd(e,t){let n=X(e,t),r=ud(e,t);if(r!=null)return r;if(Al(n,2))return dd(e,t,``);let i=fd(e,n.parentId),a=tu(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return dd(e,t,J(n)?`${o}/`:o)}function pd(e,t){let n=e.instrumentation;n==null?Vd(e,t):Y(n,`store.recomputeCountsUpwardFrom`,()=>Vd(e,t))}function md(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||!J(o)){Bd(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){Bd(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function hd(e,t){let n=[],r=t;for(;r!=null;){let t=X(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function gd(e,t){if(t.length===0)return e.snapshot.rootId;let n=Ql(t);return _d(e,n.segments,n.requiresDirectory)}function _d(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=vd(e,r),a=fl(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=X(e,r);return n&&!J(i)?null:r}function vd(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 X(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Al(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function yd(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Al(n,4))return[];if(!J(n))return[fd(e,t)];if(vd(e,t).childIds.length===0)return Al(n,1)&&!Al(n,2)?[fd(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||Al(n,4)){i.pop();continue}if(!J(n)){r.push(fd(e,t.nodeId)),i.pop();continue}let a=vd(e,t.nodeId);if(a.childIds.length===0){Al(n,1)&&!Al(n,2)&&r.push(fd(e,t.nodeId)),i.pop();continue}let o=a.childIds[t.childIndex];o==null?i.pop():(t.childIndex++,i.push({childIndex:0,nodeId:o}))}return r}function bd(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=eu(e.snapshot.segmentTable,i),a=vd(e,r),o=fl(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!J(X(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o}else r=xd(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function xd(e,t,n){let r=X(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:El(Dl(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,ul()),wd(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function Sd(e,t,n){let r=eu(e.snapshot.segmentTable,n),i=vd(e,t);if(fl(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${Ud(e,t,n)}"`);let a=X(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:El(Dl(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),wd(e,t,o),e.activeNodeCount++,o}function Cd(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];o==null||Ed(e,n,o)<0?i=a:r=a+1}return r}function wd(e,t,n){let r=vd(e,t),i=X(e,n);fl(e.snapshot.nodes,r).set(i.nameId,n),_l(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=Cd(e,r,n);r.childIds.splice(a,0,n),hl(r,a),bl(e.snapshot.nodes,r)}function Td(e,t,n,r){let i=vd(e,t),a=pl(i),o=a.get(n)??-1;fl(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&_l(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),hl(i,o),bl(e.snapshot.nodes,i))}function Ed(e,t,n){let r=e.snapshot.options.sort;return r==="default"?Dd(e,t,n):r(Od(e,t),Od(e,n))}function Dd(e,t,n){let r=X(e,t),i=X(e,n),a=J(r);if(a!==J(i))return a?-1:1;let o=Vl(Jl(e.snapshot.segmentTable,r.nameId),Jl(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=tu(e.snapshot.segmentTable,r.nameId),c=tu(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function Od(e,t){let n=X(e,t),r=fd(e,t),i=J(n),a=i?r.slice(0,-1):r;return{basename:tu(e.snapshot.segmentTable,n.nameId),depth:Dl(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function kd(e,t,n){let r=X(e,t),i=gd(e,n);if(i!=null){let t=X(e,i);if(J(t))return{basename:tu(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=Ql(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=Ql(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:_d(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function Ad(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${fd(e,t)}"`);let i=X(e,t);if(Ol(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(J(i)&&vd(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return jd(e,t),Td(e,a,t,o),Md(e,a),pd(e,a),`handled`}function jd(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=X(e,t.nodeId);if(t.visitedChildren||!J(i)){J(i)&&e.snapshot.directories.delete(t.nodeId),jl(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),Mu(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=vd(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 Md(e,t){let n=t;for(;n!=null;){let t=X(e,n);if(!J(t)||Al(t,2)||vd(e,n).childIds.length>0)return;jl(t,1),n=t.parentId===n?null:t.parentId}}function Nd(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=fl(e.snapshot.nodes,vd(e,n)).get(t);if(i==null||!J(X(e,i)))break;n=i}return n}function Pd(e,t){let n=Ld(e,t);if(n==null)return null;let r=id(e,n),i=X(e,r),a=n===r?null:ad(e,n).map(t=>fd(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:vd(e,r).childIds.length>0,path:fd(e,r),terminalKind:Ol(i)})}function Fd(e,t){return Id([e],[t])}function Id(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 Ld(e,t){let n=t;for(;n!=null;){let t=X(e,n);if(!J(t)||Al(t,2))return null;if(!Cu(e,n,t))return n;n=t.parentId}return null}function Rd(e,t){let n=X(e,t);if(Ml(n,(t===e.snapshot.rootId?-1:Dl(X(e,n.parentId)))+1),!J(n))return;let r=vd(e,t);for(let t of r.childIds)Rd(e,t)}function zd(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=X(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function Bd(e,t,n=X(e,t),r=!1){let i=e.instrumentation;i==null?Hd(e,t,n,r):Y(i,`store.recomputeNodeCounts`,()=>Hd(e,t,n,r))}function Vd(e,t){let n=t;for(;n!=null;){let t=X(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(Bd(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&_l(vd(e,s),n,a,o),n=s}}function Hd(e,t,n,r){if(!J(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=vd(e,t);if(r){let t=e.instrumentation;t==null?gl(e.snapshot.nodes,i):Y(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>gl(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;n.subtreeNodeCount=a,n.visibleSubtreeCount=Al(n,2)?o:rd(e,t)==null?Cu(e,t,n)?1+o:1:o}function Ud(e,t,n){let r=fd(e,t);return r.length===0?n:`${r}${n}`}function Wd(e){return e!=null&&!Al(e,4)}function Gd(e,t){let n=e.snapshot.nodes[t];return!Wd(n)||!J(n)||Al(n,2)?null:n}function Kd(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&Wd(e.snapshot.nodes[n])&&(t+=1);return t}function qd(e){return Math.max(0,e.valueById.length-1)}function Jd(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:Kd(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:qd(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function Yd(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 Xd(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)Gd(e,n)!=null&&t.push(fd(e,n));for(let t of e.expandedDirectoryIds)Gd(e,t)!=null&&n.push(fd(e,t));return{collapsedPaths:t,expandedPaths:n}}function Zd(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)Gd(e,n)!=null&&Eu(e,n)!==`loaded`&&t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:fd(e,n)});return t}function Qd(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=gd(e,n);t!=null&&wu(e,t,!0,X(e,t))}for(let n of t.collapsedPaths){let t=gd(e,n);t!=null&&wu(e,t,!1,X(e,t))}}function $d(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=gd(e,n.path);t!=null&&Gd(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function ef(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function tf(e){let t=e.snapshot.segmentTable,n=$l();for(let r of e.snapshot.nodes)Wd(r)&&(r.nameId=Al(r,2)?0:eu(n,tu(t,r.nameId)));e.snapshot.segmentTable=n}function nf(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!Wd(r)||!J(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return Wd(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[X(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),gl(e.snapshot.nodes,n)}}function rf(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(Wd(n))break;--t}e.snapshot.nodes.length=t+1}function af(e){let t=Xd(e),n=Zd(e);Y(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>ef(e)),Y(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>tf(e)),Y(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>nf(e)),Y(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>rf(e)),Y(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>Qd(e,t)),Y(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>$d(e,n)),Y(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>md(e,e.snapshot.rootId))}function of(e){let t=Xd(e),n=Zd(e),r=Y(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>od(e)),i=Pl({...e.snapshot.options},e.instrumentation),a=Y(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new vu(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,Y(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>Qd(e,t)),Y(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>$d(e,n)),Y(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>md(e,e.snapshot.rootId))}function sf(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function cf(e,t){let n=Jd(e);t===`stable`?Y(e.instrumentation,`store.cleanup.stable`,()=>af(e)):Y(e.instrumentation,`store.cleanup.aggressive`,()=>of(e));let r=Jd(e);return Yd(t,t===`stable`,n,r)}var lf=64;function uf(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 df(e){return X(e,e.snapshot.rootId).visibleSubtreeCount}function ff(e,t,n,r){let i=X(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function pf(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:Mf(e,t.cursor),setSize:t.setSize,subtreeEndIndex:ff(e,t.cursor,t.index,n)}}function mf(e,t,n,r,i,a){let o=vd(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=vl(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return hf(e,u,l,r+c,i+1,s,o.childIds.length,a)}function hf(e,t,n,r,i,a,o,s){if(!J(X(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=Ef(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=X(e,c.terminalNodeId);if(!J(l)||!Cu(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return mf(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function gf(e,t){let n=df(e);if(t<0||t>=n)return null;let r=mf(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>fd(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=pf(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:Mf(e,r.cursor),setSize:r.setSize,subtreeEndIndex:ff(e,r.cursor,r.index,n)}}function _f(e,t,n){let r=e.instrumentation,i=df(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 jf(e,o+1);let t=[],n=Cf(e,a);for(let r=a;r<=o&&n!=null;r++){let r=Mf(e,n);t.push(r),n=Of(e,n)}return t}let s=[],c=0,l=0,u=Y(r,`store.getVisibleSlice.selectFirstRow`,()=>Cf(e,a));for(let t=a;t<=o&&u!=null;t++){let t=Y(r,`store.getVisibleSlice.materializeRow`,()=>Mf(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=Y(r,`store.getVisibleSlice.advanceCursor`,()=>Of(e,u))}return Il(r,`workload.visibleRowsRead`,s.length),Il(r,`workload.flattenedRowsRead`,c),Il(r,`workload.flattenedSegmentsRead`,l),s}function vf(e,t=df(e)){let n=e.instrumentation;return n==null?Af(e,t):Y(n,`store.getVisibleTreeProjection`,()=>Af(e,t))}function yf(e){return kf(vf(e))}function bf(e,t){let n=gd(e,t);if(n==null||n===e.snapshot.rootId||J(X(e,n))&&id(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=X(e,i).parentId,n=vd(e,t),s=pl(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=yl(a,n,s),t!==o){let n=X(e,t),a=rd(e,t);if(!Cu(e,t,n)&&a!==i)return null;id(e,t)===t&&(r+=1)}i=t}return r}function xf(e,t){let n=gd(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=X(e,n);if(!J(r))throw Error(`Path is not a directory: "${t}"`);return Cu(e,n,r)?null:(wu(e,n,!0,r),pd(e,n),Lu({affectedAncestorIds:hd(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function Sf(e,t){let n=gd(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=X(e,n);if(!J(r))throw Error(`Path is not a directory: "${t}"`);return Cu(e,n,r)?(wu(e,n,!1,r),pd(e,n),Ru({affectedAncestorIds:hd(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function Cf(e,t){return t<0||t>=df(e)?null:wf(e,e.snapshot.rootId,t,-1)}function wf(e,t,n,r){let i=vd(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?vl(e.snapshot.nodes,i,n):Y(a,`store.getVisibleSlice.selectChildIndex`,()=>vl(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return Tf(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function Tf(e,t,n,r){if(!J(X(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=Ef(e,t,r);if(n===0)return i;let a=X(e,i.terminalNodeId);if(!J(a)||!Cu(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return wf(e,i.terminalNodeId,n-1,i.visibleDepth)}function Ef(e,t,n){return J(X(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:id(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:Y(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>id(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function Df(e,t){let n=X(e,t);if(!J(n))return!0;let r=n.parentId;return r===e.snapshot.rootId||rd(e,r)!==t}function Of(e,t){let n=X(e,t.terminalNodeId);if(J(n)){let r=vd(e,t.terminalNodeId);if(Cu(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:Tf(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=X(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=vd(e,n),o=pl(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 Tf(e,s,0,i);Df(e,r)&&i--,r=n}}function kf(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 Af(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(lf);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=uf(o,y);let x,S=_;if(J(v))S=f?id(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:fd(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&&J(C)&&Cu(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 jf(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(!J(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:fd(e,f)};continue}let h=l?id(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=Mf(e,g);let _=i[h];_!=null&&J(_)&&Cu(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function Mf(e,t){let n=X(e,t.terminalNodeId),r=J(n)?Nf(e,t):null,i=fd(e,t.terminalNodeId),a=tu(e.snapshot.segmentTable,n.nameId),o=J(n)&&vd(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?ad(e,t.headNodeId).map(n=>{let r=X(e,n);return{isTerminal:n===t.terminalNodeId,name:tu(e.snapshot.segmentTable,r.nameId),nodeId:n,path:fd(e,n)}}):Y(c,`store.getVisibleSlice.flatten.collectSegments`,()=>ad(e,t.headNodeId).map(n=>{let r=X(e,n);return{isTerminal:n===t.terminalNodeId,name:tu(e.snapshot.segmentTable,r.nameId),nodeId:n,path:fd(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:J(n)&&Cu(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:J(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function Nf(e,t){if(t.headNodeId===t.terminalNodeId)return Eu(e,t.terminalNodeId);let n=ad(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=Eu(e,t);if(n===`loading`)return`loading`;n===`error`?i=!0:n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}var Pf=8;function Ff(e){let{nodes:t,directories:n,rootId:r,options:i}=e,a=t.length,o=new Int32Array(a),s=new Int32Array(a),c=new Int32Array(a),l=new Int32Array(a),u=new Int32Array(a),d=new Int32Array(a),f=new Int32Array(a);for(let e=0;e<a;e+=1){let n=t[e];n!=null&&(o[e]=n.parentId,s[e]=n.nameId,c[e]=n.depthAndFlags,l[e]=n.subtreeNodeCount,u[e]=n.visibleSubtreeCount)}let p=0;for(let e of n.values())p+=e.childIds.length;let m=new Int32Array(p),h=0;for(let[e,t]of n){let n=t.childIds;d[e]=h,f[e]=n.length;for(let e=0;e<n.length;e+=1)m[h]=n[e],h+=1}return{nodeCount:a,rootId:r,flattenEmptyDirectories:i.flattenEmptyDirectories===!0,parentId:o,nameId:s,depthAndFlags:c,subtreeNodeCount:l,visibleSubtreeCount:u,childStart:d,childCount:f,childIdsFlat:m}}function If(e){let{nodeCount:t,rootId:n,flattenEmptyDirectories:r,depthAndFlags:i,subtreeNodeCount:a,visibleSubtreeCount:o,childStart:s,childCount:c,childIdsFlat:l}=e;for(let e=t-1;e>=1;--e){if((i[e]&Pf)===0)continue;let t=s[e],n=c[e],u=0,d=0;for(let e=0;e<n;e+=1){let n=l[t+e];u+=a[n],d+=o[n]}a[e]=1+u;let f;f=r&&n===1?(i[l[t]]&Pf)===0?1+d:d:1+d,o[e]=f}let u=s[n],d=c[n],f=0,p=0;for(let e=0;e<d;e+=1){let t=l[u+e];f+=a[t],p+=o[t]}a[n]=1+f,o[n]=p}function Lf(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||!J(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&&bl(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&J(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,bl(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function Rf(e){let{directories:t,nodes:n,rootId:r}=e.snapshot,i=Ff(e.snapshot);If(i);let a=i.subtreeNodeCount,o=i.visibleSubtreeCount;for(let e=0;e<n.length;e+=1){let t=n[e];t!=null&&(t.subtreeNodeCount=a[e],t.visibleSubtreeCount=o[e])}for(let[e,i]of t){let t=i.childIds,a=t.length,o=0,s=0;for(let e=0;e<a;e++){let r=t[e];if(r==null)continue;let i=n[r];o+=i.subtreeNodeCount,s+=i.visibleSubtreeCount}i.totalChildSubtreeNodeCount=o,i.totalChildVisibleSubtreeCount=s,(e===r||a>=128)&&bl(n,i)}}function zf(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var Bf=class e{#e;constructor(e={}){let t=Fl(e),n=Y(t,`store.builder.create`,()=>new vu(e));if(e.preparedInput!=null){let t=hu(e.preparedInput);t==null?n.appendPreparedPaths(mu(e.preparedInput),!1):n.appendPresortedPaths(t,gu(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(Y(t,`store.preparePathEntries`,()=>_u(r,e)))}let r=Y(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=Y(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=Y(t,`store.state.create`,()=>yu(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:Y(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||zf(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&Y(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?e.useSoaCountSweep===!0?Y(t,`store.state.initializeOpenVisibleCountsViaSoa`,()=>Rf(this.#e)):Y(t,`store.state.initializeOpenVisibleCounts`,()=>Lf(this.#e)):Y(t,`store.state.recomputeCounts`,()=>md(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return du(e,t)}static prepareInput(e,t={}){return fu(e,t)}static preparePresortedInput(e){return pu(e)}list(e){return Y(this.#e.instrumentation,`store.list`,()=>od(this.#e,e))}add(e){Y(this.#e.instrumentation,`store.add`,()=>{let t=df(this.#e);qu(this.#e,Gu(this.#e,t,sd(this.#e,e)))})}remove(e,t={}){Y(this.#e.instrumentation,`store.remove`,()=>{let n=df(this.#e);qu(this.#e,Gu(this.#e,n,cd(this.#e,e,t)))})}move(e,t,n={}){Y(this.#e.instrumentation,`store.move`,()=>{let r=df(this.#e),i=ld(this.#e,e,t,n);i!=null&&qu(this.#e,Gu(this.#e,r,i))})}batch(e){Ku(this.#e,()=>{if(typeof e==`function`)e(this);else 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})}})}getVisibleCount(){return Y(this.#e.instrumentation,`store.getVisibleCount`,()=>df(this.#e))}getVisibleSlice(e,t){return Y(this.#e.instrumentation,`store.getVisibleSlice`,()=>_f(this.#e,e,t))}getVisibleRowContext(e){return Y(this.#e.instrumentation,`store.getVisibleRowContext`,()=>gf(this.#e,e))}getVisibleTreeProjection(){return yf(this.#e)}getVisibleTreeProjectionData(e){return vf(this.#e,e)}getVisibleIndex(e){return Y(this.#e.instrumentation,`store.getVisibleIndex`,()=>bf(this.#e,e))}getPathInfo(e){return Y(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=gd(this.#e,e);if(t==null)return null;let n=X(this.#e,t);return{depth:Dl(n),kind:J(n)?`directory`:`file`,path:fd(this.#e,t)}})}isExpanded(e){return Y(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=X(this.#e,t);return Cu(this.#e,t,n)})}expand(e){Y(this.#e.instrumentation,`store.expand`,()=>{let t=df(this.#e),n=xf(this.#e,e);n!=null&&qu(this.#e,Gu(this.#e,t,n))})}collapse(e){Y(this.#e.instrumentation,`store.collapse`,()=>{let t=df(this.#e),n=Sf(this.#e,e);n!=null&&qu(this.#e,Gu(this.#e,t,n))})}on(e,t){return Nu(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return Eu(this.#e,t)}markDirectoryUnloaded(e){Y(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(vd(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=df(this.#e);Ou(this.#e,t),qu(this.#e,Gu(this.#e,n,zu({affectedAncestorIds:hd(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return Y(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=df(this.#e),r=Du(this.#e,t);return qu(this.#e,Gu(this.#e,n,Bu({affectedAncestorIds:hd(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return Y(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||Eu(this.#e,n)!==`loading`||!Au(this.#e,n,e.attemptId))return!1;let r=fd(this.#e,n);this.validateChildPatch(r,t);let i=df(this.#e),a=[];for(let e of t.operations){Vf(r,e);let t=df(this.#e);switch(e.type){case`add`:a.push(Gu(this.#e,t,sd(this.#e,e.path)));break;case`remove`:a.push(Gu(this.#e,t,cd(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=ld(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(Gu(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return qu(this.#e,Gu(this.#e,i,Vu({affectedAncestorIds:hd(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:fd(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return Y(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=df(this.#e),r=ku(this.#e,t,e.attemptId);return qu(this.#e,Gu(this.#e,n,Hu({affectedAncestorIds:hd(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:fd(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return Y(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=df(this.#e),i=ju(this.#e,n,e.attemptId,t);return qu(this.#e,Gu(this.#e,r,Uu({affectedAncestorIds:hd(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:fd(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return Y(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(sf(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=df(this.#e),n=cf(this.#e,e.mode??`stable`);return qu(this.#e,Gu(this.#e,t,Wu({...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=vd(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??zl(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=Vl(Jl(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||!J(X(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;else for(let e=d;e<m;e+=1){let n=r[e];if(n==null)continue;let i=X(this.#e,n);Cu(this.#e,n,i)||(wu(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=X(this.#e,e);if(!Cu(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=gd(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!J(X(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!J(X(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=X(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=X(this.#e,e),r=rd(this.#e,e);if(!Cu(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 Vf(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}"`)}}var Hf={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function Uf(e,t){if(typeof e==`number`)return{itemHeight:t??Hf.default.itemHeight,factor:e};let n=Hf[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var Wf=Hf.default.itemHeight,Gf=`@layer base {
168
+ </symbol>`],Pc=[Fs,Is,Rs,zs,Bs,Vs,Us,Js,Ys,$s,oc,sc,cc,lc,uc,fc,hc,gc,_c,vc,yc,Sc,Cc,Ec,Dc,Oc,kc,Ac,jc,Mc];function Fc(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
169
+ `)}\n</svg>`)}var Ic=Fc(Ps,Nc),Lc={minimal:Ps,standard:Ic,complete:Fc(Ic,Pc)},Rc={".babelrc":`babel`,".babelrc.json":`babel`,".bash_profile":`bash`,".bashrc":`bash`,".browserslistrc":`browserslist`,".dockerignore":`docker`,".eslintignore":`eslint`,".eslintrc":`eslint`,".eslintrc.cjs":`eslint`,".eslintrc.js":`eslint`,".eslintrc.json":`eslint`,".eslintrc.yaml":`eslint`,".eslintrc.yml":`eslint`,".gitattributes":`git`,".gitignore":`git`,".gitkeep":`git`,".gitmodules":`git`,".oxlintrc.json":`oxc`,".postcssrc":`postcss`,".postcssrc.json":`postcss`,".postcssrc.yaml":`postcss`,".postcssrc.yml":`postcss`,".prettierignore":`prettier`,".prettierrc":`prettier`,".prettierrc.cjs":`prettier`,".prettierrc.js":`prettier`,".prettierrc.json":`prettier`,".prettierrc.mjs":`prettier`,".prettierrc.toml":`prettier`,".prettierrc.yaml":`prettier`,".prettierrc.yml":`prettier`,".stylelintignore":`stylelint`,".stylelintrc":`stylelint`,".stylelintrc.cjs":`stylelint`,".stylelintrc.js":`stylelint`,".stylelintrc.json":`stylelint`,".stylelintrc.mjs":`stylelint`,".stylelintrc.yaml":`stylelint`,".stylelintrc.yml":`stylelint`,".terraform.lock.hcl":`terraform`,".zprofile":`bash`,".zshenv":`bash`,".zshrc":`bash`,"babel.config.cjs":`babel`,"babel.config.js":`babel`,"babel.config.json":`babel`,"babel.config.mjs":`babel`,"biome.json":`biome`,"biome.jsonc":`biome`,"bootstrap.bundle.js":`bootstrap`,"bootstrap.bundle.min.js":`bootstrap`,"bootstrap.css":`bootstrap`,"bootstrap.js":`bootstrap`,"bootstrap.min.css":`bootstrap`,"bootstrap.min.js":`bootstrap`,"bun.lock":`bun`,"bun.lockb":`bun`,"bunfig.toml":`bun`,"claude.md":`claude`,"compose.yaml":`docker`,"compose.yml":`docker`,"docker-compose.override.yml":`docker`,"docker-compose.yaml":`docker`,"docker-compose.yml":`docker`,dockerfile:`docker`,"eslint.config.cjs":`eslint`,"eslint.config.js":`eslint`,"eslint.config.mjs":`eslint`,"eslint.config.mts":`eslint`,"eslint.config.ts":`eslint`,gemfile:`ruby`,"next.config.js":`nextjs`,"next.config.mjs":`nextjs`,"next.config.mts":`nextjs`,"next.config.ts":`nextjs`,"postcss.config.cjs":`postcss`,"postcss.config.js":`postcss`,"postcss.config.mjs":`postcss`,"postcss.config.ts":`postcss`,"prettier.config.cjs":`prettier`,"prettier.config.js":`prettier`,"prettier.config.mjs":`prettier`,rakefile:`ruby`,"readme.md":`markdown`,"stylelint.config.cjs":`stylelint`,"stylelint.config.js":`stylelint`,"stylelint.config.mjs":`stylelint`,"svgo.config.cjs":`svgo`,"svgo.config.js":`svgo`,"svgo.config.mjs":`svgo`,"svgo.config.ts":`svgo`,"tailwind.config.cjs":`tailwind`,"tailwind.config.js":`tailwind`,"tailwind.config.mjs":`tailwind`,"tailwind.config.ts":`tailwind`,"vite.config.js":`vite`,"vite.config.mjs":`vite`,"vite.config.mts":`vite`,"vite.config.ts":`vite`,"webpack.config.babel.js":`webpack`,"webpack.config.cjs":`webpack`,"webpack.config.js":`webpack`,"webpack.config.mjs":`webpack`,"webpack.config.ts":`webpack`},zc={"7z":`zip`,astro:`astro`,AUTHORS:`text`,avif:`image`,bash:`bash`,bmp:`image`,bz2:`zip`,c:`c`,cc:`cpp`,cfg:`text`,CHANGELOG:`text`,cjs:`javascript`,"code-workspace":`vscode`,conf:`text`,CONTRIBUTORS:`text`,cpp:`cpp`,csh:`bash`,css:`css`,csv:`table`,cts:`typescript`,cxx:`cpp`,db:`database`,editorconfig:`text`,env:`text`,"env.development":`text`,"env.local":`text`,"env.production":`text`,eot:`font`,erb:`ruby`,fish:`bash`,gemspec:`ruby`,gif:`image`,go:`go`,gql:`graphql`,graphql:`graphql`,gz:`zip`,h:`c`,hh:`cpp`,hpp:`cpp`,htm:`html`,html:`html`,hxx:`cpp`,icns:`image`,ico:`image`,ini:`text`,inl:`cpp`,jar:`zip`,jpeg:`image`,jpg:`image`,js:`javascript`,json:`json`,json5:`json`,jsonc:`json`,jsonl:`json`,jsx:`javascript`,ksh:`bash`,less:`css`,LICENSE:`text`,log:`text`,markdown:`markdown`,mcp:`mcp`,md:`markdown`,mdx:`markdown`,"mdx.tsx":`markdown`,mjs:`javascript`,mm:`cpp`,mts:`typescript`,ods:`table`,otf:`font`,png:`image`,postcss:`css`,py:`python`,pyi:`python`,pyw:`python`,pyx:`python`,rake:`ruby`,rar:`zip`,rb:`ruby`,rs:`rust`,rst:`text`,rtf:`text`,sass:`css`,scss:`css`,sh:`bash`,sql:`database`,sqlite:`database`,sqlite3:`database`,styl:`css`,svelte:`svelte`,svg:`svg`,swift:`swift`,tar:`zip`,tf:`terraform`,tfstate:`terraform`,tfvars:`terraform`,tgz:`zip`,tif:`image`,tiff:`image`,ts:`typescript`,tsv:`table`,tsx:`typescript`,ttf:`font`,txt:`text`,vue:`vue`,war:`zip`,wasm:`wasm`,wast:`wasm`,wat:`wasm`,webp:`image`,woff:`font`,woff2:`font`,xhtml:`html`,xls:`table`,xlsx:`table`,xz:`zip`,yaml:`yml`,yml:`yml`,zig:`zig`,zip:`zip`,zsh:`bash`},Bc={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},Vc=new Set([`bash`,`c`,`cpp`,`css`,`database`,`default`,`font`,`git`,`go`,`html`,`image`,`javascript`,`json`,`markdown`,`mcp`,`python`,`ruby`,`rust`,`swift`,`table`,`text`,`typescript`,`zip`]),Hc=new Set([`complete`]);function Uc(e){return Lc[e===`none`?`minimal`:e]}function Wc(e){return`file-tree-builtin-${e}`}function Gc(e){return e!==`none`&&Hc.has(e)}function Kc(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=Rc[t.toLowerCase()];if(i!=null&&(r||Vc.has(i)))return i;for(let e of n){if(r){let t=Bc[e];if(t!=null)return t}let t=zc[e];if(t!=null&&(r||Vc.has(t)))return t}return`default`}var qc=`file-tree-container`,Jc=`data-file-tree-style`,Yc=`data-file-tree-unsafe-css`,Xc=`data-file-tree-scrollbar-measure`,Zc=`data-file-tree-scrollbar-gutter-measured`,Qc=`--trees-scrollbar-gutter-measured`,$c=`header`,el=`context-menu`,tl=`context-menu-trigger`;function nl(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function rl(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(nl(e)?`none`:`complete`),colored:e.colored??!0}}var il=e=>e.trim().toLowerCase(),al=e=>e.split(`/`).at(-1)??e,ol=e=>{let t=e.toLowerCase().split(`.`),n=[];for(let e=1;e<t.length;e+=1)n.push(t.slice(e).join(`.`));return n};function sl(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function cl(e){let t=rl(e),n=t.remap,r=new Map;for(let[e,n]of Object.entries(t.byFileName??{}))r.set(e.toLowerCase(),n);let i=new Map;for(let[e,n]of Object.entries(t.byFileExtension??{}))i.set(il(e),n);let a=Object.entries(t.byFileNameContains??{}).map(([e,t])=>[e.toLowerCase(),t]);return{resolveIcon:(e,o)=>{if(e===`file-tree-icon-file`&&o!=null){let s=al(o),c=s.toLowerCase(),l=r.get(c);if(l!=null)return sl(l,e);for(let[t,n]of a)if(c.includes(t))return sl(n,e);let u=ol(s);for(let t of u){let n=i.get(t);if(n!=null)return sl(n,e)}let d=Kc(t.set,s,u);if(d!=null&&t.set!==`none`){if(d==="default"){let t=n?.[e];if(t!=null)return sl(t,e)}return{name:Wc(d),remappedFrom:e,token:d}}}let s=n?.[e];return s==null?{name:e}:sl(s,e)}}}var ll=5,ul=32,dl=128;function fl(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function pl(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function ml(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 hl(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 gl(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function _l(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 vl(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,Sl(e,t)}function yl(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=hl(e).get(t);if(i===void 0)return;let a=i>>ll;e.childVisibleChunkSums[a]+=r}function bl(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=Cl(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=ul}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 xl(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>ll;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<ll}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 Sl(e,t){if(t.childIds.length<dl){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/ul),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>>ll]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function Cl(e,t,n,r){let i=Math.min(t.childIds.length,n+ul),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 wl=7,Tl=3,El=8,Dl=4;function Ol(e,t,n=0){return e<<Dl|n<<Tl|t}function kl(e){return e.depthAndFlags>>>Dl}function Al(e){return(e.depthAndFlags&El)>>Tl}function J(e){return(e.depthAndFlags&El)!==0}function jl(e){return e.depthAndFlags&wl}function Ml(e,t){return(jl(e)&t)!==0}function Nl(e,t){e.depthAndFlags|=t}function Pl(e,t){e.depthAndFlags=Ol(t,jl(e),Al(e))}var Fl=Symbol(`benchmarkInstrumentation`);function Il(e,t){return t==null||Object.defineProperty(e,Fl,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function Ll(e){return e==null?null:e[Fl]??null}function Y(e,t,n){return e==null?n():e.measurePhase(t,n)}function Rl(e,t,n){Number.isFinite(n)&&e!=null&&e.setCounter(t,n)}function zl(e){return e>=48&&e<=57}function Bl(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!zl(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&&zl(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 Vl(e){let t=e.toLowerCase();return{lowerValue:t,tokens:Bl(t)}}function Hl(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 Ul(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=Hl(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function Wl(e,t,n){let r=Ul(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function Gl(e,t){return Wl(e,t,Vl)}function Kl(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function ql(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=Kl(e,r);return a===Kl(t,r)?Gl(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 Jl(e,t){return ql(e,t)}function Yl(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=Vl(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=Kl(e,n);return o===Kl(t,n)?Wl(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 Xl(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=Vl(r);return e.sortKeyById[t]=i,i}function Zl(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function Ql(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 $l(e){let{hasTrailingSlash:t,segments:n}=Ql(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function eu(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=Ql(e);return{requiresDirectory:t,segments:n}}function tu(){let e=new Map;return e.set(``,0),{idByValue:e,valueById:[``],sortKeyById:[Vl(``)]}}function nu(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 ru(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var iu=Symbol(`pathStorePreparedInputKind`);function au(e,t){return e[iu]=t,e}function ou(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function su(e,t,n){return n==="default"?Jl(e,t):n(ou(e),ou(t))}function cu(){return{depthAndFlags:Ol(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function lu(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 uu(e){return e.isDirectory?e.segments.length:e.segments.length-1}function du(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 fu(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function pu(e,t={}){return yu(e,t).map(e=>e.path)}function mu(e,t={}){let n=yu(e,t);return au({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function hu(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 au({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function gu(e){let t=e,n=t.preparedPaths;if(t[iu]===`prepared`&&n!=null)return n;if(!du(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function _u(e){let t=e;return t[iu]===`presorted`&&t.presortedPaths!=null||fu(t.presortedPaths)?t.presortedPaths:null}function vu(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function yu(e,t={}){let n=Zl(t),r=Ll(t);Rl(r,`workload.inputFiles`,e.length);let i=Y(r,`store.preparePathEntries.parse`,()=>e.map(e=>$l(e)));return Y(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>su(e,t,n.sort))),i}var bu=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[cu()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=tu();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=Ll(e),this.options=Zl(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,fl())}appendPaths(e){return Y(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>$l(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,Y(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return Y(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:Ol(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:Ol(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d,m=a+1}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:Ol(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=$l(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:Ol(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:Ol(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=$l(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(Y(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||Y(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"?Yl(this.lastPreparedPath,e,this.segmentSortKeyCache):su(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=uu(e),i=n==null?0:uu(n),a=n==null?0:lu(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=nu(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:Ol(kl(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),gl(i,s),s}createFileChildUnchecked(e,t){let n=nu(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:Ol(kl(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),gl(r,a),a}getOrCreateDirectoryChild(e,t){let n=nu(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&&!J(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:Ol(kl(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),gl(r,a),this.directories.set(a,fl()),a}createDirectoryChild(e,t){let n=nu(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:Ol(kl(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),gl(r,a),this.directories.set(a,fl()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!J(n))throw Error(`Path is not a directory: "${t}"`);if(Ml(n,1))throw Error(`Duplicate path: "${t}"`);Nl(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,pl());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(J(a)){let t=pl();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;J(n)&&this.directories.set(t,fl());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),gl(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!J(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 vl(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function xu(e,t=`closed`,n=null){let r=Cu(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 Su(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function Cu(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 wu(e,t){return Ml(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion!==`closed`&&kl(t)<=e.defaultExpansion}function Tu(e,t,n=e.snapshot.nodes[t]){return n==null||!J(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:wu(e,n)}function Eu(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!J(r))return;let i=wu(e,r);if(n){if(i){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t)}else i?(e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0):e.expandedDirectoryIds.delete(t)}function Du(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 Ou(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function ku(e,t){let n=Du(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 Au(e,t){let n=Du(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function ju(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 Mu(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function Nu(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 Pu(e,t){e.directoryLoadInfoById.delete(t)}function Fu(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 Iu(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Lu(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function Ru(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function zu(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Bu(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Vu(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Hu(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 Uu(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 Wu(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 Gu(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 Ku(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 qu(e,t,n){return{...n,visibleCountDelta:id(e)-t}}function Ju(e,t){let n=id(e),r=Su();e.transactionStack.push(r);try{t()}catch(t){throw Zu(e,r,!1),t}Zu(e,r,!0,id(e)-n)}function Yu(e,t){let n=e.instrumentation;n==null?Xu(e,t):Y(n,`store.events.record`,()=>Xu(e,t))}function Xu(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;n==null?nd(e,t):(n.events.push(t),td(n,t))}function Zu(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?ed(i,t):Y(n,`store.events.batch.merge`,()=>ed(i,t));return}let a=Qu(t,r),o=e.instrumentation;o==null?nd(e,a):Y(o,`store.events.batch.commit`,()=>nd(e,a))}function Qu(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 $u(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function ed(e,t){for(let n of t.events)e.events.push(n);$u(e,t)}function td(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function nd(e,t){let n=e.instrumentation;n==null?rd(e,t):Y(n,`store.events.emit`,()=>rd(e,t))}function rd(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function id(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function ad(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!J(n)||Ml(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||!J(a)?null:i}function od(e,t){let n=t;for(;;){let t=ad(e,n);if(t==null)return n;n=t}}function sd(e,t){let n=[t],r=t;for(;;){let t=ad(e,r);if(t==null)return n;n.push(t),r=t}}function cd(e,t){let n=t==null?e.snapshot.rootId:vd(e,t);return n==null?[]:xd(e,n)}function ld(e,t){let n=$l(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=Id(e,Fd(e,r)),{createdNodeIds:a,directoryId:o}=Sd(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=X(e,o);if(Ml(n,1))throw Error(`Path already exists: "${t}"`);Nl(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=wd(e,o,n.basename),s.add(c);hd(e,o);let l=Id(e,o);return Iu({affectedAncestorIds:_d(e,c),affectedNodeIds:[...s],path:t,projectionChanged:Ld(i,l)})}function ud(e,t,n){let r=vd(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=X(e,r);if(Ml(i,2))throw Error(`The root node cannot be removed`);if(J(i)&&bd(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=Id(e,a),s=Nd(e,r);Dd(e,a,r,i.nameId),Pd(e,a),hd(e,a);let c=Id(e,a);return Lu({affectedAncestorIds:_d(e,a),affectedNodeIds:s,path:t,projectionChanged:Ld(o,c),recursive:n.recursive===!0})}function dd(e,t,n,r){let i=vd(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=X(e,i);if(Ml(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=jd(e,i,n),c=Id(e,a.parentId),l=Id(e,s.parentId),u=ru(e.snapshot.segmentTable,a.nameId),d=nu(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(J(a)&&Vd(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=ml(e.snapshot.nodes,bd(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&Md(e,p,o,Al(a))===`skip`)return null;let m=a.parentId;Dd(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),Bd(e,i),Ed(e,s.parentId,i),Pd(e,m),e.pathCacheVersion++,hd(e,m),s.parentId!==m&&hd(e,s.parentId);let h=Id(e,m),g=Id(e,s.parentId);return Ru({affectedAncestorIds:[...new Set([..._d(e,m),..._d(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:Rd([c,l],[h,g]),to:md(e,i)})}function fd(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function pd(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function md(e,t){let n=X(e,t),r=fd(e,t);if(r!=null)return r;if(Ml(n,2))return pd(e,t,``);let i=md(e,n.parentId),a=ru(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return pd(e,t,J(n)?`${o}/`:o)}function hd(e,t){let n=e.instrumentation;n==null?Ud(e,t):Y(n,`store.recomputeCountsUpwardFrom`,()=>Ud(e,t))}function gd(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||!J(o)){Hd(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){Hd(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function _d(e,t){let n=[],r=t;for(;r!=null;){let t=X(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function vd(e,t){if(t.length===0)return e.snapshot.rootId;let n=eu(t);return yd(e,n.segments,n.requiresDirectory)}function yd(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=bd(e,r),a=ml(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=X(e,r);return n&&!J(i)?null:r}function bd(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 X(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Ml(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function xd(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Ml(n,4))return[];if(!J(n))return[md(e,t)];if(bd(e,t).childIds.length===0)return Ml(n,1)&&!Ml(n,2)?[md(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||Ml(n,4)){i.pop();continue}if(!J(n)){r.push(md(e,t.nodeId)),i.pop();continue}let a=bd(e,t.nodeId);if(a.childIds.length===0){Ml(n,1)&&!Ml(n,2)&&r.push(md(e,t.nodeId)),i.pop();continue}let o=a.childIds[t.childIndex];o==null?i.pop():(t.childIndex++,i.push({childIndex:0,nodeId:o}))}return r}function Sd(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=nu(e.snapshot.segmentTable,i),a=bd(e,r),o=ml(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!J(X(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o}else r=Cd(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function Cd(e,t,n){let r=X(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Ol(kl(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,fl()),Ed(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function wd(e,t,n){let r=nu(e.snapshot.segmentTable,n),i=bd(e,t);if(ml(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${Gd(e,t,n)}"`);let a=X(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Ol(kl(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),Ed(e,t,o),e.activeNodeCount++,o}function Td(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];o==null||Od(e,n,o)<0?i=a:r=a+1}return r}function Ed(e,t,n){let r=bd(e,t),i=X(e,n);ml(e.snapshot.nodes,r).set(i.nameId,n),yl(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=Td(e,r,n);r.childIds.splice(a,0,n),_l(r,a),Sl(e.snapshot.nodes,r)}function Dd(e,t,n,r){let i=bd(e,t),a=hl(i),o=a.get(n)??-1;ml(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&yl(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),_l(i,o),Sl(e.snapshot.nodes,i))}function Od(e,t,n){let r=e.snapshot.options.sort;return r==="default"?kd(e,t,n):r(Ad(e,t),Ad(e,n))}function kd(e,t,n){let r=X(e,t),i=X(e,n),a=J(r);if(a!==J(i))return a?-1:1;let o=Ul(Xl(e.snapshot.segmentTable,r.nameId),Xl(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=ru(e.snapshot.segmentTable,r.nameId),c=ru(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function Ad(e,t){let n=X(e,t),r=md(e,t),i=J(n),a=i?r.slice(0,-1):r;return{basename:ru(e.snapshot.segmentTable,n.nameId),depth:kl(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function jd(e,t,n){let r=X(e,t),i=vd(e,n);if(i!=null){let t=X(e,i);if(J(t))return{basename:ru(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=eu(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=eu(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:yd(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function Md(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${md(e,t)}"`);let i=X(e,t);if(Al(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(J(i)&&bd(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return Nd(e,t),Dd(e,a,t,o),Pd(e,a),hd(e,a),`handled`}function Nd(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=X(e,t.nodeId);if(t.visitedChildren||!J(i)){J(i)&&e.snapshot.directories.delete(t.nodeId),Nl(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),Pu(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=bd(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 Pd(e,t){let n=t;for(;n!=null;){let t=X(e,n);if(!J(t)||Ml(t,2)||bd(e,n).childIds.length>0)return;Nl(t,1),n=t.parentId===n?null:t.parentId}}function Fd(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=ml(e.snapshot.nodes,bd(e,n)).get(t);if(i==null||!J(X(e,i)))break;n=i}return n}function Id(e,t){let n=zd(e,t);if(n==null)return null;let r=od(e,n),i=X(e,r),a=n===r?null:sd(e,n).map(t=>md(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:bd(e,r).childIds.length>0,path:md(e,r),terminalKind:Al(i)})}function Ld(e,t){return Rd([e],[t])}function Rd(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 zd(e,t){let n=t;for(;n!=null;){let t=X(e,n);if(!J(t)||Ml(t,2))return null;if(!Tu(e,n,t))return n;n=t.parentId}return null}function Bd(e,t){let n=X(e,t);if(Pl(n,(t===e.snapshot.rootId?-1:kl(X(e,n.parentId)))+1),!J(n))return;let r=bd(e,t);for(let t of r.childIds)Bd(e,t)}function Vd(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=X(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function Hd(e,t,n=X(e,t),r=!1){let i=e.instrumentation;i==null?Wd(e,t,n,r):Y(i,`store.recomputeNodeCounts`,()=>Wd(e,t,n,r))}function Ud(e,t){let n=t;for(;n!=null;){let t=X(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(Hd(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&yl(bd(e,s),n,a,o),n=s}}function Wd(e,t,n,r){if(!J(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=bd(e,t);if(r){let t=e.instrumentation;t==null?vl(e.snapshot.nodes,i):Y(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>vl(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;n.subtreeNodeCount=a,n.visibleSubtreeCount=Ml(n,2)?o:ad(e,t)==null?Tu(e,t,n)?1+o:1:o}function Gd(e,t,n){let r=md(e,t);return r.length===0?n:`${r}${n}`}function Kd(e){return e!=null&&!Ml(e,4)}function qd(e,t){let n=e.snapshot.nodes[t];return!Kd(n)||!J(n)||Ml(n,2)?null:n}function Jd(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&Kd(e.snapshot.nodes[n])&&(t+=1);return t}function Yd(e){return Math.max(0,e.valueById.length-1)}function Xd(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:Jd(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:Yd(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function Zd(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 Qd(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)qd(e,n)!=null&&t.push(md(e,n));for(let t of e.expandedDirectoryIds)qd(e,t)!=null&&n.push(md(e,t));return{collapsedPaths:t,expandedPaths:n}}function $d(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)qd(e,n)!=null&&Ou(e,n)!==`loaded`&&t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:md(e,n)});return t}function ef(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=vd(e,n);t!=null&&Eu(e,t,!0,X(e,t))}for(let n of t.collapsedPaths){let t=vd(e,n);t!=null&&Eu(e,t,!1,X(e,t))}}function tf(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=vd(e,n.path);t!=null&&qd(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function nf(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function rf(e){let t=e.snapshot.segmentTable,n=tu();for(let r of e.snapshot.nodes)Kd(r)&&(r.nameId=Ml(r,2)?0:nu(n,ru(t,r.nameId)));e.snapshot.segmentTable=n}function af(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!Kd(r)||!J(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return Kd(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[X(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),vl(e.snapshot.nodes,n)}}function of(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(Kd(n))break;--t}e.snapshot.nodes.length=t+1}function sf(e){let t=Qd(e),n=$d(e);Y(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>nf(e)),Y(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>rf(e)),Y(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>af(e)),Y(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>of(e)),Y(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>ef(e,t)),Y(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>tf(e,n)),Y(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>gd(e,e.snapshot.rootId))}function cf(e){let t=Qd(e),n=$d(e),r=Y(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>cd(e)),i=Il({...e.snapshot.options},e.instrumentation),a=Y(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new bu(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,Y(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>ef(e,t)),Y(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>tf(e,n)),Y(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>gd(e,e.snapshot.rootId))}function lf(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function uf(e,t){let n=Xd(e);t===`stable`?Y(e.instrumentation,`store.cleanup.stable`,()=>sf(e)):Y(e.instrumentation,`store.cleanup.aggressive`,()=>cf(e));let r=Xd(e);return Zd(t,t===`stable`,n,r)}var df=64;function ff(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 pf(e){return X(e,e.snapshot.rootId).visibleSubtreeCount}function mf(e,t,n,r){let i=X(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function hf(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:Pf(e,t.cursor),setSize:t.setSize,subtreeEndIndex:mf(e,t.cursor,t.index,n)}}function gf(e,t,n,r,i,a){let o=bd(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=bl(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return _f(e,u,l,r+c,i+1,s,o.childIds.length,a)}function _f(e,t,n,r,i,a,o,s){if(!J(X(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=Of(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=X(e,c.terminalNodeId);if(!J(l)||!Tu(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return gf(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function vf(e,t){let n=pf(e);if(t<0||t>=n)return null;let r=gf(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>md(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=hf(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:Pf(e,r.cursor),setSize:r.setSize,subtreeEndIndex:mf(e,r.cursor,r.index,n)}}function yf(e,t,n){let r=e.instrumentation,i=pf(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 Nf(e,o+1);let t=[],n=Tf(e,a);for(let r=a;r<=o&&n!=null;r++){let r=Pf(e,n);t.push(r),n=Af(e,n)}return t}let s=[],c=0,l=0,u=Y(r,`store.getVisibleSlice.selectFirstRow`,()=>Tf(e,a));for(let t=a;t<=o&&u!=null;t++){let t=Y(r,`store.getVisibleSlice.materializeRow`,()=>Pf(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=Y(r,`store.getVisibleSlice.advanceCursor`,()=>Af(e,u))}return Rl(r,`workload.visibleRowsRead`,s.length),Rl(r,`workload.flattenedRowsRead`,c),Rl(r,`workload.flattenedSegmentsRead`,l),s}function bf(e,t=pf(e)){let n=e.instrumentation;return n==null?Mf(e,t):Y(n,`store.getVisibleTreeProjection`,()=>Mf(e,t))}function xf(e){return jf(bf(e))}function Sf(e,t){let n=vd(e,t);if(n==null||n===e.snapshot.rootId||J(X(e,n))&&od(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=X(e,i).parentId,n=bd(e,t),s=hl(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=xl(a,n,s),t!==o){let n=X(e,t),a=ad(e,t);if(!Tu(e,t,n)&&a!==i)return null;od(e,t)===t&&(r+=1)}i=t}return r}function Cf(e,t){let n=vd(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=X(e,n);if(!J(r))throw Error(`Path is not a directory: "${t}"`);return Tu(e,n,r)?null:(Eu(e,n,!0,r),hd(e,n),zu({affectedAncestorIds:_d(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function wf(e,t){let n=vd(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=X(e,n);if(!J(r))throw Error(`Path is not a directory: "${t}"`);return Tu(e,n,r)?(Eu(e,n,!1,r),hd(e,n),Bu({affectedAncestorIds:_d(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function Tf(e,t){return t<0||t>=pf(e)?null:Ef(e,e.snapshot.rootId,t,-1)}function Ef(e,t,n,r){let i=bd(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?bl(e.snapshot.nodes,i,n):Y(a,`store.getVisibleSlice.selectChildIndex`,()=>bl(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return Df(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function Df(e,t,n,r){if(!J(X(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=Of(e,t,r);if(n===0)return i;let a=X(e,i.terminalNodeId);if(!J(a)||!Tu(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return Ef(e,i.terminalNodeId,n-1,i.visibleDepth)}function Of(e,t,n){return J(X(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:od(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:Y(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>od(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function kf(e,t){let n=X(e,t);if(!J(n))return!0;let r=n.parentId;return r===e.snapshot.rootId||ad(e,r)!==t}function Af(e,t){let n=X(e,t.terminalNodeId);if(J(n)){let r=bd(e,t.terminalNodeId);if(Tu(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:Df(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=X(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=bd(e,n),o=hl(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 Df(e,s,0,i);kf(e,r)&&i--,r=n}}function jf(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 Mf(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(df);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=ff(o,y);let x,S=_;if(J(v))S=f?od(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:md(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&&J(C)&&Tu(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 Nf(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(!J(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:md(e,f)};continue}let h=l?od(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=Pf(e,g);let _=i[h];_!=null&&J(_)&&Tu(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function Pf(e,t){let n=X(e,t.terminalNodeId),r=J(n)?Ff(e,t):null,i=md(e,t.terminalNodeId),a=ru(e.snapshot.segmentTable,n.nameId),o=J(n)&&bd(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?sd(e,t.headNodeId).map(n=>{let r=X(e,n);return{isTerminal:n===t.terminalNodeId,name:ru(e.snapshot.segmentTable,r.nameId),nodeId:n,path:md(e,n)}}):Y(c,`store.getVisibleSlice.flatten.collectSegments`,()=>sd(e,t.headNodeId).map(n=>{let r=X(e,n);return{isTerminal:n===t.terminalNodeId,name:ru(e.snapshot.segmentTable,r.nameId),nodeId:n,path:md(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:J(n)&&Tu(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:J(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function Ff(e,t){if(t.headNodeId===t.terminalNodeId)return Ou(e,t.terminalNodeId);let n=sd(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=Ou(e,t);if(n===`loading`)return`loading`;n===`error`?i=!0:n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}var If=8;function Lf(e){let{nodes:t,directories:n,rootId:r,options:i}=e,a=t.length,o=new Int32Array(a),s=new Int32Array(a),c=new Int32Array(a),l=new Int32Array(a),u=new Int32Array(a),d=new Int32Array(a),f=new Int32Array(a);for(let e=0;e<a;e+=1){let n=t[e];n!=null&&(o[e]=n.parentId,s[e]=n.nameId,c[e]=n.depthAndFlags,l[e]=n.subtreeNodeCount,u[e]=n.visibleSubtreeCount)}let p=0;for(let e of n.values())p+=e.childIds.length;let m=new Int32Array(p),h=0;for(let[e,t]of n){let n=t.childIds;d[e]=h,f[e]=n.length;for(let e=0;e<n.length;e+=1)m[h]=n[e],h+=1}return{nodeCount:a,rootId:r,flattenEmptyDirectories:i.flattenEmptyDirectories===!0,parentId:o,nameId:s,depthAndFlags:c,subtreeNodeCount:l,visibleSubtreeCount:u,childStart:d,childCount:f,childIdsFlat:m}}function Rf(e){let{nodeCount:t,rootId:n,flattenEmptyDirectories:r,depthAndFlags:i,subtreeNodeCount:a,visibleSubtreeCount:o,childStart:s,childCount:c,childIdsFlat:l}=e;for(let e=t-1;e>=1;--e){if((i[e]&If)===0)continue;let t=s[e],n=c[e],u=0,d=0;for(let e=0;e<n;e+=1){let n=l[t+e];u+=a[n],d+=o[n]}a[e]=1+u;let f;f=r&&n===1?(i[l[t]]&If)===0?1+d:d:1+d,o[e]=f}let u=s[n],d=c[n],f=0,p=0;for(let e=0;e<d;e+=1){let t=l[u+e];f+=a[t],p+=o[t]}a[n]=1+f,o[n]=p}function zf(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||!J(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&&Sl(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&J(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,Sl(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function Bf(e){let{directories:t,nodes:n,rootId:r}=e.snapshot,i=Lf(e.snapshot);Rf(i);let a=i.subtreeNodeCount,o=i.visibleSubtreeCount;for(let e=0;e<n.length;e+=1){let t=n[e];t!=null&&(t.subtreeNodeCount=a[e],t.visibleSubtreeCount=o[e])}for(let[e,i]of t){let t=i.childIds,a=t.length,o=0,s=0;for(let e=0;e<a;e++){let r=t[e];if(r==null)continue;let i=n[r];o+=i.subtreeNodeCount,s+=i.visibleSubtreeCount}i.totalChildSubtreeNodeCount=o,i.totalChildVisibleSubtreeCount=s,(e===r||a>=128)&&Sl(n,i)}}function Vf(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var Hf=class e{#e;constructor(e={}){let t=Ll(e),n=Y(t,`store.builder.create`,()=>new bu(e));if(e.preparedInput!=null){let t=_u(e.preparedInput);t==null?n.appendPreparedPaths(gu(e.preparedInput),!1):n.appendPresortedPaths(t,vu(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(Y(t,`store.preparePathEntries`,()=>yu(r,e)))}let r=Y(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=Y(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=Y(t,`store.state.create`,()=>xu(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:Y(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||Vf(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&Y(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?e.useSoaCountSweep===!0?Y(t,`store.state.initializeOpenVisibleCountsViaSoa`,()=>Bf(this.#e)):Y(t,`store.state.initializeOpenVisibleCounts`,()=>zf(this.#e)):Y(t,`store.state.recomputeCounts`,()=>gd(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return pu(e,t)}static prepareInput(e,t={}){return mu(e,t)}static preparePresortedInput(e){return hu(e)}list(e){return Y(this.#e.instrumentation,`store.list`,()=>cd(this.#e,e))}add(e){Y(this.#e.instrumentation,`store.add`,()=>{let t=pf(this.#e);Yu(this.#e,qu(this.#e,t,ld(this.#e,e)))})}remove(e,t={}){Y(this.#e.instrumentation,`store.remove`,()=>{let n=pf(this.#e);Yu(this.#e,qu(this.#e,n,ud(this.#e,e,t)))})}move(e,t,n={}){Y(this.#e.instrumentation,`store.move`,()=>{let r=pf(this.#e),i=dd(this.#e,e,t,n);i!=null&&Yu(this.#e,qu(this.#e,r,i))})}batch(e){Ju(this.#e,()=>{if(typeof e==`function`)e(this);else 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})}})}getVisibleCount(){return Y(this.#e.instrumentation,`store.getVisibleCount`,()=>pf(this.#e))}getVisibleSlice(e,t){return Y(this.#e.instrumentation,`store.getVisibleSlice`,()=>yf(this.#e,e,t))}getVisibleRowContext(e){return Y(this.#e.instrumentation,`store.getVisibleRowContext`,()=>vf(this.#e,e))}getVisibleTreeProjection(){return xf(this.#e)}getVisibleTreeProjectionData(e){return bf(this.#e,e)}getVisibleIndex(e){return Y(this.#e.instrumentation,`store.getVisibleIndex`,()=>Sf(this.#e,e))}getPathInfo(e){return Y(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=vd(this.#e,e);if(t==null)return null;let n=X(this.#e,t);return{depth:kl(n),kind:J(n)?`directory`:`file`,path:md(this.#e,t)}})}isExpanded(e){return Y(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=X(this.#e,t);return Tu(this.#e,t,n)})}expand(e){Y(this.#e.instrumentation,`store.expand`,()=>{let t=pf(this.#e),n=Cf(this.#e,e);n!=null&&Yu(this.#e,qu(this.#e,t,n))})}collapse(e){Y(this.#e.instrumentation,`store.collapse`,()=>{let t=pf(this.#e),n=wf(this.#e,e);n!=null&&Yu(this.#e,qu(this.#e,t,n))})}on(e,t){return Fu(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return Ou(this.#e,t)}markDirectoryUnloaded(e){Y(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(bd(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=pf(this.#e);Au(this.#e,t),Yu(this.#e,qu(this.#e,n,Vu({affectedAncestorIds:_d(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return Y(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=pf(this.#e),r=ku(this.#e,t);return Yu(this.#e,qu(this.#e,n,Hu({affectedAncestorIds:_d(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return Y(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||Ou(this.#e,n)!==`loading`||!Mu(this.#e,n,e.attemptId))return!1;let r=md(this.#e,n);this.validateChildPatch(r,t);let i=pf(this.#e),a=[];for(let e of t.operations){Uf(r,e);let t=pf(this.#e);switch(e.type){case`add`:a.push(qu(this.#e,t,ld(this.#e,e.path)));break;case`remove`:a.push(qu(this.#e,t,ud(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=dd(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(qu(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return Yu(this.#e,qu(this.#e,i,Uu({affectedAncestorIds:_d(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:md(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return Y(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=pf(this.#e),r=ju(this.#e,t,e.attemptId);return Yu(this.#e,qu(this.#e,n,Wu({affectedAncestorIds:_d(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:md(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return Y(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=pf(this.#e),i=Nu(this.#e,n,e.attemptId,t);return Yu(this.#e,qu(this.#e,r,Gu({affectedAncestorIds:_d(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:md(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return Y(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(lf(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=pf(this.#e),n=uf(this.#e,e.mode??`stable`);return Yu(this.#e,qu(this.#e,t,Ku({...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=bd(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??Vl(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=Ul(Xl(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||!J(X(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;else for(let e=d;e<m;e+=1){let n=r[e];if(n==null)continue;let i=X(this.#e,n);Tu(this.#e,n,i)||(Eu(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=X(this.#e,e);if(!Tu(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=vd(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!J(X(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!J(X(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=X(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=X(this.#e,e),r=ad(this.#e,e);if(!Tu(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 Uf(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}"`)}}var Wf={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function Gf(e,t){if(typeof e==`number`)return{itemHeight:t??Wf.default.itemHeight,factor:e};let n=Wf[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var Kf=Wf.default.itemHeight,qf=`@layer base {
170
170
  :host {
171
171
  --trees-accent: var(--trees-accent-override, #009fff);
172
172
  --trees-fg: var(--trees-fg-override, var(--trees-theme-sidebar-fg, light-dark(#6c6c71, #adadb1)));
@@ -1258,73 +1258,73 @@ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$ as t,$c as n,$i as r
1258
1258
  }
1259
1259
 
1260
1260
  @layer theme, unsafe;
1261
- `,Kf=`@layer base, unsafe;`;function qf(e){return`${Kf}
1261
+ `,Jf=`@layer base, unsafe;`;function Yf(e){return`${Jf}
1262
1262
  @layer base {
1263
1263
  ${e}
1264
- }`}function Jf(e){return`${Kf}
1264
+ }`}function Xf(e){return`${Jf}
1265
1265
  @layer unsafe {
1266
1266
  ${e}
1267
- }`}var Yf=new WeakMap;function Xf(e){let t=Yf.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(Jc,`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(),Yf.set(e,i),i}function Zf(e,t){if(!e.isConnected)return;let n=Xf(t);if(n==null)return;let r=t.querySelector(`style[${Yc}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(Yc,``),t.appendChild(i)),i.textContent=`:host { ${Xc}: ${n}px; }`}var Qf;function $f(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){Qf??(Qf=new CSSStyleSheet,Qf.replaceSync(qf(Gf)));let t=!1;try{e.adoptedStyleSheets=[Qf],t=!0}catch{}if(t){e.querySelector(`style[${Kc}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(Kc,``),t.textContent=qf(Gf),e.prepend(t)}}function ep(e,t){tp(e,t),$f(t),Zf(e,t)}function tp(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`});ep(this,e)}}if(customElements.define(Gc,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(Gc)))e instanceof HTMLElement&&ep(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var np=e=>e.startsWith(`f::`)?e.slice(3):e;function rp(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function ip(e,t){return e===``?t:`${e}/${t}`}function ap({files:e,path:t,isFolder:n,nextBasename:r}){let i=np(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}=rp(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=ip(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 op(e){return e.endsWith(`/`)}function sp(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 cp(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 lp(e,t){return t.includes(e)?cp(t):[e]}function up(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 dp(e,t){return{draggedPaths:e,target:t}}function fp(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(op(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function pp(e,t){return t.kind===`root`||t.directoryPath==null?sp(e):t.directoryPath}function mp(e,t){let n=e.map(e=>{let n=pp(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 hp(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 gp(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(!hp(Bf.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 _p(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function vp(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 yp(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function bp(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 yp(e,t.path)?n?e:null:e;case`move`:return vp(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=bp(r,e,n),r==null)return null;return r}}}function xp(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function Sp(e){switch(e.operation){case`add`:return{...xp(e),operation:`add`,path:e.path};case`remove`:return{...xp(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...xp(e),from:e.from,operation:`move`,to:e.to}}}function Cp(e){return{...xp(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>Sp(e)),operation:`batch`}}function wp(e){switch(e.operation){case`add`:case`remove`:case`move`:return Sp(e);case`batch`:return Cp(e);default:return null}}function Tp(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function Ep(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 Dp(e){return Ep(e).at(-1)??null}function Op(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function kp(e){return e.endsWith(`/`)}var Ap=e=>e.toLowerCase();function jp(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function Mp(e){return e.endsWith(`/`)?e.slice(0,-1):e}function Np(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var Pp=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},Fp=Symbol(`FILE_TREE_RENAME_VIEW`),Ip=512,Lp=512;function Rp(e){return e===`top`||e===`center`?e:`nearest`}function zp(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=Ep(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 Bp(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:zp(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var Vp=class e{static{Object.defineProperty(e.prototype,Fp,{configurable:!0,value(){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}},writable:!0})}#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=gp({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=Dp(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:Rp(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<=Lp){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];r!=null&&r===a+1?a=r:(i>=0&&this.#H.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null?(i=-1,a=-1):(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);t!=null&&(this.#B.has(t)?this.deselectPath(t):this.selectPath(t))}togglePathSelectionFromInput(e){let t=this.#Ne(e);t!=null&&(this.#B.has(t)?this.#ae([...this.#B].filter(e=>e!==t),t):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=lp(t,n);return this.#r.canDrag?.(r)!==!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=dp(t.draggedPaths,n);(fp(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}up(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=dp(e.draggedPaths,t);if(fp(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=mp(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=kp(r),a=Mp(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of Ep(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=jp(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}#q(){if(this.#T==null)return;let e=this.#T,t=this.#D;this.#T=null,this.#E=``,this.#D=!1,t?this.remove(e,kp(e)?{recursive:!0}:void 0):(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,kp(e)?{recursive:!0}:void 0);return}let t=kp(e),n=ap({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:Mp(e)});this.#T=null,this.#E=``,this.#D=!1,`error`in n?(this.#Pe(e),this.#v?.(n.error),this.#De()):n.sourcePath===n.destinationPath?(this.#Pe(e),this.#De()):(this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(Np(n.sourcePath,t),Np(n.destinationPath,t)))}#Y(e){this.#T!=null&&this.#E!==e&&(this.#E=e,this.#De())}resetPaths(e,t={}){let n=!Array.isArray(e),r=n?void 0:e,i=n?e:t,a=this.#H.list().length,o=this.#G,s=gp({paths:r,preparedInput:i.preparedInput},`resetPaths`,this.#e.sort),c=this.#le(s.paths,s.preparedInput,i.initialExpandedPaths),l=this.#c,u=this.#T,d=this.getSelectedPaths(),f=this.#z;this.#K?.(),this.#H=c,this.#d.clear(),this.#he();let p=d.map(e=>c.getPathInfo(e)?.path??null).filter(e=>e!=null),m=!Tp(this.#B,p);this.#B=new Set(p),m&&(this.#V+=1),this.#z=f==null?null:c.getPathInfo(f)?.path??null,this.#T=u==null?null:c.getPathInfo(u)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(l,l!=null||p.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:s.paths.length,pathCountBefore:a,projectionChanged:!0,usedPreparedInput:i.preparedInput!=null,visibleCountDelta:this.#G-o})}#X(e){this.#Ie();let t=Dp(e),n=Op(e,t),r=null,i=null;for(let e of this.#be()){if(Dp(e)!==t)continue;let a=Op(e,t);if(a<n)r=e;else if(a>n){i=e;break}}return r??i}#Z(e){let t=this.#Ce(e);if(t!==-1)return t;let n=Ep(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=!Tp(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 Bf({...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 Ep(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(Ap),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(Ap),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 Ep(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:Pp(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 Ep(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 Ep(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=Bp(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,Ip)),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=bp(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=bp(this.#c,e,!0),r=[...this.#B].map(t=>bp(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=bp(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return Tp(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&&_p(e)&&(this.#i=null);let t=_p(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=wp(e);i!=null&&this.#Oe(i)})}#ze(e){this.#H.isExpanded(e)?this.#ie(e):this.#ke(e)}},Hp=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 Up(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1)e[t]!==`/`&&t!==e.length?r===-1&&(r=t):r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1);return n===``?null:{isDirectory:t,path:n}}function Wp(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=[],r=0;for(;;){let e=t.indexOf(`/`,r);if(e===-1)break;n.push(t.slice(0,e+1)),r=e+1}return n}function Gp(e,t){return t?`${e}/`:e}function Kp(e,t=null){let n=Hp(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,o=new Map;for(let t of e??[]){let e=Jp(t);e!=null&&Zp({canonicalPath:e.canonicalPath,changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,isDirectory:e.isDirectory,status:t.status,statusByPath:r})}return r.size===0?null:{changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}function qp(e,t){let n=t?.remove??[],r=t?.set??[];if(n.length===0&&r.length===0)return e;let i=new Map(e?.statusByPath),a=new Set(e?.directoriesWithChanges),o=new Set(e?.ignoredDirectoryPaths),s=new Map(e?.changeCountByDirectoryPath),c=!1;for(let e of n){let t=Yp(e);t!=null&&(c=Xp({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,statusByPath:i})||c)}for(let e of r){let t=Jp(e);t!=null&&(c=Zp({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,isDirectory:t.isDirectory,status:e.status,statusByPath:i})||c)}return c?i.size===0?null:{changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,signature:em(i),statusByPath:i}:e}function Jp(e){return Yp(e.path)}function Yp(e){let t=Up(e);if(t!=null)return{canonicalPath:Gp(t.path,t.isDirectory),isDirectory:t.isDirectory}}function Xp({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,statusByPath:i}){let a=i.get(e);return a!=null&&(i.delete(e),a===`ignored`&&e.endsWith(`/`)&&r.delete(e),$p(t,n,e),!0)}function Zp({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,isDirectory:i,status:a,statusByPath:o}){let s=o.get(e);return s!==a&&(s??Qp(t,n,e),o.set(e,a),a===`ignored`&&i?r.add(e):i&&r.delete(e),!0)}function Qp(e,t,n){for(let r of Wp(n))e.set(r,(e.get(r)??0)+1),t.add(r)}function $p(e,t,n){for(let r of Wp(n)){let n=(e.get(r)??0)-1;n>0?e.set(r,n):(e.delete(r),t.delete(r))}}function em(e){let t=`${e.size}`;for(let[n,r]of e)t+=`\0${n}\0${r}`;return t}var tm,nm,rm,im,am,om,sm,cm,lm,um,dm={},fm=[],pm=Array.isArray,mm=fm.slice,hm=Object.assign;function gm(e){e&&e.parentNode&&e.remove()}function _m(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?mm.call(arguments,2):n),vm(e,o,r,i,null)}function vm(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??++nm,__i:-1,__u:0};return i==null&&tm.vnode!=null&&tm.vnode(a),a}function ym(e){return e.children}function bm(e,t){this.props=e,this.context=t,this.__g=0}function xm(e,t){if(t==null)return e.__?xm(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`?xm(e):null}function Sm(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 Sm(e)}}function Cm(e){(8&e.__g||!(e.__g|=8)||!rm.push(e)||am++)&&im==tm.debounceRendering||((im=tm.debounceRendering)||queueMicrotask)(wm)}function wm(){for(var e,t,n,r,i,a,o,s,c=1;rm.length;)rm.length>c&&rm.sort(om),e=rm.shift(),c=rm.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=hm({},r)).__v=r.__v+1,tm.vnode&&tm.vnode(n),Mm(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??xm(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,Pm(a,n,o),n.__e!=i&&Sm(n)));am=0}function Tm(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||fm,b=t.length;for(c=Em(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?dm:y[m.__i]||dm,m.__i=f,_=Mm(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&Lm(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=Dm(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function Em(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?vm(null,o,null,null,null):pm(o)?vm(ym,{children:o},null,null,null):o.constructor==null&&o.__b>0?vm(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=Om(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=xm(s)),Rm(s,s));return r}function Dm(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=Dm(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=xm(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Om(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&!(2&l.__u);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 km(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function Am(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||km(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||km(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(sm,`$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=cm,e.addEventListener(t,a?um:lm,a)):e.removeEventListener(t,a?um:lm,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 jm(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=cm++;else if(t.u<n.l)return;return n(tm.event?tm.event(t):t)}}}function Mm(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M=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=tm.__b)&&d(t);n:if(typeof M==`function`)try{if(v=t.props,y=`prototype`in M&&M.prototype.render,b=(d=M.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 M(v,x):(t.__c=f=new bm(v,x),f.constructor=M,f.render=zm),b&&b.sub(f),f.props=v,f.state||(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&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=hm({},f.__s)),hm(f.__s,M.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&M.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=tm.__r,w=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);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&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=hm({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===ym&&d.key==null&&(E=Fm(d.props.children)),s=Tm(e,pm(E)?E:[E],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(D=0,O=!1,t.__u|=c?160:128,t.__c.__z=[],k=0;k<a.length;k++)(A=a[k])==null||O||(A.nodeType==8&&A.data==`$s`?(D>0&&t.__c.__z.push(A),D++,a[k]=null):A.nodeType==8&&A.data==`/$s`?(--D>0&&t.__c.__z.push(A),O=D===0,s=a[k],a[k]=null):D>0&&(t.__c.__z.push(A),a[k]=null));if(!O){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(j=a.length;j--;)gm(a[j]);Nm(t)}}else t.__e=n.__e,t.__k=n.__k,e.then||Nm(t);tm.__e(e,t,n)}else s=t.__e=Im(n.__e,t,n,r,i,a,o,c,l,u);return(d=tm.diffed)&&d(t),128&t.__u?void 0:s}function Nm(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(Nm)}function Pm(e,t,n){for(var r=0;r<n.length;r++)Lm(n[r],n[++r],n[++r]);tm.__c&&tm.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){tm.__e(e,t.__v)}})}function Fm(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:pm(e)?e.map(Fm):hm({},e)}function Im(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&&=(tm.__m&&tm.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=mm.call(e.childNodes),v=n.props||dm,!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;Am(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&&!_||Am(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=``),Tm(b==`template`?e.content:e,pm(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&xm(n,0),s,c,l),a!=null)for(u=a.length;u--;)gm(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||Am(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&Am(e,u,g,v[u],i))}return e}function Lm(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){tm.__e(e,n)}}function Rm(e,t,n){var r,i;if(tm.unmount&&tm.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Lm(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){tm.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Rm(r[i],t,n||typeof e.type!=`function`);n||gm(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function zm(e,t,n){return this.constructor(e,n)}function Bm(e,t){var n,r,i,a;t==document&&(t=document.documentElement),tm.__&&tm.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=_m(ym,null,[e]),i=[],a=[],Mm(t,e,r||dm,dm,t.namespaceURI,r?null:t.firstChild?mm.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),Pm(i,e,a)}function Vm(e,t){e.__u|=32,Bm(e,t)}tm={__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 am=0,e}},nm=0,bm.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=hm({},this.state);typeof e==`function`&&(e=e(hm({},n),this.props)),e&&hm(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Cm(this))},bm.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),Cm(this))},bm.prototype.render=ym,rm=[],am=0,om=function(e,t){return e.__v.__b-t.__v.__b},sm=/(PointerCapture)$|Capture$/i,cm=0,lm=jm(!1),um=jm(!0);var Hm=0;Array.isArray;function Z(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:--Hm,__i:-1,__u:0,__source:i,__self:a};return tm.vnode&&tm.vnode(l),l}var Um=16,Wm=16,Gm={};function Km({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}=Gm[e]??{width:Um,height:Wm},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return Z(`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:Z(`use`,{href:c})})}var qm=e=>e!==void 0&&/\s/.test(e),Jm=(e,t)=>{let n=t=>qm(e[t-1])||qm(e[t]);if(!n(t))return t;for(let r=1;r<e.length;r++){let i=t-r;if(i>0&&!n(i))return i;let a=t+r;if(a<e.length&&!n(a))return a}return t},Ym=e=>Jm(e,Math.ceil(e.length/2)),Xm=e=>{if(e.length<2)return[e,``];let t=Ym(e);return[e.slice(0,t),e.slice(t)]},Zm=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:Ym(e);return[e.slice(0,r),e.slice(r)]},Qm=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)]},$m=(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)]},eh=(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)]},th=(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 nh({children:e,marker:t,variant:n=`default`}){"use no memo";return Z(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:Z(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?Z(`span`,{"data-truncate-fade":!0}):t})})}function rh(e){"use no memo";let{mode:t,children:n}=e;return Z(`div`,{children:[Z(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?Z(`span`,{children:n}):n}),Z(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?Z(`span`,{children:n}):n})]})}function ih({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=Z(rh,{mode:t,children:e},`content`),o=Z(nh,{marker:n,mode:t,variant:r},`marker`),s=Z(`div`,{"data-truncate-fill":!0},`fill`);return Z(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:Z(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function ah({children:e,...t}){"use no memo";return Z(ih,{mode:`truncate`,...t,children:e})}function oh({children:e,...t}){"use no memo";return Z(ih,{mode:`fruncate`,...t,children:e})}function sh({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=Z(ah,{...s,children:t[0]}),l=Z(oh,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return Z(`div`,{className:a,style:o});if(e.length<i)return Z(n===`end`?oh:ah,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=Xm:r===`extension`?t=Zm:r===`leaf-path`&&(t=Qm);else if(typeof r==`number`)t=$m,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=eh:e===`first`&&(t=th)}else typeof r==`function`&&(t=r);t??=Xm;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=Z(ah,{...s,..._,children:f}),l=Z(oh,{...s,...v,children:p})}return Z(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[Z(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),Z(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var ch={endIndex:-1,startIndex:-1};function lh(e,t,n){return Math.min(Math.max(e,t),n)}function uh(e,t){return e<0||t<e?ch:{endIndex:t,startIndex:e}}function dh(e){return e.startIndex<0||e.endIndex<e.startIndex}function fh(e,t){return dh(e)?0:(e.endIndex-e.startIndex+1)*t}function ph(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function mh(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function hh(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);i==null?t.set(r,[n]):i.push(n)}),t}function gh(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;o<=t?(i=a,n=a+1):r=a-1}return i}function _h(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 vh(e,t,n){if(e.length===0||t<=0)return[];let r=_h(e),i=hh(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=gh(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 yh(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=lh(t.scrollTop,0,o),c=t.stickyRows??vh(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=ph(s,n,t.itemHeight),m=ph(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?ch:uh(m,mh(u+d,n,t.itemHeight)),y=g+1,b=dh(v)?ch:uh(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=fh(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:dh(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var bh={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},xh={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},Sh=`Contains git status items`;function Ch(e){return e.current?!0:(e.current=!0,!1)}function wh(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 Th(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return wh({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 Eh(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 Dh(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 Oh(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 kh(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function Ah(e,t){return e!=null&&e>0?e:t}function jh(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 Mh(e,t,n,r,i=0){let a=wh({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a!=null&&(e.scrollTop=a,!0)}function Nh(e,t,n,r,i,a,o=0){let s=Th({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s!=null&&(e.scrollTop=s,!0)}function Ph(e,t,n,r,i,a){let o=Eh({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o!=null&&(e.scrollTop=o,!0)}function Fh(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function Ih(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function Lh({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return Z(`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 Rh(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 zh(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 Bh,Vh,Hh,Uh,Wh=Object.is,Gh=0,Kh=[],qh=tm,Jh=qh.__b,Yh=qh.__r,Xh=qh.diffed,Zh=qh.__c,Qh=qh.unmount,$h=qh.__;function eg(e,t){qh.__h&&qh.__h(Vh,e,Gh||t),Gh=0;var n=Vh.__H||(Vh.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function tg(e){return Gh=1,ng(pg,e)}function ng(e,t,n){var r=eg(Bh++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):pg(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);Wh(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=Vh,!Vh.__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,Wh(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};Vh.__f=!0;var a=Vh.shouldComponentUpdate,o=Vh.componentWillUpdate;Vh.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)},Vh.shouldComponentUpdate=i}return r.__N||r.__}function rg(e,t){var n=eg(Bh++,3);!qh.__s&&fg(n.__H,t)&&(n.__=e,n.u=t,Vh.__H.__h.push(n))}function ig(e,t){var n=eg(Bh++,4);!qh.__s&&fg(n.__H,t)&&(n.__=e,n.u=t,Vh.__h.push(n))}function Q(e){return Gh=5,ag(function(){return{current:e}},[])}function ag(e,t){var n=eg(Bh++,7);return fg(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function og(e,t){return Gh=8,ag(function(){return e},t)}function sg(){for(var e;e=Kh.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ug),e.__H.__h.forEach(dg),e.__H.__h=[]}catch(t){e.__H.__h=[],qh.__e(t,e.__v)}}qh.__b=function(e){Vh=null,Jh&&Jh(e)},qh.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),$h&&$h(e,t)},qh.__r=function(e){Yh&&Yh(e),Bh=0;var t=(Vh=e.__c).__H;t&&(Hh===Vh?(t.__h=[],Vh.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(ug),t.__h.forEach(dg),t.__h=[],Bh=0)),Hh=Vh},qh.diffed=function(e){Xh&&Xh(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Kh.push(t)!==1&&Uh===qh.requestAnimationFrame||((Uh=qh.requestAnimationFrame)||lg)(sg)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),Hh=Vh=null},qh.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ug),e.__h=e.__h.filter(function(e){return!e.__||dg(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],qh.__e(n,e.__v)}}),Zh&&Zh(e,t)},qh.unmount=function(e){Qh&&Qh(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ug(e)}catch(e){t=e}}),n.__H=void 0,t&&qh.__e(t,n.__v))};var cg=typeof requestAnimationFrame==`function`;function lg(e){var t,n=function(){clearTimeout(r),cg&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);cg&&(t=requestAnimationFrame(n))}function ug(e){var t=Vh,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),Vh=t}function dg(e){var t=Vh;e.__c=e.__(),Vh=t}function fg(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!Wh(t,e[n])})}function pg(e,t){return typeof t==`function`?t(e):t}function mg(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:Z(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return Z(ym,{children:[Z(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:Z(ah,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function hg(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function gg(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function _g(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 vg({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=yh(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:_g(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?_g(u,1,t,o):i&&r<=0&&c.length>0?vh(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 yg=400,bg=40,xg=18;function Sg(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))?Cg(e,t,n):a instanceof HTMLElement?a:null}function Cg(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 wg(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 Tg(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 Eg(){return navigator.vendor!==`Apple Computer, Inc.`}function Dg(e,t){let n=e-t.top;if(n<bg)return-Math.ceil((bg-Math.max(0,n))/bg*xg);let r=t.bottom-e;return r<bg?Math.ceil((bg-Math.max(0,r))/bg*xg):0}function Og(e,t){if(e!=null){let t=bh[e];return t==null?null:{text:t,title:xh[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:Sh}:null}function kg(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 Ag(e){return e!=null&&`toggle`in e}function jg(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function Mg(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function Ng(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function Pg(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function Fg(e,t){return t&&Pg(e)||(e.ctrlKey||e.metaKey)&&jg(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var Ig=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function Lg(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 Rg(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 zg(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function Bg(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function Vg(e,t,n){n==null?e.delete(t):e.set(t,n)}function Hg(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 Ug(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 Wg(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 Gg(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=Wg(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 Kg(e,t){return{kind:e.kind,name:gg(e),path:t}}function qg(e){return e==null?void 0:`${e}__tree`}function Jg(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function Yg(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function Xg(e,t){if(e==null)return null;if(`text`in e)return e.parts==null?Z(`span`,{title:e.title,children:e.text}):Z(`span`,{title:e.title,children:e.parts.map((e,t)=>Z(`span`,{style:{color:e.color},children:e.text},t))});let n=typeof e.icon==`string`?Yg(e.icon)?t(e.icon):{name:e.icon}:Yg(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return Z(`span`,{title:e.title,children:Z(Km,{...n})})}function Zg(e){e!=null&&Dh(e.querySelector(`button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`)??e)}function Qg(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=hg(e);return Z(ym,{children:[e.depth>0?Z(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>Z(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,Z(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?Z(Km,{...t(`file-tree-icon-chevron`)}):Z(Km,{...t(`file-tree-icon-file`,u)})}),Z(`div`,{"data-item-section":`content`,children:e.isFlattened?mg(e,c,a):c??Z(sh,{minimumLength:5,split:`extension`,children:e.name})}),i?Z(`div`,{"data-item-section":`decoration`,children:r==null?null:Xg(r,t)}):null,s?Z(`div`,{"data-item-section":`git`,children:Xg(o,t)}):null,n?Z(`div`,{"data-item-section":`action`,children:l?Z(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:Z(Km,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function $g(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:w,contextMenuButtonVisibility:T,contextMenuRightClickEnabled:E,registerRenameInput:D,registerButton:O,resolveIcon:k,renderDecorationForRow:A,openContextMenuForRow:j,onRowClick:M,onKeyDown:N}=e,P=hg(t),{isParked:F=!1,mode:I=`flow`,style:L}=r,R=I===`sticky`,ee=_?.get(P)??null??kg(t.ancestorPaths,v,y),te=t.kind===`directory`&&(b?.has(P)??!1),z=A(t,P),ne=Og(ee,te),B=S&&w,re=z!=null||x||B,ie=B&&T===`always`,V=a.getPath()===P,ae=V?a.getValue():``,oe=R||!V?null:Z(Lh,{ref:D,ariaLabel:`Rename ${gg(t)}`,isFlattened:t.isFlattened,value:ae,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),se=Qg(t,k,{actionLaneEnabled:B,customDecoration:z,decorationLaneEnabled:re,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:ne,gitLaneActive:x,renameInput:oe,showDecorativeActionAffordance:ie}),ce={...Rh({ariaLabel:gg(t),domId:t.isFocused?Jg(h,P,F):void 0,extraStyle:L,features:{actionLaneEnabled:B,contextMenuButtonVisibility:B?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:F,itemHeight:g,mode:I,row:t,state:{containsGitChange:te,effectiveGitStatus:ee,isContextHovered:s===P,isDragTarget:l?.kind===`directory`&&l.directoryPath===P,isDragging:c?.has(P)===!0,isFocusRinged:t.isFocused&&o===P},targetPath:P}),key:n,onContextMenu:S||u?e=>{d()?e.preventDefault():S&&(e.preventDefault(),E&&(i.focusMountedPathFromInput(P),j(t,P,{anchorRect:zg(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:R?void 0:()=>{i.focusMountedPathFromInput(P)},onKeyDown:R?void 0:N,ref:e=>{O(P,e)}};return!R&&V?Z(`div`,{...ce,children:se}):Z(`button`,{...ce,type:`button`,draggable:u&&!F,onDragEnd:u&&!F?p:void 0,onDragStart:u&&!F?e=>{f(e,t,P)}:void 0,onMouseDown:e=>{(R||i.isSearchOpen())&&e.preventDefault()},onTouchStart:u&&!F?e=>{m(e,t,P)}:void 0,onClick:e=>{M(e,t,P,I)},children:se})}function e_(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(hg(e))).map((n,r)=>$g(e,n,t.start+r))}function t_({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=Wf,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 _=Q(null),v=Q(null),y=Q(!1),b=Q(null),x=Q(null),S=Q(null),C=Q(null),w=Q(null),T=Q(new Map),E=Q(new Map),D=Q(()=>{}),O=Q(null),k=Q(0),A=Q(!1),j=Q(null);j.current!==t&&(A.current=!1,j.current=t);let M=Q(!1),N=Q(null),P=Q(null),F=Q(!1),I=Q(null),L=Q(null),R=Q(null),ee=Q(null),te=Q(null),z=Q(null),ne=Q(null),B=Q(null),re=Q(!1),ie=Q(null),V=Q(null),ae=Q(null),oe=Q(null),se=ag(()=>new Map,[]),[,ce]=tg(0),le=Q(!1),[ue,de]=tg(null),[fe,pe]=tg(null),[me,he]=tg(null),[ge,_e]=tg(null),[ve,ye]=tg(0),[be,xe]=tg(null),Se=Q(be);Se.current=be;let Ce=Q(null),H=Q(null),we=Q(null),Te=Q(null),Ee=Q(null),De=Q(!1),Oe=()=>{H.current=null,we.current=null,Te.current=null},ke=(e,t)=>{H.current=e,we.current=null,Te.current=t==null?null:{path:e,scrollTop:t}},U=(e,t)=>{H.current=null,we.current={path:e,viewportOffset:t},Te.current=null},Ae=Q(d===`retain`&&t.isSearchOpen()),[je,Me]=tg(p);rg(()=>{p||Me(!1)},[p]);let Ne=Q(!1),Pe=og(()=>{Ne.current=!0,Me(e=>e&&!1)},[]),[Fe,Ie]=tg(()=>vg({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Le,Re]=tg(!1);rg(()=>{Re(!0)},[]);let ze=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Be=e?.contextMenu?.triggerMode??(ze?`right-click`:`both`),Ve=Be===`both`||Be===`button`,He=e?.contextMenu?.buttonVisibility??`when-needed`,Ue=Be===`both`||Be===`right-click`;ig(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;Ee.current=t,pe(t),_e(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(De.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 We=og((e,t)=>{Vg(T.current,e,t)},[]),Ge=og((e,t)=>{Vg(E.current,e,t)},[]),Ke=og(e=>{x.current=e},[]),qe=og(e=>Hg(e,E.current,T.current),[]),Je=n!=null||r!=null||i!=null,{resolveIcon:Ye}=ag(()=>ol(a),[a]),Xe=t[Fp](),Ze=Xe.getPath(),Qe=Ze!=null,$e=t.isSearchOpen(),et=t.getSearchValue(),W=t.getFocusedPath(),tt=t.getFocusedIndex(),nt=t.getScrollRequest(),rt=t.isDragAndDropEnabled(),it=t.getDragSession(),at=ag(()=>it==null?null:new Set(it.draggedPaths),[it]),ot=it?.target??null,st=it?.primaryPath??null,ct=qg(o),{overlayHeight:lt,overlayRows:ut,snapshot:dt,visibleRows:ft}=Fe,pt=dt.physical.viewportHeight,mt=ag(()=>({end:dt.window.endIndex,start:dt.window.startIndex}),[dt.window.endIndex,dt.window.startIndex]),ht=ut,gt=dt.sticky.rows,_t=dt.physical.totalHeight,vt=dt.sticky.height,yt=ag(()=>new Set(gt.map(e=>hg(e.row))),[gt]),bt=tt>=0&&tt>=mt.start&&tt<=mt.end,xt=og((e,t)=>u?.({item:Kg(e,t),row:e})??null,[u]),St=og(e=>Dh(e==null?null:T.current.get(e)??null)?!0:Dh(S.current),[]),Ct=og(e=>{St(t.focusNearestPath(e))},[t,St]),wt=Q(Ct);wt.current=Ct;let Tt=Q(!0),Et=Q(()=>{}),Dt=og((t=!0)=>{let n=Se.current;n!=null&&(Tt.current=Tt.current&&t,xe(null),e?.contextMenu?.onClose?.(),Tt.current&&Ct(n.path))},[e?.contextMenu,Ct]);Et.current=Dt;let Ot=og(e=>{let t=e==null?null:Bg(S.current,e);he(e=>e===t?e:t)},[]),kt=og((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=qe(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;ke(n,e?.scrollTop??null),M.current=!0,de(e=>e===n?e:n)}i.focus(),Ot(a),Tt.current=!0,xe({anchorRect:r?.anchorRect??null,item:Kg(e,n),path:n,source:r?.source??`keyboard`})},[t,qe,Ot]),At=og(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=kh(e,pt);I.current=tt<0||e==null?null:Math.max(0,Math.min(tt*s-e.scrollTop,Math.max(0,t-s))),F.current=!0}t.startRenaming(e)!==!1&&(_e(`focus`),ce(e=>e+1))}},[t,tt,s,l,pt]),jt=og((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=kh(i,pt),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:vg({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return M.current=!0,Ph(i,a,s,l,u,d),D.current(),Ce.current=n?e:null,!0},[t,s,c,pt,h]),Mt=()=>y.current===!0||oe.current!=null||re.current===!0,Nt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Pt=e=>{e!=null&&(typeof window.cancelAnimationFrame==`function`?window.cancelAnimationFrame(e):window.clearTimeout(e))},Ft=()=>{ee.current!=null&&(clearTimeout(ee.current),ee.current=null),R.current=null},It=()=>{z.current?.remove(),z.current=null},Lt=()=>{Pt(L.current),L.current=null,te.current=null},Rt=e=>{let t=S.current?.getRootNode();t instanceof ShadowRoot?t.append(e):document.body.append(e)},zt=()=>{B.current?.(),B.current=null,oe.current!=null&&(clearTimeout(oe.current),oe.current=null),re.current=!1,ie.current=null,ae.current=null,V.current!=null&&(V.current.setAttribute(`draggable`,`true`),V.current.style.removeProperty(`touch-action`),V.current=null),It(),Ft(),Lt(),ne.current=null},Bt=(e,n)=>{let r=S.current?.getRootNode(),i=wg(Sg(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Vt=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Ft();return}let r=t.getItem(e.directoryPath),i=Ag(r)?r:null;if(i==null||i.isExpanded()){Ft();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;R.current!==a&&(Ft(),R.current=a,ee.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind===`directory`&&n.directoryPath===e.directoryPath&&n.flattenedSegmentPath===e.flattenedSegmentPath&&i.expand()},n))},Ht=()=>{L.current=null;let e=te.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=Dg(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,D.current()),Vt(Bt(e.clientX,e.clientY)),L.current=Nt(Ht)},Ut=(e,t)=>{te.current={clientX:e,clientY:t},L.current??=Nt(Ht)},Wt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(zt(),It(),Ft(),Lt(),t.startDrag(r)===!1)e.preventDefault();else if(ne.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),Eg())){let t=Tg(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Rt(t),z.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Gt=()=>{It(),Ft(),Lt(),ne.current=null,t.cancelDrag()},Kt=(e,n,r)=>{if(oe.current!=null||re.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;ae.current={clientX:i.clientX,clientY:i.clientY},V.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!re.current;oe.current!=null&&(clearTimeout(oe.current),oe.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),B.current===o&&(B.current=null),t&&(a.setAttribute(`draggable`,`true`),V.current===a&&(V.current=null),ae.current=null)},s=e=>{let t=e.touches[0],n=ae.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=100||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),B.current=o,oe.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),V.current===a&&(V.current=null),ae.current=null;return}re.current=!0,V.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),ne.current=n;let e=a.getBoundingClientRect(),s=Tg(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`}),Rt(s),z.current=s,ie.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=ie.current;n!=null&&z.current!=null&&(z.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),Vt(Bt(t.clientX,t.clientY)),Ut(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Bt(n.clientX,n.clientY),t.completeDrag(),zt()},u=()=>{t.cancelDrag(),zt()};B.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)},yg)},qt=e=>{if(be!=null){if(e.key===`Escape`){Dt(),e.preventDefault(),e.stopPropagation();return}Ig.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(Xe.isActive()){if(e.isComposing||e.keyCode===229)return;if(e.key===`Escape`)Xe.cancel();else if(e.key===`Enter`)Xe.commit();else return;_e(`focus`),ce(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){At(W??void 0),e.preventDefault(),e.stopPropagation();return}if($e){if(e.key===`Escape`)F.current=!1,I.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=kh(n,pt);I.current=tt<0||n==null?null:Math.max(0,Math.min(tt*s-n.scrollTop,Math.max(0,r-s))),F.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;_e(`focus`),ce(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&Mg(e)){t.openSearch(e.key),ce(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=ze&&Pg(e),r=Fg(e,ze),i=r&&S.current!=null?Oh(S.current):null,a=r?new Set(Ug(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==W&&a.has(o)){let e=C.current;ke(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=Ag(p)?p:null,h=u!=null&&(yt.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=Hg(u,E.current,T.current);e==null||n==null?y=!1:kt(e,u)}else if((e.ctrlKey||e.metaKey)&&jg(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;_e(`focus`);let b=t.getFocusedPath(),x=b!=null&&(yt.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))ke(b,v?.scrollTop??null),M.current=!0,de(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(U(b,Gg(S.current,v,i,u,s,vt,pt)),M.current=!0,de(e=>e===b?e:b)):Oe()}ce(e=>e+1),e.preventDefault(),e.stopPropagation()};ig(()=>{f&&$e&&(Ae.current?Ae.current=!1:Dh(w.current))},[$e,f]),ig(()=>{let e=x.current;switch(Ih({hasRenderedInput:e!=null,previousRenamingPath:P.current,renamingPath:Ze})){case`reset`:P.current=null;return;case`reveal-canonical`:Ze!=null&&jt(Ze,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(Ce.current=null,P.current=Ze,Dh(e),e.select());return}},[mt.end,mt.start,Ze,jt,yt]),ig(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=Oh(e)?.dataset.itemPath??null;de(e=>e===t?e:t)},i=()=>{n(),M.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{t=null,Oh(e)==null?(M.current=!1,de(null)):r()},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),M.current=!1,de(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;de(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),ig(()=>{let e=S.current;e!=null&&(dt.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[dt.physical.scrollTop]),ig(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=kh(n,g);let a=()=>{let e=t.getVisibleCount(),r=Ah(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Ie(vg({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!A.current){A.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=Ah(O.current,g),i=t.getVisibleRows(e,e)[0]??null;Mh(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}D.current=a;let o=t.subscribe(()=>{Ch(le)&&ce(e=>e+1),a()}),l=()=>{De.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,ye(e=>e+1),e=null},50))},u=null,d=()=>{i!=null&&delete i.dataset.overlayReveal,u!=null&&(clearTimeout(u),u=null)},f=()=>{i!=null&&De.current!==!0&&(n.scrollTop>0||(i.dataset.overlayReveal=`true`,u!=null&&clearTimeout(u),u=setTimeout(()=>{d()},200)))},p=()=>{a(),n.scrollTop>0&&d(),Se.current!=null&&y.current&&Et.current(),De.current===!0?y.current=!1:(pe(e=>e==null?e:null),l())},m=()=>{l(),f()},_=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),v=e=>{_.has(e.key)&&m()};n.addEventListener(`scroll`,p,{passive:!0}),n.addEventListener(`wheel`,m,{passive:!0}),n.addEventListener(`touchmove`,m,{passive:!0}),n.addEventListener(`keydown`,v);let x=typeof ResizeObserver<`u`?new ResizeObserver(e=>{O.current=(e[0]==null?null:jh(e[0]))??kh(n,g),a()}):null;return x?.observe(n),()=>{D.current=()=>{},o(),n.removeEventListener(`scroll`,p),n.removeEventListener(`wheel`,m),n.removeEventListener(`touchmove`,m),n.removeEventListener(`keydown`,v),e!=null&&clearTimeout(e),u!=null&&clearTimeout(u),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,O.current=null,x?.disconnect()}},[t,g,s,c,h]),ig(()=>{ze||be==null||Dt(!1)},[Dt,ze,be]);let Jt=ag(()=>be==null?null:`${be.path}::${be.source}`,[be]);ig(()=>{if(Jt==null){m?.clearSlotContent(Qc);return}let t=Se.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??Rg(n.getBoundingClientRect()),close:e=>{Et.current(e?.restoreFocus??!0)},restoreFocus:()=>{Tt.current&&wt.current(Se.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(Qc,i),e?.contextMenu?.onOpen?.(t.item,r),Zg(i),queueMicrotask(()=>{i!=null&&i.isConnected&&document.activeElement===i&&Zg(i)}),()=>{m?.clearSlotContent(Qc)}},[Jt,e?.contextMenu,m]),ig(()=>{be!=null&&t.getItem(be.path)==null&&Dt()},[Dt,be,t]),ig(()=>{if(be==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(Lg(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&Dt())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Dt())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[Dt,be]),ig(()=>{let e=C.current,n=S.current;if(e==null||n==null){N.current=W;return}let r=W==null?null:T.current.get(W)??null,i=Oh(n),a=i?.dataset.itemPath??null,o=Qe&&x.current===i,c=f&&w.current===i,l=F.current&&!$e,u=I.current??0,d=Ce.current,p=H.current,m=we.current,g=Te.current,_=i!=null,v=M.current||_,y=N.current!==W,b=p!=null&&p===W&&W!=null,E=!1,O=!1;if(nt!=null&&nt.id!==k.current){k.current=nt.id;let n=nt.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,pt-s))):vt;E=!0,O=Nh(e,n,s,pt,_t,nt.offset,t)}t.clearScrollRequest(nt.id)}let A=!E&&l&&Ph(e,tt,s,pt,_t,u),j=!E&&d!=null&&d===W&&Ph(e,tt,s,pt,_t,vt),P=!E&&m!=null&&m.path===W&&Ph(e,tt,s,pt,_t,m.viewportOffset),L=!E&&g!=null&&g.path===W&&e.scrollTop!==g.scrollTop;L&&(e.scrollTop=g.scrollTop),(L||O||j||P||A||v&&y&&d!==W&&!b&&Mh(e,tt,s,pt,vt))&&D.current(),E?N.current=W:v?o||c&&!l?N.current=W:r==null?(l&&tt>=0&&(Ph(e,tt,s,pt,_t,u),D.current()),N.current=W):((y||l||d===W||p===W||m?.path===W||g?.path===W||a==null||a!==W)&&(Dh(r),d===W&&(Ce.current=null),p===W&&(H.current=null),m?.path===W&&(we.current=null),g?.path===W&&(Te.current=null),F.current=!1,I.current=null),N.current=W):N.current=W},[t,tt,W,bt,s,Qe,$e,mt,pt,f,nt,h,vt,_t,ft]);let Yt=tt>=0&&tt>=dt.visible.startIndex&&tt<=dt.visible.endIndex,Xt=W!=null&&ht.some(e=>hg(e.row)===W),Zt=Yt||Xt,Qt=Ve&&M.current===!0&&Zt?W:null,$t=ge===`pointer`?fe:null,en=be?.path??Ee.current??$t??Qt??fe,tn=be?.source===`right-click`;ig(()=>{y.current&&be==null||Ot(qe(en))},[be,qe,mt,pt,ve,ht,en,Ot,ft]);let nn=og(e=>{if(y.current||Lg(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&&_e(e=>e===`pointer`?e:`pointer`),pe(e=>e===i?e:i)},[]),rn=og(()=>{pe(null)},[]);ig(()=>{if(!rt)return;let e=()=>{zt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),zt(),t.cancelDrag()}},[t,rt]);let an=e=>{if(!rt||t.getDragSession()==null||re.current)return;let n=wg(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Vt(t.getDragSession()?.target??null),Ut(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},on=e=>{if(!rt||t.getDragSession()==null||re.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Ft(),Lt(),t.setDragTarget(null))},sn=e=>{rt&&t.getDragSession()!=null&&!re.current&&(e.preventDefault(),Bt(e.clientX,e.clientY),t.completeDrag(),It(),Ft(),Lt(),ne.current=null)},cn=dt.window.height,ln=dt.window.offsetTop,un=Math.min(0,pt-cn),dn=Math.min(0,pt-cn-vt),fn=ue===W||F.current,pn=W!=null&&fn&&!bt&&tt>=0?ft[tt]??t.getVisibleRows(tt,tt)[0]??null:null,mn=pn==null?null:Fh(tt,s,mt,cn),hn=ne.current,gn=st!=null&&hn!=null&&hn.path===st&&hn.index>=mt.start&&hn.index<=mt.end,_n=st!=null&&hn!=null&&hn.path===st&&!gn&&hn.path!==pn?.path?hn:null,vn=_n==null?null:Fh(_n.index,s,mt,cn),yn=Ng((tt>=0?ft[tt]??t.getVisibleRows(tt,tt)[0]??null:null)?.ancestorPaths.at(-1)??null),bn=$e&&W!=null?Jg(o,W,!bt):void 0,xn=be?.path??($e?W:ue),Sn=be?.path??fe,Cn=qe(en),wn=ze&&Ve&&!tn&&!Qe&&Cn!=null&&me!=null&&en!=null,Tn=ze&&(wn||be!=null),En=be?.anchorRect,Dn=En==null&&Cn!=null&&me!=null&&(be!=null||wn)?me:null,On=En==null?Dn==null?void 0:{top:`${Dn}px`}:{left:`${En.left}px`,position:`fixed`,right:`auto`,top:`${En.top}px`},kn=tn?{opacity:`0`}:void 0,An=og((e,n,r,i)=>{let a=zh({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:$e,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)}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=dt.visible.startIndex&&n.index<=dt.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(M.current=!0,de(e=>e===c?e:c),_e(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&jt(c,{targetOffset:`sticky-parents`})},[t,$e,dt.visible.endIndex,dt.visible.startIndex,jt]),jn=()=>{if(y.current||!Ve||en==null||Cn==null)return;let e=t.getItem(en);e!=null&&(Ot(Cn),Tt.current=!0,xe({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:Cn.getAttribute(`aria-label`)??en,path:e.getPath()},path:e.getPath(),source:`button`}))},Mn={contextHoverPath:Sn,contextMenuButtonTriggerEnabled:Ve,contextMenuButtonVisibility:He,contextMenuEnabled:ze,contextMenuRightClickEnabled:Ue,contextMenuTriggerMode:Be,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:rt,draggedPathSet:at,dragTarget:ot,gitLaneActive:Je,gitStatusByPath:n,handleRowDragEnd:Gt,handleRowDragStart:Wt,handleRowTouchStart:Kt,ignoredGitDirectories:r,ignoredInheritanceCache:se,instanceId:o,itemHeight:s,onKeyDown:qt,onRowClick:An,openContextMenuForRow:kt,registerButton:We,registerRenameInput:Ke,renameView:Xe,renderDecorationForRow:xt,resolveIcon:Ye,shouldSuppressContextMenu:Mt,visualFocusPath:xn},Nn={...Mn,registerButton:Ge};return Z(`div`,{ref:S,id:ct,"data-file-tree-context-menu-button-visibility":ze&&Ve?He:void 0,"data-file-tree-context-menu-trigger-mode":ze?Be:void 0,"data-file-tree-has-context-menu-action-lane":ze&&Ve?`true`:void 0,"data-file-tree-has-git-lane":Je?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:rt?on:void 0,onDragOver:rt?an:void 0,onDrop:rt?sn:void 0,onKeyDown:qt,onPointerLeave:ze?rn:void 0,onPointerOver:ze?nn:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[Z(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:yn}}),Z(`slot`,{name:Zc,"data-type":`header-slot`}),f?Z(`div`,{"data-file-tree-search-container":!0,"data-open":$e?`true`:`false`,children:Z(`input`,{ref:w,"aria-activedescendant":bn,"aria-controls":ct,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":je?`true`:void 0,value:et,onBlur:()=>{(d!==`retain`||Ne.current)&&t.closeSearch()},onFocus:Pe,onPointerDown:Pe,onInput:e=>{Pe();let n=e.currentTarget;t.setSearch(n.value)}})}):null,Z(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Le&&ht.length>0?Z(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:Z(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${lt}px`},children:ht.map((e,t)=>$g(Nn,e.row,`sticky:${hg(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${ht.length-t}`}}))})}):null,Z(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${_t}px`},children:[Z(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${ln}px`}}),Z(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${cn}px`,top:`${un}px`,bottom:`${dn}px`},children:[e_(Mn,mt,yt),pn!=null&&mn!=null?$g(Mn,pn,`parked:${pn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:st===pn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${mn}px`}}):null,_n!=null&&vn!=null?$g(Mn,_n,`parked-drag:${_n.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${vn}px`}}):null]})]})]}),ze?Z(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":Tn?`true`:`false`,style:On,children:[Z(`button`,{ref:v,type:`button`,"data-type":$c,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":be==null?`false`:`true`,"data-visible":wn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{e.preventDefault(),e.stopPropagation(),be==null?jn():Dt()},tabIndex:-1,style:kn,children:Z(Km,{...Ye(`file-tree-icon-ellipsis`)})}),be==null?null:Z(`slot`,{name:Qc})]}):null,be==null?null:Z(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),Dt()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),Dt()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var n_={hydrateRoot:(e,t)=>{Vm(_m(t_,t),e)},renderRoot:(e,t)=>{Bm(_m(t_,t),e)},unmountRoot:e=>{Bm(null,e)}};function r_(e,t){n_.renderRoot(e,t)}function i_(e,t){n_.hydrateRoot(e,t)}function a_(e){n_.unmountRoot(e)}var o_=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);n===t?t!=null&&(this.#e.set(e,t),this.#r(e,t)):(n?.remove(),t==null?this.#e.delete(e):(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)}}};Array.isArray;var s_=0;function c_(e){return e!=null&&e.length>0?e:(s_+=1,`pst_ft_${s_}`)}function l_({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??Wf)}function u_(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 d_(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 f_(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var p_=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new o_;#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=c_(a),this.#p=Kp(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=Uf(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new Vp({...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&&(a_(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()}getFocusedIndex(){return this.#t.getFocusedIndex()}getVisibleCount(){return this.#t.getVisibleCount()}getVisibleRows(e,t){return this.#t.getVisibleRows(e,t)}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{t?e():t=!0})}focusPath(e){this.#t.focusPath(e)}focusFirstItem(){this.#t.focusFirstItem()}focusLastItem(){this.#t.focusLastItem()}focusNextItem(){this.#t.focusNextItem()}focusPreviousItem(){this.#t.focusPreviousItem()}focusParentItem(){this.#t.focusParentItem()}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}applyGitStatusPatch(e){let t=qp(this.#p,e);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&r_(n.wrapper,this.#w())}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){Array.isArray(e)?this.#t.resetPaths(e,t):this.#t.resetPaths(e)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),r_(t.wrapper,this.#w()))}setGitStatus(e){let t=Kp(e,this.#p);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&r_(n.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),r_(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),i_(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),r_(r,this.#w())}#C(){return{initialViewportHeight:l_({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;e==null?this.#l.setSlotHtml(Zc,this.#e?.header?.html??null):this.#l.setSlotContent(Zc,e())}#k(e){let t=f_(e).find(e=>d_(e)),n=u_(Vc(tl(this.#m).set));n!=null&&(t==null||t.outerHTML!==n.outerHTML)&&(t==null?e.prepend(n):t.replaceWith(n))}#A(e){let t=f_(e),n=t.find(e=>d_(e)),r=t.filter(e=>e!==n),i=tl(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=u_(i);if(a==null)for(let e of r)e.remove();else if(r.length!==1||r[0].outerHTML!==a.outerHTML){for(let e of r)e.remove();e.appendChild(a)}}#j(e){let t=tl(this.#m);t.colored&&Uc(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${qc}]`);this.#g==null&&t instanceof HTMLStyleElement&&(this.#g=t),this.#h==null||this.#h===``?(this.#g?.remove(),this.#g=void 0,this.#_=void 0):(this.#g?.parentNode!==e||this.#_!==this.#h)&&(this.#g??=document.createElement(`style`),this.#g.setAttribute(qc,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=Jf(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 ep(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)}},m_=e=>e.split(`/`).at(-1)??e,h_={symlink:`porcelain-symlink`,submodule:`porcelain-submodule`},g_=`viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"`,__=`<svg xmlns="http://www.w3.org/2000/svg" style="display:none">
1268
- <symbol id="${h_.symlink}" ${g_}>
1267
+ }`}var Zf=new WeakMap;function Qf(e){let t=Zf.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(Xc,`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(),Zf.set(e,i),i}function $f(e,t){if(!e.isConnected)return;let n=Qf(t);if(n==null)return;let r=t.querySelector(`style[${Zc}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(Zc,``),t.appendChild(i)),i.textContent=`:host { ${Qc}: ${n}px; }`}var ep;function tp(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){ep??(ep=new CSSStyleSheet,ep.replaceSync(Yf(qf)));let t=!1;try{e.adoptedStyleSheets=[ep],t=!0}catch{}if(t){e.querySelector(`style[${Jc}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(Jc,``),t.textContent=Yf(qf),e.prepend(t)}}function np(e,t){rp(e,t),tp(t),$f(e,t)}function rp(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`});np(this,e)}}if(customElements.define(qc,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(qc)))e instanceof HTMLElement&&np(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var ip=e=>e.startsWith(`f::`)?e.slice(3):e;function ap(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function op(e,t){return e===``?t:`${e}/${t}`}function sp({files:e,path:t,isFolder:n,nextBasename:r}){let i=ip(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}=ap(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=op(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 cp(e){return e.endsWith(`/`)}function lp(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 up(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 dp(e,t){return t.includes(e)?up(t):[e]}function fp(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 pp(e,t){return{draggedPaths:e,target:t}}function mp(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(cp(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function hp(e,t){return t.kind===`root`||t.directoryPath==null?lp(e):t.directoryPath}function gp(e,t){let n=e.map(e=>{let n=hp(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 _p(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 vp(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(!_p(Hf.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 yp(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function bp(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 xp(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function Sp(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 xp(e,t.path)?n?e:null:e;case`move`:return bp(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=Sp(r,e,n),r==null)return null;return r}}}function Cp(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function wp(e){switch(e.operation){case`add`:return{...Cp(e),operation:`add`,path:e.path};case`remove`:return{...Cp(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...Cp(e),from:e.from,operation:`move`,to:e.to}}}function Tp(e){return{...Cp(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>wp(e)),operation:`batch`}}function Ep(e){switch(e.operation){case`add`:case`remove`:case`move`:return wp(e);case`batch`:return Tp(e);default:return null}}function Dp(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function Op(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 kp(e){return Op(e).at(-1)??null}function Ap(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function jp(e){return e.endsWith(`/`)}var Mp=e=>e.toLowerCase();function Np(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function Pp(e){return e.endsWith(`/`)?e.slice(0,-1):e}function Fp(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var Ip=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},Lp=Symbol(`FILE_TREE_RENAME_VIEW`),Rp=512,zp=512;function Bp(e){return e===`top`||e===`center`?e:`nearest`}function Vp(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=Op(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 Hp(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:Vp(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var Up=class e{static{Object.defineProperty(e.prototype,Lp,{configurable:!0,value(){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}},writable:!0})}#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=vp({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=kp(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:Bp(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<=zp){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];r!=null&&r===a+1?a=r:(i>=0&&this.#H.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null?(i=-1,a=-1):(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);t!=null&&(this.#B.has(t)?this.deselectPath(t):this.selectPath(t))}togglePathSelectionFromInput(e){let t=this.#Ne(e);t!=null&&(this.#B.has(t)?this.#ae([...this.#B].filter(e=>e!==t),t):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=dp(t,n);return this.#r.canDrag?.(r)!==!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=pp(t.draggedPaths,n);(mp(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}fp(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=pp(e.draggedPaths,t);if(mp(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=gp(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=jp(r),a=Pp(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of Op(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=Np(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}#q(){if(this.#T==null)return;let e=this.#T,t=this.#D;this.#T=null,this.#E=``,this.#D=!1,t?this.remove(e,jp(e)?{recursive:!0}:void 0):(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,jp(e)?{recursive:!0}:void 0);return}let t=jp(e),n=sp({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:Pp(e)});this.#T=null,this.#E=``,this.#D=!1,`error`in n?(this.#Pe(e),this.#v?.(n.error),this.#De()):n.sourcePath===n.destinationPath?(this.#Pe(e),this.#De()):(this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(Fp(n.sourcePath,t),Fp(n.destinationPath,t)))}#Y(e){this.#T!=null&&this.#E!==e&&(this.#E=e,this.#De())}resetPaths(e,t={}){let n=!Array.isArray(e),r=n?void 0:e,i=n?e:t,a=this.#H.list().length,o=this.#G,s=vp({paths:r,preparedInput:i.preparedInput},`resetPaths`,this.#e.sort),c=this.#le(s.paths,s.preparedInput,i.initialExpandedPaths),l=this.#c,u=this.#T,d=this.getSelectedPaths(),f=this.#z;this.#K?.(),this.#H=c,this.#d.clear(),this.#he();let p=d.map(e=>c.getPathInfo(e)?.path??null).filter(e=>e!=null),m=!Dp(this.#B,p);this.#B=new Set(p),m&&(this.#V+=1),this.#z=f==null?null:c.getPathInfo(f)?.path??null,this.#T=u==null?null:c.getPathInfo(u)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(l,l!=null||p.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:s.paths.length,pathCountBefore:a,projectionChanged:!0,usedPreparedInput:i.preparedInput!=null,visibleCountDelta:this.#G-o})}#X(e){this.#Ie();let t=kp(e),n=Ap(e,t),r=null,i=null;for(let e of this.#be()){if(kp(e)!==t)continue;let a=Ap(e,t);if(a<n)r=e;else if(a>n){i=e;break}}return r??i}#Z(e){let t=this.#Ce(e);if(t!==-1)return t;let n=Op(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=!Dp(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 Hf({...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 Op(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(Mp),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(Mp),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 Op(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:Ip(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 Op(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 Op(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=Hp(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,Rp)),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=Sp(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=Sp(this.#c,e,!0),r=[...this.#B].map(t=>Sp(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=Sp(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return Dp(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&&yp(e)&&(this.#i=null);let t=yp(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=Ep(e);i!=null&&this.#Oe(i)})}#ze(e){this.#H.isExpanded(e)?this.#ie(e):this.#ke(e)}},Wp=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 Gp(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1)e[t]!==`/`&&t!==e.length?r===-1&&(r=t):r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1);return n===``?null:{isDirectory:t,path:n}}function Kp(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=[],r=0;for(;;){let e=t.indexOf(`/`,r);if(e===-1)break;n.push(t.slice(0,e+1)),r=e+1}return n}function qp(e,t){return t?`${e}/`:e}function Jp(e,t=null){let n=Wp(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,o=new Map;for(let t of e??[]){let e=Xp(t);e!=null&&$p({canonicalPath:e.canonicalPath,changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,isDirectory:e.isDirectory,status:t.status,statusByPath:r})}return r.size===0?null:{changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}function Yp(e,t){let n=t?.remove??[],r=t?.set??[];if(n.length===0&&r.length===0)return e;let i=new Map(e?.statusByPath),a=new Set(e?.directoriesWithChanges),o=new Set(e?.ignoredDirectoryPaths),s=new Map(e?.changeCountByDirectoryPath),c=!1;for(let e of n){let t=Zp(e);t!=null&&(c=Qp({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,statusByPath:i})||c)}for(let e of r){let t=Xp(e);t!=null&&(c=$p({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,isDirectory:t.isDirectory,status:e.status,statusByPath:i})||c)}return c?i.size===0?null:{changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,signature:nm(i),statusByPath:i}:e}function Xp(e){return Zp(e.path)}function Zp(e){let t=Gp(e);if(t!=null)return{canonicalPath:qp(t.path,t.isDirectory),isDirectory:t.isDirectory}}function Qp({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,statusByPath:i}){let a=i.get(e);return a!=null&&(i.delete(e),a===`ignored`&&e.endsWith(`/`)&&r.delete(e),tm(t,n,e),!0)}function $p({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,isDirectory:i,status:a,statusByPath:o}){let s=o.get(e);return s!==a&&(s??em(t,n,e),o.set(e,a),a===`ignored`&&i?r.add(e):i&&r.delete(e),!0)}function em(e,t,n){for(let r of Kp(n))e.set(r,(e.get(r)??0)+1),t.add(r)}function tm(e,t,n){for(let r of Kp(n)){let n=(e.get(r)??0)-1;n>0?e.set(r,n):(e.delete(r),t.delete(r))}}function nm(e){let t=`${e.size}`;for(let[n,r]of e)t+=`\0${n}\0${r}`;return t}var rm,im,am,om,sm,cm,lm,um,dm,fm,pm={},mm=[],hm=Array.isArray,gm=mm.slice,_m=Object.assign;function vm(e){e&&e.parentNode&&e.remove()}function ym(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?gm.call(arguments,2):n),bm(e,o,r,i,null)}function bm(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??++im,__i:-1,__u:0};return i==null&&rm.vnode!=null&&rm.vnode(a),a}function xm(e){return e.children}function Sm(e,t){this.props=e,this.context=t,this.__g=0}function Cm(e,t){if(t==null)return e.__?Cm(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`?Cm(e):null}function wm(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 wm(e)}}function Tm(e){(8&e.__g||!(e.__g|=8)||!am.push(e)||sm++)&&om==rm.debounceRendering||((om=rm.debounceRendering)||queueMicrotask)(Em)}function Em(){for(var e,t,n,r,i,a,o,s,c=1;am.length;)am.length>c&&am.sort(cm),e=am.shift(),c=am.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=_m({},r)).__v=r.__v+1,rm.vnode&&rm.vnode(n),Pm(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??Cm(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,Im(a,n,o),n.__e!=i&&wm(n)));sm=0}function Dm(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||mm,b=t.length;for(c=Om(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?pm:y[m.__i]||pm,m.__i=f,_=Pm(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&zm(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=km(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function Om(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?bm(null,o,null,null,null):hm(o)?bm(xm,{children:o},null,null,null):o.constructor==null&&o.__b>0?bm(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=Am(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=Cm(s)),Bm(s,s));return r}function km(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=km(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=Cm(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Am(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&!(2&l.__u);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 jm(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function Mm(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||jm(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||jm(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(lm,`$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=um,e.addEventListener(t,a?fm:dm,a)):e.removeEventListener(t,a?fm:dm,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 Nm(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=um++;else if(t.u<n.l)return;return n(rm.event?rm.event(t):t)}}}function Pm(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M=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=rm.__b)&&d(t);n:if(typeof M==`function`)try{if(v=t.props,y=`prototype`in M&&M.prototype.render,b=(d=M.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 M(v,x):(t.__c=f=new Sm(v,x),f.constructor=M,f.render=Vm),b&&b.sub(f),f.props=v,f.state||(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&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=_m({},f.__s)),_m(f.__s,M.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&M.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=rm.__r,w=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);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&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=_m({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===xm&&d.key==null&&(E=Lm(d.props.children)),s=Dm(e,hm(E)?E:[E],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(D=0,O=!1,t.__u|=c?160:128,t.__c.__z=[],k=0;k<a.length;k++)(A=a[k])==null||O||(A.nodeType==8&&A.data==`$s`?(D>0&&t.__c.__z.push(A),D++,a[k]=null):A.nodeType==8&&A.data==`/$s`?(--D>0&&t.__c.__z.push(A),O=D===0,s=a[k],a[k]=null):D>0&&(t.__c.__z.push(A),a[k]=null));if(!O){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(j=a.length;j--;)vm(a[j]);Fm(t)}}else t.__e=n.__e,t.__k=n.__k,e.then||Fm(t);rm.__e(e,t,n)}else s=t.__e=Rm(n.__e,t,n,r,i,a,o,c,l,u);return(d=rm.diffed)&&d(t),128&t.__u?void 0:s}function Fm(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(Fm)}function Im(e,t,n){for(var r=0;r<n.length;r++)zm(n[r],n[++r],n[++r]);rm.__c&&rm.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){rm.__e(e,t.__v)}})}function Lm(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:hm(e)?e.map(Lm):_m({},e)}function Rm(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&&=(rm.__m&&rm.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=gm.call(e.childNodes),v=n.props||pm,!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;Mm(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&&!_||Mm(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=``),Dm(b==`template`?e.content:e,hm(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&Cm(n,0),s,c,l),a!=null)for(u=a.length;u--;)vm(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||Mm(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&Mm(e,u,g,v[u],i))}return e}function zm(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){rm.__e(e,n)}}function Bm(e,t,n){var r,i;if(rm.unmount&&rm.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||zm(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){rm.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Bm(r[i],t,n||typeof e.type!=`function`);n||vm(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function Vm(e,t,n){return this.constructor(e,n)}function Hm(e,t){var n,r,i,a;t==document&&(t=document.documentElement),rm.__&&rm.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=ym(xm,null,[e]),i=[],a=[],Pm(t,e,r||pm,pm,t.namespaceURI,r?null:t.firstChild?gm.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),Im(i,e,a)}function Um(e,t){e.__u|=32,Hm(e,t)}rm={__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 sm=0,e}},im=0,Sm.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=_m({},this.state);typeof e==`function`&&(e=e(_m({},n),this.props)),e&&_m(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Tm(this))},Sm.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),Tm(this))},Sm.prototype.render=xm,am=[],sm=0,cm=function(e,t){return e.__v.__b-t.__v.__b},lm=/(PointerCapture)$|Capture$/i,um=0,dm=Nm(!1),fm=Nm(!0);var Wm=0;Array.isArray;function Z(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:--Wm,__i:-1,__u:0,__source:i,__self:a};return rm.vnode&&rm.vnode(l),l}var Gm=16,Km=16,qm={};function Jm({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}=qm[e]??{width:Gm,height:Km},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return Z(`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:Z(`use`,{href:c})})}var Ym=e=>e!==void 0&&/\s/.test(e),Xm=(e,t)=>{let n=t=>Ym(e[t-1])||Ym(e[t]);if(!n(t))return t;for(let r=1;r<e.length;r++){let i=t-r;if(i>0&&!n(i))return i;let a=t+r;if(a<e.length&&!n(a))return a}return t},Zm=e=>Xm(e,Math.ceil(e.length/2)),Qm=e=>{if(e.length<2)return[e,``];let t=Zm(e);return[e.slice(0,t),e.slice(t)]},$m=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:Zm(e);return[e.slice(0,r),e.slice(r)]},eh=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)]},th=(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)]},nh=(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)]},rh=(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 ih({children:e,marker:t,variant:n=`default`}){"use no memo";return Z(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:Z(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?Z(`span`,{"data-truncate-fade":!0}):t})})}function ah(e){"use no memo";let{mode:t,children:n}=e;return Z(`div`,{children:[Z(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?Z(`span`,{children:n}):n}),Z(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?Z(`span`,{children:n}):n})]})}function oh({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=Z(ah,{mode:t,children:e},`content`),o=Z(ih,{marker:n,mode:t,variant:r},`marker`),s=Z(`div`,{"data-truncate-fill":!0},`fill`);return Z(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:Z(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function sh({children:e,...t}){"use no memo";return Z(oh,{mode:`truncate`,...t,children:e})}function ch({children:e,...t}){"use no memo";return Z(oh,{mode:`fruncate`,...t,children:e})}function lh({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=Z(sh,{...s,children:t[0]}),l=Z(ch,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return Z(`div`,{className:a,style:o});if(e.length<i)return Z(n===`end`?ch:sh,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=Qm:r===`extension`?t=$m:r===`leaf-path`&&(t=eh);else if(typeof r==`number`)t=th,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=nh:e===`first`&&(t=rh)}else typeof r==`function`&&(t=r);t??=Qm;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=Z(sh,{...s,..._,children:f}),l=Z(ch,{...s,...v,children:p})}return Z(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[Z(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),Z(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var uh={endIndex:-1,startIndex:-1};function dh(e,t,n){return Math.min(Math.max(e,t),n)}function fh(e,t){return e<0||t<e?uh:{endIndex:t,startIndex:e}}function ph(e){return e.startIndex<0||e.endIndex<e.startIndex}function mh(e,t){return ph(e)?0:(e.endIndex-e.startIndex+1)*t}function hh(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function gh(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function _h(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);i==null?t.set(r,[n]):i.push(n)}),t}function vh(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;o<=t?(i=a,n=a+1):r=a-1}return i}function yh(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 bh(e,t,n){if(e.length===0||t<=0)return[];let r=yh(e),i=_h(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=vh(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 xh(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=dh(t.scrollTop,0,o),c=t.stickyRows??bh(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=hh(s,n,t.itemHeight),m=hh(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?uh:fh(m,gh(u+d,n,t.itemHeight)),y=g+1,b=ph(v)?uh:fh(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=mh(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:ph(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var Sh={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},Ch={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},wh=`Contains git status items`;function Th(e){return e.current?!0:(e.current=!0,!1)}function Eh(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 Dh(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return Eh({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 Oh(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 kh(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 Ah(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 jh(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function Mh(e,t){return e!=null&&e>0?e:t}function Nh(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 Ph(e,t,n,r,i=0){let a=Eh({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a!=null&&(e.scrollTop=a,!0)}function Fh(e,t,n,r,i,a,o=0){let s=Dh({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s!=null&&(e.scrollTop=s,!0)}function Ih(e,t,n,r,i,a){let o=Oh({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o!=null&&(e.scrollTop=o,!0)}function Lh(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function Rh(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function zh({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return Z(`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 Bh(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 Vh(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 Hh,Uh,Wh,Gh,Kh=Object.is,qh=0,Jh=[],Yh=rm,Xh=Yh.__b,Zh=Yh.__r,Qh=Yh.diffed,$h=Yh.__c,eg=Yh.unmount,tg=Yh.__;function ng(e,t){Yh.__h&&Yh.__h(Uh,e,qh||t),qh=0;var n=Uh.__H||(Uh.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function rg(e){return qh=1,ig(hg,e)}function ig(e,t,n){var r=ng(Hh++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):hg(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);Kh(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=Uh,!Uh.__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,Kh(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};Uh.__f=!0;var a=Uh.shouldComponentUpdate,o=Uh.componentWillUpdate;Uh.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)},Uh.shouldComponentUpdate=i}return r.__N||r.__}function ag(e,t){var n=ng(Hh++,3);!Yh.__s&&mg(n.__H,t)&&(n.__=e,n.u=t,Uh.__H.__h.push(n))}function og(e,t){var n=ng(Hh++,4);!Yh.__s&&mg(n.__H,t)&&(n.__=e,n.u=t,Uh.__h.push(n))}function Q(e){return qh=5,sg(function(){return{current:e}},[])}function sg(e,t){var n=ng(Hh++,7);return mg(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function cg(e,t){return qh=8,sg(function(){return e},t)}function lg(){for(var e;e=Jh.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(fg),e.__H.__h.forEach(pg),e.__H.__h=[]}catch(t){e.__H.__h=[],Yh.__e(t,e.__v)}}Yh.__b=function(e){Uh=null,Xh&&Xh(e)},Yh.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),tg&&tg(e,t)},Yh.__r=function(e){Zh&&Zh(e),Hh=0;var t=(Uh=e.__c).__H;t&&(Wh===Uh?(t.__h=[],Uh.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(fg),t.__h.forEach(pg),t.__h=[],Hh=0)),Wh=Uh},Yh.diffed=function(e){Qh&&Qh(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Jh.push(t)!==1&&Gh===Yh.requestAnimationFrame||((Gh=Yh.requestAnimationFrame)||dg)(lg)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),Wh=Uh=null},Yh.__c=function(e,t){t.some(function(e){try{e.__h.forEach(fg),e.__h=e.__h.filter(function(e){return!e.__||pg(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],Yh.__e(n,e.__v)}}),$h&&$h(e,t)},Yh.unmount=function(e){eg&&eg(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{fg(e)}catch(e){t=e}}),n.__H=void 0,t&&Yh.__e(t,n.__v))};var ug=typeof requestAnimationFrame==`function`;function dg(e){var t,n=function(){clearTimeout(r),ug&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);ug&&(t=requestAnimationFrame(n))}function fg(e){var t=Uh,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),Uh=t}function pg(e){var t=Uh;e.__c=e.__(),Uh=t}function mg(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!Kh(t,e[n])})}function hg(e,t){return typeof t==`function`?t(e):t}function gg(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:Z(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return Z(xm,{children:[Z(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:Z(sh,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function _g(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function vg(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function yg(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 bg({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=xh(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:yg(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?yg(u,1,t,o):i&&r<=0&&c.length>0?bh(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 xg=400,Sg=40,Cg=18;function wg(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))?Tg(e,t,n):a instanceof HTMLElement?a:null}function Tg(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 Eg(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 Dg(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 Og(){return navigator.vendor!==`Apple Computer, Inc.`}function kg(e,t){let n=e-t.top;if(n<Sg)return-Math.ceil((Sg-Math.max(0,n))/Sg*Cg);let r=t.bottom-e;return r<Sg?Math.ceil((Sg-Math.max(0,r))/Sg*Cg):0}function Ag(e,t){if(e!=null){let t=Sh[e];return t==null?null:{text:t,title:Ch[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:wh}:null}function jg(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 Mg(e){return e!=null&&`toggle`in e}function Ng(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function Pg(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function Fg(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function Ig(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function Lg(e,t){return t&&Ig(e)||(e.ctrlKey||e.metaKey)&&Ng(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var Rg=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function zg(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 Bg(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 Vg(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function Hg(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function Ug(e,t,n){n==null?e.delete(t):e.set(t,n)}function Wg(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 Gg(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 Kg(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 qg(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=Kg(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 Jg(e,t){return{kind:e.kind,name:vg(e),path:t}}function Yg(e){return e==null?void 0:`${e}__tree`}function Xg(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function Zg(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function Qg(e,t){if(e==null)return null;if(`text`in e)return e.parts==null?Z(`span`,{title:e.title,children:e.text}):Z(`span`,{title:e.title,children:e.parts.map((e,t)=>Z(`span`,{style:{color:e.color},children:e.text},t))});let n=typeof e.icon==`string`?Zg(e.icon)?t(e.icon):{name:e.icon}:Zg(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return Z(`span`,{title:e.title,children:Z(Jm,{...n})})}function $g(e){e!=null&&kh(e.querySelector(`button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`)??e)}function e_(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=_g(e);return Z(xm,{children:[e.depth>0?Z(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>Z(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,Z(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?Z(Jm,{...t(`file-tree-icon-chevron`)}):Z(Jm,{...t(`file-tree-icon-file`,u)})}),Z(`div`,{"data-item-section":`content`,children:e.isFlattened?gg(e,c,a):c??Z(lh,{minimumLength:5,split:`extension`,children:e.name})}),i?Z(`div`,{"data-item-section":`decoration`,children:r==null?null:Qg(r,t)}):null,s?Z(`div`,{"data-item-section":`git`,children:Qg(o,t)}):null,n?Z(`div`,{"data-item-section":`action`,children:l?Z(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:Z(Jm,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function t_(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:w,contextMenuButtonVisibility:T,contextMenuRightClickEnabled:E,registerRenameInput:D,registerButton:O,resolveIcon:k,renderDecorationForRow:A,openContextMenuForRow:j,onRowClick:M,onKeyDown:N}=e,P=_g(t),{isParked:F=!1,mode:I=`flow`,style:L}=r,R=I===`sticky`,ee=_?.get(P)??null??jg(t.ancestorPaths,v,y),te=t.kind===`directory`&&(b?.has(P)??!1),z=A(t,P),ne=Ag(ee,te),B=S&&w,re=z!=null||x||B,ie=B&&T===`always`,V=a.getPath()===P,ae=V?a.getValue():``,oe=R||!V?null:Z(zh,{ref:D,ariaLabel:`Rename ${vg(t)}`,isFlattened:t.isFlattened,value:ae,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),se=e_(t,k,{actionLaneEnabled:B,customDecoration:z,decorationLaneEnabled:re,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:ne,gitLaneActive:x,renameInput:oe,showDecorativeActionAffordance:ie}),ce={...Bh({ariaLabel:vg(t),domId:t.isFocused?Xg(h,P,F):void 0,extraStyle:L,features:{actionLaneEnabled:B,contextMenuButtonVisibility:B?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:F,itemHeight:g,mode:I,row:t,state:{containsGitChange:te,effectiveGitStatus:ee,isContextHovered:s===P,isDragTarget:l?.kind===`directory`&&l.directoryPath===P,isDragging:c?.has(P)===!0,isFocusRinged:t.isFocused&&o===P},targetPath:P}),key:n,onContextMenu:S||u?e=>{d()?e.preventDefault():S&&(e.preventDefault(),E&&(i.focusMountedPathFromInput(P),j(t,P,{anchorRect:Vg(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:R?void 0:()=>{i.focusMountedPathFromInput(P)},onKeyDown:R?void 0:N,ref:e=>{O(P,e)}};return!R&&V?Z(`div`,{...ce,children:se}):Z(`button`,{...ce,type:`button`,draggable:u&&!F,onDragEnd:u&&!F?p:void 0,onDragStart:u&&!F?e=>{f(e,t,P)}:void 0,onMouseDown:e=>{(R||i.isSearchOpen())&&e.preventDefault()},onTouchStart:u&&!F?e=>{m(e,t,P)}:void 0,onClick:e=>{M(e,t,P,I)},children:se})}function n_(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(_g(e))).map((n,r)=>t_(e,n,t.start+r))}function r_({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=Kf,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 _=Q(null),v=Q(null),y=Q(!1),b=Q(null),x=Q(null),S=Q(null),C=Q(null),w=Q(null),T=Q(new Map),E=Q(new Map),D=Q(()=>{}),O=Q(null),k=Q(0),A=Q(!1),j=Q(null);j.current!==t&&(A.current=!1,j.current=t);let M=Q(!1),N=Q(null),P=Q(null),F=Q(!1),I=Q(null),L=Q(null),R=Q(null),ee=Q(null),te=Q(null),z=Q(null),ne=Q(null),B=Q(null),re=Q(!1),ie=Q(null),V=Q(null),ae=Q(null),oe=Q(null),se=sg(()=>new Map,[]),[,ce]=rg(0),le=Q(!1),[ue,de]=rg(null),[fe,pe]=rg(null),[me,he]=rg(null),[ge,_e]=rg(null),[ve,ye]=rg(0),[be,xe]=rg(null),Se=Q(be);Se.current=be;let Ce=Q(null),H=Q(null),we=Q(null),Te=Q(null),Ee=Q(null),De=Q(!1),Oe=()=>{H.current=null,we.current=null,Te.current=null},ke=(e,t)=>{H.current=e,we.current=null,Te.current=t==null?null:{path:e,scrollTop:t}},U=(e,t)=>{H.current=null,we.current={path:e,viewportOffset:t},Te.current=null},Ae=Q(d===`retain`&&t.isSearchOpen()),[je,Me]=rg(p);ag(()=>{p||Me(!1)},[p]);let Ne=Q(!1),Pe=cg(()=>{Ne.current=!0,Me(e=>e&&!1)},[]),[Fe,Ie]=rg(()=>bg({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Le,Re]=rg(!1);ag(()=>{Re(!0)},[]);let ze=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Be=e?.contextMenu?.triggerMode??(ze?`right-click`:`both`),Ve=Be===`both`||Be===`button`,He=e?.contextMenu?.buttonVisibility??`when-needed`,Ue=Be===`both`||Be===`right-click`;og(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;Ee.current=t,pe(t),_e(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(De.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 We=cg((e,t)=>{Ug(T.current,e,t)},[]),Ge=cg((e,t)=>{Ug(E.current,e,t)},[]),Ke=cg(e=>{x.current=e},[]),qe=cg(e=>Wg(e,E.current,T.current),[]),Je=n!=null||r!=null||i!=null,{resolveIcon:Ye}=sg(()=>cl(a),[a]),Xe=t[Lp](),Ze=Xe.getPath(),Qe=Ze!=null,$e=t.isSearchOpen(),et=t.getSearchValue(),W=t.getFocusedPath(),tt=t.getFocusedIndex(),nt=t.getScrollRequest(),rt=t.isDragAndDropEnabled(),it=t.getDragSession(),at=sg(()=>it==null?null:new Set(it.draggedPaths),[it]),ot=it?.target??null,st=it?.primaryPath??null,ct=Yg(o),{overlayHeight:lt,overlayRows:ut,snapshot:dt,visibleRows:ft}=Fe,pt=dt.physical.viewportHeight,mt=sg(()=>({end:dt.window.endIndex,start:dt.window.startIndex}),[dt.window.endIndex,dt.window.startIndex]),ht=ut,gt=dt.sticky.rows,_t=dt.physical.totalHeight,vt=dt.sticky.height,yt=sg(()=>new Set(gt.map(e=>_g(e.row))),[gt]),bt=tt>=0&&tt>=mt.start&&tt<=mt.end,xt=cg((e,t)=>u?.({item:Jg(e,t),row:e})??null,[u]),St=cg(e=>kh(e==null?null:T.current.get(e)??null)?!0:kh(S.current),[]),Ct=cg(e=>{St(t.focusNearestPath(e))},[t,St]),wt=Q(Ct);wt.current=Ct;let Tt=Q(!0),Et=Q(()=>{}),Dt=cg((t=!0)=>{let n=Se.current;n!=null&&(Tt.current=Tt.current&&t,xe(null),e?.contextMenu?.onClose?.(),Tt.current&&Ct(n.path))},[e?.contextMenu,Ct]);Et.current=Dt;let Ot=cg(e=>{let t=e==null?null:Hg(S.current,e);he(e=>e===t?e:t)},[]),kt=cg((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=qe(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;ke(n,e?.scrollTop??null),M.current=!0,de(e=>e===n?e:n)}i.focus(),Ot(a),Tt.current=!0,xe({anchorRect:r?.anchorRect??null,item:Jg(e,n),path:n,source:r?.source??`keyboard`})},[t,qe,Ot]),At=cg(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=jh(e,pt);I.current=tt<0||e==null?null:Math.max(0,Math.min(tt*s-e.scrollTop,Math.max(0,t-s))),F.current=!0}t.startRenaming(e)!==!1&&(_e(`focus`),ce(e=>e+1))}},[t,tt,s,l,pt]),jt=cg((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=jh(i,pt),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:bg({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return M.current=!0,Ih(i,a,s,l,u,d),D.current(),Ce.current=n?e:null,!0},[t,s,c,pt,h]),Mt=()=>y.current===!0||oe.current!=null||re.current===!0,Nt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Pt=e=>{e!=null&&(typeof window.cancelAnimationFrame==`function`?window.cancelAnimationFrame(e):window.clearTimeout(e))},Ft=()=>{ee.current!=null&&(clearTimeout(ee.current),ee.current=null),R.current=null},It=()=>{z.current?.remove(),z.current=null},Lt=()=>{Pt(L.current),L.current=null,te.current=null},Rt=e=>{let t=S.current?.getRootNode();t instanceof ShadowRoot?t.append(e):document.body.append(e)},zt=()=>{B.current?.(),B.current=null,oe.current!=null&&(clearTimeout(oe.current),oe.current=null),re.current=!1,ie.current=null,ae.current=null,V.current!=null&&(V.current.setAttribute(`draggable`,`true`),V.current.style.removeProperty(`touch-action`),V.current=null),It(),Ft(),Lt(),ne.current=null},Bt=(e,n)=>{let r=S.current?.getRootNode(),i=Eg(wg(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Vt=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Ft();return}let r=t.getItem(e.directoryPath),i=Mg(r)?r:null;if(i==null||i.isExpanded()){Ft();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;R.current!==a&&(Ft(),R.current=a,ee.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind===`directory`&&n.directoryPath===e.directoryPath&&n.flattenedSegmentPath===e.flattenedSegmentPath&&i.expand()},n))},Ht=()=>{L.current=null;let e=te.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=kg(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,D.current()),Vt(Bt(e.clientX,e.clientY)),L.current=Nt(Ht)},Ut=(e,t)=>{te.current={clientX:e,clientY:t},L.current??=Nt(Ht)},Wt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(zt(),It(),Ft(),Lt(),t.startDrag(r)===!1)e.preventDefault();else if(ne.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),Og())){let t=Dg(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Rt(t),z.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Gt=()=>{It(),Ft(),Lt(),ne.current=null,t.cancelDrag()},Kt=(e,n,r)=>{if(oe.current!=null||re.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;ae.current={clientX:i.clientX,clientY:i.clientY},V.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!re.current;oe.current!=null&&(clearTimeout(oe.current),oe.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),B.current===o&&(B.current=null),t&&(a.setAttribute(`draggable`,`true`),V.current===a&&(V.current=null),ae.current=null)},s=e=>{let t=e.touches[0],n=ae.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=100||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),B.current=o,oe.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),V.current===a&&(V.current=null),ae.current=null;return}re.current=!0,V.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),ne.current=n;let e=a.getBoundingClientRect(),s=Dg(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`}),Rt(s),z.current=s,ie.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=ie.current;n!=null&&z.current!=null&&(z.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),Vt(Bt(t.clientX,t.clientY)),Ut(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Bt(n.clientX,n.clientY),t.completeDrag(),zt()},u=()=>{t.cancelDrag(),zt()};B.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)},xg)},qt=e=>{if(be!=null){if(e.key===`Escape`){Dt(),e.preventDefault(),e.stopPropagation();return}Rg.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(Xe.isActive()){if(e.isComposing||e.keyCode===229)return;if(e.key===`Escape`)Xe.cancel();else if(e.key===`Enter`)Xe.commit();else return;_e(`focus`),ce(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){At(W??void 0),e.preventDefault(),e.stopPropagation();return}if($e){if(e.key===`Escape`)F.current=!1,I.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=jh(n,pt);I.current=tt<0||n==null?null:Math.max(0,Math.min(tt*s-n.scrollTop,Math.max(0,r-s))),F.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;_e(`focus`),ce(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&Pg(e)){t.openSearch(e.key),ce(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=ze&&Ig(e),r=Lg(e,ze),i=r&&S.current!=null?Ah(S.current):null,a=r?new Set(Gg(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==W&&a.has(o)){let e=C.current;ke(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=Mg(p)?p:null,h=u!=null&&(yt.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=Wg(u,E.current,T.current);e==null||n==null?y=!1:kt(e,u)}else if((e.ctrlKey||e.metaKey)&&Ng(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;_e(`focus`);let b=t.getFocusedPath(),x=b!=null&&(yt.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))ke(b,v?.scrollTop??null),M.current=!0,de(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(U(b,qg(S.current,v,i,u,s,vt,pt)),M.current=!0,de(e=>e===b?e:b)):Oe()}ce(e=>e+1),e.preventDefault(),e.stopPropagation()};og(()=>{f&&$e&&(Ae.current?Ae.current=!1:kh(w.current))},[$e,f]),og(()=>{let e=x.current;switch(Rh({hasRenderedInput:e!=null,previousRenamingPath:P.current,renamingPath:Ze})){case`reset`:P.current=null;return;case`reveal-canonical`:Ze!=null&&jt(Ze,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(Ce.current=null,P.current=Ze,kh(e),e.select());return}},[mt.end,mt.start,Ze,jt,yt]),og(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=Ah(e)?.dataset.itemPath??null;de(e=>e===t?e:t)},i=()=>{n(),M.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{t=null,Ah(e)==null?(M.current=!1,de(null)):r()},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),M.current=!1,de(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;de(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),og(()=>{let e=S.current;e!=null&&(dt.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[dt.physical.scrollTop]),og(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=jh(n,g);let a=()=>{let e=t.getVisibleCount(),r=Mh(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Ie(bg({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!A.current){A.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=Mh(O.current,g),i=t.getVisibleRows(e,e)[0]??null;Ph(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}D.current=a;let o=t.subscribe(()=>{Th(le)&&ce(e=>e+1),a()}),l=()=>{De.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,ye(e=>e+1),e=null},50))},u=null,d=()=>{i!=null&&delete i.dataset.overlayReveal,u!=null&&(clearTimeout(u),u=null)},f=()=>{i!=null&&De.current!==!0&&(n.scrollTop>0||(i.dataset.overlayReveal=`true`,u!=null&&clearTimeout(u),u=setTimeout(()=>{d()},200)))},p=()=>{a(),n.scrollTop>0&&d(),Se.current!=null&&y.current&&Et.current(),De.current===!0?y.current=!1:(pe(e=>e==null?e:null),l())},m=()=>{l(),f()},_=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),v=e=>{_.has(e.key)&&m()};n.addEventListener(`scroll`,p,{passive:!0}),n.addEventListener(`wheel`,m,{passive:!0}),n.addEventListener(`touchmove`,m,{passive:!0}),n.addEventListener(`keydown`,v);let x=typeof ResizeObserver<`u`?new ResizeObserver(e=>{O.current=(e[0]==null?null:Nh(e[0]))??jh(n,g),a()}):null;return x?.observe(n),()=>{D.current=()=>{},o(),n.removeEventListener(`scroll`,p),n.removeEventListener(`wheel`,m),n.removeEventListener(`touchmove`,m),n.removeEventListener(`keydown`,v),e!=null&&clearTimeout(e),u!=null&&clearTimeout(u),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,O.current=null,x?.disconnect()}},[t,g,s,c,h]),og(()=>{ze||be==null||Dt(!1)},[Dt,ze,be]);let Jt=sg(()=>be==null?null:`${be.path}::${be.source}`,[be]);og(()=>{if(Jt==null){m?.clearSlotContent(el);return}let t=Se.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??Bg(n.getBoundingClientRect()),close:e=>{Et.current(e?.restoreFocus??!0)},restoreFocus:()=>{Tt.current&&wt.current(Se.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(el,i),e?.contextMenu?.onOpen?.(t.item,r),$g(i),queueMicrotask(()=>{i!=null&&i.isConnected&&document.activeElement===i&&$g(i)}),()=>{m?.clearSlotContent(el)}},[Jt,e?.contextMenu,m]),og(()=>{be!=null&&t.getItem(be.path)==null&&Dt()},[Dt,be,t]),og(()=>{if(be==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(zg(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&Dt())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Dt())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[Dt,be]),og(()=>{let e=C.current,n=S.current;if(e==null||n==null){N.current=W;return}let r=W==null?null:T.current.get(W)??null,i=Ah(n),a=i?.dataset.itemPath??null,o=Qe&&x.current===i,c=f&&w.current===i,l=F.current&&!$e,u=I.current??0,d=Ce.current,p=H.current,m=we.current,g=Te.current,_=i!=null,v=M.current||_,y=N.current!==W,b=p!=null&&p===W&&W!=null,E=!1,O=!1;if(nt!=null&&nt.id!==k.current){k.current=nt.id;let n=nt.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,pt-s))):vt;E=!0,O=Fh(e,n,s,pt,_t,nt.offset,t)}t.clearScrollRequest(nt.id)}let A=!E&&l&&Ih(e,tt,s,pt,_t,u),j=!E&&d!=null&&d===W&&Ih(e,tt,s,pt,_t,vt),P=!E&&m!=null&&m.path===W&&Ih(e,tt,s,pt,_t,m.viewportOffset),L=!E&&g!=null&&g.path===W&&e.scrollTop!==g.scrollTop;L&&(e.scrollTop=g.scrollTop),(L||O||j||P||A||v&&y&&d!==W&&!b&&Ph(e,tt,s,pt,vt))&&D.current(),E?N.current=W:v?o||c&&!l?N.current=W:r==null?(l&&tt>=0&&(Ih(e,tt,s,pt,_t,u),D.current()),N.current=W):((y||l||d===W||p===W||m?.path===W||g?.path===W||a==null||a!==W)&&(kh(r),d===W&&(Ce.current=null),p===W&&(H.current=null),m?.path===W&&(we.current=null),g?.path===W&&(Te.current=null),F.current=!1,I.current=null),N.current=W):N.current=W},[t,tt,W,bt,s,Qe,$e,mt,pt,f,nt,h,vt,_t,ft]);let Yt=tt>=0&&tt>=dt.visible.startIndex&&tt<=dt.visible.endIndex,Xt=W!=null&&ht.some(e=>_g(e.row)===W),Zt=Yt||Xt,Qt=Ve&&M.current===!0&&Zt?W:null,$t=ge===`pointer`?fe:null,en=be?.path??Ee.current??$t??Qt??fe,tn=be?.source===`right-click`;og(()=>{y.current&&be==null||Ot(qe(en))},[be,qe,mt,pt,ve,ht,en,Ot,ft]);let nn=cg(e=>{if(y.current||zg(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&&_e(e=>e===`pointer`?e:`pointer`),pe(e=>e===i?e:i)},[]),rn=cg(()=>{pe(null)},[]);og(()=>{if(!rt)return;let e=()=>{zt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),zt(),t.cancelDrag()}},[t,rt]);let an=e=>{if(!rt||t.getDragSession()==null||re.current)return;let n=Eg(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Vt(t.getDragSession()?.target??null),Ut(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},on=e=>{if(!rt||t.getDragSession()==null||re.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Ft(),Lt(),t.setDragTarget(null))},sn=e=>{rt&&t.getDragSession()!=null&&!re.current&&(e.preventDefault(),Bt(e.clientX,e.clientY),t.completeDrag(),It(),Ft(),Lt(),ne.current=null)},cn=dt.window.height,ln=dt.window.offsetTop,un=Math.min(0,pt-cn),dn=Math.min(0,pt-cn-vt),fn=ue===W||F.current,pn=W!=null&&fn&&!bt&&tt>=0?ft[tt]??t.getVisibleRows(tt,tt)[0]??null:null,mn=pn==null?null:Lh(tt,s,mt,cn),hn=ne.current,gn=st!=null&&hn!=null&&hn.path===st&&hn.index>=mt.start&&hn.index<=mt.end,_n=st!=null&&hn!=null&&hn.path===st&&!gn&&hn.path!==pn?.path?hn:null,vn=_n==null?null:Lh(_n.index,s,mt,cn),yn=Fg((tt>=0?ft[tt]??t.getVisibleRows(tt,tt)[0]??null:null)?.ancestorPaths.at(-1)??null),bn=$e&&W!=null?Xg(o,W,!bt):void 0,xn=be?.path??($e?W:ue),Sn=be?.path??fe,Cn=qe(en),wn=ze&&Ve&&!tn&&!Qe&&Cn!=null&&me!=null&&en!=null,Tn=ze&&(wn||be!=null),En=be?.anchorRect,Dn=En==null&&Cn!=null&&me!=null&&(be!=null||wn)?me:null,On=En==null?Dn==null?void 0:{top:`${Dn}px`}:{left:`${En.left}px`,position:`fixed`,right:`auto`,top:`${En.top}px`},kn=tn?{opacity:`0`}:void 0,An=cg((e,n,r,i)=>{let a=Vh({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:$e,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)}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=dt.visible.startIndex&&n.index<=dt.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(M.current=!0,de(e=>e===c?e:c),_e(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&jt(c,{targetOffset:`sticky-parents`})},[t,$e,dt.visible.endIndex,dt.visible.startIndex,jt]),jn=()=>{if(y.current||!Ve||en==null||Cn==null)return;let e=t.getItem(en);e!=null&&(Ot(Cn),Tt.current=!0,xe({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:Cn.getAttribute(`aria-label`)??en,path:e.getPath()},path:e.getPath(),source:`button`}))},Mn={contextHoverPath:Sn,contextMenuButtonTriggerEnabled:Ve,contextMenuButtonVisibility:He,contextMenuEnabled:ze,contextMenuRightClickEnabled:Ue,contextMenuTriggerMode:Be,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:rt,draggedPathSet:at,dragTarget:ot,gitLaneActive:Je,gitStatusByPath:n,handleRowDragEnd:Gt,handleRowDragStart:Wt,handleRowTouchStart:Kt,ignoredGitDirectories:r,ignoredInheritanceCache:se,instanceId:o,itemHeight:s,onKeyDown:qt,onRowClick:An,openContextMenuForRow:kt,registerButton:We,registerRenameInput:Ke,renameView:Xe,renderDecorationForRow:xt,resolveIcon:Ye,shouldSuppressContextMenu:Mt,visualFocusPath:xn},Nn={...Mn,registerButton:Ge};return Z(`div`,{ref:S,id:ct,"data-file-tree-context-menu-button-visibility":ze&&Ve?He:void 0,"data-file-tree-context-menu-trigger-mode":ze?Be:void 0,"data-file-tree-has-context-menu-action-lane":ze&&Ve?`true`:void 0,"data-file-tree-has-git-lane":Je?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:rt?on:void 0,onDragOver:rt?an:void 0,onDrop:rt?sn:void 0,onKeyDown:qt,onPointerLeave:ze?rn:void 0,onPointerOver:ze?nn:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[Z(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:yn}}),Z(`slot`,{name:$c,"data-type":`header-slot`}),f?Z(`div`,{"data-file-tree-search-container":!0,"data-open":$e?`true`:`false`,children:Z(`input`,{ref:w,"aria-activedescendant":bn,"aria-controls":ct,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":je?`true`:void 0,value:et,onBlur:()=>{(d!==`retain`||Ne.current)&&t.closeSearch()},onFocus:Pe,onPointerDown:Pe,onInput:e=>{Pe();let n=e.currentTarget;t.setSearch(n.value)}})}):null,Z(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Le&&ht.length>0?Z(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:Z(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${lt}px`},children:ht.map((e,t)=>t_(Nn,e.row,`sticky:${_g(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${ht.length-t}`}}))})}):null,Z(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${_t}px`},children:[Z(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${ln}px`}}),Z(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${cn}px`,top:`${un}px`,bottom:`${dn}px`},children:[n_(Mn,mt,yt),pn!=null&&mn!=null?t_(Mn,pn,`parked:${pn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:st===pn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${mn}px`}}):null,_n!=null&&vn!=null?t_(Mn,_n,`parked-drag:${_n.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${vn}px`}}):null]})]})]}),ze?Z(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":Tn?`true`:`false`,style:On,children:[Z(`button`,{ref:v,type:`button`,"data-type":tl,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":be==null?`false`:`true`,"data-visible":wn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{e.preventDefault(),e.stopPropagation(),be==null?jn():Dt()},tabIndex:-1,style:kn,children:Z(Jm,{...Ye(`file-tree-icon-ellipsis`)})}),be==null?null:Z(`slot`,{name:el})]}):null,be==null?null:Z(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),Dt()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),Dt()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var i_={hydrateRoot:(e,t)=>{Um(ym(r_,t),e)},renderRoot:(e,t)=>{Hm(ym(r_,t),e)},unmountRoot:e=>{Hm(null,e)}};function a_(e,t){i_.renderRoot(e,t)}function o_(e,t){i_.hydrateRoot(e,t)}function s_(e){i_.unmountRoot(e)}var c_=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);n===t?t!=null&&(this.#e.set(e,t),this.#r(e,t)):(n?.remove(),t==null?this.#e.delete(e):(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)}}};Array.isArray;var l_=0;function u_(e){return e!=null&&e.length>0?e:(l_+=1,`pst_ft_${l_}`)}function d_({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??Kf)}function f_(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 p_(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 m_(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var h_=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new c_;#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=u_(a),this.#p=Jp(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=Gf(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new Up({...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&&(s_(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()}getFocusedIndex(){return this.#t.getFocusedIndex()}getVisibleCount(){return this.#t.getVisibleCount()}getVisibleRows(e,t){return this.#t.getVisibleRows(e,t)}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{t?e():t=!0})}focusPath(e){this.#t.focusPath(e)}focusFirstItem(){this.#t.focusFirstItem()}focusLastItem(){this.#t.focusLastItem()}focusNextItem(){this.#t.focusNextItem()}focusPreviousItem(){this.#t.focusPreviousItem()}focusParentItem(){this.#t.focusParentItem()}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}applyGitStatusPatch(e){let t=Yp(this.#p,e);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&a_(n.wrapper,this.#w())}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){Array.isArray(e)?this.#t.resetPaths(e,t):this.#t.resetPaths(e)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),a_(t.wrapper,this.#w()))}setGitStatus(e){let t=Jp(e,this.#p);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&a_(n.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),a_(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),o_(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),a_(r,this.#w())}#C(){return{initialViewportHeight:d_({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;e==null?this.#l.setSlotHtml($c,this.#e?.header?.html??null):this.#l.setSlotContent($c,e())}#k(e){let t=m_(e).find(e=>p_(e)),n=f_(Uc(rl(this.#m).set));n!=null&&(t==null||t.outerHTML!==n.outerHTML)&&(t==null?e.prepend(n):t.replaceWith(n))}#A(e){let t=m_(e),n=t.find(e=>p_(e)),r=t.filter(e=>e!==n),i=rl(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=f_(i);if(a==null)for(let e of r)e.remove();else if(r.length!==1||r[0].outerHTML!==a.outerHTML){for(let e of r)e.remove();e.appendChild(a)}}#j(e){let t=rl(this.#m);t.colored&&Gc(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${Yc}]`);this.#g==null&&t instanceof HTMLStyleElement&&(this.#g=t),this.#h==null||this.#h===``?(this.#g?.remove(),this.#g=void 0,this.#_=void 0):(this.#g?.parentNode!==e||this.#_!==this.#h)&&(this.#g??=document.createElement(`style`),this.#g.setAttribute(Yc,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=Xf(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 np(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)}},g_=e=>e.split(`/`).at(-1)??e,__={symlink:`porcelain-symlink`,submodule:`porcelain-submodule`},v_=`viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"`,y_=`<svg xmlns="http://www.w3.org/2000/svg" style="display:none">
1268
+ <symbol id="${__.symlink}" ${v_}>
1269
1269
  <path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" />
1270
1270
  <path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" />
1271
1271
  </symbol>
1272
- <symbol id="${h_.submodule}" ${g_}>
1272
+ <symbol id="${__.submodule}" ${v_}>
1273
1273
  <path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z" />
1274
1274
  <circle cx="12" cy="13" r="2" />
1275
1275
  <path d="M14 13h3" />
1276
1276
  <path d="M7 13h3" />
1277
1277
  </symbol>
1278
- </svg>`;function v_(e=[]){return{set:`complete`,colored:!0,spriteSheet:__,byFileExtension:ga.byFileExtension,byFileName:{...ga.byFileName,...Object.fromEntries(e.flatMap(e=>{let t=e.kind===`symlink`?h_.symlink:e.kind===`submodule`?h_.submodule:null;return t?[[m_(e.path),t]]:[]}))}}}var y_=ol(v_()),b_=`${Vc(`complete`)}${__}`;function x_(){let e=(0,q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(`div`,{"aria-hidden":`true`,style:{position:`absolute`,width:0,height:0,overflow:`hidden`},dangerouslySetInnerHTML:{__html:b_}}),e[0]=t):t=e[0],t}function S_(e){let t=(0,q.c)(14),{path:n,expanded:r,className:i}=e,a;t[0]===n?a=t[1]:(a=y_.resolveIcon(n===void 0?`file-tree-icon-chevron`:`file-tree-icon-file`,n),t[0]=n,t[1]=a);let o=a,s=o.token?Sa[o.token]:void 0,c=o.width??16,l=o.height??16,u;t[2]===s?u=t[3]:(u=s?{color:`light-dark(${s.light}, ${s.dark})`}:void 0,t[2]=s,t[3]=u);let d=o.viewBox??`0 0 ${c} ${l}`,f=r===!1&&`-rotate-90`,p;t[4]!==i||t[5]!==f?(p=H(`pierre-file-icon`,f,i),t[4]=i,t[5]=f,t[6]=p):p=t[6];let m=`#${o.name}`,h;t[7]===m?h=t[8]:(h=(0,K.jsx)(`use`,{href:m}),t[7]=m,t[8]=h);let g;return t[9]!==u||t[10]!==d||t[11]!==p||t[12]!==h?(g=(0,K.jsx)(`svg`,{"aria-hidden":`true`,style:u,viewBox:d,className:p,children:h}),t[9]=u,t[10]=d,t[11]=p,t[12]=h,t[13]=g):g=t[13],g}var C_=e=>`data:${e.mediaType};base64,${e.base64}`;function w_(e,t,n){let r=(0,q.c)(4),i;return r[0]!==e||r[1]!==n||r[2]!==t?(i=Ye({scope:t,connection:e,path:n}),r[0]=e,r[1]=n,r[2]=t,r[3]=i):i=r[3],B(i)}function T_(e,t,n,r,i){let a=(0,q.c)(6),o;return a[0]!==e||a[1]!==r||a[2]!==n||a[3]!==i||a[4]!==t?(o=Rt({scope:t,connection:e,path:n,html:r,platform:i}),a[0]=e,a[1]=r,a[2]=n,a[3]=i,a[4]=t,a[5]=o):o=a[5],B(o)}function E_(e){let t=(0,q.c)(3),{scope:n,path:r,connection:i}=e,a=w_(i,n,r),o;return t[0]!==r||t[1]!==a?(o=(0,K.jsx)(`div`,{className:`flex w-full flex-col items-center gap-2 p-4`,children:(0,K.jsx)(D_,{query:a,path:r})}),t[0]=r,t[1]=a,t[2]=o):o=t[2],o}function D_(e){let t=(0,q.c)(10),{query:n,path:r}=e;if(sr(n)){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,K.jsx)(`p`,{role:`status`,children:`Loading image…`}),t[0]=e):e=t[0],e}if(Wn(n)){let e;t[1]===n.cause?e=t[2]:(e=la(xr(n.cause)),t[1]=n.cause,t[2]=e);let r;return t[3]===e?r=t[4]:(r=(0,K.jsx)(`p`,{role:`status`,children:e}),t[3]=e,t[4]=r),r}let i;t[5]===n?i=t[6]:(i=C_(zn(Ht(n))),t[5]=n,t[6]=i);let a;return t[7]!==r||t[8]!==i?(a=(0,K.jsx)(`img`,{src:i,alt:r,className:`max-h-[70vh] max-w-full object-contain`}),t[7]=r,t[8]=i,t[9]=a):a=t[9],a}function O_(e){let t=(0,G.useRef)(e);return(0,G.useInsertionEffect)(()=>void(t.current=e)),(0,G.useCallback)((...e)=>t.current(...e),[])}var k_=(0,G.createContext)(void 0);function A_(){return(0,G.useContext)(k_)}var j_={position:`absolute`,top:0,bottom:0,textAlign:`center`,whiteSpace:`normal`,touchAction:`none`},M_={display:`contents`};function N_(){return null}function P_(e,t){return e-(t===0?0:1)}function F_(e,t){return P_(e,t)+t}function I_({file:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,lineAnnotations:o,renderGutterUtility:s,getHoveredLine:c,getAnnotationSlotName:l=xi}){let u=t?.(e),d=n?.(e),f=r?.(e),p=i?.(e);return(0,K.jsxs)(K.Fragment,{children:[u==null?(0,K.jsxs)(K.Fragment,{children:[d!=null&&(0,K.jsx)(`div`,{slot:`header-prefix`,children:d}),f!=null&&(0,K.jsx)(`div`,{slot:`header-filename-suffix`,children:f}),p!=null&&(0,K.jsx)(`div`,{slot:`header-metadata`,children:p})]}):(0,K.jsx)(`div`,{slot:Ei,children:u}),a!=null&&o?.map((t,n)=>(0,K.jsx)(`div`,{slot:l(t),children:a(t,e)},n)),s!=null&&(0,K.jsx)(`div`,{slot:`gutter-utility-slot`,style:j_,children:s(c)})]})}function L_(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e===t}function R_(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function z_(e,t){return yi(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function B_(e){let t=e.lang??Ai(e.name),n=e.lang??(e.prevName==null?`text`:Ai(e.prevName));return t===`text`&&n===`text`}function V_(e){return[P_(e.additionStart,e.additionCount)+1,F_(e.additionStart,e.additionCount)+1]}function H_({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:r,collapsedContextThreshold:i}){let a=Math.max(t,0);if(a===0||e)return{fromStart:0,fromEnd:0,rangeSize:a,collapsedLines:a,renderAll:!1};if(n===!0||a<=i)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(r),s=Math.min(Math.max(o?.fromStart??0,0),a),c=Math.min(Math.max(o?.fromEnd??0,0),a),l=s+c,u=l>=a;return{fromStart:u?a:s,fromEnd:u?0:c,rangeSize:a,collapsedLines:Math.max(a-l,0),renderAll:u}}function U_(e){let t=e.hunks[e.hunks.length-1];if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return!1;let n=e.additionLines.length-F_(t.additionStart,t.additionCount),r=e.deletionLines.length-F_(t.deletionStart,t.deletionCount);return n<=0&&r<=0?!1:n!==r}function W_({fileDiff:e,errorPrefix:t}){let n=e.hunks[e.hunks.length-1];if(n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let r=e.additionLines.length-F_(n.additionStart,n.additionCount),i=e.deletionLines.length-F_(n.deletionStart,n.deletionCount);if(r<=0&&i<=0)return 0;if(r!==i)throw Error(`${t}: trailing context mismatch (additions=${r}, deletions=${i}) for ${e.name}`);return Math.min(r,i)}function G_({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=W_({fileDiff:e,errorPrefix:i});if(a<=0)return;if(n===!0||a<=r)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(e.hunks.length),s=Math.min(Math.max(o?.fromStart??0,0),a);return{fromStart:s,fromEnd:0,rangeSize:a,collapsedLines:a-s,renderAll:s>=a}}function K_({fileDiff:e,lineNumber:t,expandedHunks:n,collapsedContextThreshold:r}){if(n===!0||e.isPartial)return!0;for(let[i,a]of e.hunks.entries()){let[o,s]=V_(a);if(t<o){let s=H_({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:n,hunkIndex:i,collapsedContextThreshold:r}),c=o-s.rangeSize;return s.renderAll||t<c+s.fromStart||t>=o-s.fromEnd}if(t<s)return!0}let i=G_({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:`isAdditionLineRenderable`});if(i==null||i.renderAll)return!0;let a=e.hunks[e.hunks.length-1],[,o]=V_(a);return t<o+i.fromStart||t>=o+i.rangeSize}function q_({fileDiff:e,lineNumber:t,direction:n,expandedHunks:r,collapsedContextThreshold:i}){if(r===!0||e.isPartial)return t;let a=[],o=1;for(let[t,n]of e.hunks.entries()){let[s,c]=V_(n),l=H_({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:r,hunkIndex:t,collapsedContextThreshold:i}),u=s-l.rangeSize;l.renderAll?a.push([u,s]):(l.fromStart>0&&a.push([u,u+l.fromStart]),l.fromEnd>0&&a.push([s-l.fromEnd,s])),a.push([s,c]),o=c}let s=G_({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:r,collapsedContextThreshold:i,errorPrefix:`getNearestRenderableAdditionLine`});if(s!=null){let e=o;o=e+s.rangeSize,s.renderAll?a.push([e,o]):s.fromStart>0&&a.push([e,e+s.fromStart])}if(t>=o)return t;if(n===`down`){for(let[e,n]of a)if(n>t)return Math.max(e,t)}else for(let e=a.length-1;e>=0;e--){let[n,r]=a[e];if(n<=t)return Math.min(r-1,t)}}function J_({type:e,metrics:t}){return t.hunkSeparatorHeight??wa(e)}function Y_({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function X_({type:e,hunkIndex:t,hunkSpecs:n}){switch(e){case`simple`:return t>0;case`metadata`:return n!=null;case`line-info`:case`line-info-basic`:case`custom`:return!0}}function Z_(e){return e!==`simple`&&e!==`metadata`}function Q_({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!X_({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=J_({type:e,metrics:t}),a=Y_({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function $_({type:e,metrics:t}){if(!Z_(e))return;let n=J_({type:e,metrics:t}),r=Y_({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function ev({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=tv({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:a}),c={viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:s.splitCount,unifiedCount:s.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!c.isWindowedHighlight)return!1;let e=c.unifiedCount>=n+r,i=c.splitCount>=n+r;return t===`unified`?e:(t===`split`||e)&&i},shouldSkip(e,r){if(!c.isWindowedHighlight)return!1;let i=e>0&&c.unifiedCount+e<=n,a=r>0&&c.splitCount+r<=n;return t===`unified`?i:(t===`split`||i)&&a},incrementCounts(e,n){(t===`unified`||t===`both`)&&(c.unifiedCount+=e),(t===`split`||t===`both`)&&(c.splitCount+=n)},isInWindow(e,n){if(!c.isWindowedHighlight)return!0;let r=c.isInUnifiedWindow(e),i=c.isInSplitWindow(n);return t===`unified`?r:t===`split`?i:r||i},isInUnifiedWindow(e){return!c.isWindowedHighlight||c.unifiedCount>=n-e&&c.unifiedCount<n+r},isInSplitWindow(e){return!c.isWindowedHighlight||c.splitCount>=n-e&&c.splitCount<n+r},emit(e,n=!1){return n||(t===`unified`?c.incrementCounts(1,0):t===`split`?c.incrementCounts(0,1):c.incrementCounts(1,1)),o(e)??!1}};hunkIterator:for(let n=s.hunkIndex;n<e.hunks.length;n++){let r=e.hunks[n];if(r==null)throw Error(`iterateOverDiff: invalid hunk index`);if(c.shouldBreak())break;let o=P_(r.deletionStart,r.deletionCount),s=P_(r.additionStart,r.additionCount),l=!e.isPartial&&r.deletionCount===0?o:r.deletionLineIndex,u=!e.isPartial&&r.additionCount===0?s:r.additionLineIndex,d=H_({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),f=n===c.finalHunkIndex?G_({fileDiff:e,hunkIndex:n,expandedHunks:i,collapsedContextThreshold:a,errorPrefix:`iterateOverDiff`}):void 0,p=d.fromStart+d.fromEnd;function m(e,n){return f==null||f.collapsedLines<=0||f.fromStart+f.fromEnd>0?0:t===`unified`?e===r.unifiedLineStart+r.unifiedLineCount-1?f.collapsedLines:0:n===r.splitLineStart+r.splitLineCount-1?f.collapsedLines:0}let h=d.collapsedLines===0;function g(){return h?0:(h=!0,d.collapsedLines)}if(c.shouldSkip(p,p))c.incrementCounts(p,p),g();else{let e=r.unifiedLineStart-d.rangeSize,i=r.splitLineStart-d.rangeSize,a=l-d.rangeSize,f=u-d.rangeSize,p=o+1-d.rangeSize,m=s+1-d.rangeSize;if(iv(c,d.fromStart,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:0,collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}))||(e=r.unifiedLineStart-d.fromEnd,i=r.splitLineStart-d.fromEnd,a=l-d.fromEnd,f=u-d.fromEnd,p=o+1-d.fromEnd,m=s+1-d.fromEnd,iv(c,d.fromEnd,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}),()=>{g()})))break hunkIterator}let _=r.unifiedLineStart,v=r.splitLineStart,y=l,b=u,x=o+1,S=s+1,C=r.hunkContent.at(-1);for(let e of r.hunkContent){if(c.shouldBreak())break hunkIterator;let i=e===C;if(e.type===`context`){if(c.shouldSkip(e.lines,e.lines))c.incrementCounts(e.lines,e.lines),g();else if(iv(c,e.lines,t,t=>{let a=i&&t===e.lines-1,o=_+t,s=v+t;return c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:m(o,s),type:`context`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:a&&r.noEOFCRDeletions,unifiedLineIndex:o,splitLineIndex:s},additionLine:{unifiedLineIndex:o,splitLineIndex:s,lineIndex:b+t,lineNumber:S+t,noEOFCR:a&&r.noEOFCRAdditions}})},()=>{g()}))break hunkIterator;_+=e.lines,v+=e.lines,y+=e.lines,b+=e.lines,x+=e.lines,S+=e.lines}else{let a=Math.max(e.deletions,e.additions),o=e.deletions+e.additions;if(!c.shouldSkip(o,a)){let s=av(c,e,t);(s[0]?.[0]??0)>0&&g();for(let[l,u]of s)for(let s=l;s<u;s++){let l=m(_+s,t===`unified`?v+(s<e.deletions?s:s-e.deletions):v+s);if(c.emit(ov({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:l,diffStyle:t,index:s,unifiedLineIndex:_,splitLineIndex:v,additionLineIndex:b,deletionLineIndex:y,additionLineNumber:S,deletionLineNumber:x,content:e,isLastContent:i,unifiedCount:o,splitCount:a}),!0))break hunkIterator}}g(),c.incrementCounts(o,a),_+=o,v+=a,y+=e.deletions,b+=e.additions,x+=e.deletions,S+=e.additions}}if(f!=null){let{collapsedLines:n,fromStart:r,fromEnd:i}=f,a=r+i;if(iv(c,a,t,t=>{let r=t===a-1;return c.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:r?n:0,type:`context-expanded`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:!1,unifiedLineIndex:_+t,splitLineIndex:v+t},additionLine:{unifiedLineIndex:_+t,splitLineIndex:v+t,lineIndex:b+t,lineNumber:S+t,noEOFCR:!1}})},void 0,()=>c.shouldBreak()))break hunkIterator}}}function tv({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=nv({diff:e,expandedHunks:r,collapsedContextThreshold:i}),o=0,s=e.hunks.length-1,c=e.hunks.length;for(;o<=s;){let e=o+s>>1,r=a[e+1];if(r==null)throw Error(`iterateOverDiff: invalid hunk prefix index`);(t===`unified`?r.unifiedCount:r.splitCount)>n?(c=e,s=e-1):o=e+1}if(c>=e.hunks.length){let t=a[e.hunks.length];if(t==null)throw Error(`iterateOverDiff: invalid terminal hunk prefix index`);return{hunkIndex:e.hunks.length,splitCount:t.splitCount,unifiedCount:t.unifiedCount}}let l=a[c];if(l==null)throw Error(`iterateOverDiff: invalid selected hunk prefix index`);return{hunkIndex:c,splitCount:l.splitCount,unifiedCount:l.unifiedCount}}function nv({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let r=0,i=0,a=e.hunks.length-1,o=[{splitCount:0,unifiedCount:0}];for(let s=0;s<e.hunks.length;s++){let c=e.hunks[s];if(c==null)throw Error(`iterateOverDiff: invalid hunk summary index`);let l=H_({isPartial:e.isPartial,rangeSize:c.collapsedBefore,expandedHunks:t,hunkIndex:s,collapsedContextThreshold:n}),u=l.fromStart+l.fromEnd;r+=u+c.splitLineCount,i+=u+c.unifiedLineCount;let d=s===a?G_({fileDiff:e,hunkIndex:s,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`iterateOverDiff`}):void 0;if(d!=null){let e=d.fromStart+d.fromEnd;r+=e,i+=e}o.push({splitCount:r,unifiedCount:i})}return o}function rv(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];let r=[];function i(n){let i=Math.max(0,e.viewportStart-n),a=Math.min(t,e.viewportEnd-n);a>i&&r.push([i,a])}if(n!==`split`&&i(e.unifiedCount),n!==`unified`&&i(e.splitCount),r.length===0)return[0,0];let a=r[0][0],o=r[0][1];for(let e=1;e<r.length;e++){let t=r[e];a=Math.min(a,t[0]),o=Math.max(o,t[1])}return[a,o]}function iv(e,t,n,r,i,a){let[o,s]=rv(e,t,n);o>0&&(e.incrementCounts(o,o),i?.());let c=o;for(;c<t;){if(a?.()===!0)return!0;if(c>=s){e.incrementCounts(t-c,t-c);break}if(e.isInWindow(0,0)){if(r(c)===!0)return!0}else e.incrementCounts(1,1);c++}return!1}function av(e,t,n){if(!e.isWindowedHighlight)return[[0,n===`unified`?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];let r=n!==`split`,i=n!==`unified`,a=n===`unified`?`unified`:`split`,o=[];function s(t,n){if(t+n<=e.viewportStart||t>=e.viewportEnd)return;let r=Math.max(0,e.viewportStart-t),i=Math.min(n,e.viewportEnd-t);return i>r?[r,i]:void 0}function c(e,n){return a===`split`?e:n===`additions`?[e[0]+t.deletions,e[1]+t.deletions]:e}function l(e,t){if(e==null)return;let[n,r]=c(e,t);r>n&&o.push([n,r])}if(r&&(l(s(e.unifiedCount,t.deletions),`deletions`),l(s(e.unifiedCount+t.deletions,t.additions),`additions`)),i&&(l(s(e.splitCount,t.deletions),`deletions`),l(s(e.splitCount,t.additions),`additions`)),o.length===0)return o;o.sort((e,t)=>e[0]-t[0]);let u=[o[0]];for(let[e,t]of o.slice(1)){let n=u[u.length-1];e<=n[1]?n[1]=Math.max(n[1],t):u.push([e,t])}return u}function ov({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,diffStyle:i,index:a,unifiedLineIndex:o,splitLineIndex:s,additionLineIndex:c,deletionLineIndex:l,additionLineNumber:u,deletionLineNumber:d,content:f,isLastContent:p,unifiedCount:m,splitCount:h}){let g=a<f.deletions?o+a:void 0,_=i===`unified`?a>=f.deletions?o+a:void 0:a<f.additions?o+f.deletions+a:void 0,v=i===`unified`?s+(a<f.deletions?a:a-f.deletions):s+a,y=a<f.deletions?l+a:void 0,b=a<f.deletions?d+a:void 0,x=i===`unified`?a>=f.deletions?c+(a-f.deletions):void 0:a<f.additions?c+a:void 0,S=i===`unified`?a>=f.deletions?u+(a-f.deletions):void 0:a<f.additions?u+a:void 0,C=i===`unified`?p&&a===f.deletions-1&&t.noEOFCRDeletions:p&&a===h-1&&t.noEOFCRDeletions,w=i===`unified`?p&&a===m-1&&t.noEOFCRAdditions:p&&a===h-1&&t.noEOFCRAdditions,T=y!=null&&b!=null&&g!=null?{lineNumber:b,lineIndex:y,noEOFCR:C,unifiedLineIndex:g,splitLineIndex:v}:void 0,E=x!=null&&S!=null&&_!=null?{unifiedLineIndex:_,splitLineIndex:v,lineIndex:x,lineNumber:S,noEOFCR:w}:void 0;if(T==null&&E!=null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:E};if(T!=null&&E==null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:void 0};if(T==null||E==null)throw Error(`iterateOverDiff: missing change line data`);return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:E}}function sv(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var cv=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r)setTimeout(function(){r(e)},0);else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h)d[r]=void 0;else{if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}},lv=new class extends cv{};function uv(e,t,n){return lv.diff(e,t,n)}function dv(e,t){let n=0;for(;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function fv(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function pv(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function mv(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function hv(e,t){return pv(e,t,``)}function gv(e,t){return mv(e,t,``)}function _v(e,t){return t.slice(0,vv(e,t))}function vv(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function yv(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function bv(e,t){if(t)return Sv(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function xv(e,t){if(t)return Sv(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function Sv(e,t){if(!t)return[xv(e),bv(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=yv(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var Cv=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,wv=RegExp(`[${Cv}]+|\\s+|[^${Cv}]`,`ug`);new class extends cv{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=yv(e,r)}else n=e.match(wv)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&Tv(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&Tv(n,i,r,null,t.intlSegmenter),e}};function Tv(e,t,n,r,i){if(t&&n){let[a,o]=Sv(t.value,i),[s,c]=Sv(n.value,i);if(e){let r=dv(a,s);e.value=mv(e.value,s,r),t.value=hv(t.value,r),n.value=hv(n.value,r)}if(r){let e=fv(o,c);r.value=pv(r.value,c,e),t.value=gv(t.value,e),n.value=gv(n.value,e)}}else if(n){if(e){let e=xv(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=xv(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=xv(r.value,i),[a,o]=Sv(t.value,i),s=dv(n,a);t.value=hv(t.value,s);let c=fv(hv(n,s),o);t.value=gv(t.value,c),r.value=pv(r.value,n,c),e.value=mv(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=xv(r.value,i),n=_v(bv(t.value,i),e);t.value=gv(t.value,n)}else if(e){let n=_v(bv(e.value,i),xv(t.value,i));t.value=hv(t.value,n)}}var Ev=new class extends cv{tokenize(e){let t=RegExp(`(\\r?\\n)|[${Cv}]+|[^\\S\\n\\r]+|[^${Cv}]`,`ug`);return e.match(t)||[]}};function Dv(e,t,n){return Ev.diff(e,t,n)}var Ov=new class extends cv{constructor(){super(...arguments),this.tokenize=Av}equals(e,t,n){return n.ignoreWhitespace?(n.newlineIsToken&&e.includes(`
1278
+ </svg>`;function b_(e=[]){return{set:`complete`,colored:!0,spriteSheet:y_,byFileExtension:ga.byFileExtension,byFileName:{...ga.byFileName,...Object.fromEntries(e.flatMap(e=>{let t=e.kind===`symlink`?__.symlink:e.kind===`submodule`?__.submodule:null;return t?[[g_(e.path),t]]:[]}))}}}var x_=cl(b_()),S_=`${Uc(`complete`)}${y_}`;function C_(){let e=(0,q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(`div`,{"aria-hidden":`true`,style:{position:`absolute`,width:0,height:0,overflow:`hidden`},dangerouslySetInnerHTML:{__html:S_}}),e[0]=t):t=e[0],t}function w_(e){let t=(0,q.c)(14),{path:n,expanded:r,className:i}=e,a;t[0]===n?a=t[1]:(a=x_.resolveIcon(n===void 0?`file-tree-icon-chevron`:`file-tree-icon-file`,n),t[0]=n,t[1]=a);let o=a,s=o.token?Sa[o.token]:void 0,c=o.width??16,l=o.height??16,u;t[2]===s?u=t[3]:(u=s?{color:`light-dark(${s.light}, ${s.dark})`}:void 0,t[2]=s,t[3]=u);let d=o.viewBox??`0 0 ${c} ${l}`,f=r===!1&&`-rotate-90`,p;t[4]!==i||t[5]!==f?(p=H(`pierre-file-icon`,f,i),t[4]=i,t[5]=f,t[6]=p):p=t[6];let m=`#${o.name}`,h;t[7]===m?h=t[8]:(h=(0,K.jsx)(`use`,{href:m}),t[7]=m,t[8]=h);let g;return t[9]!==u||t[10]!==d||t[11]!==p||t[12]!==h?(g=(0,K.jsx)(`svg`,{"aria-hidden":`true`,style:u,viewBox:d,className:p,children:h}),t[9]=u,t[10]=d,t[11]=p,t[12]=h,t[13]=g):g=t[13],g}var T_=e=>`data:${e.mediaType};base64,${e.base64}`;function E_(e,t,n){let r=(0,q.c)(4),i;return r[0]!==e||r[1]!==n||r[2]!==t?(i=Ye({scope:t,connection:e,path:n}),r[0]=e,r[1]=n,r[2]=t,r[3]=i):i=r[3],B(i)}function D_(e,t,n,r,i){let a=(0,q.c)(6),o;return a[0]!==e||a[1]!==r||a[2]!==n||a[3]!==i||a[4]!==t?(o=Rt({scope:t,connection:e,path:n,html:r,platform:i}),a[0]=e,a[1]=r,a[2]=n,a[3]=i,a[4]=t,a[5]=o):o=a[5],B(o)}function O_(e){let t=(0,q.c)(3),{scope:n,path:r,connection:i}=e,a=E_(i,n,r),o;return t[0]!==r||t[1]!==a?(o=(0,K.jsx)(`div`,{className:`flex w-full flex-col items-center gap-2 p-4`,children:(0,K.jsx)(k_,{query:a,path:r})}),t[0]=r,t[1]=a,t[2]=o):o=t[2],o}function k_(e){let t=(0,q.c)(10),{query:n,path:r}=e;if(sr(n)){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,K.jsx)(`p`,{role:`status`,children:`Loading image…`}),t[0]=e):e=t[0],e}if(Wn(n)){let e;t[1]===n.cause?e=t[2]:(e=la(xr(n.cause)),t[1]=n.cause,t[2]=e);let r;return t[3]===e?r=t[4]:(r=(0,K.jsx)(`p`,{role:`status`,children:e}),t[3]=e,t[4]=r),r}let i;t[5]===n?i=t[6]:(i=T_(zn(Ht(n))),t[5]=n,t[6]=i);let a;return t[7]!==r||t[8]!==i?(a=(0,K.jsx)(`img`,{src:i,alt:r,className:`max-h-[70vh] max-w-full object-contain`}),t[7]=r,t[8]=i,t[9]=a):a=t[9],a}function A_(e){let t=(0,G.useRef)(e);return(0,G.useInsertionEffect)(()=>void(t.current=e)),(0,G.useCallback)((...e)=>t.current(...e),[])}var j_=(0,G.createContext)(void 0);function M_(){return(0,G.useContext)(j_)}var N_={position:`absolute`,top:0,bottom:0,textAlign:`center`,whiteSpace:`normal`,touchAction:`none`},P_={display:`contents`};function F_(){return null}function I_(e,t){return e-(t===0?0:1)}function L_(e,t){return I_(e,t)+t}function R_({file:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,lineAnnotations:o,renderGutterUtility:s,getHoveredLine:c,getAnnotationSlotName:l=xi}){let u=t?.(e),d=n?.(e),f=r?.(e),p=i?.(e);return(0,K.jsxs)(K.Fragment,{children:[u==null?(0,K.jsxs)(K.Fragment,{children:[d!=null&&(0,K.jsx)(`div`,{slot:`header-prefix`,children:d}),f!=null&&(0,K.jsx)(`div`,{slot:`header-filename-suffix`,children:f}),p!=null&&(0,K.jsx)(`div`,{slot:`header-metadata`,children:p})]}):(0,K.jsx)(`div`,{slot:Ei,children:u}),a!=null&&o?.map((t,n)=>(0,K.jsx)(`div`,{slot:l(t),children:a(t,e)},n)),s!=null&&(0,K.jsx)(`div`,{slot:`gutter-utility-slot`,style:N_,children:s(c)})]})}function z_(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e===t}function B_(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function V_(e,t){return yi(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function H_(e){let t=e.lang??Ai(e.name),n=e.lang??(e.prevName==null?`text`:Ai(e.prevName));return t===`text`&&n===`text`}function U_(e){return[I_(e.additionStart,e.additionCount)+1,L_(e.additionStart,e.additionCount)+1]}function W_({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:r,collapsedContextThreshold:i}){let a=Math.max(t,0);if(a===0||e)return{fromStart:0,fromEnd:0,rangeSize:a,collapsedLines:a,renderAll:!1};if(n===!0||a<=i)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(r),s=Math.min(Math.max(o?.fromStart??0,0),a),c=Math.min(Math.max(o?.fromEnd??0,0),a),l=s+c,u=l>=a;return{fromStart:u?a:s,fromEnd:u?0:c,rangeSize:a,collapsedLines:Math.max(a-l,0),renderAll:u}}function G_(e){let t=e.hunks[e.hunks.length-1];if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return!1;let n=e.additionLines.length-L_(t.additionStart,t.additionCount),r=e.deletionLines.length-L_(t.deletionStart,t.deletionCount);return n<=0&&r<=0?!1:n!==r}function K_({fileDiff:e,errorPrefix:t}){let n=e.hunks[e.hunks.length-1];if(n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let r=e.additionLines.length-L_(n.additionStart,n.additionCount),i=e.deletionLines.length-L_(n.deletionStart,n.deletionCount);if(r<=0&&i<=0)return 0;if(r!==i)throw Error(`${t}: trailing context mismatch (additions=${r}, deletions=${i}) for ${e.name}`);return Math.min(r,i)}function q_({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=K_({fileDiff:e,errorPrefix:i});if(a<=0)return;if(n===!0||a<=r)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(e.hunks.length),s=Math.min(Math.max(o?.fromStart??0,0),a);return{fromStart:s,fromEnd:0,rangeSize:a,collapsedLines:a-s,renderAll:s>=a}}function J_({fileDiff:e,lineNumber:t,expandedHunks:n,collapsedContextThreshold:r}){if(n===!0||e.isPartial)return!0;for(let[i,a]of e.hunks.entries()){let[o,s]=U_(a);if(t<o){let s=W_({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:n,hunkIndex:i,collapsedContextThreshold:r}),c=o-s.rangeSize;return s.renderAll||t<c+s.fromStart||t>=o-s.fromEnd}if(t<s)return!0}let i=q_({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:`isAdditionLineRenderable`});if(i==null||i.renderAll)return!0;let a=e.hunks[e.hunks.length-1],[,o]=U_(a);return t<o+i.fromStart||t>=o+i.rangeSize}function Y_({fileDiff:e,lineNumber:t,direction:n,expandedHunks:r,collapsedContextThreshold:i}){if(r===!0||e.isPartial)return t;let a=[],o=1;for(let[t,n]of e.hunks.entries()){let[s,c]=U_(n),l=W_({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:r,hunkIndex:t,collapsedContextThreshold:i}),u=s-l.rangeSize;l.renderAll?a.push([u,s]):(l.fromStart>0&&a.push([u,u+l.fromStart]),l.fromEnd>0&&a.push([s-l.fromEnd,s])),a.push([s,c]),o=c}let s=q_({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:r,collapsedContextThreshold:i,errorPrefix:`getNearestRenderableAdditionLine`});if(s!=null){let e=o;o=e+s.rangeSize,s.renderAll?a.push([e,o]):s.fromStart>0&&a.push([e,e+s.fromStart])}if(t>=o)return t;if(n===`down`){for(let[e,n]of a)if(n>t)return Math.max(e,t)}else for(let e=a.length-1;e>=0;e--){let[n,r]=a[e];if(n<=t)return Math.min(r-1,t)}}function X_({type:e,metrics:t}){return t.hunkSeparatorHeight??wa(e)}function Z_({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function Q_({type:e,hunkIndex:t,hunkSpecs:n}){switch(e){case`simple`:return t>0;case`metadata`:return n!=null;case`line-info`:case`line-info-basic`:case`custom`:return!0}}function $_(e){return e!==`simple`&&e!==`metadata`}function ev({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!Q_({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=X_({type:e,metrics:t}),a=Z_({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function tv({type:e,metrics:t}){if(!$_(e))return;let n=X_({type:e,metrics:t}),r=Z_({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function nv({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=rv({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:a}),c={viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:s.splitCount,unifiedCount:s.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!c.isWindowedHighlight)return!1;let e=c.unifiedCount>=n+r,i=c.splitCount>=n+r;return t===`unified`?e:(t===`split`||e)&&i},shouldSkip(e,r){if(!c.isWindowedHighlight)return!1;let i=e>0&&c.unifiedCount+e<=n,a=r>0&&c.splitCount+r<=n;return t===`unified`?i:(t===`split`||i)&&a},incrementCounts(e,n){(t===`unified`||t===`both`)&&(c.unifiedCount+=e),(t===`split`||t===`both`)&&(c.splitCount+=n)},isInWindow(e,n){if(!c.isWindowedHighlight)return!0;let r=c.isInUnifiedWindow(e),i=c.isInSplitWindow(n);return t===`unified`?r:t===`split`?i:r||i},isInUnifiedWindow(e){return!c.isWindowedHighlight||c.unifiedCount>=n-e&&c.unifiedCount<n+r},isInSplitWindow(e){return!c.isWindowedHighlight||c.splitCount>=n-e&&c.splitCount<n+r},emit(e,n=!1){return n||(t===`unified`?c.incrementCounts(1,0):t===`split`?c.incrementCounts(0,1):c.incrementCounts(1,1)),o(e)??!1}};hunkIterator:for(let n=s.hunkIndex;n<e.hunks.length;n++){let r=e.hunks[n];if(r==null)throw Error(`iterateOverDiff: invalid hunk index`);if(c.shouldBreak())break;let o=I_(r.deletionStart,r.deletionCount),s=I_(r.additionStart,r.additionCount),l=!e.isPartial&&r.deletionCount===0?o:r.deletionLineIndex,u=!e.isPartial&&r.additionCount===0?s:r.additionLineIndex,d=W_({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),f=n===c.finalHunkIndex?q_({fileDiff:e,hunkIndex:n,expandedHunks:i,collapsedContextThreshold:a,errorPrefix:`iterateOverDiff`}):void 0,p=d.fromStart+d.fromEnd;function m(e,n){return f==null||f.collapsedLines<=0||f.fromStart+f.fromEnd>0?0:t===`unified`?e===r.unifiedLineStart+r.unifiedLineCount-1?f.collapsedLines:0:n===r.splitLineStart+r.splitLineCount-1?f.collapsedLines:0}let h=d.collapsedLines===0;function g(){return h?0:(h=!0,d.collapsedLines)}if(c.shouldSkip(p,p))c.incrementCounts(p,p),g();else{let e=r.unifiedLineStart-d.rangeSize,i=r.splitLineStart-d.rangeSize,a=l-d.rangeSize,f=u-d.rangeSize,p=o+1-d.rangeSize,m=s+1-d.rangeSize;if(ov(c,d.fromStart,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:0,collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}))||(e=r.unifiedLineStart-d.fromEnd,i=r.splitLineStart-d.fromEnd,a=l-d.fromEnd,f=u-d.fromEnd,p=o+1-d.fromEnd,m=s+1-d.fromEnd,ov(c,d.fromEnd,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}),()=>{g()})))break hunkIterator}let _=r.unifiedLineStart,v=r.splitLineStart,y=l,b=u,x=o+1,S=s+1,C=r.hunkContent.at(-1);for(let e of r.hunkContent){if(c.shouldBreak())break hunkIterator;let i=e===C;if(e.type===`context`){if(c.shouldSkip(e.lines,e.lines))c.incrementCounts(e.lines,e.lines),g();else if(ov(c,e.lines,t,t=>{let a=i&&t===e.lines-1,o=_+t,s=v+t;return c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:m(o,s),type:`context`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:a&&r.noEOFCRDeletions,unifiedLineIndex:o,splitLineIndex:s},additionLine:{unifiedLineIndex:o,splitLineIndex:s,lineIndex:b+t,lineNumber:S+t,noEOFCR:a&&r.noEOFCRAdditions}})},()=>{g()}))break hunkIterator;_+=e.lines,v+=e.lines,y+=e.lines,b+=e.lines,x+=e.lines,S+=e.lines}else{let a=Math.max(e.deletions,e.additions),o=e.deletions+e.additions;if(!c.shouldSkip(o,a)){let s=sv(c,e,t);(s[0]?.[0]??0)>0&&g();for(let[l,u]of s)for(let s=l;s<u;s++){let l=m(_+s,t===`unified`?v+(s<e.deletions?s:s-e.deletions):v+s);if(c.emit(cv({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:l,diffStyle:t,index:s,unifiedLineIndex:_,splitLineIndex:v,additionLineIndex:b,deletionLineIndex:y,additionLineNumber:S,deletionLineNumber:x,content:e,isLastContent:i,unifiedCount:o,splitCount:a}),!0))break hunkIterator}}g(),c.incrementCounts(o,a),_+=o,v+=a,y+=e.deletions,b+=e.additions,x+=e.deletions,S+=e.additions}}if(f!=null){let{collapsedLines:n,fromStart:r,fromEnd:i}=f,a=r+i;if(ov(c,a,t,t=>{let r=t===a-1;return c.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:r?n:0,type:`context-expanded`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:!1,unifiedLineIndex:_+t,splitLineIndex:v+t},additionLine:{unifiedLineIndex:_+t,splitLineIndex:v+t,lineIndex:b+t,lineNumber:S+t,noEOFCR:!1}})},void 0,()=>c.shouldBreak()))break hunkIterator}}}function rv({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=iv({diff:e,expandedHunks:r,collapsedContextThreshold:i}),o=0,s=e.hunks.length-1,c=e.hunks.length;for(;o<=s;){let e=o+s>>1,r=a[e+1];if(r==null)throw Error(`iterateOverDiff: invalid hunk prefix index`);(t===`unified`?r.unifiedCount:r.splitCount)>n?(c=e,s=e-1):o=e+1}if(c>=e.hunks.length){let t=a[e.hunks.length];if(t==null)throw Error(`iterateOverDiff: invalid terminal hunk prefix index`);return{hunkIndex:e.hunks.length,splitCount:t.splitCount,unifiedCount:t.unifiedCount}}let l=a[c];if(l==null)throw Error(`iterateOverDiff: invalid selected hunk prefix index`);return{hunkIndex:c,splitCount:l.splitCount,unifiedCount:l.unifiedCount}}function iv({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let r=0,i=0,a=e.hunks.length-1,o=[{splitCount:0,unifiedCount:0}];for(let s=0;s<e.hunks.length;s++){let c=e.hunks[s];if(c==null)throw Error(`iterateOverDiff: invalid hunk summary index`);let l=W_({isPartial:e.isPartial,rangeSize:c.collapsedBefore,expandedHunks:t,hunkIndex:s,collapsedContextThreshold:n}),u=l.fromStart+l.fromEnd;r+=u+c.splitLineCount,i+=u+c.unifiedLineCount;let d=s===a?q_({fileDiff:e,hunkIndex:s,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`iterateOverDiff`}):void 0;if(d!=null){let e=d.fromStart+d.fromEnd;r+=e,i+=e}o.push({splitCount:r,unifiedCount:i})}return o}function av(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];let r=[];function i(n){let i=Math.max(0,e.viewportStart-n),a=Math.min(t,e.viewportEnd-n);a>i&&r.push([i,a])}if(n!==`split`&&i(e.unifiedCount),n!==`unified`&&i(e.splitCount),r.length===0)return[0,0];let a=r[0][0],o=r[0][1];for(let e=1;e<r.length;e++){let t=r[e];a=Math.min(a,t[0]),o=Math.max(o,t[1])}return[a,o]}function ov(e,t,n,r,i,a){let[o,s]=av(e,t,n);o>0&&(e.incrementCounts(o,o),i?.());let c=o;for(;c<t;){if(a?.()===!0)return!0;if(c>=s){e.incrementCounts(t-c,t-c);break}if(e.isInWindow(0,0)){if(r(c)===!0)return!0}else e.incrementCounts(1,1);c++}return!1}function sv(e,t,n){if(!e.isWindowedHighlight)return[[0,n===`unified`?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];let r=n!==`split`,i=n!==`unified`,a=n===`unified`?`unified`:`split`,o=[];function s(t,n){if(t+n<=e.viewportStart||t>=e.viewportEnd)return;let r=Math.max(0,e.viewportStart-t),i=Math.min(n,e.viewportEnd-t);return i>r?[r,i]:void 0}function c(e,n){return a===`split`?e:n===`additions`?[e[0]+t.deletions,e[1]+t.deletions]:e}function l(e,t){if(e==null)return;let[n,r]=c(e,t);r>n&&o.push([n,r])}if(r&&(l(s(e.unifiedCount,t.deletions),`deletions`),l(s(e.unifiedCount+t.deletions,t.additions),`additions`)),i&&(l(s(e.splitCount,t.deletions),`deletions`),l(s(e.splitCount,t.additions),`additions`)),o.length===0)return o;o.sort((e,t)=>e[0]-t[0]);let u=[o[0]];for(let[e,t]of o.slice(1)){let n=u[u.length-1];e<=n[1]?n[1]=Math.max(n[1],t):u.push([e,t])}return u}function cv({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,diffStyle:i,index:a,unifiedLineIndex:o,splitLineIndex:s,additionLineIndex:c,deletionLineIndex:l,additionLineNumber:u,deletionLineNumber:d,content:f,isLastContent:p,unifiedCount:m,splitCount:h}){let g=a<f.deletions?o+a:void 0,_=i===`unified`?a>=f.deletions?o+a:void 0:a<f.additions?o+f.deletions+a:void 0,v=i===`unified`?s+(a<f.deletions?a:a-f.deletions):s+a,y=a<f.deletions?l+a:void 0,b=a<f.deletions?d+a:void 0,x=i===`unified`?a>=f.deletions?c+(a-f.deletions):void 0:a<f.additions?c+a:void 0,S=i===`unified`?a>=f.deletions?u+(a-f.deletions):void 0:a<f.additions?u+a:void 0,C=i===`unified`?p&&a===f.deletions-1&&t.noEOFCRDeletions:p&&a===h-1&&t.noEOFCRDeletions,w=i===`unified`?p&&a===m-1&&t.noEOFCRAdditions:p&&a===h-1&&t.noEOFCRAdditions,T=y!=null&&b!=null&&g!=null?{lineNumber:b,lineIndex:y,noEOFCR:C,unifiedLineIndex:g,splitLineIndex:v}:void 0,E=x!=null&&S!=null&&_!=null?{unifiedLineIndex:_,splitLineIndex:v,lineIndex:x,lineNumber:S,noEOFCR:w}:void 0;if(T==null&&E!=null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:E};if(T!=null&&E==null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:void 0};if(T==null||E==null)throw Error(`iterateOverDiff: missing change line data`);return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:E}}function lv(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var uv=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r)setTimeout(function(){r(e)},0);else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h)d[r]=void 0;else{if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}},dv=new class extends uv{};function fv(e,t,n){return dv.diff(e,t,n)}function pv(e,t){let n=0;for(;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function mv(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function hv(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function gv(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function _v(e,t){return hv(e,t,``)}function vv(e,t){return gv(e,t,``)}function yv(e,t){return t.slice(0,bv(e,t))}function bv(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function xv(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function Sv(e,t){if(t)return wv(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function Cv(e,t){if(t)return wv(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function wv(e,t){if(!t)return[Cv(e),Sv(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=xv(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var Tv=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,Ev=RegExp(`[${Tv}]+|\\s+|[^${Tv}]`,`ug`);new class extends uv{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=xv(e,r)}else n=e.match(Ev)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&Dv(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&Dv(n,i,r,null,t.intlSegmenter),e}};function Dv(e,t,n,r,i){if(t&&n){let[a,o]=wv(t.value,i),[s,c]=wv(n.value,i);if(e){let r=pv(a,s);e.value=gv(e.value,s,r),t.value=_v(t.value,r),n.value=_v(n.value,r)}if(r){let e=mv(o,c);r.value=hv(r.value,c,e),t.value=vv(t.value,e),n.value=vv(n.value,e)}}else if(n){if(e){let e=Cv(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=Cv(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=Cv(r.value,i),[a,o]=wv(t.value,i),s=pv(n,a);t.value=_v(t.value,s);let c=mv(_v(n,s),o);t.value=vv(t.value,c),r.value=hv(r.value,n,c),e.value=gv(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=Cv(r.value,i),n=yv(Sv(t.value,i),e);t.value=vv(t.value,n)}else if(e){let n=yv(Sv(e.value,i),Cv(t.value,i));t.value=_v(t.value,n)}}var Ov=new class extends uv{tokenize(e){let t=RegExp(`(\\r?\\n)|[${Tv}]+|[^\\S\\n\\r]+|[^${Tv}]`,`ug`);return e.match(t)||[]}};function kv(e,t,n){return Ov.diff(e,t,n)}var Av=new class extends uv{constructor(){super(...arguments),this.tokenize=Mv}equals(e,t,n){return n.ignoreWhitespace?(n.newlineIsToken&&e.includes(`
1279
1279
  `)||(e=e.trim()),n.newlineIsToken&&t.includes(`
1280
1280
  `)||(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
1281
1281
  `)&&(e=e.slice(0,-1)),t.endsWith(`
1282
- `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function kv(e,t,n){return Ov.diff(e,t,n)}function Av(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
1283
- `));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function jv(e){return e==`.`||e==`!`||e==`?`}new class extends cv{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(jv(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends cv{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends cv{constructor(){super(...arguments),this.tokenize=Av}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(Mv(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function Mv(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a=0;for(;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=Mv(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=Mv(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends cv{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function Nv(e){for(let t=0;t<e.length;t++)if(e[t]<` `||e[t]>`~`||e[t]===`"`||e[t]===`\\`)return!0;return!1}function Pv(e){if(!Nv(e))return e;let t=`"`,n=new TextEncoder().encode(e),r=0;for(;r<n.length;){let e=n[r];t+=e===7?`\\a`:e===8?`\\b`:e===9?`\\t`:e===10?`\\n`:e===11?`\\v`:e===12?`\\f`:e===13?`\\r`:e===34?`\\"`:e===92?`\\\\`:e>=32&&e<=126?String.fromCharCode(e):`\\`+e.toString(8).padStart(3,`0`),r++}return t+=`"`,t}var Fv={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function Iv(e,t,n,r,i,a,o){let s;s=o?typeof o==`function`?{callback:o}:o:{},s.context===void 0&&(s.context=4);let c=s.context;if(s.newlineIsToken)throw Error(`newlineIsToken may not be used with patch-generation functions, only with diffing functions`);if(s.callback){let{callback:e}=s;kv(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l(kv(n,r,s));function l(n){if(!n)return;n.push({value:``,lines:[]});function r(e){return e.map(function(e){return` `+e})}let o=[],s=0,l=0,u=[],d=1,f=1;for(let e=0;e<n.length;e++){let t=n[e],i=t.lines||zv(t.value);if(t.lines=i,t.added||t.removed){if(!s){let t=n[e-1];s=d,l=f,t&&(u=c>0?r(t.lines.slice(-c)):[],s-=u.length,l-=u.length)}for(let e of i)u.push((t.added?`+`:`-`)+e);t.added?f+=i.length:d+=i.length}else{if(s){if(i.length<=c*2&&e<n.length-2)for(let e of r(i))u.push(e);else{let e=Math.min(i.length,c);for(let t of r(i.slice(0,e)))u.push(t);let t={oldStart:s,oldLines:d-s+e,newStart:l,newLines:f-l+e,lines:u};o.push(t),s=0,l=0,u=[]}}d+=i.length,f+=i.length}}for(let e of o)for(let t=0;t<e.lines.length;t++)e.lines[t].endsWith(`
1284
- `)?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,`\`),t++);return{oldFileName:e,newFileName:t,oldHeader:i,newHeader:a,hunks:o}}}function Lv(e,t){if(t||=Fv,Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders&&!e.every(e=>e.isGit))throw Error(`Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)`);return e.map(e=>Lv(e,t)).join(`
1285
- `)}let n=[];if(e.isGit){if(t=Fv,!e.oldFileName)throw Error(`oldFileName must be specified for Git patches`);if(!e.newFileName)throw Error(`newFileName must be specified for Git patches`);let r=e.oldFileName,i=e.newFileName;e.isCreate&&r===`/dev/null`?r=i.replace(/^b\//,`a/`):e.isDelete&&i===`/dev/null`&&(i=r.replace(/^a\//,`b/`)),n.push(`diff --git `+Pv(r)+` `+Pv(i)),e.isDelete&&n.push(`deleted file mode `+(e.oldMode??`100644`)),e.isCreate&&n.push(`new file mode `+(e.newMode??`100644`)),e.oldMode&&e.newMode&&!e.isDelete&&!e.isCreate&&(n.push(`old mode `+e.oldMode),n.push(`new mode `+e.newMode)),e.isRename&&(n.push(`rename from `+Pv((e.oldFileName??``).replace(/^a\//,``))),n.push(`rename to `+Pv((e.newFileName??``).replace(/^b\//,``)))),e.isCopy&&(n.push(`copy from `+Pv((e.oldFileName??``).replace(/^a\//,``))),n.push(`copy to `+Pv((e.newFileName??``).replace(/^b\//,``))))}else t.includeIndex&&e.oldFileName==e.newFileName&&e.oldFileName!==void 0&&n.push(`Index: `+e.oldFileName),t.includeUnderline&&n.push(`===================================================================`);let r=e.hunks.length>0;t.includeFileHeaders&&e.oldFileName!==void 0&&e.newFileName!==void 0&&(!e.isGit||r)&&(n.push(`--- `+Pv(e.oldFileName)+(e.oldHeader?` `+e.oldHeader:``)),n.push(`+++ `+Pv(e.newFileName)+(e.newHeader?` `+e.newHeader:``)));for(let t=0;t<e.hunks.length;t++){let r=e.hunks[t],i=r.oldLines===0?r.oldStart-1:r.oldStart,a=r.newLines===0?r.newStart-1:r.newStart;n.push(`@@ -`+i+`,`+r.oldLines+` +`+a+`,`+r.newLines+` @@`);for(let e of r.lines)n.push(e)}return n.join(`
1282
+ `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function jv(e,t,n){return Av.diff(e,t,n)}function Mv(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
1283
+ `));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function Nv(e){return e==`.`||e==`!`||e==`?`}new class extends uv{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(Nv(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends uv{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends uv{constructor(){super(...arguments),this.tokenize=Mv}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(Pv(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function Pv(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a=0;for(;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=Pv(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=Pv(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends uv{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function Fv(e){for(let t=0;t<e.length;t++)if(e[t]<` `||e[t]>`~`||e[t]===`"`||e[t]===`\\`)return!0;return!1}function Iv(e){if(!Fv(e))return e;let t=`"`,n=new TextEncoder().encode(e),r=0;for(;r<n.length;){let e=n[r];t+=e===7?`\\a`:e===8?`\\b`:e===9?`\\t`:e===10?`\\n`:e===11?`\\v`:e===12?`\\f`:e===13?`\\r`:e===34?`\\"`:e===92?`\\\\`:e>=32&&e<=126?String.fromCharCode(e):`\\`+e.toString(8).padStart(3,`0`),r++}return t+=`"`,t}var Lv={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function Rv(e,t,n,r,i,a,o){let s;s=o?typeof o==`function`?{callback:o}:o:{},s.context===void 0&&(s.context=4);let c=s.context;if(s.newlineIsToken)throw Error(`newlineIsToken may not be used with patch-generation functions, only with diffing functions`);if(s.callback){let{callback:e}=s;jv(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l(jv(n,r,s));function l(n){if(!n)return;n.push({value:``,lines:[]});function r(e){return e.map(function(e){return` `+e})}let o=[],s=0,l=0,u=[],d=1,f=1;for(let e=0;e<n.length;e++){let t=n[e],i=t.lines||Vv(t.value);if(t.lines=i,t.added||t.removed){if(!s){let t=n[e-1];s=d,l=f,t&&(u=c>0?r(t.lines.slice(-c)):[],s-=u.length,l-=u.length)}for(let e of i)u.push((t.added?`+`:`-`)+e);t.added?f+=i.length:d+=i.length}else{if(s){if(i.length<=c*2&&e<n.length-2)for(let e of r(i))u.push(e);else{let e=Math.min(i.length,c);for(let t of r(i.slice(0,e)))u.push(t);let t={oldStart:s,oldLines:d-s+e,newStart:l,newLines:f-l+e,lines:u};o.push(t),s=0,l=0,u=[]}}d+=i.length,f+=i.length}}for(let e of o)for(let t=0;t<e.lines.length;t++)e.lines[t].endsWith(`
1284
+ `)?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,`\`),t++);return{oldFileName:e,newFileName:t,oldHeader:i,newHeader:a,hunks:o}}}function zv(e,t){if(t||=Lv,Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders&&!e.every(e=>e.isGit))throw Error(`Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)`);return e.map(e=>zv(e,t)).join(`
1285
+ `)}let n=[];if(e.isGit){if(t=Lv,!e.oldFileName)throw Error(`oldFileName must be specified for Git patches`);if(!e.newFileName)throw Error(`newFileName must be specified for Git patches`);let r=e.oldFileName,i=e.newFileName;e.isCreate&&r===`/dev/null`?r=i.replace(/^b\//,`a/`):e.isDelete&&i===`/dev/null`&&(i=r.replace(/^a\//,`b/`)),n.push(`diff --git `+Iv(r)+` `+Iv(i)),e.isDelete&&n.push(`deleted file mode `+(e.oldMode??`100644`)),e.isCreate&&n.push(`new file mode `+(e.newMode??`100644`)),e.oldMode&&e.newMode&&!e.isDelete&&!e.isCreate&&(n.push(`old mode `+e.oldMode),n.push(`new mode `+e.newMode)),e.isRename&&(n.push(`rename from `+Iv((e.oldFileName??``).replace(/^a\//,``))),n.push(`rename to `+Iv((e.newFileName??``).replace(/^b\//,``)))),e.isCopy&&(n.push(`copy from `+Iv((e.oldFileName??``).replace(/^a\//,``))),n.push(`copy to `+Iv((e.newFileName??``).replace(/^b\//,``))))}else t.includeIndex&&e.oldFileName==e.newFileName&&e.oldFileName!==void 0&&n.push(`Index: `+e.oldFileName),t.includeUnderline&&n.push(`===================================================================`);let r=e.hunks.length>0;t.includeFileHeaders&&e.oldFileName!==void 0&&e.newFileName!==void 0&&(!e.isGit||r)&&(n.push(`--- `+Iv(e.oldFileName)+(e.oldHeader?` `+e.oldHeader:``)),n.push(`+++ `+Iv(e.newFileName)+(e.newHeader?` `+e.newHeader:``)));for(let t=0;t<e.hunks.length;t++){let r=e.hunks[t],i=r.oldLines===0?r.oldStart-1:r.oldStart,a=r.newLines===0?r.newStart-1:r.newStart;n.push(`@@ -`+i+`,`+r.oldLines+` +`+a+`,`+r.newLines+` @@`);for(let e of r.lines)n.push(e)}return n.join(`
1286
1286
  `)+`
1287
- `}function Rv(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;Iv(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?Lv(e,o.headerOptions):void 0)}}))}else{let s=Iv(e,t,n,r,i,a,o);return s?Lv(s,o?.headerOptions):void 0}}function zv(e){let t=e.endsWith(`
1287
+ `}function Bv(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;Rv(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?zv(e,o.headerOptions):void 0)}}))}else{let s=Rv(e,t,n,r,i,a,o);return s?zv(s,o?.headerOptions):void 0}}function Vv(e){let t=e.endsWith(`
1288
1288
  `),n=e.split(`
1289
1289
  `).map(e=>e+`
1290
- `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function Bv({line:e,spanStart:t,spanLength:n}){return{start:{line:e,character:t},end:{line:e,character:t+n},properties:{"data-diff-span":``},alwaysWrap:!0}}function Vv({item:e,arr:t,enableJoin:n,isNeutral:r=!1,isLastItem:i=!1}){let a=t[t.length-1];if(a==null||i||!n){t.push([+!r,e.value]);return}let o=a[0]===0;r===o||r&&e.value.length===1&&!o?a[1]+=e.value:t.push([+!r,e.value])}var Hv={forcePlainText:!1};function Uv(e,t,n,{forcePlainText:r,lazyLineAST:i=!1,startingLine:a,totalLines:o,expandedHunks:s,collapsedContextThreshold:c=1}=Hv){r?(a??=0,o??=1/0):(a=0,o=1/0);let l=a>0||o<1/0;i&&=!r&&!n.useTokenTransformer;let u=typeof n.theme==`string`?t.getTheme(n.theme).type:void 0,d=Oa({theme:n.theme,highlighter:t}),f=r&&!l&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?`none`:n.lineDiffType,p={deletionLines:[],additionLines:[]},{maxLineDiffLength:m}=n,h=!r&&!e.isPartial,g=r?s:void 0,_=new Map;function v(e){let t=h?0:e,n=_.get(t)??Kv();return _.set(t,n),n}function y(e,t,n,r){if(l){let e=n.at(-1);(e==null||e.targetIndex+e.count!==t)&&(e={targetIndex:t,originalOffset:r.length,count:0},n.push(e)),e.count++}r.push(e)}ev({diff:e,diffStyle:`both`,startingLine:a,totalLines:o,expandedHunks:!l||g,collapsedContextThreshold:c,callback:({hunkIndex:t,additionLine:n,deletionLine:r,type:i})=>{let a=v(t),o=n==null?r.splitLineIndex:n.splitLineIndex;i===`change`&&n!=null&&r!=null&&Gv({additionLine:e.additionLines[n.lineIndex],deletionLine:e.deletionLines[r.lineIndex],deletionLineIndex:a.deletionContent.length,additionLineIndex:a.additionContent.length,deletionDecorations:a.deletionDecorations,additionDecorations:a.additionDecorations,lineDiffType:f,maxLineDiffLength:m}),r!=null&&(y(e.deletionLines[r.lineIndex],r.lineIndex,a.deletionSegments,a.deletionContent),a.deletionInfo.push({type:i===`change`?`change-deletion`:i,lineNumber:r.lineNumber,altLineNumber:i===`change`?void 0:n.lineNumber??void 0,lineIndex:`${r.unifiedLineIndex},${o}`})),n!=null&&(y(e.additionLines[n.lineIndex],n.lineIndex,a.additionSegments,a.additionContent),a.additionInfo.push({type:i===`change`?`change-addition`:i,lineNumber:n.lineNumber,altLineNumber:i===`change`?void 0:r.lineNumber??void 0,lineIndex:`${n.unifiedLineIndex},${o}`}))}});for(let a of _.values()){if(a.deletionContent.length===0&&a.additionContent.length===0)continue;let o={name:e.prevName??e.name,contents:a.deletionContent.value},s={name:e.name,contents:a.additionContent.value},{deletionLines:c,additionLines:l}=qv({deletionFile:o,deletionInfo:a.deletionInfo,deletionDecorations:a.deletionDecorations,additionFile:s,additionInfo:a.additionInfo,additionDecorations:a.additionDecorations,highlighter:t,options:n,languageOverride:r?`text`:e.lang,lazyLineAST:i});if(h)p.deletionLines=c,p.additionLines=l;else for(let[e,t,n]of[[p.deletionLines,c,a.deletionSegments],[p.additionLines,l,a.additionSegments]])if(n.length>0)for(let r of n)for(let n=0;n<r.count;n++)e[r.targetIndex+n]=t[r.originalOffset+n];else if(i){let n=e.length;for(let r=0;r<t.length;r++)Ra(e,n+r,()=>t[r])}else za(e,t)}return{code:p,themeStyles:d,baseThemeType:u}}function Wv(e,{deletionLineIndex:t,additionLineIndex:n,deletionDecorations:r,additionDecorations:i}){let a=0,o=0,s=-1,c=0,l=-1,u=0;for(let{value:t,added:n,removed:r}of e)r?(s===-1&&(s=a),a+=t.length,c=a):n?(l===-1&&(l=o),o+=t.length,u=o):(a+=t.length,o+=t.length);s!==-1&&r.push(Bv({line:t,spanStart:s,spanLength:c-s})),l!==-1&&i.push(Bv({line:n,spanStart:l,spanLength:u-l}))}function Gv({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:s}){if(e==null||t==null||o===`none`||(e=sv(e),t=sv(t),e.length>s||t.length>s))return;let c=o===`char`?uv(e,t):Dv(e,t);if(o===`word-line`){Wv(c,{deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a});return}let l=[],u=[],d=o===`word-alt`,f=c.at(-1);for(let e of c){let t=e===f;!e.added&&!e.removed?(Vv({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),Vv({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?Vv({item:e,arr:l,enableJoin:d,isLastItem:t}):Vv({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(Bv({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(Bv({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function Kv(){return{deletionContent:{push(e){this.value+=e,this.length++},value:``,length:0},additionContent:{push(e){this.value+=e,this.length++},value:``,length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function qv({lazyLineAST:e,deletionFile:t,additionFile:n,deletionInfo:r,additionInfo:i,highlighter:a,deletionDecorations:o,additionDecorations:s,languageOverride:c,options:{theme:l,useTokenTransformer:u,tokenizeMaxLineLength:d}}){let f=(t,n,r)=>t.contents===``?[]:La(a.codeToTokens(sv(t.contents),Gi(c??Ai(t.name),l,d)).tokens,{state:{lineInfo:n},useTokenTransformer:u,decorations:r,lazyLineAST:e,cacheHtmlStyles:a.name===`highlights`});return{deletionLines:f(t,r,o),additionLines:f(n,i,s)}}function Jv(e){let t=[];for(let n of e){let e=Va.get(n);if(e==null)throw Error(`getResolvedLanguages: ${n} is not resolved. Please resolve languages before calling getResolvedLanguages`);t.push(e)}return t}function Yv(e){for(let t of Array.isArray(e)?e:[e])if(!Va.has(t))return!1;return!0}function Xv(e,t=Ba()){return Fa(t).getResolvedThemes(e)}function Zv(e,t=Ba()){return Fa(t).hasResolvedThemes(e)}function Qv(e,t=Ba()){return Fa(t).resolveThemes(e)}var $v=0,ey=1,ty=2,ny=4,ry=5,iy=6,ay=[void 0,null,!0,!1];function oy(e){if(Array.isArray(e))return e;let{ops:t,offsets:n,strings:r,text:i,extras:a}=e,o=Array(n.length/2),s=0,c=0;function l(e){let n=Array(e);for(let o=0;o<e;o++){let e=t[s++];if(e!==$v){if(e===ey){let e=c+t[s++];n[o]={type:`text`,value:i.slice(c,e)},c=e}else if(e===ty){let e=r[t[s++]],i={};for(let e=t[s++];e>0;e--){let e=r[t[s++]],n=t[s++],o=n===ny?r[t[s++]]:n===ry?t[s++]:n===iy?a[t[s++]]:ay[n];e===`__proto__`?Object.defineProperty(i,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):i[e]=o}n[o]={type:`element`,tagName:e,properties:i,children:l(t[s++])}}else n[o]=a[t[s++]]}}return n}for(let e=0;e<o.length;e++)t[n[e*2]]!==$v&&Ra(o,e,()=>(s=n[e*2],c=n[e*2+1],l(1)[0]),{retain:!1});return o}var sy=e(Ji(),1),cy=Symbol(`IGNORE_RESPONSE`),ly=1e4,uy=class{options;preferredHighlighter;renderOptions;renderOptionsRequestVersion=0;renderOptionsVersion=0;initialized=!1;workers=[];queuedTasks=[];queuedTaskByInstance=new Map;taskByHighlightKey=new Map;activeTaskById=new Map;activeRequestByInstance=new Map;nextRequestId=0;themeSubscribers=new Set;workersFailed=!1;terminated=!1;statSubscribers=new Set;fileCache;diffCache;_queuedBroadcast;lifecycleGeneration=0;constructor(e,{langs:t,theme:n=Ii,useTokenTransformer:r=!1,lineDiffType:i=`word-alt`,maxLineDiffLength:a=1e3,tokenizeMaxLineLength:o=1e3,preferredHighlighter:s}){this.options=e,this.preferredHighlighter=Ba(s),this.renderOptions={theme:n,useTokenTransformer:r,lineDiffType:i,maxLineDiffLength:a,tokenizeMaxLineLength:o},this.fileCache=new sy.default.LRUMap(e.totalASTLRUCacheSize??100),this.diffCache=new sy.default.LRUMap(e.totalASTLRUCacheSize??100),this.queueInitialization(t)}isWorkingPool(){return!this.workersFailed&&!this.terminated}shouldHighlightOnMainThread(e){let{mainThreadMaxCharacters:t=-1}=this.options;return(`contents`in e?e.contents.length:e.deletionCharacterCount+e.additionCharacterCount)<=t}getFileResultCache(e){return e.cacheKey==null?void 0:this.fileCache.get(e.cacheKey)}getDiffResultCache(e){return e.cacheKey==null?void 0:this.diffCache.get(e.cacheKey)}setFileResultCache(e,{result:t,options:n}){return e==null||!ri(n,this.getFileRenderOptions())?!1:(this.fileCache.set(e,{result:t,options:n}),this.queueBroadcastStateChanges(),!0)}setDiffResultCache(e,{result:t,options:n}){return e==null||!z_(n,this.getDiffRenderOptions())?!1:(this.diffCache.set(e,{result:t,options:n}),this.queueBroadcastStateChanges(),!0)}inspectCaches(){let{fileCache:e,diffCache:t}=this;return{fileCache:e,diffCache:t}}evictFileFromCache(e){try{return this.fileCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}evictDiffFromCache(e){try{return this.diffCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}async setRenderOptions({theme:e=this.renderOptions.theme??Ii,useTokenTransformer:t=this.renderOptions.useTokenTransformer??!1,lineDiffType:n=this.renderOptions.lineDiffType??`word-alt`,maxLineDiffLength:r=this.renderOptions.maxLineDiffLength??1e3,tokenizeMaxLineLength:i=this.renderOptions.tokenizeMaxLineLength??1e3}){let{lifecycleGeneration:a}=this,o=++this.renderOptionsRequestVersion,s=()=>this.isCurrentLifecycle(a)&&this.renderOptionsRequestVersion===o;try{let a={theme:e,useTokenTransformer:t,lineDiffType:n,maxLineDiffLength:r,tokenizeMaxLineLength:i};if(!this.isInitialized())try{await this.initialize()}catch(e){if(!this.workersFailed)throw e}if(!s()||z_(a,this.renderOptions))return;let o=_i(e),c=[];if(yi(a.theme,this.renderOptions.theme)||(c=Zv(o,this.preferredHighlighter)?Xv(o,this.preferredHighlighter):await Qv(o,this.preferredHighlighter)),!s()||ua({theme:e})==null&&(await this.loadSharedHighlighter(o,[`text`]),!s()))return;let l=this.setRenderOptionsOnWorkers(a,c);this.renderOptions=a,this.renderOptionsVersion++,this.diffCache.clear(),this.fileCache.clear(),this.invalidateRenderTasks();for(let e of this.themeSubscribers)e.onThemeChange();await l}catch(e){if(e instanceof na||!s())return;throw e}}getPreferredHighlighter(){return this.preferredHighlighter}getFileRenderOptions(){let{tokenizeMaxLineLength:e,theme:t,useTokenTransformer:n}=this.renderOptions;return{theme:t,useTokenTransformer:n,tokenizeMaxLineLength:e}}getDiffRenderOptions(){return{...this.renderOptions}}async setRenderOptionsOnWorkers(e,t){if(this.workersFailed)return;this.isInitialized()||await this.initialize();let n=[];for(let r of this.workers){if(!r.initialized)throw console.log({managedWorker:r}),Error(`setRenderOptionsOnWorkers: Somehow we have an uninitialized worker`);n.push(new Promise((n,i)=>{let a=this.generateRequestId(),o={type:`set-render-options`,id:a,request:{type:`set-render-options`,id:a,renderOptions:e,resolvedThemes:t},resolve:n,reject:i,requestStart:Date.now()};this.activeTaskById.set(a,o),r.pendingSetupRequestId=a,r.worker.postMessage(o.request)}))}await Promise.all(n)}subscribeToThemeChanges(e){return this.themeSubscribers.add(e),this.queueBroadcastStateChanges(),()=>{this.unsubscribeToThemeChanges(e),this.queueBroadcastStateChanges()}}unsubscribeToThemeChanges(e){this.themeSubscribers.delete(e),this.queueBroadcastStateChanges()}subscribeToStatChanges(e){return this.statSubscribers.add(e),e(this.getStats()),()=>{this.statSubscribers.delete(e)}}queueBroadcastStateChanges(){this._queuedBroadcast??=requestAnimationFrame(this._broadcastStateChanges)}_broadcastStateChanges=()=>{this._queuedBroadcast!=null&&(cancelAnimationFrame(this._queuedBroadcast),this._queuedBroadcast=void 0);let e=this.getStats();for(let t of this.statSubscribers)t(e)};cleanUpTasks(e){this.detachInstanceFromQueuedTasks(e);let t=this.activeRequestByInstance.get(e);if(t!=null){let n=this.activeTaskById.get(t);py(n)?(this.detachInstanceFromRenderTask(n,e),!n.primeCache&&n.instances.size===0&&this.removeActiveTask(n)):this.activeTaskById.delete(t)}this.activeRequestByInstance.delete(e),this.queueBroadcastStateChanges()}isInitialized(){return this.initialized===!0}async initialize(e=[]){if(this.initialized===!0)ua({theme:this.renderOptions.theme})??await this.loadSharedHighlighter(_i(this.renderOptions.theme),[`text`,...e]);else{if(this.initialized===!1){this.terminated=!1;let{lifecycleGeneration:t}=this,n=new Promise((n,r)=>{(async()=>{try{let r=_i(this.renderOptions.theme),i=Zv(r,this.preferredHighlighter)?Xv(r,this.preferredHighlighter):await Qv(r,this.preferredHighlighter);if(!this.isCurrentLifecycle(t)){n();return}let a=[];if(this.preferredHighlighter!==`highlights`&&(a=Yv(e)?Jv(e):await Ha(e)),!this.isCurrentLifecycle(t)){n();return}if(await Promise.all([this.loadSharedHighlighter(r,[`text`,...e]),this.initializeWorkers(i,a)]),!this.isCurrentLifecycle(t)){this.terminateWorkers(),n();return}this.initialized=!0,this.drainQueue(),this.queueBroadcastStateChanges(),n()}catch(e){if(e instanceof na||!this.isCurrentLifecycle(t)){n();return}this.initialized=!1,this.workersFailed=!0,this.cancelActiveWorkerTasks(),this.terminateWorkers(),this.activeTaskById.clear();for(let t of this.queuedTasks)this.rejectRenderTaskCallbacks(t,hy(e));this.queueBroadcastStateChanges(),r(e)}})()});return this.initialized=n,this.queueBroadcastStateChanges(),n}return this.initialized}}async loadSharedHighlighter(e,t){try{await Yr({themes:e,langs:t,preferredHighlighter:this.preferredHighlighter})}catch(e){if(!(e instanceof Ia))throw e}}async initializeWorkers(e,t){this.workersFailed=!1;let n=[],r=Aa(),i=r>0?ei():void 0;this.workers.length>0&&this.terminateWorkers();for(let a=0;a<(this.options.poolSize??8);a++){let a=this.options.workerFactory(),o={worker:a,requestId:void 0,pendingSetupRequestId:void 0,initialized:!1,langs:new Set([`text`,...t.map(({name:e})=>e)]),customExtensionsVersion:0};a.addEventListener(`message`,e=>{this.handleWorkerMessage(o,e.data)}),a.addEventListener(`error`,e=>this.handleWorkerError(o,e)),this.workers.push(o),n.push(new Promise((n,a)=>{let s=this.generateRequestId(),c={type:`initialize`,id:s,request:{type:`initialize`,resultFormat:`hast-ops-v1`,id:s,renderOptions:this.renderOptions,preferredHighlighter:this.preferredHighlighter,resolvedThemes:e,resolvedLanguages:t,customExtensionsVersion:i==null?void 0:r,customExtensionMap:i},resolve(){o.initialized=!0,n()},reject:a,requestStart:Date.now()};o.pendingSetupRequestId=s,this.activeTaskById.set(s,c),this.executeTask(o,c)}))}let a=this.options.workerInitializationTimeout??ly,o;try{await Promise.race([Promise.all(n),new Promise((e,t)=>{o=setTimeout(()=>{t(Error(`WorkerPoolManager: worker initialization timed out after ${a}ms`))},a)})])}finally{o!=null&&clearTimeout(o)}}handleWorkerError(e,t){let{onWorkerError:n}=this.options;if(n!=null)try{n(t,e.worker)}catch(e){console.error(`WorkerPoolManager: onWorkerError threw:`,e)}else console.error(`Worker error:`,t,e);let{pendingSetupRequestId:r}=e;if(r==null)return;let i=this.activeTaskById.get(r);if(i?.type!==`initialize`)return;let a=gy(t);n!=null&&sa(a),i.reject(a),this.cleanWorkerAndTask(e,i)}drainQueue=()=>{if(this._queuedDrain=void 0,this.initialized===!0&&this.queuedTasks.length!==0){for(let e=0;e<this.queuedTasks.length;){let t=this.queuedTasks[e];if(this.hasActiveRequest(t)){e++;continue}let n=fy(t.request),r=this.getAvailableWorker(n);if(r==null)break;this.queuedTasks.splice(e,1),this.assignWorkerToTask(t,r),this.resolveLanguagesAndExecuteTask(r,t,n)}this.queueBroadcastStateChanges()}};highlightFileAST(e,t){let n=this.getFileResultCache(t);Oi(t)||n!=null&&ri(n.options,this.getFileRenderOptions())||this.hasMatchingFileInstanceTask(e,t)||this.submitTask(e,{type:`file`,file:t})}primeFileHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(Error(`WorkerPoolManager.primeFileHighlightCache: worker pool is not working`));if(!this.shouldPrimeFileHighlightCache(e))return Promise.resolve();if(this.shouldHighlightOnMainThread(e)){let t=this.getFileRenderOptions();return this.primeHighlightCacheOnMainThread(fy({type:`file`,file:e}),t.theme,n=>this.setFileResultCache(e.cacheKey,{result:ia(e,n,t),options:t}))}let t=this.getOrCreateFileHighlightCacheTask(e);return t==null?Promise.resolve():this.createRenderTaskCallbacks(t)}shouldPrimeFileHighlightCache(e){if(e.cacheKey==null)return console.warn(`WorkerPoolManager.primeFileHighlightCache: priming highlight cache requires file.cacheKey; skipping "${e.name}".`),!1;let t=this.getFileResultCache(e);return!Oi(e)&&(t==null||!ri(t.options,this.getFileRenderOptions()))}getOrCreateFileHighlightCacheTask(e){let t=this.getFileHighlightKey(e);if(t==null)return;let n=this.getTaskByHighlightKey(t);if(n!=null){if(n.type!==`file`)throw Error(`WorkerPoolManager.getOrCreateFileHighlightCacheTask: Invalid task type`);return n.primeCache=!0,n}{let n=this.submitCacheTask({type:`file`,file:e},t);if(n.type!==`file`)throw Error(`WorkerPoolManager.getOrCreateFileHighlightCacheTask: Invalid task created`);return n}}getPlainFileAST(e,t,n,r){let i=ua({theme:this.renderOptions.theme});if(i==null)this.queueInitialization();else return ia(e,i,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,lines:r})}highlightDiffAST(e,t){let n=this.getDiffResultCache(t);B_(t)||n!=null&&z_(n.options,this.getDiffRenderOptions())||this.hasMatchingDiffInstanceTask(e,t)||this.submitTask(e,{type:`diff`,diff:t})}primeDiffHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(Error(`WorkerPoolManager.primeDiffHighlightCache: worker pool is not working`));if(!this.shouldPrimeDiffHighlightCache(e))return Promise.resolve();if(this.shouldHighlightOnMainThread(e)){let t=this.getDiffRenderOptions();return this.primeHighlightCacheOnMainThread(fy({type:`diff`,diff:e}),t.theme,n=>this.setDiffResultCache(e.cacheKey,{result:Uv(e,n,t),options:t}))}let t=this.getOrCreateDiffHighlightCacheTask(e);return t==null?Promise.resolve():this.createRenderTaskCallbacks(t)}shouldPrimeDiffHighlightCache(e){if(e.cacheKey==null)return console.warn(`WorkerPoolManager.primeDiffHighlightCache: priming highlight cache requires diff.cacheKey; skipping "${e.prevName??e.name}" -> "${e.name}".`),!1;let t=this.getDiffResultCache(e);return!B_(e)&&(t==null||!z_(t.options,this.getDiffRenderOptions()))}primeHighlightCacheOnMainThread(e,t,n){function r(){let r=ua({theme:t,langs:e});return r!=null&&n(r)}if(r())return Promise.resolve();let{lifecycleGeneration:i}=this;return this.loadSharedHighlighter(_i(t),[`text`,...e]).then(()=>{if(!this.isCurrentLifecycle(i))throw new na;if(!r())throw new $i})}getOrCreateDiffHighlightCacheTask(e){let t=this.getDiffHighlightKey(e);if(t==null)return;let n=this.getTaskByHighlightKey(t);if(n!=null){if(n.type!==`diff`)throw Error(`WorkerPoolManager.getOrCreateDiffHighlightCacheTask: Invalid task type`);return n.primeCache=!0,n}{let n=this.submitCacheTask({type:`diff`,diff:e},t);if(n.type!==`diff`)throw Error(`WorkerPoolManager.getOrCreateDiffHighlightCacheTask: Invalid task created`);return n}}getPlainDiffAST(e,t,n,r,i){let a=ua({theme:this.renderOptions.theme});if(a==null)this.queueInitialization();else return Uv(e,a,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,expandedHunks:r,collapsedContextThreshold:i})}terminate(){this.lifecycleGeneration++,this.cancelActiveWorkerTasks(),this.terminateWorkers();let e=new na;for(let t of this.queuedTasks)this.rejectRenderTaskCallbacks(t,e);this.fileCache.clear(),this.diffCache.clear(),this.activeRequestByInstance.clear(),this.queuedTasks.length=0,this.queuedTaskByInstance.clear(),this.taskByHighlightKey.clear(),this.activeTaskById.clear(),this.initialized=!1,this.workersFailed=!1,this.terminated=!0,this.queueBroadcastStateChanges()}isCurrentLifecycle(e){return this.lifecycleGeneration===e}queueInitialization(e){this.initialize(e).catch(e=>{ha(e)||console.error(e)})}cancelActiveWorkerTasks(){let e=new na;for(let t of this.activeTaskById.values())`reject`in t?t.reject(e):py(t)&&this.rejectRenderTaskCallbacks(t,e)}terminateWorkers(){for(let e of this.workers)e.worker.terminate();this.workers.length=0}getStats(){return{managerState:this.initialized===!1?`waiting`:this.initialized===!0?`initialized`:`initializing`,totalWorkers:this.workers.length,workersFailed:this.workersFailed,busyWorkers:this.workers.filter(e=>e.requestId!=null||e.pendingSetupRequestId!=null).length,queuedTasks:this.queuedTasks.length,activeTasks:this.activeTaskById.size,themeSubscribers:this.themeSubscribers.size,fileCacheSize:this.fileCache.size,diffCacheSize:this.diffCache.size}}submitTask(e,t){this.initialized===!1&&this.queueInitialization();let n=this.getHighlightKeyForRequest(t),r=n==null?void 0:this.getTaskByHighlightKey(n);if(r!=null){this.detachInstanceFromQueuedTasks(e,r),this.addInstanceToTask(r,e),this.queueBroadcastStateChanges();return}this.detachInstanceFromQueuedTasks(e);let i=this.generateRequestId(),a=Date.now(),{renderOptionsVersion:o}=this,s=(()=>{switch(t.type){case`file`:return{type:`file`,id:i,request:{...t,id:i},instances:new Set([e]),primeCache:!1,highlightKey:n,callbacks:new Set,renderOptionsVersion:o,requestStart:a};case`diff`:return{type:`diff`,id:i,request:{...t,id:i},instances:new Set([e]),primeCache:!1,highlightKey:n,callbacks:new Set,renderOptionsVersion:o,requestStart:a}}})();this.enqueueRenderTask(s,e)}submitCacheTask(e,t){this.initialized===!1&&this.queueInitialization();let n=this.generateRequestId(),r=Date.now(),{renderOptionsVersion:i}=this,a=(()=>{switch(e.type){case`file`:return{type:`file`,id:n,request:{...e,id:n},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:i,requestStart:r};case`diff`:return{type:`diff`,id:n,request:{...e,id:n},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:i,requestStart:r}}})();return this.enqueueRenderTask(a),a}enqueueRenderTask(e,t){this.queuedTasks.push(e),t!=null&&this.queuedTaskByInstance.set(t,e),e.highlightKey!=null&&this.taskByHighlightKey.set(e.highlightKey,e),this.queueDrain()}async resolveLanguagesAndExecuteTask(e,t,n){try{let r=ua(),i=n.filter(e=>r==null||!ti(e,r));i.length>0&&this.loadSharedHighlighter(_i(this.renderOptions.theme),[`text`,...i]).catch(e=>{console.error(e)});let a=this.preferredHighlighter===`highlights`?[]:n.filter(t=>!e.langs.has(t));if(a.length>0&&(Yv(a)?t.request.resolvedLanguages=Jv(a):t.request.resolvedLanguages=await Ha(a)),!this.activeTaskById.has(t.id)){e.requestId===t.id&&(this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain());return}this.executeTask(e,t)}catch(n){this.rejectRenderTaskCallbacks(t,hy(n)),this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}}handleWorkerMessage(e,t){let n=this.activeTaskById.get(t.id);try{if(n==null)throw cy;if(t.type===`error`){let e=Error(t.error);if(t.stack&&(e.stack=t.stack),`reject`in n)n.reject(e);else if(py(n))this.notifyHighlightError(n,e),this.rejectRenderTaskCallbacks(n,e);else throw Error(`handleWorkerMessage: unknown task type`);throw e}if(py(n))for(let{name:t}of n.request.resolvedLanguages??[])e.langs.add(t);switch(t.requestType){case`initialize`:if(n.type!==`initialize`)throw Error(`handleWorkerMessage: task/response dont match`);this.syncCustomExtensionVersion(e,n.request),n.resolve();break;case`set-render-options`:if(n.type!==`set-render-options`)throw Error(`handleWorkerMessage: task/response dont match`);n.resolve();break;case`file`:{if(n.type!==`file`)throw Error(`handleWorkerMessage: task/response dont match`);let{options:r}=t;if(!this.isCurrentRenderTask(n)||!ri(r,this.getFileRenderOptions()))throw cy;let{request:i}=n,a={...t.result,code:oy(t.result.code)};this.syncCustomExtensionVersion(e,i),n.cacheKeyAtDispatch!=null&&this.fileCache.set(n.cacheKeyAtDispatch,{result:a,options:r}),this.resolveRenderTaskCallbacks(n),this.notifyFileInstances(n,a,r);break}case`diff`:{if(n.type!==`diff`)throw Error(`handleWorkerMessage: task/response dont match`);let{options:r}=t;if(!this.isCurrentRenderTask(n)||!z_(r,this.getDiffRenderOptions()))throw cy;let{request:i}=n,a={...t.result,code:{deletionLines:oy(t.result.code.deletionLines),additionLines:oy(t.result.code.additionLines)}};this.syncCustomExtensionVersion(e,i),n.cacheKeyAtDispatch!=null&&this.diffCache.set(n.cacheKeyAtDispatch,{result:a,options:r}),this.resolveRenderTaskCallbacks(n),this.notifyDiffInstances(n,a,r);break}}}catch(e){e!==cy&&console.error(e,n,t)}this.cleanWorkerAndTask(e,n,t.id),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}_queuedDrain;queueDrain(){this._queuedDrain??(this._queuedDrain=Promise.resolve().then(this.drainQueue),this.queueBroadcastStateChanges())}assignWorkerToTask(e,t){t.requestId=e.id,py(e)&&(this.clearQueuedInstanceRequests(e),this.trackInstanceRequests(e)),this.activeTaskById.set(e.id,e)}cleanWorkerAndTask(e,t,n=t?.id){e.requestId===n&&(e.requestId=void 0),e.pendingSetupRequestId===n&&(e.pendingSetupRequestId=void 0),t!=null&&(py(t)&&(this.rejectRenderTaskCallbacks(t,new $i),this.clearInstanceRequests(t),this.clearHighlightKey(t)),this.activeTaskById.delete(t.id))}executeTask(e,t){dy(t.request)&&this.maybeAttachCustomExtensions(e,t.request),this.activeTaskById.has(t.id)||this.assignWorkerToTask(t,e);try{t.type===`file`?t.cacheKeyAtDispatch=t.request.file.cacheKey:t.type===`diff`&&(t.cacheKeyAtDispatch=t.request.diff.cacheKey),e.worker.postMessage(t.request)}catch(n){console.error(`Failed to post message to worker:`,n),py(t)?(this.notifyHighlightError(t,n),this.rejectRenderTaskCallbacks(t,hy(n))):`reject`in t&&t.reject(n),this.cleanWorkerAndTask(e,t),this.queuedTasks.length>0&&this.queueDrain()}this.queueBroadcastStateChanges()}maybeAttachCustomExtensions(e,t){if(t.customExtensionsVersion!=null)return;let n=Aa();e.customExtensionsVersion>=n||(t.customExtensionsVersion=n,t.customExtensionMap=ei())}syncCustomExtensionVersion(e,t){t.customExtensionsVersion!=null&&(e.customExtensionsVersion=t.customExtensionsVersion)}getAvailableWorker(e){let t;for(let n of this.workers){if(n.requestId!=null||n.pendingSetupRequestId!=null||!n.initialized)continue;if(t=n,e.length===0)break;let r=!0;for(let t of e)if(!n.langs.has(t)){r=!1;break}if(r)break}return t}getFileHighlightKey(e){if(e.cacheKey!=null)return`file:${e.cacheKey}:${this.renderOptionsVersion}`}getDiffHighlightKey(e){if(e.cacheKey!=null)return`diff:${e.cacheKey}:${this.renderOptionsVersion}`}getHighlightKeyForRequest(e){switch(e.type){case`file`:return this.getFileHighlightKey(e.file);case`diff`:return this.getDiffHighlightKey(e.diff)}}hasActiveRequest(e){for(let t of my(e))if(this.activeRequestByInstance.has(t))return!0;return!1}addInstanceToTask(e,t){e.type,e.instances.add(t),this.activeTaskById.has(e.id)?this.activeRequestByInstance.set(t,e.id):this.queuedTaskByInstance.set(t,e)}detachInstanceFromQueuedTasks(e,t){let n=this.queuedTaskByInstance.get(e);n!=null&&n!==t&&(this.queuedTaskByInstance.delete(e),this.detachInstanceFromRenderTask(n,e),!n.primeCache&&n.instances.size===0&&this.removeQueuedTask(n))}detachInstanceFromRenderTask(e,t){e.type,e.instances.delete(t)}removeQueuedTask(e){let t=this.queuedTasks.indexOf(e);t!==-1&&this.queuedTasks.splice(t,1),this.rejectRenderTaskCallbacks(e,new $i),this.clearQueuedInstanceRequests(e),this.clearHighlightKey(e)}removeActiveTask(e){this.rejectRenderTaskCallbacks(e,new $i),this.clearInstanceRequests(e),this.clearHighlightKey(e),this.activeTaskById.delete(e.id)}createRenderTaskCallbacks(e){return new Promise((t,n)=>{e.callbacks.add({resolve:t,reject:n})})}resolveRenderTaskCallbacks(e){for(let t of e.callbacks)t.resolve();e.callbacks.clear()}rejectRenderTaskCallbacks(e,t){for(let n of e.callbacks)n.reject(t);e.callbacks.clear()}invalidateRenderTasks(){for(let e=this.queuedTasks.length-1;e>=0;e--){let t=this.queuedTasks[e];t.renderOptionsVersion!==this.renderOptionsVersion&&this.removeQueuedTask(t)}for(let e of Array.from(this.activeTaskById.values()))py(e)&&e.renderOptionsVersion!==this.renderOptionsVersion&&this.removeActiveTask(e)}clearQueuedInstanceRequests(e){for(let t of my(e))this.queuedTaskByInstance.get(t)===e&&this.queuedTaskByInstance.delete(t)}clearHighlightKey(e){e.highlightKey!=null&&this.taskByHighlightKey.get(e.highlightKey)===e&&this.taskByHighlightKey.delete(e.highlightKey)}trackInstanceRequests(e){for(let t of my(e))this.activeRequestByInstance.set(t,e.id)}clearInstanceRequests(e){for(let t of my(e))this.activeRequestByInstance.get(t)===e.id&&this.activeRequestByInstance.delete(t)}notifyFileInstances(e,t,n){for(let r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.file,t,n)}notifyDiffInstances(e,t,n){for(let r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.diff,t,n)}notifyHighlightError(e,t){for(let n of my(e))this.activeRequestByInstance.get(n)===e.id&&n.onHighlightError(t)}hasMatchingFileInstanceTask(e,t){for(let n of this.iterateRenderTasks())if(n.type===`file`&&this.isCurrentRenderTask(n)&&n.instances.has(e)&&R_(t,n.request.file))return!0;return!1}hasMatchingDiffInstanceTask(e,t){for(let n of this.iterateRenderTasks())if(n.type===`diff`&&this.isCurrentRenderTask(n)&&n.instances.has(e)&&L_(n.request.diff,t))return!0;return!1}getTaskByHighlightKey(e){let t=this.taskByHighlightKey.get(e);return t!=null&&this.isCurrentRenderTask(t)?t:void 0}isCurrentRenderTask(e){return e.renderOptionsVersion===this.renderOptionsVersion}*iterateRenderTasks(){for(let e of this.queuedTasks)yield e;for(let e of this.activeTaskById.values())py(e)&&(yield e)}generateRequestId(){return`req_${++this.nextRequestId}`}};function dy(e){return e.type===`initialize`||e.type===`file`||e.type===`diff`}function fy(e){let t=new Set;switch(e.type){case`file`:t.add(e.file.lang??Ai(e.file.name));break;case`diff`:t.add(e.diff.lang??Ai(e.diff.name)),t.add(e.diff.lang??Ai(e.diff.prevName??`-`))}return t.delete(`text`),Array.from(t)}function py(e){return e?.type===`file`||e?.type===`diff`}function my(e){return e.instances}function hy(e){if(e instanceof Error)return e;if(typeof e==`object`&&e){if(`error`in e&&e.error instanceof Error)return e.error;if(`message`in e&&typeof e.message==`string`)return Error(e.message)}return Error(String(e))}function gy(e){let t=`error`in e?e.error:void 0,n=`message`in e&&typeof e.message==`string`&&e.message!==``?e.message:t instanceof Error?t.message:`the worker script failed to load (the error event carries no message)`;return new xa(`WorkerPoolManager: worker failed: ${n}`,t instanceof Error?{cause:t}:void 0)}var _y;function vy({poolOptions:e,highlighterOptions:t}){return _y??=new uy(e,t),_y}function yy(){_y!=null&&(_y.terminate(),_y=void 0)}var by=(0,G.createContext)(void 0),xy=0;function Sy({children:e,poolOptions:t,highlighterOptions:n}){let[r]=(0,G.useState)(()=>{if(typeof window<`u`)return vy({poolOptions:t,highlighterOptions:n})});return(0,G.useInsertionEffect)(()=>{if(r!=null)return xy++,()=>{xy--}},[r]),(0,G.useEffect)(()=>()=>{xy===0&&yy()},[]),(0,K.jsx)(by.Provider,{value:r,children:e})}var Cy=1;function wy(e,...t){return`ck${Cy}:${JSON.stringify([e,...t])}`}var Ty=new TextEncoder,Ey=new TextDecoder(`utf-8`,{ignoreBOM:!0}),Dy=/[\uD800-\uDFFF]/,Oy=1024,ky=new Uint8Array(Oy);function Ay(){ky.length!==Oy&&(ky=new Uint8Array(Oy))}function jy(e){if(e.length===0)return e;if(Dy.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;ky.length<t&&(ky=new Uint8Array(t));let{written:n}=Ty.encodeInto(e,ky);return Ey.decode(ky.subarray(0,n))}var My=new TextDecoder(`utf-8`,{ignoreBOM:!0}),Ny={'"':`"`,"\\":`\\`,a:`\x07`,b:`\b`,t:` `,n:`
1291
- `,v:`\v`,f:`\f`,r:`\r`};function Py(e){if(e[0]!==`"`)return;let t=``,n=1;for(;n<e.length;){let r=e[n];if(r===`"`)return{fileName:t,rawLength:n+1};if(r!==`\\`){t+=r,n++;continue}let i=Ny[e[n+1]];if(i!=null){t+=i,n+=2;continue}let a=[];do{let t=Fy(e,n+1);if(t==null)return;a.push(t),n+=4}while(e[n]===`\\`&&e[n+1]>=`0`&&e[n+1]<=`7`);t+=My.decode(new Uint8Array(a))}}function Fy(e,t){let n=e.charCodeAt(t)-48,r=e.charCodeAt(t+1)-48,i=e.charCodeAt(t+2)-48;if(n>=0&&n<=3&&r>=0&&r<=7&&i>=0&&i<=7)return n*64+r*8+i}var Iy=4096,Ly=.5;function Ry(e){for(let t of e.hunks)for(let n=0;n<t.hunkContent.length;n++){let r=t.hunkContent[n];if(r.type!==`change`)continue;let i=By(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}}function zy(e,t,n){let{hunkContent:r}=e;for(let e=1;e<r.length;e++){let i=r[e],a=r[e-1];if(i.type!==`change`||i.additions>0&&i.deletions>0||a.type!==`context`)continue;let o=i.additions>0,s=o?t.additionLines:t.deletionLines,c=o?i.additionLineIndex:i.deletionLineIndex,l=o?i.additions:i.deletions,u=s[c]??``;if(u.trim()!==``)continue;let d=!0;for(let e=1;e<l;e++)if(s[c+e]!==u){d=!1;break}if(!d)continue;let f=0;for(;f<a.lines&&t.additionLines[a.additionLineIndex+a.lines-1-f]===u;)f++;if(f===0||e===1&&f===a.lines||n!=null&&(f=n(i,f),f===0))continue;i.additionLineIndex-=f,i.deletionLineIndex-=f;let p=i.additionLineIndex+i.additions,m=i.deletionLineIndex+i.deletions,h=r[e+1];h?.type===`context`?(h.lines+=f,h.additionLineIndex=p,h.deletionLineIndex=m):r.splice(e+1,0,{type:`context`,lines:f,additionLineIndex:p,deletionLineIndex:m}),a.lines-=f,a.lines===0&&(r.splice(e-1,1),e--)}}function By(e,t){let{deletions:n,additions:r,deletionLineIndex:i,additionLineIndex:a}=t,o=Math.min(n,r),s=Math.abs(r-n);if(o===0||s===0||o*(s+1)>Iy)return null;let c=[];for(let t=0;t<n;t++)c.push(Hy(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(Hy(e.additionLines[a+t]??``));let u=r>n,d=0,f=-1;for(let e=0;e<=s;e++){let t=0;for(let n=0;n<o;n++)t+=Uy(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*Ly:t>f&&(f=t,d=e)}if(d===0)return null;let p=[],m=(e,t,n,r)=>{(e>0||t>0)&&p.push({type:`change`,deletions:e,additions:t,deletionLineIndex:n,additionLineIndex:r})};return u?(m(0,d,i,a),m(o,o,i,a+d),m(0,r-o-d,i+o,a+d+o)):(m(d,0,i,a),m(o,o,i+d,a),m(n-o-d,0,i+d+o,a+o)),p}var Vy=/\s+/g;function Hy(e){return e.replace(Vy,``)}function Uy(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),r=Math.min(e.length,t.length);if(r===0)return 0;let i=0;for(;i<r&&e[i]===t[i];)i++;let a=0;for(;a<r-i&&e[e.length-1-a]===t[t.length-1-a];)a++;return(i+a)/n}var Wy=/^diff --git ("a\/(?:[^"\\]|\\.)*"|a\/.+?) ("b\/(?:[^"\\]|\\.)*"|b\/.+?)$/;function Gy(e,{cacheKeyPrefix:t,disableLineMatching:n,throwOnError:r=!1}={},i){let a=ub(e),o=a?$y(e):eb(e),s=n===!0?`patch-file-raw`:`patch-file`,c,l=[];for(let e of o){if(a&&!wi.test(e)||!a&&!tb(e)){if(c==null)c=jy(e);else if(r)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}let o=qy(e,{cacheKey:t==null?void 0:i==null?wy(s,t,String(l.length)):wy(s,t,String(i),String(l.length)),isGitDiff:a,disableLineMatching:n,throwOnError:r});o!=null&&l.push(o)}return{patchMetadata:c,files:l}}function Ky(e,t){try{return qy(e,t)}finally{Ay()}}function qy(e,{cacheKey:t,disableLineMatching:n=!1,isGitDiff:r=wi.test(e),oldFile:i,newFile:a,throwOnError:o=!1}={}){let s=0,c=db(e,`@@ `),l,u=i==null||a==null,d=0,f=0;for(let e of c){let n=Qy(e),c=n[0];if(c==null){if(o)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=sb(c),m=0,h=0;if(p==null||l==null){if(l!=null){if(o)throw Error(`parsePatchContent: Invalid hunk`);console.error(`parsePatchContent: Invalid hunk`,e);continue}l={name:``,type:`change`,hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:u,additionLines:!u&&i!=null&&a!=null?Zy(a.contents):[],deletionLines:!u&&i!=null&&a!=null?Zy(i.contents):[],additionCharacterCount:!u&&i!=null&&a!=null?a.contents.length:0,deletionCharacterCount:!u&&i!=null&&a!=null?i.contents.length:0,cacheKey:pb(t)},l.additionLines.length===1&&a?.contents===``&&(l.additionLines.length=0),l.deletionLines.length===1&&i?.contents===``&&(l.deletionLines.length=0);for(let e of n){if(e.startsWith(`diff --git`)){let t=e.trim().match(Wy);if(t==null){if(o)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}let n=Yy(t[1],!0),r=Yy(t[2],!0);l.name=jy(r),n!==r&&(l.prevName=jy(n));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(Hi):null;if(t!=null){let[,e,n]=t,i=Yy(n,r);if(e===`---`&&i!==`/dev/null`){let e=jy(i);l.prevName=e,l.name=e}else e===`+++`&&i!==`/dev/null`&&(l.name=jy(i))}else if(r){if(e.startsWith(`new mode `)&&(l.mode=jy(e.slice(8).trim())),e.startsWith(`old mode `)&&(l.prevMode=jy(e.slice(8).trim())),e.startsWith(`new file mode`)&&(l.type=`new`,l.mode=jy(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(l.type=`deleted`,l.mode=jy(e.slice(17).trim())),e.startsWith(`similarity index`)&&(e.startsWith(`similarity index 100%`)?l.type=`rename-pure`:l.type=`rename-changed`),e.startsWith(`index `)){let[,t,n,r]=e.trim().match(va)??[];t!=null&&(l.prevObjectId=jy(t)),n!=null&&(l.newObjectId=jy(n)),r!=null&&(l.mode=jy(r))}(e.startsWith(`rename from `)||e.startsWith(`copy from `))&&(l.prevName=jy(Yy(e.slice(e.startsWith(`rename`)?12:10)))),(e.startsWith(`rename to `)||e.startsWith(`copy to `))&&(l.name=jy(Yy(e.slice(e.startsWith(`rename`)?10:8))))}}continue}let g,_;for(;n.length>0&&(n[n.length-1]===`
1290
+ `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function Hv({line:e,spanStart:t,spanLength:n}){return{start:{line:e,character:t},end:{line:e,character:t+n},properties:{"data-diff-span":``},alwaysWrap:!0}}function Uv({item:e,arr:t,enableJoin:n,isNeutral:r=!1,isLastItem:i=!1}){let a=t[t.length-1];if(a==null||i||!n){t.push([+!r,e.value]);return}let o=a[0]===0;r===o||r&&e.value.length===1&&!o?a[1]+=e.value:t.push([+!r,e.value])}var Wv={forcePlainText:!1};function Gv(e,t,n,{forcePlainText:r,lazyLineAST:i=!1,startingLine:a,totalLines:o,expandedHunks:s,collapsedContextThreshold:c=1}=Wv){r?(a??=0,o??=1/0):(a=0,o=1/0);let l=a>0||o<1/0;i&&=!r&&!n.useTokenTransformer;let u=typeof n.theme==`string`?t.getTheme(n.theme).type:void 0,d=Oa({theme:n.theme,highlighter:t}),f=r&&!l&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?`none`:n.lineDiffType,p={deletionLines:[],additionLines:[]},{maxLineDiffLength:m}=n,h=!r&&!e.isPartial,g=r?s:void 0,_=new Map;function v(e){let t=h?0:e,n=_.get(t)??Jv();return _.set(t,n),n}function y(e,t,n,r){if(l){let e=n.at(-1);(e==null||e.targetIndex+e.count!==t)&&(e={targetIndex:t,originalOffset:r.length,count:0},n.push(e)),e.count++}r.push(e)}nv({diff:e,diffStyle:`both`,startingLine:a,totalLines:o,expandedHunks:!l||g,collapsedContextThreshold:c,callback:({hunkIndex:t,additionLine:n,deletionLine:r,type:i})=>{let a=v(t),o=n==null?r.splitLineIndex:n.splitLineIndex;i===`change`&&n!=null&&r!=null&&qv({additionLine:e.additionLines[n.lineIndex],deletionLine:e.deletionLines[r.lineIndex],deletionLineIndex:a.deletionContent.length,additionLineIndex:a.additionContent.length,deletionDecorations:a.deletionDecorations,additionDecorations:a.additionDecorations,lineDiffType:f,maxLineDiffLength:m}),r!=null&&(y(e.deletionLines[r.lineIndex],r.lineIndex,a.deletionSegments,a.deletionContent),a.deletionInfo.push({type:i===`change`?`change-deletion`:i,lineNumber:r.lineNumber,altLineNumber:i===`change`?void 0:n.lineNumber??void 0,lineIndex:`${r.unifiedLineIndex},${o}`})),n!=null&&(y(e.additionLines[n.lineIndex],n.lineIndex,a.additionSegments,a.additionContent),a.additionInfo.push({type:i===`change`?`change-addition`:i,lineNumber:n.lineNumber,altLineNumber:i===`change`?void 0:r.lineNumber??void 0,lineIndex:`${n.unifiedLineIndex},${o}`}))}});for(let a of _.values()){if(a.deletionContent.length===0&&a.additionContent.length===0)continue;let o={name:e.prevName??e.name,contents:a.deletionContent.value},s={name:e.name,contents:a.additionContent.value},{deletionLines:c,additionLines:l}=Yv({deletionFile:o,deletionInfo:a.deletionInfo,deletionDecorations:a.deletionDecorations,additionFile:s,additionInfo:a.additionInfo,additionDecorations:a.additionDecorations,highlighter:t,options:n,languageOverride:r?`text`:e.lang,lazyLineAST:i});if(h)p.deletionLines=c,p.additionLines=l;else for(let[e,t,n]of[[p.deletionLines,c,a.deletionSegments],[p.additionLines,l,a.additionSegments]])if(n.length>0)for(let r of n)for(let n=0;n<r.count;n++)e[r.targetIndex+n]=t[r.originalOffset+n];else if(i){let n=e.length;for(let r=0;r<t.length;r++)Ra(e,n+r,()=>t[r])}else za(e,t)}return{code:p,themeStyles:d,baseThemeType:u}}function Kv(e,{deletionLineIndex:t,additionLineIndex:n,deletionDecorations:r,additionDecorations:i}){let a=0,o=0,s=-1,c=0,l=-1,u=0;for(let{value:t,added:n,removed:r}of e)r?(s===-1&&(s=a),a+=t.length,c=a):n?(l===-1&&(l=o),o+=t.length,u=o):(a+=t.length,o+=t.length);s!==-1&&r.push(Hv({line:t,spanStart:s,spanLength:c-s})),l!==-1&&i.push(Hv({line:n,spanStart:l,spanLength:u-l}))}function qv({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:s}){if(e==null||t==null||o===`none`||(e=lv(e),t=lv(t),e.length>s||t.length>s))return;let c=o===`char`?fv(e,t):kv(e,t);if(o===`word-line`){Kv(c,{deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a});return}let l=[],u=[],d=o===`word-alt`,f=c.at(-1);for(let e of c){let t=e===f;!e.added&&!e.removed?(Uv({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),Uv({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?Uv({item:e,arr:l,enableJoin:d,isLastItem:t}):Uv({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(Hv({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(Hv({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function Jv(){return{deletionContent:{push(e){this.value+=e,this.length++},value:``,length:0},additionContent:{push(e){this.value+=e,this.length++},value:``,length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function Yv({lazyLineAST:e,deletionFile:t,additionFile:n,deletionInfo:r,additionInfo:i,highlighter:a,deletionDecorations:o,additionDecorations:s,languageOverride:c,options:{theme:l,useTokenTransformer:u,tokenizeMaxLineLength:d}}){let f=(t,n,r)=>t.contents===``?[]:La(a.codeToTokens(lv(t.contents),Gi(c??Ai(t.name),l,d)).tokens,{state:{lineInfo:n},useTokenTransformer:u,decorations:r,lazyLineAST:e,cacheHtmlStyles:a.name===`highlights`});return{deletionLines:f(t,r,o),additionLines:f(n,i,s)}}function Xv(e){let t=[];for(let n of e){let e=Va.get(n);if(e==null)throw Error(`getResolvedLanguages: ${n} is not resolved. Please resolve languages before calling getResolvedLanguages`);t.push(e)}return t}function Zv(e){for(let t of Array.isArray(e)?e:[e])if(!Va.has(t))return!1;return!0}function Qv(e,t=Ba()){return Fa(t).getResolvedThemes(e)}function $v(e,t=Ba()){return Fa(t).hasResolvedThemes(e)}function ey(e,t=Ba()){return Fa(t).resolveThemes(e)}var ty=0,ny=1,ry=2,iy=4,ay=5,oy=6,sy=[void 0,null,!0,!1];function cy(e){if(Array.isArray(e))return e;let{ops:t,offsets:n,strings:r,text:i,extras:a}=e,o=Array(n.length/2),s=0,c=0;function l(e){let n=Array(e);for(let o=0;o<e;o++){let e=t[s++];if(e!==ty){if(e===ny){let e=c+t[s++];n[o]={type:`text`,value:i.slice(c,e)},c=e}else if(e===ry){let e=r[t[s++]],i={};for(let e=t[s++];e>0;e--){let e=r[t[s++]],n=t[s++],o=n===iy?r[t[s++]]:n===ay?t[s++]:n===oy?a[t[s++]]:sy[n];e===`__proto__`?Object.defineProperty(i,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):i[e]=o}n[o]={type:`element`,tagName:e,properties:i,children:l(t[s++])}}else n[o]=a[t[s++]]}}return n}for(let e=0;e<o.length;e++)t[n[e*2]]!==ty&&Ra(o,e,()=>(s=n[e*2],c=n[e*2+1],l(1)[0]),{retain:!1});return o}var ly=e(Ji(),1),uy=Symbol(`IGNORE_RESPONSE`),dy=1e4,fy=class{options;preferredHighlighter;renderOptions;renderOptionsRequestVersion=0;renderOptionsVersion=0;initialized=!1;workers=[];queuedTasks=[];queuedTaskByInstance=new Map;taskByHighlightKey=new Map;activeTaskById=new Map;activeRequestByInstance=new Map;nextRequestId=0;themeSubscribers=new Set;workersFailed=!1;terminated=!1;statSubscribers=new Set;fileCache;diffCache;_queuedBroadcast;lifecycleGeneration=0;constructor(e,{langs:t,theme:n=Ii,useTokenTransformer:r=!1,lineDiffType:i=`word-alt`,maxLineDiffLength:a=1e3,tokenizeMaxLineLength:o=1e3,preferredHighlighter:s}){this.options=e,this.preferredHighlighter=Ba(s),this.renderOptions={theme:n,useTokenTransformer:r,lineDiffType:i,maxLineDiffLength:a,tokenizeMaxLineLength:o},this.fileCache=new ly.default.LRUMap(e.totalASTLRUCacheSize??100),this.diffCache=new ly.default.LRUMap(e.totalASTLRUCacheSize??100),this.queueInitialization(t)}isWorkingPool(){return!this.workersFailed&&!this.terminated}shouldHighlightOnMainThread(e){let{mainThreadMaxCharacters:t=-1}=this.options;return(`contents`in e?e.contents.length:e.deletionCharacterCount+e.additionCharacterCount)<=t}getFileResultCache(e){return e.cacheKey==null?void 0:this.fileCache.get(e.cacheKey)}getDiffResultCache(e){return e.cacheKey==null?void 0:this.diffCache.get(e.cacheKey)}setFileResultCache(e,{result:t,options:n}){return e==null||!ri(n,this.getFileRenderOptions())?!1:(this.fileCache.set(e,{result:t,options:n}),this.queueBroadcastStateChanges(),!0)}setDiffResultCache(e,{result:t,options:n}){return e==null||!V_(n,this.getDiffRenderOptions())?!1:(this.diffCache.set(e,{result:t,options:n}),this.queueBroadcastStateChanges(),!0)}inspectCaches(){let{fileCache:e,diffCache:t}=this;return{fileCache:e,diffCache:t}}evictFileFromCache(e){try{return this.fileCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}evictDiffFromCache(e){try{return this.diffCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}async setRenderOptions({theme:e=this.renderOptions.theme??Ii,useTokenTransformer:t=this.renderOptions.useTokenTransformer??!1,lineDiffType:n=this.renderOptions.lineDiffType??`word-alt`,maxLineDiffLength:r=this.renderOptions.maxLineDiffLength??1e3,tokenizeMaxLineLength:i=this.renderOptions.tokenizeMaxLineLength??1e3}){let{lifecycleGeneration:a}=this,o=++this.renderOptionsRequestVersion,s=()=>this.isCurrentLifecycle(a)&&this.renderOptionsRequestVersion===o;try{let a={theme:e,useTokenTransformer:t,lineDiffType:n,maxLineDiffLength:r,tokenizeMaxLineLength:i};if(!this.isInitialized())try{await this.initialize()}catch(e){if(!this.workersFailed)throw e}if(!s()||V_(a,this.renderOptions))return;let o=_i(e),c=[];if(yi(a.theme,this.renderOptions.theme)||(c=$v(o,this.preferredHighlighter)?Qv(o,this.preferredHighlighter):await ey(o,this.preferredHighlighter)),!s()||ua({theme:e})==null&&(await this.loadSharedHighlighter(o,[`text`]),!s()))return;let l=this.setRenderOptionsOnWorkers(a,c);this.renderOptions=a,this.renderOptionsVersion++,this.diffCache.clear(),this.fileCache.clear(),this.invalidateRenderTasks();for(let e of this.themeSubscribers)e.onThemeChange();await l}catch(e){if(e instanceof na||!s())return;throw e}}getPreferredHighlighter(){return this.preferredHighlighter}getFileRenderOptions(){let{tokenizeMaxLineLength:e,theme:t,useTokenTransformer:n}=this.renderOptions;return{theme:t,useTokenTransformer:n,tokenizeMaxLineLength:e}}getDiffRenderOptions(){return{...this.renderOptions}}async setRenderOptionsOnWorkers(e,t){if(this.workersFailed)return;this.isInitialized()||await this.initialize();let n=[];for(let r of this.workers){if(!r.initialized)throw console.log({managedWorker:r}),Error(`setRenderOptionsOnWorkers: Somehow we have an uninitialized worker`);n.push(new Promise((n,i)=>{let a=this.generateRequestId(),o={type:`set-render-options`,id:a,request:{type:`set-render-options`,id:a,renderOptions:e,resolvedThemes:t},resolve:n,reject:i,requestStart:Date.now()};this.activeTaskById.set(a,o),r.pendingSetupRequestId=a,r.worker.postMessage(o.request)}))}await Promise.all(n)}subscribeToThemeChanges(e){return this.themeSubscribers.add(e),this.queueBroadcastStateChanges(),()=>{this.unsubscribeToThemeChanges(e),this.queueBroadcastStateChanges()}}unsubscribeToThemeChanges(e){this.themeSubscribers.delete(e),this.queueBroadcastStateChanges()}subscribeToStatChanges(e){return this.statSubscribers.add(e),e(this.getStats()),()=>{this.statSubscribers.delete(e)}}queueBroadcastStateChanges(){this._queuedBroadcast??=requestAnimationFrame(this._broadcastStateChanges)}_broadcastStateChanges=()=>{this._queuedBroadcast!=null&&(cancelAnimationFrame(this._queuedBroadcast),this._queuedBroadcast=void 0);let e=this.getStats();for(let t of this.statSubscribers)t(e)};cleanUpTasks(e){this.detachInstanceFromQueuedTasks(e);let t=this.activeRequestByInstance.get(e);if(t!=null){let n=this.activeTaskById.get(t);hy(n)?(this.detachInstanceFromRenderTask(n,e),!n.primeCache&&n.instances.size===0&&this.removeActiveTask(n)):this.activeTaskById.delete(t)}this.activeRequestByInstance.delete(e),this.queueBroadcastStateChanges()}isInitialized(){return this.initialized===!0}async initialize(e=[]){if(this.initialized===!0)ua({theme:this.renderOptions.theme})??await this.loadSharedHighlighter(_i(this.renderOptions.theme),[`text`,...e]);else{if(this.initialized===!1){this.terminated=!1;let{lifecycleGeneration:t}=this,n=new Promise((n,r)=>{(async()=>{try{let r=_i(this.renderOptions.theme),i=$v(r,this.preferredHighlighter)?Qv(r,this.preferredHighlighter):await ey(r,this.preferredHighlighter);if(!this.isCurrentLifecycle(t)){n();return}let a=[];if(this.preferredHighlighter!==`highlights`&&(a=Zv(e)?Xv(e):await Ha(e)),!this.isCurrentLifecycle(t)){n();return}if(await Promise.all([this.loadSharedHighlighter(r,[`text`,...e]),this.initializeWorkers(i,a)]),!this.isCurrentLifecycle(t)){this.terminateWorkers(),n();return}this.initialized=!0,this.drainQueue(),this.queueBroadcastStateChanges(),n()}catch(e){if(e instanceof na||!this.isCurrentLifecycle(t)){n();return}this.initialized=!1,this.workersFailed=!0,this.cancelActiveWorkerTasks(),this.terminateWorkers(),this.activeTaskById.clear();for(let t of this.queuedTasks)this.rejectRenderTaskCallbacks(t,_y(e));this.queueBroadcastStateChanges(),r(e)}})()});return this.initialized=n,this.queueBroadcastStateChanges(),n}return this.initialized}}async loadSharedHighlighter(e,t){try{await Yr({themes:e,langs:t,preferredHighlighter:this.preferredHighlighter})}catch(e){if(!(e instanceof Ia))throw e}}async initializeWorkers(e,t){this.workersFailed=!1;let n=[],r=Aa(),i=r>0?ei():void 0;this.workers.length>0&&this.terminateWorkers();for(let a=0;a<(this.options.poolSize??8);a++){let a=this.options.workerFactory(),o={worker:a,requestId:void 0,pendingSetupRequestId:void 0,initialized:!1,langs:new Set([`text`,...t.map(({name:e})=>e)]),customExtensionsVersion:0};a.addEventListener(`message`,e=>{this.handleWorkerMessage(o,e.data)}),a.addEventListener(`error`,e=>this.handleWorkerError(o,e)),this.workers.push(o),n.push(new Promise((n,a)=>{let s=this.generateRequestId(),c={type:`initialize`,id:s,request:{type:`initialize`,resultFormat:`hast-ops-v1`,id:s,renderOptions:this.renderOptions,preferredHighlighter:this.preferredHighlighter,resolvedThemes:e,resolvedLanguages:t,customExtensionsVersion:i==null?void 0:r,customExtensionMap:i},resolve(){o.initialized=!0,n()},reject:a,requestStart:Date.now()};o.pendingSetupRequestId=s,this.activeTaskById.set(s,c),this.executeTask(o,c)}))}let a=this.options.workerInitializationTimeout??dy,o;try{await Promise.race([Promise.all(n),new Promise((e,t)=>{o=setTimeout(()=>{t(Error(`WorkerPoolManager: worker initialization timed out after ${a}ms`))},a)})])}finally{o!=null&&clearTimeout(o)}}handleWorkerError(e,t){let{onWorkerError:n}=this.options;if(n!=null)try{n(t,e.worker)}catch(e){console.error(`WorkerPoolManager: onWorkerError threw:`,e)}else console.error(`Worker error:`,t,e);let{pendingSetupRequestId:r}=e;if(r==null)return;let i=this.activeTaskById.get(r);if(i?.type!==`initialize`)return;let a=vy(t);n!=null&&sa(a),i.reject(a),this.cleanWorkerAndTask(e,i)}drainQueue=()=>{if(this._queuedDrain=void 0,this.initialized===!0&&this.queuedTasks.length!==0){for(let e=0;e<this.queuedTasks.length;){let t=this.queuedTasks[e];if(this.hasActiveRequest(t)){e++;continue}let n=my(t.request),r=this.getAvailableWorker(n);if(r==null)break;this.queuedTasks.splice(e,1),this.assignWorkerToTask(t,r),this.resolveLanguagesAndExecuteTask(r,t,n)}this.queueBroadcastStateChanges()}};highlightFileAST(e,t){let n=this.getFileResultCache(t);Oi(t)||n!=null&&ri(n.options,this.getFileRenderOptions())||this.hasMatchingFileInstanceTask(e,t)||this.submitTask(e,{type:`file`,file:t})}primeFileHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(Error(`WorkerPoolManager.primeFileHighlightCache: worker pool is not working`));if(!this.shouldPrimeFileHighlightCache(e))return Promise.resolve();if(this.shouldHighlightOnMainThread(e)){let t=this.getFileRenderOptions();return this.primeHighlightCacheOnMainThread(my({type:`file`,file:e}),t.theme,n=>this.setFileResultCache(e.cacheKey,{result:ia(e,n,t),options:t}))}let t=this.getOrCreateFileHighlightCacheTask(e);return t==null?Promise.resolve():this.createRenderTaskCallbacks(t)}shouldPrimeFileHighlightCache(e){if(e.cacheKey==null)return console.warn(`WorkerPoolManager.primeFileHighlightCache: priming highlight cache requires file.cacheKey; skipping "${e.name}".`),!1;let t=this.getFileResultCache(e);return!Oi(e)&&(t==null||!ri(t.options,this.getFileRenderOptions()))}getOrCreateFileHighlightCacheTask(e){let t=this.getFileHighlightKey(e);if(t==null)return;let n=this.getTaskByHighlightKey(t);if(n!=null){if(n.type!==`file`)throw Error(`WorkerPoolManager.getOrCreateFileHighlightCacheTask: Invalid task type`);return n.primeCache=!0,n}{let n=this.submitCacheTask({type:`file`,file:e},t);if(n.type!==`file`)throw Error(`WorkerPoolManager.getOrCreateFileHighlightCacheTask: Invalid task created`);return n}}getPlainFileAST(e,t,n,r){let i=ua({theme:this.renderOptions.theme});if(i==null)this.queueInitialization();else return ia(e,i,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,lines:r})}highlightDiffAST(e,t){let n=this.getDiffResultCache(t);H_(t)||n!=null&&V_(n.options,this.getDiffRenderOptions())||this.hasMatchingDiffInstanceTask(e,t)||this.submitTask(e,{type:`diff`,diff:t})}primeDiffHighlightCache(e){if(!this.isWorkingPool())return Promise.reject(Error(`WorkerPoolManager.primeDiffHighlightCache: worker pool is not working`));if(!this.shouldPrimeDiffHighlightCache(e))return Promise.resolve();if(this.shouldHighlightOnMainThread(e)){let t=this.getDiffRenderOptions();return this.primeHighlightCacheOnMainThread(my({type:`diff`,diff:e}),t.theme,n=>this.setDiffResultCache(e.cacheKey,{result:Gv(e,n,t),options:t}))}let t=this.getOrCreateDiffHighlightCacheTask(e);return t==null?Promise.resolve():this.createRenderTaskCallbacks(t)}shouldPrimeDiffHighlightCache(e){if(e.cacheKey==null)return console.warn(`WorkerPoolManager.primeDiffHighlightCache: priming highlight cache requires diff.cacheKey; skipping "${e.prevName??e.name}" -> "${e.name}".`),!1;let t=this.getDiffResultCache(e);return!H_(e)&&(t==null||!V_(t.options,this.getDiffRenderOptions()))}primeHighlightCacheOnMainThread(e,t,n){function r(){let r=ua({theme:t,langs:e});return r!=null&&n(r)}if(r())return Promise.resolve();let{lifecycleGeneration:i}=this;return this.loadSharedHighlighter(_i(t),[`text`,...e]).then(()=>{if(!this.isCurrentLifecycle(i))throw new na;if(!r())throw new $i})}getOrCreateDiffHighlightCacheTask(e){let t=this.getDiffHighlightKey(e);if(t==null)return;let n=this.getTaskByHighlightKey(t);if(n!=null){if(n.type!==`diff`)throw Error(`WorkerPoolManager.getOrCreateDiffHighlightCacheTask: Invalid task type`);return n.primeCache=!0,n}{let n=this.submitCacheTask({type:`diff`,diff:e},t);if(n.type!==`diff`)throw Error(`WorkerPoolManager.getOrCreateDiffHighlightCacheTask: Invalid task created`);return n}}getPlainDiffAST(e,t,n,r,i){let a=ua({theme:this.renderOptions.theme});if(a==null)this.queueInitialization();else return Gv(e,a,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,expandedHunks:r,collapsedContextThreshold:i})}terminate(){this.lifecycleGeneration++,this.cancelActiveWorkerTasks(),this.terminateWorkers();let e=new na;for(let t of this.queuedTasks)this.rejectRenderTaskCallbacks(t,e);this.fileCache.clear(),this.diffCache.clear(),this.activeRequestByInstance.clear(),this.queuedTasks.length=0,this.queuedTaskByInstance.clear(),this.taskByHighlightKey.clear(),this.activeTaskById.clear(),this.initialized=!1,this.workersFailed=!1,this.terminated=!0,this.queueBroadcastStateChanges()}isCurrentLifecycle(e){return this.lifecycleGeneration===e}queueInitialization(e){this.initialize(e).catch(e=>{ha(e)||console.error(e)})}cancelActiveWorkerTasks(){let e=new na;for(let t of this.activeTaskById.values())`reject`in t?t.reject(e):hy(t)&&this.rejectRenderTaskCallbacks(t,e)}terminateWorkers(){for(let e of this.workers)e.worker.terminate();this.workers.length=0}getStats(){return{managerState:this.initialized===!1?`waiting`:this.initialized===!0?`initialized`:`initializing`,totalWorkers:this.workers.length,workersFailed:this.workersFailed,busyWorkers:this.workers.filter(e=>e.requestId!=null||e.pendingSetupRequestId!=null).length,queuedTasks:this.queuedTasks.length,activeTasks:this.activeTaskById.size,themeSubscribers:this.themeSubscribers.size,fileCacheSize:this.fileCache.size,diffCacheSize:this.diffCache.size}}submitTask(e,t){this.initialized===!1&&this.queueInitialization();let n=this.getHighlightKeyForRequest(t),r=n==null?void 0:this.getTaskByHighlightKey(n);if(r!=null){this.detachInstanceFromQueuedTasks(e,r),this.addInstanceToTask(r,e),this.queueBroadcastStateChanges();return}this.detachInstanceFromQueuedTasks(e);let i=this.generateRequestId(),a=Date.now(),{renderOptionsVersion:o}=this,s=(()=>{switch(t.type){case`file`:return{type:`file`,id:i,request:{...t,id:i},instances:new Set([e]),primeCache:!1,highlightKey:n,callbacks:new Set,renderOptionsVersion:o,requestStart:a};case`diff`:return{type:`diff`,id:i,request:{...t,id:i},instances:new Set([e]),primeCache:!1,highlightKey:n,callbacks:new Set,renderOptionsVersion:o,requestStart:a}}})();this.enqueueRenderTask(s,e)}submitCacheTask(e,t){this.initialized===!1&&this.queueInitialization();let n=this.generateRequestId(),r=Date.now(),{renderOptionsVersion:i}=this,a=(()=>{switch(e.type){case`file`:return{type:`file`,id:n,request:{...e,id:n},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:i,requestStart:r};case`diff`:return{type:`diff`,id:n,request:{...e,id:n},instances:new Set,primeCache:!0,highlightKey:t,callbacks:new Set,renderOptionsVersion:i,requestStart:r}}})();return this.enqueueRenderTask(a),a}enqueueRenderTask(e,t){this.queuedTasks.push(e),t!=null&&this.queuedTaskByInstance.set(t,e),e.highlightKey!=null&&this.taskByHighlightKey.set(e.highlightKey,e),this.queueDrain()}async resolveLanguagesAndExecuteTask(e,t,n){try{let r=ua(),i=n.filter(e=>r==null||!ti(e,r));i.length>0&&this.loadSharedHighlighter(_i(this.renderOptions.theme),[`text`,...i]).catch(e=>{console.error(e)});let a=this.preferredHighlighter===`highlights`?[]:n.filter(t=>!e.langs.has(t));if(a.length>0&&(Zv(a)?t.request.resolvedLanguages=Xv(a):t.request.resolvedLanguages=await Ha(a)),!this.activeTaskById.has(t.id)){e.requestId===t.id&&(this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain());return}this.executeTask(e,t)}catch(n){this.rejectRenderTaskCallbacks(t,_y(n)),this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}}handleWorkerMessage(e,t){let n=this.activeTaskById.get(t.id);try{if(n==null)throw uy;if(t.type===`error`){let e=Error(t.error);if(t.stack&&(e.stack=t.stack),`reject`in n)n.reject(e);else if(hy(n))this.notifyHighlightError(n,e),this.rejectRenderTaskCallbacks(n,e);else throw Error(`handleWorkerMessage: unknown task type`);throw e}if(hy(n))for(let{name:t}of n.request.resolvedLanguages??[])e.langs.add(t);switch(t.requestType){case`initialize`:if(n.type!==`initialize`)throw Error(`handleWorkerMessage: task/response dont match`);this.syncCustomExtensionVersion(e,n.request),n.resolve();break;case`set-render-options`:if(n.type!==`set-render-options`)throw Error(`handleWorkerMessage: task/response dont match`);n.resolve();break;case`file`:{if(n.type!==`file`)throw Error(`handleWorkerMessage: task/response dont match`);let{options:r}=t;if(!this.isCurrentRenderTask(n)||!ri(r,this.getFileRenderOptions()))throw uy;let{request:i}=n,a={...t.result,code:cy(t.result.code)};this.syncCustomExtensionVersion(e,i),n.cacheKeyAtDispatch!=null&&this.fileCache.set(n.cacheKeyAtDispatch,{result:a,options:r}),this.resolveRenderTaskCallbacks(n),this.notifyFileInstances(n,a,r);break}case`diff`:{if(n.type!==`diff`)throw Error(`handleWorkerMessage: task/response dont match`);let{options:r}=t;if(!this.isCurrentRenderTask(n)||!V_(r,this.getDiffRenderOptions()))throw uy;let{request:i}=n,a={...t.result,code:{deletionLines:cy(t.result.code.deletionLines),additionLines:cy(t.result.code.additionLines)}};this.syncCustomExtensionVersion(e,i),n.cacheKeyAtDispatch!=null&&this.diffCache.set(n.cacheKeyAtDispatch,{result:a,options:r}),this.resolveRenderTaskCallbacks(n),this.notifyDiffInstances(n,a,r);break}}}catch(e){e!==uy&&console.error(e,n,t)}this.cleanWorkerAndTask(e,n,t.id),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}_queuedDrain;queueDrain(){this._queuedDrain??(this._queuedDrain=Promise.resolve().then(this.drainQueue),this.queueBroadcastStateChanges())}assignWorkerToTask(e,t){t.requestId=e.id,hy(e)&&(this.clearQueuedInstanceRequests(e),this.trackInstanceRequests(e)),this.activeTaskById.set(e.id,e)}cleanWorkerAndTask(e,t,n=t?.id){e.requestId===n&&(e.requestId=void 0),e.pendingSetupRequestId===n&&(e.pendingSetupRequestId=void 0),t!=null&&(hy(t)&&(this.rejectRenderTaskCallbacks(t,new $i),this.clearInstanceRequests(t),this.clearHighlightKey(t)),this.activeTaskById.delete(t.id))}executeTask(e,t){py(t.request)&&this.maybeAttachCustomExtensions(e,t.request),this.activeTaskById.has(t.id)||this.assignWorkerToTask(t,e);try{t.type===`file`?t.cacheKeyAtDispatch=t.request.file.cacheKey:t.type===`diff`&&(t.cacheKeyAtDispatch=t.request.diff.cacheKey),e.worker.postMessage(t.request)}catch(n){console.error(`Failed to post message to worker:`,n),hy(t)?(this.notifyHighlightError(t,n),this.rejectRenderTaskCallbacks(t,_y(n))):`reject`in t&&t.reject(n),this.cleanWorkerAndTask(e,t),this.queuedTasks.length>0&&this.queueDrain()}this.queueBroadcastStateChanges()}maybeAttachCustomExtensions(e,t){if(t.customExtensionsVersion!=null)return;let n=Aa();e.customExtensionsVersion>=n||(t.customExtensionsVersion=n,t.customExtensionMap=ei())}syncCustomExtensionVersion(e,t){t.customExtensionsVersion!=null&&(e.customExtensionsVersion=t.customExtensionsVersion)}getAvailableWorker(e){let t;for(let n of this.workers){if(n.requestId!=null||n.pendingSetupRequestId!=null||!n.initialized)continue;if(t=n,e.length===0)break;let r=!0;for(let t of e)if(!n.langs.has(t)){r=!1;break}if(r)break}return t}getFileHighlightKey(e){if(e.cacheKey!=null)return`file:${e.cacheKey}:${this.renderOptionsVersion}`}getDiffHighlightKey(e){if(e.cacheKey!=null)return`diff:${e.cacheKey}:${this.renderOptionsVersion}`}getHighlightKeyForRequest(e){switch(e.type){case`file`:return this.getFileHighlightKey(e.file);case`diff`:return this.getDiffHighlightKey(e.diff)}}hasActiveRequest(e){for(let t of gy(e))if(this.activeRequestByInstance.has(t))return!0;return!1}addInstanceToTask(e,t){e.type,e.instances.add(t),this.activeTaskById.has(e.id)?this.activeRequestByInstance.set(t,e.id):this.queuedTaskByInstance.set(t,e)}detachInstanceFromQueuedTasks(e,t){let n=this.queuedTaskByInstance.get(e);n!=null&&n!==t&&(this.queuedTaskByInstance.delete(e),this.detachInstanceFromRenderTask(n,e),!n.primeCache&&n.instances.size===0&&this.removeQueuedTask(n))}detachInstanceFromRenderTask(e,t){e.type,e.instances.delete(t)}removeQueuedTask(e){let t=this.queuedTasks.indexOf(e);t!==-1&&this.queuedTasks.splice(t,1),this.rejectRenderTaskCallbacks(e,new $i),this.clearQueuedInstanceRequests(e),this.clearHighlightKey(e)}removeActiveTask(e){this.rejectRenderTaskCallbacks(e,new $i),this.clearInstanceRequests(e),this.clearHighlightKey(e),this.activeTaskById.delete(e.id)}createRenderTaskCallbacks(e){return new Promise((t,n)=>{e.callbacks.add({resolve:t,reject:n})})}resolveRenderTaskCallbacks(e){for(let t of e.callbacks)t.resolve();e.callbacks.clear()}rejectRenderTaskCallbacks(e,t){for(let n of e.callbacks)n.reject(t);e.callbacks.clear()}invalidateRenderTasks(){for(let e=this.queuedTasks.length-1;e>=0;e--){let t=this.queuedTasks[e];t.renderOptionsVersion!==this.renderOptionsVersion&&this.removeQueuedTask(t)}for(let e of Array.from(this.activeTaskById.values()))hy(e)&&e.renderOptionsVersion!==this.renderOptionsVersion&&this.removeActiveTask(e)}clearQueuedInstanceRequests(e){for(let t of gy(e))this.queuedTaskByInstance.get(t)===e&&this.queuedTaskByInstance.delete(t)}clearHighlightKey(e){e.highlightKey!=null&&this.taskByHighlightKey.get(e.highlightKey)===e&&this.taskByHighlightKey.delete(e.highlightKey)}trackInstanceRequests(e){for(let t of gy(e))this.activeRequestByInstance.set(t,e.id)}clearInstanceRequests(e){for(let t of gy(e))this.activeRequestByInstance.get(t)===e.id&&this.activeRequestByInstance.delete(t)}notifyFileInstances(e,t,n){for(let r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.file,t,n)}notifyDiffInstances(e,t,n){for(let r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.diff,t,n)}notifyHighlightError(e,t){for(let n of gy(e))this.activeRequestByInstance.get(n)===e.id&&n.onHighlightError(t)}hasMatchingFileInstanceTask(e,t){for(let n of this.iterateRenderTasks())if(n.type===`file`&&this.isCurrentRenderTask(n)&&n.instances.has(e)&&B_(t,n.request.file))return!0;return!1}hasMatchingDiffInstanceTask(e,t){for(let n of this.iterateRenderTasks())if(n.type===`diff`&&this.isCurrentRenderTask(n)&&n.instances.has(e)&&z_(n.request.diff,t))return!0;return!1}getTaskByHighlightKey(e){let t=this.taskByHighlightKey.get(e);return t!=null&&this.isCurrentRenderTask(t)?t:void 0}isCurrentRenderTask(e){return e.renderOptionsVersion===this.renderOptionsVersion}*iterateRenderTasks(){for(let e of this.queuedTasks)yield e;for(let e of this.activeTaskById.values())hy(e)&&(yield e)}generateRequestId(){return`req_${++this.nextRequestId}`}};function py(e){return e.type===`initialize`||e.type===`file`||e.type===`diff`}function my(e){let t=new Set;switch(e.type){case`file`:t.add(e.file.lang??Ai(e.file.name));break;case`diff`:t.add(e.diff.lang??Ai(e.diff.name)),t.add(e.diff.lang??Ai(e.diff.prevName??`-`))}return t.delete(`text`),Array.from(t)}function hy(e){return e?.type===`file`||e?.type===`diff`}function gy(e){return e.instances}function _y(e){if(e instanceof Error)return e;if(typeof e==`object`&&e){if(`error`in e&&e.error instanceof Error)return e.error;if(`message`in e&&typeof e.message==`string`)return Error(e.message)}return Error(String(e))}function vy(e){let t=`error`in e?e.error:void 0,n=`message`in e&&typeof e.message==`string`&&e.message!==``?e.message:t instanceof Error?t.message:`the worker script failed to load (the error event carries no message)`;return new xa(`WorkerPoolManager: worker failed: ${n}`,t instanceof Error?{cause:t}:void 0)}var yy;function by({poolOptions:e,highlighterOptions:t}){return yy??=new fy(e,t),yy}function xy(){yy!=null&&(yy.terminate(),yy=void 0)}var Sy=(0,G.createContext)(void 0),Cy=0;function wy({children:e,poolOptions:t,highlighterOptions:n}){let[r]=(0,G.useState)(()=>{if(typeof window<`u`)return by({poolOptions:t,highlighterOptions:n})});return(0,G.useInsertionEffect)(()=>{if(r!=null)return Cy++,()=>{Cy--}},[r]),(0,G.useEffect)(()=>()=>{Cy===0&&xy()},[]),(0,K.jsx)(Sy.Provider,{value:r,children:e})}var Ty=1;function Ey(e,...t){return`ck${Ty}:${JSON.stringify([e,...t])}`}var Dy=new TextEncoder,Oy=new TextDecoder(`utf-8`,{ignoreBOM:!0}),ky=/[\uD800-\uDFFF]/,Ay=1024,jy=new Uint8Array(Ay);function My(){jy.length!==Ay&&(jy=new Uint8Array(Ay))}function Ny(e){if(e.length===0)return e;if(ky.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;jy.length<t&&(jy=new Uint8Array(t));let{written:n}=Dy.encodeInto(e,jy);return Oy.decode(jy.subarray(0,n))}var Py=new TextDecoder(`utf-8`,{ignoreBOM:!0}),Fy={'"':`"`,"\\":`\\`,a:`\x07`,b:`\b`,t:` `,n:`
1291
+ `,v:`\v`,f:`\f`,r:`\r`};function Iy(e){if(e[0]!==`"`)return;let t=``,n=1;for(;n<e.length;){let r=e[n];if(r===`"`)return{fileName:t,rawLength:n+1};if(r!==`\\`){t+=r,n++;continue}let i=Fy[e[n+1]];if(i!=null){t+=i,n+=2;continue}let a=[];do{let t=Ly(e,n+1);if(t==null)return;a.push(t),n+=4}while(e[n]===`\\`&&e[n+1]>=`0`&&e[n+1]<=`7`);t+=Py.decode(new Uint8Array(a))}}function Ly(e,t){let n=e.charCodeAt(t)-48,r=e.charCodeAt(t+1)-48,i=e.charCodeAt(t+2)-48;if(n>=0&&n<=3&&r>=0&&r<=7&&i>=0&&i<=7)return n*64+r*8+i}var Ry=4096,zy=.5;function By(e){for(let t of e.hunks)for(let n=0;n<t.hunkContent.length;n++){let r=t.hunkContent[n];if(r.type!==`change`)continue;let i=Hy(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}}function Vy(e,t,n){let{hunkContent:r}=e;for(let e=1;e<r.length;e++){let i=r[e],a=r[e-1];if(i.type!==`change`||i.additions>0&&i.deletions>0||a.type!==`context`)continue;let o=i.additions>0,s=o?t.additionLines:t.deletionLines,c=o?i.additionLineIndex:i.deletionLineIndex,l=o?i.additions:i.deletions,u=s[c]??``;if(u.trim()!==``)continue;let d=!0;for(let e=1;e<l;e++)if(s[c+e]!==u){d=!1;break}if(!d)continue;let f=0;for(;f<a.lines&&t.additionLines[a.additionLineIndex+a.lines-1-f]===u;)f++;if(f===0||e===1&&f===a.lines||n!=null&&(f=n(i,f),f===0))continue;i.additionLineIndex-=f,i.deletionLineIndex-=f;let p=i.additionLineIndex+i.additions,m=i.deletionLineIndex+i.deletions,h=r[e+1];h?.type===`context`?(h.lines+=f,h.additionLineIndex=p,h.deletionLineIndex=m):r.splice(e+1,0,{type:`context`,lines:f,additionLineIndex:p,deletionLineIndex:m}),a.lines-=f,a.lines===0&&(r.splice(e-1,1),e--)}}function Hy(e,t){let{deletions:n,additions:r,deletionLineIndex:i,additionLineIndex:a}=t,o=Math.min(n,r),s=Math.abs(r-n);if(o===0||s===0||o*(s+1)>Ry)return null;let c=[];for(let t=0;t<n;t++)c.push(Wy(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(Wy(e.additionLines[a+t]??``));let u=r>n,d=0,f=-1;for(let e=0;e<=s;e++){let t=0;for(let n=0;n<o;n++)t+=Gy(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*zy:t>f&&(f=t,d=e)}if(d===0)return null;let p=[],m=(e,t,n,r)=>{(e>0||t>0)&&p.push({type:`change`,deletions:e,additions:t,deletionLineIndex:n,additionLineIndex:r})};return u?(m(0,d,i,a),m(o,o,i,a+d),m(0,r-o-d,i+o,a+d+o)):(m(d,0,i,a),m(o,o,i+d,a),m(n-o-d,0,i+d+o,a+o)),p}var Uy=/\s+/g;function Wy(e){return e.replace(Uy,``)}function Gy(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),r=Math.min(e.length,t.length);if(r===0)return 0;let i=0;for(;i<r&&e[i]===t[i];)i++;let a=0;for(;a<r-i&&e[e.length-1-a]===t[t.length-1-a];)a++;return(i+a)/n}var Ky=/^diff --git ("a\/(?:[^"\\]|\\.)*"|a\/.+?) ("b\/(?:[^"\\]|\\.)*"|b\/.+?)$/;function qy(e,{cacheKeyPrefix:t,disableLineMatching:n,throwOnError:r=!1}={},i){let a=fb(e),o=a?tb(e):nb(e),s=n===!0?`patch-file-raw`:`patch-file`,c,l=[];for(let e of o){if(a&&!wi.test(e)||!a&&!rb(e)){if(c==null)c=Ny(e);else if(r)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}let o=Yy(e,{cacheKey:t==null?void 0:i==null?Ey(s,t,String(l.length)):Ey(s,t,String(i),String(l.length)),isGitDiff:a,disableLineMatching:n,throwOnError:r});o!=null&&l.push(o)}return{patchMetadata:c,files:l}}function Jy(e,t){try{return Yy(e,t)}finally{My()}}function Yy(e,{cacheKey:t,disableLineMatching:n=!1,isGitDiff:r=wi.test(e),oldFile:i,newFile:a,throwOnError:o=!1}={}){let s=0,c=pb(e,`@@ `),l,u=i==null||a==null,d=0,f=0;for(let e of c){let n=eb(e),c=n[0];if(c==null){if(o)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=lb(c),m=0,h=0;if(p==null||l==null){if(l!=null){if(o)throw Error(`parsePatchContent: Invalid hunk`);console.error(`parsePatchContent: Invalid hunk`,e);continue}l={name:``,type:`change`,hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:u,additionLines:!u&&i!=null&&a!=null?$y(a.contents):[],deletionLines:!u&&i!=null&&a!=null?$y(i.contents):[],additionCharacterCount:!u&&i!=null&&a!=null?a.contents.length:0,deletionCharacterCount:!u&&i!=null&&a!=null?i.contents.length:0,cacheKey:hb(t)},l.additionLines.length===1&&a?.contents===``&&(l.additionLines.length=0),l.deletionLines.length===1&&i?.contents===``&&(l.deletionLines.length=0);for(let e of n){if(e.startsWith(`diff --git`)){let t=e.trim().match(Ky);if(t==null){if(o)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}let n=Zy(t[1],!0),r=Zy(t[2],!0);l.name=Ny(r),n!==r&&(l.prevName=Ny(n));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(Hi):null;if(t!=null){let[,e,n]=t,i=Zy(n,r);if(e===`---`&&i!==`/dev/null`){let e=Ny(i);l.prevName=e,l.name=e}else e===`+++`&&i!==`/dev/null`&&(l.name=Ny(i))}else if(r){if(e.startsWith(`new mode `)&&(l.mode=Ny(e.slice(8).trim())),e.startsWith(`old mode `)&&(l.prevMode=Ny(e.slice(8).trim())),e.startsWith(`new file mode`)&&(l.type=`new`,l.mode=Ny(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(l.type=`deleted`,l.mode=Ny(e.slice(17).trim())),e.startsWith(`similarity index`)&&(e.startsWith(`similarity index 100%`)?l.type=`rename-pure`:l.type=`rename-changed`),e.startsWith(`index `)){let[,t,n,r]=e.trim().match(va)??[];t!=null&&(l.prevObjectId=Ny(t)),n!=null&&(l.newObjectId=Ny(n)),r!=null&&(l.mode=Ny(r))}(e.startsWith(`rename from `)||e.startsWith(`copy from `))&&(l.prevName=Ny(Zy(e.slice(e.startsWith(`rename`)?12:10)))),(e.startsWith(`rename to `)||e.startsWith(`copy to `))&&(l.name=Ny(Zy(e.slice(e.startsWith(`rename`)?10:8))))}}continue}let g,_;for(;n.length>0&&(n[n.length-1]===`
1292
1292
  `||n[n.length-1]===`\r`||n[n.length-1]===`\r
1293
- `||n[n.length-1]===``);)n.pop();let{additionStart:v,deletionStart:y}=p;d=u?d:y-1,f=u?f:v-1;let b={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:v,additionLines:m,deletionCount:p.deletionCount,deletionStart:y,deletionLines:h,deletionLineIndex:d,additionLineIndex:f,hunkContent:[],hunkContext:pb(p.hunkContext),hunkSpecs:jy(c),noEOFCRAdditions:!1,noEOFCRDeletions:!1},x=0,S=0;for(let e=1;e<n.length;e++){let t=n[e];if(x>=b.additionCount&&S>=b.deletionCount&&!t.startsWith(`\\`)){if(!ab(t)||ob(t))break;if(o)throw Error(`parsePatchContent: hunk has more lines than expected`)}let r=t[0];if(r!==`+`&&r!==`-`&&r!==` `&&r!==`\\`){if(o)throw Error(`parsePatchContent: invalid hunk line`);console.error(`parseLineType: Invalid firstChar: "${r}", full line: "${t}"`),console.error(`processFile: invalid rawLine:`,t);continue}let i=mb(r);if(i===`addition`){if(o&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=hb(t);(g==null||g.type!==`change`)&&(g=gb(`change`,d,f),b.hunkContent.push(g)),f++,x++,u&&(l.additionLines.push(e),l.additionCharacterCount+=e.length),g.additions++,m++,_=`addition`}else if(i===`deletion`){if(o&&S>=b.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=hb(t);(g==null||g.type!==`change`)&&(g=gb(`change`,d,f),b.hunkContent.push(g)),d++,S++,u&&(l.deletionLines.push(e),l.deletionCharacterCount+=e.length),g.deletions++,h++,_=`deletion`}else if(i===`context`){if(o&&(S>=b.deletionCount||x>=b.additionCount))throw Error(`parsePatchContent: hunk has too many context lines`);let e=hb(t);(g==null||g.type!==`context`)&&(g=gb(`context`,d,f),b.hunkContent.push(g)),f++,d++,x++,S++,u&&(l.deletionLines.push(e),l.additionLines.push(e),l.deletionCharacterCount+=e.length,l.additionCharacterCount+=e.length),g.lines++,_=`context`}else if(i===`metadata`&&g!=null){if(g.type===`context`?(b.noEOFCRAdditions=!0,b.noEOFCRDeletions=!0):_===`deletion`?b.noEOFCRDeletions=!0:_===`addition`&&(b.noEOFCRAdditions=!0),u&&(_===`addition`||_===`context`)){let e=l.additionLines.length-1;if(e>=0){let t=l.additionLines[e],n=sv(t);l.additionLines[e]=n,l.additionCharacterCount+=n.length-t.length}}if(u&&(_===`deletion`||_===`context`)){let e=l.deletionLines.length-1;if(e>=0){let t=l.deletionLines[e],n=sv(t);l.deletionLines[e]=n,l.deletionCharacterCount+=n.length-t.length}}}}if(x!==b.additionCount||S!==b.deletionCount){if(o)throw Error(`parsePatchContent: hunk line count mismatch`);console.error(`parsePatchContent: hunk line count mismatch: "${c.trimEnd()}", declared old/new ${b.deletionCount}/${b.additionCount}, parsed old/new ${S}/${x}`);let e=P_(b.additionStart,b.additionCount)+(x===0?0:1),t=P_(b.deletionStart,b.deletionCount)+(S===0?0:1);if(!u){let n=e-b.additionStart,r=t-b.deletionStart;b.additionLineIndex+=n,b.deletionLineIndex+=r;for(let e of b.hunkContent)e.additionLineIndex+=n,e.deletionLineIndex+=r}b.additionStart=e,b.deletionStart=t,b.additionCount=x,b.deletionCount=S}b.additionLines=m,b.deletionLines=h,b.collapsedBefore=Math.max(P_(b.additionStart,b.additionCount)-s,0),l.hunks.push(b),s=F_(b.additionStart,b.additionCount);for(let e of b.hunkContent)e.type===`context`?(b.splitLineCount+=e.lines,b.unifiedLineCount+=e.lines):(b.splitLineCount+=Math.max(e.additions,e.deletions),b.unifiedLineCount+=e.deletions+e.additions);b.splitLineStart=l.splitLineCount+b.collapsedBefore,b.unifiedLineStart=l.unifiedLineCount+b.collapsedBefore,l.splitLineCount+=b.collapsedBefore+b.splitLineCount,l.unifiedLineCount+=b.collapsedBefore+b.unifiedLineCount}if(l!=null){if(o&&u&&!r&&l.hunks.length===0)throw Error(`parsePatchContent: unified file has no hunks`);if(l.hunks.length>0&&!u&&l.additionLines.length>0&&l.deletionLines.length>0){let e=l.hunks[l.hunks.length-1],t=F_(e.additionStart,e.additionCount),n=l.additionLines.length,r=Math.max(n-t,0);l.splitLineCount+=r,l.unifiedLineCount+=r}return r||(l.prevName!=null&&l.name!==l.prevName?l.hunks.length>0?l.type=`rename-changed`:l.type=`rename-pure`:(i==null||i.contents===``)&&a!=null&&a.contents!==``?l.type=`new`:i!=null&&i.contents!==``&&(a==null||a.contents===``)&&(l.type=`deleted`)),l.type!==`rename-pure`&&l.type!==`rename-changed`&&(l.prevName=void 0),n||Ry(l),l}}function Jy(e,t={}){let{cacheKeyPrefix:n,throwOnError:r=!1}=t,i=[],a=Xy(e)?e.split(mi):[e];for(let e of a)try{i.push(Gy(e,t,n==null?void 0:i.length))}catch(e){if(r)throw e;console.error(e)}finally{Ay()}return i}function Yy(e,t=!1){let n=e.trim(),r=n.startsWith(`"`)?Py(n)?.fileName??n:n;return t&&(r.startsWith(`a/`)||r.startsWith(`b/`))?r.slice(2):r}function Xy(e){return e.startsWith(`From `)||e.includes(`
1294
- From `)}function Zy(e){let t=Qy(e);for(let e=0;e<t.length;e++)t[e]=jy(t[e]);return t}function Qy(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
1295
- `,n);if(r===-1)break;t.push(e.slice(n,r+1)),n=r+1}return n<e.length&&t.push(e.slice(n)),t}function $y(e){return db(e,`diff --git`)}function eb(e){if(e.length===0)return[``];let t=[],n=0,r=0,i=0,a=0,o=!1;for(;r<e.length;){let s=ib(e,r);if(i<=0&&a<=0){if(nb(e,r)){r>n&&t.push(e.slice(n,r)),n=r,o=!0,r=ib(e,s);continue}if(o&&e.startsWith(`@@ -`,r)){let t=sb(e.slice(r,s));t!=null&&(i=t.deletionCount,a=t.additionCount)}r=s;continue}let c=e[r];c===`\\`||(c===` `?(i=Math.max(i-1,0),a=Math.max(a-1,0)):c===`-`?i=Math.max(i-1,0):c===`+`&&(a=Math.max(a-1,0))),r=s}return t.push(e.slice(n)),t}function tb(e){return nb(e,0)}function nb(e,t){let n=ib(e,t);return rb(e,t,`---`)&&rb(e,n,`+++`)}function rb(e,t,n){if(!e.startsWith(n,t))return!1;let r=e[t+n.length];if(r!==` `&&r!==` `)return!1;for(let r=t+n.length+1;r<e.length;r++){let t=e[r];if(t===`
1296
- `||t===`\r`)break;if(t!==` `&&t!==` `)return!0}return!1}function ib(e,t){let n=e.indexOf(`
1297
- `,t);return n===-1?e.length:n+1}function ab(e){let t=e[0];return t===`+`||t===`-`||t===` `}function ob(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
1298
- `&&n!==`\r`)return!1}return!0}function sb(e){if(!e.startsWith(`@@ -`))return;let t=4,n=cb(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=cb(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=cb(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=cb(e,t+1);if(n==null)return;s=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`@`||e[t+2]!==`@`)return;let c,l=t+3;return e[l]===` `&&(c=lb(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function cb(e,t){let n=t,r=0;for(;n<e.length;n++){let t=e.charCodeAt(n)-48;if(t<0||t>9)break;r=r*10+t}if(n!==t)return{value:r,endIndex:n}}function lb(e){return e.endsWith(`\r
1293
+ `||n[n.length-1]===``);)n.pop();let{additionStart:v,deletionStart:y}=p;d=u?d:y-1,f=u?f:v-1;let b={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:v,additionLines:m,deletionCount:p.deletionCount,deletionStart:y,deletionLines:h,deletionLineIndex:d,additionLineIndex:f,hunkContent:[],hunkContext:hb(p.hunkContext),hunkSpecs:Ny(c),noEOFCRAdditions:!1,noEOFCRDeletions:!1},x=0,S=0;for(let e=1;e<n.length;e++){let t=n[e];if(x>=b.additionCount&&S>=b.deletionCount&&!t.startsWith(`\\`)){if(!sb(t)||cb(t))break;if(o)throw Error(`parsePatchContent: hunk has more lines than expected`)}let r=t[0];if(r!==`+`&&r!==`-`&&r!==` `&&r!==`\\`){if(o)throw Error(`parsePatchContent: invalid hunk line`);console.error(`parseLineType: Invalid firstChar: "${r}", full line: "${t}"`),console.error(`processFile: invalid rawLine:`,t);continue}let i=gb(r);if(i===`addition`){if(o&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=_b(t);(g==null||g.type!==`change`)&&(g=vb(`change`,d,f),b.hunkContent.push(g)),f++,x++,u&&(l.additionLines.push(e),l.additionCharacterCount+=e.length),g.additions++,m++,_=`addition`}else if(i===`deletion`){if(o&&S>=b.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=_b(t);(g==null||g.type!==`change`)&&(g=vb(`change`,d,f),b.hunkContent.push(g)),d++,S++,u&&(l.deletionLines.push(e),l.deletionCharacterCount+=e.length),g.deletions++,h++,_=`deletion`}else if(i===`context`){if(o&&(S>=b.deletionCount||x>=b.additionCount))throw Error(`parsePatchContent: hunk has too many context lines`);let e=_b(t);(g==null||g.type!==`context`)&&(g=vb(`context`,d,f),b.hunkContent.push(g)),f++,d++,x++,S++,u&&(l.deletionLines.push(e),l.additionLines.push(e),l.deletionCharacterCount+=e.length,l.additionCharacterCount+=e.length),g.lines++,_=`context`}else if(i===`metadata`&&g!=null){if(g.type===`context`?(b.noEOFCRAdditions=!0,b.noEOFCRDeletions=!0):_===`deletion`?b.noEOFCRDeletions=!0:_===`addition`&&(b.noEOFCRAdditions=!0),u&&(_===`addition`||_===`context`)){let e=l.additionLines.length-1;if(e>=0){let t=l.additionLines[e],n=lv(t);l.additionLines[e]=n,l.additionCharacterCount+=n.length-t.length}}if(u&&(_===`deletion`||_===`context`)){let e=l.deletionLines.length-1;if(e>=0){let t=l.deletionLines[e],n=lv(t);l.deletionLines[e]=n,l.deletionCharacterCount+=n.length-t.length}}}}if(x!==b.additionCount||S!==b.deletionCount){if(o)throw Error(`parsePatchContent: hunk line count mismatch`);console.error(`parsePatchContent: hunk line count mismatch: "${c.trimEnd()}", declared old/new ${b.deletionCount}/${b.additionCount}, parsed old/new ${S}/${x}`);let e=I_(b.additionStart,b.additionCount)+(x===0?0:1),t=I_(b.deletionStart,b.deletionCount)+(S===0?0:1);if(!u){let n=e-b.additionStart,r=t-b.deletionStart;b.additionLineIndex+=n,b.deletionLineIndex+=r;for(let e of b.hunkContent)e.additionLineIndex+=n,e.deletionLineIndex+=r}b.additionStart=e,b.deletionStart=t,b.additionCount=x,b.deletionCount=S}b.additionLines=m,b.deletionLines=h,b.collapsedBefore=Math.max(I_(b.additionStart,b.additionCount)-s,0),l.hunks.push(b),s=L_(b.additionStart,b.additionCount);for(let e of b.hunkContent)e.type===`context`?(b.splitLineCount+=e.lines,b.unifiedLineCount+=e.lines):(b.splitLineCount+=Math.max(e.additions,e.deletions),b.unifiedLineCount+=e.deletions+e.additions);b.splitLineStart=l.splitLineCount+b.collapsedBefore,b.unifiedLineStart=l.unifiedLineCount+b.collapsedBefore,l.splitLineCount+=b.collapsedBefore+b.splitLineCount,l.unifiedLineCount+=b.collapsedBefore+b.unifiedLineCount}if(l!=null){if(o&&u&&!r&&l.hunks.length===0)throw Error(`parsePatchContent: unified file has no hunks`);if(l.hunks.length>0&&!u&&l.additionLines.length>0&&l.deletionLines.length>0){let e=l.hunks[l.hunks.length-1],t=L_(e.additionStart,e.additionCount),n=l.additionLines.length,r=Math.max(n-t,0);l.splitLineCount+=r,l.unifiedLineCount+=r}return r||(l.prevName!=null&&l.name!==l.prevName?l.hunks.length>0?l.type=`rename-changed`:l.type=`rename-pure`:(i==null||i.contents===``)&&a!=null&&a.contents!==``?l.type=`new`:i!=null&&i.contents!==``&&(a==null||a.contents===``)&&(l.type=`deleted`)),l.type!==`rename-pure`&&l.type!==`rename-changed`&&(l.prevName=void 0),n||By(l),l}}function Xy(e,t={}){let{cacheKeyPrefix:n,throwOnError:r=!1}=t,i=[],a=Qy(e)?e.split(mi):[e];for(let e of a)try{i.push(qy(e,t,n==null?void 0:i.length))}catch(e){if(r)throw e;console.error(e)}finally{My()}return i}function Zy(e,t=!1){let n=e.trim(),r=n.startsWith(`"`)?Iy(n)?.fileName??n:n;return t&&(r.startsWith(`a/`)||r.startsWith(`b/`))?r.slice(2):r}function Qy(e){return e.startsWith(`From `)||e.includes(`
1294
+ From `)}function $y(e){let t=eb(e);for(let e=0;e<t.length;e++)t[e]=Ny(t[e]);return t}function eb(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
1295
+ `,n);if(r===-1)break;t.push(e.slice(n,r+1)),n=r+1}return n<e.length&&t.push(e.slice(n)),t}function tb(e){return pb(e,`diff --git`)}function nb(e){if(e.length===0)return[``];let t=[],n=0,r=0,i=0,a=0,o=!1;for(;r<e.length;){let s=ob(e,r);if(i<=0&&a<=0){if(ib(e,r)){r>n&&t.push(e.slice(n,r)),n=r,o=!0,r=ob(e,s);continue}if(o&&e.startsWith(`@@ -`,r)){let t=lb(e.slice(r,s));t!=null&&(i=t.deletionCount,a=t.additionCount)}r=s;continue}let c=e[r];c===`\\`||(c===` `?(i=Math.max(i-1,0),a=Math.max(a-1,0)):c===`-`?i=Math.max(i-1,0):c===`+`&&(a=Math.max(a-1,0))),r=s}return t.push(e.slice(n)),t}function rb(e){return ib(e,0)}function ib(e,t){let n=ob(e,t);return ab(e,t,`---`)&&ab(e,n,`+++`)}function ab(e,t,n){if(!e.startsWith(n,t))return!1;let r=e[t+n.length];if(r!==` `&&r!==` `)return!1;for(let r=t+n.length+1;r<e.length;r++){let t=e[r];if(t===`
1296
+ `||t===`\r`)break;if(t!==` `&&t!==` `)return!0}return!1}function ob(e,t){let n=e.indexOf(`
1297
+ `,t);return n===-1?e.length:n+1}function sb(e){let t=e[0];return t===`+`||t===`-`||t===` `}function cb(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
1298
+ `&&n!==`\r`)return!1}return!0}function lb(e){if(!e.startsWith(`@@ -`))return;let t=4,n=ub(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=ub(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=ub(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=ub(e,t+1);if(n==null)return;s=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`@`||e[t+2]!==`@`)return;let c,l=t+3;return e[l]===` `&&(c=db(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function ub(e,t){let n=t,r=0;for(;n<e.length;n++){let t=e.charCodeAt(n)-48;if(t<0||t>9)break;r=r*10+t}if(n!==t)return{value:r,endIndex:n}}function db(e){return e.endsWith(`\r
1299
1299
  `)?e.slice(0,-2):e.endsWith(`
1300
- `)?e.slice(0,-1):e}function ub(e){return e.startsWith(`diff --git`)||e.includes(`
1301
- diff --git`)}function db(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:fb(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=fb(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function fb(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function pb(e){return e==null?e:jy(e)}function mb(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function hb(e){let t=e.slice(1);return jy(t===``?`
1302
- `:t)}function gb(e,t,n){return e===`change`?{type:`change`,additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:`context`,lines:0,additionLineIndex:n,deletionLineIndex:t}}function _b(e,t){return typeof window>`u`&&t!=null?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,K.jsx)(K.Fragment,{children:e})}var vb=(0,G.createContext)(void 0);function yb(){return(0,G.useContext)(vb)}function bb(){let[e]=(0,G.useState)(()=>{let e=0,t;return{getSnapshot:()=>e,subscribe(e){return t=e,()=>{t=void 0}},forceUpdate(){e++,t?.()}}});return(0,G.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot),e.forceUpdate}function xb(e,t){"use no memo";return e.current?.__getNextRenderData(t)}var Sb=typeof window>`u`?G.useEffect:G.useLayoutEffect;function Cb({file:e,options:t,editorOptions:n,editStateKey:r,lineAnnotations:i,selectedLines:a,prerenderedHTML:o,metrics:s,hasGutterRenderUtility:c,hasCustomHeader:l,disableWorkerPool:u,edit:d,onEditChange:f,onEditComplete:p}){let m=yb(),h=a!==void 0,g=(0,G.useContext)(by),_=A_(),v=O_(e=>f?.(e)),y=f==null?void 0:v,b=(0,G.useRef)(null),x=O_(e=>{let t=p?.(e)??`reject`;return t===`accept`&&(b.current={file:{installed:e.file,stale:e.originalFile},annotations:{installed:e.lineAnnotations,stale:e.originalLineAnnotations}}),t}),S=p==null?void 0:x,C=(0,G.useRef)(null),w=bb(),T=xb(C,wb(b,e,i))??{file:e,lineAnnotations:i??Vi},E=(0,G.useRef)(null),D=O_(()=>{if(_==null)throw Error(`File: EditContext is not attached`);return _(`file`,n??{},r)}),O=O_(n=>{if(n!=null){if(C.current!=null)throw Error(`File: An instance should not already exist when a node is created`);m==null?C.current=new ea(Db({controlledSelection:h,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:y,onEditComplete:S,options:t}),u?void 0:g,w):C.current=new Ea(Db({controlledSelection:h,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:y,onEditComplete:S,options:t}),m,s,u?void 0:g,w),d&&E.current==null&&(E.current=Ob(C.current,D)),C.current.hydrate({file:e,fileContainer:n,lineAnnotations:i,prerenderedHTML:o})}else{if(C.current==null)throw Error(`File: A File instance should exist when unmounting`);C.current.cleanUp(),C.current=null,E.current=null}});Sb(()=>{let{current:n}=C;if(n==null)return;let r=Db({controlledSelection:h,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:y,onEditComplete:S,options:t}),o=!Ca(n.options,r);if(n.setOptions(r),!d&&E.current!=null){let{current:e}=E;E.current=null,e()}let s=Eb(e,i,b);n.render({file:s.file,lineAnnotations:s.lineAnnotations,forceRender:o}),a!==void 0&&n.setSelectedLines(a),d&&E.current==null&&(E.current=Ob(n,D),w())});let k=(0,G.useCallback)(()=>C.current?.getHoveredLine(),[]),A=(0,G.useCallback)(e=>C.current?.getAnnotationSlotName(e)??xi(e),[]);return{...T,ref:O,getHoveredLine:k,getAnnotationSlotName:A}}function wb(e,t,n){"use no memo";return Tb(t,n,e.current)}function Tb(e,t,n){return{file:n?.file!=null&&fi(e,n.file.stale)?n.file.installed:e,lineAnnotations:n?.annotations!=null&&t===n.annotations.stale?n.annotations.installed:t}}function Eb(e,t,n){let{current:r}=n,i=Tb(e,t,r);return r==null||(r.file!=null&&!fi(e,r.file.stale)&&(r.file=null),t!==r.annotations?.stale&&(r.annotations=null),r.file==null&&r.annotations==null&&(n.current=null)),i}function Db({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r,onEditChange:i,onEditComplete:a}){return{...e,controlledSelection:t,renderCustomHeader:n?N_:e?.renderCustomHeader,renderGutterUtility:r?N_:e?.renderGutterUtility,onEditChange:i,onEditComplete:a}}function Ob(e,t){let n=t();try{return n.edit(e)}catch(e){throw n.cleanUp(),e}}function kb({file:e,lineAnnotations:t,selectedLines:n,options:r,editorOptions:i,editStateKey:a,metrics:o,className:s,style:c,renderAnnotation:l,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,prerenderedHTML:m,renderGutterUtility:h,disableWorkerPool:g=!1,edit:_=!1,onEditChange:v,onEditComplete:y}){let{ref:b,getHoveredLine:x,getAnnotationSlotName:S,file:C,lineAnnotations:w}=Cb({file:e,options:r,editorOptions:i,editStateKey:a,metrics:o,lineAnnotations:t,selectedLines:n,prerenderedHTML:m,hasGutterRenderUtility:h!=null,hasCustomHeader:u!=null,disableWorkerPool:g,edit:_,onEditChange:v,onEditComplete:y}),T=I_({file:C,renderAnnotation:l,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,renderGutterUtility:h,lineAnnotations:w,getHoveredLine:x,getAnnotationSlotName:S});return(0,K.jsx)(di,{ref:b,className:s,style:c,children:_b(T,m)})}var Ab={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`};function jb(e){return e.replace(/^\uFEFF/,``).replace(/\r\n?/g,`
1303
- `)}function Mb(e){return e.replace(/[&<>"']/g,e=>Ab[e])}function Nb(e){return Mb(e).replace(/`/g,`&#96;`)}function Pb(e){return/^\s*$/.test(e)}function Fb(e,t){let n=0;for(;n<e.length&&n<t&&e[n]===` `;)n++;return e.slice(n)}function Ib(e){let t=``;for(let n of e)n.type===`text`||n.type===`inlineCode`?t+=n.value:`children`in n?t+=Ib(n.children):n.type===`image`&&(t+=n.alt);return t}function Lb(e=Rb){let t=new Map;return n=>{let r=e(n),i=t.get(r)??1,a=r;for(;t.has(a);)a=`${r}-${++i}`;return t.set(r,i),t.set(a,1),a}}function Rb(e){return e.toLowerCase().normalize(`NFKD`).replace(/[\u0300-\u036f]/g,``).replace(/&[a-z0-9#]+;/gi,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`section`}function zb(e){let t=e.replace(/[\u0000-\u001F\u007F\s]+/g,``);return/^(?!https?:|mailto:|tel:)[a-z][a-z0-9+.-]*:/i.test(t)?``:t}function Bb(e){let t=e.match(/^(?:<([^<>\n]*)>|([^<>\s]*?))(?:\s+(?:"([^"]*)"|'([^']*)'|\(([^)]*)\)))?$/);if(!t)return;let n=t[1]??t[2],r=t[3]??t[4]??t[5];return{href:n.replace(/\\([!-/:-@\[-`{-~])/g,`$1`),...r?{title:r}:{}}}function Vb(e){return e.trim().replace(/\s+/g,` `).toLowerCase()}function Hb(e){return Vb(e).replace(/[^a-z0-9_-]+/g,`-`).replace(/^-+|-+$/g,``)||`footnote`}function Ub(e,t=1){return t>1?`${e}-${t}`:e}function Wb(e,t={}){let n=Jb(e,t);for(let e of t.extensions??[])n=e.transformInline?.(n,{options:t})??n;return n}var Gb=32,Kb=16,qb=/[\\`!\[_*~<]/g;function Jb(e,t,n={scans:Math.max(e.length*Kb,1024),depth:0,links:0}){if(n.depth>=Gb)return e?[{type:`text`,value:e}]:[];n.depth++;let r=[],i=0,a=``,o=()=>{a&&=(r.push({type:`text`,value:a}),``)};for(;i<e.length;){let s=e[i],c=e[i+1];if(s===`\\`){if(c===`
1304
- `){o(),r.push({type:`break`}),i+=2;continue}if(c&&/[!-/:-@\[-`{-~]/.test(c)){a+=c,i+=2;continue}}if(s==="`"){let t=$b(e,i,"`"),s=ex(e,i+t,"`",t,n);if(s!==-1){o(),r.push({type:`inlineCode`,value:e.slice(i+t,s).replace(/\n/g,` `).replace(/^ (?! *$)(.*) $/s,`$1`)}),i=s+t;continue}a+=e.slice(i,i+t),i+=t;continue}if(s===`[`||s===`!`&&c===`[`){let l=s===`!`,u=c===`^`&&Yb(e,i,t,n);if(u){o(),r.push(u.node),n.links++,i=u.end;continue}let d=Xb(e,i+Number(l),t,n);if(d){let e=n.links,s=Jb(d.label,l?t.references?{references:t.references}:{}:t,n),c=!l&&n.links!==e,u=zb(d.href);if(l||!c&&(u||!d.href))o(),r.push({...l?{type:`image`,src:u,alt:Ib(s)}:{type:`link`,href:u,children:s},...d.title?{title:d.title}:{}});else{c&&(a+=`[`);for(let e of s)e.type===`text`?a+=e.value:(o(),r.push(e))}n.links=l?e:n.links+1,i=c?i+d.label.length+1:d.end;continue}}if(s===`*`&&c===`*`&&e[i+2]===`*`){let a=tx(e,i+3,`***`,n);if(a!==-1){o(),r.push({type:`emphasis`,children:Jb(e.slice(i+1,a+2),t,n)}),i=a+3;continue}}if(s===`~`&&c===`~`&&e[i+2]===`~`){let t=$b(e,i,`~`);a+=e.slice(i,i+t),i+=t;continue}if(s===`*`||s===`_`||s===`~`){let l=c===s?2:1,u=s===`_`&&!rx(e,i,l,!0)?-1:tx(e,i+l,s.repeat(l),n);u===-1?(a+=s.repeat(l),i+=l):(o(),r.push({type:s===`~`?`strike`:l===2?`strong`:`emphasis`,children:Jb(e.slice(i+l,u),t,n)}),i=u+l);continue}if(s===`<`&&t.allowHtml){let t=nx(e,i+1,`>`,n);if(t!==-1&&Zb(e.slice(i,t+1))){o(),r.push({type:`inlineHtml`,value:e.slice(i,t+1)}),i=t+1;continue}}qb.lastIndex=i+1;let l=n.scans>0?qb.exec(e)?.index??e.length:e.indexOf(`\\`,i+1);a+=e.slice(i,l<0?e.length:l),i=l<0?e.length:l}return o(),n.depth--,r}function Yb(e,t,n,r){let i=nx(e,t+2,`]`,r);if(i===-1)return;let a=Vb(e.slice(t+2,i)),o=n.footnotes?.[a];if(!o||!n.footnoteOrder)return;let s=n.footnoteOrder.indexOf(a)+1;s||=n.footnoteOrder.push(a);let c=(n.footnoteCounts?.[a]??0)+1;return n.footnoteCounts&&(n.footnoteCounts[a]=c),{node:{type:`footnoteReference`,id:o.id??Hb(o.label),number:s,...c>1?{referenceIndex:c}:{}},end:i+1}}function Xb(e,t,n,r){let i=Qb(e,t,`[`,`]`,r);if(i===-1)return;let a=e.slice(t+1,i),o=i+1,s;if(e[o]===`(`){let t=Qb(e,o,`(`,`)`,r);if(t===-1)return;s=Bb(e.slice(o+1,t).trim()),o=t+1}else if(e[o]===`[`){let t=Qb(e,o,`[`,`]`,r);if(t===-1)return;s=n.references?.[Vb(e.slice(o+1,t)||a)],o=t+1}else s=n.references?.[Vb(a)];if(s)return{...s,label:a,end:o}}function Zb(e){return/^<(?:!--(?:[\s\S]*--|-?)|\?[\s\S]*\?|![A-Z][\s\S]*|!\[CDATA\[[\s\S]*\]\]|\/[A-Za-z][\w:-]*\s*|[A-Za-z][\w:-]*(?:\s+[A-Za-z_:][\w:.-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?)*\s*\/?)>$/.test(e)}function Qb(e,t,n,r,i){if(nx(e,t+1,r,i)===-1)return-1;let a=0;for(let o=t;o<e.length;o++){if(--i.scans<0)return-1;if(e[o]===`\\`)o++;else if(e[o]===n&&a++,e[o]===r&&(a--,a===0))return o}return-1}function $b(e,t,n,r){let i=0;for(;e[t+i]===n&&!(r&&--r.scans<0);)i++;return i}function ex(e,t,n,r,i){let a=t;for(;(a=nx(e,a,n,i))!==-1;){let t=$b(e,a,n,i);if(t===r)return a;a+=t}return-1}function tx(e,t,n,r){if(n===`~`&&/[\s\d]/.test(e[t]??``))return-1;for(let i=t;i<e.length;i++){if(--r.scans<0)return-1;if(e[i]===`\\`)i++;else if(e.startsWith(n,i)){if(n[0]===`~`){if(e[i-1]===`~`||e[i+n.length]===`~`)continue;if(n===`~`&&/\s/.test(e[i-1]??``))return-1}else if(e[i+1]===n){let t=$b(e,i,n,r),a=tx(e,i+t,n.repeat(t),r);if(a>i+t){i=a+t-1;continue}}if(n[0]!==`_`||rx(e,i,n.length,!1))return i}}return-1}function nx(e,t,n,r){if(r.scans<=0)return-1;let i=e.indexOf(n,t);return r.scans-=(i<0?e.length:i+1)-t,r.scans<0?-1:i}function rx(e,t,n,r){let i=e[r?t+n:t-1],a=e[r?t-1:t+n];return i!==void 0&&!/\s/.test(i)&&(a===void 0||/[^\p{L}\p{N}]/u.test(a))}var ix=64;function ax(e,t={}){let n=jb(e),r=t.frontmatter!==!1,i=n.split(`
1300
+ `)?e.slice(0,-1):e}function fb(e){return e.startsWith(`diff --git`)||e.includes(`
1301
+ diff --git`)}function pb(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:mb(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=mb(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function mb(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function hb(e){return e==null?e:Ny(e)}function gb(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function _b(e){let t=e.slice(1);return Ny(t===``?`
1302
+ `:t)}function vb(e,t,n){return e===`change`?{type:`change`,additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:`context`,lines:0,additionLineIndex:n,deletionLineIndex:t}}function yb(e,t){return typeof window>`u`&&t!=null?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,K.jsx)(K.Fragment,{children:e})}var bb=(0,G.createContext)(void 0);function xb(){return(0,G.useContext)(bb)}function Sb(){let[e]=(0,G.useState)(()=>{let e=0,t;return{getSnapshot:()=>e,subscribe(e){return t=e,()=>{t=void 0}},forceUpdate(){e++,t?.()}}});return(0,G.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot),e.forceUpdate}function Cb(e,t){"use no memo";return e.current?.__getNextRenderData(t)}var wb=typeof window>`u`?G.useEffect:G.useLayoutEffect;function Tb({file:e,options:t,editorOptions:n,editStateKey:r,lineAnnotations:i,selectedLines:a,prerenderedHTML:o,metrics:s,hasGutterRenderUtility:c,hasCustomHeader:l,disableWorkerPool:u,edit:d,onEditChange:f,onEditComplete:p}){let m=xb(),h=a!==void 0,g=(0,G.useContext)(Sy),_=M_(),v=A_(e=>f?.(e)),y=f==null?void 0:v,b=(0,G.useRef)(null),x=A_(e=>{let t=p?.(e)??`reject`;return t===`accept`&&(b.current={file:{installed:e.file,stale:e.originalFile},annotations:{installed:e.lineAnnotations,stale:e.originalLineAnnotations}}),t}),S=p==null?void 0:x,C=(0,G.useRef)(null),w=Sb(),T=Cb(C,Eb(b,e,i))??{file:e,lineAnnotations:i??Vi},E=(0,G.useRef)(null),D=A_(()=>{if(_==null)throw Error(`File: EditContext is not attached`);return _(`file`,n??{},r)}),O=A_(n=>{if(n!=null){if(C.current!=null)throw Error(`File: An instance should not already exist when a node is created`);m==null?C.current=new ea(kb({controlledSelection:h,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:y,onEditComplete:S,options:t}),u?void 0:g,w):C.current=new Ea(kb({controlledSelection:h,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:y,onEditComplete:S,options:t}),m,s,u?void 0:g,w),d&&E.current==null&&(E.current=Ab(C.current,D)),C.current.hydrate({file:e,fileContainer:n,lineAnnotations:i,prerenderedHTML:o})}else{if(C.current==null)throw Error(`File: A File instance should exist when unmounting`);C.current.cleanUp(),C.current=null,E.current=null}});wb(()=>{let{current:n}=C;if(n==null)return;let r=kb({controlledSelection:h,hasCustomHeader:l,hasGutterRenderUtility:c,onEditChange:y,onEditComplete:S,options:t}),o=!Ca(n.options,r);if(n.setOptions(r),!d&&E.current!=null){let{current:e}=E;E.current=null,e()}let s=Ob(e,i,b);n.render({file:s.file,lineAnnotations:s.lineAnnotations,forceRender:o}),a!==void 0&&n.setSelectedLines(a),d&&E.current==null&&(E.current=Ab(n,D),w())});let k=(0,G.useCallback)(()=>C.current?.getHoveredLine(),[]),A=(0,G.useCallback)(e=>C.current?.getAnnotationSlotName(e)??xi(e),[]);return{...T,ref:O,getHoveredLine:k,getAnnotationSlotName:A}}function Eb(e,t,n){"use no memo";return Db(t,n,e.current)}function Db(e,t,n){return{file:n?.file!=null&&fi(e,n.file.stale)?n.file.installed:e,lineAnnotations:n?.annotations!=null&&t===n.annotations.stale?n.annotations.installed:t}}function Ob(e,t,n){let{current:r}=n,i=Db(e,t,r);return r==null||(r.file!=null&&!fi(e,r.file.stale)&&(r.file=null),t!==r.annotations?.stale&&(r.annotations=null),r.file==null&&r.annotations==null&&(n.current=null)),i}function kb({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r,onEditChange:i,onEditComplete:a}){return{...e,controlledSelection:t,renderCustomHeader:n?F_:e?.renderCustomHeader,renderGutterUtility:r?F_:e?.renderGutterUtility,onEditChange:i,onEditComplete:a}}function Ab(e,t){let n=t();try{return n.edit(e)}catch(e){throw n.cleanUp(),e}}function jb({file:e,lineAnnotations:t,selectedLines:n,options:r,editorOptions:i,editStateKey:a,metrics:o,className:s,style:c,renderAnnotation:l,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,prerenderedHTML:m,renderGutterUtility:h,disableWorkerPool:g=!1,edit:_=!1,onEditChange:v,onEditComplete:y}){let{ref:b,getHoveredLine:x,getAnnotationSlotName:S,file:C,lineAnnotations:w}=Tb({file:e,options:r,editorOptions:i,editStateKey:a,metrics:o,lineAnnotations:t,selectedLines:n,prerenderedHTML:m,hasGutterRenderUtility:h!=null,hasCustomHeader:u!=null,disableWorkerPool:g,edit:_,onEditChange:v,onEditComplete:y}),T=R_({file:C,renderAnnotation:l,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,renderGutterUtility:h,lineAnnotations:w,getHoveredLine:x,getAnnotationSlotName:S});return(0,K.jsx)(di,{ref:b,className:s,style:c,children:yb(T,m)})}var Mb={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`};function Nb(e){return e.replace(/^\uFEFF/,``).replace(/\r\n?/g,`
1303
+ `)}function Pb(e){return e.replace(/[&<>"']/g,e=>Mb[e])}function Fb(e){return Pb(e).replace(/`/g,`&#96;`)}function Ib(e){return/^\s*$/.test(e)}function Lb(e,t){let n=0;for(;n<e.length&&n<t&&e[n]===` `;)n++;return e.slice(n)}function Rb(e){let t=``;for(let n of e)n.type===`text`||n.type===`inlineCode`?t+=n.value:`children`in n?t+=Rb(n.children):n.type===`image`&&(t+=n.alt);return t}function zb(e=Bb){let t=new Map;return n=>{let r=e(n),i=t.get(r)??1,a=r;for(;t.has(a);)a=`${r}-${++i}`;return t.set(r,i),t.set(a,1),a}}function Bb(e){return e.toLowerCase().normalize(`NFKD`).replace(/[\u0300-\u036f]/g,``).replace(/&[a-z0-9#]+;/gi,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`section`}function Vb(e){let t=e.replace(/[\u0000-\u001F\u007F\s]+/g,``);return/^(?!https?:|mailto:|tel:)[a-z][a-z0-9+.-]*:/i.test(t)?``:t}function Hb(e){let t=e.match(/^(?:<([^<>\n]*)>|([^<>\s]*?))(?:\s+(?:"([^"]*)"|'([^']*)'|\(([^)]*)\)))?$/);if(!t)return;let n=t[1]??t[2],r=t[3]??t[4]??t[5];return{href:n.replace(/\\([!-/:-@\[-`{-~])/g,`$1`),...r?{title:r}:{}}}function Ub(e){return e.trim().replace(/\s+/g,` `).toLowerCase()}function Wb(e){return Ub(e).replace(/[^a-z0-9_-]+/g,`-`).replace(/^-+|-+$/g,``)||`footnote`}function Gb(e,t=1){return t>1?`${e}-${t}`:e}function Kb(e,t={}){let n=Xb(e,t);for(let e of t.extensions??[])n=e.transformInline?.(n,{options:t})??n;return n}var qb=32,Jb=16,Yb=/[\\`!\[_*~<]/g;function Xb(e,t,n={scans:Math.max(e.length*Jb,1024),depth:0,links:0}){if(n.depth>=qb)return e?[{type:`text`,value:e}]:[];n.depth++;let r=[],i=0,a=``,o=()=>{a&&=(r.push({type:`text`,value:a}),``)};for(;i<e.length;){let s=e[i],c=e[i+1];if(s===`\\`){if(c===`
1304
+ `){o(),r.push({type:`break`}),i+=2;continue}if(c&&/[!-/:-@\[-`{-~]/.test(c)){a+=c,i+=2;continue}}if(s==="`"){let t=tx(e,i,"`"),s=nx(e,i+t,"`",t,n);if(s!==-1){o(),r.push({type:`inlineCode`,value:e.slice(i+t,s).replace(/\n/g,` `).replace(/^ (?! *$)(.*) $/s,`$1`)}),i=s+t;continue}a+=e.slice(i,i+t),i+=t;continue}if(s===`[`||s===`!`&&c===`[`){let l=s===`!`,u=c===`^`&&Zb(e,i,t,n);if(u){o(),r.push(u.node),n.links++,i=u.end;continue}let d=Qb(e,i+Number(l),t,n);if(d){let e=n.links,s=Xb(d.label,l?t.references?{references:t.references}:{}:t,n),c=!l&&n.links!==e,u=Vb(d.href);if(l||!c&&(u||!d.href))o(),r.push({...l?{type:`image`,src:u,alt:Rb(s)}:{type:`link`,href:u,children:s},...d.title?{title:d.title}:{}});else{c&&(a+=`[`);for(let e of s)e.type===`text`?a+=e.value:(o(),r.push(e))}n.links=l?e:n.links+1,i=c?i+d.label.length+1:d.end;continue}}if(s===`*`&&c===`*`&&e[i+2]===`*`){let a=rx(e,i+3,`***`,n);if(a!==-1){o(),r.push({type:`emphasis`,children:Xb(e.slice(i+1,a+2),t,n)}),i=a+3;continue}}if(s===`~`&&c===`~`&&e[i+2]===`~`){let t=tx(e,i,`~`);a+=e.slice(i,i+t),i+=t;continue}if(s===`*`||s===`_`||s===`~`){let l=c===s?2:1,u=s===`_`&&!ax(e,i,l,!0)?-1:rx(e,i+l,s.repeat(l),n);u===-1?(a+=s.repeat(l),i+=l):(o(),r.push({type:s===`~`?`strike`:l===2?`strong`:`emphasis`,children:Xb(e.slice(i+l,u),t,n)}),i=u+l);continue}if(s===`<`&&t.allowHtml){let t=ix(e,i+1,`>`,n);if(t!==-1&&$b(e.slice(i,t+1))){o(),r.push({type:`inlineHtml`,value:e.slice(i,t+1)}),i=t+1;continue}}Yb.lastIndex=i+1;let l=n.scans>0?Yb.exec(e)?.index??e.length:e.indexOf(`\\`,i+1);a+=e.slice(i,l<0?e.length:l),i=l<0?e.length:l}return o(),n.depth--,r}function Zb(e,t,n,r){let i=ix(e,t+2,`]`,r);if(i===-1)return;let a=Ub(e.slice(t+2,i)),o=n.footnotes?.[a];if(!o||!n.footnoteOrder)return;let s=n.footnoteOrder.indexOf(a)+1;s||=n.footnoteOrder.push(a);let c=(n.footnoteCounts?.[a]??0)+1;return n.footnoteCounts&&(n.footnoteCounts[a]=c),{node:{type:`footnoteReference`,id:o.id??Wb(o.label),number:s,...c>1?{referenceIndex:c}:{}},end:i+1}}function Qb(e,t,n,r){let i=ex(e,t,`[`,`]`,r);if(i===-1)return;let a=e.slice(t+1,i),o=i+1,s;if(e[o]===`(`){let t=ex(e,o,`(`,`)`,r);if(t===-1)return;s=Hb(e.slice(o+1,t).trim()),o=t+1}else if(e[o]===`[`){let t=ex(e,o,`[`,`]`,r);if(t===-1)return;s=n.references?.[Ub(e.slice(o+1,t)||a)],o=t+1}else s=n.references?.[Ub(a)];if(s)return{...s,label:a,end:o}}function $b(e){return/^<(?:!--(?:[\s\S]*--|-?)|\?[\s\S]*\?|![A-Z][\s\S]*|!\[CDATA\[[\s\S]*\]\]|\/[A-Za-z][\w:-]*\s*|[A-Za-z][\w:-]*(?:\s+[A-Za-z_:][\w:.-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?)*\s*\/?)>$/.test(e)}function ex(e,t,n,r,i){if(ix(e,t+1,r,i)===-1)return-1;let a=0;for(let o=t;o<e.length;o++){if(--i.scans<0)return-1;if(e[o]===`\\`)o++;else if(e[o]===n&&a++,e[o]===r&&(a--,a===0))return o}return-1}function tx(e,t,n,r){let i=0;for(;e[t+i]===n&&!(r&&--r.scans<0);)i++;return i}function nx(e,t,n,r,i){let a=t;for(;(a=ix(e,a,n,i))!==-1;){let t=tx(e,a,n,i);if(t===r)return a;a+=t}return-1}function rx(e,t,n,r){if(n===`~`&&/[\s\d]/.test(e[t]??``))return-1;for(let i=t;i<e.length;i++){if(--r.scans<0)return-1;if(e[i]===`\\`)i++;else if(e.startsWith(n,i)){if(n[0]===`~`){if(e[i-1]===`~`||e[i+n.length]===`~`)continue;if(n===`~`&&/\s/.test(e[i-1]??``))return-1}else if(e[i+1]===n){let t=tx(e,i,n,r),a=rx(e,i+t,n.repeat(t),r);if(a>i+t){i=a+t-1;continue}}if(n[0]!==`_`||ax(e,i,n.length,!1))return i}}return-1}function ix(e,t,n,r){if(r.scans<=0)return-1;let i=e.indexOf(n,t);return r.scans-=(i<0?e.length:i+1)-t,r.scans<0?-1:i}function ax(e,t,n,r){let i=e[r?t+n:t-1],a=e[r?t-1:t+n];return i!==void 0&&!/\s/.test(i)&&(a===void 0||/[^\p{L}\p{N}]/u.test(a))}var ox=64;function sx(e,t={}){let n=Nb(e),r=t.frontmatter!==!1,i=n.split(`
1305
1305
  `),a;if(r&&i[0]===`---`){let e=i.findIndex((e,t)=>t>0&&e===`---`);e>0&&(a=i.slice(1,e).join(`
1306
- `),i=i.slice(e+1))}let o=cx(i);i=o.lines;let s=[],c=Object.create(null),l=Object.keys(o.references).length>0,u=Object.keys(o.footnotes).length>0,d=l||u?{...t,...l?{references:o.references}:{},...u?{footnotes:o.footnotes,footnoteOrder:s,footnoteCounts:c}:{}}:t,f=Lb(),p=new ox(i,d,f).parse();u&&s.length>0&&p.push(lx(o.footnotes,s,d,f));let m=a===void 0?{type:`root`,children:p}:{type:`root`,frontmatter:a,children:p};for(let e of d.extensions??[])m=e.transformDocument?.(m,{options:d})??m;return m}var ox=class e{lines;options;slugger;budget;index=0;loose=!1;constructor(e,t,n,r={depth:0}){this.lines=e,this.options=t,this.slugger=n,this.budget=r}parse(){if(this.budget.depth>=ix){let e=this.lines.slice(this.index).join(`
1307
- `);return this.index=this.lines.length,e?[{type:`paragraph`,children:Wb(e,this.options)}]:[]}this.budget.depth++;let e=[];for(;this.index<this.lines.length;){if(Pb(this.current())){e.length&&(this.loose=!0),this.index++;continue}let t=this.parseExtensionBlock();if(t){e.push(t);continue}let n=this.parseFence()??this.parseHeading()??this.parseThematicBreak()??this.parseBlockquote()??this.parseList()??this.parseTable()??this.parseHtmlBlock()??this.parseParagraph();e.push(n)}return this.budget.depth--,e}parseExtensionBlock(){for(let t of this.options.extensions??[]){let n=0,r=t.parseBlock?.({lines:this.lines,index:this.index,options:this.options,parseInline:e=>Wb(e,this.options),parseBlocks:t=>new e(jb(t).split(`
1308
- `),this.options,this.slugger,this.budget).parse(),consume:e=>{n=e}});if(r)return this.index+=Math.max(n,1),r}}parseFence(){let e=this.current().match(/^( {0,3})(`{3,}|~{3,})(.*)$/);if(!e)return;let t=e[2],n=e[3].trim(),r=[];for(this.index++;this.index<this.lines.length;){let n=this.current();if(n.match(/^ {0,3}(`{3,}|~{3,})\s*$/)?.[1].startsWith(t)){this.index++;break}r.push(Fb(n,e[1].length)),this.index++}return{type:`code`,value:r.join(`
1309
- `),...sx(n)}}parseHeading(){let e=this.current().match(/^ {0,3}(#{1,6})(?:[ \t]+(.*)|[ \t]*)$/);if(!e)return;let t=e[1].length,n=e[2]??``,r=Wb((/^#+[ \t]*$/.test(n)?``:n.replace(/[ \t]+#+[ \t]*$/,``)).trim(),this.options),i=this.createHeadingId(r);return this.index++,i?{type:`heading`,depth:t,id:i,children:r}:{type:`heading`,depth:t,children:r}}parseThematicBreak(){if(/^ {0,3}([-*_])(?:\s*\1){2,}\s*$/.test(this.current()))return this.index++,{type:`thematicBreak`}}parseBlockquote(){if(!/^ {0,3}>\s?/.test(this.current()))return;let t=[];for(;this.index<this.lines.length;){let e=this.current(),n=e.match(/^ {0,3}>\s?(.*)$/);if(!n){if(!Pb(e))break;this.loose=!0}t.push(n?.[1]??``),this.index++}return{type:`blockquote`,children:new e(t,this.options,this.slugger,this.budget).parse()}}parseList(){let t=dx(this.current());if(!t)return;let n=[],r=t.ordered,i=t.indent,a=!1;for(;this.index<this.lines.length;){let r=dx(this.current());if(!r||r.marker!==t.marker||r.indent!==i)break;let o=r.content,s=o.match(/^\[([ xX])\]\s+(.*)$/),c=s?s[1].toLowerCase()===`x`:void 0;s&&(o=s[2]);let l=[o];for(this.index++;this.index<this.lines.length;){let e=this.current(),n=dx(e);if(n&&n.indent===i)break;if(Pb(e)){let e=this.index;for(;e<this.lines.length&&Pb(this.lines[e]);)e++;let n=this.lines[e];if(n===void 0)break;let o=dx(n);if(o?.indent===i){if(o.marker!==t.marker)break;a=!0,this.index=e;break}if(fx(n)<r.contentIndent)break;for(;this.index<e;)l.push(Fb(this.lines[this.index++],r.contentIndent))}else if(fx(e)>=r.contentIndent)l.push(Fb(e,r.contentIndent)),this.index++;else{if(px(e,this.next()))break;l.push(e.trimStart()),this.index++}}let u=new e(l,this.options,this.slugger,this.budget),d=u.parse();a||=u.loose;let f={type:`listItem`,children:d};c!==void 0&&(f.checked=c),n.push(f)}return{type:`list`,ordered:r,...r&&{start:t.number},...a&&{loose:!0},items:n}}parseTable(){let e=this.current(),t=this.next();if(!t||!mx(e,t))return;let n=hx(e),r=hx(t).map(gx),i=n.length,a=[];for(this.index+=2;this.index<this.lines.length;){let e=this.current();if(Pb(e)||px(e,this.next()))break;let t=hx(e);a.push(Array.from({length:i},(e,n)=>_x(t[n]??``,this.options))),this.index++}return{type:`table`,align:r,header:n.map(e=>_x(e,this.options)),rows:a}}parseHtmlBlock(){if(!this.options.allowHtml||!/^ {0,3}<([A-Za-z][\w:-]*|!--|\/[A-Za-z])/.test(this.current()))return;let e=[];if(/^ {0,3}<!--/.test(this.current())){for(;this.index<this.lines.length;){let t=this.current();if(e.push(t),this.index++,t.includes(`-->`))break}return{type:`html`,value:e.join(`
1310
- `)}}for(;this.index<this.lines.length&&!Pb(this.current());)e.push(this.current()),this.index++;return{type:`html`,value:e.join(`
1311
- `)}}parseParagraph(){let e=[];for(;this.index<this.lines.length;){let t=this.current();if(Pb(t)||e.length>0&&px(t,this.next()))break;e.push(t.trim()),this.index++}return{type:`paragraph`,children:Wb(e.join(`
1312
- `),this.options)}}createHeadingId(e){if(this.options.headingIds===!1)return;let t=Ib(e);return typeof this.options.headingIds==`function`?this.options.headingIds(t,this.index):this.slugger(t)}current(){return this.lines[this.index]??``}next(){return this.lines[this.index+1]}};function sx(e){if(!e)return{};let t=e.match(/^([A-Za-z0-9_+.#-]+)/)?.[1],n=t?e.slice(t.length).trim():e,r=n.match(/(?:^|\s)(?:title|file)=(?:"([^"]+)"|'([^']+)'|([^\s}]+))/),i=n.match(/(?:^|\s)framework=(?:"([^"]+)"|'([^']+)'|([^\s}]+))/),a=n.match(/\{([^}]+)\}|(?:^|\s)lines=([^\s]+)/),o=a?ux(a[1]??a[2]):[],s=r?r[1]??r[2]??r[3]:void 0,c=i?i[1]??i[2]??i[3]:void 0;return{...t?{lang:t}:{},...n?{meta:n}:{},...s?{title:s,file:s}:{},...c?{framework:c.toLowerCase()}:{},...o.length?{highlightLines:o}:{}}}function cx(e){let t=Object.create(null),n=Object.create(null),r=Lb(Hb),i=[],a=``,o=0;for(;o<e.length;){let s=e[o],c=s.match(/^ {0,3}(`{3,}|~{3,})(.*)$/);if(c)a?c[1].startsWith(a)&&Pb(c[2])&&(a=``):a=c[1];else if(!a){let i=s.match(/^ {0,3}\[\^([^\]\n]+)\]:[ \t]*(.*)$/);if(i){let t=i[1],a=[i[2]??``];for(o++;o<e.length;){let t=e[o];if(!/^(?: {4,}|\t)/.test(t))break;a.push(t.replace(/^(?: {4}|\t)/,``)),o++}let s=Vb(t);n[s]||(n[s]={label:t,content:a.join(`
1313
- `),id:r(t)});continue}let a=s.match(/^ {0,3}\[([^\]\n]+)\]:[ \t]*(\S.*)$/),c=a&&Bb(a[2].trimEnd());if(c){t[Vb(a[1])]??=c,o++;continue}}i.push(s),o++}return{lines:i,references:t,footnotes:n}}function lx(e,t,n,r){let i=[];for(let a=0;a<t.length;a++){let o=e[t[a]];o&&i.push({id:o.id??Hb(o.label),number:a+1,children:new ox(jb(o.content).split(`
1314
- `),n,r).parse()})}for(let e of i){let r=n.footnoteCounts?.[t[e.number-1]]??1;r>1&&(e.referenceCount=r)}return{type:`footnotes`,items:i}}function ux(e){let t=new Set;for(let n of e.split(`,`)){let e=n.trim().match(/^(\d+)(?:-(\d+))?$/);if(!e)continue;let r=Number(e[1]),i=Number(e[2]??e[1]);if(!(i>2**53-1))for(let e=r;e<=i&&e<r+1e3;e++)t.add(e)}return[...t].sort((e,t)=>e-t)}function dx(e){let t=e.match(/^(\s{0,8})([-+*]|\d{1,9}[.)])(?:([ \t]+)(.*))?$/);if(!t)return;let n=t[2],r=/\d/.test(n[0]);return{ordered:r,...r?{number:Number.parseInt(n,10)}:{},indent:t[1].length,marker:r?n.at(-1):n,contentIndent:t[1].length+n.length+(t[3]?.length??1),content:t[4]??``}}function fx(e){return e.match(/^ */)?.[0].length??0}function px(e,t){let n=dx(e);return/^ {0,3}(?:`{3,}|~{3,}|#{1,6}(?:\s|$)|([-*_])(?:\s*\1){2,}\s*$|>)/.test(e)||n!==void 0&&(!n.ordered||n.number===1)||!!t&&mx(e,t)}function mx(e,t){if(!e.includes(`|`))return!1;let n=hx(t);return n.length===hx(e).length&&n.every(e=>/^:?-+:?$/.test(e.trim()))}function hx(e){let t=e.trim(),n=[],r=``;for(let e=+!!t.startsWith(`|`);e<t.length;e++){let i=t[e];i===`\\`&&t[e+1]===`|`?(r+=`|`,e++):i===`|`?(n.push(r.trim()),r=``):r+=i}return!r&&t.endsWith(`|`)&&n.length||n.push(r.trim()),n}function gx(e){let t=e.trim();if(t.startsWith(`:`)&&t.endsWith(`:`))return`center`;if(t.endsWith(`:`))return`right`;if(t.startsWith(`:`))return`left`}function _x(e,t){return{type:`tableCell`,children:Wb(e,t)}}function vx(e,t={}){return(typeof e==`string`?ax(e,t):e).children.map(e=>yx(e,t)).join(`
1315
- `)}function yx(e,t={}){let n=Ax(e,t);if(n!==void 0)return n;switch(e.type){case`heading`:{let n=e.id?` id="${Nb(e.id)}"`:``,r=e.framework?` data-framework="${Nb(e.framework)}"`:``;return`<h${e.depth}${n}${r}>${xx(e.children,t)}${jx(e.id,t)}</h${e.depth}>`}case`paragraph`:return`<p>${xx(e.children,t)}</p>`;case`code`:return Sx(e,t);case`list`:{let n=e.ordered?`ol`:`ul`;return`<${n}${e.ordered&&e.start!==void 0&&e.start!==1?` start="${e.start}"`:``}>\n${e.items.map(n=>`<li>${Cx(n.children,n.checked,e.loose,t)}</li>`).join(`
1316
- `)}\n</${n}>`}case`blockquote`:return`<blockquote>\n${e.children.map(e=>yx(e,t)).join(`
1317
- `)}\n</blockquote>`;case`table`:return`<table>${`<thead><tr>${e.header.map((n,r)=>kx(`th`,n,e.align[r],t)).join(``)}</tr></thead>`}${e.rows.length?`<tbody>${e.rows.map(n=>`<tr>${n.map((n,r)=>kx(`td`,n,e.align[r],t)).join(``)}</tr>`).join(``)}</tbody>`:``}</table>`;case`footnotes`:return Tx(e.items,t);case`thematicBreak`:return`<hr>`;case`html`:return t.allowHtml?e.value:Mb(e.value);case`callout`:return wx(e,t);case`component`:return Ox(e,t)}}function bx(e,t={}){let n=Ax(e,t);if(n!==void 0)return n;switch(e.type){case`text`:return Mb(e.value);case`inlineCode`:return`<code>${Mb(e.value)}</code>`;case`strong`:return`<strong>${xx(e.children,t)}</strong>`;case`emphasis`:return`<em>${xx(e.children,t)}</em>`;case`strike`:return`<del>${xx(e.children,t)}</del>`;case`footnoteReference`:return`<sup><a id="user-content-fnref-${Nb(Ub(e.id,e.referenceIndex))}" data-footnote-ref="" aria-describedby="footnote-label" href="#user-content-fn-${Nb(e.id)}">${e.number}</a></sup>`;case`link`:return`<a href="${Nb(e.href)}"${e.title?` title="${Nb(e.title)}"`:``}>${xx(e.children,t)}</a>`;case`image`:return`<img src="${Nb(e.src)}" alt="${Nb(e.alt)}"${e.title?` title="${Nb(e.title)}"`:``}>`;case`break`:return`<br>`;case`inlineHtml`:return t.allowHtml?e.value:Mb(e.value)}}function xx(e,t){return e.map(e=>bx(e,t)).join(``)}function Sx(e,t){let n=e.lang??`plaintext`,r=`class="tm-code${t.codeLineNumbers?` tm-code--line-numbers`:``}" data-lang="${Nb(n)}"`+(e.title?` data-code-title="${Nb(e.title)}"`:``)+(e.file?` data-filename="${Nb(e.file)}"`:``)+(e.framework?` data-framework="${Nb(e.framework)}"`:``),i=t.highlighter?.(e.value,n,{...e.highlightLines&&{highlightLines:e.highlightLines},...t.codeLineNumbers!==void 0&&{lineNumbers:t.codeLineNumbers}})??Mb(e.value),a=`<pre ${r}><code class="language-${Nb(n)}">${i}</code></pre>`;return e.title?`<figure class="tm-code-frame" data-lang="${Nb(n)}"><figcaption>${Mb(e.title)}</figcaption>${a}</figure>`:a}function Cx(e,t,n,r){let i=t===void 0?``:`<input type="checkbox" disabled${t?` checked`:``}> `;for(let t=0;t<e.length;t++){let a=e[t];a.type===`paragraph`&&(!n||t===0)?(i+=xx(a.children,r),n&&(i=`<p>${i}</p>`)):i+=(t?`
1318
- `:``)+yx(a,r)}return i}function wx(e,t){let n=e.kind.toLowerCase(),r=e.children.map(e=>yx(e,t)).join(`
1319
- `);return`<div class="markdown-alert markdown-alert-${Nb(n)}"><p class="markdown-alert-title">${Mb(e.title)}</p><div class="markdown-alert-content">${r}</div></div>`}function Tx(e,t){let n=e.map(e=>`<li id="user-content-fn-${Nb(e.id)}">\n${Ex(e,t)}\n</li>`).join(`
1320
- `);return`<section data-footnotes="" class="footnotes"><h2 id="footnote-label" class="sr-only">Footnotes${jx(`footnote-label`,t)}</h2>\n<ol>\n${n}\n</ol>\n</section>`}function Ex(e,t){let n=Dx(e),r=e.children.length-1,i=e.children.map((e,i)=>i===r&&e.type===`paragraph`?`<p>${xx(e.children,t)}${n}</p>`:yx(e,t));return e.children[r]?.type!==`paragraph`&&i.push(`<p>${n.trimStart()}</p>`),i.join(`
1321
- `)}function Dx(e){let t=``;for(let n=1;n<=(e.referenceCount??1);n++){let r=Ub(e.id,n),i=n===1?`${e.number}`:`${e.number}-${n}`;t+=` <a data-footnote-backref="" aria-label="Back to reference ${i}" class="data-footnote-backref" href="#user-content-fnref-${Nb(r)}">&#8617;</a>`}return t}function Ox(e,t){let n=e.tagName??`md-comment-component`;return`<${n}${Mx(e)}>${e.children.map(e=>yx(e,t)).join(`
1322
- `)}</${n}>`}function kx(e,t,n,r){return`<${e}${n?` style="text-align:${n}"`:``}>${xx(t.children,r)}</${e}>`}function Ax(e,t){for(let n of t.extensions??[]){let r=n.renderHtml?.(e,{options:t,renderBlock:e=>yx(e,t),renderInline:e=>bx(e,t)});if(r!==void 0)return r}}function jx(e,t){let n=t.headingAnchors;if(!e||!n)return``;let r=typeof n==`object`?n:{};return`<a href="#${Nb(e)}" aria-hidden="${r.ariaHidden??!0}" class="${Nb(r.className??`anchor-heading anchor-heading-link`)}" tabindex="${r.tabIndex??-1}">${Mb(r.content??`#`)}</a>`}function Mx(e){let t={...e.properties};return e.tagName||(t[`data-component`]=e.name,t[`data-attributes`]||=JSON.stringify(e.attributes)),Object.entries(t).map(([e,t])=>` ${e}="${Nb(t)}"`).join(``)}function Nx(e,t={}){return(typeof e==`string`?ax(e,t):e).children.map((e,n)=>Px(e,t,`b:${n}`))}function Px(e,t={},n){switch(e.type){case`heading`:return $(t,`h${e.depth}`,{key:n,...e.id?{id:e.id}:{},...e.framework?{"data-framework":e.framework}:{}},Ix(e.children,t),Wx(e.id,t));case`paragraph`:return $(t,`p`,{key:n},Ix(e.children,t));case`code`:return Lx(e,t,n);case`list`:return $(t,e.ordered?`ol`:`ul`,{key:n,...e.ordered&&e.start!==void 0&&e.start!==1?{start:e.start}:{}},e.items.map((n,r)=>$(t,`li`,{key:r},Rx(n.children,n.checked,e.loose,t,`${r}`))));case`blockquote`:return $(t,`blockquote`,{key:n},e.children.map((e,r)=>Px(e,t,`${n}:${r}`)));case`table`:return $(t,`table`,{key:n},$(t,`thead`,null,$(t,`tr`,null,e.header.map((n,r)=>zx(`th`,n,e.align[r],t,r)))),e.rows.length?$(t,`tbody`,null,e.rows.map((n,r)=>$(t,`tr`,{key:r},n.map((n,r)=>zx(`td`,n,e.align[r],t,r))))):null);case`footnotes`:return Bx(e.items,t,n);case`thematicBreak`:return $(t,`hr`,{key:n});case`html`:return t.allowHtml?$(t,`div`,{key:n,dangerouslySetInnerHTML:{__html:e.value}}):$(t,`p`,{key:n},e.value);case`callout`:return $(t,`div`,{key:n,className:`markdown-alert markdown-alert-${e.kind.toLowerCase()}`},$(t,`p`,{className:`markdown-alert-title`},e.title),$(t,`div`,{className:`markdown-alert-content`},e.children.map((e,r)=>Px(e,t,`${n}:${r}`))));case`component`:return Ux(e,t,n)}}function Fx(e,t={},n){switch(e.type){case`text`:return e.value;case`inlineCode`:return $(t,`code`,{key:n},e.value);case`strong`:return $(t,`strong`,{key:n},Ix(e.children,t));case`emphasis`:return $(t,`em`,{key:n},Ix(e.children,t));case`strike`:return $(t,`del`,{key:n},Ix(e.children,t));case`footnoteReference`:return $(t,`sup`,{key:n},$(t,`a`,{id:`user-content-fnref-${Ub(e.id,e.referenceIndex)}`,"data-footnote-ref":``,"aria-describedby":`footnote-label`,href:`#user-content-fn-${e.id}`},e.number));case`link`:return $(t,`a`,{key:n,href:e.href,...e.title?{title:e.title}:{}},Ix(e.children,t));case`image`:return $(t,`img`,{key:n,src:e.src,alt:e.alt,...e.title?{title:e.title}:{}});case`break`:return $(t,`br`,{key:n});case`inlineHtml`:return t.allowHtml?$(t,`span`,{key:n,dangerouslySetInnerHTML:{__html:e.value}}):e.value}}function Ix(e,t){return e.map((e,n)=>Fx(e,t,`i:${n}`))}function Lx(e,t,n){let r=e.lang??`plaintext`,i=t.highlighter,a={className:`language-${r}`},o=i?void 0:e.value,s=i?{dangerouslySetInnerHTML:{__html:i(e.value,r,{...e.highlightLines&&{highlightLines:e.highlightLines},...t.codeLineNumbers!==void 0&&{lineNumbers:t.codeLineNumbers}})}}:void 0,c=$(t,`pre`,{className:`tm-code${t.codeLineNumbers?` tm-code--line-numbers`:``}`,"data-lang":r,...e.title?{"data-code-title":e.title}:{},...e.file?{"data-filename":e.file}:{},...e.framework?{"data-framework":e.framework}:{}},$(t,`code`,{...a,...s},o));return e.title?$(t,`figure`,{key:n,className:`tm-code-frame`,"data-lang":r},$(t,`figcaption`,null,e.title),c):$(t,G.Fragment,{key:n},c)}function Rx(e,t,n,r,i){let a=t===void 0?[]:[$(r,`input`,{key:`${i}:checkbox`,type:`checkbox`,disabled:!0,checked:t,readOnly:!0}),` `];for(let t=0;t<e.length;t++){let o=e[t];if(o.type===`paragraph`&&(!n||t===0)){for(let e of Ix(o.children,r))a.push(e);n&&(a=[$(r,`p`,{key:`${i}:paragraph`},a)])}else a.push(Px(o,r,`${i}:${t}`))}return a}function zx(e,t,n,r,i){return $(r,e,{key:i,...n?{style:{textAlign:n}}:{}},Ix(t.children,r))}function Bx(e,t,n){return $(t,`section`,{key:n,"data-footnotes":``,className:`footnotes`},$(t,`h2`,{id:`footnote-label`,className:`sr-only`},`Footnotes`,Wx(`footnote-label`,t)),$(t,`ol`,null,e.map(e=>$(t,`li`,{key:e.id,id:`user-content-fn-${e.id}`},Vx(e,t)))))}function Vx(e,t){let n=e.children.length-1,r=Hx(e,t),i=e.children.map((e,i)=>i===n&&e.type===`paragraph`?$(t,`p`,{key:i},Ix(e.children,t),r):Px(e,t,`${i}`));return e.children[n]?.type!==`paragraph`&&i.push($(t,`p`,{key:`backref-wrapper`},r.slice(1))),i}function Hx(e,t){let n=[];for(let r=1;r<=(e.referenceCount??1);r++){let i=Ub(e.id,r),a=r===1?`${e.number}`:`${e.number}-${r}`;n.push(` `,$(t,`a`,{key:r,"data-footnote-backref":``,"aria-label":`Back to reference ${a}`,className:`data-footnote-backref`,href:`#user-content-fnref-${i}`},`↩`))}return n}function $(e,t,n,...r){let i=typeof t==`string`?e.components?.[t]??t:t;return(0,G.createElement)(i,n,...r)}function Ux(e,t,n){let r=e.tagName??`md-comment-component`,i={...e.properties??{}};return e.tagName||(i[`data-component`]=e.name,i[`data-attributes`]||=JSON.stringify(e.attributes)),$(t,r,{key:n,...i},e.children.map((e,r)=>Px(e,t,`${n}:${r}`)))}function Wx(e,t){if(!e||!t.headingAnchors)return null;let n=typeof t.headingAnchors==`object`?t.headingAnchors:{};return $(t,`a`,{href:`#${e}`,"aria-hidden":n.ariaHidden??!0,className:n.className??`anchor-heading anchor-heading-link`,tabIndex:n.tabIndex??-1},n.content??`#`)}function Gx(e){try{let t=new URL(e);return(t.protocol===`http:`||t.protocol===`https:`||t.protocol===`mailto:`)&&t.username===``&&t.password===``}catch{return!1}}var Kx=Rr.check(s()),qx=Ln.check(Ae()).check(C({minimum:1,maximum:2**53-1}));Dt({reviewId:Kx,environmentId:an,host:an,protocol:bn(dn([`http`,`https`])),revision:bn(qx),decision:bn(Kx)});var Jx=new Set(`details.summary.img.br.p.div.span.strong.b.em.i.del.s.a.ul.ol.li.blockquote.pre.code.h1.h2.h3.h4.h5.h6.table.thead.tbody.tr.th.td.hr.sup.sub.kbd.input`.split(`.`)),Yx=new Set([`script`,`style`,`iframe`,`object`,`embed`,`svg`,`math`,`template`]);function Xx(e,t){let n=new DOMParser().parseFromString(vx(e,{allowHtml:!0}),`text/html`),r=e=>Array.from(e.childNodes,(e,t)=>i(e,t)),i=(e,n)=>{if(e.nodeType===Node.TEXT_NODE){let n=e.textContent??``;return e.parentElement?.tagName===`DETAILS`&&n.trim()?Nx(n,{components:t}):n}if(!(e instanceof Element))return null;let i=e.tagName.toLowerCase();if(Yx.has(i))return null;if(!Jx.has(i))return r(e);let a={key:n};if(i===`input`){if(e.getAttribute(`type`)!==`checkbox`)return null;a.type=`checkbox`,a.disabled=!0,a.checked=e.hasAttribute(`checked`)}i===`ol`&&/^\d+$/.test(e.getAttribute(`start`)??``)&&(a.start=Number(e.getAttribute(`start`)));let o=e.getAttribute(`id`);if(o&&/^[A-Za-z][\w:.-]*$/.test(o)&&(a.id=o),i===`img`&&(a.src=e.getAttribute(`src`)??``,a.alt=e.getAttribute(`alt`)??``),i===`a`){let t=e.getAttribute(`href`)??``;(Gx(t)||/^(?:#[^\s]*|\/(?![/\\])[^\s]*)$/.test(t))&&(a.href=t)}return i===`pre`&&(a[`data-lang`]=e.getAttribute(`data-lang`)??`text`),(0,G.createElement)(t[i]??i,a,...[`img`,`br`,`hr`,`input`].includes(i)?[]:r(e))};return r(n.body)}var Zx={ts:`ts`,typescript:`ts`,tsx:`tsx`,js:`js`,javascript:`js`,jsx:`jsx`,json:`json`,bash:`sh`,sh:`sh`,shell:`sh`,css:`css`,html:`html`,md:`md`,markdown:`md`,yaml:`yaml`,yml:`yaml`,sql:`sql`,diff:`diff`};function Qx(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(Qx).join(``):(0,G.isValidElement)(e)?Qx(e.props.children):``}function $x(e){let t=(0,q.c)(11),{dark:n}=Bi(),r=(e[`data-lang`]??`text`).toLowerCase(),i;if(t[0]!==e.children){let n;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=/\n$/,t[2]=n):n=t[2],i=Qx(G.Children.toArray(e.children)).replace(n,``),t[0]=e.children,t[1]=i}else i=t[1];let a=i,o=`snippet.${Zx[r]??`txt`}`,s;t[3]!==a||t[4]!==o?(s={name:o,contents:a},t[3]=a,t[4]=o,t[5]=s):s=t[5];let c=n?`dark`:`light`,l;t[6]===c?l=t[7]:(l=pa(c,{overflow:`wrap`}),t[6]=c,t[7]=l);let u;return t[8]!==s||t[9]!==l?(u=(0,K.jsx)(`div`,{className:`my-3 overflow-hidden rounded-lg border`,children:(0,K.jsx)(kb,{file:s,options:l})}),t[8]=s,t[9]=l,t[10]=u):u=t[10],u}function eS(e){let t=(0,q.c)(8),{src:n,alt:r}=e,[i,a]=(0,G.useState)();if(!n||!Gx(n)||i===n){let e=r?`: ${r}`:``,n;return t[0]===e?n=t[1]:(n=(0,K.jsxs)(`span`,{className:`inline-block rounded border px-2 py-1 text-caption text-muted-foreground`,children:[`Image unavailable`,e]}),t[0]=e,t[1]=n),n}let o=r??``,s;t[2]===n?s=t[3]:(s=()=>a(n),t[2]=n,t[3]=s);let c;return t[4]!==n||t[5]!==o||t[6]!==s?(c=(0,K.jsx)(`img`,{src:n,alt:o,className:`my-2 h-auto max-w-full rounded`,referrerPolicy:`no-referrer`,onError:s}),t[4]=n,t[5]=o,t[6]=s,t[7]=c):c=t[7],c}var tS={img:eS,details:e=>(0,K.jsx)(`details`,{className:`my-3 rounded border p-3`,...e}),summary:e=>(0,K.jsx)(`summary`,{className:`cursor-pointer font-medium`,...e}),pre:$x,h1:e=>(0,K.jsx)(`h1`,{className:`mt-5 mb-2 text-lg font-semibold first:mt-0`,...e}),h2:e=>(0,K.jsx)(`h2`,{className:`mt-5 mb-2 text-base font-semibold first:mt-0`,...e}),h3:e=>(0,K.jsx)(`h3`,{className:`mt-4 mb-1.5 text-sm font-semibold`,...e}),p:e=>(0,K.jsx)(`p`,{className:`my-2 leading-relaxed`,...e}),ul:e=>(0,K.jsx)(`ul`,{className:`my-2 list-disc pl-5`,...e}),ol:e=>(0,K.jsx)(`ol`,{className:`my-2 list-decimal pl-5`,...e}),li:e=>(0,K.jsx)(`li`,{className:`my-0.5`,...e}),a:e=>(0,K.jsx)(`a`,{className:`text-foreground underline underline-offset-2`,target:`_blank`,rel:`noreferrer`,...e}),code:e=>(0,K.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-[0.9em]`,...e}),blockquote:e=>(0,K.jsx)(`blockquote`,{className:`my-3 border-l-2 pl-3 text-muted-foreground`,...e}),table:e=>(0,K.jsx)(`div`,{className:`my-3 overflow-x-auto rounded-lg border`,children:(0,K.jsx)(`table`,{className:`w-full text-left text-caption`,...e})}),th:e=>(0,K.jsx)(`th`,{className:`border-b bg-muted/60 px-3 py-1.5 font-medium`,...e}),td:e=>(0,K.jsx)(`td`,{className:`border-b px-3 py-1.5 last:border-b-0`,...e}),hr:()=>(0,K.jsx)(`hr`,{className:`my-4`})};function nS(e){let t=(0,q.c)(7),{text:n,className:r}=e,i;t[0]===r?i=t[1]:(i=H(`text-ui text-foreground`,r),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=Xx(n,tS),t[2]=n,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,K.jsx)(`div`,{className:i,children:a}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}var rS=P(e=>m(t=>e.paths.map(n=>t(T({...e,path:n}))))),iS=P(e=>xe((t,n)=>{for(let t of e.paths)n.refresh(T({...e,path:t}));return null}));function aS(e,t,n){let r=(0,q.c)(14),i={connection:e,scope:t,paths:n},a=B(rS(i)),o=p(iS(i)),s;if(r[0]!==n||r[1]!==a){let e;r[3]===a?e=r[4]:(e=(e,t)=>{let n=a[t],r=n?pn(Ht(n)):void 0;return r&&`text`in r?[[e,r.text]]:[]},r[3]=a,r[4]=e),s=new Map(n.flatMap(e)),r[0]=n,r[1]=a,r[2]=s}else s=r[2];let c;r[5]===a?c=r[6]:(c=a.some(sr),r[5]=a,r[6]=c);let l;r[7]===a?l=r[8]:(l=a.some(Wn),r[7]=a,r[8]=l);let u;return r[9]!==o||r[10]!==s||r[11]!==c||r[12]!==l?(u={contents:s,pending:c,failed:l,retry:o},r[9]=o,r[10]=s,r[11]=c,r[12]=l,r[13]=u):u=r[13],u}var oS=(0,G.lazy)(()=>Pa(()=>import(`./file-editor-DGtg0rP2.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])));function sS(e){let t=(0,q.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,K.jsx)(`p`,{role:`status`,className:`p-3.5 text-xs text-muted-foreground`,children:`Loading editor…`}),t[0]=n):n=t[0];let r;return t[1]===e?r=t[2]:(r=(0,K.jsx)(G.Suspense,{fallback:n,children:(0,K.jsx)(oS,{...e})}),t[1]=e,t[2]=r),r}var cS=/url\(\s*(['"]?)([^)'"]+)\1\s*\)|@import\s+(['"])([^'"]+)\3/g,lS=`default-src 'none'; script-src 'unsafe-inline' data:; style-src 'unsafe-inline' data:; img-src data: blob:; font-src data:; connect-src 'none'; form-action 'none'; base-uri 'none'; frame-src 'none'`;function uS(e){let t=window.document.implementation.createHTMLDocument(),n=t.createElement(`meta`);n.httpEquiv=`Content-Security-Policy`,n.content=lS;let r=t.createElement(`style`);r.textContent=`html, body { height: 100%; margin: 0; } iframe { display: block; width: 100%; height: 100%; border: 0; color-scheme: inherit; }`,t.head.replaceChildren(n,r),t.documentElement.style.colorScheme=`light dark`;let i=t.createElement(`iframe`);return i.title=`Preview content`,i.setAttribute(`aria-label`,`Preview content`),i.sandbox.add(`allow-scripts`),i.referrerPolicy=`no-referrer`,i.srcdoc=e,t.body.append(i),`<!doctype html>${t.documentElement.outerHTML}`}var dS=z(`BrowserHtmlPreview.inlineAssets`)(function*(e,t,n){let r=`https://porcelain-preview.invalid/`,i=t.includes(`/`)?`${t.slice(0,t.lastIndexOf(`/`))}/`:``,a=new URL(i,r),o=new Set,s=new Map,c=0;function l(e,t){if(e.startsWith(`data:`)||e.startsWith(`#`))return null;let n=new URL(e,new URL(t,r));if(n.origin!==a.origin)throw Error(`External asset`);if(!n.pathname.startsWith(a.pathname))throw Error(`Outside the document folder`);return{path:decodeURIComponent(n.pathname.slice(1)),hash:n.hash}}function u(e,t){let n=[];for(let r of e.matchAll(cS)){let e=(r[2]??r[4]??``).trim();try{let r=l(e,t);r&&n.push(r.path)}catch{o.add(e)}}return n}function d(e){return new TextDecoder().decode(Uint8Array.from(atob(e.base64),e=>e.charCodeAt(0)))}function f(e,t,n){try{let r=l(e,t);if(r===null)return e;let i=s.get(r.path);if(!i)throw Error(`Unavailable`);if(n.includes(r.path))throw Error(`Circular stylesheet`);let a=(i.mediaType===`text/css`?`data:text/css;charset=utf-8,${encodeURIComponent(p(d(i),r.path,[...n,r.path]))}`:C_(i))+r.hash;if(c+a.length>29360128)throw Error(`Expanded preview too large`);return c+=a.length,a}catch{return o.add(e),`data:,`}}function p(e,t,n=[]){let r=``,i=0;for(let a of e.matchAll(cS)){r+=e.slice(i,a.index);let o=f((a[2]??a[4]??``).trim(),t,n);r+=a[4]?`@import url("${o}")`:`url("${o}")`,i=a.index+a[0].length}return r+e.slice(i)}let m=new DOMParser().parseFromString(e,`text/html`);for(let e of m.querySelectorAll(`base, meta[http-equiv]`))e.remove();let h=[...m.querySelectorAll(`link[href], img[src], script[src], source[src], video[poster], image[href]`)].map(e=>({node:e,attribute:e.hasAttribute(`href`)?`href`:e.hasAttribute(`poster`)?`poster`:`src`})),g=[...m.querySelectorAll(`[srcset]`)],_=[...m.querySelectorAll(`style`),...m.querySelectorAll(`[style]`)],v=[],y=e=>{try{let n=l(e,t);n&&v.push(n.path)}catch{o.add(e)}};for(let{node:e,attribute:t}of h)y(e.getAttribute(t)??``);for(let e of g)for(let t of fS(e.getAttribute(`srcset`)??``))y(t.url);for(let e of _)v.push(...u(e.tagName===`STYLE`?e.textContent??``:e.getAttribute(`style`)??``,t));s=yield*lr(v,n,u);for(let{node:e,attribute:n}of h)e.setAttribute(n,f(e.getAttribute(n)??``,t,[])),e.removeAttribute(`integrity`),e.removeAttribute(`crossorigin`);for(let e of g)e.setAttribute(`srcset`,fS(e.getAttribute(`srcset`)??``).map(e=>`${f(e.url,t,[])}${e.descriptor?` ${e.descriptor}`:``}`).join(`, `));for(let e of m.querySelectorAll(`style`))e.textContent=p(e.textContent??``,t);for(let e of m.querySelectorAll(`[style]`))e.setAttribute(`style`,p(e.getAttribute(`style`)??``,t));let b=m.createElement(`meta`);return b.httpEquiv=`Content-Security-Policy`,b.content=lS,m.head.prepend(b),{html:`<!doctype html>${m.documentElement.outerHTML}`,missing:[...o]}});function fS(e){return[...e.matchAll(/(data:[^\s]+|[^,\s]+)(?:\s+(\d+(?:\.\d+)?[wx]))?\s*,?/g)].map(e=>({url:(e[1]??``).replace(/,$/,``),descriptor:e[2]??``}))}var pS=ir(Nn,{render:(e,t,n)=>dS(e,t,n).pipe(Ve(()=>d(new Sr)))});function mS(e){let t=(0,q.c)(11),{html:n,title:r,className:i}=e,{dark:a}=Bi(),o;t[0]===n?o=t[1]:(o=uS(n),t[0]=n,t[1]=o);let s=a?`dark`:`light`,c;t[2]===s?c=t[3]:(c={colorScheme:s},t[2]=s,t[3]=c);let l;t[4]===i?l=t[5]:(l=H(`block min-h-128 w-full border-0 bg-transparent`,i),t[4]=i,t[5]=l);let u;return t[6]!==o||t[7]!==c||t[8]!==l||t[9]!==r?(u=(0,K.jsx)(`iframe`,{title:r,"aria-label":r,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,srcDoc:o,style:c,className:l}),t[6]=o,t[7]=c,t[8]=l,t[9]=r,t[10]=u):u=t[10],u}function hS(e){let t=(0,q.c)(14),{scope:n,path:r,html:i,connection:a}=e,o=T_(a,n,r,i,pS);if(sr(o)){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,K.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading preview…`}),t[0]=e):e=t[0],e}if(Wn(o)){let e;t[1]===o.cause?e=t[2]:(e=la(xr(o.cause)),t[1]=o.cause,t[2]=e);let n;return t[3]===e?n=t[4]:(n=(0,K.jsx)(`p`,{role:`alert`,className:`p-4`,children:e}),t[3]=e,t[4]=n),n}let s,c;t[5]===o?(s=t[6],c=t[7]):(s=zn(Ht(o)),c=s.missing.length>0&&(0,K.jsxs)(`p`,{role:`status`,className:`px-4 py-2 text-xs text-muted-foreground`,children:[`Some assets could not be loaded: `,s.missing.join(`, `),`. This preview supports local static assets.`]}),t[5]=o,t[6]=s,t[7]=c);let l=`${r} HTML preview`,u;t[8]!==s.html||t[9]!==l?(u=(0,K.jsx)(mS,{html:s.html,title:l,className:`min-h-0 flex-1`}),t[8]=s.html,t[9]=l,t[10]=u):u=t[10];let d;return t[11]!==c||t[12]!==u?(d=(0,K.jsxs)(K.Fragment,{children:[c,u]}),t[11]=c,t[12]=u,t[13]=d):d=t[13],d}function gS(e,t,n){let r=(0,q.c)(4),i;return r[0]!==e||r[1]!==n||r[2]!==t?(i=$e({connection:e,scope:t,path:n}),r[0]=e,r[1]=n,r[2]=t,r[3]=i):i=r[3],ba(i).value}function _S(e,t,n){let r=(0,q.c)(9),i={connection:e,scope:t,paths:n},a=B(Mr(i)),o=p(A(i)),s;if(r[0]!==n||r[1]!==a){let e;r[3]===n?e=r[4]:(e=(e,t)=>{let r=n[t]??``;if(Wn(e))return{path:r,status:`unavailable`};let i=pn(Ht(e));return i?{path:r,status:`loaded`,entries:i.entries}:{path:r,status:`loading`}},r[3]=n,r[4]=e),s=a.map(e),r[0]=n,r[1]=a,r[2]=s}else s=r[2];let c=s,l;return r[5]!==a||r[6]!==o||r[7]!==c?(l={results:a,states:c,retry:o},r[5]=a,r[6]=o,r[7]=c,r[8]=l):l=r[8],l}function vS(e){return kr(`alert-dialog`,e)}var yS=class extends As{};function bS(){return new yS}function xS({...e}){return(0,K.jsx)(vS,{"data-slot":`alert-dialog`,...e})}function SS({...e}){return(0,K.jsx)(E,{"data-slot":`alert-dialog-portal`,...e})}function CS({className:e,...t}){return(0,K.jsx)(o,{"data-slot":`alert-dialog-overlay`,className:H(`fixed inset-0 isolate z-50 bg-black/80 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function wS({className:e,size:t=`default`,...n}){return(0,K.jsxs)(SS,{children:[(0,K.jsx)(CS,{}),(0,K.jsx)(S,{"data-slot":`alert-dialog-content`,"data-size":t,className:H(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-3 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-64 data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...n})]})}function TS({className:e,...t}){return(0,K.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:H(`grid grid-rows-[auto_1fr] place-items-center gap-1 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function ES({className:e,...t}){return(0,K.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:H(`flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function DS({className:e,...t}){return(0,K.jsx)(Ge,{"data-slot":`alert-dialog-title`,className:H(`font-heading text-sm font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function OS({className:e,...t}){return(0,K.jsx)(ke,{"data-slot":`alert-dialog-description`,className:H(`text-xs/relaxed text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function kS({className:e,...t}){return(0,K.jsx)(wn,{"data-slot":`alert-dialog-action`,className:H(e),...t})}function AS({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,K.jsx)(Cn,{"data-slot":`alert-dialog-cancel`,className:H(e),render:(0,K.jsx)(wn,{variant:t,size:n}),...r})}var jS=P(e=>Ot(e,[`branch`,e.base??null],t=>t.changes.readBranchChanges({params:{worktreeId:e.scope.worktreeId},query:{base:e.base}}),t=>t.worktreeId===e.scope.worktreeId)),MS=P(e=>Ot(e,[`branch-bases`],t=>t.changes.listBranchBases({params:{worktreeId:e.scope.worktreeId}}))),NS=P(({connection:e,scope:t,input:n})=>v(e,t,[`change-diffs`,n],at(function*(){let r=yield*(yield*fe(e)).request(e=>e.changes.readChangeDiffs({params:{worktreeId:t.worktreeId},payload:n}));return yield*I(e,r.environmentId===e.environmentId&&r.worktreeId===t.worktreeId&&r.statusToken===n.expectedStatusToken),r}),tr(e),n.expectedFiles.map(e=>e.path))),PS=P(({connection:e,scope:t,input:n})=>v(e,t,[`branch-diffs`,n],at(function*(){return yield*(yield*fe(e)).request(e=>e.changes.readBranchDiffs({params:{worktreeId:t.worktreeId},payload:n}))}),tr(e))),FS=P(({connection:e,scope:t,oid:n,parent:r,paths:i})=>v(e,t,[`commit-diffs`,n,r,i],at(function*(){let a=yield*(yield*fe(e)).request(e=>e.changes.readCommitDiffs({params:{worktreeId:t.worktreeId,oid:n},payload:{...r===1?{}:{parent:r},paths:i.map(e=>[...e])}}));return yield*I(e,a.commitOid===n),a}),tr(e)));function IS(e){return new Map(e.diffs.map(e=>[`selection`in e?ns(e.selection):e.paths.join(`\0`),e.content]))}var LS=P(e=>re(t=>e.map(e=>br(t(e),IS)),t=>{for(let n of e)t(n)})),RS=P(e=>m(t=>he(tt(e,e=>he(t.result(e,{suspendOnWaiting:!0}),IS),{concurrency:`unbounded`}),e=>new Map(e.flatMap(e=>[...e])))).pipe(ee(0)));function zS(e,t){return i(t.map(t=>nt.reviewSurface(e.connection.environmentId,e.scope,[t])))}var BS=P(e=>tr(e.connection).fn(z(`Changes.readCurrent`)(t=>Le(Rn(e),()=>zS(e,[`changes`]))))),VS=P(e=>tr(e.connection).fn(z(`Changes.refreshGitLook`)(t=>Le(Rn(e),()=>zS(e,[`changes`,`git-status`]))))),HS=P(e=>tr(e.connection).fn(z(`Changes.readCurrentGitStatus`)(t=>Le(on(e),()=>zS(e,[`git-status`]))))),US=class e extends Ut()(`@porcelain/client/ChangedDiffRecovery`){static layer=pr(e,at(function*(){let e=yield*gt({attempted:{},pending:{}});return{state:me(e),changes:nr(e),begin:z(`ChangedDiffRecovery.begin`)((t,n)=>ft(e,e=>e.attempted[t]===n?[!1,e]:[!0,{attempted:{...e.attempted,[t]:n},pending:{...e.pending,[t]:n}}])),finish:z(`ChangedDiffRecovery.finish`)((t,n)=>vt(e,e=>{if(e.pending[t]!==n)return e;let r={...e.pending};return delete r[t],{...e,pending:r}}))}}))},WS=P(e=>e.atoms(t=>Vn(US.layer,t(tr(e).layer)))),GS=P(e=>WS(e.connection).fn(z(`Changes.recoverDiffs`)(function*(t,n){let r=yield*US,i=JSON.stringify([e.scope.projectId,e.scope.worktreeId]);if(!(yield*r.begin(i,t)))return;let a=Zn(e);return n.refresh(a),yield*Wr(n.result(a,{suspendOnWaiting:!0}),r.finish(i,t))}),{concurrent:!0})),KS=P(({connection:e,scope:t,statusToken:n})=>WS(e).atom(Bn(he(US,e=>e.changes)).pipe(qt(e=>{let r=JSON.stringify([t.projectId,t.worktreeId]);return{pending:e.pending[r]===n,attempted:e.attempted[r]===n}})))),qS=P(e=>{let{connection:t,scope:n,statusToken:r}=e,i=os(e.expectedFiles,e.selections,200).map(e=>NS({connection:t,scope:n,input:{expectedStatusToken:r,expectedFiles:e.expectedFiles,selections:e.selections}})),a=LS(i),o=RS(i),s=GS({connection:t,scope:n});return re(t=>{t.mount(s);let n=t(a),i=t(KS(e));return It(i)&&!i.value.attempted&&n.some(e=>Wn(e)&&ge(xr(e.cause)))&&t.set(s,r),{result:t(o),recovery:i}},e=>e(a)).pipe(ee(0))}),JS=class e extends Ut()(`@porcelain/client/ReviewedFilesState`){static layer(t,n,r){return pr(e,at(function*(){let e=yield*fe(t),i=yield*gt([]),a=Os(r),o=yield*ne(t,nt.reviewSurface(t.environmentId,n,a),at(function*(){let i=yield*e.request(e=>e.reviewedFiles.listReviewedFiles({params:{worktreeId:n.worktreeId},query:r.kind===`branch`?{scope:`branch`,branch:r.branch}:{}}));return yield*I(t,i.worktreeId===n.worktreeId),i}),Br(),nt.worktreeReads(t,n,a));return{stream:rr(o.stream,nr(i),(e,t)=>br(e,e=>ks(e,t))),confirm:(e,r)=>Yt(a=>at(function*(){yield*a(I(t));let s={id:Symbol(),changes:e,reviewedAt:M(yield*ae)};return yield*vt(i,e=>[...e,s]),yield*a(o.confirm(r.pipe(Le(e=>I(t,e.worktreeId===n.worktreeId))),(e,t)=>kt({worktreeId:t.worktreeId,marks:t.marks}))).pipe(Wr(vt(i,e=>e.filter(e=>e.id!==s.id))))}))}}))}},YS=P(({connection:e,scope:t,range:n})=>e.atoms(r=>Vn(JS.layer(e,t,n),r(tr(e).layer))));function XS(e){return YS({...e,range:Ds(e.range)})}var ZS=P(e=>Ar(e.scope,`reviewed`,JS,XS(e)).pipe(Nr));function QS({range:e=gs,...t}){return ZS({...t,range:Ds(e)})}var $S=P(({connection:e,scope:t,range:n})=>{let r=XS({connection:e,scope:t,range:n}),i={worktreeId:t.worktreeId},a=n.kind===`branch`?{scope:`branch`,branch:n.branch}:{};function o(e,t){return rt(JS,n=>n.confirm(e,t))}let s=z(`Reviews.markFile`)(function*(t){let r=yield*fe(e);return yield*o([t],r.request(e=>n.kind===`branch`?e.reviewedFiles.setReviewedFile({params:i,payload:{...t,reviewed:!0,scope:`branch`,base:n.base}}):e.reviewedFiles.setReviewedFile({params:i,payload:{...t,reviewed:!0}})))}),c=z(`Reviews.unmarkFile`)(function*(t){let n=yield*fe(e);return yield*o([{path:t}],n.request(e=>e.reviewedFiles.removeReviewedFile({params:i,query:{path:t,...a}})))}),l=z(`Reviews.markFiles`)(function*(t){return yield*o(t,(yield*fe(e)).request(e=>n.kind===`branch`?e.reviewedFiles.setReviewedFiles({params:i,payload:{files:t,scope:`branch`,base:n.base}}):e.reviewedFiles.setReviewedFiles({params:i,payload:{files:t}})))}),u=z(`Reviews.unmarkFiles`)(function*(t){let n=yield*fe(e);return yield*o(t.map(e=>({path:e})),n.request(e=>e.reviewedFiles.removeReviewedFiles({params:i,payload:{paths:[...t],...a}})))});return{set:r.fn(s,{concurrent:!0}),remove:r.fn(c,{concurrent:!0}),bulk:r.fn(z(`Reviews.reviewFiles`)(function*(e){if(e.kind===`unmark`){for(let t of vs(e.paths,gn))yield*u(t);return{kind:`unmark`}}let t=bs(e.entries),n=t.report;for(let e of vs(t.files,gn))n=xs(n,yield*l(e));return{kind:`mark`,report:n}}),{concurrent:!0})}});function eC(e,t){if(Wn(e))return xr(e.cause);if(Wn(t))return xr(t.cause)}function tC(e,t){let n=(0,q.c)(3),r;return n[0]!==t||n[1]!==e?(r=Zn({scope:e,connection:t}),n[0]=t,n[1]=e,n[2]=r):r=n[2],ba(r).value}function nC(e,t){let n=(0,q.c)(3),r;return n[0]!==t||n[1]!==e?(r=Zn({scope:e,connection:t}),n[0]=t,n[1]=e,n[2]=r):r=n[2],B(r)}function rC(e,t,n,r,i){let a=(0,q.c)(21),o;a[0]!==t||a[1]!==r||a[2]!==e||a[3]!==i||a[4]!==n?(o=qS({scope:e,connection:t,statusToken:n,expectedFiles:r,selections:i}),a[0]=t,a[1]=r,a[2]=e,a[3]=i,a[4]=n,a[5]=o):o=a[5];let s=o,{result:c,recovery:l}=B(s),u;a[6]===l?u=a[7]:(u=$t(Ht(l),iC),a[6]=l,a[7]=u);let d=u,f;a[8]===c?f=a[9]:(f=It(c)?c.value:new Map,a[8]=c,a[9]=f);let p;a[10]!==d||a[11]!==c?(p=sr(c)||d,a[10]=d,a[11]=c,a[12]=p):p=a[12];let m;a[13]!==d||a[14]!==c?(m=Wn(c)&&!d,a[13]=d,a[14]=c,a[15]=m):m=a[15];let h=Kr(s),g;return a[16]!==f||a[17]!==p||a[18]!==m||a[19]!==h?(g={diffs:f,pending:p,failed:m,retry:h},a[16]=f,a[17]=p,a[18]=m,a[19]=h,a[20]=g):g=a[20],g}function iC(e){return e.pending}var aC=m(Tt());function oC(e,t,n){let r=(0,q.c)(11),i=n===void 0||n,a;r[0]!==t||r[1]!==e?(a=fn({connection:t,scope:e}),r[0]=t,r[1]=e,r[2]=a):a=r[2];let o=a,s=B(i?o:aC),c;r[3]!==t||r[4]!==e?(c=HS({connection:t,scope:e}),r[3]=t,r[4]=e,r[5]=c):c=r[5];let l;r[6]===Symbol.for(`react.memo_cache_sentinel`)?(l={mode:`promise`},r[6]=l):l=r[6];let u=p(c,l),d=Kr(i?o:aC),f;return r[7]!==s||r[8]!==u||r[9]!==d?(f={result:s,read:u,refresh:d},r[7]=s,r[8]=u,r[9]=d,r[10]=f):f=r[10],f}function sC(e,t){if(!$o(t))return null;let n=Zi(t.patch),r=Jy(t.patch,{cacheKeyPrefix:`${rs(e)}:${n}`}).flatMap(e=>e.files),i=r.length===1?r[0]:void 0;return i?{id:rs(e),kind:`diff`,path:ts(e),fileDiff:i,version:n,note:`${e.scope} · ${e.kind}`}:null}function cC(e,t,n){let r=es(t,n);if(!r||n?.kind!==`text`)return null;let i=Zi(n.patch),a=Jy(n.patch,{cacheKeyPrefix:`${e}:${r}:${i}`}).flatMap(e=>e.files),o=a[0];return o?{id:`commit:${e}:${r}`,kind:`diff`,path:r,fileDiff:o,lineCounts:a.flatMap(e=>e.hunks).reduce((e,t)=>({added:e.added+t.additionLines,removed:e.removed+t.deletionLines}),{added:0,removed:0}),version:i,note:t.status}:null}function lC(e,t){let n=(0,q.c)(4),r;n[0]!==t||n[1]!==e?(r=BS({connection:t,scope:e}),n[0]=t,n[1]=e,n[2]=r):r=n[2];let i;return n[3]===Symbol.for(`react.memo_cache_sentinel`)?(i={mode:`promise`},n[3]=i):i=n[3],p(r,i)}function uC(e,t){let n=(0,q.c)(4),r;n[0]!==t||n[1]!==e?(r=VS({connection:t,scope:e}),n[0]=t,n[1]=e,n[2]=r):r=n[2];let i;return n[3]===Symbol.for(`react.memo_cache_sentinel`)?(i={mode:`promise`},n[3]=i):i=n[3],p(r,i)}function dC(e){let t=(0,q.c)(5),n;t[0]===e?n=t[1]:(n=LS(e),t[0]=e,t[1]=n);let r=n,i=B(r),a=Kr(r),o;return t[2]!==i||t[3]!==a?(o={results:i,retry:a},t[2]=i,t[3]=a,t[4]=o):o=t[4],o}function fC(e){let t=(0,q.c)(11),n=dC(e),r;t[0]===n.results?r=t[1]:(r=new Map(n.results.flatMap(pC)),t[0]=n.results,t[1]=r);let i;t[2]===n.results?i=t[3]:(i=n.results.some(sr),t[2]=n.results,t[3]=i);let a;t[4]===n.results?a=t[5]:(a=n.results.some(Wn),t[4]=n.results,t[5]=a);let o;return t[6]!==n.retry||t[7]!==r||t[8]!==i||t[9]!==a?(o={patches:r,pending:i,failed:a,retry:n.retry},t[6]=n.retry,t[7]=r,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}function pC(e){return Pr(Ht(e)).flatMap(mC)}function mC(e){return[...e]}var hC=m(Tt()),gC=m(Tt());function _C(e,t,n){let r=(0,q.c)(7),i;r[0]!==n||r[1]!==t||r[2]!==e?(i=e?jS({connection:t,scope:e,...n===void 0?{}:{base:n}}):gC,r[0]=n,r[1]=t,r[2]=e,r[3]=i):i=r[3];let a=i,o=B(a),s=Kr(a),c;return r[4]!==o||r[5]!==s?(c={result:o,refresh:s},r[4]=o,r[5]=s,r[6]=c):c=r[6],c}function vC(e,t,n){let r=(0,q.c)(7),i;r[0]!==t||r[1]!==n||r[2]!==e?(i=n?MS({connection:t,scope:e}):hC,r[0]=t,r[1]=n,r[2]=e,r[3]=i):i=r[3];let a=i,o=B(a),s=Kr(a),c;return r[4]!==o||r[5]!==s?(c={result:o,refresh:s},r[4]=o,r[5]=s,r[6]=c):c=r[6],c}function yC(e,t,n,r){let i=(0,q.c)(5),a;return i[0]!==t||i[1]!==r||i[2]!==n||i[3]!==e?(a=n?ss(r,25).map(r=>PS({connection:t,scope:e,input:{baseOid:n.baseOid,headOid:n.headOid,paths:r.map(bC)}})):[],i[0]=t,i[1]=r,i[2]=n,i[3]=e,i[4]=a):a=i[4],fC(a)}function bC(e){return[...e]}function xC(e,t,n,r,i){let a=(0,q.c)(11),o;if(a[0]!==e||a[1]!==n||a[2]!==r||a[3]!==i||a[4]!==t){let s;a[6]!==e||a[7]!==n||a[8]!==r||a[9]!==t?(s=i=>FS({connection:e,scope:t,oid:n,parent:r,paths:i}),a[6]=e,a[7]=n,a[8]=r,a[9]=t,a[10]=s):s=a[10],o=ss(i,25).map(s),a[0]=e,a[1]=n,a[2]=r,a[3]=i,a[4]=t,a[5]=o}else o=a[5];return fC(o)}function SC(e,t){let n=(0,q.c)(7),r;n[0]!==e||n[1]!==t?(r=Qe({connection:e,projectId:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2];let i;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(i={mode:`promise`},n[3]=i):i=n[3];let[a,o]=se(r,i),s;return n[4]!==a||n[5]!==o?(s={result:a,submit:o},n[4]=a,n[5]=o,n[6]=s):s=n[6],s}function CC(e,t){let n=(0,q.c)(5),r=SC(e,t),i;n[0]===r?i=n[1]:(i=e=>r.submit({path:ca(e.path),flag:`hidden`,value:e.hidden}),n[0]=r,n[1]=i);let a;return n[2]!==r||n[3]!==i?(a={...r,submit:i},n[2]=r,n[3]=i,n[4]=a):a=n[4],a}function wC(e,t){let n=(0,q.c)(5),r=SC(e,t),i;n[0]===r?i=n[1]:(i=e=>r.submit({path:ca(e.path),flag:`pinned`,value:e.pinned}),n[0]=r,n[1]=i);let a;return n[2]!==r||n[3]!==i?(a={...r,submit:i},n[2]=r,n[3]=i,n[4]=a):a=n[4],a}var TC=m(void 0);function EC(e,t,r,i){let a=(0,q.c)(13),o;a[0]===e?o=a[1]:(o=xt(e),a[0]=e,a[1]=o);let s;a[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={mode:`promiseExit`},a[2]=s):s=a[2];let[c,l]=se(o,s),u=p(TC),d;a[3]!==r||a[4]!==l||a[5]!==c||a[6]!==t||a[7]!==i||a[8]!==u?(d=e=>{if(!c.waiting)return l({path:e,remote:t,complete:()=>{u(void 0),r()},select:e=>n({try:()=>i(e),catch:DC})})},a[3]=r,a[4]=l,a[5]=c,a[6]=t,a[7]=i,a[8]=u,a[9]=d):d=a[9];let f=d,m;return a[10]!==c||a[11]!==f?(m={result:c,submit:f},a[10]=c,a[11]=f,a[12]=m):m=a[12],m}function DC(e){return new Un({message:`Could not open the selected worktree.`,cause:e})}function OC(){let e=(0,q.c)(2),t=p(TC),n;return e[0]===t?n=e[1]:(n=e=>{e||t(void 0)},e[0]=t,e[1]=n),n}var kC=ct(xn.layer).atom(xn),AC=P(e=>e.atoms(xn.layer).fn((t,r)=>at(function*(){let i=yield*(yield*xn).pickProject(e.address);i!==null&&(yield*r.setResult(xt(e),{path:i,remote:null,complete:()=>void 0,select:e=>n({try:()=>t(e),catch:e=>new Un({message:`Could not open the selected worktree.`,cause:e})})}))})));function jC(e,t,n){let r=(0,q.c)(3),i=pn(Ht(B(kC))),a;r[0]===e?a=r[1]:(a=AC(e),r[0]=e,r[1]=a);let o;r[2]===Symbol.for(`react.memo_cache_sentinel`)?(o={mode:`promiseExit`},r[2]=o):o=r[2];let[s,c]=se(a,o);return i?.canPickProject(e.address)&&(()=>{s.waiting||c(t).then(e=>{if(Kn(e)){let t=xr(e.cause);n(t instanceof Error?t:new Un({message:`Could not open the selected worktree.`,cause:t}))}})})}var MC=js(),NC=js(),PC=js(),FC=bS(),IC=bS(),LC=bS(),RC=js();function zC(e,t){let n=(0,q.c)(6),r;n[0]!==e||n[1]!==t?(r=zr({connection:e,projectId:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2];let i=r,a=B(i),o=Kr(i),s;return n[3]!==a||n[4]!==o?(s={result:a,refresh:o},n[3]=a,n[4]=o,n[5]=s):s=n[5],s}function BC(e,t){let n=(0,q.c)(3),r;return n[0]!==e||n[1]!==t?(r=zr({connection:e,projectId:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],ba(r).value}function VC(e,t){let n=(0,q.c)(2),r=BC(e,t),i;return n[0]===r.preferences?i=n[1]:(i=new Set(r.preferences.filter(UC).map(HC)),n[0]=r.preferences,n[1]=i),i}function HC(e){return e.path}function UC(e){return e.hidden}function WC(e,t){let n=(0,q.c)(2),r=BC(e,t),i;return n[0]===r.preferences?i=n[1]:(i=r.preferences.filter(KC).map(GC),n[0]=r.preferences,n[1]=i),i}function GC(e){return e.path}function KC(e){return e.pinned}function qC(e){let t=(0,q.c)(2),n;return t[0]===e?n=t[1]:(n=Gr(e),t[0]=e,t[1]=n),ba(n).value}function JC({...e}){return(0,K.jsx)(g,{"data-slot":`dialog`,...e})}function YC({...e}){return(0,K.jsx)(E,{"data-slot":`dialog-portal`,...e})}function XC({...e}){return(0,K.jsx)(Cn,{"data-slot":`dialog-close`,...e})}function ZC({className:e,...t}){return(0,K.jsx)(o,{"data-slot":`dialog-overlay`,className:H(`fixed inset-0 isolate z-50 bg-black/80 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function QC({className:e,children:t,showCloseButton:n=!0,...r}){return(0,K.jsxs)(YC,{children:[(0,K.jsx)(ZC,{}),(0,K.jsxs)(S,{"data-slot":`dialog-content`,className:H(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-xs/relaxed text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n&&(0,K.jsxs)(Cn,{"data-slot":`dialog-close`,render:(0,K.jsx)(wn,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`}),children:[(0,K.jsx)(un,{}),(0,K.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function $C({className:e,...t}){return(0,K.jsx)(`div`,{"data-slot":`dialog-header`,className:H(`flex flex-col gap-1`,e),...t})}function ew({className:e,showCloseButton:t=!1,children:n,...r}){return(0,K.jsxs)(`div`,{"data-slot":`dialog-footer`,className:H(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,K.jsx)(Cn,{render:(0,K.jsx)(wn,{variant:`outline`}),children:`Close`})]})}function tw({className:e,...t}){return(0,K.jsx)(Ge,{"data-slot":`dialog-title`,className:H(`font-heading text-sm font-medium`,e),...t})}function nw({className:e,...t}){return(0,K.jsx)(ke,{"data-slot":`dialog-description`,className:H(`text-xs/relaxed text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}var rw=G.createContext(void 0);function iw(){let e=G.useContext(rw);if(e===void 0)throw Error(On(53));return e}function aw(e,t,n){if(!e)return 0;let r=getComputedStyle(e),i=`${t}${n===`x`?`Inline`:`Block`}`,a=parseFloat(r[`${i}Start`]);return n===`x`&&t===`margin`?a*2:a+parseFloat(r[`${i}End`])}var ow=`data-has-overflow-x`,sw=`data-has-overflow-y`,cw=`data-overflow-x-start`,lw=`data-overflow-x-end`,uw=`data-overflow-y-start`,dw=`data-overflow-y-end`,fw=e=>t=>t?{[e]:``}:null,pw={hasOverflowX:fw(ow),hasOverflowY:fw(sw),overflowXStart:fw(cw),overflowXEnd:fw(lw),overflowYStart:fw(uw),overflowYEnd:fw(dw),cornerHidden:()=>null},mw=`--scroll-area-corner-height`,hw=`--scroll-area-corner-width`,gw=`data-orientation`,_w={x:0,y:0},vw={width:0,height:0},yw={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},bw={x:!0,y:!0,corner:!0},xw=G.forwardRef(function(e,n){let{render:r,className:i,overflowEdgeThreshold:a,style:o,...s}=e,{xStart:c,xEnd:l,yStart:u,yEnd:d}=Sw(a),f=In(),p=Je(),m=Je(),{nonce:h,disableStyleElements:g}=Ie(),[_,v]=G.useState(!1),[y,b]=G.useState(!1),[x,S]=G.useState(!1),[C,w]=G.useState(!1),[T,E]=G.useState(!1),[D,O]=G.useState(vw),[k,A]=G.useState(vw),[j,M]=G.useState(yw),[N,P]=G.useState(bw),F=G.useRef(null),I=G.useRef(null),L=G.useRef(null),R=G.useRef(null),ee=G.useRef(null),te=G.useRef(null),z=G.useRef(null),ne=G.useRef(null),B=G.useRef(0),re=G.useRef(0),ie=G.useRef(0),V=G.useRef(0),ae=G.useRef(`vertical`),oe=G.useRef(_w),se=G.useRef(null);function ce(e){let t=e?S:b,n=e?p:m;t(!0),n.start(500,()=>{t(!1)})}let le=Ne(e=>{let t=e.x-oe.current.x,n=e.y-oe.current.y;oe.current=e,n!==0&&ce(!0),t!==0&&ce(!1)}),ue=Ne(()=>{let e=I.current;e&&se.current===null&&(se.current=e.style.scrollSnapType,e.style.scrollSnapType=`none`)}),de=Ne(e=>{if(e.button!==0||ne.current!==null&&(ae.current===`vertical`?ee.current:te.current)?.hasPointerCapture(ne.current))return;ne.current=e.pointerId,B.current=e.clientY,re.current=e.clientX,ae.current=e.currentTarget.getAttribute(gw);let t=I.current;t&&(ie.current=t.scrollTop,V.current=t.scrollLeft,ue()),(ae.current===`vertical`?ee.current:te.current)?.setPointerCapture(e.pointerId)}),fe=Ne(e=>{if(e.pointerId!==ne.current)return;ne.current=null,(ae.current===`vertical`?S:b)(!1),se.current!==null&&(I.current&&(I.current.style.scrollSnapType=se.current),se.current=null);let t=ae.current===`vertical`?ee.current:te.current;t?.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId)}),pe=Ne(e=>{if(e.pointerId!==ne.current)return;if(e.buttons%2==0){fe(e);return}let t=I.current;if(!t)return;let n=ae.current===`vertical`,r=n?ee.current:te.current,i=n?L.current:R.current;if(!r||!i)return;let a=n?`y`:`x`,o=aw(i,`padding`,a),s=aw(r,`margin`,a),c=n?r.offsetHeight:r.offsetWidth,l=(n?i.offsetHeight:i.offsetWidth)-c-o-s,u=n?e.clientY-B.current:e.clientX-re.current,d=l<=0?0:u/l,f=n?t.scrollHeight:t.scrollWidth,p=n?t.clientHeight:t.clientWidth,m=(n?ie.current:V.current)+d*(f-p);n?t.scrollTop=m:t.scrollLeft=m,e.preventDefault(),ce(n)});function me(e){w(e.pointerType===`touch`)}function he(e){if(me(e),e.pointerType!==`touch`){let t=Er(F.current,e.target);v(t)}}let ge=G.useMemo(()=>({scrolling:y||x,hasOverflowX:!N.x,hasOverflowY:!N.y,overflowXStart:j.xStart,overflowXEnd:j.xEnd,overflowYStart:j.yStart,overflowYEnd:j.yEnd,cornerHidden:N.corner}),[y,x,N.x,N.y,N.corner,j]),_e={role:`presentation`,onPointerEnter:he,onPointerMove:he,onPointerDown:me,onPointerLeave(){v(!1)},style:{position:`relative`,[mw]:`${D.height}px`,[hw]:`${D.width}px`}},ve=Xt(`div`,e,{state:ge,ref:[n,F],props:[_e,s],stateAttributesMapping:pw}),ye=G.useMemo(()=>({handlePointerDown:de,handlePointerMove:pe,handlePointerUp:fe,handleScroll:le,disableViewportSnap:ue,cornerSize:D,setCornerSize:O,thumbSize:k,setThumbSize:A,hasMeasuredScrollbar:T,setHasMeasuredScrollbar:E,touchModality:C,cornerRef:z,scrollingX:y,scrollingY:x,hovering:_,setHovering:v,viewportRef:I,scrollbarYRef:L,scrollbarXRef:R,thumbYRef:ee,thumbXRef:te,rootId:f,hiddenState:N,setHiddenState:P,overflowEdges:j,setOverflowEdges:M,viewportState:ge,overflowEdgeThreshold:{xStart:c,xEnd:l,yStart:u,yEnd:d}}),[de,pe,fe,le,ue,D,k,T,C,y,x,_,f,N,j,ge,c,l,u,d]);return(0,K.jsxs)(rw.Provider,{value:ye,children:[!g&&t.getElement(h),ve]})});function Sw(e){let t=typeof e==`number`?{xStart:e,xEnd:e,yStart:e,yEnd:e}:e;return{xStart:Math.max(0,t?.xStart||0),xEnd:Math.max(0,t?.xEnd||0),yStart:Math.max(0,t?.yStart||0),yEnd:Math.max(0,t?.yEnd||0)}}var Cw=G.createContext(void 0),ww=`--scroll-area-overflow-x-start`,Tw=`--scroll-area-overflow-x-end`,Ew=`--scroll-area-overflow-y-start`,Dw=`--scroll-area-overflow-y-end`,Ow=`--scroll-area-thumb-height`,kw=`--scroll-area-thumb-width`,Aw=[ww,Tw,Ew,Dw],jw=!1;function Mw(){jw||jt||(typeof CSS<`u`&&`registerProperty`in CSS&&Aw.forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),jw=!0)}var Nw=G.forwardRef(function(e,n){let{render:r,className:i,style:a,...o}=e,{viewportRef:s,scrollbarYRef:c,scrollbarXRef:u,thumbYRef:d,thumbXRef:f,cornerRef:p,cornerSize:m,setCornerSize:h,setThumbSize:g,rootId:_,setHiddenState:v,hiddenState:y,setHasMeasuredScrollbar:b,handleScroll:x,touchModality:S,setHovering:C,setOverflowEdges:w,overflowEdgeThreshold:T,viewportState:E}=iw(),D=De(),O=G.useRef(!0),k=G.useRef([NaN,NaN,NaN,NaN]),A=Je(),j=Je(),M=Ne(()=>{let e=s.current,t=c.current,n=u.current,r=d.current,i=f.current,a=p.current;if(!e)return;let o=e.scrollHeight,l=e.scrollWidth,_=e.clientHeight,y=e.clientWidth,x=e.scrollTop,S=e.scrollLeft,C=k.current,E=Number.isNaN(C[0]);if(C[0]=_,C[1]=o,C[2]=y,C[3]=l,E&&b(!0),o===0||l===0)return;let O=Pw(e),A=O.y,j=O.x,M=y/l,N=_/o,P=Math.max(0,l-y),F=Math.max(0,o-_),I=0,L=0;j||(I=Zt(D===`rtl`?-S:S,P),L=P-I);let R=A?0:Zt(x,F),ee=A?0:F-R,te=j?0:y,z=A?0:_,ne=0,B=0;!j&&!A&&(ne=t?.offsetWidth||0,B=n?.offsetHeight||0);let re=m.width===0&&m.height===0,ie=re?ne:0,V=re?B:0,ae=aw(n,`padding`,`x`),oe=aw(t,`padding`,`y`),se=aw(i,`margin`,`x`),ce=aw(r,`margin`,`y`),le=te-ae-se,ue=z-oe-ce,de=n?Math.min(n.offsetWidth-ie,le):le,fe=t?Math.min(t.offsetHeight-V,ue):ue,pe=Math.max(16,de*M),me=Math.max(16,fe*N);if(g(e=>Fw(e,{width:pe,height:me})),t&&r){let e=Iw(r,Ow,x,F,o,me,t.offsetHeight-me-oe-ce);r.style.transform=`translate3d(0,${e}px,0)`}if(n&&i){let e=n.offsetWidth-pe-ae-se,t=Iw(i,kw,D===`rtl`?-S:S,P,l,pe,e);i.style.transform=`translate3d(${D===`rtl`?-t:t}px,0,0)`}let he=[I,L,R,ee];Aw.forEach((t,n)=>{e.style.setProperty(t,`${he[n]}px`)}),a&&h(e=>Fw(e,{width:ne,height:B})),v(e=>Fw(e,O));let ge={xStart:!j&&I>T.xStart,xEnd:!j&&L>T.xEnd,yStart:!A&&R>T.yStart,yEnd:!A&&ee>T.yEnd};w(e=>Fw(e,ge))});l(()=>{Mw()},[]),l(()=>{queueMicrotask(M)},[M,y,D,T.xStart,T.xEnd,T.yStart,T.yEnd]),l(()=>{s.current?.matches(`:hover`)&&C(!0)},[s,C]),l(()=>{let e=s.current;if(typeof ResizeObserver>`u`||!e)return;let t=!1,n=new ResizeObserver(()=>{if(!t){t=!0;let n=k.current;if(n[0]===e.clientHeight&&n[1]===e.scrollHeight&&n[2]===e.clientWidth&&n[3]===e.scrollWidth)return}M()});return n.observe(e),j.start(0,()=>{let t=e.getAnimations({subtree:!0});t.length!==0&&Promise.allSettled(t.map(e=>e.finished)).then(M).catch(()=>{})}),()=>{n.disconnect(),j.clear()}},[M,s,j]);function N(){O.current=!1}let P={role:`presentation`,..._&&{"data-id":`${_}-viewport`},tabIndex:y.x&&y.y?-1:0,className:t.className,style:{overflow:`scroll`},onScroll(){s.current&&(M(),(S||!O.current)&&x({x:s.current.scrollLeft,y:s.current.scrollTop}),A.start(100,()=>{O.current=!0}))},onWheel:N,onPointerMove:N,onPointerEnter:N,onKeyDown:N},F=Xt(`div`,e,{ref:[n,s],state:E,props:[P,o],stateAttributesMapping:pw}),I=G.useMemo(()=>({computeThumbPosition:M}),[M]);return(0,K.jsx)(Cw.Provider,{value:I,children:F})});function Pw(e){let t=e.clientHeight>=e.scrollHeight,n=e.clientWidth>=e.scrollWidth;return{y:t,x:n,corner:t||n}}function Fw(e,t){for(let n in t)if(e[n]!==t[n])return t;return e}function Iw(e,t,n,r,i,a,o){let s=pt(n,0,r),c=n-s,l=Math.max(16,a*i/(i+Math.abs(c)));return e.style.setProperty(t,c?`${l}px`:``),(r?s/r*o:0)+(c>0?a-l:0)}var Lw=G.createContext(void 0);function Rw(){let e=G.useContext(Lw);if(e===void 0)throw Error(On(54));return e}var zw=G.forwardRef(function(e,t){let{render:n,className:r,orientation:i=`vertical`,keepMounted:a=!1,style:o,...s}=e,{hovering:c,scrollingX:l,scrollingY:u,hiddenState:d,scrollbarYRef:f,scrollbarXRef:p,viewportRef:m,thumbYRef:h,thumbXRef:g,handlePointerDown:_,handlePointerUp:v,handleScroll:y,disableViewportSnap:x,rootId:S,thumbSize:C,hasMeasuredScrollbar:w,viewportState:T}=iw(),E=i===`vertical`,D={...T,hovering:c,scrolling:E?u:l,orientation:i},O=De(),k=!w&&!a,A=E?d.y:d.x,j=a||!A;G.useEffect(()=>{if(!j)return;let e=m.current,t=E?f.current:p.current;if(!t)return;function n(t){if(!e||t.ctrlKey)return;let n=!E,r=n?`scrollLeft`:`scrollTop`,i=n?t.deltaX:t.deltaY;if(i===0)return;let a=n?e.scrollWidth-e.clientWidth:e.scrollHeight-e.clientHeight,o=n&&O===`rtl`?-a:0,s=n&&O===`rtl`?0:a,c=e[r];c<=o&&i<0||c>=s&&i>0||(t.preventDefault(),e[r]=Math.min(s,Math.max(o,c+i)),y({x:e.scrollLeft,y:e.scrollTop}))}return b(t,`wheel`,n,{passive:!1})},[O,y,E,p,f,j,m]);let M={...S&&{"data-id":`${S}-scrollbar`},"aria-hidden":!0,onPointerDown(e){if(e.button!==0)return;let t=Vr(e.nativeEvent),n=E?h.current:g.current;if(n&&Er(n,t))return;let r=m.current;if(!r)return;let i=E?f.current:p.current;if(!n||!i)return;let a=E?`y`:`x`,o=aw(n,`margin`,a),s=aw(i,`padding`,a),c=E?n.offsetHeight:n.offsetWidth,l=i.getBoundingClientRect(),u=E?e.clientY-l.top-c/2-s+o/2:e.clientX-l.left-c/2-s+o/2,d=E?r.scrollHeight:r.scrollWidth,v=E?r.clientHeight:r.clientWidth,b=(E?i.offsetHeight:i.offsetWidth)-c-s-o;if(b<=0)return;let S=u/b,C=d-v;x(),E?r.scrollTop=S*C:r.scrollLeft=O===`rtl`?-(1-S)*C:S*C,y({x:r.scrollLeft,y:r.scrollTop}),_(e)},onMouseDown(e){e.preventDefault()},onPointerUp:v,onPointerCancel:v,style:{position:`absolute`,touchAction:`none`,WebkitUserSelect:`none`,userSelect:`none`,visibility:k?`hidden`:void 0,...E?{top:0,bottom:`var(${mw})`,insetInlineEnd:0,[Ow]:`${C.height}px`}:{insetInlineStart:0,insetInlineEnd:`var(${hw})`,bottom:0,[kw]:`${C.width}px`}}},N=Xt(`div`,e,{ref:[t,E?f:p],state:D,props:[M,s],stateAttributesMapping:pw});return j?(0,K.jsx)(Lw.Provider,{value:i,children:N}):null}),Bw=G.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{thumbYRef:o,thumbXRef:s,handlePointerDown:c,handlePointerMove:l,handlePointerUp:u,scrollingX:d,scrollingY:f,hasMeasuredScrollbar:p}=iw(),m=Rw(),h=m===`vertical`;return Xt(`div`,e,{ref:[t,h?o:s],state:{scrolling:h?f:d,orientation:m},props:[{onPointerDown:c,onPointerMove:l,onPointerUp:u,onPointerCancel:u,style:{visibility:p?void 0:`hidden`,...h?{height:`var(--scroll-area-thumb-height)`}:{width:`var(--scroll-area-thumb-width)`}}},a]})}),Vw=G.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{cornerRef:o,cornerSize:s,hiddenState:c}=iw(),l=Xt(`div`,e,{ref:[t,o],props:[{"aria-hidden":!0,style:{position:`absolute`,bottom:0,insetInlineEnd:0,width:s.width,height:s.height}},a]});return c.corner?null:l});function Hw({className:e,children:t,...n}){return(0,K.jsxs)(xw,{"data-slot":`scroll-area`,className:H(`relative`,e),...n,children:[(0,K.jsx)(Nw,{"data-slot":`scroll-area-viewport`,className:`size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1`,children:t}),(0,K.jsx)(Uw,{}),(0,K.jsx)(Vw,{})]})}function Uw({className:e,orientation:t=`vertical`,...n}){return(0,K.jsx)(zw,{"data-slot":`scroll-area-scrollbar`,"data-orientation":t,orientation:t,className:H(`flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent`,e),...n,children:(0,K.jsx)(Bw,{"data-slot":`scroll-area-thumb`,className:`relative flex-1 rounded-full bg-border`})})}function Ww({className:e,...t}){return(0,K.jsx)(`nav`,{"aria-label":`breadcrumb`,"data-slot":`breadcrumb`,className:H(e),...t})}function Gw({className:e,...t}){return(0,K.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:H(`flex flex-wrap items-center gap-1.5 text-xs/relaxed wrap-break-word text-muted-foreground`,e),...t})}function Kw({className:e,...t}){return(0,K.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:H(`inline-flex items-center gap-1`,e),...t})}function qw({className:e,render:t,...n}){return Lt({defaultTagName:`a`,props:hr({className:H(`transition-colors hover:text-foreground`,e)},n),render:t,state:{slot:`breadcrumb-link`}})}function Jw({className:e,...t}){return(0,K.jsx)(`span`,{"data-slot":`breadcrumb-page`,role:`link`,"aria-disabled":`true`,"aria-current":`page`,className:H(`font-normal text-foreground`,e),...t})}function Yw({children:e,className:t,...n}){return(0,K.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:H(`[&>svg]:size-3.5`,t),...n,children:e??(0,K.jsx)(_,{})})}function Xw(e,t){let n=(0,q.c)(6),r;n[0]!==e||n[1]!==t?(r=Tr(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2];let i=r,a=B(i),o=Kr(i),s;return n[3]!==a||n[4]!==o?(s={value:a,refresh:o},n[3]=a,n[4]=o,n[5]=s):s=n[5],s}function Zw(e){let t=(0,q.c)(3),{folder:n,disabled:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,K.jsx)(Hw,{className:`h-40`,"aria-label":`Folders`,children:(0,K.jsx)(`div`,{className:`flex flex-col p-1`,children:(0,K.jsx)(Qw,{folder:n,disabled:r})})}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function Qw(e){let t=(0,q.c)(38),{folder:n,disabled:r}=e,i=p(TC),a;t[0]===n.value?a=t[1]:(a=pn(Ht(n.value)),t[0]=n.value,t[1]=a);let o=a;if(sr(n.value)){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,K.jsx)(`p`,{role:`status`,className:`px-2 py-1.5 text-xs text-muted-foreground`,children:`Loading folders…`}),t[2]=e):e=t[2],e}if(Wn(n.value)){let e;t[3]===n.value.cause?e=t[4]:(e=it(xr(n.value.cause)),t[3]=n.value.cause,t[4]=e);let a;t[5]===e?a=t[6]:(a=(0,K.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:e}),t[5]=e,t[6]=a);let o;t[7]!==r||t[8]!==n.refresh?(o=(0,K.jsx)(wn,{variant:`outline`,size:`xs`,onClick:n.refresh,disabled:r,children:`Try again`}),t[7]=r,t[8]=n.refresh,t[9]=o):o=t[9];let s;t[10]===i?s=t[11]:(s=()=>i(void 0),t[10]=i,t[11]=s);let c;t[12]!==r||t[13]!==s?(c=(0,K.jsx)(wn,{variant:`ghost`,size:`xs`,onClick:s,disabled:r,children:`Home folder`}),t[12]=r,t[13]=s,t[14]=c):c=t[14];let l;t[15]!==o||t[16]!==c?(l=(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[o,c]}),t[15]=o,t[16]=c,t[17]=l):l=t[17];let u;return t[18]!==a||t[19]!==l?(u=(0,K.jsxs)(`div`,{className:`flex flex-col items-start gap-2 px-2 py-1.5`,children:[a,l]}),t[18]=a,t[19]=l,t[20]=u):u=t[20],u}if(!o)return null;let s;t[21]!==o.parent||t[22]!==r||t[23]!==i?(s=o.parent&&(0,K.jsxs)(wn,{variant:`ghost`,size:`sm`,className:`w-full justify-start`,onClick:()=>i(o.parent??void 0),disabled:r,children:[(0,K.jsx)(qa,{"data-icon":`inline-start`}),`Up`]}),t[21]=o.parent,t[22]=r,t[23]=i,t[24]=s):s=t[24];let c;if(t[25]!==o.directories||t[26]!==r||t[27]!==i){let e;t[29]!==r||t[30]!==i?(e=e=>(0,K.jsxs)(wn,{variant:`ghost`,size:`sm`,className:`w-full justify-start`,title:e.path,onClick:()=>i(e.path),disabled:r,children:[(0,K.jsx)(So,{"data-icon":`inline-start`}),(0,K.jsx)(Fr,{text:e.name})]},e.path),t[29]=r,t[30]=i,t[31]=e):e=t[31],c=o.directories.map(e),t[25]=o.directories,t[26]=r,t[27]=i,t[28]=c}else c=t[28];let l;t[32]===o.directories.length?l=t[33]:(l=!o.directories.length&&(0,K.jsx)(`p`,{className:`px-2 py-1.5 text-xs text-muted-foreground`,children:`No subfolders.`}),t[32]=o.directories.length,t[33]=l);let u;return t[34]!==s||t[35]!==c||t[36]!==l?(u=(0,K.jsxs)(K.Fragment,{children:[s,c,l]}),t[34]=s,t[35]=c,t[36]=l,t[37]=u):u=t[37],u}function $w(e){let t=(0,q.c)(44),{connection:n,disabled:r,onOpen:i}=e,a=B(TC),o=p(TC),s=Xw(n,a),c,l;t[0]===s.value?(c=t[1],l=t[2]):(c=pn(Ht(s.value)),l=c?[`/`,...c.path.split(`/`).filter(Boolean)]:[],t[0]=s.value,t[1]=c,t[2]=l);let u=l,d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,K.jsx)(`h3`,{className:`text-sm font-medium`,children:`Browse for a folder`}),t[3]=d):d=t[3];let f;t[4]!==u||t[5]!==c||t[6]!==r||t[7]!==o?(f=c&&(0,K.jsx)(Ww,{"aria-label":`Folder path`,children:(0,K.jsx)(Gw,{children:u.map((e,t)=>{let n=t===0?`/`:`/${u.slice(1,t+1).join(`/`)}`;return(0,K.jsxs)(G.Fragment,{children:[t>0&&(0,K.jsx)(Yw,{}),(0,K.jsx)(Kw,{className:`min-w-0`,children:t===u.length-1?(0,K.jsx)(Jw,{className:`max-w-48`,title:c.path,children:e}):(0,K.jsx)(qw,{render:(0,K.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>o(n)}),title:n,children:e})})]},n)})})}),t[4]=u,t[5]=c,t[6]=r,t[7]=o,t[8]=f):f=t[8];let m;t[9]===f?m=t[10]:(m=(0,K.jsxs)(`div`,{className:`flex flex-col gap-1 px-3 pt-1`,children:[d,f]}),t[9]=f,t[10]=m);let h;t[11]!==r||t[12]!==s?(h=(0,K.jsx)(Zw,{folder:s,disabled:r}),t[11]=r,t[12]=s,t[13]=h):h=t[13];let g;t[14]===c?.truncated?g=t[15]:(g=c?.truncated&&(0,K.jsx)(`p`,{className:`px-3 text-xs text-muted-foreground`,children:`This folder is large; some entries are not shown.`}),t[14]=c?.truncated,t[15]=g);let _=c?.repository?`Every worktree appears in the sidebar.`:`Pick a folder that is a Git repository.`,v;t[16]===_?v=t[17]:(v=(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:_}),t[16]=_,t[17]=v);let y;t[18]!==c?.repository||t[19]!==r||t[20]!==s.value?(y=r||!c?.repository||An(s.value)||Wn(s.value),t[18]=c?.repository,t[19]=r,t[20]=s.value,t[21]=y):y=t[21];let b;t[22]!==c||t[23]!==i?(b=()=>{c&&i(c.path)},t[22]=c,t[23]=i,t[24]=b):b=t[24];let x;t[25]===r?x=t[26]:(x=r&&(0,K.jsx)(At,{}),t[25]=r,t[26]=x);let S;t[27]===c?.path?S=t[28]:(S=c?.path.split(`/`).filter(Boolean).at(-1)??`folder`,t[27]=c?.path,t[28]=S);let C=`Open ${S}`,w;t[29]===C?w=t[30]:(w=(0,K.jsx)(Fr,{className:`max-w-36`,text:C}),t[29]=C,t[30]=w);let T;t[31]!==b||t[32]!==x||t[33]!==w||t[34]!==y?(T=(0,K.jsxs)(wn,{size:`sm`,disabled:y,onClick:b,children:[x,w]}),t[31]=b,t[32]=x,t[33]=w,t[34]=y,t[35]=T):T=t[35];let E;t[36]!==T||t[37]!==v?(E=(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pr-1 pb-1 pl-3`,children:[v,T]}),t[36]=T,t[37]=v,t[38]=E):E=t[38];let D;return t[39]!==E||t[40]!==m||t[41]!==h||t[42]!==g?(D=(0,K.jsxs)(`section`,{"aria-label":`Browse for a folder`,className:`flex flex-col gap-2 rounded-2xl border bg-muted/30 p-2`,children:[m,h,g,E]}),t[39]=E,t[40]=m,t[41]=h,t[42]=g,t[43]=D):D=t[43],D}function eT(e){let t=(0,q.c)(9),{connection:n,remotes:r,onOpened:i}=e,a=OC(),o;t[0]!==n||t[1]!==r?(o=e=>{if(e===null)return{connection:n,name:void 0};let t=r.find(t=>t.remote.environmentId===e);return t&&{connection:t.connection,name:t.remote.name}},t[0]=n,t[1]=r,t[2]=o):o=t[2];let s=o,c;t[3]!==s||t[4]!==i?(c=e=>{let{payload:t}=e,n=t&&s(t.remote);return t&&n&&(0,K.jsx)(QC,{className:`flex max-h-[90svh] flex-col sm:max-w-lg`,children:(0,K.jsx)(tT,{connection:n.connection,remote:t.remote,name:n.name,onOpened:i},t.remote)})},t[3]=s,t[4]=i,t[5]=c):c=t[5];let l;return t[6]!==a||t[7]!==c?(l=(0,K.jsx)(g,{handle:MC,onOpenChangeComplete:a,children:c}),t[6]=a,t[7]=c,t[8]=l):l=t[8],l}function tT(e){let t=(0,q.c)(18),{connection:n,remote:r,name:i,onOpened:o}=e,s=EC(n,r,nT,o),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,K.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-secondary text-secondary-foreground`,children:(0,K.jsx)(go,{"aria-hidden":`true`})}),t[0]=c):c=t[0];let l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,K.jsx)(tw,{children:`Open project`}),t[1]=l):l=t[1];let u=i===void 0?`Browse for a repository on the Porcelain server.`:`Browse for a repository on ${i}.`,d;t[2]===u?d=t[3]:(d=(0,K.jsxs)($C,{className:`shrink-0 flex-row items-center text-left`,children:[c,(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[l,(0,K.jsx)(nw,{children:u})]})]}),t[2]=u,t[3]=d);let f;t[4]===s?f=t[5]:(f=e=>void s.submit(e),t[4]=s,t[5]=f);let p;t[6]!==n||t[7]!==s.result.waiting||t[8]!==f?(p=(0,K.jsx)($w,{disabled:s.result.waiting,connection:n,onOpen:f}),t[6]=n,t[7]=s.result.waiting,t[8]=f,t[9]=p):p=t[9];let m;t[10]===s.result?m=t[11]:(m=Wn(s.result)&&(0,K.jsx)(Be,{variant:`destructive`,children:(0,K.jsx)(a,{children:it(xr(s.result.cause))})}),t[10]=s.result,t[11]=m);let h;t[12]!==p||t[13]!==m?(h=(0,K.jsx)(Hw,{className:`min-h-0 [&>[data-slot=scroll-area-viewport]]:max-h-[calc(90svh-8rem)]`,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[p,m]})}),t[12]=p,t[13]=m,t[14]=h):h=t[14];let g;return t[15]!==d||t[16]!==h?(g=(0,K.jsxs)(K.Fragment,{children:[d,h]}),t[15]=d,t[16]=h,t[17]=g):g=t[17],g}function nT(){return MC.close()}var rT=Mi(),iT=P(e=>m(t=>{let n=new Map,r=t.registry,i=Jt(e.connections),a=e=>({children:r.get(i).waiting?`Retrying…`:`Retry`,disabled:r.get(i).waiting,onClick:()=>r.set(i,{environmentId:e})});t.subscribe(Oe,t=>{let i=t.filter(t=>!t.dismissed&&e.connections.some(e=>e.environmentId===t.environmentId));for(let[e,t]of n)i.some(t=>t.environmentId===e)||(n.delete(e),rT.close(t.id));for(let t of i){let i=t.environmentId,o=JSON.stringify([t.environmentName,t.failures.map(({entry:e,detail:t})=>[e.key,e.name,t])]),s=n.get(i),c={title:`Couldn’t check changes on ${t.environmentName}`,description:e.description(t)};if(s){s.signature!==o&&(rT.update(s.id,c),s.signature=o);continue}let l=rT.add({...c,priority:`low`,actionProps:a(i),onClose:()=>r.update(Oe,e=>e.some(e=>e.environmentId===i&&!e.dismissed)?e.map(e=>e.environmentId===i?{...e,dismissed:!0}:e):e)});n.set(i,{id:l,signature:o})}},{immediate:!0}),t.subscribe(i,()=>{for(let[e,t]of n)rT.update(t.id,{actionProps:a(e)})}),t.addFinalizer(()=>{for(let e of n.values())rT.close(e.id)})}));function aT(e){let[t,n]=G.useState({getBoundingClientRect(){return DOMRect.fromRect({width:0,height:0,x:0,y:0})}}),r=G.useRef(null),i=G.useRef(null),a=G.useRef(null),o=G.useRef(null),s=G.useRef(!0),c=G.useRef(null),l=ue(),u=G.useMemo(()=>({anchor:t,setAnchor:n,actionsRef:a,backdropRef:r,internalBackdropRef:i,positionerRef:o,allowMouseUpTriggerRef:s,initialCursorPointRef:c,rootId:l}),[t,l]);return(0,K.jsx)(Fe.Provider,{value:u,children:(0,K.jsx)(le.Provider,{value:void 0,children:(0,K.jsx)(wt,{...e})})})}var oT=500,sT=G.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{setAnchor:o,actionsRef:s,internalBackdropRef:c,backdropRef:l,positionerRef:u,allowMouseUpTriggerRef:d,initialCursorPointRef:f,rootId:p}=F(!1),{store:m}=Se(!1),h=m.useState(`open`),g=m.useState(`disabled`),_=G.useRef(null),v=G.useRef(null),y=Je(),x=Je(),S=G.useRef(!1),C=G.useRef(null);function w(e,t,n){let r=n.type.startsWith(`touch`);f.current={x:e,y:t},o({getBoundingClientRect(){return DOMRect.fromRect({width:r?10:0,height:r?10:0,x:e,y:t})}}),S.current=!1,s.current?.setOpen(!0,V(W,n)),x.start(oT,()=>{S.current=!0})}function T(e){if(g)return;d.current=!0,Gt(e),w(e.clientX,e.clientY,e.nativeEvent);let t=jr(_.current);C.current?.abort();let n=new AbortController;C.current=n,t.addEventListener(`mouseup`,e=>{if(d.current=!1,!S.current)return;x.clear(),S.current=!1;let t=Vr(e);Er(u.current,t)||p&&t&&hn(t)===p||s.current?.setOpen(!1,V(_e,e))},{once:!0,signal:n.signal})}function E(){y.clear(),v.current=null}function D(e){if(g||(d.current=!1,e.touches.length!==1)){E();return}e.stopPropagation();let t=e.touches[0],n={x:t.clientX,y:t.clientY};v.current=n,y.start(oT,()=>{w(n.x,n.y,e.nativeEvent)})}function O(e){if(e.touches.length!==1)E();else if(y.isStarted()&&v.current){let t=e.touches[0],n=Math.abs(t.clientX-v.current.x),r=Math.abs(t.clientY-v.current.y);(n>10||r>10)&&E()}}return G.useEffect(()=>()=>{C.current?.abort()},[]),G.useEffect(()=>{function e(e){if(g)return;let t=Vr(e);(Er(_.current,t)||Er(c.current,t)||Er(l.current,t))&&e.preventDefault()}let t=jr(_.current);return b(t,`contextmenu`,e)},[l,g,c]),Xt(`div`,e,{state:{open:h},ref:[_,t],props:[{onContextMenu:T,onTouchStart:D,onTouchMove:O,onTouchEnd:E,onTouchCancel:E,style:{WebkitTouchCallout:`none`}},a],stateAttributesMapping:Qn})}),cT=Or;function lT({...e}){return(0,K.jsx)(aT,{"data-slot":`context-menu`,...e})}function uT({className:e,...t}){return(0,K.jsx)(sT,{"data-slot":`context-menu-trigger`,className:H(`select-none`,e),...t})}function dT({className:e,align:t=`start`,alignOffset:n=4,side:r=`right`,sideOffset:i=0,...a}){return(0,K.jsx)(Nt,{children:(0,K.jsx)(cT,{className:`isolate z-50 outline-none`,align:t,alignOffset:n,side:r,sideOffset:i,children:(0,K.jsx)(Lr,{"data-slot":`context-menu-content`,className:H(`z-50 max-h-(--available-height) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 animate-none! relative bg-popover/70 before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] before:backdrop-blur-2xl before:backdrop-saturate-150 **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!`,e),...a})})})}function fT({...e}){return(0,K.jsx)(Ee,{"data-slot":`context-menu-group`,...e})}function pT({className:e,inset:t,variant:n=`default`,...r}){return(0,K.jsx)(Sn,{"data-slot":`context-menu-item`,"data-inset":t,"data-variant":n,className:H(`group/context-menu-item relative flex min-h-7 cursor-default items-center gap-2 rounded-md px-2 py-1 text-xs/relaxed outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7.5 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function mT({className:e,...t}){return(0,K.jsx)(sn,{"data-slot":`context-menu-separator`,className:H(`-mx-1 my-1 h-px bg-border/50`,e),...t})}function hT({className:e,...t}){return(0,K.jsx)(`span`,{"data-slot":`context-menu-shortcut`,className:H(`ml-auto text-[0.625rem] tracking-widest text-muted-foreground group-focus/context-menu-item:text-accent-foreground`,e),...t})}function gT(e){let t=(0,q.c)(26),{entry:n,connection:r,children:i,onRetryChanges:a}=e,o=n.worktreeId,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,K.jsx)(`div`,{className:`min-w-0 flex-1 py-0.5`}),t[0]=s):s=t[0];let c;t[1]===i?c=t[2]:(c=(0,K.jsx)(uT,{render:s,children:i}),t[1]=i,t[2]=c);let l;t[3]!==n.available||t[4]!==n.changes||t[5]!==n.kind||t[6]!==a?(l=n.available&&n.kind===`worktree`&&n.changes.state===`unavailable`&&(0,K.jsxs)(pT,{onClick:a,children:[(0,K.jsx)(Bo,{}),`Retry changes`]}),t[3]=n.available,t[4]=n.changes,t[5]=n.kind,t[6]=a,t[7]=l):l=t[7];let u;t[8]===n.path?u=t[9]:(u=n.path&&(0,K.jsxs)(pT,{className:`cursor-pointer`,onClick:()=>n.path&&Ft(n.path,`worktree path`),children:[(0,K.jsx)(Za,{}),`Copy worktree path`]}),t[8]=n.path,t[9]=u);let d;t[10]!==r||t[11]!==n||t[12]!==o?(d=n.kind===`worktree`&&o&&(0,K.jsxs)(pT,{className:`cursor-pointer`,disabled:!n.available,onClick:()=>RC.openWithPayload({entry:n,connection:r,worktreeId:o,requestId:crypto.randomUUID()}),children:[(0,K.jsx)(wo,{}),`Switch branch`]}),t[10]=r,t[11]=n,t[12]=o,t[13]=d):d=t[13];let f;t[14]!==r||t[15]!==n||t[16]!==o?(f=!n.main&&n.kind===`worktree`&&o&&(0,K.jsxs)(pT,{variant:`destructive`,className:`cursor-pointer`,disabled:!n.available,onClick:()=>LC.openWithPayload({entry:n,connection:r,worktreeId:o,requestId:crypto.randomUUID()}),children:[(0,K.jsx)(Xo,{}),`Delete`]}),t[14]=r,t[15]=n,t[16]=o,t[17]=f):f=t[17];let p;t[18]!==l||t[19]!==u||t[20]!==d||t[21]!==f?(p=(0,K.jsx)(dT,{children:(0,K.jsxs)(fT,{children:[l,u,d,f]})}),t[18]=l,t[19]=u,t[20]=d,t[21]=f,t[22]=p):p=t[22];let m;return t[23]!==c||t[24]!==p?(m=(0,K.jsxs)(lT,{children:[c,p]}),t[23]=c,t[24]=p,t[25]=m):m=t[25],m}function _T({className:e,...t}){return(0,K.jsx)(`kbd`,{"data-slot":`kbd`,className:H(`pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-xs bg-muted px-1 font-sans text-[0.625rem] font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3`,e),...t})}function vT({className:e,...t}){return(0,K.jsx)(`kbd`,{"data-slot":`kbd-group`,className:H(`inline-flex items-center gap-1`,e),...t})}function yT(){let e=(0,q.c)(2),[t,n]=(0,G.useState)(null),r;return e[0]===t?r=e[1]:(r={element:t,attach:n},e[0]=t,e[1]=r),r}function bT({className:e,...t}){return(0,K.jsx)(`textarea`,{"data-slot":`textarea`,className:H(`flex field-sizing-content min-h-16 w-full resize-none rounded-md border border-input bg-input/20 px-2 py-2 text-sm transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 md:text-xs/relaxed dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function xT({className:e,...t}){return(0,K.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:H(`group/input-group relative flex h-7 w-full min-w-0 items-center rounded-md border border-input bg-input/20 transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-data-[align=block-end]:rounded-md has-data-[align=block-start]:rounded-md has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-2 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/30 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-2 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[textarea]:rounded-md has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,e),...t})}var ST=yn(`flex h-auto cursor-text items-center justify-center gap-1 py-2 text-xs/relaxed font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 **:data-[slot=kbd]:rounded-[calc(var(--radius-sm)-2px)] **:data-[slot=kbd]:bg-muted-foreground/10 **:data-[slot=kbd]:px-1 **:data-[slot=kbd]:text-[0.625rem] [&>svg:not([class*='size-'])]:size-3.5`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:ml-[-0.275rem] has-[>kbd]:ml-[-0.275rem]`,"inline-end":`order-last pr-2 has-[>button]:mr-[-0.275rem] has-[>kbd]:mr-[-0.275rem]`,"block-start":`order-first w-full justify-start px-2 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function CT({className:e,align:t=`inline-start`,...n}){return(0,K.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:H(ST({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}var wT=yn(`flex items-center gap-2 rounded-md text-xs/relaxed shadow-none`,{variants:{size:{xs:`h-5 gap-1 rounded-[calc(var(--radius-sm)-2px)] px-1 [&>svg:not([class*='size-'])]:size-3`,sm:`gap-1`,"icon-xs":`size-6 p-0 has-[>svg]:p-0`,"icon-sm":`size-7 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function TT({className:e,type:t=`button`,variant:n=`ghost`,size:r=`xs`,...i}){return(0,K.jsx)(wn,{type:t,"data-size":r,variant:n,className:H(wT({size:r}),e),...i})}function ET({className:e,...t}){return(0,K.jsx)(`span`,{className:H(`flex items-center gap-2 text-xs/relaxed text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,e),...t})}function DT({className:e,...t}){return(0,K.jsx)(h,{"data-slot":`input-group-control`,className:H(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent`,e),...t})}function OT({className:e,...t}){return(0,K.jsx)(bT,{"data-slot":`input-group-control`,className:H(`flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent`,e),...t})}function kT({className:e,...t}){return(0,K.jsx)(`div`,{"data-slot":`empty`,className:H(`flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance`,e),...t})}function AT({className:e,...t}){return(0,K.jsx)(`div`,{"data-slot":`empty-header`,className:H(`flex max-w-sm flex-col items-center gap-1`,e),...t})}yn(`mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`flex size-8 shrink-0 items-center justify-center rounded-md bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4`}},defaultVariants:{variant:`default`}});function jT({className:e,...t}){return(0,K.jsx)(`div`,{"data-slot":`empty-title`,className:H(`font-heading text-sm font-medium tracking-tight`,e),...t})}function MT({className:e,...t}){return(0,K.jsx)(`div`,{"data-slot":`empty-description`,className:H(`text-xs/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}var NT=1,PT=.9,FT=.8,IT=.17,LT=.1,RT=.999,zT=.9999,BT=.99,VT=/[\\\/_+.#"@\[\(\{&]/,HT=/[\\\/_+.#"@\[\(\{&]/g,UT=/[\s-]/,WT=/[\s-]/g;function GT(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?NT:BT;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=GT(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=NT:VT.test(e.charAt(l-1))?(d*=FT,p=e.slice(i,l-1).match(HT),p&&i>0&&(d*=RT**+p.length)):UT.test(e.charAt(l-1))?(d*=PT,m=e.slice(i,l-1).match(WT),m&&i>0&&(d*=RT**+m.length)):(d*=IT,i>0&&(d*=RT**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=zT)),(d<LT&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=GT(e,t,n,r,l+1,a+2,o),f*LT>d&&(d=f*LT)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function KT(e){return e.toLowerCase().replace(WT,` `)}function qT(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,GT(e,t,KT(e),KT(t),0,0,{})}var JT=Object.defineProperty,YT=(e,t)=>JT(e,`name`,{value:t,configurable:!0}),XT=!!(typeof window<`u`&&window.document&&window.document.createElement);function ZT(e,t,{checkForDefaultPrevented:n=!0}={}){return YT(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}YT(ZT,`composeEventHandlers`);function QT(e){if(!XT)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}YT(QT,`getOwnerWindow`);function $T(e){if(!XT)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}YT($T,`getOwnerDocument`);function eE(e,t=!1){let{activeElement:n}=$T(e);if(!n?.nodeName)return null;if(tE(n)&&n.contentDocument)return eE(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=$T(n).getElementById(e);if(t)return t}}return n}YT(eE,`getActiveElement`);function tE(e){return e.tagName===`IFRAME`}YT(tE,`isFrame`);var nE=Object.defineProperty,rE=(e,t)=>nE(e,`name`,{value:t,configurable:!0});function iE(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}rE(iE,`setRef`);function aE(...e){return t=>{let n=!1,r=e.map(e=>{let r=iE(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():iE(e[t],null)}}}}rE(aE,`composeRefs`);function oE(...e){return G.useCallback(aE(...e),e)}rE(oE,`useComposedRefs`);var sE=Object.defineProperty,cE=(e,t)=>sE(e,`name`,{value:t,configurable:!0});function lE(e,t){let n=G.createContext(t);n.displayName=e+`Context`;let r=cE(e=>{let{children:t,...r}=e,i=G.useMemo(()=>r,Object.values(r));return(0,K.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=G.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return cE(i,`useContext`),[r,i]}cE(lE,`createContext`);function uE(e,t=[]){let n=[];function r(t,r){let i=G.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=cE(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=G.useMemo(()=>o,Object.values(o));return(0,K.jsx)(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=G.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return cE(s,`useContext`),[o,s]}cE(r,`createContext`);let i=cE(()=>{let t=n.map(e=>G.createContext(e));return cE(function(n){let r=n?.[e]||t;return G.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,dE(i,...t)]}cE(uE,`createContextScope`);function dE(...e){let t=e[0];if(e.length===1)return t;let n=cE(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return cE(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return G.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}cE(dE,`composeContextScopes`);var fE=globalThis?.document?G.useLayoutEffect:()=>{},pE=Object.defineProperty,mE=(e,t)=>pE(e,`name`,{value:t,configurable:!0}),hE=G.useId||(()=>void 0),gE=0;function _E(e){let[t,n]=G.useState(hE());return fE(()=>{e||n(e=>e??String(gE++))},[e]),e||(t?`radix-${t}`:``)}mE(_E,`useId`);var vE=Object.defineProperty,yE=(e,t)=>vE(e,`name`,{value:t,configurable:!0}),bE=G.useEffectEvent,xE=G.useInsertionEffect;function SE(e){if(typeof bE==`function`)return bE(e);let t=G.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof xE==`function`?xE(()=>{t.current=e}):fE(()=>{t.current=e}),G.useMemo(()=>((...e)=>t.current?.(...e)),[])}yE(SE,`useEffectEvent`);var CE=Object.defineProperty,wE=(e,t)=>CE(e,`name`,{value:t,configurable:!0}),TE=G.useInsertionEffect||fE;function EE({prop:e,defaultProp:t,onChange:n=wE(()=>{},`onChange`),caller:r}){let[i,a,o]=DE({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,G.useCallback(t=>{if(s){let n=OE(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}wE(EE,`useControllableState`);function DE({defaultProp:e,onChange:t}){let[n,r]=G.useState(e),i=G.useRef(n),a=G.useRef(t);return TE(()=>{a.current=t},[t]),G.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}wE(DE,`useUncontrolledState`);function OE(e){return typeof e==`function`}wE(OE,`isFunction`);var kE=Symbol(`RADIX:SYNC_STATE`);function AE(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=SE(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=G.useReducer((t,n)=>{if(n.type===kE)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),p=d.state,m=G.useRef(p);G.useEffect(()=>{m.current!==p&&(m.current=p,c||l(p))},[p,m,c]);let h=G.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return G.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:kE,state:i})},[i,d.state,c]),[h,f]}wE(AE,`useControllableStateReducer`);var jE=Object.defineProperty,ME=(e,t)=>jE(e,`name`,{value:t,configurable:!0});function NE(e){let t=G.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];VE(r)&&typeof GE==`function`&&(r=GE(r._payload)),G.Children.forEach(r,e=>{if(zE(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;VE(n)&&typeof GE==`function`&&(n=GE(n._payload)),a=IE(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=G.cloneElement(a,void 0,s):!o&&G.Children.count(r)===1&&G.isValidElement(r)&&(a=r);let c=a?RE(a):void 0,l=oE(n,c);if(!a){if(r||r===0)throw Error(o?WE(e):UE(e));return r}let u=LE(i,a.props??{});return a.type!==G.Fragment&&(u.ref=n?l:c),G.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}ME(NE,`createSlot`);var PE=Symbol.for(`radix.slottable`);function FE(e){let t=ME(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=PE,t}ME(FE,`createSlottable`);var IE=ME((e,t)=>{if(`child`in e.props){let t=e.props.child;return G.isValidElement(t)?G.cloneElement(t,void 0,e.props.children(t.props.children)):null}return G.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function LE(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}ME(LE,`mergeProps`);function RE(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}ME(RE,`getElementRef`);function zE(e){return G.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===PE}ME(zE,`isSlottable`);var BE=Symbol.for(`react.lazy`);function VE(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===BE&&`_payload`in e&&HE(e._payload)}ME(VE,`isLazyComponent`);function HE(e){return typeof e==`object`&&!!e&&`then`in e}ME(HE,`isPromiseLike`);var UE=ME(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),WE=ME(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),GE=G.use,KE=Object.defineProperty,qE=(e,t)=>KE(e,`name`,{value:t,configurable:!0}),JE=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=NE(`Primitive.${t}`),r=G.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,K.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function YE(e,t){e&&is.flushSync(()=>e.dispatchEvent(t))}qE(YE,`dispatchDiscreteCustomEvent`);var XE=Object.defineProperty,ZE=(e,t)=>XE(e,`name`,{value:t,configurable:!0});function QE(e){let t=G.useRef(e);return G.useEffect(()=>{t.current=e}),G.useMemo(()=>((...e)=>t.current?.(...e)),[])}ZE(QE,`useCallbackRef`);var $E=Object.defineProperty,eD=(e,t)=>$E(e,`name`,{value:t,configurable:!0}),tD=`dismissableLayer.update`,nD=`dismissableLayer.pointerDownOutside`,rD=`dismissableLayer.focusOutside`,iD,aD=G.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),oD=G.forwardRef(eD(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=G.useContext(aD),[d,f]=G.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=G.useState({}),h=oE(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=G.useRef(!1),C=lD(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:G.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),w=uD(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=QE(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return G.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T,E]),G.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(iD=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),dD(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=iD))}},[d,p,n,u]),G.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),dD())},[d,u]),G.useEffect(()=>{let e=eD(()=>m({}),`handleUpdate`);return document.addEventListener(tD,e),()=>document.removeEventListener(tD,e)},[]),(0,K.jsx)(JE.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:ZT(e.onFocusCapture,w.onFocusCapture),onBlurCapture:ZT(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:ZT(e.onPointerDownCapture,C.onPointerDownCapture)})},`DismissableLayer`));function sD(){let e=G.useContext(aD),[t,n]=G.useState(null);return G.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}eD(sD,`useDismissableLayerSurface`);var cD=eD(()=>!0,`IS_TRUE`);function lD(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=cD}=t,s=QE(e),c=G.useRef(!1),l=G.useRef(!1),u=G.useRef(new Map),d=G.useRef(()=>{});return G.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}eD(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}eD(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}eD(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}eD(p,`handleInteractionBubble`);let m=eD(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||fD(nD,s,p,{discrete:!0})};if(eD(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:eD(()=>c.current=!0,`onPointerDownCapture`)}}eD(lD,`usePointerDownOutside`);function uD(e,t=globalThis?.document){let n=QE(e),r=G.useRef(!1);return G.useEffect(()=>{let e=eD(e=>{e.target&&!r.current&&fD(rD,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:eD(()=>r.current=!0,`onFocusCapture`),onBlurCapture:eD(()=>r.current=!1,`onBlurCapture`)}}eD(uD,`useFocusOutside`);function dD(){let e=new CustomEvent(tD);document.dispatchEvent(e)}eD(dD,`dispatchUpdate`);function fD(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?YE(i,a):i.dispatchEvent(a)}eD(fD,`handleAndDispatchCustomEvent`);var pD=Object.defineProperty,mD=(e,t)=>pD(e,`name`,{value:t,configurable:!0}),hD=`focusScope.autoFocusOnMount`,gD=`focusScope.autoFocusOnUnmount`,_D={bubbles:!1,cancelable:!0},vD=G.forwardRef(mD(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=G.useState(null),l=QE(i),u=QE(a),d=G.useRef(null),f=oE(t,c),p=G.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;G.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:TD(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||TD(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&TD(s)};mD(e,`handleFocusIn`),mD(t,`handleFocusOut`),mD(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),G.useEffect(()=>{if(s){ED.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(hD,_D);s.addEventListener(hD,l),s.dispatchEvent(t),t.defaultPrevented||(yD(kD(xD(s)),{select:!0}),document.activeElement===e&&TD(s))}return()=>{s.removeEventListener(hD,l),setTimeout(()=>{let t=new CustomEvent(gD,_D);s.addEventListener(gD,u),s.dispatchEvent(t),t.defaultPrevented||TD(e??document.body,{select:!0}),s.removeEventListener(gD,u),ED.remove(p)},0)}}},[s,l,u,p]);let m=G.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=bD(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&TD(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&TD(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,K.jsx)(JE.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})},`FocusScope`));function yD(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(TD(r,{select:t}),document.activeElement!==n)return}mD(yD,`focusFirst`);function bD(e){let t=xD(e);return[SD(t,e),SD(t.reverse(),e)]}mD(bD,`getTabbableEdges`);function xD(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:mD(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}mD(xD,`getTabbableCandidates`);function SD(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):CD(r,{upTo:t})))return r}mD(SD,`findVisible`);function CD(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}mD(CD,`isHidden`);function wD(e){return e instanceof HTMLInputElement&&`select`in e}mD(wD,`isSelectableInput`);function TD(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&wD(e)&&t&&e.select()}}mD(TD,`focus`);var ED=DD();function DD(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=OD(e,t),e.unshift(t)},remove(t){e=OD(e,t),e[0]?.resume()}}}mD(DD,`createFocusScopesStack`);function OD(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}mD(OD,`arrayRemove`);function kD(e){return e.filter(e=>e.tagName!==`A`)}mD(kD,`removeLinks`);var AD=Object.defineProperty,jD=G.forwardRef(((e,t)=>AD(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=G.useState(!1);fE(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?is.createPortal((0,K.jsx)(JE.div,{...r,ref:t}),o):null},`Portal`)),MD=Object.defineProperty,ND=(e,t)=>MD(e,`name`,{value:t,configurable:!0});function PD(e,t){return G.useReducer((e,n)=>t[e][n]??e,e)}ND(PD,`useStateMachine`);var FD=ND(e=>{let{present:t,children:n}=e,r=ID(t),i=typeof n==`function`?n({present:r.isPresent}):G.Children.only(n),a=RD(r.ref,BD(i));return typeof n==`function`||r.isPresent?G.cloneElement(i,{ref:a}):null},`Presence`);function ID(e){let[t,n]=G.useState(),r=G.useRef(null),i=G.useRef(e),a=G.useRef(`none`),o=G.useRef(void 0),[s,c]=PD(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return G.useEffect(()=>{s===`mounted`?(a.current=o.current??zD(r.current),o.current=void 0):a.current=`none`},[s]),fE(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=zD(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),fE(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=ND(a=>{let o=zD(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=ND(e=>{e.target===t&&(a.current=zD(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:G.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=zD(t)}else r.current=null;n(e)},[])}}ND(ID,`usePresence`);function LD(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}ND(LD,`setRef`);function RD(...e){let t=G.useRef(e);return t.current=e,G.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=LD(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():LD(n[e],null)}}},[])}ND(RD,`useStableComposedRefs`);function zD(e){return e?.animationName||`none`}ND(zD,`getAnimationName`);function BD(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}ND(BD,`getElementRef`);var VD=Object.defineProperty,HD=(e,t)=>VD(e,`name`,{value:t,configurable:!0}),UD=0,WD=null;function GD(e){return KD(),e.children}HD(GD,`FocusGuards`);function KD(){G.useEffect(()=>{WD||={start:qD(),end:qD()};let{start:e,end:t}=WD;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),UD++,()=>{UD===1&&(WD?.start.remove(),WD?.end.remove(),WD=null),UD=Math.max(0,UD-1)}},[])}HD(KD,`useFocusGuards`);function qD(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}HD(qD,`createFocusGuard`);var JD=function(){return JD=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},JD.apply(this,arguments)};function YD(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function XD(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var ZD=`right-scroll-bar-position`,QD=`width-before-scroll-bar`,$D=`with-scroll-bars-hidden`,eO=`--removed-body-scroll-bar-size`;function tO(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function nO(e,t){var n=(0,G.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var rO=typeof window<`u`?G.useLayoutEffect:G.useEffect,iO=new WeakMap;function aO(e,t){var n=nO(t||null,function(t){return e.forEach(function(e){return tO(e,t)})});return rO(function(){var t=iO.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||tO(e,null)}),i.forEach(function(e){r.has(e)||tO(e,a)})}iO.set(n,e)},[e]),n}function oO(e){return e}function sO(e,t){t===void 0&&(t=oO);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function cO(e){e===void 0&&(e={});var t=sO(null);return t.options=JD({async:!0,ssr:!1},e),t}var lO=function(e){var t=e.sideCar,n=YD(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return G.createElement(r,JD({},n))};lO.isSideCarExport=!0;function uO(e,t){return e.useMedium(t),lO}var dO=cO(),fO=function(){},pO=G.forwardRef(function(e,t){var n=G.useRef(null),r=G.useState({onScrollCapture:fO,onWheelCapture:fO,onTouchMoveCapture:fO}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=YD(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=aO([n,t]),C=JD(JD({},b),i);return G.createElement(G.Fragment,null,u&&G.createElement(x,{sideCar:dO,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?G.cloneElement(G.Children.only(s),JD(JD({},C),{ref:S})):G.createElement(v,JD({},C,{className:c,ref:S}),s))});pO.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},pO.classNames={fullWidth:QD,zeroRight:ZD};var mO=function(){if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function hO(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=mO();return t&&e.setAttribute(`nonce`,t),e}function gO(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function _O(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var vO=function(){var e=0,t=null;return{add:function(n){e==0&&(t=hO())&&(gO(t,n),_O(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},yO=function(){var e=vO();return function(t,n){G.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},bO=function(){var e=yO();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},xO={left:0,top:0,right:0,gap:0},SO=function(e){return parseInt(e||``,10)||0},CO=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[SO(n),SO(r),SO(i)]},wO=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return xO;var t=CO(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},TO=bO(),EO=`data-scroll-locked`,DO=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
1323
- .${$D} {
1306
+ `),i=i.slice(e+1))}let o=ux(i);i=o.lines;let s=[],c=Object.create(null),l=Object.keys(o.references).length>0,u=Object.keys(o.footnotes).length>0,d=l||u?{...t,...l?{references:o.references}:{},...u?{footnotes:o.footnotes,footnoteOrder:s,footnoteCounts:c}:{}}:t,f=zb(),p=new cx(i,d,f).parse();u&&s.length>0&&p.push(dx(o.footnotes,s,d,f));let m=a===void 0?{type:`root`,children:p}:{type:`root`,frontmatter:a,children:p};for(let e of d.extensions??[])m=e.transformDocument?.(m,{options:d})??m;return m}var cx=class e{lines;options;slugger;budget;index=0;loose=!1;constructor(e,t,n,r={depth:0}){this.lines=e,this.options=t,this.slugger=n,this.budget=r}parse(){if(this.budget.depth>=ox){let e=this.lines.slice(this.index).join(`
1307
+ `);return this.index=this.lines.length,e?[{type:`paragraph`,children:Kb(e,this.options)}]:[]}this.budget.depth++;let e=[];for(;this.index<this.lines.length;){if(Ib(this.current())){e.length&&(this.loose=!0),this.index++;continue}let t=this.parseExtensionBlock();if(t){e.push(t);continue}let n=this.parseFence()??this.parseHeading()??this.parseThematicBreak()??this.parseBlockquote()??this.parseList()??this.parseTable()??this.parseHtmlBlock()??this.parseParagraph();e.push(n)}return this.budget.depth--,e}parseExtensionBlock(){for(let t of this.options.extensions??[]){let n=0,r=t.parseBlock?.({lines:this.lines,index:this.index,options:this.options,parseInline:e=>Kb(e,this.options),parseBlocks:t=>new e(Nb(t).split(`
1308
+ `),this.options,this.slugger,this.budget).parse(),consume:e=>{n=e}});if(r)return this.index+=Math.max(n,1),r}}parseFence(){let e=this.current().match(/^( {0,3})(`{3,}|~{3,})(.*)$/);if(!e)return;let t=e[2],n=e[3].trim(),r=[];for(this.index++;this.index<this.lines.length;){let n=this.current();if(n.match(/^ {0,3}(`{3,}|~{3,})\s*$/)?.[1].startsWith(t)){this.index++;break}r.push(Lb(n,e[1].length)),this.index++}return{type:`code`,value:r.join(`
1309
+ `),...lx(n)}}parseHeading(){let e=this.current().match(/^ {0,3}(#{1,6})(?:[ \t]+(.*)|[ \t]*)$/);if(!e)return;let t=e[1].length,n=e[2]??``,r=Kb((/^#+[ \t]*$/.test(n)?``:n.replace(/[ \t]+#+[ \t]*$/,``)).trim(),this.options),i=this.createHeadingId(r);return this.index++,i?{type:`heading`,depth:t,id:i,children:r}:{type:`heading`,depth:t,children:r}}parseThematicBreak(){if(/^ {0,3}([-*_])(?:\s*\1){2,}\s*$/.test(this.current()))return this.index++,{type:`thematicBreak`}}parseBlockquote(){if(!/^ {0,3}>\s?/.test(this.current()))return;let t=[];for(;this.index<this.lines.length;){let e=this.current(),n=e.match(/^ {0,3}>\s?(.*)$/);if(!n){if(!Ib(e))break;this.loose=!0}t.push(n?.[1]??``),this.index++}return{type:`blockquote`,children:new e(t,this.options,this.slugger,this.budget).parse()}}parseList(){let t=px(this.current());if(!t)return;let n=[],r=t.ordered,i=t.indent,a=!1;for(;this.index<this.lines.length;){let r=px(this.current());if(!r||r.marker!==t.marker||r.indent!==i)break;let o=r.content,s=o.match(/^\[([ xX])\]\s+(.*)$/),c=s?s[1].toLowerCase()===`x`:void 0;s&&(o=s[2]);let l=[o];for(this.index++;this.index<this.lines.length;){let e=this.current(),n=px(e);if(n&&n.indent===i)break;if(Ib(e)){let e=this.index;for(;e<this.lines.length&&Ib(this.lines[e]);)e++;let n=this.lines[e];if(n===void 0)break;let o=px(n);if(o?.indent===i){if(o.marker!==t.marker)break;a=!0,this.index=e;break}if(mx(n)<r.contentIndent)break;for(;this.index<e;)l.push(Lb(this.lines[this.index++],r.contentIndent))}else if(mx(e)>=r.contentIndent)l.push(Lb(e,r.contentIndent)),this.index++;else{if(hx(e,this.next()))break;l.push(e.trimStart()),this.index++}}let u=new e(l,this.options,this.slugger,this.budget),d=u.parse();a||=u.loose;let f={type:`listItem`,children:d};c!==void 0&&(f.checked=c),n.push(f)}return{type:`list`,ordered:r,...r&&{start:t.number},...a&&{loose:!0},items:n}}parseTable(){let e=this.current(),t=this.next();if(!t||!gx(e,t))return;let n=_x(e),r=_x(t).map(vx),i=n.length,a=[];for(this.index+=2;this.index<this.lines.length;){let e=this.current();if(Ib(e)||hx(e,this.next()))break;let t=_x(e);a.push(Array.from({length:i},(e,n)=>yx(t[n]??``,this.options))),this.index++}return{type:`table`,align:r,header:n.map(e=>yx(e,this.options)),rows:a}}parseHtmlBlock(){if(!this.options.allowHtml||!/^ {0,3}<([A-Za-z][\w:-]*|!--|\/[A-Za-z])/.test(this.current()))return;let e=[];if(/^ {0,3}<!--/.test(this.current())){for(;this.index<this.lines.length;){let t=this.current();if(e.push(t),this.index++,t.includes(`-->`))break}return{type:`html`,value:e.join(`
1310
+ `)}}for(;this.index<this.lines.length&&!Ib(this.current());)e.push(this.current()),this.index++;return{type:`html`,value:e.join(`
1311
+ `)}}parseParagraph(){let e=[];for(;this.index<this.lines.length;){let t=this.current();if(Ib(t)||e.length>0&&hx(t,this.next()))break;e.push(t.trim()),this.index++}return{type:`paragraph`,children:Kb(e.join(`
1312
+ `),this.options)}}createHeadingId(e){if(this.options.headingIds===!1)return;let t=Rb(e);return typeof this.options.headingIds==`function`?this.options.headingIds(t,this.index):this.slugger(t)}current(){return this.lines[this.index]??``}next(){return this.lines[this.index+1]}};function lx(e){if(!e)return{};let t=e.match(/^([A-Za-z0-9_+.#-]+)/)?.[1],n=t?e.slice(t.length).trim():e,r=n.match(/(?:^|\s)(?:title|file)=(?:"([^"]+)"|'([^']+)'|([^\s}]+))/),i=n.match(/(?:^|\s)framework=(?:"([^"]+)"|'([^']+)'|([^\s}]+))/),a=n.match(/\{([^}]+)\}|(?:^|\s)lines=([^\s]+)/),o=a?fx(a[1]??a[2]):[],s=r?r[1]??r[2]??r[3]:void 0,c=i?i[1]??i[2]??i[3]:void 0;return{...t?{lang:t}:{},...n?{meta:n}:{},...s?{title:s,file:s}:{},...c?{framework:c.toLowerCase()}:{},...o.length?{highlightLines:o}:{}}}function ux(e){let t=Object.create(null),n=Object.create(null),r=zb(Wb),i=[],a=``,o=0;for(;o<e.length;){let s=e[o],c=s.match(/^ {0,3}(`{3,}|~{3,})(.*)$/);if(c)a?c[1].startsWith(a)&&Ib(c[2])&&(a=``):a=c[1];else if(!a){let i=s.match(/^ {0,3}\[\^([^\]\n]+)\]:[ \t]*(.*)$/);if(i){let t=i[1],a=[i[2]??``];for(o++;o<e.length;){let t=e[o];if(!/^(?: {4,}|\t)/.test(t))break;a.push(t.replace(/^(?: {4}|\t)/,``)),o++}let s=Ub(t);n[s]||(n[s]={label:t,content:a.join(`
1313
+ `),id:r(t)});continue}let a=s.match(/^ {0,3}\[([^\]\n]+)\]:[ \t]*(\S.*)$/),c=a&&Hb(a[2].trimEnd());if(c){t[Ub(a[1])]??=c,o++;continue}}i.push(s),o++}return{lines:i,references:t,footnotes:n}}function dx(e,t,n,r){let i=[];for(let a=0;a<t.length;a++){let o=e[t[a]];o&&i.push({id:o.id??Wb(o.label),number:a+1,children:new cx(Nb(o.content).split(`
1314
+ `),n,r).parse()})}for(let e of i){let r=n.footnoteCounts?.[t[e.number-1]]??1;r>1&&(e.referenceCount=r)}return{type:`footnotes`,items:i}}function fx(e){let t=new Set;for(let n of e.split(`,`)){let e=n.trim().match(/^(\d+)(?:-(\d+))?$/);if(!e)continue;let r=Number(e[1]),i=Number(e[2]??e[1]);if(!(i>2**53-1))for(let e=r;e<=i&&e<r+1e3;e++)t.add(e)}return[...t].sort((e,t)=>e-t)}function px(e){let t=e.match(/^(\s{0,8})([-+*]|\d{1,9}[.)])(?:([ \t]+)(.*))?$/);if(!t)return;let n=t[2],r=/\d/.test(n[0]);return{ordered:r,...r?{number:Number.parseInt(n,10)}:{},indent:t[1].length,marker:r?n.at(-1):n,contentIndent:t[1].length+n.length+(t[3]?.length??1),content:t[4]??``}}function mx(e){return e.match(/^ */)?.[0].length??0}function hx(e,t){let n=px(e);return/^ {0,3}(?:`{3,}|~{3,}|#{1,6}(?:\s|$)|([-*_])(?:\s*\1){2,}\s*$|>)/.test(e)||n!==void 0&&(!n.ordered||n.number===1)||!!t&&gx(e,t)}function gx(e,t){if(!e.includes(`|`))return!1;let n=_x(t);return n.length===_x(e).length&&n.every(e=>/^:?-+:?$/.test(e.trim()))}function _x(e){let t=e.trim(),n=[],r=``;for(let e=+!!t.startsWith(`|`);e<t.length;e++){let i=t[e];i===`\\`&&t[e+1]===`|`?(r+=`|`,e++):i===`|`?(n.push(r.trim()),r=``):r+=i}return!r&&t.endsWith(`|`)&&n.length||n.push(r.trim()),n}function vx(e){let t=e.trim();if(t.startsWith(`:`)&&t.endsWith(`:`))return`center`;if(t.endsWith(`:`))return`right`;if(t.startsWith(`:`))return`left`}function yx(e,t){return{type:`tableCell`,children:Kb(e,t)}}function bx(e,t={}){return(typeof e==`string`?sx(e,t):e).children.map(e=>xx(e,t)).join(`
1315
+ `)}function xx(e,t={}){let n=Mx(e,t);if(n!==void 0)return n;switch(e.type){case`heading`:{let n=e.id?` id="${Fb(e.id)}"`:``,r=e.framework?` data-framework="${Fb(e.framework)}"`:``;return`<h${e.depth}${n}${r}>${Cx(e.children,t)}${Nx(e.id,t)}</h${e.depth}>`}case`paragraph`:return`<p>${Cx(e.children,t)}</p>`;case`code`:return wx(e,t);case`list`:{let n=e.ordered?`ol`:`ul`;return`<${n}${e.ordered&&e.start!==void 0&&e.start!==1?` start="${e.start}"`:``}>\n${e.items.map(n=>`<li>${Tx(n.children,n.checked,e.loose,t)}</li>`).join(`
1316
+ `)}\n</${n}>`}case`blockquote`:return`<blockquote>\n${e.children.map(e=>xx(e,t)).join(`
1317
+ `)}\n</blockquote>`;case`table`:return`<table>${`<thead><tr>${e.header.map((n,r)=>jx(`th`,n,e.align[r],t)).join(``)}</tr></thead>`}${e.rows.length?`<tbody>${e.rows.map(n=>`<tr>${n.map((n,r)=>jx(`td`,n,e.align[r],t)).join(``)}</tr>`).join(``)}</tbody>`:``}</table>`;case`footnotes`:return Dx(e.items,t);case`thematicBreak`:return`<hr>`;case`html`:return t.allowHtml?e.value:Pb(e.value);case`callout`:return Ex(e,t);case`component`:return Ax(e,t)}}function Sx(e,t={}){let n=Mx(e,t);if(n!==void 0)return n;switch(e.type){case`text`:return Pb(e.value);case`inlineCode`:return`<code>${Pb(e.value)}</code>`;case`strong`:return`<strong>${Cx(e.children,t)}</strong>`;case`emphasis`:return`<em>${Cx(e.children,t)}</em>`;case`strike`:return`<del>${Cx(e.children,t)}</del>`;case`footnoteReference`:return`<sup><a id="user-content-fnref-${Fb(Gb(e.id,e.referenceIndex))}" data-footnote-ref="" aria-describedby="footnote-label" href="#user-content-fn-${Fb(e.id)}">${e.number}</a></sup>`;case`link`:return`<a href="${Fb(e.href)}"${e.title?` title="${Fb(e.title)}"`:``}>${Cx(e.children,t)}</a>`;case`image`:return`<img src="${Fb(e.src)}" alt="${Fb(e.alt)}"${e.title?` title="${Fb(e.title)}"`:``}>`;case`break`:return`<br>`;case`inlineHtml`:return t.allowHtml?e.value:Pb(e.value)}}function Cx(e,t){return e.map(e=>Sx(e,t)).join(``)}function wx(e,t){let n=e.lang??`plaintext`,r=`class="tm-code${t.codeLineNumbers?` tm-code--line-numbers`:``}" data-lang="${Fb(n)}"`+(e.title?` data-code-title="${Fb(e.title)}"`:``)+(e.file?` data-filename="${Fb(e.file)}"`:``)+(e.framework?` data-framework="${Fb(e.framework)}"`:``),i=t.highlighter?.(e.value,n,{...e.highlightLines&&{highlightLines:e.highlightLines},...t.codeLineNumbers!==void 0&&{lineNumbers:t.codeLineNumbers}})??Pb(e.value),a=`<pre ${r}><code class="language-${Fb(n)}">${i}</code></pre>`;return e.title?`<figure class="tm-code-frame" data-lang="${Fb(n)}"><figcaption>${Pb(e.title)}</figcaption>${a}</figure>`:a}function Tx(e,t,n,r){let i=t===void 0?``:`<input type="checkbox" disabled${t?` checked`:``}> `;for(let t=0;t<e.length;t++){let a=e[t];a.type===`paragraph`&&(!n||t===0)?(i+=Cx(a.children,r),n&&(i=`<p>${i}</p>`)):i+=(t?`
1318
+ `:``)+xx(a,r)}return i}function Ex(e,t){let n=e.kind.toLowerCase(),r=e.children.map(e=>xx(e,t)).join(`
1319
+ `);return`<div class="markdown-alert markdown-alert-${Fb(n)}"><p class="markdown-alert-title">${Pb(e.title)}</p><div class="markdown-alert-content">${r}</div></div>`}function Dx(e,t){let n=e.map(e=>`<li id="user-content-fn-${Fb(e.id)}">\n${Ox(e,t)}\n</li>`).join(`
1320
+ `);return`<section data-footnotes="" class="footnotes"><h2 id="footnote-label" class="sr-only">Footnotes${Nx(`footnote-label`,t)}</h2>\n<ol>\n${n}\n</ol>\n</section>`}function Ox(e,t){let n=kx(e),r=e.children.length-1,i=e.children.map((e,i)=>i===r&&e.type===`paragraph`?`<p>${Cx(e.children,t)}${n}</p>`:xx(e,t));return e.children[r]?.type!==`paragraph`&&i.push(`<p>${n.trimStart()}</p>`),i.join(`
1321
+ `)}function kx(e){let t=``;for(let n=1;n<=(e.referenceCount??1);n++){let r=Gb(e.id,n),i=n===1?`${e.number}`:`${e.number}-${n}`;t+=` <a data-footnote-backref="" aria-label="Back to reference ${i}" class="data-footnote-backref" href="#user-content-fnref-${Fb(r)}">&#8617;</a>`}return t}function Ax(e,t){let n=e.tagName??`md-comment-component`;return`<${n}${Px(e)}>${e.children.map(e=>xx(e,t)).join(`
1322
+ `)}</${n}>`}function jx(e,t,n,r){return`<${e}${n?` style="text-align:${n}"`:``}>${Cx(t.children,r)}</${e}>`}function Mx(e,t){for(let n of t.extensions??[]){let r=n.renderHtml?.(e,{options:t,renderBlock:e=>xx(e,t),renderInline:e=>Sx(e,t)});if(r!==void 0)return r}}function Nx(e,t){let n=t.headingAnchors;if(!e||!n)return``;let r=typeof n==`object`?n:{};return`<a href="#${Fb(e)}" aria-hidden="${r.ariaHidden??!0}" class="${Fb(r.className??`anchor-heading anchor-heading-link`)}" tabindex="${r.tabIndex??-1}">${Pb(r.content??`#`)}</a>`}function Px(e){let t={...e.properties};return e.tagName||(t[`data-component`]=e.name,t[`data-attributes`]||=JSON.stringify(e.attributes)),Object.entries(t).map(([e,t])=>` ${e}="${Fb(t)}"`).join(``)}function Fx(e,t={}){return(typeof e==`string`?sx(e,t):e).children.map((e,n)=>Ix(e,t,`b:${n}`))}function Ix(e,t={},n){switch(e.type){case`heading`:return $(t,`h${e.depth}`,{key:n,...e.id?{id:e.id}:{},...e.framework?{"data-framework":e.framework}:{}},Rx(e.children,t),Kx(e.id,t));case`paragraph`:return $(t,`p`,{key:n},Rx(e.children,t));case`code`:return zx(e,t,n);case`list`:return $(t,e.ordered?`ol`:`ul`,{key:n,...e.ordered&&e.start!==void 0&&e.start!==1?{start:e.start}:{}},e.items.map((n,r)=>$(t,`li`,{key:r},Bx(n.children,n.checked,e.loose,t,`${r}`))));case`blockquote`:return $(t,`blockquote`,{key:n},e.children.map((e,r)=>Ix(e,t,`${n}:${r}`)));case`table`:return $(t,`table`,{key:n},$(t,`thead`,null,$(t,`tr`,null,e.header.map((n,r)=>Vx(`th`,n,e.align[r],t,r)))),e.rows.length?$(t,`tbody`,null,e.rows.map((n,r)=>$(t,`tr`,{key:r},n.map((n,r)=>Vx(`td`,n,e.align[r],t,r))))):null);case`footnotes`:return Hx(e.items,t,n);case`thematicBreak`:return $(t,`hr`,{key:n});case`html`:return t.allowHtml?$(t,`div`,{key:n,dangerouslySetInnerHTML:{__html:e.value}}):$(t,`p`,{key:n},e.value);case`callout`:return $(t,`div`,{key:n,className:`markdown-alert markdown-alert-${e.kind.toLowerCase()}`},$(t,`p`,{className:`markdown-alert-title`},e.title),$(t,`div`,{className:`markdown-alert-content`},e.children.map((e,r)=>Ix(e,t,`${n}:${r}`))));case`component`:return Gx(e,t,n)}}function Lx(e,t={},n){switch(e.type){case`text`:return e.value;case`inlineCode`:return $(t,`code`,{key:n},e.value);case`strong`:return $(t,`strong`,{key:n},Rx(e.children,t));case`emphasis`:return $(t,`em`,{key:n},Rx(e.children,t));case`strike`:return $(t,`del`,{key:n},Rx(e.children,t));case`footnoteReference`:return $(t,`sup`,{key:n},$(t,`a`,{id:`user-content-fnref-${Gb(e.id,e.referenceIndex)}`,"data-footnote-ref":``,"aria-describedby":`footnote-label`,href:`#user-content-fn-${e.id}`},e.number));case`link`:return $(t,`a`,{key:n,href:e.href,...e.title?{title:e.title}:{}},Rx(e.children,t));case`image`:return $(t,`img`,{key:n,src:e.src,alt:e.alt,...e.title?{title:e.title}:{}});case`break`:return $(t,`br`,{key:n});case`inlineHtml`:return t.allowHtml?$(t,`span`,{key:n,dangerouslySetInnerHTML:{__html:e.value}}):e.value}}function Rx(e,t){return e.map((e,n)=>Lx(e,t,`i:${n}`))}function zx(e,t,n){let r=e.lang??`plaintext`,i=t.highlighter,a={className:`language-${r}`},o=i?void 0:e.value,s=i?{dangerouslySetInnerHTML:{__html:i(e.value,r,{...e.highlightLines&&{highlightLines:e.highlightLines},...t.codeLineNumbers!==void 0&&{lineNumbers:t.codeLineNumbers}})}}:void 0,c=$(t,`pre`,{className:`tm-code${t.codeLineNumbers?` tm-code--line-numbers`:``}`,"data-lang":r,...e.title?{"data-code-title":e.title}:{},...e.file?{"data-filename":e.file}:{},...e.framework?{"data-framework":e.framework}:{}},$(t,`code`,{...a,...s},o));return e.title?$(t,`figure`,{key:n,className:`tm-code-frame`,"data-lang":r},$(t,`figcaption`,null,e.title),c):$(t,G.Fragment,{key:n},c)}function Bx(e,t,n,r,i){let a=t===void 0?[]:[$(r,`input`,{key:`${i}:checkbox`,type:`checkbox`,disabled:!0,checked:t,readOnly:!0}),` `];for(let t=0;t<e.length;t++){let o=e[t];if(o.type===`paragraph`&&(!n||t===0)){for(let e of Rx(o.children,r))a.push(e);n&&(a=[$(r,`p`,{key:`${i}:paragraph`},a)])}else a.push(Ix(o,r,`${i}:${t}`))}return a}function Vx(e,t,n,r,i){return $(r,e,{key:i,...n?{style:{textAlign:n}}:{}},Rx(t.children,r))}function Hx(e,t,n){return $(t,`section`,{key:n,"data-footnotes":``,className:`footnotes`},$(t,`h2`,{id:`footnote-label`,className:`sr-only`},`Footnotes`,Kx(`footnote-label`,t)),$(t,`ol`,null,e.map(e=>$(t,`li`,{key:e.id,id:`user-content-fn-${e.id}`},Ux(e,t)))))}function Ux(e,t){let n=e.children.length-1,r=Wx(e,t),i=e.children.map((e,i)=>i===n&&e.type===`paragraph`?$(t,`p`,{key:i},Rx(e.children,t),r):Ix(e,t,`${i}`));return e.children[n]?.type!==`paragraph`&&i.push($(t,`p`,{key:`backref-wrapper`},r.slice(1))),i}function Wx(e,t){let n=[];for(let r=1;r<=(e.referenceCount??1);r++){let i=Gb(e.id,r),a=r===1?`${e.number}`:`${e.number}-${r}`;n.push(` `,$(t,`a`,{key:r,"data-footnote-backref":``,"aria-label":`Back to reference ${a}`,className:`data-footnote-backref`,href:`#user-content-fnref-${i}`},`↩`))}return n}function $(e,t,n,...r){let i=typeof t==`string`?e.components?.[t]??t:t;return(0,G.createElement)(i,n,...r)}function Gx(e,t,n){let r=e.tagName??`md-comment-component`,i={...e.properties??{}};return e.tagName||(i[`data-component`]=e.name,i[`data-attributes`]||=JSON.stringify(e.attributes)),$(t,r,{key:n,...i},e.children.map((e,r)=>Ix(e,t,`${n}:${r}`)))}function Kx(e,t){if(!e||!t.headingAnchors)return null;let n=typeof t.headingAnchors==`object`?t.headingAnchors:{};return $(t,`a`,{href:`#${e}`,"aria-hidden":n.ariaHidden??!0,className:n.className??`anchor-heading anchor-heading-link`,tabIndex:n.tabIndex??-1},n.content??`#`)}function qx(e){try{let t=new URL(e);return(t.protocol===`http:`||t.protocol===`https:`||t.protocol===`mailto:`)&&t.username===``&&t.password===``}catch{return!1}}var Jx=Rr.check(s()),Yx=Ln.check(Ae()).check(C({minimum:1,maximum:2**53-1}));Dt({reviewId:Jx,environmentId:an,host:an,protocol:bn(dn([`http`,`https`])),revision:bn(Yx),decision:bn(Jx)});var Xx=new Set(`details.summary.img.br.p.div.span.strong.b.em.i.del.s.a.ul.ol.li.blockquote.pre.code.h1.h2.h3.h4.h5.h6.table.thead.tbody.tr.th.td.hr.sup.sub.kbd.input`.split(`.`)),Zx=new Set([`script`,`style`,`iframe`,`object`,`embed`,`svg`,`math`,`template`]);function Qx(e,t){let n=new DOMParser().parseFromString(bx(e,{allowHtml:!0}),`text/html`),r=e=>Array.from(e.childNodes,(e,t)=>i(e,t)),i=(e,n)=>{if(e.nodeType===Node.TEXT_NODE){let n=e.textContent??``;return e.parentElement?.tagName===`DETAILS`&&n.trim()?Fx(n,{components:t}):n}if(!(e instanceof Element))return null;let i=e.tagName.toLowerCase();if(Zx.has(i))return null;if(!Xx.has(i))return r(e);let a={key:n};if(i===`input`){if(e.getAttribute(`type`)!==`checkbox`)return null;a.type=`checkbox`,a.disabled=!0,a.checked=e.hasAttribute(`checked`)}i===`ol`&&/^\d+$/.test(e.getAttribute(`start`)??``)&&(a.start=Number(e.getAttribute(`start`)));let o=e.getAttribute(`id`);if(o&&/^[A-Za-z][\w:.-]*$/.test(o)&&(a.id=o),i===`img`&&(a.src=e.getAttribute(`src`)??``,a.alt=e.getAttribute(`alt`)??``),i===`a`){let t=e.getAttribute(`href`)??``;(qx(t)||/^(?:#[^\s]*|\/(?![/\\])[^\s]*)$/.test(t))&&(a.href=t)}return i===`pre`&&(a[`data-lang`]=e.getAttribute(`data-lang`)??`text`),(0,G.createElement)(t[i]??i,a,...[`img`,`br`,`hr`,`input`].includes(i)?[]:r(e))};return r(n.body)}var $x={ts:`ts`,typescript:`ts`,tsx:`tsx`,js:`js`,javascript:`js`,jsx:`jsx`,json:`json`,bash:`sh`,sh:`sh`,shell:`sh`,css:`css`,html:`html`,md:`md`,markdown:`md`,yaml:`yaml`,yml:`yaml`,sql:`sql`,diff:`diff`};function eS(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(eS).join(``):(0,G.isValidElement)(e)?eS(e.props.children):``}function tS(e){let t=(0,q.c)(11),{dark:n}=Bi(),r=(e[`data-lang`]??`text`).toLowerCase(),i;if(t[0]!==e.children){let n;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=/\n$/,t[2]=n):n=t[2],i=eS(G.Children.toArray(e.children)).replace(n,``),t[0]=e.children,t[1]=i}else i=t[1];let a=i,o=`snippet.${$x[r]??`txt`}`,s;t[3]!==a||t[4]!==o?(s={name:o,contents:a},t[3]=a,t[4]=o,t[5]=s):s=t[5];let c=n?`dark`:`light`,l;t[6]===c?l=t[7]:(l=pa(c,{overflow:`wrap`}),t[6]=c,t[7]=l);let u;return t[8]!==s||t[9]!==l?(u=(0,K.jsx)(`div`,{className:`my-3 overflow-hidden rounded-lg border`,children:(0,K.jsx)(jb,{file:s,options:l})}),t[8]=s,t[9]=l,t[10]=u):u=t[10],u}function nS(e){let t=(0,q.c)(8),{src:n,alt:r}=e,[i,a]=(0,G.useState)();if(!n||!qx(n)||i===n){let e=r?`: ${r}`:``,n;return t[0]===e?n=t[1]:(n=(0,K.jsxs)(`span`,{className:`inline-block rounded border px-2 py-1 text-caption text-muted-foreground`,children:[`Image unavailable`,e]}),t[0]=e,t[1]=n),n}let o=r??``,s;t[2]===n?s=t[3]:(s=()=>a(n),t[2]=n,t[3]=s);let c;return t[4]!==n||t[5]!==o||t[6]!==s?(c=(0,K.jsx)(`img`,{src:n,alt:o,className:`my-2 h-auto max-w-full rounded`,referrerPolicy:`no-referrer`,onError:s}),t[4]=n,t[5]=o,t[6]=s,t[7]=c):c=t[7],c}var rS={img:nS,details:e=>(0,K.jsx)(`details`,{className:`my-3 rounded border p-3`,...e}),summary:e=>(0,K.jsx)(`summary`,{className:`cursor-pointer font-medium`,...e}),pre:tS,h1:e=>(0,K.jsx)(`h1`,{className:`mt-5 mb-2 text-lg font-semibold first:mt-0`,...e}),h2:e=>(0,K.jsx)(`h2`,{className:`mt-5 mb-2 text-base font-semibold first:mt-0`,...e}),h3:e=>(0,K.jsx)(`h3`,{className:`mt-4 mb-1.5 text-sm font-semibold`,...e}),p:e=>(0,K.jsx)(`p`,{className:`my-2 leading-relaxed`,...e}),ul:e=>(0,K.jsx)(`ul`,{className:`my-2 list-disc pl-5`,...e}),ol:e=>(0,K.jsx)(`ol`,{className:`my-2 list-decimal pl-5`,...e}),li:e=>(0,K.jsx)(`li`,{className:`my-0.5`,...e}),a:e=>(0,K.jsx)(`a`,{className:`text-foreground underline underline-offset-2`,target:`_blank`,rel:`noreferrer`,...e}),code:e=>(0,K.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-[0.9em]`,...e}),blockquote:e=>(0,K.jsx)(`blockquote`,{className:`my-3 border-l-2 pl-3 text-muted-foreground`,...e}),table:e=>(0,K.jsx)(`div`,{className:`my-3 overflow-x-auto rounded-lg border`,children:(0,K.jsx)(`table`,{className:`w-full text-left text-caption`,...e})}),th:e=>(0,K.jsx)(`th`,{className:`border-b bg-muted/60 px-3 py-1.5 font-medium`,...e}),td:e=>(0,K.jsx)(`td`,{className:`border-b px-3 py-1.5 last:border-b-0`,...e}),hr:()=>(0,K.jsx)(`hr`,{className:`my-4`})};function iS(e){let t=(0,q.c)(7),{text:n,className:r}=e,i;t[0]===r?i=t[1]:(i=H(`text-ui text-foreground`,r),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=Qx(n,rS),t[2]=n,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,K.jsx)(`div`,{className:i,children:a}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}var aS=P(e=>m(t=>e.paths.map(n=>t(T({...e,path:n}))))),oS=P(e=>xe((t,n)=>{for(let t of e.paths)n.refresh(T({...e,path:t}));return null}));function sS(e,t,n){let r=(0,q.c)(14),i={connection:e,scope:t,paths:n},a=B(aS(i)),o=p(oS(i)),s;if(r[0]!==n||r[1]!==a){let e;r[3]===a?e=r[4]:(e=(e,t)=>{let n=a[t],r=n?pn(Ht(n)):void 0;return r&&`text`in r?[[e,r.text]]:[]},r[3]=a,r[4]=e),s=new Map(n.flatMap(e)),r[0]=n,r[1]=a,r[2]=s}else s=r[2];let c;r[5]===a?c=r[6]:(c=a.some(sr),r[5]=a,r[6]=c);let l;r[7]===a?l=r[8]:(l=a.some(Wn),r[7]=a,r[8]=l);let u;return r[9]!==o||r[10]!==s||r[11]!==c||r[12]!==l?(u={contents:s,pending:c,failed:l,retry:o},r[9]=o,r[10]=s,r[11]=c,r[12]=l,r[13]=u):u=r[13],u}var cS=(0,G.lazy)(()=>Pa(()=>import(`./file-editor-oLgfLZbs.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])));function lS(e){let t=(0,q.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,K.jsx)(`p`,{role:`status`,className:`p-3.5 text-xs text-muted-foreground`,children:`Loading editor…`}),t[0]=n):n=t[0];let r;return t[1]===e?r=t[2]:(r=(0,K.jsx)(G.Suspense,{fallback:n,children:(0,K.jsx)(cS,{...e})}),t[1]=e,t[2]=r),r}var uS=/url\(\s*(['"]?)([^)'"]+)\1\s*\)|@import\s+(['"])([^'"]+)\3/g,dS=`default-src 'none'; script-src 'unsafe-inline' data:; style-src 'unsafe-inline' data:; img-src data: blob:; font-src data:; connect-src 'none'; form-action 'none'; base-uri 'none'; frame-src 'none'`;function fS(e){let t=window.document.implementation.createHTMLDocument(),n=t.createElement(`meta`);n.httpEquiv=`Content-Security-Policy`,n.content=dS;let r=t.createElement(`style`);r.textContent=`html, body { height: 100%; margin: 0; } iframe { display: block; width: 100%; height: 100%; border: 0; color-scheme: inherit; }`,t.head.replaceChildren(n,r),t.documentElement.style.colorScheme=`light dark`;let i=t.createElement(`iframe`);return i.title=`Preview content`,i.setAttribute(`aria-label`,`Preview content`),i.sandbox.add(`allow-scripts`),i.referrerPolicy=`no-referrer`,i.srcdoc=e,t.body.append(i),`<!doctype html>${t.documentElement.outerHTML}`}var pS=z(`BrowserHtmlPreview.inlineAssets`)(function*(e,t,n){let r=`https://porcelain-preview.invalid/`,i=t.includes(`/`)?`${t.slice(0,t.lastIndexOf(`/`))}/`:``,a=new URL(i,r),o=new Set,s=new Map,c=0;function l(e,t){if(e.startsWith(`data:`)||e.startsWith(`#`))return null;let n=new URL(e,new URL(t,r));if(n.origin!==a.origin)throw Error(`External asset`);if(!n.pathname.startsWith(a.pathname))throw Error(`Outside the document folder`);return{path:decodeURIComponent(n.pathname.slice(1)),hash:n.hash}}function u(e,t){let n=[];for(let r of e.matchAll(uS)){let e=(r[2]??r[4]??``).trim();try{let r=l(e,t);r&&n.push(r.path)}catch{o.add(e)}}return n}function d(e){return new TextDecoder().decode(Uint8Array.from(atob(e.base64),e=>e.charCodeAt(0)))}function f(e,t,n){try{let r=l(e,t);if(r===null)return e;let i=s.get(r.path);if(!i)throw Error(`Unavailable`);if(n.includes(r.path))throw Error(`Circular stylesheet`);let a=(i.mediaType===`text/css`?`data:text/css;charset=utf-8,${encodeURIComponent(p(d(i),r.path,[...n,r.path]))}`:T_(i))+r.hash;if(c+a.length>29360128)throw Error(`Expanded preview too large`);return c+=a.length,a}catch{return o.add(e),`data:,`}}function p(e,t,n=[]){let r=``,i=0;for(let a of e.matchAll(uS)){r+=e.slice(i,a.index);let o=f((a[2]??a[4]??``).trim(),t,n);r+=a[4]?`@import url("${o}")`:`url("${o}")`,i=a.index+a[0].length}return r+e.slice(i)}let m=new DOMParser().parseFromString(e,`text/html`);for(let e of m.querySelectorAll(`base, meta[http-equiv]`))e.remove();let h=[...m.querySelectorAll(`link[href], img[src], script[src], source[src], video[poster], image[href]`)].map(e=>({node:e,attribute:e.hasAttribute(`href`)?`href`:e.hasAttribute(`poster`)?`poster`:`src`})),g=[...m.querySelectorAll(`[srcset]`)],_=[...m.querySelectorAll(`style`),...m.querySelectorAll(`[style]`)],v=[],y=e=>{try{let n=l(e,t);n&&v.push(n.path)}catch{o.add(e)}};for(let{node:e,attribute:t}of h)y(e.getAttribute(t)??``);for(let e of g)for(let t of mS(e.getAttribute(`srcset`)??``))y(t.url);for(let e of _)v.push(...u(e.tagName===`STYLE`?e.textContent??``:e.getAttribute(`style`)??``,t));s=yield*lr(v,n,u);for(let{node:e,attribute:n}of h)e.setAttribute(n,f(e.getAttribute(n)??``,t,[])),e.removeAttribute(`integrity`),e.removeAttribute(`crossorigin`);for(let e of g)e.setAttribute(`srcset`,mS(e.getAttribute(`srcset`)??``).map(e=>`${f(e.url,t,[])}${e.descriptor?` ${e.descriptor}`:``}`).join(`, `));for(let e of m.querySelectorAll(`style`))e.textContent=p(e.textContent??``,t);for(let e of m.querySelectorAll(`[style]`))e.setAttribute(`style`,p(e.getAttribute(`style`)??``,t));let b=m.createElement(`meta`);return b.httpEquiv=`Content-Security-Policy`,b.content=dS,m.head.prepend(b),{html:`<!doctype html>${m.documentElement.outerHTML}`,missing:[...o]}});function mS(e){return[...e.matchAll(/(data:[^\s]+|[^,\s]+)(?:\s+(\d+(?:\.\d+)?[wx]))?\s*,?/g)].map(e=>({url:(e[1]??``).replace(/,$/,``),descriptor:e[2]??``}))}var hS=ir(Nn,{render:(e,t,n)=>pS(e,t,n).pipe(Ve(()=>d(new Sr)))});function gS(e){let t=(0,q.c)(11),{html:n,title:r,className:i}=e,{dark:a}=Bi(),o;t[0]===n?o=t[1]:(o=fS(n),t[0]=n,t[1]=o);let s=a?`dark`:`light`,c;t[2]===s?c=t[3]:(c={colorScheme:s},t[2]=s,t[3]=c);let l;t[4]===i?l=t[5]:(l=H(`block min-h-128 w-full border-0 bg-transparent`,i),t[4]=i,t[5]=l);let u;return t[6]!==o||t[7]!==c||t[8]!==l||t[9]!==r?(u=(0,K.jsx)(`iframe`,{title:r,"aria-label":r,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,srcDoc:o,style:c,className:l}),t[6]=o,t[7]=c,t[8]=l,t[9]=r,t[10]=u):u=t[10],u}function _S(e){let t=(0,q.c)(14),{scope:n,path:r,html:i,connection:a}=e,o=D_(a,n,r,i,hS);if(sr(o)){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,K.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading preview…`}),t[0]=e):e=t[0],e}if(Wn(o)){let e;t[1]===o.cause?e=t[2]:(e=la(xr(o.cause)),t[1]=o.cause,t[2]=e);let n;return t[3]===e?n=t[4]:(n=(0,K.jsx)(`p`,{role:`alert`,className:`p-4`,children:e}),t[3]=e,t[4]=n),n}let s,c;t[5]===o?(s=t[6],c=t[7]):(s=zn(Ht(o)),c=s.missing.length>0&&(0,K.jsxs)(`p`,{role:`status`,className:`px-4 py-2 text-xs text-muted-foreground`,children:[`Some assets could not be loaded: `,s.missing.join(`, `),`. This preview supports local static assets.`]}),t[5]=o,t[6]=s,t[7]=c);let l=`${r} HTML preview`,u;t[8]!==s.html||t[9]!==l?(u=(0,K.jsx)(gS,{html:s.html,title:l,className:`min-h-0 flex-1`}),t[8]=s.html,t[9]=l,t[10]=u):u=t[10];let d;return t[11]!==c||t[12]!==u?(d=(0,K.jsxs)(K.Fragment,{children:[c,u]}),t[11]=c,t[12]=u,t[13]=d):d=t[13],d}function vS(e,t,n){let r=(0,q.c)(4),i;return r[0]!==e||r[1]!==n||r[2]!==t?(i=$e({connection:e,scope:t,path:n}),r[0]=e,r[1]=n,r[2]=t,r[3]=i):i=r[3],ba(i).value}function yS(e,t,n){let r=(0,q.c)(9),i={connection:e,scope:t,paths:n},a=B(Mr(i)),o=p(A(i)),s;if(r[0]!==n||r[1]!==a){let e;r[3]===n?e=r[4]:(e=(e,t)=>{let r=n[t]??``;if(Wn(e))return{path:r,status:`unavailable`};let i=pn(Ht(e));return i?{path:r,status:`loaded`,entries:i.entries}:{path:r,status:`loading`}},r[3]=n,r[4]=e),s=a.map(e),r[0]=n,r[1]=a,r[2]=s}else s=r[2];let c=s,l;return r[5]!==a||r[6]!==o||r[7]!==c?(l={results:a,states:c,retry:o},r[5]=a,r[6]=o,r[7]=c,r[8]=l):l=r[8],l}function bS(e){return kr(`alert-dialog`,e)}var xS=class extends Ms{};function SS(){return new xS}function CS({...e}){return(0,K.jsx)(bS,{"data-slot":`alert-dialog`,...e})}function wS({...e}){return(0,K.jsx)(E,{"data-slot":`alert-dialog-portal`,...e})}function TS({className:e,...t}){return(0,K.jsx)(o,{"data-slot":`alert-dialog-overlay`,className:H(`fixed inset-0 isolate z-50 bg-black/80 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function ES({className:e,size:t=`default`,...n}){return(0,K.jsxs)(wS,{children:[(0,K.jsx)(TS,{}),(0,K.jsx)(S,{"data-slot":`alert-dialog-content`,"data-size":t,className:H(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-3 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-64 data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...n})]})}function DS({className:e,...t}){return(0,K.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:H(`grid grid-rows-[auto_1fr] place-items-center gap-1 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function OS({className:e,...t}){return(0,K.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:H(`flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function kS({className:e,...t}){return(0,K.jsx)(Ge,{"data-slot":`alert-dialog-title`,className:H(`font-heading text-sm font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function AS({className:e,...t}){return(0,K.jsx)(ke,{"data-slot":`alert-dialog-description`,className:H(`text-xs/relaxed text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function jS({className:e,...t}){return(0,K.jsx)(wn,{"data-slot":`alert-dialog-action`,className:H(e),...t})}function MS({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,K.jsx)(Cn,{"data-slot":`alert-dialog-cancel`,className:H(e),render:(0,K.jsx)(wn,{variant:t,size:n}),...r})}var NS=P(e=>Ot(e,[`branch`,e.base??null],t=>t.changes.readBranchChanges({params:{worktreeId:e.scope.worktreeId},query:{base:e.base}}),t=>t.worktreeId===e.scope.worktreeId)),PS=P(e=>Ot(e,[`branch-bases`],t=>t.changes.listBranchBases({params:{worktreeId:e.scope.worktreeId}}))),FS=P(({connection:e,scope:t,input:n})=>v(e,t,[`change-diffs`,n],at(function*(){let r=yield*(yield*fe(e)).request(e=>e.changes.readChangeDiffs({params:{worktreeId:t.worktreeId},payload:n}));return yield*I(e,r.environmentId===e.environmentId&&r.worktreeId===t.worktreeId&&r.statusToken===n.expectedStatusToken),r}),tr(e),n.expectedFiles.map(e=>e.path))),IS=P(({connection:e,scope:t,input:n})=>v(e,t,[`branch-diffs`,n],at(function*(){return yield*(yield*fe(e)).request(e=>e.changes.readBranchDiffs({params:{worktreeId:t.worktreeId},payload:n}))}),tr(e))),LS=P(({connection:e,scope:t,oid:n,parent:r,paths:i})=>v(e,t,[`commit-diffs`,n,r,i],at(function*(){let a=yield*(yield*fe(e)).request(e=>e.changes.readCommitDiffs({params:{worktreeId:t.worktreeId,oid:n},payload:{...r===1?{}:{parent:r},paths:i.map(e=>[...e])}}));return yield*I(e,a.commitOid===n),a}),tr(e)));function RS(e){return new Map(e.diffs.map(e=>[`selection`in e?ns(e.selection):e.paths.join(`\0`),e.content]))}var zS=P(e=>re(t=>e.map(e=>br(t(e),RS)),t=>{for(let n of e)t(n)})),BS=P(e=>m(t=>he(tt(e,e=>he(t.result(e,{suspendOnWaiting:!0}),RS),{concurrency:`unbounded`}),e=>new Map(e.flatMap(e=>[...e])))).pipe(ee(0)));function VS(e,t){return i(t.map(t=>nt.reviewSurface(e.connection.environmentId,e.scope,[t])))}var HS=P(e=>tr(e.connection).fn(z(`Changes.readCurrent`)(t=>Le(Rn(e),()=>VS(e,[`changes`]))))),US=P(e=>tr(e.connection).fn(z(`Changes.refreshGitLook`)(t=>Le(Rn(e),()=>VS(e,[`changes`,`git-status`]))))),WS=P(e=>tr(e.connection).fn(z(`Changes.readCurrentGitStatus`)(t=>Le(on(e),()=>VS(e,[`git-status`]))))),GS=class e extends Ut()(`@porcelain/client/ChangedDiffRecovery`){static layer=pr(e,at(function*(){let e=yield*gt({attempted:{},pending:{}});return{state:me(e),changes:nr(e),begin:z(`ChangedDiffRecovery.begin`)((t,n)=>ft(e,e=>e.attempted[t]===n?[!1,e]:[!0,{attempted:{...e.attempted,[t]:n},pending:{...e.pending,[t]:n}}])),finish:z(`ChangedDiffRecovery.finish`)((t,n)=>vt(e,e=>{if(e.pending[t]!==n)return e;let r={...e.pending};return delete r[t],{...e,pending:r}}))}}))},KS=P(e=>e.atoms(t=>Vn(GS.layer,t(tr(e).layer)))),qS=P(e=>KS(e.connection).fn(z(`Changes.recoverDiffs`)(function*(t,n){let r=yield*GS,i=JSON.stringify([e.scope.projectId,e.scope.worktreeId]);if(!(yield*r.begin(i,t)))return;let a=Zn(e);return n.refresh(a),yield*Wr(n.result(a,{suspendOnWaiting:!0}),r.finish(i,t))}),{concurrent:!0})),JS=P(({connection:e,scope:t,statusToken:n})=>KS(e).atom(Bn(he(GS,e=>e.changes)).pipe(qt(e=>{let r=JSON.stringify([t.projectId,t.worktreeId]);return{pending:e.pending[r]===n,attempted:e.attempted[r]===n}})))),YS=P(e=>{let{connection:t,scope:n,statusToken:r}=e,i=os(e.expectedFiles,e.selections,200).map(e=>FS({connection:t,scope:n,input:{expectedStatusToken:r,expectedFiles:e.expectedFiles,selections:e.selections}})),a=zS(i),o=BS(i),s=qS({connection:t,scope:n});return re(t=>{t.mount(s);let n=t(a),i=t(JS(e));return It(i)&&!i.value.attempted&&n.some(e=>Wn(e)&&ge(xr(e.cause)))&&t.set(s,r),{result:t(o),recovery:i}},e=>e(a)).pipe(ee(0))}),XS=class e extends Ut()(`@porcelain/client/ReviewedFilesState`){static layer(t,n,r){return pr(e,at(function*(){let e=yield*fe(t),i=yield*gt([]),a=As(r),o=yield*ne(t,nt.reviewSurface(t.environmentId,n,a),at(function*(){let i=yield*e.request(e=>e.reviewedFiles.listReviewedFiles({params:{worktreeId:n.worktreeId},query:r.kind===`branch`?{scope:`branch`,branch:r.branch}:{}}));return yield*I(t,i.worktreeId===n.worktreeId),i}),Br(),nt.worktreeReads(t,n,a));return{stream:rr(o.stream,nr(i),(e,t)=>br(e,e=>js(e,t))),confirm:(e,r)=>Yt(a=>at(function*(){yield*a(I(t));let s={id:Symbol(),changes:e,reviewedAt:M(yield*ae)};return yield*vt(i,e=>[...e,s]),yield*a(o.confirm(r.pipe(Le(e=>I(t,e.worktreeId===n.worktreeId))),(e,t)=>kt({worktreeId:t.worktreeId,marks:t.marks}))).pipe(Wr(vt(i,e=>e.filter(e=>e.id!==s.id))))}))}}))}},ZS=P(({connection:e,scope:t,range:n})=>e.atoms(r=>Vn(XS.layer(e,t,n),r(tr(e).layer))));function QS(e){return ZS({...e,range:ks(e.range)})}var $S=P(e=>Ar(e.scope,`reviewed`,XS,QS(e)).pipe(Nr));function eC({range:e=gs,...t}){return $S({...t,range:ks(e)})}var tC=P(({connection:e,scope:t,range:n})=>{let r=QS({connection:e,scope:t,range:n}),i={worktreeId:t.worktreeId},a=n.kind===`branch`?{scope:`branch`,branch:n.branch}:{};function o(e,t){return rt(XS,n=>n.confirm(e,t))}let s=z(`Reviews.markFile`)(function*(t){let r=yield*fe(e);return yield*o([t],r.request(e=>n.kind===`branch`?e.reviewedFiles.setReviewedFile({params:i,payload:{...t,reviewed:!0,scope:`branch`,base:n.base}}):e.reviewedFiles.setReviewedFile({params:i,payload:{...t,reviewed:!0}})))}),c=z(`Reviews.unmarkFile`)(function*(t){let n=yield*fe(e);return yield*o([{path:t}],n.request(e=>e.reviewedFiles.removeReviewedFile({params:i,query:{path:t,...a}})))}),l=z(`Reviews.markFiles`)(function*(t){return yield*o(t,(yield*fe(e)).request(e=>n.kind===`branch`?e.reviewedFiles.setReviewedFiles({params:i,payload:{files:t,scope:`branch`,base:n.base}}):e.reviewedFiles.setReviewedFiles({params:i,payload:{files:t}})))}),u=z(`Reviews.unmarkFiles`)(function*(t){let n=yield*fe(e);return yield*o(t.map(e=>({path:e})),n.request(e=>e.reviewedFiles.removeReviewedFiles({params:i,payload:{paths:[...t],...a}})))});return{set:r.fn(s,{concurrent:!0}),remove:r.fn(c,{concurrent:!0}),bulk:r.fn(z(`Reviews.reviewFiles`)(function*(e){if(e.kind===`unmark`){for(let t of vs(e.paths,gn))yield*u(t);return{kind:`unmark`}}let t=bs(e.entries),n=t.report;for(let e of vs(t.files,gn))n=xs(n,yield*l(e));return{kind:`mark`,report:n}}),{concurrent:!0})}});function nC(e,t){if(Wn(e))return xr(e.cause);if(Wn(t))return xr(t.cause)}function rC(e,t){let n=(0,q.c)(3),r;return n[0]!==t||n[1]!==e?(r=Zn({scope:e,connection:t}),n[0]=t,n[1]=e,n[2]=r):r=n[2],ba(r).value}function iC(e,t){let n=(0,q.c)(3),r;return n[0]!==t||n[1]!==e?(r=Zn({scope:e,connection:t}),n[0]=t,n[1]=e,n[2]=r):r=n[2],B(r)}function aC(e,t,n,r,i){let a=(0,q.c)(21),o;a[0]!==t||a[1]!==r||a[2]!==e||a[3]!==i||a[4]!==n?(o=YS({scope:e,connection:t,statusToken:n,expectedFiles:r,selections:i}),a[0]=t,a[1]=r,a[2]=e,a[3]=i,a[4]=n,a[5]=o):o=a[5];let s=o,{result:c,recovery:l}=B(s),u;a[6]===l?u=a[7]:(u=$t(Ht(l),oC),a[6]=l,a[7]=u);let d=u,f;a[8]===c?f=a[9]:(f=It(c)?c.value:new Map,a[8]=c,a[9]=f);let p;a[10]!==d||a[11]!==c?(p=sr(c)||d,a[10]=d,a[11]=c,a[12]=p):p=a[12];let m;a[13]!==d||a[14]!==c?(m=Wn(c)&&!d,a[13]=d,a[14]=c,a[15]=m):m=a[15];let h=Kr(s),g;return a[16]!==f||a[17]!==p||a[18]!==m||a[19]!==h?(g={diffs:f,pending:p,failed:m,retry:h},a[16]=f,a[17]=p,a[18]=m,a[19]=h,a[20]=g):g=a[20],g}function oC(e){return e.pending}var sC=m(Tt());function cC(e,t,n){let r=(0,q.c)(11),i=n===void 0||n,a;r[0]!==t||r[1]!==e?(a=fn({connection:t,scope:e}),r[0]=t,r[1]=e,r[2]=a):a=r[2];let o=a,s=B(i?o:sC),c;r[3]!==t||r[4]!==e?(c=WS({connection:t,scope:e}),r[3]=t,r[4]=e,r[5]=c):c=r[5];let l;r[6]===Symbol.for(`react.memo_cache_sentinel`)?(l={mode:`promise`},r[6]=l):l=r[6];let u=p(c,l),d=Kr(i?o:sC),f;return r[7]!==s||r[8]!==u||r[9]!==d?(f={result:s,read:u,refresh:d},r[7]=s,r[8]=u,r[9]=d,r[10]=f):f=r[10],f}function lC(e,t){if(!$o(t))return null;let n=Zi(t.patch),r=Xy(t.patch,{cacheKeyPrefix:`${rs(e)}:${n}`}).flatMap(e=>e.files),i=r.length===1?r[0]:void 0;return i?{id:rs(e),kind:`diff`,path:ts(e),fileDiff:i,version:n,note:`${e.scope} · ${e.kind}`}:null}function uC(e,t,n){let r=es(t,n);if(!r||n?.kind!==`text`)return null;let i=Zi(n.patch),a=Xy(n.patch,{cacheKeyPrefix:`${e}:${r}:${i}`}).flatMap(e=>e.files),o=a[0];return o?{id:`commit:${e}:${r}`,kind:`diff`,path:r,fileDiff:o,lineCounts:a.flatMap(e=>e.hunks).reduce((e,t)=>({added:e.added+t.additionLines,removed:e.removed+t.deletionLines}),{added:0,removed:0}),version:i,note:t.status}:null}function dC(e,t){let n=(0,q.c)(4),r;n[0]!==t||n[1]!==e?(r=HS({connection:t,scope:e}),n[0]=t,n[1]=e,n[2]=r):r=n[2];let i;return n[3]===Symbol.for(`react.memo_cache_sentinel`)?(i={mode:`promise`},n[3]=i):i=n[3],p(r,i)}function fC(e,t){let n=(0,q.c)(4),r;n[0]!==t||n[1]!==e?(r=US({connection:t,scope:e}),n[0]=t,n[1]=e,n[2]=r):r=n[2];let i;return n[3]===Symbol.for(`react.memo_cache_sentinel`)?(i={mode:`promise`},n[3]=i):i=n[3],p(r,i)}function pC(e){let t=(0,q.c)(5),n;t[0]===e?n=t[1]:(n=zS(e),t[0]=e,t[1]=n);let r=n,i=B(r),a=Kr(r),o;return t[2]!==i||t[3]!==a?(o={results:i,retry:a},t[2]=i,t[3]=a,t[4]=o):o=t[4],o}function mC(e){let t=(0,q.c)(11),n=pC(e),r;t[0]===n.results?r=t[1]:(r=new Map(n.results.flatMap(hC)),t[0]=n.results,t[1]=r);let i;t[2]===n.results?i=t[3]:(i=n.results.some(sr),t[2]=n.results,t[3]=i);let a;t[4]===n.results?a=t[5]:(a=n.results.some(Wn),t[4]=n.results,t[5]=a);let o;return t[6]!==n.retry||t[7]!==r||t[8]!==i||t[9]!==a?(o={patches:r,pending:i,failed:a,retry:n.retry},t[6]=n.retry,t[7]=r,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}function hC(e){return Pr(Ht(e)).flatMap(gC)}function gC(e){return[...e]}var _C=m(Tt()),vC=m(Tt());function yC(e,t,n){let r=(0,q.c)(7),i;r[0]!==n||r[1]!==t||r[2]!==e?(i=e?NS({connection:t,scope:e,...n===void 0?{}:{base:n}}):vC,r[0]=n,r[1]=t,r[2]=e,r[3]=i):i=r[3];let a=i,o=B(a),s=Kr(a),c;return r[4]!==o||r[5]!==s?(c={result:o,refresh:s},r[4]=o,r[5]=s,r[6]=c):c=r[6],c}function bC(e,t,n){let r=(0,q.c)(7),i;r[0]!==t||r[1]!==n||r[2]!==e?(i=n?PS({connection:t,scope:e}):_C,r[0]=t,r[1]=n,r[2]=e,r[3]=i):i=r[3];let a=i,o=B(a),s=Kr(a),c;return r[4]!==o||r[5]!==s?(c={result:o,refresh:s},r[4]=o,r[5]=s,r[6]=c):c=r[6],c}function xC(e,t,n,r){let i=(0,q.c)(5),a;return i[0]!==t||i[1]!==r||i[2]!==n||i[3]!==e?(a=n?ss(r,25).map(r=>IS({connection:t,scope:e,input:{baseOid:n.baseOid,headOid:n.headOid,paths:r.map(SC)}})):[],i[0]=t,i[1]=r,i[2]=n,i[3]=e,i[4]=a):a=i[4],mC(a)}function SC(e){return[...e]}function CC(e,t,n,r,i){let a=(0,q.c)(11),o;if(a[0]!==e||a[1]!==n||a[2]!==r||a[3]!==i||a[4]!==t){let s;a[6]!==e||a[7]!==n||a[8]!==r||a[9]!==t?(s=i=>LS({connection:e,scope:t,oid:n,parent:r,paths:i}),a[6]=e,a[7]=n,a[8]=r,a[9]=t,a[10]=s):s=a[10],o=ss(i,25).map(s),a[0]=e,a[1]=n,a[2]=r,a[3]=i,a[4]=t,a[5]=o}else o=a[5];return mC(o)}function wC(e,t){let n=(0,q.c)(7),r;n[0]!==e||n[1]!==t?(r=Qe({connection:e,projectId:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2];let i;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(i={mode:`promise`},n[3]=i):i=n[3];let[a,o]=se(r,i),s;return n[4]!==a||n[5]!==o?(s={result:a,submit:o},n[4]=a,n[5]=o,n[6]=s):s=n[6],s}function TC(e,t){let n=(0,q.c)(5),r=wC(e,t),i;n[0]===r?i=n[1]:(i=e=>r.submit({path:ca(e.path),flag:`hidden`,value:e.hidden}),n[0]=r,n[1]=i);let a;return n[2]!==r||n[3]!==i?(a={...r,submit:i},n[2]=r,n[3]=i,n[4]=a):a=n[4],a}function EC(e,t){let n=(0,q.c)(5),r=wC(e,t),i;n[0]===r?i=n[1]:(i=e=>r.submit({path:ca(e.path),flag:`pinned`,value:e.pinned}),n[0]=r,n[1]=i);let a;return n[2]!==r||n[3]!==i?(a={...r,submit:i},n[2]=r,n[3]=i,n[4]=a):a=n[4],a}var DC=m(void 0);function OC(e,t,r,i){let a=(0,q.c)(13),o;a[0]===e?o=a[1]:(o=xt(e),a[0]=e,a[1]=o);let s;a[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={mode:`promiseExit`},a[2]=s):s=a[2];let[c,l]=se(o,s),u=p(DC),d;a[3]!==r||a[4]!==l||a[5]!==c||a[6]!==t||a[7]!==i||a[8]!==u?(d=e=>{if(!c.waiting)return l({path:e,remote:t,complete:()=>{u(void 0),r()},select:e=>n({try:()=>i(e),catch:kC})})},a[3]=r,a[4]=l,a[5]=c,a[6]=t,a[7]=i,a[8]=u,a[9]=d):d=a[9];let f=d,m;return a[10]!==c||a[11]!==f?(m={result:c,submit:f},a[10]=c,a[11]=f,a[12]=m):m=a[12],m}function kC(e){return new Un({message:`Could not open the selected worktree.`,cause:e})}function AC(){let e=(0,q.c)(2),t=p(DC),n;return e[0]===t?n=e[1]:(n=e=>{e||t(void 0)},e[0]=t,e[1]=n),n}var jC=ct(xn.layer).atom(xn),MC=P(e=>e.atoms(xn.layer).fn((t,r)=>at(function*(){let i=yield*(yield*xn).pickProject(e.address);i!==null&&(yield*r.setResult(xt(e),{path:i,remote:null,complete:()=>void 0,select:e=>n({try:()=>t(e),catch:e=>new Un({message:`Could not open the selected worktree.`,cause:e})})}))})));function NC(e,t,n){let r=(0,q.c)(3),i=pn(Ht(B(jC))),a;r[0]===e?a=r[1]:(a=MC(e),r[0]=e,r[1]=a);let o;r[2]===Symbol.for(`react.memo_cache_sentinel`)?(o={mode:`promiseExit`},r[2]=o):o=r[2];let[s,c]=se(a,o);return i?.canPickProject(e.address)&&(()=>{s.waiting||c(t).then(e=>{if(Kn(e)){let t=xr(e.cause);n(t instanceof Error?t:new Un({message:`Could not open the selected worktree.`,cause:t}))}})})}var PC=Ns(),FC=Ns(),IC=Ns(),LC=SS(),RC=SS(),zC=SS(),BC=Ns();function VC(e,t){let n=(0,q.c)(6),r;n[0]!==e||n[1]!==t?(r=zr({connection:e,projectId:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2];let i=r,a=B(i),o=Kr(i),s;return n[3]!==a||n[4]!==o?(s={result:a,refresh:o},n[3]=a,n[4]=o,n[5]=s):s=n[5],s}function HC(e,t){let n=(0,q.c)(3),r;return n[0]!==e||n[1]!==t?(r=zr({connection:e,projectId:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],ba(r).value}function UC(e,t){let n=(0,q.c)(2),r=HC(e,t),i;return n[0]===r.preferences?i=n[1]:(i=new Set(r.preferences.filter(GC).map(WC)),n[0]=r.preferences,n[1]=i),i}function WC(e){return e.path}function GC(e){return e.hidden}function KC(e,t){let n=(0,q.c)(2),r=HC(e,t),i;return n[0]===r.preferences?i=n[1]:(i=r.preferences.filter(JC).map(qC),n[0]=r.preferences,n[1]=i),i}function qC(e){return e.path}function JC(e){return e.pinned}function YC(e){let t=(0,q.c)(2),n;return t[0]===e?n=t[1]:(n=Gr(e),t[0]=e,t[1]=n),ba(n).value}function XC({...e}){return(0,K.jsx)(g,{"data-slot":`dialog`,...e})}function ZC({...e}){return(0,K.jsx)(E,{"data-slot":`dialog-portal`,...e})}function QC({...e}){return(0,K.jsx)(Cn,{"data-slot":`dialog-close`,...e})}function $C({className:e,...t}){return(0,K.jsx)(o,{"data-slot":`dialog-overlay`,className:H(`fixed inset-0 isolate z-50 bg-black/80 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function ew({className:e,children:t,showCloseButton:n=!0,...r}){return(0,K.jsxs)(ZC,{children:[(0,K.jsx)($C,{}),(0,K.jsxs)(S,{"data-slot":`dialog-content`,className:H(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-xs/relaxed text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n&&(0,K.jsxs)(Cn,{"data-slot":`dialog-close`,render:(0,K.jsx)(wn,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`}),children:[(0,K.jsx)(un,{}),(0,K.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function tw({className:e,...t}){return(0,K.jsx)(`div`,{"data-slot":`dialog-header`,className:H(`flex flex-col gap-1`,e),...t})}function nw({className:e,showCloseButton:t=!1,children:n,...r}){return(0,K.jsxs)(`div`,{"data-slot":`dialog-footer`,className:H(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,K.jsx)(Cn,{render:(0,K.jsx)(wn,{variant:`outline`}),children:`Close`})]})}function rw({className:e,...t}){return(0,K.jsx)(Ge,{"data-slot":`dialog-title`,className:H(`font-heading text-sm font-medium`,e),...t})}function iw({className:e,...t}){return(0,K.jsx)(ke,{"data-slot":`dialog-description`,className:H(`text-xs/relaxed text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}var aw=G.createContext(void 0);function ow(){let e=G.useContext(aw);if(e===void 0)throw Error(On(53));return e}function sw(e,t,n){if(!e)return 0;let r=getComputedStyle(e),i=`${t}${n===`x`?`Inline`:`Block`}`,a=parseFloat(r[`${i}Start`]);return n===`x`&&t===`margin`?a*2:a+parseFloat(r[`${i}End`])}var cw=`data-has-overflow-x`,lw=`data-has-overflow-y`,uw=`data-overflow-x-start`,dw=`data-overflow-x-end`,fw=`data-overflow-y-start`,pw=`data-overflow-y-end`,mw=e=>t=>t?{[e]:``}:null,hw={hasOverflowX:mw(cw),hasOverflowY:mw(lw),overflowXStart:mw(uw),overflowXEnd:mw(dw),overflowYStart:mw(fw),overflowYEnd:mw(pw),cornerHidden:()=>null},gw=`--scroll-area-corner-height`,_w=`--scroll-area-corner-width`,vw=`data-orientation`,yw={x:0,y:0},bw={width:0,height:0},xw={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},Sw={x:!0,y:!0,corner:!0},Cw=G.forwardRef(function(e,n){let{render:r,className:i,overflowEdgeThreshold:a,style:o,...s}=e,{xStart:c,xEnd:l,yStart:u,yEnd:d}=ww(a),f=In(),p=Je(),m=Je(),{nonce:h,disableStyleElements:g}=Ie(),[_,v]=G.useState(!1),[y,b]=G.useState(!1),[x,S]=G.useState(!1),[C,w]=G.useState(!1),[T,E]=G.useState(!1),[D,O]=G.useState(bw),[k,A]=G.useState(bw),[j,M]=G.useState(xw),[N,P]=G.useState(Sw),F=G.useRef(null),I=G.useRef(null),L=G.useRef(null),R=G.useRef(null),ee=G.useRef(null),te=G.useRef(null),z=G.useRef(null),ne=G.useRef(null),B=G.useRef(0),re=G.useRef(0),ie=G.useRef(0),V=G.useRef(0),ae=G.useRef(`vertical`),oe=G.useRef(yw),se=G.useRef(null);function ce(e){let t=e?S:b,n=e?p:m;t(!0),n.start(500,()=>{t(!1)})}let le=Ne(e=>{let t=e.x-oe.current.x,n=e.y-oe.current.y;oe.current=e,n!==0&&ce(!0),t!==0&&ce(!1)}),ue=Ne(()=>{let e=I.current;e&&se.current===null&&(se.current=e.style.scrollSnapType,e.style.scrollSnapType=`none`)}),de=Ne(e=>{if(e.button!==0||ne.current!==null&&(ae.current===`vertical`?ee.current:te.current)?.hasPointerCapture(ne.current))return;ne.current=e.pointerId,B.current=e.clientY,re.current=e.clientX,ae.current=e.currentTarget.getAttribute(vw);let t=I.current;t&&(ie.current=t.scrollTop,V.current=t.scrollLeft,ue()),(ae.current===`vertical`?ee.current:te.current)?.setPointerCapture(e.pointerId)}),fe=Ne(e=>{if(e.pointerId!==ne.current)return;ne.current=null,(ae.current===`vertical`?S:b)(!1),se.current!==null&&(I.current&&(I.current.style.scrollSnapType=se.current),se.current=null);let t=ae.current===`vertical`?ee.current:te.current;t?.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId)}),pe=Ne(e=>{if(e.pointerId!==ne.current)return;if(e.buttons%2==0){fe(e);return}let t=I.current;if(!t)return;let n=ae.current===`vertical`,r=n?ee.current:te.current,i=n?L.current:R.current;if(!r||!i)return;let a=n?`y`:`x`,o=sw(i,`padding`,a),s=sw(r,`margin`,a),c=n?r.offsetHeight:r.offsetWidth,l=(n?i.offsetHeight:i.offsetWidth)-c-o-s,u=n?e.clientY-B.current:e.clientX-re.current,d=l<=0?0:u/l,f=n?t.scrollHeight:t.scrollWidth,p=n?t.clientHeight:t.clientWidth,m=(n?ie.current:V.current)+d*(f-p);n?t.scrollTop=m:t.scrollLeft=m,e.preventDefault(),ce(n)});function me(e){w(e.pointerType===`touch`)}function he(e){if(me(e),e.pointerType!==`touch`){let t=Er(F.current,e.target);v(t)}}let ge=G.useMemo(()=>({scrolling:y||x,hasOverflowX:!N.x,hasOverflowY:!N.y,overflowXStart:j.xStart,overflowXEnd:j.xEnd,overflowYStart:j.yStart,overflowYEnd:j.yEnd,cornerHidden:N.corner}),[y,x,N.x,N.y,N.corner,j]),_e={role:`presentation`,onPointerEnter:he,onPointerMove:he,onPointerDown:me,onPointerLeave(){v(!1)},style:{position:`relative`,[gw]:`${D.height}px`,[_w]:`${D.width}px`}},ve=Xt(`div`,e,{state:ge,ref:[n,F],props:[_e,s],stateAttributesMapping:hw}),ye=G.useMemo(()=>({handlePointerDown:de,handlePointerMove:pe,handlePointerUp:fe,handleScroll:le,disableViewportSnap:ue,cornerSize:D,setCornerSize:O,thumbSize:k,setThumbSize:A,hasMeasuredScrollbar:T,setHasMeasuredScrollbar:E,touchModality:C,cornerRef:z,scrollingX:y,scrollingY:x,hovering:_,setHovering:v,viewportRef:I,scrollbarYRef:L,scrollbarXRef:R,thumbYRef:ee,thumbXRef:te,rootId:f,hiddenState:N,setHiddenState:P,overflowEdges:j,setOverflowEdges:M,viewportState:ge,overflowEdgeThreshold:{xStart:c,xEnd:l,yStart:u,yEnd:d}}),[de,pe,fe,le,ue,D,k,T,C,y,x,_,f,N,j,ge,c,l,u,d]);return(0,K.jsxs)(aw.Provider,{value:ye,children:[!g&&t.getElement(h),ve]})});function ww(e){let t=typeof e==`number`?{xStart:e,xEnd:e,yStart:e,yEnd:e}:e;return{xStart:Math.max(0,t?.xStart||0),xEnd:Math.max(0,t?.xEnd||0),yStart:Math.max(0,t?.yStart||0),yEnd:Math.max(0,t?.yEnd||0)}}var Tw=G.createContext(void 0),Ew=`--scroll-area-overflow-x-start`,Dw=`--scroll-area-overflow-x-end`,Ow=`--scroll-area-overflow-y-start`,kw=`--scroll-area-overflow-y-end`,Aw=`--scroll-area-thumb-height`,jw=`--scroll-area-thumb-width`,Mw=[Ew,Dw,Ow,kw],Nw=!1;function Pw(){Nw||jt||(typeof CSS<`u`&&`registerProperty`in CSS&&Mw.forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),Nw=!0)}var Fw=G.forwardRef(function(e,n){let{render:r,className:i,style:a,...o}=e,{viewportRef:s,scrollbarYRef:c,scrollbarXRef:u,thumbYRef:d,thumbXRef:f,cornerRef:p,cornerSize:m,setCornerSize:h,setThumbSize:g,rootId:_,setHiddenState:v,hiddenState:y,setHasMeasuredScrollbar:b,handleScroll:x,touchModality:S,setHovering:C,setOverflowEdges:w,overflowEdgeThreshold:T,viewportState:E}=ow(),D=De(),O=G.useRef(!0),k=G.useRef([NaN,NaN,NaN,NaN]),A=Je(),j=Je(),M=Ne(()=>{let e=s.current,t=c.current,n=u.current,r=d.current,i=f.current,a=p.current;if(!e)return;let o=e.scrollHeight,l=e.scrollWidth,_=e.clientHeight,y=e.clientWidth,x=e.scrollTop,S=e.scrollLeft,C=k.current,E=Number.isNaN(C[0]);if(C[0]=_,C[1]=o,C[2]=y,C[3]=l,E&&b(!0),o===0||l===0)return;let O=Iw(e),A=O.y,j=O.x,M=y/l,N=_/o,P=Math.max(0,l-y),F=Math.max(0,o-_),I=0,L=0;j||(I=Zt(D===`rtl`?-S:S,P),L=P-I);let R=A?0:Zt(x,F),ee=A?0:F-R,te=j?0:y,z=A?0:_,ne=0,B=0;!j&&!A&&(ne=t?.offsetWidth||0,B=n?.offsetHeight||0);let re=m.width===0&&m.height===0,ie=re?ne:0,V=re?B:0,ae=sw(n,`padding`,`x`),oe=sw(t,`padding`,`y`),se=sw(i,`margin`,`x`),ce=sw(r,`margin`,`y`),le=te-ae-se,ue=z-oe-ce,de=n?Math.min(n.offsetWidth-ie,le):le,fe=t?Math.min(t.offsetHeight-V,ue):ue,pe=Math.max(16,de*M),me=Math.max(16,fe*N);if(g(e=>Lw(e,{width:pe,height:me})),t&&r){let e=Rw(r,Aw,x,F,o,me,t.offsetHeight-me-oe-ce);r.style.transform=`translate3d(0,${e}px,0)`}if(n&&i){let e=n.offsetWidth-pe-ae-se,t=Rw(i,jw,D===`rtl`?-S:S,P,l,pe,e);i.style.transform=`translate3d(${D===`rtl`?-t:t}px,0,0)`}let he=[I,L,R,ee];Mw.forEach((t,n)=>{e.style.setProperty(t,`${he[n]}px`)}),a&&h(e=>Lw(e,{width:ne,height:B})),v(e=>Lw(e,O));let ge={xStart:!j&&I>T.xStart,xEnd:!j&&L>T.xEnd,yStart:!A&&R>T.yStart,yEnd:!A&&ee>T.yEnd};w(e=>Lw(e,ge))});l(()=>{Pw()},[]),l(()=>{queueMicrotask(M)},[M,y,D,T.xStart,T.xEnd,T.yStart,T.yEnd]),l(()=>{s.current?.matches(`:hover`)&&C(!0)},[s,C]),l(()=>{let e=s.current;if(typeof ResizeObserver>`u`||!e)return;let t=!1,n=new ResizeObserver(()=>{if(!t){t=!0;let n=k.current;if(n[0]===e.clientHeight&&n[1]===e.scrollHeight&&n[2]===e.clientWidth&&n[3]===e.scrollWidth)return}M()});return n.observe(e),j.start(0,()=>{let t=e.getAnimations({subtree:!0});t.length!==0&&Promise.allSettled(t.map(e=>e.finished)).then(M).catch(()=>{})}),()=>{n.disconnect(),j.clear()}},[M,s,j]);function N(){O.current=!1}let P={role:`presentation`,..._&&{"data-id":`${_}-viewport`},tabIndex:y.x&&y.y?-1:0,className:t.className,style:{overflow:`scroll`},onScroll(){s.current&&(M(),(S||!O.current)&&x({x:s.current.scrollLeft,y:s.current.scrollTop}),A.start(100,()=>{O.current=!0}))},onWheel:N,onPointerMove:N,onPointerEnter:N,onKeyDown:N},F=Xt(`div`,e,{ref:[n,s],state:E,props:[P,o],stateAttributesMapping:hw}),I=G.useMemo(()=>({computeThumbPosition:M}),[M]);return(0,K.jsx)(Tw.Provider,{value:I,children:F})});function Iw(e){let t=e.clientHeight>=e.scrollHeight,n=e.clientWidth>=e.scrollWidth;return{y:t,x:n,corner:t||n}}function Lw(e,t){for(let n in t)if(e[n]!==t[n])return t;return e}function Rw(e,t,n,r,i,a,o){let s=pt(n,0,r),c=n-s,l=Math.max(16,a*i/(i+Math.abs(c)));return e.style.setProperty(t,c?`${l}px`:``),(r?s/r*o:0)+(c>0?a-l:0)}var zw=G.createContext(void 0);function Bw(){let e=G.useContext(zw);if(e===void 0)throw Error(On(54));return e}var Vw=G.forwardRef(function(e,t){let{render:n,className:r,orientation:i=`vertical`,keepMounted:a=!1,style:o,...s}=e,{hovering:c,scrollingX:l,scrollingY:u,hiddenState:d,scrollbarYRef:f,scrollbarXRef:p,viewportRef:m,thumbYRef:h,thumbXRef:g,handlePointerDown:_,handlePointerUp:v,handleScroll:y,disableViewportSnap:x,rootId:S,thumbSize:C,hasMeasuredScrollbar:w,viewportState:T}=ow(),E=i===`vertical`,D={...T,hovering:c,scrolling:E?u:l,orientation:i},O=De(),k=!w&&!a,A=E?d.y:d.x,j=a||!A;G.useEffect(()=>{if(!j)return;let e=m.current,t=E?f.current:p.current;if(!t)return;function n(t){if(!e||t.ctrlKey)return;let n=!E,r=n?`scrollLeft`:`scrollTop`,i=n?t.deltaX:t.deltaY;if(i===0)return;let a=n?e.scrollWidth-e.clientWidth:e.scrollHeight-e.clientHeight,o=n&&O===`rtl`?-a:0,s=n&&O===`rtl`?0:a,c=e[r];c<=o&&i<0||c>=s&&i>0||(t.preventDefault(),e[r]=Math.min(s,Math.max(o,c+i)),y({x:e.scrollLeft,y:e.scrollTop}))}return b(t,`wheel`,n,{passive:!1})},[O,y,E,p,f,j,m]);let M={...S&&{"data-id":`${S}-scrollbar`},"aria-hidden":!0,onPointerDown(e){if(e.button!==0)return;let t=Vr(e.nativeEvent),n=E?h.current:g.current;if(n&&Er(n,t))return;let r=m.current;if(!r)return;let i=E?f.current:p.current;if(!n||!i)return;let a=E?`y`:`x`,o=sw(n,`margin`,a),s=sw(i,`padding`,a),c=E?n.offsetHeight:n.offsetWidth,l=i.getBoundingClientRect(),u=E?e.clientY-l.top-c/2-s+o/2:e.clientX-l.left-c/2-s+o/2,d=E?r.scrollHeight:r.scrollWidth,v=E?r.clientHeight:r.clientWidth,b=(E?i.offsetHeight:i.offsetWidth)-c-s-o;if(b<=0)return;let S=u/b,C=d-v;x(),E?r.scrollTop=S*C:r.scrollLeft=O===`rtl`?-(1-S)*C:S*C,y({x:r.scrollLeft,y:r.scrollTop}),_(e)},onMouseDown(e){e.preventDefault()},onPointerUp:v,onPointerCancel:v,style:{position:`absolute`,touchAction:`none`,WebkitUserSelect:`none`,userSelect:`none`,visibility:k?`hidden`:void 0,...E?{top:0,bottom:`var(${gw})`,insetInlineEnd:0,[Aw]:`${C.height}px`}:{insetInlineStart:0,insetInlineEnd:`var(${_w})`,bottom:0,[jw]:`${C.width}px`}}},N=Xt(`div`,e,{ref:[t,E?f:p],state:D,props:[M,s],stateAttributesMapping:hw});return j?(0,K.jsx)(zw.Provider,{value:i,children:N}):null}),Hw=G.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{thumbYRef:o,thumbXRef:s,handlePointerDown:c,handlePointerMove:l,handlePointerUp:u,scrollingX:d,scrollingY:f,hasMeasuredScrollbar:p}=ow(),m=Bw(),h=m===`vertical`;return Xt(`div`,e,{ref:[t,h?o:s],state:{scrolling:h?f:d,orientation:m},props:[{onPointerDown:c,onPointerMove:l,onPointerUp:u,onPointerCancel:u,style:{visibility:p?void 0:`hidden`,...h?{height:`var(--scroll-area-thumb-height)`}:{width:`var(--scroll-area-thumb-width)`}}},a]})}),Uw=G.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{cornerRef:o,cornerSize:s,hiddenState:c}=ow(),l=Xt(`div`,e,{ref:[t,o],props:[{"aria-hidden":!0,style:{position:`absolute`,bottom:0,insetInlineEnd:0,width:s.width,height:s.height}},a]});return c.corner?null:l});function Ww({className:e,children:t,...n}){return(0,K.jsxs)(Cw,{"data-slot":`scroll-area`,className:H(`relative`,e),...n,children:[(0,K.jsx)(Fw,{"data-slot":`scroll-area-viewport`,className:`size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1`,children:t}),(0,K.jsx)(Gw,{}),(0,K.jsx)(Uw,{})]})}function Gw({className:e,orientation:t=`vertical`,...n}){return(0,K.jsx)(Vw,{"data-slot":`scroll-area-scrollbar`,"data-orientation":t,orientation:t,className:H(`flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent`,e),...n,children:(0,K.jsx)(Hw,{"data-slot":`scroll-area-thumb`,className:`relative flex-1 rounded-full bg-border`})})}function Kw({className:e,...t}){return(0,K.jsx)(`nav`,{"aria-label":`breadcrumb`,"data-slot":`breadcrumb`,className:H(e),...t})}function qw({className:e,...t}){return(0,K.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:H(`flex flex-wrap items-center gap-1.5 text-xs/relaxed wrap-break-word text-muted-foreground`,e),...t})}function Jw({className:e,...t}){return(0,K.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:H(`inline-flex items-center gap-1`,e),...t})}function Yw({className:e,render:t,...n}){return Lt({defaultTagName:`a`,props:hr({className:H(`transition-colors hover:text-foreground`,e)},n),render:t,state:{slot:`breadcrumb-link`}})}function Xw({className:e,...t}){return(0,K.jsx)(`span`,{"data-slot":`breadcrumb-page`,role:`link`,"aria-disabled":`true`,"aria-current":`page`,className:H(`font-normal text-foreground`,e),...t})}function Zw({children:e,className:t,...n}){return(0,K.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:H(`[&>svg]:size-3.5`,t),...n,children:e??(0,K.jsx)(_,{})})}function Qw(e,t){let n=(0,q.c)(6),r;n[0]!==e||n[1]!==t?(r=Tr(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2];let i=r,a=B(i),o=Kr(i),s;return n[3]!==a||n[4]!==o?(s={value:a,refresh:o},n[3]=a,n[4]=o,n[5]=s):s=n[5],s}function $w(e){let t=(0,q.c)(3),{folder:n,disabled:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,K.jsx)(Ww,{className:`h-40`,"aria-label":`Folders`,children:(0,K.jsx)(`div`,{className:`flex flex-col p-1`,children:(0,K.jsx)(eT,{folder:n,disabled:r})})}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function eT(e){let t=(0,q.c)(38),{folder:n,disabled:r}=e,i=p(DC),a;t[0]===n.value?a=t[1]:(a=pn(Ht(n.value)),t[0]=n.value,t[1]=a);let o=a;if(sr(n.value)){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,K.jsx)(`p`,{role:`status`,className:`px-2 py-1.5 text-xs text-muted-foreground`,children:`Loading folders…`}),t[2]=e):e=t[2],e}if(Wn(n.value)){let e;t[3]===n.value.cause?e=t[4]:(e=it(xr(n.value.cause)),t[3]=n.value.cause,t[4]=e);let a;t[5]===e?a=t[6]:(a=(0,K.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:e}),t[5]=e,t[6]=a);let o;t[7]!==r||t[8]!==n.refresh?(o=(0,K.jsx)(wn,{variant:`outline`,size:`xs`,onClick:n.refresh,disabled:r,children:`Try again`}),t[7]=r,t[8]=n.refresh,t[9]=o):o=t[9];let s;t[10]===i?s=t[11]:(s=()=>i(void 0),t[10]=i,t[11]=s);let c;t[12]!==r||t[13]!==s?(c=(0,K.jsx)(wn,{variant:`ghost`,size:`xs`,onClick:s,disabled:r,children:`Home folder`}),t[12]=r,t[13]=s,t[14]=c):c=t[14];let l;t[15]!==o||t[16]!==c?(l=(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[o,c]}),t[15]=o,t[16]=c,t[17]=l):l=t[17];let u;return t[18]!==a||t[19]!==l?(u=(0,K.jsxs)(`div`,{className:`flex flex-col items-start gap-2 px-2 py-1.5`,children:[a,l]}),t[18]=a,t[19]=l,t[20]=u):u=t[20],u}if(!o)return null;let s;t[21]!==o.parent||t[22]!==r||t[23]!==i?(s=o.parent&&(0,K.jsxs)(wn,{variant:`ghost`,size:`sm`,className:`w-full justify-start`,onClick:()=>i(o.parent??void 0),disabled:r,children:[(0,K.jsx)(qa,{"data-icon":`inline-start`}),`Up`]}),t[21]=o.parent,t[22]=r,t[23]=i,t[24]=s):s=t[24];let c;if(t[25]!==o.directories||t[26]!==r||t[27]!==i){let e;t[29]!==r||t[30]!==i?(e=e=>(0,K.jsxs)(wn,{variant:`ghost`,size:`sm`,className:`w-full justify-start`,title:e.path,onClick:()=>i(e.path),disabled:r,children:[(0,K.jsx)(So,{"data-icon":`inline-start`}),(0,K.jsx)(Fr,{text:e.name})]},e.path),t[29]=r,t[30]=i,t[31]=e):e=t[31],c=o.directories.map(e),t[25]=o.directories,t[26]=r,t[27]=i,t[28]=c}else c=t[28];let l;t[32]===o.directories.length?l=t[33]:(l=!o.directories.length&&(0,K.jsx)(`p`,{className:`px-2 py-1.5 text-xs text-muted-foreground`,children:`No subfolders.`}),t[32]=o.directories.length,t[33]=l);let u;return t[34]!==s||t[35]!==c||t[36]!==l?(u=(0,K.jsxs)(K.Fragment,{children:[s,c,l]}),t[34]=s,t[35]=c,t[36]=l,t[37]=u):u=t[37],u}function tT(e){let t=(0,q.c)(44),{connection:n,disabled:r,onOpen:i}=e,a=B(DC),o=p(DC),s=Qw(n,a),c,l;t[0]===s.value?(c=t[1],l=t[2]):(c=pn(Ht(s.value)),l=c?[`/`,...c.path.split(`/`).filter(Boolean)]:[],t[0]=s.value,t[1]=c,t[2]=l);let u=l,d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,K.jsx)(`h3`,{className:`text-sm font-medium`,children:`Browse for a folder`}),t[3]=d):d=t[3];let f;t[4]!==u||t[5]!==c||t[6]!==r||t[7]!==o?(f=c&&(0,K.jsx)(Kw,{"aria-label":`Folder path`,children:(0,K.jsx)(qw,{children:u.map((e,t)=>{let n=t===0?`/`:`/${u.slice(1,t+1).join(`/`)}`;return(0,K.jsxs)(G.Fragment,{children:[t>0&&(0,K.jsx)(Zw,{}),(0,K.jsx)(Jw,{className:`min-w-0`,children:t===u.length-1?(0,K.jsx)(Xw,{className:`max-w-48`,title:c.path,children:e}):(0,K.jsx)(Yw,{render:(0,K.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>o(n)}),title:n,children:e})})]},n)})})}),t[4]=u,t[5]=c,t[6]=r,t[7]=o,t[8]=f):f=t[8];let m;t[9]===f?m=t[10]:(m=(0,K.jsxs)(`div`,{className:`flex flex-col gap-1 px-3 pt-1`,children:[d,f]}),t[9]=f,t[10]=m);let h;t[11]!==r||t[12]!==s?(h=(0,K.jsx)($w,{folder:s,disabled:r}),t[11]=r,t[12]=s,t[13]=h):h=t[13];let g;t[14]===c?.truncated?g=t[15]:(g=c?.truncated&&(0,K.jsx)(`p`,{className:`px-3 text-xs text-muted-foreground`,children:`This folder is large; some entries are not shown.`}),t[14]=c?.truncated,t[15]=g);let _=c?.repository?`Every worktree appears in the sidebar.`:`Pick a folder that is a Git repository.`,v;t[16]===_?v=t[17]:(v=(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:_}),t[16]=_,t[17]=v);let y;t[18]!==c?.repository||t[19]!==r||t[20]!==s.value?(y=r||!c?.repository||An(s.value)||Wn(s.value),t[18]=c?.repository,t[19]=r,t[20]=s.value,t[21]=y):y=t[21];let b;t[22]!==c||t[23]!==i?(b=()=>{c&&i(c.path)},t[22]=c,t[23]=i,t[24]=b):b=t[24];let x;t[25]===r?x=t[26]:(x=r&&(0,K.jsx)(At,{}),t[25]=r,t[26]=x);let S;t[27]===c?.path?S=t[28]:(S=c?.path.split(`/`).filter(Boolean).at(-1)??`folder`,t[27]=c?.path,t[28]=S);let C=`Open ${S}`,w;t[29]===C?w=t[30]:(w=(0,K.jsx)(Fr,{className:`max-w-36`,text:C}),t[29]=C,t[30]=w);let T;t[31]!==b||t[32]!==x||t[33]!==w||t[34]!==y?(T=(0,K.jsxs)(wn,{size:`sm`,disabled:y,onClick:b,children:[x,w]}),t[31]=b,t[32]=x,t[33]=w,t[34]=y,t[35]=T):T=t[35];let E;t[36]!==T||t[37]!==v?(E=(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pr-1 pb-1 pl-3`,children:[v,T]}),t[36]=T,t[37]=v,t[38]=E):E=t[38];let D;return t[39]!==E||t[40]!==m||t[41]!==h||t[42]!==g?(D=(0,K.jsxs)(`section`,{"aria-label":`Browse for a folder`,className:`flex flex-col gap-2 rounded-2xl border bg-muted/30 p-2`,children:[m,h,g,E]}),t[39]=E,t[40]=m,t[41]=h,t[42]=g,t[43]=D):D=t[43],D}function nT(e){let t=(0,q.c)(9),{connection:n,remotes:r,onOpened:i}=e,a=AC(),o;t[0]!==n||t[1]!==r?(o=e=>{if(e===null)return{connection:n,name:void 0};let t=r.find(t=>t.remote.environmentId===e);return t&&{connection:t.connection,name:t.remote.name}},t[0]=n,t[1]=r,t[2]=o):o=t[2];let s=o,c;t[3]!==s||t[4]!==i?(c=e=>{let{payload:t}=e,n=t&&s(t.remote);return t&&n&&(0,K.jsx)(ew,{className:`flex max-h-[90svh] flex-col sm:max-w-lg`,children:(0,K.jsx)(rT,{connection:n.connection,remote:t.remote,name:n.name,onOpened:i},t.remote)})},t[3]=s,t[4]=i,t[5]=c):c=t[5];let l;return t[6]!==a||t[7]!==c?(l=(0,K.jsx)(g,{handle:PC,onOpenChangeComplete:a,children:c}),t[6]=a,t[7]=c,t[8]=l):l=t[8],l}function rT(e){let t=(0,q.c)(18),{connection:n,remote:r,name:i,onOpened:o}=e,s=OC(n,r,iT,o),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,K.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-secondary text-secondary-foreground`,children:(0,K.jsx)(go,{"aria-hidden":`true`})}),t[0]=c):c=t[0];let l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,K.jsx)(rw,{children:`Open project`}),t[1]=l):l=t[1];let u=i===void 0?`Browse for a repository on the Porcelain server.`:`Browse for a repository on ${i}.`,d;t[2]===u?d=t[3]:(d=(0,K.jsxs)(tw,{className:`shrink-0 flex-row items-center text-left`,children:[c,(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[l,(0,K.jsx)(iw,{children:u})]})]}),t[2]=u,t[3]=d);let f;t[4]===s?f=t[5]:(f=e=>void s.submit(e),t[4]=s,t[5]=f);let p;t[6]!==n||t[7]!==s.result.waiting||t[8]!==f?(p=(0,K.jsx)(tT,{disabled:s.result.waiting,connection:n,onOpen:f}),t[6]=n,t[7]=s.result.waiting,t[8]=f,t[9]=p):p=t[9];let m;t[10]===s.result?m=t[11]:(m=Wn(s.result)&&(0,K.jsx)(Be,{variant:`destructive`,children:(0,K.jsx)(a,{children:it(xr(s.result.cause))})}),t[10]=s.result,t[11]=m);let h;t[12]!==p||t[13]!==m?(h=(0,K.jsx)(Ww,{className:`min-h-0 [&>[data-slot=scroll-area-viewport]]:max-h-[calc(90svh-8rem)]`,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[p,m]})}),t[12]=p,t[13]=m,t[14]=h):h=t[14];let g;return t[15]!==d||t[16]!==h?(g=(0,K.jsxs)(K.Fragment,{children:[d,h]}),t[15]=d,t[16]=h,t[17]=g):g=t[17],g}function iT(){return PC.close()}var aT=Mi(),oT=P(e=>m(t=>{let n=new Map,r=t.registry,i=Jt(e.connections),a=e=>({children:r.get(i).waiting?`Retrying…`:`Retry`,disabled:r.get(i).waiting,onClick:()=>r.set(i,{environmentId:e})});t.subscribe(Oe,t=>{let i=t.filter(t=>!t.dismissed&&e.connections.some(e=>e.environmentId===t.environmentId));for(let[e,t]of n)i.some(t=>t.environmentId===e)||(n.delete(e),aT.close(t.id));for(let t of i){let i=t.environmentId,o=JSON.stringify([t.environmentName,t.failures.map(({entry:e,detail:t})=>[e.key,e.name,t])]),s=n.get(i),c={title:`Couldn’t check changes on ${t.environmentName}`,description:e.description(t)};if(s){s.signature!==o&&(aT.update(s.id,c),s.signature=o);continue}let l=aT.add({...c,priority:`low`,actionProps:a(i),onClose:()=>r.update(Oe,e=>e.some(e=>e.environmentId===i&&!e.dismissed)?e.map(e=>e.environmentId===i?{...e,dismissed:!0}:e):e)});n.set(i,{id:l,signature:o})}},{immediate:!0}),t.subscribe(i,()=>{for(let[e,t]of n)aT.update(t.id,{actionProps:a(e)})}),t.addFinalizer(()=>{for(let e of n.values())aT.close(e.id)})}));function sT(e){let[t,n]=G.useState({getBoundingClientRect(){return DOMRect.fromRect({width:0,height:0,x:0,y:0})}}),r=G.useRef(null),i=G.useRef(null),a=G.useRef(null),o=G.useRef(null),s=G.useRef(!0),c=G.useRef(null),l=ue(),u=G.useMemo(()=>({anchor:t,setAnchor:n,actionsRef:a,backdropRef:r,internalBackdropRef:i,positionerRef:o,allowMouseUpTriggerRef:s,initialCursorPointRef:c,rootId:l}),[t,l]);return(0,K.jsx)(Fe.Provider,{value:u,children:(0,K.jsx)(le.Provider,{value:void 0,children:(0,K.jsx)(wt,{...e})})})}var cT=500,lT=G.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{setAnchor:o,actionsRef:s,internalBackdropRef:c,backdropRef:l,positionerRef:u,allowMouseUpTriggerRef:d,initialCursorPointRef:f,rootId:p}=F(!1),{store:m}=Se(!1),h=m.useState(`open`),g=m.useState(`disabled`),_=G.useRef(null),v=G.useRef(null),y=Je(),x=Je(),S=G.useRef(!1),C=G.useRef(null);function w(e,t,n){let r=n.type.startsWith(`touch`);f.current={x:e,y:t},o({getBoundingClientRect(){return DOMRect.fromRect({width:r?10:0,height:r?10:0,x:e,y:t})}}),S.current=!1,s.current?.setOpen(!0,V(W,n)),x.start(cT,()=>{S.current=!0})}function T(e){if(g)return;d.current=!0,Gt(e),w(e.clientX,e.clientY,e.nativeEvent);let t=jr(_.current);C.current?.abort();let n=new AbortController;C.current=n,t.addEventListener(`mouseup`,e=>{if(d.current=!1,!S.current)return;x.clear(),S.current=!1;let t=Vr(e);Er(u.current,t)||p&&t&&hn(t)===p||s.current?.setOpen(!1,V(_e,e))},{once:!0,signal:n.signal})}function E(){y.clear(),v.current=null}function D(e){if(g||(d.current=!1,e.touches.length!==1)){E();return}e.stopPropagation();let t=e.touches[0],n={x:t.clientX,y:t.clientY};v.current=n,y.start(cT,()=>{w(n.x,n.y,e.nativeEvent)})}function O(e){if(e.touches.length!==1)E();else if(y.isStarted()&&v.current){let t=e.touches[0],n=Math.abs(t.clientX-v.current.x),r=Math.abs(t.clientY-v.current.y);(n>10||r>10)&&E()}}return G.useEffect(()=>()=>{C.current?.abort()},[]),G.useEffect(()=>{function e(e){if(g)return;let t=Vr(e);(Er(_.current,t)||Er(c.current,t)||Er(l.current,t))&&e.preventDefault()}let t=jr(_.current);return b(t,`contextmenu`,e)},[l,g,c]),Xt(`div`,e,{state:{open:h},ref:[_,t],props:[{onContextMenu:T,onTouchStart:D,onTouchMove:O,onTouchEnd:E,onTouchCancel:E,style:{WebkitTouchCallout:`none`}},a],stateAttributesMapping:Qn})}),uT=Or;function dT({...e}){return(0,K.jsx)(sT,{"data-slot":`context-menu`,...e})}function fT({className:e,...t}){return(0,K.jsx)(lT,{"data-slot":`context-menu-trigger`,className:H(`select-none`,e),...t})}function pT({className:e,align:t=`start`,alignOffset:n=4,side:r=`right`,sideOffset:i=0,...a}){return(0,K.jsx)(Nt,{children:(0,K.jsx)(uT,{className:`isolate z-50 outline-none`,align:t,alignOffset:n,side:r,sideOffset:i,children:(0,K.jsx)(Lr,{"data-slot":`context-menu-content`,className:H(`z-50 max-h-(--available-height) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 animate-none! relative bg-popover/70 before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] before:backdrop-blur-2xl before:backdrop-saturate-150 **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!`,e),...a})})})}function mT({...e}){return(0,K.jsx)(Ee,{"data-slot":`context-menu-group`,...e})}function hT({className:e,inset:t,variant:n=`default`,...r}){return(0,K.jsx)(Sn,{"data-slot":`context-menu-item`,"data-inset":t,"data-variant":n,className:H(`group/context-menu-item relative flex min-h-7 cursor-default items-center gap-2 rounded-md px-2 py-1 text-xs/relaxed outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7.5 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function gT({className:e,...t}){return(0,K.jsx)(sn,{"data-slot":`context-menu-separator`,className:H(`-mx-1 my-1 h-px bg-border/50`,e),...t})}function _T({className:e,...t}){return(0,K.jsx)(`span`,{"data-slot":`context-menu-shortcut`,className:H(`ml-auto text-[0.625rem] tracking-widest text-muted-foreground group-focus/context-menu-item:text-accent-foreground`,e),...t})}function vT(e){let t=(0,q.c)(26),{entry:n,connection:r,children:i,onRetryChanges:a}=e,o=n.worktreeId,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,K.jsx)(`div`,{className:`min-w-0 flex-1 py-0.5`}),t[0]=s):s=t[0];let c;t[1]===i?c=t[2]:(c=(0,K.jsx)(fT,{render:s,children:i}),t[1]=i,t[2]=c);let l;t[3]!==n.available||t[4]!==n.changes||t[5]!==n.kind||t[6]!==a?(l=n.available&&n.kind===`worktree`&&n.changes.state===`unavailable`&&(0,K.jsxs)(hT,{onClick:a,children:[(0,K.jsx)(Bo,{}),`Retry changes`]}),t[3]=n.available,t[4]=n.changes,t[5]=n.kind,t[6]=a,t[7]=l):l=t[7];let u;t[8]===n.path?u=t[9]:(u=n.path&&(0,K.jsxs)(hT,{className:`cursor-pointer`,onClick:()=>n.path&&Ft(n.path,`worktree path`),children:[(0,K.jsx)(Za,{}),`Copy worktree path`]}),t[8]=n.path,t[9]=u);let d;t[10]!==r||t[11]!==n||t[12]!==o?(d=n.kind===`worktree`&&o&&(0,K.jsxs)(hT,{className:`cursor-pointer`,disabled:!n.available,onClick:()=>BC.openWithPayload({entry:n,connection:r,worktreeId:o,requestId:crypto.randomUUID()}),children:[(0,K.jsx)(wo,{}),`Switch branch`]}),t[10]=r,t[11]=n,t[12]=o,t[13]=d):d=t[13];let f;t[14]!==r||t[15]!==n||t[16]!==o?(f=!n.main&&n.kind===`worktree`&&o&&(0,K.jsxs)(hT,{variant:`destructive`,className:`cursor-pointer`,disabled:!n.available,onClick:()=>zC.openWithPayload({entry:n,connection:r,worktreeId:o,requestId:crypto.randomUUID()}),children:[(0,K.jsx)(Xo,{}),`Delete`]}),t[14]=r,t[15]=n,t[16]=o,t[17]=f):f=t[17];let p;t[18]!==l||t[19]!==u||t[20]!==d||t[21]!==f?(p=(0,K.jsx)(pT,{children:(0,K.jsxs)(mT,{children:[l,u,d,f]})}),t[18]=l,t[19]=u,t[20]=d,t[21]=f,t[22]=p):p=t[22];let m;return t[23]!==c||t[24]!==p?(m=(0,K.jsxs)(dT,{children:[c,p]}),t[23]=c,t[24]=p,t[25]=m):m=t[25],m}function yT({className:e,...t}){return(0,K.jsx)(`kbd`,{"data-slot":`kbd`,className:H(`pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-xs bg-muted px-1 font-sans text-[0.625rem] font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3`,e),...t})}function bT({className:e,...t}){return(0,K.jsx)(`kbd`,{"data-slot":`kbd-group`,className:H(`inline-flex items-center gap-1`,e),...t})}function xT(){let e=(0,q.c)(2),[t,n]=(0,G.useState)(null),r;return e[0]===t?r=e[1]:(r={element:t,attach:n},e[0]=t,e[1]=r),r}function ST({className:e,...t}){return(0,K.jsx)(`textarea`,{"data-slot":`textarea`,className:H(`flex field-sizing-content min-h-16 w-full resize-none rounded-md border border-input bg-input/20 px-2 py-2 text-sm transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 md:text-xs/relaxed dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function CT({className:e,...t}){return(0,K.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:H(`group/input-group relative flex h-7 w-full min-w-0 items-center rounded-md border border-input bg-input/20 transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-data-[align=block-end]:rounded-md has-data-[align=block-start]:rounded-md has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-2 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/30 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-2 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[textarea]:rounded-md has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,e),...t})}var wT=yn(`flex h-auto cursor-text items-center justify-center gap-1 py-2 text-xs/relaxed font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 **:data-[slot=kbd]:rounded-[calc(var(--radius-sm)-2px)] **:data-[slot=kbd]:bg-muted-foreground/10 **:data-[slot=kbd]:px-1 **:data-[slot=kbd]:text-[0.625rem] [&>svg:not([class*='size-'])]:size-3.5`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:ml-[-0.275rem] has-[>kbd]:ml-[-0.275rem]`,"inline-end":`order-last pr-2 has-[>button]:mr-[-0.275rem] has-[>kbd]:mr-[-0.275rem]`,"block-start":`order-first w-full justify-start px-2 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function TT({className:e,align:t=`inline-start`,...n}){return(0,K.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:H(wT({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}var ET=yn(`flex items-center gap-2 rounded-md text-xs/relaxed shadow-none`,{variants:{size:{xs:`h-5 gap-1 rounded-[calc(var(--radius-sm)-2px)] px-1 [&>svg:not([class*='size-'])]:size-3`,sm:`gap-1`,"icon-xs":`size-6 p-0 has-[>svg]:p-0`,"icon-sm":`size-7 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function DT({className:e,type:t=`button`,variant:n=`ghost`,size:r=`xs`,...i}){return(0,K.jsx)(wn,{type:t,"data-size":r,variant:n,className:H(ET({size:r}),e),...i})}function OT({className:e,...t}){return(0,K.jsx)(`span`,{className:H(`flex items-center gap-2 text-xs/relaxed text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,e),...t})}function kT({className:e,...t}){return(0,K.jsx)(h,{"data-slot":`input-group-control`,className:H(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent`,e),...t})}function AT({className:e,...t}){return(0,K.jsx)(ST,{"data-slot":`input-group-control`,className:H(`flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent`,e),...t})}function jT({className:e,...t}){return(0,K.jsx)(`div`,{"data-slot":`empty`,className:H(`flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance`,e),...t})}function MT({className:e,...t}){return(0,K.jsx)(`div`,{"data-slot":`empty-header`,className:H(`flex max-w-sm flex-col items-center gap-1`,e),...t})}yn(`mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`flex size-8 shrink-0 items-center justify-center rounded-md bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4`}},defaultVariants:{variant:`default`}});function NT({className:e,...t}){return(0,K.jsx)(`div`,{"data-slot":`empty-title`,className:H(`font-heading text-sm font-medium tracking-tight`,e),...t})}function PT({className:e,...t}){return(0,K.jsx)(`div`,{"data-slot":`empty-description`,className:H(`text-xs/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}var FT=1,IT=.9,LT=.8,RT=.17,zT=.1,BT=.999,VT=.9999,HT=.99,UT=/[\\\/_+.#"@\[\(\{&]/,WT=/[\\\/_+.#"@\[\(\{&]/g,GT=/[\s-]/,KT=/[\s-]/g;function qT(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?FT:HT;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=qT(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=FT:UT.test(e.charAt(l-1))?(d*=LT,p=e.slice(i,l-1).match(WT),p&&i>0&&(d*=BT**+p.length)):GT.test(e.charAt(l-1))?(d*=IT,m=e.slice(i,l-1).match(KT),m&&i>0&&(d*=BT**+m.length)):(d*=RT,i>0&&(d*=BT**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=VT)),(d<zT&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=qT(e,t,n,r,l+1,a+2,o),f*zT>d&&(d=f*zT)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function JT(e){return e.toLowerCase().replace(KT,` `)}function YT(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,qT(e,t,JT(e),JT(t),0,0,{})}var XT=Object.defineProperty,ZT=(e,t)=>XT(e,`name`,{value:t,configurable:!0}),QT=!!(typeof window<`u`&&window.document&&window.document.createElement);function $T(e,t,{checkForDefaultPrevented:n=!0}={}){return ZT(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}ZT($T,`composeEventHandlers`);function eE(e){if(!QT)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}ZT(eE,`getOwnerWindow`);function tE(e){if(!QT)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}ZT(tE,`getOwnerDocument`);function nE(e,t=!1){let{activeElement:n}=tE(e);if(!n?.nodeName)return null;if(rE(n)&&n.contentDocument)return nE(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=tE(n).getElementById(e);if(t)return t}}return n}ZT(nE,`getActiveElement`);function rE(e){return e.tagName===`IFRAME`}ZT(rE,`isFrame`);var iE=Object.defineProperty,aE=(e,t)=>iE(e,`name`,{value:t,configurable:!0});function oE(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}aE(oE,`setRef`);function sE(...e){return t=>{let n=!1,r=e.map(e=>{let r=oE(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():oE(e[t],null)}}}}aE(sE,`composeRefs`);function cE(...e){return G.useCallback(sE(...e),e)}aE(cE,`useComposedRefs`);var lE=Object.defineProperty,uE=(e,t)=>lE(e,`name`,{value:t,configurable:!0});function dE(e,t){let n=G.createContext(t);n.displayName=e+`Context`;let r=uE(e=>{let{children:t,...r}=e,i=G.useMemo(()=>r,Object.values(r));return(0,K.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=G.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return uE(i,`useContext`),[r,i]}uE(dE,`createContext`);function fE(e,t=[]){let n=[];function r(t,r){let i=G.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=uE(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=G.useMemo(()=>o,Object.values(o));return(0,K.jsx)(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=G.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return uE(s,`useContext`),[o,s]}uE(r,`createContext`);let i=uE(()=>{let t=n.map(e=>G.createContext(e));return uE(function(n){let r=n?.[e]||t;return G.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,pE(i,...t)]}uE(fE,`createContextScope`);function pE(...e){let t=e[0];if(e.length===1)return t;let n=uE(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return uE(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return G.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}uE(pE,`composeContextScopes`);var mE=globalThis?.document?G.useLayoutEffect:()=>{},hE=Object.defineProperty,gE=(e,t)=>hE(e,`name`,{value:t,configurable:!0}),_E=G.useId||(()=>void 0),vE=0;function yE(e){let[t,n]=G.useState(_E());return mE(()=>{e||n(e=>e??String(vE++))},[e]),e||(t?`radix-${t}`:``)}gE(yE,`useId`);var bE=Object.defineProperty,xE=(e,t)=>bE(e,`name`,{value:t,configurable:!0}),SE=G.useEffectEvent,CE=G.useInsertionEffect;function wE(e){if(typeof SE==`function`)return SE(e);let t=G.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof CE==`function`?CE(()=>{t.current=e}):mE(()=>{t.current=e}),G.useMemo(()=>((...e)=>t.current?.(...e)),[])}xE(wE,`useEffectEvent`);var TE=Object.defineProperty,EE=(e,t)=>TE(e,`name`,{value:t,configurable:!0}),DE=G.useInsertionEffect||mE;function OE({prop:e,defaultProp:t,onChange:n=EE(()=>{},`onChange`),caller:r}){let[i,a,o]=kE({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,G.useCallback(t=>{if(s){let n=AE(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}EE(OE,`useControllableState`);function kE({defaultProp:e,onChange:t}){let[n,r]=G.useState(e),i=G.useRef(n),a=G.useRef(t);return DE(()=>{a.current=t},[t]),G.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}EE(kE,`useUncontrolledState`);function AE(e){return typeof e==`function`}EE(AE,`isFunction`);var jE=Symbol(`RADIX:SYNC_STATE`);function ME(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=wE(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=G.useReducer((t,n)=>{if(n.type===jE)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),p=d.state,m=G.useRef(p);G.useEffect(()=>{m.current!==p&&(m.current=p,c||l(p))},[p,m,c]);let h=G.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return G.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:jE,state:i})},[i,d.state,c]),[h,f]}EE(ME,`useControllableStateReducer`);var NE=Object.defineProperty,PE=(e,t)=>NE(e,`name`,{value:t,configurable:!0});function FE(e){let t=G.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];UE(r)&&typeof qE==`function`&&(r=qE(r._payload)),G.Children.forEach(r,e=>{if(VE(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;UE(n)&&typeof qE==`function`&&(n=qE(n._payload)),a=RE(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=G.cloneElement(a,void 0,s):!o&&G.Children.count(r)===1&&G.isValidElement(r)&&(a=r);let c=a?BE(a):void 0,l=cE(n,c);if(!a){if(r||r===0)throw Error(o?KE(e):GE(e));return r}let u=zE(i,a.props??{});return a.type!==G.Fragment&&(u.ref=n?l:c),G.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}PE(FE,`createSlot`);var IE=Symbol.for(`radix.slottable`);function LE(e){let t=PE(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=IE,t}PE(LE,`createSlottable`);var RE=PE((e,t)=>{if(`child`in e.props){let t=e.props.child;return G.isValidElement(t)?G.cloneElement(t,void 0,e.props.children(t.props.children)):null}return G.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function zE(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}PE(zE,`mergeProps`);function BE(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}PE(BE,`getElementRef`);function VE(e){return G.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===IE}PE(VE,`isSlottable`);var HE=Symbol.for(`react.lazy`);function UE(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===HE&&`_payload`in e&&WE(e._payload)}PE(UE,`isLazyComponent`);function WE(e){return typeof e==`object`&&!!e&&`then`in e}PE(WE,`isPromiseLike`);var GE=PE(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),KE=PE(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),qE=G.use,JE=Object.defineProperty,YE=(e,t)=>JE(e,`name`,{value:t,configurable:!0}),XE=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=FE(`Primitive.${t}`),r=G.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,K.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function ZE(e,t){e&&is.flushSync(()=>e.dispatchEvent(t))}YE(ZE,`dispatchDiscreteCustomEvent`);var QE=Object.defineProperty,$E=(e,t)=>QE(e,`name`,{value:t,configurable:!0});function eD(e){let t=G.useRef(e);return G.useEffect(()=>{t.current=e}),G.useMemo(()=>((...e)=>t.current?.(...e)),[])}$E(eD,`useCallbackRef`);var tD=Object.defineProperty,nD=(e,t)=>tD(e,`name`,{value:t,configurable:!0}),rD=`dismissableLayer.update`,iD=`dismissableLayer.pointerDownOutside`,aD=`dismissableLayer.focusOutside`,oD,sD=G.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),cD=G.forwardRef(nD(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=G.useContext(sD),[d,f]=G.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=G.useState({}),h=cE(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=G.useRef(!1),C=dD(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:G.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),w=fD(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=eD(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return G.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T,E]),G.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(oD=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),pD(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=oD))}},[d,p,n,u]),G.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),pD())},[d,u]),G.useEffect(()=>{let e=nD(()=>m({}),`handleUpdate`);return document.addEventListener(rD,e),()=>document.removeEventListener(rD,e)},[]),(0,K.jsx)(XE.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:$T(e.onFocusCapture,w.onFocusCapture),onBlurCapture:$T(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:$T(e.onPointerDownCapture,C.onPointerDownCapture)})},`DismissableLayer`));function lD(){let e=G.useContext(sD),[t,n]=G.useState(null);return G.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}nD(lD,`useDismissableLayerSurface`);var uD=nD(()=>!0,`IS_TRUE`);function dD(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=uD}=t,s=eD(e),c=G.useRef(!1),l=G.useRef(!1),u=G.useRef(new Map),d=G.useRef(()=>{});return G.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}nD(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}nD(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}nD(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}nD(p,`handleInteractionBubble`);let m=nD(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||mD(iD,s,p,{discrete:!0})};if(nD(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:nD(()=>c.current=!0,`onPointerDownCapture`)}}nD(dD,`usePointerDownOutside`);function fD(e,t=globalThis?.document){let n=eD(e),r=G.useRef(!1);return G.useEffect(()=>{let e=nD(e=>{e.target&&!r.current&&mD(aD,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:nD(()=>r.current=!0,`onFocusCapture`),onBlurCapture:nD(()=>r.current=!1,`onBlurCapture`)}}nD(fD,`useFocusOutside`);function pD(){let e=new CustomEvent(rD);document.dispatchEvent(e)}nD(pD,`dispatchUpdate`);function mD(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?ZE(i,a):i.dispatchEvent(a)}nD(mD,`handleAndDispatchCustomEvent`);var hD=Object.defineProperty,gD=(e,t)=>hD(e,`name`,{value:t,configurable:!0}),_D=`focusScope.autoFocusOnMount`,vD=`focusScope.autoFocusOnUnmount`,yD={bubbles:!1,cancelable:!0},bD=G.forwardRef(gD(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=G.useState(null),l=eD(i),u=eD(a),d=G.useRef(null),f=cE(t,c),p=G.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;G.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:DD(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||DD(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&DD(s)};gD(e,`handleFocusIn`),gD(t,`handleFocusOut`),gD(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),G.useEffect(()=>{if(s){OD.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(_D,yD);s.addEventListener(_D,l),s.dispatchEvent(t),t.defaultPrevented||(xD(jD(CD(s)),{select:!0}),document.activeElement===e&&DD(s))}return()=>{s.removeEventListener(_D,l),setTimeout(()=>{let t=new CustomEvent(vD,yD);s.addEventListener(vD,u),s.dispatchEvent(t),t.defaultPrevented||DD(e??document.body,{select:!0}),s.removeEventListener(vD,u),OD.remove(p)},0)}}},[s,l,u,p]);let m=G.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=SD(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&DD(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&DD(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,K.jsx)(XE.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})},`FocusScope`));function xD(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(DD(r,{select:t}),document.activeElement!==n)return}gD(xD,`focusFirst`);function SD(e){let t=CD(e);return[wD(t,e),wD(t.reverse(),e)]}gD(SD,`getTabbableEdges`);function CD(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:gD(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}gD(CD,`getTabbableCandidates`);function wD(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):TD(r,{upTo:t})))return r}gD(wD,`findVisible`);function TD(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}gD(TD,`isHidden`);function ED(e){return e instanceof HTMLInputElement&&`select`in e}gD(ED,`isSelectableInput`);function DD(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ED(e)&&t&&e.select()}}gD(DD,`focus`);var OD=kD();function kD(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=AD(e,t),e.unshift(t)},remove(t){e=AD(e,t),e[0]?.resume()}}}gD(kD,`createFocusScopesStack`);function AD(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}gD(AD,`arrayRemove`);function jD(e){return e.filter(e=>e.tagName!==`A`)}gD(jD,`removeLinks`);var MD=Object.defineProperty,ND=G.forwardRef(((e,t)=>MD(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=G.useState(!1);mE(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?is.createPortal((0,K.jsx)(XE.div,{...r,ref:t}),o):null},`Portal`)),PD=Object.defineProperty,FD=(e,t)=>PD(e,`name`,{value:t,configurable:!0});function ID(e,t){return G.useReducer((e,n)=>t[e][n]??e,e)}FD(ID,`useStateMachine`);var LD=FD(e=>{let{present:t,children:n}=e,r=RD(t),i=typeof n==`function`?n({present:r.isPresent}):G.Children.only(n),a=BD(r.ref,HD(i));return typeof n==`function`||r.isPresent?G.cloneElement(i,{ref:a}):null},`Presence`);function RD(e){let[t,n]=G.useState(),r=G.useRef(null),i=G.useRef(e),a=G.useRef(`none`),o=G.useRef(void 0),[s,c]=ID(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return G.useEffect(()=>{s===`mounted`?(a.current=o.current??VD(r.current),o.current=void 0):a.current=`none`},[s]),mE(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=VD(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),mE(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=FD(a=>{let o=VD(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=FD(e=>{e.target===t&&(a.current=VD(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:G.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=VD(t)}else r.current=null;n(e)},[])}}FD(RD,`usePresence`);function zD(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}FD(zD,`setRef`);function BD(...e){let t=G.useRef(e);return t.current=e,G.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=zD(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():zD(n[e],null)}}},[])}FD(BD,`useStableComposedRefs`);function VD(e){return e?.animationName||`none`}FD(VD,`getAnimationName`);function HD(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}FD(HD,`getElementRef`);var UD=Object.defineProperty,WD=(e,t)=>UD(e,`name`,{value:t,configurable:!0}),GD=0,KD=null;function qD(e){return JD(),e.children}WD(qD,`FocusGuards`);function JD(){G.useEffect(()=>{KD||={start:YD(),end:YD()};let{start:e,end:t}=KD;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),GD++,()=>{GD===1&&(KD?.start.remove(),KD?.end.remove(),KD=null),GD=Math.max(0,GD-1)}},[])}WD(JD,`useFocusGuards`);function YD(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}WD(YD,`createFocusGuard`);var XD=function(){return XD=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},XD.apply(this,arguments)};function ZD(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function QD(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var $D=`right-scroll-bar-position`,eO=`width-before-scroll-bar`,tO=`with-scroll-bars-hidden`,nO=`--removed-body-scroll-bar-size`;function rO(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function iO(e,t){var n=(0,G.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var aO=typeof window<`u`?G.useLayoutEffect:G.useEffect,oO=new WeakMap;function sO(e,t){var n=iO(t||null,function(t){return e.forEach(function(e){return rO(e,t)})});return aO(function(){var t=oO.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||rO(e,null)}),i.forEach(function(e){r.has(e)||rO(e,a)})}oO.set(n,e)},[e]),n}function cO(e){return e}function lO(e,t){t===void 0&&(t=cO);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function uO(e){e===void 0&&(e={});var t=lO(null);return t.options=XD({async:!0,ssr:!1},e),t}var dO=function(e){var t=e.sideCar,n=ZD(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return G.createElement(r,XD({},n))};dO.isSideCarExport=!0;function fO(e,t){return e.useMedium(t),dO}var pO=uO(),mO=function(){},hO=G.forwardRef(function(e,t){var n=G.useRef(null),r=G.useState({onScrollCapture:mO,onWheelCapture:mO,onTouchMoveCapture:mO}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=ZD(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=sO([n,t]),C=XD(XD({},b),i);return G.createElement(G.Fragment,null,u&&G.createElement(x,{sideCar:pO,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?G.cloneElement(G.Children.only(s),XD(XD({},C),{ref:S})):G.createElement(v,XD({},C,{className:c,ref:S}),s))});hO.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},hO.classNames={fullWidth:eO,zeroRight:$D};var gO=function(){if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function _O(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=gO();return t&&e.setAttribute(`nonce`,t),e}function vO(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function yO(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var bO=function(){var e=0,t=null;return{add:function(n){e==0&&(t=_O())&&(vO(t,n),yO(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},xO=function(){var e=bO();return function(t,n){G.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},SO=function(){var e=xO();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},CO={left:0,top:0,right:0,gap:0},wO=function(e){return parseInt(e||``,10)||0},TO=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[wO(n),wO(r),wO(i)]},EO=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return CO;var t=TO(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},DO=SO(),OO=`data-scroll-locked`,kO=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
1323
+ .${tO} {
1324
1324
  overflow: hidden ${r};
1325
1325
  padding-right: ${s}px ${r};
1326
1326
  }
1327
- body[${EO}] {
1327
+ body[${OO}] {
1328
1328
  overflow: hidden ${r};
1329
1329
  overscroll-behavior: contain;
1330
1330
  ${[t&&`position: relative ${r};`,n===`margin`&&`
@@ -1337,26 +1337,26 @@ diff --git`)}function db(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.star
1337
1337
  `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
1338
1338
  }
1339
1339
 
1340
- .${ZD} {
1340
+ .${$D} {
1341
1341
  right: ${s}px ${r};
1342
1342
  }
1343
1343
 
1344
- .${QD} {
1344
+ .${eO} {
1345
1345
  margin-right: ${s}px ${r};
1346
1346
  }
1347
1347
 
1348
- .${ZD} .${ZD} {
1348
+ .${$D} .${$D} {
1349
1349
  right: 0 ${r};
1350
1350
  }
1351
1351
 
1352
- .${QD} .${QD} {
1352
+ .${eO} .${eO} {
1353
1353
  margin-right: 0 ${r};
1354
1354
  }
1355
1355
 
1356
- body[${EO}] {
1357
- ${eO}: ${s}px;
1356
+ body[${OO}] {
1357
+ ${nO}: ${s}px;
1358
1358
  }
1359
- `},OO=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},kO=function(){G.useEffect(function(){return document.body.setAttribute(EO,(OO()+1).toString()),function(){var e=OO()-1;e<=0?document.body.removeAttribute(EO):document.body.setAttribute(EO,e.toString())}},[])},AO=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;kO();var a=G.useMemo(function(){return wO(i)},[i]);return G.createElement(TO,{styles:DO(a,!t,i,n?``:`!important`)})},jO=!1;if(typeof window<`u`)try{var MO=Object.defineProperty({},"passive",{get:function(){return jO=!0,!0}});window.addEventListener(`test`,MO,MO),window.removeEventListener(`test`,MO,MO)}catch{jO=!1}var NO=jO?{passive:!1}:!1,PO=function(e){return e.tagName===`TEXTAREA`},FO=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!PO(e)&&n[t]===`visible`)},IO=function(e){return FO(e,`overflowY`)},LO=function(e){return FO(e,`overflowX`)},RO=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),VO(e,r)){var i=HO(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},zO=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},BO=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},VO=function(e,t){return e===`v`?IO(t):LO(t)},HO=function(e,t){return e===`v`?zO(t):BO(t)},UO=function(e,t){return e===`h`&&t===`rtl`?-1:1},WO=function(e,t,n,r,i){var a=UO(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=HO(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&VO(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},GO=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},KO=function(e){return[e.deltaX,e.deltaY]},qO=function(e){return e&&`current`in e?e.current:e},JO=function(e,t){return e[0]===t[0]&&e[1]===t[1]},YO=function(e){return`
1359
+ `},AO=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},jO=function(){G.useEffect(function(){return document.body.setAttribute(OO,(AO()+1).toString()),function(){var e=AO()-1;e<=0?document.body.removeAttribute(OO):document.body.setAttribute(OO,e.toString())}},[])},MO=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;jO();var a=G.useMemo(function(){return EO(i)},[i]);return G.createElement(DO,{styles:kO(a,!t,i,n?``:`!important`)})},NO=!1;if(typeof window<`u`)try{var PO=Object.defineProperty({},"passive",{get:function(){return NO=!0,!0}});window.addEventListener(`test`,PO,PO),window.removeEventListener(`test`,PO,PO)}catch{NO=!1}var FO=NO?{passive:!1}:!1,IO=function(e){return e.tagName===`TEXTAREA`},LO=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!IO(e)&&n[t]===`visible`)},RO=function(e){return LO(e,`overflowY`)},zO=function(e){return LO(e,`overflowX`)},BO=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),UO(e,r)){var i=WO(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},VO=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},HO=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},UO=function(e,t){return e===`v`?RO(t):zO(t)},WO=function(e,t){return e===`v`?VO(t):HO(t)},GO=function(e,t){return e===`h`&&t===`rtl`?-1:1},KO=function(e,t,n,r,i){var a=GO(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=WO(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&UO(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},qO=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},JO=function(e){return[e.deltaX,e.deltaY]},YO=function(e){return e&&`current`in e?e.current:e},XO=function(e,t){return e[0]===t[0]&&e[1]===t[1]},ZO=function(e){return`
1360
1360
  .block-interactivity-${e} {pointer-events: none;}
1361
1361
  .allow-interactivity-${e} {pointer-events: all;}
1362
- `},XO=0,ZO=[];function QO(e){var t=G.useRef([]),n=G.useRef([0,0]),r=G.useRef(),i=G.useState(XO++)[0],a=G.useState(bO)[0],o=G.useRef(e);G.useEffect(function(){o.current=e},[e]),G.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=XD([e.lockRef.current],(e.shards||[]).map(qO),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=G.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=GO(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=RO(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=RO(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return WO(h,t,e,h===`h`?s:c,!0)},[]),c=G.useCallback(function(e){var n=e;if(ZO.length&&ZO[ZO.length-1]===a){var r=`deltaY`in n?KO(n):GO(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&JO(e.delta,r)})[0];if(i&&i.should)n.cancelable&&n.preventDefault();else if(!i){var c=(o.current.shards||[]).map(qO).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=G.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:$O(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=G.useCallback(function(e){n.current=GO(e),r.current=void 0},[]),d=G.useCallback(function(t){l(t.type,KO(t),t.target,s(t,e.lockRef.current))},[]),f=G.useCallback(function(t){l(t.type,GO(t),t.target,s(t,e.lockRef.current))},[]);G.useEffect(function(){return ZO.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,NO),document.addEventListener(`touchmove`,c,NO),document.addEventListener(`touchstart`,u,NO),function(){ZO=ZO.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,NO),document.removeEventListener(`touchmove`,c,NO),document.removeEventListener(`touchstart`,u,NO)}},[]);var p=e.removeScrollBar,m=e.inert;return G.createElement(G.Fragment,null,m?G.createElement(a,{styles:YO(i)}):null,p?G.createElement(AO,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function $O(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var ek=uO(dO,QO),tk=G.forwardRef(function(e,t){return G.createElement(pO,JD({},e,{ref:t,sideCar:ek}))});tk.classNames=pO.classNames;var nk=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},rk=new WeakMap,ik=new WeakMap,ak={},ok=0,sk=function(e){return e&&(e.host||sk(e.parentNode))},ck=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=sk(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},lk=function(e,t,n,r){var i=ck(t,Array.isArray(e)?e:[e]);ak[n]||(ak[n]=new WeakMap);var a=ak[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(rk.get(e)||0)+1,l=(a.get(e)||0)+1;rk.set(e,c),a.set(e,l),o.push(e),c===1&&i&&ik.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),ok++,function(){o.forEach(function(e){var t=rk.get(e)-1,i=a.get(e)-1;rk.set(e,t),a.set(e,i),t||(ik.has(e)||e.removeAttribute(r),ik.delete(e)),i||e.removeAttribute(n)}),ok--,ok||(rk=new WeakMap,rk=new WeakMap,ik=new WeakMap,ak={})}},uk=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||nk(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),lk(r,i,n,`aria-hidden`)):function(){return null}},dk=Object.defineProperty,fk=(e,t)=>dk(e,`name`,{value:t,configurable:!0}),pk=`Dialog`,[mk,hk]=uE(pk),[gk,_k]=mk(pk),vk=fk(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=G.useRef(null),c=G.useRef(null),[l,u]=EE({prop:r,defaultProp:i??!1,onChange:a,caller:pk}),[d,f]=G.useState(0),[p,m]=G.useState(0);return(0,K.jsx)(gk,{scope:t,triggerRef:s,contentRef:c,contentId:_E(),titleId:_E(),descriptionId:_E(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:G.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),yk=`DialogPortal`,[bk,xk]=mk(yk,{forceMount:void 0}),Sk=fk(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=_k(yk,t);return(0,K.jsx)(bk,{scope:t,forceMount:n,children:G.Children.map(r,e=>(0,K.jsx)(FD,{present:n||a.open,children:(0,K.jsx)(jD,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),Ck=`DialogOverlay`,wk=G.forwardRef(fk(function(e,t){let n=xk(Ck,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=_k(Ck,e.__scopeDialog);return a.modal?(0,K.jsx)(FD,{present:r||a.open,children:(0,K.jsx)(Ek,{...i,ref:t})}):null},`DialogOverlay`)),Tk=NE(`DialogOverlay.RemoveScroll`),Ek=G.forwardRef(fk(function(e,t){let{__scopeDialog:n,...r}=e,i=_k(Ck,n),a=oE(t,sD());return(0,K.jsx)(tk,{as:Tk,allowPinchZoom:!0,shards:[i.contentRef],children:(0,K.jsx)(JE.div,{"data-state":Mk(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Dk=`DialogContent`,Ok=G.forwardRef(fk(function(e,t){let n=xk(Dk,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=_k(Dk,e.__scopeDialog);return(0,K.jsx)(FD,{present:r||a.open,children:a.modal?(0,K.jsx)(kk,{...i,ref:t}):(0,K.jsx)(Ak,{...i,ref:t})})},`DialogContent`)),kk=G.forwardRef(fk(function(e,t){let n=_k(Dk,e.__scopeDialog),r=G.useRef(null),i=oE(t,n.contentRef,r);return G.useEffect(()=>{let e=r.current;if(e)return uk(e)},[]),(0,K.jsx)(jk,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:ZT(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:ZT(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:ZT(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Ak=G.forwardRef(fk(function(e,t){let n=_k(Dk,e.__scopeDialog),r=G.useRef(!1),i=G.useRef(!1);return(0,K.jsx)(jk,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),jk=G.forwardRef(fk(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=_k(Dk,n);return KD(),(0,K.jsx)(K.Fragment,{children:(0,K.jsx)(vD,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,K.jsx)(oD,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":Mk(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`));function Mk(e){return e?`open`:`closed`}fk(Mk,`getState`);var Nk=`[cmdk-group=""]`,Pk=`[cmdk-group-items=""]`,Fk=`[cmdk-group-heading=""]`,Ik=`[cmdk-item=""]`,Lk=`${Ik}:not([aria-disabled="true"])`,Rk=`cmdk-item-select`,zk=`data-value`,Bk=(e,t,n)=>qT(e,t,n),Vk=G.createContext(void 0),Hk=()=>G.useContext(Vk),Uk=G.createContext(void 0),Wk=()=>G.useContext(Uk),Gk=G.createContext(void 0),Kk=G.forwardRef((e,t)=>{let n=oA(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=oA(()=>new Set),i=oA(()=>new Map),a=oA(()=>new Map),o=oA(()=>new Set),s=iA(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=_E(),y=_E(),b=_E(),x=G.useRef(null),S=lA();aA(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),aA(()=>{S(6,k)},[]);let C=G.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),S(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=A()?.id,C.emit()}),r||S(5,k),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=G.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),S(2,()=>{E(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{O(),E(),n.current.value||D(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();S(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function T(e,t){let r=s.current?.filter??Bk;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(Pk);t?t.appendChild(e.parentElement===t?e:e.closest(`${Pk} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Pk} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${Nk}[${zk}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(zk);C.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=T(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function k(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(Nk)?.querySelector(Fk))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return x.current?.querySelector(`${Ik}[aria-selected="true"]`)}function j(){return Array.from(x.current?.querySelectorAll(Lk)||[])}function M(e){let t=j()[e];t&&C.setState(`value`,t.getAttribute(zk))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(zk))}function P(e){let t=A()?.closest(Nk),n;for(;t&&!n;)t=e>0?nA(t,Nk):rA(t,Nk),n=t?.querySelector(Lk);n?C.setState(`value`,n.getAttribute(zk)):N(e)}let F=()=>M(j().length-1),I=e=>{e.preventDefault(),e.metaKey?F():e.altKey?P(1):N(1)},L=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?P(-1):N(-1)};return G.createElement(JE.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&I(e);break;case`ArrowDown`:I(e);break;case`p`:case`k`:g&&e.ctrlKey&&L(e);break;case`ArrowUp`:L(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),F();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(Rk);t.dispatchEvent(e)}}}}},G.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:fA},c),dA(e,e=>G.createElement(Uk.Provider,{value:C},G.createElement(Vk.Provider,{value:w},e))))}),qk=G.forwardRef((e,t)=>{let n=_E(),r=G.useRef(null),i=G.useContext(Gk),a=Hk(),o=iA(e),s=o.current?.forceMount??i?.forceMount;aA(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=cA(n,r,[e.value,e.children,r],e.keywords),l=Wk(),u=sA(e=>e.value&&e.value===c.current),d=sA(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);G.useEffect(()=>{let t=r.current;if(t&&!e.disabled)return t.addEventListener(Rk,f),()=>t.removeEventListener(Rk,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return G.createElement(JE.div,{ref:aE(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),Jk=G.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=_E(),s=G.useRef(null),c=G.useRef(null),l=_E(),u=Hk(),d=sA(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));aA(()=>u.group(o),[]),cA(o,s,[e.value,e.heading,c]);let f=G.useMemo(()=>({id:o,forceMount:i}),[i]);return G.createElement(JE.div,{ref:aE(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!d||void 0},n&&G.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),dA(e,e=>G.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},G.createElement(Gk.Provider,{value:f},e))))}),Yk=G.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=G.useRef(null),a=sA(e=>!e.search);return!n&&!a?null:G.createElement(JE.div,{ref:aE(i,t),...r,"cmdk-separator":``,role:`separator`})}),Xk=G.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=Wk(),o=sA(e=>e.search),s=sA(e=>e.selectedItemId),c=Hk();return G.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),G.createElement(JE.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),Zk=G.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=G.useRef(null),o=G.useRef(null),s=sA(e=>e.selectedItemId),c=Hk();return G.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),G.createElement(JE.div,{ref:aE(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},dA(e,e=>G.createElement(`div`,{ref:aE(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),Qk=G.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return G.createElement(vk,{open:n,onOpenChange:r},G.createElement(Sk,{container:o},G.createElement(wk,{"cmdk-overlay":``,className:i}),G.createElement(Ok,{"aria-label":e.label,"cmdk-dialog":``,className:a},G.createElement(Kk,{ref:t,...s}))))}),$k=G.forwardRef((e,t)=>sA(e=>e.filtered.count===0)?G.createElement(JE.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),eA=G.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return G.createElement(JE.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},dA(e,e=>G.createElement(`div`,{"aria-hidden":!0},e)))}),tA=Object.assign(Kk,{List:Zk,Item:qk,Input:Xk,Group:Jk,Separator:Yk,Dialog:Qk,Empty:$k,Loading:eA});function nA(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function rA(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function iA(e){let t=G.useRef(e);return aA(()=>{t.current=e}),t}var aA=typeof window>`u`?G.useEffect:G.useLayoutEffect;function oA(e){let t=G.useRef();return t.current===void 0&&(t.current=e()),t}function sA(e){let t=Wk(),n=()=>e(t.snapshot());return G.useSyncExternalStore(t.subscribe,n,n)}function cA(e,t,n,r=[]){let i=G.useRef(),a=Hk();return aA(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(zk,s),i.current=s}),i}var lA=()=>{let[e,t]=G.useState(),n=oA(()=>new Map);return aA(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function uA(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function dA({asChild:e,children:t},n){return e&&G.isValidElement(t)?G.cloneElement(uA(t),{ref:t.ref},n(t.props.children)):n(t)}var fA={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function pA({className:e,...t}){return(0,K.jsx)(tA,{"data-slot":`command`,className:H(`flex size-full flex-col overflow-hidden rounded-xl bg-popover p-1 text-popover-foreground`,e),...t})}function mA({title:e=`Command Palette`,description:t=`Search for a command to run...`,children:n,className:r,showCloseButton:i=!1,...a}){return(0,K.jsxs)(JC,{...a,children:[(0,K.jsxs)($C,{className:`sr-only`,children:[(0,K.jsx)(tw,{children:e}),(0,K.jsx)(nw,{children:t})]}),(0,K.jsx)(QC,{className:H(`top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0`,r),showCloseButton:i,children:n})]})}function hA({className:e,...t}){return(0,K.jsx)(`div`,{"data-slot":`command-input-wrapper`,className:`p-1 pb-0`,children:(0,K.jsxs)(xT,{className:`h-8! bg-input/20 dark:bg-input/30`,children:[(0,K.jsx)(tA.Input,{"data-slot":`command-input`,className:H(`w-full text-xs/relaxed outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,e),...t}),(0,K.jsx)(CT,{children:(0,K.jsx)(Wo,{className:`size-3.5 shrink-0 opacity-50`})})]})})}function gA({className:e,...t}){return(0,K.jsx)(tA.List,{"data-slot":`command-list`,className:H(`no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none`,e),...t})}function _A({className:e,...t}){return(0,K.jsx)(tA.Empty,{"data-slot":`command-empty`,className:H(`py-6 text-center text-xs/relaxed`,e),...t})}function vA({className:e,...t}){return(0,K.jsx)(tA.Group,{"data-slot":`command-group`,className:H(`overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2.5 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function yA({className:e,children:t,...n}){return(0,K.jsxs)(tA.Item,{"data-slot":`command-item`,className:H(`group/command-item relative flex min-h-7 cursor-default items-center gap-2 rounded-md px-2.5 py-1.5 text-xs/relaxed outline-hidden select-none in-data-[slot=dialog-content]:rounded-md data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 data-selected:*:[svg]:text-foreground`,e),...n,children:[t,(0,K.jsx)(D,{className:`ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100`})]})}function bA(e,t,n){let r=(0,q.c)(12),i;r[0]===e?i=r[1]:(i=pe(e),r[0]=e,r[1]=i);let[a,o]=Wi(i),s=Dn(),c=ze(),l=mt(),u;r[2]!==s?.environmentId||r[3]!==l||r[4]!==n||r[5]!==c||r[6]!==o||r[7]!==e?(u=(t,r,i)=>o(t).then(async t=>{if(!t.deleted){r(t.plan);return}n();let i=c.state.matches.at(-1)?.params;t.plan.worktreePath&&i&&`worktreeId`in i&&`projectId`in i&&i.worktreeId===e.scope.worktreeId&&i.projectId===e.scope.projectId&&(`environmentId`in i?i.environmentId:s?.environmentId)===e.connection.environmentId&&await l({to:`/`})},i),r[2]=s?.environmentId,r[3]=l,r[4]=n,r[5]=c,r[6]=o,r[7]=e,r[8]=u):u=r[8];let d;return r[9]!==a||r[10]!==u?(d={result:a,submit:u},r[9]=a,r[10]=u,r[11]=d):d=r[11],d}function xA(e){let t=(0,q.c)(15),n;t[0]===e?n=t[1]:(n=dt(e),t[0]=e,t[1]=n);let[r,i]=Wi(n),a;t[2]===e?a=t[3]:(a=ht(e),t[2]=e,t[3]=a);let[o,s]=Wi(a),[c,l]=(0,G.useState)(!1),u;t[4]===e?u=t[5]:(u=fr(e),t[4]=e,t[5]=u);let{unresolved:d}=Ue(u),f=c?o:r,p=r.waiting||o.waiting,m;t[6]!==s||t[7]!==i||t[8]!==d?(m=(e,t)=>{l(d);let n;if(d)n=s(void 0);else if(e)n=i(e);else return;return n.then(e=>{(e.state===`succeeded`||e.state===`no-change`)&&t()},SA)},t[6]=s,t[7]=i,t[8]=d,t[9]=m):m=t[9];let h;return t[10]!==f||t[11]!==p||t[12]!==m||t[13]!==d?(h={result:f,pending:p,unresolved:d,submit:m},t[10]=f,t[11]=p,t[12]=m,t[13]=d,t[14]=h):h=t[14],h}function SA(){}function CA(){let e=(0,q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(g,{handle:RC,children:wA}),e[0]=t):t=e[0],t}function wA(e){let{payload:t}=e;return t&&(0,K.jsx)(TA,{...t},t.requestId)}function TA(e){let t=(0,q.c)(66),{connection:n,entry:r,worktreeId:i}=e,[a,o]=(0,G.useState)(),s;t[0]!==r.projectId||t[1]!==i?(s={projectId:r.projectId,worktreeId:i},t[0]=r.projectId,t[1]=i,t[2]=s):s=t[2];let c;t[3]!==n||t[4]!==s?(c={connection:n,scope:s},t[3]=n,t[4]=s,t[5]=c):c=t[5];let{result:l,pending:u,unresolved:d,submit:f}=xA(c),p;t[6]!==r.projectId||t[7]!==i?(p={projectId:r.projectId,worktreeId:i},t[6]=r.projectId,t[7]=i,t[8]=p):p=t[8];let{result:m}=vC(p,n,!0),h=pn(Ht(m)),g;t[9]===r.projectId?g=t[10]:(g=e=>e.id===r.projectId,t[9]=r.projectId,t[10]=g);let _=qC(n).projects.find(g),v=Ti(h?.bases??[],_?.worktrees??[],i),y;t[11]===a?y=t[12]:(y=e=>e.ref===a&&!e.current&&!e.inUse,t[11]=a,t[12]=y);let b=v.some(y),x=`Switch branch`;d&&(x=`Check outcome`),u&&(x=`Checking switch`);let S=QC,C=!u,w;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,K.jsx)(tw,{children:`Switch branch`}),t[13]=w):w=t[13];let T;t[14]===r.name?T=t[15]:(T=(0,K.jsxs)($C,{children:[w,(0,K.jsxs)(nw,{children:[`Choose a branch for `,r.name,`. Branches used by another worktree are unavailable.`]})]}),t[14]=r.name,t[15]=T);let E=pA,O;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,K.jsx)(hA,{"aria-label":`Find a branch`,placeholder:`Find a branch`}),t[16]=O):O=t[16];let k=gA,A;t[17]===m?A=t[18]:(A=sr(m)&&(0,K.jsx)(`p`,{role:`status`,className:`p-3 text-xs text-muted-foreground`,children:`Reading branches`}),t[17]=m,t[18]=A);let j;t[19]===m?j=t[20]:(j=Wn(m)&&(0,K.jsx)(`p`,{role:`alert`,className:`p-3 text-xs text-muted-foreground`,children:`Branches could not be read.`}),t[19]=m,t[20]=j);let M=h&&(0,K.jsx)(_A,{children:`No matching branch`}),N=vA,P;t[21]!==a||t[22]!==u||t[23]!==d?(P=e=>(0,K.jsxs)(yA,{value:e.name,disabled:u||d||e.current||e.inUse,onSelect:()=>o(e.ref),"data-checked":a===e.ref,className:`cursor-pointer`,children:[(0,K.jsx)(wo,{}),(0,K.jsx)(Fr,{text:e.name,className:`min-w-0 flex-1`}),e.current&&(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`Current`}),e.inUse&&(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`In use`}),a===e.ref&&(0,K.jsx)(D,{})]},e.ref),t[21]=a,t[22]=u,t[23]=d,t[24]=P):P=t[24];let F=v.map(P),I;t[25]!==N||t[26]!==F?(I=(0,K.jsx)(N,{children:F}),t[25]=N,t[26]=F,t[27]=I):I=t[27];let L;t[28]!==k||t[29]!==A||t[30]!==j||t[31]!==M||t[32]!==I?(L=(0,K.jsxs)(k,{"aria-label":`Branches`,children:[A,j,M,I]}),t[28]=k,t[29]=A,t[30]=j,t[31]=M,t[32]=I,t[33]=L):L=t[33];let R;t[34]!==E||t[35]!==L||t[36]!==O?(R=(0,K.jsxs)(E,{children:[O,L]}),t[34]=E,t[35]=L,t[36]=O,t[37]=R):R=t[37];let ee;t[38]===d?ee=t[39]:(ee=d&&(0,K.jsx)(`p`,{role:`status`,children:`The previous switch is not confirmed. Check its outcome before switching again.`}),t[38]=d,t[39]=ee);let te;t[40]===l?te=t[41]:(te=Wn(l)&&(0,K.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:String(xr(l.cause))}),t[40]=l,t[41]=te);let z;t[42]===l?z=t[43]:(z=It(l)&&l.value.state!==`succeeded`&&l.value.state!==`no-change`&&(0,K.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:l.value.message??`The branch could not be switched.`}),t[42]=l,t[43]=z);let ne;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,K.jsx)(wn,{variant:`outline`}),t[44]=ne):ne=t[44];let B;t[45]===u?B=t[46]:(B=(0,K.jsx)(XC,{render:ne,disabled:u,children:`Cancel`}),t[45]=u,t[46]=B);let re=u||!d&&!b,ie;t[47]!==a||t[48]!==f?(ie=()=>void f(a,EA),t[47]=a,t[48]=f,t[49]=ie):ie=t[49];let V;t[50]!==x||t[51]!==re||t[52]!==ie?(V=(0,K.jsx)(wn,{disabled:re,onClick:ie,children:x}),t[50]=x,t[51]=re,t[52]=ie,t[53]=V):V=t[53];let ae;t[54]!==B||t[55]!==V?(ae=(0,K.jsxs)(ew,{children:[B,V]}),t[54]=B,t[55]=V,t[56]=ae):ae=t[56];let oe;return t[57]!==S||t[58]!==R||t[59]!==ee||t[60]!==te||t[61]!==z||t[62]!==ae||t[63]!==C||t[64]!==T?(oe=(0,K.jsxs)(S,{showCloseButton:C,children:[T,R,ee,te,z,ae]}),t[57]=S,t[58]=R,t[59]=ee,t[60]=te,t[61]=z,t[62]=ae,t[63]=C,t[64]=T,t[65]=oe):oe=t[65],oe}function EA(){return RC.close()}function DA(){let e=(0,q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(vS,{handle:LC,children:OA}),e[0]=t):t=e[0],t}function OA(e){let{payload:t}=e;return t&&(0,K.jsx)(kA,{...t},t.requestId)}function kA(e){let t=(0,q.c)(21),{entry:n,connection:r,worktreeId:i}=e,a=$r(r),o;t[0]===a?o=t[1]:(o=Ri(a),t[0]=a,t[1]=o);let s=o,c;t[2]===a?c=t[3]:(c=Ci(a),t[2]=a,t[3]=c);let l=c,u;t[4]===n.name?u=t[5]:(u=(0,K.jsxs)(DS,{children:[`Delete `,n.name,`?`]}),t[4]=n.name,t[5]=u);let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,K.jsx)(OS,{children:`Choose what to delete this time. Your saved settings won’t change. Review history stays available.`}),t[6]=d):d=t[6];let f;t[7]===u?f=t[8]:(f=(0,K.jsxs)(TS,{children:[u,d]}),t[7]=u,t[8]=f);let p;t[9]!==l||t[10]!==r||t[11]!==n||t[12]!==s||t[13]!==i?(p=s?(0,K.jsx)(AA,{settings:s,entry:n,connection:r,worktreeId:i}):(0,K.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:l??`Reading deletion settings…`}),t[9]=l,t[10]=r,t[11]=n,t[12]=s,t[13]=i,t[14]=p):p=t[14];let m;t[15]===s?m=t[16]:(m=!s&&(0,K.jsx)(AS,{children:`Cancel`}),t[15]=s,t[16]=m);let h;return t[17]!==f||t[18]!==p||t[19]!==m?(h=(0,K.jsxs)(wS,{children:[f,p,m]}),t[17]=f,t[18]=p,t[19]=m,t[20]=h):h=t[20],h}function AA(e){let t=(0,q.c)(56),{settings:n,entry:r,connection:i,worktreeId:a}=e,{detached:o}=r,s;t[0]!==o||t[1]!==n?(s=()=>ci(n,o),t[0]=o,t[1]=n,t[2]=s):s=t[2];let[c,l]=(0,G.useState)(s),[u,d]=(0,G.useState)(),[f,p]=(0,G.useState)(!1),m;t[3]!==r.projectId||t[4]!==a?(m={projectId:r.projectId,worktreeId:a},t[3]=r.projectId,t[4]=a,t[5]=m):m=t[5];let h;t[6]!==i||t[7]!==m?(h={connection:i,scope:m},t[6]=i,t[7]=m,t[8]=h):h=t[8];let{result:g,submit:_}=bA(h,r,jA),v;t[9]!==f||t[10]!==c||t[11]!==u||t[12]!==_?(v=()=>void _({options:c,...u?{confirmation:{plan:u,discardChanges:f}}:{}},d,()=>{d(void 0),p(!1)}),t[9]=f,t[10]=c,t[11]=u,t[12]=_,t[13]=v):v=t[13];let y=v,b=g.waiting,x=Object.values(c).some(Boolean),S=u&&(u.dirty||u.unpushed),C=u&&!u.worktreePath&&!u.localBranch&&!u.remoteBranch,w=`Review deletion`;u&&(w=`Delete`),b&&(w=`Checking`);let T;t[14]!==o||t[15]!==c||t[16]!==b?(T=Ni.map(e=>{let{key:t,label:n}=e;return(0,K.jsxs)(Mn,{orientation:`horizontal`,children:[(0,K.jsx)(en,{htmlFor:`delete-${t}`,children:n}),(0,K.jsx)(_r,{id:`delete-${t}`,checked:c[t],disabled:b||o&&t!==`deleteWorktree`,onCheckedChange:e=>{l(n=>({...n,[t]:e})),d(void 0),p(!1)},className:`cursor-pointer`})]},t)}),t[14]=o,t[15]=c,t[16]=b,t[17]=T):T=t[17];let E;t[18]===o?E=t[19]:(E=o&&(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This worktree is detached: there is no checked-out branch to delete.`}),t[18]=o,t[19]=E);let D;t[20]!==o||t[21]!==c?(D=!o&&!c.deleteWorktree&&c.deleteLocalBranch&&(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Keep the worktree folder and its files, detach it from the branch, then delete the local branch.`}),t[20]=o,t[21]=c,t[22]=D):D=t[22];let O;t[23]!==o||t[24]!==c?(O=!o&&c.deleteWorktree&&!c.deleteLocalBranch&&(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`The worktree folder will be deleted. The local branch will be kept.`}),t[23]=o,t[24]=c,t[25]=O):O=t[25];let k;t[26]!==T||t[27]!==E||t[28]!==D||t[29]!==O?(k=(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[T,E,D,O]}),t[26]=T,t[27]=E,t[28]=D,t[29]=O,t[30]=k):k=t[30];let A;t[31]!==r.path||t[32]!==u?(A=u?(0,K.jsx)(`p`,{className:`whitespace-pre-wrap break-all text-xs text-muted-foreground`,children:Ma(u)}):(0,K.jsx)(`p`,{className:`break-all text-xs text-muted-foreground`,children:r.path}),t[31]=r.path,t[32]=u,t[33]=A):A=t[33];let j;t[34]!==f||t[35]!==b||t[36]!==S?(j=S&&(0,K.jsxs)(Mn,{orientation:`horizontal`,children:[(0,K.jsx)(en,{htmlFor:`delete-discard-changes`,children:`I understand the risk of losing changes and commits`}),(0,K.jsx)(_r,{id:`delete-discard-changes`,checked:f,disabled:b,onCheckedChange:p,className:`cursor-pointer`})]}),t[34]=f,t[35]=b,t[36]=S,t[37]=j):j=t[37];let M;t[38]===g?M=t[39]:(M=Wn(g)&&(0,K.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:Zr(xr(g.cause))}),t[38]=g,t[39]=M);let N;t[40]===b?N=t[41]:(N=(0,K.jsx)(AS,{disabled:b,children:`Cancel`}),t[40]=b,t[41]=N);let P=u?`destructive`:`default`,F=b||!x||!!(C||S&&!f),I;t[42]!==w||t[43]!==y||t[44]!==P||t[45]!==F?(I=(0,K.jsx)(wn,{variant:P,disabled:F,onClick:y,children:w}),t[42]=w,t[43]=y,t[44]=P,t[45]=F,t[46]=I):I=t[46];let L;t[47]!==N||t[48]!==I?(L=(0,K.jsxs)(ES,{children:[N,I]}),t[47]=N,t[48]=I,t[49]=L):L=t[49];let R;return t[50]!==A||t[51]!==j||t[52]!==M||t[53]!==L||t[54]!==k?(R=(0,K.jsxs)(K.Fragment,{children:[k,A,j,M,L]}),t[50]=A,t[51]=j,t[52]=M,t[53]=L,t[54]=k,t[55]=R):R=t[55],R}function jA(){return LC.close()}function MA(e){let t=(0,q.c)(34),{environmentId:n,environmentName:r,project:i}=e,a;t[0]!==n||t[1]!==i?(a={project:i,remote:n},t[0]=n,t[1]=i,t[2]=a):a=t[2];let o=a,s;t[3]===i?s=t[4]:(s={label:`Copy path`,icon:Ke,run:()=>Ft(Gn(i),`project path`),destructive:!1},t[3]=i,t[4]=s);let c;t[5]===o?c=t[6]:(c={label:`Rename project`,icon:bt,run:()=>PC.openWithPayload(o),destructive:!1},t[5]=o,t[6]=c);let l;t[7]===o?l=t[8]:(l={label:`Walkthrough settings`,icon:Ko,run:()=>NC.openWithPayload(o),destructive:!1},t[7]=o,t[8]=l);let u;t[9]===o?u=t[10]:(u={label:`Remove from Porcelain`,icon:vo,run:()=>FC.openWithPayload(o),destructive:!0},t[9]=o,t[10]=u);let d;t[11]!==s||t[12]!==c||t[13]!==l||t[14]!==u?(d=[s,c,l,u],t[11]=s,t[12]=c,t[13]=l,t[14]=u,t[15]=d):d=t[15];let f=d,p=`Project actions: ${i.name} · ${r}`,m;t[16]===p?m=t[17]:(m=(0,K.jsx)(er,{render:(0,K.jsx)(wn,{variant:`ghost`,size:`icon-xs`,"aria-label":p})}),t[16]=p,t[17]=m);let h;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,K.jsx)(ro,{}),t[18]=h):h=t[18];let g;t[19]===m?g=t[20]:(g=(0,K.jsx)(Xn,{render:m,children:h}),t[19]=m,t[20]=g);let _;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,K.jsx)(Vt,{children:`Project actions`}),t[21]=_):_=t[21];let v;t[22]===g?v=t[23]:(v=(0,K.jsxs)(yr,{disableHoverablePopup:!0,children:[g,_]}),t[22]=g,t[23]=v);let y;t[24]===i?y=t[25]:(y=!i.available&&(0,K.jsx)(Kt,{children:cr(i)}),t[24]=i,t[25]=y);let b;t[26]===f?b=t[27]:(b=f.map(NA),t[26]=f,t[27]=b);let x;t[28]!==y||t[29]!==b?(x=(0,K.jsx)(zt,{className:`w-56 max-w-[calc(100vw-2rem)]`,children:(0,K.jsxs)(Pn,{children:[y,b]})}),t[28]=y,t[29]=b,t[30]=x):x=t[30];let S;return t[31]!==v||t[32]!==x?(S=(0,K.jsxs)(Jn,{children:[v,x]}),t[31]=v,t[32]=x,t[33]=S):S=t[33],S}function NA(e){let{label:t,icon:n,run:r,destructive:i}=e;return(0,K.jsxs)(Cr,{className:`cursor-pointer`,variant:i?`destructive`:`default`,onClick:r,children:[(0,K.jsx)(n,{}),t]},t)}function PA(e){let t=(0,q.c)(10),{projectName:n,environmentName:r,environmentIcon:i,showEnvironment:a}=e,o=`${n} · ${r}`,s;t[0]===n?s=t[1]:(s=(0,K.jsx)(`div`,{className:`flex min-w-0 text-xs font-semibold`,children:(0,K.jsx)(Fr,{text:n})}),t[0]=n,t[1]=s);let c;t[2]!==i||t[3]!==r||t[4]!==a?(c=a&&(0,K.jsxs)(`div`,{role:`img`,"aria-label":`Computer: ${r}`,className:`flex min-w-0 items-center gap-1 text-2xs text-muted-foreground`,children:[(0,K.jsx)(Et,{icon:i,className:`size-3 shrink-0`}),(0,K.jsx)(Fr,{text:r})]}),t[2]=i,t[3]=r,t[4]=a,t[5]=c):c=t[5];let l;return t[6]!==o||t[7]!==s||t[8]!==c?(l=(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5 px-2 py-2`,"aria-label":o,children:[s,c]}),t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9],l}function FA(e){let t=(0,q.c)(3),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,K.jsx)(`div`,{className:`flex min-w-0 flex-col leading-tight`,children:(0,K.jsx)(Fr,{className:`text-sm font-semibold tracking-tight`,text:`Porcelain`})}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,K.jsxs)(`header`,{className:`desktop-sidebar-header mt-0.5 flex h-10 shrink-0 items-center gap-2 px-2`,children:[r,n]}),t[1]=n,t[2]=i),i}function IA(e){let t=(0,q.c)(23),{remotes:n,onOpenProject:r}=e;if(!n?.length){let e;t[0]===r?e=t[1]:(e=(0,K.jsx)(Bt,{className:`relative top-0 right-0 ml-auto w-6 cursor-pointer`,"aria-label":`Open project`,onClick:()=>r(null)}),t[0]=r,t[1]=e);let n;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,K.jsx)(Ro,{className:`text-muted-foreground`}),t[2]=n):n=t[2];let i;t[3]===e?i=t[4]:(i=(0,K.jsx)(Xn,{render:e,children:n}),t[3]=e,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.jsx)(Vt,{role:`tooltip`,children:`Open project`}),t[5]=a):a=t[5];let o;return t[6]===i?o=t[7]:(o=(0,K.jsxs)(yr,{disableHoverablePopup:!0,children:[i,a]}),t[6]=i,t[7]=o),o}let i;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,K.jsxs)(yr,{disableHoverablePopup:!0,children:[(0,K.jsx)(Xn,{render:(0,K.jsx)(er,{render:(0,K.jsx)(Bt,{className:`relative top-0 right-0 ml-auto w-6 cursor-pointer`,"aria-label":`Open project`})}),children:(0,K.jsx)(Ro,{className:`text-muted-foreground`})}),(0,K.jsx)(Vt,{role:`tooltip`,children:`Open project`})]}),t[8]=i):i=t[8];let a;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.jsx)(Kt,{children:`Open project on`}),t[9]=a):a=t[9];let o;t[10]===r?o=t[11]:(o=()=>r(null),t[10]=r,t[11]=o);let s;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,K.jsx)(wr,{}),t[12]=s):s=t[12];let c;t[13]===o?c=t[14]:(c=(0,K.jsxs)(Cr,{onClick:o,children:[s,`This computer`]}),t[13]=o,t[14]=c);let l;if(t[15]!==r||t[16]!==n){let e;t[18]===r?e=t[19]:(e=e=>(0,K.jsx)(LA,{entry:e,onOpen:()=>r(e)},e.remote.environmentId),t[18]=r,t[19]=e),l=n.map(e),t[15]=r,t[16]=n,t[17]=l}else l=t[17];let u;return t[20]!==c||t[21]!==l?(u=(0,K.jsxs)(Jn,{children:[i,(0,K.jsx)(zt,{align:`end`,className:`w-56`,children:(0,K.jsxs)(Pn,{children:[a,c,l]})})]}),t[20]=c,t[21]=l,t[22]=u):u=t[22],u}function LA(e){let t=(0,q.c)(11),{entry:n,onOpen:r}=e,i=y(n.remote),a=i.kind===`online`,o=!a,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,K.jsx)(rn,{}),t[0]=s):s=t[0];let c=a?i.name:n.remote.name,l;t[1]===c?l=t[2]:(l=(0,K.jsx)(Fr,{className:`min-w-0`,text:c}),t[1]=c,t[2]=l);let d;t[3]!==a||t[4]!==i?(d=!a&&(0,K.jsx)(yt,{variant:u(i),className:`relative top-0 right-0 ml-auto w-6 cursor-pointer`,children:Re(i)}),t[3]=a,t[4]=i,t[5]=d):d=t[5];let f;return t[6]!==r||t[7]!==o||t[8]!==l||t[9]!==d?(f=(0,K.jsxs)(Cr,{disabled:o,onClick:r,children:[s,l,d]}),t[6]=r,t[7]=o,t[8]=l,t[9]=d,t[10]=f):f=t[10],f}function RA(e){return e.main?Eo:wo}function zA(e){let t=(0,q.c)(7),{container:n}=e,{toasts:r}=si();if(!n)return null;let i;t[0]===r?i=t[1]:(i=r.map(BA),t[0]=r,t[1]=i);let a;t[2]===i?a=t[3]:(a=(0,K.jsx)(Pi,{children:i}),t[2]=i,t[3]=a);let o;return t[4]!==n||t[5]!==a?(o=(0,K.jsx)(Di,{container:n,children:a}),t[4]=n,t[5]=a,t[6]=o):o=t[6],o}function BA(e){return(0,K.jsx)(vi,{toast:e,children:(0,K.jsxs)(ui,{children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1 wrap-anywhere`,children:[(0,K.jsx)(Qr,{}),(0,K.jsx)(hi,{})]}),(0,K.jsx)(Si,{}),(0,K.jsx)(oi,{})]})},e.id)}function VA(e){return(0,K.jsxs)(Hn,{render:(0,K.jsx)(`span`,{className:`block`}),children:[(0,K.jsxs)(`span`,{className:`block`,children:[e.failures.length,` `,e.failures.length===1?`worktree`:`worktrees`,` ·`,` `,(0,K.jsx)(vn,{render:(0,K.jsx)(wn,{variant:`link`,size:`sm`}),children:`Details`})]}),(0,K.jsx)(or,{render:(0,K.jsx)(`span`,{className:`block`}),children:(0,K.jsx)(`span`,{role:`list`,tabIndex:0,"aria-label":`Affected worktrees`,className:`mt-2 block max-h-48 space-y-2 overflow-y-auto`,children:e.failures.map(({entry:e,detail:t})=>(0,K.jsxs)(`span`,{role:`listitem`,className:`block wrap-anywhere`,children:[(0,K.jsx)(`span`,{className:`block font-medium`,children:e.name}),t&&(0,K.jsx)(`span`,{className:`block`,children:t})]},e.key))})})]})}function HA(e){let t=(0,q.c)(122),{remotes:n,selected:r,onSelect:i,onOpenPullRequest:a,onOpenProject:o,onOpenSettings:s,settingsOpen:c,onOpenShortcuts:l}=e,{connection:u}=Me(),[d,f]=(0,G.useState)(null),m=yT(),h=yT(),g=yT(),_=[u,...(n??[]).map(qA)],{projects:v,filters:y,loading:b,messages:x}=B(_n(_)),S=B(we),C=p(we),{query:w,filter:T}=S;ye(k(_));let E=p(Jt(_));ye(iT({connections:_,description:VA}));let D=Ua(),O;t[0]===D.href?O=t[1]:(O={href:D.href,open:!1},t[0]=D.href,t[1]=O);let[A,j]=(0,G.useState)(O),M=A.href===D.href&&A.open,P;t[2]===C?P=t[3]:(P=e=>C(t=>({...t,query:e})),t[2]=C,t[3]=P);let F=P,I=T.projects!==void 0||T.environments!==void 0,L=w.trim()||I?`No matching worktrees`:`No projects registered`,R=w.trim()||I?`Try another search or clear the filters.`:`Open a Git repository to get started.`,{setOpenMobile:ee,isMobile:te}=nn(),z=r?{kind:`worktree`,worktreeId:r.worktreeId,environmentId:r.remote??u.environmentId}:void 0,ne,re;if(t[4]!==v){let e=v.flatMap(KA).filter(GA);ne=e[0]?.key,re=e.at(-1)?.key,t[4]=v,t[5]=ne,t[6]=re}else ne=t[5],re=t[6];let ie=re,V;t[7]!==u||t[8]!==i||t[9]!==ee?(V=e=>{e.worktreeId&&(i({remote:e.environmentId===u.environmentId?null:e.environmentId,projectId:e.projectId,worktreeId:e.worktreeId}),ee(!1))},t[7]=u,t[8]=i,t[9]=ee,t[10]=V):V=t[10];let ae=V,se;t[11]!==o||t[12]!==n?(se=(0,K.jsx)(FA,{children:(0,K.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center`,children:(0,K.jsx)(IA,{remotes:n,onOpenProject:o})})}),t[11]=o,t[12]=n,t[13]=se):se=t[13];let ce;t[14]===F?ce=t[15]:(ce=e=>F(e.target.value),t[14]=F,t[15]=ce);let le;t[16]!==h||t[17]!==g||t[18]!==w.length||t[19]!==F?(le=e=>{e.key===`Escape`&&w.length>0&&(e.stopPropagation(),F(``)),(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),(e.key===`ArrowDown`?h:g).element?.focus())},t[16]=h,t[17]=g,t[18]=w.length,t[19]=F,t[20]=le):le=t[20];let ue;t[21]!==te||t[22]!==w||t[23]!==ce||t[24]!==le?(ue=(0,K.jsx)(DT,{autoFocus:te,type:`search`,"aria-label":`Search worktrees`,placeholder:`Search`,value:w,onChange:ce,onKeyDown:le}),t[21]=te,t[22]=w,t[23]=ce,t[24]=le,t[25]=ue):ue=t[25];let de;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,K.jsx)(CT,{children:(0,K.jsx)(Wo,{})}),t[26]=de):de=t[26];let fe;t[27]===ue?fe=t[28]:(fe=(0,K.jsxs)(xT,{className:`min-w-0 flex-1`,children:[ue,de]}),t[27]=ue,t[28]=fe);let pe;t[29]===D.href?pe=t[30]:(pe=e=>j({href:D.href,open:e}),t[29]=D.href,t[30]=pe);let me;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,K.jsxs)(yr,{disableHoverablePopup:!0,children:[(0,K.jsx)(Xn,{render:(0,K.jsx)(er,{render:(0,K.jsx)(Bt,{"aria-label":`Filter worktrees`,className:`relative top-0 right-0 w-6 cursor-pointer`})}),children:(0,K.jsx)(Mo,{})}),(0,K.jsx)(Vt,{children:`Filter worktrees`})]}),t[31]=me):me=t[31];let he;if(t[32]!==y||t[33]!==C){let e;t[35]===C?e=t[36]:(e=e=>(0,K.jsxs)(Pn,{children:[(0,K.jsx)(Kt,{children:e.label}),e.items.map(t=>(0,K.jsxs)(ur,{className:`cursor-pointer`,checked:t.checked,closeOnClick:!1,onCheckedChange:()=>C(n=>({...n,filter:{...n.filter,[e.key]:t.next}})),children:[t.icon&&(0,K.jsx)(Et,{icon:t.icon}),(0,K.jsx)(Fr,{propagateEscape:!0,text:t.label,className:`min-w-0 flex-1`})]},t.id)),(0,K.jsx)(tn,{})]},e.key),t[35]=C,t[36]=e),he=y.map(e),t[32]=y,t[33]=C,t[34]=he}else he=t[34];let ge;t[37]===C?ge=t[38]:(ge=(0,K.jsx)(Cr,{className:`cursor-pointer`,onClick:()=>C(WA),children:`Clear filters`}),t[37]=C,t[38]=ge);let _e;t[39]!==he||t[40]!==ge?(_e=(0,K.jsx)(zt,{align:`start`,className:`flex max-h-[min(24rem,var(--available-height))] w-80 max-w-[calc(100vw-2rem)] flex-col overflow-y-hidden`,children:(0,K.jsxs)(`div`,{className:`-m-1 min-h-0 overflow-y-auto p-1`,children:[he,ge]})}),t[39]=he,t[40]=ge,t[41]=_e):_e=t[41];let be;t[42]!==M||t[43]!==pe||t[44]!==_e?(be=(0,K.jsxs)(Jn,{open:M,onOpenChange:pe,children:[me,_e]}),t[42]=M,t[43]=pe,t[44]=_e,t[45]=be):be=t[45];let xe;t[46]!==fe||t[47]!==be?(xe=(0,K.jsxs)(`div`,{className:`navigator-filters mb-2 flex items-center gap-1 px-2`,children:[fe,be]}),t[46]=fe,t[47]=be,t[48]=xe):xe=t[48];let Se=kn,Ce;t[49]===b?Ce=t[50]:(Ce=b&&(0,K.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 px-3 py-2 text-xs text-muted-foreground`,children:[(0,K.jsx)(At,{"aria-label":`Reading worktrees`}),`Reading worktrees…`]}),t[49]=b,t[50]=Ce);let H=v.map(e=>(0,K.jsx)(vr,{className:`mb-3`,children:(0,K.jsxs)(Hn,{open:e.expanded,onOpenChange:t=>C(n=>({...n,expanded:{...n.expanded,[e.key]:t}})),className:`group/project`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,K.jsx)(PA,{projectName:e.project.name,environmentName:e.environmentName,environmentIcon:e.environmentIcon,showEnvironment:_.length>1}),(0,K.jsx)(MA,{project:e.project,environmentId:e.connection.environmentId===u.environmentId?null:e.connection.environmentId,environmentName:e.environmentName}),(0,K.jsxs)(yr,{disableHoverablePopup:!0,children:[(0,K.jsx)(Xn,{render:(0,K.jsx)(vn,{render:(0,K.jsx)(Bt,{className:`relative top-0 right-0 w-6 cursor-pointer`,"aria-label":`${e.expanded?`Collapse`:`Expand`} ${e.project.name} · ${e.environmentName}`})}),children:(0,K.jsx)(Ze,{className:`group-data-closed/project:-rotate-90`})}),(0,K.jsx)(Vt,{children:e.expanded?`Collapse project`:`Expand project`})]})]}),(0,K.jsx)(or,{children:(0,K.jsxs)(Qt,{children:[e.entries.map(t=>{let n=z!==void 0&&He(t,z),r=t.pullRequest.state===`available`?t.pullRequest:void 0,i=t.kind===`worktree`?N(t.changes):``,o=RA(t),s=r?.checks?.state===`available`&&r.checks.result===`failed`,c=t.key===ie?g.attach:void 0;t.key===ne&&(c=h.attach);let l=`${[t.name,t.projectName,t.environmentName,t.main?`Main worktree`:void 0,t.detached?`Detached HEAD`:void 0,t.detached?t.path:void 0,t.kind===`worktree`?oe(t.changes):void 0,r?.number?`Pull request #${r.number}`:void 0,t.available?void 0:`Unavailable`].filter(Boolean).join(`, `)}${n?`, Current`:``}`;return(0,K.jsx)(Yn,{children:(0,K.jsx)(gT,{onRetryChanges:()=>E({environmentId:t.environmentId}),entry:t,connection:_.find(t=>t.environmentId===e.connection.environmentId)??u,children:(0,K.jsx)(Fr,{text:t.path?`${t.name} · ${t.path}`:t.name,disclose:t.detached?`always`:`clipped`,renderTrigger:(e,u)=>(0,K.jsxs)(`div`,{"data-navigator-card":``,role:`presentation`,tabIndex:-1,className:n?`relative rounded-md bg-card`:`relative rounded-md hover:bg-card`,children:[(0,K.jsx)(mr,{className:`absolute inset-0 h-full cursor-pointer`,"data-sidebar":`menu-button`,size:`xs`,"aria-label":l,"aria-current":n?`page`:void 0,onClick:()=>ae(t),render:(0,K.jsx)(`button`,{type:`button`,ref:c,disabled:!t.available})}),(0,K.jsxs)(mr,{size:`xs`,className:`pointer-events-none relative`,children:[(0,K.jsx)(qn,{className:`self-start`,children:(0,K.jsx)(o,{className:`mt-0.5 size-3.5 text-muted-foreground`})}),(0,K.jsxs)(ar,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[u(t.displayTitle??t.name,n?`min-w-0 flex-1 font-semibold`:`min-w-0 flex-1 font-medium`),t.detached&&(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Detached`}),s&&(0,K.jsx)(Ya,{className:`size-3 shrink-0 text-del-fg`,"aria-label":`Checks failed`})]}),t.displayTitle&&(0,K.jsx)(`div`,{className:`min-w-0 font-mono text-2xs text-muted-foreground`,children:u(t.branch,`block font-mono text-2xs`)}),(r?.number||i)&&(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-2xs text-muted-foreground`,children:[r?.number&&(0,K.jsx)(wn,{variant:`ghost`,size:`xs`,className:`relative pointer-events-auto cursor-pointer`,"aria-label":`Open PR #${r.number} · ${t.projectName} · ${t.environmentName} · ${ve(r.checks)}`,onClick:()=>{a(t),ee(!1)},children:(0,K.jsxs)(`span`,{className:`text-muted-foreground`,children:[`#`,r.number]})}),i&&(0,K.jsx)(`span`,{role:`img`,"aria-label":`Local uncommitted changes: ${oe(t.changes)}`,children:i})]})]})]})]})})})},t.key)}),e.entries.length===0&&!b&&(0,K.jsx)(`p`,{className:`px-2 py-3 text-xs text-muted-foreground`,children:`No matching worktrees`})]})})]})},e.key)),Te;t[51]!==R||t[52]!==L||t[53]!==b||t[54]!==x.length||t[55]!==v.length?(Te=!b&&x.length===0&&v.length===0&&(0,K.jsx)(kT,{children:(0,K.jsxs)(AT,{children:[(0,K.jsx)(jT,{children:L}),(0,K.jsx)(MT,{children:R})]})}),t[51]=R,t[52]=L,t[53]=b,t[54]=x.length,t[55]=v.length,t[56]=Te):Te=t[56];let Ee;t[57]===x?Ee=t[58]:(Ee=x.map(UA),t[57]=x,t[58]=Ee);let De;t[59]!==b||t[60]!==x.length||t[61]!==E?(De=x.length>0&&(0,K.jsx)(wn,{variant:`ghost`,disabled:b,onClick:()=>E(void 0),children:`Read again`}),t[59]=b,t[60]=x.length,t[61]=E,t[62]=De):De=t[62];let Oe;t[63]!==Se||t[64]!==Ce||t[65]!==H||t[66]!==Te||t[67]!==Ee||t[68]!==De?(Oe=(0,K.jsxs)(Se,{children:[Ce,H,Te,Ee,De]}),t[63]=Se,t[64]=Ce,t[65]=H,t[66]=Te,t[67]=Ee,t[68]=De,t[69]=Oe):Oe=t[69];let ke;t[70]===d?ke=t[71]:(ke=(0,K.jsx)(`div`,{ref:f,children:(0,K.jsx)(Na,{toastManager:rT,children:(0,K.jsx)(zA,{container:d})})}),t[70]=d,t[71]=ke);let U;t[72]===m?U=t[73]:(U=e=>m.attach(e),t[72]=m,t[73]=U);let Ae=c?`Close Settings`:`Settings`,je=c?`submit`:`button`,Ne=c?`close-settings`:void 0,Pe=c?void 0:s,Fe;t[74]===c?Fe=t[75]:(Fe=e=>{c&&e.key===`Escape`&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},t[74]=c,t[75]=Fe);let Ie;t[76]!==U||t[77]!==Ae||t[78]!==je||t[79]!==Ne||t[80]!==Pe||t[81]!==Fe?(Ie=(0,K.jsx)(wn,{ref:U,variant:`ghost`,className:`min-w-0 shrink`,"aria-label":Ae,type:je,form:Ne,onClick:Pe,onKeyDown:Fe}),t[76]=U,t[77]=Ae,t[78]=je,t[79]=Ne,t[80]=Pe,t[81]=Fe,t[82]=Ie):Ie=t[82];let Le;t[83]===c?Le=t[84]:(Le=c?(0,K.jsx)(un,{}):(0,K.jsx)(Ko,{className:`text-muted-foreground`}),t[83]=c,t[84]=Le);let Re=c?`Close`:`Settings`,ze;t[85]===Re?ze=t[86]:(ze=(0,K.jsx)(Fr,{text:Re}),t[85]=Re,t[86]=ze);let Be;t[87]===c?Be=t[88]:(Be=c&&(0,K.jsx)(_T,{children:Ui(Fi.closeSettings)}),t[87]=c,t[88]=Be);let Ve;t[89]!==Ie||t[90]!==Le||t[91]!==ze||t[92]!==Be?(Ve=(0,K.jsxs)(Xn,{render:Ie,children:[Le,ze,Be]}),t[89]=Ie,t[90]=Le,t[91]=ze,t[92]=Be,t[93]=Ve):Ve=t[93];let Ue=c?`Close Settings`:`Settings`,We=c?Fi.closeSettings:Fi.openSettings,Ge;t[94]===We?Ge=t[95]:(Ge=Ui(We),t[94]=We,t[95]=Ge);let Ke;t[96]===Ge?Ke=t[97]:(Ke=(0,K.jsx)(_T,{children:Ge}),t[96]=Ge,t[97]=Ke);let qe;t[98]!==Ue||t[99]!==Ke?(qe=(0,K.jsxs)(Vt,{role:`tooltip`,children:[Ue,` `,Ke]}),t[98]=Ue,t[99]=Ke,t[100]=qe):qe=t[100];let Je;t[101]!==Ve||t[102]!==qe?(Je=(0,K.jsxs)(yr,{disableHoverablePopup:!0,children:[Ve,qe]}),t[101]=Ve,t[102]=qe,t[103]=Je):Je=t[103];let Ye;t[104]===m?Ye=t[105]:(Ye=(0,K.jsx)(dr,{fallbackFocus:m}),t[104]=m,t[105]=Ye);let Xe;t[106]===l?Xe=t[107]:(Xe=(0,K.jsx)(wn,{variant:`ghost`,size:`icon`,"aria-label":`Keyboard shortcuts`,onClick:l}),t[106]=l,t[107]=Xe);let Qe;t[108]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=(0,K.jsx)(Oo,{className:`text-muted-foreground`}),t[108]=Qe):Qe=t[108];let $e;t[109]===Xe?$e=t[110]:($e=(0,K.jsx)(Xn,{render:Xe,children:Qe}),t[109]=Xe,t[110]=$e);let et;t[111]===Symbol.for(`react.memo_cache_sentinel`)?(et=(0,K.jsxs)(Vt,{role:`tooltip`,children:[`Keyboard shortcuts`,` `,(0,K.jsx)(_T,{children:Ui(Fi.openShortcuts)})]}),t[111]=et):et=t[111];let W;t[112]===$e?W=t[113]:(W=(0,K.jsxs)(yr,{disableHoverablePopup:!0,children:[$e,et]}),t[112]=$e,t[113]=W);let tt;t[114]!==Ye||t[115]!==W?(tt=(0,K.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[Ye,W]}),t[114]=Ye,t[115]=W,t[116]=tt):tt=t[116];let nt;t[117]!==Je||t[118]!==tt?(nt=(0,K.jsxs)(`footer`,{role:`group`,"aria-label":`Navigator controls`,className:`navigator-footer flex shrink-0 items-center gap-1 p-2`,children:[Je,tt]}),t[117]=Je,t[118]=tt,t[119]=nt):nt=t[119];let rt,it;return t[120]===Symbol.for(`react.memo_cache_sentinel`)?(rt=(0,K.jsx)(DA,{}),it=(0,K.jsx)(CA,{}),t[120]=rt,t[121]=it):(rt=t[120],it=t[121]),(0,K.jsxs)(`div`,{className:`review-navigator h-full min-h-0 overflow-hidden bg-frame text-ui [--sidebar:var(--frame)] [--sidebar-foreground:var(--foreground)] [--muted:var(--card)] [--secondary:var(--card)] [--sidebar-accent:var(--card)]`,children:[(0,K.jsxs)(Pt,{role:`navigation`,collapsible:`none`,className:`h-full w-full min-h-0 overflow-hidden`,"aria-label":`Projects and worktrees`,children:[se,xe,Oe,ke,nt]}),rt,it]})}function UA(e){return(0,K.jsx)(`p`,{role:`status`,className:`px-3 text-xs wrap-anywhere`,children:e},e)}function WA(e){return{...e,filter:Pe}}function GA(e){return e.available||e.pullRequest.state===`available`}function KA(e){return e.expanded?e.entries:[]}function qA(e){return e.connection}function JA(e,t){let n=(0,q.c)(6),[r,i]=Wi(e),a;n[0]!==t||n[1]!==i?(a=e=>i(e).then(t,YA),n[0]=t,n[1]=i,n[2]=a):a=n[2];let o;return n[3]!==r||n[4]!==a?(o={result:r,submit:a},n[3]=r,n[4]=a,n[5]=o):o=n[5],o}function YA(){}function XA(e,t){let n=(0,q.c)(2),r;return n[0]===e?r=n[1]:(r=En(e),n[0]=e,n[1]=r),JA(r,t)}function ZA(e,t){let n=(0,q.c)(2),r;return n[0]===e?r=n[1]:(r=je(e),n[0]=e,n[1]=r),JA(r,t)}var QA=r;function $A(e){let t=(0,q.c)(4),{remote:n,connection:r,children:i}=e,a;return t[0]!==i||t[1]!==r||t[2]!==n?(a=n===null?i({connection:r,unavailable:void 0}):(0,K.jsx)(ej,{environmentId:n,children:i}),t[0]=i,t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function ej(e){let t=(0,q.c)(3),{environmentId:n,children:r}=e,i=c(n),a;return t[0]!==r||t[1]!==i?(a=i&&(0,K.jsx)(tj,{entry:i,children:r}),t[0]=r,t[1]=i,t[2]=a):a=t[2],a}function tj(e){let t=(0,q.c)(6),{entry:n,children:r}=e,i=y(n.remote),a;t[0]===i?a=t[1]:(a=i.kind===`online`?void 0:`${Re(i)}. ${_t(i)??`Wait for this computer to answer before changing its projects.`}`,t[0]=i,t[1]=a);let o;return t[2]!==r||t[3]!==n.connection||t[4]!==a?(o=r({connection:n.connection,unavailable:a}),t[2]=r,t[3]=n.connection,t[4]=a,t[5]=o):o=t[5],o}function nj(e){let t=(0,q.c)(5),{unavailable:n,result:r}=e,i;t[0]!==r||t[1]!==n?(i=n??(Wn(r)?it(xr(r.cause)):void 0),t[0]=r,t[1]=n,t[2]=i):i=t[2];let o=i,s;return t[3]===o?s=t[4]:(s=o&&(0,K.jsx)(Be,{variant:`destructive`,children:(0,K.jsx)(a,{children:o})}),t[3]=o,t[4]=s),s}function rj(e){let t=(0,q.c)(2),{connection:n}=e,r;return t[0]===n?r=t[1]:(r=(0,K.jsx)(vS,{handle:FC,children:e=>{let{payload:t}=e;return t&&(0,K.jsx)($A,{remote:t.remote,connection:n,children:e=>(0,K.jsx)(wS,{children:(0,K.jsx)(ij,{project:t.project,...e},t.project.id)})})}}),t[0]=n,t[1]=r),r}function ij(e){let t=(0,q.c)(32),{project:n,connection:r,unavailable:i}=e,a=ZA(r,aj),{result:o}=a,s;t[0]===n.name?s=t[1]:(s=(0,K.jsxs)(DS,{className:`break-all`,children:[`Remove `,n.name,` from Porcelain?`]}),t[0]=n.name,t[1]=s);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,K.jsx)(OS,{children:`Removes this project and its reviews and comments from Porcelain; files and Git history stay on disk.`}),t[2]=c):c=t[2];let l;t[3]===s?l=t[4]:(l=(0,K.jsxs)(TS,{children:[s,c]}),t[3]=s,t[4]=l);let u;t[5]===n?u=t[6]:(u=Gn(n),t[5]=n,t[6]=u);let d;t[7]===u?d=t[8]:(d=(0,K.jsx)(`p`,{className:`break-all font-mono text-xs text-muted-foreground`,children:u}),t[7]=u,t[8]=d);let f;t[9]!==o||t[10]!==i?(f=(0,K.jsx)(nj,{unavailable:i,result:o}),t[9]=o,t[10]=i,t[11]=f):f=t[11];let p;t[12]===o.waiting?p=t[13]:(p=(0,K.jsx)(AS,{disabled:o.waiting,children:`Cancel`}),t[12]=o.waiting,t[13]=p);let m=o.waiting||i!==void 0,h;t[14]!==n.id||t[15]!==a?(h=()=>void a.submit(n.id),t[14]=n.id,t[15]=a,t[16]=h):h=t[16];let g;t[17]===o.waiting?g=t[18]:(g=o.waiting&&(0,K.jsx)(At,{}),t[17]=o.waiting,t[18]=g);let _=o.waiting?`Removing…`:`Remove from Porcelain`,v;t[19]!==g||t[20]!==_||t[21]!==m||t[22]!==h?(v=(0,K.jsxs)(kS,{variant:`destructive`,disabled:m,onClick:h,children:[g,_]}),t[19]=g,t[20]=_,t[21]=m,t[22]=h,t[23]=v):v=t[23];let y;t[24]!==v||t[25]!==p?(y=(0,K.jsxs)(ES,{children:[p,v]}),t[24]=v,t[25]=p,t[26]=y):y=t[26];let b;return t[27]!==y||t[28]!==l||t[29]!==d||t[30]!==f?(b=(0,K.jsxs)(K.Fragment,{children:[l,d,f,y]}),t[27]=y,t[28]=l,t[29]=d,t[30]=f,t[31]=b):b=t[31],b}function aj(){return FC.close()}function oj(e){let t=(0,q.c)(2),{connection:n}=e,r;return t[0]===n?r=t[1]:(r=(0,K.jsx)(g,{handle:PC,children:e=>{let{payload:t}=e;return t&&(0,K.jsx)($A,{remote:t.remote,connection:n,children:e=>(0,K.jsx)(QC,{children:(0,K.jsx)(sj,{project:t.project,...e},t.project.id)})})}}),t[0]=n,t[1]=r),r}function sj(e){let t=(0,q.c)(40),{project:n,connection:r,unavailable:i}=e,a=XA(r,dj),{result:o}=a,s;t[0]===n.name?s=t[1]:(s={name:n.name},t[0]=n.name,t[1]=s);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c={onChange:QA},t[2]=c):c=t[2];let l;t[3]!==n.id||t[4]!==a?(l=e=>{let{value:t}=e;return a.submit({projectId:n.id,name:t.name})},t[3]=n.id,t[4]=a,t[5]=l):l=t[5];let u;t[6]!==s||t[7]!==l?(u={defaultValues:s,validators:c,onSubmit:l},t[6]=s,t[7]=l,t[8]=u):u=t[8];let d=Da(u),f;t[9]===d?f=t[10]:(f=e=>qr(e,()=>d.handleSubmit()),t[9]=d,t[10]=f);let p;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,K.jsxs)($C,{children:[(0,K.jsx)(tw,{children:`Rename project`}),(0,K.jsx)(nw,{children:`The name is only a label in this sidebar. Nothing on disk changes, and two projects may share one.`})]}),t[11]=p):p=t[11];let m;t[12]===d.Field?m=t[13]:(m=(0,K.jsx)(d.Field,{name:`name`,children:uj}),t[12]=d.Field,t[13]=m);let h;t[14]===n?h=t[15]:(h=Gn(n),t[14]=n,t[15]=h);let g;t[16]===h?g=t[17]:(g=(0,K.jsx)(`p`,{className:`break-all font-mono text-xs text-muted-foreground`,children:h}),t[16]=h,t[17]=g);let _;t[18]!==m||t[19]!==g?(_=(0,K.jsxs)(`div`,{className:`grid gap-2 py-4`,children:[m,g]}),t[18]=m,t[19]=g,t[20]=_):_=t[20];let v;t[21]!==o||t[22]!==i?(v=(0,K.jsx)(nj,{unavailable:i,result:o}),t[21]=o,t[22]=i,t[23]=v):v=t[23];let y;t[24]===o.waiting?y=t[25]:(y=(0,K.jsx)(wn,{type:`button`,variant:`outline`,disabled:o.waiting,onClick:lj,children:`Cancel`}),t[24]=o.waiting,t[25]=y);let b;t[26]!==o.waiting||t[27]!==i?(b=e=>(0,K.jsxs)(wn,{type:`submit`,disabled:!e||o.waiting||i!==void 0,children:[o.waiting&&(0,K.jsx)(At,{}),o.waiting?`Renaming…`:`Rename`]}),t[26]=o.waiting,t[27]=i,t[28]=b):b=t[28];let x;t[29]!==d.Subscribe||t[30]!==b?(x=(0,K.jsx)(d.Subscribe,{selector:cj,children:b}),t[29]=d.Subscribe,t[30]=b,t[31]=x):x=t[31];let S;t[32]!==y||t[33]!==x?(S=(0,K.jsxs)(ew,{children:[y,x]}),t[32]=y,t[33]=x,t[34]=S):S=t[34];let C;return t[35]!==_||t[36]!==v||t[37]!==S||t[38]!==f?(C=(0,K.jsxs)(`form`,{onSubmit:f,children:[p,_,v,S]}),t[35]=_,t[36]=v,t[37]=S,t[38]=f,t[39]=C):C=t[39],C}function cj(e){return e.canSubmit}function lj(){return PC.close()}function uj(e){return(0,K.jsxs)(Mn,{"data-invalid":e.state.meta.isTouched&&!e.state.meta.isValid,children:[(0,K.jsx)(St,{htmlFor:`project-name`,children:`Name`}),(0,K.jsx)(h,{id:`project-name`,name:e.name,value:e.state.value,autoFocus:!0,"aria-invalid":e.state.meta.isTouched&&!e.state.meta.isValid,"aria-describedby":e.state.meta.isTouched&&!e.state.meta.isValid?`project-name-error`:void 0,onBlur:e.handleBlur,onChange:t=>e.handleChange(t.target.value)}),e.state.meta.isTouched&&!e.state.meta.isValid&&(0,K.jsx)(Wt,{id:`project-name-error`,errors:e.state.meta.errors})]})}function dj(){return PC.close()}function fj(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function pj(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function mj(e){return e/100*window.innerHeight}function hj(e){return e/100*window.innerWidth}function gj(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function _j({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=gj(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=pj(t,i);break;case`em`:r=fj(t,i);break;case`vh`:r=mj(i);break;case`vw`:r=hj(i)}return r}function vj(e){return parseFloat(e.toFixed(3))}function yj({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function bj(e){let{panels:t}=e,n=yj({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=vj(_j({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=vj(_j({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=vj(_j({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=vj(_j({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function xj(e,t=`Assertion error`){if(!e)throw Error(t)}function Sj(e,t){return Array.from(t).sort(e===`horizontal`?Cj:wj)}function Cj(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function wj(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function Tj(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Ej(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function Dj({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=Ej(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return xj(i,`No rect found`),i}var Oj;function kj(){return Oj===void 0&&(Oj=typeof matchMedia==`function`&&!!matchMedia(`(pointer:coarse)`).matches),Oj}function Aj(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Sj(n,Array.from(t.children).filter(Tj).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,Dj({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=kj()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:yj({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var jj=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0){if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},Mj={cursorFlags:0,state:`inactive`},Nj=new jj;function Pj(){return Mj}function Fj(e){return Nj.addListener(`change`,e)}function Ij(e){let t=Mj,n={...Mj};n.cursorFlags=e,Mj=n,Nj.emit(`change`,{prev:t,next:n})}function Lj(e){let t=Mj;Mj=e,Nj.emit(`change`,{prev:t,next:e})}var Rj=e=>e,zj=()=>{},Bj=1,Vj=2,Hj=4,Uj=8,Wj=3,Gj=12,Kj;function qj(){return Kj===void 0&&(Kj=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(Kj=!0)),Kj}function Jj({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++}})}if(r!==0||i!==0){if(n===`active`&&e&&qj()){let t=(e&Bj)!==0,n=(e&Vj)!==0,r=(e&Hj)!==0,i=(e&Uj)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}return qj()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var Yj=new WeakMap;function Xj(e){if(!e.defaultView||!e.adoptedStyleSheets)return;let{prevStyle:t,styleSheet:n}=Yj.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let r=Pj();switch(r.state){case`active`:case`hover`:{let e=Jj({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0)}Yj.set(e,{prevStyle:t,styleSheet:n})}var Zj=new Map,Qj=new jj;function $j(e){Zj=new Map(Zj),Zj.delete(e)}function eM(e,t){for(let[t]of Zj)if(t.id===e)return t}function tM(e,t){for(let[t,n]of Zj)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function nM(){return Zj}function rM(e,t){return Qj.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function iM(e,t,n){let r=Zj.get(e);Zj=new Map(Zj),Zj.set(e,t),Qj.emit(`groupChange`,{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:r,next:t})}function aM(e){let t=Pj(),n=nM(),r=!1;return t.state===`active`&&(Lj({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(Xj(e),r=!0,t.hitRegions.forEach(e=>{if(!n.has(e.group))return;let t=tM(e.group.id,!0);iM(e.group,t,{isUserInteraction:!0})}))),r}function oM(e){e.defaultPrevented||aM(e.currentTarget)}function sM(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Ej(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t)}}return r?{distance:i,hitRegion:r}:void 0}function cM(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function lM(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:hM(e),b:hM(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();xj(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:mM(pM(n.a)),b:mM(pM(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var uM=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function dM(e){let t=getComputedStyle(gM(e)??e).display;return t===`flex`||t===`inline-flex`}function fM(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||dM(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||uM.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function pM(e){let t=e.length;for(;t--;){let n=e[t];if(xj(n,`Missing node`),fM(n))return n}return null}function mM(e){return e&&Number(getComputedStyle(e).zIndex)||0}function hM(e){let t=[];for(;e;)t.push(e),e=gM(e);return t}function gM(e){let{parentNode:t}=e;return cM(t)?t.host:t}function _M(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function vM({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Tj(n)||n.contains(e)||e.contains(n))return!0;if(lM(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(_M(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function yM(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Aj(r),a=sM(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&vM({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function bM(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function xM(e,t,n=0){return Math.abs(vj(e)-vj(t))<=n}function SM(e,t){return xM(e,t)?0:e>t?1:-1}function CM({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(SM(r,c)<0){if(a){let e=(i+c)/2;r=SM(r,e)<0?i:c}else r=c}return r=Math.min(s,r),r=vj(r),r}function wM({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(xM(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;xj(u!=null,`Invalid first pivot index`),xj(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];xj(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(xj(n!=null,`Previous layout not found for panel index ${t}`),xM(n,i)){let t=o-n;SM(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];xj(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(xj(n!=null,`Previous layout not found for panel index ${t}`),xM(n,o)){let t=n-i;SM(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];xj(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&SM(i,c)<0){if(e>0){let t=c-o,n=t/2;SM(i+e,c)<0&&(e=SM(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;SM(i-e,c)<0&&(e=SM(100+e,n)>0?0:-t)}}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];xj(e!=null,`Previous layout not found for panel index ${r}`);let a=CM({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];xj(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=CM({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!xM(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(bM(c,l))return i;{let t=e<0?d:u,r=s[t];xj(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=CM({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!xM(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];xj(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=CM({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(xM(i,s)||(t-=s-i,l[r]=s),xM(t,0))break;e>0?r--:r++}}}if(!xM(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function TM(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||SM(e[n],t[n])!==0)return!1;return!0}function EM({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!xM(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];xj(t!=null,`No layout data found for index ${e}`);let n=100/i*t;r[e]=n}let a=0;for(let e=0;e<t.length;e++){let i=n[e];xj(i!=null,`No layout data found for index ${e}`);let o=r[e];xj(o!=null,`No layout data found for index ${e}`);let s=CM({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!xM(a,0))for(let e=0;e<t.length;e++){let n=r[e];xj(n!=null,`No layout data found for index ${e}`);let i=n+a,o=CM({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,xM(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function DM({groupId:e,panelId:t}){let n=()=>{let t=nM();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=({nextSize:e,panels:n,prevLayout:r,derivedPanelConstraints:i})=>{let o=a(),s=n.findIndex(e=>e.id===t),c=s===0,l=s===n.length-1;if(l&&e<o&&(c||n.slice(0,s).every((e,t)=>{let n=i[t];return n?.collapsible&&xM(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:vj(100-e)}}return wM({delta:l?o-e:e-o,initialLayout:r,panelConstraints:i,pivotIndices:l?[s-1,s]:[s,s+1],prevLayout:r,trigger:`imperative-api`})},s=e=>{if(e===a())return;let{defaultLayoutDeferred:t,derivedPanelConstraints:r,group:i,groupSize:s,layout:c,separatorToPanels:l}=n(),u=EM({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});TM(c,u)||iM(i,{defaultLayoutDeferred:t,derivedPanelConstraints:r,groupSize:s,layout:u,separatorToPanels:l})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),o=a();e&&o!==t&&(n.expandToSize=o,s(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:o}=i(),c=a();if(e&&c===t){let e=o.expandToSize??n;e===0&&(e=1),s(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&xM(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=yj({group:t}),o=vj(_j({groupSize:a,panelElement:r,styleProp:e})/a*100);s(o)}}}function OM(e){e.defaultPrevented||yM(e,nM()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=DM({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function kM(e){let t=nM();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function AM({groupId:e}){let t=()=>{let t=nM();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=EM({layout:e,panelConstraints:r});return n?o:(TM(o,c)||iM(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function jM(e,t){let n=kM(e),r=tM(n.id,!0),i=n.separators.find(t=>t.element===e);xj(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);xj(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=AM({groupId:n.id}).getLayout(),c=EM({layout:wM({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});TM(s,c)||iM(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function MM(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=kM(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&jM(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&jM(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&jM(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&jM(t,-5);break;case`End`:e.preventDefault(),jM(t,100);break;case`Enter`:{e.preventDefault();let n=kM(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=tM(n.id,!0),o=n.separators.find(e=>e.element===t);xj(o,`Matching separator not found`);let s=a.get(o);xj(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(xj(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];jM(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=kM(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);xj(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),jM(t,-100)}}function NM(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=nM(),n=yM(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({focusVisible:!1,preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),Lj({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}function PM({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=wM({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(TM(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?Bj:Vj;break;case`vertical`:s|=d<0?Hj:Uj}}else iM(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&Wj:c|=s&Wj,t.movementY===0?c|=o&Gj:c|=s&Gj,Ij(c),Xj(e)}function FM(e){let t=nM(),n=Pj();n.state===`active`&&PM({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}function IM(e){if(e.defaultPrevented)return;let t=Pj(),n=nM();switch(t.state){case`active`:if(e.buttons===0){Lj({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{if(!n.has(e.group))return;let t=tM(e.group.id,!0);iM(e.group,t,{isUserInteraction:!0})});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.isConnected&&!t.hasPointerCapture?.(e.pointerId)&&t.setPointerCapture?.(e.pointerId)}PM({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=yM(e,n);r.length===0?t.state!==`inactive`&&Lj({cursorFlags:0,state:`inactive`}):Lj({cursorFlags:0,hitRegions:r,state:`hover`}),Xj(e.currentTarget);break}}}function LM(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Pj().state){case`hover`:Lj({cursorFlags:0,state:`inactive`})}}function RM(e){e.defaultPrevented||e.pointerType===`mouse`&&e.button>0||aM(e.currentTarget)&&e.preventDefault()}function zM(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=vj(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=vj((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function BM(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=yj({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:vj(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function VM(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function HM(e,t){return e.length===t.length&&e.every((e,n)=>VM(e,t[n]))}function UM({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=vj(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=vj((r[e]??0)/a*l);else{let e=vj(l/c.length);for(let t of c)u[t]=e}return u}function WM(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var GM=new Map;function KM(e){let t=!0;xj(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=yj({group:e});if(t===0)return;let n=tM(e.id);if(!n)return;let r=bj(e),i=n.defaultLayoutDeferred?zM(r):n.layout,a=EM({layout:UM({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&TM(n.layout,a)&&HM(n.derivedPanelConstraints,r)&&n.groupSize===t)continue;iM(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else BM(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{xj(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=yj({group:e}),s=bj(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(WM(e.panels,l)||(l=void 0));let u=EM({layout:e.mutableState.layouts[c]??l??zM(s),panelConstraints:s}),d=e.element.ownerDocument;GM.set(d,(GM.get(d)??0)+1);let f=new Map;return Aj(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),iM(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{xj(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,MM)}),GM.get(d)===1&&(d.addEventListener(`contextmenu`,oM,!0),d.addEventListener(`dblclick`,OM,!0),d.addEventListener(`pointerdown`,NM,!0),d.addEventListener(`pointerleave`,FM),d.addEventListener(`pointermove`,IM),d.addEventListener(`pointerout`,LM),d.addEventListener(`pointerup`,RM,!0)),function(){t=!1,GM.set(d,Math.max(0,(GM.get(d)??0)-1)),$j(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,MM)}),GM.get(d)||(d.removeEventListener(`contextmenu`,oM,!0),d.removeEventListener(`dblclick`,OM,!0),d.removeEventListener(`pointerdown`,NM,!0),d.removeEventListener(`pointerleave`,FM),d.removeEventListener(`pointermove`,IM),d.removeEventListener(`pointerout`,LM),d.removeEventListener(`pointerup`,RM,!0)),a.disconnect()}}function qM(){let[e,t]=(0,G.useState)({});return[e,(0,G.useCallback)(()=>t({}),[])]}function JM(e){let t=(0,G.useId)();return`${e??t}`}var YM=typeof window<`u`?G.useLayoutEffect:G.useEffect;function XM(e){let t=(0,G.useRef)(e);return YM(()=>{t.current=e},[e]),(0,G.useCallback)((...e)=>t.current?.(...e),[t])}function ZM(...e){return XM(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t}})})}function QM(e){let t=(0,G.useRef)({...e});return YM(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var $M=(0,G.createContext)(null);function eN(e,t){let n=(0,G.useRef)({getLayout:()=>({}),setLayout:Rj});(0,G.useImperativeHandle)(t,()=>n.current,[]),YM(()=>{Object.assign(n.current,AM({groupId:e}))})}function tN({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,G.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=XM(e=>{TM(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=XM((e,t)=>{TM(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e,{isUserInteraction:t}))}),_=JM(s),v=(0,G.useRef)(null),[y,b]=qM(),x=(0,G.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=ZM(v,a);eN(_,o);let C=XM((e,t)=>{let r=Pj(),i=eM(e),a=tM(e);if(a){let e=!1;return r.state===`active`&&(e=r.hitRegions.some(e=>e.group===i)),{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),w=QM({defaultLayout:n,disableCursor:r}),T=(0,G.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=Sj(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Sj(u,[...t.separators,e]),b(),()=>{t.separators=t.separators.filter(t=>t!==e),b()}},updatePanelProps:(e,{disabled:t})=>{let n=x.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=eM(_),i=tM(_);r&&i&&iM(r,{...i,derivedPanelConstraints:bj(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=x.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[C,_,b,u,w]),E=(0,G.useRef)(null);return YM(()=>{let e=v.current;if(e===null)return;let t=x.current,n;if(w.defaultLayout!==void 0&&Object.keys(w.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=w.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!i,element:e,id:_,mutableState:{defaultLayout:n,disableCursor:!!w.disableCursor,expandedPanelSizes:x.current.lastExpandedPanelSizes,layouts:x.current.layouts},orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};E.current=r;let a=KM(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=tM(r.id,!0);!o&&s.length>0&&(h(c),g(c,!1));let l=rM(_,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=xM(t.collapsedSize,i[t.panelId]),a=xM(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=Pj().state!==`active`;h(i),o&&g(i,e.isUserInteraction)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,G.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,K.jsx)($M.Provider,{value:T,children:(0,K.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:S,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}tN.displayName=`Group`;function nN(){let e=(0,G.useContext)($M);return xj(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function rN(e,t){let{id:n}=nN(),r=(0,G.useRef)({collapse:zj,expand:zj,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:zj});(0,G.useImperativeHandle)(t,()=>r.current,[]),YM(()=>{Object.assign(r.current,DM({groupId:n,panelId:e}))})}function iN({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:s=`preserve-relative-size`,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=JM(c),_=QM({disabled:a}),v=(0,G.useRef)(null),y=ZM(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=nN(),T=d!==null,E=XM((e,t,n)=>{d?.(e,c,n)});YM(()=>{let e=v.current;if(e!==null){let t={element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:T?E:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:l,minSize:u}};return C(t)}},[s,n,r,i,T,g,h,l,u,E,C,_]),(0,G.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),rN(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,G.useSyncExternalStore)(e=>rM(x,e),D,D),k;return k=O?JSON.parse(O):i===void 0?{flexGrow:1}:{flexGrow:void 0,flexShrink:void 0,flexBasis:i},(0,K.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...aN,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...k},children:(0,K.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}iN.displayName=`Panel`;var aN={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function oN({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=EM({layout:wM({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=EM({layout:wM({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function sN({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=JM(a),l=QM({disabled:n,disableDoubleClick:r}),[u,d]=(0,G.useState)({}),[f,p]=(0,G.useState)(`inactive`),[m,h]=(0,G.useState)(!1),g=(0,G.useRef)(null),_=ZM(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=nN(),C=b===`horizontal`?`vertical`:`horizontal`;YM(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=Fj(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=rM(y,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=n.findIndex(t=>t.panelId===e.id);d(oN({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[y,c,x,l]),(0,G.useEffect)(()=>{S(c,{disabled:n,disableDoubleClick:r})},[n,r,c,S]);let w;n&&!v&&(w=`not-allowed`);let T;if(n)T=`disabled`;else switch(f){case`active`:T=`active`;break;default:T=m?`focus`:f}return(0,K.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":C,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":T,"data-testid":c,id:c,onBlur:()=>h(!1),onFocus:()=>h(!0),ref:_,role:`separator`,style:{flexBasis:`auto`,cursor:w,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}sN.displayName=`Separator`;function cN({className:e,...t}){return(0,K.jsx)(tN,{"data-slot":`resizable-panel-group`,className:H(`flex h-full w-full aria-[orientation=vertical]:flex-col`,e),...t})}function lN({...e}){return(0,K.jsx)(iN,{"data-slot":`resizable-panel`,...e})}function uN({withHandle:e,className:t,...n}){return(0,K.jsx)(sN,{"data-slot":`resizable-handle`,className:H(`relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,t),...n,children:e&&(0,K.jsx)(`div`,{className:`z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border`})})}function dN(e){let t=(0,q.c)(4),{open:n,onOpenChange:r,children:i}=e,a;return t[0]!==i||t[1]!==r||t[2]!==n?(a=(0,K.jsx)(Fn,{open:n,onOpenChange:r,children:i}),t[0]=i,t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function fN(e){let t=(0,q.c)(17),{navigator:n,isMobile:r,open:i,children:a}=e,o=(r||!i)&&`desktop-workspace-without-navigator`,s;t[0]===o?s=t[1]:(s=H(`h-svh min-w-0 flex-1 bg-frame p-2 text-ui text-foreground`,o),t[0]=o,t[1]=s);let c;t[2]!==r||t[3]!==n||t[4]!==i?(c=!r&&i&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(lN,{id:`navigator`,defaultSize:248,minSize:220,maxSize:420,children:(0,K.jsx)(HA,{...n})}),(0,K.jsx)(uN,{"aria-label":`Worktree navigator and document panes`,className:`w-2 bg-transparent after:w-2`})]}),t[2]=r,t[3]=n,t[4]=i,t[5]=c):c=t[5];let l=r?0:420,u;t[6]===a?u=t[7]:(u=(0,K.jsx)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:a}),t[6]=a,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,K.jsx)(lN,{id:`document`,minSize:l,children:u}),t[8]=l,t[9]=u,t[10]=d):d=t[10];let f;t[11]!==c||t[12]!==d?(f=(0,K.jsxs)(cN,{orientation:`horizontal`,children:[c,d]}),t[11]=c,t[12]=d,t[13]=f):f=t[13];let p;return t[14]!==s||t[15]!==f?(p=(0,K.jsx)(`div`,{className:s,children:f}),t[14]=s,t[15]=f,t[16]=p):p=t[16],p}function pN(e,t,n,r,i){let a=(0,q.c)(17),o;a[0]!==e||a[1]!==n||a[2]!==t?(o=R({connection:e,projectId:t,number:n}),a[0]=e,a[1]=n,a[2]=t,a[3]=o):o=a[3];let s;a[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={mode:`promise`},a[4]=s):s=a[4];let[c,l]=se(o,s),u;a[5]===e?u=a[6]:(u=w(e),a[5]=e,a[6]=u);let d;a[7]===Symbol.for(`react.memo_cache_sentinel`)?(d={mode:`promise`},a[7]=d):d=a[7];let[,f]=se(u,d),p=mt(),m;a[8]!==i||a[9]!==p||a[10]!==r||a[11]!==f||a[12]!==l?(m=async e=>{e.confirmation&&i&&i();let t;try{t=await l(e),t.archived&&(await f(),await p({to:`/`,replace:!0}))}catch{return}return t.archived&&r&&r(),t},a[8]=i,a[9]=p,a[10]=r,a[11]=f,a[12]=l,a[13]=m):m=a[13];let h;return a[14]!==c||a[15]!==m?(h={result:c,submit:m},a[14]=c,a[15]=m,a[16]=h):h=a[16],h}function mN(e){let t=(0,q.c)(30),{connection:n,projectId:r,number:i,beforeLeave:a,menuItem:o}=e,s=a===void 0?hN:a,c=o!==void 0&&o,l=$r(n),u;t[0]===l?u=t[1]:(u=Ri(l),t[0]=l,t[1]=u);let d=u,f;t[2]===l?f=t[3]:(f=Ci(l),t[2]=l,t[3]=f);let p=f,{submit:m}=pN(n,r,i),h;t[4]!==s||t[5]!==n||t[6]!==i||t[7]!==r||t[8]!==d||t[9]!==m?(h=()=>{if(!d)return;let e=pi(d);IC.openWithPayload({connection:n,projectId:r,number:i,options:e,requestId:crypto.randomUUID(),beforeLeave:s}),m({options:e})},t[4]=s,t[5]=n,t[6]=i,t[7]=r,t[8]=d,t[9]=m,t[10]=h):h=t[10];let g=h;if(c){let e=!d,n;t[11]!==p||t[12]!==d?(n=!d&&p&&(0,K.jsx)(`span`,{className:`text-xs whitespace-normal text-muted-foreground`,children:p}),t[11]=p,t[12]=d,t[13]=n):n=t[13];let r;t[14]===n?r=t[15]:(r=(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[`Archive`,n]}),t[14]=n,t[15]=r);let i;return t[16]!==g||t[17]!==e||t[18]!==r?(i=(0,K.jsx)(pT,{disabled:e,onClick:g,children:r}),t[16]=g,t[17]=e,t[18]=r,t[19]=i):i=t[19],i}let _=!d,v;t[20]!==g||t[21]!==_?(v=(0,K.jsx)(wn,{variant:`outline`,size:`sm`,disabled:_,focusableWhenDisabled:!0,onClick:g,children:`Archive`}),t[20]=g,t[21]=_,t[22]=v):v=t[22];let y=v;if(d||!p)return y;let b;t[23]===y?b=t[24]:(b=(0,K.jsx)(Xn,{render:y}),t[23]=y,t[24]=b);let x;t[25]===p?x=t[26]:(x=(0,K.jsx)(Vt,{children:p}),t[25]=p,t[26]=x);let S;return t[27]!==b||t[28]!==x?(S=(0,K.jsxs)(yr,{children:[b,x]}),t[27]=b,t[28]=x,t[29]=S):S=t[29],S}function hN(){}function gN(){let e=(0,q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(vS,{handle:IC,children:_N}),e[0]=t):t=e[0],t}function _N(e){let{payload:t}=e;return t&&(0,K.jsx)(vN,{...t},t.requestId)}function vN(e){let t=(0,q.c)(31),{connection:n,projectId:r,number:i,options:a,beforeLeave:o}=e,{result:s,submit:c}=pN(n,r,i,yN,o),[l,u]=(0,G.useState)(!1),d;t[0]===s?d=t[1]:(d=It(s)?s.value:void 0,t[0]=s,t[1]=d);let f=d?.plan,p=`Checking the worktree and branches…`;if(Wn(s)&&(p=`Archiving could not be completed.`),f){let e;t[2]===f?e=t[3]:(e=ai(f),t[2]=f,t[3]=e),p=e}let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,K.jsx)(DS,{children:`Archive pull request?`}),t[4]=m):m=t[4];let h;t[5]===p?h=t[6]:(h=(0,K.jsxs)(TS,{children:[m,(0,K.jsx)(OS,{className:`whitespace-pre-wrap [overflow-wrap:anywhere]`,children:p})]}),t[5]=p,t[6]=h);let g;t[7]===s?g=t[8]:(g=Wn(s)?(0,K.jsx)(`p`,{role:`alert`,children:li(xr(s.cause))}):null,t[7]=s,t[8]=g);let _;t[9]!==l||t[10]!==f?(_=f&&(f.dirty||f.unpushed)?(0,K.jsxs)(Mn,{orientation:`horizontal`,children:[(0,K.jsx)(_r,{checked:l,onCheckedChange:u,id:`archive-discard-changes`}),(0,K.jsx)(en,{htmlFor:`archive-discard-changes`,children:`I understand the risk of losing changes and commits`})]}):null,t[9]=l,t[10]=f,t[11]=_):_=t[11];let v;t[12]===s.waiting?v=t[13]:(v=(0,K.jsx)(AS,{disabled:s.waiting,children:`Cancel`}),t[12]=s.waiting,t[13]=v);let y=s.waiting||!f||(f.dirty||f.unpushed)&&!l,b;t[14]!==l||t[15]!==a||t[16]!==f||t[17]!==c?(b=()=>{f&&c({options:a,confirmation:{plan:f,discardChanges:l}})},t[14]=l,t[15]=a,t[16]=f,t[17]=c,t[18]=b):b=t[18];let x=s.waiting?`Checking…`:`Archive pull request`,S;t[19]!==y||t[20]!==b||t[21]!==x?(S=(0,K.jsx)(wn,{variant:`destructive`,disabled:y,onClick:b,children:x}),t[19]=y,t[20]=b,t[21]=x,t[22]=S):S=t[22];let C;t[23]!==S||t[24]!==v?(C=(0,K.jsxs)(ES,{children:[v,S]}),t[23]=S,t[24]=v,t[25]=C):C=t[25];let w;return t[26]!==C||t[27]!==h||t[28]!==g||t[29]!==_?(w=(0,K.jsxs)(wS,{children:[h,g,_,C]}),t[26]=C,t[27]=h,t[28]=g,t[29]=_,t[30]=w):w=t[30],w}function yN(){return IC.close()}function bN(e){let t=(0,q.c)(2),{connection:n}=e,r;return t[0]===n?r=t[1]:(r=(0,K.jsx)(g,{handle:NC,children:e=>{let{payload:t}=e;return t&&(0,K.jsx)($A,{remote:t.remote,connection:n,children:e=>(0,K.jsxs)(QC,{children:[(0,K.jsxs)($C,{children:[(0,K.jsxs)(tw,{children:[`Walkthroughs for `,t.project.name]}),(0,K.jsx)(nw,{children:`Use the default writer or override it for this project. This choice applies to manual and automatic walkthroughs and their answers.`})]}),(0,K.jsx)(ra,{project:t.project,...e,onSaved:xN},t.project.id)]})})}}),t[0]=n,t[1]=r),r}function xN(){return NC.close()}function SN(e,t){return cn(t).filter(t=>{let n=e.getItem(t);return n!==null&&`isExpanded`in n&&n.isExpanded()})}function CN(e){let t=(0,q.c)(30),n=(0,G.useId)(),r;t[0]===n?r=t[1]:(r=Xi(n),t[0]=n,t[1]=r);let i=r,a=B(Ce),[o,s]=(0,G.useState)(!1),[c,l]=(0,G.useState)(null),u;t[2]!==c||t[3]!==e.filter||t[4]!==e.paths?(u=c?.pathsKey===e.paths.join(`\0`)&&c.filter===e.filter,t[2]=c,t[3]=e.filter,t[4]=e.paths,t[5]=u):u=t[5];let d=u;o&&!d&&s(!1);let f;t[6]!==i||t[7]!==a?(f=()=>e=>{if(e)return TN(e,a,i,l,s)},t[6]=i,t[7]=a,t[8]=f):f=t[8];let[p]=(0,G.useState)(f),m=o&&d,h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`}),t[9]=h):h=t[9];let g;t[10]!==i||t[11]!==e||t[12]!==a?(g=(0,K.jsx)(`span`,{hidden:!0,ref:t=>{t&&a.set(i,kt(e))}}),t[10]=i,t[11]=e,t[12]=a,t[13]=g):g=t[13];let _;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,K.jsx)(`div`,{ref:p,className:`flex min-h-0 flex-1 flex-col`}),t[14]=_):_=t[14];let v;t[15]===g?v=t[16]:(v=(0,K.jsxs)(uT,{render:h,children:[g,_]}),t[15]=g,t[16]=v);let y;t[17]!==d||t[18]!==o||t[19]!==c?(y=o&&d&&c&&(0,K.jsx)(`span`,{hidden:!0,ref:()=>{let{row:e}=c;return e.setAttribute(`aria-haspopup`,`menu`),e.setAttribute(`data-context-menu-open`,``),()=>{e.removeAttribute(`aria-haspopup`),e.removeAttribute(`data-context-menu-open`)}}}),t[17]=d,t[18]=o,t[19]=c,t[20]=y):y=t[20];let b;t[21]!==d||t[22]!==c||t[23]!==e.renderMenu?(b=c&&e.renderMenu(c.item,{finalFocus:d?c.finalFocus:wN,close:c.close},c.rename),t[21]=d,t[22]=c,t[23]=e.renderMenu,t[24]=b):b=t[24];let x;return t[25]!==b||t[26]!==m||t[27]!==v||t[28]!==y?(x=(0,K.jsxs)(lT,{open:m,onOpenChange:s,children:[v,y,b]}),t[25]=b,t[26]=m,t[27]=v,t[28]=y,t[29]=x):x=t[29],x}function wN(){return!1}function TN(e,t,r,i,a){let o=()=>zn(t.get(r)),s=fa(o().owner),c=t.get(s),l=new Set(c.expanded),u=!o().filter&&c.document===o().selected&&!(document.activeElement instanceof HTMLInputElement),d=!0,f=!1,p=!1,m={selected:c.document,complete:c.document===o().selected},h=null,g,_,v=new Set;function y(e){let t=requestAnimationFrame(()=>{v.delete(t),d&&e()});v.add(t)}let b=new p_({paths:o().paths,density:`default`,flattenEmptyDirectories:!0,initialExpansion:o().filter?`open`:`closed`,icons:v_(o().links),unsafeCSS:`[data-icon-name="file-tree-icon-chevron"] { color: var(--trees-fg-muted); } [data-item-git-status]:not([data-item-git-status="ignored"]) > [data-item-section="content"] { color: inherit; } [data-context-menu-open] { outline: 1px solid var(--trees-fg-muted); outline-offset: -1px; border-radius: 4px; }`,gitStatus:o().gitStatus,search:!1,renaming:{onError:e=>{h=null,o().onInvalidName(e),queueMicrotask(()=>{d&&b.resetPaths(o().paths)})},onRename:e=>{p=!0;let t=h;h=null,(t?.path.replace(/\/$/,``)===e.sourcePath.replace(/\/$/,``)?o().onCreate(e.destinationPath,t.kind):o().onMove(e.sourcePath,e.destinationPath)).catch(()=>{d&&b.resetPaths(o().paths)})}},dragAndDrop:{canDrag:()=>(f=!0,queueMicrotask(()=>{f=!1}),!0),canDrop:({draggedPaths:e,target:t})=>mn(e,t.directoryPath??``),onDropComplete:e=>{let t=o().onMove;de($n(e.draggedPaths,e.target.directoryPath??``,(e,r)=>n({try:()=>t(e,r),catch:e=>new jn(e)}))).catch(()=>{d&&b.resetPaths(o().paths)})}},renderRowDecoration:({item:e})=>{let t=o().links.find(t=>t.path===e.path);return t?{text:t.kind===`symlink`?`→ ${t.target??`?`}`:`submodule`,title:`Not followed`}:null},onSelectionChange:([e])=>{!f&&!p&&e&&h?.path.replace(/\/$/,``)!==e.replace(/\/$/,``)&&e!==o().selected&&o().onSelect(e)}});function x(){o().bindCollapseAll(()=>{f=!0,l.clear(),u=!1,m={selected:o().selected,complete:!0};let e=fa(o().owner.replace(/:search$/,``));t.set(e,{...t.get(e),expanded:[],document:o().selected,focused:null,anchor:null}),o().onFilterChange(``),b.resetPaths(o().paths,{initialExpandedPaths:[]}),f=!1}),o().bindRename(e=>o().onRequestRename(e))}function S(){let e=o().renameRequest;e&&!o().filter&&_!==e.nonce&&b.getItem(e.path)!==null&&(_=e.nonce,y(()=>{f=!0,b.startRenaming(e.path)&&e.onStart(),f=!1}))}function C(){let{creating:t}=o();if(!t||g===t.nonce)return;g=t.nonce;let n=Mt(t.kind,t.folder,e=>b.getItem(e)!==null);h={path:n,kind:t.kind},b.add(n),b.startRenaming(n,{removeIfCanceled:!0}),y(()=>{let t=e.querySelector(`[data-slot="file-tree"]`)?.shadowRoot?.querySelector(`[data-item-rename-input]`);t instanceof HTMLInputElement&&t.focus()})}function w(){let e=SN(b,o().paths).map(e=>e.replace(/\/$/,``));e.length&&!o().filter&&o().onExpand(e)}function T(){o().onContentHeight?.(b.getVisibleCount()*b.getItemHeight())}function E(){if(h)return;let{selected:e}=o(),t=o().paths;m.selected!==e&&(m={selected:e,complete:!1});let n=da(t.flatMap(e=>{let t=o().kinds.get(e);return t===void 0?[]:[{path:e,kind:t}]}),new Set([...SN(b,t),...l]),new Set(cn(t).filter(e=>b.getItem(e)!==null))).map(e=>`${e}/`);f=!0;{let r=m.complete?[]:Ir(e);b.resetPaths(t,{initialExpandedPaths:o().filter?cn(t):[...new Set([...n,...r])]});for(let e of l)b.getItem(e)!==null&&l.delete(e);let i=b.getItem(e);!m.complete&&i&&!i.isDirectory()&&(i.select(),m.complete=!0)}if(f=!1,u){f=!0;for(let e of c.selected)b.getItem(e)?.select();c.focused&&b.getItem(c.focused)&&b.focusPath(c.focused),c.anchor&&b.getItem(c.anchor)&&(b.scrollToPath(c.anchor,{focus:!1,offset:`top`}),u=!1),f=!1}w()}let D;function O(){let e=o();x(),D&&D.paths.join(`\0`)===e.paths.join(`\0`)&&D.selected===e.selected||E(),D?.gitStatus!==e.gitStatus&&b.setGitStatus(e.gitStatus),D?.links!==e.links&&b.setIcons(v_(e.links)),D=e,C(),S(),T()}let k=b.onMutation(`move`,()=>{p=!1}),A=t.subscribe(r,O),j=b.subscribe(()=>{T(),f||w()});function M(e){let t=h;if(!t)return;let n=e.composedPath().find(e=>e instanceof HTMLInputElement&&e.hasAttribute(`data-item-rename-input`));n?.value.trim()===``?(h=null,y(E)):n?.value===Dr(t.path)&&(h=null,o().onCreate(t.path,t.kind).catch(()=>{d&&b.resetPaths(o().paths)}))}function N(e){let t=e.composedPath().find(e=>e instanceof HTMLElement&&e.hasAttribute(`data-item-path`)),n=t?.dataset.itemPath,r=n===void 0?null:b.getItem(n);if(!t||!n||!r||t.querySelector(`[data-item-rename-input]`))return!1;let s={restore:!0},{paths:c,filter:l}=o();return i({row:t,pathsKey:c.join(`\0`),filter:l,finalFocus:()=>s.restore&&t.isConnected&&t.dataset.itemPath===n?t:!1,close:e=>{s.restore=e,a(!1)},rename:()=>o().onRequestRename(n),item:{path:n,name:Dr(n),kind:r.isDirectory()?`directory`:`file`}}),!0}function P(e){if(e.key===`F2`&&!h){let t=b.getFocusedPath();t&&(e.preventDefault(),e.stopPropagation(),o().onRequestRename(t))}e.key===`Enter`&&M(e),e.key===`Escape`&&h&&(h=null,y(E))}function F(e){if(e.button!==0||!e.altKey&&(e.ctrlKey||e.metaKey||e.shiftKey))return;let t=e.composedPath();if(t.some(e=>e instanceof HTMLInputElement))return;let n=t.find(e=>e instanceof HTMLElement&&e.hasAttribute(`data-item-path`))?.dataset.itemPath;if(!n||o().kinds.get(n)!==`file`)return;let r=b.getItem(n);if(r&&h?.path!==n){e.preventDefault(),e.stopPropagation(),f=!0;for(let e of b.getSelectedPaths())e!==n&&b.getItem(e)?.deselect();r.select(),f=!1,o().onSelect(n,e.altKey)}}function I(e){N(e)||e.stopPropagation()}return e.addEventListener(`keydown`,P,!0),e.addEventListener(`click`,F,!0),e.addEventListener(`blur`,M,!0),e.addEventListener(`contextmenu`,I,!0),e.addEventListener(`touchstart`,I,!0),b.render({containerWrapper:e}),b.getFileTreeContainer()?.setAttribute(`class`,`min-h-0 flex-1`),b.getFileTreeContainer()?.setAttribute(`data-slot`,`file-tree`),b.getFileTreeContainer()?.setAttribute(`aria-label`,`Worktree files`),O(),()=>{let n=b.getFileTreeContainer(),r=n?.getBoundingClientRect().top??0,i=[...n?.shadowRoot?.querySelectorAll(`[data-item-path]`)??[]].find(e=>e.getBoundingClientRect().bottom>r)?.dataset.itemPath??null;t.set(s,{expanded:[...new Set([...SN(b,o().paths),...l])],selected:b.getSelectedPaths(),focused:b.getFocusedPath(),anchor:i,document:o().selected}),d=!1;for(let e of v)cancelAnimationFrame(e);A(),j(),k(),o().bindRename(()=>void 0),o().bindCollapseAll(()=>void 0),e.removeEventListener(`keydown`,P,!0),e.removeEventListener(`click`,F,!0),e.removeEventListener(`blur`,M,!0),e.removeEventListener(`contextmenu`,I,!0),e.removeEventListener(`touchstart`,I,!0),b.cleanUp(),e.replaceChildren()}}function EN(e,t){t.close(e!==`rename`&&e!==`new-file`&&e!==`new-folder`&&e!==`open-to-side`),e===`rename`?queueMicrotask(t.rename):e===`new-file`?t.onStartCreate(`file`,t.path):e===`new-folder`?t.onStartCreate(`directory`,t.path):e===`open`||e===`open-file`?t.onOpenFile(t.path):e===`open-to-side`?t.onOpenToSide(t.path):e===`open-diff`?t.onOpenDiff(t.path):e===`timeline`?t.onOpenTimeline(t.path):e===`duplicate`?t.onDuplicate(t.path):e===`pin`?t.onTogglePinned(t.path):e===`hide`?t.onSetHidden(t.hiddenEntry??t.path,t.hiddenEntry===null):e===`copy-relative`?Ft(t.path,`relative path`):e===`copy-full`?Ft(`${t.worktreePath.replace(/\/$/,``)}/${t.path}`,`full path`):t.onTrash(t.path)}var DN=m(Tt());function ON(e,t,n){let r=(0,q.c)(7),i=n===void 0||n,a;r[0]!==e||r[1]!==i||r[2]!==t?(a=i?x({connection:e,scope:t}):DN,r[0]=e,r[1]=i,r[2]=t,r[3]=a):a=r[3];let o=a,s=B(o),c=Kr(o),l;return r[4]!==s||r[5]!==c?(l={result:s,refresh:c},r[4]=s,r[5]=c,r[6]=l):l=r[6],l}var kN={"new-file":mo,"new-folder":bo,rename:bt,duplicate:to,open:lo,"open-file":lo,"open-to-side":$a,"open-diff":fo,timeline:Ho,pin:Po,hide:ao,"copy-relative":Ke,"copy-full":Ke,trash:Xo};function AN(e){let t=(0,q.c)(14),{path:n,finalFocus:r,actions:i,hidden:a,onAction:o}=e,s=yT(),c;t[0]===s?c=t[1]:(c=e=>s.attach(e),t[0]=s,t[1]=c);let l=`${n} actions`,u;t[2]!==r||t[3]!==s.element?(u=()=>{let e=document.activeElement;return e===document.body||s.element?.contains(e)?r():!1},t[2]=r,t[3]=s.element,t[4]=u):u=t[4];let d;t[5]!==i||t[6]!==a||t[7]!==o?(d=(0,K.jsx)(MN,{actions:i,hidden:a,onAction:o}),t[5]=i,t[6]=a,t[7]=o,t[8]=d):d=t[8];let f;return t[9]!==c||t[10]!==l||t[11]!==u||t[12]!==d?(f=(0,K.jsx)(dT,{ref:c,"aria-label":l,className:`w-max max-w-[calc(100vw-2rem)] whitespace-nowrap`,onKeyDownCapture:jN,finalFocus:u,children:d}),t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function jN(e){if(e.key!==`ArrowDown`||e.target!==e.currentTarget)return;let t=e.currentTarget.querySelector(`[role="menuitem"]`);t instanceof HTMLElement&&(e.preventDefault(),e.stopPropagation(),t.focus())}function MN({actions:e,hidden:t,onAction:n}){return e.map(e=>(0,K.jsx)(NN,{action:e,onAction:n,hidden:t},e.id))}function NN(e){let t=(0,q.c)(15),{action:n,onAction:r,hidden:i}=e,a=n.id===`hide`&&i?so:kN[n.id],o;t[0]===n.id?o=t[1]:(o=(n.id===`hide`||n.id===`copy-relative`||n.id===`trash`)&&(0,K.jsx)(mT,{}),t[0]=n.id,t[1]=o);let s=n.id===`trash`?`destructive`:`default`,c;t[2]!==n.id||t[3]!==r?(c=()=>r(n.id),t[2]=n.id,t[3]=r,t[4]=c):c=t[4];let l;t[5]===a?l=t[6]:(l=(0,K.jsx)(a,{}),t[5]=a,t[6]=l);let u;t[7]!==n.label||t[8]!==s||t[9]!==c||t[10]!==l?(u=(0,K.jsxs)(pT,{variant:s,onClick:c,children:[l,n.label]}),t[7]=n.label,t[8]=s,t[9]=c,t[10]=l,t[11]=u):u=t[11];let d;return t[12]!==o||t[13]!==u?(d=(0,K.jsxs)(K.Fragment,{children:[o,u]}),t[12]=o,t[13]=u,t[14]=d):d=t[14],d}function PN(e){let t=(0,q.c)(7),{label:n,count:r}=e,i;t[0]===n?i=t[1]:(i=(0,K.jsx)(`span`,{className:`flex-1`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r===void 0?null:(0,K.jsx)(`span`,{className:`tabular-nums`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,K.jsxs)(`h3`,{className:`flex h-7 shrink-0 items-center gap-1 px-6 text-2xs font-medium text-muted-foreground`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}var FN={added:`A`,deleted:`D`,modified:`M`,renamed:`R`,untracked:`U`},IN={resolved:`Not followed`,loading:`Loading…`,missing:`Missing`,unavailable:`Listing unavailable · Open as file`};function LN(e){let t=(0,q.c)(32),{entries:n,expanded:r,onExpand:i,onRetry:a,renderDirectory:o,statuses:s,selected:c,onOpen:l,onUnpin:u,menuFor:d}=e,[f,p]=(0,G.useState)(!1);if(n.length===0)return null;let m;t[0]===s?m=t[1]:(m=new Map(s.flatMap(RN)),t[0]=s,t[1]=m);let h=m,g;t[2]===n.length?g=t[3]:(g=(0,K.jsx)(PN,{label:`Pinned`,count:n.length}),t[2]=n.length,t[3]=g);let _;if(t[4]!==n||t[5]!==r||t[6]!==h||t[7]!==d||t[8]!==i||t[9]!==l||t[10]!==a||t[11]!==u||t[12]!==f||t[13]!==o||t[14]!==c){let e;t[16]!==r||t[17]!==h||t[18]!==d||t[19]!==i||t[20]!==l||t[21]!==a||t[22]!==u||t[23]!==f||t[24]!==o||t[25]!==c?(e=e=>{let{path:t}=e,n=e.state===`resolved`&&e.entry.kind===`directory`,s=r.includes(t),m=e.state===`unavailable`||e.state===`resolved`&&(e.entry.kind===`file`||n),g=t.lastIndexOf(`/`)+1,_=d(n?`${t}/`:t);return(0,K.jsxs)(lT,{onOpenChange:e=>{e&&p(!1)},children:[(0,K.jsxs)(uT,{render:(0,K.jsx)(`li`,{className:`flex flex-wrap items-center gap-0.5`}),children:[(0,K.jsx)(Fr,{text:t,className:`min-w-0`,renderTrigger:(r,a)=>(0,K.jsxs)(`button`,{type:`button`,"data-file-tree-row":``,"aria-label":e.state===`unavailable`?`Open ${t} as file`:t,"aria-current":t===c?`page`:void 0,"aria-expanded":n?s:void 0,disabled:!m,className:H(`flex h-7.5 min-w-0 flex-1 items-center gap-1.5 rounded-md px-2 text-left hover:bg-accent`,t===c&&`bg-accent`),onClick:e=>n?i(t,!s):l(t,e.altKey),children:[n?(0,K.jsx)(S_,{expanded:s,className:`size-4 shrink-0`}):(0,K.jsx)(S_,{path:t,className:`size-4 shrink-0`}),r,g>0&&a(t.slice(0,g-1),`shrink-[100] text-muted-foreground`),h.has(t)&&(0,K.jsx)(`span`,{"aria-hidden":`true`,className:H(`ml-auto shrink-0 pl-1 font-mono text-2xs text-muted-foreground`,h.get(t)===FN.modified&&`text-brand`),children:h.get(t)})]}),children:t.slice(g)}),(!m||e.state===`unavailable`)&&(0,K.jsx)(`span`,{className:`text-2xs text-muted-foreground`,children:IN[e.state]}),e.state===`unavailable`&&(0,K.jsx)(wn,{variant:`outline`,size:`xs`,onClick:a,children:`Try again`}),(0,K.jsxs)(yr,{children:[(0,K.jsx)(Xn,{render:(0,K.jsx)(wn,{size:`icon-xs`,variant:`ghost`,"aria-label":`Unpin ${t}`,onClick:()=>u(t)}),children:(0,K.jsx)(Io,{})}),(0,K.jsx)(Vt,{role:`tooltip`,className:`break-all`,children:`Unpin ${t}`})]}),n&&s&&(0,K.jsx)(`div`,{className:`w-full`,children:o(t)})]}),(0,K.jsx)(dT,{finalFocus:!f,children:(0,K.jsx)(MN,{actions:_.actions,hidden:_.hidden,onAction:e=>{e===`open-to-side`&&(0,is.flushSync)(()=>p(!0)),_.onAction(e)}})})]},t)},t[16]=r,t[17]=h,t[18]=d,t[19]=i,t[20]=l,t[21]=a,t[22]=u,t[23]=f,t[24]=o,t[25]=c,t[26]=e):e=t[26],_=n.map(e),t[4]=n,t[5]=r,t[6]=h,t[7]=d,t[8]=i,t[9]=l,t[10]=a,t[11]=u,t[12]=f,t[13]=o,t[14]=c,t[15]=_}else _=t[15];let v;t[27]===_?v=t[28]:(v=(0,K.jsx)(`ul`,{className:`px-4`,children:_}),t[27]=_,t[28]=v);let y;return t[29]!==g||t[30]!==v?(y=(0,K.jsxs)(`section`,{"aria-label":`Pinned files`,className:`shrink-0 pt-1.5 pb-1`,children:[g,v]}),t[29]=g,t[30]=v,t[31]=y):y=t[31],y}function RN(e){let t=FN[e.status];return t===void 0?[]:[[e.path,t]]}function zN(e){let t=(0,q.c)(9),{scope:n,connection:r,worktreePath:i,selected:a,onOpen:o,sideLabel:s,actionsTarget:c}=e,l=`${r.environmentId}:${n.projectId}:${n.worktreeId}`,u;return t[0]!==c||t[1]!==r||t[2]!==o||t[3]!==n||t[4]!==l||t[5]!==a||t[6]!==s||t[7]!==i?(u=(0,K.jsx)(BN,{scope:n,connection:r,worktreePath:i,selected:a,onOpen:o,sideLabel:s,actionsTarget:c},l),t[0]=c,t[1]=r,t[2]=o,t[3]=n,t[4]=l,t[5]=a,t[6]=s,t[7]=i,t[8]=u):u=t[8],u}function BN(e){let t=(0,q.c)(86),{scope:n,connection:r,worktreePath:i,selected:a,onOpen:o,sideLabel:s,actionsTarget:c}=e,l=gS(r,n,``),u=_a(r,n),d=Wn(u.result)?xr(u.result.cause):void 0,[f,p]=(0,G.useState)(),[m,g]=(0,G.useState)(),[_,v]=(0,G.useState)(null),y=pn(Ht(nC(n,r))),b=VC(r,n.projectId),x=CC(r,n.projectId),S=WC(r,n.projectId),C=wC(r,n.projectId),w=`${r.environmentId}:${n.projectId}:${n.worktreeId}`,T=Ta(w),{showHidden:E,query:D,requested:O,pinnedExpanded:k}=T.state,A;t[0]===D?A=t[1]:(A=D.trim(),t[0]=D,t[1]=A);let j=A!==``,M=ON(r,n,j),N;t[2]===T?N=t[3]:(N=e=>T.set(t=>({...t,showHidden:e})),t[2]=T,t[3]=N);let P=N,F;t[4]===T?F=t[5]:(F=e=>T.set(t=>({...t,query:e})),t[4]=T,t[5]=F);let I=F,L;t[6]===T?L=t[7]:(L=e=>T.set(t=>{let n=e(t.requested);return n===t.requested?t:{...t,requested:n}}),t[6]=T,t[7]=L);let R=L,ee=D===``?`Collapse all`:`Clear search and collapse all`,te;t[8]!==S||t[9]!==O||t[10]!==a?(te=iP(iP(iP(O,ja(S.map(rP))),[``]),bi(a)),t[8]=S,t[9]=O,t[10]=a,t[11]=te):te=t[11];let z=_S(r,n,te),ne=[l,...z.results.flatMap(nP)],B=Xr(ne),re=j?ji(Yi(pn(Ht(M.result))?.paths??[],b,E),D):[],ie=iP(re,re.flatMap(eP)),V=[...B,...ie.filter(e=>!B.some(t=>t.path===e)).map($N)],ae=j?ie:V.map(QN),oe=Yi(ae,b,E),se=new Map(V.map(ZN)),ce;t[12]===z.results?ce=t[13]:(ce=z.results.filter(Wn),t[12]=z.results,t[13]=ce);let le=ce,ue=[{path:``,status:`loaded`,entries:l.entries},...z.states],de=ka(Yi(S,b,E),ue),fe=[...V.filter(XN).map(YN),...(y?.changes??[]).flatMap(JN).map(qN)],pe=new Set((y?.changes??[]).map(KN)),me=new Set(V.filter(GN).map(WN)),he;t[14]===o?he=t[15]:(he=(e,t)=>o({kind:`file`,path:e},{toSide:t!==void 0&&t}),t[14]=o,t[15]=he);let ge=he,_e=e=>u.duplicate(e,Ct(e,e=>se.has(e)),ge),ve;t[16]!==_e||t[17]!==u.result.waiting||t[18]!==a?(ve=()=>{u.result.waiting||_e(a)},t[16]=_e,t[17]=u.result.waiting,t[18]=a,t[19]=ve):ve=t[19];let ye=me.has(a),be;t[20]===ye?be=t[21]:(be={enabled:ye,ignoreInputs:!0},t[20]=ye,t[21]=be),zi(Fi.duplicateFile,ve,be);let xe=(e,t)=>{let n=t!==void 0&&t,r=se.get(e);r===`symlink`||r===`submodule`?o({kind:`file`,path:e},{toSide:n}):r===`file`&&ge(e,n)},{collapseAll:Se,renameFile:Ce,bindCollapseAll:H,bindRename:we}=Qi(w),Te=e=>{let t=aa(e,b),n=V.find(t=>ca(t.path)===ca(e));return{hidden:t!==null,actions:Hr(n,{changed:pe.has(e),openToSideLabel:s,hiddenEntry:t,ownHidden:t===ca(e),hiddenName:t?.replace(/\/$/,``).split(`/`).at(-1)??``,pinned:n?.kind===`file`||n?.kind===`directory`?S.includes(ca(e)):void 0}),run:(n,r,a)=>EN(n,{path:e,hiddenEntry:t,worktreePath:i,close:r,rename:a,onStartCreate:(e,t)=>{u.result.waiting||p({kind:e,folder:t,nonce:Date.now()})},onOpenFile:e=>o({kind:`file`,path:e}),onOpenToSide:e=>ge(e,!0),onOpenDiff:e=>o({kind:`change`,path:e}),onOpenTimeline:e=>o({kind:`timeline`,path:e}),onSetHidden:(e,t)=>We(x.submit({path:e,hidden:t})),onTogglePinned:e=>We(C.submit({path:e,pinned:!S.includes(ca(e))})),onTrash:v,onDuplicate:e=>{u.result.waiting||_e(e)}})}},Ee;t[22]!==I||t[23]!==R?(Ee=e=>{R(t=>iP(t,bi(e))),I(``),g({path:e,nonce:Date.now()})},t[22]=I,t[23]=R,t[24]=Ee):Ee=t[24];let De;t[25]!==u||t[26]!==o?(De=(e,t)=>u.create(e,t,e=>o({kind:`file`,path:e})),t[25]=u,t[26]=o,t[27]=De):De=t[27];let Oe;t[28]===R?Oe=t[29]:(Oe=e=>R(t=>iP(t,e)),t[28]=R,t[29]=Oe);let ke={owner:j?`${w}:search`:w,filter:j?D:``,onFilterChange:I,paths:oe,kinds:se,links:V.filter(UN),creating:f,renameRequest:m?{...m,onStart:()=>g(void 0)}:void 0,onRequestRename:Ee,onCreate:De,onMove:u.move,gitStatus:fe,selected:a,bindRename:we,bindCollapseAll:H,onInvalidName:HN,renderMenu:(e,t,n)=>{let r=e.kind===`directory`&&!e.path.endsWith(`/`)?`${e.path}/`:e.path,i=Te(r);return(0,K.jsx)(AN,{path:r,finalFocus:t.finalFocus,actions:i.actions,hidden:i.hidden,onAction:e=>i.run(e,t.close,n)},r)},onExpand:Oe,onSelect:xe},U;t[30]===I?U=t[31]:(U=e=>I(e.target.value),t[30]=I,t[31]=U);let Ae;t[32]!==D||t[33]!==U?(Ae=(0,K.jsx)(`div`,{className:`flex shrink-0 items-center gap-1 px-2 pt-2`,children:(0,K.jsx)(h,{"aria-label":`Search files`,placeholder:`Search...`,value:D,onChange:U,className:`h-7 w-auto min-w-0 flex-1`})}),t[32]=D,t[33]=U,t[34]=Ae):Ae=t[34];let je;t[35]!==c||t[36]!==Se||t[37]!==ee||t[38]!==u.result.waiting?(je=c&&(0,is.createPortal)((0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(Jn,{children:[(0,K.jsxs)(yr,{children:[(0,K.jsx)(Xn,{render:(0,K.jsx)(er,{render:(0,K.jsx)(wn,{size:`icon-sm`,variant:`ghost`,"aria-label":`Create file or folder`,disabled:u.result.waiting}),children:(0,K.jsx)(Ro,{className:`text-muted-foreground`})})}),(0,K.jsx)(Vt,{role:`tooltip`,className:`break-all`,children:`Create file or folder`})]}),(0,K.jsxs)(zt,{align:`end`,children:[(0,K.jsxs)(Cr,{onClick:()=>p({kind:`file`,folder:``,nonce:Date.now()}),children:[(0,K.jsx)(mo,{}),`New file`]}),(0,K.jsxs)(Cr,{onClick:()=>p({kind:`directory`,folder:``,nonce:Date.now()}),children:[(0,K.jsx)(bo,{}),`New folder`]})]})]}),(0,K.jsxs)(yr,{children:[(0,K.jsx)(Xn,{render:(0,K.jsx)(wn,{size:`icon-sm`,variant:`ghost`,"aria-label":ee,onClick:()=>Se()}),children:(0,K.jsx)(Ao,{className:`text-muted-foreground`})}),(0,K.jsx)(Vt,{role:`tooltip`,className:`break-all`,children:ee})]})]}),c),t[35]=c,t[36]=Se,t[37]=ee,t[38]=u.result.waiting,t[39]=je):je=t[39];let Me;t[40]!==T||t[41]!==R?(Me=(e,t)=>{T.set(n=>({...n,pinnedExpanded:t?iP(n.pinnedExpanded,[e]):n.pinnedExpanded.filter(t=>t!==e)})),t&&R(t=>iP(t,[e]))},t[40]=T,t[41]=R,t[42]=Me):Me=t[42];let Ne;t[43]===z?Ne=t[44]:(Ne=()=>z.retry(),t[43]=z,t[44]=Ne);let Pe;t[45]===C?Pe=t[46]:(Pe=e=>We(C.submit({path:e,pinned:!1})),t[45]=C,t[46]=Pe);let Fe;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,K.jsx)(PN,{label:`All files`}),t[47]=Fe):Fe=t[47];let Ie;t[48]!==M||t[49]!==j?(Ie=j&&Wn(M.result)&&(0,K.jsxs)(`div`,{role:`alert`,className:`px-3 py-2 text-xs`,children:[`Could not search files.`,(0,K.jsx)(wn,{variant:`link`,size:`xs`,onClick:()=>M.refresh(),children:`Try again`})]}),t[48]=M,t[49]=j,t[50]=Ie):Ie=t[50];let Le=_!==null,Re;t[51]===u.result.waiting?Re=t[52]:(Re=e=>{!e&&!u.result.waiting&&v(null)},t[51]=u.result.waiting,t[52]=Re);let ze;t[53]===_?ze=t[54]:(ze=(0,K.jsxs)(DS,{children:[`Move `,_,` to the trash?`]}),t[53]=_,t[54]=ze);let Be=_!=null&&pe.has(_)?`This is part of the agent’s changes. Deleting it changes what you are reviewing, and the agent may write it again. You can restore it from the system trash.`:`You can restore it from the system trash. This changes the files in your worktree.`,Ve;t[55]===Be?Ve=t[56]:(Ve=(0,K.jsx)(OS,{children:Be}),t[55]=Be,t[56]=Ve);let He;t[57]!==ze||t[58]!==Ve?(He=(0,K.jsxs)(TS,{children:[ze,Ve]}),t[57]=ze,t[58]=Ve,t[59]=He):He=t[59];let Ue;t[60]===u.result.waiting?Ue=t[61]:(Ue=(0,K.jsx)(AS,{disabled:u.result.waiting,children:`Cancel`}),t[60]=u.result.waiting,t[61]=Ue);let Ge;t[62]!==_||t[63]!==u?(Ge=()=>{_&&u.trash(_,()=>v(null))},t[62]=_,t[63]=u,t[64]=Ge):Ge=t[64];let Ke;t[65]!==u.result.waiting||t[66]!==Ge?(Ke=(0,K.jsx)(wn,{variant:`destructive`,disabled:u.result.waiting,onClick:Ge,children:`Move to trash`}),t[65]=u.result.waiting,t[66]=Ge,t[67]=Ke):Ke=t[67];let qe;t[68]!==Ue||t[69]!==Ke?(qe=(0,K.jsxs)(ES,{children:[Ue,Ke]}),t[68]=Ue,t[69]=Ke,t[70]=qe):qe=t[70];let Je=d!==void 0&&(0,K.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:la(d)}),Ye;t[71]!==He||t[72]!==qe||t[73]!==Je?(Ye=(0,K.jsxs)(wS,{children:[He,qe,Je]}),t[71]=He,t[72]=qe,t[73]=Je,t[74]=Ye):Ye=t[74];let Xe;t[75]!==Le||t[76]!==Re||t[77]!==Ye?(Xe=(0,K.jsx)(xS,{open:Le,onOpenChange:Re,children:Ye}),t[75]=Le,t[76]=Re,t[77]=Ye,t[78]=Xe):Xe=t[78];let Ze;t[79]===C.result?Ze=t[80]:(Ze=Wn(C.result)&&(0,K.jsx)(`p`,{role:`alert`,className:`border-t px-3 py-2 text-xs text-destructive`,children:gi(xr(C.result.cause))}),t[79]=C.result,t[80]=Ze);let Qe;t[81]===x.result?Qe=t[82]:(Qe=Wn(x.result)&&(0,K.jsx)(`p`,{role:`alert`,className:`border-t px-3 py-2 text-xs text-destructive`,children:gi(xr(x.result.cause))}),t[81]=x.result,t[82]=Qe);let $e;return t[83]!==z||t[84]!==le.length?($e=le.length>0&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2 border-t px-3 py-2 text-xs text-muted-foreground`,children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Some folders could not be loaded.`}),(0,K.jsx)(wn,{variant:`outline`,size:`xs`,onClick:()=>z.retry(),children:`Try again`})]}),t[83]=z,t[84]=le.length,t[85]=$e):$e=t[85],(0,K.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[Ae,je,(0,K.jsx)(LN,{entries:de,expanded:k,onExpand:Me,onRetry:Ne,renderDirectory:e=>(0,K.jsx)(aP,{prefix:`${e}/`,input:ke}),statuses:fe,selected:a,onOpen:ge,onUnpin:Pe,menuFor:e=>{let t=Te(e);return{actions:de.some(t=>t.path===ca(e)&&t.state===`resolved`)?t.actions:[],hidden:t.hidden,onAction:n=>t.run(n,VN,()=>Ce(e))}}}),(0,K.jsxs)(`section`,{"aria-label":`All files`,className:`flex min-h-0 flex-1 flex-col pt-1`,children:[Fe,Ie,(0,K.jsx)(CN,{...ke},ke.owner),b.size>0&&(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 px-3.5 py-2 text-2xs text-muted-foreground`,children:[(0,K.jsx)(ao,{className:`size-3.5 shrink-0`}),(0,K.jsx)(`span`,{children:Ki(b,e=>se.get(e)??se.get(`${e}/`))}),(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,K.jsx)(wn,{variant:`link`,size:`xs`,onClick:()=>P(!E),children:E?`Hide`:`Show`})]})]}),Xe,d!==void 0&&!_&&(0,K.jsx)(`p`,{role:`alert`,className:`px-3 py-2 text-xs text-destructive`,children:la(d)}),Ze,Qe,$e]})}function VN(){}function HN(e){return Li.add({title:`Invalid name`,description:e,type:`error`})}function UN(e){return e.kind===`symlink`||e.kind===`submodule`}function WN(e){return e.path}function GN(e){return e.kind===`file`}function KN(e){return e.path}function qN(e){return{path:ts(e),status:ki(e)}}function JN(e){return e.comparisons}function YN(e){return{path:e.path,status:`ignored`}}function XN(e){return e.ignored}function ZN(e){return[e.path,e.kind]}function QN(e){return e.path}function $N(e){return{path:e,kind:e.endsWith(`/`)?`directory`:`file`}}function eP(e){return bi(e).map(tP)}function tP(e){return`${e}/`}function nP(e){return Pr(Ht(e))}function rP(e){return{path:e,pinned:!0,hidden:!1}}function iP(e,t){let n=[...new Set([...e,...t])].sort();return n.length===e.length&&n.every((t,n)=>t===e[n])?e:n}function aP(e){let t=(0,q.c)(73),{prefix:n,input:r}=e,[i,a]=(0,G.useState)(0),o;t[0]===n.length?o=t[1]:(o=e=>e.slice(n.length),t[0]=n.length,t[1]=o);let s=o,c,l,u,d,f,p,m,h,g;if(t[2]!==i||t[3]!==r||t[4]!==n||t[5]!==s){let e;t[15]===n?e=t[16]:(e=e=>e.startsWith(n)&&e!==n,t[15]=n,t[16]=e);let o=r.paths.filter(e);h=`flex max-h-52 min-h-0 flex-col pl-1.5`,t[17]===i?g=t[18]:(g={height:i},t[17]=i,t[18]=g),c=CN,l=r.owner,u=r,d=a,f=`${r.owner}:pin:${n}`,p=o.map(s);let _;t[19]!==r.kinds||t[20]!==s?(_=e=>{let t=r.kinds.get(e);return t===void 0?[]:[[s(e),t]]},t[19]=r.kinds,t[20]=s,t[21]=_):_=t[21],m=new Map(o.flatMap(_)),t[2]=i,t[3]=r,t[4]=n,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h,t[14]=g}else c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14];let _;if(t[22]!==r.links||t[23]!==n||t[24]!==s){let e;t[26]===n?e=t[27]:(e=e=>e.path.startsWith(n),t[26]=n,t[27]=e);let i;t[28]===s?i=t[29]:(i=e=>({...e,path:s(e.path)}),t[28]=s,t[29]=i),_=r.links.filter(e).map(i),t[22]=r.links,t[23]=n,t[24]=s,t[25]=_}else _=t[25];let v;if(t[30]!==r.gitStatus||t[31]!==n||t[32]!==s){let e;t[34]===n?e=t[35]:(e=e=>e.path.startsWith(n),t[34]=n,t[35]=e);let i;t[36]===s?i=t[37]:(i=e=>({...e,path:s(e.path)}),t[36]=s,t[37]=i),v=r.gitStatus.filter(e).map(i),t[30]=r.gitStatus,t[31]=n,t[32]=s,t[33]=v}else v=t[33];let y;t[38]!==r.selected||t[39]!==n||t[40]!==s?(y=r.selected.startsWith(n)?s(r.selected):``,t[38]=r.selected,t[39]=n,t[40]=s,t[41]=y):y=t[41];let b,x,S,C,w;t[42]!==r||t[43]!==n?(b=e=>r.onRequestRename(`${n}${e}`),x=(e,t)=>r.onCreate(`${n}${e}`,t),S=(e,t)=>r.onMove(`${n}${e}`,`${n}${t}`),C=(e,t)=>r.onSelect(`${n}${e}`,t),w=e=>r.onExpand(e.map(e=>`${n}${e}`)),t[42]=r,t[43]=n,t[44]=b,t[45]=x,t[46]=S,t[47]=C,t[48]=w):(b=t[44],x=t[45],S=t[46],C=t[47],w=t[48]);let T;t[49]!==r||t[50]!==n?(T=(e,t,i)=>r.renderMenu({...e,path:`${n}${e.path}`},t,i),t[49]=r,t[50]=n,t[51]=T):T=t[51];let E;t[52]!==c||t[53]!==_||t[54]!==v||t[55]!==y||t[56]!==b||t[57]!==x||t[58]!==S||t[59]!==C||t[60]!==w||t[61]!==T||t[62]!==l||t[63]!==u||t[64]!==d||t[65]!==f||t[66]!==p||t[67]!==m?(E=(0,K.jsx)(c,{...u,onContentHeight:d,owner:f,paths:p,kinds:m,links:_,gitStatus:v,selected:y,creating:void 0,renameRequest:void 0,onRequestRename:b,onCreate:x,onMove:S,onSelect:C,onExpand:w,bindRename:sP,bindCollapseAll:oP,renderMenu:T},l),t[52]=c,t[53]=_,t[54]=v,t[55]=y,t[56]=b,t[57]=x,t[58]=S,t[59]=C,t[60]=w,t[61]=T,t[62]=l,t[63]=u,t[64]=d,t[65]=f,t[66]=p,t[67]=m,t[68]=E):E=t[68];let D;return t[69]!==E||t[70]!==h||t[71]!==g?(D=(0,K.jsx)(`div`,{className:h,style:g,children:E}),t[69]=E,t[70]=h,t[71]=g,t[72]=D):D=t[72],D}function oP(){}function sP(){}var cP=js(),lP={toggle(){cP.isOpen?cP.close():cP.open(null)},close(){cP.close()}};function uP(e,t){let n=(0,q.c)(9),{query:r,setQuery:i}=ta(),a;n[0]!==e||n[1]!==t||n[2]!==i?(a=n=>{t.close(),i(``),e(n)},n[0]=e,n[1]=t,n[2]=i,n[3]=a):a=n[3];let o;return n[4]!==t.toggle||n[5]!==r||n[6]!==i||n[7]!==a?(o={query:r,setQuery:i,toggle:t.toggle,select:a},n[4]=t.toggle,n[5]=r,n[6]=i,n[7]=a,n[8]=o):o=n[8],o}function dP(e){let t=(0,q.c)(1),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={enabled:!0},t[0]=n):n=t[0],zi(`Mod+P`,e,n)}function fP(e){let t=(0,q.c)(2);dP(pP);let n;return t[0]===e?n=t[1]:(n=(0,K.jsx)(mA,{handle:cP,title:`Find a file`,description:`Find a file by name, or enter a relative path to open it.`,children:(0,K.jsx)(mP,{...e})}),t[0]=e,t[1]=n),n}function pP(){return lP.toggle()}function mP(e){let t=(0,q.c)(10),{scope:n,connection:r,openFiles:i,onOpen:a,bindPopup:o}=e,{query:s,setQuery:c,select:l}=uP(a,lP),u=zC(r,n.projectId),d=pn(Ht(u.result)),f=new Set(d?.preferences.filter(gP).map(hP)??[]),p=Ta(`${r.environmentId}:${n.projectId}:${n.worktreeId}`).state.showHidden,m=pA,h;t[0]!==s||t[1]!==c?(h=(0,K.jsx)(hA,{"aria-label":`Find a file by name`,placeholder:`Find a file by name`,value:s,onValueChange:c}),t[0]=s,t[1]=c,t[2]=h):h=t[2];let g=d===void 0&&(0,K.jsx)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:Wn(u.result)?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`block`,children:`File visibility preferences could not be loaded.`}),(0,K.jsx)(wn,{variant:`outline`,size:`xs`,className:`mt-2`,onClick:()=>u.refresh(),children:`Try again`})]}):`Reading file visibility…`}),_=d!==void 0&&s.trim()===``&&(0,K.jsx)(_P,{scope:n,connection:r,openFiles:Yi(i,f,p),preferences:d.preferences.filter(e=>p||aa(e.path,f)===null),onSelect:l}),v=d!==void 0&&s.trim()!==``&&(0,K.jsx)(CP,{scope:n,connection:r,query:s,hidden:f,showHidden:p,onSelect:l}),y;return t[3]!==m||t[4]!==o||t[5]!==h||t[6]!==g||t[7]!==_||t[8]!==v?(y=(0,K.jsxs)(m,{ref:o,shouldFilter:!1,children:[h,g,_,v]}),t[3]=m,t[4]=o,t[5]=h,t[6]=g,t[7]=_,t[8]=v,t[9]=y):y=t[9],y}function hP(e){return e.path}function gP(e){return e.hidden}function _P(e){let t=(0,q.c)(2),{scope:n,connection:r,openFiles:i,preferences:a,onSelect:o}=e,s=a.filter(SP),c=_S(r,n,s.length===0?[]:[``,...ja(s)]),l=ka(s.map(xP),c.states).filter(bP).map(yP),u=[...new Set([...i,...l])],d;return t[0]===c?d=t[1]:(d=c.states.some(vP)&&(0,K.jsxs)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:[`Pinned files could not be loaded.`,(0,K.jsx)(wn,{variant:`outline`,size:`xs`,className:`ml-2`,onClick:()=>c.retry(),children:`Try again`})]}),t[0]=c,t[1]=d),(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(gA,{children:u.map(e=>(0,K.jsx)(wP,{path:e,onSelect:o},e))}),u.length===0&&(0,K.jsx)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:`Type a file name or relative path.`}),d]})}function vP(e){return e.status===`unavailable`}function yP(e){let{path:t}=e;return t}function bP(e){return e.state===`resolved`&&e.entry.kind===`file`}function xP(e){let{path:t}=e;return t}function SP(e){return e.pinned}function CP(e){let t=(0,q.c)(26),{scope:n,connection:r,query:i,hidden:a,showHidden:o,onSelect:s}=e,c=ON(r,n),l,u,d,f,p,m;if(t[0]!==a||t[1]!==c||t[2]!==s||t[3]!==i||t[4]!==o){let e=ii(Yi(pn(Ht(c.result))?.paths??[],a,o),i),n=ni(i),r=n!==null&&(o||aa(n,a)===null)&&!e.includes(n)?n:null;t[11]===c?f=t[12]:(f=Wn(c.result)&&(0,K.jsxs)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:[(0,K.jsx)(`span`,{className:`block`,children:`Full file search could not be loaded. You can still browse folders.`}),(0,K.jsx)(wn,{variant:`outline`,size:`xs`,className:`mt-2`,onClick:()=>c.refresh(),children:`Try again`})]}),t[11]=c,t[12]=f),t[13]===c.result?p=t[14]:(p=sr(c.result)&&(0,K.jsx)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:`Reading file names…`}),t[13]=c.result,t[14]=p),m=!sr(c.result)&&!Wn(c.result)&&e.length===0&&r===null&&(0,K.jsx)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:`No file matches that name.`}),l=gA,u=r!==null&&(0,K.jsxs)(yA,{value:r,onSelect:()=>s(r),children:[`Open path `,r]});let h;t[15]===s?h=t[16]:(h=e=>(0,K.jsx)(wP,{path:e,onSelect:s},e),t[15]=s,t[16]=h),d=e.map(h),t[0]=a,t[1]=c,t[2]=s,t[3]=i,t[4]=o,t[5]=l,t[6]=u,t[7]=d,t[8]=f,t[9]=p,t[10]=m}else l=t[5],u=t[6],d=t[7],f=t[8],p=t[9],m=t[10];let h;t[17]!==l||t[18]!==u||t[19]!==d?(h=(0,K.jsxs)(l,{children:[u,d]}),t[17]=l,t[18]=u,t[19]=d,t[20]=h):h=t[20];let g;return t[21]!==f||t[22]!==p||t[23]!==m||t[24]!==h?(g=(0,K.jsxs)(K.Fragment,{children:[f,p,m,h]}),t[21]=f,t[22]=p,t[23]=m,t[24]=h,t[25]=g):g=t[25],g}function wP(e){let t=(0,q.c)(11),{path:n,onSelect:r}=e,i=n.lastIndexOf(`/`)+1,a;t[0]!==r||t[1]!==n||t[2]!==i?(a=(e,t)=>(0,K.jsxs)(yA,{value:n,"aria-label":n,onSelect:()=>r(n),children:[e,i>0&&t(n.slice(0,i-1),`shrink-[100] text-muted-foreground`)]}),t[0]=r,t[1]=n,t[2]=i,t[3]=a):a=t[3];let o;t[4]!==n||t[5]!==i?(o=n.slice(i),t[4]=n,t[5]=i,t[6]=o):o=t[6];let s;return t[7]!==n||t[8]!==a||t[9]!==o?(s=(0,K.jsx)(Fr,{text:n,className:`min-w-0`,renderTrigger:a,children:o}),t[7]=n,t[8]=a,t[9]=o,t[10]=s):s=t[10],s}function TP(e,t,n){let r=(0,q.c)(7),i;r[0]!==e||r[1]!==t?(i=ya({draft:e,viewer:t}),r[0]=e,r[1]=t,r[2]=i):i=r[2],ye(i);let a;r[3]!==e||r[4]!==n||r[5]!==t?(a=qi({draft:e,viewer:t,fingerprint:n}),r[3]=e,r[4]=n,r[5]=t,r[6]=a):a=r[6],ye(a)}var EP=P(({connection:e,environmentIds:t})=>m(n=>{if(!e||t.length===0)return;let r=n(f(e)),i=pn(Ht(r));if(!i)return;let a=e=>{i.hasUnsaved(t)&&e.preventDefault()};window.addEventListener(`beforeunload`,a),n.addFinalizer(()=>window.removeEventListener(`beforeunload`,a))}));function DP(e,t){let n=(0,q.c)(3),r;n[0]!==e||n[1]!==t?(r=EP({connection:e,environmentIds:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],ye(r)}var OP=dn([`changes`,`files`,`history`]),kP=dn([`uncommitted`,`branch`]),AP=bn(Rr.check(Tn(st))).pipe(qe(()=>lt(kt(void 0)))),jP=Dt({surface:bn(OP).pipe(qe(()=>lt(kt(void 0)))),entry:AP,side:AP,scope:bn(kP).pipe(qe(()=>lt(kt(void 0)))),base:AP}),MP=O(OP),NP=O(kP),PP=[{id:`general`,label:`General`,icon:Jo},{id:`git`,label:`Changes & Git`,icon:wo},{id:`computers`,label:`Computers`,icon:rn}],FP=PP[0].id,IP={reading:`max-w-186 gap-8`,list:`max-w-186 gap-7`,wide:`max-w-240 gap-5.5 md:pt-7.5`};function LP(e){return H(`settings-content wrap-anywhere mx-auto flex w-full flex-col px-4 py-6 md:px-6 md:py-9 lg:pr-10 lg:pl-6`,IP[e])}function RP(e){let t=(0,q.c)(5),{children:n,layout:r}=e,i;t[0]===r?i=t[1]:(i=LP(r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,K.jsx)(Hw,{className:`min-h-0 flex-1`,children:(0,K.jsx)(`div`,{className:i,children:n})}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function zP(e){let t=(0,q.c)(71),{section:n,environmentId:r}=e,i=mt(),{setOpenMobile:a}=nn(),o=ze(),s=Wa(),l;t[0]!==s||t[1]!==o.history.location.state.__TSR_index?(l=()=>({historyIndex:o.history.location.state.__TSR_index,hasPredecessor:s}),t[0]=s,t[1]=o.history.location.state.__TSR_index,t[2]=l):l=t[2];let[u]=(0,G.useState)(l),d=c(r??``)?.remote,{element:f,attach:p}=yT(),{element:m,attach:h}=yT(),[g,_]=(0,G.useState)(null),v;t[3]!==g||t[4]!==i||t[5]!==o.history?(v=()=>{g?o.history.back():i({to:`/settings/$section`,params:{section:`computers`},replace:!0})},t[3]=g,t[4]=i,t[5]=o.history,t[6]=v):v=t[6];let y=v,b;t[7]!==f?.scrollTop||t[8]!==i?(b=e=>{_({scroll:f?.scrollTop??0,focus:document.activeElement instanceof HTMLElement?document.activeElement:null}),i({to:`/settings/$section/$environmentId`,params:{section:`computers`,environmentId:e}})},t[7]=f?.scrollTop,t[8]=i,t[9]=b):b=t[9];let x=b,S;t[10]!==r||t[11]!==h?(S=e=>{h(e),r!==void 0&&e?.focus({preventScroll:!0})},t[10]=r,t[11]=h,t[12]=S):S=t[12];let C=S,w;t[13]!==r||t[14]!==g||t[15]!==p?(w=e=>{if(p(e),r===void 0&&e){g&&(e.scrollTop=g.scroll);let t=g?.focus;t?.isConnected?t.focus({preventScroll:!0}):e.focus({preventScroll:!0})}},t[13]=r,t[14]=g,t[15]=p,t[16]=w):w=t[16];let T=w,{connection:E}=Me(),{environment:D}=qC(E),O;t[17]===n?O=t[18]:(O=PP.find(e=>e.id===n)??PP[0],t[17]=n,t[18]=O);let k=O,A=`Computer unavailable`;if(r===`this-computer`)A=`This computer`;else if(d){let e;t[19]===d?e=t[20]:(e=(0,K.jsx)(j,{remote:d}),t[19]=d,t[20]=e),A=e}let M;t[21]!==u||t[22]!==r||t[23]!==i||t[24]!==y||t[25]!==o.history||t[26]!==a?(M=()=>{a(!1),r===void 0?u.hasPredecessor?o.history.go(-Math.max(1,o.history.location.state.__TSR_index-u.historyIndex+1)):i({to:`/`}):y()},t[21]=u,t[22]=r,t[23]=i,t[24]=y,t[25]=o.history,t[26]=a,t[27]=M):M=t[27];let N=M,P;t[28]===m?P=t[29]:(P={target:m,ignoreInputs:!0},t[28]=m,t[29]=P),zi(Fi.closeSettings,N,P);let F;t[30]===N?F=t[31]:(F=(0,K.jsx)(`form`,{id:`close-settings`,hidden:!0,onSubmit:e=>{e.preventDefault(),N()}}),t[30]=N,t[31]=F);let I;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,K.jsx)(Xn,{render:(0,K.jsx)(ln,{"aria-label":`Toggle Sidebar`})}),t[32]=I):I=t[32];let L;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,K.jsxs)(yr,{children:[I,(0,K.jsxs)(Vt,{children:[`Toggle sidebar`,` `,(0,K.jsx)(_T,{children:Ui(Fi.toggleNavigator)})]})]}),t[33]=L):L=t[33];let R,ee;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,K.jsx)(Kw,{children:`Settings`}),ee=(0,K.jsx)(Yw,{children:`/`}),t[34]=R,t[35]=ee):(R=t[34],ee=t[35]);let z;t[36]!==k.label||t[37]!==r||t[38]!==y?(z=(0,K.jsx)(Kw,{children:(0,K.jsx)(`h2`,{children:r===void 0?(0,K.jsx)(Jw,{children:k.label}):(0,K.jsx)(qw,{render:(0,K.jsx)(`button`,{type:`button`,onClick:y}),children:`Computers`})})}),t[36]=k.label,t[37]=r,t[38]=y,t[39]=z):z=t[39];let ne;t[40]!==A||t[41]!==r?(ne=r!==void 0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Yw,{children:`/`}),(0,K.jsx)(Kw,{className:`min-w-0`,children:(0,K.jsx)(Jw,{className:`min-w-0`,children:A})})]}),t[40]=A,t[41]=r,t[42]=ne):ne=t[42];let B;t[43]!==z||t[44]!==ne?(B=(0,K.jsxs)(`header`,{className:`settings-bar flex min-h-12 shrink-0 items-center gap-2 border-b px-2`,children:[L,(0,K.jsx)(Ww,{className:`min-w-0 flex-1`,children:(0,K.jsxs)(Gw,{className:`min-w-0 flex-nowrap`,children:[R,ee,z,ne]})})]}),t[43]=z,t[44]=ne,t[45]=B):B=t[45];let re;t[46]!==k.id||t[47]!==r||t[48]!==i||t[49]!==y?(re=PP.map(e=>{let t=e.icon,n=k.id===e.id;return(0,K.jsxs)(wn,{variant:n?`secondary`:`ghost`,size:`sm`,className:`shrink-0 justify-start md:w-full`,"aria-current":n?`page`:void 0,onClick:()=>{r!==void 0&&e.id===`computers`?y():i({to:`/settings/$section`,params:{section:e.id},replace:!0})},children:[(0,K.jsx)(t,{}),e.label]},e.id)}),t[46]=k.id,t[47]=r,t[48]=i,t[49]=y,t[50]=re):re=t[50];let V;t[51]===re?V=t[52]:(V=(0,K.jsx)(`div`,{className:`settings-nav flex gap-0.5 overflow-x-auto px-3 py-3 md:flex-col md:py-5`,children:re}),t[51]=re,t[52]=V);let ae;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,K.jsxs)(`p`,{className:`mt-auto hidden px-5 pb-4 text-xs tabular-nums text-muted-foreground md:block`,children:[`Porcelain `,`0.82.2`]}),t[53]=ae):ae=t[53];let oe;t[54]===V?oe=t[55]:(oe=(0,K.jsxs)(`nav`,{"aria-label":`Settings sections`,className:`flex shrink-0 flex-col md:w-52`,children:[V,ae]}),t[54]=V,t[55]=oe);let se;t[56]!==T||t[57]!==k.id||t[58]!==D||t[59]!==r||t[60]!==x||t[61]!==y?(se=(0,K.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:k.id===`computers`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{ref:T,className:r===void 0?`min-h-0 flex-1 overflow-y-auto outline-none`:`hidden`,role:`region`,"aria-label":`Computers list`,tabIndex:-1,children:(0,K.jsx)(`div`,{className:LP(`list`),children:(0,K.jsx)(te,{showUpdates:r===void 0,environment:D,onOpen:x})})}),r!==void 0&&(0,K.jsx)(RP,{layout:`wide`,children:r===`this-computer`?(0,K.jsx)(et,{environment:D}):(0,K.jsx)(ie,{environmentId:r,onForgotten:y},r)})]}):(0,K.jsx)(RP,{layout:`reading`,children:k.id===`git`?(0,K.jsx)(oa,{}):(0,K.jsx)(ma,{})})}),t[56]=T,t[57]=k.id,t[58]=D,t[59]=r,t[60]=x,t[61]=y,t[62]=se):se=t[62];let ce;t[63]!==oe||t[64]!==se?(ce=(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col md:flex-row`,children:[oe,se]}),t[63]=oe,t[64]=se,t[65]=ce):ce=t[65];let le;return t[66]!==C||t[67]!==B||t[68]!==ce||t[69]!==F?(le=(0,K.jsxs)(`main`,{ref:C,tabIndex:-1,"aria-label":`Settings`,className:`flex h-full min-h-0 min-w-0 flex-col overflow-hidden rounded-paper bg-card shadow-paper outline-none`,children:[F,B,ce]}),t[66]=C,t[67]=B,t[68]=ce,t[69]=F,t[70]=le):le=t[70],le}export{JC as $,B_ as $t,AT as A,Wo as An,hS as At,_T as B,ro as Bn,Uv as Bt,_A as C,cs as Cn,AS as Ct,gA as D,ns as Dn,TS as Dt,yA as E,ts as En,ES as Et,DT as F,Oo as Fn,Ky as Ft,mT as G,V_ as Gt,lT as H,Ya as Hn,sv as Ht,ET as I,wo as In,zy as It,eT as J,W_ as Jt,hT as K,Q_ as Kt,OT as L,fo as Ln,wy as Lt,xT as M,Ro as Mn,aS as Mt,CT as N,Io as Nn,nS as Nt,kT as O,Qo as On,DS as Ot,TT as P,Po as Pn,kb as Pt,xw as Q,K_ as Qt,bT as R,lo as Rn,by as Rt,pA as S,ds as Sn,xS as St,hA as T,rs as Tn,OS as Tt,dT as U,qa as Un,ev as Ut,vT as V,$a as Vn,Rv as Vt,pT as W,H_ as Wt,Uw as X,$_ as Xt,Hw as Y,G_ as Yt,Nw as Z,U_ as Zt,lN as _,Es as _n,tC as _t,MP as a,P_ as an,MC as at,rj as b,hs as bn,$S as bt,TP as c,A_ as cn,vC as ct,bN as d,S_ as dn,lC as dt,z_ as en,QC as et,mN as f,x_ as fn,uC as ft,uN as g,ws as gn,rC as gt,dN as h,Ss as hn,oC as ht,NP as i,F_ as in,qC as it,jT as j,Ho as jn,sS as jt,MT as k,Ko as kn,gS as kt,fP as l,O_ as ln,_C as lt,fN as m,_s as mn,sC as mt,FP as n,L_ as nn,$C as nt,jP as o,j_ as on,jC as ot,gN as p,gs as pn,cC as pt,uT as q,q_ as qt,PP as r,I_ as rn,tw as rt,DP as s,M_ as sn,xC as st,zP as t,R_ as tn,nw as tt,zN as u,E_ as un,yC as ut,cN as v,Ts as vn,nC as vt,vA as w,ps as wn,wS as wt,HA as x,fs as xn,QS as xt,oj as y,Cs as yn,eC as yt,yT as z,ao as zn,Sy as zt};
1362
+ `},QO=0,$O=[];function ek(e){var t=G.useRef([]),n=G.useRef([0,0]),r=G.useRef(),i=G.useState(QO++)[0],a=G.useState(SO)[0],o=G.useRef(e);G.useEffect(function(){o.current=e},[e]),G.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=QD([e.lockRef.current],(e.shards||[]).map(YO),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=G.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=qO(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=BO(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=BO(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return KO(h,t,e,h===`h`?s:c,!0)},[]),c=G.useCallback(function(e){var n=e;if($O.length&&$O[$O.length-1]===a){var r=`deltaY`in n?JO(n):qO(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&XO(e.delta,r)})[0];if(i&&i.should)n.cancelable&&n.preventDefault();else if(!i){var c=(o.current.shards||[]).map(YO).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=G.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:tk(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=G.useCallback(function(e){n.current=qO(e),r.current=void 0},[]),d=G.useCallback(function(t){l(t.type,JO(t),t.target,s(t,e.lockRef.current))},[]),f=G.useCallback(function(t){l(t.type,qO(t),t.target,s(t,e.lockRef.current))},[]);G.useEffect(function(){return $O.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,FO),document.addEventListener(`touchmove`,c,FO),document.addEventListener(`touchstart`,u,FO),function(){$O=$O.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,FO),document.removeEventListener(`touchmove`,c,FO),document.removeEventListener(`touchstart`,u,FO)}},[]);var p=e.removeScrollBar,m=e.inert;return G.createElement(G.Fragment,null,m?G.createElement(a,{styles:ZO(i)}):null,p?G.createElement(MO,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function tk(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var nk=fO(pO,ek),rk=G.forwardRef(function(e,t){return G.createElement(hO,XD({},e,{ref:t,sideCar:nk}))});rk.classNames=hO.classNames;var ik=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},ak=new WeakMap,ok=new WeakMap,sk={},ck=0,lk=function(e){return e&&(e.host||lk(e.parentNode))},uk=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=lk(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},dk=function(e,t,n,r){var i=uk(t,Array.isArray(e)?e:[e]);sk[n]||(sk[n]=new WeakMap);var a=sk[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(ak.get(e)||0)+1,l=(a.get(e)||0)+1;ak.set(e,c),a.set(e,l),o.push(e),c===1&&i&&ok.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),ck++,function(){o.forEach(function(e){var t=ak.get(e)-1,i=a.get(e)-1;ak.set(e,t),a.set(e,i),t||(ok.has(e)||e.removeAttribute(r),ok.delete(e)),i||e.removeAttribute(n)}),ck--,ck||(ak=new WeakMap,ak=new WeakMap,ok=new WeakMap,sk={})}},fk=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||ik(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),dk(r,i,n,`aria-hidden`)):function(){return null}},pk=Object.defineProperty,mk=(e,t)=>pk(e,`name`,{value:t,configurable:!0}),hk=`Dialog`,[gk,_k]=fE(hk),[vk,yk]=gk(hk),bk=mk(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=G.useRef(null),c=G.useRef(null),[l,u]=OE({prop:r,defaultProp:i??!1,onChange:a,caller:hk}),[d,f]=G.useState(0),[p,m]=G.useState(0);return(0,K.jsx)(vk,{scope:t,triggerRef:s,contentRef:c,contentId:yE(),titleId:yE(),descriptionId:yE(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:G.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),xk=`DialogPortal`,[Sk,Ck]=gk(xk,{forceMount:void 0}),wk=mk(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=yk(xk,t);return(0,K.jsx)(Sk,{scope:t,forceMount:n,children:G.Children.map(r,e=>(0,K.jsx)(LD,{present:n||a.open,children:(0,K.jsx)(ND,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),Tk=`DialogOverlay`,Ek=G.forwardRef(mk(function(e,t){let n=Ck(Tk,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=yk(Tk,e.__scopeDialog);return a.modal?(0,K.jsx)(LD,{present:r||a.open,children:(0,K.jsx)(Ok,{...i,ref:t})}):null},`DialogOverlay`)),Dk=FE(`DialogOverlay.RemoveScroll`),Ok=G.forwardRef(mk(function(e,t){let{__scopeDialog:n,...r}=e,i=yk(Tk,n),a=cE(t,lD());return(0,K.jsx)(rk,{as:Dk,allowPinchZoom:!0,shards:[i.contentRef],children:(0,K.jsx)(XE.div,{"data-state":Pk(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),kk=`DialogContent`,Ak=G.forwardRef(mk(function(e,t){let n=Ck(kk,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=yk(kk,e.__scopeDialog);return(0,K.jsx)(LD,{present:r||a.open,children:a.modal?(0,K.jsx)(jk,{...i,ref:t}):(0,K.jsx)(Mk,{...i,ref:t})})},`DialogContent`)),jk=G.forwardRef(mk(function(e,t){let n=yk(kk,e.__scopeDialog),r=G.useRef(null),i=cE(t,n.contentRef,r);return G.useEffect(()=>{let e=r.current;if(e)return fk(e)},[]),(0,K.jsx)(Nk,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:$T(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:$T(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:$T(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Mk=G.forwardRef(mk(function(e,t){let n=yk(kk,e.__scopeDialog),r=G.useRef(!1),i=G.useRef(!1);return(0,K.jsx)(Nk,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),Nk=G.forwardRef(mk(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=yk(kk,n);return JD(),(0,K.jsx)(K.Fragment,{children:(0,K.jsx)(bD,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,K.jsx)(cD,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":Pk(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`));function Pk(e){return e?`open`:`closed`}mk(Pk,`getState`);var Fk=`[cmdk-group=""]`,Ik=`[cmdk-group-items=""]`,Lk=`[cmdk-group-heading=""]`,Rk=`[cmdk-item=""]`,zk=`${Rk}:not([aria-disabled="true"])`,Bk=`cmdk-item-select`,Vk=`data-value`,Hk=(e,t,n)=>YT(e,t,n),Uk=G.createContext(void 0),Wk=()=>G.useContext(Uk),Gk=G.createContext(void 0),Kk=()=>G.useContext(Gk),qk=G.createContext(void 0),Jk=G.forwardRef((e,t)=>{let n=cA(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=cA(()=>new Set),i=cA(()=>new Map),a=cA(()=>new Map),o=cA(()=>new Set),s=oA(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=yE(),y=yE(),b=yE(),x=G.useRef(null),S=dA();sA(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),sA(()=>{S(6,k)},[]);let C=G.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),S(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=A()?.id,C.emit()}),r||S(5,k),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=G.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),S(2,()=>{E(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{O(),E(),n.current.value||D(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();S(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function T(e,t){let r=s.current?.filter??Hk;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(Ik);t?t.appendChild(e.parentElement===t?e:e.closest(`${Ik} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Ik} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${Fk}[${Vk}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(Vk);C.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=T(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function k(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(Fk)?.querySelector(Lk))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return x.current?.querySelector(`${Rk}[aria-selected="true"]`)}function j(){return Array.from(x.current?.querySelectorAll(zk)||[])}function M(e){let t=j()[e];t&&C.setState(`value`,t.getAttribute(Vk))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(Vk))}function P(e){let t=A()?.closest(Fk),n;for(;t&&!n;)t=e>0?iA(t,Fk):aA(t,Fk),n=t?.querySelector(zk);n?C.setState(`value`,n.getAttribute(Vk)):N(e)}let F=()=>M(j().length-1),I=e=>{e.preventDefault(),e.metaKey?F():e.altKey?P(1):N(1)},L=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?P(-1):N(-1)};return G.createElement(XE.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&I(e);break;case`ArrowDown`:I(e);break;case`p`:case`k`:g&&e.ctrlKey&&L(e);break;case`ArrowUp`:L(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),F();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(Bk);t.dispatchEvent(e)}}}}},G.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:mA},c),pA(e,e=>G.createElement(Gk.Provider,{value:C},G.createElement(Uk.Provider,{value:w},e))))}),Yk=G.forwardRef((e,t)=>{let n=yE(),r=G.useRef(null),i=G.useContext(qk),a=Wk(),o=oA(e),s=o.current?.forceMount??i?.forceMount;sA(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=uA(n,r,[e.value,e.children,r],e.keywords),l=Kk(),u=lA(e=>e.value&&e.value===c.current),d=lA(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);G.useEffect(()=>{let t=r.current;if(t&&!e.disabled)return t.addEventListener(Bk,f),()=>t.removeEventListener(Bk,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return G.createElement(XE.div,{ref:sE(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),Xk=G.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=yE(),s=G.useRef(null),c=G.useRef(null),l=yE(),u=Wk(),d=lA(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));sA(()=>u.group(o),[]),uA(o,s,[e.value,e.heading,c]);let f=G.useMemo(()=>({id:o,forceMount:i}),[i]);return G.createElement(XE.div,{ref:sE(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!d||void 0},n&&G.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),pA(e,e=>G.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},G.createElement(qk.Provider,{value:f},e))))}),Zk=G.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=G.useRef(null),a=lA(e=>!e.search);return!n&&!a?null:G.createElement(XE.div,{ref:sE(i,t),...r,"cmdk-separator":``,role:`separator`})}),Qk=G.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=Kk(),o=lA(e=>e.search),s=lA(e=>e.selectedItemId),c=Wk();return G.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),G.createElement(XE.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),$k=G.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=G.useRef(null),o=G.useRef(null),s=lA(e=>e.selectedItemId),c=Wk();return G.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),G.createElement(XE.div,{ref:sE(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},pA(e,e=>G.createElement(`div`,{ref:sE(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),eA=G.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return G.createElement(bk,{open:n,onOpenChange:r},G.createElement(wk,{container:o},G.createElement(Ek,{"cmdk-overlay":``,className:i}),G.createElement(Ak,{"aria-label":e.label,"cmdk-dialog":``,className:a},G.createElement(Jk,{ref:t,...s}))))}),tA=G.forwardRef((e,t)=>lA(e=>e.filtered.count===0)?G.createElement(XE.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),nA=G.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return G.createElement(XE.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},pA(e,e=>G.createElement(`div`,{"aria-hidden":!0},e)))}),rA=Object.assign(Jk,{List:$k,Item:Yk,Input:Qk,Group:Xk,Separator:Zk,Dialog:eA,Empty:tA,Loading:nA});function iA(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function aA(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function oA(e){let t=G.useRef(e);return sA(()=>{t.current=e}),t}var sA=typeof window>`u`?G.useEffect:G.useLayoutEffect;function cA(e){let t=G.useRef();return t.current===void 0&&(t.current=e()),t}function lA(e){let t=Kk(),n=()=>e(t.snapshot());return G.useSyncExternalStore(t.subscribe,n,n)}function uA(e,t,n,r=[]){let i=G.useRef(),a=Wk();return sA(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(Vk,s),i.current=s}),i}var dA=()=>{let[e,t]=G.useState(),n=cA(()=>new Map);return sA(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function fA(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function pA({asChild:e,children:t},n){return e&&G.isValidElement(t)?G.cloneElement(fA(t),{ref:t.ref},n(t.props.children)):n(t)}var mA={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function hA({className:e,...t}){return(0,K.jsx)(rA,{"data-slot":`command`,className:H(`flex size-full flex-col overflow-hidden rounded-xl bg-popover p-1 text-popover-foreground`,e),...t})}function gA({title:e=`Command Palette`,description:t=`Search for a command to run...`,children:n,className:r,showCloseButton:i=!1,...a}){return(0,K.jsxs)(XC,{...a,children:[(0,K.jsxs)(tw,{className:`sr-only`,children:[(0,K.jsx)(rw,{children:e}),(0,K.jsx)(iw,{children:t})]}),(0,K.jsx)(ew,{className:H(`top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0`,r),showCloseButton:i,children:n})]})}function _A({className:e,...t}){return(0,K.jsx)(`div`,{"data-slot":`command-input-wrapper`,className:`p-1 pb-0`,children:(0,K.jsxs)(CT,{className:`h-8! bg-input/20 dark:bg-input/30`,children:[(0,K.jsx)(rA.Input,{"data-slot":`command-input`,className:H(`w-full text-xs/relaxed outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,e),...t}),(0,K.jsx)(TT,{children:(0,K.jsx)(Wo,{className:`size-3.5 shrink-0 opacity-50`})})]})})}function vA({className:e,...t}){return(0,K.jsx)(rA.List,{"data-slot":`command-list`,className:H(`no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none`,e),...t})}function yA({className:e,...t}){return(0,K.jsx)(rA.Empty,{"data-slot":`command-empty`,className:H(`py-6 text-center text-xs/relaxed`,e),...t})}function bA({className:e,...t}){return(0,K.jsx)(rA.Group,{"data-slot":`command-group`,className:H(`overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2.5 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function xA({className:e,children:t,...n}){return(0,K.jsxs)(rA.Item,{"data-slot":`command-item`,className:H(`group/command-item relative flex min-h-7 cursor-default items-center gap-2 rounded-md px-2.5 py-1.5 text-xs/relaxed outline-hidden select-none in-data-[slot=dialog-content]:rounded-md data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 data-selected:*:[svg]:text-foreground`,e),...n,children:[t,(0,K.jsx)(D,{className:`ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100`})]})}function SA(e,t,n){let r=(0,q.c)(12),i;r[0]===e?i=r[1]:(i=pe(e),r[0]=e,r[1]=i);let[a,o]=Wi(i),s=Dn(),c=ze(),l=mt(),u;r[2]!==s?.environmentId||r[3]!==l||r[4]!==n||r[5]!==c||r[6]!==o||r[7]!==e?(u=(t,r,i)=>o(t).then(async t=>{if(!t.deleted){r(t.plan);return}n();let i=c.state.matches.at(-1)?.params;t.plan.worktreePath&&i&&`worktreeId`in i&&`projectId`in i&&i.worktreeId===e.scope.worktreeId&&i.projectId===e.scope.projectId&&(`environmentId`in i?i.environmentId:s?.environmentId)===e.connection.environmentId&&await l({to:`/`})},i),r[2]=s?.environmentId,r[3]=l,r[4]=n,r[5]=c,r[6]=o,r[7]=e,r[8]=u):u=r[8];let d;return r[9]!==a||r[10]!==u?(d={result:a,submit:u},r[9]=a,r[10]=u,r[11]=d):d=r[11],d}function CA(e){let t=(0,q.c)(15),n;t[0]===e?n=t[1]:(n=dt(e),t[0]=e,t[1]=n);let[r,i]=Wi(n),a;t[2]===e?a=t[3]:(a=ht(e),t[2]=e,t[3]=a);let[o,s]=Wi(a),[c,l]=(0,G.useState)(!1),u;t[4]===e?u=t[5]:(u=fr(e),t[4]=e,t[5]=u);let{unresolved:d}=Ue(u),f=c?o:r,p=r.waiting||o.waiting,m;t[6]!==s||t[7]!==i||t[8]!==d?(m=(e,t)=>{l(d);let n;if(d)n=s(void 0);else if(e)n=i(e);else return;return n.then(e=>{(e.state===`succeeded`||e.state===`no-change`)&&t()},wA)},t[6]=s,t[7]=i,t[8]=d,t[9]=m):m=t[9];let h;return t[10]!==f||t[11]!==p||t[12]!==m||t[13]!==d?(h={result:f,pending:p,unresolved:d,submit:m},t[10]=f,t[11]=p,t[12]=m,t[13]=d,t[14]=h):h=t[14],h}function wA(){}function TA(){let e=(0,q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(g,{handle:BC,children:EA}),e[0]=t):t=e[0],t}function EA(e){let{payload:t}=e;return t&&(0,K.jsx)(DA,{...t},t.requestId)}function DA(e){let t=(0,q.c)(66),{connection:n,entry:r,worktreeId:i}=e,[a,o]=(0,G.useState)(),s;t[0]!==r.projectId||t[1]!==i?(s={projectId:r.projectId,worktreeId:i},t[0]=r.projectId,t[1]=i,t[2]=s):s=t[2];let c;t[3]!==n||t[4]!==s?(c={connection:n,scope:s},t[3]=n,t[4]=s,t[5]=c):c=t[5];let{result:l,pending:u,unresolved:d,submit:f}=CA(c),p;t[6]!==r.projectId||t[7]!==i?(p={projectId:r.projectId,worktreeId:i},t[6]=r.projectId,t[7]=i,t[8]=p):p=t[8];let{result:m}=bC(p,n,!0),h=pn(Ht(m)),g;t[9]===r.projectId?g=t[10]:(g=e=>e.id===r.projectId,t[9]=r.projectId,t[10]=g);let _=YC(n).projects.find(g),v=Ti(h?.bases??[],_?.worktrees??[],i),y;t[11]===a?y=t[12]:(y=e=>e.ref===a&&!e.current&&!e.inUse,t[11]=a,t[12]=y);let b=v.some(y),x=`Switch branch`;d&&(x=`Check outcome`),u&&(x=`Checking switch`);let S=ew,C=!u,w;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,K.jsx)(rw,{children:`Switch branch`}),t[13]=w):w=t[13];let T;t[14]===r.name?T=t[15]:(T=(0,K.jsxs)(tw,{children:[w,(0,K.jsxs)(iw,{children:[`Choose a branch for `,r.name,`. Branches used by another worktree are unavailable.`]})]}),t[14]=r.name,t[15]=T);let E=hA,O;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,K.jsx)(_A,{"aria-label":`Find a branch`,placeholder:`Find a branch`}),t[16]=O):O=t[16];let k=vA,A;t[17]===m?A=t[18]:(A=sr(m)&&(0,K.jsx)(`p`,{role:`status`,className:`p-3 text-xs text-muted-foreground`,children:`Reading branches`}),t[17]=m,t[18]=A);let j;t[19]===m?j=t[20]:(j=Wn(m)&&(0,K.jsx)(`p`,{role:`alert`,className:`p-3 text-xs text-muted-foreground`,children:`Branches could not be read.`}),t[19]=m,t[20]=j);let M=h&&(0,K.jsx)(yA,{children:`No matching branch`}),N=bA,P;t[21]!==a||t[22]!==u||t[23]!==d?(P=e=>(0,K.jsxs)(xA,{value:e.name,disabled:u||d||e.current||e.inUse,onSelect:()=>o(e.ref),"data-checked":a===e.ref,className:`cursor-pointer`,children:[(0,K.jsx)(wo,{}),(0,K.jsx)(Fr,{text:e.name,className:`min-w-0 flex-1`}),e.current&&(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`Current`}),e.inUse&&(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`In use`}),a===e.ref&&(0,K.jsx)(D,{})]},e.ref),t[21]=a,t[22]=u,t[23]=d,t[24]=P):P=t[24];let F=v.map(P),I;t[25]!==N||t[26]!==F?(I=(0,K.jsx)(N,{children:F}),t[25]=N,t[26]=F,t[27]=I):I=t[27];let L;t[28]!==k||t[29]!==A||t[30]!==j||t[31]!==M||t[32]!==I?(L=(0,K.jsxs)(k,{"aria-label":`Branches`,children:[A,j,M,I]}),t[28]=k,t[29]=A,t[30]=j,t[31]=M,t[32]=I,t[33]=L):L=t[33];let R;t[34]!==E||t[35]!==L||t[36]!==O?(R=(0,K.jsxs)(E,{children:[O,L]}),t[34]=E,t[35]=L,t[36]=O,t[37]=R):R=t[37];let ee;t[38]===d?ee=t[39]:(ee=d&&(0,K.jsx)(`p`,{role:`status`,children:`The previous switch is not confirmed. Check its outcome before switching again.`}),t[38]=d,t[39]=ee);let te;t[40]===l?te=t[41]:(te=Wn(l)&&(0,K.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:String(xr(l.cause))}),t[40]=l,t[41]=te);let z;t[42]===l?z=t[43]:(z=It(l)&&l.value.state!==`succeeded`&&l.value.state!==`no-change`&&(0,K.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:l.value.message??`The branch could not be switched.`}),t[42]=l,t[43]=z);let ne;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,K.jsx)(wn,{variant:`outline`}),t[44]=ne):ne=t[44];let B;t[45]===u?B=t[46]:(B=(0,K.jsx)(QC,{render:ne,disabled:u,children:`Cancel`}),t[45]=u,t[46]=B);let re=u||!d&&!b,ie;t[47]!==a||t[48]!==f?(ie=()=>void f(a,OA),t[47]=a,t[48]=f,t[49]=ie):ie=t[49];let V;t[50]!==x||t[51]!==re||t[52]!==ie?(V=(0,K.jsx)(wn,{disabled:re,onClick:ie,children:x}),t[50]=x,t[51]=re,t[52]=ie,t[53]=V):V=t[53];let ae;t[54]!==B||t[55]!==V?(ae=(0,K.jsxs)(nw,{children:[B,V]}),t[54]=B,t[55]=V,t[56]=ae):ae=t[56];let oe;return t[57]!==S||t[58]!==R||t[59]!==ee||t[60]!==te||t[61]!==z||t[62]!==ae||t[63]!==C||t[64]!==T?(oe=(0,K.jsxs)(S,{showCloseButton:C,children:[T,R,ee,te,z,ae]}),t[57]=S,t[58]=R,t[59]=ee,t[60]=te,t[61]=z,t[62]=ae,t[63]=C,t[64]=T,t[65]=oe):oe=t[65],oe}function OA(){return BC.close()}function kA(){let e=(0,q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(bS,{handle:zC,children:AA}),e[0]=t):t=e[0],t}function AA(e){let{payload:t}=e;return t&&(0,K.jsx)(jA,{...t},t.requestId)}function jA(e){let t=(0,q.c)(21),{entry:n,connection:r,worktreeId:i}=e,a=$r(r),o;t[0]===a?o=t[1]:(o=Ri(a),t[0]=a,t[1]=o);let s=o,c;t[2]===a?c=t[3]:(c=Ci(a),t[2]=a,t[3]=c);let l=c,u;t[4]===n.name?u=t[5]:(u=(0,K.jsxs)(kS,{children:[`Delete `,n.name,`?`]}),t[4]=n.name,t[5]=u);let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,K.jsx)(AS,{children:`Choose what to delete this time. Your saved settings won’t change. Review history stays available.`}),t[6]=d):d=t[6];let f;t[7]===u?f=t[8]:(f=(0,K.jsxs)(DS,{children:[u,d]}),t[7]=u,t[8]=f);let p;t[9]!==l||t[10]!==r||t[11]!==n||t[12]!==s||t[13]!==i?(p=s?(0,K.jsx)(MA,{settings:s,entry:n,connection:r,worktreeId:i}):(0,K.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:l??`Reading deletion settings…`}),t[9]=l,t[10]=r,t[11]=n,t[12]=s,t[13]=i,t[14]=p):p=t[14];let m;t[15]===s?m=t[16]:(m=!s&&(0,K.jsx)(MS,{children:`Cancel`}),t[15]=s,t[16]=m);let h;return t[17]!==f||t[18]!==p||t[19]!==m?(h=(0,K.jsxs)(ES,{children:[f,p,m]}),t[17]=f,t[18]=p,t[19]=m,t[20]=h):h=t[20],h}function MA(e){let t=(0,q.c)(56),{settings:n,entry:r,connection:i,worktreeId:a}=e,{detached:o}=r,s;t[0]!==o||t[1]!==n?(s=()=>ci(n,o),t[0]=o,t[1]=n,t[2]=s):s=t[2];let[c,l]=(0,G.useState)(s),[u,d]=(0,G.useState)(),[f,p]=(0,G.useState)(!1),m;t[3]!==r.projectId||t[4]!==a?(m={projectId:r.projectId,worktreeId:a},t[3]=r.projectId,t[4]=a,t[5]=m):m=t[5];let h;t[6]!==i||t[7]!==m?(h={connection:i,scope:m},t[6]=i,t[7]=m,t[8]=h):h=t[8];let{result:g,submit:_}=SA(h,r,NA),v;t[9]!==f||t[10]!==c||t[11]!==u||t[12]!==_?(v=()=>void _({options:c,...u?{confirmation:{plan:u,discardChanges:f}}:{}},d,()=>{d(void 0),p(!1)}),t[9]=f,t[10]=c,t[11]=u,t[12]=_,t[13]=v):v=t[13];let y=v,b=g.waiting,x=Object.values(c).some(Boolean),S=u&&(u.dirty||u.unpushed),C=u&&!u.worktreePath&&!u.localBranch&&!u.remoteBranch,w=`Review deletion`;u&&(w=`Delete`),b&&(w=`Checking`);let T;t[14]!==o||t[15]!==c||t[16]!==b?(T=Ni.map(e=>{let{key:t,label:n}=e;return(0,K.jsxs)(Mn,{orientation:`horizontal`,children:[(0,K.jsx)(en,{htmlFor:`delete-${t}`,children:n}),(0,K.jsx)(_r,{id:`delete-${t}`,checked:c[t],disabled:b||o&&t!==`deleteWorktree`,onCheckedChange:e=>{l(n=>({...n,[t]:e})),d(void 0),p(!1)},className:`cursor-pointer`})]},t)}),t[14]=o,t[15]=c,t[16]=b,t[17]=T):T=t[17];let E;t[18]===o?E=t[19]:(E=o&&(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This worktree is detached: there is no checked-out branch to delete.`}),t[18]=o,t[19]=E);let D;t[20]!==o||t[21]!==c?(D=!o&&!c.deleteWorktree&&c.deleteLocalBranch&&(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Keep the worktree folder and its files, detach it from the branch, then delete the local branch.`}),t[20]=o,t[21]=c,t[22]=D):D=t[22];let O;t[23]!==o||t[24]!==c?(O=!o&&c.deleteWorktree&&!c.deleteLocalBranch&&(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`The worktree folder will be deleted. The local branch will be kept.`}),t[23]=o,t[24]=c,t[25]=O):O=t[25];let k;t[26]!==T||t[27]!==E||t[28]!==D||t[29]!==O?(k=(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[T,E,D,O]}),t[26]=T,t[27]=E,t[28]=D,t[29]=O,t[30]=k):k=t[30];let A;t[31]!==r.path||t[32]!==u?(A=u?(0,K.jsx)(`p`,{className:`whitespace-pre-wrap break-all text-xs text-muted-foreground`,children:Ma(u)}):(0,K.jsx)(`p`,{className:`break-all text-xs text-muted-foreground`,children:r.path}),t[31]=r.path,t[32]=u,t[33]=A):A=t[33];let j;t[34]!==f||t[35]!==b||t[36]!==S?(j=S&&(0,K.jsxs)(Mn,{orientation:`horizontal`,children:[(0,K.jsx)(en,{htmlFor:`delete-discard-changes`,children:`I understand the risk of losing changes and commits`}),(0,K.jsx)(_r,{id:`delete-discard-changes`,checked:f,disabled:b,onCheckedChange:p,className:`cursor-pointer`})]}),t[34]=f,t[35]=b,t[36]=S,t[37]=j):j=t[37];let M;t[38]===g?M=t[39]:(M=Wn(g)&&(0,K.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:Zr(xr(g.cause))}),t[38]=g,t[39]=M);let N;t[40]===b?N=t[41]:(N=(0,K.jsx)(MS,{disabled:b,children:`Cancel`}),t[40]=b,t[41]=N);let P=u?`destructive`:`default`,F=b||!x||!!(C||S&&!f),I;t[42]!==w||t[43]!==y||t[44]!==P||t[45]!==F?(I=(0,K.jsx)(wn,{variant:P,disabled:F,onClick:y,children:w}),t[42]=w,t[43]=y,t[44]=P,t[45]=F,t[46]=I):I=t[46];let L;t[47]!==N||t[48]!==I?(L=(0,K.jsxs)(OS,{children:[N,I]}),t[47]=N,t[48]=I,t[49]=L):L=t[49];let R;return t[50]!==A||t[51]!==j||t[52]!==M||t[53]!==L||t[54]!==k?(R=(0,K.jsxs)(K.Fragment,{children:[k,A,j,M,L]}),t[50]=A,t[51]=j,t[52]=M,t[53]=L,t[54]=k,t[55]=R):R=t[55],R}function NA(){return zC.close()}function PA(e){let t=(0,q.c)(34),{environmentId:n,environmentName:r,project:i}=e,a;t[0]!==n||t[1]!==i?(a={project:i,remote:n},t[0]=n,t[1]=i,t[2]=a):a=t[2];let o=a,s;t[3]===i?s=t[4]:(s={label:`Copy path`,icon:Ke,run:()=>Ft(Gn(i),`project path`),destructive:!1},t[3]=i,t[4]=s);let c;t[5]===o?c=t[6]:(c={label:`Rename project`,icon:bt,run:()=>IC.openWithPayload(o),destructive:!1},t[5]=o,t[6]=c);let l;t[7]===o?l=t[8]:(l={label:`Walkthrough settings`,icon:Ko,run:()=>FC.openWithPayload(o),destructive:!1},t[7]=o,t[8]=l);let u;t[9]===o?u=t[10]:(u={label:`Remove from Porcelain`,icon:vo,run:()=>LC.openWithPayload(o),destructive:!0},t[9]=o,t[10]=u);let d;t[11]!==s||t[12]!==c||t[13]!==l||t[14]!==u?(d=[s,c,l,u],t[11]=s,t[12]=c,t[13]=l,t[14]=u,t[15]=d):d=t[15];let f=d,p=`Project actions: ${i.name} · ${r}`,m;t[16]===p?m=t[17]:(m=(0,K.jsx)(er,{render:(0,K.jsx)(wn,{variant:`ghost`,size:`icon-xs`,"aria-label":p})}),t[16]=p,t[17]=m);let h;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,K.jsx)(ro,{}),t[18]=h):h=t[18];let g;t[19]===m?g=t[20]:(g=(0,K.jsx)(Xn,{render:m,children:h}),t[19]=m,t[20]=g);let _;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,K.jsx)(Vt,{children:`Project actions`}),t[21]=_):_=t[21];let v;t[22]===g?v=t[23]:(v=(0,K.jsxs)(yr,{disableHoverablePopup:!0,children:[g,_]}),t[22]=g,t[23]=v);let y;t[24]===i?y=t[25]:(y=!i.available&&(0,K.jsx)(Kt,{children:cr(i)}),t[24]=i,t[25]=y);let b;t[26]===f?b=t[27]:(b=f.map(FA),t[26]=f,t[27]=b);let x;t[28]!==y||t[29]!==b?(x=(0,K.jsx)(zt,{className:`w-56 max-w-[calc(100vw-2rem)]`,children:(0,K.jsxs)(Pn,{children:[y,b]})}),t[28]=y,t[29]=b,t[30]=x):x=t[30];let S;return t[31]!==v||t[32]!==x?(S=(0,K.jsxs)(Jn,{children:[v,x]}),t[31]=v,t[32]=x,t[33]=S):S=t[33],S}function FA(e){let{label:t,icon:n,run:r,destructive:i}=e;return(0,K.jsxs)(Cr,{className:`cursor-pointer`,variant:i?`destructive`:`default`,onClick:r,children:[(0,K.jsx)(n,{}),t]},t)}function IA(e){let t=(0,q.c)(10),{projectName:n,environmentName:r,environmentIcon:i,showEnvironment:a}=e,o=`${n} · ${r}`,s;t[0]===n?s=t[1]:(s=(0,K.jsx)(`div`,{className:`flex min-w-0 text-xs font-semibold`,children:(0,K.jsx)(Fr,{text:n})}),t[0]=n,t[1]=s);let c;t[2]!==i||t[3]!==r||t[4]!==a?(c=a&&(0,K.jsxs)(`div`,{role:`img`,"aria-label":`Computer: ${r}`,className:`flex min-w-0 items-center gap-1 text-2xs text-muted-foreground`,children:[(0,K.jsx)(Et,{icon:i,className:`size-3 shrink-0`}),(0,K.jsx)(Fr,{text:r})]}),t[2]=i,t[3]=r,t[4]=a,t[5]=c):c=t[5];let l;return t[6]!==o||t[7]!==s||t[8]!==c?(l=(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5 px-2 py-2`,"aria-label":o,children:[s,c]}),t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9],l}function LA(e){let t=(0,q.c)(3),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,K.jsx)(`div`,{className:`flex min-w-0 flex-col leading-tight`,children:(0,K.jsx)(Fr,{className:`text-sm font-semibold tracking-tight`,text:`Porcelain`})}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,K.jsxs)(`header`,{className:`desktop-sidebar-header mt-0.5 flex h-10 shrink-0 items-center gap-2 px-2`,children:[r,n]}),t[1]=n,t[2]=i),i}function RA(e){let t=(0,q.c)(23),{remotes:n,onOpenProject:r}=e;if(!n?.length){let e;t[0]===r?e=t[1]:(e=(0,K.jsx)(Bt,{className:`relative top-0 right-0 ml-auto w-6 cursor-pointer`,"aria-label":`Open project`,onClick:()=>r(null)}),t[0]=r,t[1]=e);let n;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,K.jsx)(Ro,{className:`text-muted-foreground`}),t[2]=n):n=t[2];let i;t[3]===e?i=t[4]:(i=(0,K.jsx)(Xn,{render:e,children:n}),t[3]=e,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.jsx)(Vt,{role:`tooltip`,children:`Open project`}),t[5]=a):a=t[5];let o;return t[6]===i?o=t[7]:(o=(0,K.jsxs)(yr,{disableHoverablePopup:!0,children:[i,a]}),t[6]=i,t[7]=o),o}let i;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,K.jsxs)(yr,{disableHoverablePopup:!0,children:[(0,K.jsx)(Xn,{render:(0,K.jsx)(er,{render:(0,K.jsx)(Bt,{className:`relative top-0 right-0 ml-auto w-6 cursor-pointer`,"aria-label":`Open project`})}),children:(0,K.jsx)(Ro,{className:`text-muted-foreground`})}),(0,K.jsx)(Vt,{role:`tooltip`,children:`Open project`})]}),t[8]=i):i=t[8];let a;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.jsx)(Kt,{children:`Open project on`}),t[9]=a):a=t[9];let o;t[10]===r?o=t[11]:(o=()=>r(null),t[10]=r,t[11]=o);let s;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,K.jsx)(wr,{}),t[12]=s):s=t[12];let c;t[13]===o?c=t[14]:(c=(0,K.jsxs)(Cr,{onClick:o,children:[s,`This computer`]}),t[13]=o,t[14]=c);let l;if(t[15]!==r||t[16]!==n){let e;t[18]===r?e=t[19]:(e=e=>(0,K.jsx)(zA,{entry:e,onOpen:()=>r(e)},e.remote.environmentId),t[18]=r,t[19]=e),l=n.map(e),t[15]=r,t[16]=n,t[17]=l}else l=t[17];let u;return t[20]!==c||t[21]!==l?(u=(0,K.jsxs)(Jn,{children:[i,(0,K.jsx)(zt,{align:`end`,className:`w-56`,children:(0,K.jsxs)(Pn,{children:[a,c,l]})})]}),t[20]=c,t[21]=l,t[22]=u):u=t[22],u}function zA(e){let t=(0,q.c)(11),{entry:n,onOpen:r}=e,i=y(n.remote),a=i.kind===`online`,o=!a,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,K.jsx)(rn,{}),t[0]=s):s=t[0];let c=a?i.name:n.remote.name,l;t[1]===c?l=t[2]:(l=(0,K.jsx)(Fr,{className:`min-w-0`,text:c}),t[1]=c,t[2]=l);let d;t[3]!==a||t[4]!==i?(d=!a&&(0,K.jsx)(yt,{variant:u(i),className:`relative top-0 right-0 ml-auto w-6 cursor-pointer`,children:Re(i)}),t[3]=a,t[4]=i,t[5]=d):d=t[5];let f;return t[6]!==r||t[7]!==o||t[8]!==l||t[9]!==d?(f=(0,K.jsxs)(Cr,{disabled:o,onClick:r,children:[s,l,d]}),t[6]=r,t[7]=o,t[8]=l,t[9]=d,t[10]=f):f=t[10],f}function BA(e){return e.main?Eo:wo}function VA(e){let t=(0,q.c)(7),{container:n}=e,{toasts:r}=si();if(!n)return null;let i;t[0]===r?i=t[1]:(i=r.map(HA),t[0]=r,t[1]=i);let a;t[2]===i?a=t[3]:(a=(0,K.jsx)(Pi,{children:i}),t[2]=i,t[3]=a);let o;return t[4]!==n||t[5]!==a?(o=(0,K.jsx)(Di,{container:n,children:a}),t[4]=n,t[5]=a,t[6]=o):o=t[6],o}function HA(e){return(0,K.jsx)(vi,{toast:e,children:(0,K.jsxs)(ui,{children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1 wrap-anywhere`,children:[(0,K.jsx)(Qr,{}),(0,K.jsx)(hi,{})]}),(0,K.jsx)(Si,{}),(0,K.jsx)(oi,{})]})},e.id)}function UA(e){return(0,K.jsxs)(Hn,{render:(0,K.jsx)(`span`,{className:`block`}),children:[(0,K.jsxs)(`span`,{className:`block`,children:[e.failures.length,` `,e.failures.length===1?`worktree`:`worktrees`,` ·`,` `,(0,K.jsx)(vn,{render:(0,K.jsx)(wn,{variant:`link`,size:`sm`}),children:`Details`})]}),(0,K.jsx)(or,{render:(0,K.jsx)(`span`,{className:`block`}),children:(0,K.jsx)(`span`,{role:`list`,tabIndex:0,"aria-label":`Affected worktrees`,className:`mt-2 block max-h-48 space-y-2 overflow-y-auto`,children:e.failures.map(({entry:e,detail:t})=>(0,K.jsxs)(`span`,{role:`listitem`,className:`block wrap-anywhere`,children:[(0,K.jsx)(`span`,{className:`block font-medium`,children:e.name}),t&&(0,K.jsx)(`span`,{className:`block`,children:t})]},e.key))})})]})}function WA(e){let t=(0,q.c)(122),{remotes:n,selected:r,onSelect:i,onOpenPullRequest:a,onOpenProject:o,onOpenSettings:s,settingsOpen:c,onOpenShortcuts:l}=e,{connection:u}=Me(),[d,f]=(0,G.useState)(null),m=xT(),h=xT(),g=xT(),_=[u,...(n??[]).map(YA)],{projects:v,filters:y,loading:b,messages:x}=B(_n(_)),S=B(we),C=p(we),{query:w,filter:T}=S;ye(k(_));let E=p(Jt(_));ye(oT({connections:_,description:UA}));let D=Ua(),O;t[0]===D.href?O=t[1]:(O={href:D.href,open:!1},t[0]=D.href,t[1]=O);let[A,j]=(0,G.useState)(O),M=A.href===D.href&&A.open,P;t[2]===C?P=t[3]:(P=e=>C(t=>({...t,query:e})),t[2]=C,t[3]=P);let F=P,I=T.projects!==void 0||T.environments!==void 0,L=w.trim()||I?`No matching worktrees`:`No projects registered`,R=w.trim()||I?`Try another search or clear the filters.`:`Open a Git repository to get started.`,{setOpenMobile:ee,isMobile:te}=nn(),z=r?{kind:`worktree`,worktreeId:r.worktreeId,environmentId:r.remote??u.environmentId}:void 0,ne,re;if(t[4]!==v){let e=v.flatMap(JA).filter(qA);ne=e[0]?.key,re=e.at(-1)?.key,t[4]=v,t[5]=ne,t[6]=re}else ne=t[5],re=t[6];let ie=re,V;t[7]!==u||t[8]!==i||t[9]!==ee?(V=e=>{e.worktreeId&&(i({remote:e.environmentId===u.environmentId?null:e.environmentId,projectId:e.projectId,worktreeId:e.worktreeId}),ee(!1))},t[7]=u,t[8]=i,t[9]=ee,t[10]=V):V=t[10];let ae=V,se;t[11]!==o||t[12]!==n?(se=(0,K.jsx)(LA,{children:(0,K.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center`,children:(0,K.jsx)(RA,{remotes:n,onOpenProject:o})})}),t[11]=o,t[12]=n,t[13]=se):se=t[13];let ce;t[14]===F?ce=t[15]:(ce=e=>F(e.target.value),t[14]=F,t[15]=ce);let le;t[16]!==h||t[17]!==g||t[18]!==w.length||t[19]!==F?(le=e=>{e.key===`Escape`&&w.length>0&&(e.stopPropagation(),F(``)),(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),(e.key===`ArrowDown`?h:g).element?.focus())},t[16]=h,t[17]=g,t[18]=w.length,t[19]=F,t[20]=le):le=t[20];let ue;t[21]!==te||t[22]!==w||t[23]!==ce||t[24]!==le?(ue=(0,K.jsx)(kT,{autoFocus:te,type:`search`,"aria-label":`Search worktrees`,placeholder:`Search`,value:w,onChange:ce,onKeyDown:le}),t[21]=te,t[22]=w,t[23]=ce,t[24]=le,t[25]=ue):ue=t[25];let de;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,K.jsx)(TT,{children:(0,K.jsx)(Wo,{})}),t[26]=de):de=t[26];let fe;t[27]===ue?fe=t[28]:(fe=(0,K.jsxs)(CT,{className:`min-w-0 flex-1`,children:[ue,de]}),t[27]=ue,t[28]=fe);let pe;t[29]===D.href?pe=t[30]:(pe=e=>j({href:D.href,open:e}),t[29]=D.href,t[30]=pe);let me;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,K.jsxs)(yr,{disableHoverablePopup:!0,children:[(0,K.jsx)(Xn,{render:(0,K.jsx)(er,{render:(0,K.jsx)(Bt,{"aria-label":`Filter worktrees`,className:`relative top-0 right-0 w-6 cursor-pointer`})}),children:(0,K.jsx)(Mo,{})}),(0,K.jsx)(Vt,{children:`Filter worktrees`})]}),t[31]=me):me=t[31];let he;if(t[32]!==y||t[33]!==C){let e;t[35]===C?e=t[36]:(e=e=>(0,K.jsxs)(Pn,{children:[(0,K.jsx)(Kt,{children:e.label}),e.items.map(t=>(0,K.jsxs)(ur,{className:`cursor-pointer`,checked:t.checked,closeOnClick:!1,onCheckedChange:()=>C(n=>({...n,filter:{...n.filter,[e.key]:t.next}})),children:[t.icon&&(0,K.jsx)(Et,{icon:t.icon}),(0,K.jsx)(Fr,{propagateEscape:!0,text:t.label,className:`min-w-0 flex-1`})]},t.id)),(0,K.jsx)(tn,{})]},e.key),t[35]=C,t[36]=e),he=y.map(e),t[32]=y,t[33]=C,t[34]=he}else he=t[34];let ge;t[37]===C?ge=t[38]:(ge=(0,K.jsx)(Cr,{className:`cursor-pointer`,onClick:()=>C(KA),children:`Clear filters`}),t[37]=C,t[38]=ge);let _e;t[39]!==he||t[40]!==ge?(_e=(0,K.jsx)(zt,{align:`start`,className:`flex max-h-[min(24rem,var(--available-height))] w-80 max-w-[calc(100vw-2rem)] flex-col overflow-y-hidden`,children:(0,K.jsxs)(`div`,{className:`-m-1 min-h-0 overflow-y-auto p-1`,children:[he,ge]})}),t[39]=he,t[40]=ge,t[41]=_e):_e=t[41];let be;t[42]!==M||t[43]!==pe||t[44]!==_e?(be=(0,K.jsxs)(Jn,{open:M,onOpenChange:pe,children:[me,_e]}),t[42]=M,t[43]=pe,t[44]=_e,t[45]=be):be=t[45];let xe;t[46]!==fe||t[47]!==be?(xe=(0,K.jsxs)(`div`,{className:`navigator-filters mb-2 flex items-center gap-1 px-2`,children:[fe,be]}),t[46]=fe,t[47]=be,t[48]=xe):xe=t[48];let Se=kn,Ce;t[49]===b?Ce=t[50]:(Ce=b&&(0,K.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 px-3 py-2 text-xs text-muted-foreground`,children:[(0,K.jsx)(At,{"aria-label":`Reading worktrees`}),`Reading worktrees…`]}),t[49]=b,t[50]=Ce);let H=v.map(e=>(0,K.jsx)(vr,{className:`mb-3`,children:(0,K.jsxs)(Hn,{open:e.expanded,onOpenChange:t=>C(n=>({...n,expanded:{...n.expanded,[e.key]:t}})),className:`group/project`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,K.jsx)(IA,{projectName:e.project.name,environmentName:e.environmentName,environmentIcon:e.environmentIcon,showEnvironment:_.length>1}),(0,K.jsx)(PA,{project:e.project,environmentId:e.connection.environmentId===u.environmentId?null:e.connection.environmentId,environmentName:e.environmentName}),(0,K.jsxs)(yr,{disableHoverablePopup:!0,children:[(0,K.jsx)(Xn,{render:(0,K.jsx)(vn,{render:(0,K.jsx)(Bt,{className:`relative top-0 right-0 w-6 cursor-pointer`,"aria-label":`${e.expanded?`Collapse`:`Expand`} ${e.project.name} · ${e.environmentName}`})}),children:(0,K.jsx)(Ze,{className:`group-data-closed/project:-rotate-90`})}),(0,K.jsx)(Vt,{children:e.expanded?`Collapse project`:`Expand project`})]})]}),(0,K.jsx)(or,{children:(0,K.jsxs)(Qt,{children:[e.entries.map(t=>{let n=z!==void 0&&He(t,z),r=t.pullRequest.state===`available`?t.pullRequest:void 0,i=t.kind===`worktree`?N(t.changes):``,o=BA(t),s=r?.checks?.state===`available`&&r.checks.result===`failed`,c=t.key===ie?g.attach:void 0;t.key===ne&&(c=h.attach);let l=`${[t.name,t.projectName,t.environmentName,t.main?`Main worktree`:void 0,t.detached?`Detached HEAD`:void 0,t.detached?t.path:void 0,t.kind===`worktree`?oe(t.changes):void 0,r?.number?`Pull request #${r.number}`:void 0,t.available?void 0:`Unavailable`].filter(Boolean).join(`, `)}${n?`, Current`:``}`;return(0,K.jsx)(Yn,{children:(0,K.jsx)(vT,{onRetryChanges:()=>E({environmentId:t.environmentId}),entry:t,connection:_.find(t=>t.environmentId===e.connection.environmentId)??u,children:(0,K.jsx)(Fr,{text:t.path?`${t.name} · ${t.path}`:t.name,disclose:t.detached?`always`:`clipped`,renderTrigger:(e,u)=>(0,K.jsxs)(`div`,{"data-navigator-card":``,role:`presentation`,tabIndex:-1,className:n?`relative rounded-md bg-card`:`relative rounded-md hover:bg-card`,children:[(0,K.jsx)(mr,{className:`absolute inset-0 h-full cursor-pointer`,"data-sidebar":`menu-button`,size:`xs`,"aria-label":l,"aria-current":n?`page`:void 0,onClick:()=>ae(t),render:(0,K.jsx)(`button`,{type:`button`,ref:c,disabled:!t.available})}),(0,K.jsxs)(mr,{size:`xs`,className:`pointer-events-none relative`,children:[(0,K.jsx)(qn,{className:`self-start`,children:(0,K.jsx)(o,{className:`mt-0.5 size-3.5 text-muted-foreground`})}),(0,K.jsxs)(ar,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[u(t.displayTitle??t.name,n?`min-w-0 flex-1 font-semibold`:`min-w-0 flex-1 font-medium`),t.detached&&(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Detached`}),s&&(0,K.jsx)(Ya,{className:`size-3 shrink-0 text-del-fg`,"aria-label":`Checks failed`})]}),t.displayTitle&&(0,K.jsx)(`div`,{className:`min-w-0 font-mono text-2xs text-muted-foreground`,children:u(t.branch,`block font-mono text-2xs`)}),(r?.number||i)&&(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-2xs text-muted-foreground`,children:[r?.number&&(0,K.jsx)(wn,{variant:`ghost`,size:`xs`,className:`relative pointer-events-auto cursor-pointer`,"aria-label":`Open PR #${r.number} · ${t.projectName} · ${t.environmentName} · ${ve(r.checks)}`,onClick:()=>{a(t),ee(!1)},children:(0,K.jsxs)(`span`,{className:`text-muted-foreground`,children:[`#`,r.number]})}),i&&(0,K.jsx)(`span`,{role:`img`,"aria-label":`Local uncommitted changes: ${oe(t.changes)}`,children:i})]})]})]})]})})})},t.key)}),e.entries.length===0&&!b&&(0,K.jsx)(`p`,{className:`px-2 py-3 text-xs text-muted-foreground`,children:`No matching worktrees`})]})})]})},e.key)),Te;t[51]!==R||t[52]!==L||t[53]!==b||t[54]!==x.length||t[55]!==v.length?(Te=!b&&x.length===0&&v.length===0&&(0,K.jsx)(jT,{children:(0,K.jsxs)(MT,{children:[(0,K.jsx)(NT,{children:L}),(0,K.jsx)(PT,{children:R})]})}),t[51]=R,t[52]=L,t[53]=b,t[54]=x.length,t[55]=v.length,t[56]=Te):Te=t[56];let Ee;t[57]===x?Ee=t[58]:(Ee=x.map(GA),t[57]=x,t[58]=Ee);let De;t[59]!==b||t[60]!==x.length||t[61]!==E?(De=x.length>0&&(0,K.jsx)(wn,{variant:`ghost`,disabled:b,onClick:()=>E(void 0),children:`Read again`}),t[59]=b,t[60]=x.length,t[61]=E,t[62]=De):De=t[62];let Oe;t[63]!==Se||t[64]!==Ce||t[65]!==H||t[66]!==Te||t[67]!==Ee||t[68]!==De?(Oe=(0,K.jsxs)(Se,{children:[Ce,H,Te,Ee,De]}),t[63]=Se,t[64]=Ce,t[65]=H,t[66]=Te,t[67]=Ee,t[68]=De,t[69]=Oe):Oe=t[69];let ke;t[70]===d?ke=t[71]:(ke=(0,K.jsx)(`div`,{ref:f,children:(0,K.jsx)(Na,{toastManager:aT,children:(0,K.jsx)(VA,{container:d})})}),t[70]=d,t[71]=ke);let U;t[72]===m?U=t[73]:(U=e=>m.attach(e),t[72]=m,t[73]=U);let Ae=c?`Close Settings`:`Settings`,je=c?`submit`:`button`,Ne=c?`close-settings`:void 0,Pe=c?void 0:s,Fe;t[74]===c?Fe=t[75]:(Fe=e=>{c&&e.key===`Escape`&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},t[74]=c,t[75]=Fe);let Ie;t[76]!==U||t[77]!==Ae||t[78]!==je||t[79]!==Ne||t[80]!==Pe||t[81]!==Fe?(Ie=(0,K.jsx)(wn,{ref:U,variant:`ghost`,className:`min-w-0 shrink`,"aria-label":Ae,type:je,form:Ne,onClick:Pe,onKeyDown:Fe}),t[76]=U,t[77]=Ae,t[78]=je,t[79]=Ne,t[80]=Pe,t[81]=Fe,t[82]=Ie):Ie=t[82];let Le;t[83]===c?Le=t[84]:(Le=c?(0,K.jsx)(un,{}):(0,K.jsx)(Ko,{className:`text-muted-foreground`}),t[83]=c,t[84]=Le);let Re=c?`Close`:`Settings`,ze;t[85]===Re?ze=t[86]:(ze=(0,K.jsx)(Fr,{text:Re}),t[85]=Re,t[86]=ze);let Be;t[87]===c?Be=t[88]:(Be=c&&(0,K.jsx)(yT,{children:Ui(Fi.closeSettings)}),t[87]=c,t[88]=Be);let Ve;t[89]!==Ie||t[90]!==Le||t[91]!==ze||t[92]!==Be?(Ve=(0,K.jsxs)(Xn,{render:Ie,children:[Le,ze,Be]}),t[89]=Ie,t[90]=Le,t[91]=ze,t[92]=Be,t[93]=Ve):Ve=t[93];let Ue=c?`Close Settings`:`Settings`,We=c?Fi.closeSettings:Fi.openSettings,Ge;t[94]===We?Ge=t[95]:(Ge=Ui(We),t[94]=We,t[95]=Ge);let Ke;t[96]===Ge?Ke=t[97]:(Ke=(0,K.jsx)(yT,{children:Ge}),t[96]=Ge,t[97]=Ke);let qe;t[98]!==Ue||t[99]!==Ke?(qe=(0,K.jsxs)(Vt,{role:`tooltip`,children:[Ue,` `,Ke]}),t[98]=Ue,t[99]=Ke,t[100]=qe):qe=t[100];let Je;t[101]!==Ve||t[102]!==qe?(Je=(0,K.jsxs)(yr,{disableHoverablePopup:!0,children:[Ve,qe]}),t[101]=Ve,t[102]=qe,t[103]=Je):Je=t[103];let Ye;t[104]===m?Ye=t[105]:(Ye=(0,K.jsx)(dr,{fallbackFocus:m}),t[104]=m,t[105]=Ye);let Xe;t[106]===l?Xe=t[107]:(Xe=(0,K.jsx)(wn,{variant:`ghost`,size:`icon`,"aria-label":`Keyboard shortcuts`,onClick:l}),t[106]=l,t[107]=Xe);let Qe;t[108]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=(0,K.jsx)(Oo,{className:`text-muted-foreground`}),t[108]=Qe):Qe=t[108];let $e;t[109]===Xe?$e=t[110]:($e=(0,K.jsx)(Xn,{render:Xe,children:Qe}),t[109]=Xe,t[110]=$e);let et;t[111]===Symbol.for(`react.memo_cache_sentinel`)?(et=(0,K.jsxs)(Vt,{role:`tooltip`,children:[`Keyboard shortcuts`,` `,(0,K.jsx)(yT,{children:Ui(Fi.openShortcuts)})]}),t[111]=et):et=t[111];let W;t[112]===$e?W=t[113]:(W=(0,K.jsxs)(yr,{disableHoverablePopup:!0,children:[$e,et]}),t[112]=$e,t[113]=W);let tt;t[114]!==Ye||t[115]!==W?(tt=(0,K.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[Ye,W]}),t[114]=Ye,t[115]=W,t[116]=tt):tt=t[116];let nt;t[117]!==Je||t[118]!==tt?(nt=(0,K.jsxs)(`footer`,{role:`group`,"aria-label":`Navigator controls`,className:`navigator-footer flex shrink-0 items-center gap-1 p-2`,children:[Je,tt]}),t[117]=Je,t[118]=tt,t[119]=nt):nt=t[119];let rt,it;return t[120]===Symbol.for(`react.memo_cache_sentinel`)?(rt=(0,K.jsx)(kA,{}),it=(0,K.jsx)(TA,{}),t[120]=rt,t[121]=it):(rt=t[120],it=t[121]),(0,K.jsxs)(`div`,{className:`review-navigator h-full min-h-0 overflow-hidden bg-frame text-ui [--sidebar:var(--frame)] [--sidebar-foreground:var(--foreground)] [--muted:var(--card)] [--secondary:var(--card)] [--sidebar-accent:var(--card)]`,children:[(0,K.jsxs)(Pt,{role:`navigation`,collapsible:`none`,className:`h-full w-full min-h-0 overflow-hidden`,"aria-label":`Projects and worktrees`,children:[se,xe,Oe,ke,nt]}),rt,it]})}function GA(e){return(0,K.jsx)(`p`,{role:`status`,className:`px-3 text-xs wrap-anywhere`,children:e},e)}function KA(e){return{...e,filter:Pe}}function qA(e){return e.available||e.pullRequest.state===`available`}function JA(e){return e.expanded?e.entries:[]}function YA(e){return e.connection}function XA(e,t){let n=(0,q.c)(6),[r,i]=Wi(e),a;n[0]!==t||n[1]!==i?(a=e=>i(e).then(t,ZA),n[0]=t,n[1]=i,n[2]=a):a=n[2];let o;return n[3]!==r||n[4]!==a?(o={result:r,submit:a},n[3]=r,n[4]=a,n[5]=o):o=n[5],o}function ZA(){}function QA(e,t){let n=(0,q.c)(2),r;return n[0]===e?r=n[1]:(r=En(e),n[0]=e,n[1]=r),XA(r,t)}function $A(e,t){let n=(0,q.c)(2),r;return n[0]===e?r=n[1]:(r=je(e),n[0]=e,n[1]=r),XA(r,t)}var ej=r;function tj(e){let t=(0,q.c)(4),{remote:n,connection:r,children:i}=e,a;return t[0]!==i||t[1]!==r||t[2]!==n?(a=n===null?i({connection:r,unavailable:void 0}):(0,K.jsx)(nj,{environmentId:n,children:i}),t[0]=i,t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function nj(e){let t=(0,q.c)(3),{environmentId:n,children:r}=e,i=c(n),a;return t[0]!==r||t[1]!==i?(a=i&&(0,K.jsx)(rj,{entry:i,children:r}),t[0]=r,t[1]=i,t[2]=a):a=t[2],a}function rj(e){let t=(0,q.c)(6),{entry:n,children:r}=e,i=y(n.remote),a;t[0]===i?a=t[1]:(a=i.kind===`online`?void 0:`${Re(i)}. ${_t(i)??`Wait for this computer to answer before changing its projects.`}`,t[0]=i,t[1]=a);let o;return t[2]!==r||t[3]!==n.connection||t[4]!==a?(o=r({connection:n.connection,unavailable:a}),t[2]=r,t[3]=n.connection,t[4]=a,t[5]=o):o=t[5],o}function ij(e){let t=(0,q.c)(5),{unavailable:n,result:r}=e,i;t[0]!==r||t[1]!==n?(i=n??(Wn(r)?it(xr(r.cause)):void 0),t[0]=r,t[1]=n,t[2]=i):i=t[2];let o=i,s;return t[3]===o?s=t[4]:(s=o&&(0,K.jsx)(Be,{variant:`destructive`,children:(0,K.jsx)(a,{children:o})}),t[3]=o,t[4]=s),s}function aj(e){let t=(0,q.c)(2),{connection:n}=e,r;return t[0]===n?r=t[1]:(r=(0,K.jsx)(bS,{handle:LC,children:e=>{let{payload:t}=e;return t&&(0,K.jsx)(tj,{remote:t.remote,connection:n,children:e=>(0,K.jsx)(ES,{children:(0,K.jsx)(oj,{project:t.project,...e},t.project.id)})})}}),t[0]=n,t[1]=r),r}function oj(e){let t=(0,q.c)(32),{project:n,connection:r,unavailable:i}=e,a=$A(r,sj),{result:o}=a,s;t[0]===n.name?s=t[1]:(s=(0,K.jsxs)(kS,{className:`break-all`,children:[`Remove `,n.name,` from Porcelain?`]}),t[0]=n.name,t[1]=s);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,K.jsx)(AS,{children:`Removes this project and its reviews and comments from Porcelain; files and Git history stay on disk.`}),t[2]=c):c=t[2];let l;t[3]===s?l=t[4]:(l=(0,K.jsxs)(DS,{children:[s,c]}),t[3]=s,t[4]=l);let u;t[5]===n?u=t[6]:(u=Gn(n),t[5]=n,t[6]=u);let d;t[7]===u?d=t[8]:(d=(0,K.jsx)(`p`,{className:`break-all font-mono text-xs text-muted-foreground`,children:u}),t[7]=u,t[8]=d);let f;t[9]!==o||t[10]!==i?(f=(0,K.jsx)(ij,{unavailable:i,result:o}),t[9]=o,t[10]=i,t[11]=f):f=t[11];let p;t[12]===o.waiting?p=t[13]:(p=(0,K.jsx)(MS,{disabled:o.waiting,children:`Cancel`}),t[12]=o.waiting,t[13]=p);let m=o.waiting||i!==void 0,h;t[14]!==n.id||t[15]!==a?(h=()=>void a.submit(n.id),t[14]=n.id,t[15]=a,t[16]=h):h=t[16];let g;t[17]===o.waiting?g=t[18]:(g=o.waiting&&(0,K.jsx)(At,{}),t[17]=o.waiting,t[18]=g);let _=o.waiting?`Removing…`:`Remove from Porcelain`,v;t[19]!==g||t[20]!==_||t[21]!==m||t[22]!==h?(v=(0,K.jsxs)(jS,{variant:`destructive`,disabled:m,onClick:h,children:[g,_]}),t[19]=g,t[20]=_,t[21]=m,t[22]=h,t[23]=v):v=t[23];let y;t[24]!==v||t[25]!==p?(y=(0,K.jsxs)(OS,{children:[p,v]}),t[24]=v,t[25]=p,t[26]=y):y=t[26];let b;return t[27]!==y||t[28]!==l||t[29]!==d||t[30]!==f?(b=(0,K.jsxs)(K.Fragment,{children:[l,d,f,y]}),t[27]=y,t[28]=l,t[29]=d,t[30]=f,t[31]=b):b=t[31],b}function sj(){return LC.close()}function cj(e){let t=(0,q.c)(2),{connection:n}=e,r;return t[0]===n?r=t[1]:(r=(0,K.jsx)(g,{handle:IC,children:e=>{let{payload:t}=e;return t&&(0,K.jsx)(tj,{remote:t.remote,connection:n,children:e=>(0,K.jsx)(ew,{children:(0,K.jsx)(lj,{project:t.project,...e},t.project.id)})})}}),t[0]=n,t[1]=r),r}function lj(e){let t=(0,q.c)(40),{project:n,connection:r,unavailable:i}=e,a=QA(r,pj),{result:o}=a,s;t[0]===n.name?s=t[1]:(s={name:n.name},t[0]=n.name,t[1]=s);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c={onChange:ej},t[2]=c):c=t[2];let l;t[3]!==n.id||t[4]!==a?(l=e=>{let{value:t}=e;return a.submit({projectId:n.id,name:t.name})},t[3]=n.id,t[4]=a,t[5]=l):l=t[5];let u;t[6]!==s||t[7]!==l?(u={defaultValues:s,validators:c,onSubmit:l},t[6]=s,t[7]=l,t[8]=u):u=t[8];let d=Da(u),f;t[9]===d?f=t[10]:(f=e=>qr(e,()=>d.handleSubmit()),t[9]=d,t[10]=f);let p;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,K.jsxs)(tw,{children:[(0,K.jsx)(rw,{children:`Rename project`}),(0,K.jsx)(iw,{children:`The name is only a label in this sidebar. Nothing on disk changes, and two projects may share one.`})]}),t[11]=p):p=t[11];let m;t[12]===d.Field?m=t[13]:(m=(0,K.jsx)(d.Field,{name:`name`,children:fj}),t[12]=d.Field,t[13]=m);let h;t[14]===n?h=t[15]:(h=Gn(n),t[14]=n,t[15]=h);let g;t[16]===h?g=t[17]:(g=(0,K.jsx)(`p`,{className:`break-all font-mono text-xs text-muted-foreground`,children:h}),t[16]=h,t[17]=g);let _;t[18]!==m||t[19]!==g?(_=(0,K.jsxs)(`div`,{className:`grid gap-2 py-4`,children:[m,g]}),t[18]=m,t[19]=g,t[20]=_):_=t[20];let v;t[21]!==o||t[22]!==i?(v=(0,K.jsx)(ij,{unavailable:i,result:o}),t[21]=o,t[22]=i,t[23]=v):v=t[23];let y;t[24]===o.waiting?y=t[25]:(y=(0,K.jsx)(wn,{type:`button`,variant:`outline`,disabled:o.waiting,onClick:dj,children:`Cancel`}),t[24]=o.waiting,t[25]=y);let b;t[26]!==o.waiting||t[27]!==i?(b=e=>(0,K.jsxs)(wn,{type:`submit`,disabled:!e||o.waiting||i!==void 0,children:[o.waiting&&(0,K.jsx)(At,{}),o.waiting?`Renaming…`:`Rename`]}),t[26]=o.waiting,t[27]=i,t[28]=b):b=t[28];let x;t[29]!==d.Subscribe||t[30]!==b?(x=(0,K.jsx)(d.Subscribe,{selector:uj,children:b}),t[29]=d.Subscribe,t[30]=b,t[31]=x):x=t[31];let S;t[32]!==y||t[33]!==x?(S=(0,K.jsxs)(nw,{children:[y,x]}),t[32]=y,t[33]=x,t[34]=S):S=t[34];let C;return t[35]!==_||t[36]!==v||t[37]!==S||t[38]!==f?(C=(0,K.jsxs)(`form`,{onSubmit:f,children:[p,_,v,S]}),t[35]=_,t[36]=v,t[37]=S,t[38]=f,t[39]=C):C=t[39],C}function uj(e){return e.canSubmit}function dj(){return IC.close()}function fj(e){return(0,K.jsxs)(Mn,{"data-invalid":e.state.meta.isTouched&&!e.state.meta.isValid,children:[(0,K.jsx)(St,{htmlFor:`project-name`,children:`Name`}),(0,K.jsx)(h,{id:`project-name`,name:e.name,value:e.state.value,autoFocus:!0,"aria-invalid":e.state.meta.isTouched&&!e.state.meta.isValid,"aria-describedby":e.state.meta.isTouched&&!e.state.meta.isValid?`project-name-error`:void 0,onBlur:e.handleBlur,onChange:t=>e.handleChange(t.target.value)}),e.state.meta.isTouched&&!e.state.meta.isValid&&(0,K.jsx)(Wt,{id:`project-name-error`,errors:e.state.meta.errors})]})}function pj(){return IC.close()}function mj(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function hj(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function gj(e){return e/100*window.innerHeight}function _j(e){return e/100*window.innerWidth}function vj(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function yj({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=vj(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=hj(t,i);break;case`em`:r=mj(t,i);break;case`vh`:r=gj(i);break;case`vw`:r=_j(i)}return r}function bj(e){return parseFloat(e.toFixed(3))}function xj({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function Sj(e){let{panels:t}=e,n=xj({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=bj(yj({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=bj(yj({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=bj(yj({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=bj(yj({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function Cj(e,t=`Assertion error`){if(!e)throw Error(t)}function wj(e,t){return Array.from(t).sort(e===`horizontal`?Tj:Ej)}function Tj(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function Ej(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function Dj(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Oj(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function kj({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=Oj(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return Cj(i,`No rect found`),i}var Aj;function jj(){return Aj===void 0&&(Aj=typeof matchMedia==`function`&&!!matchMedia(`(pointer:coarse)`).matches),Aj}function Mj(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=wj(n,Array.from(t.children).filter(Dj).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,kj({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=jj()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:xj({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var Nj=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0){if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},Pj={cursorFlags:0,state:`inactive`},Fj=new Nj;function Ij(){return Pj}function Lj(e){return Fj.addListener(`change`,e)}function Rj(e){let t=Pj,n={...Pj};n.cursorFlags=e,Pj=n,Fj.emit(`change`,{prev:t,next:n})}function zj(e){let t=Pj;Pj=e,Fj.emit(`change`,{prev:t,next:e})}var Bj=e=>e,Vj=()=>{},Hj=1,Uj=2,Wj=4,Gj=8,Kj=3,qj=12,Jj;function Yj(){return Jj===void 0&&(Jj=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(Jj=!0)),Jj}function Xj({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++}})}if(r!==0||i!==0){if(n===`active`&&e&&Yj()){let t=(e&Hj)!==0,n=(e&Uj)!==0,r=(e&Wj)!==0,i=(e&Gj)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}return Yj()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var Zj=new WeakMap;function Qj(e){if(!e.defaultView||!e.adoptedStyleSheets)return;let{prevStyle:t,styleSheet:n}=Zj.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let r=Ij();switch(r.state){case`active`:case`hover`:{let e=Xj({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0)}Zj.set(e,{prevStyle:t,styleSheet:n})}var $j=new Map,eM=new Nj;function tM(e){$j=new Map($j),$j.delete(e)}function nM(e,t){for(let[t]of $j)if(t.id===e)return t}function rM(e,t){for(let[t,n]of $j)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function iM(){return $j}function aM(e,t){return eM.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function oM(e,t,n){let r=$j.get(e);$j=new Map($j),$j.set(e,t),eM.emit(`groupChange`,{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:r,next:t})}function sM(e){let t=Ij(),n=iM(),r=!1;return t.state===`active`&&(zj({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(Qj(e),r=!0,t.hitRegions.forEach(e=>{if(!n.has(e.group))return;let t=rM(e.group.id,!0);oM(e.group,t,{isUserInteraction:!0})}))),r}function cM(e){e.defaultPrevented||sM(e.currentTarget)}function lM(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Oj(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t)}}return r?{distance:i,hitRegion:r}:void 0}function uM(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function dM(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:_M(e),b:_M(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();Cj(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:gM(hM(n.a)),b:gM(hM(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var fM=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function pM(e){let t=getComputedStyle(vM(e)??e).display;return t===`flex`||t===`inline-flex`}function mM(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||pM(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||fM.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function hM(e){let t=e.length;for(;t--;){let n=e[t];if(Cj(n,`Missing node`),mM(n))return n}return null}function gM(e){return e&&Number(getComputedStyle(e).zIndex)||0}function _M(e){let t=[];for(;e;)t.push(e),e=vM(e);return t}function vM(e){let{parentNode:t}=e;return uM(t)?t.host:t}function yM(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function bM({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Dj(n)||n.contains(e)||e.contains(n))return!0;if(dM(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(yM(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function xM(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Mj(r),a=lM(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&bM({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function SM(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function CM(e,t,n=0){return Math.abs(bj(e)-bj(t))<=n}function wM(e,t){return CM(e,t)?0:e>t?1:-1}function TM({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(wM(r,c)<0){if(a){let e=(i+c)/2;r=wM(r,e)<0?i:c}else r=c}return r=Math.min(s,r),r=bj(r),r}function EM({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(CM(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;Cj(u!=null,`Invalid first pivot index`),Cj(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];Cj(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(Cj(n!=null,`Previous layout not found for panel index ${t}`),CM(n,i)){let t=o-n;wM(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];Cj(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(Cj(n!=null,`Previous layout not found for panel index ${t}`),CM(n,o)){let t=n-i;wM(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];Cj(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&wM(i,c)<0){if(e>0){let t=c-o,n=t/2;wM(i+e,c)<0&&(e=wM(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;wM(i-e,c)<0&&(e=wM(100+e,n)>0?0:-t)}}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];Cj(e!=null,`Previous layout not found for panel index ${r}`);let a=TM({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];Cj(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=TM({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!CM(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(SM(c,l))return i;{let t=e<0?d:u,r=s[t];Cj(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=TM({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!CM(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];Cj(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=TM({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(CM(i,s)||(t-=s-i,l[r]=s),CM(t,0))break;e>0?r--:r++}}}if(!CM(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function DM(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||wM(e[n],t[n])!==0)return!1;return!0}function OM({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!CM(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];Cj(t!=null,`No layout data found for index ${e}`);let n=100/i*t;r[e]=n}let a=0;for(let e=0;e<t.length;e++){let i=n[e];Cj(i!=null,`No layout data found for index ${e}`);let o=r[e];Cj(o!=null,`No layout data found for index ${e}`);let s=TM({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!CM(a,0))for(let e=0;e<t.length;e++){let n=r[e];Cj(n!=null,`No layout data found for index ${e}`);let i=n+a,o=TM({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,CM(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function kM({groupId:e,panelId:t}){let n=()=>{let t=iM();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=({nextSize:e,panels:n,prevLayout:r,derivedPanelConstraints:i})=>{let o=a(),s=n.findIndex(e=>e.id===t),c=s===0,l=s===n.length-1;if(l&&e<o&&(c||n.slice(0,s).every((e,t)=>{let n=i[t];return n?.collapsible&&CM(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:bj(100-e)}}return EM({delta:l?o-e:e-o,initialLayout:r,panelConstraints:i,pivotIndices:l?[s-1,s]:[s,s+1],prevLayout:r,trigger:`imperative-api`})},s=e=>{if(e===a())return;let{defaultLayoutDeferred:t,derivedPanelConstraints:r,group:i,groupSize:s,layout:c,separatorToPanels:l}=n(),u=OM({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});DM(c,u)||oM(i,{defaultLayoutDeferred:t,derivedPanelConstraints:r,groupSize:s,layout:u,separatorToPanels:l})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),o=a();e&&o!==t&&(n.expandToSize=o,s(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:o}=i(),c=a();if(e&&c===t){let e=o.expandToSize??n;e===0&&(e=1),s(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&CM(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=xj({group:t}),o=bj(yj({groupSize:a,panelElement:r,styleProp:e})/a*100);s(o)}}}function AM(e){e.defaultPrevented||xM(e,iM()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=kM({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function jM(e){let t=iM();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function MM({groupId:e}){let t=()=>{let t=iM();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=OM({layout:e,panelConstraints:r});return n?o:(DM(o,c)||oM(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function NM(e,t){let n=jM(e),r=rM(n.id,!0),i=n.separators.find(t=>t.element===e);Cj(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);Cj(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=MM({groupId:n.id}).getLayout(),c=OM({layout:EM({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});DM(s,c)||oM(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function PM(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=jM(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&NM(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&NM(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&NM(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&NM(t,-5);break;case`End`:e.preventDefault(),NM(t,100);break;case`Enter`:{e.preventDefault();let n=jM(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=rM(n.id,!0),o=n.separators.find(e=>e.element===t);Cj(o,`Matching separator not found`);let s=a.get(o);Cj(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(Cj(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];NM(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=jM(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);Cj(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),NM(t,-100)}}function FM(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=iM(),n=xM(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({focusVisible:!1,preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),zj({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}function IM({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=EM({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(DM(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?Hj:Uj;break;case`vertical`:s|=d<0?Wj:Gj}}else oM(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&Kj:c|=s&Kj,t.movementY===0?c|=o&qj:c|=s&qj,Rj(c),Qj(e)}function LM(e){let t=iM(),n=Ij();n.state===`active`&&IM({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}function RM(e){if(e.defaultPrevented)return;let t=Ij(),n=iM();switch(t.state){case`active`:if(e.buttons===0){zj({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{if(!n.has(e.group))return;let t=rM(e.group.id,!0);oM(e.group,t,{isUserInteraction:!0})});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.isConnected&&!t.hasPointerCapture?.(e.pointerId)&&t.setPointerCapture?.(e.pointerId)}IM({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=xM(e,n);r.length===0?t.state!==`inactive`&&zj({cursorFlags:0,state:`inactive`}):zj({cursorFlags:0,hitRegions:r,state:`hover`}),Qj(e.currentTarget);break}}}function zM(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Ij().state){case`hover`:zj({cursorFlags:0,state:`inactive`})}}function BM(e){e.defaultPrevented||e.pointerType===`mouse`&&e.button>0||sM(e.currentTarget)&&e.preventDefault()}function VM(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=bj(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=bj((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function HM(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=xj({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:bj(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function UM(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function WM(e,t){return e.length===t.length&&e.every((e,n)=>UM(e,t[n]))}function GM({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=bj(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=bj((r[e]??0)/a*l);else{let e=bj(l/c.length);for(let t of c)u[t]=e}return u}function KM(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var qM=new Map;function JM(e){let t=!0;Cj(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=xj({group:e});if(t===0)return;let n=rM(e.id);if(!n)return;let r=Sj(e),i=n.defaultLayoutDeferred?VM(r):n.layout,a=OM({layout:GM({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&DM(n.layout,a)&&WM(n.derivedPanelConstraints,r)&&n.groupSize===t)continue;oM(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else HM(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{Cj(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=xj({group:e}),s=Sj(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(KM(e.panels,l)||(l=void 0));let u=OM({layout:e.mutableState.layouts[c]??l??VM(s),panelConstraints:s}),d=e.element.ownerDocument;qM.set(d,(qM.get(d)??0)+1);let f=new Map;return Mj(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),oM(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{Cj(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,PM)}),qM.get(d)===1&&(d.addEventListener(`contextmenu`,cM,!0),d.addEventListener(`dblclick`,AM,!0),d.addEventListener(`pointerdown`,FM,!0),d.addEventListener(`pointerleave`,LM),d.addEventListener(`pointermove`,RM),d.addEventListener(`pointerout`,zM),d.addEventListener(`pointerup`,BM,!0)),function(){t=!1,qM.set(d,Math.max(0,(qM.get(d)??0)-1)),tM(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,PM)}),qM.get(d)||(d.removeEventListener(`contextmenu`,cM,!0),d.removeEventListener(`dblclick`,AM,!0),d.removeEventListener(`pointerdown`,FM,!0),d.removeEventListener(`pointerleave`,LM),d.removeEventListener(`pointermove`,RM),d.removeEventListener(`pointerout`,zM),d.removeEventListener(`pointerup`,BM,!0)),a.disconnect()}}function YM(){let[e,t]=(0,G.useState)({});return[e,(0,G.useCallback)(()=>t({}),[])]}function XM(e){let t=(0,G.useId)();return`${e??t}`}var ZM=typeof window<`u`?G.useLayoutEffect:G.useEffect;function QM(e){let t=(0,G.useRef)(e);return ZM(()=>{t.current=e},[e]),(0,G.useCallback)((...e)=>t.current?.(...e),[t])}function $M(...e){return QM(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t}})})}function eN(e){let t=(0,G.useRef)({...e});return ZM(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var tN=(0,G.createContext)(null);function nN(e,t){let n=(0,G.useRef)({getLayout:()=>({}),setLayout:Bj});(0,G.useImperativeHandle)(t,()=>n.current,[]),ZM(()=>{Object.assign(n.current,MM({groupId:e}))})}function rN({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,G.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=QM(e=>{DM(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=QM((e,t)=>{DM(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e,{isUserInteraction:t}))}),_=XM(s),v=(0,G.useRef)(null),[y,b]=YM(),x=(0,G.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=$M(v,a);nN(_,o);let C=QM((e,t)=>{let r=Ij(),i=nM(e),a=rM(e);if(a){let e=!1;return r.state===`active`&&(e=r.hitRegions.some(e=>e.group===i)),{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),w=eN({defaultLayout:n,disableCursor:r}),T=(0,G.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=wj(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=wj(u,[...t.separators,e]),b(),()=>{t.separators=t.separators.filter(t=>t!==e),b()}},updatePanelProps:(e,{disabled:t})=>{let n=x.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=nM(_),i=rM(_);r&&i&&oM(r,{...i,derivedPanelConstraints:Sj(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=x.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[C,_,b,u,w]),E=(0,G.useRef)(null);return ZM(()=>{let e=v.current;if(e===null)return;let t=x.current,n;if(w.defaultLayout!==void 0&&Object.keys(w.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=w.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!i,element:e,id:_,mutableState:{defaultLayout:n,disableCursor:!!w.disableCursor,expandedPanelSizes:x.current.lastExpandedPanelSizes,layouts:x.current.layouts},orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};E.current=r;let a=JM(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=rM(r.id,!0);!o&&s.length>0&&(h(c),g(c,!1));let l=aM(_,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=CM(t.collapsedSize,i[t.panelId]),a=CM(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=Ij().state!==`active`;h(i),o&&g(i,e.isUserInteraction)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,G.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,K.jsx)(tN.Provider,{value:T,children:(0,K.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:S,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}rN.displayName=`Group`;function iN(){let e=(0,G.useContext)(tN);return Cj(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function aN(e,t){let{id:n}=iN(),r=(0,G.useRef)({collapse:Vj,expand:Vj,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Vj});(0,G.useImperativeHandle)(t,()=>r.current,[]),ZM(()=>{Object.assign(r.current,kM({groupId:n,panelId:e}))})}function oN({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:s=`preserve-relative-size`,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=XM(c),_=eN({disabled:a}),v=(0,G.useRef)(null),y=$M(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=iN(),T=d!==null,E=QM((e,t,n)=>{d?.(e,c,n)});ZM(()=>{let e=v.current;if(e!==null){let t={element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:T?E:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:l,minSize:u}};return C(t)}},[s,n,r,i,T,g,h,l,u,E,C,_]),(0,G.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),aN(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,G.useSyncExternalStore)(e=>aM(x,e),D,D),k;return k=O?JSON.parse(O):i===void 0?{flexGrow:1}:{flexGrow:void 0,flexShrink:void 0,flexBasis:i},(0,K.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...sN,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...k},children:(0,K.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}oN.displayName=`Panel`;var sN={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function cN({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=OM({layout:EM({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=OM({layout:EM({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function lN({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=XM(a),l=eN({disabled:n,disableDoubleClick:r}),[u,d]=(0,G.useState)({}),[f,p]=(0,G.useState)(`inactive`),[m,h]=(0,G.useState)(!1),g=(0,G.useRef)(null),_=$M(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=iN(),C=b===`horizontal`?`vertical`:`horizontal`;ZM(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=Lj(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=aM(y,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=n.findIndex(t=>t.panelId===e.id);d(cN({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[y,c,x,l]),(0,G.useEffect)(()=>{S(c,{disabled:n,disableDoubleClick:r})},[n,r,c,S]);let w;n&&!v&&(w=`not-allowed`);let T;if(n)T=`disabled`;else switch(f){case`active`:T=`active`;break;default:T=m?`focus`:f}return(0,K.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":C,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":T,"data-testid":c,id:c,onBlur:()=>h(!1),onFocus:()=>h(!0),ref:_,role:`separator`,style:{flexBasis:`auto`,cursor:w,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}lN.displayName=`Separator`;function uN({className:e,...t}){return(0,K.jsx)(rN,{"data-slot":`resizable-panel-group`,className:H(`flex h-full w-full aria-[orientation=vertical]:flex-col`,e),...t})}function dN({...e}){return(0,K.jsx)(oN,{"data-slot":`resizable-panel`,...e})}function fN({withHandle:e,className:t,...n}){return(0,K.jsx)(lN,{"data-slot":`resizable-handle`,className:H(`relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,t),...n,children:e&&(0,K.jsx)(`div`,{className:`z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border`})})}function pN(e){let t=(0,q.c)(4),{open:n,onOpenChange:r,children:i}=e,a;return t[0]!==i||t[1]!==r||t[2]!==n?(a=(0,K.jsx)(Fn,{open:n,onOpenChange:r,children:i}),t[0]=i,t[1]=r,t[2]=n,t[3]=a):a=t[3],a}function mN(e){let t=(0,q.c)(17),{navigator:n,isMobile:r,open:i,children:a}=e,o=(r||!i)&&`desktop-workspace-without-navigator`,s;t[0]===o?s=t[1]:(s=H(`h-svh min-w-0 flex-1 bg-frame p-2 text-ui text-foreground`,o),t[0]=o,t[1]=s);let c;t[2]!==r||t[3]!==n||t[4]!==i?(c=!r&&i&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(dN,{id:`navigator`,defaultSize:248,minSize:220,maxSize:420,children:(0,K.jsx)(WA,{...n})}),(0,K.jsx)(fN,{"aria-label":`Worktree navigator and document panes`,className:`w-2 bg-transparent after:w-2`})]}),t[2]=r,t[3]=n,t[4]=i,t[5]=c):c=t[5];let l=r?0:420,u;t[6]===a?u=t[7]:(u=(0,K.jsx)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:a}),t[6]=a,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,K.jsx)(dN,{id:`document`,minSize:l,children:u}),t[8]=l,t[9]=u,t[10]=d):d=t[10];let f;t[11]!==c||t[12]!==d?(f=(0,K.jsxs)(uN,{orientation:`horizontal`,children:[c,d]}),t[11]=c,t[12]=d,t[13]=f):f=t[13];let p;return t[14]!==s||t[15]!==f?(p=(0,K.jsx)(`div`,{className:s,children:f}),t[14]=s,t[15]=f,t[16]=p):p=t[16],p}function hN(e,t,n,r,i){let a=(0,q.c)(17),o;a[0]!==e||a[1]!==n||a[2]!==t?(o=R({connection:e,projectId:t,number:n}),a[0]=e,a[1]=n,a[2]=t,a[3]=o):o=a[3];let s;a[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={mode:`promise`},a[4]=s):s=a[4];let[c,l]=se(o,s),u;a[5]===e?u=a[6]:(u=w(e),a[5]=e,a[6]=u);let d;a[7]===Symbol.for(`react.memo_cache_sentinel`)?(d={mode:`promise`},a[7]=d):d=a[7];let[,f]=se(u,d),p=mt(),m;a[8]!==i||a[9]!==p||a[10]!==r||a[11]!==f||a[12]!==l?(m=async e=>{e.confirmation&&i&&i();let t;try{t=await l(e),t.archived&&(await f(),await p({to:`/`,replace:!0}))}catch{return}return t.archived&&r&&r(),t},a[8]=i,a[9]=p,a[10]=r,a[11]=f,a[12]=l,a[13]=m):m=a[13];let h;return a[14]!==c||a[15]!==m?(h={result:c,submit:m},a[14]=c,a[15]=m,a[16]=h):h=a[16],h}function gN(e){let t=(0,q.c)(30),{connection:n,projectId:r,number:i,beforeLeave:a,menuItem:o}=e,s=a===void 0?_N:a,c=o!==void 0&&o,l=$r(n),u;t[0]===l?u=t[1]:(u=Ri(l),t[0]=l,t[1]=u);let d=u,f;t[2]===l?f=t[3]:(f=Ci(l),t[2]=l,t[3]=f);let p=f,{submit:m}=hN(n,r,i),h;t[4]!==s||t[5]!==n||t[6]!==i||t[7]!==r||t[8]!==d||t[9]!==m?(h=()=>{if(!d)return;let e=pi(d);RC.openWithPayload({connection:n,projectId:r,number:i,options:e,requestId:crypto.randomUUID(),beforeLeave:s}),m({options:e})},t[4]=s,t[5]=n,t[6]=i,t[7]=r,t[8]=d,t[9]=m,t[10]=h):h=t[10];let g=h;if(c){let e=!d,n;t[11]!==p||t[12]!==d?(n=!d&&p&&(0,K.jsx)(`span`,{className:`text-xs whitespace-normal text-muted-foreground`,children:p}),t[11]=p,t[12]=d,t[13]=n):n=t[13];let r;t[14]===n?r=t[15]:(r=(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[`Archive`,n]}),t[14]=n,t[15]=r);let i;return t[16]!==g||t[17]!==e||t[18]!==r?(i=(0,K.jsx)(hT,{disabled:e,onClick:g,children:r}),t[16]=g,t[17]=e,t[18]=r,t[19]=i):i=t[19],i}let _=!d,v;t[20]!==g||t[21]!==_?(v=(0,K.jsx)(wn,{variant:`outline`,size:`sm`,disabled:_,focusableWhenDisabled:!0,onClick:g,children:`Archive`}),t[20]=g,t[21]=_,t[22]=v):v=t[22];let y=v;if(d||!p)return y;let b;t[23]===y?b=t[24]:(b=(0,K.jsx)(Xn,{render:y}),t[23]=y,t[24]=b);let x;t[25]===p?x=t[26]:(x=(0,K.jsx)(Vt,{children:p}),t[25]=p,t[26]=x);let S;return t[27]!==b||t[28]!==x?(S=(0,K.jsxs)(yr,{children:[b,x]}),t[27]=b,t[28]=x,t[29]=S):S=t[29],S}function _N(){}function vN(){let e=(0,q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(bS,{handle:RC,children:yN}),e[0]=t):t=e[0],t}function yN(e){let{payload:t}=e;return t&&(0,K.jsx)(bN,{...t},t.requestId)}function bN(e){let t=(0,q.c)(31),{connection:n,projectId:r,number:i,options:a,beforeLeave:o}=e,{result:s,submit:c}=hN(n,r,i,xN,o),[l,u]=(0,G.useState)(!1),d;t[0]===s?d=t[1]:(d=It(s)?s.value:void 0,t[0]=s,t[1]=d);let f=d?.plan,p=`Checking the worktree and branches…`;if(Wn(s)&&(p=`Archiving could not be completed.`),f){let e;t[2]===f?e=t[3]:(e=ai(f),t[2]=f,t[3]=e),p=e}let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,K.jsx)(kS,{children:`Archive pull request?`}),t[4]=m):m=t[4];let h;t[5]===p?h=t[6]:(h=(0,K.jsxs)(DS,{children:[m,(0,K.jsx)(AS,{className:`whitespace-pre-wrap [overflow-wrap:anywhere]`,children:p})]}),t[5]=p,t[6]=h);let g;t[7]===s?g=t[8]:(g=Wn(s)?(0,K.jsx)(`p`,{role:`alert`,children:li(xr(s.cause))}):null,t[7]=s,t[8]=g);let _;t[9]!==l||t[10]!==f?(_=f&&(f.dirty||f.unpushed)?(0,K.jsxs)(Mn,{orientation:`horizontal`,children:[(0,K.jsx)(_r,{checked:l,onCheckedChange:u,id:`archive-discard-changes`}),(0,K.jsx)(en,{htmlFor:`archive-discard-changes`,children:`I understand the risk of losing changes and commits`})]}):null,t[9]=l,t[10]=f,t[11]=_):_=t[11];let v;t[12]===s.waiting?v=t[13]:(v=(0,K.jsx)(MS,{disabled:s.waiting,children:`Cancel`}),t[12]=s.waiting,t[13]=v);let y=s.waiting||!f||(f.dirty||f.unpushed)&&!l,b;t[14]!==l||t[15]!==a||t[16]!==f||t[17]!==c?(b=()=>{f&&c({options:a,confirmation:{plan:f,discardChanges:l}})},t[14]=l,t[15]=a,t[16]=f,t[17]=c,t[18]=b):b=t[18];let x=s.waiting?`Checking…`:`Archive pull request`,S;t[19]!==y||t[20]!==b||t[21]!==x?(S=(0,K.jsx)(wn,{variant:`destructive`,disabled:y,onClick:b,children:x}),t[19]=y,t[20]=b,t[21]=x,t[22]=S):S=t[22];let C;t[23]!==S||t[24]!==v?(C=(0,K.jsxs)(OS,{children:[v,S]}),t[23]=S,t[24]=v,t[25]=C):C=t[25];let w;return t[26]!==C||t[27]!==h||t[28]!==g||t[29]!==_?(w=(0,K.jsxs)(ES,{children:[h,g,_,C]}),t[26]=C,t[27]=h,t[28]=g,t[29]=_,t[30]=w):w=t[30],w}function xN(){return RC.close()}function SN(e){let t=(0,q.c)(2),{connection:n}=e,r;return t[0]===n?r=t[1]:(r=(0,K.jsx)(g,{handle:FC,children:e=>{let{payload:t}=e;return t&&(0,K.jsx)(tj,{remote:t.remote,connection:n,children:e=>(0,K.jsxs)(ew,{children:[(0,K.jsxs)(tw,{children:[(0,K.jsxs)(rw,{children:[`Walkthroughs for `,t.project.name]}),(0,K.jsx)(iw,{children:`Use the default writer or override it for this project. This choice applies to manual and automatic walkthroughs and their answers.`})]}),(0,K.jsx)(ra,{project:t.project,...e,onSaved:CN},t.project.id)]})})}}),t[0]=n,t[1]=r),r}function CN(){return FC.close()}function wN(e,t){return cn(t).filter(t=>{let n=e.getItem(t);return n!==null&&`isExpanded`in n&&n.isExpanded()})}function TN(e){let t=(0,q.c)(30),n=(0,G.useId)(),r;t[0]===n?r=t[1]:(r=Xi(n),t[0]=n,t[1]=r);let i=r,a=B(Ce),[o,s]=(0,G.useState)(!1),[c,l]=(0,G.useState)(null),u;t[2]!==c||t[3]!==e.filter||t[4]!==e.paths?(u=c?.pathsKey===e.paths.join(`\0`)&&c.filter===e.filter,t[2]=c,t[3]=e.filter,t[4]=e.paths,t[5]=u):u=t[5];let d=u;o&&!d&&s(!1);let f;t[6]!==i||t[7]!==a?(f=()=>e=>{if(e)return DN(e,a,i,l,s)},t[6]=i,t[7]=a,t[8]=f):f=t[8];let[p]=(0,G.useState)(f),m=o&&d,h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`}),t[9]=h):h=t[9];let g;t[10]!==i||t[11]!==e||t[12]!==a?(g=(0,K.jsx)(`span`,{hidden:!0,ref:t=>{t&&a.set(i,kt(e))}}),t[10]=i,t[11]=e,t[12]=a,t[13]=g):g=t[13];let _;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,K.jsx)(`div`,{ref:p,className:`flex min-h-0 flex-1 flex-col`}),t[14]=_):_=t[14];let v;t[15]===g?v=t[16]:(v=(0,K.jsxs)(fT,{render:h,children:[g,_]}),t[15]=g,t[16]=v);let y;t[17]!==d||t[18]!==o||t[19]!==c?(y=o&&d&&c&&(0,K.jsx)(`span`,{hidden:!0,ref:()=>{let{row:e}=c;return e.setAttribute(`aria-haspopup`,`menu`),e.setAttribute(`data-context-menu-open`,``),()=>{e.removeAttribute(`aria-haspopup`),e.removeAttribute(`data-context-menu-open`)}}}),t[17]=d,t[18]=o,t[19]=c,t[20]=y):y=t[20];let b;t[21]!==d||t[22]!==c||t[23]!==e.renderMenu?(b=c&&e.renderMenu(c.item,{finalFocus:d?c.finalFocus:EN,close:c.close},c.rename),t[21]=d,t[22]=c,t[23]=e.renderMenu,t[24]=b):b=t[24];let x;return t[25]!==b||t[26]!==m||t[27]!==v||t[28]!==y?(x=(0,K.jsxs)(dT,{open:m,onOpenChange:s,children:[v,y,b]}),t[25]=b,t[26]=m,t[27]=v,t[28]=y,t[29]=x):x=t[29],x}function EN(){return!1}function DN(e,t,r,i,a){let o=()=>zn(t.get(r)),s=fa(o().owner),c=t.get(s),l=new Set(c.expanded),u=!o().filter&&c.document===o().selected&&!(document.activeElement instanceof HTMLInputElement),d=!0,f=!1,p=!1,m={selected:c.document,complete:c.document===o().selected},h=null,g,_,v=new Set;function y(e){let t=requestAnimationFrame(()=>{v.delete(t),d&&e()});v.add(t)}let b=new h_({paths:o().paths,density:`default`,flattenEmptyDirectories:!0,initialExpansion:o().filter?`open`:`closed`,icons:b_(o().links),unsafeCSS:`[data-icon-name="file-tree-icon-chevron"] { color: var(--trees-fg-muted); } [data-item-git-status]:not([data-item-git-status="ignored"]) > [data-item-section="content"] { color: inherit; } [data-context-menu-open] { outline: 1px solid var(--trees-fg-muted); outline-offset: -1px; border-radius: 4px; }`,gitStatus:o().gitStatus,search:!1,renaming:{onError:e=>{h=null,o().onInvalidName(e),queueMicrotask(()=>{d&&b.resetPaths(o().paths)})},onRename:e=>{p=!0;let t=h;h=null,(t?.path.replace(/\/$/,``)===e.sourcePath.replace(/\/$/,``)?o().onCreate(e.destinationPath,t.kind):o().onMove(e.sourcePath,e.destinationPath)).catch(()=>{d&&b.resetPaths(o().paths)})}},dragAndDrop:{canDrag:()=>(f=!0,queueMicrotask(()=>{f=!1}),!0),canDrop:({draggedPaths:e,target:t})=>mn(e,t.directoryPath??``),onDropComplete:e=>{let t=o().onMove;de($n(e.draggedPaths,e.target.directoryPath??``,(e,r)=>n({try:()=>t(e,r),catch:e=>new jn(e)}))).catch(()=>{d&&b.resetPaths(o().paths)})}},renderRowDecoration:({item:e})=>{let t=o().links.find(t=>t.path===e.path);return t?{text:t.kind===`symlink`?`→ ${t.target??`?`}`:`submodule`,title:`Not followed`}:null},onSelectionChange:([e])=>{!f&&!p&&e&&h?.path.replace(/\/$/,``)!==e.replace(/\/$/,``)&&e!==o().selected&&o().onSelect(e)}});function x(){o().bindCollapseAll(()=>{f=!0,l.clear(),u=!1,m={selected:o().selected,complete:!0};let e=fa(o().owner.replace(/:search$/,``));t.set(e,{...t.get(e),expanded:[],document:o().selected,focused:null,anchor:null}),o().onFilterChange(``),b.resetPaths(o().paths,{initialExpandedPaths:[]}),f=!1}),o().bindRename(e=>o().onRequestRename(e))}function S(){let e=o().renameRequest;e&&!o().filter&&_!==e.nonce&&b.getItem(e.path)!==null&&(_=e.nonce,y(()=>{f=!0,b.startRenaming(e.path)&&e.onStart(),f=!1}))}function C(){let{creating:t}=o();if(!t||g===t.nonce)return;g=t.nonce;let n=Mt(t.kind,t.folder,e=>b.getItem(e)!==null);h={path:n,kind:t.kind},b.add(n),b.startRenaming(n,{removeIfCanceled:!0}),y(()=>{let t=e.querySelector(`[data-slot="file-tree"]`)?.shadowRoot?.querySelector(`[data-item-rename-input]`);t instanceof HTMLInputElement&&t.focus()})}function w(){let e=wN(b,o().paths).map(e=>e.replace(/\/$/,``));e.length&&!o().filter&&o().onExpand(e)}function T(){o().onContentHeight?.(b.getVisibleCount()*b.getItemHeight())}function E(){if(h)return;let{selected:e}=o(),t=o().paths;m.selected!==e&&(m={selected:e,complete:!1});let n=da(t.flatMap(e=>{let t=o().kinds.get(e);return t===void 0?[]:[{path:e,kind:t}]}),new Set([...wN(b,t),...l]),new Set(cn(t).filter(e=>b.getItem(e)!==null))).map(e=>`${e}/`);f=!0;{let r=m.complete?[]:Ir(e);b.resetPaths(t,{initialExpandedPaths:o().filter?cn(t):[...new Set([...n,...r])]});for(let e of l)b.getItem(e)!==null&&l.delete(e);let i=b.getItem(e);!m.complete&&i&&!i.isDirectory()&&(i.select(),m.complete=!0)}if(f=!1,u){f=!0;for(let e of c.selected)b.getItem(e)?.select();c.focused&&b.getItem(c.focused)&&b.focusPath(c.focused),c.anchor&&b.getItem(c.anchor)&&(b.scrollToPath(c.anchor,{focus:!1,offset:`top`}),u=!1),f=!1}w()}let D;function O(){let e=o();x(),D&&D.paths.join(`\0`)===e.paths.join(`\0`)&&D.selected===e.selected||E(),D?.gitStatus!==e.gitStatus&&b.setGitStatus(e.gitStatus),D?.links!==e.links&&b.setIcons(b_(e.links)),D=e,C(),S(),T()}let k=b.onMutation(`move`,()=>{p=!1}),A=t.subscribe(r,O),j=b.subscribe(()=>{T(),f||w()});function M(e){let t=h;if(!t)return;let n=e.composedPath().find(e=>e instanceof HTMLInputElement&&e.hasAttribute(`data-item-rename-input`));n?.value.trim()===``?(h=null,y(E)):n?.value===Dr(t.path)&&(h=null,o().onCreate(t.path,t.kind).catch(()=>{d&&b.resetPaths(o().paths)}))}function N(e){let t=e.composedPath().find(e=>e instanceof HTMLElement&&e.hasAttribute(`data-item-path`)),n=t?.dataset.itemPath,r=n===void 0?null:b.getItem(n);if(!t||!n||!r||t.querySelector(`[data-item-rename-input]`))return!1;let s={restore:!0},{paths:c,filter:l}=o();return i({row:t,pathsKey:c.join(`\0`),filter:l,finalFocus:()=>s.restore&&t.isConnected&&t.dataset.itemPath===n?t:!1,close:e=>{s.restore=e,a(!1)},rename:()=>o().onRequestRename(n),item:{path:n,name:Dr(n),kind:r.isDirectory()?`directory`:`file`}}),!0}function P(e){if(e.key===`F2`&&!h){let t=b.getFocusedPath();t&&(e.preventDefault(),e.stopPropagation(),o().onRequestRename(t))}e.key===`Enter`&&M(e),e.key===`Escape`&&h&&(h=null,y(E))}function F(e){if(e.button!==0||!e.altKey&&(e.ctrlKey||e.metaKey||e.shiftKey))return;let t=e.composedPath();if(t.some(e=>e instanceof HTMLInputElement))return;let n=t.find(e=>e instanceof HTMLElement&&e.hasAttribute(`data-item-path`))?.dataset.itemPath;if(!n||o().kinds.get(n)!==`file`)return;let r=b.getItem(n);if(r&&h?.path!==n){e.preventDefault(),e.stopPropagation(),f=!0;for(let e of b.getSelectedPaths())e!==n&&b.getItem(e)?.deselect();r.select(),f=!1,o().onSelect(n,e.altKey)}}function I(e){N(e)||e.stopPropagation()}return e.addEventListener(`keydown`,P,!0),e.addEventListener(`click`,F,!0),e.addEventListener(`blur`,M,!0),e.addEventListener(`contextmenu`,I,!0),e.addEventListener(`touchstart`,I,!0),b.render({containerWrapper:e}),b.getFileTreeContainer()?.setAttribute(`class`,`min-h-0 flex-1`),b.getFileTreeContainer()?.setAttribute(`data-slot`,`file-tree`),b.getFileTreeContainer()?.setAttribute(`aria-label`,`Worktree files`),O(),()=>{let n=b.getFileTreeContainer(),r=n?.getBoundingClientRect().top??0,i=[...n?.shadowRoot?.querySelectorAll(`[data-item-path]`)??[]].find(e=>e.getBoundingClientRect().bottom>r)?.dataset.itemPath??null;t.set(s,{expanded:[...new Set([...wN(b,o().paths),...l])],selected:b.getSelectedPaths(),focused:b.getFocusedPath(),anchor:i,document:o().selected}),d=!1;for(let e of v)cancelAnimationFrame(e);A(),j(),k(),o().bindRename(()=>void 0),o().bindCollapseAll(()=>void 0),e.removeEventListener(`keydown`,P,!0),e.removeEventListener(`click`,F,!0),e.removeEventListener(`blur`,M,!0),e.removeEventListener(`contextmenu`,I,!0),e.removeEventListener(`touchstart`,I,!0),b.cleanUp(),e.replaceChildren()}}function ON(e,t){t.close(e!==`rename`&&e!==`new-file`&&e!==`new-folder`&&e!==`open-to-side`),e===`rename`?queueMicrotask(t.rename):e===`new-file`?t.onStartCreate(`file`,t.path):e===`new-folder`?t.onStartCreate(`directory`,t.path):e===`open`||e===`open-file`?t.onOpenFile(t.path):e===`open-to-side`?t.onOpenToSide(t.path):e===`open-diff`?t.onOpenDiff(t.path):e===`timeline`?t.onOpenTimeline(t.path):e===`duplicate`?t.onDuplicate(t.path):e===`pin`?t.onTogglePinned(t.path):e===`hide`?t.onSetHidden(t.hiddenEntry??t.path,t.hiddenEntry===null):e===`copy-relative`?Ft(t.path,`relative path`):e===`copy-full`?Ft(`${t.worktreePath.replace(/\/$/,``)}/${t.path}`,`full path`):t.onTrash(t.path)}var kN=m(Tt());function AN(e,t,n){let r=(0,q.c)(7),i=n===void 0||n,a;r[0]!==e||r[1]!==i||r[2]!==t?(a=i?x({connection:e,scope:t}):kN,r[0]=e,r[1]=i,r[2]=t,r[3]=a):a=r[3];let o=a,s=B(o),c=Kr(o),l;return r[4]!==s||r[5]!==c?(l={result:s,refresh:c},r[4]=s,r[5]=c,r[6]=l):l=r[6],l}var jN={"new-file":mo,"new-folder":bo,rename:bt,duplicate:to,open:lo,"open-file":lo,"open-to-side":$a,"open-diff":fo,timeline:Ho,pin:Po,hide:ao,"copy-relative":Ke,"copy-full":Ke,trash:Xo};function MN(e){let t=(0,q.c)(14),{path:n,finalFocus:r,actions:i,hidden:a,onAction:o}=e,s=xT(),c;t[0]===s?c=t[1]:(c=e=>s.attach(e),t[0]=s,t[1]=c);let l=`${n} actions`,u;t[2]!==r||t[3]!==s.element?(u=()=>{let e=document.activeElement;return e===document.body||s.element?.contains(e)?r():!1},t[2]=r,t[3]=s.element,t[4]=u):u=t[4];let d;t[5]!==i||t[6]!==a||t[7]!==o?(d=(0,K.jsx)(PN,{actions:i,hidden:a,onAction:o}),t[5]=i,t[6]=a,t[7]=o,t[8]=d):d=t[8];let f;return t[9]!==c||t[10]!==l||t[11]!==u||t[12]!==d?(f=(0,K.jsx)(pT,{ref:c,"aria-label":l,className:`w-max max-w-[calc(100vw-2rem)] whitespace-nowrap`,onKeyDownCapture:NN,finalFocus:u,children:d}),t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function NN(e){if(e.key!==`ArrowDown`||e.target!==e.currentTarget)return;let t=e.currentTarget.querySelector(`[role="menuitem"]`);t instanceof HTMLElement&&(e.preventDefault(),e.stopPropagation(),t.focus())}function PN({actions:e,hidden:t,onAction:n}){return e.map(e=>(0,K.jsx)(FN,{action:e,onAction:n,hidden:t},e.id))}function FN(e){let t=(0,q.c)(15),{action:n,onAction:r,hidden:i}=e,a=n.id===`hide`&&i?so:jN[n.id],o;t[0]===n.id?o=t[1]:(o=(n.id===`hide`||n.id===`copy-relative`||n.id===`trash`)&&(0,K.jsx)(gT,{}),t[0]=n.id,t[1]=o);let s=n.id===`trash`?`destructive`:`default`,c;t[2]!==n.id||t[3]!==r?(c=()=>r(n.id),t[2]=n.id,t[3]=r,t[4]=c):c=t[4];let l;t[5]===a?l=t[6]:(l=(0,K.jsx)(a,{}),t[5]=a,t[6]=l);let u;t[7]!==n.label||t[8]!==s||t[9]!==c||t[10]!==l?(u=(0,K.jsxs)(hT,{variant:s,onClick:c,children:[l,n.label]}),t[7]=n.label,t[8]=s,t[9]=c,t[10]=l,t[11]=u):u=t[11];let d;return t[12]!==o||t[13]!==u?(d=(0,K.jsxs)(K.Fragment,{children:[o,u]}),t[12]=o,t[13]=u,t[14]=d):d=t[14],d}function IN(e){let t=(0,q.c)(7),{label:n,count:r}=e,i;t[0]===n?i=t[1]:(i=(0,K.jsx)(`span`,{className:`flex-1`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r===void 0?null:(0,K.jsx)(`span`,{className:`tabular-nums`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,K.jsxs)(`h3`,{className:`flex h-7 shrink-0 items-center gap-1 px-6 text-2xs font-medium text-muted-foreground`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}var LN={added:`A`,deleted:`D`,modified:`M`,renamed:`R`,untracked:`U`},RN={resolved:`Not followed`,loading:`Loading…`,missing:`Missing`,unavailable:`Listing unavailable · Open as file`};function zN(e){let t=(0,q.c)(32),{entries:n,expanded:r,onExpand:i,onRetry:a,renderDirectory:o,statuses:s,selected:c,onOpen:l,onUnpin:u,menuFor:d}=e,[f,p]=(0,G.useState)(!1);if(n.length===0)return null;let m;t[0]===s?m=t[1]:(m=new Map(s.flatMap(BN)),t[0]=s,t[1]=m);let h=m,g;t[2]===n.length?g=t[3]:(g=(0,K.jsx)(IN,{label:`Pinned`,count:n.length}),t[2]=n.length,t[3]=g);let _;if(t[4]!==n||t[5]!==r||t[6]!==h||t[7]!==d||t[8]!==i||t[9]!==l||t[10]!==a||t[11]!==u||t[12]!==f||t[13]!==o||t[14]!==c){let e;t[16]!==r||t[17]!==h||t[18]!==d||t[19]!==i||t[20]!==l||t[21]!==a||t[22]!==u||t[23]!==f||t[24]!==o||t[25]!==c?(e=e=>{let{path:t}=e,n=e.state===`resolved`&&e.entry.kind===`directory`,s=r.includes(t),m=e.state===`unavailable`||e.state===`resolved`&&(e.entry.kind===`file`||n),g=t.lastIndexOf(`/`)+1,_=d(n?`${t}/`:t);return(0,K.jsxs)(dT,{onOpenChange:e=>{e&&p(!1)},children:[(0,K.jsxs)(fT,{render:(0,K.jsx)(`li`,{className:`flex flex-wrap items-center gap-0.5`}),children:[(0,K.jsx)(Fr,{text:t,className:`min-w-0`,renderTrigger:(r,a)=>(0,K.jsxs)(`button`,{type:`button`,"data-file-tree-row":``,"aria-label":e.state===`unavailable`?`Open ${t} as file`:t,"aria-current":t===c?`page`:void 0,"aria-expanded":n?s:void 0,disabled:!m,className:H(`flex h-7.5 min-w-0 flex-1 items-center gap-1.5 rounded-md px-2 text-left hover:bg-accent`,t===c&&`bg-accent`),onClick:e=>n?i(t,!s):l(t,e.altKey),children:[n?(0,K.jsx)(w_,{expanded:s,className:`size-4 shrink-0`}):(0,K.jsx)(w_,{path:t,className:`size-4 shrink-0`}),r,g>0&&a(t.slice(0,g-1),`shrink-[100] text-muted-foreground`),h.has(t)&&(0,K.jsx)(`span`,{"aria-hidden":`true`,className:H(`ml-auto shrink-0 pl-1 font-mono text-2xs text-muted-foreground`,h.get(t)===LN.modified&&`text-brand`),children:h.get(t)})]}),children:t.slice(g)}),(!m||e.state===`unavailable`)&&(0,K.jsx)(`span`,{className:`text-2xs text-muted-foreground`,children:RN[e.state]}),e.state===`unavailable`&&(0,K.jsx)(wn,{variant:`outline`,size:`xs`,onClick:a,children:`Try again`}),(0,K.jsxs)(yr,{children:[(0,K.jsx)(Xn,{render:(0,K.jsx)(wn,{size:`icon-xs`,variant:`ghost`,"aria-label":`Unpin ${t}`,onClick:()=>u(t)}),children:(0,K.jsx)(Io,{})}),(0,K.jsx)(Vt,{role:`tooltip`,className:`break-all`,children:`Unpin ${t}`})]}),n&&s&&(0,K.jsx)(`div`,{className:`w-full`,children:o(t)})]}),(0,K.jsx)(pT,{finalFocus:!f,children:(0,K.jsx)(PN,{actions:_.actions,hidden:_.hidden,onAction:e=>{e===`open-to-side`&&(0,is.flushSync)(()=>p(!0)),_.onAction(e)}})})]},t)},t[16]=r,t[17]=h,t[18]=d,t[19]=i,t[20]=l,t[21]=a,t[22]=u,t[23]=f,t[24]=o,t[25]=c,t[26]=e):e=t[26],_=n.map(e),t[4]=n,t[5]=r,t[6]=h,t[7]=d,t[8]=i,t[9]=l,t[10]=a,t[11]=u,t[12]=f,t[13]=o,t[14]=c,t[15]=_}else _=t[15];let v;t[27]===_?v=t[28]:(v=(0,K.jsx)(`ul`,{className:`px-4`,children:_}),t[27]=_,t[28]=v);let y;return t[29]!==g||t[30]!==v?(y=(0,K.jsxs)(`section`,{"aria-label":`Pinned files`,className:`shrink-0 pt-1.5 pb-1`,children:[g,v]}),t[29]=g,t[30]=v,t[31]=y):y=t[31],y}function BN(e){let t=LN[e.status];return t===void 0?[]:[[e.path,t]]}function VN(e){let t=(0,q.c)(9),{scope:n,connection:r,worktreePath:i,selected:a,onOpen:o,sideLabel:s,actionsTarget:c}=e,l=`${r.environmentId}:${n.projectId}:${n.worktreeId}`,u;return t[0]!==c||t[1]!==r||t[2]!==o||t[3]!==n||t[4]!==l||t[5]!==a||t[6]!==s||t[7]!==i?(u=(0,K.jsx)(HN,{scope:n,connection:r,worktreePath:i,selected:a,onOpen:o,sideLabel:s,actionsTarget:c},l),t[0]=c,t[1]=r,t[2]=o,t[3]=n,t[4]=l,t[5]=a,t[6]=s,t[7]=i,t[8]=u):u=t[8],u}function HN(e){let t=(0,q.c)(86),{scope:n,connection:r,worktreePath:i,selected:a,onOpen:o,sideLabel:s,actionsTarget:c}=e,l=vS(r,n,``),u=_a(r,n),d=Wn(u.result)?xr(u.result.cause):void 0,[f,p]=(0,G.useState)(),[m,g]=(0,G.useState)(),[_,v]=(0,G.useState)(null),y=pn(Ht(iC(n,r))),b=UC(r,n.projectId),x=TC(r,n.projectId),S=KC(r,n.projectId),C=EC(r,n.projectId),w=`${r.environmentId}:${n.projectId}:${n.worktreeId}`,T=Ta(w),{showHidden:E,query:D,requested:O,pinnedExpanded:k}=T.state,A;t[0]===D?A=t[1]:(A=D.trim(),t[0]=D,t[1]=A);let j=A!==``,M=AN(r,n,j),N;t[2]===T?N=t[3]:(N=e=>T.set(t=>({...t,showHidden:e})),t[2]=T,t[3]=N);let P=N,F;t[4]===T?F=t[5]:(F=e=>T.set(t=>({...t,query:e})),t[4]=T,t[5]=F);let I=F,L;t[6]===T?L=t[7]:(L=e=>T.set(t=>{let n=e(t.requested);return n===t.requested?t:{...t,requested:n}}),t[6]=T,t[7]=L);let R=L,ee=D===``?`Collapse all`:`Clear search and collapse all`,te;t[8]!==S||t[9]!==O||t[10]!==a?(te=oP(oP(oP(O,ja(S.map(aP))),[``]),bi(a)),t[8]=S,t[9]=O,t[10]=a,t[11]=te):te=t[11];let z=yS(r,n,te),ne=[l,...z.results.flatMap(iP)],B=Xr(ne),re=j?ji(Yi(pn(Ht(M.result))?.paths??[],b,E),D):[],ie=oP(re,re.flatMap(nP)),V=[...B,...ie.filter(e=>!B.some(t=>t.path===e)).map(tP)],ae=j?ie:V.map(eP),oe=Yi(ae,b,E),se=new Map(V.map($N)),ce;t[12]===z.results?ce=t[13]:(ce=z.results.filter(Wn),t[12]=z.results,t[13]=ce);let le=ce,ue=[{path:``,status:`loaded`,entries:l.entries},...z.states],de=ka(Yi(S,b,E),ue),fe=[...V.filter(QN).map(ZN),...(y?.changes??[]).flatMap(XN).map(YN)],pe=new Set((y?.changes??[]).map(JN)),me=new Set(V.filter(qN).map(KN)),he;t[14]===o?he=t[15]:(he=(e,t)=>o({kind:`file`,path:e},{toSide:t!==void 0&&t}),t[14]=o,t[15]=he);let ge=he,_e=e=>u.duplicate(e,Ct(e,e=>se.has(e)),ge),ve;t[16]!==_e||t[17]!==u.result.waiting||t[18]!==a?(ve=()=>{u.result.waiting||_e(a)},t[16]=_e,t[17]=u.result.waiting,t[18]=a,t[19]=ve):ve=t[19];let ye=me.has(a),be;t[20]===ye?be=t[21]:(be={enabled:ye,ignoreInputs:!0},t[20]=ye,t[21]=be),zi(Fi.duplicateFile,ve,be);let xe=(e,t)=>{let n=t!==void 0&&t,r=se.get(e);r===`symlink`||r===`submodule`?o({kind:`file`,path:e},{toSide:n}):r===`file`&&ge(e,n)},{collapseAll:Se,renameFile:Ce,bindCollapseAll:H,bindRename:we}=Qi(w),Te=e=>{let t=aa(e,b),n=V.find(t=>ca(t.path)===ca(e));return{hidden:t!==null,actions:Hr(n,{changed:pe.has(e),openToSideLabel:s,hiddenEntry:t,ownHidden:t===ca(e),hiddenName:t?.replace(/\/$/,``).split(`/`).at(-1)??``,pinned:n?.kind===`file`||n?.kind===`directory`?S.includes(ca(e)):void 0}),run:(n,r,a)=>ON(n,{path:e,hiddenEntry:t,worktreePath:i,close:r,rename:a,onStartCreate:(e,t)=>{u.result.waiting||p({kind:e,folder:t,nonce:Date.now()})},onOpenFile:e=>o({kind:`file`,path:e}),onOpenToSide:e=>ge(e,!0),onOpenDiff:e=>o({kind:`change`,path:e}),onOpenTimeline:e=>o({kind:`timeline`,path:e}),onSetHidden:(e,t)=>We(x.submit({path:e,hidden:t})),onTogglePinned:e=>We(C.submit({path:e,pinned:!S.includes(ca(e))})),onTrash:v,onDuplicate:e=>{u.result.waiting||_e(e)}})}},Ee;t[22]!==I||t[23]!==R?(Ee=e=>{R(t=>oP(t,bi(e))),I(``),g({path:e,nonce:Date.now()})},t[22]=I,t[23]=R,t[24]=Ee):Ee=t[24];let De;t[25]!==u||t[26]!==o?(De=(e,t)=>u.create(e,t,e=>o({kind:`file`,path:e})),t[25]=u,t[26]=o,t[27]=De):De=t[27];let Oe;t[28]===R?Oe=t[29]:(Oe=e=>R(t=>oP(t,e)),t[28]=R,t[29]=Oe);let ke={owner:j?`${w}:search`:w,filter:j?D:``,onFilterChange:I,paths:oe,kinds:se,links:V.filter(GN),creating:f,renameRequest:m?{...m,onStart:()=>g(void 0)}:void 0,onRequestRename:Ee,onCreate:De,onMove:u.move,gitStatus:fe,selected:a,bindRename:we,bindCollapseAll:H,onInvalidName:WN,renderMenu:(e,t,n)=>{let r=e.kind===`directory`&&!e.path.endsWith(`/`)?`${e.path}/`:e.path,i=Te(r);return(0,K.jsx)(MN,{path:r,finalFocus:t.finalFocus,actions:i.actions,hidden:i.hidden,onAction:e=>i.run(e,t.close,n)},r)},onExpand:Oe,onSelect:xe},U;t[30]===I?U=t[31]:(U=e=>I(e.target.value),t[30]=I,t[31]=U);let Ae;t[32]!==D||t[33]!==U?(Ae=(0,K.jsx)(`div`,{className:`flex shrink-0 items-center gap-1 px-2 pt-2`,children:(0,K.jsx)(h,{"aria-label":`Search files`,placeholder:`Search...`,value:D,onChange:U,className:`h-7 w-auto min-w-0 flex-1`})}),t[32]=D,t[33]=U,t[34]=Ae):Ae=t[34];let je;t[35]!==c||t[36]!==Se||t[37]!==ee||t[38]!==u.result.waiting?(je=c&&(0,is.createPortal)((0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(Jn,{children:[(0,K.jsxs)(yr,{children:[(0,K.jsx)(Xn,{render:(0,K.jsx)(er,{render:(0,K.jsx)(wn,{size:`icon-sm`,variant:`ghost`,"aria-label":`Create file or folder`,disabled:u.result.waiting}),children:(0,K.jsx)(Ro,{className:`text-muted-foreground`})})}),(0,K.jsx)(Vt,{role:`tooltip`,className:`break-all`,children:`Create file or folder`})]}),(0,K.jsxs)(zt,{align:`end`,children:[(0,K.jsxs)(Cr,{onClick:()=>p({kind:`file`,folder:``,nonce:Date.now()}),children:[(0,K.jsx)(mo,{}),`New file`]}),(0,K.jsxs)(Cr,{onClick:()=>p({kind:`directory`,folder:``,nonce:Date.now()}),children:[(0,K.jsx)(bo,{}),`New folder`]})]})]}),(0,K.jsxs)(yr,{children:[(0,K.jsx)(Xn,{render:(0,K.jsx)(wn,{size:`icon-sm`,variant:`ghost`,"aria-label":ee,onClick:()=>Se()}),children:(0,K.jsx)(Ao,{className:`text-muted-foreground`})}),(0,K.jsx)(Vt,{role:`tooltip`,className:`break-all`,children:ee})]})]}),c),t[35]=c,t[36]=Se,t[37]=ee,t[38]=u.result.waiting,t[39]=je):je=t[39];let Me;t[40]!==T||t[41]!==R?(Me=(e,t)=>{T.set(n=>({...n,pinnedExpanded:t?oP(n.pinnedExpanded,[e]):n.pinnedExpanded.filter(t=>t!==e)})),t&&R(t=>oP(t,[e]))},t[40]=T,t[41]=R,t[42]=Me):Me=t[42];let Ne;t[43]===z?Ne=t[44]:(Ne=()=>z.retry(),t[43]=z,t[44]=Ne);let Pe;t[45]===C?Pe=t[46]:(Pe=e=>We(C.submit({path:e,pinned:!1})),t[45]=C,t[46]=Pe);let Fe;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,K.jsx)(IN,{label:`All files`}),t[47]=Fe):Fe=t[47];let Ie;t[48]!==M||t[49]!==j?(Ie=j&&Wn(M.result)&&(0,K.jsxs)(`div`,{role:`alert`,className:`px-3 py-2 text-xs`,children:[`Could not search files.`,(0,K.jsx)(wn,{variant:`link`,size:`xs`,onClick:()=>M.refresh(),children:`Try again`})]}),t[48]=M,t[49]=j,t[50]=Ie):Ie=t[50];let Le=_!==null,Re;t[51]===u.result.waiting?Re=t[52]:(Re=e=>{!e&&!u.result.waiting&&v(null)},t[51]=u.result.waiting,t[52]=Re);let ze;t[53]===_?ze=t[54]:(ze=(0,K.jsxs)(kS,{children:[`Move `,_,` to the trash?`]}),t[53]=_,t[54]=ze);let Be=_!=null&&pe.has(_)?`This is part of the agent’s changes. Deleting it changes what you are reviewing, and the agent may write it again. You can restore it from the system trash.`:`You can restore it from the system trash. This changes the files in your worktree.`,Ve;t[55]===Be?Ve=t[56]:(Ve=(0,K.jsx)(AS,{children:Be}),t[55]=Be,t[56]=Ve);let He;t[57]!==ze||t[58]!==Ve?(He=(0,K.jsxs)(DS,{children:[ze,Ve]}),t[57]=ze,t[58]=Ve,t[59]=He):He=t[59];let Ue;t[60]===u.result.waiting?Ue=t[61]:(Ue=(0,K.jsx)(MS,{disabled:u.result.waiting,children:`Cancel`}),t[60]=u.result.waiting,t[61]=Ue);let Ge;t[62]!==_||t[63]!==u?(Ge=()=>{_&&u.trash(_,()=>v(null))},t[62]=_,t[63]=u,t[64]=Ge):Ge=t[64];let Ke;t[65]!==u.result.waiting||t[66]!==Ge?(Ke=(0,K.jsx)(wn,{variant:`destructive`,disabled:u.result.waiting,onClick:Ge,children:`Move to trash`}),t[65]=u.result.waiting,t[66]=Ge,t[67]=Ke):Ke=t[67];let qe;t[68]!==Ue||t[69]!==Ke?(qe=(0,K.jsxs)(OS,{children:[Ue,Ke]}),t[68]=Ue,t[69]=Ke,t[70]=qe):qe=t[70];let Je=d!==void 0&&(0,K.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:la(d)}),Ye;t[71]!==He||t[72]!==qe||t[73]!==Je?(Ye=(0,K.jsxs)(ES,{children:[He,qe,Je]}),t[71]=He,t[72]=qe,t[73]=Je,t[74]=Ye):Ye=t[74];let Xe;t[75]!==Le||t[76]!==Re||t[77]!==Ye?(Xe=(0,K.jsx)(CS,{open:Le,onOpenChange:Re,children:Ye}),t[75]=Le,t[76]=Re,t[77]=Ye,t[78]=Xe):Xe=t[78];let Ze;t[79]===C.result?Ze=t[80]:(Ze=Wn(C.result)&&(0,K.jsx)(`p`,{role:`alert`,className:`border-t px-3 py-2 text-xs text-destructive`,children:gi(xr(C.result.cause))}),t[79]=C.result,t[80]=Ze);let Qe;t[81]===x.result?Qe=t[82]:(Qe=Wn(x.result)&&(0,K.jsx)(`p`,{role:`alert`,className:`border-t px-3 py-2 text-xs text-destructive`,children:gi(xr(x.result.cause))}),t[81]=x.result,t[82]=Qe);let $e;return t[83]!==z||t[84]!==le.length?($e=le.length>0&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2 border-t px-3 py-2 text-xs text-muted-foreground`,children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Some folders could not be loaded.`}),(0,K.jsx)(wn,{variant:`outline`,size:`xs`,onClick:()=>z.retry(),children:`Try again`})]}),t[83]=z,t[84]=le.length,t[85]=$e):$e=t[85],(0,K.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[Ae,je,(0,K.jsx)(zN,{entries:de,expanded:k,onExpand:Me,onRetry:Ne,renderDirectory:e=>(0,K.jsx)(sP,{prefix:`${e}/`,input:ke}),statuses:fe,selected:a,onOpen:ge,onUnpin:Pe,menuFor:e=>{let t=Te(e);return{actions:de.some(t=>t.path===ca(e)&&t.state===`resolved`)?t.actions:[],hidden:t.hidden,onAction:n=>t.run(n,UN,()=>Ce(e))}}}),(0,K.jsxs)(`section`,{"aria-label":`All files`,className:`flex min-h-0 flex-1 flex-col pt-1`,children:[Fe,Ie,(0,K.jsx)(TN,{...ke},ke.owner),b.size>0&&(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 px-3.5 py-2 text-2xs text-muted-foreground`,children:[(0,K.jsx)(ao,{className:`size-3.5 shrink-0`}),(0,K.jsx)(`span`,{children:Ki(b,e=>se.get(e)??se.get(`${e}/`))}),(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,K.jsx)(wn,{variant:`link`,size:`xs`,onClick:()=>P(!E),children:E?`Hide`:`Show`})]})]}),Xe,d!==void 0&&!_&&(0,K.jsx)(`p`,{role:`alert`,className:`px-3 py-2 text-xs text-destructive`,children:la(d)}),Ze,Qe,$e]})}function UN(){}function WN(e){return Li.add({title:`Invalid name`,description:e,type:`error`})}function GN(e){return e.kind===`symlink`||e.kind===`submodule`}function KN(e){return e.path}function qN(e){return e.kind===`file`}function JN(e){return e.path}function YN(e){return{path:ts(e),status:ki(e)}}function XN(e){return e.comparisons}function ZN(e){return{path:e.path,status:`ignored`}}function QN(e){return e.ignored}function $N(e){return[e.path,e.kind]}function eP(e){return e.path}function tP(e){return{path:e,kind:e.endsWith(`/`)?`directory`:`file`}}function nP(e){return bi(e).map(rP)}function rP(e){return`${e}/`}function iP(e){return Pr(Ht(e))}function aP(e){return{path:e,pinned:!0,hidden:!1}}function oP(e,t){let n=[...new Set([...e,...t])].sort();return n.length===e.length&&n.every((t,n)=>t===e[n])?e:n}function sP(e){let t=(0,q.c)(73),{prefix:n,input:r}=e,[i,a]=(0,G.useState)(0),o;t[0]===n.length?o=t[1]:(o=e=>e.slice(n.length),t[0]=n.length,t[1]=o);let s=o,c,l,u,d,f,p,m,h,g;if(t[2]!==i||t[3]!==r||t[4]!==n||t[5]!==s){let e;t[15]===n?e=t[16]:(e=e=>e.startsWith(n)&&e!==n,t[15]=n,t[16]=e);let o=r.paths.filter(e);h=`flex max-h-52 min-h-0 flex-col pl-1.5`,t[17]===i?g=t[18]:(g={height:i},t[17]=i,t[18]=g),c=TN,l=r.owner,u=r,d=a,f=`${r.owner}:pin:${n}`,p=o.map(s);let _;t[19]!==r.kinds||t[20]!==s?(_=e=>{let t=r.kinds.get(e);return t===void 0?[]:[[s(e),t]]},t[19]=r.kinds,t[20]=s,t[21]=_):_=t[21],m=new Map(o.flatMap(_)),t[2]=i,t[3]=r,t[4]=n,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h,t[14]=g}else c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14];let _;if(t[22]!==r.links||t[23]!==n||t[24]!==s){let e;t[26]===n?e=t[27]:(e=e=>e.path.startsWith(n),t[26]=n,t[27]=e);let i;t[28]===s?i=t[29]:(i=e=>({...e,path:s(e.path)}),t[28]=s,t[29]=i),_=r.links.filter(e).map(i),t[22]=r.links,t[23]=n,t[24]=s,t[25]=_}else _=t[25];let v;if(t[30]!==r.gitStatus||t[31]!==n||t[32]!==s){let e;t[34]===n?e=t[35]:(e=e=>e.path.startsWith(n),t[34]=n,t[35]=e);let i;t[36]===s?i=t[37]:(i=e=>({...e,path:s(e.path)}),t[36]=s,t[37]=i),v=r.gitStatus.filter(e).map(i),t[30]=r.gitStatus,t[31]=n,t[32]=s,t[33]=v}else v=t[33];let y;t[38]!==r.selected||t[39]!==n||t[40]!==s?(y=r.selected.startsWith(n)?s(r.selected):``,t[38]=r.selected,t[39]=n,t[40]=s,t[41]=y):y=t[41];let b,x,S,C,w;t[42]!==r||t[43]!==n?(b=e=>r.onRequestRename(`${n}${e}`),x=(e,t)=>r.onCreate(`${n}${e}`,t),S=(e,t)=>r.onMove(`${n}${e}`,`${n}${t}`),C=(e,t)=>r.onSelect(`${n}${e}`,t),w=e=>r.onExpand(e.map(e=>`${n}${e}`)),t[42]=r,t[43]=n,t[44]=b,t[45]=x,t[46]=S,t[47]=C,t[48]=w):(b=t[44],x=t[45],S=t[46],C=t[47],w=t[48]);let T;t[49]!==r||t[50]!==n?(T=(e,t,i)=>r.renderMenu({...e,path:`${n}${e.path}`},t,i),t[49]=r,t[50]=n,t[51]=T):T=t[51];let E;t[52]!==c||t[53]!==_||t[54]!==v||t[55]!==y||t[56]!==b||t[57]!==x||t[58]!==S||t[59]!==C||t[60]!==w||t[61]!==T||t[62]!==l||t[63]!==u||t[64]!==d||t[65]!==f||t[66]!==p||t[67]!==m?(E=(0,K.jsx)(c,{...u,onContentHeight:d,owner:f,paths:p,kinds:m,links:_,gitStatus:v,selected:y,creating:void 0,renameRequest:void 0,onRequestRename:b,onCreate:x,onMove:S,onSelect:C,onExpand:w,bindRename:lP,bindCollapseAll:cP,renderMenu:T},l),t[52]=c,t[53]=_,t[54]=v,t[55]=y,t[56]=b,t[57]=x,t[58]=S,t[59]=C,t[60]=w,t[61]=T,t[62]=l,t[63]=u,t[64]=d,t[65]=f,t[66]=p,t[67]=m,t[68]=E):E=t[68];let D;return t[69]!==E||t[70]!==h||t[71]!==g?(D=(0,K.jsx)(`div`,{className:h,style:g,children:E}),t[69]=E,t[70]=h,t[71]=g,t[72]=D):D=t[72],D}function cP(){}function lP(){}var uP=Ns(),dP={toggle(){uP.isOpen?uP.close():uP.open(null)},close(){uP.close()}};function fP(e,t){let n=(0,q.c)(9),{query:r,setQuery:i}=ta(),a;n[0]!==e||n[1]!==t||n[2]!==i?(a=n=>{t.close(),i(``),e(n)},n[0]=e,n[1]=t,n[2]=i,n[3]=a):a=n[3];let o;return n[4]!==t.toggle||n[5]!==r||n[6]!==i||n[7]!==a?(o={query:r,setQuery:i,toggle:t.toggle,select:a},n[4]=t.toggle,n[5]=r,n[6]=i,n[7]=a,n[8]=o):o=n[8],o}function pP(e){let t=(0,q.c)(1),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={enabled:!0},t[0]=n):n=t[0],zi(`Mod+P`,e,n)}function mP(e){let t=(0,q.c)(2);pP(hP);let n;return t[0]===e?n=t[1]:(n=(0,K.jsx)(gA,{handle:uP,title:`Find a file`,description:`Find a file by name, or enter a relative path to open it.`,children:(0,K.jsx)(gP,{...e})}),t[0]=e,t[1]=n),n}function hP(){return dP.toggle()}function gP(e){let t=(0,q.c)(10),{scope:n,connection:r,openFiles:i,onOpen:a,bindPopup:o}=e,{query:s,setQuery:c,select:l}=fP(a,dP),u=VC(r,n.projectId),d=pn(Ht(u.result)),f=new Set(d?.preferences.filter(vP).map(_P)??[]),p=Ta(`${r.environmentId}:${n.projectId}:${n.worktreeId}`).state.showHidden,m=hA,h;t[0]!==s||t[1]!==c?(h=(0,K.jsx)(_A,{"aria-label":`Find a file by name`,placeholder:`Find a file by name`,value:s,onValueChange:c}),t[0]=s,t[1]=c,t[2]=h):h=t[2];let g=d===void 0&&(0,K.jsx)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:Wn(u.result)?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`block`,children:`File visibility preferences could not be loaded.`}),(0,K.jsx)(wn,{variant:`outline`,size:`xs`,className:`mt-2`,onClick:()=>u.refresh(),children:`Try again`})]}):`Reading file visibility…`}),_=d!==void 0&&s.trim()===``&&(0,K.jsx)(yP,{scope:n,connection:r,openFiles:Yi(i,f,p),preferences:d.preferences.filter(e=>p||aa(e.path,f)===null),onSelect:l}),v=d!==void 0&&s.trim()!==``&&(0,K.jsx)(TP,{scope:n,connection:r,query:s,hidden:f,showHidden:p,onSelect:l}),y;return t[3]!==m||t[4]!==o||t[5]!==h||t[6]!==g||t[7]!==_||t[8]!==v?(y=(0,K.jsxs)(m,{ref:o,shouldFilter:!1,children:[h,g,_,v]}),t[3]=m,t[4]=o,t[5]=h,t[6]=g,t[7]=_,t[8]=v,t[9]=y):y=t[9],y}function _P(e){return e.path}function vP(e){return e.hidden}function yP(e){let t=(0,q.c)(2),{scope:n,connection:r,openFiles:i,preferences:a,onSelect:o}=e,s=a.filter(wP),c=yS(r,n,s.length===0?[]:[``,...ja(s)]),l=ka(s.map(CP),c.states).filter(SP).map(xP),u=[...new Set([...i,...l])],d;return t[0]===c?d=t[1]:(d=c.states.some(bP)&&(0,K.jsxs)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:[`Pinned files could not be loaded.`,(0,K.jsx)(wn,{variant:`outline`,size:`xs`,className:`ml-2`,onClick:()=>c.retry(),children:`Try again`})]}),t[0]=c,t[1]=d),(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(vA,{children:u.map(e=>(0,K.jsx)(EP,{path:e,onSelect:o},e))}),u.length===0&&(0,K.jsx)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:`Type a file name or relative path.`}),d]})}function bP(e){return e.status===`unavailable`}function xP(e){let{path:t}=e;return t}function SP(e){return e.state===`resolved`&&e.entry.kind===`file`}function CP(e){let{path:t}=e;return t}function wP(e){return e.pinned}function TP(e){let t=(0,q.c)(26),{scope:n,connection:r,query:i,hidden:a,showHidden:o,onSelect:s}=e,c=AN(r,n),l,u,d,f,p,m;if(t[0]!==a||t[1]!==c||t[2]!==s||t[3]!==i||t[4]!==o){let e=ii(Yi(pn(Ht(c.result))?.paths??[],a,o),i),n=ni(i),r=n!==null&&(o||aa(n,a)===null)&&!e.includes(n)?n:null;t[11]===c?f=t[12]:(f=Wn(c.result)&&(0,K.jsxs)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:[(0,K.jsx)(`span`,{className:`block`,children:`Full file search could not be loaded. You can still browse folders.`}),(0,K.jsx)(wn,{variant:`outline`,size:`xs`,className:`mt-2`,onClick:()=>c.refresh(),children:`Try again`})]}),t[11]=c,t[12]=f),t[13]===c.result?p=t[14]:(p=sr(c.result)&&(0,K.jsx)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:`Reading file names…`}),t[13]=c.result,t[14]=p),m=!sr(c.result)&&!Wn(c.result)&&e.length===0&&r===null&&(0,K.jsx)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:`No file matches that name.`}),l=vA,u=r!==null&&(0,K.jsxs)(xA,{value:r,onSelect:()=>s(r),children:[`Open path `,r]});let h;t[15]===s?h=t[16]:(h=e=>(0,K.jsx)(EP,{path:e,onSelect:s},e),t[15]=s,t[16]=h),d=e.map(h),t[0]=a,t[1]=c,t[2]=s,t[3]=i,t[4]=o,t[5]=l,t[6]=u,t[7]=d,t[8]=f,t[9]=p,t[10]=m}else l=t[5],u=t[6],d=t[7],f=t[8],p=t[9],m=t[10];let h;t[17]!==l||t[18]!==u||t[19]!==d?(h=(0,K.jsxs)(l,{children:[u,d]}),t[17]=l,t[18]=u,t[19]=d,t[20]=h):h=t[20];let g;return t[21]!==f||t[22]!==p||t[23]!==m||t[24]!==h?(g=(0,K.jsxs)(K.Fragment,{children:[f,p,m,h]}),t[21]=f,t[22]=p,t[23]=m,t[24]=h,t[25]=g):g=t[25],g}function EP(e){let t=(0,q.c)(11),{path:n,onSelect:r}=e,i=n.lastIndexOf(`/`)+1,a;t[0]!==r||t[1]!==n||t[2]!==i?(a=(e,t)=>(0,K.jsxs)(xA,{value:n,"aria-label":n,onSelect:()=>r(n),children:[e,i>0&&t(n.slice(0,i-1),`shrink-[100] text-muted-foreground`)]}),t[0]=r,t[1]=n,t[2]=i,t[3]=a):a=t[3];let o;t[4]!==n||t[5]!==i?(o=n.slice(i),t[4]=n,t[5]=i,t[6]=o):o=t[6];let s;return t[7]!==n||t[8]!==a||t[9]!==o?(s=(0,K.jsx)(Fr,{text:n,className:`min-w-0`,renderTrigger:a,children:o}),t[7]=n,t[8]=a,t[9]=o,t[10]=s):s=t[10],s}function DP(e,t,n){let r=(0,q.c)(7),i;r[0]!==e||r[1]!==t?(i=ya({draft:e,viewer:t}),r[0]=e,r[1]=t,r[2]=i):i=r[2],ye(i);let a;r[3]!==e||r[4]!==n||r[5]!==t?(a=qi({draft:e,viewer:t,fingerprint:n}),r[3]=e,r[4]=n,r[5]=t,r[6]=a):a=r[6],ye(a)}var OP=P(({connection:e,environmentIds:t})=>m(n=>{if(!e||t.length===0)return;let r=n(f(e)),i=pn(Ht(r));if(!i)return;let a=e=>{i.hasUnsaved(t)&&e.preventDefault()};window.addEventListener(`beforeunload`,a),n.addFinalizer(()=>window.removeEventListener(`beforeunload`,a))}));function kP(e,t){let n=(0,q.c)(3),r;n[0]!==e||n[1]!==t?(r=OP({connection:e,environmentIds:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],ye(r)}var AP=dn([`changes`,`files`,`history`]),jP=dn([`uncommitted`,`branch`]),MP=bn(Rr.check(Tn(st))).pipe(qe(()=>lt(kt(void 0)))),NP=Dt({surface:bn(AP).pipe(qe(()=>lt(kt(void 0)))),entry:MP,side:MP,scope:bn(jP).pipe(qe(()=>lt(kt(void 0)))),base:MP}),PP=O(AP),FP=O(jP),IP=[{id:`general`,label:`General`,icon:Jo},{id:`git`,label:`Changes & Git`,icon:wo},{id:`computers`,label:`Computers`,icon:rn}],LP=IP[0].id,RP={reading:`max-w-186 gap-8`,list:`max-w-186 gap-7`,wide:`max-w-240 gap-5.5 md:pt-7.5`};function zP(e){return H(`settings-content wrap-anywhere mx-auto flex w-full flex-col px-4 py-6 md:px-6 md:py-9 lg:pr-10 lg:pl-6`,RP[e])}function BP(e){let t=(0,q.c)(5),{children:n,layout:r}=e,i;t[0]===r?i=t[1]:(i=zP(r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,K.jsx)(Ww,{className:`min-h-0 flex-1`,children:(0,K.jsx)(`div`,{className:i,children:n})}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function VP(e){let t=(0,q.c)(71),{section:n,environmentId:r}=e,i=mt(),{setOpenMobile:a}=nn(),o=ze(),s=Wa(),l;t[0]!==s||t[1]!==o.history.location.state.__TSR_index?(l=()=>({historyIndex:o.history.location.state.__TSR_index,hasPredecessor:s}),t[0]=s,t[1]=o.history.location.state.__TSR_index,t[2]=l):l=t[2];let[u]=(0,G.useState)(l),d=c(r??``)?.remote,{element:f,attach:p}=xT(),{element:m,attach:h}=xT(),[g,_]=(0,G.useState)(null),v;t[3]!==g||t[4]!==i||t[5]!==o.history?(v=()=>{g?o.history.back():i({to:`/settings/$section`,params:{section:`computers`},replace:!0})},t[3]=g,t[4]=i,t[5]=o.history,t[6]=v):v=t[6];let y=v,b;t[7]!==f?.scrollTop||t[8]!==i?(b=e=>{_({scroll:f?.scrollTop??0,focus:document.activeElement instanceof HTMLElement?document.activeElement:null}),i({to:`/settings/$section/$environmentId`,params:{section:`computers`,environmentId:e}})},t[7]=f?.scrollTop,t[8]=i,t[9]=b):b=t[9];let x=b,S;t[10]!==r||t[11]!==h?(S=e=>{h(e),r!==void 0&&e?.focus({preventScroll:!0})},t[10]=r,t[11]=h,t[12]=S):S=t[12];let C=S,w;t[13]!==r||t[14]!==g||t[15]!==p?(w=e=>{if(p(e),r===void 0&&e){g&&(e.scrollTop=g.scroll);let t=g?.focus;t?.isConnected?t.focus({preventScroll:!0}):e.focus({preventScroll:!0})}},t[13]=r,t[14]=g,t[15]=p,t[16]=w):w=t[16];let T=w,{connection:E}=Me(),{environment:D}=YC(E),O;t[17]===n?O=t[18]:(O=IP.find(e=>e.id===n)??IP[0],t[17]=n,t[18]=O);let k=O,A=`Computer unavailable`;if(r===`this-computer`)A=`This computer`;else if(d){let e;t[19]===d?e=t[20]:(e=(0,K.jsx)(j,{remote:d}),t[19]=d,t[20]=e),A=e}let M;t[21]!==u||t[22]!==r||t[23]!==i||t[24]!==y||t[25]!==o.history||t[26]!==a?(M=()=>{a(!1),r===void 0?u.hasPredecessor?o.history.go(-Math.max(1,o.history.location.state.__TSR_index-u.historyIndex+1)):i({to:`/`}):y()},t[21]=u,t[22]=r,t[23]=i,t[24]=y,t[25]=o.history,t[26]=a,t[27]=M):M=t[27];let N=M,P;t[28]===m?P=t[29]:(P={target:m,ignoreInputs:!0},t[28]=m,t[29]=P),zi(Fi.closeSettings,N,P);let F;t[30]===N?F=t[31]:(F=(0,K.jsx)(`form`,{id:`close-settings`,hidden:!0,onSubmit:e=>{e.preventDefault(),N()}}),t[30]=N,t[31]=F);let I;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,K.jsx)(Xn,{render:(0,K.jsx)(ln,{"aria-label":`Toggle Sidebar`})}),t[32]=I):I=t[32];let L;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,K.jsxs)(yr,{children:[I,(0,K.jsxs)(Vt,{children:[`Toggle sidebar`,` `,(0,K.jsx)(yT,{children:Ui(Fi.toggleNavigator)})]})]}),t[33]=L):L=t[33];let R,ee;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,K.jsx)(Jw,{children:`Settings`}),ee=(0,K.jsx)(Zw,{children:`/`}),t[34]=R,t[35]=ee):(R=t[34],ee=t[35]);let z;t[36]!==k.label||t[37]!==r||t[38]!==y?(z=(0,K.jsx)(Jw,{children:(0,K.jsx)(`h2`,{children:r===void 0?(0,K.jsx)(Xw,{children:k.label}):(0,K.jsx)(Yw,{render:(0,K.jsx)(`button`,{type:`button`,onClick:y}),children:`Computers`})})}),t[36]=k.label,t[37]=r,t[38]=y,t[39]=z):z=t[39];let ne;t[40]!==A||t[41]!==r?(ne=r!==void 0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Zw,{children:`/`}),(0,K.jsx)(Jw,{className:`min-w-0`,children:(0,K.jsx)(Xw,{className:`min-w-0`,children:A})})]}),t[40]=A,t[41]=r,t[42]=ne):ne=t[42];let B;t[43]!==z||t[44]!==ne?(B=(0,K.jsxs)(`header`,{className:`settings-bar flex min-h-12 shrink-0 items-center gap-2 border-b px-2`,children:[L,(0,K.jsx)(Kw,{className:`min-w-0 flex-1`,children:(0,K.jsxs)(qw,{className:`min-w-0 flex-nowrap`,children:[R,ee,z,ne]})})]}),t[43]=z,t[44]=ne,t[45]=B):B=t[45];let re;t[46]!==k.id||t[47]!==r||t[48]!==i||t[49]!==y?(re=IP.map(e=>{let t=e.icon,n=k.id===e.id;return(0,K.jsxs)(wn,{variant:n?`secondary`:`ghost`,size:`sm`,className:`shrink-0 justify-start md:w-full`,"aria-current":n?`page`:void 0,onClick:()=>{r!==void 0&&e.id===`computers`?y():i({to:`/settings/$section`,params:{section:e.id},replace:!0})},children:[(0,K.jsx)(t,{}),e.label]},e.id)}),t[46]=k.id,t[47]=r,t[48]=i,t[49]=y,t[50]=re):re=t[50];let V;t[51]===re?V=t[52]:(V=(0,K.jsx)(`div`,{className:`settings-nav flex gap-0.5 overflow-x-auto px-3 py-3 md:flex-col md:py-5`,children:re}),t[51]=re,t[52]=V);let ae;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,K.jsxs)(`p`,{className:`mt-auto hidden px-5 pb-4 text-xs tabular-nums text-muted-foreground md:block`,children:[`Porcelain `,`0.82.3`]}),t[53]=ae):ae=t[53];let oe;t[54]===V?oe=t[55]:(oe=(0,K.jsxs)(`nav`,{"aria-label":`Settings sections`,className:`flex shrink-0 flex-col md:w-52`,children:[V,ae]}),t[54]=V,t[55]=oe);let se;t[56]!==T||t[57]!==k.id||t[58]!==D||t[59]!==r||t[60]!==x||t[61]!==y?(se=(0,K.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:k.id===`computers`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{ref:T,className:r===void 0?`min-h-0 flex-1 overflow-y-auto outline-none`:`hidden`,role:`region`,"aria-label":`Computers list`,tabIndex:-1,children:(0,K.jsx)(`div`,{className:zP(`list`),children:(0,K.jsx)(te,{showUpdates:r===void 0,environment:D,onOpen:x})})}),r!==void 0&&(0,K.jsx)(BP,{layout:`wide`,children:r===`this-computer`?(0,K.jsx)(et,{environment:D}):(0,K.jsx)(ie,{environmentId:r,onForgotten:y},r)})]}):(0,K.jsx)(BP,{layout:`reading`,children:k.id===`git`?(0,K.jsx)(oa,{}):(0,K.jsx)(ma,{})})}),t[56]=T,t[57]=k.id,t[58]=D,t[59]=r,t[60]=x,t[61]=y,t[62]=se):se=t[62];let ce;t[63]!==oe||t[64]!==se?(ce=(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col md:flex-row`,children:[oe,se]}),t[63]=oe,t[64]=se,t[65]=ce):ce=t[65];let le;return t[66]!==C||t[67]!==B||t[68]!==ce||t[69]!==F?(le=(0,K.jsxs)(`main`,{ref:C,tabIndex:-1,"aria-label":`Settings`,className:`flex h-full min-h-0 min-w-0 flex-col overflow-hidden rounded-paper bg-card shadow-paper outline-none`,children:[F,B,ce]}),t[66]=C,t[67]=B,t[68]=ce,t[69]=F,t[70]=le):le=t[70],le}export{XC as $,H_ as $t,MT as A,Ko as An,_S as At,yT as B,ao as Bn,Gv as Bt,yA as C,ds as Cn,MS as Ct,vA as D,ts as Dn,DS as Dt,xA as E,rs as En,OS as Et,kT as F,Po as Fn,Jy as Ft,gT as G,U_ as Gt,dT as H,$a as Hn,lv as Ht,OT as I,Oo as In,Vy as It,nT as J,K_ as Jt,_T as K,ev as Kt,AT as L,wo as Ln,Ey as Lt,CT as M,Ho as Mn,sS as Mt,TT as N,Ro as Nn,iS as Nt,jT as O,ns as On,kS as Ot,DT as P,Io as Pn,jb as Pt,Cw as Q,J_ as Qt,ST as R,fo as Rn,Sy as Rt,hA as S,fs as Sn,CS as St,_A as T,ps as Tn,AS as Tt,pT as U,Ya as Un,nv as Ut,bT as V,ro as Vn,Bv as Vt,hT as W,qa as Wn,W_ as Wt,Gw as X,tv as Xt,Ww as Y,q_ as Yt,Fw as Z,G_ as Zt,dN as _,Es as _n,rC as _t,PP as a,I_ as an,PC as at,aj as b,Cs as bn,tC as bt,DP as c,M_ as cn,bC as ct,SN as d,w_ as dn,dC as dt,V_ as en,ew as et,gN as f,C_ as fn,fC as ft,fN as g,Ts as gn,aC as gt,pN as h,Ss as hn,cC as ht,FP as i,L_ as in,YC as it,NT as j,Wo as jn,lS as jt,PT as k,Qo as kn,vS as kt,mP as l,A_ as ln,yC as lt,mN as m,_s as mn,lC as mt,LP as n,z_ as nn,tw as nt,NP as o,N_ as on,NC as ot,vN as p,gs as pn,uC as pt,fT as q,Y_ as qt,IP as r,R_ as rn,rw as rt,kP as s,P_ as sn,CC as st,VP as t,B_ as tn,iw as tt,VN as u,O_ as un,xC as ut,uN as v,Os as vn,iC as vt,bA as w,cs as wn,ES as wt,WA as x,hs as xn,eC as xt,cj as y,Ds as yn,nC as yt,xT as z,lo as zn,wy as zt};