@mrpatronz/nexusflow 2.5.0 → 2.5.2

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 (52) hide show
  1. package/dist/commands/diff.d.ts +2 -0
  2. package/dist/commands/diff.d.ts.map +1 -1
  3. package/dist/commands/diff.js +13 -1
  4. package/dist/commands/diff.js.map +1 -1
  5. package/dist/commands/finish.d.ts.map +1 -1
  6. package/dist/commands/finish.js +7 -0
  7. package/dist/commands/finish.js.map +1 -1
  8. package/dist/commands/list.d.ts +3 -1
  9. package/dist/commands/list.d.ts.map +1 -1
  10. package/dist/commands/list.js +5 -1
  11. package/dist/commands/list.js.map +1 -1
  12. package/dist/commands/schedule.d.ts +3 -1
  13. package/dist/commands/schedule.d.ts.map +1 -1
  14. package/dist/commands/schedule.js +15 -2
  15. package/dist/commands/schedule.js.map +1 -1
  16. package/dist/commands/status.d.ts +4 -1
  17. package/dist/commands/status.d.ts.map +1 -1
  18. package/dist/commands/status.js +9 -3
  19. package/dist/commands/status.js.map +1 -1
  20. package/dist/commands/ui.d.ts +9 -0
  21. package/dist/commands/ui.d.ts.map +1 -1
  22. package/dist/commands/ui.js +42 -1
  23. package/dist/commands/ui.js.map +1 -1
  24. package/dist/core/doctor.d.ts.map +1 -1
  25. package/dist/core/doctor.js +24 -0
  26. package/dist/core/doctor.js.map +1 -1
  27. package/dist/core/worktree.test.js +2 -2
  28. package/dist/desktop-server.d.ts +1 -1
  29. package/dist/desktop-server.js +1 -1
  30. package/dist/gui/assets/{AgentsPage-BNHR9qux.js → AgentsPage-CGvhYtRS.js} +1 -1
  31. package/dist/gui/assets/{DashboardPage-BScH3Cxp.js → DashboardPage-BSVVVXuM.js} +1 -1
  32. package/dist/gui/assets/{GettingStartedPage-AWlI-176.js → GettingStartedPage-srl_5DA_.js} +1 -1
  33. package/dist/gui/assets/{ProjectsPage-Bojj7gxI.js → ProjectsPage-BfFX3Rg1.js} +1 -1
  34. package/dist/gui/assets/{ScaffoldRepoInline-DJMbeHVM.js → ScaffoldRepoInline-DWsd4vxF.js} +1 -1
  35. package/dist/gui/assets/{SettingsPage-BAdXO8X0.js → SettingsPage-C16CjqlK.js} +1 -1
  36. package/dist/gui/assets/{SkillsPage-CF6Db1FA.js → SkillsPage-DKLoq_sH.js} +1 -1
  37. package/dist/gui/assets/StartWorkPage-D56-WIZp.js +1 -0
  38. package/dist/gui/assets/{StrategiesPage-nGbR9TAc.js → StrategiesPage-CY8xp7Lz.js} +1 -1
  39. package/dist/gui/assets/{WorkspacesPage-7XRtVJNF.js → WorkspacesPage-CXtIMMUl.js} +1 -1
  40. package/dist/gui/assets/{alert-dialog-67uzXJi4.js → alert-dialog-CCwlEjU2.js} +1 -1
  41. package/dist/gui/assets/{index-V1dDX1O_.js → index-pxzwuRLq.js} +3 -3
  42. package/dist/gui/assets/{vsc-Di05BTNr.js → vsc-DkRhgYbO.js} +1 -1
  43. package/dist/gui/index.html +1 -1
  44. package/dist/index.js +130 -546
  45. package/dist/index.js.map +1 -1
  46. package/dist/server.d.ts.map +1 -1
  47. package/dist/server.js +48 -11
  48. package/dist/server.js.map +1 -1
  49. package/dist/server.test.js +1 -0
  50. package/dist/server.test.js.map +1 -1
  51. package/package.json +3 -3
  52. package/dist/gui/assets/StartWorkPage-BQid3uIw.js +0 -1
@@ -1,2 +1,2 @@
1
- import{_ as e,b as t,c as n,d as r,g as i,h as a,i as o,l as s,m as c,o as l,p as u,s as d,t as f}from"./button-BDDZnIHx.js";import{$ as p,$t as m,A as h,C as g,D as _,E as v,F as y,Fn as b,Ft as x,H as S,I as C,It as w,J as T,Jn as E,Jt as D,Kt as O,L as k,Lt as A,M as j,N as M,O as N,On as P,P as F,Pn as I,Q as ee,Qn as L,R,Rn as te,S as z,Sn as B,St as V,T as H,Tt as U,Un as ne,X as re,Xn as ie,Xt as ae,Yn as oe,Yt as se,Z as ce,Zn as le,Zt as ue,_ as de,_t as fe,at as pe,bt as me,ct as he,d as ge,dn as _e,en as ve,et as ye,f as be,g as xe,gt as Se,h as Ce,it as we,j as Te,jn as Ee,k as De,ln as W,m as Oe,n as ke,on as Ae,p as je,q as Me,qn as Ne,sn as Pe,t as Fe,tt as Ie,un as G,v as Le,vt as Re,w as ze,x as Be,xt as Ve,y as He,z as Ue,zn as We}from"./CSPContext-BG7no5S_.js";import{t as Ge}from"./bot-C2HWrAft.js";import{t as Ke}from"./chevron-down-qTL8HPug.js";import{a as qe,c as Je,i as Ye,l as Xe,n as Ze,o as Qe,r as $e,s as et,t as tt,u as nt}from"./square-DlIYnlSq.js";import{t as rt}from"./code-xml-jFAa3-TT.js";import{t as it}from"./cpu-Cdwd84Jz.js";import{a as at,h as ot,m as st,n as ct,r as lt,t as ut}from"./store-D7ixdVck.js";import{t as dt}from"./trash-2-CtR35_eF.js";import{t as ft}from"./zap-CWG_Lvki.js";import{_ as pt,a as mt,c as ht,d as gt,f as _t,l as vt,n as yt,o as bt,s as xt,t as St,u as Ct,x as wt,y as Tt}from"./isElementDisabled-D_fu2zfc.js";import{$ as Et,A as Dt,At as Ot,Ft as kt,Ht as At,It as jt,K as Mt,Lt as Nt,M as Pt,Mt as Ft,N as It,Ot as Lt,Pt as Rt,Q as zt,Rt as Bt,U as Vt,Ut as Ht,Vt as K,W as Ut,Wt,_t as Gt,a as q,at as Kt,ct as qt,dt as Jt,et as Yt,ft as Xt,gt as Zt,ht as Qt,i as J,j as $t,jt as Y,lt as en,mt as tn,n as nn,ot as rn,pt as an,r as on,rt as sn,t as cn,ut as X,vt as ln,w as un,xt as dn,yt as fn,zt as Z}from"./index-V1dDX1O_.js";import{t as pn}from"./badge-CAohJGj6.js";import{t as mn}from"./card-BKXzd_5L.js";import{a as hn,i as gn,n as _n,r as vn,t as yn}from"./empty-BdlgbifD.js";import{t as bn}from"./textarea-BNRuIXNs.js";import{n as xn,t as Sn}from"./vsc-Di05BTNr.js";var Cn=a(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),wn=a(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Tn=a(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),En=a(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),Dn=a(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),On=a(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),kn=a(`puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),An=a(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),jn=a(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Mn=a(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Q=t(e(),1);function Nn(){let[,e]=Q.useState({});return Q.useCallback(()=>{e({})},[])}function Pn(e){let t=_e(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=B(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r;return(Tt(n)!==a||Tt(r)!==o)&&(n=a,r=o),{width:n,height:r}}function Fn(e){let{popupElement:t,positionerElement:r,content:i,mounted:a,onMeasureLayout:o,onMeasureLayoutComplete:c,side:l,direction:u}=e,d=se(t,!0,!1),f=ue(),p=Q.useRef(null),m=Q.useRef(!0),h=Q.useRef(s),g=G(o),_=G(c),v=Q.useMemo(()=>{let e=l===`top`,t=l===`left`;return u===`rtl`?(e||=l===`inline-end`,t||=l===`inline-end`):(e||=l===`inline-start`,t||=l===`inline-start`),e?{position:`absolute`,[l===`top`?`bottom`:`top`]:`0`,[t?`right`:`left`]:`0`}:n},[l,u]);W(()=>{if(!a){h.current=s,m.current=!0,p.current=null;return}if(!t||!r)return;h.current=Ln(t,v),Rn(t,`auto`);let e=In(t,`position`,`static`),n=In(t,`transform`,`none`),i=In(t,`scale`,`1`),o=Ln(r,{"--available-width":`max-content`,"--available-height":`max-content`});function c(){e(),n(),o()}function l(){c(),i()}if(g?.(),m.current||p.current===null){zn(r,`max-content`);let e=Pn(t);return p.current=e,zn(r,e),l(),_?.(null,e),m.current=!1,()=>{h.current(),h.current=s}}zn(r,`max-content`);let u=p.current,y=Pn(t);p.current=y,Rn(t,u),l(),_?.(u,y),zn(r,y);let b=new AbortController;return f.request(()=>{Rn(t,y),d(()=>{t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`)},b.signal)}),()=>{b.abort(),f.cancel(),h.current(),h.current=s}},[i,t,r,d,f,a,g,_,v])}function In(e,t,n){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}function Ln(e,t){let n=[];for(let[r,i]of Object.entries(t))n.push(In(e,r,i));return n.length?()=>{n.forEach(e=>e())}:s}function Rn(e,t){let n=t===`auto`?`auto`:`${t.width}px`,r=t===`auto`?`auto`:`${t.height}px`;e.style.setProperty(`--popup-width`,n),e.style.setProperty(`--popup-height`,r)}function zn(e,t){let n=t===`max-content`?`max-content`:`${t.width}px`,r=t===`max-content`?`max-content`:`${t.height}px`;e.style.setProperty(`--positioner-width`,n),e.style.setProperty(`--positioner-height`,r)}var Bn=t(L(),1),$=i();function Vn(e){let{store:t,side:n,cssVars:r,children:i}=e,a=be(),o=t.useState(`activeTriggerElement`),s=t.useState(`activeTriggerId`),c=t.useState(`open`),l=t.useState(`payload`),u=t.useState(`mounted`),d=t.useState(`popupElement`),f=t.useState(`positionerElement`),p=yt(c?o:null),m=Gn(s,l),h=Q.useRef(null),[g,_]=Q.useState(null),[v,y]=Q.useState(null),b=Q.useRef(null),x=Q.useRef(null),S=se(b,!0,!1),C=ue(),[w,T]=Q.useState(null),[E,D]=Q.useState(!1);W(()=>(t.set(`hasViewport`,!0),()=>{t.set(`hasViewport`,!1)}),[t]);let O=G(()=>{b.current?.style.setProperty(`animation`,`none`),b.current?.style.setProperty(`transition`,`none`),x.current?.style.setProperty(`display`,`none`)}),k=G(e=>{b.current?.style.removeProperty(`animation`),b.current?.style.removeProperty(`transition`),x.current?.style.removeProperty(`display`),e&&T(e)}),A=Q.useRef(null);W(()=>{(!c||!u)&&(A.current=null)},[c,u]),W(()=>{if(o&&p&&o!==p&&A.current!==o&&h.current){_(h.current),D(!0);let e=Wn(p,o);y(e),C.request(()=>{Bn.flushSync(()=>{D(!1)}),S(()=>{_(null),T(null),h.current=null})}),A.current=o}},[o,p,g,S,C]),W(()=>{let e=b.current;if(!e)return;let t=U(e).createElement(`div`);for(let n of Array.from(e.childNodes))t.appendChild(n.cloneNode(!0));h.current=t});let j=g!=null,M;M=j?(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(`div`,{"data-previous":!0,inert:je(!0),ref:x,style:{...w?{[r.popupWidth]:`${w.width}px`,[r.popupHeight]:`${w.height}px`}:null,position:`absolute`},"data-ending-style":E?void 0:``},`previous`),(0,$.jsx)(`div`,{"data-current":!0,ref:b,"data-starting-style":E?``:void 0,children:i},m)]}):(0,$.jsx)(`div`,{"data-current":!0,ref:b,children:i},m),W(()=>{let e=x.current;!e||!g||e.replaceChildren(...Array.from(g.childNodes))},[g]),Fn({popupElement:d,positionerElement:f,mounted:u,content:l,onMeasureLayout:O,onMeasureLayoutComplete:k,side:n,direction:a});let N={activationDirection:Hn(v),transitioning:j};return{children:M,state:N}}function Hn(e){if(e)return`${Un(e.horizontal,5,`right`,`left`)} ${Un(e.vertical,5,`down`,`up`)}`}function Un(e,t,n,r){return e>t?n:e<-t?r:``}function Wn(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i={x:n.left+n.width/2,y:n.top+n.height/2},a={x:r.left+r.width/2,y:r.top+r.height/2};return{horizontal:a.x-i.x,vertical:a.y-i.y}}function Gn(e,t){let[n,r]=Q.useState(0),i=Q.useRef(e),a=Q.useRef(t),o=Q.useRef(!1);return W(()=>{let n=i.current,s=a.current,c=e!==n,l=t!==s;c?(r(e=>e+1),o.current=!l):o.current&&l&&(r(e=>e+1),o.current=!1),i.current=e,a.current=t},[e,t]),`${e??`current`}-${n}`}var Kn=Q.createContext(void 0);function qn(){let e=Q.useContext(Kn);if(e===void 0)throw Error(u(64));return e}var Jn=function(e){return e.activationDirection=`data-activation-direction`,e.orientation=`data-orientation`,e}({}),Yn={tabActivationDirection:e=>({[Jn.activationDirection]:e})},Xn=Q.forwardRef(function(e,t){let{className:n,defaultValue:r=0,onValueChange:i,orientation:a=`horizontal`,render:s,value:c,style:l,...u}=e,d=e.defaultValue!==void 0,f=Q.useRef([]),[p,h]=Q.useState(()=>new Map),[g,_]=P({controlled:c,default:r,name:`Tabs`,state:`value`}),v=c!==void 0,[y,x]=Q.useState(()=>new Map),S=Q.useRef(void 0),C=Q.useCallback(e=>{if(e===void 0)return null;for(let[t,n]of y.entries())if(n!=null&&e===(n.value??n.index))return t;return null},[y]),[w,T]=Q.useState(()=>({previousValue:g,tabActivationDirection:`none`})),{previousValue:E,tabActivationDirection:D}=w,O=D,k=!1;E!==g&&(O=Zn(E,g,a,y),k=E!=null&&g!=null&&C(g)==null);let A=k?E:g,j=E!==A||D!==O;W(()=>{j&&T({previousValue:A,tabActivationDirection:O})},[A,j,O]);let M=G((e,t)=>{t.activationDirection=Zn(g,e,a,y),i?.(e,t),!t.isCanceled&&_(e)}),N=G((e,t)=>{i?.(e,m(t,void 0,void 0,{activationDirection:`none`}))}),F=G((e,t)=>{h(n=>{if(n.get(e)===t)return n;let r=new Map(n);return r.set(e,t),r})}),I=G((e,t)=>{h(n=>{if(!n.has(e)||n.get(e)!==t)return n;let r=new Map(n);return r.delete(e),r})}),ee=Q.useCallback(e=>p.get(e),[p]),L=Q.useCallback(e=>{for(let t of y.values())if(e===t?.value)return t?.id},[y]),R=Q.useMemo(()=>({getTabElementBySelectedValue:C,getTabIdByPanelValue:L,getTabPanelIdByValue:ee,onValueChange:M,orientation:a,registerMountedTabPanel:F,setTabMap:x,unregisterMountedTabPanel:I,tabActivationDirection:O,value:g}),[C,L,ee,M,a,F,x,I,O,g]),z=Q.useMemo(()=>{for(let e of y.values())if(e!=null&&e.value===g)return e},[y,g]),B=Q.useMemo(()=>{for(let e of y.values())if(e!=null&&!e.disabled)return e.value},[y]),V=Q.useRef(!d),H=Q.useRef(r),U=Q.useRef(d),ne=Q.useRef(!1);W(()=>{if(v)return;function e(e,t){_(e),T(t=>t.previousValue===e&&t.tabActivationDirection===`none`?t:{previousValue:e,tabActivationDirection:`none`}),N(e,t),V.current=!1}if(y.size===0){ne.current&&g!==null&&!S.current?.isConnected&&e(null,te);return}ne.current=!0,S.current=y.keys().next().value;let t=z?.disabled,n=z==null&&g!==null;if(!t&&g===H.current&&(U.current=!1),U.current&&t&&g===H.current)return;let r=V.current;if(t||n){let n=B??null;if(g===n){V.current=!1;return}let i=te;r?i=b:t&&(i=Ee),e(n,i);return}r&&z!=null&&(N(g,b),V.current=!1)},[B,v,N,z,_,y,g]);let re=o(`div`,e,{state:{orientation:a,tabActivationDirection:O},ref:t,props:u,stateAttributesMapping:Yn});return(0,$.jsx)(Kn.Provider,{value:R,children:(0,$.jsx)(ht,{elementsRef:f,children:re})})});function Zn(e,t,n,r){if(e==null||t==null)return`none`;let i=null,a=null;for(let[n,o]of r.entries()){if(o==null)continue;let r=o.value??o.index;if(e===r&&(i=n),t===r&&(a=n),i!=null&&a!=null)break}if(i==null||a==null)return i!==a&&(typeof e==`number`||typeof e==`string`)&&typeof e==typeof t?n===`horizontal`?t>e?`right`:`left`:t>e?`down`:`up`:`none`;let o=i.getBoundingClientRect(),s=a.getBoundingClientRect();if(n===`horizontal`){if(s.left<o.left)return`left`;if(s.left>o.left)return`right`}else{if(s.top<o.top)return`up`;if(s.top>o.top)return`down`}return`none`}var Qn=`data-composite-item-active`,$n=Q.createContext(void 0);function er(){let e=Q.useContext($n);if(e===void 0)throw Error(u(65));return e}var tr=Q.forwardRef(function(e,t){let{className:n,disabled:r=!1,render:i,value:a,id:s,nativeButton:c=!0,style:l,...u}=e,{value:d,getTabPanelIdByValue:f,orientation:p,tabActivationDirection:h}=qn(),{activateOnFocus:g,highlightedTabIndex:_,onTabActivation:v,registerTabResizeObserverElement:y,setHighlightedTabIndex:b,tabsListElement:S}=er(),C=ve(s),{compositeProps:T,compositeRef:E,index:D}=tn({metadata:Q.useMemo(()=>({disabled:r,id:C,value:a}),[r,C,a])}),O=a===d,k=Q.useRef(!1),A=Q.useRef(null);W(()=>{let e=A.current;if(e)return y(e)},[y]),W(()=>{if(k.current){k.current=!1;return}if(!(O&&D>-1&&_!==D))return;let e=S;if(e!=null){let t=x(U(e));if(t&&w(e,t))return}r||b(D)},[O,D,_,b,r,S]);let{getButtonProps:j,buttonRef:M}=Ae({disabled:r,native:c,focusableWhenDisabled:!0}),N=f(a),P=Q.useRef(!1),F=Q.useRef(!1);function I(e){O||r||v(a,m(We,e.nativeEvent,void 0,{activationDirection:`none`}))}function ee(e){O||(D>-1&&!r&&b(D),!r&&g&&(!P.current||P.current&&F.current)&&v(a,m(We,e.nativeEvent,void 0,{activationDirection:`none`})))}function L(e){if(O||r)return;P.current=!0;function t(){P.current=!1,F.current=!1}(!e.button||e.button===0)&&(F.current=!0,U(e.currentTarget).addEventListener(`pointerup`,t,{once:!0}))}return o(`button`,e,{state:{disabled:r,active:O,orientation:p,tabActivationDirection:h},ref:[t,M,E,A],props:[T,{role:`tab`,"aria-controls":N,"aria-selected":O,id:C,onClick:I,onFocus:ee,onPointerDown:L,[Qn]:O?``:void 0,onKeyDownCapture(){k.current=!0}},u,j],stateAttributesMapping:Yn})}),nr=Me();function rr(){return s}function ir(){return!1}function ar(){return!0}function or(){return(0,nr.useSyncExternalStore)(rr,ir,ar)}var sr=function(e){return e.activeTabLeft=`--active-tab-left`,e.activeTabRight=`--active-tab-right`,e.activeTabTop=`--active-tab-top`,e.activeTabBottom=`--active-tab-bottom`,e.activeTabWidth=`--active-tab-width`,e.activeTabHeight=`--active-tab-height`,e}({}),cr={...Yn,activeTabPosition:()=>null,activeTabSize:()=>null},lr=Q.forwardRef(function(e,t){let{className:n,render:r,renderBeforeHydration:i=!1,style:a,...s}=e,{nonce:c}=Fe(),{getTabElementBySelectedValue:l,orientation:u,tabActivationDirection:d,value:f}=qn(),{tabsListElement:p,registerIndicatorUpdateListener:m}=er(),h=or(),g=Nn();Q.useEffect(()=>m(g),[m,g]);let _=0,v=0,y=0,b=0,x=0,S=0,C=!1;if(f!=null&&p!=null){let e=l(f);if(e!=null){C=!0;let{width:t,height:n}=Pn(e),{width:r,height:i}=Pn(p),a=e.getBoundingClientRect(),o=p.getBoundingClientRect(),s=r>0?o.width/r:1,c=i>0?o.height/i:1;if(Math.abs(s)>2**-52&&Math.abs(c)>2**-52){let e=a.left-o.left,t=a.top-o.top;_=e/s+p.scrollLeft-p.clientLeft,y=t/c+p.scrollTop-p.clientTop}else _=e.offsetLeft,y=e.offsetTop;x=t,S=n,v=p.scrollWidth-_-x,b=p.scrollHeight-y-S}}let w=C?{left:_,right:v,top:y,bottom:b}:null,T=C?{width:x,height:S}:null,E=C?{[sr.activeTabLeft]:`${_}px`,[sr.activeTabRight]:`${v}px`,[sr.activeTabTop]:`${y}px`,[sr.activeTabBottom]:`${b}px`,[sr.activeTabWidth]:`${x}px`,[sr.activeTabHeight]:`${S}px`}:void 0,D=o(`span`,e,{state:{orientation:u,activeTabPosition:w,activeTabSize:T,tabActivationDirection:d},ref:t,props:[{role:`presentation`,style:E,hidden:!(C&&x>0&&S>0)},s,{suppressHydrationWarning:!0}],stateAttributesMapping:cr});return f==null?null:(0,$.jsxs)(Q.Fragment,{children:[D,h&&i&&(0,$.jsx)(`script`,{nonce:c,dangerouslySetInnerHTML:{__html:'!function(){const t=document.currentScript.previousElementSibling;if(!t)return;const e=t.closest(\'[role="tablist"]\');if(!e)return;const i=e.querySelector("[data-active]");if(!i)return;if(0===i.offsetWidth||0===e.offsetWidth)return;let o=0,n=0,h=0,l=0,r=0,f=0;function s(t){const e=getComputedStyle(t);let i=parseFloat(e.width)||0,o=parseFloat(e.height)||0;return(Math.round(i)!==t.offsetWidth||Math.round(o)!==t.offsetHeight)&&(i=t.offsetWidth,o=t.offsetHeight),{width:i,height:o}}if(null!=i&&null!=e){const{width:t,height:c}=s(i),{width:u,height:d}=s(e),a=i.getBoundingClientRect(),g=e.getBoundingClientRect(),p=u>0?g.width/u:1,b=d>0?g.height/d:1;if(Math.abs(p)>Number.EPSILON&&Math.abs(b)>Number.EPSILON){const t=a.left-g.left,i=a.top-g.top;o=t/p+e.scrollLeft-e.clientLeft,h=i/b+e.scrollTop-e.clientTop}else o=i.offsetLeft,h=i.offsetTop;r=t,f=c,n=e.scrollWidth-o-r,l=e.scrollHeight-h-f}function c(e,i){t.style.setProperty(`--active-tab-${e}`,`${i}px`)}c("left",o),c("right",n),c("top",h),c("bottom",l),c("width",r),c("height",f),r>0&&f>0&&t.removeAttribute("hidden")}();'},suppressHydrationWarning:!0})]})}),ur=function(e){return e.index=`data-index`,e.activationDirection=`data-activation-direction`,e.orientation=`data-orientation`,e.hidden=`data-hidden`,e[e.startingStyle=ie.startingStyle]=`startingStyle`,e[e.endingStyle=ie.endingStyle]=`endingStyle`,e}({}),dr={...Yn,...le},fr=Q.forwardRef(function(e,t){let{className:n,value:r,render:i,keepMounted:a=!1,style:s,...c}=e,{value:l,getTabIdByPanelValue:u,orientation:d,tabActivationDirection:f,registerMountedTabPanel:p,unregisterMountedTabPanel:m}=qn(),h=ve(),{ref:g,index:_}=wt({metadata:Q.useMemo(()=>({id:h,value:r}),[h,r])}),v=r===l,{mounted:y,transitionStatus:b,setMounted:x}=ae(v),S=!y,C=u(r),w={hidden:S,orientation:d,tabActivationDirection:f,transitionStatus:b},T=Q.useRef(null),E=o(`div`,e,{state:w,ref:[t,g,T],props:[{"aria-labelledby":C,hidden:S,id:h,role:`tabpanel`,tabIndex:v?0:-1,inert:je(!v),[ur.index]:_},c],stateAttributesMapping:dr});return D({open:v,ref:T,onComplete(){v||x(!1)}}),W(()=>{if(!(S&&!a)&&h!=null)return p(r,h),()=>{m(r,h)}},[S,a,r,h,p,m]),a||y?E:null}),pr=[];function mr(e){let{loopFocus:t=!0,orientation:n=`both`,grid:i,onLoop:a,direction:o,highlightedIndex:s,onHighlightedIndexChange:c,rootRef:l,enableHomeAndEndKeys:u=!1,stopEventPropagation:d=!1,disabledIndices:f,modifierKeys:p=pr}=e,[m,h]=Q.useState(0),g=i!=null,y=Q.useRef(null),b=r(y,l),x=Q.useRef([]),S=Q.useRef(!1),C=s??m,w=G((e,t=!1)=>{if((c??h)(e),t){let t=x.current[e];_(y.current,t,o,n)}}),T=G(e=>{if(e.size===0||S.current)return;S.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?t.indexOf(r):-1;if(i!==-1)w(i);else if(Ve(t,C,f)){let e=Se(t,{disabledIndices:f});me(t,e)||w(e)}_(y.current,r,o,n)});W(()=>{if(f==null||s!=null||!S.current)return;let e=x.current;if(Ve(e,C,f)){let t=Se(e,{disabledIndices:f});me(e,t)||w(t)}},[f,s,C,x,w]);let E=G((e,t,n)=>a?a(e,t,n,x):n),D=G(e=>{let r=u?He:Ce;if(!r.has(e.key)||hr(e,p)||!y.current)return;let s=o===`rtl`,c=s?xe:de,l={horizontal:c,vertical:Oe,both:c}[n],m=s?de:xe,h={horizontal:m,vertical:Le,both:m}[n],_=A(e.nativeEvent);if(_!=null&&v(_)&&!St(_)){let t=_.selectionStart,n=_.selectionEnd,r=_.value??``;if(t==null||e.shiftKey||t!==n||e.key!==h&&t<r.length||e.key!==l&&t>0)return}let b=C,S=Re(x,f),T=fe(x,f);i!=null&&(b=i({disabledIndices:f,elementsRef:x,event:e,highlightedIndex:C,loopFocus:t,maxIndex:T,minIndex:S,onLoop:E,orientation:n,rtl:s}));let D={horizontal:[c],vertical:[Oe],both:[c,Oe]}[n],O={horizontal:[m],vertical:[Le],both:[m,Le]}[n],k=g?r:{horizontal:u?z:Be,vertical:u?H:ze,both:r}[n];u&&(e.key===`Home`?b=S:e.key===`End`&&(b=T)),b===C&&(D.includes(e.key)||O.includes(e.key))&&(t&&b===T&&D.includes(e.key)?(b=S,a&&(b=a(e,C,b,x))):t&&b===S&&O.includes(e.key)?(b=T,a&&(b=a(e,C,b,x))):b=Se(x.current,{startingIndex:b,decrement:O.includes(e.key),disabledIndices:f})),b!==C&&!me(x.current,b)&&(d&&e.stopPropagation(),k.has(e.key)&&e.preventDefault(),w(b,!0),queueMicrotask(()=>{x.current[b]?.focus()}))});return{props:{ref:b,onFocus(e){let t=y.current,n=A(e.nativeEvent);!t||n==null||!v(n)||n.setSelectionRange(0,n.value.length??0)},onKeyDown:D},highlightedIndex:C,onHighlightedIndexChange:w,elementsRef:x,disabledIndices:f,onMapChange:T,relayKeyboardEvent:D}}function hr(e,t){for(let n of g.values())if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function gr(e){let{render:t,className:r,style:i,refs:a=d,props:s=d,state:c=n,stateAttributesMapping:l,highlightedIndex:u,onHighlightedIndexChange:f,orientation:p,grid:m,loopFocus:h,onLoop:g,enableHomeAndEndKeys:_,onMapChange:v,stopEventPropagation:y=!0,rootRef:b,disabledIndices:x,modifierKeys:S,highlightItemOnHover:C=!1,tag:w=`div`,...T}=e,{props:E,highlightedIndex:D,onHighlightedIndexChange:O,elementsRef:k,onMapChange:A,relayKeyboardEvent:j}=mr({grid:m,loopFocus:h,onLoop:g,orientation:p,highlightedIndex:u,onHighlightedIndexChange:f,rootRef:b,stopEventPropagation:y,enableHomeAndEndKeys:_,direction:be(),disabledIndices:x,modifierKeys:S}),M=o(w,e,{state:c,ref:a,props:[E,...s,T],stateAttributesMapping:l}),N=Q.useMemo(()=>({highlightedIndex:D,onHighlightedIndexChange:O,highlightItemOnHover:C,relayKeyboardEvent:j}),[D,O,C,j]);return(0,$.jsx)(Pe.Provider,{value:N,children:(0,$.jsx)(ht,{elementsRef:k,onMapChange:e=>{v?.(e),A(e)},children:M})})}var _r=Q.forwardRef(function(e,t){let{activateOnFocus:n=!1,className:r,loopFocus:i=!0,render:a,style:o,...s}=e,{onValueChange:c,orientation:l,value:u,setTabMap:f,tabActivationDirection:p}=qn(),[m,h]=Q.useState(0),[g,_]=Q.useState(null),v=Q.useRef(new Set),y=Q.useRef(new Set),b=Q.useRef(null);W(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{v.current.forEach(e=>{e()})});return b.current=e,g&&e.observe(g),y.current.forEach(t=>{e.observe(t)}),()=>{e.disconnect(),b.current=null}},[g]);let x=G(e=>(v.current.add(e),()=>{v.current.delete(e)})),S=G(e=>(y.current.add(e),b.current?.observe(e),()=>{y.current.delete(e),b.current?.unobserve(e)})),C=G((e,t)=>{e!==u&&c(e,t)}),w={orientation:l,tabActivationDirection:p},T={"aria-orientation":l===`vertical`?`vertical`:void 0,role:`tablist`},E=Q.useMemo(()=>({activateOnFocus:n,highlightedTabIndex:m,registerIndicatorUpdateListener:x,registerTabResizeObserverElement:S,onTabActivation:C,setHighlightedTabIndex:h,tabsListElement:g}),[n,m,x,S,C,h,g]);return(0,$.jsx)($n.Provider,{value:E,children:(0,$.jsx)(gr,{render:a,className:r,style:o,state:w,refs:[t,_],props:[T,s],stateAttributesMapping:Yn,highlightedIndex:m,enableHomeAndEndKeys:!0,loopFocus:i,orientation:l,onHighlightedIndexChange:h,onMapChange:f,disabledIndices:d})})});function vr({className:e,...t}){return(0,$.jsx)(Xn,{className:c(`flex flex-col gap-4`,e),"data-slot":`tabs`,...t})}function yr({className:e,...t}){return(0,$.jsxs)(_r,{className:c(`relative z-0 flex w-fit items-center gap-1 rounded-lg bg-muted p-1`,e),"data-slot":`tabs-list`,...t,children:[t.children,(0,$.jsx)(lr,{className:`absolute top-1/2 left-0 z-[-1] h-[calc(100%-0.5rem)] w-(--active-tab-width) -translate-y-1/2 translate-x-(--active-tab-left) rounded-md bg-background shadow-xs transition-all duration-150`,"data-slot":`tabs-indicator`})]})}function br({className:e,...t}){return(0,$.jsx)(tr,{className:c(`flex h-7 cursor-pointer items-center justify-center whitespace-nowrap rounded-md border border-transparent px-2.5 font-medium text-muted-foreground text-sm outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring data-selected:text-foreground`,e),"data-slot":`tabs-tab`,...t})}function xr({className:e,...t}){return(0,$.jsx)(fr,{className:c(`flex-1 outline-none`,e),"data-slot":`tabs-panel`,...t})}var Sr=Q.createContext(void 0);function Cr(e){let t=Q.useContext(Sr);if(t===void 0&&!e)throw Error(u(47));return t}function wr(){return{...ut(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}var Tr={...lt,disabled:T(e=>e.disabled),instantType:T(e=>e.instantType),openMethod:T(e=>e.openMethod),openChangeReason:T(e=>e.openChangeReason),modal:T(e=>e.modal),focusManagerModal:T(e=>e.focusManagerModal),stickIfOpen:T(e=>e.stickIfOpen),titleElementId:T(e=>e.titleElementId),descriptionElementId:T(e=>e.descriptionElementId),openOnHover:T(e=>e.openOnHover),closeDelay:T(e=>e.closeDelay),hasViewport:T(e=>e.hasViewport)},Er=class e extends S{constructor(e,t,n=!1){let r={...wr(),...e},i=new N;r.open&&e?.mounted===void 0&&(r.mounted=!0),r.floatingRootContext=ct(i,t,n),super(r,{popupRef:Q.createRef(),backdropRef:Q.createRef(),internalBackdropRef:Q.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:Q.createRef(),beforeContentFocusGuardRef:Q.createRef(),stickIfOpenTimeout:new O,triggerElements:i},Tr)}setOpen=(e,t)=>{let n=t.reason===ne,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=h(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n={open:e,openChangeReason:t.reason};j(n,e,t.trigger,a()),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),Bn.flushSync(s)):s(),r||i?this.set(`instantType`,r?`click`:`dismiss`):t.reason===`focus-out`?this.set(`instantType`,`focus`):this.set(`instantType`,void 0)};static useStore(t,n){let{store:r,internalStore:i}=R(t,(t,r)=>new e(n,t,r));return Q.useEffect(()=>i?.disposeEffect(),[i]),r}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()};function Dr({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=Er.useStore(s?.store,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});F(u,n,r,l),u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`),h=Ie()!=null;u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),k(u,d),M(u);let{forceUnmount:g}=y(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});u.useSyncedValues({modal:o,nested:h}),Q.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);let _=Q.useCallback(()=>{u.setOpen(!1,m(I))},[u]);Q.useImperativeHandle(e.actionsRef,()=>({unmount:g,close:_}),[g,_]);let v=d||f,b=Q.useMemo(()=>({store:u}),[u]);return(0,$.jsxs)(Sr.Provider,{value:b,children:[v&&(0,$.jsx)(kr,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})}function Or(e){return Cr(!0)?(0,$.jsx)(Dr,{props:e}):(0,$.jsx)(p,{children:(0,$.jsx)(Dr,{props:e})})}function kr({store:e,modal:t}){let r=re(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}});return C(e,{activeTriggerProps:r.reference??n,inactiveTriggerProps:r.trigger??n,popupProps:Q.useMemo(()=>l(De,r.floating),[r.floating])}),null}var Ar=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:s=!0,handle:c,payload:l,openOnHover:d=!1,delay:f=300,closeDelay:p=0,id:m,...h}=e,g=Cr(!0),_=c?.store??g?.store;if(!_)throw Error(u(74));let v=ve(m),y=_.useState(`isTriggerActive`,v),b=_.useState(`floatingRootContext`),x=_.useState(`isOpenedByTrigger`,v),S=_.useState(`triggerPopupId`,v),C=Q.useRef(null),{registerTrigger:w,isMountedByThisTrigger:T}=Ue(v,C,_,{payload:l,disabled:a,openOnHover:d,closeDelay:p}),D=_.useState(`openChangeReason`),O=_.useState(`stickIfOpen`),k=_.useState(`openMethod`),A=_.useState(`focusManagerModal`),j=Zt(b,{enabled:!a&&b!=null&&d&&(k!==`touch`||D!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:Qt(),restMs:f,delay:{close:p},triggerElementRef:C,isActiveTrigger:y,isClosing:()=>_.select(`transitionStatus`)===`ending`}),M=pt(b,{enabled:b!=null,stickIfOpen:O}),N=mt(()=>_.select(`open`),e=>{_.set(`openMethod`,e)}),P=_.useState(`triggerProps`,T),{getButtonProps:F,buttonRef:I}=Ae({disabled:a,native:s}),ee={open(e){return e&&D===`trigger-press`?E.open(e):oe.open(e)}},{preFocusGuardRef:L,handlePreFocusGuardFocus:R,handleFocusTargetFocus:te}=an(_,C),z=o(`button`,e,{state:{disabled:a,open:x},ref:[I,t,w,C],props:[M.reference,j,P,N,{[pe]:``,id:v,"aria-haspopup":`dialog`,"aria-expanded":x,"aria-controls":S},h,F],stateAttributesMapping:ee});return T&&!A?(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(V,{ref:L,onFocus:R}),(0,$.jsx)(Q.Fragment,{children:z},v),(0,$.jsx)(V,{ref:_.context.triggerFocusTargetRef,onFocus:te})]}):(0,$.jsx)(Q.Fragment,{children:z},v)}),jr=Q.createContext(void 0);function Mr(){let e=Q.useContext(jr);if(e===void 0)throw Error(u(45));return e}var Nr=Q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Cr();return i.useState(`mounted`)||n?(0,$.jsx)(jr.Provider,{value:n,children:(0,$.jsx)(we,{ref:t,...r})}):null}),Pr=Q.createContext(void 0);function Fr(){let e=Q.useContext(Pr);if(!e)throw Error(u(46));return e}var Ir=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o=`absolute`,side:s=`bottom`,align:c=`center`,sideOffset:l=0,alignOffset:u=0,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:h=!1,collisionAvoidance:g=he,..._}=e,{store:v}=Cr(),y=Mr(),b=ye(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`positionerElement`),k=v.useState(`instantType`),A=v.useState(`transitionStatus`),j=v.useState(`hasViewport`),M=Q.useRef(null),N=se(O,!1,!1),P=vt({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:j?Ct:void 0}),F=x.useState(`domReferenceElement`);W(()=>{let e=F,t=M.current;if(e&&(M.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return N(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[F,N,v]),bt(C&&E===!0&&w!==`trigger-hover`,D===`touch`,O,T);let I=Q.useCallback(e=>{v.set(`positionerElement`,e)},[v]),L=xt(e,{open:C,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:k},{styles:P.positionerStyles,transitionStatus:A,props:_,refs:[t,I],hidden:!S,inert:!C});return(0,$.jsxs)(Pr.Provider,{value:P,children:[S&&E===!0&&w!==`trigger-hover`&&(0,$.jsx)(ge,{ref:v.context.internalBackdropRef,inert:je(!C),cutout:T}),(0,$.jsx)(ee,{id:b,children:L})]})}),Lr=Q.createContext(void 0);function Rr(){let[e,t]=Q.useState(0),n=G(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:Q.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function zr(e){let{value:t,children:n}=e;return(0,$.jsx)(Lr.Provider,{value:t,children:n})}var Br={...Ne,...le},Vr=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:s,...c}=e,{store:l}=Cr(),u=Fr(),d=_t(!0)!=null,{context:f,hasClosePart:p}=Rr(),m=l.useState(`open`),h=l.useState(`openMethod`),g=l.useState(`instantType`),_=l.useState(`transitionStatus`),v=l.useState(`popupProps`),y=l.useState(`titleElementId`),b=l.useState(`descriptionElementId`),x=l.useState(`modal`),S=l.useState(`mounted`),C=l.useState(`openChangeReason`),w=l.useState(`activeTriggerElement`),T=l.useState(`floatingRootContext`),E=T.useState(`floatingId`),O=l.useState(`disabled`),k=l.useState(`openOnHover`),A=l.useState(`closeDelay`),j=c.id??E;D({open:m,ref:l.context.popupRef,onComplete(){m&&l.context.onOpenChangeComplete?.(!0)}}),Gt(T,{enabled:k&&!O,closeDelay:A});let M=a===void 0?Te(l.context.popupRef):a,N=x!==!1&&p;l.useSyncedValue(`focusManagerModal`,N);let P=Q.useCallback(e=>{l.set(`popupElement`,e)},[l]),F=o(`div`,e,{state:{open:m,side:u.side,align:u.align,instant:g,transitionStatus:_},ref:[t,l.context.popupRef,P],props:[v,{id:j,role:`dialog`,...De,"aria-labelledby":y,"aria-describedby":b,onKeyDown(e){d&&He.has(e.key)&&e.stopPropagation()}},gt(_),c],stateAttributesMapping:Br});return(0,$.jsx)(ce,{context:T,openInteractionType:h,modal:N,disabled:!S||C===`trigger-hover`,initialFocus:M,returnFocus:s,restoreFocus:`popup`,previousFocusableElement:B(w)?w:void 0,nextFocusableElement:l.context.triggerFocusTargetRef,beforeContentFocusGuardRef:l.context.beforeContentFocusGuardRef,children:(0,$.jsx)(zr,{value:f,children:F})})}),Hr=function(e){return e.popupWidth=`--popup-width`,e.popupHeight=`--popup-height`,e}({}),Ur={activationDirection:e=>e?{"data-activation-direction":e}:null},Wr=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...s}=e,{store:c}=Cr(),{side:l}=Fr(),u=c.useState(`instantType`),{children:d,state:f}=Vn({store:c,side:l,cssVars:Hr,children:a});return o(`div`,e,{state:{activationDirection:f.activationDirection,transitioning:f.transitioning,instant:u},ref:t,props:[s,{children:d}],stateAttributesMapping:Ur})}),Gr=Or;function Kr({className:e,children:t,...n}){return(0,$.jsx)(Ar,{className:e,"data-slot":`popover-trigger`,...n,children:t})}function qr({children:e,className:t,viewportClassName:n,side:r=`bottom`,align:i=`center`,sideOffset:a=4,alignOffset:o=0,tooltipStyle:s=!1,anchor:l,...u}){return(0,$.jsx)(Nr,{children:(0,$.jsx)(Ir,{align:i,alignOffset:o,anchor:l,className:`z-50 h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) transition-[top,left,right,bottom,transform] data-instant:transition-none`,"data-slot":`popover-positioner`,side:r,sideOffset:a,children:(0,$.jsx)(Vr,{className:c(`relative flex h-(--popup-height,auto) w-(--popup-width,auto) origin-(--transform-origin) rounded-lg border bg-popover not-dark:bg-clip-padding text-popover-foreground shadow-lg/5 outline-none transition-[width,height,scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] has-data-[slot=calendar]:rounded-xl has-data-[slot=calendar]:before:rounded-[calc(var(--radius-xl)-1px)] data-starting-style:scale-98 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,s&&`w-fit text-balance rounded-md text-xs shadow-md/5 before:rounded-[calc(var(--radius-md)-1px)]`,t),"data-slot":`popover-popup`,...u,children:(0,$.jsx)(Wr,{className:c(`relative size-full max-h-(--available-height) overflow-clip px-(--viewport-inline-padding) py-4 [--viewport-inline-padding:--spacing(4)] has-data-[slot=calendar]:p-2 data-instant:transition-none **:data-current:data-ending-style:opacity-0 **:data-current:data-starting-style:opacity-0 **:data-previous:data-ending-style:opacity-0 **:data-previous:data-starting-style:opacity-0 **:data-current:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-current:opacity-100 **:data-previous:opacity-100 **:data-current:transition-opacity **:data-previous:transition-opacity`,s?`py-1 [--viewport-inline-padding:--spacing(2)]`:`not-data-transitioning:overflow-y-auto`,n),"data-slot":`popover-viewport`,children:e})})})})}function Jr({repos:e,disabled:t,onAdd:n}){let[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(``),s=(0,Q.useMemo)(()=>{let t=a.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)):e},[e,a]);return(0,$.jsxs)(Gr,{open:r,onOpenChange:e=>{e&&o(``),i(e)},children:[(0,$.jsx)(Kr,{render:(0,$.jsxs)(f,{variant:`outline`,size:`sm`,disabled:t,className:`h-8 text-xs text-muted-foreground`,children:[(0,$.jsx)(kt,{size:14}),` Add repository`]})}),(0,$.jsxs)(qr,{align:`end`,className:`w-[320px]`,viewportClassName:`p-0`,children:[(0,$.jsx)(`div`,{className:`border-b border-border p-2`,children:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(ot,{className:`absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(ke,{autoFocus:!0,value:a,onChange:e=>o(e.target.value),placeholder:`Search repositories`,className:`pl-8`,"aria-label":`Search repositories`})]})}),(0,$.jsx)(`div`,{role:`listbox`,className:`max-h-64 overflow-y-auto py-1`,children:s.length===0?(0,$.jsx)(`div`,{className:`px-3 py-4 text-center text-sm text-muted-foreground`,children:`No repositories found.`}):s.map(e=>(0,$.jsxs)(`button`,{role:`option`,"aria-selected":!1,onClick:()=>{i(!1),n(e.path)},className:`flex w-full cursor-pointer items-center gap-3 px-3 py-2 text-left transition-colors hover:bg-accent`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:e.name}),(0,$.jsx)(`span`,{className:`block truncate font-mono text-xs text-muted-foreground`,children:e.path})]}),(0,$.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:e.defaultBranch})]},e.path))})]})]})}var Yr=(e,t)=>{switch(e){case`antigravity`:return`agy --conversation ${t}`;case`claude`:return`claude --resume ${t}`;case`codex`:return`codex resume ${t}`;case`copilot`:return`copilot --resume ${t}`;default:return`agy --conversation ${t}`}},Xr=e=>{switch(e){case`antigravity`:return(0,$.jsx)(`span`,{className:`grid size-5.5 place-items-center rounded-md bg-card border border-border/80 shadow-2xs p-0.5 shrink-0`,title:`Google Antigravity`,children:(0,$.jsx)(ln,{className:`size-3.5`})});case`claude`:return(0,$.jsx)(`span`,{className:`grid size-5.5 place-items-center rounded-md bg-[#D97757] text-white font-bold text-[9px] shadow-2xs shrink-0`,title:`Claude Code`,children:(0,$.jsx)(fn,{className:`size-2.5`})});case`codex`:return(0,$.jsx)(`span`,{className:`grid size-5.5 place-items-center rounded-md bg-foreground text-background font-bold text-[9px] shadow-2xs shrink-0`,title:`OpenAI Codex`,children:(0,$.jsx)(Lt,{className:`size-2.5`})});case`copilot`:return(0,$.jsx)(`span`,{className:`grid size-5.5 place-items-center rounded-md bg-gradient-to-tr from-purple-600 via-indigo-500 to-blue-600 text-white font-bold text-[9px] shadow-2xs shrink-0`,title:`GitHub Copilot`,children:(0,$.jsx)(dn,{className:`size-2.5`})});default:return null}},Zr=e=>{if(!e)return``;let t=new Date(e);return isNaN(t.getTime())?``:new Date().toDateString()===t.toDateString()?`Today ${t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}`:`${t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})} ${t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}`},Qr=({ws:e,sessions:t,sessionsLoading:n,setActiveSession:r,setTranscript:i,fetchSessionTranscript:a,handleOpenDesktopSession:o,showToast:s})=>{let l=sn(),u=Vt(),d=Pt(),p=d.data?.find(e=>e.name===`antigravity`)?.detected??!0,m=d.data?.find(e=>e.name===`claude`)?.detected??!1,h=d.data?.find(e=>e.name===`codex`)?.detected??!1,g=d.data?.find(e=>e.name===`copilot`)?.detected??!1,_=!!l.data?.some(e=>e.id===`antigravity`&&e.available),v=!!l.data?.some(e=>e.id===`codex-desktop`&&e.available),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(`created-desc`),[k,A]=(0,Q.useState)(`harness`),[j,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(`all`),[F,I]=(0,Q.useState)({antigravity:!1,claude:!1,codex:!1,copilot:!1}),ee=e=>{I(t=>({...t,[e]:!t[e]}))},L=(0,Q.useRef)(!1),R=(0,Q.useRef)(null),te=async t=>{try{await qt(`/api/workspace/${encodeURIComponent(e.branchName)}/launch`,{method:`POST`,body:JSON.stringify({targetId:t})}),s?.(`Launched ${t===`claude-desktop`?`Claude Desktop`:t===`codex-desktop`?`Codex Desktop`:t} for workspace ${e.branchName}`,`success`)}catch(e){let t=e instanceof Error?e.message:`Failed to launch desktop application`;s?.(t,`error`)}},z=async t=>{if(!C){w(t);try{await u.mutateAsync({workspaceId:e.branchName,assistant:t}),E({assistant:t,cmd:t===`antigravity`?`agy`:t===`claude`?`claude`:t===`codex`?`codex`:`copilot`,timestamp:new Date}),s?.(`Started new ${t} session in terminal`,`success`)}catch(e){let t=e instanceof Error?e.message:`Failed to launch terminal`;s?.(t,`error`)}finally{w(null)}}},B=async(t,n)=>{if(!L.current){L.current=!0,S(t);try{await u.mutateAsync({workspaceId:e.branchName,sessionId:t,assistant:n});let r=Yr(n,t);E({assistant:n,cmd:r,timestamp:new Date}),s?.(`Resumed ${n} session in terminal`,`success`)}catch{let e=Yr(n,t);await cn(e),s?.(`Copied resume command to clipboard: ${e}`,`info`)}finally{S(null),L.current=!1}}},V=async t=>{if(!(!v||R.current)){R.current=t,b(t);try{await o(e,t,`codex`)}finally{R.current=null,b(null)}}},H=(e,t)=>[...e].sort((e,n)=>{switch(t){case`created-desc`:{let t=new Date(e.createdAt||e.updatedAt||0).getTime();return new Date(n.createdAt||n.updatedAt||0).getTime()-t}case`created-asc`:return new Date(e.createdAt||e.updatedAt||0).getTime()-new Date(n.createdAt||n.updatedAt||0).getTime();case`updated-desc`:{let t=new Date(e.updatedAt||e.createdAt||0).getTime();return new Date(n.updatedAt||n.createdAt||0).getTime()-t}case`messages-desc`:return(n.messageCount||0)-(e.messageCount||0);case`title-asc`:return(e.title||``).localeCompare(n.title||``);default:return 0}}),U=(0,Q.useMemo)(()=>{let e=t;if(N!==`all`&&(e=e.filter(e=>e.assistant===N)),j.trim()){let t=j.toLowerCase();e=e.filter(e=>`${e.title} ${e.id} ${e.assistant}`.toLowerCase().includes(t))}return H(e,D)},[t,N,j,D]),ne=(0,Q.useMemo)(()=>H(t.filter(e=>e.assistant===`antigravity`),D),[t,D]),re=(0,Q.useMemo)(()=>H(t.filter(e=>e.assistant===`claude`),D),[t,D]),ie=(0,Q.useMemo)(()=>H(t.filter(e=>e.assistant===`codex`),D),[t,D]),ae=(0,Q.useMemo)(()=>H(t.filter(e=>e.assistant===`copilot`),D),[t,D]),oe=t=>e.assistants?.includes(t)??!1,se=[{id:`antigravity`,name:`Google Antigravity`,cliCommand:`agy`,isDetected:p,isConfigured:oe(`antigravity`),hasApp:_,appName:`IDE`,appTargetId:`antigravity`,sessions:ne,icon:(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-card border border-border/80 shadow-2xs p-0.5`,children:(0,$.jsx)(ln,{className:`size-4`})})},{id:`claude`,name:`Claude Code`,cliCommand:`claude`,isDetected:m,isConfigured:oe(`claude`),hasApp:!1,appName:`App`,appTargetId:`claude`,sessions:re,icon:(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-[#D97757] text-white font-bold text-[10px] shadow-2xs`,children:(0,$.jsx)(fn,{className:`size-3`})})},{id:`codex`,name:`OpenAI Codex`,cliCommand:`codex`,isDetected:h,isConfigured:oe(`codex`),hasApp:v,appName:`Desktop`,appTargetId:`codex-desktop`,sessions:ie,icon:(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-foreground text-background font-bold text-[10px] shadow-2xs`,children:(0,$.jsx)(Lt,{className:`size-3`})})},{id:`copilot`,name:`GitHub Copilot`,cliCommand:`copilot`,isDetected:g,isConfigured:oe(`copilot`),hasApp:!1,appName:`App`,appTargetId:`copilot`,sessions:ae,icon:(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-gradient-to-tr from-purple-600 via-indigo-500 to-blue-600 text-white font-bold text-[10px] shadow-2xs`,children:(0,$.jsx)(dn,{className:`size-3`})})}];return(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between bg-card/60 p-2 rounded-md border border-border/80`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`relative flex-1 min-w-0 max-w-xs`,children:[(0,$.jsx)(ot,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 size-3 text-muted-foreground`}),(0,$.jsx)(`input`,{type:`text`,value:j,onChange:e=>M(e.target.value),placeholder:`Search chat sessions...`,className:`w-full pl-7 pr-6 py-1 text-xs rounded border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:border-primary`}),j&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>M(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground text-[10px] cursor-pointer`,children:`✕`})]}),(0,$.jsxs)(`div`,{className:`hidden md:flex items-center gap-1`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>P(`all`),className:c(`px-2 py-0.5 text-[11px] rounded font-medium transition-colors cursor-pointer`,N===`all`?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`bg-muted/60 text-muted-foreground hover:text-foreground hover:bg-muted`),children:[`All (`,t.length,`)`]}),[`antigravity`,`claude`,`codex`,`copilot`].map(e=>{let n=t.filter(t=>t.assistant===e).length;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>P(N===e?`all`:e),className:c(`px-2 py-0.5 text-[11px] rounded font-medium capitalize transition-colors cursor-pointer`,N===e?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`bg-muted/60 text-muted-foreground hover:text-foreground hover:bg-muted`),children:[e,` (`,n,`)`]},e)})]}),n&&(0,$.jsx)(`span`,{className:`flex items-center gap-1 text-xs text-muted-foreground shrink-0 pl-1`,children:(0,$.jsx)(q,{className:`size-3`})})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,$.jsxs)(en,{children:[(0,$.jsxs)(Xt,{className:`flex items-center gap-1.5 px-2 py-1 text-xs font-medium rounded border border-border bg-card text-foreground hover:bg-accent cursor-pointer shadow-2xs transition-colors`,children:[(0,$.jsx)(Wt,{size:11,className:`text-muted-foreground`}),(0,$.jsx)(`span`,{children:{"created-desc":`Newest`,"created-asc":`Oldest`,"updated-desc":`Recently active`,"messages-desc":`Most turns`,"title-asc":`A–Z`}[D]}),(0,$.jsx)(Ke,{size:10,className:`text-muted-foreground opacity-70`})]}),(0,$.jsxs)(Jt,{align:`end`,className:`w-48`,children:[(0,$.jsx)(`div`,{className:`px-2 py-1 text-[10px] font-semibold text-muted-foreground uppercase tracking-wider`,children:`Order Chats By`}),(0,$.jsxs)(X,{onClick:()=>O(`created-desc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Newest created`}),D===`created-desc`&&(0,$.jsx)(K,{size:12,className:`text-primary`})]}),(0,$.jsxs)(X,{onClick:()=>O(`created-asc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Oldest created`}),D===`created-asc`&&(0,$.jsx)(K,{size:12,className:`text-primary`})]}),(0,$.jsxs)(X,{onClick:()=>O(`updated-desc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Recently active`}),D===`updated-desc`&&(0,$.jsx)(K,{size:12,className:`text-primary`})]}),(0,$.jsxs)(X,{onClick:()=>O(`messages-desc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Most turns`}),D===`messages-desc`&&(0,$.jsx)(K,{size:12,className:`text-primary`})]}),(0,$.jsxs)(X,{onClick:()=>O(`title-asc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Title (A–Z)`}),D===`title-asc`&&(0,$.jsx)(K,{size:12,className:`text-primary`})]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center rounded border border-border bg-card p-0.5 shadow-2xs`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>A(`harness`),title:`Group chats by AI Harness`,className:c(`px-2 py-0.5 text-xs rounded font-medium transition-colors cursor-pointer`,k===`harness`?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`text-muted-foreground hover:text-foreground`),children:`Grouped`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>A(`timeline`),title:`Unified Chronological Timeline`,className:c(`px-2 py-0.5 text-xs rounded font-medium transition-colors cursor-pointer`,k===`timeline`?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`text-muted-foreground hover:text-foreground`),children:`Timeline`})]})]})]}),T&&(0,$.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 p-2.5 rounded-md bg-emerald-500/10 border border-emerald-500/30 text-xs animate-fade-in`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-foreground min-w-0`,children:[(0,$.jsx)(`span`,{className:`size-2 rounded-full bg-emerald-500 animate-pulse shrink-0`}),(0,$.jsxs)(`span`,{className:`truncate`,children:[(0,$.jsx)(`strong`,{children:`Active in terminal:`}),` `,(0,$.jsx)(`code`,{className:`font-mono bg-background/80 px-1.5 py-0.5 rounded text-emerald-400`,children:T.cmd})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:async()=>{await cn(T.cmd),s?.(`Command copied to clipboard!`,`success`)},className:`inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium rounded border border-emerald-500/40 bg-emerald-500/15 text-emerald-400 hover:bg-emerald-500/25 transition-colors cursor-pointer`,children:[(0,$.jsx)(Z,{size:11}),` Copy`]}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>E(null),className:`text-muted-foreground hover:text-foreground cursor-pointer text-xs px-1`,title:`Dismiss banner`,children:`✕`})]})]}),k===`timeline`?(0,$.jsx)(mn,{className:`divide-y divide-border overflow-hidden surface-card`,children:U.length===0?(0,$.jsx)(`div`,{className:`py-8 text-center text-xs text-muted-foreground`,children:j?`No chat sessions match your search filter.`:`No chat sessions recorded yet.`}):U.map(e=>(0,$.jsxs)(`div`,{className:`group flex flex-col gap-2 p-3 hover:bg-accent/40 transition-colors sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[Xr(e.assistant),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-muted-foreground mb-0.5`,children:[(0,$.jsx)(`span`,{className:`font-semibold capitalize text-foreground`,children:e.assistant===`antigravity`?`Antigravity`:e.assistant===`claude`?`Claude`:e.assistant===`codex`?`Codex`:`Copilot`}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsx)(`span`,{className:`font-mono text-muted-foreground/80`,children:e.id.slice(0,8)}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsx)(`span`,{children:Zr(e.createdAt||e.updatedAt)}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{className:`font-mono`,children:[e.messageCount,` `,e.messageCount===1?`turn`:`turns`]})]}),(0,$.jsx)(`p`,{className:`text-xs font-semibold text-foreground truncate`,title:e.title,children:e.title})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 pl-8 sm:pl-0`,children:[(0,$.jsxs)(f,{size:`xs`,variant:`default`,disabled:x===e.id,onClick:()=>void B(e.id,e.assistant),title:`Resume session in terminal (${e.id})`,children:[x===e.id?(0,$.jsx)(q,{className:`size-3`}):(0,$.jsx)(Y,{size:12}),(0,$.jsx)(`span`,{children:`Resume`})]}),(0,$.jsxs)(f,{size:`xs`,variant:`outline`,onClick:()=>{r(e),i([]),a(e.assistant,e.id)},title:`Inspect transcript log`,children:[(0,$.jsx)(Dn,{size:12}),(0,$.jsx)(`span`,{children:`Logs`})]}),e.assistant===`codex`&&v&&(0,$.jsxs)(f,{size:`xs`,variant:`outline`,disabled:y===e.id,onClick:()=>void V(e.id),title:`Open in Codex Desktop`,children:[y===e.id?(0,$.jsx)(q,{className:`size-3`}):(0,$.jsx)(Bt,{size:12}),(0,$.jsx)(`span`,{children:`Desktop`})]}),(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,onClick:async()=>{let t=Yr(e.assistant,e.id);await cn(t),s?.(`Copied: ${t}`,`success`)},title:`Copy CLI resume command`,children:(0,$.jsx)(Z,{size:12})})]})]},e.id))}):(0,$.jsx)(`div`,{className:`space-y-2.5`,children:se.map(e=>{let t=F[e.id]??!1,n=e.sessions.filter(e=>{if(!j.trim())return!0;let t=j.toLowerCase();return`${e.title} ${e.id}`.toLowerCase().includes(t)});return(0,$.jsxs)(mn,{className:`overflow-hidden surface-card`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 p-3 sm:flex-row sm:items-center sm:justify-between bg-muted/20 hover:bg-muted/35 transition-colors cursor-pointer select-none`,onClick:()=>ee(e.id),children:[(0,$.jsxs)(`div`,{className:`flex flex-1 items-center gap-2.5 min-w-0`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground transition-transform`,children:t?(0,$.jsx)(Ke,{size:14}):(0,$.jsx)(nt,{size:14})}),e.icon,(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 min-w-0`,children:[(0,$.jsx)(`span`,{className:`font-bold text-xs text-foreground`,children:e.name}),(0,$.jsxs)(J,{tone:e.isDetected?`success`:`neutral`,dot:e.isDetected,children:[`CLI: `,e.cliCommand]}),e.hasApp&&(0,$.jsx)(J,{tone:`running`,children:e.appName}),(0,$.jsxs)(`span`,{className:`text-[11px] text-muted-foreground font-mono`,children:[`(`,n.length,`)`]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 pl-6 sm:pl-0`,onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(f,{size:`xs`,variant:`default`,disabled:C===e.id,onClick:()=>void z(e.id),title:`Launch new ${e.cliCommand} session in terminal`,children:[C===e.id?(0,$.jsx)(q,{className:`size-3`}):(0,$.jsx)(kt,{size:12}),(0,$.jsx)(`span`,{children:`New Session`})]}),e.hasApp&&(0,$.jsxs)(f,{size:`xs`,variant:`outline`,onClick:()=>void te(e.appTargetId),title:`Open in ${e.appName}`,children:[(0,$.jsx)(Bt,{size:12}),(0,$.jsx)(`span`,{children:e.appName})]})]})]}),t&&(0,$.jsx)(`div`,{className:`divide-y divide-border/60 border-t border-border`,children:n.length===0?(0,$.jsxs)(`div`,{className:`p-4 text-center text-xs text-muted-foreground flex items-center justify-center gap-2`,children:[(0,$.jsx)(`span`,{children:j?`No sessions match your search query.`:`No previous sessions recorded for ${e.name}.`}),!j&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void z(e.id),className:`text-primary font-semibold hover:underline cursor-pointer inline-flex items-center gap-1 text-xs`,children:[(0,$.jsx)(kt,{size:11}),` Start session`]})]}):n.map(e=>(0,$.jsxs)(`div`,{className:`group flex flex-col gap-1.5 px-3.5 py-2.5 hover:bg-accent/40 transition-colors sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 mb-0.5 text-[11px] text-muted-foreground font-mono`,children:[(0,$.jsx)(`span`,{children:e.id.slice(0,8)}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsx)(`span`,{children:Zr(e.createdAt||e.updatedAt)}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{children:[e.messageCount,` `,e.messageCount===1?`turn`:`turns`]})]}),(0,$.jsx)(`p`,{className:`text-xs font-semibold text-foreground truncate`,title:e.title,children:e.title})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,$.jsxs)(f,{size:`xs`,variant:`default`,disabled:x===e.id,onClick:()=>void B(e.id,e.assistant),title:`Resume session in terminal (${e.id})`,children:[x===e.id?(0,$.jsx)(q,{className:`size-3`}):(0,$.jsx)(Y,{size:12}),(0,$.jsx)(`span`,{children:`Resume`})]}),(0,$.jsxs)(f,{size:`xs`,variant:`outline`,onClick:()=>{r(e),i([]),a(e.assistant,e.id)},title:`Inspect transcript log`,children:[(0,$.jsx)(Dn,{size:12}),(0,$.jsx)(`span`,{children:`Logs`})]}),e.assistant===`codex`&&v&&(0,$.jsxs)(f,{size:`xs`,variant:`outline`,disabled:y===e.id,onClick:()=>void V(e.id),title:`Open in Codex Desktop`,children:[y===e.id?(0,$.jsx)(q,{className:`size-3`}):(0,$.jsx)(Bt,{size:12}),(0,$.jsx)(`span`,{children:`Desktop`})]}),(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,onClick:async()=>{let t=Yr(e.assistant,e.id);await cn(t),s?.(`Copied: ${t}`,`success`)},title:`Copy CLI resume command`,children:(0,$.jsx)(Z,{size:12})})]})]},e.id))})]},e.id)})})]})};function $r({ws:e}){let t=e.branchName,n=Kt(t),r=zt(t),i=Ut(t),a=n.data,o=(0,Q.useMemo)(()=>a?.services??[],[a]),s=(0,Q.useMemo)(()=>a?.runningState??[],[a]),l=a?.orchestrationTools??[],u=(0,Q.useMemo)(()=>a?.runningOrchestrators??[],[a]),d=(0,Q.useMemo)(()=>u.filter(e=>e.mode===`pm2`&&e.logName),[u]),[p,m]=(0,Q.useState)(`classic`),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{let e=[...o.map(e=>e.name),...d.map(e=>e.logName)];e.length===0?_!==null&&v(null):(!_||!e.includes(_))&&v(e[0])},[o,d]);let{logs:y,connected:b,clear:x}=Dt(t,_,!0),S=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{S.current?.scrollIntoView({behavior:`smooth`})},[y]);let C=(0,Q.useMemo)(()=>new Set(s.filter(e=>e.pid>0).map(e=>e.name)),[s]),w=(0,Q.useMemo)(()=>new Set(u.map(e=>e.id)),[u]),T=C.size>0,E=p===`matrix`?`term-matrix`:p===`dracula`?`term-dracula`:`term-classic`,D=r.isPending||i.isPending;return(0,$.jsxs)(`div`,{className:`animate-fade-in`,children:[n.isLoading&&(0,$.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-[10px] text-primary`,children:[(0,$.jsx)(q,{className:`size-3`}),(0,$.jsx)(`span`,{className:`font-semibold tracking-wider uppercase`,children:`Scanning service configurations...`})]}),l.length>0&&(0,$.jsxs)(`div`,{className:`mb-4 rounded-md border border-border/80 bg-card p-4 surface-card`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-[10px] font-bold uppercase tracking-wider text-muted-foreground`,children:[(0,$.jsx)(Ot,{size:12,className:`text-info`}),` Orchestration tools`]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:l.map(e=>{let t=w.has(e.id);return(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border/60 bg-muted/20 p-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`h-2 w-2 rounded-full ${t?`bg-success`:`bg-muted-foreground/40`}`}),(0,$.jsx)(`span`,{className:`text-xs font-bold text-foreground`,children:e.tool}),(0,$.jsx)(J,{tone:`idle`,dot:!1,children:e.mode})]}),(0,$.jsx)(`code`,{className:`mt-1 block truncate font-mono text-[9px] text-muted-foreground`,children:e.configPath})]}),(0,$.jsx)(`div`,{className:`shrink-0`,children:t?(0,$.jsxs)(f,{size:`xs`,variant:`destructive`,"aria-label":`Stop ${e.tool}`,disabled:D,onClick:()=>i.mutate({action:`stop`,id:e.id}),children:[(0,$.jsx)(tt,{size:12}),` Stop`]}):(0,$.jsxs)(f,{size:`xs`,"aria-label":`Start ${e.tool}`,disabled:D,onClick:()=>i.mutate({action:`start`,id:e.id}),children:[(0,$.jsx)(jt,{size:12}),` Start`]})})]},e.id)})})]}),(0,$.jsxs)(`div`,{className:`mb-4 rounded-md border border-border/80 bg-card p-4 surface-card`,children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-center justify-between text-xs font-semibold text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:`Workspace Status`}),(0,$.jsx)(J,{tone:T?`running`:`idle`,children:T?`Active`:`Standby`})]}),(0,$.jsx)(`div`,{className:`mb-3 text-xs font-semibold text-foreground`,children:T?`${C.size} process${C.size===1?``:`es`} active`:`All processes offline`}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(f,{size:`sm`,disabled:T||D,onClick:()=>r.mutate({action:`start`}),children:[(0,$.jsx)(jt,{size:13}),` Start All Services`]}),(0,$.jsxs)(f,{size:`sm`,variant:`destructive`,disabled:!T||D,onClick:()=>r.mutate({action:`stop`}),children:[(0,$.jsx)(tt,{size:13}),` Stop All`]})]})]}),(o.length>0||d.length>0)&&(0,$.jsxs)(`div`,{className:`grid grid-cols-1 overflow-hidden rounded-md border border-border/80 bg-card shadow-xs lg:grid-cols-12 surface-card`,children:[(0,$.jsxs)(`div`,{className:`border-b border-border/80 bg-muted/20 p-4 lg:col-span-4 lg:border-b-0 lg:border-r`,children:[(0,$.jsxs)(`h4`,{className:`mb-4 flex items-center gap-1.5 border-b border-border pb-2 text-[10px] font-bold uppercase tracking-wider text-muted-foreground`,children:[(0,$.jsx)(Y,{size:12,className:`text-primary`}),` Background Services`]}),(0,$.jsxs)(`div`,{className:`flex max-h-[400px] flex-col gap-2 overflow-y-auto pr-1`,children:[o.map(e=>{let t=_===e.name,n=C.has(e.name);return(0,$.jsxs)(`div`,{className:c(`flex cursor-pointer flex-col rounded-xl border p-3 transition-colors`,t?`border-primary/40 bg-primary/10 text-foreground`:`border-border bg-card text-muted-foreground hover:border-foreground/15 hover:bg-accent/50 hover:text-foreground`),onClick:()=>v(e.name),children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${n?`bg-success`:`bg-destructive`}`}),(0,$.jsx)(`span`,{className:`truncate text-xs font-bold`,children:e.name})]}),(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,onClick:e=>e.stopPropagation(),children:n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,"aria-label":`Restart ${e.name}`,disabled:D,onClick:()=>r.mutate({action:`restart`,service:e.name}),children:(0,$.jsx)(An,{})}),(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,"aria-label":`Stop ${e.name}`,disabled:D,onClick:()=>r.mutate({action:`stop`,service:e.name}),children:(0,$.jsx)(tt,{})})]}):(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,"aria-label":`Start ${e.name}`,disabled:D,onClick:()=>r.mutate({action:`start`,service:e.name}),children:(0,$.jsx)(jt,{})})})]}),e.port?(0,$.jsxs)(`span`,{className:`mt-2 w-fit rounded border border-border bg-background px-2 py-0.5 font-mono text-[9px] text-muted-foreground`,children:[`Port: `,e.port]}):null,(0,$.jsxs)(`code`,{className:`mt-2 block truncate rounded border border-border bg-muted/40 p-1.5 font-mono text-[9px] text-muted-foreground`,children:[e.command,` `,e.args.join(` `)]})]},e.name)}),d.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`mt-2 border-t border-border pt-3 text-[9px] font-bold uppercase tracking-wider text-muted-foreground`,children:`Orchestrators`}),d.map(e=>{let t=e.logName;return(0,$.jsxs)(`div`,{className:c(`flex cursor-pointer items-center gap-2 rounded-xl border p-3 transition-colors`,_===t?`border-primary/40 bg-primary/10 text-foreground`:`border-border bg-card text-muted-foreground hover:border-foreground/15 hover:bg-accent/50 hover:text-foreground`),onClick:()=>v(t),children:[(0,$.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-success`}),(0,$.jsx)(`span`,{className:`truncate text-xs font-bold`,children:e.tool}),(0,$.jsx)(J,{tone:`idle`,dot:!1,children:e.mode})]},e.id)})]})]})]}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col bg-background lg:col-span-8`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-border bg-muted/40 px-5 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`font-mono text-xs font-bold text-primary`,children:_||`no-service`}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`|`}),(0,$.jsx)(J,{tone:b?`running`:`idle`,children:b?`streaming`:`idle`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3 self-end sm:self-auto`,children:[(0,$.jsx)(`div`,{className:`flex rounded-lg border border-border bg-card p-0.5 text-[9px] font-semibold text-muted-foreground`,children:[`classic`,`matrix`,`dracula`].map(e=>(0,$.jsx)(`button`,{className:c(`cursor-pointer rounded-md px-2 py-1 capitalize transition-colors`,p===e?`bg-primary/10 font-bold text-primary`:`hover:text-foreground`),onClick:()=>m(e),children:e},e))}),(0,$.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,$.jsx)(`button`,{onClick:x,className:`cursor-pointer rounded-lg border border-border bg-card p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:`Clear Console`,children:(0,$.jsx)(dt,{size:13})}),(0,$.jsx)(`button`,{onClick:()=>g(!h),className:`cursor-pointer rounded-lg border border-border bg-card p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:h?`Minimize Console`:`Expand Console`,children:h?(0,$.jsx)(On,{size:13}):(0,$.jsx)(En,{size:13})})]})]})]}),(0,$.jsxs)(`div`,{className:c(`relative overflow-y-auto whitespace-pre-wrap p-5 font-mono text-[10.5px] leading-relaxed selection:bg-primary/20`,E,h?`h-[520px]`:`h-80`),children:[y.trim()?y:(0,$.jsx)(`span`,{className:`font-mono italic text-muted-foreground`,children:`(no log content yet)`}),(0,$.jsx)(`div`,{ref:S})]})]})]})]})}var ei=({ws:e,gitChanges:t,gitChangesLoading:n,syncLoading:r,syncResults:i,commitMessage:a,showCommitModal:o,commitLoading:s,commitResults:c,setSyncResults:l,setCommitResults:u,setCommitMessage:d,setShowCommitModal:p,fetchGitChanges:m,handleSyncAll:h,handleCommitAll:g})=>{let[_,v]=(0,Q.useState)({}),[y,b]=(0,Q.useState)({}),[x,S]=(0,Q.useState)({}),[C,w]=(0,Q.useState)({}),[T,E]=(0,Q.useState)(``),D=async(t,n)=>{let r=`${t}/${n}`,i=!_[r];if(v(e=>({...e,[r]:i})),i&&!y[r]){S(e=>({...e,[r]:!0})),w(e=>({...e,[r]:``}));try{let i=encodeURIComponent(e.branchName),a=await fetch(`/api/workspace/${i}/changes/diff?repo=${encodeURIComponent(t)}&file=${encodeURIComponent(n)}`);if(!a.ok)throw Error(`Failed to load diff: ${a.statusText}`);let o=await a.json();b(e=>({...e,[r]:o.diff||``}))}catch(e){w(t=>({...t,[r]:e.message||`Unknown error`}))}finally{S(e=>({...e,[r]:!1}))}}},O=e=>!e||!e.trim()?(0,$.jsx)(`div`,{className:`p-3 font-mono text-[11px] italic text-muted-foreground`,children:`No diff details available.`}):(0,$.jsx)(`pre`,{className:`custom-scrollbar max-h-[450px] overflow-x-auto overflow-y-auto rounded-xl border border-border bg-muted/40 p-4 font-mono text-[11px] leading-relaxed text-muted-foreground select-text`,children:e.split(`
1
+ import{_ as e,b as t,c as n,d as r,g as i,h as a,i as o,l as s,m as c,o as l,p as u,s as d,t as f}from"./button-BDDZnIHx.js";import{$ as p,$t as m,A as h,C as g,D as _,E as v,F as y,Fn as b,Ft as x,H as S,I as C,It as w,J as T,Jn as E,Jt as D,Kt as O,L as k,Lt as A,M as j,N as M,O as N,On as P,P as F,Pn as I,Q as ee,Qn as L,R,Rn as te,S as z,Sn as B,St as V,T as H,Tt as U,Un as ne,X as re,Xn as ie,Xt as ae,Yn as oe,Yt as se,Z as ce,Zn as le,Zt as ue,_ as de,_t as fe,at as pe,bt as me,ct as he,d as ge,dn as _e,en as ve,et as ye,f as be,g as xe,gt as Se,h as Ce,it as we,j as Te,jn as Ee,k as De,ln as W,m as Oe,n as ke,on as Ae,p as je,q as Me,qn as Ne,sn as Pe,t as Fe,tt as Ie,un as G,v as Le,vt as Re,w as ze,x as Be,xt as Ve,y as He,z as Ue,zn as We}from"./CSPContext-BG7no5S_.js";import{t as Ge}from"./bot-C2HWrAft.js";import{t as Ke}from"./chevron-down-qTL8HPug.js";import{a as qe,c as Je,i as Ye,l as Xe,n as Ze,o as Qe,r as $e,s as et,t as tt,u as nt}from"./square-DlIYnlSq.js";import{t as rt}from"./code-xml-jFAa3-TT.js";import{t as it}from"./cpu-Cdwd84Jz.js";import{a as at,h as ot,m as st,n as ct,r as lt,t as ut}from"./store-D7ixdVck.js";import{t as dt}from"./trash-2-CtR35_eF.js";import{t as ft}from"./zap-CWG_Lvki.js";import{_ as pt,a as mt,c as ht,d as gt,f as _t,l as vt,n as yt,o as bt,s as xt,t as St,u as Ct,x as wt,y as Tt}from"./isElementDisabled-D_fu2zfc.js";import{$ as Et,A as Dt,At as Ot,Ft as kt,Ht as At,It as jt,K as Mt,Lt as Nt,M as Pt,Mt as Ft,N as It,Ot as Lt,Pt as Rt,Q as zt,Rt as Bt,U as Vt,Ut as Ht,Vt as K,W as Ut,Wt,_t as Gt,a as q,at as Kt,ct as qt,dt as Jt,et as Yt,ft as Xt,gt as Zt,ht as Qt,i as J,j as $t,jt as Y,lt as en,mt as tn,n as nn,ot as rn,pt as an,r as on,rt as sn,t as cn,ut as X,vt as ln,w as un,xt as dn,yt as fn,zt as Z}from"./index-pxzwuRLq.js";import{t as pn}from"./badge-CAohJGj6.js";import{t as mn}from"./card-BKXzd_5L.js";import{a as hn,i as gn,n as _n,r as vn,t as yn}from"./empty-BdlgbifD.js";import{t as bn}from"./textarea-BNRuIXNs.js";import{n as xn,t as Sn}from"./vsc-DkRhgYbO.js";var Cn=a(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),wn=a(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Tn=a(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),En=a(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),Dn=a(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),On=a(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),kn=a(`puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),An=a(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),jn=a(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Mn=a(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Q=t(e(),1);function Nn(){let[,e]=Q.useState({});return Q.useCallback(()=>{e({})},[])}function Pn(e){let t=_e(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=B(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r;return(Tt(n)!==a||Tt(r)!==o)&&(n=a,r=o),{width:n,height:r}}function Fn(e){let{popupElement:t,positionerElement:r,content:i,mounted:a,onMeasureLayout:o,onMeasureLayoutComplete:c,side:l,direction:u}=e,d=se(t,!0,!1),f=ue(),p=Q.useRef(null),m=Q.useRef(!0),h=Q.useRef(s),g=G(o),_=G(c),v=Q.useMemo(()=>{let e=l===`top`,t=l===`left`;return u===`rtl`?(e||=l===`inline-end`,t||=l===`inline-end`):(e||=l===`inline-start`,t||=l===`inline-start`),e?{position:`absolute`,[l===`top`?`bottom`:`top`]:`0`,[t?`right`:`left`]:`0`}:n},[l,u]);W(()=>{if(!a){h.current=s,m.current=!0,p.current=null;return}if(!t||!r)return;h.current=Ln(t,v),Rn(t,`auto`);let e=In(t,`position`,`static`),n=In(t,`transform`,`none`),i=In(t,`scale`,`1`),o=Ln(r,{"--available-width":`max-content`,"--available-height":`max-content`});function c(){e(),n(),o()}function l(){c(),i()}if(g?.(),m.current||p.current===null){zn(r,`max-content`);let e=Pn(t);return p.current=e,zn(r,e),l(),_?.(null,e),m.current=!1,()=>{h.current(),h.current=s}}zn(r,`max-content`);let u=p.current,y=Pn(t);p.current=y,Rn(t,u),l(),_?.(u,y),zn(r,y);let b=new AbortController;return f.request(()=>{Rn(t,y),d(()=>{t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`)},b.signal)}),()=>{b.abort(),f.cancel(),h.current(),h.current=s}},[i,t,r,d,f,a,g,_,v])}function In(e,t,n){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}function Ln(e,t){let n=[];for(let[r,i]of Object.entries(t))n.push(In(e,r,i));return n.length?()=>{n.forEach(e=>e())}:s}function Rn(e,t){let n=t===`auto`?`auto`:`${t.width}px`,r=t===`auto`?`auto`:`${t.height}px`;e.style.setProperty(`--popup-width`,n),e.style.setProperty(`--popup-height`,r)}function zn(e,t){let n=t===`max-content`?`max-content`:`${t.width}px`,r=t===`max-content`?`max-content`:`${t.height}px`;e.style.setProperty(`--positioner-width`,n),e.style.setProperty(`--positioner-height`,r)}var Bn=t(L(),1),$=i();function Vn(e){let{store:t,side:n,cssVars:r,children:i}=e,a=be(),o=t.useState(`activeTriggerElement`),s=t.useState(`activeTriggerId`),c=t.useState(`open`),l=t.useState(`payload`),u=t.useState(`mounted`),d=t.useState(`popupElement`),f=t.useState(`positionerElement`),p=yt(c?o:null),m=Gn(s,l),h=Q.useRef(null),[g,_]=Q.useState(null),[v,y]=Q.useState(null),b=Q.useRef(null),x=Q.useRef(null),S=se(b,!0,!1),C=ue(),[w,T]=Q.useState(null),[E,D]=Q.useState(!1);W(()=>(t.set(`hasViewport`,!0),()=>{t.set(`hasViewport`,!1)}),[t]);let O=G(()=>{b.current?.style.setProperty(`animation`,`none`),b.current?.style.setProperty(`transition`,`none`),x.current?.style.setProperty(`display`,`none`)}),k=G(e=>{b.current?.style.removeProperty(`animation`),b.current?.style.removeProperty(`transition`),x.current?.style.removeProperty(`display`),e&&T(e)}),A=Q.useRef(null);W(()=>{(!c||!u)&&(A.current=null)},[c,u]),W(()=>{if(o&&p&&o!==p&&A.current!==o&&h.current){_(h.current),D(!0);let e=Wn(p,o);y(e),C.request(()=>{Bn.flushSync(()=>{D(!1)}),S(()=>{_(null),T(null),h.current=null})}),A.current=o}},[o,p,g,S,C]),W(()=>{let e=b.current;if(!e)return;let t=U(e).createElement(`div`);for(let n of Array.from(e.childNodes))t.appendChild(n.cloneNode(!0));h.current=t});let j=g!=null,M;M=j?(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(`div`,{"data-previous":!0,inert:je(!0),ref:x,style:{...w?{[r.popupWidth]:`${w.width}px`,[r.popupHeight]:`${w.height}px`}:null,position:`absolute`},"data-ending-style":E?void 0:``},`previous`),(0,$.jsx)(`div`,{"data-current":!0,ref:b,"data-starting-style":E?``:void 0,children:i},m)]}):(0,$.jsx)(`div`,{"data-current":!0,ref:b,children:i},m),W(()=>{let e=x.current;!e||!g||e.replaceChildren(...Array.from(g.childNodes))},[g]),Fn({popupElement:d,positionerElement:f,mounted:u,content:l,onMeasureLayout:O,onMeasureLayoutComplete:k,side:n,direction:a});let N={activationDirection:Hn(v),transitioning:j};return{children:M,state:N}}function Hn(e){if(e)return`${Un(e.horizontal,5,`right`,`left`)} ${Un(e.vertical,5,`down`,`up`)}`}function Un(e,t,n,r){return e>t?n:e<-t?r:``}function Wn(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i={x:n.left+n.width/2,y:n.top+n.height/2},a={x:r.left+r.width/2,y:r.top+r.height/2};return{horizontal:a.x-i.x,vertical:a.y-i.y}}function Gn(e,t){let[n,r]=Q.useState(0),i=Q.useRef(e),a=Q.useRef(t),o=Q.useRef(!1);return W(()=>{let n=i.current,s=a.current,c=e!==n,l=t!==s;c?(r(e=>e+1),o.current=!l):o.current&&l&&(r(e=>e+1),o.current=!1),i.current=e,a.current=t},[e,t]),`${e??`current`}-${n}`}var Kn=Q.createContext(void 0);function qn(){let e=Q.useContext(Kn);if(e===void 0)throw Error(u(64));return e}var Jn=function(e){return e.activationDirection=`data-activation-direction`,e.orientation=`data-orientation`,e}({}),Yn={tabActivationDirection:e=>({[Jn.activationDirection]:e})},Xn=Q.forwardRef(function(e,t){let{className:n,defaultValue:r=0,onValueChange:i,orientation:a=`horizontal`,render:s,value:c,style:l,...u}=e,d=e.defaultValue!==void 0,f=Q.useRef([]),[p,h]=Q.useState(()=>new Map),[g,_]=P({controlled:c,default:r,name:`Tabs`,state:`value`}),v=c!==void 0,[y,x]=Q.useState(()=>new Map),S=Q.useRef(void 0),C=Q.useCallback(e=>{if(e===void 0)return null;for(let[t,n]of y.entries())if(n!=null&&e===(n.value??n.index))return t;return null},[y]),[w,T]=Q.useState(()=>({previousValue:g,tabActivationDirection:`none`})),{previousValue:E,tabActivationDirection:D}=w,O=D,k=!1;E!==g&&(O=Zn(E,g,a,y),k=E!=null&&g!=null&&C(g)==null);let A=k?E:g,j=E!==A||D!==O;W(()=>{j&&T({previousValue:A,tabActivationDirection:O})},[A,j,O]);let M=G((e,t)=>{t.activationDirection=Zn(g,e,a,y),i?.(e,t),!t.isCanceled&&_(e)}),N=G((e,t)=>{i?.(e,m(t,void 0,void 0,{activationDirection:`none`}))}),F=G((e,t)=>{h(n=>{if(n.get(e)===t)return n;let r=new Map(n);return r.set(e,t),r})}),I=G((e,t)=>{h(n=>{if(!n.has(e)||n.get(e)!==t)return n;let r=new Map(n);return r.delete(e),r})}),ee=Q.useCallback(e=>p.get(e),[p]),L=Q.useCallback(e=>{for(let t of y.values())if(e===t?.value)return t?.id},[y]),R=Q.useMemo(()=>({getTabElementBySelectedValue:C,getTabIdByPanelValue:L,getTabPanelIdByValue:ee,onValueChange:M,orientation:a,registerMountedTabPanel:F,setTabMap:x,unregisterMountedTabPanel:I,tabActivationDirection:O,value:g}),[C,L,ee,M,a,F,x,I,O,g]),z=Q.useMemo(()=>{for(let e of y.values())if(e!=null&&e.value===g)return e},[y,g]),B=Q.useMemo(()=>{for(let e of y.values())if(e!=null&&!e.disabled)return e.value},[y]),V=Q.useRef(!d),H=Q.useRef(r),U=Q.useRef(d),ne=Q.useRef(!1);W(()=>{if(v)return;function e(e,t){_(e),T(t=>t.previousValue===e&&t.tabActivationDirection===`none`?t:{previousValue:e,tabActivationDirection:`none`}),N(e,t),V.current=!1}if(y.size===0){ne.current&&g!==null&&!S.current?.isConnected&&e(null,te);return}ne.current=!0,S.current=y.keys().next().value;let t=z?.disabled,n=z==null&&g!==null;if(!t&&g===H.current&&(U.current=!1),U.current&&t&&g===H.current)return;let r=V.current;if(t||n){let n=B??null;if(g===n){V.current=!1;return}let i=te;r?i=b:t&&(i=Ee),e(n,i);return}r&&z!=null&&(N(g,b),V.current=!1)},[B,v,N,z,_,y,g]);let re=o(`div`,e,{state:{orientation:a,tabActivationDirection:O},ref:t,props:u,stateAttributesMapping:Yn});return(0,$.jsx)(Kn.Provider,{value:R,children:(0,$.jsx)(ht,{elementsRef:f,children:re})})});function Zn(e,t,n,r){if(e==null||t==null)return`none`;let i=null,a=null;for(let[n,o]of r.entries()){if(o==null)continue;let r=o.value??o.index;if(e===r&&(i=n),t===r&&(a=n),i!=null&&a!=null)break}if(i==null||a==null)return i!==a&&(typeof e==`number`||typeof e==`string`)&&typeof e==typeof t?n===`horizontal`?t>e?`right`:`left`:t>e?`down`:`up`:`none`;let o=i.getBoundingClientRect(),s=a.getBoundingClientRect();if(n===`horizontal`){if(s.left<o.left)return`left`;if(s.left>o.left)return`right`}else{if(s.top<o.top)return`up`;if(s.top>o.top)return`down`}return`none`}var Qn=`data-composite-item-active`,$n=Q.createContext(void 0);function er(){let e=Q.useContext($n);if(e===void 0)throw Error(u(65));return e}var tr=Q.forwardRef(function(e,t){let{className:n,disabled:r=!1,render:i,value:a,id:s,nativeButton:c=!0,style:l,...u}=e,{value:d,getTabPanelIdByValue:f,orientation:p,tabActivationDirection:h}=qn(),{activateOnFocus:g,highlightedTabIndex:_,onTabActivation:v,registerTabResizeObserverElement:y,setHighlightedTabIndex:b,tabsListElement:S}=er(),C=ve(s),{compositeProps:T,compositeRef:E,index:D}=tn({metadata:Q.useMemo(()=>({disabled:r,id:C,value:a}),[r,C,a])}),O=a===d,k=Q.useRef(!1),A=Q.useRef(null);W(()=>{let e=A.current;if(e)return y(e)},[y]),W(()=>{if(k.current){k.current=!1;return}if(!(O&&D>-1&&_!==D))return;let e=S;if(e!=null){let t=x(U(e));if(t&&w(e,t))return}r||b(D)},[O,D,_,b,r,S]);let{getButtonProps:j,buttonRef:M}=Ae({disabled:r,native:c,focusableWhenDisabled:!0}),N=f(a),P=Q.useRef(!1),F=Q.useRef(!1);function I(e){O||r||v(a,m(We,e.nativeEvent,void 0,{activationDirection:`none`}))}function ee(e){O||(D>-1&&!r&&b(D),!r&&g&&(!P.current||P.current&&F.current)&&v(a,m(We,e.nativeEvent,void 0,{activationDirection:`none`})))}function L(e){if(O||r)return;P.current=!0;function t(){P.current=!1,F.current=!1}(!e.button||e.button===0)&&(F.current=!0,U(e.currentTarget).addEventListener(`pointerup`,t,{once:!0}))}return o(`button`,e,{state:{disabled:r,active:O,orientation:p,tabActivationDirection:h},ref:[t,M,E,A],props:[T,{role:`tab`,"aria-controls":N,"aria-selected":O,id:C,onClick:I,onFocus:ee,onPointerDown:L,[Qn]:O?``:void 0,onKeyDownCapture(){k.current=!0}},u,j],stateAttributesMapping:Yn})}),nr=Me();function rr(){return s}function ir(){return!1}function ar(){return!0}function or(){return(0,nr.useSyncExternalStore)(rr,ir,ar)}var sr=function(e){return e.activeTabLeft=`--active-tab-left`,e.activeTabRight=`--active-tab-right`,e.activeTabTop=`--active-tab-top`,e.activeTabBottom=`--active-tab-bottom`,e.activeTabWidth=`--active-tab-width`,e.activeTabHeight=`--active-tab-height`,e}({}),cr={...Yn,activeTabPosition:()=>null,activeTabSize:()=>null},lr=Q.forwardRef(function(e,t){let{className:n,render:r,renderBeforeHydration:i=!1,style:a,...s}=e,{nonce:c}=Fe(),{getTabElementBySelectedValue:l,orientation:u,tabActivationDirection:d,value:f}=qn(),{tabsListElement:p,registerIndicatorUpdateListener:m}=er(),h=or(),g=Nn();Q.useEffect(()=>m(g),[m,g]);let _=0,v=0,y=0,b=0,x=0,S=0,C=!1;if(f!=null&&p!=null){let e=l(f);if(e!=null){C=!0;let{width:t,height:n}=Pn(e),{width:r,height:i}=Pn(p),a=e.getBoundingClientRect(),o=p.getBoundingClientRect(),s=r>0?o.width/r:1,c=i>0?o.height/i:1;if(Math.abs(s)>2**-52&&Math.abs(c)>2**-52){let e=a.left-o.left,t=a.top-o.top;_=e/s+p.scrollLeft-p.clientLeft,y=t/c+p.scrollTop-p.clientTop}else _=e.offsetLeft,y=e.offsetTop;x=t,S=n,v=p.scrollWidth-_-x,b=p.scrollHeight-y-S}}let w=C?{left:_,right:v,top:y,bottom:b}:null,T=C?{width:x,height:S}:null,E=C?{[sr.activeTabLeft]:`${_}px`,[sr.activeTabRight]:`${v}px`,[sr.activeTabTop]:`${y}px`,[sr.activeTabBottom]:`${b}px`,[sr.activeTabWidth]:`${x}px`,[sr.activeTabHeight]:`${S}px`}:void 0,D=o(`span`,e,{state:{orientation:u,activeTabPosition:w,activeTabSize:T,tabActivationDirection:d},ref:t,props:[{role:`presentation`,style:E,hidden:!(C&&x>0&&S>0)},s,{suppressHydrationWarning:!0}],stateAttributesMapping:cr});return f==null?null:(0,$.jsxs)(Q.Fragment,{children:[D,h&&i&&(0,$.jsx)(`script`,{nonce:c,dangerouslySetInnerHTML:{__html:'!function(){const t=document.currentScript.previousElementSibling;if(!t)return;const e=t.closest(\'[role="tablist"]\');if(!e)return;const i=e.querySelector("[data-active]");if(!i)return;if(0===i.offsetWidth||0===e.offsetWidth)return;let o=0,n=0,h=0,l=0,r=0,f=0;function s(t){const e=getComputedStyle(t);let i=parseFloat(e.width)||0,o=parseFloat(e.height)||0;return(Math.round(i)!==t.offsetWidth||Math.round(o)!==t.offsetHeight)&&(i=t.offsetWidth,o=t.offsetHeight),{width:i,height:o}}if(null!=i&&null!=e){const{width:t,height:c}=s(i),{width:u,height:d}=s(e),a=i.getBoundingClientRect(),g=e.getBoundingClientRect(),p=u>0?g.width/u:1,b=d>0?g.height/d:1;if(Math.abs(p)>Number.EPSILON&&Math.abs(b)>Number.EPSILON){const t=a.left-g.left,i=a.top-g.top;o=t/p+e.scrollLeft-e.clientLeft,h=i/b+e.scrollTop-e.clientTop}else o=i.offsetLeft,h=i.offsetTop;r=t,f=c,n=e.scrollWidth-o-r,l=e.scrollHeight-h-f}function c(e,i){t.style.setProperty(`--active-tab-${e}`,`${i}px`)}c("left",o),c("right",n),c("top",h),c("bottom",l),c("width",r),c("height",f),r>0&&f>0&&t.removeAttribute("hidden")}();'},suppressHydrationWarning:!0})]})}),ur=function(e){return e.index=`data-index`,e.activationDirection=`data-activation-direction`,e.orientation=`data-orientation`,e.hidden=`data-hidden`,e[e.startingStyle=ie.startingStyle]=`startingStyle`,e[e.endingStyle=ie.endingStyle]=`endingStyle`,e}({}),dr={...Yn,...le},fr=Q.forwardRef(function(e,t){let{className:n,value:r,render:i,keepMounted:a=!1,style:s,...c}=e,{value:l,getTabIdByPanelValue:u,orientation:d,tabActivationDirection:f,registerMountedTabPanel:p,unregisterMountedTabPanel:m}=qn(),h=ve(),{ref:g,index:_}=wt({metadata:Q.useMemo(()=>({id:h,value:r}),[h,r])}),v=r===l,{mounted:y,transitionStatus:b,setMounted:x}=ae(v),S=!y,C=u(r),w={hidden:S,orientation:d,tabActivationDirection:f,transitionStatus:b},T=Q.useRef(null),E=o(`div`,e,{state:w,ref:[t,g,T],props:[{"aria-labelledby":C,hidden:S,id:h,role:`tabpanel`,tabIndex:v?0:-1,inert:je(!v),[ur.index]:_},c],stateAttributesMapping:dr});return D({open:v,ref:T,onComplete(){v||x(!1)}}),W(()=>{if(!(S&&!a)&&h!=null)return p(r,h),()=>{m(r,h)}},[S,a,r,h,p,m]),a||y?E:null}),pr=[];function mr(e){let{loopFocus:t=!0,orientation:n=`both`,grid:i,onLoop:a,direction:o,highlightedIndex:s,onHighlightedIndexChange:c,rootRef:l,enableHomeAndEndKeys:u=!1,stopEventPropagation:d=!1,disabledIndices:f,modifierKeys:p=pr}=e,[m,h]=Q.useState(0),g=i!=null,y=Q.useRef(null),b=r(y,l),x=Q.useRef([]),S=Q.useRef(!1),C=s??m,w=G((e,t=!1)=>{if((c??h)(e),t){let t=x.current[e];_(y.current,t,o,n)}}),T=G(e=>{if(e.size===0||S.current)return;S.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?t.indexOf(r):-1;if(i!==-1)w(i);else if(Ve(t,C,f)){let e=Se(t,{disabledIndices:f});me(t,e)||w(e)}_(y.current,r,o,n)});W(()=>{if(f==null||s!=null||!S.current)return;let e=x.current;if(Ve(e,C,f)){let t=Se(e,{disabledIndices:f});me(e,t)||w(t)}},[f,s,C,x,w]);let E=G((e,t,n)=>a?a(e,t,n,x):n),D=G(e=>{let r=u?He:Ce;if(!r.has(e.key)||hr(e,p)||!y.current)return;let s=o===`rtl`,c=s?xe:de,l={horizontal:c,vertical:Oe,both:c}[n],m=s?de:xe,h={horizontal:m,vertical:Le,both:m}[n],_=A(e.nativeEvent);if(_!=null&&v(_)&&!St(_)){let t=_.selectionStart,n=_.selectionEnd,r=_.value??``;if(t==null||e.shiftKey||t!==n||e.key!==h&&t<r.length||e.key!==l&&t>0)return}let b=C,S=Re(x,f),T=fe(x,f);i!=null&&(b=i({disabledIndices:f,elementsRef:x,event:e,highlightedIndex:C,loopFocus:t,maxIndex:T,minIndex:S,onLoop:E,orientation:n,rtl:s}));let D={horizontal:[c],vertical:[Oe],both:[c,Oe]}[n],O={horizontal:[m],vertical:[Le],both:[m,Le]}[n],k=g?r:{horizontal:u?z:Be,vertical:u?H:ze,both:r}[n];u&&(e.key===`Home`?b=S:e.key===`End`&&(b=T)),b===C&&(D.includes(e.key)||O.includes(e.key))&&(t&&b===T&&D.includes(e.key)?(b=S,a&&(b=a(e,C,b,x))):t&&b===S&&O.includes(e.key)?(b=T,a&&(b=a(e,C,b,x))):b=Se(x.current,{startingIndex:b,decrement:O.includes(e.key),disabledIndices:f})),b!==C&&!me(x.current,b)&&(d&&e.stopPropagation(),k.has(e.key)&&e.preventDefault(),w(b,!0),queueMicrotask(()=>{x.current[b]?.focus()}))});return{props:{ref:b,onFocus(e){let t=y.current,n=A(e.nativeEvent);!t||n==null||!v(n)||n.setSelectionRange(0,n.value.length??0)},onKeyDown:D},highlightedIndex:C,onHighlightedIndexChange:w,elementsRef:x,disabledIndices:f,onMapChange:T,relayKeyboardEvent:D}}function hr(e,t){for(let n of g.values())if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function gr(e){let{render:t,className:r,style:i,refs:a=d,props:s=d,state:c=n,stateAttributesMapping:l,highlightedIndex:u,onHighlightedIndexChange:f,orientation:p,grid:m,loopFocus:h,onLoop:g,enableHomeAndEndKeys:_,onMapChange:v,stopEventPropagation:y=!0,rootRef:b,disabledIndices:x,modifierKeys:S,highlightItemOnHover:C=!1,tag:w=`div`,...T}=e,{props:E,highlightedIndex:D,onHighlightedIndexChange:O,elementsRef:k,onMapChange:A,relayKeyboardEvent:j}=mr({grid:m,loopFocus:h,onLoop:g,orientation:p,highlightedIndex:u,onHighlightedIndexChange:f,rootRef:b,stopEventPropagation:y,enableHomeAndEndKeys:_,direction:be(),disabledIndices:x,modifierKeys:S}),M=o(w,e,{state:c,ref:a,props:[E,...s,T],stateAttributesMapping:l}),N=Q.useMemo(()=>({highlightedIndex:D,onHighlightedIndexChange:O,highlightItemOnHover:C,relayKeyboardEvent:j}),[D,O,C,j]);return(0,$.jsx)(Pe.Provider,{value:N,children:(0,$.jsx)(ht,{elementsRef:k,onMapChange:e=>{v?.(e),A(e)},children:M})})}var _r=Q.forwardRef(function(e,t){let{activateOnFocus:n=!1,className:r,loopFocus:i=!0,render:a,style:o,...s}=e,{onValueChange:c,orientation:l,value:u,setTabMap:f,tabActivationDirection:p}=qn(),[m,h]=Q.useState(0),[g,_]=Q.useState(null),v=Q.useRef(new Set),y=Q.useRef(new Set),b=Q.useRef(null);W(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{v.current.forEach(e=>{e()})});return b.current=e,g&&e.observe(g),y.current.forEach(t=>{e.observe(t)}),()=>{e.disconnect(),b.current=null}},[g]);let x=G(e=>(v.current.add(e),()=>{v.current.delete(e)})),S=G(e=>(y.current.add(e),b.current?.observe(e),()=>{y.current.delete(e),b.current?.unobserve(e)})),C=G((e,t)=>{e!==u&&c(e,t)}),w={orientation:l,tabActivationDirection:p},T={"aria-orientation":l===`vertical`?`vertical`:void 0,role:`tablist`},E=Q.useMemo(()=>({activateOnFocus:n,highlightedTabIndex:m,registerIndicatorUpdateListener:x,registerTabResizeObserverElement:S,onTabActivation:C,setHighlightedTabIndex:h,tabsListElement:g}),[n,m,x,S,C,h,g]);return(0,$.jsx)($n.Provider,{value:E,children:(0,$.jsx)(gr,{render:a,className:r,style:o,state:w,refs:[t,_],props:[T,s],stateAttributesMapping:Yn,highlightedIndex:m,enableHomeAndEndKeys:!0,loopFocus:i,orientation:l,onHighlightedIndexChange:h,onMapChange:f,disabledIndices:d})})});function vr({className:e,...t}){return(0,$.jsx)(Xn,{className:c(`flex flex-col gap-4`,e),"data-slot":`tabs`,...t})}function yr({className:e,...t}){return(0,$.jsxs)(_r,{className:c(`relative z-0 flex w-fit items-center gap-1 rounded-lg bg-muted p-1`,e),"data-slot":`tabs-list`,...t,children:[t.children,(0,$.jsx)(lr,{className:`absolute top-1/2 left-0 z-[-1] h-[calc(100%-0.5rem)] w-(--active-tab-width) -translate-y-1/2 translate-x-(--active-tab-left) rounded-md bg-background shadow-xs transition-all duration-150`,"data-slot":`tabs-indicator`})]})}function br({className:e,...t}){return(0,$.jsx)(tr,{className:c(`flex h-7 cursor-pointer items-center justify-center whitespace-nowrap rounded-md border border-transparent px-2.5 font-medium text-muted-foreground text-sm outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring data-selected:text-foreground`,e),"data-slot":`tabs-tab`,...t})}function xr({className:e,...t}){return(0,$.jsx)(fr,{className:c(`flex-1 outline-none`,e),"data-slot":`tabs-panel`,...t})}var Sr=Q.createContext(void 0);function Cr(e){let t=Q.useContext(Sr);if(t===void 0&&!e)throw Error(u(47));return t}function wr(){return{...ut(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}var Tr={...lt,disabled:T(e=>e.disabled),instantType:T(e=>e.instantType),openMethod:T(e=>e.openMethod),openChangeReason:T(e=>e.openChangeReason),modal:T(e=>e.modal),focusManagerModal:T(e=>e.focusManagerModal),stickIfOpen:T(e=>e.stickIfOpen),titleElementId:T(e=>e.titleElementId),descriptionElementId:T(e=>e.descriptionElementId),openOnHover:T(e=>e.openOnHover),closeDelay:T(e=>e.closeDelay),hasViewport:T(e=>e.hasViewport)},Er=class e extends S{constructor(e,t,n=!1){let r={...wr(),...e},i=new N;r.open&&e?.mounted===void 0&&(r.mounted=!0),r.floatingRootContext=ct(i,t,n),super(r,{popupRef:Q.createRef(),backdropRef:Q.createRef(),internalBackdropRef:Q.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:Q.createRef(),beforeContentFocusGuardRef:Q.createRef(),stickIfOpenTimeout:new O,triggerElements:i},Tr)}setOpen=(e,t)=>{let n=t.reason===ne,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=h(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n={open:e,openChangeReason:t.reason};j(n,e,t.trigger,a()),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),Bn.flushSync(s)):s(),r||i?this.set(`instantType`,r?`click`:`dismiss`):t.reason===`focus-out`?this.set(`instantType`,`focus`):this.set(`instantType`,void 0)};static useStore(t,n){let{store:r,internalStore:i}=R(t,(t,r)=>new e(n,t,r));return Q.useEffect(()=>i?.disposeEffect(),[i]),r}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()};function Dr({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=Er.useStore(s?.store,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});F(u,n,r,l),u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`),h=Ie()!=null;u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),k(u,d),M(u);let{forceUnmount:g}=y(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});u.useSyncedValues({modal:o,nested:h}),Q.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);let _=Q.useCallback(()=>{u.setOpen(!1,m(I))},[u]);Q.useImperativeHandle(e.actionsRef,()=>({unmount:g,close:_}),[g,_]);let v=d||f,b=Q.useMemo(()=>({store:u}),[u]);return(0,$.jsxs)(Sr.Provider,{value:b,children:[v&&(0,$.jsx)(kr,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})}function Or(e){return Cr(!0)?(0,$.jsx)(Dr,{props:e}):(0,$.jsx)(p,{children:(0,$.jsx)(Dr,{props:e})})}function kr({store:e,modal:t}){let r=re(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}});return C(e,{activeTriggerProps:r.reference??n,inactiveTriggerProps:r.trigger??n,popupProps:Q.useMemo(()=>l(De,r.floating),[r.floating])}),null}var Ar=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:s=!0,handle:c,payload:l,openOnHover:d=!1,delay:f=300,closeDelay:p=0,id:m,...h}=e,g=Cr(!0),_=c?.store??g?.store;if(!_)throw Error(u(74));let v=ve(m),y=_.useState(`isTriggerActive`,v),b=_.useState(`floatingRootContext`),x=_.useState(`isOpenedByTrigger`,v),S=_.useState(`triggerPopupId`,v),C=Q.useRef(null),{registerTrigger:w,isMountedByThisTrigger:T}=Ue(v,C,_,{payload:l,disabled:a,openOnHover:d,closeDelay:p}),D=_.useState(`openChangeReason`),O=_.useState(`stickIfOpen`),k=_.useState(`openMethod`),A=_.useState(`focusManagerModal`),j=Zt(b,{enabled:!a&&b!=null&&d&&(k!==`touch`||D!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:Qt(),restMs:f,delay:{close:p},triggerElementRef:C,isActiveTrigger:y,isClosing:()=>_.select(`transitionStatus`)===`ending`}),M=pt(b,{enabled:b!=null,stickIfOpen:O}),N=mt(()=>_.select(`open`),e=>{_.set(`openMethod`,e)}),P=_.useState(`triggerProps`,T),{getButtonProps:F,buttonRef:I}=Ae({disabled:a,native:s}),ee={open(e){return e&&D===`trigger-press`?E.open(e):oe.open(e)}},{preFocusGuardRef:L,handlePreFocusGuardFocus:R,handleFocusTargetFocus:te}=an(_,C),z=o(`button`,e,{state:{disabled:a,open:x},ref:[I,t,w,C],props:[M.reference,j,P,N,{[pe]:``,id:v,"aria-haspopup":`dialog`,"aria-expanded":x,"aria-controls":S},h,F],stateAttributesMapping:ee});return T&&!A?(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(V,{ref:L,onFocus:R}),(0,$.jsx)(Q.Fragment,{children:z},v),(0,$.jsx)(V,{ref:_.context.triggerFocusTargetRef,onFocus:te})]}):(0,$.jsx)(Q.Fragment,{children:z},v)}),jr=Q.createContext(void 0);function Mr(){let e=Q.useContext(jr);if(e===void 0)throw Error(u(45));return e}var Nr=Q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Cr();return i.useState(`mounted`)||n?(0,$.jsx)(jr.Provider,{value:n,children:(0,$.jsx)(we,{ref:t,...r})}):null}),Pr=Q.createContext(void 0);function Fr(){let e=Q.useContext(Pr);if(!e)throw Error(u(46));return e}var Ir=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o=`absolute`,side:s=`bottom`,align:c=`center`,sideOffset:l=0,alignOffset:u=0,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:h=!1,collisionAvoidance:g=he,..._}=e,{store:v}=Cr(),y=Mr(),b=ye(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`positionerElement`),k=v.useState(`instantType`),A=v.useState(`transitionStatus`),j=v.useState(`hasViewport`),M=Q.useRef(null),N=se(O,!1,!1),P=vt({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:j?Ct:void 0}),F=x.useState(`domReferenceElement`);W(()=>{let e=F,t=M.current;if(e&&(M.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return N(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[F,N,v]),bt(C&&E===!0&&w!==`trigger-hover`,D===`touch`,O,T);let I=Q.useCallback(e=>{v.set(`positionerElement`,e)},[v]),L=xt(e,{open:C,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:k},{styles:P.positionerStyles,transitionStatus:A,props:_,refs:[t,I],hidden:!S,inert:!C});return(0,$.jsxs)(Pr.Provider,{value:P,children:[S&&E===!0&&w!==`trigger-hover`&&(0,$.jsx)(ge,{ref:v.context.internalBackdropRef,inert:je(!C),cutout:T}),(0,$.jsx)(ee,{id:b,children:L})]})}),Lr=Q.createContext(void 0);function Rr(){let[e,t]=Q.useState(0),n=G(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:Q.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function zr(e){let{value:t,children:n}=e;return(0,$.jsx)(Lr.Provider,{value:t,children:n})}var Br={...Ne,...le},Vr=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:s,...c}=e,{store:l}=Cr(),u=Fr(),d=_t(!0)!=null,{context:f,hasClosePart:p}=Rr(),m=l.useState(`open`),h=l.useState(`openMethod`),g=l.useState(`instantType`),_=l.useState(`transitionStatus`),v=l.useState(`popupProps`),y=l.useState(`titleElementId`),b=l.useState(`descriptionElementId`),x=l.useState(`modal`),S=l.useState(`mounted`),C=l.useState(`openChangeReason`),w=l.useState(`activeTriggerElement`),T=l.useState(`floatingRootContext`),E=T.useState(`floatingId`),O=l.useState(`disabled`),k=l.useState(`openOnHover`),A=l.useState(`closeDelay`),j=c.id??E;D({open:m,ref:l.context.popupRef,onComplete(){m&&l.context.onOpenChangeComplete?.(!0)}}),Gt(T,{enabled:k&&!O,closeDelay:A});let M=a===void 0?Te(l.context.popupRef):a,N=x!==!1&&p;l.useSyncedValue(`focusManagerModal`,N);let P=Q.useCallback(e=>{l.set(`popupElement`,e)},[l]),F=o(`div`,e,{state:{open:m,side:u.side,align:u.align,instant:g,transitionStatus:_},ref:[t,l.context.popupRef,P],props:[v,{id:j,role:`dialog`,...De,"aria-labelledby":y,"aria-describedby":b,onKeyDown(e){d&&He.has(e.key)&&e.stopPropagation()}},gt(_),c],stateAttributesMapping:Br});return(0,$.jsx)(ce,{context:T,openInteractionType:h,modal:N,disabled:!S||C===`trigger-hover`,initialFocus:M,returnFocus:s,restoreFocus:`popup`,previousFocusableElement:B(w)?w:void 0,nextFocusableElement:l.context.triggerFocusTargetRef,beforeContentFocusGuardRef:l.context.beforeContentFocusGuardRef,children:(0,$.jsx)(zr,{value:f,children:F})})}),Hr=function(e){return e.popupWidth=`--popup-width`,e.popupHeight=`--popup-height`,e}({}),Ur={activationDirection:e=>e?{"data-activation-direction":e}:null},Wr=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...s}=e,{store:c}=Cr(),{side:l}=Fr(),u=c.useState(`instantType`),{children:d,state:f}=Vn({store:c,side:l,cssVars:Hr,children:a});return o(`div`,e,{state:{activationDirection:f.activationDirection,transitioning:f.transitioning,instant:u},ref:t,props:[s,{children:d}],stateAttributesMapping:Ur})}),Gr=Or;function Kr({className:e,children:t,...n}){return(0,$.jsx)(Ar,{className:e,"data-slot":`popover-trigger`,...n,children:t})}function qr({children:e,className:t,viewportClassName:n,side:r=`bottom`,align:i=`center`,sideOffset:a=4,alignOffset:o=0,tooltipStyle:s=!1,anchor:l,...u}){return(0,$.jsx)(Nr,{children:(0,$.jsx)(Ir,{align:i,alignOffset:o,anchor:l,className:`z-50 h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) transition-[top,left,right,bottom,transform] data-instant:transition-none`,"data-slot":`popover-positioner`,side:r,sideOffset:a,children:(0,$.jsx)(Vr,{className:c(`relative flex h-(--popup-height,auto) w-(--popup-width,auto) origin-(--transform-origin) rounded-lg border bg-popover not-dark:bg-clip-padding text-popover-foreground shadow-lg/5 outline-none transition-[width,height,scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] has-data-[slot=calendar]:rounded-xl has-data-[slot=calendar]:before:rounded-[calc(var(--radius-xl)-1px)] data-starting-style:scale-98 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,s&&`w-fit text-balance rounded-md text-xs shadow-md/5 before:rounded-[calc(var(--radius-md)-1px)]`,t),"data-slot":`popover-popup`,...u,children:(0,$.jsx)(Wr,{className:c(`relative size-full max-h-(--available-height) overflow-clip px-(--viewport-inline-padding) py-4 [--viewport-inline-padding:--spacing(4)] has-data-[slot=calendar]:p-2 data-instant:transition-none **:data-current:data-ending-style:opacity-0 **:data-current:data-starting-style:opacity-0 **:data-previous:data-ending-style:opacity-0 **:data-previous:data-starting-style:opacity-0 **:data-current:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-current:opacity-100 **:data-previous:opacity-100 **:data-current:transition-opacity **:data-previous:transition-opacity`,s?`py-1 [--viewport-inline-padding:--spacing(2)]`:`not-data-transitioning:overflow-y-auto`,n),"data-slot":`popover-viewport`,children:e})})})})}function Jr({repos:e,disabled:t,onAdd:n}){let[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(``),s=(0,Q.useMemo)(()=>{let t=a.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)):e},[e,a]);return(0,$.jsxs)(Gr,{open:r,onOpenChange:e=>{e&&o(``),i(e)},children:[(0,$.jsx)(Kr,{render:(0,$.jsxs)(f,{variant:`outline`,size:`sm`,disabled:t,className:`h-8 text-xs text-muted-foreground`,children:[(0,$.jsx)(kt,{size:14}),` Add repository`]})}),(0,$.jsxs)(qr,{align:`end`,className:`w-[320px]`,viewportClassName:`p-0`,children:[(0,$.jsx)(`div`,{className:`border-b border-border p-2`,children:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(ot,{className:`absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(ke,{autoFocus:!0,value:a,onChange:e=>o(e.target.value),placeholder:`Search repositories`,className:`pl-8`,"aria-label":`Search repositories`})]})}),(0,$.jsx)(`div`,{role:`listbox`,className:`max-h-64 overflow-y-auto py-1`,children:s.length===0?(0,$.jsx)(`div`,{className:`px-3 py-4 text-center text-sm text-muted-foreground`,children:`No repositories found.`}):s.map(e=>(0,$.jsxs)(`button`,{role:`option`,"aria-selected":!1,onClick:()=>{i(!1),n(e.path)},className:`flex w-full cursor-pointer items-center gap-3 px-3 py-2 text-left transition-colors hover:bg-accent`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:e.name}),(0,$.jsx)(`span`,{className:`block truncate font-mono text-xs text-muted-foreground`,children:e.path})]}),(0,$.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:e.defaultBranch})]},e.path))})]})]})}var Yr=(e,t)=>{switch(e){case`antigravity`:return`agy --conversation ${t}`;case`claude`:return`claude --resume ${t}`;case`codex`:return`codex resume ${t}`;case`copilot`:return`copilot --resume ${t}`;default:return`agy --conversation ${t}`}},Xr=e=>{switch(e){case`antigravity`:return(0,$.jsx)(`span`,{className:`grid size-5.5 place-items-center rounded-md bg-card border border-border/80 shadow-2xs p-0.5 shrink-0`,title:`Google Antigravity`,children:(0,$.jsx)(ln,{className:`size-3.5`})});case`claude`:return(0,$.jsx)(`span`,{className:`grid size-5.5 place-items-center rounded-md bg-[#D97757] text-white font-bold text-[9px] shadow-2xs shrink-0`,title:`Claude Code`,children:(0,$.jsx)(fn,{className:`size-2.5`})});case`codex`:return(0,$.jsx)(`span`,{className:`grid size-5.5 place-items-center rounded-md bg-foreground text-background font-bold text-[9px] shadow-2xs shrink-0`,title:`OpenAI Codex`,children:(0,$.jsx)(Lt,{className:`size-2.5`})});case`copilot`:return(0,$.jsx)(`span`,{className:`grid size-5.5 place-items-center rounded-md bg-gradient-to-tr from-purple-600 via-indigo-500 to-blue-600 text-white font-bold text-[9px] shadow-2xs shrink-0`,title:`GitHub Copilot`,children:(0,$.jsx)(dn,{className:`size-2.5`})});default:return null}},Zr=e=>{if(!e)return``;let t=new Date(e);return isNaN(t.getTime())?``:new Date().toDateString()===t.toDateString()?`Today ${t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}`:`${t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})} ${t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}`},Qr=({ws:e,sessions:t,sessionsLoading:n,setActiveSession:r,setTranscript:i,fetchSessionTranscript:a,handleOpenDesktopSession:o,showToast:s})=>{let l=sn(),u=Vt(),d=Pt(),p=d.data?.find(e=>e.name===`antigravity`)?.detected??!0,m=d.data?.find(e=>e.name===`claude`)?.detected??!1,h=d.data?.find(e=>e.name===`codex`)?.detected??!1,g=d.data?.find(e=>e.name===`copilot`)?.detected??!1,_=!!l.data?.some(e=>e.id===`antigravity`&&e.available),v=!!l.data?.some(e=>e.id===`codex-desktop`&&e.available),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(`created-desc`),[k,A]=(0,Q.useState)(`harness`),[j,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(`all`),[F,I]=(0,Q.useState)({antigravity:!1,claude:!1,codex:!1,copilot:!1}),ee=e=>{I(t=>({...t,[e]:!t[e]}))},L=(0,Q.useRef)(!1),R=(0,Q.useRef)(null),te=async t=>{try{await qt(`/api/workspace/${encodeURIComponent(e.branchName)}/launch`,{method:`POST`,body:JSON.stringify({targetId:t})}),s?.(`Launched ${t===`claude-desktop`?`Claude Desktop`:t===`codex-desktop`?`Codex Desktop`:t} for workspace ${e.branchName}`,`success`)}catch(e){let t=e instanceof Error?e.message:`Failed to launch desktop application`;s?.(t,`error`)}},z=async t=>{if(!C){w(t);try{await u.mutateAsync({workspaceId:e.branchName,assistant:t}),E({assistant:t,cmd:t===`antigravity`?`agy`:t===`claude`?`claude`:t===`codex`?`codex`:`copilot`,timestamp:new Date}),s?.(`Started new ${t} session in terminal`,`success`)}catch(e){let t=e instanceof Error?e.message:`Failed to launch terminal`;s?.(t,`error`)}finally{w(null)}}},B=async(t,n)=>{if(!L.current){L.current=!0,S(t);try{await u.mutateAsync({workspaceId:e.branchName,sessionId:t,assistant:n});let r=Yr(n,t);E({assistant:n,cmd:r,timestamp:new Date}),s?.(`Resumed ${n} session in terminal`,`success`)}catch{let e=Yr(n,t);await cn(e),s?.(`Copied resume command to clipboard: ${e}`,`info`)}finally{S(null),L.current=!1}}},V=async t=>{if(!(!v||R.current)){R.current=t,b(t);try{await o(e,t,`codex`)}finally{R.current=null,b(null)}}},H=(e,t)=>[...e].sort((e,n)=>{switch(t){case`created-desc`:{let t=new Date(e.createdAt||e.updatedAt||0).getTime();return new Date(n.createdAt||n.updatedAt||0).getTime()-t}case`created-asc`:return new Date(e.createdAt||e.updatedAt||0).getTime()-new Date(n.createdAt||n.updatedAt||0).getTime();case`updated-desc`:{let t=new Date(e.updatedAt||e.createdAt||0).getTime();return new Date(n.updatedAt||n.createdAt||0).getTime()-t}case`messages-desc`:return(n.messageCount||0)-(e.messageCount||0);case`title-asc`:return(e.title||``).localeCompare(n.title||``);default:return 0}}),U=(0,Q.useMemo)(()=>{let e=t;if(N!==`all`&&(e=e.filter(e=>e.assistant===N)),j.trim()){let t=j.toLowerCase();e=e.filter(e=>`${e.title} ${e.id} ${e.assistant}`.toLowerCase().includes(t))}return H(e,D)},[t,N,j,D]),ne=(0,Q.useMemo)(()=>H(t.filter(e=>e.assistant===`antigravity`),D),[t,D]),re=(0,Q.useMemo)(()=>H(t.filter(e=>e.assistant===`claude`),D),[t,D]),ie=(0,Q.useMemo)(()=>H(t.filter(e=>e.assistant===`codex`),D),[t,D]),ae=(0,Q.useMemo)(()=>H(t.filter(e=>e.assistant===`copilot`),D),[t,D]),oe=t=>e.assistants?.includes(t)??!1,se=[{id:`antigravity`,name:`Google Antigravity`,cliCommand:`agy`,isDetected:p,isConfigured:oe(`antigravity`),hasApp:_,appName:`IDE`,appTargetId:`antigravity`,sessions:ne,icon:(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-card border border-border/80 shadow-2xs p-0.5`,children:(0,$.jsx)(ln,{className:`size-4`})})},{id:`claude`,name:`Claude Code`,cliCommand:`claude`,isDetected:m,isConfigured:oe(`claude`),hasApp:!1,appName:`App`,appTargetId:`claude`,sessions:re,icon:(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-[#D97757] text-white font-bold text-[10px] shadow-2xs`,children:(0,$.jsx)(fn,{className:`size-3`})})},{id:`codex`,name:`OpenAI Codex`,cliCommand:`codex`,isDetected:h,isConfigured:oe(`codex`),hasApp:v,appName:`Desktop`,appTargetId:`codex-desktop`,sessions:ie,icon:(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-foreground text-background font-bold text-[10px] shadow-2xs`,children:(0,$.jsx)(Lt,{className:`size-3`})})},{id:`copilot`,name:`GitHub Copilot`,cliCommand:`copilot`,isDetected:g,isConfigured:oe(`copilot`),hasApp:!1,appName:`App`,appTargetId:`copilot`,sessions:ae,icon:(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-gradient-to-tr from-purple-600 via-indigo-500 to-blue-600 text-white font-bold text-[10px] shadow-2xs`,children:(0,$.jsx)(dn,{className:`size-3`})})}];return(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between bg-card/60 p-2 rounded-md border border-border/80`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`relative flex-1 min-w-0 max-w-xs`,children:[(0,$.jsx)(ot,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 size-3 text-muted-foreground`}),(0,$.jsx)(`input`,{type:`text`,value:j,onChange:e=>M(e.target.value),placeholder:`Search chat sessions...`,className:`w-full pl-7 pr-6 py-1 text-xs rounded border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:border-primary`}),j&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>M(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground text-[10px] cursor-pointer`,children:`✕`})]}),(0,$.jsxs)(`div`,{className:`hidden md:flex items-center gap-1`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>P(`all`),className:c(`px-2 py-0.5 text-[11px] rounded font-medium transition-colors cursor-pointer`,N===`all`?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`bg-muted/60 text-muted-foreground hover:text-foreground hover:bg-muted`),children:[`All (`,t.length,`)`]}),[`antigravity`,`claude`,`codex`,`copilot`].map(e=>{let n=t.filter(t=>t.assistant===e).length;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>P(N===e?`all`:e),className:c(`px-2 py-0.5 text-[11px] rounded font-medium capitalize transition-colors cursor-pointer`,N===e?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`bg-muted/60 text-muted-foreground hover:text-foreground hover:bg-muted`),children:[e,` (`,n,`)`]},e)})]}),n&&(0,$.jsx)(`span`,{className:`flex items-center gap-1 text-xs text-muted-foreground shrink-0 pl-1`,children:(0,$.jsx)(q,{className:`size-3`})})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,$.jsxs)(en,{children:[(0,$.jsxs)(Xt,{className:`flex items-center gap-1.5 px-2 py-1 text-xs font-medium rounded border border-border bg-card text-foreground hover:bg-accent cursor-pointer shadow-2xs transition-colors`,children:[(0,$.jsx)(Wt,{size:11,className:`text-muted-foreground`}),(0,$.jsx)(`span`,{children:{"created-desc":`Newest`,"created-asc":`Oldest`,"updated-desc":`Recently active`,"messages-desc":`Most turns`,"title-asc":`A–Z`}[D]}),(0,$.jsx)(Ke,{size:10,className:`text-muted-foreground opacity-70`})]}),(0,$.jsxs)(Jt,{align:`end`,className:`w-48`,children:[(0,$.jsx)(`div`,{className:`px-2 py-1 text-[10px] font-semibold text-muted-foreground uppercase tracking-wider`,children:`Order Chats By`}),(0,$.jsxs)(X,{onClick:()=>O(`created-desc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Newest created`}),D===`created-desc`&&(0,$.jsx)(K,{size:12,className:`text-primary`})]}),(0,$.jsxs)(X,{onClick:()=>O(`created-asc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Oldest created`}),D===`created-asc`&&(0,$.jsx)(K,{size:12,className:`text-primary`})]}),(0,$.jsxs)(X,{onClick:()=>O(`updated-desc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Recently active`}),D===`updated-desc`&&(0,$.jsx)(K,{size:12,className:`text-primary`})]}),(0,$.jsxs)(X,{onClick:()=>O(`messages-desc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Most turns`}),D===`messages-desc`&&(0,$.jsx)(K,{size:12,className:`text-primary`})]}),(0,$.jsxs)(X,{onClick:()=>O(`title-asc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Title (A–Z)`}),D===`title-asc`&&(0,$.jsx)(K,{size:12,className:`text-primary`})]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center rounded border border-border bg-card p-0.5 shadow-2xs`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>A(`harness`),title:`Group chats by AI Harness`,className:c(`px-2 py-0.5 text-xs rounded font-medium transition-colors cursor-pointer`,k===`harness`?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`text-muted-foreground hover:text-foreground`),children:`Grouped`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>A(`timeline`),title:`Unified Chronological Timeline`,className:c(`px-2 py-0.5 text-xs rounded font-medium transition-colors cursor-pointer`,k===`timeline`?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`text-muted-foreground hover:text-foreground`),children:`Timeline`})]})]})]}),T&&(0,$.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 p-2.5 rounded-md bg-emerald-500/10 border border-emerald-500/30 text-xs animate-fade-in`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-foreground min-w-0`,children:[(0,$.jsx)(`span`,{className:`size-2 rounded-full bg-emerald-500 animate-pulse shrink-0`}),(0,$.jsxs)(`span`,{className:`truncate`,children:[(0,$.jsx)(`strong`,{children:`Active in terminal:`}),` `,(0,$.jsx)(`code`,{className:`font-mono bg-background/80 px-1.5 py-0.5 rounded text-emerald-400`,children:T.cmd})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:async()=>{await cn(T.cmd),s?.(`Command copied to clipboard!`,`success`)},className:`inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium rounded border border-emerald-500/40 bg-emerald-500/15 text-emerald-400 hover:bg-emerald-500/25 transition-colors cursor-pointer`,children:[(0,$.jsx)(Z,{size:11}),` Copy`]}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>E(null),className:`text-muted-foreground hover:text-foreground cursor-pointer text-xs px-1`,title:`Dismiss banner`,children:`✕`})]})]}),k===`timeline`?(0,$.jsx)(mn,{className:`divide-y divide-border overflow-hidden surface-card`,children:U.length===0?(0,$.jsx)(`div`,{className:`py-8 text-center text-xs text-muted-foreground`,children:j?`No chat sessions match your search filter.`:`No chat sessions recorded yet.`}):U.map(e=>(0,$.jsxs)(`div`,{className:`group flex flex-col gap-2 p-3 hover:bg-accent/40 transition-colors sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[Xr(e.assistant),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-muted-foreground mb-0.5`,children:[(0,$.jsx)(`span`,{className:`font-semibold capitalize text-foreground`,children:e.assistant===`antigravity`?`Antigravity`:e.assistant===`claude`?`Claude`:e.assistant===`codex`?`Codex`:`Copilot`}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsx)(`span`,{className:`font-mono text-muted-foreground/80`,children:e.id.slice(0,8)}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsx)(`span`,{children:Zr(e.createdAt||e.updatedAt)}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{className:`font-mono`,children:[e.messageCount,` `,e.messageCount===1?`turn`:`turns`]})]}),(0,$.jsx)(`p`,{className:`text-xs font-semibold text-foreground truncate`,title:e.title,children:e.title})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 pl-8 sm:pl-0`,children:[(0,$.jsxs)(f,{size:`xs`,variant:`default`,disabled:x===e.id,onClick:()=>void B(e.id,e.assistant),title:`Resume session in terminal (${e.id})`,children:[x===e.id?(0,$.jsx)(q,{className:`size-3`}):(0,$.jsx)(Y,{size:12}),(0,$.jsx)(`span`,{children:`Resume`})]}),(0,$.jsxs)(f,{size:`xs`,variant:`outline`,onClick:()=>{r(e),i([]),a(e.assistant,e.id)},title:`Inspect transcript log`,children:[(0,$.jsx)(Dn,{size:12}),(0,$.jsx)(`span`,{children:`Logs`})]}),e.assistant===`codex`&&v&&(0,$.jsxs)(f,{size:`xs`,variant:`outline`,disabled:y===e.id,onClick:()=>void V(e.id),title:`Open in Codex Desktop`,children:[y===e.id?(0,$.jsx)(q,{className:`size-3`}):(0,$.jsx)(Bt,{size:12}),(0,$.jsx)(`span`,{children:`Desktop`})]}),(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,onClick:async()=>{let t=Yr(e.assistant,e.id);await cn(t),s?.(`Copied: ${t}`,`success`)},title:`Copy CLI resume command`,children:(0,$.jsx)(Z,{size:12})})]})]},e.id))}):(0,$.jsx)(`div`,{className:`space-y-2.5`,children:se.map(e=>{let t=F[e.id]??!1,n=e.sessions.filter(e=>{if(!j.trim())return!0;let t=j.toLowerCase();return`${e.title} ${e.id}`.toLowerCase().includes(t)});return(0,$.jsxs)(mn,{className:`overflow-hidden surface-card`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 p-3 sm:flex-row sm:items-center sm:justify-between bg-muted/20 hover:bg-muted/35 transition-colors cursor-pointer select-none`,onClick:()=>ee(e.id),children:[(0,$.jsxs)(`div`,{className:`flex flex-1 items-center gap-2.5 min-w-0`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground transition-transform`,children:t?(0,$.jsx)(Ke,{size:14}):(0,$.jsx)(nt,{size:14})}),e.icon,(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 min-w-0`,children:[(0,$.jsx)(`span`,{className:`font-bold text-xs text-foreground`,children:e.name}),(0,$.jsxs)(J,{tone:e.isDetected?`success`:`neutral`,dot:e.isDetected,children:[`CLI: `,e.cliCommand]}),e.hasApp&&(0,$.jsx)(J,{tone:`running`,children:e.appName}),(0,$.jsxs)(`span`,{className:`text-[11px] text-muted-foreground font-mono`,children:[`(`,n.length,`)`]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 pl-6 sm:pl-0`,onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(f,{size:`xs`,variant:`default`,disabled:C===e.id,onClick:()=>void z(e.id),title:`Launch new ${e.cliCommand} session in terminal`,children:[C===e.id?(0,$.jsx)(q,{className:`size-3`}):(0,$.jsx)(kt,{size:12}),(0,$.jsx)(`span`,{children:`New Session`})]}),e.hasApp&&(0,$.jsxs)(f,{size:`xs`,variant:`outline`,onClick:()=>void te(e.appTargetId),title:`Open in ${e.appName}`,children:[(0,$.jsx)(Bt,{size:12}),(0,$.jsx)(`span`,{children:e.appName})]})]})]}),t&&(0,$.jsx)(`div`,{className:`divide-y divide-border/60 border-t border-border`,children:n.length===0?(0,$.jsxs)(`div`,{className:`p-4 text-center text-xs text-muted-foreground flex items-center justify-center gap-2`,children:[(0,$.jsx)(`span`,{children:j?`No sessions match your search query.`:`No previous sessions recorded for ${e.name}.`}),!j&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void z(e.id),className:`text-primary font-semibold hover:underline cursor-pointer inline-flex items-center gap-1 text-xs`,children:[(0,$.jsx)(kt,{size:11}),` Start session`]})]}):n.map(e=>(0,$.jsxs)(`div`,{className:`group flex flex-col gap-1.5 px-3.5 py-2.5 hover:bg-accent/40 transition-colors sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 mb-0.5 text-[11px] text-muted-foreground font-mono`,children:[(0,$.jsx)(`span`,{children:e.id.slice(0,8)}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsx)(`span`,{children:Zr(e.createdAt||e.updatedAt)}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{children:[e.messageCount,` `,e.messageCount===1?`turn`:`turns`]})]}),(0,$.jsx)(`p`,{className:`text-xs font-semibold text-foreground truncate`,title:e.title,children:e.title})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,$.jsxs)(f,{size:`xs`,variant:`default`,disabled:x===e.id,onClick:()=>void B(e.id,e.assistant),title:`Resume session in terminal (${e.id})`,children:[x===e.id?(0,$.jsx)(q,{className:`size-3`}):(0,$.jsx)(Y,{size:12}),(0,$.jsx)(`span`,{children:`Resume`})]}),(0,$.jsxs)(f,{size:`xs`,variant:`outline`,onClick:()=>{r(e),i([]),a(e.assistant,e.id)},title:`Inspect transcript log`,children:[(0,$.jsx)(Dn,{size:12}),(0,$.jsx)(`span`,{children:`Logs`})]}),e.assistant===`codex`&&v&&(0,$.jsxs)(f,{size:`xs`,variant:`outline`,disabled:y===e.id,onClick:()=>void V(e.id),title:`Open in Codex Desktop`,children:[y===e.id?(0,$.jsx)(q,{className:`size-3`}):(0,$.jsx)(Bt,{size:12}),(0,$.jsx)(`span`,{children:`Desktop`})]}),(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,onClick:async()=>{let t=Yr(e.assistant,e.id);await cn(t),s?.(`Copied: ${t}`,`success`)},title:`Copy CLI resume command`,children:(0,$.jsx)(Z,{size:12})})]})]},e.id))})]},e.id)})})]})};function $r({ws:e}){let t=e.branchName,n=Kt(t),r=zt(t),i=Ut(t),a=n.data,o=(0,Q.useMemo)(()=>a?.services??[],[a]),s=(0,Q.useMemo)(()=>a?.runningState??[],[a]),l=a?.orchestrationTools??[],u=(0,Q.useMemo)(()=>a?.runningOrchestrators??[],[a]),d=(0,Q.useMemo)(()=>u.filter(e=>e.mode===`pm2`&&e.logName),[u]),[p,m]=(0,Q.useState)(`classic`),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{let e=[...o.map(e=>e.name),...d.map(e=>e.logName)];e.length===0?_!==null&&v(null):(!_||!e.includes(_))&&v(e[0])},[o,d]);let{logs:y,connected:b,clear:x}=Dt(t,_,!0),S=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{S.current?.scrollIntoView({behavior:`smooth`})},[y]);let C=(0,Q.useMemo)(()=>new Set(s.filter(e=>e.pid>0).map(e=>e.name)),[s]),w=(0,Q.useMemo)(()=>new Set(u.map(e=>e.id)),[u]),T=C.size>0,E=p===`matrix`?`term-matrix`:p===`dracula`?`term-dracula`:`term-classic`,D=r.isPending||i.isPending;return(0,$.jsxs)(`div`,{className:`animate-fade-in`,children:[n.isLoading&&(0,$.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-[10px] text-primary`,children:[(0,$.jsx)(q,{className:`size-3`}),(0,$.jsx)(`span`,{className:`font-semibold tracking-wider uppercase`,children:`Scanning service configurations...`})]}),l.length>0&&(0,$.jsxs)(`div`,{className:`mb-4 rounded-md border border-border/80 bg-card p-4 surface-card`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-[10px] font-bold uppercase tracking-wider text-muted-foreground`,children:[(0,$.jsx)(Ot,{size:12,className:`text-info`}),` Orchestration tools`]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:l.map(e=>{let t=w.has(e.id);return(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border/60 bg-muted/20 p-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`h-2 w-2 rounded-full ${t?`bg-success`:`bg-muted-foreground/40`}`}),(0,$.jsx)(`span`,{className:`text-xs font-bold text-foreground`,children:e.tool}),(0,$.jsx)(J,{tone:`idle`,dot:!1,children:e.mode})]}),(0,$.jsx)(`code`,{className:`mt-1 block truncate font-mono text-[9px] text-muted-foreground`,children:e.configPath})]}),(0,$.jsx)(`div`,{className:`shrink-0`,children:t?(0,$.jsxs)(f,{size:`xs`,variant:`destructive`,"aria-label":`Stop ${e.tool}`,disabled:D,onClick:()=>i.mutate({action:`stop`,id:e.id}),children:[(0,$.jsx)(tt,{size:12}),` Stop`]}):(0,$.jsxs)(f,{size:`xs`,"aria-label":`Start ${e.tool}`,disabled:D,onClick:()=>i.mutate({action:`start`,id:e.id}),children:[(0,$.jsx)(jt,{size:12}),` Start`]})})]},e.id)})})]}),(0,$.jsxs)(`div`,{className:`mb-4 rounded-md border border-border/80 bg-card p-4 surface-card`,children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-center justify-between text-xs font-semibold text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:`Workspace Status`}),(0,$.jsx)(J,{tone:T?`running`:`idle`,children:T?`Active`:`Standby`})]}),(0,$.jsx)(`div`,{className:`mb-3 text-xs font-semibold text-foreground`,children:T?`${C.size} process${C.size===1?``:`es`} active`:`All processes offline`}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(f,{size:`sm`,disabled:T||D,onClick:()=>r.mutate({action:`start`}),children:[(0,$.jsx)(jt,{size:13}),` Start All Services`]}),(0,$.jsxs)(f,{size:`sm`,variant:`destructive`,disabled:!T||D,onClick:()=>r.mutate({action:`stop`}),children:[(0,$.jsx)(tt,{size:13}),` Stop All`]})]})]}),(o.length>0||d.length>0)&&(0,$.jsxs)(`div`,{className:`grid grid-cols-1 overflow-hidden rounded-md border border-border/80 bg-card shadow-xs lg:grid-cols-12 surface-card`,children:[(0,$.jsxs)(`div`,{className:`border-b border-border/80 bg-muted/20 p-4 lg:col-span-4 lg:border-b-0 lg:border-r`,children:[(0,$.jsxs)(`h4`,{className:`mb-4 flex items-center gap-1.5 border-b border-border pb-2 text-[10px] font-bold uppercase tracking-wider text-muted-foreground`,children:[(0,$.jsx)(Y,{size:12,className:`text-primary`}),` Background Services`]}),(0,$.jsxs)(`div`,{className:`flex max-h-[400px] flex-col gap-2 overflow-y-auto pr-1`,children:[o.map(e=>{let t=_===e.name,n=C.has(e.name);return(0,$.jsxs)(`div`,{className:c(`flex cursor-pointer flex-col rounded-xl border p-3 transition-colors`,t?`border-primary/40 bg-primary/10 text-foreground`:`border-border bg-card text-muted-foreground hover:border-foreground/15 hover:bg-accent/50 hover:text-foreground`),onClick:()=>v(e.name),children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${n?`bg-success`:`bg-destructive`}`}),(0,$.jsx)(`span`,{className:`truncate text-xs font-bold`,children:e.name})]}),(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,onClick:e=>e.stopPropagation(),children:n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,"aria-label":`Restart ${e.name}`,disabled:D,onClick:()=>r.mutate({action:`restart`,service:e.name}),children:(0,$.jsx)(An,{})}),(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,"aria-label":`Stop ${e.name}`,disabled:D,onClick:()=>r.mutate({action:`stop`,service:e.name}),children:(0,$.jsx)(tt,{})})]}):(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,"aria-label":`Start ${e.name}`,disabled:D,onClick:()=>r.mutate({action:`start`,service:e.name}),children:(0,$.jsx)(jt,{})})})]}),e.port?(0,$.jsxs)(`span`,{className:`mt-2 w-fit rounded border border-border bg-background px-2 py-0.5 font-mono text-[9px] text-muted-foreground`,children:[`Port: `,e.port]}):null,(0,$.jsxs)(`code`,{className:`mt-2 block truncate rounded border border-border bg-muted/40 p-1.5 font-mono text-[9px] text-muted-foreground`,children:[e.command,` `,e.args.join(` `)]})]},e.name)}),d.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`mt-2 border-t border-border pt-3 text-[9px] font-bold uppercase tracking-wider text-muted-foreground`,children:`Orchestrators`}),d.map(e=>{let t=e.logName;return(0,$.jsxs)(`div`,{className:c(`flex cursor-pointer items-center gap-2 rounded-xl border p-3 transition-colors`,_===t?`border-primary/40 bg-primary/10 text-foreground`:`border-border bg-card text-muted-foreground hover:border-foreground/15 hover:bg-accent/50 hover:text-foreground`),onClick:()=>v(t),children:[(0,$.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-success`}),(0,$.jsx)(`span`,{className:`truncate text-xs font-bold`,children:e.tool}),(0,$.jsx)(J,{tone:`idle`,dot:!1,children:e.mode})]},e.id)})]})]})]}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col bg-background lg:col-span-8`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-border bg-muted/40 px-5 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`font-mono text-xs font-bold text-primary`,children:_||`no-service`}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`|`}),(0,$.jsx)(J,{tone:b?`running`:`idle`,children:b?`streaming`:`idle`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3 self-end sm:self-auto`,children:[(0,$.jsx)(`div`,{className:`flex rounded-lg border border-border bg-card p-0.5 text-[9px] font-semibold text-muted-foreground`,children:[`classic`,`matrix`,`dracula`].map(e=>(0,$.jsx)(`button`,{className:c(`cursor-pointer rounded-md px-2 py-1 capitalize transition-colors`,p===e?`bg-primary/10 font-bold text-primary`:`hover:text-foreground`),onClick:()=>m(e),children:e},e))}),(0,$.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,$.jsx)(`button`,{onClick:x,className:`cursor-pointer rounded-lg border border-border bg-card p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:`Clear Console`,children:(0,$.jsx)(dt,{size:13})}),(0,$.jsx)(`button`,{onClick:()=>g(!h),className:`cursor-pointer rounded-lg border border-border bg-card p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:h?`Minimize Console`:`Expand Console`,children:h?(0,$.jsx)(On,{size:13}):(0,$.jsx)(En,{size:13})})]})]})]}),(0,$.jsxs)(`div`,{className:c(`relative overflow-y-auto whitespace-pre-wrap p-5 font-mono text-[10.5px] leading-relaxed selection:bg-primary/20`,E,h?`h-[520px]`:`h-80`),children:[y.trim()?y:(0,$.jsx)(`span`,{className:`font-mono italic text-muted-foreground`,children:`(no log content yet)`}),(0,$.jsx)(`div`,{ref:S})]})]})]})]})}var ei=({ws:e,gitChanges:t,gitChangesLoading:n,syncLoading:r,syncResults:i,commitMessage:a,showCommitModal:o,commitLoading:s,commitResults:c,setSyncResults:l,setCommitResults:u,setCommitMessage:d,setShowCommitModal:p,fetchGitChanges:m,handleSyncAll:h,handleCommitAll:g})=>{let[_,v]=(0,Q.useState)({}),[y,b]=(0,Q.useState)({}),[x,S]=(0,Q.useState)({}),[C,w]=(0,Q.useState)({}),[T,E]=(0,Q.useState)(``),D=async(t,n)=>{let r=`${t}/${n}`,i=!_[r];if(v(e=>({...e,[r]:i})),i&&!y[r]){S(e=>({...e,[r]:!0})),w(e=>({...e,[r]:``}));try{let i=encodeURIComponent(e.branchName),a=await fetch(`/api/workspace/${i}/changes/diff?repo=${encodeURIComponent(t)}&file=${encodeURIComponent(n)}`);if(!a.ok)throw Error(`Failed to load diff: ${a.statusText}`);let o=await a.json();b(e=>({...e,[r]:o.diff||``}))}catch(e){w(t=>({...t,[r]:e.message||`Unknown error`}))}finally{S(e=>({...e,[r]:!1}))}}},O=e=>!e||!e.trim()?(0,$.jsx)(`div`,{className:`p-3 font-mono text-[11px] italic text-muted-foreground`,children:`No diff details available.`}):(0,$.jsx)(`pre`,{className:`custom-scrollbar max-h-[450px] overflow-x-auto overflow-y-auto rounded-xl border border-border bg-muted/40 p-4 font-mono text-[11px] leading-relaxed text-muted-foreground select-text`,children:e.split(`
2
2
  `).map((e,t)=>{let n;return n=e.startsWith(`+`)&&!e.startsWith(`+++`)?`block w-full rounded-sm bg-success/10 px-1 text-success-foreground`:e.startsWith(`-`)&&!e.startsWith(`---`)?`block w-full rounded-sm bg-destructive/10 px-1 text-destructive-foreground`:e.startsWith(`@@`)?`block w-full bg-info/10 px-1 font-semibold italic text-info-foreground`:e.startsWith(`diff`)||e.startsWith(`index`)||e.startsWith(`---`)||e.startsWith(`+++`)?`block w-full font-bold text-muted-foreground`:`block w-full px-1 text-foreground`,(0,$.jsx)(`code`,{className:n,children:e},t)})});return(0,$.jsxs)(`div`,{className:`animate-fade-in`,children:[(0,$.jsxs)(`header`,{className:`flex justify-between items-center mb-6 flex-wrap gap-3`,children:[(0,$.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-bold text-foreground`,children:[(0,$.jsx)(Nt,{size:16,className:`text-primary`}),` Active Workspace Git Diffs`]}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(f,{variant:`outline`,size:`sm`,onClick:()=>m(e.branchName),disabled:n,children:[(0,$.jsx)(Rt,{size:11,className:n?`animate-spin text-primary`:``}),` Refresh Changes`]}),e.mode!==`in-place`&&(0,$.jsxs)(f,{variant:`outline`,size:`sm`,onClick:()=>h(e.branchName),disabled:r,children:[r?(0,$.jsx)(q,{className:`size-3`}):(0,$.jsx)(Rt,{size:11}),` Sync All`]}),(0,$.jsx)(f,{size:`sm`,onClick:()=>p(!0),disabled:t.every(e=>e.files.length===0)||s,children:`Commit & Push All`})]})]}),i&&e.mode!==`in-place`&&(0,$.jsxs)(`div`,{className:`relative mb-5 rounded-xl border border-info/25 bg-info/10 p-5 text-info-foreground shadow-sm`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between border-b border-info/20 pb-2`,children:[(0,$.jsx)(`h5`,{className:`font-mono text-xs font-bold text-foreground`,children:`Rebase / Sync Action Logs`}),(0,$.jsx)(`button`,{className:`cursor-pointer text-[10px] font-bold text-info-foreground hover:text-foreground`,onClick:()=>l(null),children:`Dismiss`})]}),(0,$.jsx)(`div`,{className:`space-y-2`,children:i.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-card p-2 font-mono text-[10px]`,children:[(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.repoName}),(0,$.jsx)(`span`,{className:e.success?`font-bold text-success-foreground`:`font-bold text-destructive-foreground`,children:e.success?`✓ Synced (${e.message})`:`✗ Conflict: ${e.message}`})]},e.repoName))})]}),c&&(0,$.jsxs)(`div`,{className:`relative mb-5 rounded-xl border border-success/25 bg-success/10 p-5 text-success-foreground shadow-sm`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between border-b border-success/20 pb-2`,children:[(0,$.jsx)(`h5`,{className:`font-mono text-xs font-bold text-foreground`,children:`Commit & Push Results`}),(0,$.jsx)(`button`,{className:`cursor-pointer text-[10px] font-bold text-success-foreground hover:text-foreground`,onClick:()=>u(null),children:`Dismiss`})]}),(0,$.jsx)(`div`,{className:`space-y-2`,children:c.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-card p-2 font-mono text-[10px]`,children:[(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.repoName}),(0,$.jsx)(`span`,{className:e.success?`font-bold text-success-foreground`:`font-bold text-destructive-foreground`,children:e.success?`✓ Committed ${e.filesChanged} file(s) (${e.commitHash?e.commitHash.slice(0,7):`no hash`})`:`✗ Error: ${e.message}`})]},e.repoName))})]}),o&&(0,$.jsxs)(`div`,{className:`relative mb-6 rounded-xl border border-border bg-card p-6 shadow-sm animate-rise`,children:[(0,$.jsxs)(`h5`,{className:`mb-3 flex items-center gap-1.5 text-xs font-bold text-foreground`,children:[(0,$.jsx)(jn,{size:13,className:`text-primary`}),` Enter Commit Message`]}),(0,$.jsx)(ke,{type:`text`,className:`mb-4 font-mono text-xs`,placeholder:`feat: implement multi-repo logic...`,value:a,onChange:e=>d(e.target.value),onKeyDown:t=>{t.key===`Enter`&&a.trim()&&g(e.branchName)}}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2.5`,children:[(0,$.jsx)(f,{variant:`outline`,size:`sm`,onClick:()=>{p(!1),d(``)},disabled:s,children:`Cancel`}),(0,$.jsxs)(f,{size:`sm`,onClick:()=>g(e.branchName),disabled:s||!a.trim(),children:[s?(0,$.jsx)(q,{className:`size-3`}):null,s?`Committing...`:`Commit & Push All`]})]})]}),n?(0,$.jsx)(`div`,{className:`flex justify-center py-20`,children:(0,$.jsx)(q,{className:`size-6 text-primary`})}):(0,$.jsx)(`div`,{className:`space-y-6`,children:t.every(e=>e.files.length===0)?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-xl border border-border bg-card py-16 text-center`,children:[(0,$.jsx)(`div`,{className:`mb-3 flex h-10 w-10 items-center justify-center rounded-full border border-success/25 bg-success/10 text-success-foreground shadow-sm`,children:(0,$.jsx)(K,{size:20})}),(0,$.jsx)(`h5`,{className:`text-sm font-bold text-foreground`,children:`No Uncommitted Changes`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Workspace repositories are completely in sync with Git feature branches.`})]}):t.map(e=>{if(e.files.length===0)return null;let t=e.files.length,n=e.files.reduce((e,t)=>e+(t.additions||0),0),r=e.files.reduce((e,t)=>e+(t.deletions||0),0);return(0,$.jsxs)(`div`,{className:`relative rounded-xl border border-border bg-card p-6 transition-colors`,children:[(0,$.jsxs)(`div`,{className:`flex justify-between items-center mb-4 flex-wrap gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,$.jsx)(`h5`,{className:`font-mono text-sm font-bold text-foreground`,children:e.repoName}),(0,$.jsxs)(J,{tone:`warning`,dot:!1,children:[t,` file`,t===1?``:`s`,` changed`]}),(n>0||r>0)&&(0,$.jsxs)(`span`,{className:`rounded border border-border bg-muted/40 px-2 py-0.5 font-mono text-[10px] font-bold`,children:[(0,$.jsxs)(`span`,{className:`font-bold text-success-foreground`,children:[`+`,n]}),` `,(0,$.jsxs)(`span`,{className:`font-bold text-destructive-foreground`,children:[`-`,r]})]})]}),(0,$.jsx)(`span`,{className:`max-w-[280px] truncate font-mono text-[10px] text-muted-foreground`,title:e.repoPath,children:e.repoPath})]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.files.map(t=>{let n=`${e.repoName}/${t.file}`,r=!!_[n],i=!!x[n],a=y[n]||``,o=C[n]||``;return(0,$.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border bg-muted/20 transition-colors hover:border-foreground/15`,children:[(0,$.jsxs)(`div`,{className:`flex cursor-pointer select-none items-center justify-between px-4 py-3 transition-colors hover:bg-accent/50`,onClick:()=>D(e.repoName,t.file),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[r?(0,$.jsx)(Ke,{size:14,className:`shrink-0 text-primary`}):(0,$.jsx)(nt,{size:14,className:`shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`max-w-[240px] truncate font-mono text-[11px] text-foreground sm:max-w-[480px]`,title:t.file,children:t.file}),(t.additions>0||t.deletions>0)&&(0,$.jsxs)(`span`,{className:`ml-1 shrink-0 font-mono text-[9px] font-bold text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`text-success-foreground`,children:[`+`,t.additions]}),` /`,` `,(0,$.jsxs)(`span`,{className:`text-destructive-foreground`,children:[`-`,t.deletions]})]})]}),(0,$.jsx)(`div`,{className:`flex items-center gap-2.5 shrink-0`,children:(0,$.jsx)(`span`,{className:`rounded border px-2 py-0.5 text-[8px] font-bold uppercase tracking-wider ${t.type===`added`?`border-success/25 bg-success/10 text-success-foreground`:t.type===`deleted`?`border-destructive/25 bg-destructive/10 text-destructive-foreground`:`border-warning/25 bg-warning/10 text-warning-foreground`}`,children:t.type})})]}),r&&(0,$.jsx)(`div`,{className:`border-t border-border bg-background p-3`,children:i?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 p-2 font-mono text-[10px] text-primary`,children:[(0,$.jsx)(q,{className:`size-3`}),` Loading diff...`]}):o?(0,$.jsxs)(`div`,{className:`p-2 font-mono text-[10px] text-destructive-foreground`,children:[`Error: `,o]}):(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,$.jsx)(`button`,{onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(a),E(n),setTimeout(()=>E(``),2e3)},className:`cursor-pointer rounded-lg border border-border bg-card p-1.5 text-muted-foreground shadow-sm transition-colors hover:bg-accent hover:text-foreground`,title:`Copy Diff`,children:T===n?(0,$.jsx)(K,{size:12,className:`text-success-foreground`}):(0,$.jsx)(Z,{size:12})})}),O(a)]})})]},t.file)})})]},e.repoName)})})]})},ti=({ws:e,knowledgeContent:t,knowledgeLoading:n,isEditingKnowledge:r,editedKnowledge:i,saveKnowledgeLoading:a,setEditedKnowledge:o,setIsEditingKnowledge:s,handleSaveKnowledge:c})=>{let[l,u]=(0,Q.useState)(`preview`);return(0,$.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-4 surface-card`,children:[(0,$.jsxs)(`header`,{className:`flex justify-between items-center mb-4`,children:[(0,$.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-bold text-foreground`,children:[(0,$.jsx)(Ht,{size:16,className:`text-primary`}),` Persistent Knowledge Memory (nexusflow-knowledge.md)`]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!r&&t&&(0,$.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted/50 p-0.5 rounded-md border border-border/60`,children:[(0,$.jsxs)(f,{size:`xs`,variant:l===`preview`?`secondary`:`ghost`,onClick:()=>u(`preview`),className:`text-[11px] gap-1 px-2`,children:[(0,$.jsx)(Je,{size:11}),` Preview`]}),(0,$.jsxs)(f,{size:`xs`,variant:l===`raw`?`secondary`:`ghost`,onClick:()=>u(`raw`),className:`text-[11px] gap-1 px-2`,children:[(0,$.jsx)(Cn,{size:11}),` Raw`]})]}),r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{variant:`outline`,size:`xs`,onClick:()=>{o(t),s(!1)},disabled:a,children:`Cancel`}),(0,$.jsxs)(f,{size:`xs`,onClick:()=>c(e.branchName),disabled:a,children:[a?(0,$.jsx)(q,{className:`size-3`}):(0,$.jsx)(jn,{size:10}),` Save`]})]}):(0,$.jsxs)(f,{variant:`outline`,size:`xs`,onClick:()=>s(!0),disabled:n,children:[(0,$.jsx)(Mn,{size:10}),` Edit Knowledge`]})]})]}),n?(0,$.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,$.jsx)(Rt,{className:`animate-spin text-primary`,size:20})}):r?(0,$.jsx)(bn,{className:`[&_[data-slot=textarea]]:h-96 [&_[data-slot=textarea]]:resize-y [&_[data-slot=textarea]]:font-mono [&_[data-slot=textarea]]:text-xs`,value:i,onChange:e=>o(e.target.value)}):t?l===`preview`?(0,$.jsx)(`div`,{className:`max-h-[500px] overflow-auto rounded-md border border-border/70 bg-muted/20 p-4`,children:(0,$.jsx)(un,{content:t})}):(0,$.jsx)(`div`,{className:`max-h-[500px] overflow-auto whitespace-pre-wrap rounded-md border border-border/70 bg-muted/30 p-4 font-mono text-xs leading-relaxed text-muted-foreground`,children:t}):(0,$.jsx)(`div`,{className:`rounded-md border border-dashed border-border/80 bg-muted/20 p-6 text-center text-xs text-muted-foreground`,children:`No knowledge file generated yet.`})]})},ni=({planContent:e,planLoading:t})=>{let[n,r]=(0,Q.useState)(`preview`);return(0,$.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-4 surface-card`,children:[(0,$.jsxs)(`header`,{className:`flex justify-between items-center mb-4`,children:[(0,$.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-bold text-foreground`,children:[(0,$.jsx)(Tn,{size:16,className:`text-primary`}),` Inter-Repo Implementation Plan (nexusflow-plan.md)`]}),e&&(0,$.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted/50 p-0.5 rounded-md border border-border/60`,children:[(0,$.jsxs)(f,{size:`xs`,variant:n===`preview`?`secondary`:`ghost`,onClick:()=>r(`preview`),className:`text-[11px] gap-1 px-2`,children:[(0,$.jsx)(Je,{size:11}),` Preview`]}),(0,$.jsxs)(f,{size:`xs`,variant:n===`raw`?`secondary`:`ghost`,onClick:()=>r(`raw`),className:`text-[11px] gap-1 px-2`,children:[(0,$.jsx)(Cn,{size:11}),` Raw`]})]})]}),t?(0,$.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,$.jsx)(Rt,{className:`animate-spin text-primary`,size:20})}):e?n===`preview`?(0,$.jsx)(`div`,{className:`max-h-[500px] overflow-auto rounded-md border border-border/70 bg-muted/20 p-4`,children:(0,$.jsx)(un,{content:e})}):(0,$.jsx)(`div`,{className:`max-h-[500px] overflow-auto whitespace-pre-wrap rounded-md border border-border/70 bg-muted/30 p-4 font-mono text-xs leading-relaxed text-muted-foreground`,children:e}):(0,$.jsx)(`div`,{className:`rounded-md border border-dashed border-border/80 bg-muted/20 p-6 text-center text-xs text-muted-foreground`,children:`No implementation plan generated yet.`})]})},ri={"git-pull-request":Qe,"flask-conical":et,package:Ye,database:Xe,"shield-check":$e,terminal:Y,zap:ft,cpu:it,layers:qe,boxes:At};function ii({ws:e,showToast:t}){let[n,r]=(0,Q.useState)(``),[i,a]=(0,Q.useState)({}),[o,s]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[d,p]=(0,Q.useState)(!1),{data:m=[],isLoading:h}=Et(),{data:g=[],isLoading:_}=Yt(e.branchName),{data:v=[],isLoading:y}=$t(),{data:b,isLoading:x,isError:S}=rn(e.branchName),C=It(),w=Mt(),T=(0,Q.useMemo)(()=>new Set(o??b?.enabledSkills??[]),[o,b?.enabledSkills]),E=(0,Q.useMemo)(()=>new Set(l??b?.enabledAgents??[]),[l,b?.enabledAgents]);(0,Q.useEffect)(()=>{b&&(s([...b.enabledSkills??[]]),u([...b.enabledAgents??[]]))},[b]);let D=(0,Q.useMemo)(()=>{if(!b||o===null||l===null)return!1;let e=new Set(b.enabledSkills??[]),t=new Set(b.enabledAgents??[]);return!!(o.length!==e.size||o.some(t=>!e.has(t))||l.length!==t.size||l.some(e=>!t.has(e)))},[b,o,l]),O=e=>{a(t=>({...t,[e]:!t[e]}))},k=e=>{if(o===null)return;let t=new Set(o);t.has(e)?t.delete(e):t.add(e),s(Array.from(t))},A=e=>{if(l===null)return;let t=new Set(l);t.has(e)?t.delete(e):t.add(e),u(Array.from(t))},j=(e,t,n)=>{if(o===null)return;let r=new Set(o);for(let e of n)t?r.add(e.id):r.delete(e.id);s(Array.from(r))},M=async()=>{if(!(!b||o===null||l===null)){p(!0);try{await C.mutateAsync({workspaceId:e.branchName,expectedRevision:b.revision??0,enabledSkills:o,enabledAgents:l,enabledCategories:m.map(e=>e.id)}),await w.mutateAsync({workspaceId:e.branchName}),t?.(`Skills & agents deployed successfully to workspace context!`,`success`)}catch(e){t?.(e instanceof Error?e.message:`Failed to deploy skills`,`error`)}finally{p(!1)}}},N=(0,Q.useMemo)(()=>{if(!n.trim())return g;let e=n.toLowerCase();return g.filter(t=>t.title?.toLowerCase().includes(e)||t.name.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)||t.tags?.some(t=>t.toLowerCase().includes(e)))},[g,n]),P=(0,Q.useMemo)(()=>{if(!n.trim())return v;let e=n.toLowerCase();return v.filter(t=>t.name.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)||t.category.toLowerCase().includes(e))},[v,n]),F=(0,Q.useMemo)(()=>{let e={};for(let t of m)e[t.id]=N.filter(e=>e.category===t.id);return e},[m,N]);return h||_||y||x?(0,$.jsxs)(`div`,{className:`flex items-center justify-center p-12 gap-3 text-muted-foreground`,children:[(0,$.jsx)(q,{}),(0,$.jsx)(`span`,{className:`text-sm`,children:`Loading workspace skills...`})]}):S?(0,$.jsx)(yn,{className:`py-12 border border-dashed rounded-xl`,children:(0,$.jsxs)(vn,{children:[(0,$.jsx)(hn,{children:`Could not load workspace skills config`}),(0,$.jsx)(_n,{children:`Unable to read .nexusflow/skills.json for this workspace.`})]})}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(mn,{className:`p-4 bg-card/70 flex flex-col sm:flex-row sm:items-center justify-between gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`div`,{className:`p-2 rounded-lg bg-primary/10 text-primary`,children:(0,$.jsx)(At,{className:`h-5 w-5`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-bold text-foreground`,children:`Workspace Skills & Agents`}),(0,$.jsxs)(pn,{variant:`secondary`,className:`text-[10px] font-mono`,children:[T.size,` Skills Active`]}),E.size>0&&(0,$.jsxs)(pn,{variant:`secondary`,className:`text-[10px] font-mono`,children:[E.size,` Agents Active`]})]}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:`Choose which reusable Agent Skills and Codex Agents to deploy into this workspace.`})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(f,{size:`sm`,onClick:M,disabled:d||!D&&T.size===0&&E.size===0,className:`flex items-center gap-1.5 shadow-sm`,children:[d?(0,$.jsx)(q,{className:`size-3.5`}):(0,$.jsx)(Ft,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:d?`Deploying…`:D?`Save & Deploy Changes`:`Re-Deploy to Workspace`})]}),(0,$.jsxs)(f,{render:(0,$.jsx)(at,{to:`/skills`}),variant:`outline`,size:`sm`,className:`flex items-center gap-1.5`,children:[(0,$.jsx)(Bt,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:`Resource Library`})]})]})]}),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(ot,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,$.jsx)(ke,{value:n,onChange:e=>r(e.target.value),placeholder:`Filter skills & agents by keyword...`,className:`pl-9 pr-8 h-8 text-xs bg-card`}),n&&(0,$.jsx)(`button`,{onClick:()=>r(``),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,$.jsx)(st,{className:`h-3.5 w-3.5`})})]}),(0,$.jsxs)(`div`,{className:`space-y-3`,children:[m.map(e=>{let t=ri[e.icon||`boxes`]||At,r=F[e.id]||[];if(n&&r.length===0)return null;let a=!!i[e.id],o=r.length>0&&r.every(e=>T.has(e.id));return(0,$.jsxs)(`div`,{className:`border border-border rounded-xl overflow-hidden bg-card/60 transition-colors`,children:[(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":!a,onClick:()=>O(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),O(e.id))},className:`p-3 flex items-center justify-between cursor-pointer hover:bg-muted/40 transition-colors select-none`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,$.jsx)(`div`,{className:`p-1.5 rounded-md text-white shadow-xs flex items-center justify-center`,style:{backgroundColor:e.color||`#3b82f6`},children:(0,$.jsx)(t,{className:`h-3.5 w-3.5`})}),(0,$.jsx)(`div`,{children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`h4`,{className:`font-semibold text-xs text-foreground`,children:e.name}),(0,$.jsxs)(pn,{variant:`outline`,className:`text-[9px] px-1 py-0`,children:[r.filter(e=>T.has(e.id)).length,`/`,r.length,` active`]})]})})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,onClick:e=>e.stopPropagation(),children:[r.length>0&&(0,$.jsxs)(f,{variant:`ghost`,size:`xs`,onClick:()=>j(e.id,!o,r),className:`h-6 text-[11px] px-2 text-muted-foreground hover:text-foreground`,children:[o?(0,$.jsx)(Ze,{className:`h-3 w-3 mr-1 text-primary`}):(0,$.jsx)(tt,{className:`h-3 w-3 mr-1`}),(0,$.jsx)(`span`,{children:o?`Deselect All`:`Select All`})]}),(0,$.jsx)(`div`,{className:`p-0.5 text-muted-foreground`,children:a?(0,$.jsx)(nt,{className:`h-4 w-4`}):(0,$.jsx)(Ke,{className:`h-4 w-4`})})]})]}),!a&&(0,$.jsx)(`div`,{className:`p-3 border-t border-border/40 bg-background/50`,children:r.length===0?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground py-2 text-center`,children:`No skills in this category.`}):(0,$.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-2.5`,children:r.map(e=>{let t=T.has(e.id);return(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:()=>k(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),k(e.id))},className:c(`p-3 rounded-lg border text-left cursor-pointer transition-all flex flex-col justify-between select-none shadow-2xs`,t?`border-primary/60 bg-primary/5 text-foreground`:`border-border bg-card/70 text-muted-foreground hover:border-foreground/20 hover:text-foreground`),children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2 mb-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,$.jsx)(`span`,{className:c(`grid size-4 shrink-0 place-items-center rounded border transition-colors`,t?`border-primary bg-primary text-primary-foreground`:`border-muted-foreground/40 bg-transparent`),children:t&&(0,$.jsx)(K,{className:`size-3 stroke-[3]`})}),(0,$.jsx)(`span`,{className:`font-mono text-xs font-semibold truncate`,children:e.title||e.name})]}),(0,$.jsx)(pn,{variant:`outline`,className:`text-[9px] px-1 py-0 shrink-0`,children:e.custom?`Custom`:`Template`})]}),(0,$.jsx)(`p`,{className:`text-[11px] text-muted-foreground line-clamp-2 leading-relaxed pl-6`,children:e.description||`No description provided.`}),e.tags&&e.tags.length>0&&(0,$.jsx)(`div`,{className:`mt-2 pl-6 flex items-center gap-1 flex-wrap`,children:e.tags.slice(0,3).map(e=>(0,$.jsxs)(`span`,{className:`text-[9px] font-mono text-muted-foreground bg-muted/60 px-1 py-0.2 rounded`,children:[`#`,e]},e))})]},e.id)})})})]},e.id)}),P.length>0&&(0,$.jsxs)(`div`,{className:`border border-border rounded-xl overflow-hidden bg-card/60 transition-colors`,children:[(0,$.jsx)(`div`,{className:`p-3 flex items-center justify-between border-b border-border/40 select-none`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,$.jsx)(`div`,{className:`p-1.5 rounded-md bg-purple-600 text-white shadow-xs flex items-center justify-center`,children:(0,$.jsx)(Ge,{className:`h-3.5 w-3.5`})}),(0,$.jsx)(`div`,{children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`h4`,{className:`font-semibold text-xs text-foreground`,children:`Codex Native Agents`}),(0,$.jsxs)(pn,{variant:`outline`,className:`text-[9px] px-1 py-0`,children:[P.filter(e=>E.has(e.id)).length,`/`,P.length,` active`]})]})})]})}),(0,$.jsx)(`div`,{className:`p-3 bg-background/50`,children:(0,$.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-2.5`,children:P.map(e=>{let t=E.has(e.id);return(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:()=>A(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),A(e.id))},className:c(`p-3 rounded-lg border text-left cursor-pointer transition-all flex flex-col justify-between select-none shadow-2xs`,t?`border-purple-500/60 bg-purple-500/5 text-foreground`:`border-border bg-card/70 text-muted-foreground hover:border-foreground/20 hover:text-foreground`),children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2 mb-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,$.jsx)(`span`,{className:c(`grid size-4 shrink-0 place-items-center rounded border transition-colors`,t?`border-purple-600 bg-purple-600 text-white`:`border-muted-foreground/40 bg-transparent`),children:t&&(0,$.jsx)(K,{className:`size-3 stroke-[3]`})}),(0,$.jsx)(`span`,{className:`font-mono text-xs font-semibold truncate`,children:e.name})]}),(0,$.jsx)(pn,{variant:`secondary`,className:`text-[9px] px-1 py-0 shrink-0`,children:`.codex/agents`})]}),(0,$.jsx)(`p`,{className:`text-[11px] text-muted-foreground line-clamp-2 leading-relaxed pl-6`,children:e.description||`No description provided.`})]},e.id)})})})]})]}),(0,$.jsxs)(`p`,{className:`text-[11px] text-muted-foreground`,children:[`Saving & deploying will write to `,(0,$.jsx)(`code`,{className:`font-mono text-xs text-foreground`,children:`.nexusflow/skills.json`}),` and materialize files into `,(0,$.jsx)(`code`,{className:`font-mono text-xs text-foreground`,children:`.agents/skills/`}),`, `,(0,$.jsx)(`code`,{className:`font-mono text-xs text-foreground`,children:`.claude/skills/`}),`, and `,(0,$.jsx)(`code`,{className:`font-mono text-xs text-foreground`,children:`.codex/agents/`}),`.`]})]})}var ai=(e,t)=>{let n=`${e} ${t}`.toLowerCase();return n.includes(`insiders`)?(0,$.jsx)(xn,{size:15,className:`text-[#24C05A] shrink-0`}):n.includes(`code`)||n.includes(`vscode`)?(0,$.jsx)(Sn,{size:15,className:`text-[#007ACC] shrink-0`}):n.includes(`antigravity`)?(0,$.jsx)(ln,{className:`size-3.5 shrink-0`}):n.includes(`cursor`)?(0,$.jsx)(Ft,{size:14,className:`text-purple-400 shrink-0`}):n.includes(`powershell`)||n.includes(`pwsh`)?(0,$.jsx)(Y,{size:14,className:`text-sky-400 shrink-0`}):n.includes(`cmd`)||n.includes(`command prompt`)?(0,$.jsx)(Y,{size:14,className:`text-amber-400 shrink-0`}):(0,$.jsx)(rt,{size:14,className:`shrink-0`})},oi=[{value:`overview`,label:`Overview`},{value:`changes`,label:`Changes`},{value:`services`,label:`Services`},{value:`sessions`,label:`Sessions`},{value:`knowledge`,label:`Knowledge`},{value:`plan`,label:`Plan`},{value:`skills`,label:`Skills`}];function si(e){let{workspaces:t,workspaceStatuses:n,selectedId:r,subTab:i,onSelectTab:a,handleCopyPrompt:o,handleDeleteWorkspace:s,deleteWsLoading:l,repos:u,addRepoLoading:d,handleAddRepo:p,showToast:m,sessionProps:h,changesProps:g,knowledgeProps:_,planProps:v}=e,y=t.find(e=>e.branchName===r)??null,b=y?.mode??`worktree`,x=Kt(y?.branchName??null).data?.services??[],S=rn(y?.branchName??null).data,{data:C=[],isLoading:w}=Yt(y?.branchName),T=C.filter(e=>S?.enabledSkills?.includes(e.id)),E=y?y.repos.map(e=>{let t=nn(e),n=g.gitChanges?.find(e=>e.repoName===t),r=n?n.files?.length??0:null,i=x.filter(e=>(e.cwd??``).split(/[\\/]/).includes(t));return{name:t,changedCount:r,ports:Array.from(new Set(i.map(e=>e.port).filter(e=>typeof e==`number`))),serviceCount:i.length}}):[],D=y?u.filter(e=>!y.repos.includes(e.path)):[],O=sn(),[k,A]=(0,Q.useState)(null),j=O.data?.filter(e=>e.kind===`editor`&&e.available)??[],M=j.find(e=>e.id===`vscode-insiders`)||j.find(e=>e.id===`vscode`)||j[0],N=async e=>{if(!(k||!y)){A(e);try{await qt(`/api/workspace/${encodeURIComponent(y.branchName)}/launch`,{method:`POST`,body:JSON.stringify({targetId:e})}),m?.(`Opened workspace in ${e}.`,`success`)}catch(t){m?.(`Failed to open ${e}: ${t instanceof Error?t.message:String(t)}`,`error`)}finally{A(null)}}};return(0,$.jsx)(`div`,{className:`flex flex-col h-full animate-fade-in w-full min-w-0 bg-background`,children:y?(0,$.jsx)(`div`,{className:`flex-1 min-w-0 h-full overflow-y-auto`,children:(0,$.jsx)(`div`,{className:`mx-auto flex w-full max-w-6xl flex-col`,children:(()=>{if(!y)return null;let e=n[y.branchName],t=b===`in-place`?null:e?on(e.syncStatus):null;return(0,$.jsxs)(`div`,{className:`flex flex-col min-w-0 pb-8`,children:[(0,$.jsx)(`div`,{className:`border-b border-border/80 bg-card/40 px-5 py-4`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 md:flex-row md:items-center md:justify-between`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h1`,{className:`truncate font-mono text-base sm:text-lg font-bold text-foreground tracking-tight`,title:y.branchName,children:y.branchName}),(0,$.jsx)(`button`,{type:`button`,onClick:async()=>{await cn(y.branchName)&&m?.(`Copied branch name to clipboard.`,`success`)},className:`text-muted-foreground hover:text-foreground transition-colors p-0.5 cursor-pointer`,title:`Copy branch name`,children:(0,$.jsx)(Z,{size:13})}),(0,$.jsx)(`span`,{className:`inline-flex items-center rounded border border-border/80 bg-muted/60 px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground uppercase tracking-wider`,children:b===`in-place`?`In-place`:`Worktree`})]}),(0,$.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-2.5 font-mono text-[11px] text-muted-foreground`,children:[(0,$.jsxs)(`span`,{children:[y.repos.length,` `,y.repos.length===1?`repo`:`repos`]}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{children:[`Created `,new Date(y.createdAt).toLocaleDateString()]}),e&&e.changedFiles>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-amber-400 font-semibold`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-400`}),e.changedFiles,` modified`]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-emerald-400`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-emerald-400`}),`Clean`]})]}),e&&e.runningServices>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-emerald-400`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-emerald-400 animate-pulse`}),e.runningServices,` active`]})]}),t&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-primary`,children:[(0,$.jsx)(Rt,{size:10}),` `,t.label]})]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[M&&(j.length>1?(0,$.jsxs)(`div`,{className:`inline-flex h-8 items-center rounded-md border border-border bg-card shadow-xs`,children:[(0,$.jsxs)(`button`,{type:`button`,disabled:!!k,onClick:()=>void N(M.id),title:`Open workspace in ${M.name}`,className:`inline-flex h-full items-center gap-1.5 px-3 text-xs font-semibold text-foreground hover:bg-accent transition-colors cursor-pointer rounded-l-md`,children:[k===M.id?(0,$.jsx)(q,{className:`size-3.5`}):ai(M.id,M.name),(0,$.jsx)(`span`,{children:M.name})]}),(0,$.jsxs)(en,{children:[(0,$.jsx)(Xt,{className:`inline-flex h-full w-6 items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent border-l border-border transition-colors cursor-pointer rounded-r-md`,children:(0,$.jsx)(Ke,{size:12})}),(0,$.jsxs)(Jt,{align:`end`,className:`w-52`,children:[(0,$.jsx)(`div`,{className:`px-2 py-1 text-[10px] font-semibold text-muted-foreground uppercase tracking-wider`,children:`Open Workspace In`}),j.map(e=>(0,$.jsxs)(X,{onClick:()=>void N(e.id),className:c(`flex items-center justify-between text-xs`,e.id===M.id&&`font-semibold text-primary`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[ai(e.id,e.name),(0,$.jsx)(`span`,{className:`truncate`,children:e.name})]}),e.id===M.id&&(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground font-mono`,children:`(default)`})]},e.id))]})]})]}):(0,$.jsxs)(f,{variant:`outline`,size:`sm`,disabled:!!k,onClick:()=>void N(M.id),title:`Open workspace in ${M.name}`,className:`font-medium`,children:[k===M.id?(0,$.jsx)(q,{className:`size-3.5`}):ai(M.id,M.name),(0,$.jsx)(`span`,{children:M.name})]})),(0,$.jsxs)(en,{children:[(0,$.jsx)(Xt,{className:`grid size-8 place-items-center rounded-md border border-border bg-card text-muted-foreground hover:text-foreground hover:bg-accent transition-colors cursor-pointer`,children:(0,$.jsx)(wn,{size:14})}),(0,$.jsxs)(Jt,{align:`end`,className:`w-48`,children:[(0,$.jsxs)(X,{onClick:()=>o(y),className:`flex items-center gap-2 text-xs`,children:[(0,$.jsx)(Z,{size:13}),` `,(0,$.jsx)(`span`,{children:`Copy AI Context`})]}),(0,$.jsxs)(X,{onClick:()=>void s(y.branchName),disabled:l===y.branchName,className:`flex items-center gap-2 text-xs text-destructive hover:bg-destructive/10`,children:[(0,$.jsx)(dt,{size:13}),(0,$.jsx)(`span`,{children:l===y.branchName?`Deleting…`:`Delete Workspace`})]})]})]})]})]})}),(0,$.jsx)(`div`,{className:`px-5 pt-3`,children:(0,$.jsxs)(vr,{value:i,onValueChange:e=>typeof e==`string`&&a(y.branchName,e),className:`mb-4`,children:[(0,$.jsx)(yr,{className:`max-w-full overflow-x-auto`,children:oi.map(e=>(0,$.jsx)(br,{value:e.value,children:e.value===`sessions`?`AI & Sessions`:e.label},e.value))}),(0,$.jsxs)(xr,{value:i,className:`animate-fade-in pt-3`,children:[i===`overview`&&(0,$.jsx)(`div`,{className:`flex flex-col gap-3`,children:(0,$.jsxs)(mn,{className:`divide-y divide-border overflow-hidden surface-card`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 p-4 sm:flex-row sm:items-center sm:justify-between bg-muted/20`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`span`,{className:`grid size-9 place-items-center rounded-lg border border-border bg-card text-foreground shadow-xs`,children:y.assistants[0]===`claude`?(0,$.jsx)(fn,{className:`size-4 text-[#D97757]`}):y.assistants[0]===`codex`?(0,$.jsx)(Lt,{className:`size-4 text-foreground`}):y.assistants[0]===`copilot`?(0,$.jsx)(dn,{className:`size-4 text-blue-400`}):(0,$.jsx)(ln,{className:`size-5`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`h3`,{className:`text-xs sm:text-sm font-semibold text-foreground capitalize`,children:y.assistants[0]||`Antigravity`}),(0,$.jsx)(J,{tone:`running`,children:`Configured AI`})]}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:`Workspace rules, prompt templates, and skills ready.`})]})]}),(0,$.jsx)(f,{size:`sm`,variant:`default`,onClick:()=>a(y.branchName,`sessions`),children:`AI Sessions & Harnesses →`})]}),y.description&&(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsx)(`h4`,{className:`text-[11px] font-semibold uppercase tracking-wider text-muted-foreground mb-1.5`,children:`Description`}),(0,$.jsx)(`div`,{className:`text-xs sm:text-sm leading-relaxed text-foreground/90`,children:(0,$.jsx)(un,{content:y.description})})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,$.jsxs)(`h4`,{className:`text-[11px] font-semibold uppercase tracking-wider text-muted-foreground`,children:[`Mapped Repositories (`,y.repos.length,`)`]}),D.length>0&&(0,$.jsx)(Jr,{repos:D,disabled:d,onAdd:e=>{window.confirm(`Add repository "${nn(e)}" to this workspace?\nThis creates a new git worktree and re-runs analysis.`)&&p(y.branchName,e)}})]}),(0,$.jsx)(`div`,{className:`divide-y divide-border/60`,children:E.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between py-2.5 first:pt-0 last:pb-0 text-xs`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 font-mono min-w-0`,children:[(0,$.jsx)(`span`,{className:c(`size-2 rounded-full shrink-0`,e.changedCount===null?`bg-muted-foreground`:e.changedCount>0?`bg-warning`:`bg-success`),title:e.changedCount===null?`Status unknown`:e.changedCount>0?`${e.changedCount} uncommitted changes`:`Clean`}),(0,$.jsx)(`span`,{className:`truncate font-semibold text-foreground`,children:e.name})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground font-mono shrink-0`,children:[e.ports.map(e=>(0,$.jsxs)(`span`,{className:`rounded border border-border bg-muted/80 px-1.5 py-0.5 text-[11px] text-running-foreground`,children:[`:`,e]},e)),(0,$.jsx)(`span`,{children:e.changedCount===null?`—`:e.changedCount>0?`${e.changedCount} changed`:`clean`})]})]},e.name))})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`h4`,{className:`text-[11px] font-semibold uppercase tracking-wider text-muted-foreground`,children:`Active Skills & Capabilities`}),(0,$.jsxs)(`span`,{className:c(`inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium font-mono border`,T.length>0?`border-primary/20 bg-primary/10 text-primary`:`border-border/70 bg-muted/60 text-muted-foreground`),children:[T.length,` active`]})]}),(0,$.jsxs)(f,{size:`xs`,variant:`outline`,onClick:()=>a(y.branchName,`skills`),className:`text-xs gap-1.5`,children:[(0,$.jsx)(kn,{size:12}),(0,$.jsx)(`span`,{children:`Manage Skills`})]})]}),w?(0,$.jsx)(`div`,{className:`h-10 rounded bg-muted/40 animate-pulse`}):T.length===0?(0,$.jsxs)(`div`,{className:`rounded-md border border-dashed border-border/80 bg-muted/20 px-3 py-3 sm:flex sm:items-center sm:justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-foreground`,children:`No active skills configured`}),(0,$.jsx)(`p`,{className:`text-[11px] text-muted-foreground mt-0.5`,children:`Attach PR review toolkits, linters, or test runners to enhance AI assistant context in this workspace.`})]}),(0,$.jsx)(f,{size:`xs`,variant:`ghost`,onClick:()=>a(y.branchName,`skills`),className:`shrink-0 text-primary hover:text-primary mt-2 sm:mt-0 font-medium`,children:`Configure Skills →`})]}):(0,$.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-2`,children:T.map(e=>(0,$.jsxs)(`div`,{className:`flex flex-col justify-between p-2.5 rounded-md border border-border/80 bg-card/60 hover:bg-card transition-colors shadow-2xs gap-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,$.jsx)(`span`,{className:`grid size-5 place-items-center rounded bg-primary/10 text-primary shrink-0`,children:(0,$.jsx)(kn,{size:11})}),(0,$.jsx)(`span`,{className:`text-xs font-semibold text-foreground truncate`,title:e.title||e.name,children:e.title||e.name})]}),(0,$.jsx)(`span`,{className:c(`text-[10px] font-mono uppercase px-1 py-0.5 rounded border shrink-0`,e.custom?`border-purple-500/20 bg-purple-500/10 text-purple-400`:`border-border/70 bg-muted text-muted-foreground`),children:e.custom?`Custom`:`Template`})]}),e.description&&(0,$.jsx)(`p`,{className:`text-[11px] text-muted-foreground line-clamp-2 leading-relaxed`,children:e.description})]},e.id))})]})]})}),i===`sessions`&&(0,$.jsx)(Qr,{ws:y,showToast:m,...h}),i===`services`&&(0,$.jsx)($r,{ws:y}),i===`changes`&&(0,$.jsx)(ei,{ws:y,...g}),i===`knowledge`&&(0,$.jsx)(ti,{ws:y,..._}),i===`plan`&&(0,$.jsx)(ni,{...v}),i===`skills`&&(0,$.jsx)(ii,{ws:y,showToast:m})]})]})})]})})()})}):(0,$.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8`,children:(0,$.jsx)(`div`,{className:`max-w-md w-full`,children:(0,$.jsx)(yn,{children:(0,$.jsxs)(vn,{children:[(0,$.jsx)(gn,{variant:`icon`,children:(0,$.jsx)(Nt,{})}),(0,$.jsx)(hn,{children:`No workspace selected`}),(0,$.jsx)(_n,{children:`Select a workspace from the sidebar to inspect git changes, services, context, or launch AI assistants.`})]})})})})})}export{si as WorkspacesPage};
@@ -1 +1 @@
1
- import{g as e,h as t,m as n}from"./button-BDDZnIHx.js";import{C as r,S as i,_ as a,b as o,g as s,h as c,x as l,y as u}from"./index-V1dDX1O_.js";var d=t(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]);function f(e){return a(e,`alert-dialog`)}var p=e(),m=f,h=u;function g({className:e,...t}){return(0,p.jsx)(r,{forceRender:!0,className:n(`fixed inset-0 z-50 bg-background/60 backdrop-blur-xs transition-all duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0`,e),"data-slot":`alert-dialog-backdrop`,...t})}function _({className:e,...t}){return(0,p.jsx)(s,{className:n(`fixed inset-0 z-50 grid grid-rows-[1fr_auto_1fr] justify-items-center p-4`,e),"data-slot":`alert-dialog-viewport`,...t})}function v({className:e,bottomStickOnMobile:t=!0,...r}){return(0,p.jsxs)(h,{children:[(0,p.jsx)(g,{}),(0,p.jsx)(_,{className:n(t&&`max-sm:grid-rows-[1fr_auto] max-sm:p-0 max-sm:pt-12`),children:(0,p.jsx)(o,{className:n(`-translate-y-[calc(1.25rem*var(--nested-dialogs))] relative row-start-2 flex max-h-full min-h-0 w-full min-w-0 max-w-lg scale-[calc(1-0.1*var(--nested-dialogs))] flex-col rounded-2xl border bg-popover not-dark:bg-clip-padding text-popover-foreground opacity-[calc(1-0.1*var(--nested-dialogs))] shadow-lg/5 transition-[scale,opacity,translate] duration-200 ease-in-out will-change-transform before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-nested:data-ending-style:translate-y-8 data-nested:data-starting-style:translate-y-8 data-nested-dialog-open:origin-top data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,t&&`max-sm:max-w-none max-sm:rounded-none max-sm:border-x-0 max-sm:border-t max-sm:border-b-0 max-sm:opacity-[calc(1-min(var(--nested-dialogs),1))] max-sm:data-ending-style:translate-y-4 max-sm:data-starting-style:translate-y-4 max-sm:before:hidden max-sm:before:rounded-none`,e),"data-slot":`alert-dialog-popup`,...r})})]})}function y({className:e,...t}){return(0,p.jsx)(`div`,{className:n(`flex flex-col gap-2 p-6 text-center max-sm:pb-4 sm:text-left`,e),"data-slot":`alert-dialog-header`,...t})}function b({className:e,variant:t=`default`,...r}){return(0,p.jsx)(`div`,{className:n(`flex flex-col-reverse gap-2 px-6 sm:flex-row sm:justify-end sm:rounded-b-[calc(var(--radius-2xl)-1px)]`,t==="default"&&`border-t bg-muted/72 py-4`,t===`bare`&&`pb-6`,e),"data-slot":`alert-dialog-footer`,...r})}function x({className:e,...t}){return(0,p.jsx)(c,{className:n(`font-heading font-semibold text-xl leading-none`,e),"data-slot":`alert-dialog-title`,...t})}function S({className:e,...t}){return(0,p.jsx)(l,{className:n(`text-muted-foreground text-sm`,e),"data-slot":`alert-dialog-description`,...t})}function C(e){return(0,p.jsx)(i,{"data-slot":`alert-dialog-close`,...e})}export{y as a,d as c,b as i,C as n,v as o,S as r,x as s,m as t};
1
+ import{g as e,h as t,m as n}from"./button-BDDZnIHx.js";import{C as r,S as i,_ as a,b as o,g as s,h as c,x as l,y as u}from"./index-pxzwuRLq.js";var d=t(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]);function f(e){return a(e,`alert-dialog`)}var p=e(),m=f,h=u;function g({className:e,...t}){return(0,p.jsx)(r,{forceRender:!0,className:n(`fixed inset-0 z-50 bg-background/60 backdrop-blur-xs transition-all duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0`,e),"data-slot":`alert-dialog-backdrop`,...t})}function _({className:e,...t}){return(0,p.jsx)(s,{className:n(`fixed inset-0 z-50 grid grid-rows-[1fr_auto_1fr] justify-items-center p-4`,e),"data-slot":`alert-dialog-viewport`,...t})}function v({className:e,bottomStickOnMobile:t=!0,...r}){return(0,p.jsxs)(h,{children:[(0,p.jsx)(g,{}),(0,p.jsx)(_,{className:n(t&&`max-sm:grid-rows-[1fr_auto] max-sm:p-0 max-sm:pt-12`),children:(0,p.jsx)(o,{className:n(`-translate-y-[calc(1.25rem*var(--nested-dialogs))] relative row-start-2 flex max-h-full min-h-0 w-full min-w-0 max-w-lg scale-[calc(1-0.1*var(--nested-dialogs))] flex-col rounded-2xl border bg-popover not-dark:bg-clip-padding text-popover-foreground opacity-[calc(1-0.1*var(--nested-dialogs))] shadow-lg/5 transition-[scale,opacity,translate] duration-200 ease-in-out will-change-transform before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-nested:data-ending-style:translate-y-8 data-nested:data-starting-style:translate-y-8 data-nested-dialog-open:origin-top data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,t&&`max-sm:max-w-none max-sm:rounded-none max-sm:border-x-0 max-sm:border-t max-sm:border-b-0 max-sm:opacity-[calc(1-min(var(--nested-dialogs),1))] max-sm:data-ending-style:translate-y-4 max-sm:data-starting-style:translate-y-4 max-sm:before:hidden max-sm:before:rounded-none`,e),"data-slot":`alert-dialog-popup`,...r})})]})}function y({className:e,...t}){return(0,p.jsx)(`div`,{className:n(`flex flex-col gap-2 p-6 text-center max-sm:pb-4 sm:text-left`,e),"data-slot":`alert-dialog-header`,...t})}function b({className:e,variant:t=`default`,...r}){return(0,p.jsx)(`div`,{className:n(`flex flex-col-reverse gap-2 px-6 sm:flex-row sm:justify-end sm:rounded-b-[calc(var(--radius-2xl)-1px)]`,t==="default"&&`border-t bg-muted/72 py-4`,t===`bare`&&`pb-6`,e),"data-slot":`alert-dialog-footer`,...r})}function x({className:e,...t}){return(0,p.jsx)(c,{className:n(`font-heading font-semibold text-xl leading-none`,e),"data-slot":`alert-dialog-title`,...t})}function S({className:e,...t}){return(0,p.jsx)(l,{className:n(`text-muted-foreground text-sm`,e),"data-slot":`alert-dialog-description`,...t})}function C(e){return(0,p.jsx)(i,{"data-slot":`alert-dialog-close`,...e})}export{y as a,d as c,b as i,C as n,v as o,S as r,x as s,m as t};