@puddle-code/cli 0.0.13 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +4 -9
  2. package/README.md +11 -4
  3. package/dist/index.js +446 -166
  4. package/dist/public/assets/{Dashboard-T4hbzT6P.js → Dashboard-C0aXpVU1.js} +1 -1
  5. package/dist/public/assets/{EditorTabClose-DxU5M-9J.js → EditorTabClose-DBiuZxHR.js} +1 -1
  6. package/dist/public/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  7. package/dist/public/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  8. package/dist/public/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  9. package/dist/public/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  10. package/dist/public/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  11. package/dist/public/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  12. package/dist/public/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  13. package/dist/public/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  14. package/dist/public/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  15. package/dist/public/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  16. package/dist/public/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  17. package/dist/public/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  18. package/dist/public/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  19. package/dist/public/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  20. package/dist/public/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  21. package/dist/public/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  22. package/dist/public/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  23. package/dist/public/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  24. package/dist/public/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  25. package/dist/public/assets/{LazyTerminal-Dpk5-lcY.js → LazyTerminal-yHVhpi-E.js} +2 -2
  26. package/dist/public/assets/{ModelRefcount-BGB1nvG5.js → ModelRefcount-ByUhfyK3.js} +1 -1
  27. package/dist/public/assets/PaneEditorBody-9TcMQDtu.js +322 -0
  28. package/dist/public/assets/PaneEditorBody-Dz-67XSV.css +1 -0
  29. package/dist/public/assets/{SettingsDialog-58D8eQOa.js → SettingsDialog-BJgpD7Gc.js} +1 -1
  30. package/dist/public/assets/{Terminal-DlXSwAG0.js → Terminal-CiY2j4Lf.js} +1 -1
  31. package/dist/public/assets/{Workspace-B_eXJKAN.js → Workspace-CuEhq5jJ.js} +2 -2
  32. package/dist/public/assets/_virtual_katex-inline-css-DN-_JSKR.js +2 -0
  33. package/dist/public/assets/{buffer-store-zsL8CNKc.js → buffer-store-DXk7xJbf.js} +2 -2
  34. package/dist/public/assets/{context-menu-C8MwVsBG.js → context-menu-Bw30Lg7d.js} +1 -1
  35. package/dist/public/assets/{cssMode-Dzho6NMm.js → cssMode-CLS4Lxn3.js} +1 -1
  36. package/dist/public/assets/{htmlMode-pj_l07tD.js → htmlMode-D06Q5AQV.js} +1 -1
  37. package/dist/public/assets/{index-oAv85qtL.js → index-Ba4ffI1I.js} +4 -4
  38. package/dist/public/assets/index-DWY2t2XS.css +2 -0
  39. package/dist/public/assets/{jsonMode-Dx2T0LuI.js → jsonMode-BvuUERD4.js} +1 -1
  40. package/dist/public/assets/{session-seed-C8M00YNU.js → session-seed-Y4nqH0Gc.js} +1 -1
  41. package/dist/public/assets/ssh-mode-BvVBPtPI.js +1 -0
  42. package/dist/public/assets/{tsMode-DXWeq4NK.js → tsMode-B3xMhn80.js} +1 -1
  43. package/dist/public/index.html +3 -3
  44. package/package.json +1 -1
  45. package/dist/public/assets/PaneEditorBody-DX0u3ISF.js +0 -66
  46. package/dist/public/assets/index-DK5CyY2G.css +0 -2
  47. package/dist/public/assets/ssh-mode-BdHO6hP9.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PaneEditorBody-DX0u3ISF.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/jsx-runtime-ffCh33zF.js","assets/editor-tabs-D0_DZriG.js","assets/poll-focus-B7dQPFj6.js","assets/api-Bh5IJ30S.js","assets/createLucideIcon-DyMAgLa3.js","assets/index-oAv85qtL.js","assets/preload-helper-Czpn1I53.js","assets/dialog-B43iKmfK.js","assets/utils-B6KiDbIe.js","assets/LazyTerminal-Dpk5-lcY.js","assets/index-DK5CyY2G.css","assets/editor.api2-4X9Vh9Zw.js","assets/editor-Br_kD0ds.css","assets/buffer-store-zsL8CNKc.js","assets/buffer-logic-BrpRsL1b.js","assets/editor-sync-F3Wyveaa.js","assets/debounce-B9DrqirV.js","assets/ModelRefcount-BGB1nvG5.js","assets/EditorTabClose-DxU5M-9J.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{o as i}from"./poll-focus-B7dQPFj6.js";import{C as a,S as o,a as s,d as c,f as l,g as u,h as d,l as f,m as p,n as m,p as h,r as g,s as _,t as v,u as y,w as b,x,y as S}from"./editor-tabs-D0_DZriG.js";import{t as C}from"./preload-helper-Czpn1I53.js";import{c as w,l as T,v as E,x as D}from"./api-Bh5IJ30S.js";import{A as ee,O,_ as k,a as te,b as A,g as j,h as ne,i as re,j as M,n as N,o as ie,r as ae,t as P,w as oe}from"./dialog-B43iKmfK.js";import{$ as se,C as ce,E as F,G as I,J as le,K as ue,N as de,Q as L,U as fe,V as pe,W as me,Y as he,Z as R,c as ge,ct as _e,f as ve,g as ye,h as be,j as xe,l as Se,m as Ce,n as we,nt as Te,o as Ee,q as De,r as Oe,rt as ke,s as Ae,st as je,t as Me,tt as Ne,u as Pe,w as Fe}from"./LazyTerminal-Dpk5-lcY.js";import{t as z}from"./utils-B6KiDbIe.js";import{t as B}from"./createLucideIcon-DyMAgLa3.js";import{A as Ie,C as Le,D as Re,E as ze,O as Be,S as Ve,T as He,_ as Ue,a as We,b as Ge,c as Ke,d as qe,f as Je,g as Ye,h as Xe,i as Ze,j as Qe,l as $e,m as et,n as tt,o as nt,p as rt,r as V,s as it,t as at,u as ot,v as st,w as ct,x as lt,y as ut}from"./context-menu-C8MwVsBG.js";import{a as dt,i as ft,n as pt,o as mt,r as ht,s as gt,t as _t}from"./session-seed-C8M00YNU.js";import{i as vt,r as yt}from"./dist-VDiYuPKw.js";import{$ as bt,G as xt,I as St,K as Ct,P as wt,Q as Tt,R as Et,S as Dt,U as Ot,W as kt,X as At,Z as jt,_ as Mt,a as Nt,ct as Pt,et as Ft,g as It,i as Lt,j as Rt,lt as zt,n as Bt,s as Vt,t as Ht,ut as Ut,w as Wt}from"./index-oAv85qtL.js";import{t as Gt}from"./debounce-B9DrqirV.js";import{i as Kt}from"./buffer-logic-BrpRsL1b.js";import{t as qt}from"./ssh-mode-BdHO6hP9.js";var Jt=B(`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`}]]),Yt=B(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),Xt=B(`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`}]]),Zt=B(`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`}]]),Qt=B(`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`}]]),$t=B(`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`}]]),en=B(`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`}]]),tn=B(`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`}]]),H=B(`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`}]]),nn=B(`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`}]]),rn=B(`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`}]]),an=B(`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`}]]),on=B(`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`}]]),sn=B(`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`}]]),cn=B(`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`}]]),ln=B(`file-plus`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),un=B(`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`}]]),dn=B(`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`}]]),fn=B(`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`}]]),pn=B(`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`}]]),mn=B(`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`}]]),hn=B(`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`}]]),gn=B(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),_n=B(`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`}]]),vn=B(`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`}]]),yn=B(`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`}]]),bn=B(`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`}]]),xn=B(`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`}]]),Sn=B(`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`}]]),Cn=B(`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`}]]),wn=B(`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`}]]),Tn=B(`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`}]]),En=B(`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`}]]),Dn=B(`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`}]]),On=B(`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`}]]),kn=B(`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`}]]),An=B(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),jn=B(`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`}]]),Mn=B(`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`}]]),U=r(),W=e(t(),1);function Nn(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function Pn(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function Fn(e){return e/100*window.innerHeight}function In(e){return e/100*window.innerWidth}function Ln(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 Rn({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=Ln(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=Pn(t,i);break;case`em`:r=Nn(t,i);break;case`vh`:r=Fn(i);break;case`vw`:r=In(i);break}return r}function G(e){return parseFloat(e.toFixed(3))}function zn({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 Bn(e){let{panels:t}=e,n=zn({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=G(Rn({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=G(Rn({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=G(Rn({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=G(Rn({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 K(e,t=`Assertion error`){if(!e)throw Error(t)}function Vn(e,t){return Array.from(t).sort(e===`horizontal`?Hn:Un)}function Hn(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function Un(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function Wn(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Gn(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 Kn({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}=Gn(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return K(i,`No rect found`),i}var qn;function Jn(){return qn===void 0&&(qn=typeof matchMedia==`function`&&!!matchMedia(`(pointer:coarse)`).matches),qn}function Yn(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Vn(n,Array.from(t.children).filter(Wn).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,Kn({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=Jn()?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:zn({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 Xn=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)}}},Zn={cursorFlags:0,state:`inactive`},Qn=new Xn;function $n(){return Zn}function er(e){return Qn.addListener(`change`,e)}function tr(e){let t=Zn,n={...Zn};n.cursorFlags=e,Zn=n,Qn.emit(`change`,{prev:t,next:n})}function nr(e){let t=Zn;Zn=e,Qn.emit(`change`,{prev:t,next:e})}var rr=e=>e,ir=()=>{},ar=1,or=2,sr=4,cr=8,lr=3,ur=12,dr;function fr(){return dr===void 0&&(dr=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(dr=!0)),dr}function pr({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&&fr()){let t=(e&ar)!==0,n=(e&or)!==0,r=(e&sr)!==0,i=(e&cr)!==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 fr()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var mr=new WeakMap;function hr(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=mr.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=$n();switch(r.state){case`active`:case`hover`:{let e=pr({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}mr.set(e,{prevStyle:t,styleSheet:n})}var gr=new Map,_r=new Xn;function vr(e){gr=new Map(gr),gr.delete(e)}function yr(e,t){for(let[t]of gr)if(t.id===e)return t}function br(e,t){for(let[t,n]of gr)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function xr(){return gr}function Sr(e,t){return _r.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function Cr(e,t,n){let r=gr.get(e);gr=new Map(gr),gr.set(e,t),_r.emit(`groupChange`,{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:r,next:t})}function wr(e){let t=$n(),n=!1;switch(t.state){case`active`:nr({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(hr(e),n=!0,t.hitRegions.forEach(e=>{let t=br(e.group.id,!0);Cr(e.group,t,{isUserInteraction:!0})}))}return n}function Tr(e){e.defaultPrevented||wr(e.currentTarget)}function Er(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Gn(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 Dr(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Or(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:Pr(e),b:Pr(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();K(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:Nr(Mr(n.a)),b:Nr(Mr(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 kr=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Ar(e){let t=getComputedStyle(Fr(e)??e).display;return t===`flex`||t===`inline-flex`}function jr(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||Ar(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`||kr.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Mr(e){let t=e.length;for(;t--;){let n=e[t];if(K(n,`Missing node`),jr(n))return n}return null}function Nr(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Pr(e){let t=[];for(;e;)t.push(e),e=Fr(e);return t}function Fr(e){let{parentNode:t}=e;return Dr(t)?t.host:t}function Ir(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 Lr({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Wn(n)||n.contains(e)||e.contains(n))return!0;if(Or(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Ir(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Rr(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Yn(r),a=Er(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Lr({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function zr(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 q(e,t,n=0){return Math.abs(G(e)-G(t))<=n}function Br(e,t){return q(e,t)?0:e>t?1:-1}function Vr({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(Br(r,c)<0)if(a){let e=(i+c)/2;r=Br(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=G(r),r}function Hr({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(q(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;K(u!=null,`Invalid first pivot index`),K(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];K(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(K(n!=null,`Previous layout not found for panel index ${t}`),q(n,i)){let t=o-n;Br(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];K(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(K(n!=null,`Previous layout not found for panel index ${t}`),q(n,o)){let t=n-i;Br(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];K(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&Br(i,c)<0)if(e>0){let t=c-o,n=t/2;Br(i+e,c)<0&&(e=Br(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;Br(i-e,c)<0&&(e=Br(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];K(e!=null,`Previous layout not found for panel index ${r}`);let a=Vr({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];K(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=Vr({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!q(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(zr(c,l))return i;{let t=e<0?d:u,r=s[t];K(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=Vr({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!q(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];K(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=Vr({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(q(i,s)||(t-=s-i,l[r]=s),q(t,0))break;e>0?r--:r++}}}if(!q(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 Ur(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||Br(e[n],t[n])!==0)return!1;return!0}function Wr({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(!q(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];K(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];K(i!=null,`No layout data found for index ${e}`);let o=r[e];K(o!=null,`No layout data found for index ${e}`);let s=Vr({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!q(a,0))for(let e=0;e<t.length;e++){let n=r[e];K(n!=null,`No layout data found for index ${e}`);let i=n+a,o=Vr({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,q(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Gr({groupId:e,panelId:t}){let n=()=>{let t=xr();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&&q(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:G(100-e)}}return Hr({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=Wr({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});Ur(c,u)||Cr(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&&q(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=zn({group:t}),o=G(Rn({groupSize:a,panelElement:r,styleProp:e})/a*100);s(o)}}}function Kr(e){e.defaultPrevented||Rr(e,xr()).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=Gr({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function qr(e){let t=xr();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 Jr({groupId:e}){let t=()=>{let t=xr();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=Wr({layout:e,panelConstraints:r});return n?o:(Ur(o,c)||Cr(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function Yr(e,t){let n=qr(e),r=br(n.id,!0),i=n.separators.find(t=>t.element===e);K(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);K(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=Jr({groupId:n.id}).getLayout(),c=Wr({layout:Hr({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Ur(s,c)||Cr(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function Xr(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=qr(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Yr(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Yr(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Yr(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Yr(t,-5);break;case`End`:e.preventDefault(),Yr(t,100);break;case`Enter`:{e.preventDefault();let n=qr(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=br(n.id,!0),o=n.separators.find(e=>e.element===t);K(o,`Matching separator not found`);let s=a.get(o);K(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(K(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Yr(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=qr(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);K(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(),Yr(t,-100);break}}function Zr(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=xr(),n=Rr(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)}),nr({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}function Qr({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=Hr({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Ur(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?ar:or;break;case`vertical`:s|=d<0?sr:cr;break}}else Cr(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&lr:c|=s&lr,t.movementY===0?c|=o&ur:c|=s&ur,tr(c),hr(e)}function $r(e){let t=xr(),n=$n();switch(n.state){case`active`:Qr({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function ei(e){if(e.defaultPrevented)return;let t=$n(),n=xr();switch(t.state){case`active`:if(e.buttons===0){nr({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=br(e.group.id,!0);Cr(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)}Qr({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Rr(e,n);r.length===0?t.state!==`inactive`&&nr({cursorFlags:0,state:`inactive`}):nr({cursorFlags:0,hitRegions:r,state:`hover`}),hr(e.currentTarget);break}}}function ti(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch($n().state){case`hover`:nr({cursorFlags:0,state:`inactive`})}}function ni(e){e.defaultPrevented||e.pointerType===`mouse`&&e.button>0||wr(e.currentTarget)&&e.preventDefault()}function ri(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=G(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=G((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function ii(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=zn({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:G(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function ai(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 oi({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=G(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]=G((r[e]??0)/a*l);else{let e=G(l/c.length);for(let t of c)u[t]=e}return u}function si(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 ci=new Map;function li(e){let t=!0;K(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=zn({group:e});if(t===0)return;let n=br(e.id);if(!n)return;let r=Bn(e),i=n.defaultLayoutDeferred?ri(r):n.layout,a=Wr({layout:oi({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Ur(n.layout,a)&&ai(n.derivedPanelConstraints,r)&&n.groupSize===t)return;Cr(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else ii(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{K(!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=zn({group:e}),s=Bn(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(si(e.panels,l)||(l=void 0));let u=Wr({layout:e.mutableState.layouts[c]??l??ri(s),panelConstraints:s}),d=e.element.ownerDocument;ci.set(d,(ci.get(d)??0)+1);let f=new Map;return Yn(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),Cr(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{K(!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`,Xr)}),ci.get(d)===1&&(d.addEventListener(`contextmenu`,Tr,!0),d.addEventListener(`dblclick`,Kr,!0),d.addEventListener(`pointerdown`,Zr,!0),d.addEventListener(`pointerleave`,$r),d.addEventListener(`pointermove`,ei),d.addEventListener(`pointerout`,ti),d.addEventListener(`pointerup`,ni,!0)),function(){t=!1,ci.set(d,Math.max(0,(ci.get(d)??0)-1)),vr(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,Xr)}),ci.get(d)||(d.removeEventListener(`contextmenu`,Tr,!0),d.removeEventListener(`dblclick`,Kr,!0),d.removeEventListener(`pointerdown`,Zr,!0),d.removeEventListener(`pointerleave`,$r),d.removeEventListener(`pointermove`,ei),d.removeEventListener(`pointerout`,ti),d.removeEventListener(`pointerup`,ni,!0)),a.disconnect()}}function ui(){let[e,t]=(0,W.useState)({});return[e,(0,W.useCallback)(()=>t({}),[])]}function di(e){let t=(0,W.useId)();return`${e??t}`}var fi=typeof window<`u`?W.useLayoutEffect:W.useEffect;function pi(e){let t=(0,W.useRef)(e);return fi(()=>{t.current=e},[e]),(0,W.useCallback)((...e)=>t.current?.(...e),[t])}function mi(...e){return pi(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function hi(e){let t=(0,W.useRef)({...e});return fi(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var gi=(0,W.createContext)(null);function _i(e,t){let n=(0,W.useRef)({getLayout:()=>({}),setLayout:rr});(0,W.useImperativeHandle)(t,()=>n.current,[]),fi(()=>{Object.assign(n.current,Jr({groupId:e}))})}function vi({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,W.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=pi(e=>{Ur(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=pi((e,t)=>{Ur(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e,{isUserInteraction:t}))}),_=di(s),v=(0,W.useRef)(null),[y,b]=ui(),x=(0,W.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=mi(v,a);_i(_,o);let C=pi((e,t)=>{let r=$n(),i=yr(e),a=br(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=hi({defaultLayout:n,disableCursor:r}),T=(0,W.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=Vn(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Vn(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=yr(_),i=br(_);r&&i&&Cr(r,{...i,derivedPanelConstraints:Bn(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,W.useRef)(null);return fi(()=>{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=li(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=br(r.id,!0);!o&&s.length>0&&(h(c),g(c,!1));let l=Sr(_,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=q(t.collapsedSize,i[t.panelId]),a=q(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=$n().state!==`active`;h(i),o&&g(i,e.isUserInteraction)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,W.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,U.jsx)(gi.Provider,{value:T,children:(0,U.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})})}vi.displayName=`Group`;function yi(){let e=(0,W.useContext)(gi);return K(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function bi(e,t){let{id:n}=yi(),r=(0,W.useRef)({collapse:ir,expand:ir,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:ir});(0,W.useImperativeHandle)(t,()=>r.current,[]),fi(()=>{Object.assign(r.current,Gr({groupId:n,panelId:e}))})}function xi({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=di(c),_=hi({disabled:a}),v=(0,W.useRef)(null),y=mi(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=yi(),T=d!==null,E=pi((e,t,n)=>{d?.(e,c,n)});fi(()=>{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,W.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),bi(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},ee=(0,W.useSyncExternalStore)(e=>Sr(x,e),D,D),O;return O=ee?JSON.parse(ee):i===void 0?{flexGrow:1}:{flexGrow:void 0,flexShrink:void 0,flexBasis:i},(0,U.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...Si,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...O},children:(0,U.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}xi.displayName=`Panel`;var Si={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Ci({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=Wr({layout:Hr({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Wr({layout:Hr({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function wi({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=di(a),l=hi({disabled:n,disableDoubleClick:r}),[u,d]=(0,W.useState)({}),[f,p]=(0,W.useState)(`inactive`),[m,h]=(0,W.useState)(!1),g=(0,W.useRef)(null),_=mi(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=yi(),C=b===`horizontal`?`vertical`:`horizontal`;fi(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=er(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Sr(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(Ci({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[y,c,x,l]),(0,W.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,U.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})}wi.displayName=`Separator`;function Ti(e,t,n){let r=n.snapshot.explorer_pin,i=r===null?null:e.find(e=>e.id===r&&e.status!==`archived`)??null;return{session:i??e.find(e=>e.id===t)??null,pinned:i!==null,pin(e){n.update({explorer_pin:e})},unpin(){n.update({explorer_pin:null})}}}var Ei=null,Di=null;async function Oi(){let[e,t]=await Promise.all([C(()=>import(`./PaneEditorBody-DX0u3ISF.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])),C(()=>import(`./ModelRefcount-BGB1nvG5.js`),__vite__mapDeps([20,1,2,16,9,8,3,5,6,10,11,7,12,13,14,15,17]))]);Ei=e.PaneEditorBody,Di=t.ModelRefcount}var ki=(0,W.lazy)(()=>C(()=>import(`./PaneEditorBody-DX0u3ISF.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 Ai(e){return Ei?(0,U.jsx)(Ei,{...e}):(0,U.jsx)(W.Suspense,{fallback:(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center bg-ground text-xs text-fg-muted`,children:`Loading editor…`}),children:(0,U.jsx)(ki,{...e})})}var ji=(0,W.lazy)(()=>C(()=>import(`./ModelRefcount-BGB1nvG5.js`).then(e=>({default:e.ModelRefcount})),__vite__mapDeps([20,1,2,16,9,8,3,5,6,10,11,7,12,13,14,15,17])));function Mi({buffers:e}){return Di?(0,U.jsx)(Di,{buffers:e}):(0,U.jsx)(W.Suspense,{fallback:null,children:(0,U.jsx)(ji,{buffers:e})})}var Ni=(0,W.lazy)(()=>C(()=>import(`./EditorTabClose-DxU5M-9J.js`).then(e=>({default:e.EditorTabClose})),__vite__mapDeps([21,1,2,3,10,11,7,16,9,8,5,6,12,13,14,15,17,18,19])));function Pi(e){return(0,U.jsx)(W.Suspense,{fallback:(0,U.jsx)(`button`,{onClick:t=>{t.stopPropagation(),e.onClose()},className:`flex size-4 items-center justify-center rounded-sm text-fg-muted opacity-0 transition-opacity hover:text-fg group-hover:opacity-100`,"aria-label":`Close ${e.label}`,children:`×`}),children:(0,U.jsx)(Ni,{...e})})}var Fi=e(n(),1);function Ii(){return crypto.randomUUID()}function J(e){return e.type===`terminal`?`term:${e.session}`:`editor:${v(e.tab)}`}function Li(e,t){return J(e)===J(t)}function Ri(e){return e.type===`terminal`}function zi(e=[],t){let n=e.map(J),r=t&&n.includes(t)?t:n.length>0?n[0]:null;return{kind:`leaf`,id:Ii(),tabs:e,activeKey:r,previewKey:null}}function Bi(e,t,n){return{kind:`split`,id:Ii(),direction:e,children:t,sizes:n??t.map(()=>100/Math.max(1,t.length))}}function Vi(e,t){if(e.kind===`leaf`)return e.id===t?e:null;for(let n of e.children){let e=Vi(n,t);if(e)return e}return null}function Hi(e,t){if(e.kind===`leaf`)return e.tabs.some(e=>J(e)===t)?e:null;for(let n of e.children){let e=Hi(n,t);if(e)return e}return null}function Ui(e){return e.kind===`leaf`?[e]:e.children.flatMap(Ui)}function Wi(e){return Ui(e).flatMap(e=>e.tabs)}function Gi(e){let t=e.tabs.map(J),n=e.activeKey&&t.includes(e.activeKey)?e.activeKey:t[0]??null,r=e.previewKey&&t.includes(e.previewKey)?e.previewKey:null;return n===e.activeKey&&r===(e.previewKey??null)?e:{...e,activeKey:n,previewKey:r}}function Ki(e){if(e.kind===`leaf`)return Gi(e);let t=e.children.map(Ki),n=[],r=[];t.forEach((t,i)=>{let a=e.sizes[i]??1;if(t.kind===`split`&&t.direction===e.direction){let e=t.sizes.reduce((e,t)=>e+t,0)||t.children.length;t.children.forEach((i,o)=>{n.push(i),r.push(a*(t.sizes[o]??1)/e)})}else n.push(t),r.push(a)});let i=[],a=[];return n.forEach((e,t)=>{e.kind===`leaf`&&e.tabs.length===0||(i.push(e),a.push(r[t]??1))}),i.length===0?zi([]):i.length===1?i[0]:{...e,children:i,sizes:a}}function qi(e,t,n){return e.kind===`leaf`?e.id===t?n(e):e:{...e,children:e.children.map(e=>qi(e,t,n))}}function Ji(e,t){if(e.kind===`leaf`){if(!e.tabs.some(e=>J(e)===t))return e;let n=e.tabs.filter(e=>J(e)!==t),r=e.activeKey===t?Yi(e,t):e.activeKey;return{...e,tabs:n,activeKey:r}}return{...e,children:e.children.map(e=>Ji(e,t))}}function Yi(e,t){let n=e.tabs.findIndex(e=>J(e)===t);if(n===-1)return e.activeKey;let r=e.tabs.filter(e=>J(e)!==t);return r.length===0?null:J(r[Math.min(n,r.length-1)])}function Xi(e,t,n){let r=e.tabs.filter(e=>!Li(e,t)),i=n===void 0?r.length:Math.max(0,Math.min(n,r.length)),a=[...r.slice(0,i),t,...r.slice(i)];return{...e,tabs:a,activeKey:J(t)}}function Zi(e,t,n,r){let i=n===`left`||n===`right`?`row`:`col`,a=n===`left`||n===`top`;return Ki(qi(e,t,e=>{let t=zi([r]);return Bi(i,a?[t,e]:[e,t],[50,50])}))}function Qi(e,t){let{ref:n,toLeafId:r,edge:i}=t,a=J(n),o=t.index;if(i===`center`&&o!==void 0){let t=Vi(e,r)?.tabs.findIndex(e=>J(e)===a)??-1;t!==-1&&t<o&&--o}let s=Ji(e,a);if(i===`center`){let e=qi(s,r,e=>Xi(e,n,o));return!Vi(e,r)&&!Hi(e,a)?ra(Ki($i(e,n)),a):ra(Ki(e),a)}return Vi(s,r)?ra(Zi(s,r,i,n),a):Ki(zi([n]))}function $i(e,t){let n=Ui(e)[0];return n?qi(e,n.id,e=>Xi(e,t)):zi([t])}function ea(e,t,n){return Ki(qi(e,t,e=>e.tabs.some(e=>J(e)===n)?{...e,tabs:e.tabs.filter(e=>J(e)!==n),activeKey:e.activeKey===n?Yi(e,n):e.activeKey}:e))}function ta(e,t,n){let r=J(n);return Ki(qi(e,t,e=>{let t=e.previewKey===r?null:e.previewKey;return e.tabs.some(e=>Li(e,n))?{...e,activeKey:r,previewKey:t}:{...e,tabs:[...e.tabs,n],activeKey:r,previewKey:t}}))}function na(e,t,n){let r=J(n);return Ki(qi(e,t,e=>{if(e.tabs.some(e=>Li(e,n)))return{...e,activeKey:r};let t=e.previewKey?e.tabs.findIndex(t=>J(t)===e.previewKey):-1,i=t>=0&&!Ri(e.tabs[t])?e.tabs.map((e,r)=>r===t?n:e):[...e.tabs,n];return{...e,tabs:i,activeKey:r,previewKey:r}}))}function ra(e,t){let n=e=>e.kind===`leaf`?e.previewKey===t?{...e,previewKey:null}:e:{...e,children:e.children.map(n)};return n(e)}function ia(e,t,n){let r=e=>e.kind===`leaf`?{...e,tabs:e.tabs.map(e=>e.type===`editor`&&J(e)===t?{...e,tab:{...e.tab,view:n}}:e)}:{...e,children:e.children.map(r)};return r(e)}function aa(e,t,n){return qi(e,t,e=>e.tabs.some(e=>J(e)===n)?{...e,activeKey:n}:e)}function oa(e,t,n){function r(e){return e.kind===`leaf`?e:e.id===t&&n.length===e.children.length?{...e,children:e.children.map(r),sizes:[...n]}:{...e,children:e.children.map(r)}}return r(e)}function sa(e,t){let n=e=>e.kind===`leaf`?{...e,tabs:e.tabs.filter(t)}:{...e,children:e.children.map(n)};return Ki(n(e))}function ca(e){let t=e.editor_tabs.map(e=>({type:`editor`,tab:e})),n=e.session_tabs.map(e=>({type:`terminal`,session:e})),r=e.active_editor_tab?J({type:`editor`,tab:e.active_editor_tab}):null,i=e.active_session?`term:${e.active_session}`:null;if(t.length===0&&n.length===0)return zi([]);if(t.length===0)return zi(n,i);if(n.length===0)return zi(t,r);let a=e.layout,o=typeof a.editor==`number`?a.editor:40,s=typeof a.session==`number`?a.session:60;return Ki(Bi(`col`,[zi(t,r),zi(n,i)],[o,s]))}var la=(0,W.createContext)(null);function ua({tree:e,onOpenFile:t,children:n}){let r=(0,W.useRef)(null),i=(0,W.useRef)(new Map).current,[a,o]=(0,W.useState)(()=>new Set),s=(0,W.useCallback)((e,t)=>{o(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]),c=(0,W.useMemo)(()=>{let t=new Set;for(let n of Ui(e))for(let e of n.tabs)e.type===`terminal`&&t.add(e.session);return[...t]},[e]),l=e=>{let t=`term:${e}`,n=i.get(t);return n||(n=document.createElement(`div`),n.className=`size-full`,i.set(t,n)),n};(0,W.useEffect)(()=>{let e=new Set(c.map(e=>`term:${e}`));for(let e of c){let t=i.get(`term:${e}`);t&&!t.parentElement&&r.current?.appendChild(t)}for(let[t,n]of[...i])e.has(t)||(n.remove(),i.delete(t))},[c,i]);let u=(0,W.useMemo)(()=>({parkingRef:r,containers:i,setAdopted:s}),[i,s]);return(0,U.jsxs)(la.Provider,{value:u,children:[(0,U.jsx)(`div`,{ref:r,className:`hidden`,"aria-hidden":!0}),c.map(e=>(0,Fi.createPortal)((0,U.jsx)(Me,{stream:e,paused:!a.has(`term:${e}`),onOpenFile:(n,r,i)=>t(e,n,r,i)}),l(e),e)),n]})}function da(e){let t=(0,W.useContext)(la),n=(0,W.useRef)(null);return(0,W.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}function fa(e,t){let n={};for(let r of t){let t=e[r];if(typeof t!=`number`)return;n[r]=t}return n}var pa={added:{letter:`A`,label:`added`,colourClass:`text-running`},modified:{letter:`M`,label:`modified`,colourClass:`text-fg-secondary`},deleted:{letter:`D`,label:`deleted`,colourClass:`text-interrupted`},renamed:{letter:`R`,label:`renamed`,colourClass:`text-waiting`}};function ma(e){return pa[e]}var ha=[`modified`,`added`,`deleted`,`renamed`];function ga(e){let t=new Map;for(let n of e)t.set(n.status,(t.get(n.status)??0)+1);return ha.filter(e=>t.has(e)).map(e=>`${t.get(e)} ${pa[e].label}`).join(` · `)}var _a=[`var(--accent)`,`var(--status-running)`,`var(--status-waiting)`,`var(--ansi-magenta)`,`var(--ansi-cyan)`,`var(--status-interrupted)`];function va(e){return _a[e%_a.length]}function ya(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:va(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=va(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 ba=7,xa=14,Sa=4,Ca=1.5,wa=40,Ta=22;function Ea(e){return e*xa+xa/2}function Da(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 Oa({row:e,width:t}){let n=wa,r=n/2,i=Ea(e.col),a=new Set(e.created),o=[];for(let t of e.above){let n=Ea(t.col);t.sha===e.sha?o.push({d:Da(n,0,i,r),colour:t.colour}):o.push({d:Da(n,0,n,r),colour:t.colour})}for(let t of e.below){let e=Ea(t.col);a.has(t.col)?o.push({d:Da(i,r,e,n),colour:t.colour}):o.push({d:Da(e,r,e,n),colour:t.colour})}return(0,U.jsxs)(`svg`,{width:t,height:n,className:`shrink-0`,"aria-hidden":!0,children:[o.map((e,t)=>(0,U.jsx)(`path`,{d:e.d,fill:`none`,stroke:e.colour,strokeWidth:Ca},t)),(0,U.jsx)(`circle`,{cx:i,cy:r,r:Sa,fill:`var(--bg-surface)`,stroke:e.colour,strokeWidth:Ca})]})}function ka({lanes:e,width:t}){return(0,U.jsx)(`svg`,{width:t,height:Ta,className:`shrink-0`,"aria-hidden":!0,children:e.map(e=>{let t=Ea(e.col);return(0,U.jsx)(`path`,{d:`M ${t} 0 L ${t} ${Ta}`,fill:`none`,stroke:e.colour,strokeWidth:Ca},e.col)})})}function Aa({session:e,sha:t,lanes:n,gutterW:r,onOpen:i}){let a=u(e,t),o=e=>(0,U.jsxs)(`div`,{className:`flex items-center`,style:{height:Ta},children:[(0,U.jsx)(ka,{lanes:n,width:r}),(0,U.jsx)(`span`,{className:`px-2 text-2xs text-fg-muted`,children:e})]});return a.isPending?o(`…`):a.error?o(a.error instanceof Error?a.error.message:`Failed to load commit`):a.data.files.length===0?o(`No file changes.`):(0,U.jsx)(U.Fragment,{children:a.data.files.map(e=>{let a=ma(e.status),o=e.status===`renamed`&&e.old_path?`${e.old_path} → ${e.path}`:e.path;return(0,U.jsxs)(`button`,{type:`button`,title:o,onClick:()=>i(e.path,t),className:`flex w-full items-center text-left transition-colors hover:bg-elevated`,style:{height:Ta},children:[(0,U.jsx)(ka,{lanes:n,width:r}),(0,U.jsx)(`span`,{className:z(`mr-1.5 w-3 shrink-0 text-center font-mono text-xs`,a.colourClass),children:a.letter}),(0,U.jsx)(`span`,{className:`truncate pr-3 font-mono text-2xs text-fg`,children:o})]},`${e.status}:${e.old_path??``}:${e.path}`)})})}function ja({session:e,onOpenCommitFile:t}){let n=o(e),[r,i]=(0,W.useState)(null),a=(0,W.useMemo)(()=>n.data?.pages.flatMap(e=>e.commits)??[],[n.data]),s=(0,W.useMemo)(()=>ya(a),[a]),c=Math.max(1,s.laneCount)*xa+xa/2;return n.isPending?(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`Loading history…`}):n.error?(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:n.error instanceof Error?n.error.message:`Failed to load history`}):a.length===0?(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No commits yet.`}):(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-2`,children:[s.rows.map((n,o)=>{let s=a[o],l=r===n.sha;return(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>i(l?null:n.sha),className:z(`flex w-full items-center text-left transition-colors hover:bg-elevated`,l&&`bg-selection`),style:{height:wa},children:[(0,U.jsx)(Oa,{row:n,width:c}),(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5 pr-3`,children:[(0,U.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,U.jsx)(`span`,{className:`shrink-0 font-mono text-2xs text-fg-muted`,children:n.sha.slice(0,ba)}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-fg`,children:s.subject})]}),(0,U.jsxs)(`span`,{className:`truncate text-2xs text-fg-muted`,children:[s.author_name,` ·`,` `,(0,U.jsx)(`span`,{className:`tabular-nums`,children:f(s.authored_at)})]})]})]}),l&&(0,U.jsx)(Aa,{session:e,sha:n.sha,lanes:n.below,gutterW:c,onOpen:t})]},n.sha)}),n.hasNextPage&&(0,U.jsx)(`button`,{type:`button`,onClick:()=>void n.fetchNextPage(),disabled:n.isFetchingNextPage,className:`px-3 py-2 text-left font-mono text-xs text-fg-muted transition-colors hover:bg-elevated`,children:n.isFetchingNextPage?`Loading…`:`Show more`})]})}function Ma(){return{dirs:new Map,files:[]}}function Na(e){return e.path}function Pa(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:Pa(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 Fa(e){let t=Ma();for(let n of e){let e=Na(n),r=e.split(`/`),i=r.pop(),a=t;for(let e of r){let t=a.dirs.get(e);t||(t=Ma(),a.dirs.set(e,t)),a=t}a.files.push({type:`file`,name:i,path:e,entry:n})}return Pa(t,``)}function Ia(e){return e.map(e=>({type:`file`,name:Na(e).split(`/`).pop()??Na(e),path:Na(e),entry:e})).sort((e,t)=>e.path.localeCompare(t.path,void 0,{sensitivity:`base`}))}function La({name:e,fullPath:t,status:n,depth:r,active:i,onOpen:a}){let o=ma(n);return(0,U.jsxs)(`button`,{type:`button`,title:t,onClick:()=>a(t),className:z(`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,U.jsx)(`span`,{className:z(`w-3 shrink-0 text-center font-mono text-xs`,o.colourClass),children:o.letter}),(0,U.jsx)(`span`,{className:`truncate font-mono text-xs text-fg`,children:e})]})}function Ra({nodes:e,depth:t,activePath:n,onOpen:r}){let[i,a]=(0,W.useState)(new Set);return(0,U.jsx)(U.Fragment,{children:e.map(e=>{if(e.type===`file`)return(0,U.jsx)(La,{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,U.jsxs)(`div`,{children:[(0,U.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:`flex w-full items-center gap-1 py-1 pr-3 text-left transition-colors hover:bg-elevated`,style:{paddingLeft:8+t*12},children:[o?(0,U.jsx)(vt,{className:`size-3.5 shrink-0 text-fg-gold`}):(0,U.jsx)(gt,{className:`size-3.5 shrink-0 text-fg-gold`}),(0,U.jsx)(`span`,{className:`truncate font-mono text-xs text-fg-secondary`,children:e.name})]}),!o&&(0,U.jsx)(Ra,{nodes:e.children,depth:t+1,activePath:n,onOpen:r})]},e.path)})})}function za({session:e,activePath:t,onOpen:n}){let[r,i]=(0,W.useState)(!1),a=S(e,{against:`head`}),o=a.data?.entries??[],s=(0,W.useMemo)(()=>r?null:Fa(o),[r,o]),c=(0,W.useMemo)(()=>r?Ia(o):null,[r,o]);return(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex h-7 shrink-0 items-center gap-2 px-3`,children:[(0,U.jsx)(`span`,{className:`text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:`Uncommitted`}),o.length>0&&(0,U.jsx)(`span`,{className:`truncate font-mono text-2xs text-fg-muted`,children:ga(o)}),(0,U.jsxs)(Tt,{children:[(0,U.jsx)(Ft,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,"aria-pressed":!r,onClick:()=>i(e=>!e),className:`ml-auto rounded-sm p-1 text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[r?(0,U.jsx)(xn,{className:`size-3.5`}):(0,U.jsx)(_n,{className:`size-3.5`}),(0,U.jsx)(`span`,{className:`sr-only`,children:r?`Show as tree`:`Show as flat list`})]})}),(0,U.jsx)(bt,{children:r?`Show as tree`:`Show as flat list`})]})]}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-1`,children:a.isPending?(0,U.jsx)(`div`,{className:`px-3 py-1.5 text-xs text-fg-muted`,children:`Loading changes…`}):a.error?(0,U.jsx)(`div`,{className:`px-3 py-1.5 text-xs text-fg-muted`,children:a.error instanceof Error?a.error.message:`Failed to load changes`}):o.length===0?(0,U.jsx)(`div`,{className:`px-3 py-1.5 text-xs text-fg-muted`,children:`No uncommitted changes.`}):r?c.map(e=>(0,U.jsx)(La,{name:e.path,fullPath:e.path,status:e.entry.status,depth:0,active:t===e.path,onOpen:n},e.path)):(0,U.jsx)(Ra,{nodes:s,depth:0,activePath:t,onOpen:n})})]})}function Ba({session:e,activeDiffPath:t,onOpenDiff:n,onOpenCommitFile:r}){return(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsx)(`section`,{className:`flex max-h-[45%] min-h-0 flex-col`,children:(0,U.jsx)(za,{session:e,activePath:t,onOpen:n})}),(0,U.jsx)(`div`,{className:`h-px shrink-0 bg-border`}),(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsx)(`div`,{className:`flex h-7 shrink-0 items-center px-3`,children:(0,U.jsx)(`span`,{className:`text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:`History`})}),(0,U.jsx)(ja,{session:e,onOpenCommitFile:r})]})]})}async function Va(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 Ha(e){return new Promise((t,n)=>e.file(t,n))}async function Ua(e,t,n){if(e.isFile){let r=await Ha(e);n.push(t?new File([r],`${t}/${e.name}`,{type:r.type,lastModified:r.lastModified}):r)}else if(e.isDirectory){let r=await Va(e),i=t?`${t}/${e.name}`:e.name;for(let e of r)await Ua(e,i,n)}}function Wa(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)&&D.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 Ua(t,``,e):n&&e.push(n);return e})()}var Ga={untracked:{letter:`U`,colourClass:`text-running`},added:{letter:`A`,colourClass:`text-running`},modified:{letter:`M`,colourClass:`text-waiting`},renamed:{letter:`R`,colourClass:`text-waiting`},deleted:{letter:`D`,colourClass:`text-interrupted`},conflicted:{letter:`C`,colourClass:`text-interrupted`},ignored:{letter:``,colourClass:`text-fg-muted`}};function Ka(e){return Ga[e]}function qa(e){let t=new Map;for(let n of e)t.set(n.path,n.status);return t}var Ja={conflicted:0,modified:1,renamed:2,deleted:3,added:4,untracked:5,ignored:6};function Ya(e,t){let n=t===``?``:`${t}/`,r=null;for(let[t,i]of e)n!==``&&!t.startsWith(n)||i!==`ignored`&&(r===null||Ja[i]<Ja[r])&&(r=i);return r}function Xa(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function Za(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function Qa(e,t){return e===``?t:`${e}/${t}`}function $a(e,t){let n=[],r=(i,a)=>{let o=e(i);if(o)for(let e of o.entries){let o=Qa(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 eo(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 to=(e,t)=>e instanceof Error?e.message:t;function no(e){let t=i(),n=(0,W.useCallback)(()=>{t.invalidateQueries({queryKey:[`wt-tree`,e]}),t.invalidateQueries({queryKey:[`wt-git-status`,e]})},[t,e]);return(0,W.useMemo)(()=>({async create(t,r,i){try{let a=await c(e,Qa(t,r),i);return n(),a.path}catch(e){return D.error(to(e,`Couldn't create ${r}`)),null}},async rename(t,r){let i=Qa(t.includes(`/`)?t.slice(0,t.lastIndexOf(`/`)):``,r);try{let r=await p(e,t,i);return n(),r.path}catch(e){return D.error(to(e,`Couldn't rename ${Xa(t)}`)),null}},async move(t,r){try{let i=await p(e,t,Qa(r,Xa(t)));return n(),i.path}catch(e){return D.error(to(e,`Couldn't move ${Xa(t)}`)),null}},async remove(t){let r=await Promise.allSettled(t.map(t=>l(e,t)));n();let i=r.filter(e=>e.status===`rejected`).length;i>0?D.error(`Couldn't delete ${i} item${i>1?`s`:``}`):D.success(t.length===1?`Deleted ${Xa(t[0])}`:`Deleted ${t.length} items`)},async paste(t,r){let i=t.mode===`cut`?p:y,a=await Promise.allSettled(t.paths.map(t=>i(e,t,Qa(r,Xa(t)))));n();let o=a.filter(e=>e.status===`rejected`).length;o>0&&D.error(`Couldn't paste ${o} item${o>1?`s`:``}`)}}),[e,n])}function ro(e,t,n){return n&&n.type!==`dir`||(e.includes(`/`)?e.slice(0,e.lastIndexOf(`/`)):``)===t?!1:t===``||!`${t}/`.startsWith(`${e}/`)}var io=(0,W.createContext)(null);function ao(){let e=(0,W.useContext)(io);if(!e)throw Error(`explorer components must render inside <ExplorerProvider>`);return e}function oo(){return(0,W.useContext)(io)}function so({session:e,onOpenFile:t,activePath:n,children:r}){let a=e.id,o=i(),s=no(a),c=(0,W.useCallback)((e,t)=>{t.length!==0&&d(a,e,t).then(()=>{o.invalidateQueries({queryKey:[`wt-tree`,a,e]}),o.invalidateQueries({queryKey:[`wt-git-status`,a]}),D.success(t.length===1?`Uploaded ${t[0].name}`:`Uploaded ${t.length} files`)}).catch(e=>D.error(e instanceof Error?e.message:`Upload failed`))},[a,o]),l=Fe().data?.protocol,u=!l||l.major>9||l.major===9&&l.minor>=2,f=(0,W.useCallback)((e,t,n)=>{Wa(t,n,u).then(t=>c(e,t)).catch(e=>D.error(e instanceof Error?e.message:`Couldn't read the dropped folder`))},[c,u]),[p,m]=(0,W.useState)(new Set),[g,_]=(0,W.useState)(new Set),[v,y]=(0,W.useState)(null),[b,S]=(0,W.useState)(null),[C,w]=(0,W.useState)(null),[T,E]=(0,W.useState)(null),[ee,O]=(0,W.useState)(null),k=(0,W.useRef)(null),te=x(a),A=(0,W.useMemo)(()=>qa(te.data?.entries??[]),[te.data]),[j,ne]=(0,W.useState)(0);(0,W.useEffect)(()=>o.getQueryCache().subscribe(e=>{let t=e.query.queryKey;Array.isArray(t)&&t[0]===`wt-tree`&&t[1]===a&&ne(e=>e+1)}),[o,a]);let re=(0,W.useMemo)(()=>$a(e=>o.getQueryData([`wt-tree`,a,e]),p),[o,a,p,j]),M=(0,W.useCallback)(e=>{m(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),N=(0,W.useCallback)(e=>{m(t=>t.has(e)?t:new Set(t).add(e))},[]),ie=(0,W.useCallback)(()=>m(new Set),[]),ae=(0,W.useCallback)((e,n)=>{if(y(e.path),n.metaKey||n.ctrlKey){_(t=>{let n=new Set(t);return n.has(e.path)?n.delete(e.path):n.add(e.path),n}),k.current=e.path;return}if(n.shiftKey&&k.current){_(new Set(eo(re,k.current,e.path)));return}_(new Set([e.path])),k.current=e.path,e.type===`dir`?M(e.path):t?.(a,e.path)},[re,M,t,a]),P=(0,W.useCallback)(e=>{e.type!==`dir`&&t?.(a,e.path,{preview:!1})},[t,a]),oe=(0,W.useCallback)(e=>{_(new Set([e])),y(e),k.current=e},[]),se=(0,W.useCallback)(e=>S({paths:e,mode:`cut`}),[]),ce=(0,W.useCallback)(e=>S({paths:e,mode:`copy`}),[]),F=(0,W.useCallback)(e=>{b&&s.paste(b,e).then(()=>{b.mode===`cut`&&S(null)})},[b,s]),I=(0,W.useCallback)(e=>w({mode:`rename`,path:e}),[]),le=(0,W.useCallback)((e,t)=>{e!==``&&N(e),w({mode:`create`,parentDir:e,kind:t})},[N]),ue=(0,W.useCallback)(()=>w(null),[]),de=(0,W.useCallback)(e=>{let n=e.trim(),r=C;if(w(null),!(!r||n===``))if(r.mode===`rename`){if(n===Xa(r.path))return;s.rename(r.path,n)}else s.create(r.parentDir,n,r.kind).then(e=>{e&&r.kind===`file`&&t?.(a,e)})},[C,s,t,a]),L=(0,W.useCallback)(e=>{e.length>0&&O(e)},[]),fe=(0,W.useCallback)(()=>{let e=ee;O(null),e&&s.remove(e)},[ee,s]),pe=(0,W.useCallback)(()=>O(null),[]),me=(0,W.useCallback)((t,n)=>{let r=n?t:Qa(e.worktree_path,t);navigator.clipboard.writeText(r),D.success(n?`Relative path copied`:`Path copied`)},[e.worktree_path]),he=(0,W.useCallback)(e=>{h(a,e).catch(e=>D.error(e instanceof Error?e.message:`Download failed`))},[a]),R=(0,W.useCallback)(()=>{o.invalidateQueries({queryKey:[`wt-tree`,a]}),o.invalidateQueries({queryKey:[`wt-git-status`,a]})},[o,a]),ge=(0,W.useCallback)((e,t)=>{ro(t,e)&&s.move(t,e)},[s]),_e=(0,W.useCallback)(()=>v&&g.has(v)?[...g]:v?[v]:[...g],[v,g]),ve=(0,W.useRef)({buffer:``,at:0}),ye=(0,W.useCallback)(e=>{if(C)return;let n=re;if(n.length===0)return;let r=v?n.findIndex(e=>e.path===v):-1,i=(e,t)=>{let r=n[Math.max(0,Math.min(n.length-1,e))];r&&(y(r.path),t&&k.current?_(new Set(eo(n,k.current,r.path))):(_(new Set([r.path])),k.current=r.path))},o=r>=0?n[r]:void 0,s=e.metaKey||e.ctrlKey;switch(e.key){case`ArrowDown`:e.preventDefault(),i(r+1,e.shiftKey);return;case`ArrowUp`:e.preventDefault(),i(r<=0?0:r-1,e.shiftKey);return;case`ArrowRight`:e.preventDefault(),o?.type===`dir`&&!p.has(o.path)?N(o.path):o?.type===`dir`&&i(r+1,!1);return;case`ArrowLeft`:if(e.preventDefault(),o?.type===`dir`&&p.has(o.path))M(o.path);else if(o){let e=n.findIndex(e=>e.path===o.parentDir);e>=0&&i(e,!1)}return;case`Enter`:case` `:if(e.preventDefault(),!o)return;o.type===`dir`?M(o.path):t?.(a,o.path);return;case`F2`:e.preventDefault(),o&&I(o.path);return;case`Delete`:e.preventDefault(),L(_e());return;case`Backspace`:s&&(e.preventDefault(),L(_e()));return}if(s&&(e.key===`c`||e.key===`C`)){e.preventDefault();let t=_e();e.altKey?me(t[0]??``,e.shiftKey):ce(t);return}if(s&&(e.key===`x`||e.key===`X`)){e.preventDefault(),se(_e());return}if(s&&(e.key===`v`||e.key===`V`)){e.preventDefault();let t=o?o.type===`dir`?o.path:o.parentDir:``;F(t);return}if(!s&&!e.altKey&&e.key.length===1&&/\S/.test(e.key)){let t=Date.now(),a=ve.current;a.buffer=t-a.at>700?e.key:a.buffer+e.key,a.at=t;let o=a.buffer.toLowerCase(),s=r+1;for(let e=0;e<n.length;e++){let t=n[(s+e)%n.length];if(t.name.toLowerCase().startsWith(o)){i(n.findIndex(e=>e.path===t.path),!1);break}}}},[C,re,v,p,N,M,t,a,I,L,_e,ce,se,F,me]),be={sid:a,worktreePath:e.worktree_path,onOpenFile:t,activePath:n,expanded:p,toggle:M,collapseAll:ie,statusMap:A,visibleRows:re,selection:g,focusedPath:v,onRowClick:ae,onRowDoubleClick:P,selectOnly:oe,clipboard:b,cut:se,copy:ce,paste:F,editing:C,beginRename:I,beginCreate:le,cancelEdit:ue,commitEdit:de,requestDelete:L,copyPathToClipboard:me,download:he,refresh:R,onUpload:c,onDropUpload:f,dropTarget:T,setDropTarget:E,onInternalDrop:ge,handleKeyDown:ye,pendingDelete:ee,confirmDelete:fe,cancelDelete:pe};return(0,U.jsx)(io.Provider,{value:be,children:r})}var co=`application/x-puddle-tab`;function lo(e){return JSON.stringify(e)}function uo(e){try{return w.parse(JSON.parse(e))}catch{return null}}function fo(e){return e.includes(co)}var po={"package.json":tn,"package-lock.json":sn,"pnpm-lock.yaml":sn,"yarn.lock":sn,"pnpm-workspace.yaml":nn,dockerfile:H,".gitignore":nn,".gitattributes":nn,"readme.md":fn,license:fn,licence:fn},mo={ts:H,tsx:H,mts:H,cts:H,js:H,jsx:H,mjs:H,cjs:H,py:H,rs:H,go:H,rb:H,php:H,java:H,kt:H,c:H,h:H,cpp:H,hpp:H,cc:H,html:H,htm:H,xml:H,vue:H,sql:H,json:tn,jsonc:tn,yml:nn,yaml:nn,toml:nn,ini:nn,cfg:nn,conf:nn,env:on,lock:sn,csv:un,tsv:un,xlsx:un,xls:un,md:fn,mdx:fn,markdown:fn,txt:fn,rtf:fn,log:fn,pdf:fn,css:pn,scss:pn,sass:pn,less:pn,sh:dn,bash:dn,zsh:dn,fish:dn,svg:an,png:an,jpg:an,jpeg:an,gif:an,webp:an,bmp:an,ico:an,avif:an,mp4:cn,mov:cn,webm:cn,mkv:cn,avi:cn,mp3:rn,wav:rn,flac:rn,ogg:rn,m4a:rn,zip:en,tar:en,gz:en,tgz:en,rar:en,"7z":en};function ho(e){let t=e.toLowerCase(),n=po[t];if(n)return{Icon:n,generic:!1};let r=t.lastIndexOf(`.`);if(r>0){let e=mo[t.slice(r+1)];if(e)return{Icon:e,generic:!1}}return{Icon:mn,generic:!0}}function go({name:e,dimmed:t}){let{Icon:n,generic:r}=ho(e);return(0,U.jsx)(n,{className:z(`size-3.5 shrink-0`,t||r?`text-fg-muted`:`text-fg`)})}var _o=14,vo=`application/x-puddle-path`;function yo({children:e}){return(0,U.jsx)(`span`,{className:`ml-auto pl-6 text-2xs text-fg-muted tabular-nums`,children:e})}function bo({depth:e,initial:t,icon:n,onCommit:r,onCancel:i}){let a=(0,W.useRef)(null),o=(0,W.useRef)(!1);(0,W.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,U.jsxs)(`div`,{className:`flex h-6 items-center gap-1 pr-2`,style:{paddingLeft:e*_o+8},children:[(0,U.jsx)(`span`,{className:`size-3.5 shrink-0`}),n,(0,U.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 font-mono text-sm text-fg outline-none`})]})}function xo({path:e,entry:t,depth:n}){let r=ao(),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:Za(e)},d=r.statusMap.get(e),f=i?Ya(r.statusMap,e):null,p=d?Ka(d):f?Ka(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:Za(e),_=r.clipboard!==null;return r.editing?.mode===`rename`&&r.editing.path===e?(0,U.jsx)(bo,{depth:n,initial:t.name,icon:i?(0,U.jsx)(hn,{className:`size-3.5 shrink-0 text-fg`}):(0,U.jsx)(go,{name:t.name}),onCommit:r.commitEdit,onCancel:r.cancelEdit}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(at,{children:[(0,U.jsx)(Ke,{asChild:!0,children:(0,U.jsxs)(`div`,{role:`treeitem`,"data-path":e,"aria-expanded":i?a:void 0,"aria-selected":c,tabIndex:-1,draggable:!0,onClick:e=>{e.currentTarget.closest(`[data-explorer-root]`)?.focus(),r.onRowClick(u,e)},onDoubleClick:()=>r.onRowDoubleClick(u),onContextMenu:()=>{c||r.selectOnly(e)},onDragStart:t=>{t.dataTransfer.setData(vo,e),i||t.dataTransfer.setData(co,lo({type:`editor`,tab:{kind:`file`,session:r.sid,path:e}})),t.dataTransfer.effectAllowed=`copyMove`},onDragOver:t=>{i&&(t.preventDefault(),t.stopPropagation(),r.setDropTarget(e))},onDragLeave:e=>{i&&e.currentTarget===e.target&&r.setDropTarget(null)},onDrop:t=>{if(!i)return;t.preventDefault(),t.stopPropagation(),r.setDropTarget(null);let n=t.dataTransfer.getData(vo);n?r.onInternalDrop(e,n):r.onDropUpload(e,t.dataTransfer.items,t.dataTransfer.files)},style:{paddingLeft:n*_o+8},className:z(`flex h-6 cursor-pointer items-center gap-1 pr-2 text-sm transition-colors hover:bg-elevated`,c?`bg-selection`:s&&`bg-elevated`,o&&`bg-selection`,l&&`opacity-50`),children:[i?(0,U.jsx)(vt,{className:z(`size-3.5 shrink-0 text-fg-gold transition-transform duration-150`,a&&`rotate-90`)}):(0,U.jsx)(`span`,{className:`size-3.5 shrink-0`}),t.symlink||t.type===`symlink`?(0,U.jsx)(bn,{className:`size-3.5 shrink-0 text-fg`}):i?a?(0,U.jsx)(At,{className:z(`size-3.5 shrink-0`,f?p?.colourClass:`text-fg`)}):(0,U.jsx)(hn,{className:z(`size-3.5 shrink-0`,f?p?.colourClass:`text-fg`)}):(0,U.jsx)(go,{name:t.name,dimmed:d===`ignored`}),(0,U.jsx)(`span`,{className:z(`min-w-0 flex-1 truncate font-mono`,m),children:t.name}),d&&p&&p.letter&&(0,U.jsx)(`span`,{className:z(`shrink-0 font-mono text-2xs`,p.colourClass),children:p.letter})]})}),(0,U.jsxs)(tt,{onCloseAutoFocus:e=>{r.editing&&e.preventDefault()},children:[i&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(V,{onSelect:()=>r.beginCreate(e,`file`),children:`New File…`}),(0,U.jsx)(V,{onSelect:()=>r.beginCreate(e,`dir`),children:`New Folder…`}),(0,U.jsx)(Ze,{})]}),(0,U.jsxs)(V,{onSelect:()=>r.cut(h),children:[`Cut `,(0,U.jsx)(yo,{children:`⌘X`})]}),(0,U.jsxs)(V,{onSelect:()=>r.copy(h),children:[`Copy `,(0,U.jsx)(yo,{children:`⌘C`})]}),(0,U.jsxs)(V,{disabled:!_,onSelect:()=>r.paste(g),children:[`Paste `,(0,U.jsx)(yo,{children:`⌘V`})]}),(0,U.jsx)(Ze,{}),(0,U.jsxs)(V,{onSelect:()=>r.copyPathToClipboard(e,!1),children:[`Copy Path `,(0,U.jsx)(yo,{children:`⌥⌘C`})]}),(0,U.jsxs)(V,{onSelect:()=>r.copyPathToClipboard(e,!0),children:[`Copy Relative Path `,(0,U.jsx)(yo,{children:`⌥⇧⌘C`})]}),(0,U.jsx)(Ze,{}),(0,U.jsxs)(V,{onSelect:()=>r.beginRename(e),children:[`Rename… `,(0,U.jsx)(yo,{children:`F2`})]}),(0,U.jsxs)(V,{onSelect:()=>r.requestDelete(h),children:[`Delete `,(0,U.jsx)(yo,{children:`⌘⌫`})]}),(0,U.jsx)(Ze,{}),(0,U.jsx)(V,{onSelect:()=>r.download(e),children:`Download`})]})]}),i&&a&&(0,U.jsx)(So,{sid:r.sid,path:e,depth:n+1})]})}function So({sid:e,path:t,depth:n}){let r=ao(),i=b(e,t),a={paddingLeft:n*_o+8},o=r.editing,s=o?.mode===`create`&&o.parentDir===t?(0,U.jsx)(Co,{depth:n,kind:o.kind}):null;if(i.isLoading)return(0,U.jsxs)(U.Fragment,{children:[s,(0,U.jsx)(`div`,{style:a,className:`py-0.5 text-xs text-fg-muted`,children:`Loading…`})]});if(i.isError)return(0,U.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,U.jsx)(`div`,{style:a,className:`py-0.5 text-xs text-fg-muted`,children:`Empty`}):(0,U.jsxs)(U.Fragment,{children:[s,c.map(e=>(0,U.jsx)(xo,{path:Qa(t,e.name),entry:e,depth:n},e.name))]})}function Co({depth:e,kind:t}){let n=ao(),[r,i]=(0,W.useState)(``);return(0,U.jsx)(bo,{depth:e,initial:r,icon:t===`dir`?(0,U.jsx)(hn,{className:`size-3.5 shrink-0 text-fg`}):(0,U.jsx)(go,{name:r||`file`}),onCommit:e=>{i(e),n.commitEdit(e)},onCancel:n.cancelEdit})}function wo(){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(To,{}),(0,U.jsx)(Eo,{})]})}function To(){let e=ao(),t=(0,W.useRef)(null);(0,W.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,U.jsxs)(at,{children:[(0,U.jsx)(Ke,{asChild:!0,children:(0,U.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=>{t.preventDefault(),e.setDropTarget(``)},onDragLeave:t=>{t.currentTarget===t.target&&e.setDropTarget(null)},onDrop:t=>{t.preventDefault(),e.setDropTarget(null);let n=t.dataTransfer.getData(`application/x-puddle-path`);n?e.onInternalDrop(``,n):e.onDropUpload(``,t.dataTransfer.items,t.dataTransfer.files)},className:z(`h-full overflow-y-auto py-1 outline-none`,e.dropTarget===``&&`bg-selection`),children:(0,U.jsx)(So,{sid:e.sid,path:``,depth:0})})}),(0,U.jsxs)(tt,{onCloseAutoFocus:t=>{e.editing&&t.preventDefault()},children:[(0,U.jsx)(V,{onSelect:()=>e.beginCreate(``,`file`),children:`New File…`}),(0,U.jsx)(V,{onSelect:()=>e.beginCreate(``,`dir`),children:`New Folder…`}),(0,U.jsx)(Ze,{}),(0,U.jsx)(V,{disabled:!n,onSelect:()=>e.paste(``),children:`Paste`}),(0,U.jsx)(Ze,{}),(0,U.jsx)(V,{onSelect:()=>e.copyPathToClipboard(``,!1),children:`Copy Path`}),(0,U.jsx)(V,{onSelect:()=>e.download(``),children:`Download worktree`})]})]})}function Eo(){let e=ao(),t=e.pendingDelete;return(0,U.jsx)(P,{open:t!==null,onOpenChange:t=>!t&&e.cancelDelete(),children:(0,U.jsxs)(N,{children:[(0,U.jsxs)(te,{children:[(0,U.jsxs)(ie,{children:[`Delete `,t&&t.length===1?`“${Xa(t[0])}”`:`${t?.length??0} items`,`?`]}),(0,U.jsxs)(ae,{children:[`This permanently removes `,t&&t.length>1?`them`:`it`,` from the worktree. There is no undo.`]})]}),(0,U.jsxs)(re,{children:[(0,U.jsx)(j,{variant:`ghost`,onClick:e.cancelDelete,children:`Cancel`}),(0,U.jsx)(j,{variant:`danger`,onClick:e.confirmDelete,children:`Delete`})]})]})})}var Do=/[.*+?^${}()|[\]\\]/g;function Oo(e){if(e.query.length===0)return null;try{let t=e.regex?e.query:e.query.replace(Do,`\\$&`);return e.wholeWord&&(t=`\\b(?:${t})\\b`),new RegExp(t,e.caseSensitive?`g`:`gi`)}catch{return null}}function ko(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 Ao=240;function jo(e){let t=e.replace(/^\s+/,``);return t.length>Ao?`${t.slice(0,Ao)}…`:t}var Mo=250;function No({active:e,label:t,onClick:n,children:r}){return(0,U.jsxs)(Tt,{children:[(0,U.jsx)(Ft,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,"aria-pressed":e,onClick:n,className:z(`rounded-sm p-1 transition-colors`,e?`bg-elevated text-accent`:`text-fg-muted hover:bg-elevated hover:text-fg`),children:[r,(0,U.jsx)(`span`,{className:`sr-only`,children:t})]})}),(0,U.jsx)(bt,{children:t})]})}function Po({session:e,onOpen:t}){let[n,r]=(0,W.useState)(``),[i,o]=(0,W.useState)(``),[s,c]=(0,W.useState)(!1),[l,u]=(0,W.useState)(!1),[d,f]=(0,W.useState)(!1);(0,W.useEffect)(()=>{let e=setTimeout(()=>o(n),Mo);return()=>clearTimeout(e)},[n]);let p={query:i,regex:s,caseSensitive:l,wholeWord:d},m=a(e,p),h=(0,W.useMemo)(()=>Oo(p),[i,s,l,d]),g=m.data,_=!!g&&(g.files.length>0||g.content.length>0);return(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1 px-2 py-1.5`,children:[(0,U.jsx)(`input`,{value:n,onChange:e=>r(e.target.value),placeholder:`Search files and contents`,spellCheck:!1,autoComplete:`off`,className:`rounded-md bg-elevated px-2 py-1 font-mono text-xs text-fg outline-none placeholder:text-fg-muted`}),(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsx)(No,{active:l,label:`Match case`,onClick:()=>u(e=>!e),children:(0,U.jsx)(Jt,{className:`size-3.5`})}),(0,U.jsx)(No,{active:d,label:`Match whole word`,onClick:()=>f(e=>!e),children:(0,U.jsx)(Mn,{className:`size-3.5`})}),(0,U.jsx)(No,{active:s,label:`Use regular expression`,onClick:()=>c(e=>!e),children:(0,U.jsx)(On,{className:`size-3.5`})})]})]}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-2`,children:i.length===0?(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`Search file names and contents.`}):m.isPending?(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`Searching…`}):m.error?(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:m.error instanceof Error?m.error.message:`Search failed`}):_?(0,U.jsxs)(U.Fragment,{children:[g.files.length>0&&(0,U.jsxs)(`section`,{children:[(0,U.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,U.jsxs)(`button`,{type:`button`,title:e,onClick:()=>t(e),className:`flex w-full items-center gap-1.5 px-3 py-1 text-left transition-colors hover:bg-elevated`,children:[(0,U.jsx)(mn,{className:`size-3.5 shrink-0 text-fg-gold`}),(0,U.jsx)(`span`,{className:`truncate font-mono text-xs text-fg`,children:e})]},e))]}),g.content.length>0&&(0,U.jsxs)(`section`,{children:[(0,U.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,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`truncate px-3 py-1 font-mono text-2xs text-fg-secondary`,title:e.path,children:e.path}),e.matches.map((n,r)=>(0,U.jsxs)(`button`,{type:`button`,onClick:()=>t(e.path,n.line),className:`flex w-full items-baseline gap-2 py-0.5 pl-6 pr-3 text-left transition-colors hover:bg-elevated`,children:[(0,U.jsx)(`span`,{className:`shrink-0 font-mono text-2xs tabular-nums text-fg-muted`,children:n.line}),(0,U.jsx)(`span`,{className:`truncate font-mono text-2xs text-fg-secondary`,children:ko(jo(n.text),h).map((e,t)=>e.hit?(0,U.jsx)(`span`,{className:`text-accent`,children:e.text},t):(0,U.jsx)(`span`,{children:e.text},t))})]},`${n.line}:${r}`))]},e.path))]}),g.truncated&&(0,U.jsx)(`div`,{className:`px-3 py-2 text-2xs text-fg-muted`,children:`Showing the first results — refine the query for more.`})]}):(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No results.`})})]})}function Fo({text:e,hoverClass:t,className:n,title:r}){let i=(0,W.useRef)(null),[a,o]=(0,W.useState)(0);return(0,W.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,U.jsx)(`div`,{className:`min-w-0 flex-1 overflow-hidden`,children:(0,U.jsx)(`span`,{ref:i,title:r,className:z(`block whitespace-nowrap transition-transform duration-[900ms] ease-linear`,n,a>0&&t),style:a>0?{"--tail":`-${a}px`}:void 0,children:e})})}var Io=new Set([`starting`,`running`,`waiting_input`]),Lo=`group-hover:[transform:translateX(var(--tail))]`;function Ro(e){return e.split(`/`).filter(Boolean).pop()??e}function zo({children:e,className:t,title:n}){return(0,U.jsx)(`span`,{title:n,className:z(`shrink-0 text-2xs`,t),children:e})}function Bo({label:e,blockReason:t,onClick:n}){return(0,U.jsxs)(Tt,{children:[(0,U.jsx)(Ft,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,disabled:t!==null,onClick:n,className:z(`-my-1 rounded-sm p-1 text-fg-gold transition-colors hover:text-danger`,t===null?`hidden group-hover:inline-flex`:`hidden`),children:[(0,U.jsx)(Ot,{className:`size-3.5`}),(0,U.jsx)(`span`,{className:`sr-only`,children:e})]})}),(0,U.jsx)(bt,{children:t?`Can't ${e.toLowerCase()} — ${t}`:e})]})}function Vo({repoId:e,projectId:t,sessions:n}){let r=le(e),i=I(e,t),a=F(e,t),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(null),u=i.isPending||a.isPending,d=(0,W.useMemo)(()=>{let e=new Map;for(let t of n)Io.has(t.status)&&e.set(t.worktree_path,(e.get(t.worktree_path)??0)+1);return e},[n]),f=(0,W.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,W.useMemo)(()=>[...r.data?.orphan_branches??[]].sort((e,t)=>e.name.localeCompare(t.name)),[r.data]);return r.isPending?(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`Loading worktrees…`}):r.error?(0,U.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,U.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-2`,children:[f.length===0&&p.length===0&&(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No worktrees.`}),f.map(([e,t])=>(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`group flex items-center gap-1.5 px-3 pb-0.5 pt-2 text-2xs text-fg-muted`,children:[(0,U.jsx)(yn,{className:`size-3 shrink-0 text-fg-gold`}),(0,U.jsx)(Fo,{text:e,className:`font-mono`,hoverClass:Lo})]}),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,U.jsxs)(`div`,{className:`group flex items-center gap-2 px-3 py-1 pl-6 transition-colors hover:bg-elevated`,children:[(0,U.jsx)(Fo,{text:Ro(e.path),title:e.path,className:`font-mono text-xs text-fg`,hoverClass:Lo}),e.is_primary&&(0,U.jsx)(zo,{className:`text-fg-muted`,children:`clone`}),e.dirty&&(0,U.jsx)(zo,{className:`text-waiting`,title:`Modified — uncommitted changes`,children:`M`}),t>0&&(0,U.jsx)(zo,{className:`text-running`,title:`${t} running session${t>1?`s`:``}`,children:t}),(0,U.jsx)(Bo,{label:`Prune`,blockReason:n,onClick:()=>{l(null),s({kind:`worktree`,path:e.path,branch:e.branch})}})]},e.path)})]},`wt:${e}`)),p.length>0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.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,U.jsxs)(`div`,{className:`group flex items-center gap-2 px-3 py-1 transition-colors hover:bg-elevated`,children:[(0,U.jsx)(yn,{className:`size-3 shrink-0 text-fg-gold`}),(0,U.jsx)(Fo,{text:e.name,className:`font-mono text-xs text-fg`,hoverClass:Lo}),e.local_only&&(0,U.jsx)(zo,{className:`text-waiting`,children:`local only`}),(0,U.jsx)(Bo,{label:`Delete branch`,blockReason:null,onClick:()=>{l(null),s({kind:`branch`,name:e.name,localOnly:e.local_only})}})]},`br:${e.name}`))]}),(0,U.jsx)(P,{open:o!==null,onOpenChange:e=>{e||s(null)},children:(0,U.jsxs)(N,{children:[o?.kind===`branch`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(te,{children:[(0,U.jsx)(ie,{children:`Delete branch`}),(0,U.jsxs)(ae,{children:[`Delete branch `,(0,U.jsx)(`span`,{className:`font-mono`,children:o.name}),`? This removes the branch from the repository.`]})]}),o.localOnly&&(0,U.jsxs)(`p`,{className:`text-xs text-waiting`,children:[(0,U.jsx)(`span`,{className:`font-mono`,children:o.name}),` has commits on no remote — deleting it discards that work permanently.`]})]}):(0,U.jsxs)(te,{children:[(0,U.jsx)(ie,{children:`Prune worktree`}),(0,U.jsxs)(ae,{children:[`Remove `,(0,U.jsx)(`span`,{className:`font-mono`,children:o?Ro(o.path):``}),`? The working directory is deleted; the branch`,` `,(0,U.jsx)(`span`,{className:`font-mono`,children:o?.branch??``}),` is kept.`]})]}),c&&(0,U.jsx)(`p`,{className:`text-xs text-danger`,children:c}),(0,U.jsxs)(re,{children:[(0,U.jsx)(j,{type:`button`,variant:`ghost`,onClick:()=>s(null),children:`Cancel`}),(0,U.jsx)(j,{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 Ho=`DropdownMenu`,[Uo,Wo]=O(Ho,[He]),Y=He(),[Go,Ko]=Uo(Ho),qo=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Y(t),l=W.useRef(null),[u,d]=k({prop:i,defaultProp:a??!1,onChange:o,caller:Ho});return(0,U.jsx)(Go,{scope:t,triggerId:A(),triggerRef:l,contentId:A(),open:u,onOpenChange:d,onOpenToggle:W.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,U.jsx)(Ge,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};qo.displayName=Ho;var Jo=`DropdownMenuTrigger`,Yo=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Ko(Jo,n),o=Y(n),s=ee(t,a.triggerRef);return(0,U.jsx)($e,{asChild:!0,...o,children:(0,U.jsx)(oe.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:M(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:M(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Yo.displayName=Jo;var Xo=`DropdownMenuPortal`,Zo=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Y(t);return(0,U.jsx)(Ue,{...r,...n})};Zo.displayName=Xo;var Qo=`DropdownMenuContent`,$o=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ko(Qo,n),a=Y(n),o=W.useRef(!1);return(0,U.jsx)(Je,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:M(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:M(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)`}})});$o.displayName=Qo;var es=`DropdownMenuGroup`,ts=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Y(n);return(0,U.jsx)(rt,{...i,...r,ref:t})});ts.displayName=es;var ns=`DropdownMenuLabel`,rs=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Y(n);return(0,U.jsx)(Ye,{...i,...r,ref:t})});rs.displayName=ns;var is=`DropdownMenuItem`,as=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Y(n);return(0,U.jsx)(et,{...i,...r,ref:t})});as.displayName=is;var os=`DropdownMenuCheckboxItem`,ss=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Y(n);return(0,U.jsx)(qe,{...i,...r,ref:t})});ss.displayName=os;var cs=`DropdownMenuRadioGroup`,ls=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Y(n);return(0,U.jsx)(st,{...i,...r,ref:t})});ls.displayName=cs;var us=`DropdownMenuRadioItem`,ds=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Y(n);return(0,U.jsx)(ut,{...i,...r,ref:t})});ds.displayName=us;var fs=`DropdownMenuItemIndicator`,ps=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Y(n);return(0,U.jsx)(Xe,{...i,...r,ref:t})});ps.displayName=fs;var ms=`DropdownMenuSeparator`,hs=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Y(n);return(0,U.jsx)(lt,{...i,...r,ref:t})});hs.displayName=ms;var gs=`DropdownMenuArrow`,_s=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Y(n);return(0,U.jsx)(ot,{...i,...r,ref:t})});_s.displayName=gs;var vs=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=Y(t),[s,c]=k({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,U.jsx)(Ve,{...o,open:s,onOpenChange:c,children:n})},ys=`DropdownMenuSubTrigger`,bs=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Y(n);return(0,U.jsx)(ct,{...i,...r,ref:t})});bs.displayName=ys;var xs=`DropdownMenuSubContent`,Ss=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Y(n);return(0,U.jsx)(Le,{...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)`}})});Ss.displayName=xs;var Cs=qo,ws=Yo,Ts=Zo,Es=$o,Ds=as,Os=hs,ks=vs,As=bs,js=Ss,Ms=Cs,Ns=ws,Ps=ks;function Fs({className:e,sideOffset:t=4,...n}){return(0,U.jsx)(Ts,{children:(0,U.jsx)(Es,{sideOffset:t,className:z(`z-50 min-w-36 overflow-hidden rounded-md bg-elevated p-1 shadow-xl`,e),...n})})}function Is({className:e,...t}){return(0,U.jsx)(Ds,{className:z(_e,je,`[&_svg]:size-3.5`,e),...t})}function Ls({className:e,children:t,...n}){return(0,U.jsxs)(As,{className:z(_e,je,`data-[state=open]:bg-action data-[state=open]:text-action-ink [&_svg]:size-3.5`,e),...n,children:[t,(0,U.jsx)(vt,{className:`ml-auto`})]})}function Rs({className:e,...t}){return(0,U.jsx)(Ts,{children:(0,U.jsx)(js,{className:z(`z-50 min-w-36 overflow-hidden rounded-md bg-elevated p-1 shadow-xl`,e),...t})})}function zs({className:e,...t}){return(0,U.jsx)(Os,{className:z(`-mx-1 my-1 h-px bg-border`,e),...t})}function Bs(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 Vs({text:e,className:t}){let n=(0,W.useRef)(null);return(0,W.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,U.jsx)(`div`,{ref:n,className:`no-scrollbar min-w-0 flex-1 overflow-x-auto`,children:(0,U.jsx)(`span`,{className:z(`inline-block whitespace-nowrap`,t),children:e})})}function Hs({sessions:e,target:t,showFileActions:n=!1,showPath:r=!1}){let{session:i,pinned:a,pin:o,unpin:s}=t,c=xe().data?.home,l=e.filter(e=>e.status!==`archived`),u=i?i.branch||Wt(i):`No worktree`,d=i?Bs(i.worktree_path,c):`No worktree`;return(0,U.jsxs)(`div`,{className:`group relative flex h-8 shrink-0 items-center px-2`,children:[(0,U.jsx)(Vs,{text:r?d:u,className:`font-mono text-xs text-fg-secondary`}),(0,U.jsxs)(`div`,{className:z(`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,U.jsx)(Ws,{}),(0,U.jsxs)(`button`,{type:`button`,"aria-pressed":a,disabled:!i,title:a?`Unpin — follow the active session`:`Pin the sidebar to this worktree`,onClick:()=>a?s():i&&o(i.id),className:z(`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,U.jsx)(En,{className:z(`size-3.5`,a&&`fill-current`)}),(0,U.jsx)(`span`,{className:`sr-only`,children:a?`Unpin sidebar`:`Pin sidebar`})]}),(0,U.jsxs)(Ms,{children:[(0,U.jsx)(Ns,{asChild:!0,children:(0,U.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,U.jsx)(gt,{className:`size-3.5`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Choose a worktree`})]})}),(0,U.jsx)(Fs,{align:`end`,children:l.length===0?(0,U.jsx)(`div`,{className:`px-2 py-1.5 text-xs text-fg-muted`,children:`No sessions yet`}):l.map(e=>(0,U.jsx)(Is,{onSelect:()=>o(e.id),children:(0,U.jsxs)(`span`,{className:`truncate font-mono`,children:[e.branch,` — `,Wt(e)]})},e.id))})]})]})]})}var Us=[{key:`new-file`,label:`New File`,icon:ln},{key:`new-folder`,label:`New Folder`,icon:gn},{key:`refresh`,label:`Refresh`,icon:Ct},{key:`collapse`,label:`Collapse Folders`,icon:Yt}];function Ws(){let e=oo();if(!e)return null;let t=t=>{t===`new-file`?e.beginCreate(``,`file`):t===`new-folder`?e.beginCreate(``,`dir`):t===`refresh`?e.refresh():t===`collapse`&&e.collapseAll()};return(0,U.jsx)(`div`,{className:`hidden shrink-0 items-center gap-0.5 group-hover:flex group-focus-within:flex`,children:Us.map(({key:e,label:n,icon:r})=>(0,U.jsxs)(Tt,{children:[(0,U.jsx)(Ft,{asChild:!0,children:(0,U.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,U.jsx)(r,{className:`size-3.5`}),(0,U.jsx)(`span`,{className:`sr-only`,children:n})]})}),(0,U.jsx)(bt,{children:n})]},e))})}var Gs=[{key:`files`,label:`Files`,icon:_n},{key:`search`,label:`Search`,icon:xt},{key:`changes`,label:`Changes`,icon:yn},{key:`worktrees`,label:`Worktrees`,icon:yt}];function Ks(e){return e===`diff`||e===`history`||e===`changes`?`changes`:e===`search`?`search`:e===`worktrees`?`worktrees`:`files`}function qs({mode:e,onExpand:t,onSelect:n}){return(0,U.jsxs)(`div`,{className:`flex h-full w-9 shrink-0 flex-col items-center gap-1 bg-surface py-1.5`,children:[(0,U.jsxs)(Tt,{children:[(0,U.jsx)(Ft,{asChild:!0,children:(0,U.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,U.jsx)(Cn,{className:`size-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Show sidebar`})]})}),(0,U.jsx)(bt,{side:`right`,children:`Show sidebar`})]}),Gs.map(({key:t,label:r,icon:i})=>(0,U.jsxs)(Tt,{children:[(0,U.jsx)(Ft,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,"aria-current":e===t?`page`:void 0,onClick:()=>n(t),className:z(`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,U.jsx)(i,{className:`size-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:r})]})}),(0,U.jsx)(bt,{side:`right`,children:r})]},t))]})}function Js({mode:e,onModeChange:t,onCollapse:n,projectId:r,repoId:i,sessions:a,target:o,onOpenFile:s,activeFilePath:c,activeDiffPath:l,onOpenDiff:u,onOpenCommitFile:d,onOpenSearchFile:f}){let{session:p}=o;return(0,U.jsxs)(`div`,{className:`flex h-full flex-col bg-surface`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1.5`,children:[Gs.map(({key:n,label:r,icon:i})=>(0,U.jsxs)(Tt,{children:[(0,U.jsx)(Ft,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,"aria-current":e===n?`page`:void 0,onClick:()=>t(n),className:z(`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,U.jsx)(i,{className:`size-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:r})]})}),(0,U.jsx)(bt,{children:r})]},n)),(0,U.jsxs)(Tt,{children:[(0,U.jsx)(Ft,{asChild:!0,children:(0,U.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,U.jsx)(Sn,{className:`size-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Hide sidebar`})]})}),(0,U.jsx)(bt,{children:`Hide sidebar`})]})]}),e!==`worktrees`&&e!==`files`&&(0,U.jsx)(Hs,{sessions:a,target:o,showPath:e===`search`}),e===`worktrees`&&(0,U.jsx)(Vo,{repoId:i,projectId:r,sessions:a}),e===`files`&&(p?(0,U.jsxs)(so,{session:p,onOpenFile:s,activePath:c,children:[(0,U.jsx)(Hs,{sessions:a,target:o,showFileActions:!0,showPath:!0}),(0,U.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,U.jsx)(wo,{})})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Hs,{sessions:a,target:o}),(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No worktree to show.`})]})),e===`changes`&&(p?(0,U.jsx)(Ba,{session:p.id,activeDiffPath:l,onOpenDiff:u,onOpenCommitFile:d},p.id):(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No worktree to show.`})),e===`search`&&(p?(0,U.jsx)(Po,{session:p.id,onOpen:f},p.id):(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No worktree to search.`}))]})}function Ys({projectId:e,repoId:t,open:n,kind:r=`agent`,seedAccountId:i,onOpenChange:a,onCreated:o}){let s=r===`terminal`,c=Ee(),l=ve(c??void 0),u=pe(c??void 0),d=he(),f=xe(),p=ce(),[m,h]=(0,W.useState)(``),[g,_]=(0,W.useState)(``),[v,y]=(0,W.useState)(!0),[b,x]=(0,W.useState)(!0),[S,C]=(0,W.useState)(``),[w,T]=(0,W.useState)(``),[E,D]=(0,W.useState)(!1),[ee,O]=(0,W.useState)(null),k=d.data?.find(e=>e.id===t),A=De(n?t:void 0),ne=le(n?t:void 0),M=l.data?.find(e=>String(e.id)===m),oe=u.data?.allowSkipPermissions===!0,se=!s&&oe&&M?.skip_permissions_default===!0,F=g.trim()||k?.default_base_branch||``,I=(0,W.useMemo)(()=>(ne.data?.worktrees??[]).filter(e=>e.branch===F).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})),[ne.data,F]),ue=!v&&!b,de=I.find(e=>e.is_primary)?.path??I[0]?.path??``,L=w||de,fe=(0,W.useMemo)(()=>{let e=u.data?.default_account_id;return l.data?.find(e=>e.id===i)??l.data?.find(t=>typeof e==`number`&&t.id===e)??l.data?.[0]},[l.data,u.data,i]),me=m||(fe?String(fe.id):``);(0,W.useEffect)(()=>{n&&i!==void 0&&h(String(i))},[n,i]);let R=(0,W.useRef)(u.data);R.current=u.data,(0,W.useEffect)(()=>{if(n){let e=_t(s?`terminal`:`agent`,R.current);_(e.baseBranch),y(e.separateBranch),x(e.separateWorktree),T(``)}},[n,s]);let ge=()=>{O(null),p.mutate({project_id:e,...s?{kind:`terminal`}:{account_id:Number(me)},...g.trim()?{base_branch:g.trim()}:{},separate_branch:v,...v&&S.trim()?{branch:S.trim()}:{},...v?{}:{separate_worktree:b},...ue&&L?{join_worktree:L}:{},...se&&E?{skip_permissions:!0}:{}},{onSuccess:e=>{a(!1),C(``),D(!1),o(e)},onError:e=>O(e.message)})},_e=s?`a shell`:`an agent`,ye=v?`on a new branch off ${F||`…`}, in its own directory`:ue?`on ${F||`…`}, sharing an existing directory`:`on ${F||`…`}, in its own directory`;return(0,U.jsx)(P,{open:n,onOpenChange:a,children:(0,U.jsxs)(N,{children:[(0,U.jsxs)(te,{children:[(0,U.jsx)(ie,{children:s?`New terminal`:`New agent`}),(0,U.jsxs)(ae,{children:[s?`Opens`:`Spawns`,` `,_e,` `,ye,`.`]})]}),(0,U.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),(s||me)&&ge()},children:[!s&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(Te,{children:`Account`}),l.data?.length===0?(0,U.jsxs)(`p`,{className:`text-sm text-fg-secondary`,children:[`No accounts yet —`,` `,(0,U.jsx)(`button`,{type:`button`,className:`text-accent underline`,onClick:()=>St(`accounts`),children:`add one in settings`}),`.`]}):(0,U.jsxs)(pt,{value:me,onValueChange:h,children:[(0,U.jsx)(dt,{children:(0,U.jsx)(mt,{placeholder:`pick an account`})}),(0,U.jsx)(ht,{children:l.data?.map(e=>(0,U.jsxs)(ft,{value:String(e.id),children:[(0,U.jsxs)(`span`,{className:`font-mono`,children:[e.agent_type,`/`,e.label]}),!e.logged_in&&(0,U.jsx)(`span`,{className:`ml-2 text-2xs text-waiting`,children:`not logged in`})]},e.id))})]})]}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,U.jsx)(Te,{htmlFor:`base-branch`,children:`Base branch`}),(0,U.jsx)(Oe,{id:`base-branch`,placeholder:k?.default_base_branch??`main`,value:g,onValueChange:_,hints:(A.data?.branches??[]).filter(e=>e.name.toLowerCase().includes(g.trim().toLowerCase())).slice(0,20).map(e=>({value:e.name,badge:e.name===k?.default_base_branch?`default`:e.is_session?`session: ${e.session_title??`untitled`}`:void 0})),className:`font-mono`,hintsClassName:`w-max min-w-full max-w-[36rem]`})]}),v&&(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,U.jsx)(Te,{htmlFor:`session-branch`,children:`New branch`}),(0,U.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`optional`})]}),(0,U.jsx)(ke,{id:`session-branch`,placeholder:`leave blank for auto`,value:S,onChange:e=>C(e.target.value),className:`font-mono`})]})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Nt,{id:`separate-branch`,checked:v,onCheckedChange:e=>{y(e),e&&x(!0)}}),(0,U.jsx)(Te,{htmlFor:`separate-branch`,children:`Use separate branch`})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Nt,{id:`separate-worktree`,checked:v?!0:b,disabled:v,onCheckedChange:x}),(0,U.jsx)(Te,{htmlFor:`separate-worktree`,className:z(v&&`text-fg-muted`),children:`Use separate directory`})]})]}),ue&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(Te,{htmlFor:`join-dir`,children:`Directory to join`}),I.length===0?(0,U.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[`No existing directory on `,(0,U.jsx)(`span`,{className:`font-mono`,children:F||`…`}),` — a shared one will be created for later sessions to join.`]}):(0,U.jsxs)(pt,{value:L,onValueChange:T,children:[(0,U.jsx)(dt,{id:`join-dir`,children:(0,U.jsx)(mt,{})}),(0,U.jsx)(ht,{children:I.map(e=>(0,U.jsx)(ft,{value:e.path,title:e.path,detail:(0,U.jsx)(`span`,{className:`ml-auto min-w-0 truncate font-mono text-2xs text-fg-muted`,children:Bs(e.path,f.data?.home)}),children:e.label},e.path))})]})]}),!v&&!s&&(0,U.jsxs)(`p`,{className:`text-xs text-waiting`,children:[`The `,s?`shell`:`agent`,` commits straight to`,` `,(0,U.jsx)(`span`,{className:`font-mono`,children:F||`…`}),ue?` and shares its working directory with concurrent sessions — they can trample each other’s edits.`:`.`]}),se&&(0,U.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md bg-surface px-3 py-2`,children:[(0,U.jsx)(Nt,{id:`skip-permissions`,checked:E,onCheckedChange:D}),(0,U.jsx)(Te,{htmlFor:`skip-permissions`,className:`text-waiting`,children:`Skip permission prompts for this session`})]}),ee&&(0,U.jsx)(`p`,{className:`text-xs text-danger`,children:ee}),(0,U.jsxs)(re,{children:[(0,U.jsx)(j,{type:`button`,variant:`ghost`,onClick:()=>a(!1),children:`Cancel`}),(0,U.jsx)(j,{type:`submit`,disabled:!s&&!me||p.isPending,children:s?`Open terminal`:`Start agent`})]})]})]})})}function Xs({status:e,kind:t=`agent`,stale:n=!1,className:r}){let i=`${t===`terminal`?`terminal `:``}status: ${e.replace(`_`,` `)}${n?` (no agent activity for over an hour — possibly stalled)`:``}`;return(0,U.jsx)(`span`,{className:z(`status-dot`,r),"data-status":e,"data-kind":t,"data-stale":n||void 0,role:`img`,title:n?`No agent activity for over an hour — possibly stalled`:void 0,"aria-label":i})}var Zs=[`starting`,`running`,`waiting_input`],Qs=[`exited`,`interrupted`],$s={Item:Is,Separator:zs,Sub:Ps,SubTrigger:Ls,SubContent:Rs},ec={Item:V,Separator:Ze,Sub:We,SubTrigger:it,SubContent:nt};function tc(e,t){let n=R(`resume`),r=R(`kill`),i=be(),a=Ne(),o=ue(),s=de(),c=ye(),l=ce(),u=zt(),d=Ee(),f=ve(d??void 0),p=pe(d??void 0),[m,h]=(0,W.useState)(null),[g,_]=(0,W.useState)(!1),[v,y]=(0,W.useState)(e.title??``),[b,x]=(0,W.useState)(null),S=(f.data??[]).filter(t=>t.agent_type===e.agent_type),C=!e.worktree_missing&&e.status!==`archived`&&S.some(t=>t.id!==e.account_id),w=p.data?.default_account_id,T=typeof w==`number`?w:null,E=(f.data??[]).filter(e=>e.logged_in),ee=T===null?E:[...E.filter(e=>e.id===T),...E.filter(e=>e.id!==T)];return{menu:{session:e,resumable:Qs.includes(e.status),live:Zs.includes(e.status),archived:e.status===`archived`,canMigrate:C,sameAgent:S,resume:()=>n.mutate(e.id,{onError:e=>D.error(e.message)}),kill:()=>r.mutate(e.id,{onError:e=>D.error(e.message)}),openClearEnv:()=>h(`clear-env`),openTerminal:()=>l.mutate({project_id:e.project_id,kind:`terminal`,separate_branch:!1,separate_worktree:!1,join_worktree:e.worktree_path},{onSuccess:e=>void u(`/project/${e.project_id}/session/${e.id}`),onError:e=>D.error(e.message)}),spawnAccounts:ee,defaultAccountId:T,spawnAgent:t=>l.mutate({project_id:e.project_id,account_id:t,separate_branch:!1,separate_worktree:!1,join_worktree:e.worktree_path},{onSuccess:e=>void u(`/project/${e.project_id}/session/${e.id}`),onError:e=>D.error(e.message)}),openRename:()=>{y(e.title??``),_(!0)},archive:()=>i.mutate(e.id,{onSuccess:()=>t?.(e.id),onError:e=>D.error(e.message)}),unarchive:()=>a.mutate(e.id,{onError:e=>D.error(e.message)}),setMigrateTo:x},dialogs:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(P,{open:m===`clear-env`,onOpenChange:e=>{e||h(null)},children:(0,U.jsxs)(N,{children:[(0,U.jsxs)(te,{children:[(0,U.jsx)(ie,{children:`Clear captured environment?`}),(0,U.jsx)(ae,{children:`Variables exported in this session’s terminals will no longer be injected into new shells or agent restarts.`})]}),(0,U.jsxs)(re,{children:[(0,U.jsx)(j,{variant:`ghost`,onClick:()=>h(null),children:`Cancel`}),(0,U.jsx)(j,{variant:`danger`,disabled:c.isPending,onClick:()=>c.mutate(e.id,{onSuccess:e=>{h(null),D.success(e.cleared===0?`Nothing was captured`:`Cleared ${e.cleared} captured var${e.cleared===1?``:`s`}`)},onError:e=>{h(null),D.error(e.message)}}),children:`Clear captured env`})]})]})}),(0,U.jsx)(P,{open:g,onOpenChange:_,children:(0,U.jsxs)(N,{children:[(0,U.jsxs)(te,{children:[(0,U.jsx)(ie,{children:`Rename session`}),(0,U.jsx)(ae,{children:`Leave it empty to use the agent’s own session name.`})]}),(0,U.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:t=>{t.preventDefault(),o.mutate({sessionId:e.id,title:v.trim()},{onSuccess:()=>_(!1),onError:e=>D.error(e.message)})},children:[(0,U.jsx)(ke,{value:v,onChange:e=>y(e.target.value),placeholder:e.agent_title??e.osc_title??e.id.slice(0,8),autoFocus:!0}),(0,U.jsxs)(re,{children:[(0,U.jsx)(j,{type:`button`,variant:`ghost`,onClick:()=>_(!1),children:`Cancel`}),(0,U.jsx)(j,{type:`submit`,disabled:o.isPending,children:`Rename`})]})]})]})}),(0,U.jsx)(P,{open:b!==null,onOpenChange:e=>!e&&x(null),children:(0,U.jsxs)(N,{children:[(0,U.jsxs)(te,{children:[(0,U.jsxs)(ie,{children:[`Move this session to `,b?.label,`?`]}),(0,U.jsx)(ae,{children:`The conversation continues under that account’s credentials. If the session is running it is stopped first, then resumed on the new account.`})]}),(0,U.jsxs)(re,{children:[(0,U.jsx)(j,{variant:`ghost`,onClick:()=>x(null),children:`Cancel`}),(0,U.jsx)(j,{disabled:s.isPending,onClick:()=>{b&&s.mutate({sessionId:e.id,accountId:b.id},{onSuccess:()=>{x(null),D.success(`Moved to ${b.label}`)},onError:e=>{x(null),D.error(e.message)}})},children:`Move session`})]})]})})]})}}function nc({kit:e,menu:t}){let{Item:n,Separator:r,Sub:i,SubTrigger:a,SubContent:o}=e,{session:s}=t;return(0,U.jsxs)(U.Fragment,{children:[t.resumable&&!s.worktree_missing&&(0,U.jsxs)(n,{onSelect:t.resume,children:[(0,U.jsx)(Dn,{}),` Resume`]}),t.live&&(0,U.jsxs)(n,{onSelect:t.kill,children:[(0,U.jsx)(An,{}),` Kill`]}),(0,U.jsxs)(n,{onSelect:t.openRename,children:[(0,U.jsx)(Ae,{}),` Rename`]}),!t.archived&&(0,U.jsxs)(n,{onSelect:t.openClearEnv,children:[(0,U.jsx)(Zt,{}),` Clear captured env`]}),t.canMigrate&&(0,U.jsxs)(i,{children:[(0,U.jsxs)(a,{children:[(0,U.jsx)(jn,{}),` Move to account…`]}),(0,U.jsx)(o,{children:t.sameAgent.map(e=>{let r=e.id===s.account_id;return(0,U.jsxs)(n,{disabled:r,onSelect:()=>t.setMigrateTo(e),children:[e.label,r&&(0,U.jsx)(`span`,{className:`ml-auto text-fg-muted`,children:`current`})]},e.id)})})]}),!s.worktree_missing&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(r,{}),(0,U.jsxs)(n,{onSelect:t.openTerminal,children:[(0,U.jsx)(kt,{}),` Open terminal in worktree`]}),t.spawnAccounts.length>0&&(0,U.jsxs)(i,{children:[(0,U.jsxs)(a,{children:[(0,U.jsx)(jt,{}),` Spawn agent in worktree`]}),(0,U.jsx)(o,{children:t.spawnAccounts.map(e=>(0,U.jsxs)(n,{onSelect:()=>t.spawnAgent(e.id),children:[(0,U.jsx)(Vt,{type:e.agent_type,className:`size-4 shrink-0`}),e.agent_type,`/`,e.label,e.id===t.defaultAccountId&&(0,U.jsx)(`span`,{className:`ml-auto pl-3 text-fg-muted`,children:`default`})]},e.id))})]}),(0,U.jsxs)(n,{onSelect:()=>{window.location.href=Ht(`vscode`,s.worktree_path,Bt())},children:[(0,U.jsx)(Qt,{}),` Open in VS Code`]}),(0,U.jsxs)(n,{onSelect:()=>{window.location.href=Ht(`cursor`,s.worktree_path,Bt())},children:[(0,U.jsx)(Qt,{}),` Open in Cursor`]})]}),!t.archived&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(r,{}),(0,U.jsxs)(n,{onSelect:t.archive,children:[(0,U.jsx)(Ie,{}),` Archive`]})]}),t.archived&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(r,{}),(0,U.jsxs)(n,{onSelect:t.unarchive,children:[(0,U.jsx)(Qe,{}),` Unarchive`]})]})]})}function rc({menu:e}){return(0,U.jsxs)(Ms,{children:[(0,U.jsx)(Ns,{asChild:!0,children:(0,U.jsxs)(j,{variant:`ghost`,size:`icon`,className:`size-6`,onClick:e=>e.preventDefault(),children:[(0,U.jsx)(Xt,{}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Session actions`})]})}),(0,U.jsx)(Fs,{align:`end`,children:(0,U.jsx)(nc,{kit:$s,menu:e})})]})}function ic({session:e,onArchived:t,children:n}){let{menu:r,dialogs:i}=tc(e,t);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(at,{children:[(0,U.jsx)(Ke,{asChild:!0,children:typeof n==`function`?n(r):n}),(0,U.jsx)(tt,{children:(0,U.jsx)(nc,{kit:ec,menu:r})})]}),i]})}function ac({menu:e}){return(0,U.jsx)(tt,{children:(0,U.jsx)(nc,{kit:ec,menu:e})})}function oc({icon:e,label:t,onClick:n,active:r=!1}){return(0,U.jsxs)(Tt,{children:[(0,U.jsx)(Ft,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,onClick:n,"aria-pressed":r,className:z(`flex items-center rounded-md p-1.5 transition-colors`,r?`bg-elevated text-fg`:`text-fg-gold hover:bg-elevated hover:text-fg`),children:[(0,U.jsx)(e,{className:`size-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:t})]})}),(0,U.jsx)(bt,{children:t})]})}function sc({session:e}){return(0,U.jsxs)(`span`,{className:`flex flex-col`,children:[(0,U.jsx)(`span`,{children:Dt()(e)}),(0,U.jsx)(`span`,{className:`font-mono text-2xs text-fg-muted`,children:e.branch})]})}function cc({session:e,activeSessionId:t,onPromote:n,onArchived:r}){let{menu:i,dialogs:a}=tc(e,r),o=Dt();return(0,U.jsxs)(at,{children:[(0,U.jsxs)(Tt,{children:[(0,U.jsx)(Ke,{asChild:!0,children:(0,U.jsx)(Ft,{asChild:!0,children:(0,U.jsxs)(Pt,{draggable:!1,"aria-current":e.id===t?`true`:void 0,onDoubleClick:()=>n(e.id),to:`/project/${e.project_id}/session/${e.id}`,className:z(`flex items-center rounded-md p-1.5 transition-colors hover:bg-elevated`,e.id===t&&`bg-elevated`),children:[(0,U.jsx)(Xs,{status:e.status,kind:e.kind,stale:e.stale_running,className:`[--puddle-ripple-scale:2.3]`}),(0,U.jsx)(`span`,{className:`sr-only`,children:o(e)})]})})}),(0,U.jsx)(bt,{children:(0,U.jsx)(sc,{session:e})})]}),(0,U.jsx)(ac,{menu:i}),a]})}function lc({groups:e,activeSessionId:t,onReorder:n,onPromote:r,onExpand:i,onNewTerminal:a,onNewSession:o,onArchived:s}){let[c,l]=(0,W.useState)(null),u=e.filter(e=>e.sessions.length>0),d=(e,t)=>{let r=Re(u,e,t);r&&n(r)};return(0,U.jsxs)(`div`,{className:`flex h-full w-9 shrink-0 flex-col items-center bg-surface py-1.5`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,U.jsx)(oc,{icon:Tn,label:`Show sessions`,onClick:i}),(0,U.jsx)(oc,{icon:jt,label:`New agent`,onClick:o}),(0,U.jsx)(oc,{icon:kt,label:`New terminal`,onClick:a})]}),(0,U.jsx)(`div`,{className:`no-scrollbar flex min-h-0 flex-1 flex-col items-center gap-1 overflow-y-auto`,children:u.map(e=>(0,U.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,U.jsx)(`div`,{className:`my-0.5 h-px w-5 shrink-0 bg-border`}),e.sessions.map(e=>(0,U.jsx)(`div`,{draggable:!0,onDragStart:t=>{t.dataTransfer.setData(co,lo({type:`terminal`,session:e.id})),l(e.id)},onDragEnd:()=>l(null),onDragOver:t=>{t.preventDefault(),c&&c!==e.id&&d(c,e.id)},className:z(`transition-opacity`,c===e.id&&`opacity-50`),children:(0,U.jsx)(cc,{session:e,activeSessionId:t,onPromote:r,onArchived:s})},e.id))]},e.projectId))})]})}function uc({session:e,activeSessionId:t,accountLabel:n,onPromote:r,onArchived:i,ellipsis:a}){let o=Dt();return(0,U.jsx)(ic,{session:e,onArchived:i,children:i=>(0,U.jsxs)(Pt,{draggable:!1,onDoubleClick:r&&(()=>r(e.id)),to:`/project/${e.project_id}/session/${e.id}`,className:z(`group flex items-center gap-2 px-3 py-1.5 transition-colors hover:bg-elevated`,e.id===t&&`bg-elevated`),children:[(0,U.jsx)(Xs,{status:e.status,kind:e.kind,stale:e.stale_running}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block truncate font-sans text-xs text-fg`,children:o(e)}),(0,U.jsxs)(`span`,{className:`flex items-center gap-1 truncate font-mono text-2xs text-fg-muted`,children:[(0,U.jsx)(yn,{className:`size-3 shrink-0 text-fg-gold`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.branch})]}),e.account_id!==null&&n.has(e.account_id)&&(0,U.jsxs)(`span`,{className:`flex items-center gap-1 truncate font-mono text-2xs text-fg-muted`,children:[(0,U.jsx)(Vt,{type:e.agent_type??``,className:`size-3 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:n.get(e.account_id)})]})]}),e.skip_permissions&&(0,U.jsxs)(Tt,{children:[(0,U.jsx)(Ft,{asChild:!0,children:(0,U.jsx)(kn,{className:`size-3.5 shrink-0 text-waiting`})}),(0,U.jsx)(bt,{children:`Running with permission prompts skipped`})]}),e.worktree_missing&&(0,U.jsxs)(Tt,{children:[(0,U.jsx)(Ft,{asChild:!0,children:(0,U.jsx)(vn,{className:`size-3.5 shrink-0 text-interrupted`})}),(0,U.jsx)(bt,{children:`Worktree directory is gone — archive only`})]}),a&&(0,U.jsx)(`span`,{className:`hidden group-hover:inline-flex has-[[data-state=open]]:inline-flex`,children:(0,U.jsx)(rc,{menu:i})})]})})}function dc({groups:e,accounts:t,activeSessionId:n,onReorder:r,onPromote:i,archived:a,onNewSession:o,onNewTerminal:s,onCollapse:c,onArchived:l}){return(0,U.jsxs)(`div`,{className:`flex h-full flex-col bg-surface`,children:[(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 px-2 py-1.5`,children:[(0,U.jsx)(oc,{icon:wn,label:`Hide sessions`,onClick:c}),(0,U.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,U.jsx)(oc,{icon:jt,label:`New agent`,onClick:o}),(0,U.jsx)(oc,{icon:kt,label:`New terminal`,onClick:s})]})]}),(0,U.jsx)(fc,{groups:e,accounts:t,activeSessionId:n,onReorder:r,onPromote:i,archived:a,onArchived:l})]})}function fc({groups:e,accounts:t,activeSessionId:n,onReorder:r,onPromote:i,archived:a,onArchived:o}){let[s,c]=(0,W.useState)(null),[l,u]=(0,W.useState)(!1),d=new Map(t.map(e=>[e.id,e.label])),f=e.filter(e=>e.sessions.length>0),p=f.reduce((e,t)=>e+t.sessions.length,0),m=(e,t)=>{let n=Re(f,e,t);n&&r(n)};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`no-scrollbar min-h-0 flex-1 overflow-y-auto py-1.5`,children:[p===0&&a.length===0&&(0,U.jsx)(`p`,{className:`px-3 py-3 text-xs text-fg-muted`,children:`No sessions yet — press ⌘K to start one.`}),f.map(e=>(0,U.jsxs)(`div`,{children:[e.name!==null&&(0,U.jsx)(`div`,{className:`truncate px-3 pb-1 pt-2 text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:e.name}),(0,U.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:e.sessions.map(e=>(0,U.jsx)(`li`,{draggable:!0,onDragStart:t=>{t.dataTransfer.setData(co,lo({type:`terminal`,session:e.id})),c(e.id)},onDragEnd:()=>c(null),onDragOver:t=>{t.preventDefault(),s&&s!==e.id&&m(s,e.id)},className:z(`transition-opacity`,s===e.id&&`opacity-50`),children:(0,U.jsx)(uc,{session:e,activeSessionId:n,accountLabel:d,onPromote:i,onArchived:o,ellipsis:!0})},e.id))})]},e.projectId))]}),a.length>0&&(0,U.jsxs)(`div`,{className:`shrink-0 pb-1.5`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>u(e=>!e),className:`flex w-full items-center gap-1.5 px-3 py-1.5 text-2xs uppercase tracking-wide text-fg-gold transition-colors hover:text-fg`,children:[(0,U.jsx)(vt,{className:z(`size-3 transition-transform`,l&&`rotate-90`)}),(0,U.jsx)(Ie,{className:`size-3`}),(0,U.jsx)(`span`,{children:`Archived`}),(0,U.jsx)(`span`,{className:`ml-auto tabular-nums`,children:a.length})]}),l&&(0,U.jsx)(`ul`,{className:`no-scrollbar flex max-h-48 flex-col gap-0.5 overflow-y-auto`,children:a.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsx)(uc,{session:e,activeSessionId:n,accountLabel:d,onArchived:o,ellipsis:!0})},e.id))})]})]})}var pc=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function mc(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function hc(e){return`nodeType`in e}function X(e){return e?mc(e)?e:hc(e)?e.ownerDocument?.defaultView??window:window:window}function gc(e){let{Document:t}=X(e);return e instanceof t}function _c(e){return!mc(e)&&e instanceof X(e).HTMLElement}function vc(e){return e instanceof X(e).SVGElement}function yc(e){return e?mc(e)?e.document:hc(e)?gc(e)?e:_c(e)||vc(e)?e.ownerDocument:document:document:document}var bc=pc?W.useLayoutEffect:W.useEffect;function xc(e){let t=(0,W.useRef)(e);return bc(()=>{t.current=e}),(0,W.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function Sc(){let e=(0,W.useRef)(null);return[(0,W.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,W.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function Cc(e,t){t===void 0&&(t=[e]);let n=(0,W.useRef)(e);return bc(()=>{n.current!==e&&(n.current=e)},t),n}function wc(e,t){let n=(0,W.useRef)();return(0,W.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function Tc(e){let t=xc(e),n=(0,W.useRef)(null);return[n,(0,W.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function Ec(e){let t=(0,W.useRef)();return(0,W.useEffect)(()=>{t.current=e},[e]),t.current}var Dc={};function Oc(e,t){return(0,W.useMemo)(()=>{if(t)return t;let n=Dc[e]==null?0:Dc[e]+1;return Dc[e]=n,e+`-`+n},[e,t])}function kc(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 Ac=kc(1),jc=kc(-1);function Mc(e){return`clientX`in e&&`clientY`in e}function Nc(e){if(!e)return!1;let{KeyboardEvent:t}=X(e.target);return t&&e instanceof t}function Pc(e){if(!e)return!1;let{TouchEvent:t}=X(e.target);return t&&e instanceof t}function Fc(e){if(Pc(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 Mc(e)?{x:e.clientX,y:e.clientY}:null}var Ic=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[Ic.Translate.toString(e),Ic.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),Lc=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function Rc(e){return e.matches(Lc)?e:e.querySelector(Lc)}var zc={display:`none`};function Bc(e){let{id:t,value:n}=e;return W.createElement(`div`,{id:t,style:zc},n)}function Vc(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return W.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 Hc(){let[e,t]=(0,W.useState)(``);return{announce:(0,W.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var Uc=(0,W.createContext)(null);function Wc(e){let t=(0,W.useContext)(Uc);(0,W.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function Gc(){let[e]=(0,W.useState)(()=>new Set),t=(0,W.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,W.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var Kc={draggable:`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PaneEditorBody-9TcMQDtu.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/jsx-runtime-ffCh33zF.js","assets/editor-tabs-D0_DZriG.js","assets/poll-focus-B7dQPFj6.js","assets/api-Bh5IJ30S.js","assets/preload-helper-Czpn1I53.js","assets/createLucideIcon-DyMAgLa3.js","assets/index-Ba4ffI1I.js","assets/dialog-B43iKmfK.js","assets/utils-B6KiDbIe.js","assets/LazyTerminal-yHVhpi-E.js","assets/index-DWY2t2XS.css","assets/editor.api2-4X9Vh9Zw.js","assets/editor-Br_kD0ds.css","assets/buffer-store-DXk7xJbf.js","assets/buffer-logic-BrpRsL1b.js","assets/editor-sync-F3Wyveaa.js","assets/debounce-B9DrqirV.js","assets/PaneEditorBody-Dz-67XSV.css","assets/ModelRefcount-ByUhfyK3.js","assets/EditorTabClose-DBiuZxHR.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{o as i}from"./poll-focus-B7dQPFj6.js";import{C as a,S as o,a as s,d as c,f as l,g as u,h as d,l as f,m as p,n as m,p as h,r as g,s as _,t as v,u as y,w as b,x,y as S}from"./editor-tabs-D0_DZriG.js";import{t as C}from"./preload-helper-Czpn1I53.js";import{c as w,l as T,v as E,x as D}from"./api-Bh5IJ30S.js";import{A as ee,O,_ as k,a as te,b as A,g as j,h as ne,i as re,j as M,n as N,o as ie,r as ae,t as P,w as oe}from"./dialog-B43iKmfK.js";import{$ as se,C as ce,E as F,G as I,J as le,K as ue,N as de,Q as L,U as fe,V as pe,W as me,Y as he,Z as R,c as ge,ct as _e,f as ve,g as ye,h as be,j as xe,l as Se,m as Ce,n as we,nt as Te,o as Ee,q as De,r as Oe,rt as ke,s as Ae,st as je,t as Me,tt as Ne,u as Pe,w as Fe}from"./LazyTerminal-yHVhpi-E.js";import{t as z}from"./utils-B6KiDbIe.js";import{t as B}from"./createLucideIcon-DyMAgLa3.js";import{A as Ie,C as Le,D as Re,E as ze,O as Be,S as Ve,T as He,_ as Ue,a as We,b as Ge,c as Ke,d as qe,f as Je,g as Ye,h as Xe,i as Ze,j as Qe,l as $e,m as et,n as tt,o as nt,p as rt,r as V,s as it,t as at,u as ot,v as st,w as ct,x as lt,y as ut}from"./context-menu-Bw30Lg7d.js";import{a as dt,i as ft,n as pt,o as mt,r as ht,s as gt,t as _t}from"./session-seed-Y4nqH0Gc.js";import{i as vt,r as yt}from"./dist-VDiYuPKw.js";import{$ as bt,G as xt,I as St,K as Ct,P as wt,Q as Tt,R as Et,S as Dt,U as Ot,W as kt,X as At,Z as jt,_ as Mt,a as Nt,ct as Pt,et as Ft,g as It,i as Lt,j as Rt,lt as zt,n as Bt,s as Vt,t as Ht,ut as Ut,w as Wt}from"./index-Ba4ffI1I.js";import{t as Gt}from"./debounce-B9DrqirV.js";import{i as Kt}from"./buffer-logic-BrpRsL1b.js";import{t as qt}from"./ssh-mode-BvVBPtPI.js";var Jt=B(`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`}]]),Yt=B(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),Xt=B(`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`}]]),Zt=B(`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`}]]),Qt=B(`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`}]]),$t=B(`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`}]]),en=B(`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`}]]),tn=B(`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`}]]),H=B(`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`}]]),nn=B(`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`}]]),rn=B(`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`}]]),an=B(`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`}]]),on=B(`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`}]]),sn=B(`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`}]]),cn=B(`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`}]]),ln=B(`file-plus`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),un=B(`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`}]]),dn=B(`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`}]]),fn=B(`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`}]]),pn=B(`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`}]]),mn=B(`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`}]]),hn=B(`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`}]]),gn=B(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),_n=B(`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`}]]),vn=B(`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`}]]),yn=B(`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`}]]),bn=B(`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`}]]),xn=B(`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`}]]),Sn=B(`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`}]]),Cn=B(`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`}]]),wn=B(`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`}]]),Tn=B(`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`}]]),En=B(`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`}]]),Dn=B(`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`}]]),On=B(`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`}]]),kn=B(`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`}]]),An=B(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),jn=B(`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`}]]),Mn=B(`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`}]]),U=r(),W=e(t(),1);function Nn(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function Pn(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function Fn(e){return e/100*window.innerHeight}function In(e){return e/100*window.innerWidth}function Ln(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 Rn({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=Ln(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=Pn(t,i);break;case`em`:r=Nn(t,i);break;case`vh`:r=Fn(i);break;case`vw`:r=In(i);break}return r}function G(e){return parseFloat(e.toFixed(3))}function zn({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 Bn(e){let{panels:t}=e,n=zn({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=G(Rn({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=G(Rn({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=G(Rn({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=G(Rn({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 K(e,t=`Assertion error`){if(!e)throw Error(t)}function Vn(e,t){return Array.from(t).sort(e===`horizontal`?Hn:Un)}function Hn(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function Un(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function Wn(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Gn(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 Kn({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}=Gn(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return K(i,`No rect found`),i}var qn;function Jn(){return qn===void 0&&(qn=typeof matchMedia==`function`&&!!matchMedia(`(pointer:coarse)`).matches),qn}function Yn(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Vn(n,Array.from(t.children).filter(Wn).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,Kn({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=Jn()?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:zn({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 Xn=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)}}},Zn={cursorFlags:0,state:`inactive`},Qn=new Xn;function $n(){return Zn}function er(e){return Qn.addListener(`change`,e)}function tr(e){let t=Zn,n={...Zn};n.cursorFlags=e,Zn=n,Qn.emit(`change`,{prev:t,next:n})}function nr(e){let t=Zn;Zn=e,Qn.emit(`change`,{prev:t,next:e})}var rr=e=>e,ir=()=>{},ar=1,or=2,sr=4,cr=8,lr=3,ur=12,dr;function fr(){return dr===void 0&&(dr=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(dr=!0)),dr}function pr({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&&fr()){let t=(e&ar)!==0,n=(e&or)!==0,r=(e&sr)!==0,i=(e&cr)!==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 fr()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var mr=new WeakMap;function hr(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=mr.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=$n();switch(r.state){case`active`:case`hover`:{let e=pr({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}mr.set(e,{prevStyle:t,styleSheet:n})}var gr=new Map,_r=new Xn;function vr(e){gr=new Map(gr),gr.delete(e)}function yr(e,t){for(let[t]of gr)if(t.id===e)return t}function br(e,t){for(let[t,n]of gr)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function xr(){return gr}function Sr(e,t){return _r.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function Cr(e,t,n){let r=gr.get(e);gr=new Map(gr),gr.set(e,t),_r.emit(`groupChange`,{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:r,next:t})}function wr(e){let t=$n(),n=!1;switch(t.state){case`active`:nr({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(hr(e),n=!0,t.hitRegions.forEach(e=>{let t=br(e.group.id,!0);Cr(e.group,t,{isUserInteraction:!0})}))}return n}function Tr(e){e.defaultPrevented||wr(e.currentTarget)}function Er(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Gn(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 Dr(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Or(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:Pr(e),b:Pr(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();K(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:Nr(Mr(n.a)),b:Nr(Mr(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 kr=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Ar(e){let t=getComputedStyle(Fr(e)??e).display;return t===`flex`||t===`inline-flex`}function jr(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||Ar(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`||kr.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Mr(e){let t=e.length;for(;t--;){let n=e[t];if(K(n,`Missing node`),jr(n))return n}return null}function Nr(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Pr(e){let t=[];for(;e;)t.push(e),e=Fr(e);return t}function Fr(e){let{parentNode:t}=e;return Dr(t)?t.host:t}function Ir(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 Lr({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Wn(n)||n.contains(e)||e.contains(n))return!0;if(Or(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Ir(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Rr(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Yn(r),a=Er(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Lr({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function zr(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 q(e,t,n=0){return Math.abs(G(e)-G(t))<=n}function Br(e,t){return q(e,t)?0:e>t?1:-1}function Vr({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(Br(r,c)<0)if(a){let e=(i+c)/2;r=Br(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=G(r),r}function Hr({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(q(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;K(u!=null,`Invalid first pivot index`),K(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];K(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(K(n!=null,`Previous layout not found for panel index ${t}`),q(n,i)){let t=o-n;Br(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];K(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(K(n!=null,`Previous layout not found for panel index ${t}`),q(n,o)){let t=n-i;Br(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];K(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&Br(i,c)<0)if(e>0){let t=c-o,n=t/2;Br(i+e,c)<0&&(e=Br(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;Br(i-e,c)<0&&(e=Br(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];K(e!=null,`Previous layout not found for panel index ${r}`);let a=Vr({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];K(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=Vr({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!q(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(zr(c,l))return i;{let t=e<0?d:u,r=s[t];K(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=Vr({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!q(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];K(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=Vr({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(q(i,s)||(t-=s-i,l[r]=s),q(t,0))break;e>0?r--:r++}}}if(!q(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 Ur(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||Br(e[n],t[n])!==0)return!1;return!0}function Wr({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(!q(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];K(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];K(i!=null,`No layout data found for index ${e}`);let o=r[e];K(o!=null,`No layout data found for index ${e}`);let s=Vr({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!q(a,0))for(let e=0;e<t.length;e++){let n=r[e];K(n!=null,`No layout data found for index ${e}`);let i=n+a,o=Vr({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,q(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Gr({groupId:e,panelId:t}){let n=()=>{let t=xr();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&&q(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:G(100-e)}}return Hr({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=Wr({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});Ur(c,u)||Cr(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&&q(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=zn({group:t}),o=G(Rn({groupSize:a,panelElement:r,styleProp:e})/a*100);s(o)}}}function Kr(e){e.defaultPrevented||Rr(e,xr()).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=Gr({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function qr(e){let t=xr();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 Jr({groupId:e}){let t=()=>{let t=xr();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=Wr({layout:e,panelConstraints:r});return n?o:(Ur(o,c)||Cr(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function Yr(e,t){let n=qr(e),r=br(n.id,!0),i=n.separators.find(t=>t.element===e);K(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);K(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=Jr({groupId:n.id}).getLayout(),c=Wr({layout:Hr({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Ur(s,c)||Cr(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function Xr(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=qr(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Yr(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Yr(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Yr(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Yr(t,-5);break;case`End`:e.preventDefault(),Yr(t,100);break;case`Enter`:{e.preventDefault();let n=qr(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=br(n.id,!0),o=n.separators.find(e=>e.element===t);K(o,`Matching separator not found`);let s=a.get(o);K(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(K(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Yr(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=qr(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);K(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(),Yr(t,-100);break}}function Zr(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=xr(),n=Rr(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)}),nr({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}function Qr({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=Hr({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Ur(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?ar:or;break;case`vertical`:s|=d<0?sr:cr;break}}else Cr(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&lr:c|=s&lr,t.movementY===0?c|=o&ur:c|=s&ur,tr(c),hr(e)}function $r(e){let t=xr(),n=$n();switch(n.state){case`active`:Qr({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function ei(e){if(e.defaultPrevented)return;let t=$n(),n=xr();switch(t.state){case`active`:if(e.buttons===0){nr({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=br(e.group.id,!0);Cr(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)}Qr({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Rr(e,n);r.length===0?t.state!==`inactive`&&nr({cursorFlags:0,state:`inactive`}):nr({cursorFlags:0,hitRegions:r,state:`hover`}),hr(e.currentTarget);break}}}function ti(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch($n().state){case`hover`:nr({cursorFlags:0,state:`inactive`})}}function ni(e){e.defaultPrevented||e.pointerType===`mouse`&&e.button>0||wr(e.currentTarget)&&e.preventDefault()}function ri(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=G(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=G((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function ii(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=zn({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:G(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function ai(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 oi({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=G(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]=G((r[e]??0)/a*l);else{let e=G(l/c.length);for(let t of c)u[t]=e}return u}function si(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 ci=new Map;function li(e){let t=!0;K(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=zn({group:e});if(t===0)return;let n=br(e.id);if(!n)return;let r=Bn(e),i=n.defaultLayoutDeferred?ri(r):n.layout,a=Wr({layout:oi({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Ur(n.layout,a)&&ai(n.derivedPanelConstraints,r)&&n.groupSize===t)return;Cr(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else ii(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{K(!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=zn({group:e}),s=Bn(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(si(e.panels,l)||(l=void 0));let u=Wr({layout:e.mutableState.layouts[c]??l??ri(s),panelConstraints:s}),d=e.element.ownerDocument;ci.set(d,(ci.get(d)??0)+1);let f=new Map;return Yn(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),Cr(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{K(!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`,Xr)}),ci.get(d)===1&&(d.addEventListener(`contextmenu`,Tr,!0),d.addEventListener(`dblclick`,Kr,!0),d.addEventListener(`pointerdown`,Zr,!0),d.addEventListener(`pointerleave`,$r),d.addEventListener(`pointermove`,ei),d.addEventListener(`pointerout`,ti),d.addEventListener(`pointerup`,ni,!0)),function(){t=!1,ci.set(d,Math.max(0,(ci.get(d)??0)-1)),vr(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,Xr)}),ci.get(d)||(d.removeEventListener(`contextmenu`,Tr,!0),d.removeEventListener(`dblclick`,Kr,!0),d.removeEventListener(`pointerdown`,Zr,!0),d.removeEventListener(`pointerleave`,$r),d.removeEventListener(`pointermove`,ei),d.removeEventListener(`pointerout`,ti),d.removeEventListener(`pointerup`,ni,!0)),a.disconnect()}}function ui(){let[e,t]=(0,W.useState)({});return[e,(0,W.useCallback)(()=>t({}),[])]}function di(e){let t=(0,W.useId)();return`${e??t}`}var fi=typeof window<`u`?W.useLayoutEffect:W.useEffect;function pi(e){let t=(0,W.useRef)(e);return fi(()=>{t.current=e},[e]),(0,W.useCallback)((...e)=>t.current?.(...e),[t])}function mi(...e){return pi(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function hi(e){let t=(0,W.useRef)({...e});return fi(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var gi=(0,W.createContext)(null);function _i(e,t){let n=(0,W.useRef)({getLayout:()=>({}),setLayout:rr});(0,W.useImperativeHandle)(t,()=>n.current,[]),fi(()=>{Object.assign(n.current,Jr({groupId:e}))})}function vi({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,W.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=pi(e=>{Ur(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=pi((e,t)=>{Ur(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e,{isUserInteraction:t}))}),_=di(s),v=(0,W.useRef)(null),[y,b]=ui(),x=(0,W.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=mi(v,a);_i(_,o);let C=pi((e,t)=>{let r=$n(),i=yr(e),a=br(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=hi({defaultLayout:n,disableCursor:r}),T=(0,W.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=Vn(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Vn(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=yr(_),i=br(_);r&&i&&Cr(r,{...i,derivedPanelConstraints:Bn(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,W.useRef)(null);return fi(()=>{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=li(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=br(r.id,!0);!o&&s.length>0&&(h(c),g(c,!1));let l=Sr(_,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=q(t.collapsedSize,i[t.panelId]),a=q(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=$n().state!==`active`;h(i),o&&g(i,e.isUserInteraction)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,W.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,U.jsx)(gi.Provider,{value:T,children:(0,U.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})})}vi.displayName=`Group`;function yi(){let e=(0,W.useContext)(gi);return K(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function bi(e,t){let{id:n}=yi(),r=(0,W.useRef)({collapse:ir,expand:ir,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:ir});(0,W.useImperativeHandle)(t,()=>r.current,[]),fi(()=>{Object.assign(r.current,Gr({groupId:n,panelId:e}))})}function xi({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=di(c),_=hi({disabled:a}),v=(0,W.useRef)(null),y=mi(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=yi(),T=d!==null,E=pi((e,t,n)=>{d?.(e,c,n)});fi(()=>{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,W.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),bi(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},ee=(0,W.useSyncExternalStore)(e=>Sr(x,e),D,D),O;return O=ee?JSON.parse(ee):i===void 0?{flexGrow:1}:{flexGrow:void 0,flexShrink:void 0,flexBasis:i},(0,U.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...Si,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...O},children:(0,U.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}xi.displayName=`Panel`;var Si={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Ci({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=Wr({layout:Hr({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Wr({layout:Hr({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function wi({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=di(a),l=hi({disabled:n,disableDoubleClick:r}),[u,d]=(0,W.useState)({}),[f,p]=(0,W.useState)(`inactive`),[m,h]=(0,W.useState)(!1),g=(0,W.useRef)(null),_=mi(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=yi(),C=b===`horizontal`?`vertical`:`horizontal`;fi(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=er(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Sr(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(Ci({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[y,c,x,l]),(0,W.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,U.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})}wi.displayName=`Separator`;function Ti(e,t,n){let r=n.snapshot.explorer_pin,i=r===null?null:e.find(e=>e.id===r&&e.status!==`archived`)??null;return{session:i??e.find(e=>e.id===t)??null,pinned:i!==null,pin(e){n.update({explorer_pin:e})},unpin(){n.update({explorer_pin:null})}}}var Ei=null,Di=null;async function Oi(){let[e,t]=await Promise.all([C(()=>import(`./PaneEditorBody-9TcMQDtu.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20])),C(()=>import(`./ModelRefcount-ByUhfyK3.js`),__vite__mapDeps([21,1,2,16,7,9,3,5,6,10,11,8,12,13,14,15,17]))]);Ei=e.PaneEditorBody,Di=t.ModelRefcount}var ki=(0,W.lazy)(()=>C(()=>import(`./PaneEditorBody-9TcMQDtu.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,20])));function Ai(e){return Ei?(0,U.jsx)(Ei,{...e}):(0,U.jsx)(W.Suspense,{fallback:(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center bg-ground text-xs text-fg-muted`,children:`Loading editor…`}),children:(0,U.jsx)(ki,{...e})})}var ji=(0,W.lazy)(()=>C(()=>import(`./ModelRefcount-ByUhfyK3.js`).then(e=>({default:e.ModelRefcount})),__vite__mapDeps([21,1,2,16,7,9,3,5,6,10,11,8,12,13,14,15,17])));function Mi({buffers:e}){return Di?(0,U.jsx)(Di,{buffers:e}):(0,U.jsx)(W.Suspense,{fallback:null,children:(0,U.jsx)(ji,{buffers:e})})}var Ni=(0,W.lazy)(()=>C(()=>import(`./EditorTabClose-DBiuZxHR.js`).then(e=>({default:e.EditorTabClose})),__vite__mapDeps([22,1,2,3,10,11,8,16,7,9,5,6,12,13,14,15,17,18,19])));function Pi(e){return(0,U.jsx)(W.Suspense,{fallback:(0,U.jsx)(`button`,{onClick:t=>{t.stopPropagation(),e.onClose()},className:`flex size-4 items-center justify-center rounded-sm text-fg-muted opacity-0 transition-opacity hover:text-fg group-hover:opacity-100`,"aria-label":`Close ${e.label}`,children:`×`}),children:(0,U.jsx)(Ni,{...e})})}var Fi=e(n(),1);function Ii(){return crypto.randomUUID()}function J(e){return e.type===`terminal`?`term:${e.session}`:`editor:${v(e.tab)}`}function Li(e,t){return J(e)===J(t)}function Ri(e){return e.type===`terminal`}function zi(e=[],t){let n=e.map(J),r=t&&n.includes(t)?t:n.length>0?n[0]:null;return{kind:`leaf`,id:Ii(),tabs:e,activeKey:r,previewKey:null}}function Bi(e,t,n){return{kind:`split`,id:Ii(),direction:e,children:t,sizes:n??t.map(()=>100/Math.max(1,t.length))}}function Vi(e,t){if(e.kind===`leaf`)return e.id===t?e:null;for(let n of e.children){let e=Vi(n,t);if(e)return e}return null}function Hi(e,t){if(e.kind===`leaf`)return e.tabs.some(e=>J(e)===t)?e:null;for(let n of e.children){let e=Hi(n,t);if(e)return e}return null}function Ui(e){return e.kind===`leaf`?[e]:e.children.flatMap(Ui)}function Wi(e){return Ui(e).flatMap(e=>e.tabs)}function Gi(e){let t=e.tabs.map(J),n=e.activeKey&&t.includes(e.activeKey)?e.activeKey:t[0]??null,r=e.previewKey&&t.includes(e.previewKey)?e.previewKey:null;return n===e.activeKey&&r===(e.previewKey??null)?e:{...e,activeKey:n,previewKey:r}}function Ki(e){if(e.kind===`leaf`)return Gi(e);let t=e.children.map(Ki),n=[],r=[];t.forEach((t,i)=>{let a=e.sizes[i]??1;if(t.kind===`split`&&t.direction===e.direction){let e=t.sizes.reduce((e,t)=>e+t,0)||t.children.length;t.children.forEach((i,o)=>{n.push(i),r.push(a*(t.sizes[o]??1)/e)})}else n.push(t),r.push(a)});let i=[],a=[];return n.forEach((e,t)=>{e.kind===`leaf`&&e.tabs.length===0||(i.push(e),a.push(r[t]??1))}),i.length===0?zi([]):i.length===1?i[0]:{...e,children:i,sizes:a}}function qi(e,t,n){return e.kind===`leaf`?e.id===t?n(e):e:{...e,children:e.children.map(e=>qi(e,t,n))}}function Ji(e,t){if(e.kind===`leaf`){if(!e.tabs.some(e=>J(e)===t))return e;let n=e.tabs.filter(e=>J(e)!==t),r=e.activeKey===t?Yi(e,t):e.activeKey;return{...e,tabs:n,activeKey:r}}return{...e,children:e.children.map(e=>Ji(e,t))}}function Yi(e,t){let n=e.tabs.findIndex(e=>J(e)===t);if(n===-1)return e.activeKey;let r=e.tabs.filter(e=>J(e)!==t);return r.length===0?null:J(r[Math.min(n,r.length-1)])}function Xi(e,t,n){let r=e.tabs.filter(e=>!Li(e,t)),i=n===void 0?r.length:Math.max(0,Math.min(n,r.length)),a=[...r.slice(0,i),t,...r.slice(i)];return{...e,tabs:a,activeKey:J(t)}}function Zi(e,t,n,r){let i=n===`left`||n===`right`?`row`:`col`,a=n===`left`||n===`top`;return Ki(qi(e,t,e=>{let t=zi([r]);return Bi(i,a?[t,e]:[e,t],[50,50])}))}function Qi(e,t){let{ref:n,toLeafId:r,edge:i}=t,a=J(n),o=t.index;if(i===`center`&&o!==void 0){let t=Vi(e,r)?.tabs.findIndex(e=>J(e)===a)??-1;t!==-1&&t<o&&--o}let s=Ji(e,a);if(i===`center`){let e=qi(s,r,e=>Xi(e,n,o));return!Vi(e,r)&&!Hi(e,a)?ra(Ki($i(e,n)),a):ra(Ki(e),a)}return Vi(s,r)?ra(Zi(s,r,i,n),a):Ki(zi([n]))}function $i(e,t){let n=Ui(e)[0];return n?qi(e,n.id,e=>Xi(e,t)):zi([t])}function ea(e,t,n){return Ki(qi(e,t,e=>e.tabs.some(e=>J(e)===n)?{...e,tabs:e.tabs.filter(e=>J(e)!==n),activeKey:e.activeKey===n?Yi(e,n):e.activeKey}:e))}function ta(e,t,n){let r=J(n);return Ki(qi(e,t,e=>{let t=e.previewKey===r?null:e.previewKey;return e.tabs.some(e=>Li(e,n))?{...e,activeKey:r,previewKey:t}:{...e,tabs:[...e.tabs,n],activeKey:r,previewKey:t}}))}function na(e,t,n){let r=J(n);return Ki(qi(e,t,e=>{if(e.tabs.some(e=>Li(e,n)))return{...e,activeKey:r};let t=e.previewKey?e.tabs.findIndex(t=>J(t)===e.previewKey):-1,i=t>=0&&!Ri(e.tabs[t])?e.tabs.map((e,r)=>r===t?n:e):[...e.tabs,n];return{...e,tabs:i,activeKey:r,previewKey:r}}))}function ra(e,t){let n=e=>e.kind===`leaf`?e.previewKey===t?{...e,previewKey:null}:e:{...e,children:e.children.map(n)};return n(e)}function ia(e,t,n){let r=e=>e.kind===`leaf`?{...e,tabs:e.tabs.map(e=>e.type===`editor`&&J(e)===t?{...e,tab:{...e.tab,view:n}}:e)}:{...e,children:e.children.map(r)};return r(e)}function aa(e,t,n){return qi(e,t,e=>e.tabs.some(e=>J(e)===n)?{...e,activeKey:n}:e)}function oa(e,t,n){function r(e){return e.kind===`leaf`?e:e.id===t&&n.length===e.children.length?{...e,children:e.children.map(r),sizes:[...n]}:{...e,children:e.children.map(r)}}return r(e)}function sa(e,t){let n=e=>e.kind===`leaf`?{...e,tabs:e.tabs.filter(t)}:{...e,children:e.children.map(n)};return Ki(n(e))}function ca(e){let t=e.editor_tabs.map(e=>({type:`editor`,tab:e})),n=e.session_tabs.map(e=>({type:`terminal`,session:e})),r=e.active_editor_tab?J({type:`editor`,tab:e.active_editor_tab}):null,i=e.active_session?`term:${e.active_session}`:null;if(t.length===0&&n.length===0)return zi([]);if(t.length===0)return zi(n,i);if(n.length===0)return zi(t,r);let a=e.layout,o=typeof a.editor==`number`?a.editor:40,s=typeof a.session==`number`?a.session:60;return Ki(Bi(`col`,[zi(t,r),zi(n,i)],[o,s]))}var la=(0,W.createContext)(null);function ua({tree:e,onOpenFile:t,children:n}){let r=(0,W.useRef)(null),i=(0,W.useRef)(new Map).current,[a,o]=(0,W.useState)(()=>new Set),s=(0,W.useCallback)((e,t)=>{o(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]),c=(0,W.useMemo)(()=>{let t=new Set;for(let n of Ui(e))for(let e of n.tabs)e.type===`terminal`&&t.add(e.session);return[...t]},[e]),l=e=>{let t=`term:${e}`,n=i.get(t);return n||(n=document.createElement(`div`),n.className=`size-full`,i.set(t,n)),n};(0,W.useEffect)(()=>{let e=new Set(c.map(e=>`term:${e}`));for(let e of c){let t=i.get(`term:${e}`);t&&!t.parentElement&&r.current?.appendChild(t)}for(let[t,n]of[...i])e.has(t)||(n.remove(),i.delete(t))},[c,i]);let u=(0,W.useMemo)(()=>({parkingRef:r,containers:i,setAdopted:s}),[i,s]);return(0,U.jsxs)(la.Provider,{value:u,children:[(0,U.jsx)(`div`,{ref:r,className:`hidden`,"aria-hidden":!0}),c.map(e=>(0,Fi.createPortal)((0,U.jsx)(Me,{stream:e,paused:!a.has(`term:${e}`),onOpenFile:(n,r,i)=>t(e,n,r,i)}),l(e),e)),n]})}function da(e){let t=(0,W.useContext)(la),n=(0,W.useRef)(null);return(0,W.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}function fa(e,t){let n={};for(let r of t){let t=e[r];if(typeof t!=`number`)return;n[r]=t}return n}var pa={added:{letter:`A`,label:`added`,colourClass:`text-running`},modified:{letter:`M`,label:`modified`,colourClass:`text-fg-secondary`},deleted:{letter:`D`,label:`deleted`,colourClass:`text-interrupted`},renamed:{letter:`R`,label:`renamed`,colourClass:`text-waiting`}};function ma(e){return pa[e]}var ha=[`modified`,`added`,`deleted`,`renamed`];function ga(e){let t=new Map;for(let n of e)t.set(n.status,(t.get(n.status)??0)+1);return ha.filter(e=>t.has(e)).map(e=>`${t.get(e)} ${pa[e].label}`).join(` · `)}var _a=[`var(--accent)`,`var(--status-running)`,`var(--status-waiting)`,`var(--ansi-magenta)`,`var(--ansi-cyan)`,`var(--status-interrupted)`];function va(e){return _a[e%_a.length]}function ya(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:va(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=va(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 ba=7,xa=14,Sa=4,Ca=1.5,wa=40,Ta=22;function Ea(e){return e*xa+xa/2}function Da(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 Oa({row:e,width:t}){let n=wa,r=n/2,i=Ea(e.col),a=new Set(e.created),o=[];for(let t of e.above){let n=Ea(t.col);t.sha===e.sha?o.push({d:Da(n,0,i,r),colour:t.colour}):o.push({d:Da(n,0,n,r),colour:t.colour})}for(let t of e.below){let e=Ea(t.col);a.has(t.col)?o.push({d:Da(i,r,e,n),colour:t.colour}):o.push({d:Da(e,r,e,n),colour:t.colour})}return(0,U.jsxs)(`svg`,{width:t,height:n,className:`shrink-0`,"aria-hidden":!0,children:[o.map((e,t)=>(0,U.jsx)(`path`,{d:e.d,fill:`none`,stroke:e.colour,strokeWidth:Ca},t)),(0,U.jsx)(`circle`,{cx:i,cy:r,r:Sa,fill:`var(--bg-surface)`,stroke:e.colour,strokeWidth:Ca})]})}function ka({lanes:e,width:t}){return(0,U.jsx)(`svg`,{width:t,height:Ta,className:`shrink-0`,"aria-hidden":!0,children:e.map(e=>{let t=Ea(e.col);return(0,U.jsx)(`path`,{d:`M ${t} 0 L ${t} ${Ta}`,fill:`none`,stroke:e.colour,strokeWidth:Ca},e.col)})})}function Aa({session:e,sha:t,lanes:n,gutterW:r,onOpen:i}){let a=u(e,t),o=e=>(0,U.jsxs)(`div`,{className:`flex items-center`,style:{height:Ta},children:[(0,U.jsx)(ka,{lanes:n,width:r}),(0,U.jsx)(`span`,{className:`px-2 text-2xs text-fg-muted`,children:e})]});return a.isPending?o(`…`):a.error?o(a.error instanceof Error?a.error.message:`Failed to load commit`):a.data.files.length===0?o(`No file changes.`):(0,U.jsx)(U.Fragment,{children:a.data.files.map(e=>{let a=ma(e.status),o=e.status===`renamed`&&e.old_path?`${e.old_path} → ${e.path}`:e.path;return(0,U.jsxs)(`button`,{type:`button`,title:o,onClick:()=>i(e.path,t),className:`flex w-full items-center text-left transition-colors hover:bg-elevated`,style:{height:Ta},children:[(0,U.jsx)(ka,{lanes:n,width:r}),(0,U.jsx)(`span`,{className:z(`mr-1.5 w-3 shrink-0 text-center font-mono text-xs`,a.colourClass),children:a.letter}),(0,U.jsx)(`span`,{className:`truncate pr-3 font-mono text-2xs text-fg`,children:o})]},`${e.status}:${e.old_path??``}:${e.path}`)})})}function ja({session:e,onOpenCommitFile:t}){let n=o(e),[r,i]=(0,W.useState)(null),a=(0,W.useMemo)(()=>n.data?.pages.flatMap(e=>e.commits)??[],[n.data]),s=(0,W.useMemo)(()=>ya(a),[a]),c=Math.max(1,s.laneCount)*xa+xa/2;return n.isPending?(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`Loading history…`}):n.error?(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:n.error instanceof Error?n.error.message:`Failed to load history`}):a.length===0?(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No commits yet.`}):(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-2`,children:[s.rows.map((n,o)=>{let s=a[o],l=r===n.sha;return(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>i(l?null:n.sha),className:z(`flex w-full items-center text-left transition-colors hover:bg-elevated`,l&&`bg-selection`),style:{height:wa},children:[(0,U.jsx)(Oa,{row:n,width:c}),(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5 pr-3`,children:[(0,U.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,U.jsx)(`span`,{className:`shrink-0 font-mono text-2xs text-fg-muted`,children:n.sha.slice(0,ba)}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-fg`,children:s.subject})]}),(0,U.jsxs)(`span`,{className:`truncate text-2xs text-fg-muted`,children:[s.author_name,` ·`,` `,(0,U.jsx)(`span`,{className:`tabular-nums`,children:f(s.authored_at)})]})]})]}),l&&(0,U.jsx)(Aa,{session:e,sha:n.sha,lanes:n.below,gutterW:c,onOpen:t})]},n.sha)}),n.hasNextPage&&(0,U.jsx)(`button`,{type:`button`,onClick:()=>void n.fetchNextPage(),disabled:n.isFetchingNextPage,className:`px-3 py-2 text-left font-mono text-xs text-fg-muted transition-colors hover:bg-elevated`,children:n.isFetchingNextPage?`Loading…`:`Show more`})]})}function Ma(){return{dirs:new Map,files:[]}}function Na(e){return e.path}function Pa(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:Pa(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 Fa(e){let t=Ma();for(let n of e){let e=Na(n),r=e.split(`/`),i=r.pop(),a=t;for(let e of r){let t=a.dirs.get(e);t||(t=Ma(),a.dirs.set(e,t)),a=t}a.files.push({type:`file`,name:i,path:e,entry:n})}return Pa(t,``)}function Ia(e){return e.map(e=>({type:`file`,name:Na(e).split(`/`).pop()??Na(e),path:Na(e),entry:e})).sort((e,t)=>e.path.localeCompare(t.path,void 0,{sensitivity:`base`}))}function La({name:e,fullPath:t,status:n,depth:r,active:i,onOpen:a}){let o=ma(n);return(0,U.jsxs)(`button`,{type:`button`,title:t,onClick:()=>a(t),className:z(`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,U.jsx)(`span`,{className:z(`w-3 shrink-0 text-center font-mono text-xs`,o.colourClass),children:o.letter}),(0,U.jsx)(`span`,{className:`truncate font-mono text-xs text-fg`,children:e})]})}function Ra({nodes:e,depth:t,activePath:n,onOpen:r}){let[i,a]=(0,W.useState)(new Set);return(0,U.jsx)(U.Fragment,{children:e.map(e=>{if(e.type===`file`)return(0,U.jsx)(La,{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,U.jsxs)(`div`,{children:[(0,U.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:`flex w-full items-center gap-1 py-1 pr-3 text-left transition-colors hover:bg-elevated`,style:{paddingLeft:8+t*12},children:[o?(0,U.jsx)(vt,{className:`size-3.5 shrink-0 text-fg-gold`}):(0,U.jsx)(gt,{className:`size-3.5 shrink-0 text-fg-gold`}),(0,U.jsx)(`span`,{className:`truncate font-mono text-xs text-fg-secondary`,children:e.name})]}),!o&&(0,U.jsx)(Ra,{nodes:e.children,depth:t+1,activePath:n,onOpen:r})]},e.path)})})}function za({session:e,activePath:t,onOpen:n}){let[r,i]=(0,W.useState)(!1),a=S(e,{against:`head`}),o=a.data?.entries??[],s=(0,W.useMemo)(()=>r?null:Fa(o),[r,o]),c=(0,W.useMemo)(()=>r?Ia(o):null,[r,o]);return(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex h-7 shrink-0 items-center gap-2 px-3`,children:[(0,U.jsx)(`span`,{className:`text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:`Uncommitted`}),o.length>0&&(0,U.jsx)(`span`,{className:`truncate font-mono text-2xs text-fg-muted`,children:ga(o)}),(0,U.jsxs)(Tt,{children:[(0,U.jsx)(Ft,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,"aria-pressed":!r,onClick:()=>i(e=>!e),className:`ml-auto rounded-sm p-1 text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[r?(0,U.jsx)(xn,{className:`size-3.5`}):(0,U.jsx)(_n,{className:`size-3.5`}),(0,U.jsx)(`span`,{className:`sr-only`,children:r?`Show as tree`:`Show as flat list`})]})}),(0,U.jsx)(bt,{children:r?`Show as tree`:`Show as flat list`})]})]}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-1`,children:a.isPending?(0,U.jsx)(`div`,{className:`px-3 py-1.5 text-xs text-fg-muted`,children:`Loading changes…`}):a.error?(0,U.jsx)(`div`,{className:`px-3 py-1.5 text-xs text-fg-muted`,children:a.error instanceof Error?a.error.message:`Failed to load changes`}):o.length===0?(0,U.jsx)(`div`,{className:`px-3 py-1.5 text-xs text-fg-muted`,children:`No uncommitted changes.`}):r?c.map(e=>(0,U.jsx)(La,{name:e.path,fullPath:e.path,status:e.entry.status,depth:0,active:t===e.path,onOpen:n},e.path)):(0,U.jsx)(Ra,{nodes:s,depth:0,activePath:t,onOpen:n})})]})}function Ba({session:e,activeDiffPath:t,onOpenDiff:n,onOpenCommitFile:r}){return(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsx)(`section`,{className:`flex max-h-[45%] min-h-0 flex-col`,children:(0,U.jsx)(za,{session:e,activePath:t,onOpen:n})}),(0,U.jsx)(`div`,{className:`h-px shrink-0 bg-border`}),(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsx)(`div`,{className:`flex h-7 shrink-0 items-center px-3`,children:(0,U.jsx)(`span`,{className:`text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:`History`})}),(0,U.jsx)(ja,{session:e,onOpenCommitFile:r})]})]})}async function Va(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 Ha(e){return new Promise((t,n)=>e.file(t,n))}async function Ua(e,t,n){if(e.isFile){let r=await Ha(e);n.push(t?new File([r],`${t}/${e.name}`,{type:r.type,lastModified:r.lastModified}):r)}else if(e.isDirectory){let r=await Va(e),i=t?`${t}/${e.name}`:e.name;for(let e of r)await Ua(e,i,n)}}function Wa(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)&&D.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 Ua(t,``,e):n&&e.push(n);return e})()}var Ga={untracked:{letter:`U`,colourClass:`text-running`},added:{letter:`A`,colourClass:`text-running`},modified:{letter:`M`,colourClass:`text-waiting`},renamed:{letter:`R`,colourClass:`text-waiting`},deleted:{letter:`D`,colourClass:`text-interrupted`},conflicted:{letter:`C`,colourClass:`text-interrupted`},ignored:{letter:``,colourClass:`text-fg-muted`}};function Ka(e){return Ga[e]}function qa(e){let t=new Map;for(let n of e)t.set(n.path,n.status);return t}var Ja={conflicted:0,modified:1,renamed:2,deleted:3,added:4,untracked:5,ignored:6};function Ya(e,t){let n=t===``?``:`${t}/`,r=null;for(let[t,i]of e)n!==``&&!t.startsWith(n)||i!==`ignored`&&(r===null||Ja[i]<Ja[r])&&(r=i);return r}function Xa(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function Za(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function Qa(e,t){return e===``?t:`${e}/${t}`}function $a(e,t){let n=[],r=(i,a)=>{let o=e(i);if(o)for(let e of o.entries){let o=Qa(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 eo(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 to=(e,t)=>e instanceof Error?e.message:t;function no(e){let t=i(),n=(0,W.useCallback)(()=>{t.invalidateQueries({queryKey:[`wt-tree`,e]}),t.invalidateQueries({queryKey:[`wt-git-status`,e]})},[t,e]);return(0,W.useMemo)(()=>({async create(t,r,i){try{let a=await c(e,Qa(t,r),i);return n(),a.path}catch(e){return D.error(to(e,`Couldn't create ${r}`)),null}},async rename(t,r){let i=Qa(t.includes(`/`)?t.slice(0,t.lastIndexOf(`/`)):``,r);try{let r=await p(e,t,i);return n(),r.path}catch(e){return D.error(to(e,`Couldn't rename ${Xa(t)}`)),null}},async move(t,r){try{let i=await p(e,t,Qa(r,Xa(t)));return n(),i.path}catch(e){return D.error(to(e,`Couldn't move ${Xa(t)}`)),null}},async remove(t){let r=await Promise.allSettled(t.map(t=>l(e,t)));n();let i=r.filter(e=>e.status===`rejected`).length;i>0?D.error(`Couldn't delete ${i} item${i>1?`s`:``}`):D.success(t.length===1?`Deleted ${Xa(t[0])}`:`Deleted ${t.length} items`)},async paste(t,r){let i=t.mode===`cut`?p:y,a=await Promise.allSettled(t.paths.map(t=>i(e,t,Qa(r,Xa(t)))));n();let o=a.filter(e=>e.status===`rejected`).length;o>0&&D.error(`Couldn't paste ${o} item${o>1?`s`:``}`)}}),[e,n])}function ro(e,t,n){return n&&n.type!==`dir`||(e.includes(`/`)?e.slice(0,e.lastIndexOf(`/`)):``)===t?!1:t===``||!`${t}/`.startsWith(`${e}/`)}var io=(0,W.createContext)(null);function ao(){let e=(0,W.useContext)(io);if(!e)throw Error(`explorer components must render inside <ExplorerProvider>`);return e}function oo(){return(0,W.useContext)(io)}function so({session:e,onOpenFile:t,activePath:n,children:r}){let a=e.id,o=i(),s=no(a),c=(0,W.useCallback)((e,t)=>{t.length!==0&&d(a,e,t).then(()=>{o.invalidateQueries({queryKey:[`wt-tree`,a,e]}),o.invalidateQueries({queryKey:[`wt-git-status`,a]}),D.success(t.length===1?`Uploaded ${t[0].name}`:`Uploaded ${t.length} files`)}).catch(e=>D.error(e instanceof Error?e.message:`Upload failed`))},[a,o]),l=Fe().data?.protocol,u=!l||l.major>9||l.major===9&&l.minor>=2,f=(0,W.useCallback)((e,t,n)=>{Wa(t,n,u).then(t=>c(e,t)).catch(e=>D.error(e instanceof Error?e.message:`Couldn't read the dropped folder`))},[c,u]),[p,m]=(0,W.useState)(new Set),[g,_]=(0,W.useState)(new Set),[v,y]=(0,W.useState)(null),[b,S]=(0,W.useState)(null),[C,w]=(0,W.useState)(null),[T,E]=(0,W.useState)(null),[ee,O]=(0,W.useState)(null),k=(0,W.useRef)(null),te=x(a),A=(0,W.useMemo)(()=>qa(te.data?.entries??[]),[te.data]),[j,ne]=(0,W.useState)(0);(0,W.useEffect)(()=>o.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]===a&&ne(e=>e+1)}),[o,a]);let re=(0,W.useMemo)(()=>$a(e=>o.getQueryData([`wt-tree`,a,e]),p),[o,a,p,j]),M=(0,W.useCallback)(e=>{m(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),N=(0,W.useCallback)(e=>{m(t=>t.has(e)?t:new Set(t).add(e))},[]),ie=(0,W.useCallback)(()=>m(new Set),[]),ae=(0,W.useCallback)((e,n)=>{if(y(e.path),n.metaKey||n.ctrlKey){_(t=>{let n=new Set(t);return n.has(e.path)?n.delete(e.path):n.add(e.path),n}),k.current=e.path;return}if(n.shiftKey&&k.current){_(new Set(eo(re,k.current,e.path)));return}_(new Set([e.path])),k.current=e.path,e.type===`dir`?M(e.path):t?.(a,e.path)},[re,M,t,a]),P=(0,W.useCallback)(e=>{e.type!==`dir`&&t?.(a,e.path,{preview:!1})},[t,a]),oe=(0,W.useCallback)(e=>{_(new Set([e])),y(e),k.current=e},[]),se=(0,W.useCallback)(e=>S({paths:e,mode:`cut`}),[]),ce=(0,W.useCallback)(e=>S({paths:e,mode:`copy`}),[]),F=(0,W.useCallback)(e=>{b&&s.paste(b,e).then(()=>{b.mode===`cut`&&S(null)})},[b,s]),I=(0,W.useCallback)(e=>w({mode:`rename`,path:e}),[]),le=(0,W.useCallback)((e,t)=>{e!==``&&N(e),w({mode:`create`,parentDir:e,kind:t})},[N]),ue=(0,W.useCallback)(()=>w(null),[]),de=(0,W.useCallback)(e=>{let n=e.trim(),r=C;if(w(null),!(!r||n===``))if(r.mode===`rename`){if(n===Xa(r.path))return;s.rename(r.path,n)}else s.create(r.parentDir,n,r.kind).then(e=>{e&&r.kind===`file`&&t?.(a,e)})},[C,s,t,a]),L=(0,W.useCallback)(e=>{e.length>0&&O(e)},[]),fe=(0,W.useCallback)(()=>{let e=ee;O(null),e&&s.remove(e)},[ee,s]),pe=(0,W.useCallback)(()=>O(null),[]),me=(0,W.useCallback)((t,n)=>{let r=n?t:Qa(e.worktree_path,t);navigator.clipboard.writeText(r),D.success(n?`Relative path copied`:`Path copied`)},[e.worktree_path]),he=(0,W.useCallback)(e=>{h(a,e).catch(e=>D.error(e instanceof Error?e.message:`Download failed`))},[a]),R=(0,W.useCallback)(()=>{o.invalidateQueries({queryKey:[`wt-tree`,a]}),o.invalidateQueries({queryKey:[`wt-git-status`,a]})},[o,a]),ge=(0,W.useCallback)((e,t)=>{ro(t,e)&&s.move(t,e)},[s]),_e=(0,W.useCallback)(()=>v&&g.has(v)?[...g]:v?[v]:[...g],[v,g]),ve=(0,W.useRef)({buffer:``,at:0}),ye=(0,W.useCallback)(e=>{if(C)return;let n=re;if(n.length===0)return;let r=v?n.findIndex(e=>e.path===v):-1,i=(e,t)=>{let r=n[Math.max(0,Math.min(n.length-1,e))];r&&(y(r.path),t&&k.current?_(new Set(eo(n,k.current,r.path))):(_(new Set([r.path])),k.current=r.path))},o=r>=0?n[r]:void 0,s=e.metaKey||e.ctrlKey;switch(e.key){case`ArrowDown`:e.preventDefault(),i(r+1,e.shiftKey);return;case`ArrowUp`:e.preventDefault(),i(r<=0?0:r-1,e.shiftKey);return;case`ArrowRight`:e.preventDefault(),o?.type===`dir`&&!p.has(o.path)?N(o.path):o?.type===`dir`&&i(r+1,!1);return;case`ArrowLeft`:if(e.preventDefault(),o?.type===`dir`&&p.has(o.path))M(o.path);else if(o){let e=n.findIndex(e=>e.path===o.parentDir);e>=0&&i(e,!1)}return;case`Enter`:case` `:if(e.preventDefault(),!o)return;o.type===`dir`?M(o.path):t?.(a,o.path);return;case`F2`:e.preventDefault(),o&&I(o.path);return;case`Delete`:e.preventDefault(),L(_e());return;case`Backspace`:s&&(e.preventDefault(),L(_e()));return}if(s&&(e.key===`c`||e.key===`C`)){e.preventDefault();let t=_e();e.altKey?me(t[0]??``,e.shiftKey):ce(t);return}if(s&&(e.key===`x`||e.key===`X`)){e.preventDefault(),se(_e());return}if(s&&(e.key===`v`||e.key===`V`)){e.preventDefault();let t=o?o.type===`dir`?o.path:o.parentDir:``;F(t);return}if(!s&&!e.altKey&&e.key.length===1&&/\S/.test(e.key)){let t=Date.now(),a=ve.current;a.buffer=t-a.at>700?e.key:a.buffer+e.key,a.at=t;let o=a.buffer.toLowerCase(),s=r+1;for(let e=0;e<n.length;e++){let t=n[(s+e)%n.length];if(t.name.toLowerCase().startsWith(o)){i(n.findIndex(e=>e.path===t.path),!1);break}}}},[C,re,v,p,N,M,t,a,I,L,_e,ce,se,F,me]),be={sid:a,worktreePath:e.worktree_path,onOpenFile:t,activePath:n,expanded:p,toggle:M,collapseAll:ie,statusMap:A,visibleRows:re,selection:g,focusedPath:v,onRowClick:ae,onRowDoubleClick:P,selectOnly:oe,clipboard:b,cut:se,copy:ce,paste:F,editing:C,beginRename:I,beginCreate:le,cancelEdit:ue,commitEdit:de,requestDelete:L,copyPathToClipboard:me,download:he,refresh:R,onUpload:c,onDropUpload:f,dropTarget:T,setDropTarget:E,onInternalDrop:ge,handleKeyDown:ye,pendingDelete:ee,confirmDelete:fe,cancelDelete:pe};return(0,U.jsx)(io.Provider,{value:be,children:r})}var co=`application/x-puddle-tab`;function lo(e){return JSON.stringify(e)}function uo(e){try{return w.parse(JSON.parse(e))}catch{return null}}function fo(e){return e.includes(co)}var po={"package.json":tn,"package-lock.json":sn,"pnpm-lock.yaml":sn,"yarn.lock":sn,"pnpm-workspace.yaml":nn,dockerfile:H,".gitignore":nn,".gitattributes":nn,"readme.md":fn,license:fn,licence:fn},mo={ts:H,tsx:H,mts:H,cts:H,js:H,jsx:H,mjs:H,cjs:H,py:H,rs:H,go:H,rb:H,php:H,java:H,kt:H,c:H,h:H,cpp:H,hpp:H,cc:H,html:H,htm:H,xml:H,vue:H,sql:H,json:tn,jsonc:tn,yml:nn,yaml:nn,toml:nn,ini:nn,cfg:nn,conf:nn,env:on,lock:sn,csv:un,tsv:un,xlsx:un,xls:un,md:fn,mdx:fn,markdown:fn,txt:fn,rtf:fn,log:fn,pdf:fn,css:pn,scss:pn,sass:pn,less:pn,sh:dn,bash:dn,zsh:dn,fish:dn,svg:an,png:an,jpg:an,jpeg:an,gif:an,webp:an,bmp:an,ico:an,avif:an,mp4:cn,mov:cn,webm:cn,mkv:cn,avi:cn,mp3:rn,wav:rn,flac:rn,ogg:rn,m4a:rn,zip:en,tar:en,gz:en,tgz:en,rar:en,"7z":en};function ho(e){let t=e.toLowerCase(),n=po[t];if(n)return{Icon:n,generic:!1};let r=t.lastIndexOf(`.`);if(r>0){let e=mo[t.slice(r+1)];if(e)return{Icon:e,generic:!1}}return{Icon:mn,generic:!0}}function go({name:e,dimmed:t}){let{Icon:n,generic:r}=ho(e);return(0,U.jsx)(n,{className:z(`size-3.5 shrink-0`,t||r?`text-fg-muted`:`text-fg`)})}var _o=14,vo=`application/x-puddle-path`;function yo({children:e}){return(0,U.jsx)(`span`,{className:`ml-auto pl-6 text-2xs text-fg-muted tabular-nums`,children:e})}function bo({depth:e,initial:t,icon:n,onCommit:r,onCancel:i}){let a=(0,W.useRef)(null),o=(0,W.useRef)(!1);(0,W.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,U.jsxs)(`div`,{className:`flex h-6 items-center gap-1 pr-2`,style:{paddingLeft:e*_o+8},children:[(0,U.jsx)(`span`,{className:`size-3.5 shrink-0`}),n,(0,U.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 font-mono text-sm text-fg outline-none`})]})}function xo({path:e,entry:t,depth:n}){let r=ao(),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:Za(e)},d=r.statusMap.get(e),f=i?Ya(r.statusMap,e):null,p=d?Ka(d):f?Ka(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:Za(e),_=r.clipboard!==null;return r.editing?.mode===`rename`&&r.editing.path===e?(0,U.jsx)(bo,{depth:n,initial:t.name,icon:i?(0,U.jsx)(hn,{className:`size-3.5 shrink-0 text-fg`}):(0,U.jsx)(go,{name:t.name}),onCommit:r.commitEdit,onCancel:r.cancelEdit}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(at,{children:[(0,U.jsx)(Ke,{asChild:!0,children:(0,U.jsxs)(`div`,{role:`treeitem`,"data-path":e,"aria-expanded":i?a:void 0,"aria-selected":c,tabIndex:-1,draggable:!0,onClick:e=>{e.currentTarget.closest(`[data-explorer-root]`)?.focus(),r.onRowClick(u,e)},onDoubleClick:()=>r.onRowDoubleClick(u),onContextMenu:()=>{c||r.selectOnly(e)},onDragStart:t=>{t.dataTransfer.setData(vo,e),i||t.dataTransfer.setData(co,lo({type:`editor`,tab:{kind:`file`,session:r.sid,path:e}})),t.dataTransfer.effectAllowed=`copyMove`},onDragOver:t=>{i&&(t.preventDefault(),t.stopPropagation(),r.setDropTarget(e))},onDragLeave:e=>{i&&e.currentTarget===e.target&&r.setDropTarget(null)},onDrop:t=>{if(!i)return;t.preventDefault(),t.stopPropagation(),r.setDropTarget(null);let n=t.dataTransfer.getData(vo);n?r.onInternalDrop(e,n):r.onDropUpload(e,t.dataTransfer.items,t.dataTransfer.files)},style:{paddingLeft:n*_o+8},className:z(`flex h-6 cursor-pointer items-center gap-1 pr-2 text-sm transition-colors hover:bg-elevated`,c?`bg-selection`:s&&`bg-elevated`,o&&`bg-selection`,l&&`opacity-50`),children:[i?(0,U.jsx)(vt,{className:z(`size-3.5 shrink-0 text-fg-gold transition-transform duration-150`,a&&`rotate-90`)}):(0,U.jsx)(`span`,{className:`size-3.5 shrink-0`}),t.symlink||t.type===`symlink`?(0,U.jsx)(bn,{className:`size-3.5 shrink-0 text-fg`}):i?a?(0,U.jsx)(At,{className:z(`size-3.5 shrink-0`,f?p?.colourClass:`text-fg`)}):(0,U.jsx)(hn,{className:z(`size-3.5 shrink-0`,f?p?.colourClass:`text-fg`)}):(0,U.jsx)(go,{name:t.name,dimmed:d===`ignored`}),(0,U.jsx)(`span`,{className:z(`min-w-0 flex-1 truncate font-mono`,m),children:t.name}),d&&p&&p.letter&&(0,U.jsx)(`span`,{className:z(`shrink-0 font-mono text-2xs`,p.colourClass),children:p.letter})]})}),(0,U.jsxs)(tt,{onCloseAutoFocus:e=>{r.editing&&e.preventDefault()},children:[i&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(V,{onSelect:()=>r.beginCreate(e,`file`),children:`New File…`}),(0,U.jsx)(V,{onSelect:()=>r.beginCreate(e,`dir`),children:`New Folder…`}),(0,U.jsx)(Ze,{})]}),(0,U.jsxs)(V,{onSelect:()=>r.cut(h),children:[`Cut `,(0,U.jsx)(yo,{children:`⌘X`})]}),(0,U.jsxs)(V,{onSelect:()=>r.copy(h),children:[`Copy `,(0,U.jsx)(yo,{children:`⌘C`})]}),(0,U.jsxs)(V,{disabled:!_,onSelect:()=>r.paste(g),children:[`Paste `,(0,U.jsx)(yo,{children:`⌘V`})]}),(0,U.jsx)(Ze,{}),(0,U.jsxs)(V,{onSelect:()=>r.copyPathToClipboard(e,!1),children:[`Copy Path `,(0,U.jsx)(yo,{children:`⌥⌘C`})]}),(0,U.jsxs)(V,{onSelect:()=>r.copyPathToClipboard(e,!0),children:[`Copy Relative Path `,(0,U.jsx)(yo,{children:`⌥⇧⌘C`})]}),(0,U.jsx)(Ze,{}),(0,U.jsxs)(V,{onSelect:()=>r.beginRename(e),children:[`Rename… `,(0,U.jsx)(yo,{children:`F2`})]}),(0,U.jsxs)(V,{onSelect:()=>r.requestDelete(h),children:[`Delete `,(0,U.jsx)(yo,{children:`⌘⌫`})]}),(0,U.jsx)(Ze,{}),(0,U.jsx)(V,{onSelect:()=>r.download(e),children:`Download`})]})]}),i&&a&&(0,U.jsx)(So,{sid:r.sid,path:e,depth:n+1})]})}function So({sid:e,path:t,depth:n}){let r=ao(),i=b(e,t),a={paddingLeft:n*_o+8},o=r.editing,s=o?.mode===`create`&&o.parentDir===t?(0,U.jsx)(Co,{depth:n,kind:o.kind}):null;if(i.isLoading)return(0,U.jsxs)(U.Fragment,{children:[s,(0,U.jsx)(`div`,{style:a,className:`py-0.5 text-xs text-fg-muted`,children:`Loading…`})]});if(i.isError)return(0,U.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,U.jsx)(`div`,{style:a,className:`py-0.5 text-xs text-fg-muted`,children:`Empty`}):(0,U.jsxs)(U.Fragment,{children:[s,c.map(e=>(0,U.jsx)(xo,{path:Qa(t,e.name),entry:e,depth:n},e.name))]})}function Co({depth:e,kind:t}){let n=ao(),[r,i]=(0,W.useState)(``);return(0,U.jsx)(bo,{depth:e,initial:r,icon:t===`dir`?(0,U.jsx)(hn,{className:`size-3.5 shrink-0 text-fg`}):(0,U.jsx)(go,{name:r||`file`}),onCommit:e=>{i(e),n.commitEdit(e)},onCancel:n.cancelEdit})}function wo(){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(To,{}),(0,U.jsx)(Eo,{})]})}function To(){let e=ao(),t=(0,W.useRef)(null);(0,W.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,U.jsxs)(at,{children:[(0,U.jsx)(Ke,{asChild:!0,children:(0,U.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=>{t.preventDefault(),e.setDropTarget(``)},onDragLeave:t=>{t.currentTarget===t.target&&e.setDropTarget(null)},onDrop:t=>{t.preventDefault(),e.setDropTarget(null);let n=t.dataTransfer.getData(`application/x-puddle-path`);n?e.onInternalDrop(``,n):e.onDropUpload(``,t.dataTransfer.items,t.dataTransfer.files)},className:z(`h-full overflow-y-auto py-1 outline-none`,e.dropTarget===``&&`bg-selection`),children:(0,U.jsx)(So,{sid:e.sid,path:``,depth:0})})}),(0,U.jsxs)(tt,{onCloseAutoFocus:t=>{e.editing&&t.preventDefault()},children:[(0,U.jsx)(V,{onSelect:()=>e.beginCreate(``,`file`),children:`New File…`}),(0,U.jsx)(V,{onSelect:()=>e.beginCreate(``,`dir`),children:`New Folder…`}),(0,U.jsx)(Ze,{}),(0,U.jsx)(V,{disabled:!n,onSelect:()=>e.paste(``),children:`Paste`}),(0,U.jsx)(Ze,{}),(0,U.jsx)(V,{onSelect:()=>e.copyPathToClipboard(``,!1),children:`Copy Path`}),(0,U.jsx)(V,{onSelect:()=>e.download(``),children:`Download worktree`})]})]})}function Eo(){let e=ao(),t=e.pendingDelete;return(0,U.jsx)(P,{open:t!==null,onOpenChange:t=>!t&&e.cancelDelete(),children:(0,U.jsxs)(N,{children:[(0,U.jsxs)(te,{children:[(0,U.jsxs)(ie,{children:[`Delete `,t&&t.length===1?`“${Xa(t[0])}”`:`${t?.length??0} items`,`?`]}),(0,U.jsxs)(ae,{children:[`This permanently removes `,t&&t.length>1?`them`:`it`,` from the worktree. There is no undo.`]})]}),(0,U.jsxs)(re,{children:[(0,U.jsx)(j,{variant:`ghost`,onClick:e.cancelDelete,children:`Cancel`}),(0,U.jsx)(j,{variant:`danger`,onClick:e.confirmDelete,children:`Delete`})]})]})})}var Do=/[.*+?^${}()|[\]\\]/g;function Oo(e){if(e.query.length===0)return null;try{let t=e.regex?e.query:e.query.replace(Do,`\\$&`);return e.wholeWord&&(t=`\\b(?:${t})\\b`),new RegExp(t,e.caseSensitive?`g`:`gi`)}catch{return null}}function ko(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 Ao=240;function jo(e){let t=e.replace(/^\s+/,``);return t.length>Ao?`${t.slice(0,Ao)}…`:t}var Mo=250;function No({active:e,label:t,onClick:n,children:r}){return(0,U.jsxs)(Tt,{children:[(0,U.jsx)(Ft,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,"aria-pressed":e,onClick:n,className:z(`rounded-sm p-1 transition-colors`,e?`bg-elevated text-accent`:`text-fg-muted hover:bg-elevated hover:text-fg`),children:[r,(0,U.jsx)(`span`,{className:`sr-only`,children:t})]})}),(0,U.jsx)(bt,{children:t})]})}function Po({session:e,onOpen:t}){let[n,r]=(0,W.useState)(``),[i,o]=(0,W.useState)(``),[s,c]=(0,W.useState)(!1),[l,u]=(0,W.useState)(!1),[d,f]=(0,W.useState)(!1);(0,W.useEffect)(()=>{let e=setTimeout(()=>o(n),Mo);return()=>clearTimeout(e)},[n]);let p={query:i,regex:s,caseSensitive:l,wholeWord:d},m=a(e,p),h=(0,W.useMemo)(()=>Oo(p),[i,s,l,d]),g=m.data,_=!!g&&(g.files.length>0||g.content.length>0);return(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1 px-2 py-1.5`,children:[(0,U.jsx)(`input`,{value:n,onChange:e=>r(e.target.value),placeholder:`Search files and contents`,spellCheck:!1,autoComplete:`off`,className:`rounded-md bg-elevated px-2 py-1 font-mono text-xs text-fg outline-none placeholder:text-fg-muted`}),(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsx)(No,{active:l,label:`Match case`,onClick:()=>u(e=>!e),children:(0,U.jsx)(Jt,{className:`size-3.5`})}),(0,U.jsx)(No,{active:d,label:`Match whole word`,onClick:()=>f(e=>!e),children:(0,U.jsx)(Mn,{className:`size-3.5`})}),(0,U.jsx)(No,{active:s,label:`Use regular expression`,onClick:()=>c(e=>!e),children:(0,U.jsx)(On,{className:`size-3.5`})})]})]}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-2`,children:i.length===0?(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`Search file names and contents.`}):m.isPending?(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`Searching…`}):m.error?(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:m.error instanceof Error?m.error.message:`Search failed`}):_?(0,U.jsxs)(U.Fragment,{children:[g.files.length>0&&(0,U.jsxs)(`section`,{children:[(0,U.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,U.jsxs)(`button`,{type:`button`,title:e,onClick:()=>t(e),className:`flex w-full items-center gap-1.5 px-3 py-1 text-left transition-colors hover:bg-elevated`,children:[(0,U.jsx)(mn,{className:`size-3.5 shrink-0 text-fg-gold`}),(0,U.jsx)(`span`,{className:`truncate font-mono text-xs text-fg`,children:e})]},e))]}),g.content.length>0&&(0,U.jsxs)(`section`,{children:[(0,U.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,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`truncate px-3 py-1 font-mono text-2xs text-fg-secondary`,title:e.path,children:e.path}),e.matches.map((n,r)=>(0,U.jsxs)(`button`,{type:`button`,onClick:()=>t(e.path,n.line),className:`flex w-full items-baseline gap-2 py-0.5 pl-6 pr-3 text-left transition-colors hover:bg-elevated`,children:[(0,U.jsx)(`span`,{className:`shrink-0 font-mono text-2xs tabular-nums text-fg-muted`,children:n.line}),(0,U.jsx)(`span`,{className:`truncate font-mono text-2xs text-fg-secondary`,children:ko(jo(n.text),h).map((e,t)=>e.hit?(0,U.jsx)(`span`,{className:`text-accent`,children:e.text},t):(0,U.jsx)(`span`,{children:e.text},t))})]},`${n.line}:${r}`))]},e.path))]}),g.truncated&&(0,U.jsx)(`div`,{className:`px-3 py-2 text-2xs text-fg-muted`,children:`Showing the first results — refine the query for more.`})]}):(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No results.`})})]})}function Fo({text:e,hoverClass:t,className:n,title:r}){let i=(0,W.useRef)(null),[a,o]=(0,W.useState)(0);return(0,W.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,U.jsx)(`div`,{className:`min-w-0 flex-1 overflow-hidden`,children:(0,U.jsx)(`span`,{ref:i,title:r,className:z(`block whitespace-nowrap transition-transform duration-[900ms] ease-linear`,n,a>0&&t),style:a>0?{"--tail":`-${a}px`}:void 0,children:e})})}var Io=new Set([`starting`,`running`,`waiting_input`]),Lo=`group-hover:[transform:translateX(var(--tail))]`;function Ro(e){return e.split(`/`).filter(Boolean).pop()??e}function zo({children:e,className:t,title:n}){return(0,U.jsx)(`span`,{title:n,className:z(`shrink-0 text-2xs`,t),children:e})}function Bo({label:e,blockReason:t,onClick:n}){return(0,U.jsxs)(Tt,{children:[(0,U.jsx)(Ft,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,disabled:t!==null,onClick:n,className:z(`-my-1 rounded-sm p-1 text-fg-gold transition-colors hover:text-danger`,t===null?`hidden group-hover:inline-flex`:`hidden`),children:[(0,U.jsx)(Ot,{className:`size-3.5`}),(0,U.jsx)(`span`,{className:`sr-only`,children:e})]})}),(0,U.jsx)(bt,{children:t?`Can't ${e.toLowerCase()} — ${t}`:e})]})}function Vo({repoId:e,projectId:t,sessions:n}){let r=le(e),i=I(e,t),a=F(e,t),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(null),u=i.isPending||a.isPending,d=(0,W.useMemo)(()=>{let e=new Map;for(let t of n)Io.has(t.status)&&e.set(t.worktree_path,(e.get(t.worktree_path)??0)+1);return e},[n]),f=(0,W.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,W.useMemo)(()=>[...r.data?.orphan_branches??[]].sort((e,t)=>e.name.localeCompare(t.name)),[r.data]);return r.isPending?(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`Loading worktrees…`}):r.error?(0,U.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,U.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-2`,children:[f.length===0&&p.length===0&&(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No worktrees.`}),f.map(([e,t])=>(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`group flex items-center gap-1.5 px-3 pb-0.5 pt-2 text-2xs text-fg-muted`,children:[(0,U.jsx)(yn,{className:`size-3 shrink-0 text-fg-gold`}),(0,U.jsx)(Fo,{text:e,className:`font-mono`,hoverClass:Lo})]}),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,U.jsxs)(`div`,{className:`group flex items-center gap-2 px-3 py-1 pl-6 transition-colors hover:bg-elevated`,children:[(0,U.jsx)(Fo,{text:Ro(e.path),title:e.path,className:`font-mono text-xs text-fg`,hoverClass:Lo}),e.is_primary&&(0,U.jsx)(zo,{className:`text-fg-muted`,children:`clone`}),e.dirty&&(0,U.jsx)(zo,{className:`text-waiting`,title:`Modified — uncommitted changes`,children:`M`}),t>0&&(0,U.jsx)(zo,{className:`text-running`,title:`${t} running session${t>1?`s`:``}`,children:t}),(0,U.jsx)(Bo,{label:`Prune`,blockReason:n,onClick:()=>{l(null),s({kind:`worktree`,path:e.path,branch:e.branch})}})]},e.path)})]},`wt:${e}`)),p.length>0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.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,U.jsxs)(`div`,{className:`group flex items-center gap-2 px-3 py-1 transition-colors hover:bg-elevated`,children:[(0,U.jsx)(yn,{className:`size-3 shrink-0 text-fg-gold`}),(0,U.jsx)(Fo,{text:e.name,className:`font-mono text-xs text-fg`,hoverClass:Lo}),e.local_only&&(0,U.jsx)(zo,{className:`text-waiting`,children:`local only`}),(0,U.jsx)(Bo,{label:`Delete branch`,blockReason:null,onClick:()=>{l(null),s({kind:`branch`,name:e.name,localOnly:e.local_only})}})]},`br:${e.name}`))]}),(0,U.jsx)(P,{open:o!==null,onOpenChange:e=>{e||s(null)},children:(0,U.jsxs)(N,{children:[o?.kind===`branch`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(te,{children:[(0,U.jsx)(ie,{children:`Delete branch`}),(0,U.jsxs)(ae,{children:[`Delete branch `,(0,U.jsx)(`span`,{className:`font-mono`,children:o.name}),`? This removes the branch from the repository.`]})]}),o.localOnly&&(0,U.jsxs)(`p`,{className:`text-xs text-waiting`,children:[(0,U.jsx)(`span`,{className:`font-mono`,children:o.name}),` has commits on no remote — deleting it discards that work permanently.`]})]}):(0,U.jsxs)(te,{children:[(0,U.jsx)(ie,{children:`Prune worktree`}),(0,U.jsxs)(ae,{children:[`Remove `,(0,U.jsx)(`span`,{className:`font-mono`,children:o?Ro(o.path):``}),`? The working directory is deleted; the branch`,` `,(0,U.jsx)(`span`,{className:`font-mono`,children:o?.branch??``}),` is kept.`]})]}),c&&(0,U.jsx)(`p`,{className:`text-xs text-danger`,children:c}),(0,U.jsxs)(re,{children:[(0,U.jsx)(j,{type:`button`,variant:`ghost`,onClick:()=>s(null),children:`Cancel`}),(0,U.jsx)(j,{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 Ho=`DropdownMenu`,[Uo,Wo]=O(Ho,[He]),Y=He(),[Go,Ko]=Uo(Ho),qo=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Y(t),l=W.useRef(null),[u,d]=k({prop:i,defaultProp:a??!1,onChange:o,caller:Ho});return(0,U.jsx)(Go,{scope:t,triggerId:A(),triggerRef:l,contentId:A(),open:u,onOpenChange:d,onOpenToggle:W.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,U.jsx)(Ge,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};qo.displayName=Ho;var Jo=`DropdownMenuTrigger`,Yo=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Ko(Jo,n),o=Y(n),s=ee(t,a.triggerRef);return(0,U.jsx)($e,{asChild:!0,...o,children:(0,U.jsx)(oe.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:M(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:M(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Yo.displayName=Jo;var Xo=`DropdownMenuPortal`,Zo=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Y(t);return(0,U.jsx)(Ue,{...r,...n})};Zo.displayName=Xo;var Qo=`DropdownMenuContent`,$o=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ko(Qo,n),a=Y(n),o=W.useRef(!1);return(0,U.jsx)(Je,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:M(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:M(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)`}})});$o.displayName=Qo;var es=`DropdownMenuGroup`,ts=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Y(n);return(0,U.jsx)(rt,{...i,...r,ref:t})});ts.displayName=es;var ns=`DropdownMenuLabel`,rs=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Y(n);return(0,U.jsx)(Ye,{...i,...r,ref:t})});rs.displayName=ns;var is=`DropdownMenuItem`,as=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Y(n);return(0,U.jsx)(et,{...i,...r,ref:t})});as.displayName=is;var os=`DropdownMenuCheckboxItem`,ss=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Y(n);return(0,U.jsx)(qe,{...i,...r,ref:t})});ss.displayName=os;var cs=`DropdownMenuRadioGroup`,ls=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Y(n);return(0,U.jsx)(st,{...i,...r,ref:t})});ls.displayName=cs;var us=`DropdownMenuRadioItem`,ds=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Y(n);return(0,U.jsx)(ut,{...i,...r,ref:t})});ds.displayName=us;var fs=`DropdownMenuItemIndicator`,ps=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Y(n);return(0,U.jsx)(Xe,{...i,...r,ref:t})});ps.displayName=fs;var ms=`DropdownMenuSeparator`,hs=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Y(n);return(0,U.jsx)(lt,{...i,...r,ref:t})});hs.displayName=ms;var gs=`DropdownMenuArrow`,_s=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Y(n);return(0,U.jsx)(ot,{...i,...r,ref:t})});_s.displayName=gs;var vs=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=Y(t),[s,c]=k({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,U.jsx)(Ve,{...o,open:s,onOpenChange:c,children:n})},ys=`DropdownMenuSubTrigger`,bs=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Y(n);return(0,U.jsx)(ct,{...i,...r,ref:t})});bs.displayName=ys;var xs=`DropdownMenuSubContent`,Ss=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Y(n);return(0,U.jsx)(Le,{...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)`}})});Ss.displayName=xs;var Cs=qo,ws=Yo,Ts=Zo,Es=$o,Ds=as,Os=hs,ks=vs,As=bs,js=Ss,Ms=Cs,Ns=ws,Ps=ks;function Fs({className:e,sideOffset:t=4,...n}){return(0,U.jsx)(Ts,{children:(0,U.jsx)(Es,{sideOffset:t,className:z(`z-50 min-w-36 overflow-hidden rounded-md bg-elevated p-1 shadow-xl`,e),...n})})}function Is({className:e,...t}){return(0,U.jsx)(Ds,{className:z(_e,je,`[&_svg]:size-3.5`,e),...t})}function Ls({className:e,children:t,...n}){return(0,U.jsxs)(As,{className:z(_e,je,`data-[state=open]:bg-action data-[state=open]:text-action-ink [&_svg]:size-3.5`,e),...n,children:[t,(0,U.jsx)(vt,{className:`ml-auto`})]})}function Rs({className:e,...t}){return(0,U.jsx)(Ts,{children:(0,U.jsx)(js,{className:z(`z-50 min-w-36 overflow-hidden rounded-md bg-elevated p-1 shadow-xl`,e),...t})})}function zs({className:e,...t}){return(0,U.jsx)(Os,{className:z(`-mx-1 my-1 h-px bg-border`,e),...t})}function Bs(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 Vs({text:e,className:t}){let n=(0,W.useRef)(null);return(0,W.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,U.jsx)(`div`,{ref:n,className:`no-scrollbar min-w-0 flex-1 overflow-x-auto`,children:(0,U.jsx)(`span`,{className:z(`inline-block whitespace-nowrap`,t),children:e})})}function Hs({sessions:e,target:t,showFileActions:n=!1,showPath:r=!1}){let{session:i,pinned:a,pin:o,unpin:s}=t,c=xe().data?.home,l=e.filter(e=>e.status!==`archived`),u=i?i.branch||Wt(i):`No worktree`,d=i?Bs(i.worktree_path,c):`No worktree`;return(0,U.jsxs)(`div`,{className:`group relative flex h-8 shrink-0 items-center px-2`,children:[(0,U.jsx)(Vs,{text:r?d:u,className:`font-mono text-xs text-fg-secondary`}),(0,U.jsxs)(`div`,{className:z(`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,U.jsx)(Ws,{}),(0,U.jsxs)(`button`,{type:`button`,"aria-pressed":a,disabled:!i,title:a?`Unpin — follow the active session`:`Pin the sidebar to this worktree`,onClick:()=>a?s():i&&o(i.id),className:z(`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,U.jsx)(En,{className:z(`size-3.5`,a&&`fill-current`)}),(0,U.jsx)(`span`,{className:`sr-only`,children:a?`Unpin sidebar`:`Pin sidebar`})]}),(0,U.jsxs)(Ms,{children:[(0,U.jsx)(Ns,{asChild:!0,children:(0,U.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,U.jsx)(gt,{className:`size-3.5`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Choose a worktree`})]})}),(0,U.jsx)(Fs,{align:`end`,children:l.length===0?(0,U.jsx)(`div`,{className:`px-2 py-1.5 text-xs text-fg-muted`,children:`No sessions yet`}):l.map(e=>(0,U.jsx)(Is,{onSelect:()=>o(e.id),children:(0,U.jsxs)(`span`,{className:`truncate font-mono`,children:[e.branch,` — `,Wt(e)]})},e.id))})]})]})]})}var Us=[{key:`new-file`,label:`New File`,icon:ln},{key:`new-folder`,label:`New Folder`,icon:gn},{key:`refresh`,label:`Refresh`,icon:Ct},{key:`collapse`,label:`Collapse Folders`,icon:Yt}];function Ws(){let e=oo();if(!e)return null;let t=t=>{t===`new-file`?e.beginCreate(``,`file`):t===`new-folder`?e.beginCreate(``,`dir`):t===`refresh`?e.refresh():t===`collapse`&&e.collapseAll()};return(0,U.jsx)(`div`,{className:`hidden shrink-0 items-center gap-0.5 group-hover:flex group-focus-within:flex`,children:Us.map(({key:e,label:n,icon:r})=>(0,U.jsxs)(Tt,{children:[(0,U.jsx)(Ft,{asChild:!0,children:(0,U.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,U.jsx)(r,{className:`size-3.5`}),(0,U.jsx)(`span`,{className:`sr-only`,children:n})]})}),(0,U.jsx)(bt,{children:n})]},e))})}var Gs=[{key:`files`,label:`Files`,icon:_n},{key:`search`,label:`Search`,icon:xt},{key:`changes`,label:`Changes`,icon:yn},{key:`worktrees`,label:`Worktrees`,icon:yt}];function Ks(e){return e===`diff`||e===`history`||e===`changes`?`changes`:e===`search`?`search`:e===`worktrees`?`worktrees`:`files`}function qs({mode:e,onExpand:t,onSelect:n}){return(0,U.jsxs)(`div`,{className:`flex h-full w-9 shrink-0 flex-col items-center gap-1 bg-surface py-1.5`,children:[(0,U.jsxs)(Tt,{children:[(0,U.jsx)(Ft,{asChild:!0,children:(0,U.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,U.jsx)(Cn,{className:`size-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Show sidebar`})]})}),(0,U.jsx)(bt,{side:`right`,children:`Show sidebar`})]}),Gs.map(({key:t,label:r,icon:i})=>(0,U.jsxs)(Tt,{children:[(0,U.jsx)(Ft,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,"aria-current":e===t?`page`:void 0,onClick:()=>n(t),className:z(`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,U.jsx)(i,{className:`size-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:r})]})}),(0,U.jsx)(bt,{side:`right`,children:r})]},t))]})}function Js({mode:e,onModeChange:t,onCollapse:n,projectId:r,repoId:i,sessions:a,target:o,onOpenFile:s,activeFilePath:c,activeDiffPath:l,onOpenDiff:u,onOpenCommitFile:d,onOpenSearchFile:f}){let{session:p}=o;return(0,U.jsxs)(`div`,{className:`flex h-full flex-col bg-surface`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1.5`,children:[Gs.map(({key:n,label:r,icon:i})=>(0,U.jsxs)(Tt,{children:[(0,U.jsx)(Ft,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,"aria-current":e===n?`page`:void 0,onClick:()=>t(n),className:z(`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,U.jsx)(i,{className:`size-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:r})]})}),(0,U.jsx)(bt,{children:r})]},n)),(0,U.jsxs)(Tt,{children:[(0,U.jsx)(Ft,{asChild:!0,children:(0,U.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,U.jsx)(Sn,{className:`size-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Hide sidebar`})]})}),(0,U.jsx)(bt,{children:`Hide sidebar`})]})]}),e!==`worktrees`&&e!==`files`&&(0,U.jsx)(Hs,{sessions:a,target:o,showPath:e===`search`}),e===`worktrees`&&(0,U.jsx)(Vo,{repoId:i,projectId:r,sessions:a}),e===`files`&&(p?(0,U.jsxs)(so,{session:p,onOpenFile:s,activePath:c,children:[(0,U.jsx)(Hs,{sessions:a,target:o,showFileActions:!0,showPath:!0}),(0,U.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,U.jsx)(wo,{})})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Hs,{sessions:a,target:o}),(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No worktree to show.`})]})),e===`changes`&&(p?(0,U.jsx)(Ba,{session:p.id,activeDiffPath:l,onOpenDiff:u,onOpenCommitFile:d},p.id):(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No worktree to show.`})),e===`search`&&(p?(0,U.jsx)(Po,{session:p.id,onOpen:f},p.id):(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No worktree to search.`}))]})}function Ys({projectId:e,repoId:t,open:n,kind:r=`agent`,seedAccountId:i,onOpenChange:a,onCreated:o}){let s=r===`terminal`,c=Ee(),l=ve(c??void 0),u=pe(c??void 0),d=he(),f=xe(),p=ce(),[m,h]=(0,W.useState)(``),[g,_]=(0,W.useState)(``),[v,y]=(0,W.useState)(!0),[b,x]=(0,W.useState)(!0),[S,C]=(0,W.useState)(``),[w,T]=(0,W.useState)(``),[E,D]=(0,W.useState)(!1),[ee,O]=(0,W.useState)(null),k=d.data?.find(e=>e.id===t),A=De(n?t:void 0),ne=le(n?t:void 0),M=l.data?.find(e=>String(e.id)===m),oe=u.data?.allowSkipPermissions===!0,se=!s&&oe&&M?.skip_permissions_default===!0,F=g.trim()||k?.default_base_branch||``,I=(0,W.useMemo)(()=>(ne.data?.worktrees??[]).filter(e=>e.branch===F).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})),[ne.data,F]),ue=!v&&!b,de=I.find(e=>e.is_primary)?.path??I[0]?.path??``,L=w||de,fe=(0,W.useMemo)(()=>{let e=u.data?.default_account_id;return l.data?.find(e=>e.id===i)??l.data?.find(t=>typeof e==`number`&&t.id===e)??l.data?.[0]},[l.data,u.data,i]),me=m||(fe?String(fe.id):``);(0,W.useEffect)(()=>{n&&i!==void 0&&h(String(i))},[n,i]);let R=(0,W.useRef)(u.data);R.current=u.data,(0,W.useEffect)(()=>{if(n){let e=_t(s?`terminal`:`agent`,R.current);_(e.baseBranch),y(e.separateBranch),x(e.separateWorktree),T(``)}},[n,s]);let ge=()=>{O(null),p.mutate({project_id:e,...s?{kind:`terminal`}:{account_id:Number(me)},...g.trim()?{base_branch:g.trim()}:{},separate_branch:v,...v&&S.trim()?{branch:S.trim()}:{},...v?{}:{separate_worktree:b},...ue&&L?{join_worktree:L}:{},...se&&E?{skip_permissions:!0}:{}},{onSuccess:e=>{a(!1),C(``),D(!1),o(e)},onError:e=>O(e.message)})},_e=s?`a shell`:`an agent`,ye=v?`on a new branch off ${F||`…`}, in its own directory`:ue?`on ${F||`…`}, sharing an existing directory`:`on ${F||`…`}, in its own directory`;return(0,U.jsx)(P,{open:n,onOpenChange:a,children:(0,U.jsxs)(N,{children:[(0,U.jsxs)(te,{children:[(0,U.jsx)(ie,{children:s?`New terminal`:`New agent`}),(0,U.jsxs)(ae,{children:[s?`Opens`:`Spawns`,` `,_e,` `,ye,`.`]})]}),(0,U.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),(s||me)&&ge()},children:[!s&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(Te,{children:`Account`}),l.data?.length===0?(0,U.jsxs)(`p`,{className:`text-sm text-fg-secondary`,children:[`No accounts yet —`,` `,(0,U.jsx)(`button`,{type:`button`,className:`text-accent underline`,onClick:()=>St(`accounts`),children:`add one in settings`}),`.`]}):(0,U.jsxs)(pt,{value:me,onValueChange:h,children:[(0,U.jsx)(dt,{children:(0,U.jsx)(mt,{placeholder:`pick an account`})}),(0,U.jsx)(ht,{children:l.data?.map(e=>(0,U.jsxs)(ft,{value:String(e.id),children:[(0,U.jsxs)(`span`,{className:`font-mono`,children:[e.agent_type,`/`,e.label]}),!e.logged_in&&(0,U.jsx)(`span`,{className:`ml-2 text-2xs text-waiting`,children:`not logged in`})]},e.id))})]})]}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,U.jsx)(Te,{htmlFor:`base-branch`,children:`Base branch`}),(0,U.jsx)(Oe,{id:`base-branch`,placeholder:k?.default_base_branch??`main`,value:g,onValueChange:_,hints:(A.data?.branches??[]).filter(e=>e.name.toLowerCase().includes(g.trim().toLowerCase())).slice(0,20).map(e=>({value:e.name,badge:e.name===k?.default_base_branch?`default`:e.is_session?`session: ${e.session_title??`untitled`}`:void 0})),className:`font-mono`,hintsClassName:`w-max min-w-full max-w-[36rem]`})]}),v&&(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,U.jsx)(Te,{htmlFor:`session-branch`,children:`New branch`}),(0,U.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`optional`})]}),(0,U.jsx)(ke,{id:`session-branch`,placeholder:`leave blank for auto`,value:S,onChange:e=>C(e.target.value),className:`font-mono`})]})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Nt,{id:`separate-branch`,checked:v,onCheckedChange:e=>{y(e),e&&x(!0)}}),(0,U.jsx)(Te,{htmlFor:`separate-branch`,children:`Use separate branch`})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Nt,{id:`separate-worktree`,checked:v?!0:b,disabled:v,onCheckedChange:x}),(0,U.jsx)(Te,{htmlFor:`separate-worktree`,className:z(v&&`text-fg-muted`),children:`Use separate directory`})]})]}),ue&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(Te,{htmlFor:`join-dir`,children:`Directory to join`}),I.length===0?(0,U.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[`No existing directory on `,(0,U.jsx)(`span`,{className:`font-mono`,children:F||`…`}),` — a shared one will be created for later sessions to join.`]}):(0,U.jsxs)(pt,{value:L,onValueChange:T,children:[(0,U.jsx)(dt,{id:`join-dir`,children:(0,U.jsx)(mt,{})}),(0,U.jsx)(ht,{children:I.map(e=>(0,U.jsx)(ft,{value:e.path,title:e.path,detail:(0,U.jsx)(`span`,{className:`ml-auto min-w-0 truncate font-mono text-2xs text-fg-muted`,children:Bs(e.path,f.data?.home)}),children:e.label},e.path))})]})]}),!v&&!s&&(0,U.jsxs)(`p`,{className:`text-xs text-waiting`,children:[`The `,s?`shell`:`agent`,` commits straight to`,` `,(0,U.jsx)(`span`,{className:`font-mono`,children:F||`…`}),ue?` and shares its working directory with concurrent sessions — they can trample each other’s edits.`:`.`]}),se&&(0,U.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md bg-surface px-3 py-2`,children:[(0,U.jsx)(Nt,{id:`skip-permissions`,checked:E,onCheckedChange:D}),(0,U.jsx)(Te,{htmlFor:`skip-permissions`,className:`text-waiting`,children:`Skip permission prompts for this session`})]}),ee&&(0,U.jsx)(`p`,{className:`text-xs text-danger`,children:ee}),(0,U.jsxs)(re,{children:[(0,U.jsx)(j,{type:`button`,variant:`ghost`,onClick:()=>a(!1),children:`Cancel`}),(0,U.jsx)(j,{type:`submit`,disabled:!s&&!me||p.isPending,children:s?`Open terminal`:`Start agent`})]})]})]})})}function Xs({status:e,kind:t=`agent`,stale:n=!1,className:r}){let i=`${t===`terminal`?`terminal `:``}status: ${e.replace(`_`,` `)}${n?` (no agent activity for over an hour — possibly stalled)`:``}`;return(0,U.jsx)(`span`,{className:z(`status-dot`,r),"data-status":e,"data-kind":t,"data-stale":n||void 0,role:`img`,title:n?`No agent activity for over an hour — possibly stalled`:void 0,"aria-label":i})}var Zs=[`starting`,`running`,`waiting_input`],Qs=[`exited`,`interrupted`],$s={Item:Is,Separator:zs,Sub:Ps,SubTrigger:Ls,SubContent:Rs},ec={Item:V,Separator:Ze,Sub:We,SubTrigger:it,SubContent:nt};function tc(e,t){let n=R(`resume`),r=R(`kill`),i=be(),a=Ne(),o=ue(),s=de(),c=ye(),l=ce(),u=zt(),d=Ee(),f=ve(d??void 0),p=pe(d??void 0),[m,h]=(0,W.useState)(null),[g,_]=(0,W.useState)(!1),[v,y]=(0,W.useState)(e.title??``),[b,x]=(0,W.useState)(null),S=(f.data??[]).filter(t=>t.agent_type===e.agent_type),C=!e.worktree_missing&&e.status!==`archived`&&S.some(t=>t.id!==e.account_id),w=p.data?.default_account_id,T=typeof w==`number`?w:null,E=(f.data??[]).filter(e=>e.logged_in),ee=T===null?E:[...E.filter(e=>e.id===T),...E.filter(e=>e.id!==T)];return{menu:{session:e,resumable:Qs.includes(e.status),live:Zs.includes(e.status),archived:e.status===`archived`,canMigrate:C,sameAgent:S,resume:()=>n.mutate(e.id,{onError:e=>D.error(e.message)}),kill:()=>r.mutate(e.id,{onError:e=>D.error(e.message)}),openClearEnv:()=>h(`clear-env`),openTerminal:()=>l.mutate({project_id:e.project_id,kind:`terminal`,separate_branch:!1,separate_worktree:!1,join_worktree:e.worktree_path},{onSuccess:e=>void u(`/project/${e.project_id}/session/${e.id}`),onError:e=>D.error(e.message)}),spawnAccounts:ee,defaultAccountId:T,spawnAgent:t=>l.mutate({project_id:e.project_id,account_id:t,separate_branch:!1,separate_worktree:!1,join_worktree:e.worktree_path},{onSuccess:e=>void u(`/project/${e.project_id}/session/${e.id}`),onError:e=>D.error(e.message)}),openRename:()=>{y(e.title??``),_(!0)},archive:()=>i.mutate(e.id,{onSuccess:()=>t?.(e.id),onError:e=>D.error(e.message)}),unarchive:()=>a.mutate(e.id,{onError:e=>D.error(e.message)}),setMigrateTo:x},dialogs:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(P,{open:m===`clear-env`,onOpenChange:e=>{e||h(null)},children:(0,U.jsxs)(N,{children:[(0,U.jsxs)(te,{children:[(0,U.jsx)(ie,{children:`Clear captured environment?`}),(0,U.jsx)(ae,{children:`Variables exported in this session’s terminals will no longer be injected into new shells or agent restarts.`})]}),(0,U.jsxs)(re,{children:[(0,U.jsx)(j,{variant:`ghost`,onClick:()=>h(null),children:`Cancel`}),(0,U.jsx)(j,{variant:`danger`,disabled:c.isPending,onClick:()=>c.mutate(e.id,{onSuccess:e=>{h(null),D.success(e.cleared===0?`Nothing was captured`:`Cleared ${e.cleared} captured var${e.cleared===1?``:`s`}`)},onError:e=>{h(null),D.error(e.message)}}),children:`Clear captured env`})]})]})}),(0,U.jsx)(P,{open:g,onOpenChange:_,children:(0,U.jsxs)(N,{children:[(0,U.jsxs)(te,{children:[(0,U.jsx)(ie,{children:`Rename session`}),(0,U.jsx)(ae,{children:`Leave it empty to use the agent’s own session name.`})]}),(0,U.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:t=>{t.preventDefault(),o.mutate({sessionId:e.id,title:v.trim()},{onSuccess:()=>_(!1),onError:e=>D.error(e.message)})},children:[(0,U.jsx)(ke,{value:v,onChange:e=>y(e.target.value),placeholder:e.agent_title??e.osc_title??e.id.slice(0,8),autoFocus:!0}),(0,U.jsxs)(re,{children:[(0,U.jsx)(j,{type:`button`,variant:`ghost`,onClick:()=>_(!1),children:`Cancel`}),(0,U.jsx)(j,{type:`submit`,disabled:o.isPending,children:`Rename`})]})]})]})}),(0,U.jsx)(P,{open:b!==null,onOpenChange:e=>!e&&x(null),children:(0,U.jsxs)(N,{children:[(0,U.jsxs)(te,{children:[(0,U.jsxs)(ie,{children:[`Move this session to `,b?.label,`?`]}),(0,U.jsx)(ae,{children:`The conversation continues under that account’s credentials. If the session is running it is stopped first, then resumed on the new account.`})]}),(0,U.jsxs)(re,{children:[(0,U.jsx)(j,{variant:`ghost`,onClick:()=>x(null),children:`Cancel`}),(0,U.jsx)(j,{disabled:s.isPending,onClick:()=>{b&&s.mutate({sessionId:e.id,accountId:b.id},{onSuccess:()=>{x(null),D.success(`Moved to ${b.label}`)},onError:e=>{x(null),D.error(e.message)}})},children:`Move session`})]})]})})]})}}function nc({kit:e,menu:t}){let{Item:n,Separator:r,Sub:i,SubTrigger:a,SubContent:o}=e,{session:s}=t;return(0,U.jsxs)(U.Fragment,{children:[t.resumable&&!s.worktree_missing&&(0,U.jsxs)(n,{onSelect:t.resume,children:[(0,U.jsx)(Dn,{}),` Resume`]}),t.live&&(0,U.jsxs)(n,{onSelect:t.kill,children:[(0,U.jsx)(An,{}),` Kill`]}),(0,U.jsxs)(n,{onSelect:t.openRename,children:[(0,U.jsx)(Ae,{}),` Rename`]}),!t.archived&&(0,U.jsxs)(n,{onSelect:t.openClearEnv,children:[(0,U.jsx)(Zt,{}),` Clear captured env`]}),t.canMigrate&&(0,U.jsxs)(i,{children:[(0,U.jsxs)(a,{children:[(0,U.jsx)(jn,{}),` Move to account…`]}),(0,U.jsx)(o,{children:t.sameAgent.map(e=>{let r=e.id===s.account_id;return(0,U.jsxs)(n,{disabled:r,onSelect:()=>t.setMigrateTo(e),children:[e.label,r&&(0,U.jsx)(`span`,{className:`ml-auto text-fg-muted`,children:`current`})]},e.id)})})]}),!s.worktree_missing&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(r,{}),(0,U.jsxs)(n,{onSelect:t.openTerminal,children:[(0,U.jsx)(kt,{}),` Open terminal in worktree`]}),t.spawnAccounts.length>0&&(0,U.jsxs)(i,{children:[(0,U.jsxs)(a,{children:[(0,U.jsx)(jt,{}),` Spawn agent in worktree`]}),(0,U.jsx)(o,{children:t.spawnAccounts.map(e=>(0,U.jsxs)(n,{onSelect:()=>t.spawnAgent(e.id),children:[(0,U.jsx)(Vt,{type:e.agent_type,className:`size-4 shrink-0`}),e.agent_type,`/`,e.label,e.id===t.defaultAccountId&&(0,U.jsx)(`span`,{className:`ml-auto pl-3 text-fg-muted`,children:`default`})]},e.id))})]}),(0,U.jsxs)(n,{onSelect:()=>{window.location.href=Ht(`vscode`,s.worktree_path,Bt())},children:[(0,U.jsx)(Qt,{}),` Open in VS Code`]}),(0,U.jsxs)(n,{onSelect:()=>{window.location.href=Ht(`cursor`,s.worktree_path,Bt())},children:[(0,U.jsx)(Qt,{}),` Open in Cursor`]})]}),!t.archived&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(r,{}),(0,U.jsxs)(n,{onSelect:t.archive,children:[(0,U.jsx)(Ie,{}),` Archive`]})]}),t.archived&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(r,{}),(0,U.jsxs)(n,{onSelect:t.unarchive,children:[(0,U.jsx)(Qe,{}),` Unarchive`]})]})]})}function rc({menu:e}){return(0,U.jsxs)(Ms,{children:[(0,U.jsx)(Ns,{asChild:!0,children:(0,U.jsxs)(j,{variant:`ghost`,size:`icon`,className:`size-6`,onClick:e=>e.preventDefault(),children:[(0,U.jsx)(Xt,{}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Session actions`})]})}),(0,U.jsx)(Fs,{align:`end`,children:(0,U.jsx)(nc,{kit:$s,menu:e})})]})}function ic({session:e,onArchived:t,children:n}){let{menu:r,dialogs:i}=tc(e,t);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(at,{children:[(0,U.jsx)(Ke,{asChild:!0,children:typeof n==`function`?n(r):n}),(0,U.jsx)(tt,{children:(0,U.jsx)(nc,{kit:ec,menu:r})})]}),i]})}function ac({menu:e}){return(0,U.jsx)(tt,{children:(0,U.jsx)(nc,{kit:ec,menu:e})})}function oc({icon:e,label:t,onClick:n,active:r=!1}){return(0,U.jsxs)(Tt,{children:[(0,U.jsx)(Ft,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,onClick:n,"aria-pressed":r,className:z(`flex items-center rounded-md p-1.5 transition-colors`,r?`bg-elevated text-fg`:`text-fg-gold hover:bg-elevated hover:text-fg`),children:[(0,U.jsx)(e,{className:`size-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:t})]})}),(0,U.jsx)(bt,{children:t})]})}function sc({session:e}){return(0,U.jsxs)(`span`,{className:`flex flex-col`,children:[(0,U.jsx)(`span`,{children:Dt()(e)}),(0,U.jsx)(`span`,{className:`font-mono text-2xs text-fg-muted`,children:e.branch})]})}function cc({session:e,activeSessionId:t,onPromote:n,onArchived:r}){let{menu:i,dialogs:a}=tc(e,r),o=Dt();return(0,U.jsxs)(at,{children:[(0,U.jsxs)(Tt,{children:[(0,U.jsx)(Ke,{asChild:!0,children:(0,U.jsx)(Ft,{asChild:!0,children:(0,U.jsxs)(Pt,{draggable:!1,"aria-current":e.id===t?`true`:void 0,onDoubleClick:()=>n(e.id),to:`/project/${e.project_id}/session/${e.id}`,className:z(`flex items-center rounded-md p-1.5 transition-colors hover:bg-elevated`,e.id===t&&`bg-elevated`),children:[(0,U.jsx)(Xs,{status:e.status,kind:e.kind,stale:e.stale_running,className:`[--puddle-ripple-scale:2.3]`}),(0,U.jsx)(`span`,{className:`sr-only`,children:o(e)})]})})}),(0,U.jsx)(bt,{children:(0,U.jsx)(sc,{session:e})})]}),(0,U.jsx)(ac,{menu:i}),a]})}function lc({groups:e,activeSessionId:t,onReorder:n,onPromote:r,onExpand:i,onNewTerminal:a,onNewSession:o,onArchived:s}){let[c,l]=(0,W.useState)(null),u=e.filter(e=>e.sessions.length>0),d=(e,t)=>{let r=Re(u,e,t);r&&n(r)};return(0,U.jsxs)(`div`,{className:`flex h-full w-9 shrink-0 flex-col items-center bg-surface py-1.5`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,U.jsx)(oc,{icon:Tn,label:`Show sessions`,onClick:i}),(0,U.jsx)(oc,{icon:jt,label:`New agent`,onClick:o}),(0,U.jsx)(oc,{icon:kt,label:`New terminal`,onClick:a})]}),(0,U.jsx)(`div`,{className:`no-scrollbar flex min-h-0 flex-1 flex-col items-center gap-1 overflow-y-auto`,children:u.map(e=>(0,U.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,U.jsx)(`div`,{className:`my-0.5 h-px w-5 shrink-0 bg-border`}),e.sessions.map(e=>(0,U.jsx)(`div`,{draggable:!0,onDragStart:t=>{t.dataTransfer.setData(co,lo({type:`terminal`,session:e.id})),l(e.id)},onDragEnd:()=>l(null),onDragOver:t=>{t.preventDefault(),c&&c!==e.id&&d(c,e.id)},className:z(`transition-opacity`,c===e.id&&`opacity-50`),children:(0,U.jsx)(cc,{session:e,activeSessionId:t,onPromote:r,onArchived:s})},e.id))]},e.projectId))})]})}function uc({session:e,activeSessionId:t,accountLabel:n,onPromote:r,onArchived:i,ellipsis:a}){let o=Dt();return(0,U.jsx)(ic,{session:e,onArchived:i,children:i=>(0,U.jsxs)(Pt,{draggable:!1,onDoubleClick:r&&(()=>r(e.id)),to:`/project/${e.project_id}/session/${e.id}`,className:z(`group flex items-center gap-2 px-3 py-1.5 transition-colors hover:bg-elevated`,e.id===t&&`bg-elevated`),children:[(0,U.jsx)(Xs,{status:e.status,kind:e.kind,stale:e.stale_running}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block truncate font-sans text-xs text-fg`,children:o(e)}),(0,U.jsxs)(`span`,{className:`flex items-center gap-1 truncate font-mono text-2xs text-fg-muted`,children:[(0,U.jsx)(yn,{className:`size-3 shrink-0 text-fg-gold`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.branch})]}),e.account_id!==null&&n.has(e.account_id)&&(0,U.jsxs)(`span`,{className:`flex items-center gap-1 truncate font-mono text-2xs text-fg-muted`,children:[(0,U.jsx)(Vt,{type:e.agent_type??``,className:`size-3 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:n.get(e.account_id)})]})]}),e.skip_permissions&&(0,U.jsxs)(Tt,{children:[(0,U.jsx)(Ft,{asChild:!0,children:(0,U.jsx)(kn,{className:`size-3.5 shrink-0 text-waiting`})}),(0,U.jsx)(bt,{children:`Running with permission prompts skipped`})]}),e.worktree_missing&&(0,U.jsxs)(Tt,{children:[(0,U.jsx)(Ft,{asChild:!0,children:(0,U.jsx)(vn,{className:`size-3.5 shrink-0 text-interrupted`})}),(0,U.jsx)(bt,{children:`Worktree directory is gone — archive only`})]}),a&&(0,U.jsx)(`span`,{className:`hidden group-hover:inline-flex has-[[data-state=open]]:inline-flex`,children:(0,U.jsx)(rc,{menu:i})})]})})}function dc({groups:e,accounts:t,activeSessionId:n,onReorder:r,onPromote:i,archived:a,onNewSession:o,onNewTerminal:s,onCollapse:c,onArchived:l}){return(0,U.jsxs)(`div`,{className:`flex h-full flex-col bg-surface`,children:[(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 px-2 py-1.5`,children:[(0,U.jsx)(oc,{icon:wn,label:`Hide sessions`,onClick:c}),(0,U.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,U.jsx)(oc,{icon:jt,label:`New agent`,onClick:o}),(0,U.jsx)(oc,{icon:kt,label:`New terminal`,onClick:s})]})]}),(0,U.jsx)(fc,{groups:e,accounts:t,activeSessionId:n,onReorder:r,onPromote:i,archived:a,onArchived:l})]})}function fc({groups:e,accounts:t,activeSessionId:n,onReorder:r,onPromote:i,archived:a,onArchived:o}){let[s,c]=(0,W.useState)(null),[l,u]=(0,W.useState)(!1),d=new Map(t.map(e=>[e.id,e.label])),f=e.filter(e=>e.sessions.length>0),p=f.reduce((e,t)=>e+t.sessions.length,0),m=(e,t)=>{let n=Re(f,e,t);n&&r(n)};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`no-scrollbar min-h-0 flex-1 overflow-y-auto py-1.5`,children:[p===0&&a.length===0&&(0,U.jsx)(`p`,{className:`px-3 py-3 text-xs text-fg-muted`,children:`No sessions yet — press ⌘K to start one.`}),f.map(e=>(0,U.jsxs)(`div`,{children:[e.name!==null&&(0,U.jsx)(`div`,{className:`truncate px-3 pb-1 pt-2 text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:e.name}),(0,U.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:e.sessions.map(e=>(0,U.jsx)(`li`,{draggable:!0,onDragStart:t=>{t.dataTransfer.setData(co,lo({type:`terminal`,session:e.id})),c(e.id)},onDragEnd:()=>c(null),onDragOver:t=>{t.preventDefault(),s&&s!==e.id&&m(s,e.id)},className:z(`transition-opacity`,s===e.id&&`opacity-50`),children:(0,U.jsx)(uc,{session:e,activeSessionId:n,accountLabel:d,onPromote:i,onArchived:o,ellipsis:!0})},e.id))})]},e.projectId))]}),a.length>0&&(0,U.jsxs)(`div`,{className:`shrink-0 pb-1.5`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>u(e=>!e),className:`flex w-full items-center gap-1.5 px-3 py-1.5 text-2xs uppercase tracking-wide text-fg-gold transition-colors hover:text-fg`,children:[(0,U.jsx)(vt,{className:z(`size-3 transition-transform`,l&&`rotate-90`)}),(0,U.jsx)(Ie,{className:`size-3`}),(0,U.jsx)(`span`,{children:`Archived`}),(0,U.jsx)(`span`,{className:`ml-auto tabular-nums`,children:a.length})]}),l&&(0,U.jsx)(`ul`,{className:`no-scrollbar flex max-h-48 flex-col gap-0.5 overflow-y-auto`,children:a.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsx)(uc,{session:e,activeSessionId:n,accountLabel:d,onArchived:o,ellipsis:!0})},e.id))})]})]})}var pc=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function mc(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function hc(e){return`nodeType`in e}function X(e){return e?mc(e)?e:hc(e)?e.ownerDocument?.defaultView??window:window:window}function gc(e){let{Document:t}=X(e);return e instanceof t}function _c(e){return!mc(e)&&e instanceof X(e).HTMLElement}function vc(e){return e instanceof X(e).SVGElement}function yc(e){return e?mc(e)?e.document:hc(e)?gc(e)?e:_c(e)||vc(e)?e.ownerDocument:document:document:document}var bc=pc?W.useLayoutEffect:W.useEffect;function xc(e){let t=(0,W.useRef)(e);return bc(()=>{t.current=e}),(0,W.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function Sc(){let e=(0,W.useRef)(null);return[(0,W.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,W.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function Cc(e,t){t===void 0&&(t=[e]);let n=(0,W.useRef)(e);return bc(()=>{n.current!==e&&(n.current=e)},t),n}function wc(e,t){let n=(0,W.useRef)();return(0,W.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function Tc(e){let t=xc(e),n=(0,W.useRef)(null);return[n,(0,W.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function Ec(e){let t=(0,W.useRef)();return(0,W.useEffect)(()=>{t.current=e},[e]),t.current}var Dc={};function Oc(e,t){return(0,W.useMemo)(()=>{if(t)return t;let n=Dc[e]==null?0:Dc[e]+1;return Dc[e]=n,e+`-`+n},[e,t])}function kc(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 Ac=kc(1),jc=kc(-1);function Mc(e){return`clientX`in e&&`clientY`in e}function Nc(e){if(!e)return!1;let{KeyboardEvent:t}=X(e.target);return t&&e instanceof t}function Pc(e){if(!e)return!1;let{TouchEvent:t}=X(e.target);return t&&e instanceof t}function Fc(e){if(Pc(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 Mc(e)?{x:e.clientX,y:e.clientY}:null}var Ic=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[Ic.Translate.toString(e),Ic.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),Lc=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function Rc(e){return e.matches(Lc)?e:e.querySelector(Lc)}var zc={display:`none`};function Bc(e){let{id:t,value:n}=e;return W.createElement(`div`,{id:t,style:zc},n)}function Vc(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return W.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 Hc(){let[e,t]=(0,W.useState)(``);return{announce:(0,W.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var Uc=(0,W.createContext)(null);function Wc(e){let t=(0,W.useContext)(Uc);(0,W.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function Gc(){let[e]=(0,W.useState)(()=>new Set),t=(0,W.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,W.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var Kc={draggable:`
3
3
  To pick up a draggable item, press the space bar.
4
4
  While dragging, use the arrow keys to move the item.
5
5
  Press space again to drop the item in its new position, or press escape to cancel.