local-operator-ui 0.34.31 → 0.34.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/out/renderer/assets/{_basePickBy-gsWNnL8j.js → _basePickBy-B66HBZHq.js} +1 -1
  2. package/out/renderer/assets/{_baseUniq-C5l0J_O6.js → _baseUniq-CSRHNS5X.js} +1 -1
  3. package/out/renderer/assets/{agent-details-page-DOUGX96x.js → agent-details-page--_gYi2lc.js} +1 -1
  4. package/out/renderer/assets/{agent-hub-page-DABmkR95.js → agent-hub-page-B4CYHqQ7.js} +1 -1
  5. package/out/renderer/assets/{agents-page-C0hiW8Y-.js → agents-page-Cjo3iaWD.js} +3 -3
  6. package/out/renderer/assets/{arc-BTaq9nTj.js → arc-4AcyjvSp.js} +1 -1
  7. package/out/renderer/assets/{architectureDiagram-IEHRJDOE-wVAAAp4Q.js → architectureDiagram-IEHRJDOE-BE7p-gy-.js} +1 -1
  8. package/out/renderer/assets/{blockDiagram-JOT3LUYC-Bs4G73iB.js → blockDiagram-JOT3LUYC-DgS-ikSj.js} +1 -1
  9. package/out/renderer/assets/{book-open-D3nH3Oq3.js → book-open-CKkVZcBo.js} +1 -1
  10. package/out/renderer/assets/browser-page-ql5R-cDs.js +1 -0
  11. package/out/renderer/assets/{browser-webauthn-prompt-B9kmFz6z.js → browser-webauthn-prompt-CWr4qL8A.js} +1 -1
  12. package/out/renderer/assets/{c4Diagram-VJAJSXHY-D0q1Qpyu.js → c4Diagram-VJAJSXHY-CpMtpl2f.js} +1 -1
  13. package/out/renderer/assets/channel-BdIPJXOo.js +1 -0
  14. package/out/renderer/assets/{chunk-4BMEZGHF-CvHQheuo.js → chunk-4BMEZGHF-85Yusluf.js} +1 -1
  15. package/out/renderer/assets/{chunk-A2AXSNBT-BjUHeria.js → chunk-A2AXSNBT-D6BmMNue.js} +1 -1
  16. package/out/renderer/assets/{chunk-AEK57VVT-CgyS77iO.js → chunk-AEK57VVT-C26q1R--.js} +1 -1
  17. package/out/renderer/assets/{chunk-D6G4REZN-C7o-nYwn.js → chunk-D6G4REZN-Dy4HYhmA.js} +1 -1
  18. package/out/renderer/assets/{chunk-RZ5BOZE2-BusO_5Tl.js → chunk-RZ5BOZE2-Dnxr3jB8.js} +1 -1
  19. package/out/renderer/assets/{chunk-XZIHB7SX-CJWkR_g_.js → chunk-XZIHB7SX-BGzUtiqV.js} +1 -1
  20. package/out/renderer/assets/classDiagram-GIVACNV2-DiGQhWtx.js +1 -0
  21. package/out/renderer/assets/classDiagram-v2-COTLJTTW-DiGQhWtx.js +1 -0
  22. package/out/renderer/assets/clone-BhPlGAQ6.js +1 -0
  23. package/out/renderer/assets/{console-mirror-Bzwctj4T.js → console-mirror-BAq7R11H.js} +1 -1
  24. package/out/renderer/assets/{consoleCapture-D4doKdYL.js → consoleCapture-CWJ7Wd4s.js} +1 -1
  25. package/out/renderer/assets/{conversation-input-sync-CyV2Rt9s.js → conversation-input-sync-CBw8uiPT.js} +243 -243
  26. package/out/renderer/assets/{dagre-OKDRZEBW-Bbq7XOEU.js → dagre-OKDRZEBW-D6CK2WVv.js} +1 -1
  27. package/out/renderer/assets/{diagram-SSKATNLV-CmaRShOS.js → diagram-SSKATNLV-C3TpIKTy.js} +1 -1
  28. package/out/renderer/assets/{diagram-VNBRO52H-vChIl-Zs.js → diagram-VNBRO52H-z0vxgigp.js} +1 -1
  29. package/out/renderer/assets/{erDiagram-Q7BY3M3F-DXqNkkeq.js → erDiagram-Q7BY3M3F-DBCh3SrN.js} +1 -1
  30. package/out/renderer/assets/{error-boundary-zZlBqg1b.js → error-boundary-CQILQtMV.js} +1 -1
  31. package/out/renderer/assets/{flowDiagram-4HSFHLVR-DsGksM3Z.js → flowDiagram-4HSFHLVR-BgKCzSfN.js} +1 -1
  32. package/out/renderer/assets/{ganttDiagram-APWFNJXF-C9ODwIj2.js → ganttDiagram-APWFNJXF-BwsHywQN.js} +1 -1
  33. package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-s2DTzfkq.js → gitGraphDiagram-7IBYFJ6S-DYgILe4-.js} +1 -1
  34. package/out/renderer/assets/{graph-Cj8Vtlbg.js → graph-Vw1kbjlt.js} +1 -1
  35. package/out/renderer/assets/{index-e7_5cYB9.js → index-CBEysjAK.js} +1 -1
  36. package/out/renderer/assets/index-DBAaqMbw.css +1 -0
  37. package/out/renderer/assets/{index-Caxk5tgb.js → index-DBZqVg5O.js} +1 -1
  38. package/out/renderer/assets/{index-IINfVLtx.js → index-DYrqbn3V.js} +188 -188
  39. package/out/renderer/assets/{infoDiagram-PH2N3AL5-C0dwbbo2.js → infoDiagram-PH2N3AL5-Cmpi3PDq.js} +1 -1
  40. package/out/renderer/assets/{installer-BqHXNN_Q.js → installer-Cgr6muou.js} +1 -1
  41. package/out/renderer/assets/{journeyDiagram-U35MCT3I-Ce_-6oPh.js → journeyDiagram-U35MCT3I-BVMD25G1.js} +1 -1
  42. package/out/renderer/assets/{kanban-definition-NDS4AKOZ-BfC2rELG.js → kanban-definition-NDS4AKOZ-CVijSM-H.js} +1 -1
  43. package/out/renderer/assets/{layout-C8qa96WZ.js → layout-yGyBho08.js} +1 -1
  44. package/out/renderer/assets/{legacy-agents-page-oxgL0K8w.js → legacy-agents-page-C9F6Anar.js} +2 -2
  45. package/out/renderer/assets/{mermaid.core-XU5D2QM-.js → mermaid.core-eKt0AAEa.js} +5 -5
  46. package/out/renderer/assets/{mesh-page-CKWQJjR9.js → mesh-page-V7TXOqL8.js} +1 -1
  47. package/out/renderer/assets/{mindmap-definition-ALO5MXBD-BljWsgbL.js → mindmap-definition-ALO5MXBD-7OE97AHg.js} +1 -1
  48. package/out/renderer/assets/{mini-Dx_pCNq_.js → mini-CAwodgo3.js} +1 -1
  49. package/out/renderer/assets/notebook-pen-DU0uOGQD.js +6 -0
  50. package/out/renderer/assets/{org-surface-gate-C_mfNSkA.js → org-surface-gate-BnAoMqVG.js} +1 -1
  51. package/out/renderer/assets/{page-header-Du_WrlsN.js → page-header-B0mwcG_m.js} +1 -1
  52. package/out/renderer/assets/{pieDiagram-IB7DONF6-0DtrHJC4.js → pieDiagram-IB7DONF6-BXLSPmEJ.js} +1 -1
  53. package/out/renderer/assets/{projects-page-BtO7qveV.js → projects-page-BHtKptz-.js} +1 -1
  54. package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-LH8QQXdE.js → quadrantDiagram-7GDLP6J5-Csn6f8f3.js} +1 -1
  55. package/out/renderer/assets/{radar-MK3ICKWK-BXPsHVb3.js → radar-MK3ICKWK-BZZUrPnK.js} +1 -1
  56. package/out/renderer/assets/{radient-auth-buttons-BDIMPwPh.js → radient-auth-buttons-B0TYTsdi.js} +1 -1
  57. package/out/renderer/assets/{requirementDiagram-KVF5MWMF-NUiela-Z.js → requirementDiagram-KVF5MWMF-CidyP0gb.js} +1 -1
  58. package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-Bv32xiGK.js → sankeyDiagram-QLVOVGJD-RqzFypY6.js} +1 -1
  59. package/out/renderer/assets/{schedules-page-ZOQ5Aa7i.js → schedules-page-gb6zHM13.js} +1 -1
  60. package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-DhKfMbpL.js → sequenceDiagram-X6HHIX6F-hoGno_Xs.js} +1 -1
  61. package/out/renderer/assets/{settings-page-J0ziKUQu.js → settings-page-D7QXHWhp.js} +60 -60
  62. package/out/renderer/assets/{stateDiagram-DGXRK772-DtuHtZqu.js → stateDiagram-DGXRK772-CGfBWbub.js} +1 -1
  63. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-BuXMQAvq.js +1 -0
  64. package/out/renderer/assets/{timeline-definition-BDJGKUSR-DaghAT0K.js → timeline-definition-BDJGKUSR-CS5EDd47.js} +1 -1
  65. package/out/renderer/assets/{ui-preferences-store-C0rHfuT8.js → ui-preferences-store-BiKpLkJR.js} +1 -1
  66. package/out/renderer/assets/{use-download-agent-mutation-Uqc8JSLO.js → use-download-agent-mutation-DSU0LPqD.js} +1 -1
  67. package/out/renderer/assets/{use-memberships-query-Bf_-KANH.js → use-memberships-query-CN1cjAr2.js} +1 -1
  68. package/out/renderer/assets/{use-session-snapshot-L5kUKUQN.js → use-session-snapshot-Da-uFU-c.js} +1 -1
  69. package/out/renderer/assets/{xychartDiagram-VJFVF3MP-Q-Qk3b4A.js → xychartDiagram-VJFVF3MP-D44Ss3rC.js} +1 -1
  70. package/out/renderer/console-capture.html +5 -5
  71. package/out/renderer/index.html +7 -7
  72. package/out/renderer/installer.html +4 -4
  73. package/out/renderer/mini.html +7 -7
  74. package/package.json +1 -1
  75. package/out/renderer/assets/browser-page-PLs7fq5C.js +0 -1
  76. package/out/renderer/assets/channel-DsXie7lp.js +0 -1
  77. package/out/renderer/assets/classDiagram-GIVACNV2-CcOoxcHZ.js +0 -1
  78. package/out/renderer/assets/classDiagram-v2-COTLJTTW-CcOoxcHZ.js +0 -1
  79. package/out/renderer/assets/clone-r9efBuQF.js +0 -1
  80. package/out/renderer/assets/index-B9VTDCIg.css +0 -1
  81. package/out/renderer/assets/settings-section-CvCfGlJR.js +0 -6
  82. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-CQ7XIglm.js +0 -1
  83. /package/out/renderer/assets/{index-FkCpfjDn.js → index-CtslrM_p.js} +0 -0
@@ -1,292 +1,292 @@
1
- import{r as i,j as t,c as re,t as $n}from"./index-FkCpfjDn.js";import{cy as lt,cz as Un,cA as Tt,cB as ye,bP as Pn,aF as ve,a6 as tn,a7 as vt,aw as nn,u as sn,aM as zn,aN as Kn,cC as Bn,cD as Hn,cE as Vn,cF as Gn,cG as an,cH as bt,a4 as on,cI as Be,cJ as qn,aR as Yn,cK as Et,a2 as Wn,cL as Zn,cM as Qn,cN as Jn,cO as Xn,T as jt,cP as es,cQ as ts,av as rn,aT as dt,aU as ut,cR as ns,aY as ss,cS as as,ce as mt,a as cn,b as It,ag as Ge,cT as os,cU as rs,cV as is,d as xe,cW as ht,cX as cs,cY as ls,cZ as ds,aP as us,bf as ms,c_ as ln,c$ as hs,d0 as fs,d1 as ps,aL as gs,d2 as dn,aS as un,d3 as mn,d4 as ys,d5 as xs,d6 as ks,d7 as vs,d8 as bs,d9 as js,da as ws,db as _s,aG as Ns,bK as hn,aZ as Ss,a$ as Cs,dc as Le,dd as ft,de as Lt,df as Ms,dg as As,dh as Rs,di as Ts,dj as fn,dk as Es,b8 as Is,bS as Ls,bR as Os,dl as Fs,dm as Ds,dn as $s,dp as Us,dq as Ps}from"./conversation-input-sync-CyV2Rt9s.js";import{K as zs,u as ke,e as Ks,a as Bs,b as Hs,T as Vs,d as pn}from"./ui-preferences-store-C0rHfuT8.js";import{aX as gn,aY as Gs,aZ as qs,a_ as Ys,an as Ot,a$ as Ws,b0 as He,S as Zs,aI as Qs,b1 as Js,b2 as Xs,b3 as ea,b4 as ta,b5 as na,b6 as sa,ay as Ft,at as aa,aF as Dt,b7 as oa,aG as ra,aH as ia,b8 as ca,b9 as la}from"./index-IINfVLtx.js";import{P as da}from"./page-header-Du_WrlsN.js";import{c as w,B as $,S as ie,x as ua,s as ma,t as ha,u as fa,v as pa,w as ga,f as $e,R as Ze,L as pe,I as Ce,N as pt,O as gt,P as Fe,a4 as $t,T as yn,Y as ya,D as xa,l as ka,m as va,o as ba,p as Ut,k as ja,A as ne,j as wa,E as _a,a5 as Na,Z as Sa,C as Ca,e as xn}from"./error-boundary-zZlBqg1b.js";import{S as te,I as Qe,a as oe,N as Ma}from"./settings-section-CvCfGlJR.js";import{R as Aa}from"./radient-auth-buttons-BDIMPwPh.js";import{B as Ra}from"./book-open-D3nH3Oq3.js";import{a as Ta,p as at}from"./parseISO-CZfAC2_J.js";import{i as Ea,a as Se,f as Ia}from"./format-CZUObkkr.js";import{t as La}from"./en-US-BcB1DWxG.js";import"./console-mirror-Bzwctj4T.js";/**
1
+ import{r as i,j as t,c as ce,t as Un}from"./index-CtslrM_p.js";import{cy as lt,cz as Pn,cA as Tt,cB as xe,bP as zn,aF as be,a6 as nn,a7 as vt,aw as sn,u as an,aM as Kn,aN as Bn,cC as Hn,cD as Vn,cE as Gn,cF as qn,cG as on,cH as bt,a4 as rn,cI as He,cJ as Yn,aR as Wn,cK as Et,a2 as Zn,cL as Qn,cM as Jn,cN as Xn,cO as es,T as jt,cP as ts,cQ as ns,av as cn,aT as dt,aU as ut,cR as ss,aY as as,cS as os,ce as mt,a as ln,b as It,ag as qe,cT as rs,cU as is,cV as cs,d as ke,cW as ht,cX as ls,cY as ds,cZ as us,aP as ms,bf as hs,c_ as dn,c$ as fs,d0 as ps,d1 as gs,aL as ys,d2 as un,aS as mn,d3 as hn,d4 as xs,d5 as ks,d6 as vs,d7 as bs,d8 as js,d9 as ws,da as _s,db as Ns,aG as Ss,bK as fn,aZ as Cs,a$ as Ms,dc as Oe,dd as ft,de as Lt,df as As,dg as Rs,dh as Ts,di as Es,dj as pn,dk as Is,b8 as Ls,bS as Os,bR as Fs,dl as Ds,dm as $s,dn as Us,dp as Ot,dq as Ps,dr as zs,ds as Ks}from"./conversation-input-sync-CBw8uiPT.js";import{K as Bs,u as ve,e as Hs,a as Vs,b as Gs,T as qs,d as gn}from"./ui-preferences-store-BiKpLkJR.js";import{aZ as yn,a_ as Ys,a$ as Ws,b0 as te,aJ as Je,aK as re,b1 as Zs,an as Ft,b2 as Qs,b3 as Ve,S as Js,aI as Xs,b4 as ea,b5 as ta,b6 as na,b7 as sa,b8 as aa,b9 as oa,ay as Dt,ba as ra,at as ia,aF as $t,bb as ca,aG as la,aH as da,bc as ua,bd as ma}from"./index-DYrqbn3V.js";import{P as ha}from"./page-header-B0mwcG_m.js";import{c as w,B as $,S as le,x as fa,s as pa,t as ga,u as ya,v as xa,w as ka,f as Ue,R as Qe,L as fe,I as Me,N as pt,O as gt,P as De,a4 as Ut,T as xn,Y as va,D as ba,l as ja,m as wa,o as _a,p as Pt,k as Na,A as ne,j as Sa,E as Ca,a5 as Ma,Z as Aa,C as Ra,e as kn}from"./error-boundary-CQILQtMV.js";import{R as Ta}from"./radient-auth-buttons-B0TYTsdi.js";import{N as Ea}from"./notebook-pen-DU0uOGQD.js";import{B as Ia}from"./book-open-CKkVZcBo.js";import{a as La,p as at}from"./parseISO-CZfAC2_J.js";import{i as Oa,a as Ce,f as Fa}from"./format-CZUObkkr.js";import{t as Da}from"./en-US-BcB1DWxG.js";import"./console-mirror-BAq7R11H.js";/**
2
2
  * @license lucide-react v0.507.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const Oa=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m14.31 8 5.74 9.94",key:"1y6ab4"}],["path",{d:"M9.69 8h11.48",key:"1wxppr"}],["path",{d:"m7.38 12 5.74-9.94",key:"1grp0k"}],["path",{d:"M9.69 16 3.95 6.06",key:"libnyf"}],["path",{d:"M14.31 16H2.83",key:"x5fava"}],["path",{d:"m16.62 12-5.74 9.94",key:"1vwawt"}]],Fa=w("aperture",Oa);/**
6
+ */const $a=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m14.31 8 5.74 9.94",key:"1y6ab4"}],["path",{d:"M9.69 8h11.48",key:"1wxppr"}],["path",{d:"m7.38 12 5.74-9.94",key:"1grp0k"}],["path",{d:"M9.69 16 3.95 6.06",key:"libnyf"}],["path",{d:"M14.31 16H2.83",key:"x5fava"}],["path",{d:"m16.62 12-5.74 9.94",key:"1vwawt"}]],Ua=w("aperture",$a);/**
7
7
  * @license lucide-react v0.507.0 - ISC
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const Da=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M20.2 20.2c2.04-2.03.02-7.36-4.5-11.9-4.54-4.52-9.87-6.54-11.9-4.5-2.04 2.03-.02 7.36 4.5 11.9 4.54 4.52 9.87 6.54 11.9 4.5Z",key:"1l2ple"}],["path",{d:"M15.7 15.7c4.52-4.54 6.54-9.87 4.5-11.9-2.03-2.04-7.36-.02-11.9 4.5-4.52 4.54-6.54 9.87-4.5 11.9 2.03 2.04 7.36.02 11.9-4.5Z",key:"1wam0m"}]],$a=w("atom",Da);/**
11
+ */const Pa=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M20.2 20.2c2.04-2.03.02-7.36-4.5-11.9-4.54-4.52-9.87-6.54-11.9-4.5-2.04 2.03-.02 7.36 4.5 11.9 4.54 4.52 9.87 6.54 11.9 4.5Z",key:"1l2ple"}],["path",{d:"M15.7 15.7c4.52-4.54 6.54-9.87 4.5-11.9-2.03-2.04-7.36-.02-11.9 4.5-4.52 4.54-6.54 9.87-4.5 11.9 2.03 2.04 7.36.02 11.9-4.5Z",key:"1wam0m"}]],za=w("atom",Pa);/**
12
12
  * @license lucide-react v0.507.0 - ISC
13
13
  *
14
14
  * This source code is licensed under the ISC license.
15
15
  * See the LICENSE file in the root directory of this source tree.
16
- */const Ua=[["path",{d:"M2 13a2 2 0 0 0 2-2V7a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0V4a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0v-4a2 2 0 0 1 2-2",key:"57tc96"}]],Pa=w("audio-waveform",Ua);/**
16
+ */const Ka=[["path",{d:"M2 13a2 2 0 0 0 2-2V7a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0V4a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0v-4a2 2 0 0 1 2-2",key:"57tc96"}]],Ba=w("audio-waveform",Ka);/**
17
17
  * @license lucide-react v0.507.0 - ISC
18
18
  *
19
19
  * This source code is licensed under the ISC license.
20
20
  * See the LICENSE file in the root directory of this source tree.
21
- */const za=[["rect",{x:"14",y:"14",width:"4",height:"6",rx:"2",key:"p02svl"}],["rect",{x:"6",y:"4",width:"4",height:"6",rx:"2",key:"xm4xkj"}],["path",{d:"M6 20h4",key:"1i6q5t"}],["path",{d:"M14 10h4",key:"ru81e7"}],["path",{d:"M6 14h2v6",key:"16z9wg"}],["path",{d:"M14 4h2v6",key:"1idq9u"}]],Ka=w("binary",za);/**
21
+ */const Ha=[["rect",{x:"14",y:"14",width:"4",height:"6",rx:"2",key:"p02svl"}],["rect",{x:"6",y:"4",width:"4",height:"6",rx:"2",key:"xm4xkj"}],["path",{d:"M6 20h4",key:"1i6q5t"}],["path",{d:"M14 10h4",key:"ru81e7"}],["path",{d:"M6 14h2v6",key:"16z9wg"}],["path",{d:"M14 4h2v6",key:"1idq9u"}]],Va=w("binary",Ha);/**
22
22
  * @license lucide-react v0.507.0 - ISC
23
23
  *
24
24
  * This source code is licensed under the ISC license.
25
25
  * See the LICENSE file in the root directory of this source tree.
26
- */const Ba=[["path",{d:"M10 7v10.9",key:"1gynux"}],["path",{d:"M14 6.1V17",key:"116kdf"}],["path",{d:"M16 7V3a1 1 0 0 1 1.707-.707 2.5 2.5 0 0 0 2.152.717 1 1 0 0 1 1.131 1.131 2.5 2.5 0 0 0 .717 2.152A1 1 0 0 1 21 8h-4",key:"gpb6xx"}],["path",{d:"M16.536 7.465a5 5 0 0 0-7.072 0l-2 2a5 5 0 0 0 0 7.07 5 5 0 0 0 7.072 0l2-2a5 5 0 0 0 0-7.07",key:"1tsln4"}],["path",{d:"M8 17v4a1 1 0 0 1-1.707.707 2.5 2.5 0 0 0-2.152-.717 1 1 0 0 1-1.131-1.131 2.5 2.5 0 0 0-.717-2.152A1 1 0 0 1 3 16h4",key:"qexcha"}]],Ha=w("candy",Ba);/**
26
+ */const Ga=[["path",{d:"M10 7v10.9",key:"1gynux"}],["path",{d:"M14 6.1V17",key:"116kdf"}],["path",{d:"M16 7V3a1 1 0 0 1 1.707-.707 2.5 2.5 0 0 0 2.152.717 1 1 0 0 1 1.131 1.131 2.5 2.5 0 0 0 .717 2.152A1 1 0 0 1 21 8h-4",key:"gpb6xx"}],["path",{d:"M16.536 7.465a5 5 0 0 0-7.072 0l-2 2a5 5 0 0 0 0 7.07 5 5 0 0 0 7.072 0l2-2a5 5 0 0 0 0-7.07",key:"1tsln4"}],["path",{d:"M8 17v4a1 1 0 0 1-1.707.707 2.5 2.5 0 0 0-2.152-.717 1 1 0 0 1-1.131-1.131 2.5 2.5 0 0 0-.717-2.152A1 1 0 0 1 3 16h4",key:"qexcha"}]],qa=w("candy",Ga);/**
27
27
  * @license lucide-react v0.507.0 - ISC
28
28
  *
29
29
  * This source code is licensed under the ISC license.
30
30
  * See the LICENSE file in the root directory of this source tree.
31
- */const Va=[["path",{d:"m21 8-2 2-1.5-3.7A2 2 0 0 0 15.646 5H8.4a2 2 0 0 0-1.903 1.257L5 10 3 8",key:"1imjwt"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 14h.01",key:"7oqj8z"}],["rect",{width:"18",height:"8",x:"3",y:"10",rx:"2",key:"a7itu8"}],["path",{d:"M5 18v2",key:"ppbyun"}],["path",{d:"M19 18v2",key:"gy7782"}]],Ga=w("car-front",Va);/**
31
+ */const Ya=[["path",{d:"m21 8-2 2-1.5-3.7A2 2 0 0 0 15.646 5H8.4a2 2 0 0 0-1.903 1.257L5 10 3 8",key:"1imjwt"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 14h.01",key:"7oqj8z"}],["rect",{width:"18",height:"8",x:"3",y:"10",rx:"2",key:"a7itu8"}],["path",{d:"M5 18v2",key:"ppbyun"}],["path",{d:"M19 18v2",key:"gy7782"}]],Wa=w("car-front",Ya);/**
32
32
  * @license lucide-react v0.507.0 - ISC
33
33
  *
34
34
  * This source code is licensed under the ISC license.
35
35
  * See the LICENSE file in the root directory of this source tree.
36
- */const qa=[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["circle",{cx:"8",cy:"10",r:"2",key:"1xl4ub"}],["path",{d:"M8 12h8",key:"1wcyev"}],["circle",{cx:"16",cy:"10",r:"2",key:"r14t7q"}],["path",{d:"m6 20 .7-2.9A1.4 1.4 0 0 1 8.1 16h7.8a1.4 1.4 0 0 1 1.4 1l.7 3",key:"l01ucn"}]],Ya=w("cassette-tape",qa);/**
36
+ */const Za=[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["circle",{cx:"8",cy:"10",r:"2",key:"1xl4ub"}],["path",{d:"M8 12h8",key:"1wcyev"}],["circle",{cx:"16",cy:"10",r:"2",key:"r14t7q"}],["path",{d:"m6 20 .7-2.9A1.4 1.4 0 0 1 8.1 16h7.8a1.4 1.4 0 0 1 1.4 1l.7 3",key:"l01ucn"}]],Qa=w("cassette-tape",Za);/**
37
37
  * @license lucide-react v0.507.0 - ISC
38
38
  *
39
39
  * This source code is licensed under the ISC license.
40
40
  * See the LICENSE file in the root directory of this source tree.
41
- */const Wa=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],Za=w("chart-line",Wa);/**
41
+ */const Ja=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],Xa=w("chart-line",Ja);/**
42
42
  * @license lucide-react v0.507.0 - ISC
43
43
  *
44
44
  * This source code is licensed under the ISC license.
45
45
  * See the LICENSE file in the root directory of this source tree.
46
- */const Qa=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]],Ja=w("circle-play",Qa);/**
46
+ */const eo=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]],to=w("circle-play",eo);/**
47
47
  * @license lucide-react v0.507.0 - ISC
48
48
  *
49
49
  * This source code is licensed under the ISC license.
50
50
  * See the LICENSE file in the root directory of this source tree.
51
- */const Xa=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],eo=w("circle-plus",Xa);/**
51
+ */const no=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],so=w("circle-plus",no);/**
52
52
  * @license lucide-react v0.507.0 - ISC
53
53
  *
54
54
  * This source code is licensed under the ISC license.
55
55
  * See the LICENSE file in the root directory of this source tree.
56
- */const to=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M11 9h4a2 2 0 0 0 2-2V3",key:"1ve2rv"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"M7 21v-4a2 2 0 0 1 2-2h4",key:"1fwkro"}],["circle",{cx:"15",cy:"15",r:"2",key:"3i40o0"}]],no=w("circuit-board",to);/**
56
+ */const ao=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M11 9h4a2 2 0 0 0 2-2V3",key:"1ve2rv"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"M7 21v-4a2 2 0 0 1 2-2h4",key:"1fwkro"}],["circle",{cx:"15",cy:"15",r:"2",key:"3i40o0"}]],oo=w("circuit-board",ao);/**
57
57
  * @license lucide-react v0.507.0 - ISC
58
58
  *
59
59
  * This source code is licensed under the ISC license.
60
60
  * See the LICENSE file in the root directory of this source tree.
61
- */const so=[["path",{d:"M6 16.326A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 .5 8.973",key:"1cez44"}],["path",{d:"m13 12-3 5h4l-3 5",key:"1t22er"}]],ao=w("cloud-lightning",so);/**
61
+ */const ro=[["path",{d:"M6 16.326A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 .5 8.973",key:"1cez44"}],["path",{d:"m13 12-3 5h4l-3 5",key:"1t22er"}]],io=w("cloud-lightning",ro);/**
62
62
  * @license lucide-react v0.507.0 - ISC
63
63
  *
64
64
  * This source code is licensed under the ISC license.
65
65
  * See the LICENSE file in the root directory of this source tree.
66
- */const oo=[["path",{d:"M10.188 8.5A6 6 0 0 1 16 4a1 1 0 0 0 6 6 6 6 0 0 1-3 5.197",key:"erj67n"}],["path",{d:"M13 16a3 3 0 1 1 0 6H7a5 5 0 1 1 4.9-6Z",key:"p44pc9"}]],ro=w("cloud-moon",oo);/**
66
+ */const co=[["path",{d:"M10.188 8.5A6 6 0 0 1 16 4a1 1 0 0 0 6 6 6 6 0 0 1-3 5.197",key:"erj67n"}],["path",{d:"M13 16a3 3 0 1 1 0 6H7a5 5 0 1 1 4.9-6Z",key:"p44pc9"}]],lo=w("cloud-moon",co);/**
67
67
  * @license lucide-react v0.507.0 - ISC
68
68
  *
69
69
  * This source code is licensed under the ISC license.
70
70
  * See the LICENSE file in the root directory of this source tree.
71
- */const io=[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M8 19h.01",key:"puxtts"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M12 21h.01",key:"h35vbk"}],["path",{d:"M16 15h.01",key:"rnfrdf"}],["path",{d:"M16 19h.01",key:"1vcnzz"}]],co=w("cloud-snow",io);/**
71
+ */const uo=[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M8 19h.01",key:"puxtts"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M12 21h.01",key:"h35vbk"}],["path",{d:"M16 15h.01",key:"rnfrdf"}],["path",{d:"M16 19h.01",key:"1vcnzz"}]],mo=w("cloud-snow",uo);/**
72
72
  * @license lucide-react v0.507.0 - ISC
73
73
  *
74
74
  * This source code is licensed under the ISC license.
75
75
  * See the LICENSE file in the root directory of this source tree.
76
- */const lo=[["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}],["path",{d:"M15.947 12.65a4 4 0 0 0-5.925-4.128",key:"dpwdj0"}],["path",{d:"M13 22H7a5 5 0 1 1 4.9-6H13a3 3 0 0 1 0 6Z",key:"s09mg5"}]],uo=w("cloud-sun",lo);/**
76
+ */const ho=[["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}],["path",{d:"M15.947 12.65a4 4 0 0 0-5.925-4.128",key:"dpwdj0"}],["path",{d:"M13 22H7a5 5 0 1 1 4.9-6H13a3 3 0 0 1 0 6Z",key:"s09mg5"}]],fo=w("cloud-sun",ho);/**
77
77
  * @license lucide-react v0.507.0 - ISC
78
78
  *
79
79
  * This source code is licensed under the ISC license.
80
80
  * See the LICENSE file in the root directory of this source tree.
81
- */const mo=[["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M14 2v2",key:"6buw04"}],["path",{d:"M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1",key:"pwadti"}],["path",{d:"M6 2v2",key:"colzsn"}]],ho=w("coffee",mo);/**
81
+ */const po=[["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M14 2v2",key:"6buw04"}],["path",{d:"M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1",key:"pwadti"}],["path",{d:"M6 2v2",key:"colzsn"}]],go=w("coffee",po);/**
82
82
  * @license lucide-react v0.507.0 - ISC
83
83
  *
84
84
  * This source code is licensed under the ISC license.
85
85
  * See the LICENSE file in the root directory of this source tree.
86
- */const fo=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 18a6 6 0 0 0 0-12v12z",key:"j4l70d"}]],kn=w("contrast",fo);/**
86
+ */const yo=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 18a6 6 0 0 0 0-12v12z",key:"j4l70d"}]],vn=w("contrast",yo);/**
87
87
  * @license lucide-react v0.507.0 - ISC
88
88
  *
89
89
  * This source code is licensed under the ISC license.
90
90
  * See the LICENSE file in the root directory of this source tree.
91
- */const po=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],go=w("credit-card",po);/**
91
+ */const xo=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],ko=w("credit-card",xo);/**
92
92
  * @license lucide-react v0.507.0 - ISC
93
93
  *
94
94
  * This source code is licensed under the ISC license.
95
95
  * See the LICENSE file in the root directory of this source tree.
96
- */const yo=[["path",{d:"m6 8 1.75 12.28a2 2 0 0 0 2 1.72h4.54a2 2 0 0 0 2-1.72L18 8",key:"8166m8"}],["path",{d:"M5 8h14",key:"pcz4l3"}],["path",{d:"M7 15a6.47 6.47 0 0 1 5 0 6.47 6.47 0 0 0 5 0",key:"yjz344"}],["path",{d:"m12 8 1-6h2",key:"3ybfa4"}]],xo=w("cup-soda",yo);/**
96
+ */const vo=[["path",{d:"m6 8 1.75 12.28a2 2 0 0 0 2 1.72h4.54a2 2 0 0 0 2-1.72L18 8",key:"8166m8"}],["path",{d:"M5 8h14",key:"pcz4l3"}],["path",{d:"M7 15a6.47 6.47 0 0 1 5 0 6.47 6.47 0 0 0 5 0",key:"yjz344"}],["path",{d:"m12 8 1-6h2",key:"3ybfa4"}]],bo=w("cup-soda",vo);/**
97
97
  * @license lucide-react v0.507.0 - ISC
98
98
  *
99
99
  * This source code is licensed under the ISC license.
100
100
  * See the LICENSE file in the root directory of this source tree.
101
- */const ko=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M6 12c0-1.7.7-3.2 1.8-4.2",key:"oqkarx"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M18 12c0 1.7-.7 3.2-1.8 4.2",key:"1eah9h"}]],vo=w("disc-3",ko);/**
101
+ */const jo=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M6 12c0-1.7.7-3.2 1.8-4.2",key:"oqkarx"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M18 12c0 1.7-.7 3.2-1.8 4.2",key:"1eah9h"}]],wo=w("disc-3",jo);/**
102
102
  * @license lucide-react v0.507.0 - ISC
103
103
  *
104
104
  * This source code is licensed under the ISC license.
105
105
  * See the LICENSE file in the root directory of this source tree.
106
- */const bo=[["path",{d:"M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z",key:"c7niix"}]],jo=w("droplet",bo);/**
106
+ */const _o=[["path",{d:"M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z",key:"c7niix"}]],No=w("droplet",_o);/**
107
107
  * @license lucide-react v0.507.0 - ISC
108
108
  *
109
109
  * This source code is licensed under the ISC license.
110
110
  * See the LICENSE file in the root directory of this source tree.
111
- */const wo=[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]],_o=w("droplets",wo);/**
111
+ */const So=[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]],Co=w("droplets",So);/**
112
112
  * @license lucide-react v0.507.0 - ISC
113
113
  *
114
114
  * This source code is licensed under the ISC license.
115
115
  * See the LICENSE file in the root directory of this source tree.
116
- */const No=[["path",{d:"M6.5 12c.94-3.46 4.94-6 8.5-6 3.56 0 6.06 2.54 7 6-.94 3.47-3.44 6-7 6s-7.56-2.53-8.5-6Z",key:"15baut"}],["path",{d:"M18 12v.5",key:"18hhni"}],["path",{d:"M16 17.93a9.77 9.77 0 0 1 0-11.86",key:"16dt7o"}],["path",{d:"M7 10.67C7 8 5.58 5.97 2.73 5.5c-1 1.5-1 5 .23 6.5-1.24 1.5-1.24 5-.23 6.5C5.58 18.03 7 16 7 13.33",key:"l9di03"}],["path",{d:"M10.46 7.26C10.2 5.88 9.17 4.24 8 3h5.8a2 2 0 0 1 1.98 1.67l.23 1.4",key:"1kjonw"}],["path",{d:"m16.01 17.93-.23 1.4A2 2 0 0 1 13.8 21H9.5a5.96 5.96 0 0 0 1.49-3.98",key:"1zlm23"}]],So=w("fish",No);/**
116
+ */const Mo=[["path",{d:"M6.5 12c.94-3.46 4.94-6 8.5-6 3.56 0 6.06 2.54 7 6-.94 3.47-3.44 6-7 6s-7.56-2.53-8.5-6Z",key:"15baut"}],["path",{d:"M18 12v.5",key:"18hhni"}],["path",{d:"M16 17.93a9.77 9.77 0 0 1 0-11.86",key:"16dt7o"}],["path",{d:"M7 10.67C7 8 5.58 5.97 2.73 5.5c-1 1.5-1 5 .23 6.5-1.24 1.5-1.24 5-.23 6.5C5.58 18.03 7 16 7 13.33",key:"l9di03"}],["path",{d:"M10.46 7.26C10.2 5.88 9.17 4.24 8 3h5.8a2 2 0 0 1 1.98 1.67l.23 1.4",key:"1kjonw"}],["path",{d:"m16.01 17.93-.23 1.4A2 2 0 0 1 13.8 21H9.5a5.96 5.96 0 0 0 1.49-3.98",key:"1zlm23"}]],Ao=w("fish",Mo);/**
117
117
  * @license lucide-react v0.507.0 - ISC
118
118
  *
119
119
  * This source code is licensed under the ISC license.
120
120
  * See the LICENSE file in the root directory of this source tree.
121
- */const Co=[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]],Mo=w("flame",Co);/**
121
+ */const Ro=[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]],To=w("flame",Ro);/**
122
122
  * @license lucide-react v0.507.0 - ISC
123
123
  *
124
124
  * This source code is licensed under the ISC license.
125
125
  * See the LICENSE file in the root directory of this source tree.
126
- */const Ao=[["path",{d:"M12 5a3 3 0 1 1 3 3m-3-3a3 3 0 1 0-3 3m3-3v1M9 8a3 3 0 1 0 3 3M9 8h1m5 0a3 3 0 1 1-3 3m3-3h-1m-2 3v-1",key:"3pnvol"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["path",{d:"M12 10v12",key:"6ubwww"}],["path",{d:"M12 22c4.2 0 7-1.667 7-5-4.2 0-7 1.667-7 5Z",key:"9hd38g"}],["path",{d:"M12 22c-4.2 0-7-1.667-7-5 4.2 0 7 1.667 7 5Z",key:"ufn41s"}]],Ro=w("flower-2",Ao);/**
126
+ */const Eo=[["path",{d:"M12 5a3 3 0 1 1 3 3m-3-3a3 3 0 1 0-3 3m3-3v1M9 8a3 3 0 1 0 3 3M9 8h1m5 0a3 3 0 1 1-3 3m3-3h-1m-2 3v-1",key:"3pnvol"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["path",{d:"M12 10v12",key:"6ubwww"}],["path",{d:"M12 22c4.2 0 7-1.667 7-5-4.2 0-7 1.667-7 5Z",key:"9hd38g"}],["path",{d:"M12 22c-4.2 0-7-1.667-7-5 4.2 0 7 1.667 7 5Z",key:"ufn41s"}]],Io=w("flower-2",Eo);/**
127
127
  * @license lucide-react v0.507.0 - ISC
128
128
  *
129
129
  * This source code is licensed under the ISC license.
130
130
  * See the LICENSE file in the root directory of this source tree.
131
- */const To=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 16.5A4.5 4.5 0 1 1 7.5 12 4.5 4.5 0 1 1 12 7.5a4.5 4.5 0 1 1 4.5 4.5 4.5 4.5 0 1 1-4.5 4.5",key:"14wa3c"}],["path",{d:"M12 7.5V9",key:"1oy5b0"}],["path",{d:"M7.5 12H9",key:"eltsq1"}],["path",{d:"M16.5 12H15",key:"vk5kw4"}],["path",{d:"M12 16.5V15",key:"k7eayi"}],["path",{d:"m8 8 1.88 1.88",key:"nxy4qf"}],["path",{d:"M14.12 9.88 16 8",key:"1lst6k"}],["path",{d:"m8 16 1.88-1.88",key:"h2eex1"}],["path",{d:"M14.12 14.12 16 16",key:"uqkrx3"}]],Eo=w("flower",To);/**
131
+ */const Lo=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 16.5A4.5 4.5 0 1 1 7.5 12 4.5 4.5 0 1 1 12 7.5a4.5 4.5 0 1 1 4.5 4.5 4.5 4.5 0 1 1-4.5 4.5",key:"14wa3c"}],["path",{d:"M12 7.5V9",key:"1oy5b0"}],["path",{d:"M7.5 12H9",key:"eltsq1"}],["path",{d:"M16.5 12H15",key:"vk5kw4"}],["path",{d:"M12 16.5V15",key:"k7eayi"}],["path",{d:"m8 8 1.88 1.88",key:"nxy4qf"}],["path",{d:"M14.12 9.88 16 8",key:"1lst6k"}],["path",{d:"m8 16 1.88-1.88",key:"h2eex1"}],["path",{d:"M14.12 14.12 16 16",key:"uqkrx3"}]],Oo=w("flower",Lo);/**
132
132
  * @license lucide-react v0.507.0 - ISC
133
133
  *
134
134
  * This source code is licensed under the ISC license.
135
135
  * See the LICENSE file in the root directory of this source tree.
136
- */const Io=[["path",{d:"M9 10h.01",key:"qbtxuw"}],["path",{d:"M15 10h.01",key:"1qmjsl"}],["path",{d:"M12 2a8 8 0 0 0-8 8v12l3-3 2.5 2.5L12 19l2.5 2.5L17 19l3 3V10a8 8 0 0 0-8-8z",key:"uwwb07"}]],Lo=w("ghost",Io);/**
136
+ */const Fo=[["path",{d:"M9 10h.01",key:"qbtxuw"}],["path",{d:"M15 10h.01",key:"1qmjsl"}],["path",{d:"M12 2a8 8 0 0 0-8 8v12l3-3 2.5 2.5L12 19l2.5 2.5L17 19l3 3V10a8 8 0 0 0-8-8z",key:"uwwb07"}]],Do=w("ghost",Fo);/**
137
137
  * @license lucide-react v0.507.0 - ISC
138
138
  *
139
139
  * This source code is licensed under the ISC license.
140
140
  * See the LICENSE file in the root directory of this source tree.
141
- */const Oo=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],Fo=w("github",Oo);/**
141
+ */const $o=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],Uo=w("github",$o);/**
142
142
  * @license lucide-react v0.507.0 - ISC
143
143
  *
144
144
  * This source code is licensed under the ISC license.
145
145
  * See the LICENSE file in the root directory of this source tree.
146
- */const Do=[["path",{d:"m11.9 12.1 4.514-4.514",key:"109xqo"}],["path",{d:"M20.1 2.3a1 1 0 0 0-1.4 0l-1.114 1.114A2 2 0 0 0 17 4.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 17.828 7h1.344a2 2 0 0 0 1.414-.586L21.7 5.3a1 1 0 0 0 0-1.4z",key:"txyc8t"}],["path",{d:"m6 16 2 2",key:"16qmzd"}],["path",{d:"M8.23 9.85A3 3 0 0 1 11 8a5 5 0 0 1 5 5 3 3 0 0 1-1.85 2.77l-.92.38A2 2 0 0 0 12 18a4 4 0 0 1-4 4 6 6 0 0 1-6-6 4 4 0 0 1 4-4 2 2 0 0 0 1.85-1.23z",key:"1de1vg"}]],$o=w("guitar",Do);/**
146
+ */const Po=[["path",{d:"m11.9 12.1 4.514-4.514",key:"109xqo"}],["path",{d:"M20.1 2.3a1 1 0 0 0-1.4 0l-1.114 1.114A2 2 0 0 0 17 4.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 17.828 7h1.344a2 2 0 0 0 1.414-.586L21.7 5.3a1 1 0 0 0 0-1.4z",key:"txyc8t"}],["path",{d:"m6 16 2 2",key:"16qmzd"}],["path",{d:"M8.23 9.85A3 3 0 0 1 11 8a5 5 0 0 1 5 5 3 3 0 0 1-1.85 2.77l-.92.38A2 2 0 0 0 12 18a4 4 0 0 1-4 4 6 6 0 0 1-6-6 4 4 0 0 1 4-4 2 2 0 0 0 1.85-1.23z",key:"1de1vg"}]],zo=w("guitar",Po);/**
147
147
  * @license lucide-react v0.507.0 - ISC
148
148
  *
149
149
  * This source code is licensed under the ISC license.
150
150
  * See the LICENSE file in the root directory of this source tree.
151
- */const Uo=[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}]],Po=w("hexagon",Uo);/**
151
+ */const Ko=[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}]],Bo=w("hexagon",Ko);/**
152
152
  * @license lucide-react v0.507.0 - ISC
153
153
  *
154
154
  * This source code is licensed under the ISC license.
155
155
  * See the LICENSE file in the root directory of this source tree.
156
- */const zo=[["path",{d:"M12 17c5 0 8-2.69 8-6H4c0 3.31 3 6 8 6m-4 4h8m-4-3v3M5.14 11a3.5 3.5 0 1 1 6.71 0",key:"1uxfcu"}],["path",{d:"M12.14 11a3.5 3.5 0 1 1 6.71 0",key:"4k3m1s"}],["path",{d:"M15.5 6.5a3.5 3.5 0 1 0-7 0",key:"zmuahr"}]],Ko=w("ice-cream-bowl",zo);/**
156
+ */const Ho=[["path",{d:"M12 17c5 0 8-2.69 8-6H4c0 3.31 3 6 8 6m-4 4h8m-4-3v3M5.14 11a3.5 3.5 0 1 1 6.71 0",key:"1uxfcu"}],["path",{d:"M12.14 11a3.5 3.5 0 1 1 6.71 0",key:"4k3m1s"}],["path",{d:"M15.5 6.5a3.5 3.5 0 1 0-7 0",key:"zmuahr"}]],Vo=w("ice-cream-bowl",Ho);/**
157
157
  * @license lucide-react v0.507.0 - ISC
158
158
  *
159
159
  * This source code is licensed under the ISC license.
160
160
  * See the LICENSE file in the root directory of this source tree.
161
- */const Bo=[["path",{d:"M21 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-2Z",key:"jg2n2t"}],["path",{d:"M6 15v-2",key:"gd6mvg"}],["path",{d:"M12 15V9",key:"8c7uyn"}],["circle",{cx:"12",cy:"6",r:"3",key:"1gm2ql"}]],Ho=w("joystick",Bo);/**
161
+ */const Go=[["path",{d:"M21 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-2Z",key:"jg2n2t"}],["path",{d:"M6 15v-2",key:"gd6mvg"}],["path",{d:"M12 15V9",key:"8c7uyn"}],["circle",{cx:"12",cy:"6",r:"3",key:"1gm2ql"}]],qo=w("joystick",Go);/**
162
162
  * @license lucide-react v0.507.0 - ISC
163
163
  *
164
164
  * This source code is licensed under the ISC license.
165
165
  * See the LICENSE file in the root directory of this source tree.
166
- */const Vo=[["path",{d:"M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z",key:"nnexq3"}],["path",{d:"M2 21c0-3 1.85-5.36 5.08-6C9.5 14.52 12 13 13 12",key:"mt58a7"}]],Go=w("leaf",Vo);/**
166
+ */const Yo=[["path",{d:"M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z",key:"nnexq3"}],["path",{d:"M2 21c0-3 1.85-5.36 5.08-6C9.5 14.52 12 13 13 12",key:"mt58a7"}]],Wo=w("leaf",Yo);/**
167
167
  * @license lucide-react v0.507.0 - ISC
168
168
  *
169
169
  * This source code is licensed under the ISC license.
170
170
  * See the LICENSE file in the root directory of this source tree.
171
- */const qo=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],Yo=w("lightbulb",qo);/**
171
+ */const Zo=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],Qo=w("lightbulb",Zo);/**
172
172
  * @license lucide-react v0.507.0 - ISC
173
173
  *
174
174
  * This source code is licensed under the ISC license.
175
175
  * See the LICENSE file in the root directory of this source tree.
176
- */const Wo=[["path",{d:"M8 2h8",key:"1ssgc1"}],["path",{d:"M9 2v2.789a4 4 0 0 1-.672 2.219l-.656.984A4 4 0 0 0 7 10.212V20a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-9.789a4 4 0 0 0-.672-2.219l-.656-.984A4 4 0 0 1 15 4.788V2",key:"qtp12x"}],["path",{d:"M7 15a6.472 6.472 0 0 1 5 0 6.47 6.47 0 0 0 5 0",key:"ygeh44"}]],Zo=w("milk",Wo);/**
176
+ */const Jo=[["path",{d:"M8 2h8",key:"1ssgc1"}],["path",{d:"M9 2v2.789a4 4 0 0 1-.672 2.219l-.656.984A4 4 0 0 0 7 10.212V20a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-9.789a4 4 0 0 0-.672-2.219l-.656-.984A4 4 0 0 1 15 4.788V2",key:"qtp12x"}],["path",{d:"M7 15a6.472 6.472 0 0 1 5 0 6.47 6.47 0 0 0 5 0",key:"ygeh44"}]],Xo=w("milk",Jo);/**
177
177
  * @license lucide-react v0.507.0 - ISC
178
178
  *
179
179
  * This source code is licensed under the ISC license.
180
180
  * See the LICENSE file in the root directory of this source tree.
181
- */const Qo=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9",key:"4ay0iu"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}]],Jo=w("moon-star",Qo);/**
181
+ */const er=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9",key:"4ay0iu"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}]],tr=w("moon-star",er);/**
182
182
  * @license lucide-react v0.507.0 - ISC
183
183
  *
184
184
  * This source code is licensed under the ISC license.
185
185
  * See the LICENSE file in the root directory of this source tree.
186
- */const Xo=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],er=w("moon",Xo);/**
186
+ */const nr=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],sr=w("moon",nr);/**
187
187
  * @license lucide-react v0.507.0 - ISC
188
188
  *
189
189
  * This source code is licensed under the ISC license.
190
190
  * See the LICENSE file in the root directory of this source tree.
191
- */const tr=[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}],["path",{d:"M4.14 15.08c2.62-1.57 5.24-1.43 7.86.42 2.74 1.94 5.49 2 8.23.19",key:"1pvmmp"}]],nr=w("mountain-snow",tr);/**
191
+ */const ar=[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}],["path",{d:"M4.14 15.08c2.62-1.57 5.24-1.43 7.86.42 2.74 1.94 5.49 2 8.23.19",key:"1pvmmp"}]],or=w("mountain-snow",ar);/**
192
192
  * @license lucide-react v0.507.0 - ISC
193
193
  *
194
194
  * This source code is licensed under the ISC license.
195
195
  * See the LICENSE file in the root directory of this source tree.
196
- */const sr=[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]],ar=w("mountain",sr);/**
196
+ */const rr=[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]],ir=w("mountain",rr);/**
197
197
  * @license lucide-react v0.507.0 - ISC
198
198
  *
199
199
  * This source code is licensed under the ISC license.
200
200
  * See the LICENSE file in the root directory of this source tree.
201
- */const or=[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]],rr=w("radio",or);/**
201
+ */const cr=[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]],lr=w("radio",cr);/**
202
202
  * @license lucide-react v0.507.0 - ISC
203
203
  *
204
204
  * This source code is licensed under the ISC license.
205
205
  * See the LICENSE file in the root directory of this source tree.
206
- */const ir=[["path",{d:"M22 18H2a4 4 0 0 0 4 4h12a4 4 0 0 0 4-4Z",key:"1404fh"}],["path",{d:"M21 14 10 2 3 14h18Z",key:"1nzg7v"}],["path",{d:"M10 2v16",key:"1labyt"}]],cr=w("sailboat",ir);/**
206
+ */const dr=[["path",{d:"M22 18H2a4 4 0 0 0 4 4h12a4 4 0 0 0 4-4Z",key:"1404fh"}],["path",{d:"M21 14 10 2 3 14h18Z",key:"1nzg7v"}],["path",{d:"M10 2v16",key:"1labyt"}]],ur=w("sailboat",dr);/**
207
207
  * @license lucide-react v0.507.0 - ISC
208
208
  *
209
209
  * This source code is licensed under the ISC license.
210
210
  * See the LICENSE file in the root directory of this source tree.
211
- */const lr=[["path",{d:"M20.38 3.46 16 2a4 4 0 0 1-8 0L3.62 3.46a2 2 0 0 0-1.34 2.23l.58 3.47a1 1 0 0 0 .99.84H6v10c0 1.1.9 2 2 2h8a2 2 0 0 0 2-2V10h2.15a1 1 0 0 0 .99-.84l.58-3.47a2 2 0 0 0-1.34-2.23z",key:"1wgbhj"}]],dr=w("shirt",lr);/**
211
+ */const mr=[["path",{d:"M20.38 3.46 16 2a4 4 0 0 1-8 0L3.62 3.46a2 2 0 0 0-1.34 2.23l.58 3.47a1 1 0 0 0 .99.84H6v10c0 1.1.9 2 2 2h8a2 2 0 0 0 2-2V10h2.15a1 1 0 0 0 .99-.84l.58-3.47a2 2 0 0 0-1.34-2.23z",key:"1wgbhj"}]],hr=w("shirt",mr);/**
212
212
  * @license lucide-react v0.507.0 - ISC
213
213
  *
214
214
  * This source code is licensed under the ISC license.
215
215
  * See the LICENSE file in the root directory of this source tree.
216
- */const ur=[["path",{d:"m12.5 17-.5-1-.5 1h1z",key:"3me087"}],["path",{d:"M15 22a1 1 0 0 0 1-1v-1a2 2 0 0 0 1.56-3.25 8 8 0 1 0-11.12 0A2 2 0 0 0 8 20v1a1 1 0 0 0 1 1z",key:"1o5pge"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}]],mr=w("skull",ur);/**
216
+ */const fr=[["path",{d:"m12.5 17-.5-1-.5 1h1z",key:"3me087"}],["path",{d:"M15 22a1 1 0 0 0 1-1v-1a2 2 0 0 0 1.56-3.25 8 8 0 1 0-11.12 0A2 2 0 0 0 8 20v1a1 1 0 0 0 1 1z",key:"1o5pge"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}]],pr=w("skull",fr);/**
217
217
  * @license lucide-react v0.507.0 - ISC
218
218
  *
219
219
  * This source code is licensed under the ISC license.
220
220
  * See the LICENSE file in the root directory of this source tree.
221
- */const hr=[["path",{d:"m10 20-1.25-2.5L6 18",key:"18frcb"}],["path",{d:"M10 4 8.75 6.5 6 6",key:"7mghy3"}],["path",{d:"m14 20 1.25-2.5L18 18",key:"1chtki"}],["path",{d:"m14 4 1.25 2.5L18 6",key:"1b4wsy"}],["path",{d:"m17 21-3-6h-4",key:"15hhxa"}],["path",{d:"m17 3-3 6 1.5 3",key:"11697g"}],["path",{d:"M2 12h6.5L10 9",key:"kv9z4n"}],["path",{d:"m20 10-1.5 2 1.5 2",key:"1swlpi"}],["path",{d:"M22 12h-6.5L14 15",key:"1mxi28"}],["path",{d:"m4 10 1.5 2L4 14",key:"k9enpj"}],["path",{d:"m7 21 3-6-1.5-3",key:"j8hb9u"}],["path",{d:"m7 3 3 6h4",key:"1otusx"}]],fr=w("snowflake",hr);/**
221
+ */const gr=[["path",{d:"m10 20-1.25-2.5L6 18",key:"18frcb"}],["path",{d:"M10 4 8.75 6.5 6 6",key:"7mghy3"}],["path",{d:"m14 20 1.25-2.5L18 18",key:"1chtki"}],["path",{d:"m14 4 1.25 2.5L18 6",key:"1b4wsy"}],["path",{d:"m17 21-3-6h-4",key:"15hhxa"}],["path",{d:"m17 3-3 6 1.5 3",key:"11697g"}],["path",{d:"M2 12h6.5L10 9",key:"kv9z4n"}],["path",{d:"m20 10-1.5 2 1.5 2",key:"1swlpi"}],["path",{d:"M22 12h-6.5L14 15",key:"1mxi28"}],["path",{d:"m4 10 1.5 2L4 14",key:"k9enpj"}],["path",{d:"m7 21 3-6-1.5-3",key:"j8hb9u"}],["path",{d:"m7 3 3 6h4",key:"1otusx"}]],yr=w("snowflake",gr);/**
222
222
  * @license lucide-react v0.507.0 - ISC
223
223
  *
224
224
  * This source code is licensed under the ISC license.
225
225
  * See the LICENSE file in the root directory of this source tree.
226
- */const pr=[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}]],gr=w("sparkle",pr);/**
226
+ */const xr=[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}]],kr=w("sparkle",xr);/**
227
227
  * @license lucide-react v0.507.0 - ISC
228
228
  *
229
229
  * This source code is licensed under the ISC license.
230
230
  * See the LICENSE file in the root directory of this source tree.
231
- */const yr=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 4h.01",key:"1ujb9j"}],["path",{d:"M20 12h.01",key:"1ykeid"}],["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M4 12h.01",key:"158zrr"}],["path",{d:"M17.657 6.343h.01",key:"31pqzk"}],["path",{d:"M17.657 17.657h.01",key:"jehnf4"}],["path",{d:"M6.343 17.657h.01",key:"gdk6ow"}],["path",{d:"M6.343 6.343h.01",key:"1uurf0"}]],xr=w("sun-dim",yr);/**
231
+ */const vr=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 4h.01",key:"1ujb9j"}],["path",{d:"M20 12h.01",key:"1ykeid"}],["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M4 12h.01",key:"158zrr"}],["path",{d:"M17.657 6.343h.01",key:"31pqzk"}],["path",{d:"M17.657 17.657h.01",key:"jehnf4"}],["path",{d:"M6.343 17.657h.01",key:"gdk6ow"}],["path",{d:"M6.343 6.343h.01",key:"1uurf0"}]],br=w("sun-dim",vr);/**
232
232
  * @license lucide-react v0.507.0 - ISC
233
233
  *
234
234
  * This source code is licensed under the ISC license.
235
235
  * See the LICENSE file in the root directory of this source tree.
236
- */const kr=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],vr=w("sun",kr);/**
236
+ */const jr=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],wr=w("sun",jr);/**
237
237
  * @license lucide-react v0.507.0 - ISC
238
238
  *
239
239
  * This source code is licensed under the ISC license.
240
240
  * See the LICENSE file in the root directory of this source tree.
241
- */const br=[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m4.93 10.93 1.41 1.41",key:"2a7f42"}],["path",{d:"M2 18h2",key:"j10viu"}],["path",{d:"M20 18h2",key:"wocana"}],["path",{d:"m19.07 10.93-1.41 1.41",key:"15zs5n"}],["path",{d:"M22 22H2",key:"19qnx5"}],["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M16 18a4 4 0 0 0-8 0",key:"1lzouq"}]],jr=w("sunrise",br);/**
241
+ */const _r=[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m4.93 10.93 1.41 1.41",key:"2a7f42"}],["path",{d:"M2 18h2",key:"j10viu"}],["path",{d:"M20 18h2",key:"wocana"}],["path",{d:"m19.07 10.93-1.41 1.41",key:"15zs5n"}],["path",{d:"M22 22H2",key:"19qnx5"}],["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M16 18a4 4 0 0 0-8 0",key:"1lzouq"}]],Nr=w("sunrise",_r);/**
242
242
  * @license lucide-react v0.507.0 - ISC
243
243
  *
244
244
  * This source code is licensed under the ISC license.
245
245
  * See the LICENSE file in the root directory of this source tree.
246
- */const wr=[["path",{d:"M12 10V2",key:"16sf7g"}],["path",{d:"m4.93 10.93 1.41 1.41",key:"2a7f42"}],["path",{d:"M2 18h2",key:"j10viu"}],["path",{d:"M20 18h2",key:"wocana"}],["path",{d:"m19.07 10.93-1.41 1.41",key:"15zs5n"}],["path",{d:"M22 22H2",key:"19qnx5"}],["path",{d:"m16 6-4 4-4-4",key:"6wukr"}],["path",{d:"M16 18a4 4 0 0 0-8 0",key:"1lzouq"}]],_r=w("sunset",wr);/**
246
+ */const Sr=[["path",{d:"M12 10V2",key:"16sf7g"}],["path",{d:"m4.93 10.93 1.41 1.41",key:"2a7f42"}],["path",{d:"M2 18h2",key:"j10viu"}],["path",{d:"M20 18h2",key:"wocana"}],["path",{d:"m19.07 10.93-1.41 1.41",key:"15zs5n"}],["path",{d:"M22 22H2",key:"19qnx5"}],["path",{d:"m16 6-4 4-4-4",key:"6wukr"}],["path",{d:"M16 18a4 4 0 0 0-8 0",key:"1lzouq"}]],Cr=w("sunset",Sr);/**
247
247
  * @license lucide-react v0.507.0 - ISC
248
248
  *
249
249
  * This source code is licensed under the ISC license.
250
250
  * See the LICENSE file in the root directory of this source tree.
251
- */const Nr=[["path",{d:"M3.5 21 14 3",key:"1szst5"}],["path",{d:"M20.5 21 10 3",key:"1310c3"}],["path",{d:"M15.5 21 12 15l-3.5 6",key:"1ddtfw"}],["path",{d:"M2 21h20",key:"1nyx9w"}]],Sr=w("tent",Nr);/**
251
+ */const Mr=[["path",{d:"M3.5 21 14 3",key:"1szst5"}],["path",{d:"M20.5 21 10 3",key:"1310c3"}],["path",{d:"M15.5 21 12 15l-3.5 6",key:"1ddtfw"}],["path",{d:"M2 21h20",key:"1nyx9w"}]],Ar=w("tent",Mr);/**
252
252
  * @license lucide-react v0.507.0 - ISC
253
253
  *
254
254
  * This source code is licensed under the ISC license.
255
255
  * See the LICENSE file in the root directory of this source tree.
256
- */const Cr=[["path",{d:"M8 19a4 4 0 0 1-2.24-7.32A3.5 3.5 0 0 1 9 6.03V6a3 3 0 1 1 6 0v.04a3.5 3.5 0 0 1 3.24 5.65A4 4 0 0 1 16 19Z",key:"oadzkq"}],["path",{d:"M12 19v3",key:"npa21l"}]],Mr=w("tree-deciduous",Cr);/**
256
+ */const Rr=[["path",{d:"M8 19a4 4 0 0 1-2.24-7.32A3.5 3.5 0 0 1 9 6.03V6a3 3 0 1 1 6 0v.04a3.5 3.5 0 0 1 3.24 5.65A4 4 0 0 1 16 19Z",key:"oadzkq"}],["path",{d:"M12 19v3",key:"npa21l"}]],Tr=w("tree-deciduous",Rr);/**
257
257
  * @license lucide-react v0.507.0 - ISC
258
258
  *
259
259
  * This source code is licensed under the ISC license.
260
260
  * See the LICENSE file in the root directory of this source tree.
261
- */const Ar=[["path",{d:"M13 8c0-2.76-2.46-5-5.5-5S2 5.24 2 8h2l1-1 1 1h4",key:"foxbe7"}],["path",{d:"M13 7.14A5.82 5.82 0 0 1 16.5 6c3.04 0 5.5 2.24 5.5 5h-3l-1-1-1 1h-3",key:"18arnh"}],["path",{d:"M5.89 9.71c-2.15 2.15-2.3 5.47-.35 7.43l4.24-4.25.7-.7.71-.71 2.12-2.12c-1.95-1.96-5.27-1.8-7.42.35",key:"ywahnh"}],["path",{d:"M11 15.5c.5 2.5-.17 4.5-1 6.5h4c2-5.5-.5-12-1-14",key:"ft0feo"}]],Rr=w("tree-palm",Ar);/**
261
+ */const Er=[["path",{d:"M13 8c0-2.76-2.46-5-5.5-5S2 5.24 2 8h2l1-1 1 1h4",key:"foxbe7"}],["path",{d:"M13 7.14A5.82 5.82 0 0 1 16.5 6c3.04 0 5.5 2.24 5.5 5h-3l-1-1-1 1h-3",key:"18arnh"}],["path",{d:"M5.89 9.71c-2.15 2.15-2.3 5.47-.35 7.43l4.24-4.25.7-.7.71-.71 2.12-2.12c-1.95-1.96-5.27-1.8-7.42.35",key:"ywahnh"}],["path",{d:"M11 15.5c.5 2.5-.17 4.5-1 6.5h4c2-5.5-.5-12-1-14",key:"ft0feo"}]],Ir=w("tree-palm",Er);/**
262
262
  * @license lucide-react v0.507.0 - ISC
263
263
  *
264
264
  * This source code is licensed under the ISC license.
265
265
  * See the LICENSE file in the root directory of this source tree.
266
- */const Tr=[["path",{d:"m17 14 3 3.3a1 1 0 0 1-.7 1.7H4.7a1 1 0 0 1-.7-1.7L7 14h-.3a1 1 0 0 1-.7-1.7L9 9h-.2A1 1 0 0 1 8 7.3L12 3l4 4.3a1 1 0 0 1-.8 1.7H15l3 3.3a1 1 0 0 1-.7 1.7H17Z",key:"cpyugq"}],["path",{d:"M12 22v-3",key:"kmzjlo"}]],Er=w("tree-pine",Tr);/**
266
+ */const Lr=[["path",{d:"m17 14 3 3.3a1 1 0 0 1-.7 1.7H4.7a1 1 0 0 1-.7-1.7L7 14h-.3a1 1 0 0 1-.7-1.7L9 9h-.2A1 1 0 0 1 8 7.3L12 3l4 4.3a1 1 0 0 1-.8 1.7H15l3 3.3a1 1 0 0 1-.7 1.7H17Z",key:"cpyugq"}],["path",{d:"M12 22v-3",key:"kmzjlo"}]],Or=w("tree-pine",Lr);/**
267
267
  * @license lucide-react v0.507.0 - ISC
268
268
  *
269
269
  * This source code is licensed under the ISC license.
270
270
  * See the LICENSE file in the root directory of this source tree.
271
- */const Ir=[["path",{d:"M10 10v.2A3 3 0 0 1 8.9 16H5a3 3 0 0 1-1-5.8V10a3 3 0 0 1 6 0Z",key:"1l6gj6"}],["path",{d:"M7 16v6",key:"1a82de"}],["path",{d:"M13 19v3",key:"13sx9i"}],["path",{d:"M12 19h8.3a1 1 0 0 0 .7-1.7L18 14h.3a1 1 0 0 0 .7-1.7L16 9h.2a1 1 0 0 0 .8-1.7L13 3l-1.4 1.5",key:"1sj9kv"}]],Lr=w("trees",Ir);/**
271
+ */const Fr=[["path",{d:"M10 10v.2A3 3 0 0 1 8.9 16H5a3 3 0 0 1-1-5.8V10a3 3 0 0 1 6 0Z",key:"1l6gj6"}],["path",{d:"M7 16v6",key:"1a82de"}],["path",{d:"M13 19v3",key:"13sx9i"}],["path",{d:"M12 19h8.3a1 1 0 0 0 .7-1.7L18 14h.3a1 1 0 0 0 .7-1.7L16 9h.2a1 1 0 0 0 .8-1.7L13 3l-1.4 1.5",key:"1sj9kv"}]],Dr=w("trees",Fr);/**
272
272
  * @license lucide-react v0.507.0 - ISC
273
273
  *
274
274
  * This source code is licensed under the ISC license.
275
275
  * See the LICENSE file in the root directory of this source tree.
276
- */const Or=[["path",{d:"M22 12a10.06 10.06 1 0 0-20 0Z",key:"1teyop"}],["path",{d:"M12 12v8a2 2 0 0 0 4 0",key:"ulpmoc"}],["path",{d:"M12 2v1",key:"11qlp1"}]],Fr=w("umbrella",Or);/**
276
+ */const $r=[["path",{d:"M22 12a10.06 10.06 1 0 0-20 0Z",key:"1teyop"}],["path",{d:"M12 12v8a2 2 0 0 0 4 0",key:"ulpmoc"}],["path",{d:"M12 2v1",key:"11qlp1"}]],Ur=w("umbrella",$r);/**
277
277
  * @license lucide-react v0.507.0 - ISC
278
278
  *
279
279
  * This source code is licensed under the ISC license.
280
280
  * See the LICENSE file in the root directory of this source tree.
281
- */const Dr=[["path",{d:"M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"knzxuh"}],["path",{d:"M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"2jd2cc"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}]],$r=w("waves",Dr);/**
281
+ */const Pr=[["path",{d:"M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"knzxuh"}],["path",{d:"M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"2jd2cc"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}]],zr=w("waves",Pr);/**
282
282
  * @license lucide-react v0.507.0 - ISC
283
283
  *
284
284
  * This source code is licensed under the ISC license.
285
285
  * See the LICENSE file in the root directory of this source tree.
286
- */const Ur=[["path",{d:"M2 22 16 8",key:"60hf96"}],["path",{d:"M3.47 12.53 5 11l1.53 1.53a3.5 3.5 0 0 1 0 4.94L5 19l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1rdhi6"}],["path",{d:"M7.47 8.53 9 7l1.53 1.53a3.5 3.5 0 0 1 0 4.94L9 15l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1sdzmb"}],["path",{d:"M11.47 4.53 13 3l1.53 1.53a3.5 3.5 0 0 1 0 4.94L13 11l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"eoatbi"}],["path",{d:"M20 2h2v2a4 4 0 0 1-4 4h-2V6a4 4 0 0 1 4-4Z",key:"19rau1"}],["path",{d:"M11.47 17.47 13 19l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L5 19l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"tc8ph9"}],["path",{d:"M15.47 13.47 17 15l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L9 15l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"2m8kc5"}],["path",{d:"M19.47 9.47 21 11l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L13 11l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"vex3ng"}]],Pr=w("wheat",Ur);/**
286
+ */const Kr=[["path",{d:"M2 22 16 8",key:"60hf96"}],["path",{d:"M3.47 12.53 5 11l1.53 1.53a3.5 3.5 0 0 1 0 4.94L5 19l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1rdhi6"}],["path",{d:"M7.47 8.53 9 7l1.53 1.53a3.5 3.5 0 0 1 0 4.94L9 15l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1sdzmb"}],["path",{d:"M11.47 4.53 13 3l1.53 1.53a3.5 3.5 0 0 1 0 4.94L13 11l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"eoatbi"}],["path",{d:"M20 2h2v2a4 4 0 0 1-4 4h-2V6a4 4 0 0 1 4-4Z",key:"19rau1"}],["path",{d:"M11.47 17.47 13 19l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L5 19l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"tc8ph9"}],["path",{d:"M15.47 13.47 17 15l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L9 15l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"2m8kc5"}],["path",{d:"M19.47 9.47 21 11l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L13 11l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"vex3ng"}]],Br=w("wheat",Kr);/**
287
287
  * @license lucide-react v0.507.0 - ISC
288
288
  *
289
289
  * This source code is licensed under the ISC license.
290
290
  * See the LICENSE file in the root directory of this source tree.
291
- */const zr=[["path",{d:"M12.8 19.6A2 2 0 1 0 14 16H2",key:"148xed"}],["path",{d:"M17.5 8a2.5 2.5 0 1 1 2 4H2",key:"1u4tom"}],["path",{d:"M9.8 4.4A2 2 0 1 1 11 8H2",key:"75valh"}]],Kr=w("wind",zr),Br=({appVersion:e=null,slowWaitHintMs:n})=>{const s="https://local-operator.com/download",[a,o]=i.useState(!1),r=gn(a,n??Gs),[l,u]=i.useState(!1),[c,m]=i.useState(null),[y,j]=i.useState("info"),[b,h]=i.useState(null),[f,M]=i.useState(null),S=e?.trim()?e.trim():null,V=i.useRef(!1),_=lt(L=>L.openDetail),B=i.useRef(!1),U=i.useRef(0),A=i.useRef(!1),C=i.useCallback((L,D)=>{B.current=!1,m(L),j(D),u(!0)},[]),W=i.useCallback(L=>{B.current=!0,m(L),j("success"),u(!0)},[]),q=i.useCallback(()=>{B.current&&(B.current=!1,u(!1),m(null))},[]),{clearDeferredUpdate:Q}=Un();i.useEffect(()=>{const L=window.api.updater.onUpdateError(p=>{V.current&&p.includes("manually")&&(h({message:"The server is installed outside the app, so use the tool you installed it with - uv, pipx or pip.",command:""}),B.current=!1,m(null),j("warning"),u(!0))}),D=window.api.updater.onBackendUpdateDevMode(p=>{V.current&&C(p,"info")}),O=()=>{A.current=!0,q()},z=window.api.updater.onUpdateAvailable(O),K=window.api.updater.onUpdateNpxAvailable(O),se=window.api.updater.onBackendUpdateAvailable(O);return()=>{L(),D(),z(),K(),se()}},[q,C]),i.useEffect(()=>{let L=!1;const D=()=>{window.api.updater.getLastInstallAttempt().then(z=>{L||M(z)}).catch(()=>{})};D();const O=window.api.updater.onUpdateInstallFailed(()=>D());return()=>{L=!0,O()}},[]);const T=async()=>{const L=++U.current;q(),A.current=!1;try{o(!0),V.current=!0,Q(ye.UI),Q(ye.BACKEND);const D=await window.api.updater.checkForAllUpdates({manual:!0});if(L!==U.current)return;D.app==="available"&&_(ye.UI),D.server==="available"&&_(ye.BACKEND),D?.affirmation&&!A.current?W(D.affirmation):q()}catch(D){if(L!==U.current)return;console.warn(`Update check failed; the app-level alert owns the report: ${qs(D)}`)}finally{L===U.current&&o(!1),setTimeout(()=>{V.current=!1},2e3)}},ee=()=>{B.current=!1,u(!1),m(null)};return t.jsxs(t.Fragment,{children:[f&&t.jsxs("div",{className:"mb-3 rounded-sm bg-sunken p-3",children:[t.jsxs("p",{className:"text-body-sm text-ink",children:["The last update to version ",f.targetVersion," didn't finish",f.attempts>1?` (${f.attempts} attempts)`:"",".",S?` Version ${S} is running.`:null]}),t.jsxs("p",{className:"mt-1 text-meta text-ink-dim",children:["Detected"," ",f.detectedAt?new Date(f.detectedAt).toLocaleString():"at an unknown time",". ",f.detail]}),t.jsx($,{variant:"outline",size:"sm",className:"mt-2",onClick:()=>void window.api.openExternal(s),children:"Download a fresh copy"})]}),t.jsxs($,{variant:"outline",onClick:()=>void T(),disabled:a,children:[a?t.jsx(ie,{size:"sm"}):null,a?"Checking...":"Check for updates"]}),r&&t.jsx("p",{className:"mt-2 text-meta text-ink-muted",children:"Still checking. A slow or stalled connection can hold this for about a minute and a half - the app stops waiting on its own."}),b&&t.jsxs(Tt,{open:l,autoHideDuration:1e4,onClose:ee,variant:"warning",children:[t.jsx("p",{className:"text-body-sm",children:b.message}),b.command&&t.jsx("code",{className:"mt-2 block rounded-sm bg-sunken p-2 text-mono-sm text-ink",children:b.command})]}),c&&y!=="danger"&&t.jsx(Tt,{open:l,autoHideDuration:6e3,onClose:ee,variant:y,children:c})]})},qe=["system-prompt"],Hr=()=>{const{shouldEnableQuery:e}=Pn();return ve({enabled:e({bypassInternetCheck:!0}),queryKey:qe,queryFn:async()=>{try{const s=await tn(vt.baseUrl).config.getSystemPrompt();if(s===null)return null;if(s.status>=400)throw new Error(s.message||"Failed to fetch system prompt");return s.result}catch(n){const s=n instanceof Error?n.message:"An unknown error occurred while fetching system prompt";throw nn(s),n}},refetchOnWindowFocus:!1,staleTime:5e3})},Vr=()=>{const e=sn(),n=tn(vt.baseUrl);return zn({mutationFn:async s=>{try{const a=await n.config.updateSystemPrompt(s);if(a.status>=400)throw new Error(a.message||"Failed to update system prompt");return a.result}catch(a){const o=a instanceof Error?a.message:"An unknown error occurred while updating system prompt";throw nn(o),a}},onSuccess:async s=>{await e.invalidateQueries({queryKey:qe,refetchType:"none"}),e.setQueryData(qe,a=>a&&{...a,...s}),await e.refetchQueries({queryKey:qe,type:"all"}),Kn("System prompt updated")},onError:s=>{console.error("Error updating system prompt:",s)}})},Gr=({value:e,label:n,description:s,onChange:a,icon:o,isSaving:r=!1})=>{const[l,u]=i.useState(e),c=i.useId(),m=`${c}-label`,y=`${c}-description`,j=async b=>{if(!r){u(b);try{await a(b)}catch(h){u(!b),console.error("Error toggling setting:",h)}}};return t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("span",{id:m,className:"flex min-h-6 items-center gap-2 text-body text-ink",children:[o&&t.jsx(o,{size:14,"aria-hidden":"true",className:"shrink-0 text-ink-dim"}),n]}),s&&t.jsx("p",{id:y,className:"mt-0.5 max-w-2xl text-body-sm text-ink-muted",children:s})]}),t.jsx("div",{className:"flex h-6 shrink-0 items-center",children:r?t.jsx(ie,{size:"md",label:`Saving ${n}`}):t.jsx(ua,{checked:l,onCheckedChange:j,"aria-labelledby":m,"aria-describedby":s?y:void 0})})]})};function Pt(e,n){const s=La(e,n?.in);if(!Ea(s))throw new RangeError("Invalid time value");const a=Se(s.getDate(),2),o=Se(s.getMonth()+1,2),r=s.getFullYear(),l=Se(s.getHours(),2),u=Se(s.getMinutes(),2),c=Se(s.getSeconds(),2);let m="",y="";const j=s.getTimezoneOffset();if(j!==0){const b=Math.abs(j),h=Se(Math.trunc(b/60),2),f=Se(b%60,2);y=`${j<0?"+":"-"}${h}:${f}`}else y="Z";return`${r}-${o}-${a}T${l}:${u}:${c}${m}${y}`}function qr(e,n,s){return Ta(e,-30,s)}var Yr=Bn({chartName:"LineChart",GraphicalChild:an,axisComponents:[{axisType:"xAxis",AxisComp:Hn},{axisType:"yAxis",AxisComp:Vn}],formatAxisMap:Gn});const Wr=["radient","creditBalance"],Zr=e=>{const{user:n,isAuthenticated:s}=bt(),a=n?.account?.tenant_id,o=s&&!!a&&e?.enabled;return ve({queryKey:[Wr,a],queryFn:async()=>{if(!a)throw new Error("Tenant ID not available");const r=await on({operation:"credits",tenantId:a});if(!r||typeof r.balance!="number")throw new Error("Invalid credit balance response format");return r},enabled:o,staleTime:5*60*1e3,refetchOnWindowFocus:!0})},Qr=["radient","usageRollup"],Jr=(e,n)=>{const{user:s,isAuthenticated:a}=bt(),o=s?.account?.tenant_id,r=a&&!!o&&n?.enabled;return ve({queryKey:[...Qr,o,e],queryFn:async()=>{if(!o)throw new Error("Tenant ID not available");const l={};for(const[c,m]of Object.entries(e))m!=null&&(l[c]=String(m));const u=await on({operation:"usage",tenantId:o,query:l});if(!u)throw new Error("Invalid usage rollup response format");return u},enabled:r,staleTime:5*60*1e3,refetchOnWindowFocus:!0})},zt={[ye.UI]:"Application updates",[ye.BACKEND]:"Server updates"},Kt=({type:e})=>{const n=lt(a=>a.followed[e]),s=lt(a=>a.setFollowedSegment);return t.jsxs("div",{className:"flex flex-col gap-1.5 sm:flex-row sm:items-center sm:justify-between sm:gap-6",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-body-sm text-ink",children:zt[e]}),t.jsx("div",{className:"mt-0.5 text-meta text-ink-muted",children:Be[n].description})]}),t.jsxs(ma,{value:n,onValueChange:a=>s(e,a),children:[t.jsx(ha,{"aria-label":`${zt[e]}: ${Be[n].label}`,className:"w-full sm:w-56","data-followed-segment":e,children:t.jsx(fa,{})}),t.jsx(pa,{children:qn.map(a=>t.jsx(ga,{value:a,title:Be[a].description,children:Be[a].label},a))})]})]})},Xr=()=>t.jsxs("div",{className:re("flex flex-col gap-3"),children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-heading text-ink",children:"Update notifications"}),t.jsx("p",{className:"mt-1 text-meta text-ink-muted",children:"How much of a version change shows the update notice at the bottom of the window. A check you run yourself always reports what it finds."})]}),t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx(Kt,{type:ye.UI}),t.jsx(Kt,{type:ye.BACKEND})]})]}),ei=({appVersion:e})=>t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(Xr,{}),t.jsx(Br,{appVersion:e})]}),ti=e=>{if(!e)return null;try{return new URL(e).host}catch{return null}},ni=()=>{const[e,n]=i.useState(null),[s,a]=i.useState({value:"Loading...",detail:null,degraded:!1}),[o,r]=i.useState({platform:"Loading...",arch:"...",nodeVersion:"Loading...",electronVersion:"Loading...",chromeVersion:"Loading..."});i.useEffect(()=>{let u=!0;const c=h=>{if(!u)return;const f=ti(h.url);if(h.state==="connecting"){a({value:"Loading...",detail:null,degraded:!1});return}if(h.state==="detached"){a({value:"Not connected",detail:h.detail||null,degraded:!1});return}if(h.state==="wedged"){a({value:"Not attached",detail:h.detail||null,degraded:!1});return}const M=h.version||"Version unknown";a({value:f?`${M} · ${f}`:M,detail:h.detail||null,degraded:h.state==="degraded"})};let m=!1;const y=window.api?.backend?.onStatusChange(h=>{m=!0,c(h)}),j=async()=>{try{const[h,f]=await Promise.all([window.api.systemInfo.getAppVersion(),window.api.systemInfo.getPlatformInfo()]);u&&(n(h),r(f))}catch(h){console.error("Error fetching app information:",h)}},b=async()=>{try{const h=window.api?.backend;if(h){const S=await h.getStatus();m||c(S);return}const f=await Et.healthCheck(vt.baseUrl),M=Et.getServerVersion(f);u&&a({value:M,detail:null,degraded:!1})}catch(h){console.error("Error fetching server version:",h),u&&a({value:"Unavailable",detail:null,degraded:!1})}};return j(),b(),()=>{u=!1,y?.()}},[]);const l=(u,c,m,y={})=>t.jsx(oe,{label:t.jsx($e,{content:m,children:t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx(Ze,{size:12,className:"shrink-0"}),u]})}),valueClassName:y.valueClassName,value:t.jsxs(t.Fragment,{children:[y.valueTooltip?t.jsx($e,{content:y.valueTooltip,children:t.jsx("span",{"data-backend-version":y.valueHoverTarget?"":void 0,children:c})}):c,y.statusNote?t.jsx("span",{className:"mt-0.5 block text-meta text-ink-dim",children:y.statusNote}):null]})});return t.jsx(te,{title:"Application updates and info",icon:Yn,description:"Check for updates and view information about your Local Operator installation.",dataTourTag:"settings-app-updates-section",children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsxs(Qe,{children:[l("Application version",e??"Loading...","The version of the Local Operator user interface application."),l("Server version",s.value,"The version of the Local Operator API server backend, and the address of the daemon it was read from.",{valueTooltip:s.detail,valueHoverTarget:!0,statusNote:s.degraded?"Not answering":void 0,valueClassName:s.degraded?"text-ink-muted":void 0}),l("Platform",`${o.platform} (${o.arch})`,"The operating system and architecture your application is running on."),l("Node.js version",o.nodeVersion,"The JavaScript runtime environment version."),l("Electron version",o.electronVersion,"The framework version enabling this desktop application.")]}),t.jsx(ei,{appVersion:e})]})})},si=e=>{const n=e.label.replace(/^Open\s+/,"");return n.charAt(0).toUpperCase()+n.slice(1)},ai=({action:e})=>{const n=i.useId(),s=i.useRef(null),a=ke(f=>f.shortcutBindings),o=a[e.id],r=ke(f=>f.setShortcutBinding),l=ke(f=>f.clearShortcutBinding),[u,c]=i.useState(!1),[m,y]=i.useState(null),j=i.useMemo(Wn,[]),b=Ks(e.id,a),h=si(e);return t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx(pe,{htmlFor:n,className:"w-32 text-body-sm text-ink",children:h}),t.jsx(Ce,{id:n,readOnly:!0,value:b===null?"No shortcut":Bs(b,j),"aria-label":`${h}: press the keys you want`,"data-shortcut-action":e.id,ref:s,className:re("w-52",b===null?"text-body-sm":"font-mono text-body-sm"),onFocus:()=>c(!0),onBlur:()=>{c(!1),y(null)},onKeyDown:f=>{if(Zn.has(f.key))return;if(Qn.has(f.key)){c(!1),y(null);return}if(Jn.has(f.key)||f.nativeEvent.isComposing)return;const M=Xn({key:f.key,metaKey:f.metaKey,ctrlKey:f.ctrlKey,altKey:f.altKey,shiftKey:f.shiftKey}),S=Hs(M,e.id,a,j);if(S!==null){f.preventDefault(),c(!0),y(S);return}if(M===b){c(!0),y(null);return}f.preventDefault(),c(!0),y(null),M===e.defaultChord?r(e.id,null):M!==null&&r(e.id,M)}}),b!==null&&t.jsx($,{variant:"secondary",size:"sm","aria-label":`Clear ${h}'s shortcut`,onClick:()=>{l(e.id),s.current?.focus()},children:"Clear"}),o!==void 0&&t.jsx($,{variant:"secondary",size:"sm","aria-label":`Reset ${h} to its default`,onClick:()=>{r(e.id,null),s.current?.focus()},children:"Reset"})]}),u&&t.jsx("span",{className:"text-meta text-ink-dim",children:"Press the keys you want; Esc cancels."}),m!==null&&t.jsx("output",{className:"text-meta text-danger",children:m})]})},oi=({sectionRef:e})=>t.jsx(te,{title:"Keyboard shortcuts",icon:Ys,description:"Shortcuts for the panel rail. Focus a field and press the keys you want; Esc cancels, Reset restores an action's default, and Clear leaves it unbound.",sectionRef:e,children:t.jsx("div",{className:"flex flex-col gap-4",children:zs.map(n=>t.jsx(ai,{action:n},n.id))})}),ri=[[[".claude.json"],"Claude Code"],[[".claude",".mcp.json"],"Claude Code"],[[".cursor","mcp.json"],"Cursor"],[[".vscode","mcp.json"],"VS Code"],[[".codex","config.toml"],"Codex CLI"]];function vn(e){if(!e)return null;const n=e.split("\\").join("/").split("/").filter(Boolean);for(const[s,a]of ri)if(!(n.length<s.length)&&n.slice(-s.length).join("/")===s.join("/"))return a;return null}const Ye=e=>`${e} ${e===1?"tool":"tools"}`,ii=e=>`${e} ${e===1?"integration":"integrations"}`,ci=["connected","needs_sign_in","not_started","connecting","error"],bn=e=>ci.includes(e),Te=(e,n)=>[...n].filter(s=>s.name===e&&s.status==="running").sort((s,a)=>a.created_at-s.created_at)[0]??null,li={connectedAt:null,connectedToolCount:null,settledGroup:null,pinnedGroup:null,pinnedOperationId:null,needsKey:!1,needsSignIn:!1,disconnectedAt:null,holdUntil:null,lastDecisive:null},di=1e12,ui=1e9,mi=60*60*1e3,jn=(e,n=Date.now())=>{if(typeof e!="number"||!Number.isFinite(e))return null;const s=e>=di?e:e<ui?null:e*1e3;return s===null||s>n+mi?null:Math.min(s,n)},Me=(e,n)=>e?.[n]??li,Pe=(e,n,s)=>pi(e,n)??s?.lastDecisive??null,hi=e=>({id:e.id,name:e.name,action:e.action,status:e.status,created_at:e.created_at,credential_removed:e.credential_removed,...e.message?{message:e.message}:{}}),wt=(e,n)=>e.status==="not_started"&&typeof e.tool_count=="number"&&(n.connectedAt!==null||e.status_basis==="stored"&&e.tool_count_basis==="last_seen"),fi=(e,n)=>[...n].filter(s=>s.name===e).sort((s,a)=>a.created_at-s.created_at)[0]??null,pi=(e,n)=>fi(e,n.filter(s=>s.status!=="cancelled")),Je=e=>e.actions.includes("set_key")||e.actions.includes("add_key");function gi(e,n){const s=Math.max(0,Math.round((e-n)/1e3));if(s<60)return"just now";const a=Math.round(s/60);if(a<60)return`${a} min ago`;const o=Math.round(a/60);return o<24?`${o} h ago`:`${Math.round(o/24)} d ago`}function ot(e){if(!e)return null;const n=e.trim();if(!n||/^\/\w/.test(n)||/\/mcp\s+\w+/.test(n))return null;let s=n;for(let a=0;a<3;a+=1){const o=s.replace(/^(?:connection (?:closed|error|refused)|error|closed|failed)\s*:\s*/i,"").trim();if(o===s)break;s=o}return s=s.replace(/\s*\(\s*\d{3}\s*\)/g,"").replace(/\s+([.,;])/g,"$1").replace(/\s{2,}/g," ").trim(),s||null}function yi(e,n=[],s,a=Date.now()){const o=Me(s,e.name),r=Te(e.name,n);if(r){if(r.action==="login"||r.action==="reauth")return{label:"Signing in…",tone:"info",detail:null,busy:!0};if(r.action==="logout")return{label:"Signing out…",tone:"info",detail:null,busy:!0}}if(!bn(e.status))return{label:"Status unavailable",tone:"neutral",detail:null,busy:!1};const l=Pe(e.name,n,o),u=Xe(l)&&e.status!=="connected",c=wt(e,o),m=St(l)&&e.status!=="connected",y=(l?.action==="login"||l?.action==="reauth")&&l.status==="failed";if(o.disconnectedAt!==null)return{label:"Not connected",tone:"neutral",detail:null,busy:!1};switch(e.status){case"connected":return{label:typeof e.tool_count=="number"?`Connected · ${Ye(e.tool_count)}`:"Connected",tone:"success",detail:null,busy:!1};case"connecting":return{label:"Connecting…",tone:"info",detail:null,busy:!0};case"needs_sign_in":return{label:e.auth.kind==="api_key"||De(e,n,o)?"Needs a key":"Needs sign-in",tone:"warning",detail:ot(e.status_reason),busy:!1};case"error":return{label:"Couldn't start",tone:"danger",detail:ot(e.status_reason)??"No reason was given.",busy:!1};default:if(u)return{label:"Signed out",tone:"warning",detail:null,busy:!1};if(m)return{label:"Sign-out didn't finish",tone:"warning",detail:"The sign-in is still saved.",busy:!1};if(De(e,n,o))return{label:"Needs a key",tone:"warning",detail:null,busy:!1};if(y)return{label:"Sign-in didn't finish",tone:"warning",detail:null,busy:!1};if(o.needsSignIn)return{label:e.auth.kind==="api_key"||De(e,n,o)?"Needs a key":"Needs sign-in",tone:"warning",detail:ot(e.status_reason),busy:!1};if(e.status_basis==="stored"&&c&&o.disconnectedAt===null){const j=o.connectedAt??jn(e.last_seen_at,a);return{label:j!==null?`Worked ${gi(a,j)} · ${Ye(e.tool_count)}`:`Worked earlier · ${Ye(e.tool_count)}`,tone:"success",detail:null,busy:!1}}return e.status_basis==="live"?{label:"Not connected",tone:"neutral",detail:null,busy:!1}:{label:"Ready",tone:"neutral",detail:null,busy:!1}}}const wn=e=>e===1?"Replace the saved key":"Replace saved keys",xi=/[,;]?\s*(?:or|and)?\s*add (?:its|a|the) key instead\.?\s*$/i;function ki(e,n){const s=e?.trim()??"";if(!s)return null;if(n)return s;const a=s.replace(xi,"").trim();return a?/\.$/.test(a)?a:`${a}.`:s}const vi="Nothing is wrong. It starts when a chat uses it.",bi="Not running in this chat.",ji=e=>e.transport==="local_command"?"Local command":"Remote URL";function _n(e){switch(e.source.kind){case"local-operator":case"project-mcp-json":return null;case"claude-code":return"Claude Code";case"cursor":return"Cursor";case"vscode":return"VS Code";case"codex":return"Codex CLI";default:return vn(e.source.path)}}function wi(e,n){const s=[ji(e)];e.status!=="connected"&&e.tool_count_basis==="last_seen"&&typeof e.tool_count=="number"&&s.push(`${Ye(e.tool_count)} when last checked`),n&&s.push(e.scope==="project"?"This project":"Global");const a=_n(e);return a?s.push(`Imported from ${a}`):e.source.editable||s.push("Imported from a project file"),s}const _t=(e,n)=>n.disconnectedAt!==null?"not_started":e.status;function Nt(e,n=[],s){const a=Me(s,e.name),o=Te(e.name,n);if(o)return o.action==="login"||o.action==="reauth"?{kind:"sign_in",label:"Continue sign-in"}:null;const r=y=>e.actions.includes(y),l=Je(e),u=De(e,n,a);if(!bn(e.status))return r("test")?{kind:"test",label:"Check again"}:null;const c=Pe(e.name,n,a),m=c?.status==="failed"&&ze(c);switch(_t(e,a)){case"connected":case"connecting":return null;case"needs_sign_in":return u?{kind:"set_key",label:"Add key"}:r("sign_in")?{kind:"sign_in",label:"Sign in"}:l?{kind:"set_key",label:"Add key"}:r("reauth")?{kind:"reauth",label:"Sign in again"}:{kind:"fix",label:"Fix"};case"error":return r("connect")?{kind:"connect",label:"Reconnect"}:r("test")?{kind:"test",label:"Retry"}:{kind:"fix",label:"Fix"};default:{if(Xe(c)&&r("sign_in"))return{kind:"sign_in",label:"Sign in"};if(St(c)&&r("sign_out"))return{kind:"sign_out",label:"Sign out again"};if(a.disconnectedAt!==null&&r("connect"))return{kind:"connect",label:"Connect"};if(a.needsSignIn){if(u&&l)return{kind:"set_key",label:"Add key"};if(r("sign_in"))return{kind:"sign_in",label:"Sign in"}}return u&&l?{kind:"set_key",label:"Add key"}:m&&r("sign_in")?{kind:"sign_in",label:"Try again"}:wt(e,a)&&!r("connect")?null:r("connect")?{kind:"connect",label:"Connect",...a.connectedAt===null&&e.status_basis!=="live"?{variant:"ghost"}:{}}:r("test")&&e.tool_count===null&&e.tool_count_basis===null?{kind:"test",label:"Test",variant:"ghost"}:null}}}const ze=e=>e.action==="login"||e.action==="reauth",Xe=e=>!!(e&&e.action==="logout"&&e.status==="complete"),St=e=>!!(e&&e.action==="logout"&&e.status!=="running"&&e.status!=="complete"),Nn=/no oauth authorization server/i;function De(e,n,s){if(!Je(e))return!1;const a=Pe(e.name,n,s);return a&&ze(a)&&a.status==="failed"&&Nn.test(a.message??"")?!0:s.needsKey}function _i(e,n=[],s){const a=Nt(e,n,s)?.kind,o=_t(e,Me(s,e.name)),r=c=>e.actions.includes(c),l=[],u=Te(e.name,n);if(u&&l.push({kind:"cancel",label:"Cancel"}),!u&&r("test")&&a!=="test"&&l.push({kind:"test",label:"Test connection"}),r("connect")&&a!=="connect"&&o!=="connected"&&l.push({kind:"connect",label:"Reconnect"}),!u&&r("sign_in")&&a!=="sign_in"&&o!=="connected"&&l.push({kind:"sign_in",label:"Sign in"}),r("reload")&&l.push({kind:"reload",label:"Reload"}),!u&&r("reauth")&&a!=="reauth"&&l.push({kind:"reauth",label:"Sign in again"}),Je(e)&&a!=="set_key"&&l.push({kind:"set_key",label:e.auth.secret_refs.length>0?"Update key":"Add key"}),r("sign_out")&&l.push({kind:"sign_out",label:"Sign out"}),r("disconnect")&&o==="connected"&&l.push({kind:"disconnect",label:"Disconnect"}),r("copy_setup")&&e.setup_prompt&&l.push({kind:"copy_setup",label:"Copy setup prompt"}),a!=="fix"&&l.push({kind:"open_config",label:"Open config file"}),r("remove"))l.push({kind:"remove",label:"Remove",destructive:!0});else if(!e.source.editable){const c=_n(e);l.push({kind:"remove_elsewhere",label:c?`Remove in ${c}`:"Remove in its own file",hint:c?`Defined in ${c}'s config. Remove it there.`:"Defined in a file this app doesn't write. Remove it there."})}return l}const Ni={attention:"Needs attention",connected:"Connected",ready:"Available"};function Sn(e,n=[],s){const a=Me(s,e.name),o=Te(e.name,n),r=_t(e,a);if(o&&a.pinnedGroup&&a.pinnedOperationId===o.id)return a.pinnedGroup;if(r==="needs_sign_in"||r==="error")return"attention";const l=Pe(e.name,n,a);return Xe(l)&&r!=="connected"||St(l)&&r!=="connected"?"attention":a.disconnectedAt!==null?"ready":De(e,n,a)||a.needsSignIn&&r!=="connected"||l?.status==="failed"&&ze(l)&&r!=="connected"?"attention":r==="connected"||e.status_basis==="stored"&&wt(e,a)?"connected":o&&o.action!=="test"?"attention":"ready"}function Si(e,n=[],s){return["attention","connected","ready"].map(o=>({id:o,title:Ni[o],rows:e.filter(r=>Sn(r,n,s)===o)})).filter(o=>o.rows.length>0)}function Ci(e,n,s=Date.now()){if(!n)return e??{};const a={};for(const o of n.servers){const r=Me(e,o.name),l=Te(o.name,n.operations),u=Pe(o.name,n.operations,r),c=Xe(u),m=o.status==="connected"&&(o.status_basis==="probe"||o.status_basis==="live"),y=r.holdUntil!==null&&s<r.holdUntil,j=!y&&!c&&r.connectedAt===null&&o.status_basis==="stored"&&o.tool_count_basis==="last_seen"?jn(o.last_seen_at,s):null,b=!c,h=u?.status==="failed"&&ze(u)&&Nn.test(u.message??""),f={connectedAt:m&&!y?s:j!==null?j:b?r.connectedAt:null,connectedToolCount:m&&!y||j!==null?o.tool_count??r.connectedToolCount:b?r.connectedToolCount:null,settledGroup:r.settledGroup,pinnedGroup:l&&r.pinnedOperationId===l.id?r.pinnedGroup:l?r.settledGroup:null,pinnedOperationId:l?l.id:null,needsKey:m?!1:r.needsKey||h,needsSignIn:m||c?!1:r.needsSignIn||o.status==="needs_sign_in",disconnectedAt:m&&!y?null:r.disconnectedAt,holdUntil:y?r.holdUntil:null,lastDecisive:u?hi(u):null};l||(f.settledGroup=Sn(o,n.operations,{...a,[o.name]:f})),a[o.name]=f}return a}const Mi=(e,n)=>e!==null&&n===e,yt="local-operator.settings.integrations.row-memory",Cn=(e,n)=>`${e}#${n}`;function Ai(e,n){const s={};if(!n)return s;for(const a of n.servers){const o=e[a.name];o&&(s[Cn(a.source.path,a.name)]=o)}return s}function Ri(e,n,s){if(!n)return e;let a=null;for(const o of n.servers){if(Object.prototype.hasOwnProperty.call(e,o.name))continue;const r=Ii(s[Cn(o.source.path,o.name)]);r&&(a=a??{...e},a[o.name]=r)}return a??e}const Ti=["attention","connected","ready"],Mn=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Ct=e=>typeof e=="number"&&Number.isFinite(e)?e:null,Bt=e=>Ti.includes(e)?e:null,rt=e=>{const n=Ct(e);return n!==null&&n>=1e12?n:null};function Ei(e){if(!Mn(e)||typeof e.id!="string"||typeof e.name!="string")return null;const n=e.action,s=e.status;return n!=="login"&&n!=="logout"&&n!=="reauth"&&n!=="test"||s!=="running"&&s!=="complete"&&s!=="cancelled"&&s!=="failed"?null:{id:e.id,name:e.name,action:n,status:s,created_at:Ct(e.created_at)??0,credential_removed:e.credential_removed===!0,...typeof e.message=="string"?{message:e.message}:{}}}function Ii(e){if(!Mn(e))return null;const n=rt(e.connectedAt),s=rt(e.disconnectedAt),a=e.needsKey===!0,o=e.needsSignIn===!0,r=Ei(e.lastDecisive);return n===null&&s===null&&!a&&!o&&!r?null:{connectedAt:n,connectedToolCount:Ct(e.connectedToolCount),settledGroup:Bt(e.settledGroup),pinnedGroup:Bt(e.pinnedGroup),pinnedOperationId:typeof e.pinnedOperationId=="string"?e.pinnedOperationId:null,needsKey:a,needsSignIn:o,disconnectedAt:s,holdUntil:rt(e.holdUntil),lastDecisive:r}}const An=2e3,Ht=8e3;function Li(e){return e&&(e.servers.some(s=>s.status==="connecting")||e.operations.some(s=>s.status==="running"))?An:!1}const Oi=/^[A-Za-z0-9_.:-]{1,100}$/,Fi=/:\/\//;function Di(e,n){const s=e.trim();return s?Oi.test(s)?n.includes(s)?`An integration named ${s} already exists.`:null:"Use letters, numbers, dots, dashes, underscores or colons, with no spaces.":"Give it a name."}function $i(e){const n=e.trim();if(!n)return"Enter the server's URL.";let s;try{s=new URL(n)}catch{return"Enter a full URL, like https://mcp.example.com/mcp."}return s.protocol!=="https:"&&s.protocol!=="http:"?"The URL must start with https:// or http://.":s.hostname?s.username||s.password?"Remove the username or password from the URL. Keys are added after it's saved.":s.search||s.hash?"Remove the ? or # part of the URL. Keys are added after it's saved.":Fi.test(n.slice(s.protocol.length+2))?"This looks like two URLs pasted together. Enter just one.":null:"The URL needs a host name."}const Ui=e=>e.split(`
292
- `).map(n=>n.trim()).filter(Boolean);function xt(e,n){const s=!!e?.cold,a=(e?.servers??[]).map(o=>{const r=o.transport==="http",l=o.secret_refs??[],u=o.status==="connected"?"connected":o.status==="connecting"?"connecting":o.status==="auth-required"?"needs_sign_in":"not_started",c=[];u!=="connected"&&c.push("connect"),u==="connected"&&c.push("disconnect"),s||c.push("reload"),r&&o.transport_oauth_supported!==!1&&c.push("sign_in"),l.length>0&&c.push("set_key"),o.owned_scope&&c.push("remove"),o.setup?.text&&c.push("copy_setup");const m=vn(o.source);return{id:o.name,name:o.name,scope:o.owned_scope??"global",project_cwd:null,source:{kind:Pi(o.source,m,o.owned_scope),path:o.source??"",editable:o.owned_scope!==null,owned_scope:o.owned_scope},transport:r?"remote_url":"local_command",endpoint:{command:null,url:null,endpoint_redacted:!1},status:u,status_reason:null,status_observed_at:null,last_seen_at:null,status_basis:s?"stored":"live",auth:{kind:l.length?"api_key":r?"unknown":"none",signed_in:null,secret_refs:l.map(y=>({id:y.id,state:"missing"}))},tool_count:typeof o.tool_count=="number"?o.tool_count:null,tool_count_basis:typeof o.tool_count=="number"?"live":null,actions:c,setup_prompt:o.setup?.text??null}});return{cwd:"",project_scope_available:a.some(o=>o.source.owned_scope==="project"),global_path:"",project_path:null,status_source:s?"config":"live",session_id:n,servers:a,operations:(e?.operations??[]).map(o=>({...o}))}}const Pi=(e,n,s)=>n==="Claude Code"?"claude-code":n==="Cursor"?"cursor":n==="VS Code"?"vscode":n==="Codex CLI"?"codex":s?"local-operator":e?"project-mcp-json":"local-operator",Vt={invalid_config:"That configuration isn't valid. Check the command or the URL, then try again.",operation_unavailable:"That sign-in or test isn't running any more. Try again.",exists:"An integration with this name already exists. Choose another name.",not_owned:"It's defined in another tool's config, so it can't be changed here. Edit it in that file.",project_scope_unavailable:"There's no separate project config here, so it can only be added globally.",unknown_server:"It no longer exists. The list has been refreshed.",oauth_unsupported:"It doesn't use browser sign-in.",grant_running:"A sign-in or test is already running. Wait for it to finish, or cancel it.",too_many_operations:"Too many sign-ins and tests are waiting. Try again in a moment.",write_failed:"The config file couldn't be written. Check that it isn't read-only.",mcp_starting:"Integrations are still starting. Try again in a moment.",mcp_control_refused:"The server refused it, so nothing was changed."},zi="The server refused it, so nothing was changed. Try again.";function Ve(e,n,s){if(n instanceof jt&&n.status===409){const a=typeof n.code=="string"&&Object.prototype.hasOwnProperty.call(Vt,n.code)?Vt[n.code]:zi;return`${es[e]}. ${a}`}return ts(e,n,s).message}const Ki="New chats can use it right away. Open chats pick it up when you start a new chat or reload integrations there.",Bi="Most services give you a URL. Use Local command when their setup says npx or uvx.",Hi=({existingNames:e,projectScopeAvailable:n,projectLabel:s,onSubmit:a,onCancel:o,initial:r})=>{const[l,u]=i.useState(r?.name??""),[c,m]=i.useState(r?.mode??"command"),[y,j]=i.useState(r?.command??""),[b,h]=i.useState(r?.args??""),[f,M]=i.useState(r?.url??""),[S,V]=i.useState("global"),[_,B]=i.useState(r?.touched?{name:!0,command:!0,url:!0}:{}),[U,A]=i.useState(!!r?.touched),[C,W]=i.useState(!1),[q,Q]=i.useState(null),T=i.useRef(null),ee=i.useRef(null),L=i.useRef(null);i.useEffect(()=>{T.current?.focus()},[]);const D=Di(l,e),O=c==="command"&&!y.trim()?"Enter the command to run.":null,z=c==="url"?$i(f):null,K=k=>U||_[k],se=async k=>{if(k.preventDefault(),A(!0),D||O||z){D?T.current?.focus():O?ee.current?.focus():L.current?.focus();return}W(!0),Q(null);const H=n?S:"global",G=c==="command"?{name:l.trim(),scope:H,mode:c,command:y.trim(),args:Ui(b)}:{name:l.trim(),scope:H,mode:c,url:f.trim()},J=await a(G);W(!1),Q(J)},p=(k,H,G)=>H&&K(G)?t.jsx("p",{id:k,className:"text-body-sm text-danger",children:H}):null,I=k=>k.preventDefault();return t.jsxs("form",{noValidate:!0,"aria-label":"Add integration",className:"flex flex-col gap-4 rounded-lg bg-surface p-4",onSubmit:k=>void se(k),onKeyDown:k=>{k.key==="Escape"&&(k.stopPropagation(),o())},children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(pe,{htmlFor:"integration-add-name",children:"Name"}),t.jsx(Ce,{ref:T,id:"integration-add-name",value:l,placeholder:"e.g. notion",autoComplete:"off","aria-invalid":!!(D&&K("name")),"aria-describedby":D&&K("name")?"integration-add-name-error":void 0,onChange:k=>u(k.target.value),onBlur:()=>B(k=>({...k,name:!0}))}),p("integration-add-name-error",D,"name")]}),t.jsxs(pt,{value:c,onValueChange:k=>m(k==="url"?"url":"command"),className:"flex flex-col gap-1.5",children:[t.jsx("span",{id:"integration-add-transport-label",className:"font-medium text-body-sm text-ink",children:"How it runs"}),t.jsxs(gt,{"aria-labelledby":"integration-add-transport-label",children:[t.jsx(Fe,{value:"command","data-integration-transport":"command",children:"Local command"}),t.jsx(Fe,{value:"url","data-integration-transport":"url",children:"Remote URL"})]}),t.jsx("p",{className:"text-ink-dim text-meta",children:Bi}),t.jsxs($t,{value:"command",className:"mt-0 flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(pe,{htmlFor:"integration-add-command",children:"Command"}),t.jsx(Ce,{ref:ee,id:"integration-add-command",value:y,placeholder:"e.g. npx",autoComplete:"off",className:"font-mono","aria-invalid":!!(O&&K("command")),"aria-describedby":O&&K("command")?"integration-add-command-error":void 0,onChange:k=>j(k.target.value),onBlur:()=>B(k=>({...k,command:!0}))}),p("integration-add-command-error",O,"command")]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs(pe,{htmlFor:"integration-add-args",children:["Arguments"," ",t.jsx("span",{className:"font-normal text-ink-dim",children:"(one per line)"})]}),t.jsx(yn,{id:"integration-add-args",value:b,rows:2,className:"font-mono",onChange:k=>h(k.target.value)})]})]}),t.jsx($t,{value:"url",className:"mt-0 flex flex-col gap-4",children:t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(pe,{htmlFor:"integration-add-url",children:"URL"}),t.jsx(Ce,{ref:L,id:"integration-add-url",type:"url",value:f,placeholder:"https://mcp.example.com/mcp",autoComplete:"off",className:"font-mono","aria-invalid":!!(z&&K("url")),"aria-describedby":z&&K("url")?"integration-add-url-error":"integration-add-url-help",onChange:k=>M(k.target.value),onBlur:()=>B(k=>({...k,url:!0}))}),p("integration-add-url-error",z,"url")??t.jsx("p",{id:"integration-add-url-help",className:"text-ink-dim text-meta",children:"If it needs a sign-in or a key, you'll be asked after it's added."})]})})]}),n?t.jsxs(pt,{value:S,onValueChange:k=>V(k==="project"?"project":"global"),className:"flex flex-col gap-1.5",children:[t.jsx("span",{id:"integration-add-scope-label",className:"font-medium text-body-sm text-ink",children:"Available in"}),t.jsxs(gt,{"aria-labelledby":"integration-add-scope-label",children:[t.jsx(Fe,{value:"global","data-integration-scope":"global",children:"All chats"}),t.jsx(Fe,{value:"project","data-integration-scope":"project",children:"This project"})]}),s?t.jsx("p",{className:"text-ink-dim text-meta",children:S==="project"?`Only chats working in ${s}.`:"Every chat, in any folder."}):null]}):null,q?t.jsx("p",{className:"text-body-sm text-danger",role:"alert",children:q}):null,t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx("p",{className:re("text-body-sm text-ink-dim"),children:Ki}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx($,{type:"button",variant:"ghost",size:"md",onMouseDown:I,onClick:o,children:"Cancel"}),t.jsxs($,{type:"submit",variant:"primary",size:"md",disabled:C,onMouseDown:I,children:[C?t.jsx(ie,{size:"xs"}):null,"Add integration"]})]})]})]})},Vi=4;function Gi(e){return e.rowMoving?e.now+e.windowMs:Math.max(e.hold.until,e.lastMovingAt+e.windowMs)}function qi(e){return e.now>e.hold.until||e.hold.reanchors>=Vi?"drop":e.hold.landedOn.isConnected&&(!e.candidate||e.candidate===e.hold.landedOn)?"settled":e.active&&e.active!==e.body&&e.active!==e.hold.landedOn?"drop":e.candidate?.isConnected?"restore":"drop"}function Yi(e){const n=Gi({hold:e.hold,now:e.now,windowMs:e.windowMs,rowMoving:e.rowMoving,lastMovingAt:e.lastMovingAt});if(e.now>n)return{hold:null,land:null};const s=e.hold.landedOn??null,a=e.candidate;if(!a)return{hold:{until:n,reanchors:e.hold.reanchors,landedOn:s},land:null};if(!s)return{hold:{until:n,reanchors:e.hold.reanchors,landedOn:a},land:a};const o=qi({hold:{until:n,reanchors:e.hold.reanchors,landedOn:s},candidate:a,active:e.active,body:e.body,now:e.now});if(o==="settled")return{hold:{until:n,reanchors:e.hold.reanchors,landedOn:s},land:null};if(o==="drop")return{hold:null,land:null};const r=!s.isConnected;return{hold:{until:r?e.now+e.windowMs:n,reanchors:r?e.hold.reanchors+1:e.hold.reanchors,landedOn:a},land:a}}function Wi(e){const{row:n,target:s}=e;return!n||!s||typeof s.nodeType!="number"?!1:!n.contains(s)}const Gt=250;function qt(e){return e?!e.disabled:!1}function Zi(e){return qt(e.primary)?e.primary??null:qt(e.overflow)?e.overflow??null:null}function Qi(e){return e.verdict==="finished"?null:e.watchMs}const Rn="key";function Ji(e){const{name:n,keyless:s,freeName:a,names:o,values:r,replace:l,canReplace:u}=e;if(s){const c=kt(n,a);return{values:{[c]:(r[Rn]??"").trim()},confirmedReplace:l&&u?[c]:[],header:a.trim()}}return{values:Object.fromEntries(o.map(c=>[c,(r[c]??"").trim()])),confirmedReplace:l&&u?o:[],header:void 0}}function kt(e,n){const s=Yt(e),a=Yt(n);if(!a)return"";const o=[s,a].filter(Boolean).join("_"),r=/^[A-Za-z_]/.test(o)?o:`K_${o}`;if(r.length<=it)return r;const l=Xi(s),u=it-a.length-l.length-2,c=[s.slice(0,Math.max(u,0)),l,a].filter(Boolean).join("_");return c.length<=it?c:c.slice(-128)}const it=128,Yt=e=>e.trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,""),Xi=e=>{let n=2166136261;for(let s=0;s<e.length;s+=1)n^=e.charCodeAt(s),n=Math.imul(n,16777619)>>>0;return n.toString(36).toUpperCase().slice(0,5)},ec=({name:e,keyNames:n,keyless:s=!1,savedKeys:a=[],saving:o,failure:r,onSave:l,onClose:u})=>{const[c,m]=i.useState({}),[y,j]=i.useState(!1),[b,h]=i.useState(""),f=s?[kt(e,b)]:[...n],M=s?[Rn]:f,S=(s?kt(e,b).length>0:!0)&&M.every(_=>(c[_]??"").trim()),V=f.some(_=>a.includes(_));return t.jsx(rn,{open:!0,onClose:u,maxWidth:"xs",title:s||n.length===1?`Add the key for ${e}`:`Add keys for ${e}`,actions:t.jsxs(t.Fragment,{children:[t.jsx(dt,{onClick:u,children:"Cancel"}),t.jsx(ut,{disabled:!S||o,onClick:()=>{const _=Ji({name:e,keyless:s,freeName:b,names:f,values:c,replace:y,canReplace:V});l(_.values,_.confirmedReplace,_.header)},children:o?"Saving…":"Save and test"})]}),children:t.jsxs("div",{className:"flex flex-col gap-3 p-1.5 text-body text-ink-muted",children:[t.jsx("p",{className:"-mx-1.5",children:s?"Keys are saved encrypted on this computer. This one is stored under a name derived from this integration, so no other server shares it.":"Keys are saved encrypted on this computer. Other integrations that use the same key name share it."}),s?t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(pe,{htmlFor:"integration-key-name",children:"The header this server wants the key in"}),t.jsx(Ce,{id:"integration-key-name",autoComplete:"off",placeholder:"e.g. Authorization or X-Api-Key",value:b,onChange:_=>h(_.target.value)}),t.jsx("p",{className:"-mx-1.5 text-ink-dim text-meta",children:"This server declares no key of its own, so Local Operator adds one to its config for you."})]}):null,M.filter(_=>s!==!0||_.trim().length>0).map(_=>t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(pe,{htmlFor:`integration-key-${_}`,className:"font-mono",children:s?"Key":_}),t.jsx(Ce,{id:`integration-key-${_}`,type:"password",autoComplete:"off",value:c[_]??"",onChange:B=>m(U=>({...U,[_]:B.target.value}))})]},_)),V?t.jsxs("div",{className:"flex items-center gap-2 text-body-sm",children:[t.jsx(ya,{id:"integration-key-replace",checked:y,onCheckedChange:_=>j(_===!0)}),t.jsx(pe,{htmlFor:"integration-key-replace",className:"font-normal",children:wn(f.length)})]}):null,r?t.jsx("p",{className:"-mx-1.5 text-body-sm text-danger",role:"alert",children:r}):null]})})},tc={success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info",neutral:"bg-ink-dim"},nc={success:"text-ink-muted",warning:"text-warning",danger:"text-danger",info:"text-ink-muted",neutral:"text-ink-dim"},Wt={Ready:vi,"Not connected":bi},sc=({row:e,operations:n,memories:s,now:a,projectScopeAvailable:o,highlighted:r=!1,rowRef:l,primaryRef:u,overflowRef:c,pending:m,failure:y,confirm:j,onPrimary:b,onOverflow:h,onConfirm:f,onCancelConfirm:M})=>{const S=yi(e,n,s,a),V=r&&S.tone==="danger"?"text-ink":nc[S.tone],_=Nt(e,n,s),B=_i(e,n,s),U=wi(e,o),A=B.findIndex(C=>C.kind==="remove"||C.kind==="remove_elsewhere");return t.jsxs("li",{ref:l,"data-integration":e.name,"data-status":e.status,className:re("flex min-h-14 flex-col justify-center gap-1 px-4 py-2.5",r&&"bg-row-selected"),onKeyDown:C=>{!j||C.key!=="Escape"||(C.stopPropagation(),M())},children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center",children:S.busy?t.jsx(ie,{size:"xs"}):t.jsx("span",{"aria-hidden":"true","data-tone":S.tone,className:re("size-2 rounded-full",tc[S.tone])})}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[t.jsx("span",{className:"truncate font-medium text-body text-ink",title:e.name,children:e.name}),t.jsx("span",{className:"truncate text-ink-dim text-meta",children:U.map((C,W)=>t.jsxs("span",{children:[W>0?" · ":null,C.startsWith("Imported from")&&e.source.path?t.jsx($e,{content:ns(e.source.path),children:t.jsx("span",{className:"underline decoration-dotted underline-offset-2",children:C})}):C]},C))})]}),Wt[S.label]?t.jsx($e,{content:Wt[S.label],children:t.jsx("span",{className:re("shrink-0 text-body-sm",V),children:S.label})}):t.jsx("span",{className:re("shrink-0 text-body-sm",V),children:S.label}),_?t.jsxs($,{ref:u,variant:_.variant??"secondary",size:"sm","aria-label":`${_.label} ${e.name}`,disabled:m,"data-integration-action":_.kind,onClick:()=>b(_),children:[m?t.jsx(ie,{size:"xs"}):null,_.label]}):null,t.jsxs(xa,{children:[t.jsx(ka,{asChild:!0,children:t.jsx($,{ref:c,variant:"ghost",size:"icon-sm","aria-label":`More actions for ${e.name}`,disabled:m,children:t.jsx(ss,{"aria-hidden":"true"})})}),t.jsx(va,{align:"end",className:"min-w-48",children:B.map((C,W)=>t.jsx(ac,{item:C,separated:W===A&&W>0,onSelect:()=>h(C)},C.kind))})]})]}),S.detail?t.jsx("p",{className:re("pl-7 text-body-sm",S.tone==="danger"?"text-ink-muted":"text-ink-dim"),children:S.detail}):null,y?t.jsx("p",{className:re("pl-7 text-body-sm",r?"text-ink":"text-danger"),role:"alert",children:y}):null,j?t.jsxs("div",{className:"flex flex-wrap items-center gap-2 pl-7",children:[t.jsx("span",{className:"text-body-sm text-ink",children:j.kind==="remove"?`Remove ${e.name}?`:`Sign out of ${e.name}?`}),t.jsx("span",{className:"text-body-sm text-ink-muted",children:j.kind==="remove"?`Agents in every chat lose access to ${e.name}.`:e.auth.kind==="oauth"?"The saved sign-in is removed too.":"Its saved credential is removed too."}),t.jsx($,{variant:"danger",size:"sm",onClick:f,"data-integration-confirm":j.kind,children:j.kind==="remove"?"Remove":"Sign out"}),t.jsx($,{variant:"ghost",size:"sm",onClick:M,children:"Keep"})]}):null]})},ac=({item:e,separated:n,onSelect:s})=>t.jsxs(t.Fragment,{children:[n?t.jsx(ba,{}):null,e.kind==="remove_elsewhere"?t.jsxs(Ut,{disabled:!0,className:"flex-col items-start gap-0.5",children:[t.jsx("span",{children:e.label}),t.jsx("span",{className:"text-meta text-ink-dim",children:e.hint})]}):t.jsx(Ut,{destructive:e.kind==="remove",onSelect:s,"data-integration-menu":e.kind,children:e.label})]});function oc(e,n,s){return!n||n.status==="running"?n?.browser_opened===!0?{message:`Your browser opened. Approve access to ${e} there, then come back here.`,tone:"progress",link:n.authorization_url??null}:n?.browser_opened===!1?{message:n.authorization_url?"Your browser didn't open. Open this link to approve access:":"Your browser didn't open, and no link was provided. Cancel and try again.",tone:"progress",link:n.authorization_url??null}:{message:`Waiting for you to approve access to ${e}…`,tone:"progress",link:n?.authorization_url??null}:n.status==="complete"?{message:`Signed in to ${e}. Agents can use it now.`,tone:"success",link:null}:n.status==="cancelled"?{message:"Sign-in cancelled.",tone:"failure",link:null,reason:null,nextStep:"Press Try again when you are ready."}:{message:"Sign-in didn't finish.",tone:"failure",link:null,reason:ki(n.message,s)??"The server didn't say why.",nextStep:rc(n.message??null,s)}}function rc(e,n){const s=(e??"").toLowerCase();return s.includes("redirect")?n?"This server may not accept sign-ins from Local Operator. Check the server's settings, or add a key instead.":"This server may not accept sign-ins from Local Operator. Check the server's settings, then try again.":s.includes("no oauth")||s.includes("authorization server")?n?"This server doesn't publish a browser sign-in. Add its key instead.":"This server doesn't publish a browser sign-in. Check the server's settings, then try again.":s.includes("network")||s.includes("connect")?"Check the server's URL and your network, then try again.":"Check the server's settings, then try again."}function ic(e,n){return e.kind==="ready"?"ready":e.kind==="running"&&n&&n.tone!=="progress"?n.tone==="success"?"success":"failure":"running"}const cc=({name:e,action:n,keyRoute:s,phase:a,onStart:o,onCancel:r,onOpenLink:l,onClose:u})=>{const c=a.kind==="running"?a.operation:null,m=a.kind==="running"?oc(e,c,s):null,y=a.kind==="starting"||a.kind==="running"&&m?.tone==="progress",j=m&&m.tone!=="progress",b=i.useRef(null),h=i.useRef(!1),f=ic(a,m);i.useEffect(()=>{if(!h.current){h.current=!0;return}f&&b.current?.focus()},[f]);const M=()=>u(m?.tone==="success"?"signed-in":"dismissed");return t.jsx(rn,{open:!0,onClose:M,maxWidth:"xs",fullWidth:!0,title:`Sign in to ${e}`,dialogProps:{onOpenAutoFocus:S=>{S.preventDefault(),b.current?.focus()}},actions:t.jsxs(t.Fragment,{children:[y&&c?t.jsx(dt,{ref:b,onClick:()=>r(c.id),children:"Cancel sign-in"}):t.jsx(dt,{ref:a.kind==="ready"?void 0:b,onClick:M,children:m?.tone==="success"?"Done":"Close"}),a.kind==="ready"?t.jsx(ut,{ref:b,onClick:o,children:"Continue in browser"}):null,a.kind==="refused"||m?.tone==="failure"?t.jsx(ut,{ref:m?.tone==="failure"?b:void 0,onClick:o,children:"Try again"}):null]}),children:t.jsxs("div",{className:"flex flex-col gap-3 p-1.5 text-body text-ink-muted","aria-live":"polite",children:[a.kind==="ready"?t.jsxs("p",{className:"-mx-1.5",children:["Local Operator opens your browser so you can approve access to"," ",e,".",n==="reauth"?" This replaces the sign-in it has now.":""]}):null,a.kind==="starting"?t.jsxs("p",{className:"-mx-1.5 flex items-center gap-2",children:[t.jsx(ie,{size:"xs"}),"Starting sign-in…"]}):null,m?t.jsxs("div",{className:"flex flex-col gap-1",role:j?"status":void 0,children:[t.jsxs("p",{className:(m.tone==="success","-mx-1.5 flex items-start gap-2 text-ink"),children:[m.tone==="progress"?t.jsx(ie,{size:"xs",className:"mt-0.5"}):null,m.tone==="failure"?t.jsx(ja,{"aria-hidden":"true",className:"mt-0.5 size-4 shrink-0 text-danger"}):null,t.jsx("span",{children:m.message})]}),m.reason?t.jsx("p",{className:"-mx-1.5 text-ink-muted",children:m.reason}):null,m.nextStep?t.jsx("p",{className:"-mx-1.5 text-ink-muted",children:m.nextStep}):null]}):null,m?.link&&m.tone==="progress"?t.jsxs("div",{className:"flex flex-col items-start gap-1",children:[t.jsxs("div",{className:"flex w-full min-w-0 items-center gap-1",children:[t.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-ink-dim text-mono-sm",title:m.link,children:m.link}),t.jsx($,{variant:"ghost",size:"icon-sm","aria-label":"Copy the sign-in link",title:"Copy the sign-in link",onClick:()=>{navigator.clipboard.writeText(m.link??"").then(()=>mt("Sign-in link copied.")).catch(()=>{})},children:t.jsx(as,{"aria-hidden":"true"})})]}),t.jsx($,{variant:"link",size:"sm",onClick:()=>l(m.link??""),children:"Open the sign-in page"})]}):null,a.kind==="refused"?t.jsx("p",{className:"text-danger",role:"alert",children:a.message}):null]})})},lc=e=>e.reduce((n,s)=>n?(s.updated_at??0)>(n.updated_at??0)?s:n:s,null),dc=/^[A-Za-z]:[\\/]/,We=e=>{const n=e?.trim();return n&&(n.startsWith("/")||dc.test(n))?n:null};function uc(e){const o=e?.payload?.frontend?.snapshot?.cwd;return typeof o=="string"&&o.trim()?o:null}const Ue="local-operator.settings.integrations.last-cwd";function mc(e,n,s=typeof localStorage>"u"?null:localStorage){const a=We(n);if(!(!e||!a||!s))try{const o=s.getItem(Ue),r=o?JSON.parse(o):{};if(r[e]===a)return;s.setItem(Ue,JSON.stringify({...r,[e]:a}))}catch{}}const Tn=()=>typeof localStorage>"u"?null:localStorage;function En(e=Tn()){if(!e)return{};try{const n=e.getItem(yt);if(!n)return{};const s=JSON.parse(n);return!s||typeof s!="object"||Array.isArray(s)?{}:s}catch{return{}}}const Zt=256;function hc(e,n=Tn()){if(n)try{const s={...En(n),...e},a=Object.keys(s);if(a.length>Zt){const o={};for(const r of a.slice(-Zt))o[r]=s[r];n.setItem(yt,JSON.stringify(o));return}n.setItem(yt,JSON.stringify(s))}catch{}}function Qt(e,n,s){return e==="saved"?null:e==="replace_confirmation_required"?`A saved value already exists for this key. Tick “${wn(Object.keys(s).length)}” to overwrite it.`:e==="invalid_target"?"That header can't carry this key. It may already be set on the server, or belong to the transport - try a different header name. Nothing was saved.":`Not saved: ${(n.length?n:Object.keys(s)).join(", ")}. The encrypted store may be locked.`}function fc(e,n=typeof localStorage>"u"?null:localStorage){if(!(!e||!n))try{const s=n.getItem(Ue);if(!s)return;const a=JSON.parse(s);if(!(e in a))return;const o={...a};delete o[e],n.setItem(Ue,JSON.stringify(o))}catch{}}const pc=e=>!!(e&&typeof e=="object"&&"code"in e&&e.code==="invalid_cwd"),gc=(e,n)=>n!==null&&e===n?null:e;function yc(e,n=typeof localStorage>"u"?null:localStorage){if(!e||!n)return null;try{const s=n.getItem(Ue);if(!s)return null;const o=JSON.parse(s)[e];return typeof o=="string"?o:null}catch{return null}}const xc=e=>e.action==="disconnect"?"disconnected":"connected";function kc(e){switch(e.action){case"cancel":return{action:"cancel",operation_id:e.operationId};case"connect":case"disconnect":case"reload":return null;case"test":return{action:"test",name:e.name};default:return{...e,confirmed:!0}}}function vc(e){switch(e.action){case"cancel":return{action:"cancel",operation_id:e.operationId};case"test":case"connect":return{action:"connect",name:e.name};case"reload":return{action:"reload",name:e.name};case"add":return e;case"remove":return{...e,confirmed:!0};default:return{action:e.action,name:e.name,confirmed:!0}}}function bc({sessionId:e}){const n=cn(),s=It(n.data,"mcp_catalog"),a=It(n.data,"mcp"),o=s?"catalog":a?"session":null,[r,l]=i.useState(null),u=sn(),c=Ge(v=>v.sessions),m=Ge(v=>v.fetchSessions),y=Ge(v=>v.loading),j=i.useMemo(()=>c.find(v=>v.session_id===e)??null,[c,e]),b=i.useMemo(()=>o==="session"&&!e?lc(c):null,[o,e,c]),h=o==="session"?e??b?.session_id??null:null;i.useEffect(()=>{o!=="session"||e||c.length>0||m(os)},[o,e,c.length,m]);const f=o==="catalog"?We(j?.cwd):null,M=o==="catalog"&&!!e&&f===null,S=ve({queryKey:["desktop","session-cwd",e??""],queryFn:()=>xe({op:"sessions.get",sessionId:e??""}),enabled:M,staleTime:Number.POSITIVE_INFINITY,retry:!1}),V=M&&!S.isFetched,_=f??We(uc(S.data))??(S.isFetched?We(yc(e)):null),B=gc(_,r),U=o==="catalog"?B:null,A=o==="catalog"?e??null:null,C=rs.catalog(U,A);i.useEffect(()=>{o!=="catalog"||!e||!U||mc(e,U)},[o,e,U]);const W=i.useRef(0),[q,Q]=i.useState(0),T=i.useRef(null),ee=i.useCallback((v,R)=>{const g=Date.now()+Ht;W.current=g,T.current={name:v,expect:R},Q(g)},[]),L=i.useCallback(v=>Date.now()<W.current?An:Li(v),[]),D=ve({queryKey:C,queryFn:()=>ls(U,A),enabled:o==="catalog"&&!V,staleTime:1e4,refetchInterval:v=>L(v.state.data)}),O=pc(D.error);i.useEffect(()=>{!O||!_||r===_||(l(_),fc(e))},[O,_,r,e]);const z=ve({queryKey:ht.list(h??""),queryFn:()=>ds(h??""),enabled:o==="session"&&!!h,staleTime:1e4,refetchInterval:v=>L(v.state.data?xt(v.state.data,h??""):void 0)}),K=i.useMemo(()=>{if(o==="catalog")return D.data;if(o==="session"&&z.data&&h)return xt(z.data,h)},[o,D.data,z.data,h]),se=i.useCallback(()=>jc({queryClient:u,route:o,catalogKey:C,sessionId:h}),[o,C,u,h]);i.useEffect(()=>{if(!q)return;const v=T.current;if(!v)return;const R=K?.servers.find(F=>F.name===v.name);!R||!(v.expect==="connected"?R.status==="connected":R.status_basis==="live"&&R.status!=="connected")||(W.current=0,T.current=null,Q(0))},[K,q]);const p=i.useRef({}),[I,k]=i.useState(0),H=i.useMemo(()=>(p.current=Ci(Ri(p.current,K,En()),K),p.current),[K,I]),G=i.useRef("");i.useEffect(()=>{const v=Ai(H,K);if(!Object.keys(v).length)return;const R=JSON.stringify(v);R!==G.current&&(G.current=R,hc(v))},[H,K]);const J=i.useCallback(v=>{const R=Me(p.current,v);R.needsKey||(p.current={...p.current,[v]:{...R,needsKey:!0}},k(g=>g+1))},[]),X=i.useCallback(v=>{if(v.action!=="disconnect"&&v.action!=="connect"&&v.action!=="reload")return;const R=Me(p.current,v.name),g=Date.now()+Ht,F=v.action==="disconnect"?{...R,connectedAt:null,disconnectedAt:Date.now(),holdUntil:g}:{...R,disconnectedAt:null,holdUntil:g};p.current={...p.current,[v.name]:F},ee(v.name,xc(v)),k(E=>E+1)},[ee]),Z=i.useCallback(async v=>{if(o==="catalog"){const R=kc(v);if(!R)return null;try{const g=await is(U,R);return u.setQueryData(C,g),X(v),g.operation?.id??null}catch(g){throw g instanceof jt&&g.status===409&&u.invalidateQueries({queryKey:C}),g}}if(o==="session"&&h){const R=await xe({op:"mcp.control",sessionId:h,control:vc(v)});X(v);const g=ht.list(h),F=R?.data;return F&&"servers"in F&&Array.isArray(F.servers)?(u.setQueryData(g,F),null):(u.invalidateQueries({queryKey:g}),F&&"id"in F&&typeof F.id=="string"?F.id:null)}return null},[o,U,C,u,h,X]),ge=i.useCallback(async v=>{if(o==="catalog"&&A&&(v.action==="connect"||v.action==="disconnect"||v.action==="reload")){try{await xe({op:"mcp.control",sessionId:A,control:{action:v.action,name:v.name,...v.action==="disconnect"?{confirmed:!0}:{}}})}catch(R){throw u.invalidateQueries({queryKey:C}),R}return X(v),await u.invalidateQueries({queryKey:C}),null}return Z(v)},[o,A,u,C,Z,X]),be=i.useCallback(async(v,R,g,F)=>{if(o==="catalog"){const E=await cs(U,v,R,g,F);if(E.catalog&&u.setQueryData(C,E.catalog),E.code!=="saved")return{saved:!1,message:Qt(E.code,E.failed_ids,R)};try{await Z({action:"test",name:v})}catch{}return{saved:!0,message:null}}if(o==="session"&&h){const E=await xe({op:"mcp.credentials.store",sessionId:h,name:v,values:R,confirmedReplace:g});if(E.data?.code!=="saved")return{saved:!1,message:Qt(E.data?.code,E.data?.failed_ids??[],R)};try{await Z({action:"connect",name:v})}catch{}return{saved:!0,message:null}}return{saved:!1,message:null}},[o,U,C,u,Z,h]),me=o==="catalog"?D:z,Ae=i.useCallback(()=>{me.refetch()},[me]);return{enabled:o!==null,route:o,sessionId:o==="catalog"?A:h,borrowed:b,noConversation:o==="session"&&!h&&!y,document:K,isLoading:n.isLoading||o==="catalog"&&(V||D.isLoading)||o==="session"&&(h?z.isLoading:y),isError:me.isError,folderUnavailable:Mi(r,_),refetch:Ae,readDocument:se,control:ge,storeKeys:be,memories:H,markNeedsKey:J}}function jc(e){if(e.route==="catalog")return e.queryClient.getQueryData(e.catalogKey);if(e.route==="session"&&e.sessionId){const n=e.queryClient.getQueryData(ht.list(e.sessionId));return n?xt(n,e.sessionId):void 0}}const wc=(e,n)=>{const s=e?.trim();if(!s)return null;const a=fs(s,n);return a.kind==="auth"?{kind:"matched",name:a.name,unresolved:null}:{kind:"miss",asked:s}},_c=6,ct="Integrations",Nc="Let agents use your tools and accounts, like Notion, Linear or GitHub.",Sc={test:"test",connect:"reconnect",disconnect:"disconnect",reload:"reload",remove:"remove",sign_out:"disconnect",cancel:"cancel",login:"grant",reauth:"grant"},Cc=({sessionId:e,sectionRef:n,highlightServer:s})=>{const a=bc({sessionId:e}),{document:o,control:r,readDocument:l}=a,u=us(),c=o?.servers??[],m=o?.operations??[],y=o?.project_scope_available??!1,[j,b]=i.useState(!1),[h,f]=i.useState(""),[M,S]=i.useState(null),[V,_]=i.useState({}),[B,U]=i.useState(null),[A,C]=i.useState(null),[W,q]=i.useState({kind:"ready"}),[Q,T]=i.useState(null),[ee,L]=i.useState(null),[D,O]=i.useState(!1),z=i.useRef({}),K=i.useRef({}),se=i.useRef({}),p=i.useRef(0),I=i.useRef(null),k=i.useRef(null),H=i.useRef(null),[G,J]=i.useState(null),[X,Z]=i.useState(null),[ge,be]=i.useState(null),me=i.useCallback(()=>{const d=H.current;H.current=null,C(null),T(null),window.setTimeout(()=>{d?.isConnected&&d.focus()},0)},[]),Ae=i.useCallback(d=>{const x=window.document.activeElement;H.current=x instanceof HTMLElement?x:null,C(d)},[]),v=i.useCallback((d,x)=>{Z({name:d,waitForSignIn:x==="signed-in",until:Date.now()+Oe,reanchors:0}),me()},[me]),R=i.useMemo(()=>wc(s,c.map(d=>d.name)),[s,c]),g=R?.kind==="matched"?R.name:null,F=i.useRef(null),E=i.useRef(null),le=h.trim().toLowerCase(),Y=i.useMemo(()=>le?c.filter(d=>d.name.toLowerCase().includes(le)):c,[c,le]),de=i.useMemo(()=>Si(Y,m,a.memories),[Y,m,a.memories]),ce=A?.kind==="sign_in"?c.find(d=>d.name===A.name)??null:null;i.useEffect(()=>{!g||E.current===g||!h||f("")},[g,h]),i.useEffect(()=>{!g||E.current===g||Y.some(d=>d.name===g)&&(E.current=g,F.current?.scrollIntoView({block:"center",behavior:"smooth"}))},[g,Y]),i.useEffect(()=>{if(!Q)return;const d=m.find(x=>x.id===Q)??null;q({kind:"running",operation:d})},[m,Q]);const je=m.some(d=>d.status==="running"),he=d=>{const x=window.document.activeElement;x&&x!==window.document.body&&x.isConnected||Z({name:d,waitForSignIn:!1,until:Date.now()+Oe,reanchors:0})},ae=async(d,x,N)=>{S(d),_(({[d]:_e,...Ne})=>Ne);let P=null,ue=!1;try{P=await N()}catch(_e){ue=!0,_(Ne=>({...Ne,[d]:Ve(Sc[x]??"status",_e,je)}))}finally{S(null),x!=="sign_out"&&(x!=="remove"||ue)&&he(d)}return{operationId:P,failed:ue}},we=d=>c.find(x=>x.name===d),fe=d=>{d.source.path&&ps(d.source.path)},et=async(d,x)=>{q({kind:"starting"}),T(null);try{const N=await r({action:x,name:d});N?T(N):q({kind:"running",operation:null})}catch(N){N instanceof jt&&N.code==="oauth_unsupported"&&a.markNeedsKey(d),q({kind:"refused",message:Ve("grant",N,je)})}},Ke=(d,x)=>{switch(x.kind){case"sign_in":case"reauth":{const N=m.find(P=>P.name===d.name&&P.status==="running");N&&ze(N)?(q({kind:"running",operation:N}),T(N.id)):(q({kind:"ready"}),T(null)),Ae({kind:"sign_in",name:d.name,action:x.kind==="reauth"?"reauth":"login"});return}case"set_key":L(null),Ae({kind:"key",name:d.name,keyNames:d.auth.secret_refs.map(N=>N.id)});return;case"fix":fe(d);return;case"sign_out":U({name:d.name,kind:"sign_out"});return;default:{const N=x.kind;ae(d.name,N,()=>r({action:N,name:d.name}))}}},tt=(d,x)=>{switch(x.kind){case"remove":case"sign_out":U({name:d.name,kind:x.kind});return;case"sign_in":case"reauth":case"set_key":Ke(d,{kind:x.kind,label:x.label});return;case"open_config":fe(d);return;case"copy_setup":navigator.clipboard.writeText(d.setup_prompt??"").then(()=>mt("Setup steps copied. Paste them into a chat.")).catch(()=>{});return;case"cancel":{const N=m.find(P=>P.name===d.name&&P.status==="running");N&&ae(d.name,"cancel",()=>r({action:"cancel",operationId:N.id}));return}case"test":case"connect":case"disconnect":case"reload":{const N=x.kind;ae(d.name,N,()=>r({action:N,name:d.name}));return}default:return}},nt=(d,x)=>{if(U(null),x==="remove"){const N=d.source.owned_scope;if(!N)return;const P=Y.findIndex(ue=>ue.name===d.name);ae(d.name,"remove",()=>r({action:"remove",name:d.name,scope:N})).then(({operationId:ue,failed:_e})=>{_e||ue!==null||(mt(`Removed ${d.name}.`),P>=0&&be({index:P}))});return}ae(d.name,"sign_out",()=>r({action:"logout",name:d.name})).then(()=>{Z({name:d.name,waitForSignIn:!1,until:Date.now()+Oe,reanchors:0})})},Mt=async d=>{try{return await r({action:"add",name:d.name,scope:d.scope,...d.mode==="command"?{command:d.command,args:d.args}:{url:d.url}}),b(!1),J(d.name),null}catch(x){return Ve("add",x,!1)}},Ee=t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"text-heading text-ink",children:ct}),t.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:Nc})]}),a.enabled&&c.length>0&&!j?t.jsxs($,{ref:I,variant:"secondary",size:"sm",onClick:()=>b(!0),"data-tour-tag":"mcp-add-server",children:[t.jsx(Ot,{"aria-hidden":"true"}),"Add integration"]}):null]});if(!a.enabled&&!a.isLoading)return t.jsx(te,{title:ct,titleComponent:Ee,sectionRef:n,children:t.jsx(ne,{variant:"warning",children:"Integrations need a newer Local Operator backend. Update it and restart the app to manage them here."})});const Ie=t.jsx(Hi,{existingNames:c.map(d=>d.name),projectScopeAvailable:y,projectLabel:o?.cwd?Ac(o.cwd):null,onSubmit:Mt,onCancel:()=>{b(!1),window.setTimeout(()=>I.current?.focus(),0)}}),At=A?we(A.name):void 0,On=Object.entries(V).filter(([d])=>!c.some(x=>x.name===d)),Fn=d=>_(({[d]:x,...N})=>N);i.useEffect(()=>{if(!G)return;const d=z.current[G];if(!d){c.some(x=>x.name===G)&&(K.current[G]?.focus(),J(null));return}d.focus(),J(null)},[G,c]),i.useEffect(()=>{if(!ge)return;const x=Y[Math.min(ge.index,Y.length-1)]??Y.at(-1);if(x){const N=z.current[x.name]??K.current[x.name];if(!N)return;N.focus()}else I.current?.focus();be(null)},[ge,Y]);const st=i.useCallback((d,x)=>{const N=l()??o,P=N?.servers.find(Dn=>Dn.name===d.name),ue=N?.operations??[],_e=P?P.status==="connecting"||Te(P.name,ue)!==null:!1;_e&&P&&(p.current=x);const Ne=P?Nt(P,ue,a.memories):null;if(P&&d.waitForSignIn&&(Ne?.kind==="sign_in"||Ne?.kind==="reauth"))return"kept";const Re=Yi({hold:d,now:x,windowMs:Oe,rowMoving:_e,lastMovingAt:p.current,candidate:P?Zi({primary:Ne?z.current[P.name]:null,overflow:K.current[P.name]}):void 0,active:window.document.activeElement,body:window.document.body});if(!Re.hold)return Z(null),"finished";if(!Re.land)return"kept";Z({name:d.name,waitForSignIn:!1,until:Re.hold.until,landedOn:Re.land,reanchors:Re.hold.reanchors});const Rt=Re.land;return window.setTimeout(()=>{Rt.isConnected&&Rt.focus()},0),"landed"},[l,o,a.memories]);return i.useEffect(()=>{if(!X)return;st(X,Date.now());let d=0,x=!1;const N=()=>{if(x)return;const P=Qi({verdict:st(X,Date.now()),watchMs:Gt});P!==null&&(d=window.setTimeout(N,P))};return d=window.setTimeout(N,Gt),()=>{x=!0,window.clearTimeout(d)}},[X,st]),i.useEffect(()=>{if(!X)return;const d=x=>{Wi({target:x.target,row:se.current[X.name]})&&Z(null)};return window.document.addEventListener("pointerdown",d,!0),()=>{window.document.removeEventListener("pointerdown",d,!0)}},[X]),t.jsxs(te,{title:ct,titleComponent:Ee,sectionRef:n,children:[t.jsxs("div",{className:"flex flex-col gap-4",children:[a.route==="session"&&a.borrowed?t.jsxs("p",{className:"text-body-sm text-ink-muted",children:["Showing the integrations for"," ",a.borrowed.title?.trim()||a.borrowed.session_id.slice(0,6),", your most recent chat."]}):null,a.noConversation?t.jsxs("div",{className:"flex flex-col items-start gap-2",children:[t.jsx("p",{className:"text-body-sm text-ink-muted",children:"Integrations can be managed here once a chat has started."}),t.jsx($,{variant:"primary",size:"sm",onClick:()=>u("/chat"),children:"Start a chat"}),t.jsx("p",{className:"text-ink-dim text-meta",children:"Updating Local Operator removes this step."})]}):null,a.isLoading?t.jsx("div",{className:"flex h-24 items-center justify-center",children:t.jsx(ie,{size:"lg",label:"Loading integrations"})}):null,a.folderUnavailable?t.jsx(ne,{variant:"warning",children:t.jsx("span",{children:"This chat's folder no longer exists, so only global integrations are shown."})}):null,a.isError?t.jsx(ne,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:"Integrations couldn't be loaded."}),t.jsx($,{variant:"secondary",size:"sm",onClick:a.refetch,children:"Retry"})]})}):null,On.map(([d,x])=>t.jsx(ne,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:x}),t.jsx($,{variant:"ghost",size:"sm",onClick:()=>Fn(d),children:"Dismiss"})]})},d)),j&&c.length>0?Ie:null,c.length>=_c?t.jsxs("div",{className:"relative",children:[t.jsx(ms,{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-ink-dim"}),t.jsx(Ce,{ref:k,value:h,onChange:d=>f(d.target.value),onKeyDown:d=>{d.key!=="Escape"||!h||(d.preventDefault(),f(""))},placeholder:`Search ${ii(c.length)}`,"aria-label":"Search integrations",className:"pl-9"})]}):null,R?.kind==="miss"&&c.length>0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:`No integration matches "${R.asked}".`}):null,R?.kind==="matched"&&R.unresolved?t.jsx("p",{className:"text-body-sm text-ink-muted",children:`Showing "${R.name}" — "${R.unresolved}" is not one of your integrations.`}):null,o&&c.length===0&&!a.isLoading?j?Ie:t.jsxs("div",{className:"flex flex-col items-start gap-3 rounded-lg bg-surface p-6",children:[t.jsx(ln,{"aria-hidden":"true",className:"size-5 text-ink-muted"}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("h3",{className:"text-heading text-ink",children:"No integrations yet"}),t.jsx("p",{className:"max-w-xl text-body-sm text-ink-muted",children:"Integrations let agents read and act in your other tools, like Notion or Linear. Add one with a command that runs on this computer, or a server's URL."})]}),t.jsxs($,{variant:"primary",size:"md",onClick:()=>b(!0),"data-tour-tag":"mcp-add-server",children:[t.jsx(Ot,{"aria-hidden":"true"}),"Add integration"]})]}):null,c.length>0&&Y.length===0?t.jsxs("div",{className:"flex flex-col items-start gap-2",children:[t.jsx("p",{className:"text-body-sm text-ink-muted",children:"No integrations match this search."}),t.jsx($,{variant:"secondary",size:"sm",onClick:()=>{f(""),window.setTimeout(()=>{(k.current??I.current)?.focus()},0)},children:"Clear search"})]}):null,de.map(d=>t.jsxs("section",{"aria-labelledby":`integrations-group-${d.id}`,className:"flex flex-col gap-1.5",children:[t.jsxs("h3",{id:`integrations-group-${d.id}`,className:"px-1 text-ink-dim text-meta",children:[d.title," · ",d.rows.length]}),t.jsx("ul",{className:"flex flex-col divide-y divide-hairline overflow-hidden rounded-lg bg-surface",children:d.rows.map(x=>t.jsx(sc,{row:x,operations:m,memories:a.memories,projectScopeAvailable:y,highlighted:x.name===g,rowRef:N=>{se.current[x.name]=N,x.name===g&&(F.current=N)},primaryRef:N=>{z.current[x.name]=N},overflowRef:N=>{K.current[x.name]=N},pending:M===x.name,failure:V[x.name]??null,confirm:B?.name===x.name?{kind:B.kind}:null,onPrimary:N=>Ke(x,N),onOverflow:N=>tt(x,N),onConfirm:()=>B&&nt(x,B.kind),onCancelConfirm:()=>{U(null),window.setTimeout(()=>{K.current[x.name]?.focus()},0)}},x.id))})]},d.id))]}),A?.kind==="sign_in"?t.jsx(cc,{name:A.name,action:A.action,keyRoute:ce?Je(ce):!1,phase:W,onStart:()=>void et(A.name,A.action),onCancel:d=>void r({action:"cancel",operationId:d}).catch(()=>{}),onOpenLink:d=>void hs(d),onClose:d=>v(A.name,d)}):null,A?.kind==="key"?t.jsx(ec,{name:A.name,keyNames:A.keyNames.length?A.keyNames:At?.auth.secret_refs.map(d=>d.id)??[],keyless:A.keyNames.length===0,savedKeys:At?.auth.secret_refs.filter(d=>d.state==="encrypted").map(d=>d.id),saving:D,failure:ee,onClose:me,onSave:(d,x,N)=>{O(!0),L(null),a.storeKeys(A.name,d,x,N).then(P=>{if(!P.saved){L(P.message);return}C(null),Z({name:A.name,waitForSignIn:!1,until:Date.now()+Oe,reanchors:0})}).catch(P=>L(Ve("key",P,!1))).finally(()=>O(!1))}}):null]})},Oe=4e3,Mc=/^\/(?:Users|home)\/[^/]+(?=\/|$)/,Ac=e=>e.replace(Mc,"~"),Rc=({verification:e})=>{const{prices:n}=ys(),s=e.grant_amount??n?.default_new_credits,{sentence:a,action:o}=xs(e.signup_grant,ks(s)),r=vs(e.claim_url,bs);return t.jsxs("div",{className:"mt-8 flex items-start gap-3 rounded-sm border border-hairline bg-surface p-3",children:[t.jsx(Ze,{className:"mt-0.5 size-4 shrink-0 text-ink-muted","aria-hidden":"true"}),t.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-2",children:[t.jsx("p",{className:"text-body-sm text-ink",children:a}),t.jsx($,{variant:"secondary",size:"sm",onClick:()=>js(r),children:o})]})]})},Tc=({onAfterCredentialUpdate:e})=>{const{isAuthenticated:n,user:s,isLoading:a,accountRead:o,signOut:r}=gs(),l=dn(j=>j.isSigningOut),u=i.useCallback(async()=>{try{await r()}catch(j){console.error("Error signing out:",j)}},[r]),c=i.useMemo(()=>{if(!n||!s?.radientUser)return null;const{account:j,identity:b,verification:h}=s.radientUser,f=h!=null&&!h.email_verified&&h.signup_grant!=="claimed";return t.jsxs(t.Fragment,{children:[t.jsxs(Qe,{children:[t.jsx(oe,{label:"Status",value:t.jsxs("span",{className:"inline-flex items-center gap-2",children:["Connected",t.jsx(wa,{variant:"success",className:"capitalize",children:j.status})]})}),t.jsx(oe,{label:"Name",value:j.name||"Not provided"}),t.jsx(oe,{label:"Email",value:j.email}),t.jsx(oe,{label:"Account ID",value:t.jsx("span",{className:"text-mono-sm",children:j.id})}),t.jsx(oe,{label:"Tenant ID",value:t.jsx("span",{className:"text-mono-sm",children:j.tenant_id})}),t.jsx(oe,{label:"Provider",value:t.jsx("span",{className:"capitalize",children:b.provider})}),t.jsx(oe,{label:"Created",value:un(j.created_at)})]}),f&&h?t.jsx(Rc,{verification:h}):null,t.jsxs("div",{className:"mt-8",children:[t.jsx("p",{className:"text-body-sm text-ink-muted",children:"Need to sign out or switch accounts?"}),t.jsxs($,{variant:"danger",className:"mt-3",onClick:u,children:[t.jsx(Ws,{}),"Sign out from Radient"]})]})]})},[n,s?.radientUser,u]),m=i.useMemo(()=>o==="refused"?"Radient refused the sign-in this app is holding, so your account details could not be read. Signing in again below replaces it.":mn(o)?"Your Radient account could not be read, so this app cannot show your account details.":"You are not currently signed in to Radient.",[o]),y=i.useMemo(()=>n&&s?null:t.jsxs("div",{children:[t.jsxs("p",{className:"text-body-sm text-ink-muted",children:[m," Sign in to access your account details or sign up to get free credits and unified access to models, tools, and more with Radient Pass. Radient's automatic model router will automatically select the best model for your agents to balance cost and performance. It is often cheaper to use Radient Pass than to use single AI providers due to automatic cost optimization."]}),t.jsx("div",{className:"mt-6",children:t.jsx(Aa,{titleText:"",onAfterCredentialUpdate:e,descriptionText:"",onSignInSuccess:()=>{}})})]}),[n,s,m,e]);return a||l?t.jsxs("div",{className:"flex min-h-36 flex-col items-center justify-center gap-3",children:[t.jsx(ie,{size:"lg",label:"Loading account"}),!l&&t.jsx("p",{className:"text-meta text-ink-dim",children:"Loading your Radient account details…"})]}):n&&s?.radientUser?c:t.jsx("div",{className:"flex flex-col gap-4",children:y})};function Ec({metric:e,data:n}){return t.jsx(ws,{title:"",heightClassName:"h-62",yAxisWidth:48,unit:e==="credits"?"credits":"tokens",srSummary:`${e==="credits"?"Credits consumed":"Tokens used"} over the last 30 days, plotted per day across ${n.length} days.`,xTickFormatter:s=>s,yTickFormatter:s=>e==="credits"?`$${s.toFixed(2)}`:_s(s),children:t.jsx(Yr,{data:n,children:t.jsx(an,{type:"monotone",dataKey:"value",strokeWidth:2,dot:!1,activeDot:{r:4,strokeWidth:0},name:e==="credits"?"Credits consumed":"Tokens used"})})})}const Ic={all:["desktop","tts-path-resolution"]};function Lc(e){return ve({queryKey:Ic.all,queryFn:()=>xe({op:"tts.paths"}),enabled:e,staleTime:Number.POSITIVE_INFINITY,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:Ns})}const Oc=["speech.voice.gender","speech.voice.tone","speech.voice.expressiveness","speech.voice.pace","speech.voice.language","speech.voice.accent","speech.voice.instructions"];function Jt(e){const n=new Map(e.map(o=>[o.key,o])),s=[],a=[];for(const o of Oc){const r=n.get(o);r?s.push(r):a.push(o)}return{rows:s,missing:a}}const Fc=["provider_tts_radient","provider_tts_elevenlabs","provider_tts_openai","none"];function Xt(e){return typeof e=="string"&&Fc.includes(e)}function Dc(e){if(e===null||typeof e!="object")return null;const n=e;if(!Xt(n.path)||typeof n.reason!="string"||typeof n.servable!="boolean"||!Array.isArray(n.rungs))return null;const s=[];for(const a of n.rungs){if(a===null||typeof a!="object")return null;const o=a;if(!Xt(o.path)||typeof o.available!="boolean"||typeof o.reason!="string")return null;s.push({path:o.path,available:o.available,reason:o.reason})}return{path:n.path,reason:n.reason,servable:n.servable,rungs:s}}const $c={provider_tts_radient:"Radient Pass",provider_tts_elevenlabs:"ElevenLabs",provider_tts_openai:"OpenAI",none:"No provider"};function In(e){return $c[e]}function Uc(e){return{servable:e.servable,serving:e.path==="none"?null:e.path,reason:e.reason,rungs:e.rungs.map(n=>({path:n.path,name:In(n.path),available:n.available,reason:n.reason}))}}const Pc="This backend does not serve the voicing surface. Update the backend to tune how the assistant sounds.",Ln="Speech availability could not be read.",zc=({resetErrorBoundary:e})=>t.jsx(ne,{variant:"warning",children:t.jsxs("div",{className:"flex flex-col items-start gap-3",children:[t.jsx("span",{children:Ln}),t.jsxs($,{variant:"secondary",onClick:e,children:[t.jsx(Na,{"aria-hidden":"true"}),"Try again"]})]})});function Kc(e){return e==="enabled"?"ready":e==="below-version"?"older":"pairing"}const Bc=({sectionRef:e})=>{const n=cn(),s=hn(),a=Ss(n.data,"tts"),o=Kc(a),r=ve({queryKey:Ts.all,queryFn:()=>xe({op:"settings.list"}),enabled:o==="ready",staleTime:1e4}),l=Lc(o==="ready"),{hasRadientApiKey:u,hasRadientSession:c,speechBlock:m}=Cs(),y=`${c}:${u}`,j=i.useRef(y),b=l.refetch;i.useEffect(()=>{j.current!==y&&(j.current=y,b())},[y,b]);const h=r.data,f=i.useMemo(()=>Jt(h?.settings??[]),[h]),[M,S]=i.useState({}),[V,_]=i.useState({}),[B,U]=i.useState({});i.useEffect(()=>{h&&S(p=>{let I=!1;const k={...p};for(const H of Jt(h.settings).rows){const G=p[H.key];if(G&&G.value!==Le(H).value)continue;const J=Le(H);G&&G.value===J.value&&G.cascadeBase===J.cascadeBase||(k[H.key]=J,I=!0)}return I?k:p})},[h]);const A=(p,I)=>_(k=>({...k,[p]:I})),C=(p,I)=>U(k=>({...k,[p]:I})),W=async p=>{const I=M[p.key];if(!I)return;const k=Rs(p,I);if(!k.ok){C(p.key,k.error);return}A(p.key,!0),C(p.key,null);try{await xe(k.request),A(p.key,!1);const G=(await r.refetch()).data?.settings.find(J=>J.key===p.key);G&&S(J=>{const X=J[p.key];return X&&X.value===I.value&&X.cascadeBase===I.cascadeBase?{...J,[p.key]:Le(G)}:J})}catch(H){A(p.key,!1),C(p.key,H instanceof Error?H.message:"The setting could not be saved.")}},q=async p=>{A(p.key,!0),C(p.key,null);try{await xe({op:"settings.reset",key:p.key}),S(I=>({...I,[p.key]:Le({...p,value:p.default,is_default:!0})})),A(p.key,!1),await r.refetch()}catch(I){A(p.key,!1),C(p.key,I instanceof Error?I.message:"The setting could not be reset.")}},Q=i.useMemo(()=>Dc(l.data),[l.data]),T=Q?Uc(Q):null,ee=l.isSuccess&&Q===null,L=(n.data?null:n.error)??null,D=r.error,O="Speech voicing",z="How the assistant sounds when it speaks aloud.";if(o==="pairing"){const{sentence:p}=ft(s??null,"Speech settings could not be loaded.",L);return t.jsx(te,{title:O,icon:He,description:z,sectionRef:e,children:t.jsx(ne,{variant:"warning",children:p})})}if(o==="older")return t.jsx(te,{title:O,icon:He,description:z,sectionRef:e,children:t.jsx(ne,{variant:"warning",children:Pc})});if(D||!h){const{sentence:p,remedy:I}=ft(s??null,"Speech settings could not be loaded.",D);return t.jsx(te,{title:O,icon:He,description:z,sectionRef:e,children:t.jsx(ne,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:p}),I&&t.jsx($,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{r.refetch()},children:"Retry"})]})})})}const K=T?!T.servable:m==="offline",se=T?T.rungs.find(p=>p.path===T.serving)??null:null;return t.jsx(te,{title:O,icon:He,description:z,sectionRef:e,children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsxs("section",{className:"flex flex-col gap-3",children:[l.isPending&&t.jsxs("p",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[t.jsx(ie,{}),Lt("checking")]}),(l.isError||ee)&&!T&&m!=="offline"&&t.jsx(ne,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("span",{children:[Ln," ",l.error instanceof Error?l.error.message:""]}),t.jsx($,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{l.refetch()},children:"Retry"})]})}),t.jsx(_a,{fallbackRender:zc,resetKeys:[l.dataUpdatedAt],children:T&&t.jsxs(t.Fragment,{children:[t.jsxs(Qe,{children:[t.jsx(oe,{label:"Speaks through",value:T.serving?In(T.serving):"Nothing yet"}),t.jsx(oe,{label:"Availability",value:T.servable?"Ready":"No provider"})]}),T.reason&&T.reason!==se?.reason&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:T.reason}),t.jsx("ul",{className:"flex flex-col gap-1",children:T.rungs.map(p=>t.jsxs("li",{className:"flex flex-col gap-0.5 text-body-sm",children:[t.jsxs("span",{className:p.path===T.serving?"text-ink":"text-ink-muted",children:[p.name,t.jsxs("span",{className:p.path===T.serving?"text-ink-muted":"text-ink-dim",children:[" ",p.available?"(available)":"(not available)"]})]}),t.jsx("span",{className:"text-meta text-ink-dim",children:p.reason})]},p.path))})]})})]}),K&&t.jsx(ne,{variant:"warning",children:Lt(m)}),t.jsx("div",{className:"flex flex-col gap-1",children:f.rows.map(p=>t.jsx(Ms,{setting:p,draft:M[p.key]??Le(p),tier:As(p),saving:!!V[p.key],error:B[p.key]??null,onDraftChange:I=>S(k=>({...k,[p.key]:I})),onSave:()=>{W(p)},onReset:()=>{q(p)}},p.key))}),f.missing.length>0&&t.jsxs("p",{className:"text-meta text-ink-dim",children:["This backend does not register ",f.missing.join(", ")," yet, so those rows are not shown."]})]})})},Hc=()=>{const{data:e,isLoading:n,error:s,refetch:a}=Hr(),o=Vr(),[r,l]=i.useState(""),[u,c]=i.useState(!1);i.useEffect(()=>{l(e?.content??""),c(!1)},[e]);const m=f=>{const M=f.target.value;l(M),c(M!==(e?.content??""))},y=async()=>{if(!(!u||o.isPending))try{const f={content:r};await o.mutateAsync(f),await a(),c(!1)}catch(f){console.error("Error updating system prompt:",f)}},j=()=>{l(e?.content??""),c(!1)},b=o.isPending,h=()=>t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(pe,{htmlFor:"app-system-prompt",children:"Instructions"}),t.jsx(yn,{id:"app-system-prompt",name:"systemPrompt",value:r,onChange:m,placeholder:"Enter instructions for how all agents should behave and respond to your requests...",className:"min-h-50"})]}),t.jsxs("div",{className:"flex gap-3",children:[t.jsxs($,{variant:"primary",onClick:y,disabled:!u||b,children:[b?t.jsx(ie,{size:"sm"}):t.jsx(Zs,{}),b?"Saving...":"Save changes"]}),t.jsx($,{onClick:j,disabled:!u||b,children:"Cancel"})]}),e?.last_modified&&t.jsxs("p",{className:"text-ink-dim text-meta",children:["Last modified:"," ",t.jsx("span",{className:"font-mono text-mono-sm",children:fn(e.last_modified)})]})]});return t.jsx(te,{title:"System prompt",icon:Ma,description:"Every Local Operator agent receives this prompt in addition to its own instructions, so it is the place for baseline expectations and for details you want every agent to know about you, such as your name, location, or preferences. It is sent to your selected hosting provider.",children:n?t.jsx("div",{className:"flex min-h-50 items-center justify-center",children:t.jsx(ie,{size:"lg",label:"Loading system prompt"})}):s?t.jsxs(ne,{variant:"danger",children:["Failed to load system prompt:"," ",s instanceof Error?s.message:"Unknown error"]}):h()})},Vc=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"],Gc=e=>Vc.includes(e),qc=e=>{const n=[];let s=0;for(const a of e){const o=Math.max(0,Math.floor(a.count)),r=Math.max(1,Math.floor(a.columns));for(let l=0;l<o;l+=r)n.push({start:s+l,count:Math.min(r,o-l)});s+=o}return n},Yc=({index:e,key:n,groups:s})=>{const a=qc(s),o=a.reduce((r,l)=>r+l.count,0);if(!Number.isInteger(e)||e<0||e>=o)return e;switch(n){case"Home":return 0;case"End":return o-1;case"ArrowLeft":return Math.max(0,e-1);case"ArrowRight":return Math.min(o-1,e+1);case"ArrowUp":case"ArrowDown":{const r=a.findIndex(c=>e>=c.start&&e<c.start+c.count),l=a[r+(n==="ArrowDown"?1:-1)];if(!l)return e;const u=e-a[r].start;return l.start+Math.min(u,l.count-1)}default:return e}},Wc={localOperatorDark:er,localOperatorLight:vr,dracula:mr,dune:Mo,sage:Go,monokai:Xs,tokyoNight:ar,iceberg:fr,radient:Po,neon:Es,obsidian:kn,synth:Pa,catppuccinMocha:ho,catppuccinLatte:Zo,tokyoNightStorm:ao,gruvbox:Ya,nord:Kr,oneDark:$a,solarizedDark:xr,rosePine:Eo,rosePineMoon:Jo,rosePineDawn:uo,alucard:Lo,gruvboxLight:vo,tokyoNightDay:nr,oneLight:Yo,catppuccinFrappe:xo,catppuccinMacchiato:Ko,palenight:Js,everforest:Lr,everforestLight:Er,kanagawaWave:$r,kanagawaLotus:Ro,ayuDark:jo,ayuMirage:_o,ayuLight:cr,nightfox:ro,duskfox:_r,synthwave:rr,matrix:Ka,tron:no,cyberpunk:Qs,vaporwave:Rr,outrun:Ga,neonNoir:Fr,arcade:Ho,forest:Mr,ocean:So,desert:Sr,autumn:Pr,lavender:gr,arctic:co,rosewood:$o,solarizedLight:jr,githubLight:Fo,paper:Ra,linen:dr,highContrastLight:Fa,mintLight:Ha},en="bg-[color-mix(in_srgb,var(--color-accent)_8%,var(--color-accent-wash))]",Zc=({id:e})=>t.jsxs("div",{"data-theme":e,"aria-hidden":"true",className:"flex h-full bg-canvas",children:[t.jsxs("div",{className:"flex w-1/4 flex-col gap-1 bg-sunken p-1",children:[t.jsx("span",{className:"flex h-2.5 items-center rounded-xs bg-accent-wash px-1",children:t.jsx("span",{className:"h-1 w-full rounded-xs bg-accent"})}),t.jsx("span",{className:"mx-1 h-1 w-2/3 rounded-xs bg-ink-dim"}),t.jsx("span",{className:"mx-1 h-1 w-1/2 rounded-xs bg-ink-dim"})]}),t.jsxs("div",{className:"flex flex-1 flex-col justify-between p-1",children:[t.jsxs("div",{className:"flex flex-col gap-1 rounded-xs bg-surface p-1",children:[t.jsx("span",{className:"h-1 w-3/5 rounded-xs bg-ink"}),t.jsx("span",{className:"h-1 w-full rounded-xs bg-ink-dim"})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"h-2.5 w-6 rounded-xs bg-elevated"}),t.jsx("span",{className:"h-2.5 w-5 rounded-xs bg-accent"}),t.jsx("span",{className:"h-2.5 w-4 rounded-xs bg-accent-alt"}),t.jsx("span",{className:"h-2.5 w-4 rounded-xs border border-control"})]})]})]}),Qc=({id:e,name:n,description:s,isSelected:a,isTabStop:o,onSelect:r,onFocusTile:l})=>{const u=Wc[e];return t.jsx($e,{side:"bottom",align:"start",content:s,children:t.jsxs("button",{type:"button","data-theme-tile":e,"aria-pressed":a,tabIndex:o?0:-1,onFocus:l,onClick:r,className:re("relative flex flex-col gap-1.5 rounded-md p-1 text-left transition-colors duration-fast ease-out-quart",a?en:"hover:bg-surface"),children:[t.jsxs("span",{className:re("relative block h-10 overflow-hidden rounded-sm border transition-colors duration-fast ease-out-quart",a?"border-accent":"border-hairline"),children:[t.jsx(Zc,{id:e}),a&&t.jsx("span",{className:re("pointer-events-none absolute top-0.5 right-0.5 flex h-4 w-4 items-center justify-center rounded-full",en),children:t.jsx(Ca,{size:12,className:"text-accent","aria-hidden":"true"})})]}),t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx(u,{size:12,className:"shrink-0 text-ink-dim","aria-hidden":"true"}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-meta text-ink",children:n})]})]})})},Jc=e=>[...e.querySelectorAll("[data-theme-grid]")].map(n=>{const s=[...n.querySelectorAll("[data-theme-tile]")],a=s[0]?.getBoundingClientRect().top??0;return{count:s.length,columns:Math.max(1,s.filter(o=>Math.abs(o.getBoundingClientRect().top-a)<1).length)}}),Xc=()=>{const{themeName:e,setTheme:n}=ke(),s=i.useMemo(()=>{const u=Object.values($n);return[{label:"Dark",items:u.filter(c=>c.theme.palette.mode==="dark")},{label:"Light",items:u.filter(c=>c.theme.palette.mode==="light")}].filter(c=>c.items.length>0)},[]),[a,o]=i.useState(null),r=i.useMemo(()=>{const u=s.flatMap(c=>c.items.map(m=>m.id));return a&&u.includes(a)?a:u.includes(e)?e:u[0]},[s,a,e]),l=u=>{if(!Gc(u.key))return;const c=[...u.currentTarget.querySelectorAll("[data-theme-tile]")],m=c.indexOf(u.target);if(m<0)return;u.preventDefault();const y=Yc({index:m,key:u.key,groups:Jc(u.currentTarget)});y!==m&&c[y]?.focus()};return t.jsx(Sa,{children:t.jsx("div",{onKeyDown:l,className:"flex flex-col gap-6",children:s.map(u=>t.jsxs("div",{children:[t.jsx("h3",{className:"px-1 pb-2 text-meta text-ink-dim",children:u.label}),t.jsx("div",{"data-theme-grid":u.label,className:"grid grid-cols-[repeat(auto-fill,minmax(160px,1fr))] gap-2",children:u.items.map(({id:c,name:m,description:y})=>t.jsx(Qc,{id:c,name:m,description:y,isSelected:c===e,isTabStop:c===r,onSelect:()=>n(c),onFocusTile:()=>o(c)},c))})]},u.label))})})},el=({value:e,onChange:n})=>{const s=i.useId();return t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("span",{id:s,className:"flex min-h-6 items-center text-body text-ink",children:"Transcript display"}),t.jsx("p",{className:"mt-0.5 max-w-2xl text-body-sm text-ink-muted",children:"By turn condenses each turn to its answer. By response keeps every settled response on screen, with the turn's final answer still marked."})]}),t.jsx("div",{className:"flex h-6 shrink-0 items-center",children:t.jsx(pt,{value:e,onValueChange:a=>n(pn(a)),children:t.jsx(gt,{"aria-labelledby":s,children:Vs.map(a=>t.jsx(Fe,{value:a.value,children:a.label},a.value))})})})]})},tl=()=>{const{data:e,isLoading:n,error:s}=Zr({enabled:!0});return t.jsxs("div",{children:[t.jsxs("h3",{className:"mb-3 flex items-center gap-2 text-heading text-ink",children:[t.jsx(go,{size:16,className:"shrink-0 text-ink-dim"}),"Radient Pass"]}),n&&t.jsx(xn,{className:"h-6 w-36"}),s&&t.jsxs(ne,{variant:"warning",children:["Could not load your credit balance. ",s.message]}),e&&!n&&!s&&t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[t.jsxs("p",{className:"flex-1 text-body-sm text-ink-muted",children:["Available credits"," ",t.jsx("span",{className:"font-medium text-ink",children:e.balance.toFixed(2)})]}),t.jsx($,{variant:"secondary",size:"sm",asChild:!0,children:t.jsxs("a",{href:"https://console.radienthq.com/dashboard/billing",target:"_blank",rel:"noopener noreferrer",children:[t.jsx(eo,{}),"Add credits"]})})]})]})},nl=[{id:"credits",label:"Credits"},{id:"tokens",label:"Tokens"}],sl=()=>{const[e,n]=i.useState("credits"),s=i.useMemo(()=>{const u=new Date,c=qr(u);return{start_date:Pt(c),end_date:Pt(u),rollup:"daily"}},[]),{data:a,isLoading:o,error:r}=Jr(s,{enabled:!0}),l=i.useMemo(()=>a?.data_points?[...a.data_points].sort((c,m)=>at(c.timestamp).getTime()-at(m.timestamp).getTime()).map(c=>({bucket:Us(Ia(at(c.timestamp),"yyyy-MM-dd")),value:e==="credits"?Number.parseFloat(c.total_cost.toFixed(2)):c.total_tokens})):[],[a,e]);return t.jsxs("div",{children:[t.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[t.jsxs("h3",{className:"flex items-center gap-2 text-heading text-ink",children:[t.jsx(Za,{size:16,className:"shrink-0 text-ink-dim"}),"Usage (last 30 days)"]}),t.jsxs("fieldset",{className:"m-0 w-fit border-0 p-0",children:[t.jsx("legend",{className:"sr-only",children:"Usage metric"}),t.jsx("div",{className:"flex gap-0.5 rounded-md bg-sunken p-0.5",children:nl.map(({id:u,label:c})=>t.jsx($,{variant:"ghost",size:"sm","aria-pressed":e===u,onClick:()=>n(u),className:re(e===u&&"bg-surface text-ink hover:bg-surface"),children:c},u))})]})]}),o&&t.jsx(xn,{className:"h-62 w-full"}),r&&t.jsxs(ne,{variant:"warning",children:["Could not load your usage data. ",r.message]}),!o&&!r&&a&&l.length>0&&t.jsx(Ec,{metric:e,data:l}),!o&&!r&&(!a||l.length===0)&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:"No usage recorded in the last 30 days."})]})},al=()=>t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[t.jsxs("h2",{className:"flex items-center gap-2 text-heading text-ink",children:[t.jsx(la,{size:16,className:"shrink-0 text-ink-dim"}),"Radient account"]}),t.jsx($,{variant:"secondary",size:"sm",className:"self-start sm:self-center",asChild:!0,children:t.jsxs("a",{href:"https://console.radienthq.com",target:"_blank",rel:"noopener noreferrer",children:["Go to Radient console",t.jsx(Ps,{})]})})]}),xl=()=>{const e=Is("surface"),n=ke(g=>g.showAgentReasoning),s=ke(g=>g.setShowAgentReasoning),a=ke(g=>g.transcriptDisplayMode),o=ke(g=>g.setTranscriptDisplayMode),{data:r,isLoading:l,isFetching:u,error:c,refetch:m}=Ls(),y=hn(),{sentence:j,remedy:b}=ft(y??null,"Your settings could not be loaded.",c),h=ea(),[f,M]=i.useState(null),S=dn(),{isAuthenticated:V,accountRead:_,isFetching:B,isRefreshing:U,refreshUser:A}=bt(),C=Ge(g=>g.activeSessionId),[W,q]=i.useState("general"),[Q,T]=i.useState(!1),ee=i.useRef(null),L=i.useRef(null),{startTour:D}=ta(),O=Os(),{data:z,refetch:K}=Fs(),{refreshModels:se}=Ds(),p=i.useMemo(()=>z?.keys?[...z.keys].sort():[],[z?.keys]),I=i.useRef({keys:"",hosting:void 0});i.useEffect(()=>{const g=p.join(","),F=r?.values?.hosting;(I.current.keys!==g||I.current.hosting!==F)&&(I.current={keys:g,hosting:F},se().catch(E=>{console.error("Failed to refresh models after credentials or hosting change:",E)}))},[p,r?.values?.hosting,se]);const k=i.useRef({general:i.useRef(null),radient:i.useRef(null),integrations:i.useRef(null),appearance:i.useRef(null),speech:i.useRef(null),keyboard:i.useRef(null),providers:i.useRef(null),backend:i.useRef(null),updates:i.useRef(null)}).current,H=i.useMemo(()=>new URLSearchParams(O.search).get("setting"),[O.search]),G=i.useMemo(()=>new URLSearchParams(O.search).get("filter")??"",[O.search]),J=i.useMemo(()=>new URLSearchParams(O.search).get("mcp")??void 0,[O.search]),X=i.useMemo(()=>new URLSearchParams(O.search).get("provider"),[O.search]),Z=i.useCallback(g=>{q(g),T(!0);const F=k[g],E=L.current;if(F?.current&&E){const Y=F.current.getBoundingClientRect().top-E.getBoundingClientRect().top;E.scrollHeight>E.clientHeight?E.scrollTo({top:Math.max(0,E.scrollTop+Y-80),behavior:"smooth"}):window.scrollTo({top:Math.max(0,F.current.getBoundingClientRect().top+window.scrollY-80),behavior:"smooth"}),clearTimeout(ee.current??void 0),ee.current=setTimeout(()=>{T(!1),ee.current=null},800)}else T(!1)},[k]);i.useEffect(()=>{const g=setTimeout(()=>{const F=L.current;if(!F)return;const E=()=>{if(Q)return;const le=F.getBoundingClientRect(),Y=le.height;let de="",ce=0;for(const[je,he]of Object.entries(k))if(he.current){const ae=he.current.getBoundingClientRect(),we=le.top,fe=ae.top-we,et=ae.bottom-we,Ke=ae.height,tt=Math.max(0,fe),nt=Math.min(Y,et),Ee=Math.max(0,nt-tt)/Ke,Ie=Ee+(fe<Y*.3?.1:0);Ie>ce&&Ee>.1&&(ce=Ie,de=je)}de&&de!==W&&q(de)};return E(),F.addEventListener("scroll",E,{passive:!0}),()=>{F.removeEventListener("scroll",E),clearTimeout(ee.current??void 0)}},100);return()=>clearTimeout(g)},[k,W,Q]),i.useEffect(()=>{const g=new URLSearchParams(O.search),F=g.get("section"),E=g.get("setting")?"backend":F,le=E?k[E]:void 0;if(!E||!le)return;let Y=!1,de=Number.NaN,ce=0;const je=window.setTimeout(()=>{Y||(Y=!0,ae.disconnect(),Z(E))},2e3),he=()=>{if(Y)return;const we=le.current;if(!we){ce=requestAnimationFrame(he);return}const fe=Math.round(we.getBoundingClientRect().top+window.scrollY);if(fe===de&&fe>0){Y=!0,ae.disconnect(),window.clearTimeout(je),Z(E);return}de=fe,ce=requestAnimationFrame(he)},ae=new ResizeObserver(()=>{Y||(cancelAnimationFrame(ce),ce=requestAnimationFrame(he))});return L.current&&ae.observe(L.current),ce=requestAnimationFrame(he),()=>{Y=!0,cancelAnimationFrame(ce),ae.disconnect(),window.clearTimeout(je)}},[O.search,k,Z]);const ge=async(g,F)=>{M(g);try{await h.mutateAsync({[g]:F}),await m()}catch(E){console.error(`Error updating ${g}:`,E)}finally{M(null)}},be=l,me=_==="checking",Ae=mn(_),v=_==="ready"||_==="checking"||B,R=gn(be,4e3);return c?t.jsx("div",{className:"flex h-full w-full items-center justify-center bg-canvas p-6",children:t.jsx(ne,{variant:"warning",className:"w-full max-w-xl",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:j}),b&&t.jsx($,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>void m(),disabled:u,children:u?"Retrying":"Retry"})]})})}):be?t.jsxs("div",{role:"status",className:"flex h-full w-full flex-col items-center justify-center gap-3 bg-canvas",children:[t.jsx(ie,{size:"lg",label:R?void 0:"Loading settings"}),R&&t.jsx("p",{className:"max-w-sm text-center text-body-sm text-ink-muted",children:"The Local Operator server is taking longer than usual to answer. If it does not respond, you will be able to retry from here."})]}):r?t.jsxs("div",{className:"flex h-full w-full overflow-hidden bg-canvas",children:[t.jsx("div",{ref:e,className:"w-12 shrink-0 overflow-y-auto min-[1040px]:w-55",children:t.jsx(na,{activeSection:W,onSelectSection:Z,sections:sa})}),t.jsx("div",{ref:L,"data-settings-content":!0,"data-tour-tag":"settings-general-section",className:"flex-1 overflow-y-auto overflow-x-hidden p-4 sm:p-6 md:p-8",children:t.jsxs("div",{className:"mx-auto flex w-full max-w-4xl flex-col gap-8 pb-8",children:[t.jsx(da,{title:"Settings",icon:Ft}),t.jsxs("div",{className:"flex flex-col gap-8",children:[t.jsxs("div",{ref:k.general,className:"flex flex-col gap-8",children:[t.jsxs(te,{title:"User profile",icon:aa,description:`Your user profile information displayed in the application. This information is not provided to the agents. ${V?"These details are provided through your Radient account.":""}`,children:[me&&t.jsx("p",{className:"text-meta text-ink-dim",children:"Checking your Radient account…"}),Ae&&t.jsx(ne,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("span",{children:["Your Radient account could not be read, so the name and email below are placeholders rather than your account details.",_==="refused"?" Retry, or sign in to Radient again.":" Retry."]}),t.jsx($,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>A(),disabled:U,children:U?"Retrying":"Retry"})]})}),t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(Dt,{value:S.profile.name,label:"Display name",placeholder:"Enter your name...",isSaving:f==="user_name",onSave:async g=>{M("user_name");try{S.updateName(g)}finally{M(null)}},readOnly:v}),t.jsx(Dt,{value:S.profile.email,label:"Email address",placeholder:"Enter your email...",isSaving:f==="user_email",onSave:async g=>{M("user_email");try{S.updateEmail(g)}finally{M(null)}},readOnly:v})]})]}),t.jsx(te,{title:"Application tour",description:"Missed the application onboarding tour or want a refresher? Start it again here.",children:t.jsxs($,{variant:"secondary",onClick:()=>{D({forceModalCompleted:!0})},children:[t.jsx(Ja,{}),"Take the tour"]})}),t.jsx(te,{id:"model-settings",title:"Model settings",icon:oa,description:"Configure the default AI model and hosting providers used for generating responses. This will be used for all agents that don't have a specific model or hosting provider configured. You can override these settings for individual agents in the agent settings.",children:t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(ra,{value:r.values.hosting,isSaving:f==="hosting",onSave:g=>ge("hosting",g),filterByCredentials:!0,allowCustom:!0,allowDefault:!1,emptyHelperText:"No hosting providers available. Sign in to a provider, or add a provider's API key below, under Providers."}),t.jsx(ia,{value:r.values.model_name,hostingId:r.values.hosting,isSaving:f==="model_name",onSave:g=>ge("model_name",g),allowCustom:!0,allowDefault:!1}),t.jsx(ne,{variant:"neutral",icon:t.jsx(Ze,{className:"size-4","aria-hidden":"true"}),children:"You need a Radient account or your own API keys to reach cloud providers. If you don't see more hosting providers and models here, sign in to Radient, or add a provider's API key below, under Providers."})]})}),t.jsx(Hc,{}),t.jsx(te,{title:"Configuration information",icon:Ze,description:"System information about the current configuration.",children:t.jsxs(Qe,{children:[t.jsx(oe,{label:"Version",value:t.jsx("span",{className:"text-mono-sm",children:r.version})}),t.jsx(oe,{label:"Created",value:un(r.metadata.created_at)}),t.jsx(oe,{label:"Last modified",value:fn(r.metadata.last_modified)}),t.jsx(oe,{label:"Description",value:r.metadata.description||"No description available"})]})})]}),t.jsx(te,{title:"Appearance",icon:kn,description:"Customize the look and feel of Local Operator",sectionRef:k.appearance,dataTourTag:"settings-appearance-section",children:t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(Xc,{}),t.jsx(Gr,{value:n,label:"Show agent reasoning",description:"Adds the agent's Reasoning and Thinking rows to conversations. They stay closed until you open one. Reasoning only: narration the agent writes as prose mid-turn is transcript content, not reasoning — never removed by either display mode (by turn folds it behind the turn's bars, by response keeps it on screen).",onChange:async g=>s(g)}),t.jsx(el,{value:pn(a),onChange:g=>o(g)})]})}),t.jsx(Bc,{sectionRef:k.speech}),t.jsx(oi,{sectionRef:k.keyboard}),t.jsx(te,{title:"Model providers",icon:ln,description:"Sign in to the services your agents think with. New chats use your default model.",sectionRef:k.providers,children:t.jsx(ca,{initialProviderId:X,onChangeModel:()=>Z("general")})}),t.jsx(Cc,{sessionId:C??void 0,sectionRef:k.integrations,highlightServer:J}),t.jsx(te,{title:"Radient account",titleComponent:t.jsx(al,{}),description:"Your Radient account, Radient Pass details and credits. To use Radient models, sign in under Model providers.",sectionRef:k.radient,dataTourTag:"settings-radient-account-section",children:t.jsxs("div",{className:"flex flex-col gap-8",children:[t.jsx(Tc,{onAfterCredentialUpdate:()=>{se(),K()}}),V&&t.jsxs(t.Fragment,{children:[t.jsx(tl,{}),t.jsx(sl,{})]})]})}),t.jsx(te,{title:"Backend settings",icon:Ft,description:"Every setting the backend registry owns, searchable, with typed editors and scopes.",sectionRef:k.backend,children:t.jsx($s,{focusKey:H,initialFilter:G})}),t.jsx("div",{ref:k.updates,children:t.jsx(ni,{})})]})]})})]}):t.jsx("div",{className:"flex h-full w-full items-center justify-center bg-canvas p-6",children:t.jsx(ne,{variant:"warning",className:"w-full max-w-xl",children:"Your settings could not be loaded."})})};export{xl as SettingsPage};
291
+ */const Hr=[["path",{d:"M12.8 19.6A2 2 0 1 0 14 16H2",key:"148xed"}],["path",{d:"M17.5 8a2.5 2.5 0 1 1 2 4H2",key:"1u4tom"}],["path",{d:"M9.8 4.4A2 2 0 1 1 11 8H2",key:"75valh"}]],Vr=w("wind",Hr),Gr=({appVersion:e=null,slowWaitHintMs:n})=>{const s="https://local-operator.com/download",[a,o]=i.useState(!1),r=yn(a,n??Ys),[l,u]=i.useState(!1),[c,m]=i.useState(null),[y,j]=i.useState("info"),[b,h]=i.useState(null),[f,M]=i.useState(null),S=e?.trim()?e.trim():null,V=i.useRef(!1),_=lt(I=>I.openDetail),B=i.useRef(!1),U=i.useRef(0),A=i.useRef(!1),C=i.useCallback((I,D)=>{B.current=!1,m(I),j(D),u(!0)},[]),Y=i.useCallback(I=>{B.current=!0,m(I),j("success"),u(!0)},[]),q=i.useCallback(()=>{B.current&&(B.current=!1,u(!1),m(null))},[]),{clearDeferredUpdate:Z}=Pn();i.useEffect(()=>{const I=window.api.updater.onUpdateError(p=>{V.current&&p.includes("manually")&&(h({message:"The server is installed outside the app, so use the tool you installed it with - uv, pipx or pip.",command:""}),B.current=!1,m(null),j("warning"),u(!0))}),D=window.api.updater.onBackendUpdateDevMode(p=>{V.current&&C(p,"info")}),L=()=>{A.current=!0,q()},z=window.api.updater.onUpdateAvailable(L),K=window.api.updater.onUpdateNpxAvailable(L),se=window.api.updater.onBackendUpdateAvailable(L);return()=>{I(),D(),z(),K(),se()}},[q,C]),i.useEffect(()=>{let I=!1;const D=()=>{window.api.updater.getLastInstallAttempt().then(z=>{I||M(z)}).catch(()=>{})};D();const L=window.api.updater.onUpdateInstallFailed(()=>D());return()=>{I=!0,L()}},[]);const T=async()=>{const I=++U.current;q(),A.current=!1;try{o(!0),V.current=!0,Z(xe.UI),Z(xe.BACKEND);const D=await window.api.updater.checkForAllUpdates({manual:!0});if(I!==U.current)return;D.app==="available"&&_(xe.UI),D.server==="available"&&_(xe.BACKEND),D?.affirmation&&!A.current?Y(D.affirmation):q()}catch(D){if(I!==U.current)return;console.warn(`Update check failed; the app-level alert owns the report: ${Ws(D)}`)}finally{I===U.current&&o(!1),setTimeout(()=>{V.current=!1},2e3)}},ee=()=>{B.current=!1,u(!1),m(null)};return t.jsxs(t.Fragment,{children:[f&&t.jsxs("div",{className:"mb-3 rounded-sm bg-sunken p-3",children:[t.jsxs("p",{className:"text-body-sm text-ink",children:["The last update to version ",f.targetVersion," didn't finish",f.attempts>1?` (${f.attempts} attempts)`:"",".",S?` Version ${S} is running.`:null]}),t.jsxs("p",{className:"mt-1 text-meta text-ink-dim",children:["Detected"," ",f.detectedAt?new Date(f.detectedAt).toLocaleString():"at an unknown time",". ",f.detail]}),t.jsx($,{variant:"outline",size:"sm",className:"mt-2",onClick:()=>void window.api.openExternal(s),children:"Download a fresh copy"})]}),t.jsxs($,{variant:"outline",onClick:()=>void T(),disabled:a,children:[a?t.jsx(le,{size:"sm"}):null,a?"Checking...":"Check for updates"]}),r&&t.jsx("p",{className:"mt-2 text-meta text-ink-muted",children:"Still checking. A slow or stalled connection can hold this for about a minute and a half - the app stops waiting on its own."}),b&&t.jsxs(Tt,{open:l,autoHideDuration:1e4,onClose:ee,variant:"warning",children:[t.jsx("p",{className:"text-body-sm",children:b.message}),b.command&&t.jsx("code",{className:"mt-2 block rounded-sm bg-sunken p-2 text-mono-sm text-ink",children:b.command})]}),c&&y!=="danger"&&t.jsx(Tt,{open:l,autoHideDuration:6e3,onClose:ee,variant:y,children:c})]})},Ye=["system-prompt"],qr=()=>{const{shouldEnableQuery:e}=zn();return be({enabled:e({bypassInternetCheck:!0}),queryKey:Ye,queryFn:async()=>{try{const s=await nn(vt.baseUrl).config.getSystemPrompt();if(s===null)return null;if(s.status>=400)throw new Error(s.message||"Failed to fetch system prompt");return s.result}catch(n){const s=n instanceof Error?n.message:"An unknown error occurred while fetching system prompt";throw sn(s),n}},refetchOnWindowFocus:!1,staleTime:5e3})},Yr=()=>{const e=an(),n=nn(vt.baseUrl);return Kn({mutationFn:async s=>{try{const a=await n.config.updateSystemPrompt(s);if(a.status>=400)throw new Error(a.message||"Failed to update system prompt");return a.result}catch(a){const o=a instanceof Error?a.message:"An unknown error occurred while updating system prompt";throw sn(o),a}},onSuccess:async s=>{await e.invalidateQueries({queryKey:Ye,refetchType:"none"}),e.setQueryData(Ye,a=>a&&{...a,...s}),await e.refetchQueries({queryKey:Ye,type:"all"}),Bn("System prompt updated")},onError:s=>{console.error("Error updating system prompt:",s)}})},Wr=({value:e,label:n,description:s,onChange:a,icon:o,isSaving:r=!1})=>{const[l,u]=i.useState(e),c=i.useId(),m=`${c}-label`,y=`${c}-description`,j=async b=>{if(!r){u(b);try{await a(b)}catch(h){u(!b),console.error("Error toggling setting:",h)}}};return t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("span",{id:m,className:"flex min-h-6 items-center gap-2 text-body text-ink",children:[o&&t.jsx(o,{size:14,"aria-hidden":"true",className:"shrink-0 text-ink-dim"}),n]}),s&&t.jsx("p",{id:y,className:"mt-0.5 max-w-2xl text-body-sm text-ink-muted",children:s})]}),t.jsx("div",{className:"flex h-6 shrink-0 items-center",children:r?t.jsx(le,{size:"md",label:`Saving ${n}`}):t.jsx(fa,{checked:l,onCheckedChange:j,"aria-labelledby":m,"aria-describedby":s?y:void 0})})]})};function zt(e,n){const s=Da(e,n?.in);if(!Oa(s))throw new RangeError("Invalid time value");const a=Ce(s.getDate(),2),o=Ce(s.getMonth()+1,2),r=s.getFullYear(),l=Ce(s.getHours(),2),u=Ce(s.getMinutes(),2),c=Ce(s.getSeconds(),2);let m="",y="";const j=s.getTimezoneOffset();if(j!==0){const b=Math.abs(j),h=Ce(Math.trunc(b/60),2),f=Ce(b%60,2);y=`${j<0?"+":"-"}${h}:${f}`}else y="Z";return`${r}-${o}-${a}T${l}:${u}:${c}${m}${y}`}function Zr(e,n,s){return La(e,-30,s)}var Qr=Hn({chartName:"LineChart",GraphicalChild:on,axisComponents:[{axisType:"xAxis",AxisComp:Vn},{axisType:"yAxis",AxisComp:Gn}],formatAxisMap:qn});const Jr=["radient","creditBalance"],Xr=e=>{const{user:n,isAuthenticated:s}=bt(),a=n?.account?.tenant_id,o=s&&!!a&&e?.enabled;return be({queryKey:[Jr,a],queryFn:async()=>{if(!a)throw new Error("Tenant ID not available");const r=await rn({operation:"credits",tenantId:a});if(!r||typeof r.balance!="number")throw new Error("Invalid credit balance response format");return r},enabled:o,staleTime:5*60*1e3,refetchOnWindowFocus:!0})},ei=["radient","usageRollup"],ti=(e,n)=>{const{user:s,isAuthenticated:a}=bt(),o=s?.account?.tenant_id,r=a&&!!o&&n?.enabled;return be({queryKey:[...ei,o,e],queryFn:async()=>{if(!o)throw new Error("Tenant ID not available");const l={};for(const[c,m]of Object.entries(e))m!=null&&(l[c]=String(m));const u=await rn({operation:"usage",tenantId:o,query:l});if(!u)throw new Error("Invalid usage rollup response format");return u},enabled:r,staleTime:5*60*1e3,refetchOnWindowFocus:!0})},Kt={[xe.UI]:"Application updates",[xe.BACKEND]:"Server updates"},Bt=({type:e})=>{const n=lt(a=>a.followed[e]),s=lt(a=>a.setFollowedSegment);return t.jsxs("div",{className:"flex flex-col gap-1.5 sm:flex-row sm:items-center sm:justify-between sm:gap-6",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-body-sm text-ink",children:Kt[e]}),t.jsx("div",{className:"mt-0.5 text-meta text-ink-muted",children:He[n].description})]}),t.jsxs(pa,{value:n,onValueChange:a=>s(e,a),children:[t.jsx(ga,{"aria-label":`${Kt[e]}: ${He[n].label}`,className:"w-full sm:w-56","data-followed-segment":e,children:t.jsx(ya,{})}),t.jsx(xa,{children:Yn.map(a=>t.jsx(ka,{value:a,title:He[a].description,children:He[a].label},a))})]})]})},ni=()=>t.jsxs("div",{className:ce("flex flex-col gap-3"),children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-heading text-ink",children:"Update notifications"}),t.jsx("p",{className:"mt-1 text-meta text-ink-muted",children:"How much of a version change shows the update notice at the bottom of the window. A check you run yourself always reports what it finds."})]}),t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx(Bt,{type:xe.UI}),t.jsx(Bt,{type:xe.BACKEND})]})]}),si=({appVersion:e})=>t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(ni,{}),t.jsx(Gr,{appVersion:e})]}),ai=e=>{if(!e)return null;try{return new URL(e).host}catch{return null}},oi=()=>{const[e,n]=i.useState(null),[s,a]=i.useState({value:"Loading...",detail:null,degraded:!1}),[o,r]=i.useState({platform:"Loading...",arch:"...",nodeVersion:"Loading...",electronVersion:"Loading...",chromeVersion:"Loading..."});i.useEffect(()=>{let u=!0;const c=h=>{if(!u)return;const f=ai(h.url);if(h.state==="connecting"){a({value:"Loading...",detail:null,degraded:!1});return}if(h.state==="detached"){a({value:"Not connected",detail:h.detail||null,degraded:!1});return}if(h.state==="wedged"){a({value:"Not attached",detail:h.detail||null,degraded:!1});return}const M=h.version||"Version unknown";a({value:f?`${M} · ${f}`:M,detail:h.detail||null,degraded:h.state==="degraded"})};let m=!1;const y=window.api?.backend?.onStatusChange(h=>{m=!0,c(h)}),j=async()=>{try{const[h,f]=await Promise.all([window.api.systemInfo.getAppVersion(),window.api.systemInfo.getPlatformInfo()]);u&&(n(h),r(f))}catch(h){console.error("Error fetching app information:",h)}},b=async()=>{try{const h=window.api?.backend;if(h){const S=await h.getStatus();m||c(S);return}const f=await Et.healthCheck(vt.baseUrl),M=Et.getServerVersion(f);u&&a({value:M,detail:null,degraded:!1})}catch(h){console.error("Error fetching server version:",h),u&&a({value:"Unavailable",detail:null,degraded:!1})}};return j(),b(),()=>{u=!1,y?.()}},[]);const l=(u,c,m,y={})=>t.jsx(re,{label:t.jsx(Ue,{content:m,children:t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx(Qe,{size:12,className:"shrink-0"}),u]})}),valueClassName:y.valueClassName,value:t.jsxs(t.Fragment,{children:[y.valueTooltip?t.jsx(Ue,{content:y.valueTooltip,children:t.jsx("span",{"data-backend-version":y.valueHoverTarget?"":void 0,children:c})}):c,y.statusNote?t.jsx("span",{className:"mt-0.5 block text-meta text-ink-dim",children:y.statusNote}):null]})});return t.jsx(te,{title:"Application updates and info",icon:Wn,description:"Check for updates and view information about your Local Operator installation.",dataTourTag:"settings-app-updates-section",children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsxs(Je,{children:[l("Application version",e??"Loading...","The version of the Local Operator user interface application."),l("Server version",s.value,"The version of the Local Operator API server backend, and the address of the daemon it was read from.",{valueTooltip:s.detail,valueHoverTarget:!0,statusNote:s.degraded?"Not answering":void 0,valueClassName:s.degraded?"text-ink-muted":void 0}),l("Platform",`${o.platform} (${o.arch})`,"The operating system and architecture your application is running on."),l("Node.js version",o.nodeVersion,"The JavaScript runtime environment version."),l("Electron version",o.electronVersion,"The framework version enabling this desktop application.")]}),t.jsx(si,{appVersion:e})]})})},ri=e=>{const n=e.label.replace(/^Open\s+/,"");return n.charAt(0).toUpperCase()+n.slice(1)},ii=({action:e})=>{const n=i.useId(),s=i.useRef(null),a=ve(f=>f.shortcutBindings),o=a[e.id],r=ve(f=>f.setShortcutBinding),l=ve(f=>f.clearShortcutBinding),[u,c]=i.useState(!1),[m,y]=i.useState(null),j=i.useMemo(Zn,[]),b=Hs(e.id,a),h=ri(e);return t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx(fe,{htmlFor:n,className:"w-32 text-body-sm text-ink",children:h}),t.jsx(Me,{id:n,readOnly:!0,value:b===null?"No shortcut":Vs(b,j),"aria-label":`${h}: press the keys you want`,"data-shortcut-action":e.id,ref:s,className:ce("w-52",b===null?"text-body-sm":"font-mono text-body-sm"),onFocus:()=>c(!0),onBlur:()=>{c(!1),y(null)},onKeyDown:f=>{if(Qn.has(f.key))return;if(Jn.has(f.key)){c(!1),y(null);return}if(Xn.has(f.key)||f.nativeEvent.isComposing)return;const M=es({key:f.key,metaKey:f.metaKey,ctrlKey:f.ctrlKey,altKey:f.altKey,shiftKey:f.shiftKey}),S=Gs(M,e.id,a,j);if(S!==null){f.preventDefault(),c(!0),y(S);return}if(M===b){c(!0),y(null);return}f.preventDefault(),c(!0),y(null),M===e.defaultChord?r(e.id,null):M!==null&&r(e.id,M)}}),b!==null&&t.jsx($,{variant:"secondary",size:"sm","aria-label":`Clear ${h}'s shortcut`,onClick:()=>{l(e.id),s.current?.focus()},children:"Clear"}),o!==void 0&&t.jsx($,{variant:"secondary",size:"sm","aria-label":`Reset ${h} to its default`,onClick:()=>{r(e.id,null),s.current?.focus()},children:"Reset"})]}),u&&t.jsx("span",{className:"text-meta text-ink-dim",children:"Press the keys you want; Esc cancels."}),m!==null&&t.jsx("output",{className:"text-meta text-danger",children:m})]})},ci=({sectionRef:e})=>t.jsx(te,{title:"Keyboard shortcuts",icon:Zs,description:"Shortcuts for the panel rail. Focus a field and press the keys you want; Esc cancels, Reset restores an action's default, and Clear leaves it unbound.",sectionRef:e,children:t.jsx("div",{className:"flex flex-col gap-4",children:Bs.map(n=>t.jsx(ii,{action:n},n.id))})}),li=[[[".claude.json"],"Claude Code"],[[".claude",".mcp.json"],"Claude Code"],[[".cursor","mcp.json"],"Cursor"],[[".vscode","mcp.json"],"VS Code"],[[".codex","config.toml"],"Codex CLI"]];function bn(e){if(!e)return null;const n=e.split("\\").join("/").split("/").filter(Boolean);for(const[s,a]of li)if(!(n.length<s.length)&&n.slice(-s.length).join("/")===s.join("/"))return a;return null}const We=e=>`${e} ${e===1?"tool":"tools"}`,di=e=>`${e} ${e===1?"integration":"integrations"}`,ui=["connected","needs_sign_in","not_started","connecting","error"],jn=e=>ui.includes(e),Ee=(e,n)=>[...n].filter(s=>s.name===e&&s.status==="running").sort((s,a)=>a.created_at-s.created_at)[0]??null,mi={connectedAt:null,connectedToolCount:null,settledGroup:null,pinnedGroup:null,pinnedOperationId:null,needsKey:!1,needsSignIn:!1,disconnectedAt:null,holdUntil:null,lastDecisive:null},hi=1e12,fi=1e9,pi=60*60*1e3,wn=(e,n=Date.now())=>{if(typeof e!="number"||!Number.isFinite(e))return null;const s=e>=hi?e:e<fi?null:e*1e3;return s===null||s>n+pi?null:Math.min(s,n)},Ae=(e,n)=>e?.[n]??mi,ze=(e,n,s)=>xi(e,n)??s?.lastDecisive??null,gi=e=>({id:e.id,name:e.name,action:e.action,status:e.status,created_at:e.created_at,credential_removed:e.credential_removed,...e.message?{message:e.message}:{}}),wt=(e,n)=>e.status==="not_started"&&typeof e.tool_count=="number"&&(n.connectedAt!==null||e.status_basis==="stored"&&e.tool_count_basis==="last_seen"),yi=(e,n)=>[...n].filter(s=>s.name===e).sort((s,a)=>a.created_at-s.created_at)[0]??null,xi=(e,n)=>yi(e,n.filter(s=>s.status!=="cancelled")),Xe=e=>e.actions.includes("set_key")||e.actions.includes("add_key");function ki(e,n){const s=Math.max(0,Math.round((e-n)/1e3));if(s<60)return"just now";const a=Math.round(s/60);if(a<60)return`${a} min ago`;const o=Math.round(a/60);return o<24?`${o} h ago`:`${Math.round(o/24)} d ago`}function ot(e){if(!e)return null;const n=e.trim();if(!n||/^\/\w/.test(n)||/\/mcp\s+\w+/.test(n))return null;let s=n;for(let a=0;a<3;a+=1){const o=s.replace(/^(?:connection (?:closed|error|refused)|error|closed|failed)\s*:\s*/i,"").trim();if(o===s)break;s=o}return s=s.replace(/\s*\(\s*\d{3}\s*\)/g,"").replace(/\s+([.,;])/g,"$1").replace(/\s{2,}/g," ").trim(),s||null}function vi(e,n=[],s,a=Date.now()){const o=Ae(s,e.name),r=Ee(e.name,n);if(r){if(r.action==="login"||r.action==="reauth")return{label:"Signing in…",tone:"info",detail:null,busy:!0};if(r.action==="logout")return{label:"Signing out…",tone:"info",detail:null,busy:!0}}if(!jn(e.status))return{label:"Status unavailable",tone:"neutral",detail:null,busy:!1};const l=ze(e.name,n,o),u=et(l)&&e.status!=="connected",c=wt(e,o),m=St(l)&&e.status!=="connected",y=(l?.action==="login"||l?.action==="reauth")&&l.status==="failed";if(o.disconnectedAt!==null)return{label:"Not connected",tone:"neutral",detail:null,busy:!1};switch(e.status){case"connected":return{label:typeof e.tool_count=="number"?`Connected · ${We(e.tool_count)}`:"Connected",tone:"success",detail:null,busy:!1};case"connecting":return{label:"Connecting…",tone:"info",detail:null,busy:!0};case"needs_sign_in":return{label:e.auth.kind==="api_key"||$e(e,n,o)?"Needs a key":"Needs sign-in",tone:"warning",detail:ot(e.status_reason),busy:!1};case"error":return{label:"Couldn't start",tone:"danger",detail:ot(e.status_reason)??"No reason was given.",busy:!1};default:if(u)return{label:"Signed out",tone:"warning",detail:null,busy:!1};if(m)return{label:"Sign-out didn't finish",tone:"warning",detail:"The sign-in is still saved.",busy:!1};if($e(e,n,o))return{label:"Needs a key",tone:"warning",detail:null,busy:!1};if(y)return{label:"Sign-in didn't finish",tone:"warning",detail:null,busy:!1};if(o.needsSignIn)return{label:e.auth.kind==="api_key"||$e(e,n,o)?"Needs a key":"Needs sign-in",tone:"warning",detail:ot(e.status_reason),busy:!1};if(e.status_basis==="stored"&&c&&o.disconnectedAt===null){const j=o.connectedAt??wn(e.last_seen_at,a);return{label:j!==null?`Worked ${ki(a,j)} · ${We(e.tool_count)}`:`Worked earlier · ${We(e.tool_count)}`,tone:"success",detail:null,busy:!1}}return e.status_basis==="live"?{label:"Not connected",tone:"neutral",detail:null,busy:!1}:{label:"Ready",tone:"neutral",detail:null,busy:!1}}}const _n=e=>e===1?"Replace the saved key":"Replace saved keys",bi=/[,;]?\s*(?:or|and)?\s*add (?:its|a|the) key instead\.?\s*$/i;function ji(e,n){const s=e?.trim()??"";if(!s)return null;if(n)return s;const a=s.replace(bi,"").trim();return a?/\.$/.test(a)?a:`${a}.`:s}const wi="Nothing is wrong. It starts when a chat uses it.",_i="Not running in this chat.",Ni=e=>e.transport==="local_command"?"Local command":"Remote URL";function Nn(e){switch(e.source.kind){case"local-operator":case"project-mcp-json":return null;case"claude-code":return"Claude Code";case"cursor":return"Cursor";case"vscode":return"VS Code";case"codex":return"Codex CLI";default:return bn(e.source.path)}}function Si(e,n){const s=[Ni(e)];e.status!=="connected"&&e.tool_count_basis==="last_seen"&&typeof e.tool_count=="number"&&s.push(`${We(e.tool_count)} when last checked`),n&&s.push(e.scope==="project"?"This project":"Global");const a=Nn(e);return a?s.push(`Imported from ${a}`):e.source.editable||s.push("Imported from a project file"),s}const _t=(e,n)=>n.disconnectedAt!==null?"not_started":e.status;function Nt(e,n=[],s){const a=Ae(s,e.name),o=Ee(e.name,n);if(o)return o.action==="login"||o.action==="reauth"?{kind:"sign_in",label:"Continue sign-in"}:null;const r=y=>e.actions.includes(y),l=Xe(e),u=$e(e,n,a);if(!jn(e.status))return r("test")?{kind:"test",label:"Check again"}:null;const c=ze(e.name,n,a),m=c?.status==="failed"&&Ke(c);switch(_t(e,a)){case"connected":case"connecting":return null;case"needs_sign_in":return u?{kind:"set_key",label:"Add key"}:r("sign_in")?{kind:"sign_in",label:"Sign in"}:l?{kind:"set_key",label:"Add key"}:r("reauth")?{kind:"reauth",label:"Sign in again"}:{kind:"fix",label:"Fix"};case"error":return r("connect")?{kind:"connect",label:"Reconnect"}:r("test")?{kind:"test",label:"Retry"}:{kind:"fix",label:"Fix"};default:{if(et(c)&&r("sign_in"))return{kind:"sign_in",label:"Sign in"};if(St(c)&&r("sign_out"))return{kind:"sign_out",label:"Sign out again"};if(a.disconnectedAt!==null&&r("connect"))return{kind:"connect",label:"Connect"};if(a.needsSignIn){if(u&&l)return{kind:"set_key",label:"Add key"};if(r("sign_in"))return{kind:"sign_in",label:"Sign in"}}return u&&l?{kind:"set_key",label:"Add key"}:m&&r("sign_in")?{kind:"sign_in",label:"Try again"}:wt(e,a)&&!r("connect")?null:r("connect")?{kind:"connect",label:"Connect",...a.connectedAt===null&&e.status_basis!=="live"?{variant:"ghost"}:{}}:r("test")&&e.tool_count===null&&e.tool_count_basis===null?{kind:"test",label:"Test",variant:"ghost"}:null}}}const Ke=e=>e.action==="login"||e.action==="reauth",et=e=>!!(e&&e.action==="logout"&&e.status==="complete"),St=e=>!!(e&&e.action==="logout"&&e.status!=="running"&&e.status!=="complete"),Sn=/no oauth authorization server/i;function $e(e,n,s){if(!Xe(e))return!1;const a=ze(e.name,n,s);return a&&Ke(a)&&a.status==="failed"&&Sn.test(a.message??"")?!0:s.needsKey}function Ci(e,n=[],s){const a=Nt(e,n,s)?.kind,o=_t(e,Ae(s,e.name)),r=c=>e.actions.includes(c),l=[],u=Ee(e.name,n);if(u&&l.push({kind:"cancel",label:"Cancel"}),!u&&r("test")&&a!=="test"&&l.push({kind:"test",label:"Test connection"}),r("connect")&&a!=="connect"&&o!=="connected"&&l.push({kind:"connect",label:"Reconnect"}),!u&&r("sign_in")&&a!=="sign_in"&&o!=="connected"&&l.push({kind:"sign_in",label:"Sign in"}),r("reload")&&l.push({kind:"reload",label:"Reload"}),!u&&r("reauth")&&a!=="reauth"&&l.push({kind:"reauth",label:"Sign in again"}),Xe(e)&&a!=="set_key"&&l.push({kind:"set_key",label:e.auth.secret_refs.length>0?"Update key":"Add key"}),r("sign_out")&&l.push({kind:"sign_out",label:"Sign out"}),r("disconnect")&&o==="connected"&&l.push({kind:"disconnect",label:"Disconnect"}),r("copy_setup")&&e.setup_prompt&&l.push({kind:"copy_setup",label:"Copy setup prompt"}),a!=="fix"&&l.push({kind:"open_config",label:"Open config file"}),r("remove"))l.push({kind:"remove",label:"Remove",destructive:!0});else if(!e.source.editable){const c=Nn(e);l.push({kind:"remove_elsewhere",label:c?`Remove in ${c}`:"Remove in its own file",hint:c?`Defined in ${c}'s config. Remove it there.`:"Defined in a file this app doesn't write. Remove it there."})}return l}const Mi={attention:"Needs attention",connected:"Connected",ready:"Available"};function Cn(e,n=[],s){const a=Ae(s,e.name),o=Ee(e.name,n),r=_t(e,a);if(o&&a.pinnedGroup&&a.pinnedOperationId===o.id)return a.pinnedGroup;if(r==="needs_sign_in"||r==="error")return"attention";const l=ze(e.name,n,a);return et(l)&&r!=="connected"||St(l)&&r!=="connected"?"attention":a.disconnectedAt!==null?"ready":$e(e,n,a)||a.needsSignIn&&r!=="connected"||l?.status==="failed"&&Ke(l)&&r!=="connected"?"attention":r==="connected"||e.status_basis==="stored"&&wt(e,a)?"connected":o&&o.action!=="test"?"attention":"ready"}function Ai(e,n=[],s){return["attention","connected","ready"].map(o=>({id:o,title:Mi[o],rows:e.filter(r=>Cn(r,n,s)===o)})).filter(o=>o.rows.length>0)}function Ri(e,n,s=Date.now()){if(!n)return e??{};const a={};for(const o of n.servers){const r=Ae(e,o.name),l=Ee(o.name,n.operations),u=ze(o.name,n.operations,r),c=et(u),m=o.status==="connected"&&(o.status_basis==="probe"||o.status_basis==="live"),y=r.holdUntil!==null&&s<r.holdUntil,j=!y&&!c&&r.connectedAt===null&&o.status_basis==="stored"&&o.tool_count_basis==="last_seen"?wn(o.last_seen_at,s):null,b=!c,h=u?.status==="failed"&&Ke(u)&&Sn.test(u.message??""),f={connectedAt:m&&!y?s:j!==null?j:b?r.connectedAt:null,connectedToolCount:m&&!y||j!==null?o.tool_count??r.connectedToolCount:b?r.connectedToolCount:null,settledGroup:r.settledGroup,pinnedGroup:l&&r.pinnedOperationId===l.id?r.pinnedGroup:l?r.settledGroup:null,pinnedOperationId:l?l.id:null,needsKey:m?!1:r.needsKey||h,needsSignIn:m||c?!1:r.needsSignIn||o.status==="needs_sign_in",disconnectedAt:m&&!y?null:r.disconnectedAt,holdUntil:y?r.holdUntil:null,lastDecisive:u?gi(u):null};l||(f.settledGroup=Cn(o,n.operations,{...a,[o.name]:f})),a[o.name]=f}return a}const Ti=(e,n)=>e!==null&&n===e,yt="local-operator.settings.integrations.row-memory",Mn=(e,n)=>`${e}#${n}`;function Ei(e,n){const s={};if(!n)return s;for(const a of n.servers){const o=e[a.name];o&&(s[Mn(a.source.path,a.name)]=o)}return s}function Ii(e,n,s){if(!n)return e;let a=null;for(const o of n.servers){if(Object.prototype.hasOwnProperty.call(e,o.name))continue;const r=Fi(s[Mn(o.source.path,o.name)]);r&&(a=a??{...e},a[o.name]=r)}return a??e}const Li=["attention","connected","ready"],An=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Ct=e=>typeof e=="number"&&Number.isFinite(e)?e:null,Ht=e=>Li.includes(e)?e:null,rt=e=>{const n=Ct(e);return n!==null&&n>=1e12?n:null};function Oi(e){if(!An(e)||typeof e.id!="string"||typeof e.name!="string")return null;const n=e.action,s=e.status;return n!=="login"&&n!=="logout"&&n!=="reauth"&&n!=="test"||s!=="running"&&s!=="complete"&&s!=="cancelled"&&s!=="failed"?null:{id:e.id,name:e.name,action:n,status:s,created_at:Ct(e.created_at)??0,credential_removed:e.credential_removed===!0,...typeof e.message=="string"?{message:e.message}:{}}}function Fi(e){if(!An(e))return null;const n=rt(e.connectedAt),s=rt(e.disconnectedAt),a=e.needsKey===!0,o=e.needsSignIn===!0,r=Oi(e.lastDecisive);return n===null&&s===null&&!a&&!o&&!r?null:{connectedAt:n,connectedToolCount:Ct(e.connectedToolCount),settledGroup:Ht(e.settledGroup),pinnedGroup:Ht(e.pinnedGroup),pinnedOperationId:typeof e.pinnedOperationId=="string"?e.pinnedOperationId:null,needsKey:a,needsSignIn:o,disconnectedAt:s,holdUntil:rt(e.holdUntil),lastDecisive:r}}const Rn=2e3,Vt=8e3;function Di(e){return e&&(e.servers.some(s=>s.status==="connecting")||e.operations.some(s=>s.status==="running"))?Rn:!1}const $i=/^[A-Za-z0-9_.:-]{1,100}$/,Ui=/:\/\//;function Pi(e,n){const s=e.trim();return s?$i.test(s)?n.includes(s)?`An integration named ${s} already exists.`:null:"Use letters, numbers, dots, dashes, underscores or colons, with no spaces.":"Give it a name."}function zi(e){const n=e.trim();if(!n)return"Enter the server's URL.";let s;try{s=new URL(n)}catch{return"Enter a full URL, like https://mcp.example.com/mcp."}return s.protocol!=="https:"&&s.protocol!=="http:"?"The URL must start with https:// or http://.":s.hostname?s.username||s.password?"Remove the username or password from the URL. Keys are added after it's saved.":s.search||s.hash?"Remove the ? or # part of the URL. Keys are added after it's saved.":Ui.test(n.slice(s.protocol.length+2))?"This looks like two URLs pasted together. Enter just one.":null:"The URL needs a host name."}const Ki=e=>e.split(`
292
+ `).map(n=>n.trim()).filter(Boolean);function xt(e,n){const s=!!e?.cold,a=(e?.servers??[]).map(o=>{const r=o.transport==="http",l=o.secret_refs??[],u=o.status==="connected"?"connected":o.status==="connecting"?"connecting":o.status==="auth-required"?"needs_sign_in":"not_started",c=[];u!=="connected"&&c.push("connect"),u==="connected"&&c.push("disconnect"),s||c.push("reload"),r&&o.transport_oauth_supported!==!1&&c.push("sign_in"),l.length>0&&c.push("set_key"),o.owned_scope&&c.push("remove"),o.setup?.text&&c.push("copy_setup");const m=bn(o.source);return{id:o.name,name:o.name,scope:o.owned_scope??"global",project_cwd:null,source:{kind:Bi(o.source,m,o.owned_scope),path:o.source??"",editable:o.owned_scope!==null,owned_scope:o.owned_scope},transport:r?"remote_url":"local_command",endpoint:{command:null,url:null,endpoint_redacted:!1},status:u,status_reason:null,status_observed_at:null,last_seen_at:null,status_basis:s?"stored":"live",auth:{kind:l.length?"api_key":r?"unknown":"none",signed_in:null,secret_refs:l.map(y=>({id:y.id,state:"missing"}))},tool_count:typeof o.tool_count=="number"?o.tool_count:null,tool_count_basis:typeof o.tool_count=="number"?"live":null,actions:c,setup_prompt:o.setup?.text??null}});return{cwd:"",project_scope_available:a.some(o=>o.source.owned_scope==="project"),global_path:"",project_path:null,status_source:s?"config":"live",session_id:n,servers:a,operations:(e?.operations??[]).map(o=>({...o}))}}const Bi=(e,n,s)=>n==="Claude Code"?"claude-code":n==="Cursor"?"cursor":n==="VS Code"?"vscode":n==="Codex CLI"?"codex":s?"local-operator":e?"project-mcp-json":"local-operator",Gt={invalid_config:"That configuration isn't valid. Check the command or the URL, then try again.",operation_unavailable:"That sign-in or test isn't running any more. Try again.",exists:"An integration with this name already exists. Choose another name.",not_owned:"It's defined in another tool's config, so it can't be changed here. Edit it in that file.",project_scope_unavailable:"There's no separate project config here, so it can only be added globally.",unknown_server:"It no longer exists. The list has been refreshed.",oauth_unsupported:"It doesn't use browser sign-in.",grant_running:"A sign-in or test is already running. Wait for it to finish, or cancel it.",too_many_operations:"Too many sign-ins and tests are waiting. Try again in a moment.",write_failed:"The config file couldn't be written. Check that it isn't read-only.",mcp_starting:"Integrations are still starting. Try again in a moment.",mcp_control_refused:"The server refused it, so nothing was changed."},Hi="The server refused it, so nothing was changed. Try again.";function Ge(e,n,s){if(n instanceof jt&&n.status===409){const a=typeof n.code=="string"&&Object.prototype.hasOwnProperty.call(Gt,n.code)?Gt[n.code]:Hi;return`${ts[e]}. ${a}`}return ns(e,n,s).message}const Vi="New chats can use it right away. Open chats pick it up when you start a new chat or reload integrations there.",Gi="Most services give you a URL. Use Local command when their setup says npx or uvx.",qi=({existingNames:e,projectScopeAvailable:n,projectLabel:s,onSubmit:a,onCancel:o,initial:r})=>{const[l,u]=i.useState(r?.name??""),[c,m]=i.useState(r?.mode??"command"),[y,j]=i.useState(r?.command??""),[b,h]=i.useState(r?.args??""),[f,M]=i.useState(r?.url??""),[S,V]=i.useState("global"),[_,B]=i.useState(r?.touched?{name:!0,command:!0,url:!0}:{}),[U,A]=i.useState(!!r?.touched),[C,Y]=i.useState(!1),[q,Z]=i.useState(null),T=i.useRef(null),ee=i.useRef(null),I=i.useRef(null);i.useEffect(()=>{T.current?.focus()},[]);const D=Pi(l,e),L=c==="command"&&!y.trim()?"Enter the command to run.":null,z=c==="url"?zi(f):null,K=k=>U||_[k],se=async k=>{if(k.preventDefault(),A(!0),D||L||z){D?T.current?.focus():L?ee.current?.focus():I.current?.focus();return}Y(!0),Z(null);const H=n?S:"global",G=c==="command"?{name:l.trim(),scope:H,mode:c,command:y.trim(),args:Ki(b)}:{name:l.trim(),scope:H,mode:c,url:f.trim()},Q=await a(G);Y(!1),Z(Q)},p=(k,H,G)=>H&&K(G)?t.jsx("p",{id:k,className:"text-body-sm text-danger",children:H}):null,E=k=>k.preventDefault();return t.jsxs("form",{noValidate:!0,"aria-label":"Add integration",className:"flex flex-col gap-4 rounded-lg bg-surface p-4",onSubmit:k=>void se(k),onKeyDown:k=>{k.key==="Escape"&&(k.stopPropagation(),o())},children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(fe,{htmlFor:"integration-add-name",children:"Name"}),t.jsx(Me,{ref:T,id:"integration-add-name",value:l,placeholder:"e.g. notion",autoComplete:"off","aria-invalid":!!(D&&K("name")),"aria-describedby":D&&K("name")?"integration-add-name-error":void 0,onChange:k=>u(k.target.value),onBlur:()=>B(k=>({...k,name:!0}))}),p("integration-add-name-error",D,"name")]}),t.jsxs(pt,{value:c,onValueChange:k=>m(k==="url"?"url":"command"),className:"flex flex-col gap-1.5",children:[t.jsx("span",{id:"integration-add-transport-label",className:"font-medium text-body-sm text-ink",children:"How it runs"}),t.jsxs(gt,{"aria-labelledby":"integration-add-transport-label",children:[t.jsx(De,{value:"command","data-integration-transport":"command",children:"Local command"}),t.jsx(De,{value:"url","data-integration-transport":"url",children:"Remote URL"})]}),t.jsx("p",{className:"text-ink-dim text-meta",children:Gi}),t.jsxs(Ut,{value:"command",className:"mt-0 flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(fe,{htmlFor:"integration-add-command",children:"Command"}),t.jsx(Me,{ref:ee,id:"integration-add-command",value:y,placeholder:"e.g. npx",autoComplete:"off",className:"font-mono","aria-invalid":!!(L&&K("command")),"aria-describedby":L&&K("command")?"integration-add-command-error":void 0,onChange:k=>j(k.target.value),onBlur:()=>B(k=>({...k,command:!0}))}),p("integration-add-command-error",L,"command")]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs(fe,{htmlFor:"integration-add-args",children:["Arguments"," ",t.jsx("span",{className:"font-normal text-ink-dim",children:"(one per line)"})]}),t.jsx(xn,{id:"integration-add-args",value:b,rows:2,className:"font-mono",onChange:k=>h(k.target.value)})]})]}),t.jsx(Ut,{value:"url",className:"mt-0 flex flex-col gap-4",children:t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(fe,{htmlFor:"integration-add-url",children:"URL"}),t.jsx(Me,{ref:I,id:"integration-add-url",type:"url",value:f,placeholder:"https://mcp.example.com/mcp",autoComplete:"off",className:"font-mono","aria-invalid":!!(z&&K("url")),"aria-describedby":z&&K("url")?"integration-add-url-error":"integration-add-url-help",onChange:k=>M(k.target.value),onBlur:()=>B(k=>({...k,url:!0}))}),p("integration-add-url-error",z,"url")??t.jsx("p",{id:"integration-add-url-help",className:"text-ink-dim text-meta",children:"If it needs a sign-in or a key, you'll be asked after it's added."})]})})]}),n?t.jsxs(pt,{value:S,onValueChange:k=>V(k==="project"?"project":"global"),className:"flex flex-col gap-1.5",children:[t.jsx("span",{id:"integration-add-scope-label",className:"font-medium text-body-sm text-ink",children:"Available in"}),t.jsxs(gt,{"aria-labelledby":"integration-add-scope-label",children:[t.jsx(De,{value:"global","data-integration-scope":"global",children:"All chats"}),t.jsx(De,{value:"project","data-integration-scope":"project",children:"This project"})]}),s?t.jsx("p",{className:"text-ink-dim text-meta",children:S==="project"?`Only chats working in ${s}.`:"Every chat, in any folder."}):null]}):null,q?t.jsx("p",{className:"text-body-sm text-danger",role:"alert",children:q}):null,t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx("p",{className:ce("text-body-sm text-ink-dim"),children:Vi}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx($,{type:"button",variant:"ghost",size:"md",onMouseDown:E,onClick:o,children:"Cancel"}),t.jsxs($,{type:"submit",variant:"primary",size:"md",disabled:C,onMouseDown:E,children:[C?t.jsx(le,{size:"xs"}):null,"Add integration"]})]})]})]})},Yi=4;function Wi(e){return e.rowMoving?e.now+e.windowMs:Math.max(e.hold.until,e.lastMovingAt+e.windowMs)}function Zi(e){return e.now>e.hold.until||e.hold.reanchors>=Yi?"drop":e.hold.landedOn.isConnected&&(!e.candidate||e.candidate===e.hold.landedOn)?"settled":e.active&&e.active!==e.body&&e.active!==e.hold.landedOn?"drop":e.candidate?.isConnected?"restore":"drop"}function Qi(e){const n=Wi({hold:e.hold,now:e.now,windowMs:e.windowMs,rowMoving:e.rowMoving,lastMovingAt:e.lastMovingAt});if(e.now>n)return{hold:null,land:null};const s=e.hold.landedOn??null,a=e.candidate;if(!a)return{hold:{until:n,reanchors:e.hold.reanchors,landedOn:s},land:null};if(!s)return{hold:{until:n,reanchors:e.hold.reanchors,landedOn:a},land:a};const o=Zi({hold:{until:n,reanchors:e.hold.reanchors,landedOn:s},candidate:a,active:e.active,body:e.body,now:e.now});if(o==="settled")return{hold:{until:n,reanchors:e.hold.reanchors,landedOn:s},land:null};if(o==="drop")return{hold:null,land:null};const r=!s.isConnected;return{hold:{until:r?e.now+e.windowMs:n,reanchors:r?e.hold.reanchors+1:e.hold.reanchors,landedOn:a},land:a}}function Ji(e){const{row:n,target:s}=e;return!n||!s||typeof s.nodeType!="number"?!1:!n.contains(s)}const qt=250;function Yt(e){return e?!e.disabled:!1}function Xi(e){return Yt(e.primary)?e.primary??null:Yt(e.overflow)?e.overflow??null:null}function ec(e){return e.verdict==="finished"?null:e.watchMs}const Tn="key";function tc(e){const{name:n,keyless:s,freeName:a,names:o,values:r,replace:l,canReplace:u}=e;if(s){const c=kt(n,a);return{values:{[c]:(r[Tn]??"").trim()},confirmedReplace:l&&u?[c]:[],header:a.trim()}}return{values:Object.fromEntries(o.map(c=>[c,(r[c]??"").trim()])),confirmedReplace:l&&u?o:[],header:void 0}}function kt(e,n){const s=Wt(e),a=Wt(n);if(!a)return"";const o=[s,a].filter(Boolean).join("_"),r=/^[A-Za-z_]/.test(o)?o:`K_${o}`;if(r.length<=it)return r;const l=nc(s),u=it-a.length-l.length-2,c=[s.slice(0,Math.max(u,0)),l,a].filter(Boolean).join("_");return c.length<=it?c:c.slice(-128)}const it=128,Wt=e=>e.trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,""),nc=e=>{let n=2166136261;for(let s=0;s<e.length;s+=1)n^=e.charCodeAt(s),n=Math.imul(n,16777619)>>>0;return n.toString(36).toUpperCase().slice(0,5)},sc=({name:e,keyNames:n,keyless:s=!1,savedKeys:a=[],saving:o,failure:r,onSave:l,onClose:u})=>{const[c,m]=i.useState({}),[y,j]=i.useState(!1),[b,h]=i.useState(""),f=s?[kt(e,b)]:[...n],M=s?[Tn]:f,S=(s?kt(e,b).length>0:!0)&&M.every(_=>(c[_]??"").trim()),V=f.some(_=>a.includes(_));return t.jsx(cn,{open:!0,onClose:u,maxWidth:"xs",title:s||n.length===1?`Add the key for ${e}`:`Add keys for ${e}`,actions:t.jsxs(t.Fragment,{children:[t.jsx(dt,{onClick:u,children:"Cancel"}),t.jsx(ut,{disabled:!S||o,onClick:()=>{const _=tc({name:e,keyless:s,freeName:b,names:f,values:c,replace:y,canReplace:V});l(_.values,_.confirmedReplace,_.header)},children:o?"Saving…":"Save and test"})]}),children:t.jsxs("div",{className:"flex flex-col gap-3 p-1.5 text-body text-ink-muted",children:[t.jsx("p",{className:"-mx-1.5",children:s?"Keys are saved encrypted on this computer. This one is stored under a name derived from this integration, so no other server shares it.":"Keys are saved encrypted on this computer. Other integrations that use the same key name share it."}),s?t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(fe,{htmlFor:"integration-key-name",children:"The header this server wants the key in"}),t.jsx(Me,{id:"integration-key-name",autoComplete:"off",placeholder:"e.g. Authorization or X-Api-Key",value:b,onChange:_=>h(_.target.value)}),t.jsx("p",{className:"-mx-1.5 text-ink-dim text-meta",children:"This server declares no key of its own, so Local Operator adds one to its config for you."})]}):null,M.filter(_=>s!==!0||_.trim().length>0).map(_=>t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(fe,{htmlFor:`integration-key-${_}`,className:"font-mono",children:s?"Key":_}),t.jsx(Me,{id:`integration-key-${_}`,type:"password",autoComplete:"off",value:c[_]??"",onChange:B=>m(U=>({...U,[_]:B.target.value}))})]},_)),V?t.jsxs("div",{className:"flex items-center gap-2 text-body-sm",children:[t.jsx(va,{id:"integration-key-replace",checked:y,onCheckedChange:_=>j(_===!0)}),t.jsx(fe,{htmlFor:"integration-key-replace",className:"font-normal",children:_n(f.length)})]}):null,r?t.jsx("p",{className:"-mx-1.5 text-body-sm text-danger",role:"alert",children:r}):null]})})},ac={success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info",neutral:"bg-ink-dim"},oc={success:"text-ink-muted",warning:"text-warning",danger:"text-danger",info:"text-ink-muted",neutral:"text-ink-dim"},Zt={Ready:wi,"Not connected":_i},rc=({row:e,operations:n,memories:s,now:a,projectScopeAvailable:o,highlighted:r=!1,rowRef:l,primaryRef:u,overflowRef:c,pending:m,failure:y,confirm:j,onPrimary:b,onOverflow:h,onConfirm:f,onCancelConfirm:M})=>{const S=vi(e,n,s,a),V=r&&S.tone==="danger"?"text-ink":oc[S.tone],_=Nt(e,n,s),B=Ci(e,n,s),U=Si(e,o),A=B.findIndex(C=>C.kind==="remove"||C.kind==="remove_elsewhere");return t.jsxs("li",{ref:l,"data-integration":e.name,"data-status":e.status,className:ce("flex min-h-14 flex-col justify-center gap-1 px-4 py-2.5",r&&"bg-row-selected"),onKeyDown:C=>{!j||C.key!=="Escape"||(C.stopPropagation(),M())},children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center",children:S.busy?t.jsx(le,{size:"xs"}):t.jsx("span",{"aria-hidden":"true","data-tone":S.tone,className:ce("size-2 rounded-full",ac[S.tone])})}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[t.jsx("span",{className:"truncate font-medium text-body text-ink",title:e.name,children:e.name}),t.jsx("span",{className:"truncate text-ink-dim text-meta",children:U.map((C,Y)=>t.jsxs("span",{children:[Y>0?" · ":null,C.startsWith("Imported from")&&e.source.path?t.jsx(Ue,{content:ss(e.source.path),children:t.jsx("span",{className:"underline decoration-dotted underline-offset-2",children:C})}):C]},C))})]}),Zt[S.label]?t.jsx(Ue,{content:Zt[S.label],children:t.jsx("span",{className:ce("shrink-0 text-body-sm",V),children:S.label})}):t.jsx("span",{className:ce("shrink-0 text-body-sm",V),children:S.label}),_?t.jsxs($,{ref:u,variant:_.variant??"secondary",size:"sm","aria-label":`${_.label} ${e.name}`,disabled:m,"data-integration-action":_.kind,onClick:()=>b(_),children:[m?t.jsx(le,{size:"xs"}):null,_.label]}):null,t.jsxs(ba,{children:[t.jsx(ja,{asChild:!0,children:t.jsx($,{ref:c,variant:"ghost",size:"icon-sm","aria-label":`More actions for ${e.name}`,disabled:m,children:t.jsx(as,{"aria-hidden":"true"})})}),t.jsx(wa,{align:"end",className:"min-w-48",children:B.map((C,Y)=>t.jsx(ic,{item:C,separated:Y===A&&Y>0,onSelect:()=>h(C)},C.kind))})]})]}),S.detail?t.jsx("p",{className:ce("pl-7 text-body-sm",S.tone==="danger"?"text-ink-muted":"text-ink-dim"),children:S.detail}):null,y?t.jsx("p",{className:ce("pl-7 text-body-sm",r?"text-ink":"text-danger"),role:"alert",children:y}):null,j?t.jsxs("div",{className:"flex flex-wrap items-center gap-2 pl-7",children:[t.jsx("span",{className:"text-body-sm text-ink",children:j.kind==="remove"?`Remove ${e.name}?`:`Sign out of ${e.name}?`}),t.jsx("span",{className:"text-body-sm text-ink-muted",children:j.kind==="remove"?`Agents in every chat lose access to ${e.name}.`:e.auth.kind==="oauth"?"The saved sign-in is removed too.":"Its saved credential is removed too."}),t.jsx($,{variant:"danger",size:"sm",onClick:f,"data-integration-confirm":j.kind,children:j.kind==="remove"?"Remove":"Sign out"}),t.jsx($,{variant:"ghost",size:"sm",onClick:M,children:"Keep"})]}):null]})},ic=({item:e,separated:n,onSelect:s})=>t.jsxs(t.Fragment,{children:[n?t.jsx(_a,{}):null,e.kind==="remove_elsewhere"?t.jsxs(Pt,{disabled:!0,className:"flex-col items-start gap-0.5",children:[t.jsx("span",{children:e.label}),t.jsx("span",{className:"text-meta text-ink-dim",children:e.hint})]}):t.jsx(Pt,{destructive:e.kind==="remove",onSelect:s,"data-integration-menu":e.kind,children:e.label})]});function cc(e,n,s){return!n||n.status==="running"?n?.browser_opened===!0?{message:`Your browser opened. Approve access to ${e} there, then come back here.`,tone:"progress",link:n.authorization_url??null}:n?.browser_opened===!1?{message:n.authorization_url?"Your browser didn't open. Open this link to approve access:":"Your browser didn't open, and no link was provided. Cancel and try again.",tone:"progress",link:n.authorization_url??null}:{message:`Waiting for you to approve access to ${e}…`,tone:"progress",link:n?.authorization_url??null}:n.status==="complete"?{message:`Signed in to ${e}. Agents can use it now.`,tone:"success",link:null}:n.status==="cancelled"?{message:"Sign-in cancelled.",tone:"failure",link:null,reason:null,nextStep:"Press Try again when you are ready."}:{message:"Sign-in didn't finish.",tone:"failure",link:null,reason:ji(n.message,s)??"The server didn't say why.",nextStep:lc(n.message??null,s)}}function lc(e,n){const s=(e??"").toLowerCase();return s.includes("redirect")?n?"This server may not accept sign-ins from Local Operator. Check the server's settings, or add a key instead.":"This server may not accept sign-ins from Local Operator. Check the server's settings, then try again.":s.includes("no oauth")||s.includes("authorization server")?n?"This server doesn't publish a browser sign-in. Add its key instead.":"This server doesn't publish a browser sign-in. Check the server's settings, then try again.":s.includes("network")||s.includes("connect")?"Check the server's URL and your network, then try again.":"Check the server's settings, then try again."}function dc(e,n){return e.kind==="ready"?"ready":e.kind==="running"&&n&&n.tone!=="progress"?n.tone==="success"?"success":"failure":"running"}const uc=({name:e,action:n,keyRoute:s,phase:a,onStart:o,onCancel:r,onOpenLink:l,onClose:u})=>{const c=a.kind==="running"?a.operation:null,m=a.kind==="running"?cc(e,c,s):null,y=a.kind==="starting"||a.kind==="running"&&m?.tone==="progress",j=m&&m.tone!=="progress",b=i.useRef(null),h=i.useRef(!1),f=dc(a,m);i.useEffect(()=>{if(!h.current){h.current=!0;return}f&&b.current?.focus()},[f]);const M=()=>u(m?.tone==="success"?"signed-in":"dismissed");return t.jsx(cn,{open:!0,onClose:M,maxWidth:"xs",fullWidth:!0,title:`Sign in to ${e}`,dialogProps:{onOpenAutoFocus:S=>{S.preventDefault(),b.current?.focus()}},actions:t.jsxs(t.Fragment,{children:[y&&c?t.jsx(dt,{ref:b,onClick:()=>r(c.id),children:"Cancel sign-in"}):t.jsx(dt,{ref:a.kind==="ready"?void 0:b,onClick:M,children:m?.tone==="success"?"Done":"Close"}),a.kind==="ready"?t.jsx(ut,{ref:b,onClick:o,children:"Continue in browser"}):null,a.kind==="refused"||m?.tone==="failure"?t.jsx(ut,{ref:m?.tone==="failure"?b:void 0,onClick:o,children:"Try again"}):null]}),children:t.jsxs("div",{className:"flex flex-col gap-3 p-1.5 text-body text-ink-muted","aria-live":"polite",children:[a.kind==="ready"?t.jsxs("p",{className:"-mx-1.5",children:["Local Operator opens your browser so you can approve access to"," ",e,".",n==="reauth"?" This replaces the sign-in it has now.":""]}):null,a.kind==="starting"?t.jsxs("p",{className:"-mx-1.5 flex items-center gap-2",children:[t.jsx(le,{size:"xs"}),"Starting sign-in…"]}):null,m?t.jsxs("div",{className:"flex flex-col gap-1",role:j?"status":void 0,children:[t.jsxs("p",{className:(m.tone==="success","-mx-1.5 flex items-start gap-2 text-ink"),children:[m.tone==="progress"?t.jsx(le,{size:"xs",className:"mt-0.5"}):null,m.tone==="failure"?t.jsx(Na,{"aria-hidden":"true",className:"mt-0.5 size-4 shrink-0 text-danger"}):null,t.jsx("span",{children:m.message})]}),m.reason?t.jsx("p",{className:"-mx-1.5 text-ink-muted",children:m.reason}):null,m.nextStep?t.jsx("p",{className:"-mx-1.5 text-ink-muted",children:m.nextStep}):null]}):null,m?.link&&m.tone==="progress"?t.jsxs("div",{className:"flex flex-col items-start gap-1",children:[t.jsxs("div",{className:"flex w-full min-w-0 items-center gap-1",children:[t.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-ink-dim text-mono-sm",title:m.link,children:m.link}),t.jsx($,{variant:"ghost",size:"icon-sm","aria-label":"Copy the sign-in link",title:"Copy the sign-in link",onClick:()=>{navigator.clipboard.writeText(m.link??"").then(()=>mt("Sign-in link copied.")).catch(()=>{})},children:t.jsx(os,{"aria-hidden":"true"})})]}),t.jsx($,{variant:"link",size:"sm",onClick:()=>l(m.link??""),children:"Open the sign-in page"})]}):null,a.kind==="refused"?t.jsx("p",{className:"text-danger",role:"alert",children:a.message}):null]})})},mc=e=>e.reduce((n,s)=>n?(s.updated_at??0)>(n.updated_at??0)?s:n:s,null),hc=/^[A-Za-z]:[\\/]/,Ze=e=>{const n=e?.trim();return n&&(n.startsWith("/")||hc.test(n))?n:null};function fc(e){const o=e?.payload?.frontend?.snapshot?.cwd;return typeof o=="string"&&o.trim()?o:null}const Pe="local-operator.settings.integrations.last-cwd";function pc(e,n,s=typeof localStorage>"u"?null:localStorage){const a=Ze(n);if(!(!e||!a||!s))try{const o=s.getItem(Pe),r=o?JSON.parse(o):{};if(r[e]===a)return;s.setItem(Pe,JSON.stringify({...r,[e]:a}))}catch{}}const En=()=>typeof localStorage>"u"?null:localStorage;function In(e=En()){if(!e)return{};try{const n=e.getItem(yt);if(!n)return{};const s=JSON.parse(n);return!s||typeof s!="object"||Array.isArray(s)?{}:s}catch{return{}}}const Qt=256;function gc(e,n=En()){if(n)try{const s={...In(n),...e},a=Object.keys(s);if(a.length>Qt){const o={};for(const r of a.slice(-Qt))o[r]=s[r];n.setItem(yt,JSON.stringify(o));return}n.setItem(yt,JSON.stringify(s))}catch{}}function Jt(e,n,s){return e==="saved"?null:e==="replace_confirmation_required"?`A saved value already exists for this key. Tick “${_n(Object.keys(s).length)}” to overwrite it.`:e==="invalid_target"?"That header can't carry this key. It may already be set on the server, or belong to the transport - try a different header name. Nothing was saved.":`Not saved: ${(n.length?n:Object.keys(s)).join(", ")}. The encrypted store may be locked.`}function yc(e,n=typeof localStorage>"u"?null:localStorage){if(!(!e||!n))try{const s=n.getItem(Pe);if(!s)return;const a=JSON.parse(s);if(!(e in a))return;const o={...a};delete o[e],n.setItem(Pe,JSON.stringify(o))}catch{}}const xc=e=>!!(e&&typeof e=="object"&&"code"in e&&e.code==="invalid_cwd"),kc=(e,n)=>n!==null&&e===n?null:e;function vc(e,n=typeof localStorage>"u"?null:localStorage){if(!e||!n)return null;try{const s=n.getItem(Pe);if(!s)return null;const o=JSON.parse(s)[e];return typeof o=="string"?o:null}catch{return null}}const bc=e=>e.action==="disconnect"?"disconnected":"connected";function jc(e){switch(e.action){case"cancel":return{action:"cancel",operation_id:e.operationId};case"connect":case"disconnect":case"reload":return null;case"test":return{action:"test",name:e.name};default:return{...e,confirmed:!0}}}function wc(e){switch(e.action){case"cancel":return{action:"cancel",operation_id:e.operationId};case"test":case"connect":return{action:"connect",name:e.name};case"reload":return{action:"reload",name:e.name};case"add":return e;case"remove":return{...e,confirmed:!0};default:return{action:e.action,name:e.name,confirmed:!0}}}function _c({sessionId:e}){const n=ln(),s=It(n.data,"mcp_catalog"),a=It(n.data,"mcp"),o=s?"catalog":a?"session":null,[r,l]=i.useState(null),u=an(),c=qe(v=>v.sessions),m=qe(v=>v.fetchSessions),y=qe(v=>v.loading),j=i.useMemo(()=>c.find(v=>v.session_id===e)??null,[c,e]),b=i.useMemo(()=>o==="session"&&!e?mc(c):null,[o,e,c]),h=o==="session"?e??b?.session_id??null:null;i.useEffect(()=>{o!=="session"||e||c.length>0||m(rs)},[o,e,c.length,m]);const f=o==="catalog"?Ze(j?.cwd):null,M=o==="catalog"&&!!e&&f===null,S=be({queryKey:["desktop","session-cwd",e??""],queryFn:()=>ke({op:"sessions.get",sessionId:e??""}),enabled:M,staleTime:Number.POSITIVE_INFINITY,retry:!1}),V=M&&!S.isFetched,_=f??Ze(fc(S.data))??(S.isFetched?Ze(vc(e)):null),B=kc(_,r),U=o==="catalog"?B:null,A=o==="catalog"?e??null:null,C=is.catalog(U,A);i.useEffect(()=>{o!=="catalog"||!e||!U||pc(e,U)},[o,e,U]);const Y=i.useRef(0),[q,Z]=i.useState(0),T=i.useRef(null),ee=i.useCallback((v,R)=>{const g=Date.now()+Vt;Y.current=g,T.current={name:v,expect:R},Z(g)},[]),I=i.useCallback(v=>Date.now()<Y.current?Rn:Di(v),[]),D=be({queryKey:C,queryFn:()=>ds(U,A),enabled:o==="catalog"&&!V,staleTime:1e4,refetchInterval:v=>I(v.state.data)}),L=xc(D.error);i.useEffect(()=>{!L||!_||r===_||(l(_),yc(e))},[L,_,r,e]);const z=be({queryKey:ht.list(h??""),queryFn:()=>us(h??""),enabled:o==="session"&&!!h,staleTime:1e4,refetchInterval:v=>I(v.state.data?xt(v.state.data,h??""):void 0)}),K=i.useMemo(()=>{if(o==="catalog")return D.data;if(o==="session"&&z.data&&h)return xt(z.data,h)},[o,D.data,z.data,h]),se=i.useCallback(()=>Nc({queryClient:u,route:o,catalogKey:C,sessionId:h}),[o,C,u,h]);i.useEffect(()=>{if(!q)return;const v=T.current;if(!v)return;const R=K?.servers.find(O=>O.name===v.name);!R||!(v.expect==="connected"?R.status==="connected":R.status_basis==="live"&&R.status!=="connected")||(Y.current=0,T.current=null,Z(0))},[K,q]);const p=i.useRef({}),[E,k]=i.useState(0),H=i.useMemo(()=>(p.current=Ri(Ii(p.current,K,In()),K),p.current),[K,E]),G=i.useRef("");i.useEffect(()=>{const v=Ei(H,K);if(!Object.keys(v).length)return;const R=JSON.stringify(v);R!==G.current&&(G.current=R,gc(v))},[H,K]);const Q=i.useCallback(v=>{const R=Ae(p.current,v);R.needsKey||(p.current={...p.current,[v]:{...R,needsKey:!0}},k(g=>g+1))},[]),J=i.useCallback(v=>{if(v.action!=="disconnect"&&v.action!=="connect"&&v.action!=="reload")return;const R=Ae(p.current,v.name),g=Date.now()+Vt,O=v.action==="disconnect"?{...R,connectedAt:null,disconnectedAt:Date.now(),holdUntil:g}:{...R,disconnectedAt:null,holdUntil:g};p.current={...p.current,[v.name]:O},ee(v.name,bc(v)),k(F=>F+1)},[ee]),W=i.useCallback(async v=>{if(o==="catalog"){const R=jc(v);if(!R)return null;try{const g=await cs(U,R);return u.setQueryData(C,g),J(v),g.operation?.id??null}catch(g){throw g instanceof jt&&g.status===409&&u.invalidateQueries({queryKey:C}),g}}if(o==="session"&&h){const R=await ke({op:"mcp.control",sessionId:h,control:wc(v)});J(v);const g=ht.list(h),O=R?.data;return O&&"servers"in O&&Array.isArray(O.servers)?(u.setQueryData(g,O),null):(u.invalidateQueries({queryKey:g}),O&&"id"in O&&typeof O.id=="string"?O.id:null)}return null},[o,U,C,u,h,J]),pe=i.useCallback(async v=>{if(o==="catalog"&&A&&(v.action==="connect"||v.action==="disconnect"||v.action==="reload")){try{await ke({op:"mcp.control",sessionId:A,control:{action:v.action,name:v.name,...v.action==="disconnect"?{confirmed:!0}:{}}})}catch(R){throw u.invalidateQueries({queryKey:C}),R}return J(v),await u.invalidateQueries({queryKey:C}),null}return W(v)},[o,A,u,C,W,J]),je=i.useCallback(async(v,R,g,O)=>{if(o==="catalog"){const F=await ls(U,v,R,g,O);if(F.catalog&&u.setQueryData(C,F.catalog),F.code!=="saved")return{saved:!1,message:Jt(F.code,F.failed_ids,R)};try{await W({action:"test",name:v})}catch{}return{saved:!0,message:null}}if(o==="session"&&h){const F=await ke({op:"mcp.credentials.store",sessionId:h,name:v,values:R,confirmedReplace:g});if(F.data?.code!=="saved")return{saved:!1,message:Jt(F.data?.code,F.data?.failed_ids??[],R)};try{await W({action:"connect",name:v})}catch{}return{saved:!0,message:null}}return{saved:!1,message:null}},[o,U,C,u,W,h]),me=o==="catalog"?D:z,Re=i.useCallback(()=>{me.refetch()},[me]);return{enabled:o!==null,route:o,sessionId:o==="catalog"?A:h,borrowed:b,noConversation:o==="session"&&!h&&!y,document:K,isLoading:n.isLoading||o==="catalog"&&(V||D.isLoading)||o==="session"&&(h?z.isLoading:y),isError:me.isError,folderUnavailable:Ti(r,_),refetch:Re,readDocument:se,control:pe,storeKeys:je,memories:H,markNeedsKey:Q}}function Nc(e){if(e.route==="catalog")return e.queryClient.getQueryData(e.catalogKey);if(e.route==="session"&&e.sessionId){const n=e.queryClient.getQueryData(ht.list(e.sessionId));return n?xt(n,e.sessionId):void 0}}const Sc=(e,n)=>{const s=e?.trim();if(!s)return null;const a=ps(s,n);return a.kind==="auth"?{kind:"matched",name:a.name,unresolved:null}:{kind:"miss",asked:s}},Cc=6,ct="Integrations",Mc="Let agents use your tools and accounts, like Notion, Linear or GitHub.",Ac={test:"test",connect:"reconnect",disconnect:"disconnect",reload:"reload",remove:"remove",sign_out:"disconnect",cancel:"cancel",login:"grant",reauth:"grant"},Rc=({sessionId:e,sectionRef:n,highlightServer:s})=>{const a=_c({sessionId:e}),{document:o,control:r,readDocument:l}=a,u=ms(),c=o?.servers??[],m=o?.operations??[],y=o?.project_scope_available??!1,[j,b]=i.useState(!1),[h,f]=i.useState(""),[M,S]=i.useState(null),[V,_]=i.useState({}),[B,U]=i.useState(null),[A,C]=i.useState(null),[Y,q]=i.useState({kind:"ready"}),[Z,T]=i.useState(null),[ee,I]=i.useState(null),[D,L]=i.useState(!1),z=i.useRef({}),K=i.useRef({}),se=i.useRef({}),p=i.useRef(0),E=i.useRef(null),k=i.useRef(null),H=i.useRef(null),[G,Q]=i.useState(null),[J,W]=i.useState(null),[pe,je]=i.useState(null),me=i.useCallback(()=>{const d=H.current;H.current=null,C(null),T(null),window.setTimeout(()=>{d?.isConnected&&d.focus()},0)},[]),Re=i.useCallback(d=>{const x=window.document.activeElement;H.current=x instanceof HTMLElement?x:null,C(d)},[]),v=i.useCallback((d,x)=>{W({name:d,waitForSignIn:x==="signed-in",until:Date.now()+Fe,reanchors:0}),me()},[me]),R=i.useMemo(()=>Sc(s,c.map(d=>d.name)),[s,c]),g=R?.kind==="matched"?R.name:null,O=i.useRef(null),F=i.useRef(null),ie=h.trim().toLowerCase(),X=i.useMemo(()=>ie?c.filter(d=>d.name.toLowerCase().includes(ie)):c,[c,ie]),ae=i.useMemo(()=>Ai(X,m,a.memories),[X,m,a.memories]),ge=A?.kind==="sign_in"?c.find(d=>d.name===A.name)??null:null;i.useEffect(()=>{!g||F.current===g||!h||f("")},[g,h]),i.useEffect(()=>{!g||F.current===g||X.some(d=>d.name===g)&&(F.current=g,O.current?.scrollIntoView({block:"center",behavior:"smooth"}))},[g,X]),i.useEffect(()=>{if(!Z)return;const d=m.find(x=>x.id===Z)??null;q({kind:"running",operation:d})},[m,Z]);const de=m.some(d=>d.status==="running"),we=d=>{const x=window.document.activeElement;x&&x!==window.document.body&&x.isConnected||W({name:d,waitForSignIn:!1,until:Date.now()+Fe,reanchors:0})},oe=async(d,x,N)=>{S(d),_(({[d]:Ne,...Se})=>Se);let P=null,ue=!1;try{P=await N()}catch(Ne){ue=!0,_(Se=>({...Se,[d]:Ge(Ac[x]??"status",Ne,de)}))}finally{S(null),x!=="sign_out"&&(x!=="remove"||ue)&&we(d)}return{operationId:P,failed:ue}},he=d=>c.find(x=>x.name===d),ye=d=>{d.source.path&&gs(d.source.path)},_e=async(d,x)=>{q({kind:"starting"}),T(null);try{const N=await r({action:x,name:d});N?T(N):q({kind:"running",operation:null})}catch(N){N instanceof jt&&N.code==="oauth_unsupported"&&a.markNeedsKey(d),q({kind:"refused",message:Ge("grant",N,de)})}},Be=(d,x)=>{switch(x.kind){case"sign_in":case"reauth":{const N=m.find(P=>P.name===d.name&&P.status==="running");N&&Ke(N)?(q({kind:"running",operation:N}),T(N.id)):(q({kind:"ready"}),T(null)),Re({kind:"sign_in",name:d.name,action:x.kind==="reauth"?"reauth":"login"});return}case"set_key":I(null),Re({kind:"key",name:d.name,keyNames:d.auth.secret_refs.map(N=>N.id)});return;case"fix":ye(d);return;case"sign_out":U({name:d.name,kind:"sign_out"});return;default:{const N=x.kind;oe(d.name,N,()=>r({action:N,name:d.name}))}}},tt=(d,x)=>{switch(x.kind){case"remove":case"sign_out":U({name:d.name,kind:x.kind});return;case"sign_in":case"reauth":case"set_key":Be(d,{kind:x.kind,label:x.label});return;case"open_config":ye(d);return;case"copy_setup":navigator.clipboard.writeText(d.setup_prompt??"").then(()=>mt("Setup steps copied. Paste them into a chat.")).catch(()=>{});return;case"cancel":{const N=m.find(P=>P.name===d.name&&P.status==="running");N&&oe(d.name,"cancel",()=>r({action:"cancel",operationId:N.id}));return}case"test":case"connect":case"disconnect":case"reload":{const N=x.kind;oe(d.name,N,()=>r({action:N,name:d.name}));return}default:return}},nt=(d,x)=>{if(U(null),x==="remove"){const N=d.source.owned_scope;if(!N)return;const P=X.findIndex(ue=>ue.name===d.name);oe(d.name,"remove",()=>r({action:"remove",name:d.name,scope:N})).then(({operationId:ue,failed:Ne})=>{Ne||ue!==null||(mt(`Removed ${d.name}.`),P>=0&&je({index:P}))});return}oe(d.name,"sign_out",()=>r({action:"logout",name:d.name})).then(()=>{W({name:d.name,waitForSignIn:!1,until:Date.now()+Fe,reanchors:0})})},Mt=async d=>{try{return await r({action:"add",name:d.name,scope:d.scope,...d.mode==="command"?{command:d.command,args:d.args}:{url:d.url}}),b(!1),Q(d.name),null}catch(x){return Ge("add",x,!1)}},Ie=t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"text-heading text-ink",children:ct}),t.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:Mc})]}),a.enabled&&c.length>0&&!j?t.jsxs($,{ref:E,variant:"secondary",size:"sm",onClick:()=>b(!0),"data-tour-tag":"mcp-add-server",children:[t.jsx(Ft,{"aria-hidden":"true"}),"Add integration"]}):null]});if(!a.enabled&&!a.isLoading)return t.jsx(te,{title:ct,titleComponent:Ie,sectionRef:n,children:t.jsx(ne,{variant:"warning",children:"Integrations need a newer Local Operator backend. Update it and restart the app to manage them here."})});const Le=t.jsx(qi,{existingNames:c.map(d=>d.name),projectScopeAvailable:y,projectLabel:o?.cwd?Ec(o.cwd):null,onSubmit:Mt,onCancel:()=>{b(!1),window.setTimeout(()=>E.current?.focus(),0)}}),At=A?he(A.name):void 0,Fn=Object.entries(V).filter(([d])=>!c.some(x=>x.name===d)),Dn=d=>_(({[d]:x,...N})=>N);i.useEffect(()=>{if(!G)return;const d=z.current[G];if(!d){c.some(x=>x.name===G)&&(K.current[G]?.focus(),Q(null));return}d.focus(),Q(null)},[G,c]),i.useEffect(()=>{if(!pe)return;const x=X[Math.min(pe.index,X.length-1)]??X.at(-1);if(x){const N=z.current[x.name]??K.current[x.name];if(!N)return;N.focus()}else E.current?.focus();je(null)},[pe,X]);const st=i.useCallback((d,x)=>{const N=l()??o,P=N?.servers.find($n=>$n.name===d.name),ue=N?.operations??[],Ne=P?P.status==="connecting"||Ee(P.name,ue)!==null:!1;Ne&&P&&(p.current=x);const Se=P?Nt(P,ue,a.memories):null;if(P&&d.waitForSignIn&&(Se?.kind==="sign_in"||Se?.kind==="reauth"))return"kept";const Te=Qi({hold:d,now:x,windowMs:Fe,rowMoving:Ne,lastMovingAt:p.current,candidate:P?Xi({primary:Se?z.current[P.name]:null,overflow:K.current[P.name]}):void 0,active:window.document.activeElement,body:window.document.body});if(!Te.hold)return W(null),"finished";if(!Te.land)return"kept";W({name:d.name,waitForSignIn:!1,until:Te.hold.until,landedOn:Te.land,reanchors:Te.hold.reanchors});const Rt=Te.land;return window.setTimeout(()=>{Rt.isConnected&&Rt.focus()},0),"landed"},[l,o,a.memories]);return i.useEffect(()=>{if(!J)return;st(J,Date.now());let d=0,x=!1;const N=()=>{if(x)return;const P=ec({verdict:st(J,Date.now()),watchMs:qt});P!==null&&(d=window.setTimeout(N,P))};return d=window.setTimeout(N,qt),()=>{x=!0,window.clearTimeout(d)}},[J,st]),i.useEffect(()=>{if(!J)return;const d=x=>{Ji({target:x.target,row:se.current[J.name]})&&W(null)};return window.document.addEventListener("pointerdown",d,!0),()=>{window.document.removeEventListener("pointerdown",d,!0)}},[J]),t.jsxs(te,{title:ct,titleComponent:Ie,sectionRef:n,children:[t.jsxs("div",{className:"flex flex-col gap-4",children:[a.route==="session"&&a.borrowed?t.jsxs("p",{className:"text-body-sm text-ink-muted",children:["Showing the integrations for"," ",a.borrowed.title?.trim()||a.borrowed.session_id.slice(0,6),", your most recent chat."]}):null,a.noConversation?t.jsxs("div",{className:"flex flex-col items-start gap-2",children:[t.jsx("p",{className:"text-body-sm text-ink-muted",children:"Integrations can be managed here once a chat has started."}),t.jsx($,{variant:"primary",size:"sm",onClick:()=>u("/chat"),children:"Start a chat"}),t.jsx("p",{className:"text-ink-dim text-meta",children:"Updating Local Operator removes this step."})]}):null,a.isLoading?t.jsx("div",{className:"flex h-24 items-center justify-center",children:t.jsx(le,{size:"lg",label:"Loading integrations"})}):null,a.folderUnavailable?t.jsx(ne,{variant:"warning",children:t.jsx("span",{children:"This chat's folder no longer exists, so only global integrations are shown."})}):null,a.isError?t.jsx(ne,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:"Integrations couldn't be loaded."}),t.jsx($,{variant:"secondary",size:"sm",onClick:a.refetch,children:"Retry"})]})}):null,Fn.map(([d,x])=>t.jsx(ne,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:x}),t.jsx($,{variant:"ghost",size:"sm",onClick:()=>Dn(d),children:"Dismiss"})]})},d)),j&&c.length>0?Le:null,c.length>=Cc?t.jsxs("div",{className:"relative",children:[t.jsx(hs,{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-ink-dim"}),t.jsx(Me,{ref:k,value:h,onChange:d=>f(d.target.value),onKeyDown:d=>{d.key!=="Escape"||!h||(d.preventDefault(),f(""))},placeholder:`Search ${di(c.length)}`,"aria-label":"Search integrations",className:"pl-9"})]}):null,R?.kind==="miss"&&c.length>0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:`No integration matches "${R.asked}".`}):null,R?.kind==="matched"&&R.unresolved?t.jsx("p",{className:"text-body-sm text-ink-muted",children:`Showing "${R.name}" — "${R.unresolved}" is not one of your integrations.`}):null,o&&c.length===0&&!a.isLoading?j?Le:t.jsxs("div",{className:"flex flex-col items-start gap-3 rounded-lg bg-surface p-6",children:[t.jsx(dn,{"aria-hidden":"true",className:"size-5 text-ink-muted"}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("h3",{className:"text-heading text-ink",children:"No integrations yet"}),t.jsx("p",{className:"max-w-xl text-body-sm text-ink-muted",children:"Integrations let agents read and act in your other tools, like Notion or Linear. Add one with a command that runs on this computer, or a server's URL."})]}),t.jsxs($,{variant:"primary",size:"md",onClick:()=>b(!0),"data-tour-tag":"mcp-add-server",children:[t.jsx(Ft,{"aria-hidden":"true"}),"Add integration"]})]}):null,c.length>0&&X.length===0?t.jsxs("div",{className:"flex flex-col items-start gap-2",children:[t.jsx("p",{className:"text-body-sm text-ink-muted",children:"No integrations match this search."}),t.jsx($,{variant:"secondary",size:"sm",onClick:()=>{f(""),window.setTimeout(()=>{(k.current??E.current)?.focus()},0)},children:"Clear search"})]}):null,ae.map(d=>t.jsxs("section",{"aria-labelledby":`integrations-group-${d.id}`,className:"flex flex-col gap-1.5",children:[t.jsxs("h3",{id:`integrations-group-${d.id}`,className:"px-1 text-ink-dim text-meta",children:[d.title," · ",d.rows.length]}),t.jsx("ul",{className:"flex flex-col divide-y divide-hairline overflow-hidden rounded-lg bg-surface",children:d.rows.map(x=>t.jsx(rc,{row:x,operations:m,memories:a.memories,projectScopeAvailable:y,highlighted:x.name===g,rowRef:N=>{se.current[x.name]=N,x.name===g&&(O.current=N)},primaryRef:N=>{z.current[x.name]=N},overflowRef:N=>{K.current[x.name]=N},pending:M===x.name,failure:V[x.name]??null,confirm:B?.name===x.name?{kind:B.kind}:null,onPrimary:N=>Be(x,N),onOverflow:N=>tt(x,N),onConfirm:()=>B&&nt(x,B.kind),onCancelConfirm:()=>{U(null),window.setTimeout(()=>{K.current[x.name]?.focus()},0)}},x.id))})]},d.id))]}),A?.kind==="sign_in"?t.jsx(uc,{name:A.name,action:A.action,keyRoute:ge?Xe(ge):!1,phase:Y,onStart:()=>void _e(A.name,A.action),onCancel:d=>void r({action:"cancel",operationId:d}).catch(()=>{}),onOpenLink:d=>void fs(d),onClose:d=>v(A.name,d)}):null,A?.kind==="key"?t.jsx(sc,{name:A.name,keyNames:A.keyNames.length?A.keyNames:At?.auth.secret_refs.map(d=>d.id)??[],keyless:A.keyNames.length===0,savedKeys:At?.auth.secret_refs.filter(d=>d.state==="encrypted").map(d=>d.id),saving:D,failure:ee,onClose:me,onSave:(d,x,N)=>{L(!0),I(null),a.storeKeys(A.name,d,x,N).then(P=>{if(!P.saved){I(P.message);return}C(null),W({name:A.name,waitForSignIn:!1,until:Date.now()+Fe,reanchors:0})}).catch(P=>I(Ge("key",P,!1))).finally(()=>L(!1))}}):null]})},Fe=4e3,Tc=/^\/(?:Users|home)\/[^/]+(?=\/|$)/,Ec=e=>e.replace(Tc,"~"),Ic=({verification:e})=>{const{prices:n}=xs(),s=e.grant_amount??n?.default_new_credits,{sentence:a,action:o}=ks(e.signup_grant,vs(s)),r=bs(e.claim_url,js);return t.jsxs("div",{className:"mt-8 flex items-start gap-3 rounded-sm border border-hairline bg-surface p-3",children:[t.jsx(Qe,{className:"mt-0.5 size-4 shrink-0 text-ink-muted","aria-hidden":"true"}),t.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-2",children:[t.jsx("p",{className:"text-body-sm text-ink",children:a}),t.jsx($,{variant:"secondary",size:"sm",onClick:()=>ws(r),children:o})]})]})},Lc=({onAfterCredentialUpdate:e})=>{const{isAuthenticated:n,user:s,isLoading:a,accountRead:o,signOut:r}=ys(),l=un(j=>j.isSigningOut),u=i.useCallback(async()=>{try{await r()}catch(j){console.error("Error signing out:",j)}},[r]),c=i.useMemo(()=>{if(!n||!s?.radientUser)return null;const{account:j,identity:b,verification:h}=s.radientUser,f=h!=null&&!h.email_verified&&h.signup_grant!=="claimed";return t.jsxs(t.Fragment,{children:[t.jsxs(Je,{children:[t.jsx(re,{label:"Status",value:t.jsxs("span",{className:"inline-flex items-center gap-2",children:["Connected",t.jsx(Sa,{variant:"success",className:"capitalize",children:j.status})]})}),t.jsx(re,{label:"Name",value:j.name||"Not provided"}),t.jsx(re,{label:"Email",value:j.email}),t.jsx(re,{label:"Account ID",value:t.jsx("span",{className:"text-mono-sm",children:j.id})}),t.jsx(re,{label:"Tenant ID",value:t.jsx("span",{className:"text-mono-sm",children:j.tenant_id})}),t.jsx(re,{label:"Provider",value:t.jsx("span",{className:"capitalize",children:b.provider})}),t.jsx(re,{label:"Created",value:mn(j.created_at)})]}),f&&h?t.jsx(Ic,{verification:h}):null,t.jsxs("div",{className:"mt-8",children:[t.jsx("p",{className:"text-body-sm text-ink-muted",children:"Need to sign out or switch accounts?"}),t.jsxs($,{variant:"danger",className:"mt-3",onClick:u,children:[t.jsx(Qs,{}),"Sign out from Radient"]})]})]})},[n,s?.radientUser,u]),m=i.useMemo(()=>o==="refused"?"Radient refused the sign-in this app is holding, so your account details could not be read. Signing in again below replaces it.":hn(o)?"Your Radient account could not be read, so this app cannot show your account details.":"You are not currently signed in to Radient.",[o]),y=i.useMemo(()=>n&&s?null:t.jsxs("div",{children:[t.jsxs("p",{className:"text-body-sm text-ink-muted",children:[m," Sign in to access your account details or sign up to get free credits and unified access to models, tools, and more with Radient Pass. Radient's automatic model router will automatically select the best model for your agents to balance cost and performance. It is often cheaper to use Radient Pass than to use single AI providers due to automatic cost optimization."]}),t.jsx("div",{className:"mt-6",children:t.jsx(Ta,{titleText:"",onAfterCredentialUpdate:e,descriptionText:"",onSignInSuccess:()=>{}})})]}),[n,s,m,e]);return a||l?t.jsxs("div",{className:"flex min-h-36 flex-col items-center justify-center gap-3",children:[t.jsx(le,{size:"lg",label:"Loading account"}),!l&&t.jsx("p",{className:"text-meta text-ink-dim",children:"Loading your Radient account details…"})]}):n&&s?.radientUser?c:t.jsx("div",{className:"flex flex-col gap-4",children:y})};function Oc({metric:e,data:n}){return t.jsx(_s,{title:"",heightClassName:"h-62",yAxisWidth:48,unit:e==="credits"?"credits":"tokens",srSummary:`${e==="credits"?"Credits consumed":"Tokens used"} over the last 30 days, plotted per day across ${n.length} days.`,xTickFormatter:s=>s,yTickFormatter:s=>e==="credits"?`$${s.toFixed(2)}`:Ns(s),children:t.jsx(Qr,{data:n,children:t.jsx(on,{type:"monotone",dataKey:"value",strokeWidth:2,dot:!1,activeDot:{r:4,strokeWidth:0},name:e==="credits"?"Credits consumed":"Tokens used"})})})}const Fc={all:["desktop","tts-path-resolution"]};function Dc(e){return be({queryKey:Fc.all,queryFn:()=>ke({op:"tts.paths"}),enabled:e,staleTime:Number.POSITIVE_INFINITY,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:Ss})}const $c=["speech.voice.gender","speech.voice.tone","speech.voice.expressiveness","speech.voice.pace","speech.voice.language","speech.voice.accent","speech.voice.instructions"];function Xt(e){const n=new Map(e.map(o=>[o.key,o])),s=[],a=[];for(const o of $c){const r=n.get(o);r?s.push(r):a.push(o)}return{rows:s,missing:a}}const Uc=["provider_tts_radient","provider_tts_elevenlabs","provider_tts_openai","none"];function en(e){return typeof e=="string"&&Uc.includes(e)}function Pc(e){if(e===null||typeof e!="object")return null;const n=e;if(!en(n.path)||typeof n.reason!="string"||typeof n.servable!="boolean"||!Array.isArray(n.rungs))return null;const s=[];for(const a of n.rungs){if(a===null||typeof a!="object")return null;const o=a;if(!en(o.path)||typeof o.available!="boolean"||typeof o.reason!="string")return null;s.push({path:o.path,available:o.available,reason:o.reason})}return{path:n.path,reason:n.reason,servable:n.servable,rungs:s}}const zc={provider_tts_radient:"Radient Pass",provider_tts_elevenlabs:"ElevenLabs",provider_tts_openai:"OpenAI",none:"No provider"};function Ln(e){return zc[e]}function Kc(e){return{servable:e.servable,serving:e.path==="none"?null:e.path,reason:e.reason,rungs:e.rungs.map(n=>({path:n.path,name:Ln(n.path),available:n.available,reason:n.reason}))}}const Bc="This backend does not serve the voicing surface. Update the backend to tune how the assistant sounds.",On="Speech availability could not be read.",Hc=({resetErrorBoundary:e})=>t.jsx(ne,{variant:"warning",children:t.jsxs("div",{className:"flex flex-col items-start gap-3",children:[t.jsx("span",{children:On}),t.jsxs($,{variant:"secondary",onClick:e,children:[t.jsx(Ma,{"aria-hidden":"true"}),"Try again"]})]})});function Vc(e){return e==="enabled"?"ready":e==="below-version"?"older":"pairing"}const Gc=({sectionRef:e})=>{const n=ln(),s=fn(),a=Cs(n.data,"tts"),o=Vc(a),r=be({queryKey:Es.all,queryFn:()=>ke({op:"settings.list"}),enabled:o==="ready",staleTime:1e4}),l=Dc(o==="ready"),{hasRadientApiKey:u,hasRadientSession:c,speechBlock:m}=Ms(),y=`${c}:${u}`,j=i.useRef(y),b=l.refetch;i.useEffect(()=>{j.current!==y&&(j.current=y,b())},[y,b]);const h=r.data,f=i.useMemo(()=>Xt(h?.settings??[]),[h]),[M,S]=i.useState({}),[V,_]=i.useState({}),[B,U]=i.useState({});i.useEffect(()=>{h&&S(p=>{let E=!1;const k={...p};for(const H of Xt(h.settings).rows){const G=p[H.key];if(G&&G.value!==Oe(H).value)continue;const Q=Oe(H);G&&G.value===Q.value&&G.cascadeBase===Q.cascadeBase||(k[H.key]=Q,E=!0)}return E?k:p})},[h]);const A=(p,E)=>_(k=>({...k,[p]:E})),C=(p,E)=>U(k=>({...k,[p]:E})),Y=async p=>{const E=M[p.key];if(!E)return;const k=Ts(p,E);if(!k.ok){C(p.key,k.error);return}A(p.key,!0),C(p.key,null);try{await ke(k.request),A(p.key,!1);const G=(await r.refetch()).data?.settings.find(Q=>Q.key===p.key);G&&S(Q=>{const J=Q[p.key];return J&&J.value===E.value&&J.cascadeBase===E.cascadeBase?{...Q,[p.key]:Oe(G)}:Q})}catch(H){A(p.key,!1),C(p.key,H instanceof Error?H.message:"The setting could not be saved.")}},q=async p=>{A(p.key,!0),C(p.key,null);try{await ke({op:"settings.reset",key:p.key}),S(E=>({...E,[p.key]:Oe({...p,value:p.default,is_default:!0})})),A(p.key,!1),await r.refetch()}catch(E){A(p.key,!1),C(p.key,E instanceof Error?E.message:"The setting could not be reset.")}},Z=i.useMemo(()=>Pc(l.data),[l.data]),T=Z?Kc(Z):null,ee=l.isSuccess&&Z===null,I=(n.data?null:n.error)??null,D=r.error,L="Speech voicing",z="How the assistant sounds when it speaks aloud.";if(o==="pairing"){const{sentence:p}=ft(s??null,"Speech settings could not be loaded.",I);return t.jsx(te,{title:L,icon:Ve,description:z,sectionRef:e,children:t.jsx(ne,{variant:"warning",children:p})})}if(o==="older")return t.jsx(te,{title:L,icon:Ve,description:z,sectionRef:e,children:t.jsx(ne,{variant:"warning",children:Bc})});if(D||!h){const{sentence:p,remedy:E}=ft(s??null,"Speech settings could not be loaded.",D);return t.jsx(te,{title:L,icon:Ve,description:z,sectionRef:e,children:t.jsx(ne,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:p}),E&&t.jsx($,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{r.refetch()},children:"Retry"})]})})})}const K=T?!T.servable:m==="offline",se=T?T.rungs.find(p=>p.path===T.serving)??null:null;return t.jsx(te,{title:L,icon:Ve,description:z,sectionRef:e,children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsxs("section",{className:"flex flex-col gap-3",children:[l.isPending&&t.jsxs("p",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[t.jsx(le,{}),Lt("checking")]}),(l.isError||ee)&&!T&&m!=="offline"&&t.jsx(ne,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("span",{children:[On," ",l.error instanceof Error?l.error.message:""]}),t.jsx($,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{l.refetch()},children:"Retry"})]})}),t.jsx(Ca,{fallbackRender:Hc,resetKeys:[l.dataUpdatedAt],children:T&&t.jsxs(t.Fragment,{children:[t.jsxs(Je,{children:[t.jsx(re,{label:"Speaks through",value:T.serving?Ln(T.serving):"Nothing yet"}),t.jsx(re,{label:"Availability",value:T.servable?"Ready":"No provider"})]}),T.reason&&T.reason!==se?.reason&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:T.reason}),t.jsx("ul",{className:"flex flex-col gap-1",children:T.rungs.map(p=>t.jsxs("li",{className:"flex flex-col gap-0.5 text-body-sm",children:[t.jsxs("span",{className:p.path===T.serving?"text-ink":"text-ink-muted",children:[p.name,t.jsxs("span",{className:p.path===T.serving?"text-ink-muted":"text-ink-dim",children:[" ",p.available?"(available)":"(not available)"]})]}),t.jsx("span",{className:"text-meta text-ink-dim",children:p.reason})]},p.path))})]})})]}),K&&t.jsx(ne,{variant:"warning",children:Lt(m)}),t.jsx("div",{className:"flex flex-col gap-1",children:f.rows.map(p=>t.jsx(As,{setting:p,draft:M[p.key]??Oe(p),tier:Rs(p),saving:!!V[p.key],error:B[p.key]??null,onDraftChange:E=>S(k=>({...k,[p.key]:E})),onSave:()=>{Y(p)},onReset:()=>{q(p)}},p.key))}),f.missing.length>0&&t.jsxs("p",{className:"text-meta text-ink-dim",children:["This backend does not register ",f.missing.join(", ")," yet, so those rows are not shown."]})]})})},qc=()=>{const{data:e,isLoading:n,error:s,refetch:a}=qr(),o=Yr(),[r,l]=i.useState(""),[u,c]=i.useState(!1);i.useEffect(()=>{l(e?.content??""),c(!1)},[e]);const m=f=>{const M=f.target.value;l(M),c(M!==(e?.content??""))},y=async()=>{if(!(!u||o.isPending))try{const f={content:r};await o.mutateAsync(f),await a(),c(!1)}catch(f){console.error("Error updating system prompt:",f)}},j=()=>{l(e?.content??""),c(!1)},b=o.isPending,h=()=>t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(fe,{htmlFor:"app-system-prompt",children:"Instructions"}),t.jsx(xn,{id:"app-system-prompt",name:"systemPrompt",value:r,onChange:m,placeholder:"Enter instructions for how all agents should behave and respond to your requests...",className:"min-h-50"})]}),t.jsxs("div",{className:"flex gap-3",children:[t.jsxs($,{variant:"primary",onClick:y,disabled:!u||b,children:[b?t.jsx(le,{size:"sm"}):t.jsx(Js,{}),b?"Saving...":"Save changes"]}),t.jsx($,{onClick:j,disabled:!u||b,children:"Cancel"})]}),e?.last_modified&&t.jsxs("p",{className:"text-ink-dim text-meta",children:["Last modified:"," ",t.jsx("span",{className:"font-mono text-mono-sm",children:pn(e.last_modified)})]})]});return t.jsx(te,{title:"System prompt",icon:Ea,description:"Every Local Operator agent receives this prompt in addition to its own instructions, so it is the place for baseline expectations and for details you want every agent to know about you, such as your name, location, or preferences. It is sent to your selected hosting provider.",children:n?t.jsx("div",{className:"flex min-h-50 items-center justify-center",children:t.jsx(le,{size:"lg",label:"Loading system prompt"})}):s?t.jsxs(ne,{variant:"danger",children:["Failed to load system prompt:"," ",s instanceof Error?s.message:"Unknown error"]}):h()})},Yc=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"],Wc=e=>Yc.includes(e),Zc=e=>{const n=[];let s=0;for(const a of e){const o=Math.max(0,Math.floor(a.count)),r=Math.max(1,Math.floor(a.columns));for(let l=0;l<o;l+=r)n.push({start:s+l,count:Math.min(r,o-l)});s+=o}return n},Qc=({index:e,key:n,groups:s})=>{const a=Zc(s),o=a.reduce((r,l)=>r+l.count,0);if(!Number.isInteger(e)||e<0||e>=o)return e;switch(n){case"Home":return 0;case"End":return o-1;case"ArrowLeft":return Math.max(0,e-1);case"ArrowRight":return Math.min(o-1,e+1);case"ArrowUp":case"ArrowDown":{const r=a.findIndex(c=>e>=c.start&&e<c.start+c.count),l=a[r+(n==="ArrowDown"?1:-1)];if(!l)return e;const u=e-a[r].start;return l.start+Math.min(u,l.count-1)}default:return e}},Jc={localOperatorDark:sr,localOperatorLight:wr,dracula:pr,dune:To,sage:Wo,monokai:ta,tokyoNight:ir,iceberg:yr,radient:Bo,neon:Is,obsidian:vn,synth:Ba,catppuccinMocha:go,catppuccinLatte:Xo,tokyoNightStorm:io,gruvbox:Qa,nord:Vr,oneDark:za,solarizedDark:br,rosePine:Oo,rosePineMoon:tr,rosePineDawn:fo,alucard:Do,gruvboxLight:wo,tokyoNightDay:or,oneLight:Qo,catppuccinFrappe:bo,catppuccinMacchiato:Vo,palenight:ea,everforest:Dr,everforestLight:Or,kanagawaWave:zr,kanagawaLotus:Io,ayuDark:No,ayuMirage:Co,ayuLight:ur,nightfox:lo,duskfox:Cr,synthwave:lr,matrix:Va,tron:oo,cyberpunk:Xs,vaporwave:Ir,outrun:Wa,neonNoir:Ur,arcade:qo,forest:Tr,ocean:Ao,desert:Ar,autumn:Br,lavender:kr,arctic:mo,rosewood:zo,solarizedLight:Nr,githubLight:Uo,paper:Ia,linen:hr,highContrastLight:Ua,mintLight:qa},tn="bg-[color-mix(in_srgb,var(--color-accent)_8%,var(--color-accent-wash))]",Xc=({id:e})=>t.jsxs("div",{"data-theme":e,"aria-hidden":"true",className:"flex h-full bg-canvas",children:[t.jsxs("div",{className:"flex w-1/4 flex-col gap-1 bg-sunken p-1",children:[t.jsx("span",{className:"flex h-2.5 items-center rounded-xs bg-accent-wash px-1",children:t.jsx("span",{className:"h-1 w-full rounded-xs bg-accent"})}),t.jsx("span",{className:"mx-1 h-1 w-2/3 rounded-xs bg-ink-dim"}),t.jsx("span",{className:"mx-1 h-1 w-1/2 rounded-xs bg-ink-dim"})]}),t.jsxs("div",{className:"flex flex-1 flex-col justify-between p-1",children:[t.jsxs("div",{className:"flex flex-col gap-1 rounded-xs bg-surface p-1",children:[t.jsx("span",{className:"h-1 w-3/5 rounded-xs bg-ink"}),t.jsx("span",{className:"h-1 w-full rounded-xs bg-ink-dim"})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"h-2.5 w-6 rounded-xs bg-elevated"}),t.jsx("span",{className:"h-2.5 w-5 rounded-xs bg-accent"}),t.jsx("span",{className:"h-2.5 w-4 rounded-xs bg-accent-alt"}),t.jsx("span",{className:"h-2.5 w-4 rounded-xs border border-control"})]})]})]}),el=({id:e,name:n,description:s,isSelected:a,isTabStop:o,onSelect:r,onFocusTile:l})=>{const u=Jc[e];return t.jsx(Ue,{side:"bottom",align:"start",content:s,children:t.jsxs("button",{type:"button","data-theme-tile":e,"aria-pressed":a,tabIndex:o?0:-1,onFocus:l,onClick:r,className:ce("relative flex flex-col gap-1.5 rounded-md p-1 text-left transition-colors duration-fast ease-out-quart",a?tn:"hover:bg-surface"),children:[t.jsxs("span",{className:ce("relative block h-10 overflow-hidden rounded-sm border transition-colors duration-fast ease-out-quart",a?"border-accent":"border-hairline"),children:[t.jsx(Xc,{id:e}),a&&t.jsx("span",{className:ce("pointer-events-none absolute top-0.5 right-0.5 flex h-4 w-4 items-center justify-center rounded-full",tn),children:t.jsx(Ra,{size:12,className:"text-accent","aria-hidden":"true"})})]}),t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx(u,{size:12,className:"shrink-0 text-ink-dim","aria-hidden":"true"}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-meta text-ink",children:n})]})]})})},tl=e=>[...e.querySelectorAll("[data-theme-grid]")].map(n=>{const s=[...n.querySelectorAll("[data-theme-tile]")],a=s[0]?.getBoundingClientRect().top??0;return{count:s.length,columns:Math.max(1,s.filter(o=>Math.abs(o.getBoundingClientRect().top-a)<1).length)}}),nl=()=>{const{themeName:e,setTheme:n}=ve(),s=i.useMemo(()=>{const u=Object.values(Un);return[{label:"Dark",items:u.filter(c=>c.theme.palette.mode==="dark")},{label:"Light",items:u.filter(c=>c.theme.palette.mode==="light")}].filter(c=>c.items.length>0)},[]),[a,o]=i.useState(null),r=i.useMemo(()=>{const u=s.flatMap(c=>c.items.map(m=>m.id));return a&&u.includes(a)?a:u.includes(e)?e:u[0]},[s,a,e]),l=u=>{if(!Wc(u.key))return;const c=[...u.currentTarget.querySelectorAll("[data-theme-tile]")],m=c.indexOf(u.target);if(m<0)return;u.preventDefault();const y=Qc({index:m,key:u.key,groups:tl(u.currentTarget)});y!==m&&c[y]?.focus()};return t.jsx(Aa,{children:t.jsx("div",{onKeyDown:l,className:"flex flex-col gap-6",children:s.map(u=>t.jsxs("div",{children:[t.jsx("h3",{className:"px-1 pb-2 text-meta text-ink-dim",children:u.label}),t.jsx("div",{"data-theme-grid":u.label,className:"grid grid-cols-[repeat(auto-fill,minmax(160px,1fr))] gap-2",children:u.items.map(({id:c,name:m,description:y})=>t.jsx(el,{id:c,name:m,description:y,isSelected:c===e,isTabStop:c===r,onSelect:()=>n(c),onFocusTile:()=>o(c)},c))})]},u.label))})})},sl=({value:e,onChange:n})=>{const s=i.useId();return t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("span",{id:s,className:"flex min-h-6 items-center text-body text-ink",children:"Transcript display"}),t.jsx("p",{className:"mt-0.5 max-w-2xl text-body-sm text-ink-muted",children:"By turn condenses each turn to its answer. By response keeps every settled response on screen, with the turn's final answer still marked."})]}),t.jsx("div",{className:"flex h-6 shrink-0 items-center",children:t.jsx(pt,{value:e,onValueChange:a=>n(gn(a)),children:t.jsx(gt,{"aria-labelledby":s,children:qs.map(a=>t.jsx(De,{value:a.value,children:a.label},a.value))})})})]})},al=()=>{const{data:e,isLoading:n,error:s}=Xr({enabled:!0});return t.jsxs("div",{children:[t.jsxs("h3",{className:"mb-3 flex items-center gap-2 text-heading text-ink",children:[t.jsx(ko,{size:16,className:"shrink-0 text-ink-dim"}),"Radient Pass"]}),n&&t.jsx(kn,{className:"h-6 w-36"}),s&&t.jsxs(ne,{variant:"warning",children:["Could not load your credit balance. ",s.message]}),e&&!n&&!s&&t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[t.jsxs("p",{className:"flex-1 text-body-sm text-ink-muted",children:["Available credits"," ",t.jsx("span",{className:"font-medium text-ink",children:e.balance.toFixed(2)})]}),t.jsx($,{variant:"secondary",size:"sm",asChild:!0,children:t.jsxs("a",{href:"https://console.radienthq.com/dashboard/billing",target:"_blank",rel:"noopener noreferrer",children:[t.jsx(so,{}),"Add credits"]})})]})]})},ol=[{id:"credits",label:"Credits"},{id:"tokens",label:"Tokens"}],rl=()=>{const[e,n]=i.useState("credits"),s=i.useMemo(()=>{const u=new Date,c=Zr(u);return{start_date:zt(c),end_date:zt(u),rollup:"daily"}},[]),{data:a,isLoading:o,error:r}=ti(s,{enabled:!0}),l=i.useMemo(()=>a?.data_points?[...a.data_points].sort((c,m)=>at(c.timestamp).getTime()-at(m.timestamp).getTime()).map(c=>({bucket:zs(Fa(at(c.timestamp),"yyyy-MM-dd")),value:e==="credits"?Number.parseFloat(c.total_cost.toFixed(2)):c.total_tokens})):[],[a,e]);return t.jsxs("div",{children:[t.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[t.jsxs("h3",{className:"flex items-center gap-2 text-heading text-ink",children:[t.jsx(Xa,{size:16,className:"shrink-0 text-ink-dim"}),"Usage (last 30 days)"]}),t.jsxs("fieldset",{className:"m-0 w-fit border-0 p-0",children:[t.jsx("legend",{className:"sr-only",children:"Usage metric"}),t.jsx("div",{className:"flex gap-0.5 rounded-md bg-sunken p-0.5",children:ol.map(({id:u,label:c})=>t.jsx($,{variant:"ghost",size:"sm","aria-pressed":e===u,onClick:()=>n(u),className:ce(e===u&&"bg-surface text-ink hover:bg-surface"),children:c},u))})]})]}),o&&t.jsx(kn,{className:"h-62 w-full"}),r&&t.jsxs(ne,{variant:"warning",children:["Could not load your usage data. ",r.message]}),!o&&!r&&a&&l.length>0&&t.jsx(Oc,{metric:e,data:l}),!o&&!r&&(!a||l.length===0)&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:"No usage recorded in the last 30 days."})]})},il=()=>t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[t.jsxs("h2",{className:"flex items-center gap-2 text-heading text-ink",children:[t.jsx(ma,{size:16,className:"shrink-0 text-ink-dim"}),"Radient account"]}),t.jsx($,{variant:"secondary",size:"sm",className:"self-start sm:self-center",asChild:!0,children:t.jsxs("a",{href:"https://console.radienthq.com",target:"_blank",rel:"noopener noreferrer",children:["Go to Radient console",t.jsx(Ks,{})]})})]}),bl=()=>{const e=Ls("surface"),n=ve(g=>g.showAgentReasoning),s=ve(g=>g.setShowAgentReasoning),a=ve(g=>g.transcriptDisplayMode),o=ve(g=>g.setTranscriptDisplayMode),{data:r,isLoading:l,isFetching:u,error:c,refetch:m}=Os(),y=fn(),{sentence:j,remedy:b}=ft(y??null,"Your settings could not be loaded.",c),h=na(),[f,M]=i.useState(null),S=un(),{isAuthenticated:V,accountRead:_,isFetching:B,isRefreshing:U,refreshUser:A}=bt(),C=qe(g=>g.activeSessionId),[Y,q]=i.useState("general"),[Z,T]=i.useState(!1),ee=i.useRef(null),I=i.useRef(null),{startTour:D}=sa(),L=Fs(),{data:z,refetch:K}=Ds(),{refreshModels:se}=$s(),p=i.useMemo(()=>z?.keys?[...z.keys].sort():[],[z?.keys]),E=i.useRef({keys:"",hosting:void 0});i.useEffect(()=>{const g=p.join(","),O=r?.values?.hosting;(E.current.keys!==g||E.current.hosting!==O)&&(E.current={keys:g,hosting:O},se().catch(F=>{console.error("Failed to refresh models after credentials or hosting change:",F)}))},[p,r?.values?.hosting,se]);const k=i.useRef({general:i.useRef(null),radient:i.useRef(null),integrations:i.useRef(null),appearance:i.useRef(null),speech:i.useRef(null),keyboard:i.useRef(null),providers:i.useRef(null),backend:i.useRef(null),updates:i.useRef(null)}).current,H=i.useMemo(()=>new URLSearchParams(L.search).get("setting"),[L.search]),G=i.useMemo(()=>new URLSearchParams(L.search).get("filter")??"",[L.search]),Q=i.useMemo(()=>new URLSearchParams(L.search).get("mcp")??void 0,[L.search]),J=i.useMemo(()=>new URLSearchParams(L.search).get("provider"),[L.search]),W=i.useCallback(g=>{q(g),T(!0);const O=k[g],F=I.current;if(O?.current&&F){const X=O.current.getBoundingClientRect().top-F.getBoundingClientRect().top;F.scrollHeight>F.clientHeight?F.scrollTo({top:Math.max(0,F.scrollTop+X-80),behavior:"smooth"}):window.scrollTo({top:Math.max(0,O.current.getBoundingClientRect().top+window.scrollY-80),behavior:"smooth"}),clearTimeout(ee.current??void 0),ee.current=setTimeout(()=>{T(!1),ee.current=null},800)}else T(!1)},[k]);i.useEffect(()=>{const g=setTimeout(()=>{const O=I.current;if(!O)return;const F=()=>{if(Z)return;const ie=O.getBoundingClientRect(),X=ie.height;let ae="",ge=0;for(const[de,we]of Object.entries(k))if(we.current){const oe=we.current.getBoundingClientRect(),he=ie.top,ye=oe.top-he,_e=oe.bottom-he,Be=oe.height,tt=Math.max(0,ye),nt=Math.min(X,_e),Ie=Math.max(0,nt-tt)/Be,Le=Ie+(ye<X*.3?.1:0);Le>ge&&Ie>.1&&(ge=Le,ae=de)}ae&&ae!==Y&&q(ae)};return F(),O.addEventListener("scroll",F,{passive:!0}),()=>{O.removeEventListener("scroll",F),clearTimeout(ee.current??void 0)}},100);return()=>clearTimeout(g)},[k,Y,Z]),i.useEffect(()=>{const g=new URLSearchParams(L.search),O=g.get("section"),F=g.get("setting"),ie=F?Us(F,"backend"):O,X=ie?k[ie]:void 0;if(!ie||!X)return;let ae=!1,ge=Number.NaN,de=0;const we=window.setTimeout(()=>{ae||(ae=!0,he.disconnect(),W(ie))},2e3),oe=()=>{if(ae)return;const ye=X.current;if(!ye){de=requestAnimationFrame(oe);return}const _e=Math.round(ye.getBoundingClientRect().top+window.scrollY);if(_e===ge&&_e>0){ae=!0,he.disconnect(),window.clearTimeout(we),W(ie);return}ge=_e,de=requestAnimationFrame(oe)},he=new ResizeObserver(()=>{ae||(cancelAnimationFrame(de),de=requestAnimationFrame(oe))});return I.current&&he.observe(I.current),de=requestAnimationFrame(oe),()=>{ae=!0,cancelAnimationFrame(de),he.disconnect(),window.clearTimeout(we)}},[L.search,k,W]);const pe=async(g,O)=>{M(g);try{await h.mutateAsync({[g]:O}),await m()}catch(F){console.error(`Error updating ${g}:`,F)}finally{M(null)}},je=l,me=_==="checking",Re=hn(_),v=_==="ready"||_==="checking"||B,R=yn(je,4e3);return c?t.jsx("div",{className:"flex h-full w-full items-center justify-center bg-canvas p-6",children:t.jsx(ne,{variant:"warning",className:"w-full max-w-xl",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:j}),b&&t.jsx($,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>void m(),disabled:u,children:u?"Retrying":"Retry"})]})})}):je?t.jsxs("div",{role:"status",className:"flex h-full w-full flex-col items-center justify-center gap-3 bg-canvas",children:[t.jsx(le,{size:"lg",label:R?void 0:"Loading settings"}),R&&t.jsx("p",{className:"max-w-sm text-center text-body-sm text-ink-muted",children:"The Local Operator server is taking longer than usual to answer. If it does not respond, you will be able to retry from here."})]}):r?t.jsxs("div",{className:"flex h-full w-full overflow-hidden bg-canvas",children:[t.jsx("div",{ref:e,className:"w-12 shrink-0 overflow-y-auto min-[1040px]:w-55",children:t.jsx(aa,{activeSection:Y,onSelectSection:W,sections:oa})}),t.jsx("div",{ref:I,"data-settings-content":!0,"data-tour-tag":"settings-general-section",className:"flex-1 overflow-y-auto overflow-x-hidden p-4 sm:p-6 md:p-8",children:t.jsxs("div",{className:"mx-auto flex w-full max-w-4xl flex-col gap-8 pb-8",children:[t.jsx(ha,{title:"Settings",icon:Dt}),t.jsxs("div",{className:"flex flex-col gap-8",children:[t.jsxs("div",{ref:k.general,className:"flex flex-col gap-8",children:[t.jsx(ra,{focus:H===Ot}),t.jsxs(te,{title:"User profile",icon:ia,description:`Your user profile information displayed in the application. This information is not provided to the agents. ${V?"These details are provided through your Radient account.":""}`,children:[me&&t.jsx("p",{className:"text-meta text-ink-dim",children:"Checking your Radient account…"}),Re&&t.jsx(ne,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("span",{children:["Your Radient account could not be read, so the name and email below are placeholders rather than your account details.",_==="refused"?" Retry, or sign in to Radient again.":" Retry."]}),t.jsx($,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>A(),disabled:U,children:U?"Retrying":"Retry"})]})}),t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx($t,{value:S.profile.name,label:"Display name",placeholder:"Enter your name...",isSaving:f==="user_name",onSave:async g=>{M("user_name");try{S.updateName(g)}finally{M(null)}},readOnly:v}),t.jsx($t,{value:S.profile.email,label:"Email address",placeholder:"Enter your email...",isSaving:f==="user_email",onSave:async g=>{M("user_email");try{S.updateEmail(g)}finally{M(null)}},readOnly:v})]})]}),t.jsx(te,{title:"Application tour",description:"Missed the application onboarding tour or want a refresher? Start it again here.",children:t.jsxs($,{variant:"secondary",onClick:()=>{D({forceModalCompleted:!0})},children:[t.jsx(to,{}),"Take the tour"]})}),t.jsx(te,{id:"model-settings",title:"Model settings",icon:ca,description:"Configure the default AI model and hosting providers used for generating responses. This will be used for all agents that don't have a specific model or hosting provider configured. You can override these settings for individual agents in the agent settings.",children:t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(la,{value:r.values.hosting,isSaving:f==="hosting",onSave:g=>pe("hosting",g),filterByCredentials:!0,allowCustom:!0,allowDefault:!1,emptyHelperText:"No hosting providers available. Sign in to a provider, or add a provider's API key below, under Providers."}),t.jsx(da,{value:r.values.model_name,hostingId:r.values.hosting,isSaving:f==="model_name",onSave:g=>pe("model_name",g),allowCustom:!0,allowDefault:!1}),t.jsx(ne,{variant:"neutral",icon:t.jsx(Qe,{className:"size-4","aria-hidden":"true"}),children:"You need a Radient account or your own API keys to reach cloud providers. If you don't see more hosting providers and models here, sign in to Radient, or add a provider's API key below, under Providers."})]})}),t.jsx(qc,{}),t.jsx(te,{title:"Configuration information",icon:Qe,description:"System information about the current configuration.",children:t.jsxs(Je,{children:[t.jsx(re,{label:"Version",value:t.jsx("span",{className:"text-mono-sm",children:r.version})}),t.jsx(re,{label:"Created",value:mn(r.metadata.created_at)}),t.jsx(re,{label:"Last modified",value:pn(r.metadata.last_modified)}),t.jsx(re,{label:"Description",value:r.metadata.description||"No description available"})]})})]}),t.jsx(te,{title:"Appearance",icon:vn,description:"Customize the look and feel of Local Operator",sectionRef:k.appearance,dataTourTag:"settings-appearance-section",children:t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(nl,{}),t.jsx(Wr,{value:n,label:"Show agent reasoning",description:"Adds the agent's Reasoning and Thinking rows to conversations. They stay closed until you open one. Reasoning only: narration the agent writes as prose mid-turn is transcript content, not reasoning — never removed by either display mode (by turn folds it behind the turn's bars, by response keeps it on screen).",onChange:async g=>s(g)}),t.jsx(sl,{value:gn(a),onChange:g=>o(g)})]})}),t.jsx(Gc,{sectionRef:k.speech}),t.jsx(ci,{sectionRef:k.keyboard}),t.jsx(te,{title:"Model providers",icon:dn,description:"Sign in to the services your agents think with. New chats use your default model.",sectionRef:k.providers,children:t.jsx(ua,{initialProviderId:J,onChangeModel:()=>W("general")})}),t.jsx(Rc,{sessionId:C??void 0,sectionRef:k.integrations,highlightServer:Q}),t.jsx(te,{title:"Radient account",titleComponent:t.jsx(il,{}),description:"Your Radient account, Radient Pass details and credits. To use Radient models, sign in under Model providers.",sectionRef:k.radient,dataTourTag:"settings-radient-account-section",children:t.jsxs("div",{className:"flex flex-col gap-8",children:[t.jsx(Lc,{onAfterCredentialUpdate:()=>{se(),K()}}),V&&t.jsxs(t.Fragment,{children:[t.jsx(al,{}),t.jsx(rl,{})]})]})}),t.jsx(te,{title:"Backend settings",icon:Dt,description:"Every setting the backend registry owns, searchable, with typed editors and scopes.",sectionRef:k.backend,children:t.jsx(Ps,{hideInterfaceLanguage:!0,focusKey:H===Ot?null:H,initialFilter:G})}),t.jsx("div",{ref:k.updates,children:t.jsx(oi,{})})]})]})})]}):t.jsx("div",{className:"flex h-full w-full items-center justify-center bg-canvas p-6",children:t.jsx(ne,{variant:"warning",className:"w-full max-w-xl",children:"Your settings could not be loaded."})})};export{bl as SettingsPage};