@puddle-code/cli 0.0.31 → 0.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -5
- package/dist/index.js +32 -2
- package/dist/public/assets/{Dashboard-B66LKhh2.js → Dashboard-CaIw594e.js} +1 -1
- package/dist/public/assets/{EditorTabClose-CSABrGec.js → EditorTabClose-fAutR9L2.js} +1 -1
- package/dist/public/assets/{LazyTerminal-CGHq-1X5.js → LazyTerminal-Cv4MivyB.js} +2 -2
- package/dist/public/assets/{ModelRefcount-CZJZVYmt.js → ModelRefcount-MJz59mka.js} +1 -1
- package/dist/public/assets/{PaneEditorBody-DjtxlUfi.js → PaneEditorBody-DGqg_4uR.js} +1 -1
- package/dist/public/assets/SettingsDialog-Ck6AFRjw.js +1 -0
- package/dist/public/assets/{Terminal-BOR4Jzqq.js → Terminal-BtsgoMqj.js} +1 -1
- package/dist/public/assets/{Workspace-DvUIhBbx.js → Workspace-BaIcmmwi.js} +2 -2
- package/dist/public/assets/{buffer-store-ja3NwK-y.js → buffer-store-bK5Xpj6d.js} +2 -2
- package/dist/public/assets/{context-menu-Pwhl2i5S.js → context-menu-CLWmCX87.js} +1 -1
- package/dist/public/assets/{cssMode-DTqWWjxD.js → cssMode-DfLbNQ92.js} +1 -1
- package/dist/public/assets/{editor-context-CkjrPbVW.js → editor-context-Cz5G4UVr.js} +1 -1
- package/dist/public/assets/{editor-sync-DIu7OiT7.js → editor-sync-Cc36ZLyi.js} +1 -1
- package/dist/public/assets/{hotkeys-qOqg9LFd.js → hotkeys-BrRVXikm.js} +1 -1
- package/dist/public/assets/{htmlMode-BJ4opKyi.js → htmlMode-Decw-wtn.js} +1 -1
- package/dist/public/assets/index-ChpBP8Zc.css +2 -0
- package/dist/public/assets/{index-CC56sBRj.js → index-IEQHp8h9.js} +3 -3
- package/dist/public/assets/{jsonMode-CAJh_-0Q.js → jsonMode-vNCk8wN_.js} +1 -1
- package/dist/public/assets/{session-seed-Cmid3MNi.js → session-seed-mKf0bRzJ.js} +1 -1
- package/dist/public/assets/ssh-mode-DFHbi7WV.js +1 -0
- package/dist/public/assets/{tsMode-DW6KOjeP.js → tsMode-XcRZTbul.js} +1 -1
- package/dist/public/index.html +4 -4
- package/package.json +1 -1
- package/dist/public/assets/SettingsDialog-Cc6BmzLf.js +0 -1
- package/dist/public/assets/index-Dk2_kal4.css +0 -2
- package/dist/public/assets/ssh-mode-BroWwwTf.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PaneEditorBody-
|
|
2
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{n,t as r}from"./jsx-runtime-ffCh33zF.js";import{C as i,_ as a,f as o,l as s}from"./hotkeys-qOqg9LFd.js";import{A as c,C as l,D as u,M as d,S as f,_ as p,b as m,c as h,g,h as _,i as v,j as y,k as b,l as x,p as S,r as C,s as w,t as T,v as E,w as D,x as O,y as k}from"./editor-context-CkjrPbVW.js";import{t as A}from"./preload-helper-Czpn1I53.js";import{S as j,c as ee,l as te,n as M,t as N,y as P}from"./api-BJeOJuGe.js";import{A as ne,O as re,_ as ie,a as F,b as ae,g as I,h as oe,i as L,j as se,n as R,o as ce,r as le,t as ue,w as z}from"./dialog-B43iKmfK.js";import{$ as de,D as fe,H as pe,J as me,K as he,L as B,N as ge,P as _e,Q as ve,T as ye,U as V,X as be,Y as xe,Z as Se,a as Ce,ct as we,et as Te,f as Ee,ft as De,g as Oe,h as ke,i as Ae,it as je,l as Me,m as Ne,n as Pe,nt as Fe,o as Ie,ot as Le,pt as Re,r as ze,rt as Be,st as Ve,t as He,w as Ue}from"./LazyTerminal-CGHq-1X5.js";import{t as H}from"./utils-B6KiDbIe.js";import{t as U}from"./createLucideIcon-DyMAgLa3.js";import{A as We,C as Ge,D as Ke,E as qe,M as Je,O as Ye,S as Xe,T as Ze,_ as Qe,a as $e,b as et,c as tt,d as nt,f as rt,g as it,h as at,i as ot,j as st,k as ct,l as lt,m as ut,n as dt,o as ft,p as pt,r as W,s as mt,t as ht,u as gt,v as _t,w as vt,x as yt,y as bt}from"./context-menu-Pwhl2i5S.js";import{a as xt,i as St,n as Ct,o as wt,r as Tt,s as Et,t as Dt}from"./session-seed-Cmid3MNi.js";import{r as Ot}from"./dist-i-QevsUb.js";import{A as kt,At as G,Bt as At,C as jt,D as Mt,Dt as Nt,E as Pt,Et as Ft,F as It,I as Lt,J as Rt,L as zt,M as Bt,O as Vt,Ot as K,Rt as Ht,S as Ut,T as Wt,Tt as Gt,X as Kt,Y as qt,_ as Jt,b as Yt,bt as Xt,c as Zt,ct as Qt,d as $t,f as en,ft as tn,g as nn,h as rn,i as an,j as q,k as on,kt as J,l as sn,m as cn,n as ln,o as un,ot as dn,p as fn,pt as pn,q as mn,rt as hn,s as gn,st as _n,t as vn,tt as yn,u as bn,ut as xn,v as Sn,vt as Cn,w as wn,x as Tn,xt as En,y as Dn,yt as On,z as kn,zt as An}from"./index-CC56sBRj.js";import{i as jn}from"./buffer-logic-BrpRsL1b.js";import{t as Mn}from"./ssh-mode-BroWwwTf.js";var Nn=U(`arrow-right-left`,[[`path`,{d:`m16 3 4 4-4 4`,key:`1x1c3m`}],[`path`,{d:`M20 7H4`,key:`zbl0bi`}],[`path`,{d:`m8 21-4-4 4-4`,key:`h9nckh`}],[`path`,{d:`M4 17h16`,key:`g4d7ey`}]]),Pn=U(`case-sensitive`,[[`path`,{d:`m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16`,key:`d5nyq2`}],[`path`,{d:`M22 9v7`,key:`pvm9v3`}],[`path`,{d:`M3.304 13h6.392`,key:`1q3zxz`}],[`circle`,{cx:`18.5`,cy:`12.5`,r:`3.5`,key:`z97x68`}]]),Fn=U(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),In=U(`ellipsis`,[[`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`}]]),Ln=U(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]),Rn=U(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),zn=U(`eye`,[[`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`}]]),Bn=U(`file-archive`,[[`path`,{d:`M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5`,key:`4pqfef`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 12v-1`,key:`1ej8lb`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`path`,{d:`M8 7V6`,key:`1nbb54`}],[`circle`,{cx:`8`,cy:`20`,r:`2`,key:`ckkr5m`}]]),Vn=U(`file-braces`,[[`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 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),Y=U(`file-code`,[[`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`}]]),Hn=U(`file-cog`,[[`path`,{d:`M15 8a1 1 0 0 1-1-1V2a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8z`,key:`1ckgky`}],[`path`,{d:`M20 8v12a2 2 0 0 1-2 2h-4.182`,key:`1726p0`}],[`path`,{d:`m3.305 19.53.923-.382`,key:`ao1pio`}],[`path`,{d:`M4 10.592V4a2 2 0 0 1 2-2h8`,key:`1foop0`}],[`path`,{d:`m4.228 16.852-.924-.383`,key:`1fv9zy`}],[`path`,{d:`m5.852 15.228-.383-.923`,key:`1a9hc2`}],[`path`,{d:`m5.852 20.772-.383.924`,key:`1sh9ke`}],[`path`,{d:`m8.148 15.228.383-.923`,key:`4yu6lf`}],[`path`,{d:`m8.53 21.696-.382-.924`,key:`18b0s9`}],[`path`,{d:`m9.773 16.852.922-.383`,key:`ti6xop`}],[`path`,{d:`m9.773 19.148.922.383`,key:`rws47d`}],[`circle`,{cx:`7`,cy:`18`,r:`3`,key:`lvkj7j`}]]),Un=U(`file-headphone`,[[`path`,{d:`M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343`,key:`1vfytu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0`,key:`1etmh7`}]]),Wn=U(`file-image`,[[`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`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),Gn=U(`file-key`,[[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M4 12v6`,key:`bg1pfk`}],[`path`,{d:`M4 14h2`,key:`1sf9f8`}],[`path`,{d:`M9.65 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v4`,key:`d56i0q`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),Kn=U(`file-lock`,[[`path`,{d:`M4 9.8V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3`,key:`1432pc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 17v-2a2 2 0 0 0-4 0v2`,key:`168m41`}],[`rect`,{width:`8`,height:`5`,x:`3`,y:`17`,rx:`1`,key:`o8vfew`}]]),qn=U(`file-play`,[[`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:`M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z`,key:`1tzo1f`}]]),Jn=U(`file-spreadsheet`,[[`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:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]),Yn=U(`file-terminal`,[[`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:`m8 16 2-2-2-2`,key:`10vzyd`}],[`path`,{d:`M12 18h4`,key:`1wd2n7`}]]),Xn=U(`file-text`,[[`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 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Zn=U(`file-type`,[[`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:`M11 18h2`,key:`12mj7e`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5`,key:`qbrxap`}]]),Qn=U(`file`,[[`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`}]]),$n=U(`folder-closed`,[[`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`}],[`path`,{d:`M2 10h20`,key:`1ir3d8`}]]),er=U(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),tr=U(`folder-x`,[[`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`}],[`path`,{d:`m9.5 10.5 5 5`,key:`ra9qjz`}],[`path`,{d:`m14.5 10.5-5 5`,key:`l2rkpq`}]]),nr=U(`git-branch`,[[`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`}]]),rr=U(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),ir=U(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),ar=U(`panel-left-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),or=U(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),sr=U(`panel-right-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]),cr=U(`panel-right-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),lr=U(`pin`,[[`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`}]]),ur=U(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),dr=U(`regex`,[[`path`,{d:`M17 3v10`,key:`15fgeh`}],[`path`,{d:`m12.67 5.5 8.66 5`,key:`1gpheq`}],[`path`,{d:`m12.67 10.5 8.66-5`,key:`1dkfa6`}],[`path`,{d:`M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z`,key:`swwfx4`}]]),fr=U(`shield-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),pr=U(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),mr=U(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),hr=U(`user-round-cog`,[[`path`,{d:`m14.305 19.53.923-.382`,key:`3m78fa`}],[`path`,{d:`m15.228 16.852-.923-.383`,key:`npixar`}],[`path`,{d:`m16.852 15.228-.383-.923`,key:`5xggr7`}],[`path`,{d:`m16.852 20.772-.383.924`,key:`dpfhf9`}],[`path`,{d:`m19.148 15.228.383-.923`,key:`1reyyz`}],[`path`,{d:`m19.53 21.696-.382-.924`,key:`1goivc`}],[`path`,{d:`M2 21a8 8 0 0 1 10.434-7.62`,key:`1yezr2`}],[`path`,{d:`m20.772 16.852.924-.383`,key:`htqkph`}],[`path`,{d:`m20.772 19.148.924.383`,key:`9w9pjp`}],[`circle`,{cx:`10`,cy:`8`,r:`5`,key:`o932ke`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),gr=U(`whole-word`,[[`circle`,{cx:`7`,cy:`12`,r:`3`,key:`12clwm`}],[`path`,{d:`M10 9v6`,key:`17i7lo`}],[`circle`,{cx:`17`,cy:`12`,r:`3`,key:`gl7c2s`}],[`path`,{d:`M14 7v8`,key:`dl84cr`}],[`path`,{d:`M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1`,key:`lt2kga`}]]),X=r(),Z=e(t(),1);function _r(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function vr(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function yr(e){return e/100*window.innerHeight}function br(e){return e/100*window.innerWidth}function xr(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 Sr({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=xr(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=vr(t,i);break;case`em`:r=_r(t,i);break;case`vh`:r=yr(i);break;case`vw`:r=br(i);break}return r}function Cr(e){return parseFloat(e.toFixed(3))}function wr({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 Tr(e){let{panels:t}=e,n=wr({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=Cr(Sr({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=Cr(Sr({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=Cr(Sr({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=Cr(Sr({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 Q(e,t=`Assertion error`){if(!e)throw Error(t)}function Er(e,t){return Array.from(t).sort(e===`horizontal`?Dr:Or)}function Dr(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function Or(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function kr(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Ar(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 jr({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}=Ar(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return Q(i,`No rect found`),i}var Mr;function Nr(){return Mr===void 0&&(Mr=typeof matchMedia==`function`&&!!matchMedia(`(pointer:coarse)`).matches),Mr}function Pr(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Er(n,Array.from(t.children).filter(kr).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,jr({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p;break}}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=Nr()?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:wr({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 Fr=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)}}},Ir={cursorFlags:0,state:`inactive`},Lr=new Fr;function Rr(){return Ir}function zr(e){return Lr.addListener(`change`,e)}function Br(e){let t=Ir,n={...Ir};n.cursorFlags=e,Ir=n,Lr.emit(`change`,{prev:t,next:n})}function Vr(e){let t=Ir;Ir=e,Lr.emit(`change`,{prev:t,next:e})}var Hr=e=>e,Ur=()=>{},Wr=1,Gr=2,Kr=4,qr=8,Jr=3,Yr=12,Xr;function Zr(){return Xr===void 0&&(Xr=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(Xr=!0)),Xr}function Qr({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++;break}})}if(!(r===0&&i===0)){switch(n){case`active`:if(e&&Zr()){let t=(e&Wr)!==0,n=(e&Gr)!==0,r=(e&Kr)!==0,i=(e&qr)!==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`}break}return Zr()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var $r=new WeakMap;function ei(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=$r.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=Rr();switch(r.state){case`active`:case`hover`:{let e=Qr({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);break}$r.set(e,{prevStyle:t,styleSheet:n})}var ti=new Map,ni=new Fr;function ri(e){ti=new Map(ti),ti.delete(e)}function ii(e,t){for(let[t]of ti)if(t.id===e)return t}function ai(e,t){for(let[t,n]of ti)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function oi(){return ti}function si(e,t){return ni.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function ci(e,t,n){let r=ti.get(e);ti=new Map(ti),ti.set(e,t),ni.emit(`groupChange`,{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:r,next:t})}function li(e){let t=Rr(),n=!1;switch(t.state){case`active`:Vr({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(ei(e),n=!0,t.hitRegions.forEach(e=>{let t=ai(e.group.id,!0);ci(e.group,t,{isUserInteraction:!0})}))}return n}function ui(e){e.defaultPrevented||li(e.currentTarget)}function di(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Ar(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);break}}return r?{distance:i,hitRegion:r}:void 0}function fi(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function pi(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:yi(e),b:yi(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();Q(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:vi(_i(n.a)),b:vi(_i(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 mi=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function hi(e){let t=getComputedStyle(bi(e)??e).display;return t===`flex`||t===`inline-flex`}function gi(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||hi(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`||mi.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function _i(e){let t=e.length;for(;t--;){let n=e[t];if(Q(n,`Missing node`),gi(n))return n}return null}function vi(e){return e&&Number(getComputedStyle(e).zIndex)||0}function yi(e){let t=[];for(;e;)t.push(e),e=bi(e);return t}function bi(e){let{parentNode:t}=e;return fi(t)?t.host:t}function xi(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 Si({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!kr(n)||n.contains(e)||e.contains(n))return!0;if(pi(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(xi(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Ci(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Pr(r),a=di(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Si({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function wi(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 Ti(e,t,n=0){return Math.abs(Cr(e)-Cr(t))<=n}function Ei(e,t){return Ti(e,t)?0:e>t?1:-1}function Di({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(Ei(r,c)<0)if(a){let e=(i+c)/2;r=Ei(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=Cr(r),r}function Oi({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Ti(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;Q(u!=null,`Invalid first pivot index`),Q(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];Q(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(Q(n!=null,`Previous layout not found for panel index ${t}`),Ti(n,i)){let t=o-n;Ei(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];Q(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(Q(n!=null,`Previous layout not found for panel index ${t}`),Ti(n,o)){let t=n-i;Ei(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];Q(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&Ei(i,c)<0)if(e>0){let t=c-o,n=t/2;Ei(i+e,c)<0&&(e=Ei(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;Ei(i-e,c)<0&&(e=Ei(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];Q(e!=null,`Previous layout not found for panel index ${r}`);let a=Di({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];Q(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=Di({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Ti(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(wi(c,l))return i;{let t=e<0?d:u,r=s[t];Q(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=Di({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Ti(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];Q(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=Di({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Ti(i,s)||(t-=s-i,l[r]=s),Ti(t,0))break;e>0?r--:r++}}}if(!Ti(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 ki(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||Ei(e[n],t[n])!==0)return!1;return!0}function Ai({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(!Ti(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];Q(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];Q(i!=null,`No layout data found for index ${e}`);let o=r[e];Q(o!=null,`No layout data found for index ${e}`);let s=Di({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Ti(a,0))for(let e=0;e<t.length;e++){let n=r[e];Q(n!=null,`No layout data found for index ${e}`);let i=n+a,o=Di({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Ti(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function ji({groupId:e,panelId:t}){let n=()=>{let t=oi();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&&Ti(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:Cr(100-e)}}return Oi({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=Ai({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});ki(c,u)||ci(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&&Ti(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=wr({group:t}),o=Cr(Sr({groupSize:a,panelElement:r,styleProp:e})/a*100);s(o)}}}function Mi(e){e.defaultPrevented||Ci(e,oi()).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=ji({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function Ni(e){let t=oi();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 Pi({groupId:e}){let t=()=>{let t=oi();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=Ai({layout:e,panelConstraints:r});return n?o:(ki(o,c)||ci(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function Fi(e,t){let n=Ni(e),r=ai(n.id,!0),i=n.separators.find(t=>t.element===e);Q(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);Q(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=Pi({groupId:n.id}).getLayout(),c=Ai({layout:Oi({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});ki(s,c)||ci(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function Ii(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Ni(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Fi(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Fi(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Fi(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Fi(t,-5);break;case`End`:e.preventDefault(),Fi(t,100);break;case`Enter`:{e.preventDefault();let n=Ni(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=ai(n.id,!0),o=n.separators.find(e=>e.element===t);Q(o,`Matching separator not found`);let s=a.get(o);Q(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(Q(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Fi(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=Ni(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);Q(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(),Fi(t,-100);break}}function Li(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=oi(),n=Ci(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)}),Vr({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}function Ri({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=Oi({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(ki(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?Wr:Gr;break;case`vertical`:s|=d<0?Kr:qr;break}}else ci(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&Jr:c|=s&Jr,t.movementY===0?c|=o&Yr:c|=s&Yr,Br(c),ei(e)}function zi(e){let t=oi(),n=Rr();switch(n.state){case`active`:Ri({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Bi(e){if(e.defaultPrevented)return;let t=Rr(),n=oi();switch(t.state){case`active`:if(e.buttons===0){Vr({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=ai(e.group.id,!0);ci(e.group,t,{isUserInteraction:!0})});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}Ri({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Ci(e,n);r.length===0?t.state!==`inactive`&&Vr({cursorFlags:0,state:`inactive`}):Vr({cursorFlags:0,hitRegions:r,state:`hover`}),ei(e.currentTarget);break}}}function Vi(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Rr().state){case`hover`:Vr({cursorFlags:0,state:`inactive`})}}function Hi(e){e.defaultPrevented||e.pointerType===`mouse`&&e.button>0||li(e.currentTarget)&&e.preventDefault()}function Ui(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=Cr(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=Cr((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Wi(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=wr({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:Cr(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Gi(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 Ki({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=Cr(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e;break}}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]=Cr((r[e]??0)/a*l);else{let e=Cr(l/c.length);for(let t of c)u[t]=e}return u}function qi(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 Ji=new Map;function Yi(e){let t=!0;Q(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=wr({group:e});if(t===0)return;let n=ai(e.id);if(!n)return;let r=Tr(e),i=n.defaultLayoutDeferred?Ui(r):n.layout,a=Ai({layout:Ki({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&ki(n.layout,a)&&Gi(n.derivedPanelConstraints,r)&&n.groupSize===t)return;ci(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Wi(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{Q(!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=wr({group:e}),s=Tr(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(qi(e.panels,l)||(l=void 0));let u=Ai({layout:e.mutableState.layouts[c]??l??Ui(s),panelConstraints:s}),d=e.element.ownerDocument;Ji.set(d,(Ji.get(d)??0)+1);let f=new Map;return Pr(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),ci(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{Q(!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`,Ii)}),Ji.get(d)===1&&(d.addEventListener(`contextmenu`,ui,!0),d.addEventListener(`dblclick`,Mi,!0),d.addEventListener(`pointerdown`,Li,!0),d.addEventListener(`pointerleave`,zi),d.addEventListener(`pointermove`,Bi),d.addEventListener(`pointerout`,Vi),d.addEventListener(`pointerup`,Hi,!0)),function(){t=!1,Ji.set(d,Math.max(0,(Ji.get(d)??0)-1)),ri(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,Ii)}),Ji.get(d)||(d.removeEventListener(`contextmenu`,ui,!0),d.removeEventListener(`dblclick`,Mi,!0),d.removeEventListener(`pointerdown`,Li,!0),d.removeEventListener(`pointerleave`,zi),d.removeEventListener(`pointermove`,Bi),d.removeEventListener(`pointerout`,Vi),d.removeEventListener(`pointerup`,Hi,!0)),a.disconnect()}}function Xi(){let[e,t]=(0,Z.useState)({});return[e,(0,Z.useCallback)(()=>t({}),[])]}function Zi(e){let t=(0,Z.useId)();return`${e??t}`}var Qi=typeof window<`u`?Z.useLayoutEffect:Z.useEffect;function $i(e){let t=(0,Z.useRef)(e);return Qi(()=>{t.current=e},[e]),(0,Z.useCallback)((...e)=>t.current?.(...e),[t])}function ea(...e){return $i(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function ta(e){let t=(0,Z.useRef)({...e});return Qi(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var na=(0,Z.createContext)(null);function ra(e,t){let n=(0,Z.useRef)({getLayout:()=>({}),setLayout:Hr});(0,Z.useImperativeHandle)(t,()=>n.current,[]),Qi(()=>{Object.assign(n.current,Pi({groupId:e}))})}function ia({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,Z.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=$i(e=>{ki(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=$i((e,t)=>{ki(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e,{isUserInteraction:t}))}),_=Zi(s),v=(0,Z.useRef)(null),[y,b]=Xi(),x=(0,Z.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=ea(v,a);ra(_,o);let C=$i((e,t)=>{let r=Rr(),i=ii(e),a=ai(e);if(a){let e=!1;switch(r.state){case`active`:e=r.hitRegions.some(e=>e.group===i);break}return{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),w=ta({defaultLayout:n,disableCursor:r}),T=(0,Z.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=Er(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Er(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=ii(_),i=ai(_);r&&i&&ci(r,{...i,derivedPanelConstraints:Tr(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,Z.useRef)(null);return Qi(()=>{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=Yi(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=ai(r.id,!0);!o&&s.length>0&&(h(c),g(c,!1));let l=si(_,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=Ti(t.collapsedSize,i[t.panelId]),a=Ti(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=Rr().state!==`active`;h(i),o&&g(i,e.isUserInteraction)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,Z.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,X.jsx)(na.Provider,{value:T,children:(0,X.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})})}ia.displayName=`Group`;function aa(){let e=(0,Z.useContext)(na);return Q(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function oa(e,t){let{id:n}=aa(),r=(0,Z.useRef)({collapse:Ur,expand:Ur,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Ur});(0,Z.useImperativeHandle)(t,()=>r.current,[]),Qi(()=>{Object.assign(r.current,ji({groupId:n,panelId:e}))})}function sa({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=Zi(c),_=ta({disabled:a}),v=(0,Z.useRef)(null),y=ea(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=aa(),T=d!==null,E=$i((e,t,n)=>{d?.(e,c,n)});Qi(()=>{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,Z.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),oa(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Z.useSyncExternalStore)(e=>si(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,X.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...ca,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...k},children:(0,X.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}sa.displayName=`Panel`;var ca={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function la({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=Ai({layout:Oi({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Ai({layout:Oi({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function ua({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Zi(a),l=ta({disabled:n,disableDoubleClick:r}),[u,d]=(0,Z.useState)({}),[f,p]=(0,Z.useState)(`inactive`),[m,h]=(0,Z.useState)(!1),g=(0,Z.useRef)(null),_=ea(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=aa(),C=b===`horizontal`?`vertical`:`horizontal`;Qi(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=zr(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=si(y,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);d(la({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[y,c,x,l]),(0,Z.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,X.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})}ua.displayName=`Separator`;function da({request:e,targetSession:t,targetRoot:n,targetLabel:r,profileId:i,onClose:a,onSaved:o}){let[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(null),[d,p]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{e&&(c(e.name),u(null))},[e]);let m=async()=>{if(!e||!t)return;let a=s.trim().replace(/^\/+/,``).replace(/\/+$/,``);if(a===``){u(`Give the file a path.`);return}p(!0),u(null);try{let s=!0;try{await M(`GET`,`/api/worktrees/${t.id}/file?path=${encodeURIComponent(a)}${f(n)}`)}catch(e){if(e instanceof N&&e.status===404)s=!1;else if(e instanceof N&&e.status===413)s=!0;else throw e}if(s){u(`${a} already exists in ${r}.`);return}await M(`PUT`,`/api/worktrees/${t.id}/file?path=${encodeURIComponent(a)}${f(n)}`,{content:e.content}),i!==void 0&&await x(i,e.name).catch(()=>void 0),v(e.name),o(e.name,t.id,a,n)}catch(e){u(e instanceof Error?e.message:`Save failed`)}finally{p(!1)}};return(0,X.jsx)(ue,{open:e!==null,onOpenChange:e=>!e&&a(),children:(0,X.jsxs)(R,{children:[(0,X.jsxs)(F,{children:[(0,X.jsx)(ce,{children:`Save draft into the worktree`}),(0,X.jsx)(le,{children:t?(0,X.jsxs)(X.Fragment,{children:[`Saves into `,(0,X.jsx)(`span`,{className:`text-fg-secondary`,children:r}),` — what the sidebar is bound to.`]}):`No worktree is bound — open or focus a session first.`})]}),(0,X.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),m()},children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(Ve,{htmlFor:`untitled-path`,children:`Worktree-relative path`}),(0,X.jsx)(we,{id:`untitled-path`,placeholder:`docs/notes.md`,value:s,onChange:e=>c(e.target.value),autoFocus:!0})]}),l&&(0,X.jsx)(`p`,{className:`text-xs text-danger`,children:l}),(0,X.jsxs)(L,{children:[(0,X.jsx)(I,{type:`button`,variant:`ghost`,onClick:a,children:`Cancel`}),(0,X.jsx)(I,{type:`submit`,disabled:d||!t,children:`Save`})]})]})]})})}function fa(e){return{id:ee,project_id:e.projectId,account_id:null,worktree_path:e.path,base_branch:e.defaultBranch,branch:e.defaultBranch,separate_branch:!1,kind:`terminal`,agent_type:null,agent_session_ref:null,title:e.name,status:`exited`,skip_permissions:!1,created_at:`1970-01-01T00:00:00.000Z`,updated_at:`1970-01-01T00:00:00.000Z`,last_activity_at:null}}function pa(e,t,n,r=null){let i=n.snapshot.explorer_pin,a=i===null?null:e.find(e=>e.id===i&&e.status!==`archived`)??null,o=a??e.find(e=>e.id===t)??null,s=o===null&&r!==null;return{session:s?fa(r):o,root:s?r.path:void 0,isProjectDirectory:s,pinned:a!==null,pin(e){n.update({explorer_pin:e})},unpin(){n.update({explorer_pin:null})}}}function ma(e,t,n){return!e||e.major>t||e.major===t&&e.minor>=n}var ha=e=>ma(e,10,3),ga=e=>ma(e,12,4),_a=null,va=null;async function ya(){let[e,t]=await Promise.all([A(()=>import(`./PaneEditorBody-DjtxlUfi.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])),A(()=>import(`./ModelRefcount-CZJZVYmt.js`),__vite__mapDeps([20,1,2,16,7,9,3,4,5,10,11,8,12,13,14,15,17]))]);_a=e.PaneEditorBody,va=t.ModelRefcount}var ba=(0,Z.lazy)(()=>A(()=>import(`./PaneEditorBody-DjtxlUfi.js`).then(e=>({default:e.PaneEditorBody})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])));function xa(e){return _a?(0,X.jsx)(_a,{...e}):(0,X.jsx)(Z.Suspense,{fallback:(0,X.jsx)(`div`,{className:`flex h-full items-center justify-center bg-ground text-xs text-fg-muted`,children:`Loading editor…`}),children:(0,X.jsx)(ba,{...e})})}var Sa=(0,Z.lazy)(()=>A(()=>import(`./ModelRefcount-CZJZVYmt.js`).then(e=>({default:e.ModelRefcount})),__vite__mapDeps([20,1,2,16,7,9,3,4,5,10,11,8,12,13,14,15,17])));function Ca({buffers:e}){return va?(0,X.jsx)(va,{buffers:e}):(0,X.jsx)(Z.Suspense,{fallback:null,children:(0,X.jsx)(Sa,{buffers:e})})}var wa=(0,Z.lazy)(()=>A(()=>import(`./EditorTabClose-CSABrGec.js`).then(e=>({default:e.EditorDirtyDot})),__vite__mapDeps([21,1,2,3,10,11,8,16,7,9,4,5,12,13,14,15,17,18])));function Ta(e){return(0,X.jsx)(Z.Suspense,{fallback:null,children:(0,X.jsx)(wa,{...e})})}var Ea=(0,Z.lazy)(()=>A(()=>import(`./EditorTabClose-CSABrGec.js`).then(e=>({default:e.EditorTabClose})),__vite__mapDeps([21,1,2,3,10,11,8,16,7,9,4,5,12,13,14,15,17,18])));function Da(e){return(0,X.jsx)(Z.Suspense,{fallback:(0,X.jsx)(`button`,{onClick:t=>{t.stopPropagation(),e.onClose()},className:`hidden size-4 items-center justify-center rounded-sm text-fg-muted transition-colors hover:text-fg group-hover:flex pointer-coarse:flex`,"aria-label":`Close ${e.label}`,children:`×`}),children:(0,X.jsx)(Ea,{...e})})}var Oa=e(n(),1),ka=(0,Z.createContext)(null);function Aa({tree:e,parked:t=[],onOpenFile:n,children:r}){let i=(0,Z.useRef)(null),a=(0,Z.useRef)(new Map).current,[o,s]=(0,Z.useState)(()=>new Set),c=(0,Z.useCallback)((e,t)=>{s(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]),l=[...t].sort().join(`,`),u=(0,Z.useMemo)(()=>{let t=new Set;for(let n of rn(e))for(let e of n.tabs)e.type===`terminal`&&t.add(e.session);for(let e of l===``?[]:l.split(`,`))t.add(e);return[...t].sort()},[e,l]),d=e=>{let t=`term:${e}`,n=a.get(t);return n||(n=document.createElement(`div`),n.className=`size-full`,a.set(t,n)),n};(0,Z.useEffect)(()=>{let e=new Set(u.map(e=>`term:${e}`));for(let e of u){let t=a.get(`term:${e}`);t&&!t.parentElement&&i.current?.appendChild(t)}for(let[t,n]of[...a])e.has(t)||(n.remove(),a.delete(t))},[u,a]);let f=(0,Z.useMemo)(()=>({parkingRef:i,containers:a,setAdopted:c}),[a,c]);return(0,X.jsxs)(ka.Provider,{value:f,children:[(0,X.jsx)(`div`,{ref:i,className:`hidden`,"aria-hidden":!0}),u.map(e=>(0,Oa.createPortal)((0,X.jsx)(He,{stream:e,paused:!o.has(`term:${e}`),onOpenFile:(t,r,i)=>n(e,t,r,i)}),d(e),e)),r]})}function ja(e){let t=(0,Z.useContext)(ka),n=(0,Z.useRef)(null);return(0,Z.useEffect)(()=>{let r=n.current;if(!t||!e||!r)return;let i=t.containers.get(e);return i&&(r.appendChild(i),t.setAdopted(e,!0)),()=>{let n=t.parkingRef.current;i&&n&&i.parentElement===r&&n.appendChild(i),i&&t.setAdopted(e,!1)}},[t,e]),n}var Ma=20,Na=new Map;function Pa(e,t){let n=Na.get(e)??[];n.push(t),n.length>Ma&&n.shift(),Na.set(e,n)}function Fa(e,t){let n=Na.get(e);for(;n&&n.length>0;){let e=n.pop();if(t(e.ref))return e}}function Ia(e){let[t,n]=(0,Z.useState)(()=>window.matchMedia(e).matches);return(0,Z.useEffect)(()=>{let t=window.matchMedia(e),r=e=>n(e.matches);return n(t.matches),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}var La=`(max-width: 767px)`;function Ra(e,t){let n={};for(let r of t){let t=e[r];if(typeof t!=`number`)return;n[r]=t}return n}var za=`puddle.pane-height.`;function Ba(e){try{let t=localStorage.getItem(`${za}${e}`);if(t===null)return null;let n=Number(t);return Number.isFinite(n)&&n>0?n:null}catch{return null}}function Va(e,t,{sized:n,min:r=64}){let[i,a]=(0,Z.useState)(()=>Ba(e)??t),[o,s]=(0,Z.useState)(!1),c=(0,Z.useRef)(i);return c.current=i,{height:i,handle:{dragging:o,onPointerDown:(0,Z.useCallback)(t=>{if(t.button!==0)return;t.preventDefault();let i=t.currentTarget,o=t.clientY,l=c.current,u=i.parentElement?.getBoundingClientRect().height??window.innerHeight,d=Math.max(r,u-96);i.setPointerCapture(t.pointerId),s(!0);let f=e=>{let t=e.clientY-o,i=n===`below`?l-t:l+t;a(Math.round(Math.min(d,Math.max(r,i))))},p=()=>{i.removeEventListener(`pointermove`,f),i.removeEventListener(`pointerup`,p),i.removeEventListener(`pointercancel`,p),s(!1);try{localStorage.setItem(`${za}${e}`,String(c.current))}catch{}};i.addEventListener(`pointermove`,f),i.addEventListener(`pointerup`,p),i.addEventListener(`pointercancel`,p)},[e,r,n])}}}function Ha({handle:e,label:t,className:n}){return(0,X.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,"aria-label":t,onPointerDown:e.onPointerDown,className:H(`relative h-px shrink-0 cursor-row-resize touch-none bg-border transition-colors hover:bg-accent`,e.dragging&&`bg-accent`,n),children:(0,X.jsx)(`div`,{className:`absolute inset-x-0 -top-1 h-[9px]`})})}var Ua=80,Wa=180;function Ga(e){return Math.max(Wa,Math.round(e/Ua*1e3))}function Ka({text:e,hoverClass:t,className:n,title:r}){let i=(0,Z.useRef)(null),[a,o]=(0,Z.useState)(0);return(0,Z.useEffect)(()=>{let e=i.current;if(!e)return;let t=()=>o(Math.max(0,e.scrollWidth-e.clientWidth));t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[e]),(0,X.jsx)(`span`,{className:`block min-w-0 flex-1 overflow-hidden`,children:(0,X.jsx)(`span`,{ref:i,title:r,className:H(`block whitespace-nowrap transition-transform ease-linear`,n,a>0&&t),style:a>0?{"--tail":`-${a}px`,transitionDuration:`${Ga(a)}ms`}:void 0,children:e})})}var qa=null,Ja=new Set;function Ya(e){qa=e,Ja.forEach(t=>t(e))}function Xa(e){return Ja.add(e),qa&&e(qa),()=>Ja.delete(e)}function Za(){qa=null}var Qa={added:{letter:`A`,label:`added`,colourClass:`text-success`},modified:{letter:`M`,label:`modified`,colourClass:`text-fg-secondary`},deleted:{letter:`D`,label:`deleted`,colourClass:`text-interrupted`},renamed:{letter:`R`,label:`renamed`,colourClass:`text-warning`}};function $a(e){return Qa[e]}var eo=[`modified`,`added`,`deleted`,`renamed`];function to(e){let t=new Map;for(let n of e)t.set(n.status,(t.get(n.status)??0)+1);return eo.filter(e=>t.has(e)).map(e=>`${t.get(e)} ${Qa[e].label}`).join(` · `)}var no=[`var(--accent)`,`var(--status-running)`,`var(--status-waiting)`,`var(--ansi-magenta)`,`var(--ansi-cyan)`,`var(--status-interrupted)`];function ro(e){return no[e%no.length]}function io(e){let t=[],n=0,r=0,i=()=>{let e=t.indexOf(null);return e===-1?t.length:e},a=()=>{let e=[];for(let n=0;n<t.length;n++){let r=t[n];r&&e.push({col:n,sha:r.sha,colour:ro(r.colourIdx)})}return e},o=[],s=[];for(let c of e){let e=c.parents??[],l=[];for(let e=0;e<t.length;e++)t[e]?.sha===c.sha&&l.push(e);let u,d;l.length>0?(u=l[0],d=t[u].colourIdx):(u=i(),d=n++);let f=ro(d);for(let e of l)t[e]=null;for(;t.length<=u;)t.push(null);let p=[];if(e.length>0){t[u]={sha:e[0],colourIdx:d},p.push(u);for(let r=1;r<e.length;r++){let a=e[r],o=t.findIndex(e=>e?.sha===a);if(o===-1){for(o=i();t.length<=o;)t.push(null);t[o]={sha:a,colourIdx:n++}}p.push(o)}}else t[u]=null;let m=a();o.push({sha:c.sha,col:u,colour:f,above:s,below:m,created:p}),s=m,r=Math.max(r,t.length)}return{rows:o,laneCount:r}}var ao=7,oo=14,so=4,co=1.5,lo=40,uo=22,fo=`group-hover:[transform:translateX(var(--tail))]`;function po(e){return e*oo+oo/2}function mo(e,t,n,r){if(e===n)return`M ${e} ${t} L ${n} ${r}`;let i=(t+r)/2;return`M ${e} ${t} C ${e} ${i}, ${n} ${i}, ${n} ${r}`}function ho({row:e,width:t}){let n=lo,r=n/2,i=po(e.col),a=new Set(e.created),o=[];for(let t of e.above){let n=po(t.col);t.sha===e.sha?o.push({d:mo(n,0,i,r),colour:t.colour}):o.push({d:mo(n,0,n,r),colour:t.colour})}for(let t of e.below){let e=po(t.col);a.has(t.col)?o.push({d:mo(i,r,e,n),colour:t.colour}):o.push({d:mo(e,r,e,n),colour:t.colour})}return(0,X.jsxs)(`svg`,{width:t,height:n,className:`shrink-0`,"aria-hidden":!0,children:[o.map((e,t)=>(0,X.jsx)(`path`,{d:e.d,fill:`none`,stroke:e.colour,strokeWidth:co},t)),(0,X.jsx)(`circle`,{cx:i,cy:r,r:so,fill:`var(--bg-surface)`,stroke:e.colour,strokeWidth:co})]})}function go({lanes:e,width:t}){return(0,X.jsx)(`svg`,{width:t,height:uo,className:`shrink-0`,"aria-hidden":!0,children:e.map(e=>{let t=po(e.col);return(0,X.jsx)(`path`,{d:`M ${t} 0 L ${t} ${uo}`,fill:`none`,stroke:e.colour,strokeWidth:co},e.col)})})}function _o({session:e,sha:t,root:n,lanes:r,gutterW:i,onOpen:a}){let o=D(e,t,n),s=e=>(0,X.jsxs)(`div`,{className:`flex items-center`,style:{height:uo},children:[(0,X.jsx)(go,{lanes:r,width:i}),(0,X.jsx)(`span`,{className:`px-2 text-2xs text-fg-muted`,children:e})]});return o.isPending?s(`…`):o.error?s(o.error instanceof Error?o.error.message:`Failed to load commit`):o.data.files.length===0?s(`No file changes.`):(0,X.jsx)(X.Fragment,{children:o.data.files.map(e=>{let o=$a(e.status),s=e.status===`renamed`&&e.old_path?`${e.old_path} → ${e.path}`:e.path;return(0,X.jsxs)(`button`,{type:`button`,title:s,onClick:()=>{a(e.path,t),Ya({path:e.path,root:n})},onDoubleClick:()=>a(e.path,t,{preview:!1}),className:`group flex w-full items-center text-left transition-colors hover:bg-elevated`,style:{height:uo},children:[(0,X.jsx)(go,{lanes:r,width:i}),(0,X.jsx)(`span`,{className:H(`mr-1.5 w-3 shrink-0 text-center font-mono text-xs`,o.colourClass),children:o.letter}),(0,X.jsx)(Ka,{text:s,className:`pr-3 text-2xs text-fg`,hoverClass:fo})]},`${e.status}:${e.old_path??``}:${e.path}`)})})}function vo({session:e,root:t,onOpenCommitFile:n}){let r=c(e,{root:t}),[i,a]=(0,Z.useState)(null),o=(0,Z.useMemo)(()=>r.data?.pages.flatMap(e=>e.commits)??[],[r.data]),s=(0,Z.useMemo)(()=>io(o),[o]),l=Math.max(1,s.laneCount)*oo+oo/2;return r.isPending?(0,X.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`Loading history…`}):r.error?(0,X.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:r.error instanceof Error?r.error.message:`Failed to load history`}):o.length===0?(0,X.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No commits yet.`}):(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-2`,children:[s.rows.map((r,s)=>{let c=o[s],u=i===r.sha;return(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>a(u?null:r.sha),className:H(`group flex w-full items-center text-left transition-colors hover:bg-elevated`,u&&`bg-selection`),style:{height:lo},children:[(0,X.jsx)(ho,{row:r,width:l}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5 pr-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-2xs text-fg-muted`,children:r.sha.slice(0,ao)}),(0,X.jsx)(Ka,{text:c.subject,className:`text-xs text-fg`,hoverClass:fo})]}),(0,X.jsxs)(`span`,{className:`truncate text-2xs text-fg-muted`,children:[c.author_name,` ·`,` `,(0,X.jsx)(`span`,{className:`tabular-nums`,children:S(c.authored_at)})]})]})]}),u&&(0,X.jsx)(_o,{session:e,sha:r.sha,root:t,lanes:r.below,gutterW:l,onOpen:n})]},r.sha)}),r.hasNextPage&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>void r.fetchNextPage(),disabled:r.isFetchingNextPage,className:`px-3 py-2 text-left text-xs text-fg-muted transition-colors hover:bg-elevated`,children:r.isFetchingNextPage?`Loading…`:`Show more`})]})}function yo(){return{dirs:new Map,files:[]}}function bo(e){return e.path}function xo(e,t){let n=[];for(let[r,i]of e.dirs){let e=t?`${t}/${r}`:r,a={type:`dir`,name:r,path:e,children:xo(i,e)};for(;a.children.length===1&&a.children[0].type===`dir`;){let e=a.children[0];a={type:`dir`,name:`${a.name}/${e.name}`,path:e.path,children:e.children}}n.push(a)}n.sort((e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`}));let r=[...e.files].sort((e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`}));return[...n,...r]}function So(e){let t=yo();for(let n of e){let e=bo(n),r=e.split(`/`),i=r.pop(),a=t;for(let e of r){let t=a.dirs.get(e);t||(t=yo(),a.dirs.set(e,t)),a=t}a.files.push({type:`file`,name:i,path:e,entry:n})}return xo(t,``)}function Co(e){return e.map(e=>({type:`file`,name:bo(e).split(`/`).pop()??bo(e),path:bo(e),entry:e})).sort((e,t)=>e.path.localeCompare(t.path,void 0,{sensitivity:`base`}))}var wo=`group-hover:[transform:translateX(var(--tail))]`;function To({name:e,fullPath:t,status:n,depth:r,active:i,onOpen:a}){let o=$a(n);return(0,X.jsxs)(`button`,{type:`button`,title:t,onClick:()=>a(t),onDoubleClick:()=>a(t,{preview:!1}),className:H(`group flex w-full items-center gap-1.5 py-1 pr-3 text-left transition-colors hover:bg-elevated`,i&&`bg-selection`),style:{paddingLeft:8+r*12},children:[(0,X.jsx)(`span`,{className:H(`w-3 shrink-0 text-center font-mono text-xs`,o.colourClass),children:o.letter}),(0,X.jsx)(Ka,{text:e,className:`text-xs text-fg`,hoverClass:wo})]})}function Eo({nodes:e,depth:t,activePath:n,onOpen:r}){let[i,a]=(0,Z.useState)(new Set);return(0,X.jsx)(X.Fragment,{children:e.map(e=>{if(e.type===`file`)return(0,X.jsx)(To,{name:e.name,fullPath:e.path,status:e.entry.status,depth:t,active:n===e.path,onOpen:r},e.path);let o=i.has(e.path);return(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>a(t=>{let n=new Set(t);return n.has(e.path)?n.delete(e.path):n.add(e.path),n}),className:`group flex w-full items-center gap-1 py-1 pr-3 text-left transition-colors hover:bg-elevated`,style:{paddingLeft:8+t*12},title:e.path,children:[o?(0,X.jsx)(Ot,{className:`size-3.5 shrink-0 text-fg-gold`}):(0,X.jsx)(Et,{className:`size-3.5 shrink-0 text-fg-gold`}),(0,X.jsx)(Ka,{text:e.name,className:`text-xs text-fg-secondary`,hoverClass:wo})]}),!o&&(0,X.jsx)(Eo,{nodes:e.children,depth:t+1,activePath:n,onOpen:r})]},e.path)})})}function Do({session:e,root:t,activePath:n,onOpen:r}){let[i,a]=(0,Z.useState)(!1),o=u(e,{against:`head`,root:t}),s=o.data?.entries??[],c=(e,n)=>{r(e,n),Ya({path:e,root:t})},l=(0,Z.useMemo)(()=>i?null:So(s),[i,s]),d=(0,Z.useMemo)(()=>i?Co(s):null,[i,s]);return(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,X.jsxs)(`div`,{className:`flex h-7 shrink-0 items-center gap-2 px-3`,children:[(0,X.jsx)(`span`,{className:`text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:`Uncommitted`}),s.length>0&&(0,X.jsx)(`span`,{className:`truncate text-2xs text-fg-muted`,children:to(s)}),(0,X.jsxs)(K,{children:[(0,X.jsx)(G,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"aria-pressed":!i,onClick:()=>a(e=>!e),className:`ml-auto rounded-sm p-1 text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[i?(0,X.jsx)(ir,{className:`size-3.5`}):(0,X.jsx)(er,{className:`size-3.5`}),(0,X.jsx)(`span`,{className:`sr-only`,children:i?`Show as tree`:`Show as flat list`})]})}),(0,X.jsx)(J,{children:i?`Show as tree`:`Show as flat list`})]})]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-1`,children:o.isPending?(0,X.jsx)(`div`,{className:`px-3 py-1.5 text-xs text-fg-muted`,children:`Loading changes…`}):o.error?(0,X.jsx)(`div`,{className:`px-3 py-1.5 text-xs text-fg-muted`,children:o.error instanceof Error?o.error.message:`Failed to load changes`}):s.length===0?(0,X.jsx)(`div`,{className:`px-3 py-1.5 text-xs text-fg-muted`,children:`No uncommitted changes.`}):i?d.map(e=>(0,X.jsx)(To,{name:e.path,fullPath:e.path,status:e.entry.status,depth:0,active:n===e.path,onOpen:c},e.path)):(0,X.jsx)(Eo,{nodes:l,depth:0,activePath:n,onOpen:c})})]})}function Oo({session:e,root:t,activeDiffPath:n,onOpenDiff:r,onOpenCommitFile:i}){let{height:a,handle:o}=Va(`changes-uncommitted`,240,{sized:`above`,min:80});return(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,X.jsx)(`section`,{className:`flex shrink-0 flex-col`,style:{height:a,maxHeight:`70%`},children:(0,X.jsx)(Do,{session:e,root:t,activePath:n,onOpen:r})}),(0,X.jsx)(Ha,{handle:o,label:`Resize the uncommitted changes`}),(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,X.jsx)(`div`,{className:`flex h-7 shrink-0 items-center px-3`,children:(0,X.jsx)(`span`,{className:`text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:`History`})}),(0,X.jsx)(vo,{session:e,root:t,onOpenCommitFile:i})]})]})}function ko(e,t){if(!t)return e;let n=t.endsWith(`/`)?t.slice(0,-1):t;return n===``||n===`/`?e:e===n?`~`:e.startsWith(`${n}/`)?`~${e.slice(n.length)}`:e}function Ao(e,t,n){return e!==null&&e.id===t&&n-e.at<1500}async function jo(e){let t=e.createReader(),n=[];for(;;){let e=await new Promise((e,n)=>t.readEntries(e,n));if(e.length===0)return n;n.push(...e)}}function Mo(e){return new Promise((t,n)=>e.file(t,n))}async function No(e,t,n){if(e.isFile){let r=await Mo(e);n.push(t?new File([r],`${t}/${e.name}`,{type:r.type,lastModified:r.lastModified}):r)}else if(e.isDirectory){let r=await jo(e),i=t?`${t}/${e.name}`:e.name;for(let e of r)await No(e,i,n)}}function Po(e,t,n){let r=Array.from(e??[]).map(e=>({entry:e.webkitGetAsEntry?.()??null,file:e.kind===`file`?e.getAsFile():null})),i=Array.from(t);return(async()=>{if(r.every(({entry:e,file:t})=>e===null&&t===null))return i;if(!n)return r.some(({entry:e})=>e?.isDirectory)&&j.error(`This daemon can't take folders — update it, or zip them first`),r.filter(({entry:e})=>e?.isDirectory!==!0).map(({file:e})=>e).filter(e=>e!==null);let e=[];for(let{entry:t,file:n}of r)t?.isDirectory?await No(t,``,e):n&&e.push(n);return e})()}var Fo={untracked:{letter:`U`,colourClass:`text-success`},added:{letter:`A`,colourClass:`text-success`},modified:{letter:`M`,colourClass:`text-warning`},renamed:{letter:`R`,colourClass:`text-warning`},deleted:{letter:`D`,colourClass:`text-interrupted`},conflicted:{letter:`C`,colourClass:`text-interrupted`},ignored:{letter:``,colourClass:`text-fg-muted`}};function Io(e){return Fo[e]}function Lo(e){let t=new Map;for(let n of e)t.set(n.path,n.status);return t}var Ro={conflicted:0,modified:1,renamed:2,deleted:3,added:4,untracked:5,ignored:6};function zo(e,t){let n=t===``?``:`${t}/`,r=null;for(let[t,i]of e)n!==``&&!t.startsWith(n)||i!==`ignored`&&(r===null||Ro[i]<Ro[r])&&(r=i);return r}function Bo(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function Vo(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function Ho(e){let t=e.split(`/`).filter(e=>e!==``);t.pop();let n=[];for(let e of t)n.push(Wo(n[n.length-1]??``,e));return n}function Uo(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n<=0?`/`:t.slice(0,n)}function Wo(e,t){return e===``?t:`${e}/${t}`}function Go(e){let t=new Set(e);return e.filter(e=>{if(e===``)return!0;for(let n=Vo(e);;n=Vo(n)){if(t.has(n))return!1;if(n===``)return!0}})}var Ko=`application/x-puddle-paths`;function qo(e){return JSON.stringify(e)}function Jo(e){try{let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function Yo(e,t){let n=[],r=(i,a)=>{let o=e(i);if(o)for(let e of o.entries){let o=Wo(i,e.name);n.push({path:o,name:e.name,type:e.type,depth:a,parentDir:i}),e.type===`dir`&&t.has(o)&&r(o,a+1)}};return r(``,0),n}function Xo(e,t,n){let r=e.findIndex(e=>e.path===t),i=e.findIndex(e=>e.path===n);if(r===-1||i===-1)return n?[n]:[];let[a,o]=r<=i?[r,i]:[i,r];return e.slice(a,o+1).map(e=>e.path)}var Zo=(e,t)=>e instanceof Error?e.message:t;function Qo(e,t){let n=i(),r=(0,Z.useCallback)(()=>{n.invalidateQueries({queryKey:[`wt-tree`,e]}),n.invalidateQueries({queryKey:[`wt-git-status`,e]})},[n,e]);return(0,Z.useMemo)(()=>({async create(n,i,a){try{let o=await E(e,Wo(n,i),a,t);return r(),o.path}catch(e){return j.error(Zo(e,`Couldn't create ${i}`)),null}},async rename(n,i){let a=Wo(n.includes(`/`)?n.slice(0,n.lastIndexOf(`/`)):``,i);try{let i=await O(e,n,a,t);return r(),i.path}catch(e){return j.error(Zo(e,`Couldn't rename ${Bo(n)}`)),null}},async move(n,i){let a=await Promise.allSettled(n.map(n=>O(e,n,Wo(i,Bo(n)),t)));r();let o=a.filter(e=>e.status===`rejected`);o.length>0&&j.error(n.length===1?Zo(o[0].reason,`Couldn't move ${Bo(n[0])}`):`Couldn't move ${o.length} item${o.length>1?`s`:``}`)},async remove(n){let i=await Promise.allSettled(n.map(n=>k(e,n,t)));r();let a=i.filter(e=>e.status===`rejected`).length;a>0?j.error(`Couldn't delete ${a} item${a>1?`s`:``}`):j.success(n.length===1?`Deleted ${Bo(n[0])}`:`Deleted ${n.length} items`)},async paste(n,i){let a=n.mode===`cut`?O:p,o=await Promise.allSettled(n.paths.map(n=>a(e,n,Wo(i,Bo(n)),t)));r();let s=o.filter(e=>e.status===`rejected`).length;s>0&&j.error(`Couldn't paste ${s} item${s>1?`s`:``}`)}}),[e,t,r])}function $o(e,t,n){return n&&n.type!==`dir`||(e.includes(`/`)?e.slice(0,e.lastIndexOf(`/`)):``)===t?!1:t===``||!`${t}/`.startsWith(`${e}/`)}var es=(0,Z.createContext)(null);function ts(){let e=(0,Z.useContext)(es);if(!e)throw Error(`explorer components must render inside <ExplorerProvider>`);return e}function ns(){return(0,Z.useContext)(es)}function rs({session:e,root:t,readOnly:n=!1,onOpenFile:r,onOpenTerminal:a,activePath:o,children:s}){let c=e.id,u=i(),d=Qo(c,t),f=t??e.worktree_path,p=(0,Z.useCallback)(e=>t===void 0?[`wt-tree`,c,e]:[`wt-tree`,c,e,t],[c,t]),h=(0,Z.useCallback)((e,r)=>{r.length===0||n||l(c,e,r,t).then(()=>{u.invalidateQueries({queryKey:p(e)}),u.invalidateQueries({queryKey:[`wt-git-status`,c]}),j.success(r.length===1?`Uploaded ${r[0].name}`:`Uploaded ${r.length} files`)}).catch(e=>j.error(e instanceof Error?e.message:`Upload failed`))},[c,t,n,u,p]),g=ye().data?.protocol,_=!g||g.major>9||g.major===9&&g.minor>=2,v=(0,Z.useCallback)((e,t,n)=>{Po(t,n,_).then(t=>h(e,t)).catch(e=>j.error(e instanceof Error?e.message:`Couldn't read the dropped folder`))},[h,_]),[y,x]=(0,Z.useState)(new Set),[S,C]=(0,Z.useState)(new Set),[w,T]=(0,Z.useState)(null),[E,D]=(0,Z.useState)(null),[O,k]=(0,Z.useState)(null),[A,ee]=(0,Z.useState)(null),[te,M]=(0,Z.useState)(null),N=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{let e=()=>ee(null);return window.addEventListener(`dragend`,e),()=>window.removeEventListener(`dragend`,e)},[]);let P=b(c,{enabled:t===void 0}),ne=(0,Z.useMemo)(()=>Lo(P.data?.entries??[]),[P.data]),[re,ie]=(0,Z.useState)(0);(0,Z.useEffect)(()=>u.getQueryCache().subscribe(e=>{if(e.type!==`added`&&e.type!==`removed`&&e.type!==`updated`)return;let t=e.query.queryKey;Array.isArray(t)&&t[0]===`wt-tree`&&t[1]===c&&ie(e=>e+1)}),[u,c]);let F=(0,Z.useMemo)(()=>Yo(e=>u.getQueryData(p(e)),y),[u,p,y,re]),ae=(0,Z.useCallback)(e=>{x(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),I=(0,Z.useCallback)(e=>{x(t=>t.has(e)?t:new Set(t).add(e))},[]),oe=(0,Z.useCallback)(()=>x(new Set),[]),[L,se]=(0,Z.useState)(null);(0,Z.useEffect)(()=>Xa(e=>{if(e.root===t){Za();for(let t of Ho(e.path))I(t);C(new Set([e.path])),T(e.path),se(e.path)}}),[t,I]),(0,Z.useEffect)(()=>{if(L===null)return;let e=document.querySelector(`[data-explorer-root] [data-path="${CSS.escape(L)}"]`);if(e){e.scrollIntoView({block:`nearest`}),se(null);return}let t=window.setTimeout(()=>se(null),4e3);return()=>window.clearTimeout(t)},[L,F]);let R=(0,Z.useRef)(null),ce=(0,Z.useRef)(null),le=(0,Z.useCallback)(()=>{R.current!==null&&(window.clearTimeout(R.current),R.current=null)},[]);(0,Z.useEffect)(()=>le,[le]);let ue=(0,Z.useCallback)((e,t)=>{if(le(),T(e.path),t.metaKey||t.ctrlKey){C(t=>{let n=new Set(t);return n.has(e.path)?n.delete(e.path):n.add(e.path),n}),N.current=e.path;return}if(t.shiftKey&&N.current){C(new Set(Xo(F,N.current,e.path)));return}let i=Date.now(),a=ce.current;if(ce.current={id:e.path,at:i},e.type!==`dir`&&!n&&!O&&S.size===1&&S.has(e.path)&&Ao(a,e.path,i)){R.current=window.setTimeout(()=>{R.current=null,k({mode:`rename`,path:e.path})},500);return}C(new Set([e.path])),N.current=e.path,e.type===`dir`?ae(e.path):r?.(c,e.path)},[F,ae,r,c,S,O,n,le]),z=(0,Z.useCallback)(e=>{le(),e.type!==`dir`&&r?.(c,e.path,{preview:!1})},[r,c,le]),de=(0,Z.useCallback)(e=>{C(new Set([e])),T(e),N.current=e},[]),fe=(0,Z.useCallback)(e=>D({paths:Go(e),mode:`cut`}),[]),pe=(0,Z.useCallback)(e=>D({paths:Go(e),mode:`copy`}),[]),me=(0,Z.useCallback)(e=>{!E||n||d.paste(E,e).then(()=>{E.mode===`cut`&&D(null)})},[E,d,n]),he=(0,Z.useCallback)(e=>{n||k({mode:`rename`,path:e})},[n]),B=(0,Z.useCallback)((e,t)=>{n||(e!==``&&I(e),k({mode:`create`,parentDir:e,kind:t}))},[I,n]),ge=(0,Z.useCallback)(()=>k(null),[]),_e=(0,Z.useCallback)(e=>{let t=e.trim(),n=O;if(k(null),!(!n||t===``))if(n.mode===`rename`){if(t===Bo(n.path))return;d.rename(n.path,t)}else d.create(n.parentDir,t,n.kind).then(e=>{e&&n.kind===`file`&&r?.(c,e)})},[O,d,r,c]),ve=(0,Z.useCallback)(e=>{if(n)return;let t=Go(e);t.length>0&&M(t)},[n]),V=(0,Z.useCallback)(()=>{let e=te;M(null),e&&d.remove(e)},[te,d]),be=(0,Z.useCallback)(()=>M(null),[]),xe=(0,Z.useCallback)((e,t)=>{let n=e.map(e=>t?e:Wo(f,e)).join(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PaneEditorBody-DGqg_4uR.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/jsx-runtime-ffCh33zF.js","assets/hotkeys-BrRVXikm.js","assets/api-BJeOJuGe.js","assets/editor-context-Cz5G4UVr.js","assets/preload-helper-Czpn1I53.js","assets/createLucideIcon-DyMAgLa3.js","assets/index-IEQHp8h9.js","assets/dialog-B43iKmfK.js","assets/utils-B6KiDbIe.js","assets/LazyTerminal-Cv4MivyB.js","assets/index-ChpBP8Zc.css","assets/editor.api2-4X9Vh9Zw.js","assets/editor-Br_kD0ds.css","assets/buffer-store-bK5Xpj6d.js","assets/buffer-logic-BrpRsL1b.js","assets/editor-sync-Cc36ZLyi.js","assets/PaneEditorBody-Dz-67XSV.css","assets/ModelRefcount-MJz59mka.js","assets/EditorTabClose-fAutR9L2.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{n,t as r}from"./jsx-runtime-ffCh33zF.js";import{C as i,_ as a,f as o,l as s}from"./hotkeys-BrRVXikm.js";import{A as c,C as l,D as u,M as d,S as f,_ as p,b as m,c as h,g,h as _,i as v,j as y,k as b,l as x,p as S,r as C,s as w,t as T,v as E,w as D,x as O,y as k}from"./editor-context-Cz5G4UVr.js";import{t as A}from"./preload-helper-Czpn1I53.js";import{S as j,c as ee,l as te,n as M,t as N,y as P}from"./api-BJeOJuGe.js";import{A as ne,O as re,_ as ie,a as F,b as ae,g as I,h as oe,i as L,j as se,n as R,o as ce,r as le,t as ue,w as z}from"./dialog-B43iKmfK.js";import{$ as de,D as fe,H as pe,J as me,K as he,L as B,N as ge,P as _e,Q as ve,T as ye,U as V,X as be,Y as xe,Z as Se,a as Ce,ct as we,et as Te,f as Ee,ft as De,g as Oe,h as ke,i as Ae,it as je,l as Me,m as Ne,n as Pe,nt as Fe,o as Ie,ot as Le,pt as Re,r as ze,rt as Be,st as Ve,t as He,w as Ue}from"./LazyTerminal-Cv4MivyB.js";import{t as H}from"./utils-B6KiDbIe.js";import{t as U}from"./createLucideIcon-DyMAgLa3.js";import{A as We,C as Ge,D as Ke,E as qe,M as Je,O as Ye,S as Xe,T as Ze,_ as Qe,a as $e,b as et,c as tt,d as nt,f as rt,g as it,h as at,i as ot,j as st,k as ct,l as lt,m as ut,n as dt,o as ft,p as pt,r as W,s as mt,t as ht,u as gt,v as _t,w as vt,x as yt,y as bt}from"./context-menu-CLWmCX87.js";import{a as xt,i as St,n as Ct,o as wt,r as Tt,s as Et,t as Dt}from"./session-seed-mKf0bRzJ.js";import{r as Ot}from"./dist-i-QevsUb.js";import{A as kt,At as G,Bt as At,C as jt,D as Mt,Dt as Nt,E as Pt,Et as Ft,F as It,I as Lt,J as Rt,L as zt,M as Bt,O as Vt,Ot as K,Rt as Ht,S as Ut,T as Wt,Tt as Gt,X as Kt,Y as qt,_ as Jt,b as Yt,bt as Xt,c as Zt,ct as Qt,d as $t,f as en,ft as tn,g as nn,h as rn,i as an,j as q,k as on,kt as J,l as sn,m as cn,n as ln,o as un,ot as dn,p as fn,pt as pn,q as mn,rt as hn,s as gn,st as _n,t as vn,tt as yn,u as bn,ut as xn,v as Sn,vt as Cn,w as wn,x as Tn,xt as En,y as Dn,yt as On,z as kn,zt as An}from"./index-IEQHp8h9.js";import{i as jn}from"./buffer-logic-BrpRsL1b.js";import{t as Mn}from"./ssh-mode-DFHbi7WV.js";var Nn=U(`arrow-right-left`,[[`path`,{d:`m16 3 4 4-4 4`,key:`1x1c3m`}],[`path`,{d:`M20 7H4`,key:`zbl0bi`}],[`path`,{d:`m8 21-4-4 4-4`,key:`h9nckh`}],[`path`,{d:`M4 17h16`,key:`g4d7ey`}]]),Pn=U(`case-sensitive`,[[`path`,{d:`m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16`,key:`d5nyq2`}],[`path`,{d:`M22 9v7`,key:`pvm9v3`}],[`path`,{d:`M3.304 13h6.392`,key:`1q3zxz`}],[`circle`,{cx:`18.5`,cy:`12.5`,r:`3.5`,key:`z97x68`}]]),Fn=U(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),In=U(`ellipsis`,[[`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`}]]),Ln=U(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]),Rn=U(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),zn=U(`eye`,[[`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`}]]),Bn=U(`file-archive`,[[`path`,{d:`M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5`,key:`4pqfef`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 12v-1`,key:`1ej8lb`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`path`,{d:`M8 7V6`,key:`1nbb54`}],[`circle`,{cx:`8`,cy:`20`,r:`2`,key:`ckkr5m`}]]),Vn=U(`file-braces`,[[`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 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),Y=U(`file-code`,[[`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`}]]),Hn=U(`file-cog`,[[`path`,{d:`M15 8a1 1 0 0 1-1-1V2a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8z`,key:`1ckgky`}],[`path`,{d:`M20 8v12a2 2 0 0 1-2 2h-4.182`,key:`1726p0`}],[`path`,{d:`m3.305 19.53.923-.382`,key:`ao1pio`}],[`path`,{d:`M4 10.592V4a2 2 0 0 1 2-2h8`,key:`1foop0`}],[`path`,{d:`m4.228 16.852-.924-.383`,key:`1fv9zy`}],[`path`,{d:`m5.852 15.228-.383-.923`,key:`1a9hc2`}],[`path`,{d:`m5.852 20.772-.383.924`,key:`1sh9ke`}],[`path`,{d:`m8.148 15.228.383-.923`,key:`4yu6lf`}],[`path`,{d:`m8.53 21.696-.382-.924`,key:`18b0s9`}],[`path`,{d:`m9.773 16.852.922-.383`,key:`ti6xop`}],[`path`,{d:`m9.773 19.148.922.383`,key:`rws47d`}],[`circle`,{cx:`7`,cy:`18`,r:`3`,key:`lvkj7j`}]]),Un=U(`file-headphone`,[[`path`,{d:`M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343`,key:`1vfytu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0`,key:`1etmh7`}]]),Wn=U(`file-image`,[[`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`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),Gn=U(`file-key`,[[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M4 12v6`,key:`bg1pfk`}],[`path`,{d:`M4 14h2`,key:`1sf9f8`}],[`path`,{d:`M9.65 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v4`,key:`d56i0q`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),Kn=U(`file-lock`,[[`path`,{d:`M4 9.8V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3`,key:`1432pc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 17v-2a2 2 0 0 0-4 0v2`,key:`168m41`}],[`rect`,{width:`8`,height:`5`,x:`3`,y:`17`,rx:`1`,key:`o8vfew`}]]),qn=U(`file-play`,[[`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:`M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z`,key:`1tzo1f`}]]),Jn=U(`file-spreadsheet`,[[`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:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]),Yn=U(`file-terminal`,[[`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:`m8 16 2-2-2-2`,key:`10vzyd`}],[`path`,{d:`M12 18h4`,key:`1wd2n7`}]]),Xn=U(`file-text`,[[`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 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Zn=U(`file-type`,[[`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:`M11 18h2`,key:`12mj7e`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5`,key:`qbrxap`}]]),Qn=U(`file`,[[`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`}]]),$n=U(`folder-closed`,[[`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`}],[`path`,{d:`M2 10h20`,key:`1ir3d8`}]]),er=U(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),tr=U(`folder-x`,[[`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`}],[`path`,{d:`m9.5 10.5 5 5`,key:`ra9qjz`}],[`path`,{d:`m14.5 10.5-5 5`,key:`l2rkpq`}]]),nr=U(`git-branch`,[[`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`}]]),rr=U(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),ir=U(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),ar=U(`panel-left-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),or=U(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),sr=U(`panel-right-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]),cr=U(`panel-right-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),lr=U(`pin`,[[`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`}]]),ur=U(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),dr=U(`regex`,[[`path`,{d:`M17 3v10`,key:`15fgeh`}],[`path`,{d:`m12.67 5.5 8.66 5`,key:`1gpheq`}],[`path`,{d:`m12.67 10.5 8.66-5`,key:`1dkfa6`}],[`path`,{d:`M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z`,key:`swwfx4`}]]),fr=U(`shield-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),pr=U(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),mr=U(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),hr=U(`user-round-cog`,[[`path`,{d:`m14.305 19.53.923-.382`,key:`3m78fa`}],[`path`,{d:`m15.228 16.852-.923-.383`,key:`npixar`}],[`path`,{d:`m16.852 15.228-.383-.923`,key:`5xggr7`}],[`path`,{d:`m16.852 20.772-.383.924`,key:`dpfhf9`}],[`path`,{d:`m19.148 15.228.383-.923`,key:`1reyyz`}],[`path`,{d:`m19.53 21.696-.382-.924`,key:`1goivc`}],[`path`,{d:`M2 21a8 8 0 0 1 10.434-7.62`,key:`1yezr2`}],[`path`,{d:`m20.772 16.852.924-.383`,key:`htqkph`}],[`path`,{d:`m20.772 19.148.924.383`,key:`9w9pjp`}],[`circle`,{cx:`10`,cy:`8`,r:`5`,key:`o932ke`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),gr=U(`whole-word`,[[`circle`,{cx:`7`,cy:`12`,r:`3`,key:`12clwm`}],[`path`,{d:`M10 9v6`,key:`17i7lo`}],[`circle`,{cx:`17`,cy:`12`,r:`3`,key:`gl7c2s`}],[`path`,{d:`M14 7v8`,key:`dl84cr`}],[`path`,{d:`M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1`,key:`lt2kga`}]]),X=r(),Z=e(t(),1);function _r(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function vr(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function yr(e){return e/100*window.innerHeight}function br(e){return e/100*window.innerWidth}function xr(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 Sr({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=xr(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=vr(t,i);break;case`em`:r=_r(t,i);break;case`vh`:r=yr(i);break;case`vw`:r=br(i);break}return r}function Cr(e){return parseFloat(e.toFixed(3))}function wr({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 Tr(e){let{panels:t}=e,n=wr({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=Cr(Sr({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=Cr(Sr({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=Cr(Sr({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=Cr(Sr({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 Q(e,t=`Assertion error`){if(!e)throw Error(t)}function Er(e,t){return Array.from(t).sort(e===`horizontal`?Dr:Or)}function Dr(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function Or(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function kr(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Ar(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 jr({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}=Ar(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return Q(i,`No rect found`),i}var Mr;function Nr(){return Mr===void 0&&(Mr=typeof matchMedia==`function`&&!!matchMedia(`(pointer:coarse)`).matches),Mr}function Pr(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Er(n,Array.from(t.children).filter(kr).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,jr({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p;break}}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=Nr()?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:wr({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 Fr=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)}}},Ir={cursorFlags:0,state:`inactive`},Lr=new Fr;function Rr(){return Ir}function zr(e){return Lr.addListener(`change`,e)}function Br(e){let t=Ir,n={...Ir};n.cursorFlags=e,Ir=n,Lr.emit(`change`,{prev:t,next:n})}function Vr(e){let t=Ir;Ir=e,Lr.emit(`change`,{prev:t,next:e})}var Hr=e=>e,Ur=()=>{},Wr=1,Gr=2,Kr=4,qr=8,Jr=3,Yr=12,Xr;function Zr(){return Xr===void 0&&(Xr=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(Xr=!0)),Xr}function Qr({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++;break}})}if(!(r===0&&i===0)){switch(n){case`active`:if(e&&Zr()){let t=(e&Wr)!==0,n=(e&Gr)!==0,r=(e&Kr)!==0,i=(e&qr)!==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`}break}return Zr()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var $r=new WeakMap;function ei(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=$r.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=Rr();switch(r.state){case`active`:case`hover`:{let e=Qr({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);break}$r.set(e,{prevStyle:t,styleSheet:n})}var ti=new Map,ni=new Fr;function ri(e){ti=new Map(ti),ti.delete(e)}function ii(e,t){for(let[t]of ti)if(t.id===e)return t}function ai(e,t){for(let[t,n]of ti)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function oi(){return ti}function si(e,t){return ni.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function ci(e,t,n){let r=ti.get(e);ti=new Map(ti),ti.set(e,t),ni.emit(`groupChange`,{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:r,next:t})}function li(e){let t=Rr(),n=!1;switch(t.state){case`active`:Vr({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(ei(e),n=!0,t.hitRegions.forEach(e=>{let t=ai(e.group.id,!0);ci(e.group,t,{isUserInteraction:!0})}))}return n}function ui(e){e.defaultPrevented||li(e.currentTarget)}function di(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Ar(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);break}}return r?{distance:i,hitRegion:r}:void 0}function fi(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function pi(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:yi(e),b:yi(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();Q(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:vi(_i(n.a)),b:vi(_i(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 mi=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function hi(e){let t=getComputedStyle(bi(e)??e).display;return t===`flex`||t===`inline-flex`}function gi(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||hi(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`||mi.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function _i(e){let t=e.length;for(;t--;){let n=e[t];if(Q(n,`Missing node`),gi(n))return n}return null}function vi(e){return e&&Number(getComputedStyle(e).zIndex)||0}function yi(e){let t=[];for(;e;)t.push(e),e=bi(e);return t}function bi(e){let{parentNode:t}=e;return fi(t)?t.host:t}function xi(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 Si({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!kr(n)||n.contains(e)||e.contains(n))return!0;if(pi(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(xi(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Ci(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Pr(r),a=di(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Si({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function wi(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 Ti(e,t,n=0){return Math.abs(Cr(e)-Cr(t))<=n}function Ei(e,t){return Ti(e,t)?0:e>t?1:-1}function Di({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(Ei(r,c)<0)if(a){let e=(i+c)/2;r=Ei(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=Cr(r),r}function Oi({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Ti(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;Q(u!=null,`Invalid first pivot index`),Q(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];Q(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(Q(n!=null,`Previous layout not found for panel index ${t}`),Ti(n,i)){let t=o-n;Ei(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];Q(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(Q(n!=null,`Previous layout not found for panel index ${t}`),Ti(n,o)){let t=n-i;Ei(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];Q(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&Ei(i,c)<0)if(e>0){let t=c-o,n=t/2;Ei(i+e,c)<0&&(e=Ei(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;Ei(i-e,c)<0&&(e=Ei(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];Q(e!=null,`Previous layout not found for panel index ${r}`);let a=Di({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];Q(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=Di({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Ti(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(wi(c,l))return i;{let t=e<0?d:u,r=s[t];Q(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=Di({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Ti(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];Q(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=Di({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Ti(i,s)||(t-=s-i,l[r]=s),Ti(t,0))break;e>0?r--:r++}}}if(!Ti(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 ki(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||Ei(e[n],t[n])!==0)return!1;return!0}function Ai({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(!Ti(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];Q(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];Q(i!=null,`No layout data found for index ${e}`);let o=r[e];Q(o!=null,`No layout data found for index ${e}`);let s=Di({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Ti(a,0))for(let e=0;e<t.length;e++){let n=r[e];Q(n!=null,`No layout data found for index ${e}`);let i=n+a,o=Di({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Ti(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function ji({groupId:e,panelId:t}){let n=()=>{let t=oi();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&&Ti(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:Cr(100-e)}}return Oi({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=Ai({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});ki(c,u)||ci(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&&Ti(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=wr({group:t}),o=Cr(Sr({groupSize:a,panelElement:r,styleProp:e})/a*100);s(o)}}}function Mi(e){e.defaultPrevented||Ci(e,oi()).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=ji({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function Ni(e){let t=oi();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 Pi({groupId:e}){let t=()=>{let t=oi();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=Ai({layout:e,panelConstraints:r});return n?o:(ki(o,c)||ci(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function Fi(e,t){let n=Ni(e),r=ai(n.id,!0),i=n.separators.find(t=>t.element===e);Q(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);Q(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=Pi({groupId:n.id}).getLayout(),c=Ai({layout:Oi({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});ki(s,c)||ci(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function Ii(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Ni(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Fi(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Fi(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Fi(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Fi(t,-5);break;case`End`:e.preventDefault(),Fi(t,100);break;case`Enter`:{e.preventDefault();let n=Ni(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=ai(n.id,!0),o=n.separators.find(e=>e.element===t);Q(o,`Matching separator not found`);let s=a.get(o);Q(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(Q(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Fi(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=Ni(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);Q(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(),Fi(t,-100);break}}function Li(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=oi(),n=Ci(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)}),Vr({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}function Ri({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=Oi({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(ki(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?Wr:Gr;break;case`vertical`:s|=d<0?Kr:qr;break}}else ci(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&Jr:c|=s&Jr,t.movementY===0?c|=o&Yr:c|=s&Yr,Br(c),ei(e)}function zi(e){let t=oi(),n=Rr();switch(n.state){case`active`:Ri({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Bi(e){if(e.defaultPrevented)return;let t=Rr(),n=oi();switch(t.state){case`active`:if(e.buttons===0){Vr({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=ai(e.group.id,!0);ci(e.group,t,{isUserInteraction:!0})});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}Ri({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Ci(e,n);r.length===0?t.state!==`inactive`&&Vr({cursorFlags:0,state:`inactive`}):Vr({cursorFlags:0,hitRegions:r,state:`hover`}),ei(e.currentTarget);break}}}function Vi(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Rr().state){case`hover`:Vr({cursorFlags:0,state:`inactive`})}}function Hi(e){e.defaultPrevented||e.pointerType===`mouse`&&e.button>0||li(e.currentTarget)&&e.preventDefault()}function Ui(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=Cr(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=Cr((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Wi(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=wr({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:Cr(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Gi(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 Ki({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=Cr(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e;break}}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]=Cr((r[e]??0)/a*l);else{let e=Cr(l/c.length);for(let t of c)u[t]=e}return u}function qi(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 Ji=new Map;function Yi(e){let t=!0;Q(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=wr({group:e});if(t===0)return;let n=ai(e.id);if(!n)return;let r=Tr(e),i=n.defaultLayoutDeferred?Ui(r):n.layout,a=Ai({layout:Ki({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&ki(n.layout,a)&&Gi(n.derivedPanelConstraints,r)&&n.groupSize===t)return;ci(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Wi(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{Q(!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=wr({group:e}),s=Tr(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(qi(e.panels,l)||(l=void 0));let u=Ai({layout:e.mutableState.layouts[c]??l??Ui(s),panelConstraints:s}),d=e.element.ownerDocument;Ji.set(d,(Ji.get(d)??0)+1);let f=new Map;return Pr(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),ci(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{Q(!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`,Ii)}),Ji.get(d)===1&&(d.addEventListener(`contextmenu`,ui,!0),d.addEventListener(`dblclick`,Mi,!0),d.addEventListener(`pointerdown`,Li,!0),d.addEventListener(`pointerleave`,zi),d.addEventListener(`pointermove`,Bi),d.addEventListener(`pointerout`,Vi),d.addEventListener(`pointerup`,Hi,!0)),function(){t=!1,Ji.set(d,Math.max(0,(Ji.get(d)??0)-1)),ri(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,Ii)}),Ji.get(d)||(d.removeEventListener(`contextmenu`,ui,!0),d.removeEventListener(`dblclick`,Mi,!0),d.removeEventListener(`pointerdown`,Li,!0),d.removeEventListener(`pointerleave`,zi),d.removeEventListener(`pointermove`,Bi),d.removeEventListener(`pointerout`,Vi),d.removeEventListener(`pointerup`,Hi,!0)),a.disconnect()}}function Xi(){let[e,t]=(0,Z.useState)({});return[e,(0,Z.useCallback)(()=>t({}),[])]}function Zi(e){let t=(0,Z.useId)();return`${e??t}`}var Qi=typeof window<`u`?Z.useLayoutEffect:Z.useEffect;function $i(e){let t=(0,Z.useRef)(e);return Qi(()=>{t.current=e},[e]),(0,Z.useCallback)((...e)=>t.current?.(...e),[t])}function ea(...e){return $i(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function ta(e){let t=(0,Z.useRef)({...e});return Qi(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var na=(0,Z.createContext)(null);function ra(e,t){let n=(0,Z.useRef)({getLayout:()=>({}),setLayout:Hr});(0,Z.useImperativeHandle)(t,()=>n.current,[]),Qi(()=>{Object.assign(n.current,Pi({groupId:e}))})}function ia({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,Z.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=$i(e=>{ki(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=$i((e,t)=>{ki(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e,{isUserInteraction:t}))}),_=Zi(s),v=(0,Z.useRef)(null),[y,b]=Xi(),x=(0,Z.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=ea(v,a);ra(_,o);let C=$i((e,t)=>{let r=Rr(),i=ii(e),a=ai(e);if(a){let e=!1;switch(r.state){case`active`:e=r.hitRegions.some(e=>e.group===i);break}return{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),w=ta({defaultLayout:n,disableCursor:r}),T=(0,Z.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=Er(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Er(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=ii(_),i=ai(_);r&&i&&ci(r,{...i,derivedPanelConstraints:Tr(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,Z.useRef)(null);return Qi(()=>{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=Yi(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=ai(r.id,!0);!o&&s.length>0&&(h(c),g(c,!1));let l=si(_,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=Ti(t.collapsedSize,i[t.panelId]),a=Ti(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=Rr().state!==`active`;h(i),o&&g(i,e.isUserInteraction)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,Z.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,X.jsx)(na.Provider,{value:T,children:(0,X.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})})}ia.displayName=`Group`;function aa(){let e=(0,Z.useContext)(na);return Q(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function oa(e,t){let{id:n}=aa(),r=(0,Z.useRef)({collapse:Ur,expand:Ur,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Ur});(0,Z.useImperativeHandle)(t,()=>r.current,[]),Qi(()=>{Object.assign(r.current,ji({groupId:n,panelId:e}))})}function sa({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=Zi(c),_=ta({disabled:a}),v=(0,Z.useRef)(null),y=ea(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=aa(),T=d!==null,E=$i((e,t,n)=>{d?.(e,c,n)});Qi(()=>{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,Z.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),oa(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Z.useSyncExternalStore)(e=>si(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,X.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...ca,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...k},children:(0,X.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}sa.displayName=`Panel`;var ca={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function la({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=Ai({layout:Oi({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Ai({layout:Oi({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function ua({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Zi(a),l=ta({disabled:n,disableDoubleClick:r}),[u,d]=(0,Z.useState)({}),[f,p]=(0,Z.useState)(`inactive`),[m,h]=(0,Z.useState)(!1),g=(0,Z.useRef)(null),_=ea(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=aa(),C=b===`horizontal`?`vertical`:`horizontal`;Qi(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=zr(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=si(y,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);d(la({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[y,c,x,l]),(0,Z.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,X.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})}ua.displayName=`Separator`;function da({request:e,targetSession:t,targetRoot:n,targetLabel:r,profileId:i,onClose:a,onSaved:o}){let[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(null),[d,p]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{e&&(c(e.name),u(null))},[e]);let m=async()=>{if(!e||!t)return;let a=s.trim().replace(/^\/+/,``).replace(/\/+$/,``);if(a===``){u(`Give the file a path.`);return}p(!0),u(null);try{let s=!0;try{await M(`GET`,`/api/worktrees/${t.id}/file?path=${encodeURIComponent(a)}${f(n)}`)}catch(e){if(e instanceof N&&e.status===404)s=!1;else if(e instanceof N&&e.status===413)s=!0;else throw e}if(s){u(`${a} already exists in ${r}.`);return}await M(`PUT`,`/api/worktrees/${t.id}/file?path=${encodeURIComponent(a)}${f(n)}`,{content:e.content}),i!==void 0&&await x(i,e.name).catch(()=>void 0),v(e.name),o(e.name,t.id,a,n)}catch(e){u(e instanceof Error?e.message:`Save failed`)}finally{p(!1)}};return(0,X.jsx)(ue,{open:e!==null,onOpenChange:e=>!e&&a(),children:(0,X.jsxs)(R,{children:[(0,X.jsxs)(F,{children:[(0,X.jsx)(ce,{children:`Save draft into the worktree`}),(0,X.jsx)(le,{children:t?(0,X.jsxs)(X.Fragment,{children:[`Saves into `,(0,X.jsx)(`span`,{className:`text-fg-secondary`,children:r}),` — what the sidebar is bound to.`]}):`No worktree is bound — open or focus a session first.`})]}),(0,X.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),m()},children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(Ve,{htmlFor:`untitled-path`,children:`Worktree-relative path`}),(0,X.jsx)(we,{id:`untitled-path`,placeholder:`docs/notes.md`,value:s,onChange:e=>c(e.target.value),autoFocus:!0})]}),l&&(0,X.jsx)(`p`,{className:`text-xs text-danger`,children:l}),(0,X.jsxs)(L,{children:[(0,X.jsx)(I,{type:`button`,variant:`ghost`,onClick:a,children:`Cancel`}),(0,X.jsx)(I,{type:`submit`,disabled:d||!t,children:`Save`})]})]})]})})}function fa(e){return{id:ee,project_id:e.projectId,account_id:null,worktree_path:e.path,base_branch:e.defaultBranch,branch:e.defaultBranch,separate_branch:!1,kind:`terminal`,agent_type:null,agent_session_ref:null,title:e.name,status:`exited`,skip_permissions:!1,created_at:`1970-01-01T00:00:00.000Z`,updated_at:`1970-01-01T00:00:00.000Z`,last_activity_at:null}}function pa(e,t,n,r=null){let i=n.snapshot.explorer_pin,a=i===null?null:e.find(e=>e.id===i&&e.status!==`archived`)??null,o=a??e.find(e=>e.id===t)??null,s=o===null&&r!==null;return{session:s?fa(r):o,root:s?r.path:void 0,isProjectDirectory:s,pinned:a!==null,pin(e){n.update({explorer_pin:e})},unpin(){n.update({explorer_pin:null})}}}function ma(e,t,n){return!e||e.major>t||e.major===t&&e.minor>=n}var ha=e=>ma(e,10,3),ga=e=>ma(e,12,4),_a=null,va=null;async function ya(){let[e,t]=await Promise.all([A(()=>import(`./PaneEditorBody-DGqg_4uR.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])),A(()=>import(`./ModelRefcount-MJz59mka.js`),__vite__mapDeps([20,1,2,16,7,9,3,4,5,10,11,8,12,13,14,15,17]))]);_a=e.PaneEditorBody,va=t.ModelRefcount}var ba=(0,Z.lazy)(()=>A(()=>import(`./PaneEditorBody-DGqg_4uR.js`).then(e=>({default:e.PaneEditorBody})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])));function xa(e){return _a?(0,X.jsx)(_a,{...e}):(0,X.jsx)(Z.Suspense,{fallback:(0,X.jsx)(`div`,{className:`flex h-full items-center justify-center bg-ground text-xs text-fg-muted`,children:`Loading editor…`}),children:(0,X.jsx)(ba,{...e})})}var Sa=(0,Z.lazy)(()=>A(()=>import(`./ModelRefcount-MJz59mka.js`).then(e=>({default:e.ModelRefcount})),__vite__mapDeps([20,1,2,16,7,9,3,4,5,10,11,8,12,13,14,15,17])));function Ca({buffers:e}){return va?(0,X.jsx)(va,{buffers:e}):(0,X.jsx)(Z.Suspense,{fallback:null,children:(0,X.jsx)(Sa,{buffers:e})})}var wa=(0,Z.lazy)(()=>A(()=>import(`./EditorTabClose-fAutR9L2.js`).then(e=>({default:e.EditorDirtyDot})),__vite__mapDeps([21,1,2,3,10,11,8,16,7,9,4,5,12,13,14,15,17,18])));function Ta(e){return(0,X.jsx)(Z.Suspense,{fallback:null,children:(0,X.jsx)(wa,{...e})})}var Ea=(0,Z.lazy)(()=>A(()=>import(`./EditorTabClose-fAutR9L2.js`).then(e=>({default:e.EditorTabClose})),__vite__mapDeps([21,1,2,3,10,11,8,16,7,9,4,5,12,13,14,15,17,18])));function Da(e){return(0,X.jsx)(Z.Suspense,{fallback:(0,X.jsx)(`button`,{onClick:t=>{t.stopPropagation(),e.onClose()},className:`hidden size-4 items-center justify-center rounded-sm text-fg-muted transition-colors hover:text-fg group-hover:flex pointer-coarse:flex`,"aria-label":`Close ${e.label}`,children:`×`}),children:(0,X.jsx)(Ea,{...e})})}var Oa=e(n(),1),ka=(0,Z.createContext)(null);function Aa({tree:e,parked:t=[],onOpenFile:n,children:r}){let i=(0,Z.useRef)(null),a=(0,Z.useRef)(new Map).current,[o,s]=(0,Z.useState)(()=>new Set),c=(0,Z.useCallback)((e,t)=>{s(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]),l=[...t].sort().join(`,`),u=(0,Z.useMemo)(()=>{let t=new Set;for(let n of rn(e))for(let e of n.tabs)e.type===`terminal`&&t.add(e.session);for(let e of l===``?[]:l.split(`,`))t.add(e);return[...t].sort()},[e,l]),d=e=>{let t=`term:${e}`,n=a.get(t);return n||(n=document.createElement(`div`),n.className=`size-full`,a.set(t,n)),n};(0,Z.useEffect)(()=>{let e=new Set(u.map(e=>`term:${e}`));for(let e of u){let t=a.get(`term:${e}`);t&&!t.parentElement&&i.current?.appendChild(t)}for(let[t,n]of[...a])e.has(t)||(n.remove(),a.delete(t))},[u,a]);let f=(0,Z.useMemo)(()=>({parkingRef:i,containers:a,setAdopted:c}),[a,c]);return(0,X.jsxs)(ka.Provider,{value:f,children:[(0,X.jsx)(`div`,{ref:i,className:`hidden`,"aria-hidden":!0}),u.map(e=>(0,Oa.createPortal)((0,X.jsx)(He,{stream:e,paused:!o.has(`term:${e}`),onOpenFile:(t,r,i)=>n(e,t,r,i)}),d(e),e)),r]})}function ja(e){let t=(0,Z.useContext)(ka),n=(0,Z.useRef)(null);return(0,Z.useEffect)(()=>{let r=n.current;if(!t||!e||!r)return;let i=t.containers.get(e);return i&&(r.appendChild(i),t.setAdopted(e,!0)),()=>{let n=t.parkingRef.current;i&&n&&i.parentElement===r&&n.appendChild(i),i&&t.setAdopted(e,!1)}},[t,e]),n}var Ma=20,Na=new Map;function Pa(e,t){let n=Na.get(e)??[];n.push(t),n.length>Ma&&n.shift(),Na.set(e,n)}function Fa(e,t){let n=Na.get(e);for(;n&&n.length>0;){let e=n.pop();if(t(e.ref))return e}}function Ia(e){let[t,n]=(0,Z.useState)(()=>window.matchMedia(e).matches);return(0,Z.useEffect)(()=>{let t=window.matchMedia(e),r=e=>n(e.matches);return n(t.matches),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}var La=`(max-width: 767px)`;function Ra(e,t){let n={};for(let r of t){let t=e[r];if(typeof t!=`number`)return;n[r]=t}return n}var za=`puddle.pane-height.`;function Ba(e){try{let t=localStorage.getItem(`${za}${e}`);if(t===null)return null;let n=Number(t);return Number.isFinite(n)&&n>0?n:null}catch{return null}}function Va(e,t,{sized:n,min:r=64}){let[i,a]=(0,Z.useState)(()=>Ba(e)??t),[o,s]=(0,Z.useState)(!1),c=(0,Z.useRef)(i);return c.current=i,{height:i,handle:{dragging:o,onPointerDown:(0,Z.useCallback)(t=>{if(t.button!==0)return;t.preventDefault();let i=t.currentTarget,o=t.clientY,l=c.current,u=i.parentElement?.getBoundingClientRect().height??window.innerHeight,d=Math.max(r,u-96);i.setPointerCapture(t.pointerId),s(!0);let f=e=>{let t=e.clientY-o,i=n===`below`?l-t:l+t;a(Math.round(Math.min(d,Math.max(r,i))))},p=()=>{i.removeEventListener(`pointermove`,f),i.removeEventListener(`pointerup`,p),i.removeEventListener(`pointercancel`,p),s(!1);try{localStorage.setItem(`${za}${e}`,String(c.current))}catch{}};i.addEventListener(`pointermove`,f),i.addEventListener(`pointerup`,p),i.addEventListener(`pointercancel`,p)},[e,r,n])}}}function Ha({handle:e,label:t,className:n}){return(0,X.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,"aria-label":t,onPointerDown:e.onPointerDown,className:H(`relative h-px shrink-0 cursor-row-resize touch-none bg-border transition-colors hover:bg-accent`,e.dragging&&`bg-accent`,n),children:(0,X.jsx)(`div`,{className:`absolute inset-x-0 -top-1 h-[9px]`})})}var Ua=80,Wa=180;function Ga(e){return Math.max(Wa,Math.round(e/Ua*1e3))}function Ka({text:e,hoverClass:t,className:n,title:r}){let i=(0,Z.useRef)(null),[a,o]=(0,Z.useState)(0);return(0,Z.useEffect)(()=>{let e=i.current;if(!e)return;let t=()=>o(Math.max(0,e.scrollWidth-e.clientWidth));t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[e]),(0,X.jsx)(`span`,{className:`block min-w-0 flex-1 overflow-hidden`,children:(0,X.jsx)(`span`,{ref:i,title:r,className:H(`block whitespace-nowrap transition-transform ease-linear`,n,a>0&&t),style:a>0?{"--tail":`-${a}px`,transitionDuration:`${Ga(a)}ms`}:void 0,children:e})})}var qa=null,Ja=new Set;function Ya(e){qa=e,Ja.forEach(t=>t(e))}function Xa(e){return Ja.add(e),qa&&e(qa),()=>Ja.delete(e)}function Za(){qa=null}var Qa={added:{letter:`A`,label:`added`,colourClass:`text-success`},modified:{letter:`M`,label:`modified`,colourClass:`text-fg-secondary`},deleted:{letter:`D`,label:`deleted`,colourClass:`text-interrupted`},renamed:{letter:`R`,label:`renamed`,colourClass:`text-warning`}};function $a(e){return Qa[e]}var eo=[`modified`,`added`,`deleted`,`renamed`];function to(e){let t=new Map;for(let n of e)t.set(n.status,(t.get(n.status)??0)+1);return eo.filter(e=>t.has(e)).map(e=>`${t.get(e)} ${Qa[e].label}`).join(` · `)}var no=[`var(--accent)`,`var(--status-running)`,`var(--status-waiting)`,`var(--ansi-magenta)`,`var(--ansi-cyan)`,`var(--status-interrupted)`];function ro(e){return no[e%no.length]}function io(e){let t=[],n=0,r=0,i=()=>{let e=t.indexOf(null);return e===-1?t.length:e},a=()=>{let e=[];for(let n=0;n<t.length;n++){let r=t[n];r&&e.push({col:n,sha:r.sha,colour:ro(r.colourIdx)})}return e},o=[],s=[];for(let c of e){let e=c.parents??[],l=[];for(let e=0;e<t.length;e++)t[e]?.sha===c.sha&&l.push(e);let u,d;l.length>0?(u=l[0],d=t[u].colourIdx):(u=i(),d=n++);let f=ro(d);for(let e of l)t[e]=null;for(;t.length<=u;)t.push(null);let p=[];if(e.length>0){t[u]={sha:e[0],colourIdx:d},p.push(u);for(let r=1;r<e.length;r++){let a=e[r],o=t.findIndex(e=>e?.sha===a);if(o===-1){for(o=i();t.length<=o;)t.push(null);t[o]={sha:a,colourIdx:n++}}p.push(o)}}else t[u]=null;let m=a();o.push({sha:c.sha,col:u,colour:f,above:s,below:m,created:p}),s=m,r=Math.max(r,t.length)}return{rows:o,laneCount:r}}var ao=7,oo=14,so=4,co=1.5,lo=40,uo=22,fo=`group-hover:[transform:translateX(var(--tail))]`;function po(e){return e*oo+oo/2}function mo(e,t,n,r){if(e===n)return`M ${e} ${t} L ${n} ${r}`;let i=(t+r)/2;return`M ${e} ${t} C ${e} ${i}, ${n} ${i}, ${n} ${r}`}function ho({row:e,width:t}){let n=lo,r=n/2,i=po(e.col),a=new Set(e.created),o=[];for(let t of e.above){let n=po(t.col);t.sha===e.sha?o.push({d:mo(n,0,i,r),colour:t.colour}):o.push({d:mo(n,0,n,r),colour:t.colour})}for(let t of e.below){let e=po(t.col);a.has(t.col)?o.push({d:mo(i,r,e,n),colour:t.colour}):o.push({d:mo(e,r,e,n),colour:t.colour})}return(0,X.jsxs)(`svg`,{width:t,height:n,className:`shrink-0`,"aria-hidden":!0,children:[o.map((e,t)=>(0,X.jsx)(`path`,{d:e.d,fill:`none`,stroke:e.colour,strokeWidth:co},t)),(0,X.jsx)(`circle`,{cx:i,cy:r,r:so,fill:`var(--bg-surface)`,stroke:e.colour,strokeWidth:co})]})}function go({lanes:e,width:t}){return(0,X.jsx)(`svg`,{width:t,height:uo,className:`shrink-0`,"aria-hidden":!0,children:e.map(e=>{let t=po(e.col);return(0,X.jsx)(`path`,{d:`M ${t} 0 L ${t} ${uo}`,fill:`none`,stroke:e.colour,strokeWidth:co},e.col)})})}function _o({session:e,sha:t,root:n,lanes:r,gutterW:i,onOpen:a}){let o=D(e,t,n),s=e=>(0,X.jsxs)(`div`,{className:`flex items-center`,style:{height:uo},children:[(0,X.jsx)(go,{lanes:r,width:i}),(0,X.jsx)(`span`,{className:`px-2 text-2xs text-fg-muted`,children:e})]});return o.isPending?s(`…`):o.error?s(o.error instanceof Error?o.error.message:`Failed to load commit`):o.data.files.length===0?s(`No file changes.`):(0,X.jsx)(X.Fragment,{children:o.data.files.map(e=>{let o=$a(e.status),s=e.status===`renamed`&&e.old_path?`${e.old_path} → ${e.path}`:e.path;return(0,X.jsxs)(`button`,{type:`button`,title:s,onClick:()=>{a(e.path,t),Ya({path:e.path,root:n})},onDoubleClick:()=>a(e.path,t,{preview:!1}),className:`group flex w-full items-center text-left transition-colors hover:bg-elevated`,style:{height:uo},children:[(0,X.jsx)(go,{lanes:r,width:i}),(0,X.jsx)(`span`,{className:H(`mr-1.5 w-3 shrink-0 text-center font-mono text-xs`,o.colourClass),children:o.letter}),(0,X.jsx)(Ka,{text:s,className:`pr-3 text-2xs text-fg`,hoverClass:fo})]},`${e.status}:${e.old_path??``}:${e.path}`)})})}function vo({session:e,root:t,onOpenCommitFile:n}){let r=c(e,{root:t}),[i,a]=(0,Z.useState)(null),o=(0,Z.useMemo)(()=>r.data?.pages.flatMap(e=>e.commits)??[],[r.data]),s=(0,Z.useMemo)(()=>io(o),[o]),l=Math.max(1,s.laneCount)*oo+oo/2;return r.isPending?(0,X.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`Loading history…`}):r.error?(0,X.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:r.error instanceof Error?r.error.message:`Failed to load history`}):o.length===0?(0,X.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No commits yet.`}):(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-2`,children:[s.rows.map((r,s)=>{let c=o[s],u=i===r.sha;return(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>a(u?null:r.sha),className:H(`group flex w-full items-center text-left transition-colors hover:bg-elevated`,u&&`bg-selection`),style:{height:lo},children:[(0,X.jsx)(ho,{row:r,width:l}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5 pr-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-2xs text-fg-muted`,children:r.sha.slice(0,ao)}),(0,X.jsx)(Ka,{text:c.subject,className:`text-xs text-fg`,hoverClass:fo})]}),(0,X.jsxs)(`span`,{className:`truncate text-2xs text-fg-muted`,children:[c.author_name,` ·`,` `,(0,X.jsx)(`span`,{className:`tabular-nums`,children:S(c.authored_at)})]})]})]}),u&&(0,X.jsx)(_o,{session:e,sha:r.sha,root:t,lanes:r.below,gutterW:l,onOpen:n})]},r.sha)}),r.hasNextPage&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>void r.fetchNextPage(),disabled:r.isFetchingNextPage,className:`px-3 py-2 text-left text-xs text-fg-muted transition-colors hover:bg-elevated`,children:r.isFetchingNextPage?`Loading…`:`Show more`})]})}function yo(){return{dirs:new Map,files:[]}}function bo(e){return e.path}function xo(e,t){let n=[];for(let[r,i]of e.dirs){let e=t?`${t}/${r}`:r,a={type:`dir`,name:r,path:e,children:xo(i,e)};for(;a.children.length===1&&a.children[0].type===`dir`;){let e=a.children[0];a={type:`dir`,name:`${a.name}/${e.name}`,path:e.path,children:e.children}}n.push(a)}n.sort((e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`}));let r=[...e.files].sort((e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`}));return[...n,...r]}function So(e){let t=yo();for(let n of e){let e=bo(n),r=e.split(`/`),i=r.pop(),a=t;for(let e of r){let t=a.dirs.get(e);t||(t=yo(),a.dirs.set(e,t)),a=t}a.files.push({type:`file`,name:i,path:e,entry:n})}return xo(t,``)}function Co(e){return e.map(e=>({type:`file`,name:bo(e).split(`/`).pop()??bo(e),path:bo(e),entry:e})).sort((e,t)=>e.path.localeCompare(t.path,void 0,{sensitivity:`base`}))}var wo=`group-hover:[transform:translateX(var(--tail))]`;function To({name:e,fullPath:t,status:n,depth:r,active:i,onOpen:a}){let o=$a(n);return(0,X.jsxs)(`button`,{type:`button`,title:t,onClick:()=>a(t),onDoubleClick:()=>a(t,{preview:!1}),className:H(`group flex w-full items-center gap-1.5 py-1 pr-3 text-left transition-colors hover:bg-elevated`,i&&`bg-selection`),style:{paddingLeft:8+r*12},children:[(0,X.jsx)(`span`,{className:H(`w-3 shrink-0 text-center font-mono text-xs`,o.colourClass),children:o.letter}),(0,X.jsx)(Ka,{text:e,className:`text-xs text-fg`,hoverClass:wo})]})}function Eo({nodes:e,depth:t,activePath:n,onOpen:r}){let[i,a]=(0,Z.useState)(new Set);return(0,X.jsx)(X.Fragment,{children:e.map(e=>{if(e.type===`file`)return(0,X.jsx)(To,{name:e.name,fullPath:e.path,status:e.entry.status,depth:t,active:n===e.path,onOpen:r},e.path);let o=i.has(e.path);return(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>a(t=>{let n=new Set(t);return n.has(e.path)?n.delete(e.path):n.add(e.path),n}),className:`group flex w-full items-center gap-1 py-1 pr-3 text-left transition-colors hover:bg-elevated`,style:{paddingLeft:8+t*12},title:e.path,children:[o?(0,X.jsx)(Ot,{className:`size-3.5 shrink-0 text-fg-gold`}):(0,X.jsx)(Et,{className:`size-3.5 shrink-0 text-fg-gold`}),(0,X.jsx)(Ka,{text:e.name,className:`text-xs text-fg-secondary`,hoverClass:wo})]}),!o&&(0,X.jsx)(Eo,{nodes:e.children,depth:t+1,activePath:n,onOpen:r})]},e.path)})})}function Do({session:e,root:t,activePath:n,onOpen:r}){let[i,a]=(0,Z.useState)(!1),o=u(e,{against:`head`,root:t}),s=o.data?.entries??[],c=(e,n)=>{r(e,n),Ya({path:e,root:t})},l=(0,Z.useMemo)(()=>i?null:So(s),[i,s]),d=(0,Z.useMemo)(()=>i?Co(s):null,[i,s]);return(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,X.jsxs)(`div`,{className:`flex h-7 shrink-0 items-center gap-2 px-3`,children:[(0,X.jsx)(`span`,{className:`text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:`Uncommitted`}),s.length>0&&(0,X.jsx)(`span`,{className:`truncate text-2xs text-fg-muted`,children:to(s)}),(0,X.jsxs)(K,{children:[(0,X.jsx)(G,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"aria-pressed":!i,onClick:()=>a(e=>!e),className:`ml-auto rounded-sm p-1 text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[i?(0,X.jsx)(ir,{className:`size-3.5`}):(0,X.jsx)(er,{className:`size-3.5`}),(0,X.jsx)(`span`,{className:`sr-only`,children:i?`Show as tree`:`Show as flat list`})]})}),(0,X.jsx)(J,{children:i?`Show as tree`:`Show as flat list`})]})]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-1`,children:o.isPending?(0,X.jsx)(`div`,{className:`px-3 py-1.5 text-xs text-fg-muted`,children:`Loading changes…`}):o.error?(0,X.jsx)(`div`,{className:`px-3 py-1.5 text-xs text-fg-muted`,children:o.error instanceof Error?o.error.message:`Failed to load changes`}):s.length===0?(0,X.jsx)(`div`,{className:`px-3 py-1.5 text-xs text-fg-muted`,children:`No uncommitted changes.`}):i?d.map(e=>(0,X.jsx)(To,{name:e.path,fullPath:e.path,status:e.entry.status,depth:0,active:n===e.path,onOpen:c},e.path)):(0,X.jsx)(Eo,{nodes:l,depth:0,activePath:n,onOpen:c})})]})}function Oo({session:e,root:t,activeDiffPath:n,onOpenDiff:r,onOpenCommitFile:i}){let{height:a,handle:o}=Va(`changes-uncommitted`,240,{sized:`above`,min:80});return(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,X.jsx)(`section`,{className:`flex shrink-0 flex-col`,style:{height:a,maxHeight:`70%`},children:(0,X.jsx)(Do,{session:e,root:t,activePath:n,onOpen:r})}),(0,X.jsx)(Ha,{handle:o,label:`Resize the uncommitted changes`}),(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,X.jsx)(`div`,{className:`flex h-7 shrink-0 items-center px-3`,children:(0,X.jsx)(`span`,{className:`text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:`History`})}),(0,X.jsx)(vo,{session:e,root:t,onOpenCommitFile:i})]})]})}function ko(e,t){if(!t)return e;let n=t.endsWith(`/`)?t.slice(0,-1):t;return n===``||n===`/`?e:e===n?`~`:e.startsWith(`${n}/`)?`~${e.slice(n.length)}`:e}function Ao(e,t,n){return e!==null&&e.id===t&&n-e.at<1500}async function jo(e){let t=e.createReader(),n=[];for(;;){let e=await new Promise((e,n)=>t.readEntries(e,n));if(e.length===0)return n;n.push(...e)}}function Mo(e){return new Promise((t,n)=>e.file(t,n))}async function No(e,t,n){if(e.isFile){let r=await Mo(e);n.push(t?new File([r],`${t}/${e.name}`,{type:r.type,lastModified:r.lastModified}):r)}else if(e.isDirectory){let r=await jo(e),i=t?`${t}/${e.name}`:e.name;for(let e of r)await No(e,i,n)}}function Po(e,t,n){let r=Array.from(e??[]).map(e=>({entry:e.webkitGetAsEntry?.()??null,file:e.kind===`file`?e.getAsFile():null})),i=Array.from(t);return(async()=>{if(r.every(({entry:e,file:t})=>e===null&&t===null))return i;if(!n)return r.some(({entry:e})=>e?.isDirectory)&&j.error(`This daemon can't take folders — update it, or zip them first`),r.filter(({entry:e})=>e?.isDirectory!==!0).map(({file:e})=>e).filter(e=>e!==null);let e=[];for(let{entry:t,file:n}of r)t?.isDirectory?await No(t,``,e):n&&e.push(n);return e})()}var Fo={untracked:{letter:`U`,colourClass:`text-success`},added:{letter:`A`,colourClass:`text-success`},modified:{letter:`M`,colourClass:`text-warning`},renamed:{letter:`R`,colourClass:`text-warning`},deleted:{letter:`D`,colourClass:`text-interrupted`},conflicted:{letter:`C`,colourClass:`text-interrupted`},ignored:{letter:``,colourClass:`text-fg-muted`}};function Io(e){return Fo[e]}function Lo(e){let t=new Map;for(let n of e)t.set(n.path,n.status);return t}var Ro={conflicted:0,modified:1,renamed:2,deleted:3,added:4,untracked:5,ignored:6};function zo(e,t){let n=t===``?``:`${t}/`,r=null;for(let[t,i]of e)n!==``&&!t.startsWith(n)||i!==`ignored`&&(r===null||Ro[i]<Ro[r])&&(r=i);return r}function Bo(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function Vo(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function Ho(e){let t=e.split(`/`).filter(e=>e!==``);t.pop();let n=[];for(let e of t)n.push(Wo(n[n.length-1]??``,e));return n}function Uo(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n<=0?`/`:t.slice(0,n)}function Wo(e,t){return e===``?t:`${e}/${t}`}function Go(e){let t=new Set(e);return e.filter(e=>{if(e===``)return!0;for(let n=Vo(e);;n=Vo(n)){if(t.has(n))return!1;if(n===``)return!0}})}var Ko=`application/x-puddle-paths`;function qo(e){return JSON.stringify(e)}function Jo(e){try{let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function Yo(e,t){let n=[],r=(i,a)=>{let o=e(i);if(o)for(let e of o.entries){let o=Wo(i,e.name);n.push({path:o,name:e.name,type:e.type,depth:a,parentDir:i}),e.type===`dir`&&t.has(o)&&r(o,a+1)}};return r(``,0),n}function Xo(e,t,n){let r=e.findIndex(e=>e.path===t),i=e.findIndex(e=>e.path===n);if(r===-1||i===-1)return n?[n]:[];let[a,o]=r<=i?[r,i]:[i,r];return e.slice(a,o+1).map(e=>e.path)}var Zo=(e,t)=>e instanceof Error?e.message:t;function Qo(e,t){let n=i(),r=(0,Z.useCallback)(()=>{n.invalidateQueries({queryKey:[`wt-tree`,e]}),n.invalidateQueries({queryKey:[`wt-git-status`,e]})},[n,e]);return(0,Z.useMemo)(()=>({async create(n,i,a){try{let o=await E(e,Wo(n,i),a,t);return r(),o.path}catch(e){return j.error(Zo(e,`Couldn't create ${i}`)),null}},async rename(n,i){let a=Wo(n.includes(`/`)?n.slice(0,n.lastIndexOf(`/`)):``,i);try{let i=await O(e,n,a,t);return r(),i.path}catch(e){return j.error(Zo(e,`Couldn't rename ${Bo(n)}`)),null}},async move(n,i){let a=await Promise.allSettled(n.map(n=>O(e,n,Wo(i,Bo(n)),t)));r();let o=a.filter(e=>e.status===`rejected`);o.length>0&&j.error(n.length===1?Zo(o[0].reason,`Couldn't move ${Bo(n[0])}`):`Couldn't move ${o.length} item${o.length>1?`s`:``}`)},async remove(n){let i=await Promise.allSettled(n.map(n=>k(e,n,t)));r();let a=i.filter(e=>e.status===`rejected`).length;a>0?j.error(`Couldn't delete ${a} item${a>1?`s`:``}`):j.success(n.length===1?`Deleted ${Bo(n[0])}`:`Deleted ${n.length} items`)},async paste(n,i){let a=n.mode===`cut`?O:p,o=await Promise.allSettled(n.paths.map(n=>a(e,n,Wo(i,Bo(n)),t)));r();let s=o.filter(e=>e.status===`rejected`).length;s>0&&j.error(`Couldn't paste ${s} item${s>1?`s`:``}`)}}),[e,t,r])}function $o(e,t,n){return n&&n.type!==`dir`||(e.includes(`/`)?e.slice(0,e.lastIndexOf(`/`)):``)===t?!1:t===``||!`${t}/`.startsWith(`${e}/`)}var es=(0,Z.createContext)(null);function ts(){let e=(0,Z.useContext)(es);if(!e)throw Error(`explorer components must render inside <ExplorerProvider>`);return e}function ns(){return(0,Z.useContext)(es)}function rs({session:e,root:t,readOnly:n=!1,onOpenFile:r,onOpenTerminal:a,activePath:o,children:s}){let c=e.id,u=i(),d=Qo(c,t),f=t??e.worktree_path,p=(0,Z.useCallback)(e=>t===void 0?[`wt-tree`,c,e]:[`wt-tree`,c,e,t],[c,t]),h=(0,Z.useCallback)((e,r)=>{r.length===0||n||l(c,e,r,t).then(()=>{u.invalidateQueries({queryKey:p(e)}),u.invalidateQueries({queryKey:[`wt-git-status`,c]}),j.success(r.length===1?`Uploaded ${r[0].name}`:`Uploaded ${r.length} files`)}).catch(e=>j.error(e instanceof Error?e.message:`Upload failed`))},[c,t,n,u,p]),g=ye().data?.protocol,_=!g||g.major>9||g.major===9&&g.minor>=2,v=(0,Z.useCallback)((e,t,n)=>{Po(t,n,_).then(t=>h(e,t)).catch(e=>j.error(e instanceof Error?e.message:`Couldn't read the dropped folder`))},[h,_]),[y,x]=(0,Z.useState)(new Set),[S,C]=(0,Z.useState)(new Set),[w,T]=(0,Z.useState)(null),[E,D]=(0,Z.useState)(null),[O,k]=(0,Z.useState)(null),[A,ee]=(0,Z.useState)(null),[te,M]=(0,Z.useState)(null),N=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{let e=()=>ee(null);return window.addEventListener(`dragend`,e),()=>window.removeEventListener(`dragend`,e)},[]);let P=b(c,{enabled:t===void 0}),ne=(0,Z.useMemo)(()=>Lo(P.data?.entries??[]),[P.data]),[re,ie]=(0,Z.useState)(0);(0,Z.useEffect)(()=>u.getQueryCache().subscribe(e=>{if(e.type!==`added`&&e.type!==`removed`&&e.type!==`updated`)return;let t=e.query.queryKey;Array.isArray(t)&&t[0]===`wt-tree`&&t[1]===c&&ie(e=>e+1)}),[u,c]);let F=(0,Z.useMemo)(()=>Yo(e=>u.getQueryData(p(e)),y),[u,p,y,re]),ae=(0,Z.useCallback)(e=>{x(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),I=(0,Z.useCallback)(e=>{x(t=>t.has(e)?t:new Set(t).add(e))},[]),oe=(0,Z.useCallback)(()=>x(new Set),[]),[L,se]=(0,Z.useState)(null);(0,Z.useEffect)(()=>Xa(e=>{if(e.root===t){Za();for(let t of Ho(e.path))I(t);C(new Set([e.path])),T(e.path),se(e.path)}}),[t,I]),(0,Z.useEffect)(()=>{if(L===null)return;let e=document.querySelector(`[data-explorer-root] [data-path="${CSS.escape(L)}"]`);if(e){e.scrollIntoView({block:`nearest`}),se(null);return}let t=window.setTimeout(()=>se(null),4e3);return()=>window.clearTimeout(t)},[L,F]);let R=(0,Z.useRef)(null),ce=(0,Z.useRef)(null),le=(0,Z.useCallback)(()=>{R.current!==null&&(window.clearTimeout(R.current),R.current=null)},[]);(0,Z.useEffect)(()=>le,[le]);let ue=(0,Z.useCallback)((e,t)=>{if(le(),T(e.path),t.metaKey||t.ctrlKey){C(t=>{let n=new Set(t);return n.has(e.path)?n.delete(e.path):n.add(e.path),n}),N.current=e.path;return}if(t.shiftKey&&N.current){C(new Set(Xo(F,N.current,e.path)));return}let i=Date.now(),a=ce.current;if(ce.current={id:e.path,at:i},e.type!==`dir`&&!n&&!O&&S.size===1&&S.has(e.path)&&Ao(a,e.path,i)){R.current=window.setTimeout(()=>{R.current=null,k({mode:`rename`,path:e.path})},500);return}C(new Set([e.path])),N.current=e.path,e.type===`dir`?ae(e.path):r?.(c,e.path)},[F,ae,r,c,S,O,n,le]),z=(0,Z.useCallback)(e=>{le(),e.type!==`dir`&&r?.(c,e.path,{preview:!1})},[r,c,le]),de=(0,Z.useCallback)(e=>{C(new Set([e])),T(e),N.current=e},[]),fe=(0,Z.useCallback)(e=>D({paths:Go(e),mode:`cut`}),[]),pe=(0,Z.useCallback)(e=>D({paths:Go(e),mode:`copy`}),[]),me=(0,Z.useCallback)(e=>{!E||n||d.paste(E,e).then(()=>{E.mode===`cut`&&D(null)})},[E,d,n]),he=(0,Z.useCallback)(e=>{n||k({mode:`rename`,path:e})},[n]),B=(0,Z.useCallback)((e,t)=>{n||(e!==``&&I(e),k({mode:`create`,parentDir:e,kind:t}))},[I,n]),ge=(0,Z.useCallback)(()=>k(null),[]),_e=(0,Z.useCallback)(e=>{let t=e.trim(),n=O;if(k(null),!(!n||t===``))if(n.mode===`rename`){if(t===Bo(n.path))return;d.rename(n.path,t)}else d.create(n.parentDir,t,n.kind).then(e=>{e&&n.kind===`file`&&r?.(c,e)})},[O,d,r,c]),ve=(0,Z.useCallback)(e=>{if(n)return;let t=Go(e);t.length>0&&M(t)},[n]),V=(0,Z.useCallback)(()=>{let e=te;M(null),e&&d.remove(e)},[te,d]),be=(0,Z.useCallback)(()=>M(null),[]),xe=(0,Z.useCallback)((e,t)=>{let n=e.map(e=>t?e:Wo(f,e)).join(`
|
|
3
3
|
`);navigator.clipboard.writeText(n);let r=t?`Relative path`:`Path`;j.success(e.length>1?`${e.length} ${r.toLowerCase()}s copied`:`${r} copied`)},[f]),Se=(0,Z.useCallback)(e=>{(async()=>{for(let n of Go(e))await m(c,n,t)})().catch(e=>j.error(e instanceof Error?e.message:`Download failed`))},[c,t]),Ce=(0,Z.useCallback)(()=>{u.invalidateQueries({queryKey:[`wt-tree`,c]}),u.invalidateQueries({queryKey:[`wt-git-status`,c]})},[u,c]),we=(0,Z.useCallback)((e,t)=>{if(n)return;let r=Go(t).filter(t=>$o(t,e));r.length>0&&d.move(r,e)},[d,n]),Te=(0,Z.useCallback)(()=>w&&S.has(w)?[...S]:w?[w]:[...S],[w,S]),Ee=(0,Z.useRef)({buffer:``,at:0}),De={sid:c,rootPath:f,root:t,readOnly:n,onOpenFile:r,onOpenTerminal:a,activePath:o,expanded:y,toggle:ae,collapseAll:oe,statusMap:ne,visibleRows:F,selection:S,focusedPath:w,onRowClick:ue,onRowDoubleClick:z,selectOnly:de,clipboard:E,cut:fe,copy:pe,paste:me,editing:O,beginRename:he,beginCreate:B,cancelEdit:ge,commitEdit:_e,requestDelete:ve,copyPathToClipboard:xe,download:Se,refresh:Ce,onUpload:h,onDropUpload:v,dropTarget:A,setDropTarget:ee,onInternalDrop:we,handleKeyDown:(0,Z.useCallback)(e=>{if(O)return;let t=F;if(t.length===0)return;let n=w?t.findIndex(e=>e.path===w):-1,i=(e,n)=>{let r=t[Math.max(0,Math.min(t.length-1,e))];r&&(T(r.path),n&&N.current?C(new Set(Xo(t,N.current,r.path))):(C(new Set([r.path])),N.current=r.path))},a=n>=0?t[n]:void 0,o=e.metaKey||e.ctrlKey;switch(e.key){case`ArrowDown`:e.preventDefault(),i(n+1,e.shiftKey);return;case`ArrowUp`:e.preventDefault(),i(n<=0?0:n-1,e.shiftKey);return;case`ArrowRight`:e.preventDefault(),a?.type===`dir`&&!y.has(a.path)?I(a.path):a?.type===`dir`&&i(n+1,!1);return;case`ArrowLeft`:if(e.preventDefault(),a?.type===`dir`&&y.has(a.path))ae(a.path);else if(a){let e=t.findIndex(e=>e.path===a.parentDir);e>=0&&i(e,!1)}return;case`Enter`:case` `:if(e.preventDefault(),!a)return;a.type===`dir`?ae(a.path):r?.(c,a.path);return;case`F2`:e.preventDefault(),a&&he(a.path);return;case`Delete`:e.preventDefault(),ve(Te());return;case`Backspace`:o&&(e.preventDefault(),ve(Te()));return}if(o&&(e.key===`c`||e.key===`C`)){e.preventDefault();let t=Te();e.altKey?xe(t,e.shiftKey):pe(t);return}if(o&&(e.key===`x`||e.key===`X`)){e.preventDefault(),fe(Te());return}if(o&&(e.key===`v`||e.key===`V`)){e.preventDefault();let t=a?a.type===`dir`?a.path:a.parentDir:``;me(t);return}if(!o&&!e.altKey&&e.key.length===1&&/\S/.test(e.key)){let r=Date.now(),a=Ee.current;a.buffer=r-a.at>700?e.key:a.buffer+e.key,a.at=r;let o=a.buffer.toLowerCase(),s=n+1;for(let e=0;e<t.length;e++){let n=t[(s+e)%t.length];if(n.name.toLowerCase().startsWith(o)){i(t.findIndex(e=>e.path===n.path),!1);break}}}},[O,F,w,y,I,ae,r,c,he,ve,Te,pe,fe,me,xe]),pendingDelete:te,confirmDelete:V,cancelDelete:be};return(0,X.jsx)(es.Provider,{value:De,children:s})}var is=`application/x-puddle-tab`;function as(e){return JSON.stringify(e)}function os(e){try{return te.parse(JSON.parse(e))}catch{return null}}function ss(e){return e.includes(is)}var cs={"package.json":Vn,"package-lock.json":Kn,"pnpm-lock.yaml":Kn,"yarn.lock":Kn,"pnpm-workspace.yaml":Hn,dockerfile:Y,".gitignore":Hn,".gitattributes":Hn,"readme.md":Xn,license:Xn,licence:Xn},ls={ts:Y,tsx:Y,mts:Y,cts:Y,js:Y,jsx:Y,mjs:Y,cjs:Y,py:Y,rs:Y,go:Y,rb:Y,php:Y,java:Y,kt:Y,c:Y,h:Y,cpp:Y,hpp:Y,cc:Y,html:Y,htm:Y,xml:Y,vue:Y,sql:Y,json:Vn,jsonc:Vn,yml:Hn,yaml:Hn,toml:Hn,ini:Hn,cfg:Hn,conf:Hn,env:Gn,lock:Kn,csv:Jn,tsv:Jn,xlsx:Jn,xls:Jn,md:Xn,mdx:Xn,markdown:Xn,txt:Xn,rtf:Xn,log:Xn,pdf:Xn,css:Zn,scss:Zn,sass:Zn,less:Zn,sh:Yn,bash:Yn,zsh:Yn,fish:Yn,svg:Wn,png:Wn,jpg:Wn,jpeg:Wn,gif:Wn,webp:Wn,bmp:Wn,ico:Wn,avif:Wn,mp4:qn,mov:qn,webm:qn,mkv:qn,avi:qn,mp3:Un,wav:Un,flac:Un,ogg:Un,m4a:Un,zip:Bn,tar:Bn,gz:Bn,tgz:Bn,rar:Bn,"7z":Bn};function us(e){let t=e.toLowerCase(),n=cs[t];if(n)return{Icon:n,generic:!1};let r=t.lastIndexOf(`.`);if(r>0){let e=ls[t.slice(r+1)];if(e)return{Icon:e,generic:!1}}return{Icon:Qn,generic:!0}}function ds({name:e,dimmed:t}){let{Icon:n,generic:r}=us(e);return(0,X.jsx)(n,{className:H(`size-3.5 shrink-0`,t||r?`text-fg-muted`:`text-fg`)})}var fs=14,ps=`group-hover/treerow:[transform:translateX(var(--tail))]`;function ms(e,t){let n=document.createElement(`div`);n.textContent=`${t} items`,n.className=`fixed -top-12 left-0 rounded-md bg-elevated px-2 py-1 text-xs text-fg`,document.body.appendChild(n),e.dataTransfer.setDragImage(n,12,12),requestAnimationFrame(()=>n.remove())}function hs({children:e}){return(0,X.jsx)(`span`,{className:`ml-auto pl-6 text-2xs text-fg-muted tabular-nums`,children:e})}function gs({depth:e,initial:t,icon:n,onCommit:r,onCancel:i}){let a=(0,Z.useRef)(null),o=(0,Z.useRef)(!1);(0,Z.useEffect)(()=>{let e=a.current;if(!e)return;let n=()=>{e.focus();let n=t.lastIndexOf(`.`);e.setSelectionRange(0,n>0?n:t.length)};n();let r=requestAnimationFrame(()=>{document.activeElement!==e&&n()});return()=>cancelAnimationFrame(r)},[t]);let s=()=>{o.current||(o.current=!0,r(a.current?.value??``))};return(0,X.jsxs)(`div`,{className:`flex h-6 items-center gap-1 pr-2 compact:h-5`,style:{paddingLeft:e*fs+8},children:[(0,X.jsx)(`span`,{className:`size-3.5 shrink-0`}),n,(0,X.jsx)(`input`,{ref:a,defaultValue:t,spellCheck:!1,onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`?s():e.key===`Escape`&&(o.current=!0,i())},onBlur:s,className:`min-w-0 flex-1 bg-surface text-sm text-fg outline-none`})]})}function _s({path:e,entry:t,depth:n}){let r=ts(),i=t.type===`dir`,a=i&&r.expanded.has(e),o=i&&r.dropTarget===e,s=!i&&e===r.activePath,c=r.selection.has(e),l=r.clipboard?.mode===`cut`&&r.clipboard.paths.includes(e),u={path:e,name:t.name,type:t.type,depth:n,parentDir:Vo(e)},d=r.statusMap.get(e),f=i?zo(r.statusMap,e):null,p=d?Io(d):f?Io(f):null,m=p?p.colourClass:t.name.startsWith(`.`)?`text-fg-muted`:`text-fg`,h=c&&r.selection.size>1?[...r.selection]:[e],g=i?e:Vo(e),_=r.clipboard!==null;return r.editing?.mode===`rename`&&r.editing.path===e?(0,X.jsx)(gs,{depth:n,initial:t.name,icon:i?(0,X.jsx)($n,{className:`size-3.5 shrink-0 text-fg`}):(0,X.jsx)(ds,{name:t.name}),onCommit:r.commitEdit,onCancel:r.cancelEdit}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(ht,{children:[(0,X.jsx)(tt,{asChild:!0,children:(0,X.jsxs)(`div`,{role:`treeitem`,"data-path":e,"aria-expanded":i?a:void 0,"aria-selected":c,tabIndex:-1,draggable:!r.readOnly,onClick:e=>{e.currentTarget.closest(`[data-explorer-root]`)?.focus(),r.onRowClick(u,e)},onDoubleClick:()=>r.onRowDoubleClick(u),onContextMenu:()=>{c||r.selectOnly(e)},onDragStart:t=>{let n=Go(h);t.dataTransfer.setData(Ko,qo(n)),n.length>1&&ms(t,n.length),!i&&n.length===1&&t.dataTransfer.setData(is,as({type:`editor`,tab:r.root===void 0?{kind:`file`,session:r.sid,path:e}:{kind:`external`,session:r.sid,path:e,root:r.root}})),t.dataTransfer.effectAllowed=`copyMove`},onDragOver:t=>{!i||r.readOnly||(t.preventDefault(),t.stopPropagation(),r.setDropTarget(e))},onDragLeave:e=>{i&&e.currentTarget===e.target&&r.setDropTarget(null)},onDrop:t=>{if(!i||r.readOnly)return;t.preventDefault(),t.stopPropagation(),r.setDropTarget(null);let n=Jo(t.dataTransfer.getData(Ko));n.length>0?r.onInternalDrop(e,n):r.onDropUpload(e,t.dataTransfer.items,t.dataTransfer.files)},style:{paddingLeft:n*fs+8},className:H(`group/treerow flex h-6 cursor-pointer items-center gap-1 pr-2 text-sm transition-colors hover:bg-elevated compact:h-5`,c?`bg-selection`:s&&`bg-elevated`,o&&`bg-selection`,l&&`opacity-50`),children:[i?(0,X.jsx)(Ot,{className:H(`size-3.5 shrink-0 text-fg-gold transition-transform duration-150`,a&&`rotate-90`)}):(0,X.jsx)(`span`,{className:`size-3.5 shrink-0`}),t.symlink||t.type===`symlink`?(0,X.jsx)(rr,{className:`size-3.5 shrink-0 text-fg`}):i?a?(0,X.jsx)(Gt,{className:H(`size-3.5 shrink-0`,f?p?.colourClass:`text-fg`)}):(0,X.jsx)($n,{className:H(`size-3.5 shrink-0`,f?p?.colourClass:`text-fg`)}):(0,X.jsx)(ds,{name:t.name,dimmed:d===`ignored`}),(0,X.jsx)(Ka,{text:t.name,className:m,hoverClass:ps}),d&&p&&p.letter&&(0,X.jsx)(`span`,{className:H(`shrink-0 font-mono text-2xs`,p.colourClass),children:p.letter})]})}),(0,X.jsxs)(dt,{onCloseAutoFocus:e=>{r.editing&&e.preventDefault()},children:[i&&!r.readOnly&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(W,{onSelect:()=>r.beginCreate(e,`file`),children:`New File…`}),(0,X.jsx)(W,{onSelect:()=>r.beginCreate(e,`dir`),children:`New Folder…`}),r.onOpenTerminal&&(0,X.jsx)(W,{onSelect:()=>r.onOpenTerminal?.(e),children:`Open Terminal in Directory`}),(0,X.jsx)(ot,{})]}),!r.readOnly&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(W,{onSelect:()=>r.cut(h),children:[`Cut `,(0,X.jsx)(hs,{children:`⌘X`})]}),(0,X.jsxs)(W,{onSelect:()=>r.copy(h),children:[`Copy `,(0,X.jsx)(hs,{children:`⌘C`})]}),(0,X.jsxs)(W,{disabled:!_,onSelect:()=>r.paste(g),children:[`Paste `,(0,X.jsx)(hs,{children:`⌘V`})]}),(0,X.jsx)(ot,{})]}),(0,X.jsxs)(W,{onSelect:()=>r.copyPathToClipboard(h,!1),children:[`Copy Path `,(0,X.jsx)(hs,{children:`⌥⌘C`})]}),(0,X.jsxs)(W,{onSelect:()=>r.copyPathToClipboard(h,!0),children:[`Copy Relative Path `,(0,X.jsx)(hs,{children:`⌥⇧⌘C`})]}),(0,X.jsx)(ot,{}),!r.readOnly&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(W,{onSelect:()=>r.beginRename(e),children:[`Rename… `,(0,X.jsx)(hs,{children:`F2`})]}),(0,X.jsxs)(W,{onSelect:()=>r.requestDelete(h),children:[`Delete `,(0,X.jsx)(hs,{children:`⌘⌫`})]}),(0,X.jsx)(ot,{})]}),(0,X.jsx)(W,{onSelect:()=>r.download(h),children:`Download`})]})]}),i&&a&&(0,X.jsx)(vs,{sid:r.sid,path:e,depth:n+1})]})}function vs({sid:e,path:t,depth:n}){let r=ts(),i=d(e,t,r.root),a={paddingLeft:n*fs+8},o=r.editing,s=o?.mode===`create`&&o.parentDir===t?(0,X.jsx)(ys,{depth:n,kind:o.kind}):null;if(i.isLoading)return(0,X.jsxs)(X.Fragment,{children:[s,(0,X.jsx)(`div`,{style:a,className:`py-0.5 text-xs text-fg-muted`,children:`Loading…`})]});if(i.isError)return(0,X.jsx)(`div`,{style:a,className:`py-0.5 text-xs text-fg-muted`,children:i.error instanceof Error?i.error.message:`Couldn't load this folder.`});let c=i.data?.entries??[];return c.length===0&&!s?(0,X.jsx)(`div`,{style:a,className:`py-0.5 text-xs text-fg-muted`,children:`Empty`}):(0,X.jsxs)(X.Fragment,{children:[s,c.map(e=>(0,X.jsx)(_s,{path:Wo(t,e.name),entry:e,depth:n},e.name))]})}function ys({depth:e,kind:t}){let n=ts(),[r,i]=(0,Z.useState)(``);return(0,X.jsx)(gs,{depth:e,initial:r,icon:t===`dir`?(0,X.jsx)($n,{className:`size-3.5 shrink-0 text-fg`}):(0,X.jsx)(ds,{name:r||`file`}),onCommit:e=>{i(e),n.commitEdit(e)},onCancel:n.cancelEdit})}function bs(){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(xs,{}),(0,X.jsx)(Ss,{})]})}function xs(){let e=ts(),t=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{!e.focusedPath||!t.current||t.current.querySelector(`[data-path="${CSS.escape(e.focusedPath)}"]`)?.scrollIntoView({block:`nearest`})},[e.focusedPath]);let n=e.clipboard!==null;return(0,X.jsxs)(ht,{children:[(0,X.jsx)(tt,{asChild:!0,children:(0,X.jsx)(`div`,{ref:t,"data-explorer-root":!0,role:`tree`,tabIndex:0,onKeyDown:e.handleKeyDown,onPaste:t=>e.onDropUpload(``,t.clipboardData.items,t.clipboardData.files),onDragOver:t=>{e.readOnly||(t.preventDefault(),e.setDropTarget(``))},onDragLeave:t=>{t.currentTarget===t.target&&e.setDropTarget(null)},onDrop:t=>{if(e.readOnly)return;t.preventDefault(),e.setDropTarget(null);let n=Jo(t.dataTransfer.getData(Ko));n.length>0?e.onInternalDrop(``,n):e.onDropUpload(``,t.dataTransfer.items,t.dataTransfer.files)},className:H(`h-full overflow-y-auto py-1 outline-none`,e.dropTarget===``&&`bg-selection`),children:(0,X.jsx)(vs,{sid:e.sid,path:``,depth:0})})}),(0,X.jsxs)(dt,{onCloseAutoFocus:t=>{e.editing&&t.preventDefault()},children:[!e.readOnly&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(W,{onSelect:()=>e.beginCreate(``,`file`),children:`New File…`}),(0,X.jsx)(W,{onSelect:()=>e.beginCreate(``,`dir`),children:`New Folder…`}),e.onOpenTerminal&&(0,X.jsx)(W,{onSelect:()=>e.onOpenTerminal?.(``),children:`Open Terminal in Directory`}),(0,X.jsx)(ot,{}),(0,X.jsx)(W,{disabled:!n,onSelect:()=>e.paste(``),children:`Paste`}),(0,X.jsx)(ot,{})]}),(0,X.jsx)(W,{onSelect:()=>e.copyPathToClipboard([``],!1),children:`Copy Path`}),(0,X.jsxs)(W,{onSelect:()=>e.download([``]),children:[`Download `,Bo(e.rootPath)||`folder`]})]})]})}function Ss(){let e=ts(),t=_e().data?.home,n=e.pendingDelete;return(0,X.jsx)(ue,{open:n!==null,onOpenChange:t=>!t&&e.cancelDelete(),children:(0,X.jsxs)(R,{children:[(0,X.jsxs)(F,{children:[(0,X.jsxs)(ce,{children:[`Delete `,n&&n.length===1?`“${Bo(n[0])}”`:`${n?.length??0} items`,`?`]}),(0,X.jsxs)(le,{children:[`This permanently removes `,n&&n.length>1?`them`:`it`,` from`,` `,(0,X.jsx)(`span`,{className:`text-fg-secondary`,children:ko(e.rootPath,t)}),`. There is no undo.`]})]}),(0,X.jsxs)(L,{children:[(0,X.jsx)(I,{variant:`ghost`,onClick:e.cancelDelete,children:`Cancel`}),(0,X.jsx)(I,{variant:`danger`,onClick:e.confirmDelete,children:`Delete`})]})]})})}function Cs({session:e,root:t,readOnly:n,boundHeader:r,onNavigateUp:i,onReset:a,onOpenFile:o,activePath:s}){return(0,X.jsxs)(rs,{session:e,root:t,readOnly:n,onOpenFile:(e,t,n)=>o(t,n),activePath:s,children:[r,(0,X.jsx)(ws,{root:t,onNavigateUp:i,onReset:a}),(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,X.jsx)(bs,{})})]},t)}function ws({root:e,onNavigateUp:t,onReset:n}){let r=_e().data?.home;return(0,X.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center px-2`,children:[(0,X.jsxs)(K,{children:[(0,X.jsx)(G,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,onClick:t,disabled:e===`/`,className:`flex min-w-0 flex-1 items-center gap-1.5 rounded-sm px-1 py-1 text-left text-fg-gold transition-colors hover:bg-elevated hover:text-fg disabled:pointer-events-none disabled:opacity-40`,children:[(0,X.jsx)(Ft,{className:`size-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-secondary`,children:ko(e,r)})]})}),(0,X.jsx)(J,{children:e===`/`?e:`Browse the parent directory`})]}),(0,X.jsxs)(K,{children:[(0,X.jsx)(G,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,onClick:n,className:`ml-1 shrink-0 rounded-sm p-1 text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[(0,X.jsx)(mr,{className:`size-3.5`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Back to the worktree`})]})}),(0,X.jsx)(J,{children:`Back to the worktree`})]})]})}var Ts=/[.*+?^${}()|[\]\\]/g;function Es(e){if(e.query.length===0)return null;try{let t=e.regex?e.query:e.query.replace(Ts,`\\$&`);return e.wholeWord&&(t=`\\b(?:${t})\\b`),new RegExp(t,e.caseSensitive?`g`:`gi`)}catch{return null}}function Ds(e,t){if(!t)return[{text:e,hit:!1}];let n=[],r=0;t.lastIndex=0;let i;for(;(i=t.exec(e))!==null;){if(i[0].length===0){t.lastIndex++;continue}i.index>r&&n.push({text:e.slice(r,i.index),hit:!1}),n.push({text:i[0],hit:!0}),r=i.index+i[0].length}return r<e.length&&n.push({text:e.slice(r),hit:!1}),n.length>0?n:[{text:e,hit:!1}]}var Os=240;function ks(e){let t=e.replace(/^\s+/,``);return t.length>Os?`${t.slice(0,Os)}…`:t}var As=250,js=`group-hover:[transform:translateX(var(--tail))]`;function Ms({active:e,label:t,onClick:n,children:r}){return(0,X.jsxs)(K,{children:[(0,X.jsx)(G,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"aria-pressed":e,onClick:n,className:H(`rounded-sm p-1 transition-colors`,e?`bg-elevated text-accent`:`text-fg-muted hover:bg-elevated hover:text-fg`),children:[r,(0,X.jsx)(`span`,{className:`sr-only`,children:t})]})}),(0,X.jsx)(J,{children:t})]})}function Ns({session:e,root:t,onOpen:n}){let[r,i]=(0,Z.useState)(``),[a,o]=(0,Z.useState)(``),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{let e=setTimeout(()=>o(r),As);return()=>clearTimeout(e)},[r]);let p={query:a,regex:s,caseSensitive:l,wholeWord:d},m=y(e,p,t),h=(0,Z.useMemo)(()=>Es(p),[a,s,l,d]),g=m.data,_=!!g&&(g.files.length>0||g.content.length>0),v=(e,r,i=!0)=>{n(e,r,i?void 0:{preview:!1}),Ya({path:e,root:t})};return(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1 px-2 py-1.5`,children:[(0,X.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`Search files and contents`,spellCheck:!1,autoComplete:`off`,className:`rounded-md bg-elevated px-2 py-1 text-xs text-fg outline-none placeholder:text-fg-muted`}),(0,X.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(Ms,{active:l,label:`Match case`,onClick:()=>u(e=>!e),children:(0,X.jsx)(Pn,{className:`size-3.5`})}),(0,X.jsx)(Ms,{active:d,label:`Match whole word`,onClick:()=>f(e=>!e),children:(0,X.jsx)(gr,{className:`size-3.5`})}),(0,X.jsx)(Ms,{active:s,label:`Use regular expression`,onClick:()=>c(e=>!e),children:(0,X.jsx)(dr,{className:`size-3.5`})})]})]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-2`,children:a.length===0?(0,X.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`Search file names and contents.`}):m.isPending?(0,X.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`Searching…`}):m.error?(0,X.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:m.error instanceof Error?m.error.message:`Search failed`}):_?(0,X.jsxs)(X.Fragment,{children:[g.files.length>0&&(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`div`,{className:`px-3 pb-0.5 pt-1.5 text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:`Files`}),g.files.map(e=>(0,X.jsxs)(`button`,{type:`button`,title:e,onClick:()=>v(e),onDoubleClick:()=>v(e,void 0,!1),className:`group flex w-full items-center gap-1.5 px-3 py-1 text-left transition-colors hover:bg-elevated`,children:[(0,X.jsx)(Qn,{className:`size-3.5 shrink-0 text-fg-gold`}),(0,X.jsx)(Ka,{text:e,className:`text-xs text-fg`,hoverClass:js})]},e))]}),g.content.length>0&&(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`div`,{className:`px-3 pb-0.5 pt-2 text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:`Contents`}),g.content.map(e=>(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`button`,{type:`button`,title:e.path,onClick:()=>v(e.path),onDoubleClick:()=>v(e.path,void 0,!1),className:`group flex w-full px-3 py-1 text-left transition-colors hover:bg-elevated`,children:(0,X.jsx)(Ka,{text:e.path,className:`text-2xs text-fg-secondary`,hoverClass:js})}),e.matches.map((t,n)=>(0,X.jsxs)(`button`,{type:`button`,onClick:()=>v(e.path,t.line),onDoubleClick:()=>v(e.path,t.line,!1),className:`flex w-full items-baseline gap-2 py-0.5 pl-6 pr-3 text-left transition-colors hover:bg-elevated`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-2xs tabular-nums text-fg-muted`,children:t.line}),(0,X.jsx)(`span`,{className:`truncate font-mono text-2xs text-fg-secondary`,children:Ds(ks(t.text),h).map((e,t)=>e.hit?(0,X.jsx)(`span`,{className:`text-accent`,children:e.text},t):(0,X.jsx)(`span`,{children:e.text},t))})]},`${t.line}:${n}`))]},e.path))]}),g.truncated&&(0,X.jsx)(`div`,{className:`px-3 py-2 text-2xs text-fg-muted`,children:`Showing the first results — refine the query for more.`})]}):(0,X.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No results.`})})]})}var Ps=new Set([`starting`,`running`,`waiting_input`]),Fs=`group-hover:[transform:translateX(var(--tail))]`;function Is(e){return e.split(`/`).filter(Boolean).pop()??e}function Ls({children:e,className:t,title:n}){return(0,X.jsx)(`span`,{title:n,className:H(`shrink-0 text-2xs`,t),children:e})}function Rs({label:e,blockReason:t,onClick:n}){return(0,X.jsxs)(K,{children:[(0,X.jsx)(G,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,disabled:t!==null,onClick:n,className:H(`-my-1 rounded-sm p-1 text-fg-gold transition-colors hover:text-danger`,t===null?`hidden group-hover:inline-flex pointer-coarse:inline-flex`:`hidden`),children:[(0,X.jsx)(Cn,{className:`size-3.5`}),(0,X.jsx)(`span`,{className:`sr-only`,children:e})]})}),(0,X.jsx)(J,{children:t?`Can't ${e.toLowerCase()} — ${t}`:e})]})}function zs({repoId:e,projectId:t,sessions:n}){let r=de(e),i=be(e,t),a=fe(e,t),[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(null),u=i.isPending||a.isPending,d=(0,Z.useMemo)(()=>{let e=new Map;for(let t of n)Ps.has(t.status)&&e.set(t.worktree_path,(e.get(t.worktree_path)??0)+1);return e},[n]),f=(0,Z.useMemo)(()=>{let e=new Map;for(let t of r.data?.worktrees??[]){let n=t.branch??`(detached)`;(e.get(n)??e.set(n,[]).get(n)).push(t)}return[...e.entries()].sort(([,e],[,t])=>!e.some(e=>e.is_primary)-+!t.some(e=>e.is_primary)||(e[0]?.branch??``).localeCompare(t[0]?.branch??``))},[r.data]),p=(0,Z.useMemo)(()=>[...r.data?.orphan_branches??[]].sort((e,t)=>e.name.localeCompare(t.name)),[r.data]);return r.isPending?(0,X.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`Loading worktrees…`}):r.error?(0,X.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:r.error instanceof Error?r.error.message:`Failed to load worktrees`}):(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-2`,children:[f.length===0&&p.length===0&&(0,X.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No worktrees.`}),f.map(([e,t])=>(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`div`,{className:`group flex items-center gap-1.5 px-3 pb-0.5 pt-2 text-2xs text-fg-muted`,children:[(0,X.jsx)(nr,{className:`size-3 shrink-0 text-fg-gold`}),(0,X.jsx)(Ka,{text:e,hoverClass:Fs})]}),t.map(e=>{let t=d.get(e.path)??0,n=e.is_primary?`the repository clone`:e.dirty?`uncommitted changes`:t>0?`${t} running session${t>1?`s`:``}`:null;return(0,X.jsxs)(`div`,{className:`group flex items-center gap-2 px-3 py-1 pl-6 transition-colors hover:bg-elevated`,children:[(0,X.jsx)(Ka,{text:Is(e.path),title:e.path,className:`text-xs text-fg`,hoverClass:Fs}),e.is_primary&&(0,X.jsx)(Ls,{className:`text-fg-muted`,children:`clone`}),e.dirty&&(0,X.jsx)(Ls,{className:`text-warning`,title:`Modified — uncommitted changes`,children:`M`}),t>0&&(0,X.jsx)(Ls,{className:`text-running`,title:`${t} running session${t>1?`s`:``}`,children:t}),(0,X.jsx)(Rs,{label:`Prune`,blockReason:n,onClick:()=>{l(null),s({kind:`worktree`,path:e.path,branch:e.branch})}})]},e.path)})]},`wt:${e}`)),p.length>0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`px-3 pb-0.5 pt-3 text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:`Branches without a worktree`}),p.map(e=>(0,X.jsxs)(`div`,{className:`group flex items-center gap-2 px-3 py-1 transition-colors hover:bg-elevated`,children:[(0,X.jsx)(nr,{className:`size-3 shrink-0 text-fg-gold`}),(0,X.jsx)(Ka,{text:e.name,className:`text-xs text-fg`,hoverClass:Fs}),e.local_only&&(0,X.jsx)(Ls,{className:`text-warning`,children:`local only`}),(0,X.jsx)(Rs,{label:`Delete branch`,blockReason:null,onClick:()=>{l(null),s({kind:`branch`,name:e.name,localOnly:e.local_only})}})]},`br:${e.name}`))]}),(0,X.jsx)(ue,{open:o!==null,onOpenChange:e=>{e||s(null)},children:(0,X.jsxs)(R,{children:[o?.kind===`branch`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(F,{children:[(0,X.jsx)(ce,{children:`Delete branch`}),(0,X.jsxs)(le,{children:[`Delete branch `,(0,X.jsx)(`span`,{className:`text-fg`,children:o.name}),`? This removes the branch from the repository.`]})]}),o.localOnly&&(0,X.jsxs)(`p`,{className:`text-xs text-warning`,children:[(0,X.jsx)(`span`,{children:o.name}),` has commits on no remote — deleting it discards that work permanently.`]})]}):(0,X.jsxs)(F,{children:[(0,X.jsx)(ce,{children:`Prune worktree`}),(0,X.jsxs)(le,{children:[`Remove `,(0,X.jsx)(`span`,{className:`text-fg`,children:o?Is(o.path):``}),`? The working directory is deleted; the branch`,` `,(0,X.jsx)(`span`,{className:`text-fg`,children:o?.branch??``}),` is kept.`]})]}),c&&(0,X.jsx)(`p`,{className:`text-xs text-danger`,children:c}),(0,X.jsxs)(L,{children:[(0,X.jsx)(I,{type:`button`,variant:`ghost`,onClick:()=>s(null),children:`Cancel`}),(0,X.jsx)(I,{type:`button`,variant:`danger`,disabled:u,onClick:()=>{if(!o)return;l(null);let e=e=>l(e.message),t=()=>s(null);o.kind===`worktree`?i.mutate(o.path,{onSuccess:t,onError:e}):a.mutate({name:o.name,confirm:!0},{onSuccess:t,onError:e})},children:o?.kind===`branch`?`Delete`:`Prune`})]})]})})]})}var Bs=`DropdownMenu`,[Vs,Hs]=re(Bs,[qe]),Us=qe(),[Ws,Gs]=Vs(Bs),Ks=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Us(t),l=Z.useRef(null),[u,d]=ie({prop:i,defaultProp:a??!1,onChange:o,caller:Bs});return(0,X.jsx)(Ws,{scope:t,triggerId:ae(),triggerRef:l,contentId:ae(),open:u,onOpenChange:d,onOpenToggle:Z.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,X.jsx)(yt,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};Ks.displayName=Bs;var qs=`DropdownMenuTrigger`,Js=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Gs(qs,n),o=Us(n),s=ne(t,a.triggerRef);return(0,X.jsx)(gt,{asChild:!0,...o,children:(0,X.jsx)(z.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:se(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:se(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Js.displayName=qs;var Ys=`DropdownMenuPortal`,Xs=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Us(t);return(0,X.jsx)(_t,{...r,...n})};Xs.displayName=Ys;var Zs=`DropdownMenuContent`,Qs=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Gs(Zs,n),a=Us(n),o=Z.useRef(!1);return(0,X.jsx)(pt,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:se(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:se(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Qs.displayName=Zs;var $s=`DropdownMenuGroup`,ec=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Us(n);return(0,X.jsx)(ut,{...i,...r,ref:t})});ec.displayName=$s;var tc=`DropdownMenuLabel`,nc=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Us(n);return(0,X.jsx)(Qe,{...i,...r,ref:t})});nc.displayName=tc;var rc=`DropdownMenuItem`,ic=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Us(n);return(0,X.jsx)(at,{...i,...r,ref:t})});ic.displayName=rc;var ac=`DropdownMenuCheckboxItem`,oc=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Us(n);return(0,X.jsx)(rt,{...i,...r,ref:t})});oc.displayName=ac;var sc=`DropdownMenuRadioGroup`,cc=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Us(n);return(0,X.jsx)(bt,{...i,...r,ref:t})});cc.displayName=sc;var lc=`DropdownMenuRadioItem`,uc=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Us(n);return(0,X.jsx)(et,{...i,...r,ref:t})});uc.displayName=lc;var dc=`DropdownMenuItemIndicator`,fc=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Us(n);return(0,X.jsx)(it,{...i,...r,ref:t})});fc.displayName=dc;var pc=`DropdownMenuSeparator`,mc=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Us(n);return(0,X.jsx)(Xe,{...i,...r,ref:t})});mc.displayName=pc;var hc=`DropdownMenuArrow`,gc=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Us(n);return(0,X.jsx)(nt,{...i,...r,ref:t})});gc.displayName=hc;var _c=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=Us(t),[s,c]=ie({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,X.jsx)(Ge,{...o,open:s,onOpenChange:c,children:n})},vc=`DropdownMenuSubTrigger`,yc=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Us(n);return(0,X.jsx)(Ze,{...i,...r,ref:t})});yc.displayName=vc;var bc=`DropdownMenuSubContent`,xc=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Us(n);return(0,X.jsx)(vt,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});xc.displayName=bc;var Sc=Ks,Cc=Js,wc=Xs,Tc=Qs,Ec=ic,Dc=mc,Oc=_c,kc=yc,Ac=xc,jc=Sc,Mc=Cc,Nc=Oc;function Pc({className:e,sideOffset:t=4,...n}){return(0,X.jsx)(wc,{children:(0,X.jsx)(Tc,{sideOffset:t,className:H(`z-50 min-w-36 overflow-hidden rounded-md bg-elevated p-1 shadow-xl`,e),...n})})}function Fc({className:e,...t}){return(0,X.jsx)(Ec,{className:H(Re,De,`[&_svg]:size-3.5`,e),...t})}function Ic({className:e,children:t,...n}){return(0,X.jsxs)(kc,{className:H(Re,De,`data-[state=open]:bg-action data-[state=open]:text-action-ink [&_svg]:size-3.5`,e),...n,children:[t,(0,X.jsx)(Ot,{className:`ml-auto`})]})}function Lc({className:e,...t}){return(0,X.jsx)(wc,{children:(0,X.jsx)(Ac,{className:H(`z-50 min-w-36 overflow-hidden rounded-md bg-elevated p-1 shadow-xl`,e),...t})})}function Rc({className:e,...t}){return(0,X.jsx)(Dc,{className:H(`-mx-1 my-1 h-px bg-border`,e),...t})}function zc({text:e,className:t}){let n=(0,Z.useRef)(null);return(0,Z.useEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{e.scrollLeft=e.scrollWidth};t();let r=new ResizeObserver(t);return r.observe(e),()=>r.disconnect()},[e]),(0,X.jsx)(`div`,{ref:n,className:`no-scrollbar min-w-0 flex-1 overflow-x-auto`,children:(0,X.jsx)(`span`,{className:H(`inline-block whitespace-nowrap`,t),children:e})})}function Bc({sessions:e,target:t,showFileActions:n=!1,showPath:r=!1}){let{session:i,pinned:a,pin:o,unpin:s,isProjectDirectory:c}=t,l=_e().data?.home,u=e.filter(e=>e.status!==`archived`),d=i?c?ko(i.worktree_path,l):i.branch||hn(i):`No worktree`,f=i?ko(i.worktree_path,l):`No worktree`;return(0,X.jsxs)(`div`,{className:`group relative flex h-8 shrink-0 items-center px-2`,children:[(0,X.jsx)(zc,{text:r?f:d,className:`text-xs text-fg-secondary`}),(0,X.jsxs)(`div`,{className:H(`absolute inset-y-0 right-1 flex items-center gap-1 bg-surface pl-2 opacity-0 transition-opacity`,`pointer-events-none focus-within:pointer-events-auto focus-within:opacity-100 group-hover:pointer-events-auto group-hover:opacity-100`,a&&`pointer-events-auto opacity-100`),children:[n&&i&&(0,X.jsx)(Hc,{}),(0,X.jsxs)(`button`,{type:`button`,"aria-pressed":a,disabled:!i||c,title:c?`The project directory is the fallback binding — nothing to pin`:a?`Unpin — follow the active session`:`Pin the sidebar to this worktree`,onClick:()=>a?s():i&&o(i.id),className:H(`shrink-0 rounded-sm p-1 transition-colors disabled:pointer-events-none disabled:opacity-40`,a?`text-fg`:`text-fg-gold hover:bg-elevated hover:text-fg`),children:[(0,X.jsx)(lr,{className:H(`size-3.5`,a&&`fill-current`)}),(0,X.jsx)(`span`,{className:`sr-only`,children:a?`Unpin sidebar`:`Pin sidebar`})]}),(0,X.jsxs)(jc,{children:[(0,X.jsx)(Mc,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,title:`Bind a different worktree`,className:`shrink-0 rounded-sm p-1 text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[(0,X.jsx)(Et,{className:`size-3.5`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Choose a worktree`})]})}),(0,X.jsx)(Pc,{align:`end`,children:u.length===0?(0,X.jsx)(`div`,{className:`px-2 py-1.5 text-xs text-fg-muted`,children:`No sessions yet`}):u.map(e=>(0,X.jsx)(Fc,{onSelect:()=>o(e.id),children:(0,X.jsxs)(`span`,{className:`truncate`,children:[e.branch,` — `,hn(e)]})},e.id))})]})]})]})}var Vc=[{key:`refresh`,label:`Refresh`,icon:En},{key:`collapse`,label:`Collapse Folders`,icon:Fn}];function Hc(){let e=ns();if(!e)return null;let t=t=>{t===`refresh`?e.refresh():t===`collapse`&&e.collapseAll()};return(0,X.jsx)(`div`,{className:`hidden shrink-0 items-center gap-0.5 group-hover:flex group-focus-within:flex`,children:Vc.map(({key:e,label:n,icon:r})=>(0,X.jsxs)(K,{children:[(0,X.jsx)(G,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,onClick:()=>t(e),className:`rounded-sm p-1 text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[(0,X.jsx)(r,{className:`size-3.5`}),(0,X.jsx)(`span`,{className:`sr-only`,children:n})]})}),(0,X.jsx)(J,{children:n})]},e))})}var Uc=[{key:`files`,label:`Files`,icon:er},{key:`search`,label:`Search`,icon:Xt},{key:`changes`,label:`Changes`,icon:nr},{key:`worktrees`,label:`Worktrees`,icon:Ie}];function Wc(e){return e===`diff`||e===`history`||e===`changes`?`changes`:e===`search`?`search`:e===`worktrees`?`worktrees`:`files`}function Gc({mode:e,onExpand:t,onSelect:n}){return(0,X.jsxs)(`div`,{className:`flex h-full w-9 shrink-0 flex-col items-center gap-1 bg-surface py-1.5`,children:[(0,X.jsxs)(K,{children:[(0,X.jsx)(G,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,onClick:t,className:`flex items-center rounded-md p-1.5 text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[(0,X.jsx)(or,{className:`size-4`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Show sidebar`})]})}),(0,X.jsx)(J,{side:`right`,children:`Show sidebar`})]}),Uc.map(({key:t,label:r,icon:i})=>(0,X.jsxs)(K,{children:[(0,X.jsx)(G,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"aria-current":e===t?`page`:void 0,onClick:()=>n(t),className:H(`flex items-center rounded-md p-1.5 transition-colors`,e===t?`bg-elevated text-fg`:`text-fg-gold hover:bg-elevated hover:text-fg`),children:[(0,X.jsx)(i,{className:`size-4`}),(0,X.jsx)(`span`,{className:`sr-only`,children:r})]})}),(0,X.jsx)(J,{side:`right`,children:r})]},t))]})}function Kc({mode:e,onModeChange:t,onCollapse:n,projectId:r,repoId:i,sessions:a,target:o,onOpenFile:s,onOpenExternalFile:c,onOpenTerminalIn:l,activeFilePath:u,activeExternalTab:d,activeDiffPath:f,onOpenDiff:p,onOpenCommitFile:m,onOpenSearchFile:h}){let{session:g}=o,_=o.root,[v,y]=(0,Z.useState)(null),b=ye().data?.protocol,x=!b||b.major>10||b.major===10&&b.minor>=2,S=!b||b.major>12||b.major===12&&b.minor>=3,C=x&&v!==null&&v.forSession===g?.id?v.root:null,w=C??_,T=e=>{g&&(o.pinned||o.pin(g.id),y({forSession:g.id,root:e}))},E={...o,unpin(){y(null),o.unpin()}},D=`${g?.worktree_path??``}:${w??``}`;return(0,X.jsxs)(`div`,{className:`flex h-full flex-col bg-surface`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1.5`,children:[Uc.map(({key:n,label:r,icon:i})=>(0,X.jsxs)(K,{children:[(0,X.jsx)(G,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"aria-current":e===n?`page`:void 0,onClick:()=>t(n),className:H(`flex items-center rounded-md p-1.5 transition-colors`,e===n?`bg-elevated text-fg`:`text-fg-gold hover:bg-elevated hover:text-fg`),children:[(0,X.jsx)(i,{className:`size-4`}),(0,X.jsx)(`span`,{className:`sr-only`,children:r})]})}),(0,X.jsx)(J,{side:`bottom`,children:r})]},n)),(0,X.jsxs)(K,{children:[(0,X.jsx)(G,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,onClick:n,className:`ml-auto flex items-center rounded-md p-1.5 text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[(0,X.jsx)(ar,{className:`size-4`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Hide sidebar`})]})}),(0,X.jsx)(J,{side:`bottom`,children:`Hide sidebar`})]})]}),e!==`worktrees`&&e!==`files`&&(0,X.jsx)(Bc,{sessions:a,target:E,showPath:e===`search`}),e===`worktrees`&&(0,X.jsx)(zs,{repoId:i,projectId:r,sessions:a}),e===`files`&&(g&&C!==null?(0,X.jsx)(X.Fragment,{children:(0,X.jsx)(Cs,{session:g,root:C,readOnly:!S,boundHeader:(0,X.jsx)(Bc,{sessions:a,target:E,showFileActions:!0,showPath:!0}),onNavigateUp:()=>T(Uo(C)),onReset:()=>y(null),onOpenFile:(e,t)=>c(g.id,e,C,t),activePath:d?.root===C?d.path:null})}):g?(0,X.jsxs)(rs,{session:g,root:_,onOpenFile:_===void 0?s:(e,t,n)=>c(e,t,_,n),onOpenTerminal:_===void 0?e=>l(g.id,e):void 0,activePath:_===void 0?u:d?.root===_?d.path:null,children:[(0,X.jsx)(Bc,{sessions:a,target:E,showFileActions:!0,showPath:!0}),x&&_===void 0&&(0,X.jsxs)(`button`,{type:`button`,onClick:()=>T(Uo(g.worktree_path)),title:`Browse the parent directory`,className:`flex shrink-0 items-center gap-1.5 px-3 py-1 text-left transition-colors hover:bg-elevated`,children:[(0,X.jsx)(Ft,{className:`size-3 shrink-0 text-fg-gold`}),(0,X.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`..`})]}),(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,X.jsx)(bs,{})})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Bc,{sessions:a,target:E}),(0,X.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No worktree to show.`})]})),e===`changes`&&(g?(0,X.jsx)(Oo,{session:g.id,root:w,activeDiffPath:f,onOpenDiff:p,onOpenCommitFile:m},D):(0,X.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No worktree to show.`})),e===`search`&&(g?(0,X.jsx)(Ns,{session:g.id,root:w,onOpen:h},D):(0,X.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No worktree to search.`}))]})}function qc({projectId:e,repoId:t,open:n,kind:r=`agent`,seedAccountId:i,onOpenChange:o,onCreated:s}){let c=r===`terminal`,l=a(),u=Ee(l??void 0),d=he(l??void 0),f=Te(),p=_e(),m=Ue(),[h,g]=(0,Z.useState)(``),[_,v]=(0,Z.useState)(``),[y,b]=(0,Z.useState)(``),[x,S]=(0,Z.useState)(!0),[C,w]=(0,Z.useState)(!0),[T,E]=(0,Z.useState)(``),[D,O]=(0,Z.useState)(``),[k,A]=(0,Z.useState)(!1),[j,ee]=(0,Z.useState)(null),te=xe(l??void 0),M=(0,Z.useMemo)(()=>(te.data??[]).filter(e=>!e.archived),[te.data]),N=h||e,P=M.find(e=>e.id===N)?.repo_id??t,ne=f.data?.find(e=>e.id===P),re=ve(n?P:void 0),ie=de(n?P:void 0),ae=u.data?.find(e=>String(e.id)===_),oe=d.data?.allowSkipPermissions===!0,se=!c&&oe&&ae?.skip_permissions_default===!0,z=y.trim()||ne?.default_base_branch||``;(0,Z.useEffect)(()=>{n&&g(e)},[n,e]);let fe=(0,Z.useMemo)(()=>(ie.data?.worktrees??[]).filter(e=>e.branch===z).map(e=>({path:e.path,is_primary:e.is_primary,label:e.is_primary?`${e.path.split(`/`).filter(Boolean).pop()??e.path} (clone)`:e.path.split(`/`).filter(Boolean).pop()??e.path})),[ie.data,z]),pe=!x&&!C,me=fe.find(e=>e.is_primary)?.path??fe[0]?.path??``,B=D||me,ge=(0,Z.useMemo)(()=>{let e=d.data?.default_account_id;return u.data?.find(e=>e.id===i)??u.data?.find(t=>typeof e==`number`&&t.id===e)??u.data?.[0]},[u.data,d.data,i]),ye=_||(ge?String(ge.id):``);(0,Z.useEffect)(()=>{n&&i!==void 0&&v(String(i))},[n,i]);let V=(0,Z.useRef)(d.data);V.current=d.data,(0,Z.useEffect)(()=>{if(n){let e=Dt(c?`terminal`:`agent`,V.current);b(e.baseBranch),S(e.separateBranch),w(e.separateWorktree),O(``)}},[n,c,N]);let be=ne?.default_base_branch;(0,Z.useEffect)(()=>{!n||!be||b(e=>e===``?be:e)},[n,N,be]);let Se=()=>{ee(null),m.mutate({project_id:N,...c?{kind:`terminal`}:{account_id:Number(ye)},...y.trim()?{base_branch:y.trim()}:{},separate_branch:x,...x&&T.trim()?{branch:T.trim()}:{},...x?{}:{separate_worktree:C},...pe&&B?{join_worktree:B}:{},...se&&k?{skip_permissions:!0}:{}},{onSuccess:e=>{o(!1),E(``),A(!1),s(e)},onError:e=>ee(e.message)})},Ce=c?`a shell`:`an agent`,De=x?`on a new branch off ${z||`…`}, in its own directory`:pe?`on ${z||`…`}, sharing an existing directory`:`on ${z||`…`}, in its own directory`;return(0,X.jsx)(ue,{open:n,onOpenChange:o,children:(0,X.jsxs)(R,{children:[(0,X.jsxs)(F,{children:[(0,X.jsx)(ce,{children:c?`New terminal`:`New agent`}),(0,X.jsxs)(le,{children:[c?`Opens`:`Spawns`,` `,Ce,` in`,` `,(0,X.jsx)(Jc,{projects:M,value:N,onChange:g}),` `,De,`.`]})]}),(0,X.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),(c||ye)&&Se()},children:[!c&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(Ve,{children:`Account`}),u.data?.length===0?(0,X.jsxs)(`p`,{className:`text-sm text-fg-secondary`,children:[`No accounts yet —`,` `,(0,X.jsx)(`button`,{type:`button`,className:`text-accent underline`,onClick:()=>xn(`accounts`),children:`add one in settings`}),`.`]}):(0,X.jsxs)(Ct,{value:ye,onValueChange:v,children:[(0,X.jsx)(xt,{children:(0,X.jsx)(wt,{placeholder:`pick an account`})}),(0,X.jsx)(Tt,{children:u.data?.map(e=>(0,X.jsxs)(St,{value:String(e.id),children:[(0,X.jsxs)(`span`,{children:[e.agent_type,`/`,e.label]}),!e.logged_in&&(0,X.jsx)(`span`,{className:`ml-2 text-2xs text-warning`,children:`not logged in`})]},e.id))})]})]}),(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,X.jsx)(Ve,{htmlFor:`base-branch`,children:`Base branch`}),(0,X.jsx)(ze,{id:`base-branch`,placeholder:ne?.default_base_branch??`main`,value:y,onValueChange:b,hints:(re.data?.branches??[]).filter(e=>e.name.toLowerCase().includes(y.trim().toLowerCase())).slice(0,20).map(e=>({value:e.name,badge:e.name===ne?.default_base_branch?`default`:e.is_session?`session: ${e.session_title??`untitled`}`:void 0})),hintsClassName:`w-max min-w-full max-w-[36rem]`})]}),x&&(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,X.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,X.jsx)(Ve,{htmlFor:`session-branch`,children:`New branch`}),(0,X.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`optional`})]}),(0,X.jsx)(we,{id:`session-branch`,placeholder:`leave blank for auto`,value:T,onChange:e=>E(e.target.value)})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(zt,{id:`separate-branch`,checked:x,onCheckedChange:e=>{S(e),e&&w(!0)}}),(0,X.jsx)(Ve,{htmlFor:`separate-branch`,children:`Use separate branch`})]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(zt,{id:`separate-worktree`,checked:x?!0:C,disabled:x,onCheckedChange:w}),(0,X.jsx)(Ve,{htmlFor:`separate-worktree`,className:H(x&&`text-fg-muted`),children:`Use separate directory`})]})]}),pe&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(Ve,{htmlFor:`join-dir`,children:`Directory to join`}),fe.length===0?(0,X.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[`No existing directory on`,` `,(0,X.jsx)(`span`,{className:`text-fg-secondary`,children:z||`…`}),` — a shared one will be created for later sessions to join.`]}):(0,X.jsxs)(Ct,{value:B,onValueChange:O,children:[(0,X.jsx)(xt,{id:`join-dir`,children:(0,X.jsx)(wt,{})}),(0,X.jsx)(Tt,{children:fe.map(e=>(0,X.jsx)(St,{value:e.path,title:e.path,detail:(0,X.jsx)(`span`,{className:`ml-auto min-w-0 truncate text-2xs text-fg-muted`,children:ko(e.path,p.data?.home)}),children:e.label},e.path))})]})]}),!x&&!c&&(0,X.jsxs)(`p`,{className:`text-xs text-warning`,children:[`The `,c?`shell`:`agent`,` commits straight to`,` `,(0,X.jsx)(`span`,{children:z||`…`}),pe?` and shares its working directory with concurrent sessions — they can trample each other’s edits.`:`.`]}),se&&(0,X.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md bg-surface px-3 py-2`,children:[(0,X.jsx)(zt,{id:`skip-permissions`,checked:k,onCheckedChange:A}),(0,X.jsx)(Ve,{htmlFor:`skip-permissions`,className:`text-warning`,children:`Skip permission prompts for this session`})]}),j&&(0,X.jsx)(`p`,{className:`text-xs text-danger`,children:j}),(0,X.jsxs)(L,{children:[(0,X.jsx)(I,{type:`button`,variant:`ghost`,onClick:()=>o(!1),children:`Cancel`}),(0,X.jsx)(I,{type:`submit`,disabled:!c&&!ye||m.isPending,children:c?`Open terminal`:`Start agent`})]})]})]})})}function Jc({projects:e,value:t,onChange:n}){let r=e.find(e=>e.id===t)?.name??`this project`;return e.length<2?(0,X.jsx)(`span`,{className:`text-fg-secondary`,children:r}):(0,X.jsxs)(jc,{children:[(0,X.jsx)(Mc,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,title:`Choose the project`,className:`inline-flex items-center gap-0.5 text-fg-secondary transition-colors hover:text-fg`,children:[r,(0,X.jsx)(Et,{className:`size-3 shrink-0`})]})}),(0,X.jsx)(Pc,{align:`start`,children:e.map(e=>(0,X.jsx)(Fc,{onSelect:()=>n(e.id),className:H(`truncate`,e.id===t&&`text-fg`),children:e.name},e.id))})]})}var Yc=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Xc(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function Zc(e){return`nodeType`in e}function Qc(e){return e?Xc(e)?e:Zc(e)?e.ownerDocument?.defaultView??window:window:window}function $c(e){let{Document:t}=Qc(e);return e instanceof t}function el(e){return!Xc(e)&&e instanceof Qc(e).HTMLElement}function tl(e){return e instanceof Qc(e).SVGElement}function nl(e){return e?Xc(e)?e.document:Zc(e)?$c(e)?e:el(e)||tl(e)?e.ownerDocument:document:document:document}var rl=Yc?Z.useLayoutEffect:Z.useEffect;function il(e){let t=(0,Z.useRef)(e);return rl(()=>{t.current=e}),(0,Z.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function al(){let e=(0,Z.useRef)(null);return[(0,Z.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,Z.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function ol(e,t){t===void 0&&(t=[e]);let n=(0,Z.useRef)(e);return rl(()=>{n.current!==e&&(n.current=e)},t),n}function sl(e,t){let n=(0,Z.useRef)();return(0,Z.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function cl(e){let t=il(e),n=(0,Z.useRef)(null);return[n,(0,Z.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function ll(e){let t=(0,Z.useRef)();return(0,Z.useEffect)(()=>{t.current=e},[e]),t.current}var ul={};function dl(e,t){return(0,Z.useMemo)(()=>{if(t)return t;let n=ul[e]==null?0:ul[e]+1;return ul[e]=n,e+`-`+n},[e,t])}function fl(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var pl=fl(1),ml=fl(-1);function hl(e){return`clientX`in e&&`clientY`in e}function gl(e){if(!e)return!1;let{KeyboardEvent:t}=Qc(e.target);return t&&e instanceof t}function _l(e){if(!e)return!1;let{TouchEvent:t}=Qc(e.target);return t&&e instanceof t}function vl(e){if(_l(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return hl(e)?{x:e.clientX,y:e.clientY}:null}var yl=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[yl.Translate.toString(e),yl.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),bl=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function xl(e){return e.matches(bl)?e:e.querySelector(bl)}var Sl={display:`none`};function Cl(e){let{id:t,value:n}=e;return Z.createElement(`div`,{id:t,style:Sl},n)}function wl(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return Z.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function Tl(){let[e,t]=(0,Z.useState)(``);return{announce:(0,Z.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var El=(0,Z.createContext)(null);function Dl(e){let t=(0,Z.useContext)(El);(0,Z.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function Ol(){let[e]=(0,Z.useState)(()=>new Set),t=(0,Z.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,Z.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var kl={draggable:`
|
|
4
4
|
To pick up a draggable item, press the space bar.
|
|
5
5
|
While dragging, use the arrow keys to move the item.
|