cogpit 3.5.5 → 3.6.0

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 (40) hide show
  1. package/dist/cli-runtime.js +209 -129
  2. package/dist/instance-worker.js +120 -27
  3. package/dist/web/assets/{AgentCheckDialog-DdcPaEtO.js → AgentCheckDialog-DeSKJqG3.js} +1 -1
  4. package/dist/web/assets/{AutomationsPanel-DHA6W_CZ.js → AutomationsPanel-BWjD657g.js} +1 -1
  5. package/dist/web/assets/{CogpitBlock-CN0s_qTc.js → CogpitBlock-DEl4Kxl9.js} +1 -1
  6. package/dist/web/assets/CogpitView-BYDVcso1.js +85 -0
  7. package/dist/web/assets/{CommandPaletteHost-D5mRzqIm.js → CommandPaletteHost-BWee2Tov.js} +1 -1
  8. package/dist/web/assets/{ConfigBrowser-CXxrxWWl.js → ConfigBrowser-CQOlu4Gg.js} +1 -1
  9. package/dist/web/assets/{CrewPanel-DJM6YaDN.js → CrewPanel-Dzyxoj46.js} +1 -1
  10. package/dist/web/assets/{HighlightedEditor-G-YJnadM.js → HighlightedEditor-B-bjFcyU.js} +1 -1
  11. package/dist/web/assets/{KeyboardShortcutsDialog-CcyskXfr.js → KeyboardShortcutsDialog-9k4clgVv.js} +1 -1
  12. package/dist/web/assets/{MissionHome-o1MjTkAZ.js → MissionHome-CIwnHTXt.js} +1 -1
  13. package/dist/web/assets/{MobileFileChanges-SeyE4VAV.js → MobileFileChanges-B8RaPAmX.js} +1 -1
  14. package/dist/web/assets/OrbitControls-CcXenNM0.js +1861 -0
  15. package/dist/web/assets/{PluginsDialog-BPHFbLGS.js → PluginsDialog-CYiiMArh.js} +1 -1
  16. package/dist/web/assets/{PreviewPanel-Cb6P4TQ0.js → PreviewPanel-CZazqeGT.js} +1 -1
  17. package/dist/web/assets/{ProjectFilesPanel-BIEcyM9w.js → ProjectFilesPanel-oFw09UPd.js} +1 -1
  18. package/dist/web/assets/{ProjectSwitcherModal-CXI-isj1.js → ProjectSwitcherModal-Bq7zI10J.js} +1 -1
  19. package/dist/web/assets/{TerminalOutput-Cmf1kDEH.js → TerminalOutput-BDmdqvpJ.js} +1 -1
  20. package/dist/web/assets/{ThemeSelectorModal-DKvI2x91.js → ThemeSelectorModal-Crb0YaTK.js} +1 -1
  21. package/dist/web/assets/{WorkflowsPanel-B7bJ_vvB.js → WorkflowsPanel-HqdzMBXP.js} +1 -1
  22. package/dist/web/assets/{WorktreePanel-Bu2NThZy.js → WorktreePanel-DHW4Agwj.js} +1 -1
  23. package/dist/web/assets/auto-render.min-BCDUXXLr.js +1 -0
  24. package/dist/web/assets/d3.min-DhuWnDrq.js +1 -0
  25. package/dist/web/assets/{edition-ui-CpK32xJF.js → edition-ui-Cm-dw9e0.js} +1 -1
  26. package/dist/web/assets/index-BtF9zrz_.css +1 -0
  27. package/dist/web/assets/{index-lC5dVkKa.js → index-C3zvtMTl.js} +1 -1
  28. package/dist/web/assets/{index-DUyjpORE.js → index-DGG5ZuyK.js} +1 -1
  29. package/dist/web/assets/{index-TyUw7tBu.js → index-DUeulx0e.js} +1 -1
  30. package/dist/web/assets/{index-N7rDyHyl.js → index-Dn2vHUyS.js} +2 -2
  31. package/dist/web/assets/index-Dv2TZ38C.js +521 -0
  32. package/dist/web/assets/katex.min-C_ZjXvJu.js +1 -0
  33. package/dist/web/assets/{switch-DFZA-ROd.js → switch-mgfHveYR.js} +1 -1
  34. package/dist/web/assets/three.core.min-D_80lYGt.js +1 -0
  35. package/dist/web/assets/three.module.min-CXftPEfC.js +1 -0
  36. package/dist/web/assets/{vendor-ui-B0az9ATE.js → vendor-ui-ClPj6-Gu.js} +212 -202
  37. package/dist/web/index.html +3 -3
  38. package/package.json +1 -1
  39. package/dist/web/assets/index-BYVl1VlW.js +0 -515
  40. package/dist/web/assets/index-RGkLLDnk.css +0 -1
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PluginsDialog-BPHFbLGS.js","assets/vendor-react-gGw_S5I_.js","assets/index-BYVl1VlW.js","assets/vendor-ui-B0az9ATE.js","assets/vendor-markdown-BEJ8yVzA.js","assets/index-RGkLLDnk.css"])))=>i.map(i=>d[i]);
2
- import{ae as G,ac as ie,av as B,az as Nt,aw as kt,ax as Ct,ay as Rt,at as Lt,bx as Ft,B as J,z as Ut,by as $t,c as bt,F as le,bz as At,y as lt,A as at,au as gt,Z as ot,k as Pe,bA as Bt,bB as Mt,bC as Ht,bD as Gt,bE as Vt,aH as qt,aY as Wt,bF as Xt,bG as Et,bH as Kt,l as Jt,D as Zt,j as Yt,bI as Qt,aC as es,aE as ts,n as ss,o as ns}from"./index-BYVl1VlW.js";import{c as M,j as t,r as S}from"./vendor-react-gGw_S5I_.js";import{S as _t}from"./switch-DFZA-ROd.js";import{bE as is,aG as ls,dn as as,dp as os,dq as rs,dr as cs,d3 as ds,C as us,A as fs,cW as ms,L as rt,af as hs,ds as xs,V as ps,bv as gs,bo as js,aJ as bs,cZ as vs,c3 as ws,aC as Ss,aZ as ys}from"./vendor-ui-B0az9ATE.js";import{P as vt}from"./password-BV9mqUzz.js";import"./vendor-markdown-BEJ8yVzA.js";function Ns(s){const e=M.c(3),{name:n}=s,i=n.toLowerCase();if(i.includes("iphone")||i.includes("android")){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(as,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[0]=d):d=e[0],d}if(i.includes("ipad")||i.includes("tablet")){let d;return e[1]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(os,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[1]=d):d=e[1],d}let l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(rs,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[2]=l):l=e[2],l}function jt(s){const e=Math.floor((Date.now()-s)/1e3);if(e<60)return"just now";const n=Math.floor(e/60);if(n<60)return`${n}m ago`;const i=Math.floor(n/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function ks(s){const e=[`Shared ${jt(s.createdAt)}`,s.lastAccessAt>0?`opened ${jt(s.lastAccessAt)}`:"never opened"];return s.guests>0&&e.push(s.guests===1?"1 guest":`${s.guests} guests`),e.join(" · ")}function Cs(){const s=M.c(12),{shares:e,revoke:n,revokeAll:i}=Ft();let l;s[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("p",{className:"text-xs text-muted-foreground",children:"Shared sessions"}),s[0]=l):l=s[0];let d;s[1]!==i||s[2]!==e.length?(d=e.length>0&&t.jsx(J,{variant:"ghost",size:"xs",className:"text-destructive hover:text-destructive",onClick:()=>void i(),children:"Revoke all"}),s[1]=i,s[2]=e.length,s[3]=d):d=s[3];let a;s[4]!==d?(a=t.jsxs("div",{className:"flex h-6 items-center justify-between",children:[l,d]}),s[4]=d,s[5]=a):a=s[5];let u;s[6]!==n||s[7]!==e?(u=e.length===0?t.jsx("p",{className:"text-xs text-muted-foreground",children:"No sessions are shared."}):t.jsx("div",{className:"flex flex-col gap-1.5",children:e.map(r=>{const h=r.title||r.sessionId;return t.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border px-3 py-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"truncate text-sm text-foreground",children:h}),t.jsx("p",{className:"text-xs text-muted-foreground",children:ks(r)})]}),t.jsx(J,{variant:"ghost",size:"xs","aria-label":`Revoke share of ${h}`,className:"text-destructive hover:text-destructive",onClick:()=>void n(r.sessionId),children:"Revoke"})]},r.sessionId)})}),s[6]=n,s[7]=e,s[8]=u):u=s[8];let c;return s[9]!==a||s[10]!==u?(c=t.jsxs("div",{className:"flex flex-col gap-2",children:[a,u]}),s[9]=a,s[10]=u,s[11]=c):c=s[11],c}function $s(s){const e=M.c(30),{networkAccess:n,setNetworkAccess:i,networkPassword:l,setNetworkPassword:d,showNetworkPassword:a,setShowNetworkPassword:u,hasExistingPassword:c,initialNetworkAccess:r,connectedDevices:h,minPasswordLength:o}=s;let f;e[0]!==n?(f=n?t.jsx(cs,{"data-icon":"inline-start",className:"size-4 text-success"}):t.jsx(ds,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[0]=n,e[1]=f):f=e[1];let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-foreground",children:"Network Access"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Allow other devices to connect"})]}),e[2]=m):m=e[2];let j;e[3]!==f?(j=t.jsxs("div",{className:"flex items-center gap-2",children:[f,m]}),e[3]=f,e[4]=j):j=e[4];let w;e[5]!==i?(w=v=>i(v),e[5]=i,e[6]=w):w=e[6];let x;e[7]!==n||e[8]!==w?(x=t.jsx(_t,{"aria-label":"Network Access",checked:n,onCheckedChange:w}),e[7]=n,e[8]=w,e[9]=x):x=e[9];let C;e[10]!==j||e[11]!==x?(C=t.jsxs("div",{className:"flex items-center justify-between",children:[j,x]}),e[10]=j,e[11]=x,e[12]=C):C=e[12];let p;e[13]!==c||e[14]!==o||e[15]!==n||e[16]!==l||e[17]!==d||e[18]!==u||e[19]!==a?(p=n&&t.jsxs(G,{"data-invalid":l.length>0&&l.length<o,children:[t.jsx(ie,{htmlFor:"network-password",children:"Password"}),t.jsx(B,{children:c&&l.length===0?"A password is already set. Leave blank to keep it.":`Use at least ${o} characters.`}),t.jsxs(Nt,{children:[t.jsx(kt,{id:"network-password",type:a?"text":"password",value:l,onChange:v=>d(v.target.value),placeholder:c?"Enter new password to change":"Set a password for remote access"}),t.jsx(Ct,{align:"inline-end",children:t.jsx(Rt,{size:"icon-xs","aria-label":a?"Hide password":"Show password",onClick:()=>u(!a),children:a?t.jsx(is,{"data-icon":"inline-start"}):t.jsx(ls,{"data-icon":"inline-start"})})})]}),l.length>0&&l.length<o&&t.jsxs(Lt,{children:["Password must be at least ",o," characters (",l.length,"/",o,")"]}),t.jsx(B,{children:"Requires app restart. Remote browsers need an HTTPS reverse proxy; port 19384 remains available to Cogpit hubs and device clients."})]}),e[13]=c,e[14]=o,e[15]=n,e[16]=l,e[17]=d,e[18]=u,e[19]=a,e[20]=p):p=e[20];let g;e[21]!==h||e[22]!==r||e[23]!==n?(g=n&&r&&h.length>0&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("p",{className:"text-xs text-muted-foreground",children:"Connected devices"}),t.jsx("div",{className:"flex flex-col gap-1.5",children:h.map(As)})]}),e[21]=h,e[22]=r,e[23]=n,e[24]=g):g=e[24];let y;e[25]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(Cs,{}),e[25]=y):y=e[25];let N;return e[26]!==C||e[27]!==p||e[28]!==g?(N=t.jsxs("div",{className:"flex flex-col gap-4 border-t pt-5",children:[C,p,g,y]}),e[26]=C,e[27]=p,e[28]=g,e[29]=N):N=e[29],N}function As(s,e){return t.jsxs("div",{className:"flex items-center justify-between rounded-lg border px-3 py-2",children:[t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx(Ns,{name:s.deviceName}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm text-foreground",children:s.deviceName}),t.jsx("p",{className:"text-xs text-muted-foreground",children:s.ip})]})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"size-1.5 rounded-full bg-success"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:jt(s.lastActivity)})]})]},`${s.ip}-${e}`)}const Es=["auto","path","npm","bundled","custom"],xt={source:"auto"},_s=["path","npm","bundled"];function Is(s){return Es.includes(s)}function Ts(s){if(!s||typeof s!="object")return;const{source:e,path:n}=s;if(!(!Is(e)||e==="auto"))return e==="custom"?typeof n=="string"&&n.trim()?{source:e,path:n.trim()}:void 0:{source:e}}function ct(s){const e=M.c(16),{icon:n,title:i,summary:l,open:d}=s;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(J,{type:"button",variant:"ghost",className:"h-auto w-full justify-between px-0 font-medium hover:bg-transparent"}),e[0]=a):a=e[0];let u;e[1]!==n?(u=t.jsx(n,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[1]=n,e[2]=u):u=e[2];let c;e[3]!==u||e[4]!==i?(c=t.jsxs("span",{className:"flex items-center gap-2",children:[u,i]}),e[3]=u,e[4]=i,e[5]=c):c=e[5];let r;e[6]!==l?(r=t.jsx("span",{className:"truncate",children:l}),e[6]=l,e[7]=r):r=e[7];let h;e[8]!==d?(h=d?t.jsx(us,{className:"size-4 shrink-0"}):t.jsx(fs,{className:"size-4 shrink-0"}),e[8]=d,e[9]=h):h=e[9];let o;e[10]!==r||e[11]!==h?(o=t.jsxs("span",{className:"flex min-w-0 items-center gap-1 text-xs font-normal text-muted-foreground",children:[r,h]}),e[10]=r,e[11]=h,e[12]=o):o=e[12];let f;return e[13]!==c||e[14]!==o?(f=t.jsxs(Ut,{render:a,children:[c,o]}),e[13]=c,e[14]=o,e[15]=f):f=e[15],f}const Te={auto:"Automatic",path:"Installed on PATH",npm:"Global npm install",bundled:"Bundled with Cogpit",custom:"Custom path"};function It(s,e){return e?`v${e} · ${s}`:s}function Ps(s,e){return s===null?"Checking installed binaries…":e?e.version===null?`${e.path} did not report a version — check the path.`:`Now running: ${It(e.path,e.version)}`:"No launchable binary for the saved choice — sessions cannot start."}function zs(s){return s!==null&&s.version!==null}function Ds(s){const e=M.c(82),{kind:n,value:i,onChange:l,disabled:d,reportVersion:a}=s;let u;e[0]!==n?(u=$t(n),e[0]=n,e[1]=u):u=e[1];const{displayName:c}=u,[r,h]=S.useState(null),[o,f]=S.useState(!1),m=`agent-executable-${n}`;let j;e[2]!==n?(j=()=>{let Q=!1;return le(`/api/agent-executable/${n}`).then(Ls).then(W=>{Q||h(W)}).catch(Rs),()=>{Q=!0}},e[2]=n,e[3]=j):j=e[3];let w;e[4]!==n||e[5]!==a?(w=[n,a],e[4]=n,e[5]=a,e[6]=w):w=e[6],S.useEffect(j,w);let x,C,p,g,y,N,v,k,$,_,I,O,A;if(e[7]!==d||e[8]!==c||e[9]!==m||e[10]!==l||e[11]!==o||e[12]!==(r==null?void 0:r.active)||e[13]!==(r==null?void 0:r.candidates)||e[14]!==i.path||e[15]!==i.source){const Q=new Map((r==null?void 0:r.candidates.map(Os))??[]);g=(r==null?void 0:r.active)??null;let W;e[29]!==d||e[30]!==m||e[31]!==l||e[32]!==i.path||e[33]!==i.source?(W=(D,ee,ae,oe)=>{const De=oe===void 0?!0:oe,se=`${m}-${D}`;return t.jsxs(G,{orientation:"horizontal",children:[t.jsx("input",{type:"radio",id:se,name:m,className:"mt-1 size-4 shrink-0 accent-primary",checked:i.source===D,disabled:d||!De,onChange:()=>l(D==="custom"?{source:D,path:i.path??""}:{source:D})}),t.jsxs(At,{children:[t.jsx(ie,{htmlFor:se,children:ee}),t.jsx(B,{className:"break-all",children:ae})]})]},D)},e[29]=d,e[30]=m,e[31]=l,e[32]=i.path,e[33]=i.source,e[34]=W):W=e[34],y=W;const dt=D=>{const ee=Q.get(D);return y(D,Te[D],ee?It(ee.path,ee.version):"Not found on this machine.",ee!==void 0||i.source===D)},L=g?`${Te[i.source]} · v${g.version??"?"}`:Te[i.source];p=lt,O=o,A=f,N="flex flex-col gap-2";const Ie=`${c} executable`;e[35]!==o||e[36]!==L||e[37]!==Ie?(v=t.jsx(ct,{icon:ms,title:Ie,summary:L,open:o}),e[35]=o,e[36]=L,e[37]=Ie,e[38]=v):v=e[38],C=at,x=G,e[39]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx(B,{children:"Which binary new sessions run. Automatic uses your installed CLI unless it is older than the copy bundled with Cogpit."}),e[39]=I):I=e[39],k="flex flex-col gap-2 pl-1",e[40]!==y?($=y("auto",Te.auto,"Recommended."),e[40]=y,e[41]=$):$=e[41],_=_s.map(dt),e[7]=d,e[8]=c,e[9]=m,e[10]=l,e[11]=o,e[12]=r==null?void 0:r.active,e[13]=r==null?void 0:r.candidates,e[14]=i.path,e[15]=i.source,e[16]=x,e[17]=C,e[18]=p,e[19]=g,e[20]=y,e[21]=N,e[22]=v,e[23]=k,e[24]=$,e[25]=_,e[26]=I,e[27]=O,e[28]=A}else x=e[16],C=e[17],p=e[18],g=e[19],y=e[20],N=e[21],v=e[22],k=e[23],$=e[24],_=e[25],I=e[26],O=e[27],A=e[28];const H=`${c} executable path`,V=i.source==="custom"?i.path??"":"",F=d||i.source!=="custom";let E;e[42]!==l?(E=Q=>l({source:"custom",path:Q.target.value}),e[42]=l,e[43]=E):E=e[43];let R;e[44]!==H||e[45]!==V||e[46]!==F||e[47]!==E?(R=t.jsx(gt,{"aria-label":H,value:V,placeholder:"/path/to/binary",disabled:F,onChange:E,className:"mt-1"}),e[44]=H,e[45]=V,e[46]=F,e[47]=E,e[48]=R):R=e[48];let T;e[49]!==y||e[50]!==R?(T=y("custom",Te.custom,R),e[49]=y,e[50]=R,e[51]=T):T=e[51];let U;e[52]!==T||e[53]!==k||e[54]!==$||e[55]!==_?(U=t.jsxs("div",{className:k,children:[$,_,T]}),e[52]=T,e[53]=k,e[54]=$,e[55]=_,e[56]=U):U=e[56];let P;e[57]!==g?(P=zs(g)?"text-muted-foreground":"text-destructive",e[57]=g,e[58]=P):P=e[58];let X;e[59]!==P?(X=bt("text-xs",P),e[59]=P,e[60]=X):X=e[60];let q;e[61]!==g||e[62]!==r?(q=Ps(r,g),e[61]=g,e[62]=r,e[63]=q):q=e[63];let Z;e[64]!==X||e[65]!==q?(Z=t.jsx("p",{className:X,"aria-live":"polite",children:q}),e[64]=X,e[65]=q,e[66]=Z):Z=e[66];let z;e[67]!==x||e[68]!==U||e[69]!==Z||e[70]!==I?(z=t.jsxs(x,{children:[I,U,Z]}),e[67]=x,e[68]=U,e[69]=Z,e[70]=I,e[71]=z):z=e[71];let K;e[72]!==C||e[73]!==z?(K=t.jsx(C,{children:z}),e[72]=C,e[73]=z,e[74]=K):K=e[74];let Y;return e[75]!==p||e[76]!==N||e[77]!==v||e[78]!==K||e[79]!==O||e[80]!==A?(Y=t.jsxs(p,{open:O,onOpenChange:A,className:N,children:[v,K]}),e[75]=p,e[76]=N,e[77]=v,e[78]=K,e[79]=O,e[80]=A,e[81]=Y):Y=e[81],Y}function Os(s){return[s.source,s]}function Rs(){}function Ls(s){return s.ok?s.json():null}function Tt(s){return s instanceof Error?s.message:String(s)}async function wt(s){try{const e=await le(`/api/agent-accounts/${s}`);return e.status===404?{status:"missing"}:e.ok?await e.json():{status:"error",error:await ot(e,`Request failed (${e.status})`)}}catch(e){return{status:"error",error:Tt(e)}}}function Fs(s){const[e,n]=S.useState(null),[i,l]=S.useState(null),[d,a]=S.useState(null);S.useEffect(()=>{let c=!1;return wt(s).then(r=>{c||n(r)}),()=>{c=!0}},[s]);const u=S.useCallback(async c=>{l(c),a(null);try{const r=await le(`/api/agent-accounts/${s}/switch`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slot:c})});if(!r.ok){a({kind:"failed",error:await ot(r,`Request failed (${r.status})`)});return}a({kind:"switched",result:await r.json()}),n(await wt(s))}catch(r){a({kind:"failed",error:Tt(r)})}finally{l(null)}},[s]);return{report:e,switchingSlot:i,outcome:d,switchTo:u}}const Us={token_expired:"Token expired",relogin_required:"Login needed",no_credentials:"No credentials",keychain_unavailable:"Keychain locked",foreign_credential:"Credential mismatch",api_key:"API key",unavailable:"Usage unavailable"};function pt(s){return s.alias??s.email}function St(s){const e=M.c(18),{label:n,window:i}=s;if(!i)return null;const l=i.pct>=80,d=i.resetsIn?`${n} window resets in ${i.resetsIn}`:void 0;let a;e[0]!==n?(a=t.jsx("span",{className:"w-5",children:n}),e[0]=n,e[1]=a):a=e[1];const u=l?"bg-destructive":"bg-primary";let c;e[2]!==u?(c=bt("absolute inset-y-0 left-0 rounded-full",u),e[2]=u,e[3]=c):c=e[3];const r=`${i.pct}%`;let h;e[4]!==r?(h={width:r},e[4]=r,e[5]=h):h=e[5];let o;e[6]!==c||e[7]!==h?(o=t.jsx("span",{className:"relative h-1 w-16 overflow-hidden rounded-full bg-muted",children:t.jsx("span",{className:c,style:h})}),e[6]=c,e[7]=h,e[8]=o):o=e[8];let f;e[9]!==i.pct?(f=Math.round(i.pct),e[9]=i.pct,e[10]=f):f=e[10];let m;e[11]!==f?(m=t.jsxs("span",{className:"tabular-nums",children:[f,"%"]}),e[11]=f,e[12]=m):m=e[12];let j;return e[13]!==d||e[14]!==a||e[15]!==o||e[16]!==m?(j=t.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",title:d,children:[a,o,m]}),e[13]=d,e[14]=a,e[15]=o,e[16]=m,e[17]=j):j=e[17],j}function yt(s){return/[.!?]$/.test(s)?s:`${s}.`}function Bs(s,e){if(s.kind==="failed")return`Switch failed: ${s.error}`;const{result:n}=s,i=[yt(n.message)];return n.switched&&i.push(n.credentialStore==="keychain"?`Running ${e} sessions pick it up within about 30 seconds; restart one to apply it immediately.`:`New messages in ${e} use it from now on.`),[...i,...n.warnings.map(yt)].join(" ")}function Ms(s){const e=M.c(31),{kind:n,disabled:i}=s;let l;e[0]!==n?(l=$t(n),e[0]=n,e[1]=l):l=e[1];const{displayName:d}=l,{report:a,switchingSlot:u,outcome:c,switchTo:r}=Fs(n),[h,o]=S.useState(!1);if(a===null||a.status==="missing")return null;let f,m;if(e[2]!==a.accounts||e[3]!==a.status){f=a.status==="ok"?a.accounts:[];const k=f.find(Hs)??null;m=a.status==="error"?"Unavailable":k?`${pt(k)} · ${f.length} account${f.length===1?"":"s"}`:`${f.length} account${f.length===1?"":"s"}`,e[2]=a.accounts,e[3]=a.status,e[4]=f,e[5]=m}else f=e[4],m=e[5];const j=m,w=`${d} accounts`;let x;e[6]!==h||e[7]!==j||e[8]!==w?(x=t.jsx(ct,{icon:hs,title:w,summary:j,open:h}),e[6]=h,e[7]=j,e[8]=w,e[9]=x):x=e[9];const C=a.status==="ok"&&`Logins managed by ${a.tool}${a.version?` ${a.version}`:""}. `;let p;e[10]!==d||e[11]!==C?(p=t.jsxs(B,{children:[C,"Switching changes which login ",d," sessions authenticate with."]}),e[10]=d,e[11]=C,e[12]=p):p=e[12];let g;e[13]!==f||e[14]!==i||e[15]!==a.error||e[16]!==a.status||e[17]!==r||e[18]!==u?(g=a.status==="error"?t.jsx("p",{className:"text-xs text-destructive",role:"alert",children:a.error}):t.jsx("ul",{className:"flex flex-col divide-y divide-border rounded-md border border-border",children:f.map(k=>{const $=u===k.slot,_=Us[k.usageStatus];return t.jsxs("li",{className:"flex items-center gap-3 px-3 py-2",children:[t.jsx("span",{className:"w-5 shrink-0 text-xs tabular-nums text-muted-foreground",children:k.slot}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[t.jsx("span",{className:"truncate text-sm font-medium",children:pt(k)}),k.alias&&t.jsx("span",{className:"truncate text-xs text-muted-foreground",children:k.email}),k.active&&t.jsx(Pe,{children:"Active"}),k.disabled&&t.jsx(Pe,{variant:"outline",children:"Disabled"}),_&&t.jsx(Pe,{variant:"destructive",children:_})]}),k.organization&&t.jsx("span",{className:"truncate text-xs text-muted-foreground",children:k.organization}),k.usage&&t.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1",children:[t.jsx(St,{label:"5h",window:k.usage.fiveHour}),t.jsx(St,{label:"7d",window:k.usage.sevenDay})]})]}),!i&&!k.active&&t.jsx(J,{type:"button",size:"sm",variant:"outline",disabled:u!==null,onClick:()=>r(k.slot),"aria-label":`Switch to ${pt(k)}`,children:$?t.jsxs(t.Fragment,{children:[t.jsx(rt,{"data-icon":"inline-start",className:"size-3.5 animate-spin"}),"Switching…"]}):"Switch"})]},k.slot)})}),e[13]=f,e[14]=i,e[15]=a.error,e[16]=a.status,e[17]=r,e[18]=u,e[19]=g):g=e[19];let y;e[20]!==d||e[21]!==c?(y=c&&t.jsx("p",{className:bt("text-xs",c.kind==="failed"?"text-destructive":"text-muted-foreground"),"aria-live":"polite",role:c.kind==="failed"?"alert":"status",children:Bs(c,d)}),e[20]=d,e[21]=c,e[22]=y):y=e[22];let N;e[23]!==p||e[24]!==g||e[25]!==y?(N=t.jsx(at,{children:t.jsxs(G,{children:[p,g,y]})}),e[23]=p,e[24]=g,e[25]=y,e[26]=N):N=e[26];let v;return e[27]!==h||e[28]!==x||e[29]!==N?(v=t.jsxs(lt,{open:h,onOpenChange:o,className:"flex flex-col gap-2",children:[x,N]}),e[27]=h,e[28]=x,e[29]=N,e[30]=v):v=e[30],v}function Hs(s){return s.active}function Pt(s){return s instanceof Error?s.message:String(s)}async function Gs(){try{const s=await le("/api/slack");return s.ok?{status:"ok",report:await s.json()}:{status:"error",error:await ot(s,`Request failed (${s.status})`)}}catch(s){return{status:"error",error:Pt(s)}}}function Vs(){const[s,e]=S.useState({status:"loading"}),[n,i]=S.useState(null),[l,d]=S.useState(null),a=S.useRef(0),u=S.useCallback(async()=>{const o=++a.current,f=await Gs();o===a.current&&e(f)},[]);S.useEffect(()=>{const o=a;return u(),()=>{o.current++}},[u]);const c=S.useCallback(async(o,f)=>{i(o),d(null),a.current++;try{const m=await le("/api/slack",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:o,...f})});m.ok||d(await ot(m,`Request failed (${m.status})`)),await u()}catch(m){d(Pt(m))}finally{i(null)}},[u]),r=S.useCallback((o,f)=>c(o,{action:"update",autoPost:f}),[c]),h=S.useCallback(o=>c(o,{action:"unlink"}),[c]);return{state:s,busy:n,error:l,refresh:u,setAutoPost:r,unlink:h}}const zt={connected:{label:"Connected",variant:"default"},connecting:{label:"Connecting",variant:"outline"},reconnecting:{label:"Reconnecting",variant:"outline"},stopped:{label:"Stopped",variant:"destructive"},failed:{label:"Failed",variant:"destructive"}};function ze(s,e){return`${s} ${e}${s===1?"":"s"}`}function qs(s){const e=[ze(s.dms.length,"DM"),...s.channels.length?[ze(s.channels.length,"channel")]:[]].join(" and ");return`Listens to ${s.allow.join(", ")} · posts to ${e} · ${s.postedToday}/${s.dailyCap} posts today`}function Ws(s){var n;const e=[];if(s.connection.lastError&&s.connection.state!=="connected"&&e.push(s.connection.lastError),s.pending.length){const i=(n=s.pending.find(l=>l.lastError))==null?void 0:n.lastError;e.push(`${ze(s.pending.length,"message")} waiting to reach the session${i?`: ${i}`:""}`)}return s.uncertain.length&&e.push(`${ze(s.uncertain.length,"message")} may not have arrived; check the session's queue`),e}function Xs(s){if(!s)return"Unavailable";const{links:e}=s;return e.length===0?"No links":e.length===1?`1 link · ${zt[e[0].connection.state].label}`:`${ze(e.length,"link")} · ${e.filter(n=>n.connection.state==="connected").length} connected`}function Ks(s){const e=M.c(40),{link:n,disabled:i,busy:l,onAutoPost:d,onUnlink:a}=s,u=zt[n.connection.state],c=n.title??n.sessionId;let r;e[0]!==n.sessionId||e[1]!==n.title?(r=n.title??`Session ${n.sessionId.slice(0,8)}`,e[0]=n.sessionId,e[1]=n.title,e[2]=r):r=e[2];let h;e[3]!==n.sessionId||e[4]!==r?(h=t.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",title:n.sessionId,children:r}),e[3]=n.sessionId,e[4]=r,e[5]=h):h=e[5];let o;e[6]!==n.bot?(o=t.jsx(Pe,{variant:"outline",children:n.bot}),e[6]=n.bot,e[7]=o):o=e[7];let f;e[8]!==u.label||e[9]!==u.variant?(f=t.jsx(Pe,{variant:u.variant,children:u.label}),e[8]=u.label,e[9]=u.variant,e[10]=f):f=e[10];let m;e[11]!==h||e[12]!==o||e[13]!==f?(m=t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[h,o,f]}),e[11]=h,e[12]=o,e[13]=f,e[14]=m):m=e[14];let j;e[15]!==n?(j=qs(n),e[15]=n,e[16]=j):j=e[16];let w;e[17]!==j?(w=t.jsx("p",{className:"text-xs text-muted-foreground",children:j}),e[17]=j,e[18]=w):w=e[18];let x;e[19]!==n?(x=Ws(n).map(Js),e[19]=n,e[20]=x):x=e[20];const C=`Post the session’s answer in the thread for ${c}`,p=i||l;let g;e[21]!==n.autoPost||e[22]!==d||e[23]!==p||e[24]!==C?(g=t.jsxs("span",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t.jsx(_t,{size:"sm","aria-label":C,checked:n.autoPost,disabled:p,onCheckedChange:d}),"Post the session’s answer in the thread"]}),e[21]=n.autoPost,e[22]=d,e[23]=p,e[24]=C,e[25]=g):g=e[25];let y;e[26]!==l||e[27]!==i||e[28]!==n.bot||e[29]!==c||e[30]!==a?(y=!i&&t.jsxs(J,{type:"button",size:"sm",variant:"outline",disabled:l,onClick:a,"aria-label":`Unlink ${c} from ${n.bot}`,children:[l&&t.jsx(rt,{"data-icon":"inline-start",className:"size-3.5 animate-spin"}),"Unlink"]}),e[26]=l,e[27]=i,e[28]=n.bot,e[29]=c,e[30]=a,e[31]=y):y=e[31];let N;e[32]!==g||e[33]!==y?(N=t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[g,y]}),e[32]=g,e[33]=y,e[34]=N):N=e[34];let v;return e[35]!==N||e[36]!==m||e[37]!==w||e[38]!==x?(v=t.jsxs("li",{className:"flex flex-col gap-2 px-3 py-2",children:[m,w,x,N]}),e[35]=N,e[36]=m,e[37]=w,e[38]=x,e[39]=v):v=e[39],v}function Js(s){return t.jsx("p",{className:"text-xs text-destructive",children:s},s)}function Zs(s){const e=M.c(62),{disabled:n}=s,{state:i,busy:l,error:d,refresh:a,setAutoPost:u,unlink:c}=Vs(),[r,h]=S.useState(!1);if(i.status==="loading")return null;const o=i.status==="ok"?i.report:null;if(o&&!o.available)return null;let f;e[0]!==(o==null?void 0:o.links)?(f=(o==null?void 0:o.links)??[],e[0]=o==null?void 0:o.links,e[1]=f):f=e[1];const m=f;let j,w,x,C,p,g,y,N,v,k,$;if(e[2]!==l||e[3]!==n||e[4]!==m||e[5]!==r||e[6]!==a||e[7]!==o||e[8]!==u||e[9]!==i.error||e[10]!==i.status||e[11]!==c){let H;e[23]!==m?(H=T=>!m.some(U=>U.bot===T.name),e[23]=m,e[24]=H):H=e[24];const V=((o==null?void 0:o.bots)??[]).filter(H);x=lt,N=r,v=h,k="flex flex-col gap-2";let F;e[25]!==o?(F=Xs(o),e[25]=o,e[26]=F):F=e[26],e[27]!==r||e[28]!==F?($=t.jsx(ct,{icon:xs,title:"Slack links",summary:F,open:r}),e[27]=r,e[28]=F,e[29]=$):$=e[29],w=at,j=G;let E;e[30]===Symbol.for("react.memo_cache_sentinel")?(E=t.jsxs(B,{children:["A linked session receives DMs, Assistant threads, thread replies and mentions from the people it listens to, and may post only to their DMs and the channels it lists. Add bots and link sessions with ",t.jsx("code",{children:"cogpit-session slack"}),"."]}),e[30]=E):E=e[30];let R;e[31]===Symbol.for("react.memo_cache_sentinel")?(R=t.jsx(ps,{className:"size-3.5"}),e[31]=R):R=e[31],e[32]!==a?(C=t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[E,t.jsx(J,{type:"button",size:"icon-sm",variant:"ghost",onClick:a,"aria-label":"Refresh Slack links",children:R})]}),e[32]=a,e[33]=C):C=e[33],e[34]!==i.error||e[35]!==i.status?(p=i.status==="error"&&t.jsx("p",{className:"text-xs text-destructive",role:"alert",children:i.error}),e[34]=i.error,e[35]=i.status,e[36]=p):p=e[36],e[37]!==l||e[38]!==n||e[39]!==m||e[40]!==u||e[41]!==c?(g=m.length>0&&t.jsx("ul",{className:"flex flex-col divide-y divide-border rounded-md border border-border",children:m.map(T=>t.jsx(Ks,{link:T,disabled:n,busy:l===T.sessionId,onAutoPost:U=>u(T.sessionId,U),onUnlink:()=>c(T.sessionId)},T.sessionId))}),e[37]=l,e[38]=n,e[39]=m,e[40]=u,e[41]=c,e[42]=g):g=e[42],y=V.length>0&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Not linked: ",V.map(Ys).join(", ")]}),e[2]=l,e[3]=n,e[4]=m,e[5]=r,e[6]=a,e[7]=o,e[8]=u,e[9]=i.error,e[10]=i.status,e[11]=c,e[12]=j,e[13]=w,e[14]=x,e[15]=C,e[16]=p,e[17]=g,e[18]=y,e[19]=N,e[20]=v,e[21]=k,e[22]=$}else j=e[12],w=e[13],x=e[14],C=e[15],p=e[16],g=e[17],y=e[18],N=e[19],v=e[20],k=e[21],$=e[22];let _;e[43]!==d?(_=d&&t.jsx("p",{className:"text-xs text-destructive",role:"alert",children:d}),e[43]=d,e[44]=_):_=e[44];let I;e[45]!==j||e[46]!==_||e[47]!==C||e[48]!==p||e[49]!==g||e[50]!==y?(I=t.jsxs(j,{children:[C,p,g,y,_]}),e[45]=j,e[46]=_,e[47]=C,e[48]=p,e[49]=g,e[50]=y,e[51]=I):I=e[51];let O;e[52]!==w||e[53]!==I?(O=t.jsx(w,{children:I}),e[52]=w,e[53]=I,e[54]=O):O=e[54];let A;return e[55]!==x||e[56]!==O||e[57]!==N||e[58]!==v||e[59]!==k||e[60]!==$?(A=t.jsxs(x,{open:N,onOpenChange:v,className:k,children:[$,O]}),e[55]=x,e[56]=O,e[57]=N,e[58]=v,e[59]=k,e[60]=$,e[61]=A):A=e[61],A}function Ys(s){return`${s.name}${s.teamName?` (${s.teamName})`:""}`}function Qs(s){const e=M.c(18),{active:n,onSignInStarted:i}=s,[l,d]=S.useState(!1),a=Bt(n),u=a.agents;let c;e[0]!==u?(c=(u==null?void 0:u.filter(en).length)??0,e[0]=u,e[1]=c):c=e[1];const h=u?`${c} of ${u.length} ready`:"Checking…";let o;e[2]!==l||e[3]!==h?(o=t.jsx(ct,{icon:gs,title:"Agents",summary:h,open:l}),e[2]=l,e[3]=h,e[4]=o):o=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(B,{children:"The coding agents installed on this computer, and whether you're signed in to each."}),e[5]=f):f=e[5];let m;e[6]!==a||e[7]!==i?(m=t.jsx(Ht,{check:a,onSignInStarted:i}),e[6]=a,e[7]=i,e[8]=m):m=e[8];let j;e[9]!==a?(j=t.jsx("div",{children:t.jsx(Gt,{check:a})}),e[9]=a,e[10]=j):j=e[10];let w;e[11]!==m||e[12]!==j?(w=t.jsx(at,{children:t.jsxs(G,{children:[f,m,j]})}),e[11]=m,e[12]=j,e[13]=w):w=e[13];let x;return e[14]!==l||e[15]!==o||e[16]!==w?(x=t.jsxs(lt,{open:l,onOpenChange:d,className:"flex flex-col gap-2",children:[o,w]}),e[14]=l,e[15]=o,e[16]=w,e[17]=x):x=e[17],x}function en(s){return Mt(s)==="ready"}const tn=S.lazy(()=>Kt(()=>import("./PluginsDialog-BPHFbLGS.js"),__vite__mapDeps([0,1,2,3,4,5])).then(s=>({default:s.PluginsDialog}))),sn=Et().filter(s=>s.cli.bundledBySdk).map(s=>s.kind),nn=Et().filter(s=>s.capabilities.accountSwitching).map(s=>s.kind);function ln(s,e){return s.source===e.source&&(s.source!=="custom"||s.path===e.path)}function an(s){const e=M.c(5),{status:n,error:i}=s;if(n==="validating"){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[t.jsx(rt,{"data-icon":"inline-start",className:"size-3.5 animate-spin"}),"Checking path..."]}),e[0]=l):l=e[0],l}if(n==="valid"){let l;return e[1]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsxs("div",{className:"flex items-center gap-2 text-sm text-success",children:[t.jsx(Ss,{"data-icon":"inline-start",className:"size-3.5"}),"Folder found"]}),e[1]=l):l=e[1],l}if(n==="invalid"&&i){let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(ys,{"data-icon":"inline-start",className:"size-3.5"}),e[2]=l):l=e[2];let d;return e[3]!==i?(d=t.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[l,i]}),e[3]=i,e[4]=d):d=e[4],d}return null}function bn(s){const e=M.c(123),{open:n,currentPath:i,onClose:l,onSaved:d}=s,[a,u]=S.useState(i),[c,r]=S.useState(!1),{status:h,error:o,debouncedValidate:f,reset:m,save:j}=Vt();let w;e[0]===Symbol.for("react.memo_cache_sentinel")?(w=qt(),e[0]=w):w=e[0];const x=w;let C;e[1]===Symbol.for("react.memo_cache_sentinel")?(C=Wt("configWrite"),e[1]=C):C=e[1];const p=C,[g,y]=S.useState(!1),N=Xt(n&&g&&p),[v,k]=S.useState(!1),[$,_]=S.useState(""),[I,O]=S.useState(!1),[A,H]=S.useState(""),[V,F]=S.useState(""),[E,R]=S.useState(""),[T,U]=S.useState(""),[P,X]=S.useState(!1),[q,Z]=S.useState(!1),[z,K]=S.useState(xt),[Y,Q]=S.useState(0),[W,dt]=S.useState(xt),[L,Ie]=S.useState(!1),[D,ee]=S.useState(!1);let ae;e[2]===Symbol.for("react.memo_cache_sentinel")?(ae=[],e[2]=ae):ae=e[2];const[oe,De]=S.useState(ae);let se,Oe;e[3]!==i||e[4]!==n||e[5]!==m?(se=()=>{n&&(u(i),m(),le("/api/config").then(un).then(b=>{const te=(b==null?void 0:b.networkAccess)||!1;k(te),Ie(te),ee(!!(b!=null&&b.networkPassword)),_("");const tt=(b==null?void 0:b.terminalApp)||"";H(tt),F(tt);const st=(b==null?void 0:b.editorApp)||"";R(st),U(st);const nt=(b==null?void 0:b.useBuiltInEditor)===!0;X(nt),Z(nt);const it=Ts(b==null?void 0:b.agentExecutable)??xt;K(it),dt(it),te&&(b!=null&&b.networkPassword)&&!x?le("/api/connected-devices").then(dn).then(_e=>De((_e==null?void 0:_e.devices)||[])).catch(cn):De([])}).catch(rn))},Oe=[n,i,m,x],e[3]=i,e[4]=n,e[5]=m,e[6]=se,e[7]=Oe):(se=e[6],Oe=e[7]),S.useEffect(se,Oe);let Re;e[8]!==f?(Re=b=>{const te=b.target.value;u(te),f(te)},e[8]=f,e[9]=Re):Re=e[9];const ut=Re;let Le;e[10]!==z||e[11]!==E||e[12]!==L||e[13]!==v||e[14]!==$||e[15]!==d||e[16]!==a||e[17]!==j||e[18]!==A||e[19]!==P?(Le=async()=>{r(!0);const b=await j(a,{networkAccess:x?L:v,networkPassword:!x&&v&&$.length>0?$:void 0,terminalApp:A.trim()||void 0,editorApp:E.trim()||void 0,useBuiltInEditor:P,agentExecutable:z});b.success&&b.claudeDir&&(Q(on),d(b.claudeDir)),r(!1)},e[10]=z,e[11]=E,e[12]=L,e[13]=v,e[14]=$,e[15]=d,e[16]=a,e[17]=j,e[18]=A,e[19]=P,e[20]=Le):Le=e[20];const re=Le;let Fe;e[21]!==z||e[22]!==E||e[23]!==D||e[24]!==W||e[25]!==T||e[26]!==L||e[27]!==V||e[28]!==q||e[29]!==v||e[30]!==$||e[31]!==h||e[32]!==A||e[33]!==P?(Fe=function(){var _e;if(h==="validating"||h==="invalid")return!1;const te=h==="valid",tt=!x&&(v!==L||v&&$.length>0),st=A!==V,nt=E!==T||P!==q,it=!ln(z,W);if(!te&&!tt&&!st&&!nt&&!it||z.source==="custom"&&!((_e=z.path)!=null&&_e.trim()))return!1;if(!x&&v){const Dt=$.length>0&&$.length<vt,Ot=!D&&$.length===0;if(Dt||Ot)return!1}return!0},e[21]=z,e[22]=E,e[23]=D,e[24]=W,e[25]=T,e[26]=L,e[27]=V,e[28]=q,e[29]=v,e[30]=$,e[31]=h,e[32]=A,e[33]=P,e[34]=Fe):Fe=e[34];const ne=Fe();let ce;e[35]!==l?(ce=b=>{b||l()},e[35]=l,e[36]=ce):ce=e[36];let Ue;e[37]===Symbol.for("react.memo_cache_sentinel")?(Ue=t.jsxs(Jt,{children:[t.jsx(Zt,{className:"text-foreground",children:"Configuration"}),t.jsx(Yt,{className:"text-muted-foreground",children:"Manage local paths, preferred apps, and remote access."})]}),e[37]=Ue):Ue=e[37];const ft=ne?void 0:l;let de;e[38]!==n||e[39]!==ft?(de=t.jsx(Qs,{active:n,onSignInStarted:ft}),e[38]=n,e[39]=ft,e[40]=de):de=e[40];let Be;e[41]===Symbol.for("react.memo_cache_sentinel")?(Be=p&&t.jsxs(G,{children:[t.jsx(ie,{children:"Plugins"}),t.jsx(B,{children:"Manage installed plugins, their settings, and service connections."}),t.jsx(J,{type:"button",variant:"outline",onClick:()=>y(!0),children:"Manage plugins"})]}),e[41]=Be):Be=e[41];let Me,He;e[42]===Symbol.for("react.memo_cache_sentinel")?(Me=t.jsx(ie,{htmlFor:"claude-directory",children:"Claude directory"}),He=t.jsx(B,{children:"The directory containing your Claude configuration."}),e[42]=Me,e[43]=He):(Me=e[42],He=e[43]);let Ge;e[44]===Symbol.for("react.memo_cache_sentinel")?(Ge=t.jsx(Ct,{children:t.jsx(js,{"data-icon":"inline-start"})}),e[44]=Ge):Ge=e[44];let ue;e[45]!==ne||e[46]!==re||e[47]!==c?(ue=b=>{b.key==="Enter"&&ne&&!c&&re()},e[45]=ne,e[46]=re,e[47]=c,e[48]=ue):ue=e[48];let fe;e[49]!==ut||e[50]!==a||e[51]!==ue?(fe=t.jsxs(Nt,{children:[Ge,t.jsx(kt,{id:"claude-directory",value:a,onChange:ut,placeholder:"/Users/you/.claude",disabled:!p,onKeyDown:ue})]}),e[49]=ut,e[50]=a,e[51]=ue,e[52]=fe):fe=e[52];let me;e[53]!==o||e[54]!==h?(me=t.jsx("div",{"aria-live":"polite",children:t.jsx(an,{status:h,error:o})}),e[53]=o,e[54]=h,e[55]=me):me=e[55];let he;e[56]!==fe||e[57]!==me?(he=t.jsxs(G,{children:[Me,He,fe,me]}),e[56]=fe,e[57]=me,e[58]=he):he=e[58];let Ve,qe;e[59]===Symbol.for("react.memo_cache_sentinel")?(Ve=t.jsxs(ie,{htmlFor:"terminal-application",children:[t.jsx(bs,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),"Terminal application"]}),qe=t.jsx(B,{children:"Leave blank to use the system default for Ctrl+Cmd+T."}),e[59]=Ve,e[60]=qe):(Ve=e[59],qe=e[60]);let We;e[61]===Symbol.for("react.memo_cache_sentinel")?(We=b=>H(b.target.value),e[61]=We):We=e[61];let xe;e[62]!==A?(xe=t.jsxs(G,{children:[Ve,qe,t.jsx(gt,{id:"terminal-application",value:A,onChange:We,placeholder:"Ghostty, iTerm, or /path/to/binary",disabled:!p})]}),e[62]=A,e[63]=xe):xe=e[63];let Xe;e[64]===Symbol.for("react.memo_cache_sentinel")?(Xe=b=>X(b===!0),e[64]=Xe):Xe=e[64];let pe;e[65]!==P?(pe=t.jsx(Qt,{id:"use-built-in-editor",checked:P,onCheckedChange:Xe,disabled:!p}),e[65]=P,e[66]=pe):pe=e[66];let Ke;e[67]===Symbol.for("react.memo_cache_sentinel")?(Ke=t.jsxs(At,{children:[t.jsxs(ie,{htmlFor:"use-built-in-editor",children:[t.jsx(vs,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),"Open files in Cogpit"]}),t.jsx(B,{children:"Files and diffs open in Cogpit’s file workspace instead of launching an external editor."})]}),e[67]=Ke):Ke=e[67];let ge;e[68]!==pe?(ge=t.jsxs(G,{orientation:"horizontal",children:[pe,Ke]}),e[68]=pe,e[69]=ge):ge=e[69];let Je;e[70]===Symbol.for("react.memo_cache_sentinel")?(Je=t.jsxs(ie,{htmlFor:"editor-application",children:[t.jsx(ws,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),"Editor application"]}),e[70]=Je):Je=e[70];const mt=P?"Not used while files open in Cogpit.":"Leave blank to use $VISUAL or automatic detection.";let je;e[71]!==mt?(je=t.jsx(B,{children:mt}),e[71]=mt,e[72]=je):je=e[72];let Ze;e[73]===Symbol.for("react.memo_cache_sentinel")?(Ze=b=>R(b.target.value),e[73]=Ze):Ze=e[73];const ht=!p||P;let be;e[74]!==E||e[75]!==ht?(be=t.jsx(gt,{id:"editor-application",value:E,onChange:Ze,placeholder:"cursor, code, zed, or /path/to/binary",disabled:ht}),e[74]=E,e[75]=ht,e[76]=be):be=e[76];let ve;e[77]!==je||e[78]!==be?(ve=t.jsxs(G,{children:[Je,je,be]}),e[77]=je,e[78]=be,e[79]=ve):ve=e[79];let we;e[80]!==z||e[81]!==Y?(we=sn.map(b=>t.jsx(Ds,{kind:b,value:z,onChange:K,disabled:!p,reportVersion:Y},b)),e[80]=z,e[81]=Y,e[82]=we):we=e[82];let Ye,Qe;e[83]===Symbol.for("react.memo_cache_sentinel")?(Ye=nn.map(b=>t.jsx(Ms,{kind:b,disabled:!p},b)),Qe=t.jsx(Zs,{disabled:!p}),e[83]=Ye,e[84]=Qe):(Ye=e[83],Qe=e[84]);let Se;e[85]!==oe||e[86]!==D||e[87]!==L||e[88]!==v||e[89]!==$||e[90]!==I?(Se=!x&&p&&t.jsx($s,{networkAccess:v,setNetworkAccess:k,networkPassword:$,setNetworkPassword:_,showNetworkPassword:I,setShowNetworkPassword:O,hasExistingPassword:D,initialNetworkAccess:L,connectedDevices:oe,minPasswordLength:vt}),e[85]=oe,e[86]=D,e[87]=L,e[88]=v,e[89]=$,e[90]=I,e[91]=Se):Se=e[91];let ye;e[92]!==de||e[93]!==he||e[94]!==xe||e[95]!==ge||e[96]!==ve||e[97]!==we||e[98]!==Se?(ye=t.jsxs(es,{children:[de,Be,he,xe,ge,ve,we,Ye,Qe,Se]}),e[92]=de,e[93]=he,e[94]=xe,e[95]=ge,e[96]=ve,e[97]=we,e[98]=Se,e[99]=ye):ye=e[99];let Ne;e[100]!==l?(Ne=t.jsx(J,{variant:"outline",onClick:l,children:"Cancel"}),e[100]=l,e[101]=Ne):Ne=e[101];let ke;e[102]!==ne||e[103]!==re||e[104]!==c?(ke=p&&t.jsx(J,{disabled:!ne||c,onClick:re,children:c?t.jsxs(t.Fragment,{children:[t.jsx(rt,{"data-icon":"inline-start",className:"size-4 animate-spin"}),"Saving..."]}):"Save"}),e[102]=ne,e[103]=re,e[104]=c,e[105]=ke):ke=e[105];let Ce;e[106]!==Ne||e[107]!==ke?(Ce=t.jsxs(ts,{children:[Ne,ke]}),e[106]=Ne,e[107]=ke,e[108]=Ce):Ce=e[108];let $e;e[109]!==ye||e[110]!==Ce?($e=t.jsxs(ss,{className:"max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-lg",children:[Ue,ye,Ce]}),e[109]=ye,e[110]=Ce,e[111]=$e):$e=e[111];let Ae;e[112]!==n||e[113]!==$e||e[114]!==ce?(Ae=t.jsx(ns,{open:n,onOpenChange:ce,children:$e}),e[112]=n,e[113]=$e,e[114]=ce,e[115]=Ae):Ae=e[115];let Ee;e[116]!==n||e[117]!==g||e[118]!==N?(Ee=n&&g&&p&&t.jsx(S.Suspense,{fallback:null,children:t.jsx(tn,{client:N.client,state:N,currentPath:null,onClose:()=>y(!1)})}),e[116]=n,e[117]=g,e[118]=N,e[119]=Ee):Ee=e[119];let et;return e[120]!==Ae||e[121]!==Ee?(et=t.jsxs(t.Fragment,{children:[Ae,Ee]}),e[120]=Ae,e[121]=Ee,e[122]=et):et=e[122],et}function on(s){return s+1}function rn(){}function cn(){}function dn(s){return s.json()}function un(s){return s.json()}export{bn as ConfigDialog};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PluginsDialog-CYiiMArh.js","assets/vendor-react-gGw_S5I_.js","assets/index-Dv2TZ38C.js","assets/vendor-ui-ClPj6-Gu.js","assets/vendor-markdown-BEJ8yVzA.js","assets/index-BtF9zrz_.css"])))=>i.map(i=>d[i]);
2
+ import{ae as G,ac as ie,av as B,az as Nt,aw as kt,ax as Ct,ay as Rt,at as Lt,bx as Ft,B as J,z as Ut,by as $t,c as bt,F as le,bz as At,y as lt,A as at,au as gt,Z as ot,k as Pe,bA as Bt,bB as Mt,bC as Ht,bD as Gt,bE as Vt,aH as qt,aY as Wt,bF as Xt,bG as Et,bH as Kt,l as Jt,D as Zt,j as Yt,bI as Qt,aC as es,aE as ts,n as ss,o as ns}from"./index-Dv2TZ38C.js";import{c as M,j as t,r as S}from"./vendor-react-gGw_S5I_.js";import{S as _t}from"./switch-mgfHveYR.js";import{bE as is,aG as ls,dn as as,dp as os,dq as rs,dr as cs,d3 as ds,C as us,A as fs,cW as ms,L as rt,af as hs,ds as xs,V as ps,bv as gs,bo as js,aJ as bs,cZ as vs,c3 as ws,aC as Ss,aZ as ys}from"./vendor-ui-ClPj6-Gu.js";import{P as vt}from"./password-BV9mqUzz.js";import"./vendor-markdown-BEJ8yVzA.js";function Ns(s){const e=M.c(3),{name:n}=s,i=n.toLowerCase();if(i.includes("iphone")||i.includes("android")){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(as,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[0]=d):d=e[0],d}if(i.includes("ipad")||i.includes("tablet")){let d;return e[1]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(os,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[1]=d):d=e[1],d}let l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(rs,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[2]=l):l=e[2],l}function jt(s){const e=Math.floor((Date.now()-s)/1e3);if(e<60)return"just now";const n=Math.floor(e/60);if(n<60)return`${n}m ago`;const i=Math.floor(n/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function ks(s){const e=[`Shared ${jt(s.createdAt)}`,s.lastAccessAt>0?`opened ${jt(s.lastAccessAt)}`:"never opened"];return s.guests>0&&e.push(s.guests===1?"1 guest":`${s.guests} guests`),e.join(" · ")}function Cs(){const s=M.c(12),{shares:e,revoke:n,revokeAll:i}=Ft();let l;s[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("p",{className:"text-xs text-muted-foreground",children:"Shared sessions"}),s[0]=l):l=s[0];let d;s[1]!==i||s[2]!==e.length?(d=e.length>0&&t.jsx(J,{variant:"ghost",size:"xs",className:"text-destructive hover:text-destructive",onClick:()=>void i(),children:"Revoke all"}),s[1]=i,s[2]=e.length,s[3]=d):d=s[3];let a;s[4]!==d?(a=t.jsxs("div",{className:"flex h-6 items-center justify-between",children:[l,d]}),s[4]=d,s[5]=a):a=s[5];let u;s[6]!==n||s[7]!==e?(u=e.length===0?t.jsx("p",{className:"text-xs text-muted-foreground",children:"No sessions are shared."}):t.jsx("div",{className:"flex flex-col gap-1.5",children:e.map(r=>{const h=r.title||r.sessionId;return t.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border px-3 py-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"truncate text-sm text-foreground",children:h}),t.jsx("p",{className:"text-xs text-muted-foreground",children:ks(r)})]}),t.jsx(J,{variant:"ghost",size:"xs","aria-label":`Revoke share of ${h}`,className:"text-destructive hover:text-destructive",onClick:()=>void n(r.sessionId),children:"Revoke"})]},r.sessionId)})}),s[6]=n,s[7]=e,s[8]=u):u=s[8];let c;return s[9]!==a||s[10]!==u?(c=t.jsxs("div",{className:"flex flex-col gap-2",children:[a,u]}),s[9]=a,s[10]=u,s[11]=c):c=s[11],c}function $s(s){const e=M.c(30),{networkAccess:n,setNetworkAccess:i,networkPassword:l,setNetworkPassword:d,showNetworkPassword:a,setShowNetworkPassword:u,hasExistingPassword:c,initialNetworkAccess:r,connectedDevices:h,minPasswordLength:o}=s;let f;e[0]!==n?(f=n?t.jsx(cs,{"data-icon":"inline-start",className:"size-4 text-success"}):t.jsx(ds,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[0]=n,e[1]=f):f=e[1];let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-foreground",children:"Network Access"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Allow other devices to connect"})]}),e[2]=m):m=e[2];let j;e[3]!==f?(j=t.jsxs("div",{className:"flex items-center gap-2",children:[f,m]}),e[3]=f,e[4]=j):j=e[4];let w;e[5]!==i?(w=v=>i(v),e[5]=i,e[6]=w):w=e[6];let x;e[7]!==n||e[8]!==w?(x=t.jsx(_t,{"aria-label":"Network Access",checked:n,onCheckedChange:w}),e[7]=n,e[8]=w,e[9]=x):x=e[9];let C;e[10]!==j||e[11]!==x?(C=t.jsxs("div",{className:"flex items-center justify-between",children:[j,x]}),e[10]=j,e[11]=x,e[12]=C):C=e[12];let p;e[13]!==c||e[14]!==o||e[15]!==n||e[16]!==l||e[17]!==d||e[18]!==u||e[19]!==a?(p=n&&t.jsxs(G,{"data-invalid":l.length>0&&l.length<o,children:[t.jsx(ie,{htmlFor:"network-password",children:"Password"}),t.jsx(B,{children:c&&l.length===0?"A password is already set. Leave blank to keep it.":`Use at least ${o} characters.`}),t.jsxs(Nt,{children:[t.jsx(kt,{id:"network-password",type:a?"text":"password",value:l,onChange:v=>d(v.target.value),placeholder:c?"Enter new password to change":"Set a password for remote access"}),t.jsx(Ct,{align:"inline-end",children:t.jsx(Rt,{size:"icon-xs","aria-label":a?"Hide password":"Show password",onClick:()=>u(!a),children:a?t.jsx(is,{"data-icon":"inline-start"}):t.jsx(ls,{"data-icon":"inline-start"})})})]}),l.length>0&&l.length<o&&t.jsxs(Lt,{children:["Password must be at least ",o," characters (",l.length,"/",o,")"]}),t.jsx(B,{children:"Requires app restart. Remote browsers need an HTTPS reverse proxy; port 19384 remains available to Cogpit hubs and device clients."})]}),e[13]=c,e[14]=o,e[15]=n,e[16]=l,e[17]=d,e[18]=u,e[19]=a,e[20]=p):p=e[20];let g;e[21]!==h||e[22]!==r||e[23]!==n?(g=n&&r&&h.length>0&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("p",{className:"text-xs text-muted-foreground",children:"Connected devices"}),t.jsx("div",{className:"flex flex-col gap-1.5",children:h.map(As)})]}),e[21]=h,e[22]=r,e[23]=n,e[24]=g):g=e[24];let y;e[25]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(Cs,{}),e[25]=y):y=e[25];let N;return e[26]!==C||e[27]!==p||e[28]!==g?(N=t.jsxs("div",{className:"flex flex-col gap-4 border-t pt-5",children:[C,p,g,y]}),e[26]=C,e[27]=p,e[28]=g,e[29]=N):N=e[29],N}function As(s,e){return t.jsxs("div",{className:"flex items-center justify-between rounded-lg border px-3 py-2",children:[t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx(Ns,{name:s.deviceName}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm text-foreground",children:s.deviceName}),t.jsx("p",{className:"text-xs text-muted-foreground",children:s.ip})]})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"size-1.5 rounded-full bg-success"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:jt(s.lastActivity)})]})]},`${s.ip}-${e}`)}const Es=["auto","path","npm","bundled","custom"],xt={source:"auto"},_s=["path","npm","bundled"];function Is(s){return Es.includes(s)}function Ts(s){if(!s||typeof s!="object")return;const{source:e,path:n}=s;if(!(!Is(e)||e==="auto"))return e==="custom"?typeof n=="string"&&n.trim()?{source:e,path:n.trim()}:void 0:{source:e}}function ct(s){const e=M.c(16),{icon:n,title:i,summary:l,open:d}=s;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(J,{type:"button",variant:"ghost",className:"h-auto w-full justify-between px-0 font-medium hover:bg-transparent"}),e[0]=a):a=e[0];let u;e[1]!==n?(u=t.jsx(n,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),e[1]=n,e[2]=u):u=e[2];let c;e[3]!==u||e[4]!==i?(c=t.jsxs("span",{className:"flex items-center gap-2",children:[u,i]}),e[3]=u,e[4]=i,e[5]=c):c=e[5];let r;e[6]!==l?(r=t.jsx("span",{className:"truncate",children:l}),e[6]=l,e[7]=r):r=e[7];let h;e[8]!==d?(h=d?t.jsx(us,{className:"size-4 shrink-0"}):t.jsx(fs,{className:"size-4 shrink-0"}),e[8]=d,e[9]=h):h=e[9];let o;e[10]!==r||e[11]!==h?(o=t.jsxs("span",{className:"flex min-w-0 items-center gap-1 text-xs font-normal text-muted-foreground",children:[r,h]}),e[10]=r,e[11]=h,e[12]=o):o=e[12];let f;return e[13]!==c||e[14]!==o?(f=t.jsxs(Ut,{render:a,children:[c,o]}),e[13]=c,e[14]=o,e[15]=f):f=e[15],f}const Te={auto:"Automatic",path:"Installed on PATH",npm:"Global npm install",bundled:"Bundled with Cogpit",custom:"Custom path"};function It(s,e){return e?`v${e} · ${s}`:s}function Ps(s,e){return s===null?"Checking installed binaries…":e?e.version===null?`${e.path} did not report a version — check the path.`:`Now running: ${It(e.path,e.version)}`:"No launchable binary for the saved choice — sessions cannot start."}function zs(s){return s!==null&&s.version!==null}function Ds(s){const e=M.c(82),{kind:n,value:i,onChange:l,disabled:d,reportVersion:a}=s;let u;e[0]!==n?(u=$t(n),e[0]=n,e[1]=u):u=e[1];const{displayName:c}=u,[r,h]=S.useState(null),[o,f]=S.useState(!1),m=`agent-executable-${n}`;let j;e[2]!==n?(j=()=>{let Q=!1;return le(`/api/agent-executable/${n}`).then(Ls).then(W=>{Q||h(W)}).catch(Rs),()=>{Q=!0}},e[2]=n,e[3]=j):j=e[3];let w;e[4]!==n||e[5]!==a?(w=[n,a],e[4]=n,e[5]=a,e[6]=w):w=e[6],S.useEffect(j,w);let x,C,p,g,y,N,v,k,$,_,I,O,A;if(e[7]!==d||e[8]!==c||e[9]!==m||e[10]!==l||e[11]!==o||e[12]!==(r==null?void 0:r.active)||e[13]!==(r==null?void 0:r.candidates)||e[14]!==i.path||e[15]!==i.source){const Q=new Map((r==null?void 0:r.candidates.map(Os))??[]);g=(r==null?void 0:r.active)??null;let W;e[29]!==d||e[30]!==m||e[31]!==l||e[32]!==i.path||e[33]!==i.source?(W=(D,ee,ae,oe)=>{const De=oe===void 0?!0:oe,se=`${m}-${D}`;return t.jsxs(G,{orientation:"horizontal",children:[t.jsx("input",{type:"radio",id:se,name:m,className:"mt-1 size-4 shrink-0 accent-primary",checked:i.source===D,disabled:d||!De,onChange:()=>l(D==="custom"?{source:D,path:i.path??""}:{source:D})}),t.jsxs(At,{children:[t.jsx(ie,{htmlFor:se,children:ee}),t.jsx(B,{className:"break-all",children:ae})]})]},D)},e[29]=d,e[30]=m,e[31]=l,e[32]=i.path,e[33]=i.source,e[34]=W):W=e[34],y=W;const dt=D=>{const ee=Q.get(D);return y(D,Te[D],ee?It(ee.path,ee.version):"Not found on this machine.",ee!==void 0||i.source===D)},L=g?`${Te[i.source]} · v${g.version??"?"}`:Te[i.source];p=lt,O=o,A=f,N="flex flex-col gap-2";const Ie=`${c} executable`;e[35]!==o||e[36]!==L||e[37]!==Ie?(v=t.jsx(ct,{icon:ms,title:Ie,summary:L,open:o}),e[35]=o,e[36]=L,e[37]=Ie,e[38]=v):v=e[38],C=at,x=G,e[39]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx(B,{children:"Which binary new sessions run. Automatic uses your installed CLI unless it is older than the copy bundled with Cogpit."}),e[39]=I):I=e[39],k="flex flex-col gap-2 pl-1",e[40]!==y?($=y("auto",Te.auto,"Recommended."),e[40]=y,e[41]=$):$=e[41],_=_s.map(dt),e[7]=d,e[8]=c,e[9]=m,e[10]=l,e[11]=o,e[12]=r==null?void 0:r.active,e[13]=r==null?void 0:r.candidates,e[14]=i.path,e[15]=i.source,e[16]=x,e[17]=C,e[18]=p,e[19]=g,e[20]=y,e[21]=N,e[22]=v,e[23]=k,e[24]=$,e[25]=_,e[26]=I,e[27]=O,e[28]=A}else x=e[16],C=e[17],p=e[18],g=e[19],y=e[20],N=e[21],v=e[22],k=e[23],$=e[24],_=e[25],I=e[26],O=e[27],A=e[28];const H=`${c} executable path`,V=i.source==="custom"?i.path??"":"",F=d||i.source!=="custom";let E;e[42]!==l?(E=Q=>l({source:"custom",path:Q.target.value}),e[42]=l,e[43]=E):E=e[43];let R;e[44]!==H||e[45]!==V||e[46]!==F||e[47]!==E?(R=t.jsx(gt,{"aria-label":H,value:V,placeholder:"/path/to/binary",disabled:F,onChange:E,className:"mt-1"}),e[44]=H,e[45]=V,e[46]=F,e[47]=E,e[48]=R):R=e[48];let T;e[49]!==y||e[50]!==R?(T=y("custom",Te.custom,R),e[49]=y,e[50]=R,e[51]=T):T=e[51];let U;e[52]!==T||e[53]!==k||e[54]!==$||e[55]!==_?(U=t.jsxs("div",{className:k,children:[$,_,T]}),e[52]=T,e[53]=k,e[54]=$,e[55]=_,e[56]=U):U=e[56];let P;e[57]!==g?(P=zs(g)?"text-muted-foreground":"text-destructive",e[57]=g,e[58]=P):P=e[58];let X;e[59]!==P?(X=bt("text-xs",P),e[59]=P,e[60]=X):X=e[60];let q;e[61]!==g||e[62]!==r?(q=Ps(r,g),e[61]=g,e[62]=r,e[63]=q):q=e[63];let Z;e[64]!==X||e[65]!==q?(Z=t.jsx("p",{className:X,"aria-live":"polite",children:q}),e[64]=X,e[65]=q,e[66]=Z):Z=e[66];let z;e[67]!==x||e[68]!==U||e[69]!==Z||e[70]!==I?(z=t.jsxs(x,{children:[I,U,Z]}),e[67]=x,e[68]=U,e[69]=Z,e[70]=I,e[71]=z):z=e[71];let K;e[72]!==C||e[73]!==z?(K=t.jsx(C,{children:z}),e[72]=C,e[73]=z,e[74]=K):K=e[74];let Y;return e[75]!==p||e[76]!==N||e[77]!==v||e[78]!==K||e[79]!==O||e[80]!==A?(Y=t.jsxs(p,{open:O,onOpenChange:A,className:N,children:[v,K]}),e[75]=p,e[76]=N,e[77]=v,e[78]=K,e[79]=O,e[80]=A,e[81]=Y):Y=e[81],Y}function Os(s){return[s.source,s]}function Rs(){}function Ls(s){return s.ok?s.json():null}function Tt(s){return s instanceof Error?s.message:String(s)}async function wt(s){try{const e=await le(`/api/agent-accounts/${s}`);return e.status===404?{status:"missing"}:e.ok?await e.json():{status:"error",error:await ot(e,`Request failed (${e.status})`)}}catch(e){return{status:"error",error:Tt(e)}}}function Fs(s){const[e,n]=S.useState(null),[i,l]=S.useState(null),[d,a]=S.useState(null);S.useEffect(()=>{let c=!1;return wt(s).then(r=>{c||n(r)}),()=>{c=!0}},[s]);const u=S.useCallback(async c=>{l(c),a(null);try{const r=await le(`/api/agent-accounts/${s}/switch`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slot:c})});if(!r.ok){a({kind:"failed",error:await ot(r,`Request failed (${r.status})`)});return}a({kind:"switched",result:await r.json()}),n(await wt(s))}catch(r){a({kind:"failed",error:Tt(r)})}finally{l(null)}},[s]);return{report:e,switchingSlot:i,outcome:d,switchTo:u}}const Us={token_expired:"Token expired",relogin_required:"Login needed",no_credentials:"No credentials",keychain_unavailable:"Keychain locked",foreign_credential:"Credential mismatch",api_key:"API key",unavailable:"Usage unavailable"};function pt(s){return s.alias??s.email}function St(s){const e=M.c(18),{label:n,window:i}=s;if(!i)return null;const l=i.pct>=80,d=i.resetsIn?`${n} window resets in ${i.resetsIn}`:void 0;let a;e[0]!==n?(a=t.jsx("span",{className:"w-5",children:n}),e[0]=n,e[1]=a):a=e[1];const u=l?"bg-destructive":"bg-primary";let c;e[2]!==u?(c=bt("absolute inset-y-0 left-0 rounded-full",u),e[2]=u,e[3]=c):c=e[3];const r=`${i.pct}%`;let h;e[4]!==r?(h={width:r},e[4]=r,e[5]=h):h=e[5];let o;e[6]!==c||e[7]!==h?(o=t.jsx("span",{className:"relative h-1 w-16 overflow-hidden rounded-full bg-muted",children:t.jsx("span",{className:c,style:h})}),e[6]=c,e[7]=h,e[8]=o):o=e[8];let f;e[9]!==i.pct?(f=Math.round(i.pct),e[9]=i.pct,e[10]=f):f=e[10];let m;e[11]!==f?(m=t.jsxs("span",{className:"tabular-nums",children:[f,"%"]}),e[11]=f,e[12]=m):m=e[12];let j;return e[13]!==d||e[14]!==a||e[15]!==o||e[16]!==m?(j=t.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",title:d,children:[a,o,m]}),e[13]=d,e[14]=a,e[15]=o,e[16]=m,e[17]=j):j=e[17],j}function yt(s){return/[.!?]$/.test(s)?s:`${s}.`}function Bs(s,e){if(s.kind==="failed")return`Switch failed: ${s.error}`;const{result:n}=s,i=[yt(n.message)];return n.switched&&i.push(n.credentialStore==="keychain"?`Running ${e} sessions pick it up within about 30 seconds; restart one to apply it immediately.`:`New messages in ${e} use it from now on.`),[...i,...n.warnings.map(yt)].join(" ")}function Ms(s){const e=M.c(31),{kind:n,disabled:i}=s;let l;e[0]!==n?(l=$t(n),e[0]=n,e[1]=l):l=e[1];const{displayName:d}=l,{report:a,switchingSlot:u,outcome:c,switchTo:r}=Fs(n),[h,o]=S.useState(!1);if(a===null||a.status==="missing")return null;let f,m;if(e[2]!==a.accounts||e[3]!==a.status){f=a.status==="ok"?a.accounts:[];const k=f.find(Hs)??null;m=a.status==="error"?"Unavailable":k?`${pt(k)} · ${f.length} account${f.length===1?"":"s"}`:`${f.length} account${f.length===1?"":"s"}`,e[2]=a.accounts,e[3]=a.status,e[4]=f,e[5]=m}else f=e[4],m=e[5];const j=m,w=`${d} accounts`;let x;e[6]!==h||e[7]!==j||e[8]!==w?(x=t.jsx(ct,{icon:hs,title:w,summary:j,open:h}),e[6]=h,e[7]=j,e[8]=w,e[9]=x):x=e[9];const C=a.status==="ok"&&`Logins managed by ${a.tool}${a.version?` ${a.version}`:""}. `;let p;e[10]!==d||e[11]!==C?(p=t.jsxs(B,{children:[C,"Switching changes which login ",d," sessions authenticate with."]}),e[10]=d,e[11]=C,e[12]=p):p=e[12];let g;e[13]!==f||e[14]!==i||e[15]!==a.error||e[16]!==a.status||e[17]!==r||e[18]!==u?(g=a.status==="error"?t.jsx("p",{className:"text-xs text-destructive",role:"alert",children:a.error}):t.jsx("ul",{className:"flex flex-col divide-y divide-border rounded-md border border-border",children:f.map(k=>{const $=u===k.slot,_=Us[k.usageStatus];return t.jsxs("li",{className:"flex items-center gap-3 px-3 py-2",children:[t.jsx("span",{className:"w-5 shrink-0 text-xs tabular-nums text-muted-foreground",children:k.slot}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[t.jsx("span",{className:"truncate text-sm font-medium",children:pt(k)}),k.alias&&t.jsx("span",{className:"truncate text-xs text-muted-foreground",children:k.email}),k.active&&t.jsx(Pe,{children:"Active"}),k.disabled&&t.jsx(Pe,{variant:"outline",children:"Disabled"}),_&&t.jsx(Pe,{variant:"destructive",children:_})]}),k.organization&&t.jsx("span",{className:"truncate text-xs text-muted-foreground",children:k.organization}),k.usage&&t.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1",children:[t.jsx(St,{label:"5h",window:k.usage.fiveHour}),t.jsx(St,{label:"7d",window:k.usage.sevenDay})]})]}),!i&&!k.active&&t.jsx(J,{type:"button",size:"sm",variant:"outline",disabled:u!==null,onClick:()=>r(k.slot),"aria-label":`Switch to ${pt(k)}`,children:$?t.jsxs(t.Fragment,{children:[t.jsx(rt,{"data-icon":"inline-start",className:"size-3.5 animate-spin"}),"Switching…"]}):"Switch"})]},k.slot)})}),e[13]=f,e[14]=i,e[15]=a.error,e[16]=a.status,e[17]=r,e[18]=u,e[19]=g):g=e[19];let y;e[20]!==d||e[21]!==c?(y=c&&t.jsx("p",{className:bt("text-xs",c.kind==="failed"?"text-destructive":"text-muted-foreground"),"aria-live":"polite",role:c.kind==="failed"?"alert":"status",children:Bs(c,d)}),e[20]=d,e[21]=c,e[22]=y):y=e[22];let N;e[23]!==p||e[24]!==g||e[25]!==y?(N=t.jsx(at,{children:t.jsxs(G,{children:[p,g,y]})}),e[23]=p,e[24]=g,e[25]=y,e[26]=N):N=e[26];let v;return e[27]!==h||e[28]!==x||e[29]!==N?(v=t.jsxs(lt,{open:h,onOpenChange:o,className:"flex flex-col gap-2",children:[x,N]}),e[27]=h,e[28]=x,e[29]=N,e[30]=v):v=e[30],v}function Hs(s){return s.active}function Pt(s){return s instanceof Error?s.message:String(s)}async function Gs(){try{const s=await le("/api/slack");return s.ok?{status:"ok",report:await s.json()}:{status:"error",error:await ot(s,`Request failed (${s.status})`)}}catch(s){return{status:"error",error:Pt(s)}}}function Vs(){const[s,e]=S.useState({status:"loading"}),[n,i]=S.useState(null),[l,d]=S.useState(null),a=S.useRef(0),u=S.useCallback(async()=>{const o=++a.current,f=await Gs();o===a.current&&e(f)},[]);S.useEffect(()=>{const o=a;return u(),()=>{o.current++}},[u]);const c=S.useCallback(async(o,f)=>{i(o),d(null),a.current++;try{const m=await le("/api/slack",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:o,...f})});m.ok||d(await ot(m,`Request failed (${m.status})`)),await u()}catch(m){d(Pt(m))}finally{i(null)}},[u]),r=S.useCallback((o,f)=>c(o,{action:"update",autoPost:f}),[c]),h=S.useCallback(o=>c(o,{action:"unlink"}),[c]);return{state:s,busy:n,error:l,refresh:u,setAutoPost:r,unlink:h}}const zt={connected:{label:"Connected",variant:"default"},connecting:{label:"Connecting",variant:"outline"},reconnecting:{label:"Reconnecting",variant:"outline"},stopped:{label:"Stopped",variant:"destructive"},failed:{label:"Failed",variant:"destructive"}};function ze(s,e){return`${s} ${e}${s===1?"":"s"}`}function qs(s){const e=[ze(s.dms.length,"DM"),...s.channels.length?[ze(s.channels.length,"channel")]:[]].join(" and ");return`Listens to ${s.allow.join(", ")} · posts to ${e} · ${s.postedToday}/${s.dailyCap} posts today`}function Ws(s){var n;const e=[];if(s.connection.lastError&&s.connection.state!=="connected"&&e.push(s.connection.lastError),s.pending.length){const i=(n=s.pending.find(l=>l.lastError))==null?void 0:n.lastError;e.push(`${ze(s.pending.length,"message")} waiting to reach the session${i?`: ${i}`:""}`)}return s.uncertain.length&&e.push(`${ze(s.uncertain.length,"message")} may not have arrived; check the session's queue`),e}function Xs(s){if(!s)return"Unavailable";const{links:e}=s;return e.length===0?"No links":e.length===1?`1 link · ${zt[e[0].connection.state].label}`:`${ze(e.length,"link")} · ${e.filter(n=>n.connection.state==="connected").length} connected`}function Ks(s){const e=M.c(40),{link:n,disabled:i,busy:l,onAutoPost:d,onUnlink:a}=s,u=zt[n.connection.state],c=n.title??n.sessionId;let r;e[0]!==n.sessionId||e[1]!==n.title?(r=n.title??`Session ${n.sessionId.slice(0,8)}`,e[0]=n.sessionId,e[1]=n.title,e[2]=r):r=e[2];let h;e[3]!==n.sessionId||e[4]!==r?(h=t.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",title:n.sessionId,children:r}),e[3]=n.sessionId,e[4]=r,e[5]=h):h=e[5];let o;e[6]!==n.bot?(o=t.jsx(Pe,{variant:"outline",children:n.bot}),e[6]=n.bot,e[7]=o):o=e[7];let f;e[8]!==u.label||e[9]!==u.variant?(f=t.jsx(Pe,{variant:u.variant,children:u.label}),e[8]=u.label,e[9]=u.variant,e[10]=f):f=e[10];let m;e[11]!==h||e[12]!==o||e[13]!==f?(m=t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[h,o,f]}),e[11]=h,e[12]=o,e[13]=f,e[14]=m):m=e[14];let j;e[15]!==n?(j=qs(n),e[15]=n,e[16]=j):j=e[16];let w;e[17]!==j?(w=t.jsx("p",{className:"text-xs text-muted-foreground",children:j}),e[17]=j,e[18]=w):w=e[18];let x;e[19]!==n?(x=Ws(n).map(Js),e[19]=n,e[20]=x):x=e[20];const C=`Post the session’s answer in the thread for ${c}`,p=i||l;let g;e[21]!==n.autoPost||e[22]!==d||e[23]!==p||e[24]!==C?(g=t.jsxs("span",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t.jsx(_t,{size:"sm","aria-label":C,checked:n.autoPost,disabled:p,onCheckedChange:d}),"Post the session’s answer in the thread"]}),e[21]=n.autoPost,e[22]=d,e[23]=p,e[24]=C,e[25]=g):g=e[25];let y;e[26]!==l||e[27]!==i||e[28]!==n.bot||e[29]!==c||e[30]!==a?(y=!i&&t.jsxs(J,{type:"button",size:"sm",variant:"outline",disabled:l,onClick:a,"aria-label":`Unlink ${c} from ${n.bot}`,children:[l&&t.jsx(rt,{"data-icon":"inline-start",className:"size-3.5 animate-spin"}),"Unlink"]}),e[26]=l,e[27]=i,e[28]=n.bot,e[29]=c,e[30]=a,e[31]=y):y=e[31];let N;e[32]!==g||e[33]!==y?(N=t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[g,y]}),e[32]=g,e[33]=y,e[34]=N):N=e[34];let v;return e[35]!==N||e[36]!==m||e[37]!==w||e[38]!==x?(v=t.jsxs("li",{className:"flex flex-col gap-2 px-3 py-2",children:[m,w,x,N]}),e[35]=N,e[36]=m,e[37]=w,e[38]=x,e[39]=v):v=e[39],v}function Js(s){return t.jsx("p",{className:"text-xs text-destructive",children:s},s)}function Zs(s){const e=M.c(62),{disabled:n}=s,{state:i,busy:l,error:d,refresh:a,setAutoPost:u,unlink:c}=Vs(),[r,h]=S.useState(!1);if(i.status==="loading")return null;const o=i.status==="ok"?i.report:null;if(o&&!o.available)return null;let f;e[0]!==(o==null?void 0:o.links)?(f=(o==null?void 0:o.links)??[],e[0]=o==null?void 0:o.links,e[1]=f):f=e[1];const m=f;let j,w,x,C,p,g,y,N,v,k,$;if(e[2]!==l||e[3]!==n||e[4]!==m||e[5]!==r||e[6]!==a||e[7]!==o||e[8]!==u||e[9]!==i.error||e[10]!==i.status||e[11]!==c){let H;e[23]!==m?(H=T=>!m.some(U=>U.bot===T.name),e[23]=m,e[24]=H):H=e[24];const V=((o==null?void 0:o.bots)??[]).filter(H);x=lt,N=r,v=h,k="flex flex-col gap-2";let F;e[25]!==o?(F=Xs(o),e[25]=o,e[26]=F):F=e[26],e[27]!==r||e[28]!==F?($=t.jsx(ct,{icon:xs,title:"Slack links",summary:F,open:r}),e[27]=r,e[28]=F,e[29]=$):$=e[29],w=at,j=G;let E;e[30]===Symbol.for("react.memo_cache_sentinel")?(E=t.jsxs(B,{children:["A linked session receives DMs, Assistant threads, thread replies and mentions from the people it listens to, and may post only to their DMs and the channels it lists. Add bots and link sessions with ",t.jsx("code",{children:"cogpit-session slack"}),"."]}),e[30]=E):E=e[30];let R;e[31]===Symbol.for("react.memo_cache_sentinel")?(R=t.jsx(ps,{className:"size-3.5"}),e[31]=R):R=e[31],e[32]!==a?(C=t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[E,t.jsx(J,{type:"button",size:"icon-sm",variant:"ghost",onClick:a,"aria-label":"Refresh Slack links",children:R})]}),e[32]=a,e[33]=C):C=e[33],e[34]!==i.error||e[35]!==i.status?(p=i.status==="error"&&t.jsx("p",{className:"text-xs text-destructive",role:"alert",children:i.error}),e[34]=i.error,e[35]=i.status,e[36]=p):p=e[36],e[37]!==l||e[38]!==n||e[39]!==m||e[40]!==u||e[41]!==c?(g=m.length>0&&t.jsx("ul",{className:"flex flex-col divide-y divide-border rounded-md border border-border",children:m.map(T=>t.jsx(Ks,{link:T,disabled:n,busy:l===T.sessionId,onAutoPost:U=>u(T.sessionId,U),onUnlink:()=>c(T.sessionId)},T.sessionId))}),e[37]=l,e[38]=n,e[39]=m,e[40]=u,e[41]=c,e[42]=g):g=e[42],y=V.length>0&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Not linked: ",V.map(Ys).join(", ")]}),e[2]=l,e[3]=n,e[4]=m,e[5]=r,e[6]=a,e[7]=o,e[8]=u,e[9]=i.error,e[10]=i.status,e[11]=c,e[12]=j,e[13]=w,e[14]=x,e[15]=C,e[16]=p,e[17]=g,e[18]=y,e[19]=N,e[20]=v,e[21]=k,e[22]=$}else j=e[12],w=e[13],x=e[14],C=e[15],p=e[16],g=e[17],y=e[18],N=e[19],v=e[20],k=e[21],$=e[22];let _;e[43]!==d?(_=d&&t.jsx("p",{className:"text-xs text-destructive",role:"alert",children:d}),e[43]=d,e[44]=_):_=e[44];let I;e[45]!==j||e[46]!==_||e[47]!==C||e[48]!==p||e[49]!==g||e[50]!==y?(I=t.jsxs(j,{children:[C,p,g,y,_]}),e[45]=j,e[46]=_,e[47]=C,e[48]=p,e[49]=g,e[50]=y,e[51]=I):I=e[51];let O;e[52]!==w||e[53]!==I?(O=t.jsx(w,{children:I}),e[52]=w,e[53]=I,e[54]=O):O=e[54];let A;return e[55]!==x||e[56]!==O||e[57]!==N||e[58]!==v||e[59]!==k||e[60]!==$?(A=t.jsxs(x,{open:N,onOpenChange:v,className:k,children:[$,O]}),e[55]=x,e[56]=O,e[57]=N,e[58]=v,e[59]=k,e[60]=$,e[61]=A):A=e[61],A}function Ys(s){return`${s.name}${s.teamName?` (${s.teamName})`:""}`}function Qs(s){const e=M.c(18),{active:n,onSignInStarted:i}=s,[l,d]=S.useState(!1),a=Bt(n),u=a.agents;let c;e[0]!==u?(c=(u==null?void 0:u.filter(en).length)??0,e[0]=u,e[1]=c):c=e[1];const h=u?`${c} of ${u.length} ready`:"Checking…";let o;e[2]!==l||e[3]!==h?(o=t.jsx(ct,{icon:gs,title:"Agents",summary:h,open:l}),e[2]=l,e[3]=h,e[4]=o):o=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(B,{children:"The coding agents installed on this computer, and whether you're signed in to each."}),e[5]=f):f=e[5];let m;e[6]!==a||e[7]!==i?(m=t.jsx(Ht,{check:a,onSignInStarted:i}),e[6]=a,e[7]=i,e[8]=m):m=e[8];let j;e[9]!==a?(j=t.jsx("div",{children:t.jsx(Gt,{check:a})}),e[9]=a,e[10]=j):j=e[10];let w;e[11]!==m||e[12]!==j?(w=t.jsx(at,{children:t.jsxs(G,{children:[f,m,j]})}),e[11]=m,e[12]=j,e[13]=w):w=e[13];let x;return e[14]!==l||e[15]!==o||e[16]!==w?(x=t.jsxs(lt,{open:l,onOpenChange:d,className:"flex flex-col gap-2",children:[o,w]}),e[14]=l,e[15]=o,e[16]=w,e[17]=x):x=e[17],x}function en(s){return Mt(s)==="ready"}const tn=S.lazy(()=>Kt(()=>import("./PluginsDialog-CYiiMArh.js"),__vite__mapDeps([0,1,2,3,4,5])).then(s=>({default:s.PluginsDialog}))),sn=Et().filter(s=>s.cli.bundledBySdk).map(s=>s.kind),nn=Et().filter(s=>s.capabilities.accountSwitching).map(s=>s.kind);function ln(s,e){return s.source===e.source&&(s.source!=="custom"||s.path===e.path)}function an(s){const e=M.c(5),{status:n,error:i}=s;if(n==="validating"){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[t.jsx(rt,{"data-icon":"inline-start",className:"size-3.5 animate-spin"}),"Checking path..."]}),e[0]=l):l=e[0],l}if(n==="valid"){let l;return e[1]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsxs("div",{className:"flex items-center gap-2 text-sm text-success",children:[t.jsx(Ss,{"data-icon":"inline-start",className:"size-3.5"}),"Folder found"]}),e[1]=l):l=e[1],l}if(n==="invalid"&&i){let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(ys,{"data-icon":"inline-start",className:"size-3.5"}),e[2]=l):l=e[2];let d;return e[3]!==i?(d=t.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[l,i]}),e[3]=i,e[4]=d):d=e[4],d}return null}function bn(s){const e=M.c(123),{open:n,currentPath:i,onClose:l,onSaved:d}=s,[a,u]=S.useState(i),[c,r]=S.useState(!1),{status:h,error:o,debouncedValidate:f,reset:m,save:j}=Vt();let w;e[0]===Symbol.for("react.memo_cache_sentinel")?(w=qt(),e[0]=w):w=e[0];const x=w;let C;e[1]===Symbol.for("react.memo_cache_sentinel")?(C=Wt("configWrite"),e[1]=C):C=e[1];const p=C,[g,y]=S.useState(!1),N=Xt(n&&g&&p),[v,k]=S.useState(!1),[$,_]=S.useState(""),[I,O]=S.useState(!1),[A,H]=S.useState(""),[V,F]=S.useState(""),[E,R]=S.useState(""),[T,U]=S.useState(""),[P,X]=S.useState(!1),[q,Z]=S.useState(!1),[z,K]=S.useState(xt),[Y,Q]=S.useState(0),[W,dt]=S.useState(xt),[L,Ie]=S.useState(!1),[D,ee]=S.useState(!1);let ae;e[2]===Symbol.for("react.memo_cache_sentinel")?(ae=[],e[2]=ae):ae=e[2];const[oe,De]=S.useState(ae);let se,Oe;e[3]!==i||e[4]!==n||e[5]!==m?(se=()=>{n&&(u(i),m(),le("/api/config").then(un).then(b=>{const te=(b==null?void 0:b.networkAccess)||!1;k(te),Ie(te),ee(!!(b!=null&&b.networkPassword)),_("");const tt=(b==null?void 0:b.terminalApp)||"";H(tt),F(tt);const st=(b==null?void 0:b.editorApp)||"";R(st),U(st);const nt=(b==null?void 0:b.useBuiltInEditor)===!0;X(nt),Z(nt);const it=Ts(b==null?void 0:b.agentExecutable)??xt;K(it),dt(it),te&&(b!=null&&b.networkPassword)&&!x?le("/api/connected-devices").then(dn).then(_e=>De((_e==null?void 0:_e.devices)||[])).catch(cn):De([])}).catch(rn))},Oe=[n,i,m,x],e[3]=i,e[4]=n,e[5]=m,e[6]=se,e[7]=Oe):(se=e[6],Oe=e[7]),S.useEffect(se,Oe);let Re;e[8]!==f?(Re=b=>{const te=b.target.value;u(te),f(te)},e[8]=f,e[9]=Re):Re=e[9];const ut=Re;let Le;e[10]!==z||e[11]!==E||e[12]!==L||e[13]!==v||e[14]!==$||e[15]!==d||e[16]!==a||e[17]!==j||e[18]!==A||e[19]!==P?(Le=async()=>{r(!0);const b=await j(a,{networkAccess:x?L:v,networkPassword:!x&&v&&$.length>0?$:void 0,terminalApp:A.trim()||void 0,editorApp:E.trim()||void 0,useBuiltInEditor:P,agentExecutable:z});b.success&&b.claudeDir&&(Q(on),d(b.claudeDir)),r(!1)},e[10]=z,e[11]=E,e[12]=L,e[13]=v,e[14]=$,e[15]=d,e[16]=a,e[17]=j,e[18]=A,e[19]=P,e[20]=Le):Le=e[20];const re=Le;let Fe;e[21]!==z||e[22]!==E||e[23]!==D||e[24]!==W||e[25]!==T||e[26]!==L||e[27]!==V||e[28]!==q||e[29]!==v||e[30]!==$||e[31]!==h||e[32]!==A||e[33]!==P?(Fe=function(){var _e;if(h==="validating"||h==="invalid")return!1;const te=h==="valid",tt=!x&&(v!==L||v&&$.length>0),st=A!==V,nt=E!==T||P!==q,it=!ln(z,W);if(!te&&!tt&&!st&&!nt&&!it||z.source==="custom"&&!((_e=z.path)!=null&&_e.trim()))return!1;if(!x&&v){const Dt=$.length>0&&$.length<vt,Ot=!D&&$.length===0;if(Dt||Ot)return!1}return!0},e[21]=z,e[22]=E,e[23]=D,e[24]=W,e[25]=T,e[26]=L,e[27]=V,e[28]=q,e[29]=v,e[30]=$,e[31]=h,e[32]=A,e[33]=P,e[34]=Fe):Fe=e[34];const ne=Fe();let ce;e[35]!==l?(ce=b=>{b||l()},e[35]=l,e[36]=ce):ce=e[36];let Ue;e[37]===Symbol.for("react.memo_cache_sentinel")?(Ue=t.jsxs(Jt,{children:[t.jsx(Zt,{className:"text-foreground",children:"Configuration"}),t.jsx(Yt,{className:"text-muted-foreground",children:"Manage local paths, preferred apps, and remote access."})]}),e[37]=Ue):Ue=e[37];const ft=ne?void 0:l;let de;e[38]!==n||e[39]!==ft?(de=t.jsx(Qs,{active:n,onSignInStarted:ft}),e[38]=n,e[39]=ft,e[40]=de):de=e[40];let Be;e[41]===Symbol.for("react.memo_cache_sentinel")?(Be=p&&t.jsxs(G,{children:[t.jsx(ie,{children:"Plugins"}),t.jsx(B,{children:"Manage installed plugins, their settings, and service connections."}),t.jsx(J,{type:"button",variant:"outline",onClick:()=>y(!0),children:"Manage plugins"})]}),e[41]=Be):Be=e[41];let Me,He;e[42]===Symbol.for("react.memo_cache_sentinel")?(Me=t.jsx(ie,{htmlFor:"claude-directory",children:"Claude directory"}),He=t.jsx(B,{children:"The directory containing your Claude configuration."}),e[42]=Me,e[43]=He):(Me=e[42],He=e[43]);let Ge;e[44]===Symbol.for("react.memo_cache_sentinel")?(Ge=t.jsx(Ct,{children:t.jsx(js,{"data-icon":"inline-start"})}),e[44]=Ge):Ge=e[44];let ue;e[45]!==ne||e[46]!==re||e[47]!==c?(ue=b=>{b.key==="Enter"&&ne&&!c&&re()},e[45]=ne,e[46]=re,e[47]=c,e[48]=ue):ue=e[48];let fe;e[49]!==ut||e[50]!==a||e[51]!==ue?(fe=t.jsxs(Nt,{children:[Ge,t.jsx(kt,{id:"claude-directory",value:a,onChange:ut,placeholder:"/Users/you/.claude",disabled:!p,onKeyDown:ue})]}),e[49]=ut,e[50]=a,e[51]=ue,e[52]=fe):fe=e[52];let me;e[53]!==o||e[54]!==h?(me=t.jsx("div",{"aria-live":"polite",children:t.jsx(an,{status:h,error:o})}),e[53]=o,e[54]=h,e[55]=me):me=e[55];let he;e[56]!==fe||e[57]!==me?(he=t.jsxs(G,{children:[Me,He,fe,me]}),e[56]=fe,e[57]=me,e[58]=he):he=e[58];let Ve,qe;e[59]===Symbol.for("react.memo_cache_sentinel")?(Ve=t.jsxs(ie,{htmlFor:"terminal-application",children:[t.jsx(bs,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),"Terminal application"]}),qe=t.jsx(B,{children:"Leave blank to use the system default for Ctrl+Cmd+T."}),e[59]=Ve,e[60]=qe):(Ve=e[59],qe=e[60]);let We;e[61]===Symbol.for("react.memo_cache_sentinel")?(We=b=>H(b.target.value),e[61]=We):We=e[61];let xe;e[62]!==A?(xe=t.jsxs(G,{children:[Ve,qe,t.jsx(gt,{id:"terminal-application",value:A,onChange:We,placeholder:"Ghostty, iTerm, or /path/to/binary",disabled:!p})]}),e[62]=A,e[63]=xe):xe=e[63];let Xe;e[64]===Symbol.for("react.memo_cache_sentinel")?(Xe=b=>X(b===!0),e[64]=Xe):Xe=e[64];let pe;e[65]!==P?(pe=t.jsx(Qt,{id:"use-built-in-editor",checked:P,onCheckedChange:Xe,disabled:!p}),e[65]=P,e[66]=pe):pe=e[66];let Ke;e[67]===Symbol.for("react.memo_cache_sentinel")?(Ke=t.jsxs(At,{children:[t.jsxs(ie,{htmlFor:"use-built-in-editor",children:[t.jsx(vs,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),"Open files in Cogpit"]}),t.jsx(B,{children:"Files and diffs open in Cogpit’s file workspace instead of launching an external editor."})]}),e[67]=Ke):Ke=e[67];let ge;e[68]!==pe?(ge=t.jsxs(G,{orientation:"horizontal",children:[pe,Ke]}),e[68]=pe,e[69]=ge):ge=e[69];let Je;e[70]===Symbol.for("react.memo_cache_sentinel")?(Je=t.jsxs(ie,{htmlFor:"editor-application",children:[t.jsx(ws,{"data-icon":"inline-start",className:"size-4 text-muted-foreground"}),"Editor application"]}),e[70]=Je):Je=e[70];const mt=P?"Not used while files open in Cogpit.":"Leave blank to use $VISUAL or automatic detection.";let je;e[71]!==mt?(je=t.jsx(B,{children:mt}),e[71]=mt,e[72]=je):je=e[72];let Ze;e[73]===Symbol.for("react.memo_cache_sentinel")?(Ze=b=>R(b.target.value),e[73]=Ze):Ze=e[73];const ht=!p||P;let be;e[74]!==E||e[75]!==ht?(be=t.jsx(gt,{id:"editor-application",value:E,onChange:Ze,placeholder:"cursor, code, zed, or /path/to/binary",disabled:ht}),e[74]=E,e[75]=ht,e[76]=be):be=e[76];let ve;e[77]!==je||e[78]!==be?(ve=t.jsxs(G,{children:[Je,je,be]}),e[77]=je,e[78]=be,e[79]=ve):ve=e[79];let we;e[80]!==z||e[81]!==Y?(we=sn.map(b=>t.jsx(Ds,{kind:b,value:z,onChange:K,disabled:!p,reportVersion:Y},b)),e[80]=z,e[81]=Y,e[82]=we):we=e[82];let Ye,Qe;e[83]===Symbol.for("react.memo_cache_sentinel")?(Ye=nn.map(b=>t.jsx(Ms,{kind:b,disabled:!p},b)),Qe=t.jsx(Zs,{disabled:!p}),e[83]=Ye,e[84]=Qe):(Ye=e[83],Qe=e[84]);let Se;e[85]!==oe||e[86]!==D||e[87]!==L||e[88]!==v||e[89]!==$||e[90]!==I?(Se=!x&&p&&t.jsx($s,{networkAccess:v,setNetworkAccess:k,networkPassword:$,setNetworkPassword:_,showNetworkPassword:I,setShowNetworkPassword:O,hasExistingPassword:D,initialNetworkAccess:L,connectedDevices:oe,minPasswordLength:vt}),e[85]=oe,e[86]=D,e[87]=L,e[88]=v,e[89]=$,e[90]=I,e[91]=Se):Se=e[91];let ye;e[92]!==de||e[93]!==he||e[94]!==xe||e[95]!==ge||e[96]!==ve||e[97]!==we||e[98]!==Se?(ye=t.jsxs(es,{children:[de,Be,he,xe,ge,ve,we,Ye,Qe,Se]}),e[92]=de,e[93]=he,e[94]=xe,e[95]=ge,e[96]=ve,e[97]=we,e[98]=Se,e[99]=ye):ye=e[99];let Ne;e[100]!==l?(Ne=t.jsx(J,{variant:"outline",onClick:l,children:"Cancel"}),e[100]=l,e[101]=Ne):Ne=e[101];let ke;e[102]!==ne||e[103]!==re||e[104]!==c?(ke=p&&t.jsx(J,{disabled:!ne||c,onClick:re,children:c?t.jsxs(t.Fragment,{children:[t.jsx(rt,{"data-icon":"inline-start",className:"size-4 animate-spin"}),"Saving..."]}):"Save"}),e[102]=ne,e[103]=re,e[104]=c,e[105]=ke):ke=e[105];let Ce;e[106]!==Ne||e[107]!==ke?(Ce=t.jsxs(ts,{children:[Ne,ke]}),e[106]=Ne,e[107]=ke,e[108]=Ce):Ce=e[108];let $e;e[109]!==ye||e[110]!==Ce?($e=t.jsxs(ss,{className:"max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-lg",children:[Ue,ye,Ce]}),e[109]=ye,e[110]=Ce,e[111]=$e):$e=e[111];let Ae;e[112]!==n||e[113]!==$e||e[114]!==ce?(Ae=t.jsx(ns,{open:n,onOpenChange:ce,children:$e}),e[112]=n,e[113]=$e,e[114]=ce,e[115]=Ae):Ae=e[115];let Ee;e[116]!==n||e[117]!==g||e[118]!==N?(Ee=n&&g&&p&&t.jsx(S.Suspense,{fallback:null,children:t.jsx(tn,{client:N.client,state:N,currentPath:null,onClose:()=>y(!1)})}),e[116]=n,e[117]=g,e[118]=N,e[119]=Ee):Ee=e[119];let et;return e[120]!==Ae||e[121]!==Ee?(et=t.jsxs(t.Fragment,{children:[Ae,Ee]}),e[120]=Ae,e[121]=Ee,e[122]=et):et=e[122],et}function on(s){return s+1}function rn(){}function cn(){}function dn(s){return s.json()}function un(s){return s.json()}export{bn as ConfigDialog};