local-operator-ui 0.42.7 → 0.42.8

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 (104) hide show
  1. package/out/main/index.js +14340 -252
  2. package/out/preload/index.js +58 -2
  3. package/out/renderer/assets/{_basePickBy-CzIgSCTC.js → _basePickBy-D4Seo5Pz.js} +1 -1
  4. package/out/renderer/assets/{_baseUniq-Dm8qWLNb.js → _baseUniq-CgVRhJ9V.js} +1 -1
  5. package/out/renderer/assets/{agent-details-page-BCde4GYu.js → agent-details-page-DSmJIvXx.js} +1 -1
  6. package/out/renderer/assets/{agent-hub-page-3z0FBryb.js → agent-hub-page-CD_Db8P3.js} +2 -2
  7. package/out/renderer/assets/{agents-page-DgCWT1qP.js → agents-page-CUktXXX5.js} +3 -3
  8. package/out/renderer/assets/{approvalsOverlay-2dV79TsD.js → approvalsOverlay-DxEtCZZM.js} +1 -1
  9. package/out/renderer/assets/{arc-ARfG_3LB.js → arc-Ctuni3QD.js} +1 -1
  10. package/out/renderer/assets/{architectureDiagram-IEHRJDOE-DLZi8SG_.js → architectureDiagram-IEHRJDOE-CJgH5UIr.js} +1 -1
  11. package/out/renderer/assets/{blockDiagram-JOT3LUYC-BZ0-FsMz.js → blockDiagram-JOT3LUYC-DPrJH4Ov.js} +1 -1
  12. package/out/renderer/assets/{book-open-BrntK3Uq.js → book-open-CnrMa_Lj.js} +1 -1
  13. package/out/renderer/assets/browser-page-B4X8tPFL.js +1 -0
  14. package/out/renderer/assets/{browser-webauthn-prompt-BNVEHrv9.js → browser-webauthn-prompt-CKXKeFSp.js} +1 -1
  15. package/out/renderer/assets/{building-2-Bxp0hviH.js → building-2-KNn69NZT.js} +1 -1
  16. package/out/renderer/assets/{c4Diagram-VJAJSXHY-B52-jW50.js → c4Diagram-VJAJSXHY-CXM6-guv.js} +1 -1
  17. package/out/renderer/assets/channel-DXQf2vmt.js +1 -0
  18. package/out/renderer/assets/{chunk-4BMEZGHF-IC-SKIif.js → chunk-4BMEZGHF-D1rW0otO.js} +1 -1
  19. package/out/renderer/assets/{chunk-A2AXSNBT-BOfVuPOA.js → chunk-A2AXSNBT-CpRdsZLi.js} +1 -1
  20. package/out/renderer/assets/{chunk-AEK57VVT-B7dCXqfp.js → chunk-AEK57VVT-ZpJc0SjT.js} +1 -1
  21. package/out/renderer/assets/{chunk-D6G4REZN-U8cPWlh7.js → chunk-D6G4REZN-BnbKbjb5.js} +1 -1
  22. package/out/renderer/assets/{chunk-RZ5BOZE2-BrJk5jSy.js → chunk-RZ5BOZE2-fE5orPok.js} +1 -1
  23. package/out/renderer/assets/{chunk-XZIHB7SX-Ct7sEJeN.js → chunk-XZIHB7SX-BocbG9za.js} +1 -1
  24. package/out/renderer/assets/classDiagram-GIVACNV2-wz5OSVRz.js +1 -0
  25. package/out/renderer/assets/classDiagram-v2-COTLJTTW-wz5OSVRz.js +1 -0
  26. package/out/renderer/assets/clone-VMNU3Wnj.js +1 -0
  27. package/out/renderer/assets/{console-mirror-DZYqU_Y0.js → console-mirror-Biqf_qft.js} +1 -1
  28. package/out/renderer/assets/{consoleCapture-C1mA9bas.js → consoleCapture-OrznafR2.js} +1 -1
  29. package/out/renderer/assets/{conversation-input-sync-BDD5IcnH.js → conversation-input-sync-BwzJoCux.js} +257 -260
  30. package/out/renderer/assets/{dagre-OKDRZEBW-BOaauqFt.js → dagre-OKDRZEBW-CzB91IzU.js} +1 -1
  31. package/out/renderer/assets/{diagram-SSKATNLV-uExZkj8T.js → diagram-SSKATNLV-Bg5RhMEV.js} +1 -1
  32. package/out/renderer/assets/{diagram-VNBRO52H-Cq3LidRx.js → diagram-VNBRO52H-C1BWQ4vB.js} +1 -1
  33. package/out/renderer/assets/{erDiagram-Q7BY3M3F-dZe4cj0o.js → erDiagram-Q7BY3M3F-DjPk0V9l.js} +1 -1
  34. package/out/renderer/assets/{error-boundary--NwIbr7b.js → error-boundary-vmQ5tlCX.js} +4 -4
  35. package/out/renderer/assets/{flowDiagram-4HSFHLVR-XNGjxIUH.js → flowDiagram-4HSFHLVR-DqqDHbny.js} +1 -1
  36. package/out/renderer/assets/{ganttDiagram-APWFNJXF-BmHy8No7.js → ganttDiagram-APWFNJXF-6VnttUUq.js} +1 -1
  37. package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-49Keol_N.js → gitGraphDiagram-7IBYFJ6S-B2x6qu8n.js} +1 -1
  38. package/out/renderer/assets/{graph-CnkDtGXQ.js → graph-C6vbd8o2.js} +1 -1
  39. package/out/renderer/assets/{hash-BPbfeX-Z.js → hash-L2ujAC5o.js} +1 -1
  40. package/out/renderer/assets/{heart-BrZXiFCO.js → heart-DpdW9OuA.js} +1 -1
  41. package/out/renderer/assets/{index-BaGz6zcP.js → index-C6H07UMx.js} +1 -1
  42. package/out/renderer/assets/{index-BNz6rAaW.js → index-C80Kbbvh.js} +1 -1
  43. package/out/renderer/assets/index-DLDgY5fY.css +1 -0
  44. package/out/renderer/assets/{index-QsW4kELd.js → index-DOUqLzli.js} +212 -212
  45. package/out/renderer/assets/index-DZ0oVvBQ.js +55 -0
  46. package/out/renderer/assets/infoDiagram-PH2N3AL5-BNvFBjw9.js +2 -0
  47. package/out/renderer/assets/installer-ROSRHzoN.js +1 -0
  48. package/out/renderer/assets/{journeyDiagram-U35MCT3I-n_M_559I.js → journeyDiagram-U35MCT3I-iD67_k23.js} +1 -1
  49. package/out/renderer/assets/{kanban-definition-NDS4AKOZ-DMlK_O8P.js → kanban-definition-NDS4AKOZ-BOEu-vrY.js} +1 -1
  50. package/out/renderer/assets/{layout-DEDBIH-c.js → layout-B6vENNCe.js} +1 -1
  51. package/out/renderer/assets/legacy-agents-page-B7Wl6Uer.js +33 -0
  52. package/out/renderer/assets/{library-page-B63NCgBZ.js → library-page-B4nuLGOL.js} +20 -20
  53. package/out/renderer/assets/{mermaid.core-DjqyuNnS.js → mermaid.core-CIDX9z6e.js} +19 -19
  54. package/out/renderer/assets/mesh-page-CDYqDvSH.js +1 -0
  55. package/out/renderer/assets/messages-DbS1PwZU.js +27 -0
  56. package/out/renderer/assets/{mindmap-definition-ALO5MXBD-Dupy6ZMo.js → mindmap-definition-ALO5MXBD-DZFrqoQW.js} +1 -1
  57. package/out/renderer/assets/{mini-FETdH6cx.js → mini-BXzq_AA1.js} +1 -1
  58. package/out/renderer/assets/{notebook-pen-D1EpDnlr.js → notebook-pen-CMhgSRMw.js} +1 -1
  59. package/out/renderer/assets/{org-access-CWUOPtx3.js → org-access-CGaaYfna.js} +1 -1
  60. package/out/renderer/assets/{org-surface-gate-Dfe6IW6h.js → org-surface-gate-CGfGEFG5.js} +1 -1
  61. package/out/renderer/assets/{page-header-B3bOo0UX.js → page-header-CdCjG9NV.js} +1 -1
  62. package/out/renderer/assets/path-utils-CwYffJ73.js +58 -0
  63. package/out/renderer/assets/{pieDiagram-IB7DONF6-CQyDM6gY.js → pieDiagram-IB7DONF6-DA8UkA6f.js} +1 -1
  64. package/out/renderer/assets/projects-page-Cn-KQN1u.js +45 -0
  65. package/out/renderer/assets/{publication-validation-k7S0tWBX.js → publication-validation-tcVifSwS.js} +1 -1
  66. package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-Ak7UQ-OV.js → quadrantDiagram-7GDLP6J5-DfViwx-_.js} +1 -1
  67. package/out/renderer/assets/{radar-MK3ICKWK-CSn4i6lj.js → radar-MK3ICKWK-DybxyfeY.js} +1 -1
  68. package/out/renderer/assets/{radient-auth-buttons-DuGE8XTY.js → radient-auth-buttons-ByMhjwK9.js} +1 -1
  69. package/out/renderer/assets/{requirementDiagram-KVF5MWMF-CBYNrzi6.js → requirementDiagram-KVF5MWMF-BHJJn_m3.js} +1 -1
  70. package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-D1Hj29Pl.js → sankeyDiagram-QLVOVGJD-DRtuiTmO.js} +1 -1
  71. package/out/renderer/assets/{schedules-page-D_-ba0FU.js → schedules-page-CWm4pp8U.js} +12 -12
  72. package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-xikcZJiP.js → sequenceDiagram-X6HHIX6F-BS-1w7ox.js} +1 -1
  73. package/out/renderer/assets/settings-page-D7ZRdQEG.js +287 -0
  74. package/out/renderer/assets/{smartart-BSlwSDRE.js → smartart-D3PbCQe4.js} +1 -1
  75. package/out/renderer/assets/{stateDiagram-DGXRK772-9l_IpDEE.js → stateDiagram-DGXRK772-Bejx0VAi.js} +1 -1
  76. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-B-QCGmZj.js +1 -0
  77. package/out/renderer/assets/team-bridge-page-DrLX5SLK.js +21 -0
  78. package/out/renderer/assets/{timeline-definition-BDJGKUSR-BdXZrNNw.js → timeline-definition-BDJGKUSR-C1Rfmu0P.js} +1 -1
  79. package/out/renderer/assets/{use-download-agent-mutation-jPT3Mbn-.js → use-download-agent-mutation-BS29ofCo.js} +2 -2
  80. package/out/renderer/assets/{use-session-snapshot-DKVI2EOX.js → use-session-snapshot-DoZQzNKC.js} +1 -1
  81. package/out/renderer/assets/{xychartDiagram-VJFVF3MP-20Xo8qRt.js → xychartDiagram-VJFVF3MP-rQhoehfj.js} +1 -1
  82. package/out/renderer/browser-approvals-overlay.html +2 -2
  83. package/out/renderer/console-capture.html +6 -6
  84. package/out/renderer/index.html +8 -8
  85. package/out/renderer/installer.html +5 -5
  86. package/out/renderer/mini.html +8 -8
  87. package/package.json +4 -4
  88. package/out/renderer/assets/browser-page-CpskeShW.js +0 -1
  89. package/out/renderer/assets/channel-BaHap1lA.js +0 -1
  90. package/out/renderer/assets/classDiagram-GIVACNV2-BQJOqAFd.js +0 -1
  91. package/out/renderer/assets/classDiagram-v2-COTLJTTW-BQJOqAFd.js +0 -1
  92. package/out/renderer/assets/clone-DrReGn3F.js +0 -1
  93. package/out/renderer/assets/index-DhltrflG.js +0 -55
  94. package/out/renderer/assets/index-UXcKfWo6.css +0 -1
  95. package/out/renderer/assets/infoDiagram-PH2N3AL5-CK-0Q3Nw.js +0 -2
  96. package/out/renderer/assets/installer-C38KNAZa.js +0 -1
  97. package/out/renderer/assets/legacy-agents-page-VA3GryfD.js +0 -33
  98. package/out/renderer/assets/mesh-page-Bqns7KLZ.js +0 -1
  99. package/out/renderer/assets/messages-iLQrQMz2.js +0 -3
  100. package/out/renderer/assets/path-utils-D4lxN8Wn.js +0 -58
  101. package/out/renderer/assets/projects-page-BjAPFYDN.js +0 -45
  102. package/out/renderer/assets/settings-page-leUbM4YH.js +0 -287
  103. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-Bx04P0q6.js +0 -1
  104. package/out/renderer/assets/team-bridge-page-CKVgbNNA.js +0 -16
@@ -1,287 +0,0 @@
1
- import{r as l,j as t,c as ue,t as Us}from"./index-DhltrflG.js";import{o as Bs}from"./console-mirror-DZYqU_Y0.js";import{c9 as zt,ca as Vs,cb as xn,cc as Ke,bu as Hs,a3 as Qn,a4 as Xt,T as Zn,aq as qs,ar as Gs,cd as Ys,ce as Ws,cf as Qs,cg as Zs,ch as Jn,ci as en,a1 as Xn,cj as Js,ck as Xs,at as $t,cl as yn,cm as ea,cn as pt,co as Pt,bc as es,cp as tn,bG as ht,b1 as ta,cq as ts,a0 as na,cr as sa,cs as aa,ct as ia,cu as oa,cv as ra,cw as la,S as ns,av as Kt,aw as Ut,aA as ca,bV as Bt,cx as da,cy as ua,cz as Vt,cA as ga,cB as ma,cC as _a,cD as ss,cE as pa,cF as ha,cG as fa,ap as xa,cH as as,au as is,cI as os,cJ as ya,cK as va,cL as ba,cM as ka,cN as ja,cO as wa,cP as Na,cQ as Sa,bp as rs,aZ as Ma,cR as et,cS as vn,cT as Ca,cU as Aa,cV as Ea,cW as Ia,cX as Ra,cY as Ta,bw as La,cZ as Oa,c_ as Fa,c$ as Da,d0 as bn,d1 as za,d2 as $a,d3 as Pa,bN as Ka}from"./conversation-input-sync-BDD5IcnH.js";import{h as Ie,u as nn,af as Ua,ag as Ge,a as sn,c as kt,ah as Ba,Y as Va,ai as Ha,aj as qa,ak as Ga,al as Ya,d as _e,am as Wa,x as Ue,an as Qa,ao as Za,ap as Ja,D as an,aq as Xa,q as st,ar as ei,A as ls,r as ti,L as ni,as as Ht,at as si,au as cs,V as ai}from"./path-utils-D4lxN8Wn.js";import{cC as ds,cD as ii,cE as oi,cF as us,cG as ri,cH as li,cI as Fe,cJ as ci,S as gs,ca as rt,cb as me,cK as ce,cL as di,cw as ui,cM as gi,aL as kn,cN as mi,cO as _i,cP as dt,c9 as pi,cl as hi,cQ as fi,cR as xi,cS as yi,cT as vi,b$ as jn,cU as bi,bR as ki,c6 as wn,cv as ji,c7 as wi,c8 as Ni,cV as Si,b_ as Mi,cW as Ci}from"./index-QsW4kELd.js";import{P as Ai}from"./page-header-B3bOo0UX.js";import{c as R,u as se,B as D,S as ye,M as ms,l as Je,Y as jt,Z as wt,_ as Qe,A as ae,m as Nt,n as Ae,k as xe,F as on,G as rn,H as ln,J as cn,K as Ze,L as Ee,I as De,a4 as St,N as Ei,z as it,C as qt,ac as Ii,g as _s,ag as Nn,T as ps,q as Ri,r as Ti,s as Li,v as Oi,w as Sn,p as Fi,E as Di,ah as zi,a8 as $i}from"./error-boundary--NwIbr7b.js";import{t as n,L as Pi}from"./messages-iLQrQMz2.js";import{R as Ki}from"./radient-auth-buttons-DuGE8XTY.js";import{N as Ui}from"./notebook-pen-D1EpDnlr.js";import{B as Bi}from"./book-open-BrntK3Uq.js";import{a as Vi,p as At}from"./parseISO-BHJWTxrA.js";import{i as Hi,a as qe,f as qi}from"./format-esAOn2VS.js";import{t as Gi}from"./en-US-CHJkXXr4.js";/**
2
- * @license lucide-react v0.507.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const Yi=[["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"}]],Wi=R("aperture",Yi);/**
7
- * @license lucide-react v0.507.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const Qi=[["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"}]],Zi=R("atom",Qi);/**
12
- * @license lucide-react v0.507.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const Ji=[["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"}]],Xi=R("audio-waveform",Ji);/**
17
- * @license lucide-react v0.507.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */const eo=[["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"}]],to=R("binary",eo);/**
22
- * @license lucide-react v0.507.0 - ISC
23
- *
24
- * This source code is licensed under the ISC license.
25
- * See the LICENSE file in the root directory of this source tree.
26
- */const no=[["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"}]],so=R("candy",no);/**
27
- * @license lucide-react v0.507.0 - ISC
28
- *
29
- * This source code is licensed under the ISC license.
30
- * See the LICENSE file in the root directory of this source tree.
31
- */const ao=[["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"}]],io=R("car-front",ao);/**
32
- * @license lucide-react v0.507.0 - ISC
33
- *
34
- * This source code is licensed under the ISC license.
35
- * See the LICENSE file in the root directory of this source tree.
36
- */const oo=[["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"}]],ro=R("cassette-tape",oo);/**
37
- * @license lucide-react v0.507.0 - ISC
38
- *
39
- * This source code is licensed under the ISC license.
40
- * See the LICENSE file in the root directory of this source tree.
41
- */const lo=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],co=R("chart-line",lo);/**
42
- * @license lucide-react v0.507.0 - ISC
43
- *
44
- * This source code is licensed under the ISC license.
45
- * See the LICENSE file in the root directory of this source tree.
46
- */const uo=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],go=R("circle-plus",uo);/**
47
- * @license lucide-react v0.507.0 - ISC
48
- *
49
- * This source code is licensed under the ISC license.
50
- * See the LICENSE file in the root directory of this source tree.
51
- */const mo=[["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"}]],_o=R("circuit-board",mo);/**
52
- * @license lucide-react v0.507.0 - ISC
53
- *
54
- * This source code is licensed under the ISC license.
55
- * See the LICENSE file in the root directory of this source tree.
56
- */const po=[["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"}]],ho=R("cloud-lightning",po);/**
57
- * @license lucide-react v0.507.0 - ISC
58
- *
59
- * This source code is licensed under the ISC license.
60
- * See the LICENSE file in the root directory of this source tree.
61
- */const fo=[["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"}]],xo=R("cloud-moon",fo);/**
62
- * @license lucide-react v0.507.0 - ISC
63
- *
64
- * This source code is licensed under the ISC license.
65
- * See the LICENSE file in the root directory of this source tree.
66
- */const yo=[["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"}]],vo=R("cloud-snow",yo);/**
67
- * @license lucide-react v0.507.0 - ISC
68
- *
69
- * This source code is licensed under the ISC license.
70
- * See the LICENSE file in the root directory of this source tree.
71
- */const bo=[["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"}]],ko=R("cloud-sun",bo);/**
72
- * @license lucide-react v0.507.0 - ISC
73
- *
74
- * This source code is licensed under the ISC license.
75
- * See the LICENSE file in the root directory of this source tree.
76
- */const jo=[["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"}]],wo=R("coffee",jo);/**
77
- * @license lucide-react v0.507.0 - ISC
78
- *
79
- * This source code is licensed under the ISC license.
80
- * See the LICENSE file in the root directory of this source tree.
81
- */const No=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 18a6 6 0 0 0 0-12v12z",key:"j4l70d"}]],hs=R("contrast",No);/**
82
- * @license lucide-react v0.507.0 - ISC
83
- *
84
- * This source code is licensed under the ISC license.
85
- * See the LICENSE file in the root directory of this source tree.
86
- */const So=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Mo=R("credit-card",So);/**
87
- * @license lucide-react v0.507.0 - ISC
88
- *
89
- * This source code is licensed under the ISC license.
90
- * See the LICENSE file in the root directory of this source tree.
91
- */const Co=[["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"}]],Ao=R("cup-soda",Co);/**
92
- * @license lucide-react v0.507.0 - ISC
93
- *
94
- * This source code is licensed under the ISC license.
95
- * See the LICENSE file in the root directory of this source tree.
96
- */const Eo=[["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"}]],Io=R("disc-3",Eo);/**
97
- * @license lucide-react v0.507.0 - ISC
98
- *
99
- * This source code is licensed under the ISC license.
100
- * See the LICENSE file in the root directory of this source tree.
101
- */const Ro=[["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"}]],To=R("droplet",Ro);/**
102
- * @license lucide-react v0.507.0 - ISC
103
- *
104
- * This source code is licensed under the ISC license.
105
- * See the LICENSE file in the root directory of this source tree.
106
- */const Lo=[["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"}]],Oo=R("droplets",Lo);/**
107
- * @license lucide-react v0.507.0 - ISC
108
- *
109
- * This source code is licensed under the ISC license.
110
- * See the LICENSE file in the root directory of this source tree.
111
- */const Fo=[["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"}]],Do=R("fish",Fo);/**
112
- * @license lucide-react v0.507.0 - ISC
113
- *
114
- * This source code is licensed under the ISC license.
115
- * See the LICENSE file in the root directory of this source tree.
116
- */const zo=[["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"}]],$o=R("flame",zo);/**
117
- * @license lucide-react v0.507.0 - ISC
118
- *
119
- * This source code is licensed under the ISC license.
120
- * See the LICENSE file in the root directory of this source tree.
121
- */const Po=[["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"}]],Ko=R("flower-2",Po);/**
122
- * @license lucide-react v0.507.0 - ISC
123
- *
124
- * This source code is licensed under the ISC license.
125
- * See the LICENSE file in the root directory of this source tree.
126
- */const Uo=[["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"}]],Bo=R("flower",Uo);/**
127
- * @license lucide-react v0.507.0 - ISC
128
- *
129
- * This source code is licensed under the ISC license.
130
- * See the LICENSE file in the root directory of this source tree.
131
- */const Vo=[["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"}]],Ho=R("ghost",Vo);/**
132
- * @license lucide-react v0.507.0 - ISC
133
- *
134
- * This source code is licensed under the ISC license.
135
- * See the LICENSE file in the root directory of this source tree.
136
- */const qo=[["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"}]],Go=R("github",qo);/**
137
- * @license lucide-react v0.507.0 - ISC
138
- *
139
- * This source code is licensed under the ISC license.
140
- * See the LICENSE file in the root directory of this source tree.
141
- */const Yo=[["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"}]],Wo=R("guitar",Yo);/**
142
- * @license lucide-react v0.507.0 - ISC
143
- *
144
- * This source code is licensed under the ISC license.
145
- * See the LICENSE file in the root directory of this source tree.
146
- */const Qo=[["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"}]],Zo=R("hexagon",Qo);/**
147
- * @license lucide-react v0.507.0 - ISC
148
- *
149
- * This source code is licensed under the ISC license.
150
- * See the LICENSE file in the root directory of this source tree.
151
- */const Jo=[["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"}]],Xo=R("ice-cream-bowl",Jo);/**
152
- * @license lucide-react v0.507.0 - ISC
153
- *
154
- * This source code is licensed under the ISC license.
155
- * See the LICENSE file in the root directory of this source tree.
156
- */const er=[["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"}]],tr=R("joystick",er);/**
157
- * @license lucide-react v0.507.0 - ISC
158
- *
159
- * This source code is licensed under the ISC license.
160
- * See the LICENSE file in the root directory of this source tree.
161
- */const nr=[["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"}]],sr=R("leaf",nr);/**
162
- * @license lucide-react v0.507.0 - ISC
163
- *
164
- * This source code is licensed under the ISC license.
165
- * See the LICENSE file in the root directory of this source tree.
166
- */const ar=[["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"}]],ir=R("lightbulb",ar);/**
167
- * @license lucide-react v0.507.0 - ISC
168
- *
169
- * This source code is licensed under the ISC license.
170
- * See the LICENSE file in the root directory of this source tree.
171
- */const or=[["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"}]],rr=R("milk",or);/**
172
- * @license lucide-react v0.507.0 - ISC
173
- *
174
- * This source code is licensed under the ISC license.
175
- * See the LICENSE file in the root directory of this source tree.
176
- */const lr=[["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"}]],cr=R("moon-star",lr);/**
177
- * @license lucide-react v0.507.0 - ISC
178
- *
179
- * This source code is licensed under the ISC license.
180
- * See the LICENSE file in the root directory of this source tree.
181
- */const dr=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],ur=R("moon",dr);/**
182
- * @license lucide-react v0.507.0 - ISC
183
- *
184
- * This source code is licensed under the ISC license.
185
- * See the LICENSE file in the root directory of this source tree.
186
- */const gr=[["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"}]],mr=R("mountain-snow",gr);/**
187
- * @license lucide-react v0.507.0 - ISC
188
- *
189
- * This source code is licensed under the ISC license.
190
- * See the LICENSE file in the root directory of this source tree.
191
- */const _r=[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]],pr=R("mountain",_r);/**
192
- * @license lucide-react v0.507.0 - ISC
193
- *
194
- * This source code is licensed under the ISC license.
195
- * See the LICENSE file in the root directory of this source tree.
196
- */const hr=[["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"}]],fr=R("radio",hr);/**
197
- * @license lucide-react v0.507.0 - ISC
198
- *
199
- * This source code is licensed under the ISC license.
200
- * See the LICENSE file in the root directory of this source tree.
201
- */const xr=[["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"}]],yr=R("sailboat",xr);/**
202
- * @license lucide-react v0.507.0 - ISC
203
- *
204
- * This source code is licensed under the ISC license.
205
- * See the LICENSE file in the root directory of this source tree.
206
- */const vr=[["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"}]],br=R("shirt",vr);/**
207
- * @license lucide-react v0.507.0 - ISC
208
- *
209
- * This source code is licensed under the ISC license.
210
- * See the LICENSE file in the root directory of this source tree.
211
- */const kr=[["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"}]],jr=R("skull",kr);/**
212
- * @license lucide-react v0.507.0 - ISC
213
- *
214
- * This source code is licensed under the ISC license.
215
- * See the LICENSE file in the root directory of this source tree.
216
- */const wr=[["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"}]],Nr=R("snowflake",wr);/**
217
- * @license lucide-react v0.507.0 - ISC
218
- *
219
- * This source code is licensed under the ISC license.
220
- * See the LICENSE file in the root directory of this source tree.
221
- */const Sr=[["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"}]],Mr=R("sparkle",Sr);/**
222
- * @license lucide-react v0.507.0 - ISC
223
- *
224
- * This source code is licensed under the ISC license.
225
- * See the LICENSE file in the root directory of this source tree.
226
- */const Cr=[["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"}]],Ar=R("sun-dim",Cr);/**
227
- * @license lucide-react v0.507.0 - ISC
228
- *
229
- * This source code is licensed under the ISC license.
230
- * See the LICENSE file in the root directory of this source tree.
231
- */const Er=[["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"}]],Ir=R("sun",Er);/**
232
- * @license lucide-react v0.507.0 - ISC
233
- *
234
- * This source code is licensed under the ISC license.
235
- * See the LICENSE file in the root directory of this source tree.
236
- */const Rr=[["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"}]],Tr=R("sunrise",Rr);/**
237
- * @license lucide-react v0.507.0 - ISC
238
- *
239
- * This source code is licensed under the ISC license.
240
- * See the LICENSE file in the root directory of this source tree.
241
- */const Lr=[["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"}]],Or=R("sunset",Lr);/**
242
- * @license lucide-react v0.507.0 - ISC
243
- *
244
- * This source code is licensed under the ISC license.
245
- * See the LICENSE file in the root directory of this source tree.
246
- */const Fr=[["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"}]],Dr=R("tent",Fr);/**
247
- * @license lucide-react v0.507.0 - ISC
248
- *
249
- * This source code is licensed under the ISC license.
250
- * See the LICENSE file in the root directory of this source tree.
251
- */const zr=[["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"}]],$r=R("tree-deciduous",zr);/**
252
- * @license lucide-react v0.507.0 - ISC
253
- *
254
- * This source code is licensed under the ISC license.
255
- * See the LICENSE file in the root directory of this source tree.
256
- */const Pr=[["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"}]],Kr=R("tree-palm",Pr);/**
257
- * @license lucide-react v0.507.0 - ISC
258
- *
259
- * This source code is licensed under the ISC license.
260
- * See the LICENSE file in the root directory of this source tree.
261
- */const Ur=[["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"}]],Br=R("tree-pine",Ur);/**
262
- * @license lucide-react v0.507.0 - ISC
263
- *
264
- * This source code is licensed under the ISC license.
265
- * See the LICENSE file in the root directory of this source tree.
266
- */const Vr=[["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"}]],Hr=R("trees",Vr);/**
267
- * @license lucide-react v0.507.0 - ISC
268
- *
269
- * This source code is licensed under the ISC license.
270
- * See the LICENSE file in the root directory of this source tree.
271
- */const qr=[["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"}]],Gr=R("umbrella",qr);/**
272
- * @license lucide-react v0.507.0 - ISC
273
- *
274
- * This source code is licensed under the ISC license.
275
- * See the LICENSE file in the root directory of this source tree.
276
- */const Yr=[["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"}]],Wr=R("waves",Yr);/**
277
- * @license lucide-react v0.507.0 - ISC
278
- *
279
- * This source code is licensed under the ISC license.
280
- * See the LICENSE file in the root directory of this source tree.
281
- */const Qr=[["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"}]],Zr=R("wheat",Qr);/**
282
- * @license lucide-react v0.507.0 - ISC
283
- *
284
- * This source code is licensed under the ISC license.
285
- * See the LICENSE file in the root directory of this source tree.
286
- */const Jr=[["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"}]],Xr=R("wind",Jr),el=({appVersion:e=null,slowWaitHintMs:s})=>{se();const a="https://local-operator.com/download",[i,o]=l.useState(!1),r=ds(i,s??ii),[d,g]=l.useState(!1),[c,u]=l.useState(null),[y,p]=l.useState("info"),[f,_]=l.useState(null),[x,v]=l.useState(null),N=e?.trim()?e.trim():null,z=l.useRef(!1),C=zt($=>$.openDetail),E=l.useRef(!1),b=l.useRef(0),k=l.useRef(!1),w=l.useCallback(($,U)=>{E.current=!1,u($),p(U),g(!0)},[]),G=l.useCallback($=>{E.current=!0,u($),p("success"),g(!0)},[]),Y=l.useCallback(()=>{E.current&&(E.current=!1,g(!1),u(null))},[]),{clearDeferredUpdate:W}=Vs();l.useEffect(()=>{const $=window.api.updater.onUpdateError(m=>{z.current&&m.includes("manually")&&(_({message:n("ui.common.updates.check_for_updates_button.the_server_is_installed_outside_the_app_so_use_the_tool_you_insta"),command:""}),E.current=!1,u(null),p("warning"),g(!0))}),U=window.api.updater.onBackendUpdateDevMode(m=>{z.current&&w(m,"info")}),V=()=>{k.current=!0,Y()},H=window.api.updater.onUpdateAvailable(V),q=window.api.updater.onUpdateNpxAvailable(V),te=window.api.updater.onBackendUpdateAvailable(V);return()=>{$(),U(),H(),q(),te()}},[Y,w]),l.useEffect(()=>{let $=!1;const U=()=>{window.api.updater.getLastInstallAttempt().then(H=>{$||v(H)}).catch(()=>{})};U();const V=window.api.updater.onUpdateInstallFailed(()=>U());return()=>{$=!0,V()}},[]);const S=async()=>{const $=++b.current;Y(),k.current=!1;try{o(!0),z.current=!0,W(Ke.UI),W(Ke.BACKEND);const U=await window.api.updater.checkForAllUpdates({manual:!0});if($!==b.current)return;U.app==="available"&&C(Ke.UI),U.server==="available"&&C(Ke.BACKEND),U?.affirmation&&!k.current?G(U.affirmation):Y()}catch(U){if($!==b.current)return;console.warn(`Update check failed; the app-level alert owns the report: ${oi(U)}`)}finally{$===b.current&&o(!1),setTimeout(()=>{z.current=!1},2e3)}},I=()=>{E.current=!1,g(!1),u(null)};return t.jsxs(t.Fragment,{children:[x&&t.jsxs("div",{className:"mb-3 rounded-sm bg-sunken p-3",children:[t.jsxs("p",{className:"text-body-sm text-ink",children:[n("ui.common.updates.check_for_updates_button.the_last_update_to_version"),x.targetVersion," ",n("ui.common.updates.check_for_updates_button.didn_t_finish"),x.attempts>1?n("ui.common.updates.check_for_updates_button.detail",{attempts:x.attempts,attemptsText:String(x.attempts)}):"",".",N?n("ui.common.updates.check_for_updates_button.version",{liveversion:String(N)}):null]}),t.jsxs("p",{className:"mt-1 text-meta text-ink-dim",children:[n("ui.common.updates.check_for_updates_button.detected")," ",x.detectedAt?new Date(x.detectedAt).toLocaleString():"at an unknown time",". ",x.detail]}),t.jsx(D,{variant:"outline",size:"sm",className:"mt-2",onClick:()=>void window.api.openExternal(a),children:n("ui.common.updates.check_for_updates_button.download_a_fresh_copy")})]}),t.jsxs(D,{variant:"outline",onClick:()=>void S(),disabled:i,children:[i?t.jsx(ye,{size:"sm"}):null,i?n("ui.common.updates.check_for_updates_button.checking"):n("ui.common.updates.check_for_updates_button.check_for_updates")]}),r&&t.jsx("p",{className:"mt-2 text-meta text-ink-muted",children:n("ui.common.updates.check_for_updates_button.still_checking_a_slow_or_stalled_connection_can_hold_this_for_abo")}),f&&t.jsxs(xn,{open:d,autoHideDuration:1e4,onClose:I,variant:"warning",children:[t.jsx("p",{className:"text-body-sm",children:f.message}),f.command&&t.jsx("code",{className:"mt-2 block rounded-sm bg-sunken p-2 text-mono-sm text-ink",children:f.command})]}),c&&y!=="danger"&&t.jsx(xn,{open:d,autoHideDuration:6e3,onClose:I,variant:y,children:c})]})},ft=["system-prompt"],tl=()=>{const{shouldEnableQuery:e}=Hs();return Ie({enabled:e({bypassInternetCheck:!0}),queryKey:ft,queryFn:async()=>{try{const a=await Qn(Xt.baseUrl).config.getSystemPrompt();if(a===null)return null;if(a.status>=400)throw new Error(a.message||"Failed to fetch system prompt");return a.result}catch(s){const a=s instanceof Error?s.message:"An unknown error occurred while fetching system prompt";throw Zn(a),s}},refetchOnWindowFocus:!1,staleTime:5e3})},nl=()=>{const e=nn(),s=Qn(Xt.baseUrl);return qs({mutationFn:async a=>{try{const i=await s.config.updateSystemPrompt(a);if(i.status>=400)throw new Error(i.message||"Failed to update system prompt");return i.result}catch(i){const o=i instanceof Error?i.message:"An unknown error occurred while updating system prompt";throw Zn(o),i}},onSuccess:async a=>{await e.invalidateQueries({queryKey:ft,refetchType:"none"}),e.setQueryData(ft,i=>i&&{...i,...a}),await e.refetchQueries({queryKey:ft,type:"all"}),Gs("System prompt updated")},onError:a=>{console.error("Error updating system prompt:",a)}})},fs=({value:e,label:s,description:a,onChange:i,icon:o,isSaving:r=!1,disabled:d=!1})=>{const[g,c]=l.useState(e),u=l.useId(),y=`${u}-label`,p=`${u}-description`,f=async _=>{if(!(r||d)){c(_);try{await i(_)}catch(x){c(!_),console.error("Error toggling setting:",x)}}};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:y,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"}),s]}),a&&t.jsx("p",{id:p,className:"mt-0.5 max-w-2xl text-body-sm text-ink-muted",children:a})]}),t.jsx("div",{className:"flex h-6 shrink-0 items-center",children:r?t.jsx(ye,{size:"md",label:`Saving ${s}`}):t.jsx(ms,{checked:g,onCheckedChange:f,disabled:d,"aria-labelledby":y,"aria-describedby":a?p:void 0})})]})};function Mn(e,s){const a=Gi(e,s?.in);if(!Hi(a))throw new RangeError("Invalid time value");const i=qe(a.getDate(),2),o=qe(a.getMonth()+1,2),r=a.getFullYear(),d=qe(a.getHours(),2),g=qe(a.getMinutes(),2),c=qe(a.getSeconds(),2);let u="",y="";const p=a.getTimezoneOffset();if(p!==0){const f=Math.abs(p),_=qe(Math.trunc(f/60),2),x=qe(f%60,2);y=`${p<0?"+":"-"}${_}:${x}`}else y="Z";return`${r}-${o}-${i}T${d}:${g}:${c}${u}${y}`}function sl(e,s,a){return Vi(e,-30,a)}var al=Ys({chartName:"LineChart",GraphicalChild:Jn,axisComponents:[{axisType:"xAxis",AxisComp:Ws},{axisType:"yAxis",AxisComp:Qs}],formatAxisMap:Zs});const il=["radient","creditBalance"],ol=e=>{const{user:s,isAuthenticated:a}=en(),i=s?.account?.tenant_id,o=a&&!!i&&e?.enabled;return Ie({queryKey:[il,i],queryFn:async()=>{if(!i)throw new Error("Tenant ID not available");const r=await Xn({operation:"credits",tenantId:i});if(!r||typeof r.balance!="number")throw new Error("Invalid credit balance response format");return r},enabled:o,staleTime:5*60*1e3,refetchOnWindowFocus:!0})},rl=["radient","usageRollup"],ll=(e,s)=>{const{user:a,isAuthenticated:i}=en(),o=a?.account?.tenant_id,r=i&&!!o&&s?.enabled;return Ie({queryKey:[...rl,o,e],queryFn:async()=>{if(!o)throw new Error("Tenant ID not available");const d={};for(const[c,u]of Object.entries(e))u!=null&&(d[c]=String(u));const g=await Xn({operation:"usage",tenantId:o,query:d});if(!g)throw new Error("Invalid usage rollup response format");return g},enabled:r,staleTime:5*60*1e3,refetchOnWindowFocus:!0})},cl=e=>e==="sidebars"?n("ui.settings.appearance.window_glass.coverage_sidebars"):n("ui.settings.appearance.window_glass.coverage_full"),dl=e=>{switch(e){case"window":return n("ui.settings.appearance.window_glass.material_window");case"menu":return n("ui.settings.appearance.window_glass.material_menu");case"popover":return n("ui.settings.appearance.window_glass.material_popover");case"mica":return n("ui.settings.appearance.window_glass.material_mica");case"acrylic":return n("ui.settings.appearance.window_glass.material_acrylic");case"tabbed":return n("ui.settings.appearance.window_glass.material_tabbed")}},ul=e=>{switch(e){case"reduced-transparency":return n("ui.settings.appearance.window_glass.unsupported_reduced_transparency");case"windows-too-old":return n("ui.settings.appearance.window_glass.unsupported_windows_too_old");case"windows-unverified":return n("ui.settings.appearance.window_glass.unsupported_windows_unverified");case"linux-compositor-dependent":return n("ui.settings.appearance.window_glass.unsupported_linux");case"hardware-acceleration-disabled":return n("ui.settings.appearance.window_glass.unsupported_acceleration");case"gpu-unavailable":return n("ui.settings.appearance.window_glass.unsupported_gpu");case"backdrop-filter-unavailable":return n("ui.settings.appearance.window_glass.unsupported_backdrop_filter");default:return n("ui.settings.appearance.window_glass.unsupported_other")}},Cn=({label:e,description:s,value:a,onValueChange:i,options:o})=>{const r=l.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:r,className:"flex min-h-6 items-center text-body text-ink",children:e}),t.jsx("p",{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:t.jsx(jt,{value:a,onValueChange:i,children:t.jsx(wt,{"aria-labelledby":r,children:o.map(d=>t.jsx(Qe,{value:d.value,children:d.label},d.value))})})})]})},gl=({state:e,onChange:s})=>{se();const a=l.useId(),i=`${a}-description`,[o,r]=l.useState(null),d=l.useRef(!1),g=l.useRef(null),c=e?.settings.intensity??0;if(!e)return null;const u=!e.capability.supported,y=u?ul(e.capability.reason):null,p=async x=>{if(d.current){g.current=x;return}d.current=!0;try{await s({intensity:x})}finally{d.current=!1;const v=g.current;g.current=null,v!==null&&v!==x?p(v):r(null)}},f=e.settings.enabled,_=o??c;return t.jsxs("div",{className:"flex flex-col gap-4","data-window-glass":"","data-glass-gate":e.capability.reason,children:[t.jsx(Je,{content:y,disabled:!u,children:t.jsx("div",{className:u?"opacity-60":void 0,children:t.jsx(fs,{value:u?!1:f,disabled:u,label:n("ui.settings.appearance.window_glass.label"),description:n("ui.settings.appearance.window_glass.description"),onChange:async x=>s({enabled:x})},u?"unavailable":"available")})}),y&&t.jsx("p",{"data-glass-unsupported":e.capability.reason,className:"max-w-2xl text-body-sm text-ink-muted",children:y}),e.restartRequired&&t.jsx("output",{className:"block max-w-2xl text-body-sm text-ink","data-glass-restart":"",children:n("ui.settings.appearance.window_glass.restart_needed")}),f&&!u&&t.jsxs(t.Fragment,{children:[t.jsx(Cn,{label:n("ui.settings.appearance.window_glass.coverage_label"),description:n("ui.settings.appearance.window_glass.coverage_description"),value:e.settings.coverage,onValueChange:x=>void s({coverage:x}),options:Js.map(x=>({value:x,label:cl(x)}))}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex min-h-6 items-center justify-between gap-3",children:[t.jsx("label",{htmlFor:a,className:"text-body text-ink",children:n("ui.settings.appearance.window_glass.intensity_label")}),t.jsx("span",{"data-glass-readout":"",className:"shrink-0 text-meta text-ink-dim tabular-nums",children:n("ui.settings.appearance.window_glass.intensity_value",{value:String(_)})})]}),t.jsx("p",{id:i,className:"mt-0.5 max-w-2xl text-body-sm text-ink-muted",children:n("ui.settings.appearance.window_glass.intensity_description")}),t.jsx("input",{id:a,type:"range",min:0,max:100,step:5,value:_,"aria-describedby":i,"aria-valuetext":n("ui.settings.appearance.window_glass.intensity_value",{value:String(_)}),onChange:x=>{const v=Number(x.target.value);r(v),p(v)},style:{"--fill":`${_}%`},className:"mt-3 h-4 w-full cursor-pointer appearance-none bg-transparent bg-center bg-no-repeat bg-[length:100%_6px] bg-[linear-gradient(to_right,var(--color-accent)_0_var(--fill),var(--color-sunken)_var(--fill)_100%)] [&::-webkit-slider-thumb]:size-4 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-accent [&::-webkit-slider-thumb]:transition-colors [&::-webkit-slider-thumb]:duration-fast [&::-webkit-slider-thumb]:ease-out-quart [&::-webkit-slider-thumb]:hover:bg-accent-hover"}),t.jsxs("div",{"aria-hidden":"true",className:"mt-1 flex justify-between text-meta text-ink-dim",children:[t.jsx("span",{children:n("ui.settings.appearance.window_glass.intensity_start")}),t.jsx("span",{children:n("ui.settings.appearance.window_glass.intensity_end")})]})]}),t.jsx(Cn,{label:n("ui.settings.appearance.window_glass.material_label"),description:n("ui.settings.appearance.window_glass.material_description"),value:e.settings.material,onValueChange:x=>void s({material:x}),options:e.capability.materials.map(x=>({value:x,label:dl(x)}))})]})]})},ml=new Set(["B","C","D","E","F"]);function _l(e){const{status:s,refused:a,everVisible:i,checking:o=!1}=e;return s?s.update_required||s.state==="signed_out"?"absent":s.state==="unavailable"?s.error?.code==="messaging_unavailable"?"dark":i?"error":"absent":s.surface_state==="G"?s.error===null||s.error?.code==="messaging_unavailable"?"dark":"error":s.capability<1||s.state!=="ready"||!s.visibility.settings?"absent":s.surface_state&&ml.has(s.surface_state)?"visible":"absent":o&&i?"visible":a&&i?"error":"absent"}function pl(e,s){return e!=="absent"}function tt(e,s){if(e.surface_state==="F")return"F";const a=s.endpoint;return a?a.state==="paused"?"D":a.state==="disabled"?"E":"C":"B"}const hl="open_chief_of_staff";function fl(e){const s=e?.delivery_hold;if(!s||s.code!==hl||s.count<=0)return null;const a=s.session||e?.local.session||null;return{count:s.count,sessionId:a}}function xs(e){return Ua(e)}function xl(e){return e.target.endpoint_id?{kind:"endpoint",id:e.target.endpoint_id}:{kind:"account",id:e.target.account_id??""}}function Gt(e){return e.map((s,a)=>{const i=xl(s);return{key:`${s.direction}:${s.effect}:${i.kind}:${i.id}:${a}`,direction:s.direction,effect:s.effect,kind:i.kind,id:i.id}})}function Yt(e,s){return e.filter(i=>i.effect==="deny"||s[i.direction]==="listed_only").map(i=>({direction:i.direction,effect:i.effect,target:i.kind==="endpoint"?{endpoint_id:i.id}:{account_id:i.id}})).sort((i,o)=>i.direction.localeCompare(o.direction)||i.effect.localeCompare(o.effect)||JSON.stringify(i.target).localeCompare(JSON.stringify(o.target)))}function ys(e){return JSON.stringify(e)}function yl(e){return e.saving?{disabled:!0,reason:"saving"}:["send","receive"].some(i=>e.modes[i]==="listed_only"&&!e.entries.some(o=>o.direction===i&&o.effect==="allow"))?{disabled:!0,reason:"needs_entry"}:ys(Yt(e.entries,e.modes))===e.savedSignature?{disabled:!0,reason:"unchanged"}:{disabled:!1}}const vl=/^[^\s\p{Cc}]{1,128}$/u;function bl(e){return e===""?n("ui.agentMessages.settings.allowlist.identifier_empty"):e.length>128?n("ui.agentMessages.settings.allowlist.identifier_long"):vl.test(e)?null:n("ui.agentMessages.settings.allowlist.identifier_invalid")}function xt(e){switch(e.code){case"bridge_signin_required":return n("ui.agentMessages.settings.refusal.sign_in");case"bridge_not_available":return n("ui.agentMessages.settings.refusal.not_available");case"bridge_disabled":return n("ui.agentMessages.settings.refusal.disabled");case"rate_limited":return n("ui.agentMessages.settings.refusal.rate_limited");case"invalid_request":return n("ui.agentMessages.settings.refusal.invalid_request");case"consent_version_unknown":return n("ui.agentMessages.settings.consent.changed");case"messaging_unavailable":return n("ui.agentMessages.settings.dark.body");default:return e.message||n("ui.agentMessages.settings.refusal.generic")}}const Et="__none__";function kl({availability:e,status:s,accountId:a,refusal:i=null,api:o=li,onRefreshStatus:r,sessions:d=[],onOpenSession:g}){se();const[c,u]=l.useState({kind:"loading"}),[y,p]=l.useState(0),[f,_]=l.useState(null),[x,v]=l.useState(null),[N,z]=l.useState(s?.local.enabled??!1),[C,E]=l.useState(s?.local.session??""),b=s?.tenant_id??void 0,k=e==="visible",w=s?.account_id??null,G=w!==null&&w===a;l.useEffect(()=>{if(!k)return;let S=!1;return u({kind:"loading"}),v(null),(async()=>{try{const I=await o.settings(b);if(S)return;if(!I){u({kind:"error",refusal:{code:"invalid_response",message:n("ui.agentMessages.settings.error.unreadable")}});return}let $=null;if(I.endpoint){if($=await o.allowlist(I.settings.tenant_id),S)return;if(!$){u({kind:"error",refusal:{code:"invalid_response",message:n("ui.agentMessages.settings.error.unreadable")}});return}}u({kind:"ready",settings:I,allowlist:$})}catch(I){if(S)return;u({kind:"error",refusal:Fe(I)})}})(),()=>{S=!0}},[k,a,w,b,y,o]),l.useEffect(()=>{if(!k||c.kind!=="ready"||!c.settings.endpoint||c.allowlist)return;let S=!1;return(async()=>{try{const I=await o.allowlist(c.settings.settings.tenant_id);if(S||!I)return;u($=>$.kind==="ready"&&!$.allowlist?{...$,allowlist:I}:$)}catch(I){S||v(Fe(I))}})(),()=>{S=!0}},[k,c,o]),l.useEffect(()=>{s&&(z(s.local.enabled),E(s.local.session))},[s]);const Y=()=>p(S=>S+1);if(e==="absent")return null;if(e==="dark")return t.jsxs("div",{"data-agent-messages-section":"",className:"flex flex-col gap-2",children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.agentMessages.settings.dark.title")}),t.jsx("p",{className:"max-w-2xl text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.dark.body")}),t.jsx("p",{className:"max-w-2xl text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.dark.nothing_enabled")})]});if(e==="error")return t.jsx("div",{"data-agent-messages-section":"",children:t.jsxs(ae,{variant:"warning",children:[t.jsx(Nt,{children:n("ui.agentMessages.settings.error.title")}),t.jsxs(Ae,{children:[i?xt(i):n("ui.agentMessages.settings.refusal.generic"),t.jsx(D,{className:"mt-3",variant:"secondary",onClick:()=>{Y(),r(!0)},children:n("ui.agentMessages.settings.error.retry")})]})]})});if(!s||!a)return null;const W=fl(s);return t.jsxs("div",{"data-agent-messages-section":"",className:"flex flex-col gap-6",children:[W&&t.jsx(wl,{count:W.count,onMessage:W.sessionId&&g?()=>g(W.sessionId):void 0}),x&&t.jsx(ae,{variant:"warning",children:t.jsx(Ae,{children:xt(x)})}),c.kind==="loading"&&t.jsx(jl,{}),c.kind==="error"&&t.jsxs(ae,{variant:"warning",children:[t.jsx(Nt,{children:n("ui.agentMessages.settings.error.title")}),t.jsxs(Ae,{children:[c.refusal.code!=="client_unavailable"&&t.jsx("span",{className:"block",children:xt(c.refusal)}),t.jsx("span",{className:"block",children:n("ui.agentMessages.settings.error.no_changes")}),t.jsx(D,{className:"mt-3",variant:"secondary",onClick:Y,children:n("ui.agentMessages.settings.error.retry")})]})]}),c.kind==="ready"&&t.jsxs(t.Fragment,{children:[t.jsx(Cl,{state:tt(s,c.settings),status:s,settings:c.settings,accountId:w??a,accountMatches:G,api:o,pending:f,localEnabled:N,onActionRefusal:v,onSettings:S=>u(I=>I.kind==="ready"?{...I,settings:S}:I),onLocalEnabled:z,onRefreshStatus:r,setPending:_}),t.jsx(Al,{value:C,sessions:d,pending:f==="session",disabled:f!==null,onSave:async S=>{_("session"),v(null);try{await o.localSetting("team_bridge.session",S),E(S),await r(!0)}catch(I){v(Fe(I))}finally{_(null)}}}),c.allowlist&&(tt(s,c.settings)==="C"||tt(s,c.settings)==="D"||tt(s,c.settings)==="F")&&t.jsx(El,{allowlist:c.allowlist,accountId:w??a,accountMatches:G,readOnly:s.read_only===!0&&tt(s,c.settings)==="F",pending:f!==null,onSaving:S=>_(S?"allowlist":null),onRefusal:v,onSaved:S=>u(I=>I.kind==="ready"?{...I,allowlist:S}:I),api:o},c.allowlist.view.tenant_id??"tenant")]})]})}function jl(){return t.jsxs("div",{className:"flex flex-col gap-3","aria-busy":"true",children:[t.jsx(xe,{className:"h-5 w-40"}),t.jsx(xe,{className:"h-4 w-full max-w-xl"}),t.jsx(xe,{className:"h-9 w-36"}),t.jsx(xe,{className:"h-4 w-64"})]})}const wl=({count:e,onMessage:s})=>t.jsx("output",{className:"block","data-agent-messages-hold":"open_chief_of_staff",children:t.jsx(ae,{variant:"info",className:ue(ci,"border-transparent"),children:t.jsxs("div",{className:"flex w-full min-w-0 items-center gap-3",children:[t.jsx("p",{className:"min-w-0 flex-1 text-body-sm text-ink",children:s?n("ui.agentMessages.settings.hold.chief_of_staff",{count:e}):n("ui.agentMessages.settings.hold.chief_of_staff_unlinked",{count:e})}),s&&t.jsx(D,{variant:"ghost",size:"sm",className:"shrink-0 text-ink",onClick:s,children:n("ui.agentMessages.settings.hold.open")})]})})}),Nl=({text:e})=>t.jsx("div",{className:"rounded-md border border-hairline bg-sunken p-3",children:t.jsx("p",{className:"whitespace-pre-wrap text-body-sm text-ink-muted",children:e})}),Sl={B:"ui.agentMessages.settings.state.b_title",C:"ui.agentMessages.settings.state.c_title",D:"ui.agentMessages.settings.state.d_title",E:"ui.agentMessages.settings.state.e_title",F:"ui.agentMessages.settings.state.f_title"},Ml={B:"ui.agentMessages.settings.state.b_body",C:"ui.agentMessages.settings.state.c_body",D:"ui.agentMessages.settings.state.d_body",E:"ui.agentMessages.settings.state.e_body",F:"ui.agentMessages.settings.state.f_body"},Cl=({state:e,status:s,settings:a,accountId:i,accountMatches:o,api:r,pending:d,localEnabled:g,onActionRefusal:c,onSettings:u,onLocalEnabled:y,onRefreshStatus:p,setPending:f})=>{const _=xs(s),x=a.settings.tenant_id,v=d!==null||!o;async function N(k,w={}){if(!o)return null;f(k),c(null);try{const G=await r.updateSettings({expected_account_id:i,tenant_id:x,state:k,...w});if(u(G),k==="disabled")try{await r.localSetting("team_bridge.enabled",!1),y(!1)}catch(Y){c(Fe(Y))}return G}catch(G){const Y=Fe(G);return c(Y),Y.code==="consent_version_unknown"&&await p(!0),null}finally{f(null)}}async function z(){if(!(!_||!o||!await N("active",{consent_version:_.version,consented_via:"settings"}))){f("local");try{await r.localSetting("team_bridge.enabled",!0),y(!0),await p(!0)}catch(w){c(Fe(w))}finally{f(null)}}}if(e==="F")return t.jsxs("div",{"data-agent-messages-state":e,className:"flex flex-col gap-3",children:[t.jsxs("div",{className:"rounded-md border border-hairline bg-sunken p-3",children:[t.jsx("p",{className:"text-body-sm text-ink",children:s.state_note?.trim()?s.state_note:n("ui.agentMessages.settings.state.turned_off_title")}),t.jsx("p",{className:"mt-1 text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.state.turned_off_org")})]}),t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.state.read_only")}),t.jsx(It,{settings:a,status:s,readOnly:!0}),t.jsx(En,{value:g,disabled:v,description:n("ui.agentMessages.settings.local.stays_enrolled"),onChange:async k=>{f("local"),c(null);try{await r.localSetting("team_bridge.enabled",k),y(k),await p(!0)}catch(w){c(Fe(w))}finally{f(null)}}})]});const C=a.endpoint?.label?.trim(),E=a.endpoint?.consent??null,b=E!==null&&!E.current;return t.jsxs("div",{"data-agent-messages-state":e,className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("h3",{className:"text-heading text-ink",children:n(Sl[e])}),C&&t.jsx("span",{className:"text-body-sm text-ink-muted",children:C})]}),t.jsx("p",{className:"max-w-2xl text-body-sm text-ink-muted",children:n(Ml[e])}),(e==="B"||e==="E")&&t.jsxs("div",{className:"flex flex-col gap-3",children:[_?t.jsx(Nl,{text:_.text}):t.jsx(ae,{variant:"warning",children:t.jsx(Ae,{children:n("ui.agentMessages.settings.consent.unavailable")})}),t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsx(D,{"data-agent-messages-action":"enable",onClick:()=>void z(),disabled:v||!_,children:e==="B"?n("ui.agentMessages.settings.action.enable"):n("ui.agentMessages.settings.action.enable_again")}),t.jsx("span",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.off_by_default")})]})]}),e==="C"&&a.endpoint&&t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx(D,{"data-agent-messages-action":"pause",variant:"secondary",disabled:v,onClick:()=>void N("paused"),children:n("ui.agentMessages.settings.action.pause")}),t.jsx(D,{"data-agent-messages-action":"turn_off",variant:"secondary",disabled:v,onClick:()=>void N("disabled"),children:n("ui.agentMessages.settings.action.turn_off")})]}),t.jsx(It,{settings:a,status:s}),b&&t.jsx(An,{onRenew:()=>void z(),disabled:v||!_}),t.jsx(En,{value:g,disabled:v,description:n("ui.agentMessages.settings.local.stays_enrolled"),onChange:async k=>{f("local"),c(null);try{await r.localSetting("team_bridge.enabled",k),y(k),await p(!0)}catch(w){c(Fe(w))}finally{f(null)}}})]}),e==="D"&&a.endpoint&&t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx(D,{"data-agent-messages-action":"resume",disabled:v||a.settings.consent_required&&_===null,onClick:()=>void N("active",a.settings.consent_required&&_?{consent_version:_.version,consented_via:"settings"}:{}),children:n("ui.agentMessages.settings.action.resume")}),t.jsx(D,{"data-agent-messages-action":"turn_off",variant:"secondary",disabled:v,onClick:()=>void N("disabled"),children:n("ui.agentMessages.settings.action.turn_off")})]}),a.settings.consent_required&&!_&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.consent.unavailable")}),t.jsx(It,{settings:a,status:s}),b&&t.jsx(An,{onRenew:()=>void z(),disabled:v||!_})]})]})},An=({onRenew:e,disabled:s})=>t.jsx(ae,{variant:"warning",children:t.jsxs(Ae,{children:[n("ui.agentMessages.settings.consent.renew"),t.jsx(D,{"data-agent-messages-action":"enable",className:"mt-3",variant:"secondary",disabled:s,onClick:e,children:n("ui.agentMessages.settings.action.enable_again")})]})}),It=({settings:e,status:s,readOnly:a=!1})=>{const i=e.endpoint?.consent??null,o=xs(s);return i?t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsxs(rt,{children:[t.jsx(me,{label:n("ui.agentMessages.settings.consent.version"),value:i.version}),t.jsx(me,{label:n("ui.agentMessages.settings.consent.via"),value:n(`ui.agentMessages.settings.consent.via_${i.consented_via}`)}),t.jsx(me,{label:n("ui.agentMessages.settings.consent.at"),value:i.consented_at})]}),!a&&o&&t.jsxs("details",{children:[t.jsx("summary",{className:"cursor-pointer text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.consent.show")}),t.jsx("p",{className:"mt-2 whitespace-pre-wrap text-body-sm text-ink-muted",children:o.text})]})]}):t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.consent.no_record")})},En=({value:e,disabled:s,description:a,onChange:i})=>{const o=l.useId();return t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{id:o,className:"text-body-sm text-ink",children:n("ui.agentMessages.settings.local.label")}),t.jsx("p",{className:"mt-0.5 text-meta text-ink-dim",children:a})]}),t.jsx(ms,{"aria-labelledby":o,checked:e,disabled:s,onCheckedChange:r=>void i(r)})]})},Al=({value:e,sessions:s,pending:a,disabled:i,onSave:o})=>{const r=s.some(d=>d.session_id===e);return t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.agentMessages.settings.session.title")}),t.jsx("p",{className:"max-w-2xl text-meta text-ink-dim",children:n("ui.agentMessages.settings.session.help")}),t.jsxs(on,{value:e===""?Et:e,disabled:i,onValueChange:d=>void o(d===Et?"":d),children:[t.jsx(rn,{className:"w-full max-w-md","aria-label":n("ui.agentMessages.settings.session.title"),children:t.jsx(ln,{})}),t.jsxs(cn,{children:[t.jsx(Ze,{value:Et,children:n("ui.agentMessages.settings.session.none")}),s.map(d=>t.jsx(Ze,{value:d.session_id,children:d.title?.trim()||d.session_id},d.session_id)),e!==""&&!r&&t.jsx(Ze,{value:e,children:e})]})]}),e!==""&&!r&&t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.session.unavailable")}),a&&t.jsx("p",{className:"text-meta text-ink-dim","aria-live":"polite",children:n("ui.agentMessages.settings.saving")})]})},El=({allowlist:e,accountId:s,accountMatches:a,readOnly:i,pending:o,api:r,onSaving:d,onRefusal:g,onSaved:c})=>{const[u,y]=l.useState(()=>Gt(e.allowlist.entries)),[p,f]=l.useState(()=>({send:e.view.directions.send.mode,receive:e.view.directions.receive.mode})),_=o||i||!a,x=ys(Yt(Il(e),Rl(e))),v=yl({entries:u,modes:p,savedSignature:x,saving:o}),N=l.useRef(0),z=b=>y(k=>[...k,{...b,key:`${b.direction}:${b.effect}:${N.current++}`}]),C=b=>y(k=>k.filter(w=>w.key!==b)),E=async()=>{if(!_){d(!0),g(null);try{const b=await r.updateAllowlist({expected_account_id:s,tenant_id:e.allowlist.tenant_id,entries:Yt(u,p)}),k=Gt(b.allowlist.entries);y(k),f({send:b.view.directions.send.mode,receive:b.view.directions.receive.mode}),c(b)}catch(b){g(Fe(b))}finally{d(!1)}}};return t.jsxs("div",{"data-agent-messages-allowlist":"",className:"flex flex-col gap-5",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.agentMessages.settings.allowlist.title")}),t.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.allowlist.description")})]}),t.jsx(In,{direction:"receive",title:n("ui.agentMessages.settings.allowlist.receive"),mode:p.receive,cues:e.view.cues,entries:u.filter(b=>b.direction==="receive"),disabled:_,onMode:b=>f(k=>({...k,receive:b})),onAdd:b=>z({...b,direction:"receive"}),onRemove:C}),t.jsx(In,{direction:"send",title:n("ui.agentMessages.settings.allowlist.send"),mode:p.send,cues:e.view.cues,entries:u.filter(b=>b.direction==="send"),disabled:_,onMode:b=>f(k=>({...k,send:b})),onAdd:b=>z({...b,direction:"send"}),onRemove:C}),t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsxs(D,{onClick:()=>void E(),disabled:v.disabled||_,children:[t.jsx(gs,{size:14}),n("ui.agentMessages.settings.allowlist.save")]}),v.disabled&&v.reason==="needs_entry"&&t.jsx("span",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.needs_entry")}),v.disabled&&v.reason==="unchanged"&&t.jsx("span",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.unchanged")}),i&&t.jsx("span",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.read_only")}),o&&t.jsx("span",{className:"text-meta text-ink-dim","aria-live":"polite",children:n("ui.agentMessages.settings.saving")})]})]})};function Il(e){return Gt(e.allowlist.entries)}function Rl(e){return{send:e.view.directions.send.mode,receive:e.view.directions.receive.mode}}const In=({direction:e,title:s,mode:a,cues:i,entries:o,disabled:r,onMode:d,onAdd:g,onRemove:c})=>{const u=o.filter(p=>p.effect==="allow"),y=o.filter(p=>p.effect==="deny");return t.jsxs("fieldset",{"data-agent-messages-direction":e,"data-agent-messages-level":a,className:"flex flex-col gap-3 rounded-md border border-hairline p-3",children:[t.jsx("legend",{className:"px-1 text-body-sm text-ink",children:s}),t.jsx(Tl,{mode:a,disabled:r,onMode:d}),t.jsxs("div",{className:"flex flex-col gap-1 text-meta text-ink-dim",children:[i.allow_entry_switches_direction_to_listed_only&&t.jsx("p",{children:n("ui.agentMessages.settings.allowlist.cue_listed_only")}),i.removing_allow_does_not_stop_open_thread&&t.jsx("p",{children:n("ui.agentMessages.settings.allowlist.cue_remove")}),i.deny_stops_pair_both_directions&&t.jsx("p",{children:n("ui.agentMessages.settings.allowlist.cue_deny")})]}),a==="listed_only"&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.allowed_heading")}),u.length===0&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.allowlist.allowed_empty")}),u.map(p=>t.jsx(Rn,{entry:p,disabled:r,onRemove:()=>c(p.key)},p.key)),t.jsx(Tn,{label:n("ui.agentMessages.settings.allowlist.add_allowed"),disabled:r,onAdd:p=>g({...p,effect:"allow"})})]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.blocked_heading")}),y.length===0&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.allowlist.blocked_empty")}),y.map(p=>t.jsx(Rn,{entry:p,disabled:r,onRemove:()=>c(p.key)},p.key)),t.jsx(Tn,{label:n("ui.agentMessages.settings.allowlist.add_blocked"),disabled:r,onAdd:p=>g({...p,effect:"deny"})})]})]})},Tl=({mode:e,disabled:s,onMode:a})=>{const i=[{value:"class_default",label:n("ui.agentMessages.settings.allowlist.anyone")},{value:"listed_only",label:n("ui.agentMessages.settings.allowlist.listed_only")}];return t.jsxs("fieldset",{className:"m-0 w-fit border-0 p-0",children:[t.jsx("legend",{className:"sr-only",children:n("ui.agentMessages.settings.allowlist.level")}),t.jsx("div",{"data-glass-well":"",className:"flex gap-0.5 rounded-md bg-sunken p-0.5",children:i.map(o=>t.jsx(D,{variant:"ghost",size:"sm","aria-pressed":e===o.value,disabled:s,onClick:()=>a(o.value),className:ue(e===o.value&&"bg-surface text-ink hover:bg-surface"),children:o.label},o.value))})]})},Rn=({entry:e,disabled:s,onRemove:a})=>t.jsxs("div",{className:"flex items-center justify-between gap-3 rounded border border-hairline px-2 py-1",children:[t.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[t.jsx("span",{className:"shrink-0 text-meta text-ink-dim",children:e.kind==="endpoint"?n("ui.agentMessages.settings.allowlist.agent_id"):n("ui.agentMessages.settings.allowlist.person_id")}),t.jsx("span",{className:"break-all font-mono text-body-sm text-ink",children:e.id})]}),t.jsx(D,{variant:"secondary",size:"sm",disabled:s,"aria-label":`${n("ui.agentMessages.settings.allowlist.remove")} ${e.id}`,onClick:a,children:n("ui.agentMessages.settings.allowlist.remove")})]}),Tn=({label:e,disabled:s,onAdd:a})=>{const[i,o]=l.useState("endpoint"),[r,d]=l.useState(""),[g,c]=l.useState(null),u=l.useId(),y=`${u}-help`,p=()=>{const f=bl(r.trim());c(f),!f&&(a({kind:i,id:r.trim()}),d(""))};return t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Ee,{htmlFor:u,children:e}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs(on,{value:i,disabled:s,onValueChange:f=>o(f),children:[t.jsx(rn,{className:"w-32","aria-label":n("ui.agentMessages.settings.allowlist.kind"),children:t.jsx(ln,{})}),t.jsxs(cn,{children:[t.jsx(Ze,{value:"endpoint",children:n("ui.agentMessages.settings.allowlist.kind_agent")}),t.jsx(Ze,{value:"account",children:n("ui.agentMessages.settings.allowlist.kind_person")})]})]}),t.jsx(De,{id:u,"aria-describedby":y,className:"max-w-xs",value:r,disabled:s,placeholder:n("ui.agentMessages.settings.allowlist.identifier"),onChange:f=>d(f.target.value),onKeyDown:f=>{f.key==="Enter"&&(f.preventDefault(),p())}}),t.jsx(D,{variant:"secondary",size:"sm",disabled:s,onClick:p,children:n("ui.agentMessages.settings.allowlist.add")})]}),t.jsx("p",{id:y,className:"text-meta text-ink-dim",children:i==="endpoint"?n("ui.agentMessages.settings.allowlist.identifier_help_agent"):n("ui.agentMessages.settings.allowlist.identifier_help_person")}),g&&t.jsx("p",{className:"text-meta text-danger",children:g})]})};function Ll(){const{snapshot:e}=us(),[s,a]=l.useState(!1),i=_l({status:e.status,refused:e.refusal!==null,everVisible:s,checking:e.checking});return l.useEffect(()=>{i!=="absent"&&a(!0)},[i]),l.useEffect(()=>{ri()},[]),i}const Ln={get[Ke.UI](){return n("ui.settings.updates.update_following.application_updates")},get[Ke.BACKEND](){return n("ui.settings.updates.update_following.server_updates")}},ut={patch:{get label(){return n("ui.settings.updates.update_following.patch_label")},get description(){return n("ui.settings.updates.update_following.patch_help")}},minor:{get label(){return n("ui.settings.updates.update_following.minor_label")},get description(){return n("ui.settings.updates.update_following.minor_help")}},major:{get label(){return n("ui.settings.updates.update_following.major_label")},get description(){return n("ui.settings.updates.update_following.major_help")}}},On=({type:e})=>{se();const s=zt(i=>i.followed[e]),a=zt(i=>i.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:Ln[e]}),t.jsx("div",{className:"mt-0.5 text-meta text-ink-muted",children:ut[s].description})]}),t.jsxs(on,{value:s,onValueChange:i=>a(e,i),children:[t.jsx(rn,{"aria-label":n("ui.settings.updates.update_following.surface_choice",{surface:Ln[e],choice:ut[s].label}),className:"w-full sm:w-56","data-followed-segment":e,children:t.jsx(ln,{})}),t.jsx(cn,{children:Xs.map(i=>t.jsx(Ze,{value:i,title:ut[i].description,children:ut[i].label},i))})]})]})},Ol=()=>(se(),t.jsxs("div",{className:ue("flex flex-col gap-3"),children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.settings.updates.update_following.update_notifications")}),t.jsx("p",{className:"mt-1 text-meta text-ink-muted",children:n("ui.settings.updates.update_following.how_much_of_a_version_change_shows_the_update_notice_at_the_botto")})]}),t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx(On,{type:Ke.UI}),t.jsx(On,{type:Ke.BACKEND})]})]})),Fl=({appVersion:e})=>t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(Ol,{}),t.jsx(el,{appVersion:e})]}),Dl=e=>{if(!e)return null;try{return new URL(e).host}catch{return null}};function Rt(e){switch(e){case"Loading...":return n("ui.settings.updates.app_updates_section.state_loading");case"Not connected":return n("ui.settings.updates.app_updates_section.state_not_connected");case"Not attached":return n("ui.settings.updates.app_updates_section.state_not_attached");case"Version unknown":return n("ui.settings.updates.app_updates_section.state_version_unknown");case"Unavailable":return n("ui.settings.updates.app_updates_section.state_unavailable");default:return e}}const zl=()=>{se();const[e,s]=l.useState(null),[a,i]=l.useState({value:"Loading...",detail:null,degraded:!1}),[o,r]=l.useState({platform:"Loading...",arch:"...",nodeVersion:"Loading...",electronVersion:"Loading...",chromeVersion:"Loading..."});l.useEffect(()=>{let g=!0;const c=_=>{if(!g)return;const x=Dl(_.url);if(_.state==="connecting"){i({value:"Loading...",detail:null,degraded:!1});return}if(_.state==="detached"){i({value:"Not connected",detail:_.detail||null,degraded:!1});return}if(_.state==="wedged"){i({value:"Not attached",detail:_.detail||null,degraded:!1});return}const v=_.version||"Version unknown";i({value:x?`${v} · ${x}`:v,detail:_.detail||null,degraded:_.state==="degraded"})};let u=!1;const y=window.api?.backend?.onStatusChange(_=>{u=!0,c(_)}),p=async()=>{try{const[_,x]=await Promise.all([window.api.systemInfo.getAppVersion(),window.api.systemInfo.getPlatformInfo()]);g&&(s(_),r(x))}catch(_){console.error("Error fetching app information:",_)}},f=async()=>{try{const _=window.api?.backend;if(_){const N=await _.getStatus();u||c(N);return}const x=await yn.healthCheck(Xt.baseUrl),v=yn.getServerVersion(x);g&&i({value:v,detail:null,degraded:!1})}catch(_){console.error("Error fetching server version:",_),g&&i({value:"Unavailable",detail:null,degraded:!1})}};return p(),f(),()=>{g=!1,y?.()}},[]);const d=(g,c,u,y={})=>t.jsx(me,{label:t.jsx(Je,{content:u,children:t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx(St,{size:12,className:"shrink-0"}),g]})}),valueClassName:y.valueClassName,value:t.jsxs(t.Fragment,{children:[y.valueTooltip?t.jsx(Je,{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(ce,{title:n("ui.settings.updates.app_updates_section.application_updates_and_info"),icon:$t,description:n("ui.settings.updates.app_updates_section.check_for_updates_and_view_information_about_your_local_operator_"),dataTourTag:"settings-app-updates-section",children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsxs(rt,{children:[d(n("ui.settings.updates.app_updates_section.application_version"),e??n("ui.settings.updates.app_updates_section.state_loading"),n("ui.settings.updates.app_updates_section.the_version_of_the_local_operator_user_interface_application")),d(n("ui.settings.updates.app_updates_section.server_version"),Rt(a.value),n("ui.settings.updates.app_updates_section.the_version_of_the_local_operator_api_server_backend_and_the_addr"),{valueTooltip:a.detail,valueHoverTarget:!0,statusNote:a.degraded?n("ui.settings.updates.app_updates_section.not_answering"):void 0,valueClassName:a.degraded?"text-ink-muted":void 0}),d(n("ui.settings.updates.app_updates_section.platform"),`${o.platform} (${o.arch})`,n("ui.settings.updates.app_updates_section.the_operating_system_and_architecture_your_application_is_running")),d(n("ui.settings.updates.app_updates_section.node_js_version"),Rt(o.nodeVersion),n("ui.settings.updates.app_updates_section.the_javascript_runtime_environment_version")),d(n("ui.settings.updates.app_updates_section.electron_version"),Rt(o.electronVersion),n("ui.settings.updates.app_updates_section.the_framework_version_enabling_this_desktop_application"))]}),t.jsx(Fl,{appVersion:e})]})})};function vs(e){const s={id:"",name:n("ui.settings.model.default_effort.model_default")};return e.resolvedLevel&&e.stored.trim()===""&&dn(e.resolvedLevel,e.storable)!==null&&(s.description=n("ui.settings.model.default_effort.model_default_resolves",{level:Ge(e.resolvedLevel)})),[s,...bs(e.ladder,e.storable)]}function dn(e,s){const a=e.trim().toLowerCase();return a===""?null:s.find(i=>i.trim().toLowerCase()===a)??null}function bs(e,s){return e.flatMap(a=>{const i=dn(a,s);return i===null?[]:[{id:i,name:Ge(a)}]})}function $l(e,s){const a=e.trim().toLowerCase();return a!==""&&s.some(i=>i.toLowerCase()===a)?s.find(i=>i.toLowerCase()===a)??"":""}function Pl(e){if(!e.resolved||e.ladder===null)return null;const s=e.stored.trim().toLowerCase();if(s===""||e.ladder.some(o=>o.toLowerCase()===s))return null;const a=(e.resolvedLevel??"").trim(),i=a===""?"":dn(a,e.storable)??"";return i.trim().toLowerCase()===s?null:i}const yt="\0unread";function gt(e){return e.trim()===""?"":yt}function Kl(e){if(!e.supported)return{kind:"unsupported",options:[],selectedId:"",disabled:!0,helper:""};if(!e.hasHome)return Pe("no-home",n("ui.settings.model.default_effort.no_home"));if(!e.hasModel)return Pe("no-model",n("ui.settings.model.default_effort.no_model"),yt);if(e.settings==="loading")return Pe("settings-loading",n("ui.settings.model.default_effort.settings_loading"),yt);if(e.settings==="error")return Pe("settings-error",n("ui.settings.model.default_effort.settings_error"),yt);if(e.preview==="loading")return Pe("loading",n("ui.settings.model.default_effort.loading"),gt(e.stored));if(e.preview==="error")return Pe("error",n("ui.settings.model.default_effort.error"),gt(e.stored));if(e.ladder===null||!e.specResolved)return Pe("unresolved",n("ui.settings.model.default_effort.unresolved"),gt(e.stored));const s=e.ladder;if(s.length===0)return Pe("empty",n("ui.settings.model.default_effort.empty"),gt(e.stored));const a=bs(s,e.storable);if(a.length===0){const i=Ge(s[0]),o=s.length===1&&s[0].trim().toLowerCase()==="auto";return{kind:"one-level",options:[{id:"",name:i}],selectedId:"",disabled:!0,helper:o?n("ui.settings.model.default_effort.one_level_sentinel"):n("ui.settings.model.default_effort.one_level",{level:i})}}if(s.length===1){const[i]=a;return{kind:"one-level",options:[i],selectedId:i.id,disabled:!0,helper:n("ui.settings.model.default_effort.one_level",{level:i.name})}}return{kind:"ready",options:vs({ladder:s,resolvedLevel:e.resolvedLevel,stored:e.stored,storable:e.storable}),selectedId:$l(e.stored,a.map(i=>i.id)),disabled:!1,helper:n("ui.settings.model.default_effort.helper_ready")}}function Pe(e,s,a=""){return{kind:e,options:vs({ladder:[],resolvedLevel:null,stored:"",storable:[]}),selectedId:a,disabled:!0,helper:s}}const Ul=({hosting:e,modelName:s,focus:a=!1})=>{se();const i=sn(),o=kt(i.data,"draft_preview"),r=ea(),d=e!==""&&s!=="",g=Ie({queryKey:Pt.all,queryFn:()=>_e({op:"settings.list"}),enabled:o,staleTime:1e4}),c=g.data?.settings.find(B=>B.key===pt),u=typeof c?.value=="string"?c.value:"",y=(c?.choices??[]).map(B=>B.value).filter(B=>typeof B=="string"),p={cwd:r??"",model:d?{provider:e,model_id:s,reasoning_effort:null}:null},f=g.isSuccess?u:null,_=Ie({...Va(p,kt(i.data,"draft_fast")),queryKey:[...Ba(p),"model_effort",f],enabled:o&&!!r&&d}),x=_.isSuccess&&!_.isPlaceholderData,v=x?Ha(_.data?.snapshot,null).effort:null,N=x&&Array.isArray(v?.reasoning_efforts)?qa(v):null,z=x?Ga(v):null,C=v!==null&&!Ya(v),[E,b]=l.useState(!1),[k,w]=l.useState(!1),[G,Y]=l.useState(null),[W,S]=l.useState(null),I=`${e}\0${s}`,$=nn(),U=l.useRef(null),V=l.useRef(!1),H=l.useCallback(async(B,J)=>{b(!0),Y(B),w(!1),J===null&&S(null);try{await _e({op:"settings.edit",key:pt,value:B}),await $.invalidateQueries({queryKey:Pt.all}),J!==null&&S(J)}catch{w(!0)}finally{b(!1),Y(null)}},[$]),q=typeof v?.display_name=="string"&&v.display_name.trim()||s,te=Kl({supported:o,hasHome:!!r,hasModel:d,settings:g.isError?"error":g.isSuccess?"ready":"loading",preview:_.isError?"error":x?"ready":"loading",ladder:N,specResolved:C,stored:u,resolvedLevel:z,storable:y}),m=Pl({stored:u,ladder:N,resolvedLevel:z,resolved:x&&C&&g.isSuccess,storable:y}),T=l.useRef(null);l.useEffect(()=>{if(m===null||E)return;const B=`${e}\0${s}\0${u}\0${m}`;if(T.current===B)return;T.current=B;const J=m===""?n("ui.settings.model.default_effort.clamped_unset",{level:Ge(u),model:q}):n("ui.settings.model.default_effort.clamped",{level:Ge(u),model:q,resolved:Ge(m)});H(m,{text:J,model:I})},[m,u,E,H,e,s,q,I]);const A=l.useMemo(()=>te.options.map(Bl),[te.options]);l.useEffect(()=>{if(!a){V.current=!1;return}te.disabled||V.current||(U.current?.querySelector("[role=combobox]")?.focus(),V.current=!0)},[a,te.disabled]);const Q=G??te.selectedId,Z=A.find(B=>B.id===Q)??(G!==null?{id:G,name:Ge(G)}:null),X=t.jsxs("span",{className:"flex flex-col gap-0.5",children:[t.jsx("span",{children:te.helper}),k&&t.jsx("span",{className:"text-danger",children:n("ui.settings.model.default_effort.save_failed")}),t.jsx("output",{"aria-live":"polite",children:W?.model===I?W.text:""})]});return te.kind==="unsupported"?null:t.jsx("div",{ref:U,"data-setting-key":pt,children:t.jsx(Ei,{label:n("ui.settings.model.default_effort.label"),icon:t.jsx(di,{size:16,"aria-hidden":"true"}),placeholder:n("ui.settings.model.default_effort.placeholder"),options:A,selected:Z,onSelect:B=>{H(B.id,null)},helperText:X,busy:E,busyLabel:n("ui.settings.model.default_effort.busy"),disabled:te.disabled||E})})};function Bl(e){return{id:e.id,name:e.name,description:e.description}}const Vl=e=>e.replace(/[\p{Co}\p{Cc}]/gu," ").replace(/\s+/g," ").trim(),ks=(e,s)=>{const a=s.trim().toLocaleLowerCase();return a?e.filter(i=>`${i.title} ${i.cwd} ${i.sourceId}`.toLocaleLowerCase().includes(a)):e},Hl=(e,s)=>`${e??""}\0${[...s].sort().join("\0")}`,js=5e3,ql=(e,s,a,i=js)=>{const o=new Set(a);let r=!1;for(const d of ks(e,s))if(!o.has(d.sourceId)){if(o.size>=i){r=!0;break}o.add(d.sourceId)}return{selected:o,capped:r}},Gl=/cancel/i,Yl=new Set(["done","failed","cancelled"]),Fn=e=>{switch(e){case"metadata_only":return"ui.settings.imports.availability_metadata_only";case"unsupported":return"ui.settings.imports.availability_unsupported";default:return"ui.settings.imports.availability_full"}},Tt=e=>{switch(e){case"queued":return"ui.settings.imports.state_queued";case"done":return"ui.settings.imports.state_done";case"failed":return"ui.settings.imports.state_failed";case"cancelled":return"ui.settings.imports.state_cancelled";default:return"ui.settings.imports.state_running"}},Wl=e=>{switch(e){case"selecting":return"ui.settings.imports.phase_selecting";case"memory":return"ui.settings.imports.phase_memory";case"done":return"ui.settings.imports.phase_done";case"cancelled":return"ui.settings.imports.phase_cancelled";case"queued":return"ui.settings.imports.phase_queued";default:return"ui.settings.imports.phase_importing"}},Ql=e=>{switch(e){case"resumed":return"ui.settings.imports.outcome_resumed";case"skipped_already_imported":return"ui.settings.imports.outcome_skipped";case"metadata_only":return"ui.settings.imports.outcome_metadata";case"failed":return"ui.settings.imports.outcome_failed";case"cancelled":return"ui.settings.imports.outcome_cancelled";default:return"ui.settings.imports.outcome_imported"}},Zl=e=>e==="failed"?"danger":e==="metadata_only"||e==="skipped_already_imported"?"neutral":e==="cancelled"?"warning":"success",Wt=e=>Vl(e.title)||e.sourceId,Dn=({path:e,label:s,onCopyPath:a})=>{const[i,o]=l.useState(!1);return t.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-md border border-hairline bg-surface p-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-body-sm text-ink",children:s}),t.jsx("p",{className:"mt-1 break-all font-mono text-meta text-ink-muted",children:e})]}),t.jsxs(D,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{a(e).then(r=>{r&&(o(!0),window.setTimeout(()=>o(!1),1500))})},children:[i?t.jsx(_s,{size:14}):t.jsx(ts,{size:14}),i?n("ui.settings.imports.copied"):n("ui.settings.imports.copy_path")]})]})},Jl=({progress:e,sessions:s,selected:a})=>{const i=new Map(e.results.map(g=>[g.sourceId,g])),o=e.sessionId,r=Math.max(0,e.total-e.completed-(o&&!i.has(o)?1:0)),d=s.filter(g=>a.has(g.sourceId));return t.jsxs("div",{className:"flex flex-col gap-2",children:[e.results.map(g=>t.jsx(ws,{row:g,jobCancelled:e.state==="cancelled"},`${g.source}:${g.sourceId}`)),d.filter(g=>!i.has(g.sourceId)&&g.sourceId!==o).map(g=>t.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-hairline bg-surface p-2 text-body-sm text-ink-muted",children:[t.jsx("span",{className:"min-w-0 truncate",children:Wt(g)}),t.jsx(it,{variant:"neutral",children:n("ui.settings.imports.session_pending")})]},g.sourceId)),o&&!i.has(o)&&t.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-hairline bg-surface p-2 text-body-sm text-ink-muted",children:[t.jsx(ht,{size:14,className:"animate-spin"}),t.jsx("span",{children:n("ui.settings.imports.session_importing")}),t.jsx("span",{className:"min-w-0 truncate",children:o})]}),r>0&&t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.progress_pending",{count:r})}),e.warnings.map(g=>t.jsx("p",{className:"text-meta text-warning",children:g.message},`${g.code}:${g.sessionId}:${g.message}`))]})},ws=({row:e,jobCancelled:s=!1})=>{const i=s&&e.outcome==="failed"&&e.warnings.some(o=>Gl.test(o))?"cancelled":e.outcome;return t.jsxs("div",{className:"rounded-md border border-hairline bg-surface p-3",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"min-w-0 truncate text-body-sm text-ink",children:e.sourceId}),t.jsx(it,{variant:Zl(i),children:n(Ql(i))}),t.jsx("span",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.session_meta",{messages:e.messages,compactions:e.compactions})})]}),e.targetSessionId&&(e.messages>0||e.outcome==="skipped_already_imported")&&t.jsx("p",{className:"mt-1 break-all font-mono text-meta text-ink-muted",children:n("ui.settings.imports.result_target",{target:e.targetSessionId})}),e.warnings.map(o=>t.jsx("p",{className:"mt-1 text-meta text-warning",children:o},o))]})},Xl=({sources:e,activeSource:s,sessions:a,query:i,selected:o,preview:r,previewStale:d,previewError:g,confirmed:c,busy:u,error:y,progress:p,result:f,cancelling:_,onSelectSource:x,onQueryChange:v,onToggleSession:N,onSelectAll:z,onClearSelection:C,onConfirmChange:E,onImport:b,onCancel:k,onRetry:w,onImportAnother:G,onRefresh:Y,selectionNotice:W,onCopyPath:S})=>{se();const I=e.find(m=>m.source===s),$=p!==null&&!Yl.has(p.state),U=p?.total??o.size,V=l.useMemo(()=>ks(a,i),[i,a]),H=V.length>0&&V.every(m=>o.has(m.sourceId)),q=o.size,te=q>0&&r!==null&&!d&&c&&!u&&!p&&!f;return t.jsx(ce,{title:n("ui.settings.imports.title"),icon:$t,description:n("ui.settings.imports.description"),dataTourTag:"settings-import-section",children:t.jsxs("div",{className:"flex flex-col gap-5",children:[y&&t.jsxs(ae,{variant:"warning",children:[t.jsx(Nt,{children:n("ui.settings.imports.title")}),t.jsx(Ae,{children:t.jsxs("span",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx("span",{children:y}),t.jsx(D,{variant:"secondary",size:"sm",onClick:w,children:n("ui.settings.imports.retry")})]})})]}),u==="sources"&&e.length===0?t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(xe,{className:"h-20 w-full"}),t.jsx(xe,{className:"h-20 w-full"}),t.jsx(xe,{className:"h-20 w-full"}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.loading_sources")})]}):e.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.imports.empty_sources")}):t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.settings.imports.source_heading")}),t.jsxs(D,{variant:"ghost",size:"sm",onClick:Y,disabled:$||u==="sources"||u==="sessions",children:[t.jsx(ui,{size:14,className:ue(u==="sources"&&"animate-spin")}),n("ui.settings.imports.refresh")]})]}),!e.some(m=>m.detected)&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.imports.empty_sources")}),t.jsx("div",{className:"grid gap-2 lg:grid-cols-3",children:e.map(m=>{const T=m.source===s,A=m.detected?n(Fn(m.availability)):n("ui.settings.imports.source_not_found");return t.jsxs("button",{type:"button","aria-pressed":T,disabled:$,onClick:()=>x(m.source),className:ue("rounded-lg border p-3 text-start transition-colors disabled:cursor-not-allowed disabled:opacity-60","focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2",T?"border-accent bg-accent-wash":"border-hairline bg-surface hover:bg-sunken"),children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("span",{className:"text-body-sm font-medium text-ink",children:m.label}),t.jsx(it,{variant:m.detected&&m.availability==="full"?"success":"neutral",children:A})]}),t.jsx("p",{className:"mt-1 text-meta text-ink-muted",children:n("ui.settings.imports.source_sessions",{count:m.sessionCount})}),t.jsx("p",{className:"mt-1 break-all text-meta text-ink-dim",children:m.detail||m.root})]},m.source)})})]}),I&&!p&&!f&&t.jsxs("div",{className:"flex flex-col gap-3 border-t border-hairline pt-5",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[t.jsxs("h3",{className:"text-heading text-ink",children:[n("ui.settings.imports.source_heading")," · ",I.label]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(D,{variant:"secondary",size:"sm",onClick:H?C:z,disabled:V.length===0,children:H?n("ui.settings.imports.clear_all"):n("ui.settings.imports.select_all")}),t.jsx("span",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.selected",{count:q})})]})]}),W&&t.jsx("output",{className:"text-meta text-warning",children:W}),t.jsxs("div",{className:"relative",children:[t.jsx(es,{size:15,className:"pointer-events-none absolute top-1/2 start-3 -translate-y-1/2 text-ink-dim"}),t.jsx(De,{value:i,onChange:m=>v(m.target.value),placeholder:n("ui.settings.imports.search_placeholder"),className:"ps-9"})]}),u==="sessions"?t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(xe,{className:"h-12 w-full"}),t.jsx(xe,{className:"h-12 w-full"}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.loading_sessions",{source:I.label})})]}):a.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.imports.empty_sessions",{source:I.label})}):V.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.imports.empty_filter")}):t.jsx("div",{className:"flex max-h-80 flex-col gap-1 overflow-y-auto",children:V.map(m=>{const T=`import-session-${m.source}-${m.sourceId}`;return t.jsxs("div",{className:ue("flex items-start gap-3 rounded-md border p-3",o.has(m.sourceId)?"border-accent bg-row-selected":"border-hairline bg-surface hover:bg-sunken"),children:[t.jsx(qt,{id:T,checked:o.has(m.sourceId),onCheckedChange:()=>N(m.sourceId),"aria-label":Wt(m),className:"mt-0.5"}),t.jsxs("label",{htmlFor:T,className:"min-w-0 flex-1 cursor-pointer text-start",children:[t.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"min-w-0 truncate text-body-sm text-ink",children:Wt(m)}),t.jsx(it,{variant:m.availability==="full"?"neutral":"warning",children:n(Fn(m.availability))})]}),t.jsxs("span",{className:"mt-1 flex flex-wrap gap-x-3 gap-y-1 text-meta text-ink-muted",children:[t.jsx("span",{children:n("ui.settings.imports.session_meta",{messages:m.messageCount??0,compactions:m.compactionCount})}),t.jsx("span",{children:n("ui.settings.imports.session_updated",{date:tn(new Date((m.updatedTs||m.createdTs)*1e3))})})]}),m.cwd&&t.jsx("span",{className:"mt-1 block break-all font-mono text-meta text-ink-dim",children:m.cwd}),m.availability==="metadata_only"&&t.jsx("span",{className:"mt-1 block text-meta text-warning",children:n("ui.settings.imports.metadata_only_explain")}),m.availability==="unsupported"&&t.jsx("span",{className:"mt-1 block text-meta text-warning",children:n("ui.settings.imports.session_index_only")})]})]},m.sourceId)})})]}),I&&q>0&&!p&&!f&&t.jsxs("div",{className:"flex flex-col gap-3 border-t border-hairline pt-5",children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.settings.imports.preview_heading")}),(u==="preview"||d||r===null&&!g)&&t.jsxs("p",{className:"flex items-center gap-2 text-meta text-ink-muted",children:[t.jsx(ht,{size:14,className:"animate-spin"}),n("ui.settings.imports.loading_preview")]}),r&&!d&&t.jsxs("div",{className:"flex flex-col gap-2 rounded-lg border border-hairline bg-surface p-4",children:[t.jsx("p",{className:"text-body-sm text-ink",children:n("ui.settings.imports.preview_summary",{sessions:r.totalSessions,messages:r.totalMessages,compactions:r.totalCompactions})}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.preview_memory",{records:r.totalMemoryRecords,tokens:r.projectedMemoryTokens.toLocaleString()})}),r.warnings.slice(0,4).map((m,T)=>t.jsx("p",{className:"text-meta text-warning",children:m.message},`${m.code}:${m.sessionId}:${T}`)),r.warnings.length>4&&t.jsx("p",{className:"text-meta text-warning",children:n("ui.settings.imports.warnings_heading",{count:r.warnings.length})}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.preview_confirm")})]}),t.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border border-hairline bg-surface p-4",children:[g&&t.jsx(ae,{variant:"warning",children:t.jsx(Ae,{children:t.jsxs("span",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx("span",{children:g}),t.jsx(D,{variant:"secondary",size:"sm",onClick:w,children:n("ui.settings.imports.retry")})]})})}),t.jsxs("div",{className:"flex items-start gap-2 text-body-sm text-ink",children:[t.jsx(qt,{checked:c,onCheckedChange:m=>E(m===!0),disabled:!r||d,"aria-label":n("ui.settings.imports.confirm_label"),className:"mt-0.5"}),t.jsx("span",{children:n("ui.settings.imports.confirm_label")})]}),t.jsxs(D,{variant:"primary",onClick:b,disabled:!te,className:"self-start",children:[u==="start"?t.jsx(ht,{size:14,className:"animate-spin"}):t.jsx($t,{size:14}),n("ui.settings.imports.import_button",{count:q})]})]})]}),p&&!f&&t.jsxs("div",{className:"flex flex-col gap-3 border-t border-hairline pt-5",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.settings.imports.progress_heading")}),t.jsxs(D,{variant:"secondary",size:"sm",onClick:k,disabled:_||p.state==="done"||p.state==="cancelled"||p.state==="failed",children:[t.jsx(ta,{size:12}),_?n("ui.settings.imports.cancelling"):n("ui.settings.imports.cancel")]})]}),t.jsxs("p",{className:"text-meta text-ink-muted",children:[n("ui.settings.imports.progress_job",{job:p.jobId,state:n(Tt(p.state))})," · ",n(Wl(p.phase))]}),t.jsx(Ii,{value:p.total?p.completed/p.total*100:0,className:"h-1.5"}),t.jsx(Jl,{progress:p,sessions:a,selected:o})]}),f&&t.jsxs("div",{className:"flex flex-col gap-3 border-t border-hairline pt-5",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.settings.imports.result_heading")}),t.jsx(D,{variant:"secondary",size:"sm",onClick:G,children:n("ui.settings.imports.import_another")})]}),t.jsx("p",{className:"text-body-sm text-ink",children:f.state==="cancelled"?n("ui.settings.imports.result_summary_cancelled",{state:n(Tt(f.state)),sessions:f.sessions.length,total:U,messages:f.messages}):n("ui.settings.imports.result_summary",{state:n(Tt(f.state)),sessions:f.sessions.length,messages:f.messages})}),f.sessions.map(m=>t.jsx(ws,{row:m,jobCancelled:f.state==="cancelled"},`${m.source}:${m.sourceId}:${m.targetSessionId}`)),(f.instructionReviewPath||f.memoryReviewPath)&&t.jsxs("div",{className:"flex flex-col gap-2",children:[f.instructionReviewPath&&t.jsx(Dn,{path:f.instructionReviewPath,label:n("ui.settings.imports.review_instructions"),onCopyPath:S}),f.memoryReviewPath&&t.jsx(Dn,{path:f.memoryReviewPath,label:n("ui.settings.imports.review_memory"),onCopyPath:S})]}),f.warnings.length>0&&t.jsx(ae,{variant:"warning",children:t.jsx(Ae,{children:t.jsxs("span",{className:"flex flex-col gap-1",children:[t.jsx("span",{children:n("ui.settings.imports.warnings_heading",{count:f.warnings.length})}),f.warnings.slice(0,4).map((m,T)=>t.jsx("span",{children:m.message},`${m.code}:${T}`))]})})}),f.error&&t.jsx(ae,{variant:"danger",children:t.jsx(Ae,{children:f.error})}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.rerun_safe")})]}),u==="start"&&!p&&t.jsxs("p",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[t.jsx(ht,{size:14,className:"animate-spin"}),n("ui.settings.imports.importing")]})]})})},un=e=>({source:e.source,sessionId:e.session_id,code:e.code,message:e.message}),Ns=e=>({source:e.source,sourceId:e.source_id,targetSessionId:e.target_session_id,outcome:e.outcome,messages:e.messages,compactions:e.compactions,redactions:e.redactions,skipped:e.skipped,warnings:e.warnings}),ec=e=>({jobId:e.job_id,state:e.state,sessions:e.sessions.map(Ns),messages:e.messages,compactions:e.compactions,memoryImported:e.memory_imported,memorySkipped:e.memory_skipped,memoryReviewPath:e.memory_review_path,instructionReviewPath:e.instruction_review_path,redactions:e.redactions,warnings:e.warnings.map(un),error:e.error});async function tc(){return(await _e({op:"imports.sources"})).sources.map(s=>({source:s.source,label:s.label,root:s.root,detected:s.detected,sessionCount:s.session_count,availability:s.availability,detail:s.detail}))}async function nc(e,s=!1){return(await _e({op:"imports.sessions",source:e,includeSubagents:s})).sessions.map(i=>({source:i.source,sourceId:i.source_id,title:i.title??"",cwd:i.cwd??"",createdTs:i.created_ts,updatedTs:i.updated_ts,messageCount:i.message_count,compactionCount:i.compaction_count,kind:i.kind,availability:i.availability,parentSourceId:i.parent_source_id}))}async function sc(e){const s=await _e({op:"imports.preview",sources:e.sources,sessionIds:e.sessionIds,includeMemory:e.includeMemory??!0,includeInstructions:e.includeInstructions??!0});return{totalSessions:s.total_sessions,totalMessages:s.total_messages,messageCountsEstimated:s.message_counts_estimated,totalCompactions:s.total_compactions,totalMemoryRecords:s.total_memory_records,projectedMemoryTokens:s.projected_memory_tokens,projectedGlobalTokens:s.projected_global_tokens,warnings:s.warnings.map(un),instructionReviewPaths:s.instruction_review_paths}}async function ac(e){return(await _e({op:"imports.start",sources:e.sources,sessionIds:e.sessionIds,includeMemory:e.includeMemory??!0,includeInstructions:e.includeInstructions??!0})).job_id}async function ic(e){const s=await _e({op:"imports.status",jobId:e});return{jobId:s.job_id,state:s.state,phase:s.phase,source:s.source,sessionId:s.session_id,completed:s.completed,total:s.total,results:s.results.map(Ns),warnings:s.warnings.map(un),error:s.error,startedAt:s.started_at,updatedAt:s.updated_at,result:s.result?ec(s.result):void 0}}async function oc(e){await _e({op:"imports.cancel",jobId:e})}const mt=new Set(["done","failed","cancelled"]),We=e=>e instanceof Error?e.message:String(e),rc=()=>{se();const[e,s]=l.useState([]),[a,i]=l.useState(null),[o,r]=l.useState([]),[d,g]=l.useState(""),[c,u]=l.useState(new Set),[y,p]=l.useState(null),[f,_]=l.useState(null),[x,v]=l.useState(!1),[N,z]=l.useState(null),[C,E]=l.useState(null),[b,k]=l.useState(null),[w,G]=l.useState(null),[Y,W]=l.useState(!1),[S,I]=l.useState(null),[$,U]=l.useState(0),V=l.useRef(0),H=l.useRef(0),[q,te]=l.useState(null),[m,T]=l.useState(null),A=l.useRef(null),Q=b!==null&&!mt.has(b.state),Z=l.useCallback(async()=>{z("sources"),E(null);try{const K=await tc();s(K),i(ne=>K.some(de=>de.source===ne&&de.detected)?ne:K.find(de=>de.detected)?.source??null)}catch(K){E(n("ui.settings.imports.error_sources",{reason:We(K)}))}finally{z(null)}},[]);l.useEffect(()=>{Z()},[Z]);const X=l.useCallback(async K=>{const ne=++V.current;z("sessions"),E(null);try{const ge=await nc(K);if(ne!==V.current)return;r(ge)}catch(ge){if(ne!==V.current)return;r([]),E(n("ui.settings.imports.error_sessions",{source:K,reason:We(ge)}))}finally{ne===V.current&&z(null)}},[]);l.useEffect(()=>{if(!a){r([]);return}r([]),u(new Set),p(null),_(null),te(null),T(null),v(!1),G(null),k(null),X(a)},[a,X]);const B=l.useCallback(K=>{u(K),v(!1),te(null),T(null),I(null)},[]),J=l.useCallback(K=>{Q||(i(K),g(""))},[Q]),Re=l.useCallback(K=>{const ne=new Set(c);ne.has(K)?ne.delete(K):ne.add(K),B(ne)},[B,c]),Ne=l.useCallback(()=>{const K=ql(o,d,c);B(K.selected),K.capped&&I(n("ui.settings.imports.selection_limit",{max:js}))},[d,B,c,o]),ke=l.useCallback(()=>{B(new Set)},[B]),pe=l.useMemo(()=>Hl(a,c),[a,c]),M=y!==null&&f!==pe,P=l.useCallback(async()=>{if(!a||c.size===0)return;const K=++H.current,ne=pe;z("preview"),E(null),T(null);try{const ge=await sc({sources:[a],sessionIds:{[a]:[...c].sort()}});if(K!==H.current)return;p(ge),_(ne)}catch(ge){if(K!==H.current)return;p(null),_(null),te(ne),T(n("ui.settings.imports.error_preview",{reason:We(ge)}))}finally{K===H.current&&z(null)}},[a,pe,c]);l.useEffect(()=>{if(!a||c.size===0||b||w||y&&f===pe||!y&&q===pe)return;const K=setTimeout(()=>{P()},250);return()=>clearTimeout(K)},[a,c,pe,y,f,q,b,w,P]);const L=l.useCallback(async()=>{if(!(!a||c.size===0||!y||M||!x||b)){z("start"),E(null),G(null);try{const K=await ac({sources:[a],sessionIds:{[a]:[...c].sort()}}),ne=Date.now()/1e3;k({jobId:K,state:"queued",phase:"queued",source:a,sessionId:"",completed:0,total:c.size,results:[],warnings:[],error:"",startedAt:ne,updatedAt:ne})}catch(K){E(n("ui.settings.imports.error_start",{reason:We(K)}))}finally{z(null)}}},[a,x,y,M,b,c]),ie=b?.jobId??null,oe=b?.state??null;l.useEffect(()=>{if(!ie||!oe||mt.has(oe))return;let K=!0,ne;const ge=async()=>{try{const de=await ic(ie);if(!K)return;if(A.current){const O=A.current;A.current=null,E(re=>re===O?null:re)}k(de),de.result&&G({...de.result,jobId:de.jobId}),mt.has(de.state)||(ne=setTimeout(ge,900))}catch(de){if(!K)return;const O=n("ui.settings.imports.error_job",{reason:We(de)});A.current=O,E(O),ne=setTimeout(ge,2e3)}};return ne=setTimeout(ge,$>0?0:700),()=>{K=!1,ne&&clearTimeout(ne)}},[ie,oe,$]);const Be=l.useCallback(async()=>{if(!(!b||mt.has(b.state))){W(!0),E(null);try{await oc(b.jobId)}catch(K){E(n("ui.settings.imports.error_cancel",{reason:We(K)}))}finally{W(!1)}}},[b]),fe=l.useCallback(()=>{u(new Set),p(null),_(null),te(null),T(null),v(!1),I(null),G(null),k(null),E(null),a&&X(a)},[a,X]),Se=l.useCallback(async K=>{try{return await navigator.clipboard.writeText(K),!0}catch{return!1}},[]),Te=l.useCallback(async()=>{Q||(I(null),te(null),T(null),await Z(),a&&await X(a))},[a,Q,X,Z]),Ve=l.useCallback(()=>{if(Q){E(null),U(K=>K+1);return}te(null),T(null),Te()},[Q,Te]);return t.jsx(Xl,{sources:e,activeSource:a,sessions:o,query:d,selected:c,preview:y,previewStale:M,previewError:m,confirmed:x,busy:N,error:C,progress:b,result:w,cancelling:Y,onSelectSource:J,onQueryChange:g,onToggleSession:Re,onSelectAll:Ne,onClearSelection:ke,onConfirmChange:v,onImport:()=>void L(),onCancel:()=>void Be(),onRetry:Ve,onImportAnother:fe,onRefresh:Te,selectionNotice:S,onCopyPath:Se})},lc=e=>{const s=e.label.replace(/^Open\s+/,"");return s.charAt(0).toUpperCase()+s.slice(1)},cc=({action:e})=>{se();const s=l.useId(),a=l.useRef(null),i=Ue(x=>x.shortcutBindings),o=i[e.id],r=Ue(x=>x.setShortcutBinding),d=Ue(x=>x.clearShortcutBinding),[g,c]=l.useState(!1),[u,y]=l.useState(null),p=l.useMemo(na,[]),f=Qa(e.id,i),_=lc(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(Ee,{htmlFor:s,className:"w-32 text-body-sm text-ink",children:_}),t.jsx(De,{id:s,readOnly:!0,value:f===null?n("ui.settings.shortcuts.keyboard_shortcuts_section.no_shortcut"):Za(f,p),"aria-label":n("ui.settings.shortcuts.keyboard_shortcuts_section.label_press_the_keys_you_want",{label:String(_)}),"data-shortcut-action":e.id,ref:a,className:ue("w-52",f===null?"text-body-sm":"font-mono text-body-sm"),onFocus:()=>c(!0),onBlur:()=>{c(!1),y(null)},onKeyDown:x=>{if(sa.has(x.key))return;if(aa.has(x.key)){c(!1),y(null);return}if(ia.has(x.key)||x.nativeEvent.isComposing)return;const v=oa({key:x.key,metaKey:x.metaKey,ctrlKey:x.ctrlKey,altKey:x.altKey,shiftKey:x.shiftKey}),N=Ja(v,e.id,i,p);if(N!==null){x.preventDefault(),c(!0),y(N);return}if(v===f){c(!0),y(null);return}x.preventDefault(),c(!0),y(null),v===e.defaultChord?r(e.id,null):v!==null&&r(e.id,v)}}),f!==null&&t.jsx(D,{variant:"secondary",size:"sm","aria-label":n("ui.settings.shortcuts.keyboard_shortcuts_section.clear_label_s_shortcut",{label:String(_)}),onClick:()=>{d(e.id),a.current?.focus()},children:n("ui.settings.shortcuts.keyboard_shortcuts_section.clear")}),o!==void 0&&t.jsx(D,{variant:"secondary",size:"sm","aria-label":n("ui.settings.shortcuts.keyboard_shortcuts_section.reset_label_to_its_default",{label:String(_)}),onClick:()=>{r(e.id,null),a.current?.focus()},children:n("ui.settings.shortcuts.keyboard_shortcuts_section.reset")})]}),g&&t.jsx("span",{className:"text-meta text-ink-dim",children:n("ui.settings.shortcuts.keyboard_shortcuts_section.press_the_keys_you_want_esc_cancels")}),u!==null&&t.jsx("output",{className:"text-meta text-danger",children:u})]})},dc=({sectionRef:e})=>(se(),t.jsx(ce,{title:n("ui.settings.shortcuts.keyboard_shortcuts_section.keyboard_shortcuts"),icon:gi,description:n("ui.settings.shortcuts.keyboard_shortcuts_section.shortcuts_for_the_panel_rail_focus_a_field_and_press_the_keys_you"),sectionRef:e,children:t.jsx("div",{className:"flex flex-col gap-4",children:Wa.map(s=>t.jsx(cc,{action:s},s.id))})})),uc=[[[".claude.json"],"Claude Code"],[[".claude",".mcp.json"],"Claude Code"],[[".cursor","mcp.json"],"Cursor"],[[".vscode","mcp.json"],"VS Code"],[[".codex","config.toml"],"Codex CLI"]];function Ss(e){if(!e)return null;const s=e.split("\\").join("/").split("/").filter(Boolean);for(const[a,i]of uc)if(!(s.length<a.length)&&s.slice(-a.length).join("/")===a.join("/"))return i;return null}const vt=e=>n("ui.settings.integrations.integration_model.tool_count",{count:e}),gc=e=>n("ui.settings.integrations.integration_model.integration_count",{count:e}),mc=["connected","needs_sign_in","not_started","connecting","error"],Ms=e=>mc.includes(e),Xe=(e,s)=>[...s].filter(a=>a.name===e&&a.status==="running").sort((a,i)=>i.created_at-a.created_at)[0]??null,_c={connectedAt:null,connectedToolCount:null,settledGroup:null,pinnedGroup:null,pinnedOperationId:null,needsKey:!1,needsSignIn:!1,disconnectedAt:null,holdUntil:null,lastDecisive:null},pc=1e12,hc=1e9,fc=60*60*1e3,Cs=(e,s=Date.now())=>{if(typeof e!="number"||!Number.isFinite(e))return null;const a=e>=pc?e:e<hc?null:e*1e3;return a===null||a>s+fc?null:Math.min(a,s)},Ye=(e,s)=>e?.[s]??_c,lt=(e,s,a)=>vc(e,s)??a?.lastDecisive??null,xc=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}:{}}),gn=(e,s)=>e.status==="not_started"&&typeof e.tool_count=="number"&&(s.connectedAt!==null||e.status_basis==="stored"&&e.tool_count_basis==="last_seen"),yc=(e,s)=>[...s].filter(a=>a.name===e).sort((a,i)=>i.created_at-a.created_at)[0]??null,vc=(e,s)=>yc(e,s.filter(a=>a.status!=="cancelled")),Mt=e=>e.actions.includes("set_key")||e.actions.includes("add_key");function bc(e,s){const a=Math.max(0,Math.round((e-s)/1e3));if(a<60)return n("ui.settings.integrations.integration_model.just_now");const i=Math.round(a/60);if(i<60)return n("ui.settings.integrations.integration_model.minutes_min_ago",{minutes:i});const o=Math.round(i/60);return o<24?n("ui.settings.integrations.integration_model.hours_h_ago",{hours:o}):n("ui.settings.integrations.integration_model.days_ago",{days:Math.round(o/24)})}function Lt(e){if(!e)return null;const s=e.trim();if(!s||/^\/\w/.test(s)||/\/mcp\s+\w+/.test(s))return null;let a=s;for(let i=0;i<3;i+=1){const o=a.replace(/^(?:connection (?:closed|error|refused)|error|closed|failed)\s*:\s*/i,"").trim();if(o===a)break;a=o}return a=a.replace(/\s*\(\s*\d{3}\s*\)/g,"").replace(/\s+([.,;])/g,"$1").replace(/\s{2,}/g," ").trim(),a||null}function kc(e,s=[],a,i=Date.now()){const o=Ye(a,e.name),r=Xe(e.name,s);if(r){if(r.action==="login"||r.action==="reauth")return{label:n("ui.settings.integrations.integration_model.signing_in"),tone:"info",detail:null,busy:!0};if(r.action==="logout")return{label:n("ui.settings.integrations.integration_model.signing_out"),tone:"info",detail:null,busy:!0}}if(!Ms(e.status))return{label:n("ui.settings.integrations.integration_model.status_unavailable"),tone:"neutral",detail:null,busy:!1};const d=lt(e.name,s,o),g=Ct(d)&&e.status!=="connected",c=gn(e,o),u=pn(d)&&e.status!=="connected",y=(d?.action==="login"||d?.action==="reauth")&&d.status==="failed";if(o.disconnectedAt!==null)return{label:n("ui.settings.integrations.integration_model.not_connected"),tone:"neutral",detail:null,busy:!1};switch(e.status){case"connected":return{label:typeof e.tool_count=="number"?n("ui.settings.integrations.integration_model.connected_with_tools",{tools:String(vt(e.tool_count))}):n("ui.settings.integrations.integration_model.connected"),tone:"success",detail:null,busy:!1};case"connecting":return{label:n("ui.settings.integrations.integration_model.connecting"),tone:"info",detail:null,busy:!0};case"needs_sign_in":return{label:e.auth.kind==="api_key"||at(e,s,o)?n("ui.settings.integrations.integration_model.needs_a_key"):n("ui.settings.integrations.integration_model.needs_sign_in"),tone:"warning",detail:Lt(e.status_reason),busy:!1};case"error":return{label:n("ui.settings.integrations.integration_model.couldn_t_start"),tone:"danger",detail:Lt(e.status_reason)??n("ui.settings.integrations.integration_model.no_reason_was_given"),busy:!1};default:if(g)return{label:n("ui.settings.integrations.integration_model.signed_out"),tone:"warning",detail:null,busy:!1};if(u)return{label:n("ui.settings.integrations.integration_model.sign_out_didn_t_finish"),tone:"warning",detail:n("ui.settings.integrations.integration_model.the_sign_in_is_still_saved"),busy:!1};if(at(e,s,o))return{label:n("ui.settings.integrations.integration_model.needs_a_key"),tone:"warning",detail:null,busy:!1};if(y)return{label:n("ui.settings.integrations.integration_model.sign_in_didn_t_finish"),tone:"warning",detail:null,busy:!1};if(o.needsSignIn)return{label:e.auth.kind==="api_key"||at(e,s,o)?n("ui.settings.integrations.integration_model.needs_a_key"):n("ui.settings.integrations.integration_model.needs_sign_in"),tone:"warning",detail:Lt(e.status_reason),busy:!1};if(e.status_basis==="stored"&&c&&o.disconnectedAt===null){const p=o.connectedAt??Cs(e.last_seen_at,i);return{label:p!==null?n("ui.settings.integrations.integration_model.worked_when_with_tools",{when:String(bc(i,p)),tools:String(vt(e.tool_count))}):n("ui.settings.integrations.integration_model.worked_earlier_with_tools",{tools:String(vt(e.tool_count))}),tone:"success",detail:null,busy:!1}}return e.status_basis==="live"?{label:n("ui.settings.integrations.integration_model.not_connected"),tone:"neutral",detail:null,busy:!1}:{label:n("ui.settings.integrations.integration_model.ready"),tone:"neutral",detail:null,busy:!1}}}const As=e=>n("ui.settings.integrations.integration_model.replace_keys",{count:e}),jc=/[,;]?\s*(?:or|and)?\s*add (?:its|a|the) key instead\.?\s*$/i;function wc(e,s){const a=e?.trim()??"";if(!a)return null;if(s)return a;const i=a.replace(jc,"").trim();return i?/\.$/.test(i)?i:`${i}.`:a}const Nc="ui.settings.integrations.integration_model.copy_ready_explanation",Sc="ui.settings.integrations.integration_model.copy_not_connected_explanation",Mc=e=>e.transport==="local_command"?n("ui.settings.integrations.integration_model.local_command"):n("ui.settings.integrations.integration_model.remote_url");function Es(e){switch(e.source.kind){case"local-operator":case"project-mcp-json":return null;case"claude-code":return n("ui.settings.integrations.integration_model.claude_code");case"cursor":return"Cursor";case"vscode":return n("ui.settings.integrations.integration_model.vs_code");case"codex":return n("ui.settings.integrations.integration_model.codex_cli");default:return Ss(e.source.path)}}function Cc(e,s){const a=[Mc(e)];e.status!=="connected"&&e.tool_count_basis==="last_seen"&&typeof e.tool_count=="number"&&a.push(n("ui.settings.integrations.integration_model.tools_when_last_checked",{tools:String(vt(e.tool_count))})),s&&a.push(e.scope==="project"?n("ui.settings.integrations.integration_model.this_project"):n("ui.settings.integrations.integration_model.global"));const i=Es(e);return i?a.push(n("ui.settings.integrations.integration_model.imported_from_origin",{origin:String(i)})):e.source.editable||a.push(n("ui.settings.integrations.integration_model.imported_from_a_project_file")),a}const mn=(e,s)=>s.disconnectedAt!==null?"not_started":e.status;function _n(e,s=[],a){const i=Ye(a,e.name),o=Xe(e.name,s);if(o)return o.action==="login"||o.action==="reauth"?{kind:"sign_in",label:n("ui.settings.integrations.integration_model.continue_sign_in")}:null;const r=y=>e.actions.includes(y),d=Mt(e),g=at(e,s,i);if(!Ms(e.status))return r("test")?{kind:"test",label:n("ui.settings.integrations.integration_model.check_again")}:null;const c=lt(e.name,s,i),u=c?.status==="failed"&&ct(c);switch(mn(e,i)){case"connected":case"connecting":return null;case"needs_sign_in":return g?{kind:"set_key",label:n("ui.settings.integrations.integration_model.add_key")}:r("sign_in")?{kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")}:d?{kind:"set_key",label:n("ui.settings.integrations.integration_model.add_key")}:r("reauth")?{kind:"reauth",label:n("ui.settings.integrations.integration_model.sign_in_again")}:{kind:"fix",label:n("ui.settings.integrations.integration_model.fix")};case"error":return r("connect")?{kind:"connect",label:n("ui.settings.integrations.integration_model.reconnect")}:r("test")?{kind:"test",label:n("ui.settings.integrations.integration_model.retry")}:{kind:"fix",label:n("ui.settings.integrations.integration_model.fix")};default:{if(Ct(c)&&r("sign_in"))return{kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")};if(pn(c)&&r("sign_out"))return{kind:"sign_out",label:n("ui.settings.integrations.integration_model.sign_out_again")};if(i.disconnectedAt!==null&&r("connect"))return{kind:"connect",label:n("ui.settings.integrations.integration_model.connect")};if(i.needsSignIn){if(g&&d)return{kind:"set_key",label:n("ui.settings.integrations.integration_model.add_key")};if(r("sign_in"))return{kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")}}return g&&d?{kind:"set_key",label:n("ui.settings.integrations.integration_model.add_key")}:u&&r("sign_in")?{kind:"sign_in",label:n("ui.settings.integrations.integration_model.try_again")}:gn(e,i)&&!r("connect")?null:r("connect")?{kind:"connect",label:n("ui.settings.integrations.integration_model.connect"),...i.connectedAt===null&&e.status_basis!=="live"?{variant:"ghost"}:{}}:r("test")&&e.tool_count===null&&e.tool_count_basis===null?{kind:"test",label:n("ui.settings.integrations.integration_model.test"),variant:"ghost"}:null}}}const ct=e=>e.action==="login"||e.action==="reauth",Ct=e=>!!(e&&e.action==="logout"&&e.status==="complete"),pn=e=>!!(e&&e.action==="logout"&&e.status!=="running"&&e.status!=="complete"),Is=/no oauth authorization server/i;function at(e,s,a){if(!Mt(e))return!1;const i=lt(e.name,s,a);return i&&ct(i)&&i.status==="failed"&&Is.test(i.message??"")?!0:a.needsKey}function Ac(e,s=[],a){const i=_n(e,s,a)?.kind,o=mn(e,Ye(a,e.name)),r=c=>e.actions.includes(c),d=[],g=Xe(e.name,s);if(g&&d.push({kind:"cancel",label:n("ui.settings.integrations.integration_model.cancel")}),!g&&r("test")&&i!=="test"&&d.push({kind:"test",label:n("ui.settings.integrations.integration_model.test_connection")}),r("connect")&&i!=="connect"&&o!=="connected"&&d.push({kind:"connect",label:n("ui.settings.integrations.integration_model.reconnect")}),!g&&r("sign_in")&&i!=="sign_in"&&o!=="connected"&&d.push({kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")}),r("reload")&&d.push({kind:"reload",label:n("ui.settings.integrations.integration_model.reload")}),!g&&r("reauth")&&i!=="reauth"&&d.push({kind:"reauth",label:n("ui.settings.integrations.integration_model.sign_in_again")}),Mt(e)&&i!=="set_key"&&d.push({kind:"set_key",label:e.auth.secret_refs.length>0?n("ui.settings.integrations.integration_model.update_key"):n("ui.settings.integrations.integration_model.add_key")}),r("sign_out")&&d.push({kind:"sign_out",label:n("ui.settings.integrations.integration_model.sign_out")}),r("disconnect")&&o==="connected"&&d.push({kind:"disconnect",label:n("ui.settings.integrations.integration_model.disconnect")}),r("copy_setup")&&e.setup_prompt&&d.push({kind:"copy_setup",label:n("ui.settings.integrations.integration_model.copy_setup_prompt")}),i!=="fix"&&d.push({kind:"open_config",label:n("ui.settings.integrations.integration_model.open_config_file")}),r("remove"))d.push({kind:"remove",label:n("ui.settings.integrations.integration_model.remove"),destructive:!0});else if(!e.source.editable){const c=Es(e);d.push({kind:"remove_elsewhere",label:c?n("ui.settings.integrations.integration_model.remove_in_origin",{origin:String(c)}):n("ui.settings.integrations.integration_model.remove_in_its_own_file"),hint:c?n("ui.settings.integrations.integration_model.defined_in_origin_s_config_remove_it_there",{origin:String(c)}):n("ui.settings.integrations.integration_model.defined_in_a_file_this_app_doesn_t_write_remove_it_there")})}return d}const Ec={get attention(){return n("ui.settings.integrations.integration_model.needs_attention")},get connected(){return n("ui.settings.integrations.integration_model.connected")},get ready(){return n("ui.settings.integrations.integration_model.available")}};function Rs(e,s=[],a){const i=Ye(a,e.name),o=Xe(e.name,s),r=mn(e,i);if(o&&i.pinnedGroup&&i.pinnedOperationId===o.id)return i.pinnedGroup;if(r==="needs_sign_in"||r==="error")return"attention";const d=lt(e.name,s,i);return Ct(d)&&r!=="connected"||pn(d)&&r!=="connected"?"attention":i.disconnectedAt!==null?"ready":at(e,s,i)||i.needsSignIn&&r!=="connected"||d?.status==="failed"&&ct(d)&&r!=="connected"?"attention":r==="connected"||e.status_basis==="stored"&&gn(e,i)?"connected":o&&o.action!=="test"?"attention":"ready"}function Ic(e,s=[],a){return["attention","connected","ready"].map(o=>({id:o,title:Ec[o],rows:e.filter(r=>Rs(r,s,a)===o)})).filter(o=>o.rows.length>0)}function Rc(e,s,a=Date.now()){if(!s)return e??{};const i={};for(const o of s.servers){const r=Ye(e,o.name),d=Xe(o.name,s.operations),g=lt(o.name,s.operations,r),c=Ct(g),u=o.status==="connected"&&(o.status_basis==="probe"||o.status_basis==="live"),y=r.holdUntil!==null&&a<r.holdUntil,p=!y&&!c&&r.connectedAt===null&&o.status_basis==="stored"&&o.tool_count_basis==="last_seen"?Cs(o.last_seen_at,a):null,f=!c,_=g?.status==="failed"&&ct(g)&&Is.test(g.message??""),x={connectedAt:u&&!y?a:p!==null?p:f?r.connectedAt:null,connectedToolCount:u&&!y||p!==null?o.tool_count??r.connectedToolCount:f?r.connectedToolCount:null,settledGroup:r.settledGroup,pinnedGroup:d&&r.pinnedOperationId===d.id?r.pinnedGroup:d?r.settledGroup:null,pinnedOperationId:d?d.id:null,needsKey:u?!1:r.needsKey||_,needsSignIn:u||c?!1:r.needsSignIn||o.status==="needs_sign_in",disconnectedAt:u&&!y?null:r.disconnectedAt,holdUntil:y?r.holdUntil:null,lastDecisive:g?xc(g):null};d||(x.settledGroup=Rs(o,s.operations,{...i,[o.name]:x})),i[o.name]=x}return i}const Tc=(e,s)=>e!==null&&s===e,Qt="local-operator.settings.integrations.row-memory",Ts=(e,s)=>`${e}#${s}`;function Lc(e,s){const a={};if(!s)return a;for(const i of s.servers){const o=e[i.name];o&&(a[Ts(i.source.path,i.name)]=o)}return a}function Oc(e,s,a){if(!s)return e;let i=null;for(const o of s.servers){if(Object.prototype.hasOwnProperty.call(e,o.name))continue;const r=zc(a[Ts(o.source.path,o.name)]);r&&(i=i??{...e},i[o.name]=r)}return i??e}const Fc=["attention","connected","ready"],Ls=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),hn=e=>typeof e=="number"&&Number.isFinite(e)?e:null,zn=e=>Fc.includes(e)?e:null,Ot=e=>{const s=hn(e);return s!==null&&s>=1e12?s:null};function Dc(e){if(!Ls(e)||typeof e.id!="string"||typeof e.name!="string")return null;const s=e.action,a=e.status;return s!=="login"&&s!=="logout"&&s!=="reauth"&&s!=="test"||a!=="running"&&a!=="complete"&&a!=="cancelled"&&a!=="failed"?null:{id:e.id,name:e.name,action:s,status:a,created_at:hn(e.created_at)??0,credential_removed:e.credential_removed===!0,...typeof e.message=="string"?{message:e.message}:{}}}function zc(e){if(!Ls(e))return null;const s=Ot(e.connectedAt),a=Ot(e.disconnectedAt),i=e.needsKey===!0,o=e.needsSignIn===!0,r=Dc(e.lastDecisive);return s===null&&a===null&&!i&&!o&&!r?null:{connectedAt:s,connectedToolCount:hn(e.connectedToolCount),settledGroup:zn(e.settledGroup),pinnedGroup:zn(e.pinnedGroup),pinnedOperationId:typeof e.pinnedOperationId=="string"?e.pinnedOperationId:null,needsKey:i,needsSignIn:o,disconnectedAt:a,holdUntil:Ot(e.holdUntil),lastDecisive:r}}const Os=2e3,$n=8e3;function $c(e){return e&&(e.servers.some(a=>a.status==="connecting")||e.operations.some(a=>a.status==="running"))?Os:!1}const Pc=/^[A-Za-z0-9_.:-]{1,100}$/,Kc=/:\/\//;function Uc(e,s){const a=e.trim();return a?Pc.test(a)?s.includes(a)?n("ui.settings.integrations.integration_model.an_integration_named_trimmed_already_exists",{trimmed:String(a)}):null:n("ui.settings.integrations.integration_model.use_letters_numbers_dots_dashes_underscores_or_colons_with_no_spa"):n("ui.settings.integrations.integration_model.give_it_a_name")}function Bc(e){const s=e.trim();if(!s)return n("ui.settings.integrations.integration_model.enter_the_server_s_url");let a;try{a=new URL(s)}catch{return n("ui.settings.integrations.integration_model.enter_a_full_url_like_https_mcp_example_com_mcp")}return a.protocol!=="https:"&&a.protocol!=="http:"?n("ui.settings.integrations.integration_model.the_url_must_start_with_https_or_http"):a.hostname?a.username||a.password?n("ui.settings.integrations.integration_model.remove_the_username_or_password_from_the_url_keys_are_added_after"):a.search||a.hash?n("ui.settings.integrations.integration_model.remove_the_or_part_of_the_url_keys_are_added_after_it_s_saved"):Kc.test(s.slice(a.protocol.length+2))?n("ui.settings.integrations.integration_model.this_looks_like_two_urls_pasted_together_enter_just_one"):null:n("ui.settings.integrations.integration_model.the_url_needs_a_host_name")}const Vc=e=>e.split(`
287
- `).map(s=>s.trim()).filter(Boolean);function Zt(e,s){const a=!!e?.cold,i=(e?.servers??[]).map(o=>{const r=o.transport==="http",d=o.secret_refs??[],g=o.status==="connected"?"connected":o.status==="connecting"?"connecting":o.status==="auth-required"?"needs_sign_in":"not_started",c=[];g!=="connected"&&c.push("connect"),g==="connected"&&c.push("disconnect"),a||c.push("reload"),r&&o.transport_oauth_supported!==!1&&c.push("sign_in"),d.length>0&&c.push("set_key"),o.owned_scope&&c.push("remove"),o.setup?.text&&c.push("copy_setup");const u=Ss(o.source);return{id:o.name,name:o.name,scope:o.owned_scope??"global",project_cwd:null,source:{kind:Hc(o.source,u,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:g,status_reason:null,status_observed_at:null,last_seen_at:null,status_basis:a?"stored":"live",auth:{kind:d.length?"api_key":r?"unknown":"none",signed_in:null,secret_refs:d.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:i.some(o=>o.source.owned_scope==="project"),global_path:"",project_path:null,status_source:a?"config":"live",session_id:s,servers:i,operations:(e?.operations??[]).map(o=>({...o}))}}const Hc=(e,s,a)=>s==="Claude Code"?"claude-code":s==="Cursor"?"cursor":s==="VS Code"?"vscode":s==="Codex CLI"?"codex":a?"local-operator":e?"project-mcp-json":"local-operator",Pn={get invalid_config(){return n("ui.settings.integrations.integration_model.that_configuration_isn_t_valid_check_the_command_or_the_url_then_")},get operation_unavailable(){return n("ui.settings.integrations.integration_model.that_sign_in_or_test_isn_t_running_any_more_try_again")},get exists(){return n("ui.settings.integrations.integration_model.an_integration_with_this_name_already_exists_choose_another_name")},get not_owned(){return n("ui.settings.integrations.integration_model.it_s_defined_in_another_tool_s_config_so_it_can_t_be_changed_here")},get project_scope_unavailable(){return n("ui.settings.integrations.integration_model.there_s_no_separate_project_config_here_so_it_can_only_be_added_g")},get unknown_server(){return n("ui.settings.integrations.integration_model.it_no_longer_exists_the_list_has_been_refreshed")},get oauth_unsupported(){return n("ui.settings.integrations.integration_model.it_doesn_t_use_browser_sign_in")},get grant_running(){return n("ui.settings.integrations.integration_model.a_sign_in_or_test_is_already_running_wait_for_it_to_finish_or_can")},get too_many_operations(){return n("ui.settings.integrations.integration_model.too_many_sign_ins_and_tests_are_waiting_try_again_in_a_moment")},get write_failed(){return n("ui.settings.integrations.integration_model.the_config_file_couldn_t_be_written_check_that_it_isn_t_read_only")},get mcp_starting(){return n("ui.settings.integrations.integration_model.integrations_are_still_starting_try_again_in_a_moment")},get mcp_control_refused(){return n("ui.settings.integrations.integration_model.the_server_refused_it_so_nothing_was_changed")}},qc="ui.settings.integrations.integration_model.copy_catalog_refusal_fallback";function _t(e,s,a){if(s instanceof an&&s.status===409){const i=typeof s.code=="string"&&Object.prototype.hasOwnProperty.call(Pn,s.code)?Pn[s.code]:n(qc);return`${ra[e]}. ${i}`}return la(e,s,a).message}const Gc="ui.settings.integrations.add_integration_form.copy_add_integration_pickup_note",Yc="ui.settings.integrations.add_integration_form.copy_transport_hint",Wc=({existingNames:e,projectScopeAvailable:s,projectLabel:a,onSubmit:i,onCancel:o,initial:r})=>{se();const[d,g]=l.useState(r?.name??""),[c,u]=l.useState(r?.mode??"command"),[y,p]=l.useState(r?.command??""),[f,_]=l.useState(r?.args??""),[x,v]=l.useState(r?.url??""),[N,z]=l.useState("global"),[C,E]=l.useState(r?.touched?{name:!0,command:!0,url:!0}:{}),[b,k]=l.useState(!!r?.touched),[w,G]=l.useState(!1),[Y,W]=l.useState(null),S=l.useRef(null),I=l.useRef(null),$=l.useRef(null);l.useEffect(()=>{S.current?.focus()},[]);const U=Uc(d,e),V=c==="command"&&!y.trim()?n("ui.settings.integrations.add_integration_form.enter_the_command_to_run"):null,H=c==="url"?Bc(x):null,q=A=>b||C[A],te=async A=>{if(A.preventDefault(),k(!0),U||V||H){U?S.current?.focus():V?I.current?.focus():$.current?.focus();return}G(!0),W(null);const Q=s?N:"global",Z=c==="command"?{name:d.trim(),scope:Q,mode:c,command:y.trim(),args:Vc(f)}:{name:d.trim(),scope:Q,mode:c,url:x.trim()},X=await i(Z);G(!1),W(X)},m=(A,Q,Z)=>Q&&q(Z)?t.jsx("p",{id:A,className:"text-body-sm text-danger",children:Q}):null,T=A=>A.preventDefault();return t.jsxs("form",{noValidate:!0,"aria-label":n("ui.settings.integrations.add_integration_form.add_integration"),className:"flex flex-col gap-4 rounded-lg bg-surface p-4",onSubmit:A=>void te(A),onKeyDown:A=>{A.key==="Escape"&&(A.stopPropagation(),o())},children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Ee,{htmlFor:"integration-add-name",children:n("ui.settings.integrations.add_integration_form.name")}),t.jsx(De,{ref:S,id:"integration-add-name",value:d,placeholder:n("ui.settings.integrations.add_integration_form.e_g_notion"),autoComplete:"off","aria-invalid":!!(U&&q("name")),"aria-describedby":U&&q("name")?"integration-add-name-error":void 0,onChange:A=>g(A.target.value),onBlur:()=>E(A=>({...A,name:!0}))}),m("integration-add-name-error",U,"name")]}),t.jsxs(jt,{value:c,onValueChange:A=>u(A==="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:n("ui.settings.integrations.add_integration_form.how_it_runs")}),t.jsxs(wt,{"aria-labelledby":"integration-add-transport-label",children:[t.jsx(Qe,{value:"command","data-integration-transport":"command",children:n("ui.settings.integrations.add_integration_form.local_command")}),t.jsx(Qe,{value:"url","data-integration-transport":"url",children:n("ui.settings.integrations.add_integration_form.remote_url")})]}),t.jsx("p",{className:"text-ink-dim text-meta",children:n(Yc)}),t.jsxs(Nn,{value:"command",className:"mt-0 flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Ee,{htmlFor:"integration-add-command",children:n("ui.settings.integrations.add_integration_form.command")}),t.jsx(De,{ref:I,id:"integration-add-command",value:y,placeholder:n("ui.settings.integrations.add_integration_form.e_g_npx"),autoComplete:"off",className:"font-mono","aria-invalid":!!(V&&q("command")),"aria-describedby":V&&q("command")?"integration-add-command-error":void 0,onChange:A=>p(A.target.value),onBlur:()=>E(A=>({...A,command:!0}))}),m("integration-add-command-error",V,"command")]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs(Ee,{htmlFor:"integration-add-args",children:[n("ui.settings.integrations.add_integration_form.arguments")," ",t.jsx("span",{className:"font-normal text-ink-dim",children:n("ui.settings.integrations.add_integration_form.one_per_line")})]}),t.jsx(ps,{id:"integration-add-args",value:f,rows:2,className:"font-mono",onChange:A=>_(A.target.value)})]})]}),t.jsx(Nn,{value:"url",className:"mt-0 flex flex-col gap-4",children:t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Ee,{htmlFor:"integration-add-url",children:n("ui.settings.integrations.add_integration_form.url")}),t.jsx(De,{ref:$,id:"integration-add-url",type:"url",value:x,placeholder:n("ui.settings.integrations.add_integration_form.https_mcp_example_com_mcp"),autoComplete:"off",className:"font-mono","aria-invalid":!!(H&&q("url")),"aria-describedby":H&&q("url")?"integration-add-url-error":"integration-add-url-help",onChange:A=>v(A.target.value),onBlur:()=>E(A=>({...A,url:!0}))}),m("integration-add-url-error",H,"url")??t.jsx("p",{id:"integration-add-url-help",className:"text-ink-dim text-meta",children:n("ui.settings.integrations.add_integration_form.if_it_needs_a_sign_in_or_a_key_you_ll_be_asked_after_it_s_added")})]})})]}),s?t.jsxs(jt,{value:N,onValueChange:A=>z(A==="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:n("ui.settings.integrations.add_integration_form.available_in")}),t.jsxs(wt,{"aria-labelledby":"integration-add-scope-label",children:[t.jsx(Qe,{value:"global","data-integration-scope":"global",children:n("ui.settings.integrations.add_integration_form.all_chats")}),t.jsx(Qe,{value:"project","data-integration-scope":"project",children:n("ui.settings.integrations.add_integration_form.this_project")})]}),a?t.jsx("p",{className:"text-ink-dim text-meta",children:N==="project"?n("ui.settings.integrations.add_integration_form.only_chats_working_in_projectlabel",{projectLabel:String(a)}):n("ui.settings.integrations.add_integration_form.every_chat_in_any_folder")}):null]}):null,Y?t.jsx("p",{className:"text-body-sm text-danger",role:"alert",children:Y}):null,t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx("p",{className:ue("text-body-sm text-ink-dim"),children:n(Gc)}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(D,{type:"button",variant:"ghost",size:"md",onMouseDown:T,onClick:o,children:n("ui.settings.integrations.add_integration_form.cancel")}),t.jsxs(D,{type:"submit",variant:"primary",size:"md",disabled:w,onMouseDown:T,children:[w?t.jsx(ye,{size:"xs"}):null,n("ui.settings.integrations.add_integration_form.add_integration")]})]})]})]})},Qc=4;function Zc(e){return e.rowMoving?e.now+e.windowMs:Math.max(e.hold.until,e.lastMovingAt+e.windowMs)}function Jc(e){return e.now>e.hold.until||e.hold.reanchors>=Qc?"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 Xc(e){const s=Zc({hold:e.hold,now:e.now,windowMs:e.windowMs,rowMoving:e.rowMoving,lastMovingAt:e.lastMovingAt});if(e.now>s)return{hold:null,land:null};const a=e.hold.landedOn??null,i=e.candidate;if(!i)return{hold:{until:s,reanchors:e.hold.reanchors,landedOn:a},land:null};if(!a)return{hold:{until:s,reanchors:e.hold.reanchors,landedOn:i},land:i};const o=Jc({hold:{until:s,reanchors:e.hold.reanchors,landedOn:a},candidate:i,active:e.active,body:e.body,now:e.now});if(o==="settled")return{hold:{until:s,reanchors:e.hold.reanchors,landedOn:a},land:null};if(o==="drop")return{hold:null,land:null};const r=!a.isConnected;return{hold:{until:r?e.now+e.windowMs:s,reanchors:r?e.hold.reanchors+1:e.hold.reanchors,landedOn:i},land:i}}function ed(e){const{row:s,target:a}=e;return!s||!a||typeof a.nodeType!="number"?!1:!s.contains(a)}const Kn=250;function Un(e){return e?!e.disabled:!1}function td(e){return Un(e.primary)?e.primary??null:Un(e.overflow)?e.overflow??null:null}function nd(e){return e.verdict==="finished"?null:e.watchMs}const Fs="key";function sd(e){const{name:s,keyless:a,freeName:i,names:o,values:r,replace:d,canReplace:g}=e;if(a){const c=Jt(s,i);return{values:{[c]:(r[Fs]??"").trim()},confirmedReplace:d&&g?[c]:[],header:i.trim()}}return{values:Object.fromEntries(o.map(c=>[c,(r[c]??"").trim()])),confirmedReplace:d&&g?o:[],header:void 0}}function Jt(e,s){const a=Bn(e),i=Bn(s);if(!i)return"";const o=[a,i].filter(Boolean).join("_"),r=/^[A-Za-z_]/.test(o)?o:`K_${o}`;if(r.length<=Ft)return r;const d=ad(a),g=Ft-i.length-d.length-2,c=[a.slice(0,Math.max(g,0)),d,i].filter(Boolean).join("_");return c.length<=Ft?c:c.slice(-128)}const Ft=128,Bn=e=>e.trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,""),ad=e=>{let s=2166136261;for(let a=0;a<e.length;a+=1)s^=e.charCodeAt(a),s=Math.imul(s,16777619)>>>0;return s.toString(36).toUpperCase().slice(0,5)},id=({name:e,keyNames:s,keyless:a=!1,savedKeys:i=[],saving:o,failure:r,onSave:d,onClose:g})=>{se();const[c,u]=l.useState({}),[y,p]=l.useState(!1),[f,_]=l.useState(""),x=a?[Jt(e,f)]:[...s],v=a?[Fs]:x,N=(a?Jt(e,f).length>0:!0)&&v.every(C=>(c[C]??"").trim()),z=x.some(C=>i.includes(C));return t.jsx(ns,{open:!0,onClose:g,maxWidth:"xs",title:n("ui.settings.integrations.integration_key_dialog.add_keys_heading",{count:a?1:s.length,name:e}),actions:t.jsxs(t.Fragment,{children:[t.jsx(Kt,{onClick:g,children:n("ui.settings.integrations.integration_key_dialog.cancel")}),t.jsx(Ut,{disabled:!N||o,onClick:()=>{const C=sd({name:e,keyless:a,freeName:f,names:x,values:c,replace:y,canReplace:z});d(C.values,C.confirmedReplace,C.header)},children:o?n("ui.settings.integrations.integration_key_dialog.saving"):n("ui.settings.integrations.integration_key_dialog.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:a?n("ui.settings.integrations.integration_key_dialog.keys_are_saved_encrypted_on_this_computer_this_one_is_stored_unde"):n("ui.settings.integrations.integration_key_dialog.keys_are_saved_encrypted_on_this_computer_other_integrations_that")}),a?t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Ee,{htmlFor:"integration-key-name",children:n("ui.settings.integrations.integration_key_dialog.the_header_this_server_wants_the_key_in")}),t.jsx(De,{id:"integration-key-name",autoComplete:"off",placeholder:n("ui.settings.integrations.integration_key_dialog.e_g_authorization_or_x_api_key"),value:f,onChange:C=>_(C.target.value)}),t.jsx("p",{className:"-mx-1.5 text-ink-dim text-meta",children:n("ui.settings.integrations.integration_key_dialog.this_server_declares_no_key_of_its_own_so_local_operator_adds_one")})]}):null,v.filter(C=>a!==!0||C.trim().length>0).map(C=>t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Ee,{htmlFor:`integration-key-${C}`,className:"font-mono",children:a?"Key":C}),t.jsx(De,{id:`integration-key-${C}`,type:"password",autoComplete:"off",value:c[C]??"",onChange:E=>u(b=>({...b,[C]:E.target.value}))})]},C)),z?t.jsxs("div",{className:"flex items-center gap-2 text-body-sm",children:[t.jsx(qt,{id:"integration-key-replace",checked:y,onCheckedChange:C=>p(C===!0)}),t.jsx(Ee,{htmlFor:"integration-key-replace",className:"font-normal",children:As(x.length)})]}):null,r?t.jsx("p",{className:"-mx-1.5 text-body-sm text-danger",role:"alert",children:r}):null]})})},od={success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info",neutral:"bg-ink-dim"},rd={success:"text-ink-muted",warning:"text-warning",danger:"text-danger",info:"text-ink-muted",neutral:"text-ink-dim"};function Vn(e){if(e===n("ui.settings.integrations.integration_model.ready"))return n(Nc);if(e===n("ui.settings.integrations.integration_model.not_connected"))return n(Sc)}const ld=({row:e,operations:s,memories:a,now:i,projectScopeAvailable:o,highlighted:r=!1,rowRef:d,primaryRef:g,overflowRef:c,pending:u,failure:y,confirm:p,onPrimary:f,onOverflow:_,onConfirm:x,onCancelConfirm:v})=>{se();const N=kc(e,s,a,i),z=r&&N.tone==="danger"?"text-ink":rd[N.tone],C=_n(e,s,a),E=Ac(e,s,a),b=Cc(e,o),k=E.findIndex(w=>w.kind==="remove"||w.kind==="remove_elsewhere");return t.jsxs("li",{ref:d,"data-integration":e.name,"data-status":e.status,className:ue("flex min-h-14 flex-col justify-center gap-1 px-4 py-2.5",r&&"bg-row-selected"),onKeyDown:w=>{!p||w.key!=="Escape"||(w.stopPropagation(),v())},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:N.busy?t.jsx(ye,{size:"xs"}):t.jsx("span",{"aria-hidden":"true","data-tone":N.tone,className:ue("size-2 rounded-full",od[N.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:b.map((w,G)=>t.jsxs("span",{children:[G>0?" · ":null,w.startsWith("Imported from")&&e.source.path?t.jsx(Je,{content:Xa(e.source.path),children:t.jsx("span",{className:"underline decoration-dotted underline-offset-2",children:w})}):w]},w))})]}),Vn(N.label)?t.jsx(Je,{content:Vn(N.label),children:t.jsx("span",{className:ue("shrink-0 text-body-sm",z),children:N.label})}):t.jsx("span",{className:ue("shrink-0 text-body-sm",z),children:N.label}),C?t.jsxs(D,{ref:g,variant:C.variant??"secondary",size:"sm","aria-label":`${C.label} ${e.name}`,disabled:u,"data-integration-action":C.kind,onClick:()=>f(C),children:[u?t.jsx(ye,{size:"xs"}):null,C.label]}):null,t.jsxs(Ri,{children:[t.jsx(Ti,{asChild:!0,children:t.jsx(D,{ref:c,variant:"ghost",size:"icon-sm","aria-label":n("ui.settings.integrations.integration_row.more_actions_for_name",{name:String(e.name)}),disabled:u,children:t.jsx(ca,{"aria-hidden":"true"})})}),t.jsx(Li,{align:"end",className:"min-w-48",children:E.map((w,G)=>t.jsx(cd,{item:w,separated:G===k&&G>0,onSelect:()=>_(w)},w.kind))})]})]}),N.detail?t.jsx("p",{className:ue("ps-7 text-body-sm",N.tone==="danger"?"text-ink-muted":"text-ink-dim"),children:N.detail}):null,y?t.jsx("p",{className:ue("ps-7 text-body-sm",r?"text-ink":"text-danger"),role:"alert",children:y}):null,p?t.jsxs("div",{className:"flex flex-wrap items-center gap-2 ps-7",children:[t.jsx("span",{className:"text-body-sm text-ink",children:p.kind==="remove"?n("ui.settings.integrations.integration_row.remove_name",{name:String(e.name)}):n("ui.settings.integrations.integration_row.sign_out_of_name",{name:String(e.name)})}),t.jsx("span",{className:"text-body-sm text-ink-muted",children:p.kind==="remove"?n("ui.settings.integrations.integration_row.agents_in_every_chat_lose_access_to_name",{name:String(e.name)}):e.auth.kind==="oauth"?n("ui.settings.integrations.integration_row.the_saved_sign_in_is_removed_too"):n("ui.settings.integrations.integration_row.its_saved_credential_is_removed_too")}),t.jsx(D,{variant:"danger",size:"sm",onClick:x,"data-integration-confirm":p.kind,children:p.kind==="remove"?n("ui.settings.integrations.integration_row.remove"):n("ui.settings.integrations.integration_row.sign_out")}),t.jsx(D,{variant:"ghost",size:"sm",onClick:v,children:n("ui.settings.integrations.integration_row.keep")})]}):null]})},cd=({item:e,separated:s,onSelect:a})=>(se(),t.jsxs(t.Fragment,{children:[s?t.jsx(Oi,{}):null,e.kind==="remove_elsewhere"?t.jsxs(Sn,{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(Sn,{destructive:e.kind==="remove",onSelect:a,"data-integration-menu":e.kind,children:e.label})]}));function dd(e,s,a){return!s||s.status==="running"?s?.browser_opened===!0?{message:n("ui.settings.integrations.integration_sign_in_dialog.your_browser_opened_approve_access_to_name_there_then_come_back_h",{name:String(e)}),tone:"progress",link:s.authorization_url??null}:s?.browser_opened===!1?{message:s.authorization_url?n("ui.settings.integrations.integration_sign_in_dialog.your_browser_didn_t_open_open_this_link_to_approve_access"):n("ui.settings.integrations.integration_sign_in_dialog.your_browser_didn_t_open_and_no_link_was_provided_cancel_and_try_"),tone:"progress",link:s.authorization_url??null}:{message:n("ui.settings.integrations.integration_sign_in_dialog.waiting_for_you_to_approve_access_to_name",{name:String(e)}),tone:"progress",link:s?.authorization_url??null}:s.status==="complete"?{message:n("ui.settings.integrations.integration_sign_in_dialog.signed_in_to_name_agents_can_use_it_now",{name:String(e)}),tone:"success",link:null}:s.status==="cancelled"?{message:n("ui.settings.integrations.integration_sign_in_dialog.sign_in_cancelled"),tone:"failure",link:null,reason:null,nextStep:n("ui.settings.integrations.integration_sign_in_dialog.press_try_again_when_you_are_ready")}:{message:n("ui.settings.integrations.integration_sign_in_dialog.sign_in_didn_t_finish"),tone:"failure",link:null,reason:wc(s.message,a)??n("ui.settings.integrations.integration_sign_in_dialog.the_server_didn_t_say_why"),nextStep:ud(s.message??null,a)}}function ud(e,s){const a=(e??"").toLowerCase();return a.includes("redirect")?s?n("ui.settings.integrations.integration_sign_in_dialog.this_server_may_not_accept_sign_ins_from_local_operator_check_the"):n("ui.settings.integrations.integration_sign_in_dialog.this_server_may_not_accept_sign_ins_from_local_operator_check_the_2"):a.includes("no oauth")||a.includes("authorization server")?s?n("ui.settings.integrations.integration_sign_in_dialog.this_server_doesn_t_publish_a_browser_sign_in_add_its_key_instead"):n("ui.settings.integrations.integration_sign_in_dialog.this_server_doesn_t_publish_a_browser_sign_in_check_the_server_s_"):a.includes("network")||a.includes("connect")?n("ui.settings.integrations.integration_sign_in_dialog.check_the_server_s_url_and_your_network_then_try_again"):n("ui.settings.integrations.integration_sign_in_dialog.check_the_server_s_settings_then_try_again")}function gd(e,s){return e.kind==="ready"?"ready":e.kind==="running"&&s&&s.tone!=="progress"?s.tone==="success"?"success":"failure":"running"}const md=({name:e,action:s,keyRoute:a,phase:i,onStart:o,onCancel:r,onOpenLink:d,onClose:g})=>{se();const c=i.kind==="running"?i.operation:null,u=i.kind==="running"?dd(e,c,a):null,y=i.kind==="starting"||i.kind==="running"&&u?.tone==="progress",p=u&&u.tone!=="progress",f=l.useRef(null),_=l.useRef(!1),x=gd(i,u);l.useEffect(()=>{if(!_.current){_.current=!0;return}x&&f.current?.focus()},[x]);const v=()=>g(u?.tone==="success"?"signed-in":"dismissed");return t.jsx(ns,{open:!0,onClose:v,maxWidth:"xs",fullWidth:!0,title:n("ui.settings.integrations.integration_sign_in_dialog.sign_in_to_name",{name:String(e)}),dialogProps:{onOpenAutoFocus:N=>{N.preventDefault(),f.current?.focus()}},actions:t.jsxs(t.Fragment,{children:[y&&c?t.jsx(Kt,{ref:f,onClick:()=>r(c.id),children:n("ui.settings.integrations.integration_sign_in_dialog.cancel_sign_in")}):t.jsx(Kt,{ref:i.kind==="ready"?void 0:f,onClick:v,children:u?.tone==="success"?n("ui.settings.integrations.integration_sign_in_dialog.done"):n("ui.settings.integrations.integration_sign_in_dialog.close")}),i.kind==="ready"?t.jsx(Ut,{ref:f,onClick:o,children:n("ui.settings.integrations.integration_sign_in_dialog.continue_in_browser")}):null,i.kind==="refused"||u?.tone==="failure"?t.jsx(Ut,{ref:u?.tone==="failure"?f:void 0,onClick:o,children:n("ui.settings.integrations.integration_sign_in_dialog.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:[i.kind==="ready"?t.jsx("p",{className:"-mx-1.5",children:n("ui.settings.integrations.integration_sign_in_dialog.browser_approval_notice",{name:e,replaces:s==="reauth"?"yes":"no"})}):null,i.kind==="starting"?t.jsxs("p",{className:"-mx-1.5 flex items-center gap-2",children:[t.jsx(ye,{size:"xs"}),n("ui.settings.integrations.integration_sign_in_dialog.starting_sign_in")]}):null,u?t.jsxs("div",{className:"flex flex-col gap-1",role:p?"status":void 0,children:[t.jsxs("p",{className:(u.tone==="success","-mx-1.5 flex items-start gap-2 text-ink"),children:[u.tone==="progress"?t.jsx(ye,{size:"xs",className:"mt-0.5"}):null,u.tone==="failure"?t.jsx(Fi,{"aria-hidden":"true",className:"mt-0.5 size-4 shrink-0 text-danger"}):null,t.jsx("span",{children:u.message})]}),u.reason?t.jsx("p",{className:"-mx-1.5 text-ink-muted",children:u.reason}):null,u.nextStep?t.jsx("p",{className:"-mx-1.5 text-ink-muted",children:u.nextStep}):null]}):null,u?.link&&u.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:u.link,children:u.link}),t.jsx(D,{variant:"ghost",size:"icon-sm","aria-label":n("ui.settings.integrations.integration_sign_in_dialog.copy_the_sign_in_link"),title:n("ui.settings.integrations.integration_sign_in_dialog.copy_the_sign_in_link"),onClick:()=>{navigator.clipboard.writeText(u.link??"").then(()=>Bt(n("ui.settings.integrations.integration_sign_in_dialog.sign_in_link_copied"))).catch(()=>{})},children:t.jsx(ts,{"aria-hidden":"true"})})]}),t.jsx(D,{variant:"link",size:"sm",onClick:()=>d(u.link??""),children:n("ui.settings.integrations.integration_sign_in_dialog.open_the_sign_in_page")})]}):null,i.kind==="refused"?t.jsx("p",{className:"text-danger",role:"alert",children:i.message}):null]})})},_d=e=>e.reduce((s,a)=>s?(a.updated_at??0)>(s.updated_at??0)?a:s:a,null),pd=/^[A-Za-z]:[\\/]/,bt=e=>{const s=e?.trim();return s&&(s.startsWith("/")||pd.test(s))?s:null};function hd(e){const o=e?.payload?.frontend?.snapshot?.cwd;return typeof o=="string"&&o.trim()?o:null}const ot="local-operator.settings.integrations.last-cwd";function fd(e,s,a=typeof localStorage>"u"?null:localStorage){const i=bt(s);if(!(!e||!i||!a))try{const o=a.getItem(ot),r=o?JSON.parse(o):{};if(r[e]===i)return;a.setItem(ot,JSON.stringify({...r,[e]:i}))}catch{}}const Ds=()=>typeof localStorage>"u"?null:localStorage;function zs(e=Ds()){if(!e)return{};try{const s=e.getItem(Qt);if(!s)return{};const a=JSON.parse(s);return!a||typeof a!="object"||Array.isArray(a)?{}:a}catch{return{}}}const Hn=256;function xd(e,s=Ds()){if(s)try{const a={...zs(s),...e},i=Object.keys(a);if(i.length>Hn){const o={};for(const r of i.slice(-Hn))o[r]=a[r];s.setItem(Qt,JSON.stringify(o));return}s.setItem(Qt,JSON.stringify(a))}catch{}}function qn(e,s,a){if(e==="saved")return null;if(e==="replace_confirmation_required"){const o=As(Object.keys(a).length);return n("ui.settings.integrations.use_integrations.a_saved_value_already_exists_for_this_key_tick_label_to_overwrite",{label:String(o)})}if(e==="invalid_target")return n("ui.settings.integrations.use_integrations.that_header_can_t_carry_this_key_it_may_already_be_set_on_the_ser");const i=s.length?s:Object.keys(a);return n("ui.settings.integrations.use_integrations.keys_not_saved",{keys:String(i.join(", "))})}function yd(e,s=typeof localStorage>"u"?null:localStorage){if(!(!e||!s))try{const a=s.getItem(ot);if(!a)return;const i=JSON.parse(a);if(!(e in i))return;const o={...i};delete o[e],s.setItem(ot,JSON.stringify(o))}catch{}}const vd=e=>!!(e&&typeof e=="object"&&"code"in e&&e.code==="invalid_cwd"),bd=(e,s)=>s!==null&&e===s?null:e;function kd(e,s=typeof localStorage>"u"?null:localStorage){if(!e||!s)return null;try{const a=s.getItem(ot);if(!a)return null;const o=JSON.parse(a)[e];return typeof o=="string"?o:null}catch{return null}}const jd=e=>e.action==="disconnect"?"disconnected":"connected";function wd(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 Nd(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 Sd({sessionId:e}){const s=sn(),a=kt(s.data,"mcp_catalog"),i=kt(s.data,"mcp"),o=a?"catalog":i?"session":null,[r,d]=l.useState(null),g=nn(),c=st(M=>M.sessions),u=st(M=>M.fetchSessions),y=st(M=>M.loading),p=l.useMemo(()=>c.find(M=>M.session_id===e)??null,[c,e]),f=l.useMemo(()=>o==="session"&&!e?_d(c):null,[o,e,c]),_=o==="session"?e??f?.session_id??null:null;l.useEffect(()=>{o!=="session"||e||c.length>0||u(ei)},[o,e,c.length,u]);const x=o==="catalog"?bt(p?.cwd):null,v=o==="catalog"&&!!e&&x===null,N=Ie({queryKey:["desktop","session-cwd",e??""],queryFn:()=>_e({op:"sessions.get",sessionId:e??""}),enabled:v,staleTime:Number.POSITIVE_INFINITY,retry:!1}),z=v&&!N.isFetched,C=x??bt(hd(N.data))??(N.isFetched?bt(kd(e)):null),E=bd(C,r),b=o==="catalog"?E:null,k=o==="catalog"?e??null:null,w=da.catalog(b,k);l.useEffect(()=>{o!=="catalog"||!e||!b||fd(e,b)},[o,e,b]);const G=l.useRef(0),[Y,W]=l.useState(0),S=l.useRef(null),I=l.useCallback((M,P)=>{const L=Date.now()+$n;G.current=L,S.current={name:M,expect:P},W(L)},[]),$=l.useCallback(M=>Date.now()<G.current?Os:$c(M),[]),U=Ie({queryKey:w,queryFn:()=>ma(b,k),enabled:o==="catalog"&&!z,staleTime:1e4,refetchInterval:M=>$(M.state.data)}),V=vd(U.error);l.useEffect(()=>{!V||!C||r===C||(d(C),yd(e))},[V,C,r,e]);const H=Ie({queryKey:Vt.list(_??""),queryFn:()=>_a(_??""),enabled:o==="session"&&!!_,staleTime:1e4,refetchInterval:M=>$(M.state.data?Zt(M.state.data,_??""):void 0)}),q=l.useMemo(()=>{if(o==="catalog")return U.data;if(o==="session"&&H.data&&_)return Zt(H.data,_)},[o,U.data,H.data,_]),te=l.useCallback(()=>Md({queryClient:g,route:o,catalogKey:w,sessionId:_}),[o,w,g,_]);l.useEffect(()=>{if(!Y)return;const M=S.current;if(!M)return;const P=q?.servers.find(ie=>ie.name===M.name);!P||!(M.expect==="connected"?P.status==="connected":P.status_basis==="live"&&P.status!=="connected")||(G.current=0,S.current=null,W(0))},[q,Y]);const m=l.useRef({}),[T,A]=l.useState(0),Q=l.useMemo(()=>(m.current=Rc(Oc(m.current,q,zs()),q),m.current),[q,T]),Z=l.useRef("");l.useEffect(()=>{const M=Lc(Q,q);if(!Object.keys(M).length)return;const P=JSON.stringify(M);P!==Z.current&&(Z.current=P,xd(M))},[Q,q]);const X=l.useCallback(M=>{const P=Ye(m.current,M);P.needsKey||(m.current={...m.current,[M]:{...P,needsKey:!0}},A(L=>L+1))},[]),B=l.useCallback(M=>{if(M.action!=="disconnect"&&M.action!=="connect"&&M.action!=="reload")return;const P=Ye(m.current,M.name),L=Date.now()+$n,ie=M.action==="disconnect"?{...P,connectedAt:null,disconnectedAt:Date.now(),holdUntil:L}:{...P,disconnectedAt:null,holdUntil:L};m.current={...m.current,[M.name]:ie},I(M.name,jd(M)),A(oe=>oe+1)},[I]),J=l.useCallback(async M=>{if(o==="catalog"){const P=wd(M);if(!P)return null;try{const L=await ua(b,P);return g.setQueryData(w,L),B(M),L.operation?.id??null}catch(L){throw L instanceof an&&L.status===409&&g.invalidateQueries({queryKey:w}),L}}if(o==="session"&&_){const P=await _e({op:"mcp.control",sessionId:_,control:Nd(M)});B(M);const L=Vt.list(_),ie=P?.data;return ie&&"servers"in ie&&Array.isArray(ie.servers)?(g.setQueryData(L,ie),null):(g.invalidateQueries({queryKey:L}),ie&&"id"in ie&&typeof ie.id=="string"?ie.id:null)}return null},[o,b,w,g,_,B]),Re=l.useCallback(async M=>{if(o==="catalog"&&k&&(M.action==="connect"||M.action==="disconnect"||M.action==="reload")){try{await _e({op:"mcp.control",sessionId:k,control:{action:M.action,name:M.name,...M.action==="disconnect"?{confirmed:!0}:{}}})}catch(P){throw g.invalidateQueries({queryKey:w}),P}return B(M),await g.invalidateQueries({queryKey:w}),null}return J(M)},[o,k,g,w,J,B]),Ne=l.useCallback(async(M,P,L,ie)=>{if(o==="catalog"){const oe=await ga(b,M,P,L,ie);if(oe.catalog&&g.setQueryData(w,oe.catalog),oe.code!=="saved")return{saved:!1,message:qn(oe.code,oe.failed_ids,P)};try{await J({action:"test",name:M})}catch{}return{saved:!0,message:null}}if(o==="session"&&_){const oe=await _e({op:"mcp.credentials.store",sessionId:_,name:M,values:P,confirmedReplace:L});if(oe.data?.code!=="saved")return{saved:!1,message:qn(oe.data?.code,oe.data?.failed_ids??[],P)};try{await J({action:"connect",name:M})}catch{}return{saved:!0,message:null}}return{saved:!1,message:null}},[o,b,w,g,J,_]),ke=o==="catalog"?U:H,pe=l.useCallback(()=>{ke.refetch()},[ke]);return{enabled:o!==null,route:o,sessionId:o==="catalog"?k:_,borrowed:f,noConversation:o==="session"&&!_&&!y,document:q,isLoading:s.isLoading||o==="catalog"&&(z||U.isLoading)||o==="session"&&(_?H.isLoading:y),isError:ke.isError,folderUnavailable:Tc(r,C),refetch:pe,readDocument:te,control:Re,storeKeys:Ne,memories:Q,markNeedsKey:X}}function Md(e){if(e.route==="catalog")return e.queryClient.getQueryData(e.catalogKey);if(e.route==="session"&&e.sessionId){const s=e.queryClient.getQueryData(Vt.list(e.sessionId));return s?Zt(s,e.sessionId):void 0}}const Cd=(e,s)=>{const a=e?.trim();if(!a)return null;const i=ha(a,s);return i.kind==="auth"?{kind:"matched",name:i.name,unresolved:null}:{kind:"miss",asked:a}},Ad=6,Dt="ui.settings.integrations.mcp_management_section.copy_section_title",Ed="ui.settings.integrations.mcp_management_section.copy_section_description",Id={test:"test",connect:"reconnect",disconnect:"disconnect",reload:"reload",remove:"remove",sign_out:"disconnect",cancel:"cancel",login:"grant",reauth:"grant"},Rd=({sessionId:e,sectionRef:s,highlightServer:a})=>{se();const i=Sd({sessionId:e}),{document:o,control:r,readDocument:d}=i,g=ls(),c=o?.servers??[],u=o?.operations??[],y=o?.project_scope_available??!1,[p,f]=l.useState(!1),[_,x]=l.useState(""),[v,N]=l.useState(null),[z,C]=l.useState({}),[E,b]=l.useState(null),[k,w]=l.useState(null),[G,Y]=l.useState({kind:"ready"}),[W,S]=l.useState(null),[I,$]=l.useState(null),[U,V]=l.useState(!1),H=l.useRef({}),q=l.useRef({}),te=l.useRef({}),m=l.useRef(0),T=l.useRef(null),A=l.useRef(null),Q=l.useRef(null),[Z,X]=l.useState(null),[B,J]=l.useState(null),[Re,Ne]=l.useState(null),ke=l.useCallback(()=>{const h=Q.current;Q.current=null,w(null),S(null),window.setTimeout(()=>{h?.isConnected&&h.focus()},0)},[]),pe=l.useCallback(h=>{const j=window.document.activeElement;Q.current=j instanceof HTMLElement?j:null,w(h)},[]),M=l.useCallback((h,j)=>{J({name:h,waitForSignIn:j==="signed-in",until:Date.now()+nt,reanchors:0}),ke()},[ke]),P=l.useMemo(()=>Cd(a,c.map(h=>h.name)),[a,c]),L=P?.kind==="matched"?P.name:null,ie=l.useRef(null),oe=l.useRef(null),Be=_.trim().toLowerCase(),fe=l.useMemo(()=>Be?c.filter(h=>h.name.toLowerCase().includes(Be)):c,[c,Be]),Se=Ic(fe,u,i.memories),Te=k?.kind==="sign_in"?c.find(h=>h.name===k.name)??null:null;l.useEffect(()=>{!L||oe.current===L||!_||x("")},[L,_]),l.useEffect(()=>{!L||oe.current===L||fe.some(h=>h.name===L)&&(oe.current=L,ie.current?.scrollIntoView({block:"center",behavior:"smooth"}))},[L,fe]),l.useEffect(()=>{if(!W)return;const h=u.find(j=>j.id===W)??null;Y({kind:"running",operation:h})},[u,W]);const Ve=u.some(h=>h.status==="running"),K=h=>{const j=window.document.activeElement;j&&j!==window.document.body&&j.isConnected||J({name:h,waitForSignIn:!1,until:Date.now()+nt,reanchors:0})},ne=async(h,j,F)=>{N(h),C(({[h]:$e,...Ce})=>Ce);let ee=null,be=!1;try{ee=await F()}catch($e){be=!0,C(Ce=>({...Ce,[h]:_t(Id[j]??"status",$e,Ve)}))}finally{N(null),j!=="sign_out"&&(j!=="remove"||be)&&K(h)}return{operationId:ee,failed:be}},ge=h=>c.find(j=>j.name===h),de=h=>{h.source.path&&fa(h.source.path)},O=async(h,j)=>{Y({kind:"starting"}),S(null);try{const F=await r({action:j,name:h});F?S(F):Y({kind:"running",operation:null})}catch(F){F instanceof an&&F.code==="oauth_unsupported"&&i.markNeedsKey(h),Y({kind:"refused",message:_t("grant",F,Ve)})}},re=(h,j)=>{switch(j.kind){case"sign_in":case"reauth":{const F=u.find(ee=>ee.name===h.name&&ee.status==="running");F&&ct(F)?(Y({kind:"running",operation:F}),S(F.id)):(Y({kind:"ready"}),S(null)),pe({kind:"sign_in",name:h.name,action:j.kind==="reauth"?"reauth":"login"});return}case"set_key":$(null),pe({kind:"key",name:h.name,keyNames:h.auth.secret_refs.map(F=>F.id)});return;case"fix":de(h);return;case"sign_out":b({name:h.name,kind:"sign_out"});return;default:{const F=j.kind;ne(h.name,F,()=>r({action:F,name:h.name}))}}},le=(h,j)=>{switch(j.kind){case"remove":case"sign_out":b({name:h.name,kind:j.kind});return;case"sign_in":case"reauth":case"set_key":re(h,{kind:j.kind,label:j.label});return;case"open_config":de(h);return;case"copy_setup":navigator.clipboard.writeText(h.setup_prompt??"").then(()=>Bt(n("ui.settings.integrations.mcp_management_section.setup_steps_copied_paste_them_into_a_chat"))).catch(()=>{});return;case"cancel":{const F=u.find(ee=>ee.name===h.name&&ee.status==="running");F&&ne(h.name,"cancel",()=>r({action:"cancel",operationId:F.id}));return}case"test":case"connect":case"disconnect":case"reload":{const F=j.kind;ne(h.name,F,()=>r({action:F,name:h.name}));return}default:return}},ve=(h,j)=>{if(b(null),j==="remove"){const F=h.source.owned_scope;if(!F)return;const ee=fe.findIndex(be=>be.name===h.name);ne(h.name,"remove",()=>r({action:"remove",name:h.name,scope:F})).then(({operationId:be,failed:$e})=>{$e||be!==null||(Bt(n("ui.settings.integrations.mcp_management_section.removed_name",{name:String(h.name)})),ee>=0&&Ne({index:ee}))});return}ne(h.name,"sign_out",()=>r({action:"logout",name:h.name})).then(()=>{J({name:h.name,waitForSignIn:!1,until:Date.now()+nt,reanchors:0})})},Le=async h=>{try{return await r({action:"add",name:h.name,scope:h.scope,...h.mode==="command"?{command:h.command,args:h.args}:{url:h.url}}),f(!1),X(h.name),null}catch(j){return _t("add",j,!1)}},he=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:n(Dt)}),t.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:n(Ed)})]}),i.enabled&&c.length>0&&!p?t.jsxs(D,{ref:T,variant:"secondary",size:"sm",onClick:()=>f(!0),"data-tour-tag":"mcp-add-server",children:[t.jsx(kn,{"aria-hidden":"true"}),n("ui.settings.integrations.mcp_management_section.add_integration")]}):null]});if(!i.enabled&&!i.isLoading)return t.jsx(ce,{title:n(Dt),titleComponent:he,sectionRef:s,children:t.jsx(ae,{variant:"warning",children:n("ui.settings.integrations.mcp_management_section.integrations_need_a_newer_local_operator_backend_update_it_and_re")})});const ze=t.jsx(Wc,{existingNames:c.map(h=>h.name),projectScopeAvailable:y,projectLabel:o?.cwd?Ld(o.cwd):null,onSubmit:Le,onCancel:()=>{f(!1),window.setTimeout(()=>T.current?.focus(),0)}}),je=k?ge(k.name):void 0,He=Object.entries(z).filter(([h])=>!c.some(j=>j.name===h)),Me=h=>C(({[h]:j,...F})=>F);l.useEffect(()=>{if(!Z)return;const h=H.current[Z];if(!h){c.some(j=>j.name===Z)&&(q.current[Z]?.focus(),X(null));return}h.focus(),X(null)},[Z,c]),l.useEffect(()=>{if(!Re)return;const j=fe[Math.min(Re.index,fe.length-1)]??fe.at(-1);if(j){const F=H.current[j.name]??q.current[j.name];if(!F)return;F.focus()}else T.current?.focus();Ne(null)},[Re,fe]);const we=l.useCallback((h,j)=>{const F=d()??o,ee=F?.servers.find(Ks=>Ks.name===h.name),be=F?.operations??[],$e=ee?ee.status==="connecting"||Xe(ee.name,be)!==null:!1;$e&&ee&&(m.current=j);const Ce=ee?_n(ee,be,i.memories):null;if(ee&&h.waitForSignIn&&(Ce?.kind==="sign_in"||Ce?.kind==="reauth"))return"kept";const Oe=Xc({hold:h,now:j,windowMs:nt,rowMoving:$e,lastMovingAt:m.current,candidate:ee?td({primary:Ce?H.current[ee.name]:null,overflow:q.current[ee.name]}):void 0,active:window.document.activeElement,body:window.document.body});if(!Oe.hold)return J(null),"finished";if(!Oe.land)return"kept";J({name:h.name,waitForSignIn:!1,until:Oe.hold.until,landedOn:Oe.land,reanchors:Oe.hold.reanchors});const fn=Oe.land;return window.setTimeout(()=>{fn.isConnected&&fn.focus()},0),"landed"},[d,o,i.memories]);return l.useEffect(()=>{if(!B)return;we(B,Date.now());let h=0,j=!1;const F=()=>{if(j)return;const ee=nd({verdict:we(B,Date.now()),watchMs:Kn});ee!==null&&(h=window.setTimeout(F,ee))};return h=window.setTimeout(F,Kn),()=>{j=!0,window.clearTimeout(h)}},[B,we]),l.useEffect(()=>{if(!B)return;const h=j=>{ed({target:j.target,row:te.current[B.name]})&&J(null)};return window.document.addEventListener("pointerdown",h,!0),()=>{window.document.removeEventListener("pointerdown",h,!0)}},[B]),t.jsxs(ce,{title:n(Dt),titleComponent:he,sectionRef:s,children:[t.jsxs("div",{className:"flex flex-col gap-4",children:[i.route==="session"&&i.borrowed?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.integrations.mcp_management_section.borrowed_chat_notice",{chat:i.borrowed.title?.trim()||i.borrowed.session_id.slice(0,6)})}):null,i.noConversation?t.jsxs("div",{className:"flex flex-col items-start gap-2",children:[t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.integrations.mcp_management_section.integrations_can_be_managed_here_once_a_chat_has_started")}),t.jsx(D,{variant:"primary",size:"sm",onClick:()=>g("/chat"),children:n("ui.settings.integrations.mcp_management_section.start_a_chat")}),t.jsx("p",{className:"text-ink-dim text-meta",children:n("ui.settings.integrations.mcp_management_section.updating_local_operator_removes_this_step")})]}):null,i.isLoading?t.jsx("div",{className:"flex h-24 items-center justify-center",children:t.jsx(ye,{size:"lg",label:n("ui.settings.integrations.mcp_management_section.loading_integrations")})}):null,i.folderUnavailable?t.jsx(ae,{variant:"warning",children:t.jsx("span",{children:n("ui.settings.integrations.mcp_management_section.this_chat_s_folder_no_longer_exists_so_only_global_integrations_a")})}):null,i.isError?t.jsx(ae,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:n("ui.settings.integrations.mcp_management_section.integrations_couldn_t_be_loaded")}),t.jsx(D,{variant:"secondary",size:"sm",onClick:i.refetch,children:n("ui.settings.integrations.mcp_management_section.retry")})]})}):null,He.map(([h,j])=>t.jsx(ae,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:j}),t.jsx(D,{variant:"ghost",size:"sm",onClick:()=>Me(h),children:n("ui.settings.integrations.mcp_management_section.dismiss")})]})},h)),p&&c.length>0?ze:null,c.length>=Ad?t.jsxs("div",{className:"relative",children:[t.jsx(es,{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 start-3 size-4 -translate-y-1/2 text-ink-dim"}),t.jsx(De,{ref:A,value:_,onChange:h=>x(h.target.value),onKeyDown:h=>{h.key!=="Escape"||!_||(h.preventDefault(),x(""))},placeholder:n("ui.settings.integrations.mcp_management_section.search_integrations_placeholder",{integrations:gc(c.length)}),"aria-label":n("ui.settings.integrations.mcp_management_section.search_integrations"),className:"ps-9"})]}):null,P?.kind==="miss"&&c.length>0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.integrations.mcp_management_section.no_match_for_name",{asked:String(P.asked)})}):null,P?.kind==="matched"&&P.unresolved?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.integrations.mcp_management_section.showing_fallback_for_unknown",{shown:String(P.name),asked:String(P.unresolved)})}):null,o&&c.length===0&&!i.isLoading?p?ze:t.jsxs("div",{className:"flex flex-col items-start gap-3 rounded-lg bg-surface p-6",children:[t.jsx(ss,{"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:n("ui.settings.integrations.mcp_management_section.no_integrations_yet")}),t.jsx("p",{className:"max-w-xl text-body-sm text-ink-muted",children:n("ui.settings.integrations.mcp_management_section.integrations_let_agents_read_and_act_in_your_other_tools_like_not")})]}),t.jsxs(D,{variant:"primary",size:"md",onClick:()=>f(!0),"data-tour-tag":"mcp-add-server",children:[t.jsx(kn,{"aria-hidden":"true"}),n("ui.settings.integrations.mcp_management_section.add_integration")]})]}):null,c.length>0&&fe.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:n("ui.settings.integrations.mcp_management_section.no_integrations_match_this_search")}),t.jsx(D,{variant:"secondary",size:"sm",onClick:()=>{x(""),window.setTimeout(()=>{(A.current??T.current)?.focus()},0)},children:n("ui.settings.integrations.mcp_management_section.clear_search")})]}):null,Se.map(h=>t.jsxs("section",{"aria-labelledby":`integrations-group-${h.id}`,className:"flex flex-col gap-1.5",children:[t.jsxs("h3",{id:`integrations-group-${h.id}`,className:"px-1 text-ink-dim text-meta",children:[h.title," · ",h.rows.length]}),t.jsx("ul",{className:"flex flex-col divide-y divide-hairline overflow-hidden rounded-lg bg-surface",children:h.rows.map(j=>t.jsx(ld,{row:j,operations:u,memories:i.memories,projectScopeAvailable:y,highlighted:j.name===L,rowRef:F=>{te.current[j.name]=F,j.name===L&&(ie.current=F)},primaryRef:F=>{H.current[j.name]=F},overflowRef:F=>{q.current[j.name]=F},pending:v===j.name,failure:z[j.name]??null,confirm:E?.name===j.name?{kind:E.kind}:null,onPrimary:F=>re(j,F),onOverflow:F=>le(j,F),onConfirm:()=>E&&ve(j,E.kind),onCancelConfirm:()=>{b(null),window.setTimeout(()=>{q.current[j.name]?.focus()},0)}},j.id))})]},h.id))]}),k?.kind==="sign_in"?t.jsx(md,{name:k.name,action:k.action,keyRoute:Te?Mt(Te):!1,phase:G,onStart:()=>void O(k.name,k.action),onCancel:h=>void r({action:"cancel",operationId:h}).catch(()=>{}),onOpenLink:h=>void pa(h),onClose:h=>M(k.name,h)}):null,k?.kind==="key"?t.jsx(id,{name:k.name,keyNames:k.keyNames.length?k.keyNames:je?.auth.secret_refs.map(h=>h.id)??[],keyless:k.keyNames.length===0,savedKeys:je?.auth.secret_refs.filter(h=>h.state==="encrypted").map(h=>h.id),saving:U,failure:I,onClose:ke,onSave:(h,j,F)=>{V(!0),$(null),i.storeKeys(k.name,h,j,F).then(ee=>{if(!ee.saved){$(ee.message);return}w(null),J({name:k.name,waitForSignIn:!1,until:Date.now()+nt,reanchors:0})}).catch(ee=>$(_t("key",ee,!1))).finally(()=>V(!1))}}):null]})},nt=4e3,Td=/^\/(?:Users|home)\/[^/]+(?=\/|$)/,Ld=e=>e.replace(Td,"~"),Od=({verification:e})=>{se();const{prices:s}=ya(),a=e.grant_amount??s?.default_new_credits,{sentence:i,action:o}=va(e.signup_grant,ba(a)),r=ka(e.claim_url,ja);return t.jsxs("div",{className:"mt-8 flex items-start gap-3 rounded-sm border border-hairline bg-surface p-3",children:[t.jsx(St,{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:i}),t.jsx(D,{variant:"secondary",size:"sm",onClick:()=>wa(r),children:o})]})]})},Fd=({onAfterCredentialUpdate:e})=>{se();const{isAuthenticated:s,user:a,isLoading:i,accountRead:o,signOut:r}=xa(),d=as(p=>p.isSigningOut),g=l.useCallback(async()=>{try{await r()}catch(p){console.error("Error signing out:",p)}},[r]),c=(()=>{if(!s||!a?.radientUser)return null;const{account:p,identity:f,verification:_}=a.radientUser,x=_!=null&&!_.email_verified&&_.signup_grant!=="claimed";return t.jsxs(t.Fragment,{children:[t.jsxs(rt,{children:[t.jsx(me,{label:n("ui.settings.account.radient_account_section.status"),value:t.jsxs("span",{className:"inline-flex items-center gap-2",children:[n("ui.settings.account.radient_account_section.connected"),t.jsx(it,{variant:"success",className:"capitalize",children:p.status})]})}),t.jsx(me,{label:n("ui.settings.account.radient_account_section.name"),value:p.name||n("ui.settings.account.radient_account_section.not_provided")}),t.jsx(me,{label:n("ui.settings.account.radient_account_section.email"),value:p.email}),t.jsx(me,{label:n("ui.settings.account.radient_account_section.account_id"),value:t.jsx("span",{className:"text-mono-sm",children:p.id})}),t.jsx(me,{label:n("ui.settings.account.radient_account_section.tenant_id"),value:t.jsx("span",{className:"text-mono-sm",children:p.tenant_id})}),t.jsx(me,{label:n("ui.settings.account.radient_account_section.provider"),value:t.jsx("span",{className:"capitalize",children:f.provider})}),t.jsx(me,{label:n("ui.settings.account.radient_account_section.created"),value:is(p.created_at)})]}),x&&_?t.jsx(Od,{verification:_}):null,t.jsx("div",{className:"mt-8",children:t.jsx(mi,{offerSignIn:!0})}),t.jsxs("div",{className:"mt-8",children:[t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.account.radient_account_section.need_to_sign_out_or_switch_accounts")}),t.jsxs(D,{variant:"danger",className:"mt-3",onClick:g,children:[t.jsx(_i,{}),n("ui.settings.account.radient_account_section.sign_out_from_radient")]})]})]})})(),u=o==="refused"?n("ui.settings.account.radient_account_section.radient_refused_the_sign_in_this_app_is_holding_so_your_account_d"):os(o)?n("ui.settings.account.radient_account_section.your_radient_account_could_not_be_read_so_this_app_cannot_show_yo"):n("ui.settings.account.radient_account_section.you_are_not_currently_signed_in_to_radient"),y=s&&a?null:t.jsxs("div",{children:[t.jsxs("p",{className:"text-body-sm text-ink-muted",children:[u," ",n("ui.settings.account.radient_account_section.sign_in_to_access_your_account_details_or_sign_up_to_get_free_cre")]}),t.jsx("div",{className:"mt-6",children:t.jsx(Ki,{titleText:"",onAfterCredentialUpdate:e,descriptionText:"",onSignInSuccess:()=>{}})})]});return i||d?t.jsxs("div",{className:"flex min-h-36 flex-col items-center justify-center gap-3",children:[t.jsx(ye,{size:"lg",label:n("ui.settings.account.radient_account_section.loading_account")}),!d&&t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.account.radient_account_section.loading_your_radient_account_details")})]}):s&&a?.radientUser?c:t.jsx("div",{className:"flex flex-col gap-4",children:y})};function Dd({metric:e,data:s}){return se(),t.jsx(Na,{title:"",heightClassName:"h-62",yAxisWidth:48,unit:e==="credits"?"credits":"tokens",srSummary:e==="credits"?n("ui.settings.account.settings_usage_chart.credits_summary",{days:s.length}):n("ui.settings.account.settings_usage_chart.tokens_summary",{days:s.length}),xTickFormatter:a=>a,yTickFormatter:a=>e==="credits"?`$${a.toFixed(2)}`:Sa(a),children:t.jsx(al,{data:s,children:t.jsx(Jn,{type:"monotone",dataKey:"value",strokeWidth:2,dot:!1,activeDot:{r:4,strokeWidth:0},name:e==="credits"?n("ui.settings.account.settings_usage_chart.credits_consumed"):n("ui.settings.account.settings_usage_chart.tokens_used")})})})}const zd={all:["desktop","tts-path-resolution"]};function $d(e){return Ie({queryKey:zd.all,queryFn:()=>_e({op:"tts.paths"}),enabled:e,staleTime:Number.POSITIVE_INFINITY,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:ti})}const Pd=["speech.voice.gender","speech.voice.tone","speech.voice.expressiveness","speech.voice.pace","speech.voice.language","speech.voice.accent","speech.voice.instructions"];function Gn(e){const s=new Map(e.map(o=>[o.key,o])),a=[],i=[];for(const o of Pd){const r=s.get(o);r?a.push(r):i.push(o)}return{rows:a,missing:i}}const Kd=["provider_tts_radient","provider_tts_elevenlabs","provider_tts_openai","none"];function Yn(e){return typeof e=="string"&&Kd.includes(e)}function Ud(e){if(e===null||typeof e!="object")return null;const s=e;if(!Yn(s.path)||typeof s.reason!="string"||typeof s.servable!="boolean"||!Array.isArray(s.rungs))return null;const a=[];for(const i of s.rungs){if(i===null||typeof i!="object")return null;const o=i;if(!Yn(o.path)||typeof o.available!="boolean"||typeof o.reason!="string")return null;a.push({path:o.path,available:o.available,reason:o.reason})}return{path:s.path,reason:s.reason,servable:s.servable,rungs:a}}const Bd={get provider_tts_radient(){return n("ui.settings.speech.speech_settings_model.radient_pass")},provider_tts_elevenlabs:"ElevenLabs",provider_tts_openai:"OpenAI",get none(){return n("ui.settings.speech.speech_settings_model.no_provider")}};function $s(e){return Bd[e]}function Vd(e){return{servable:e.servable,serving:e.path==="none"?null:e.path,reason:e.reason,rungs:e.rungs.map(s=>({path:s.path,name:$s(s.path),available:s.available,reason:s.reason}))}}const Hd="ui.settings.speech.speech_section.copy_backend_older_sentence",Ps="ui.settings.speech.speech_section.copy_unavailable_sentence",qd=({resetErrorBoundary:e})=>(se(),t.jsx(ae,{variant:"warning",children:t.jsxs("div",{className:"flex flex-col items-start gap-3",children:[t.jsx("span",{children:n(Ps)}),t.jsxs(D,{variant:"secondary",onClick:e,children:[t.jsx(zi,{"aria-hidden":"true"}),n("ui.settings.speech.speech_section.try_again")]})]})}));function Gd(e){return e==="enabled"?"ready":e==="below-version"?"older":"pairing"}const Yd=({sectionRef:e})=>{se();const s=sn(),a=rs(),i=ni(s.data,"tts"),o=Gd(i),r=Ie({queryKey:Pt.all,queryFn:()=>_e({op:"settings.list"}),enabled:o==="ready",staleTime:1e4}),d=$d(o==="ready"),{hasRadientApiKey:g,hasRadientSession:c,speechBlock:u}=Ma(),y=`${c}:${g}`,p=l.useRef(y),f=d.refetch;l.useEffect(()=>{p.current!==y&&(p.current=y,f())},[y,f]);const _=r.data,x=l.useMemo(()=>Gn(_?.settings??[]),[_]),[v,N]=l.useState({}),[z,C]=l.useState({}),[E,b]=l.useState({});l.useEffect(()=>{_&&N(m=>{let T=!1;const A={...m};for(const Q of Gn(_.settings).rows){const Z=m[Q.key];if(Z&&Z.value!==et(Q).value)continue;const X=et(Q);Z&&Z.value===X.value&&Z.cascadeBase===X.cascadeBase||(A[Q.key]=X,T=!0)}return T?A:m})},[_]);const k=(m,T)=>C(A=>({...A,[m]:T})),w=(m,T)=>b(A=>({...A,[m]:T})),G=async m=>{const T=v[m.key];if(!T)return;const A=Ea(m,T);if(!A.ok){w(m.key,A.error);return}k(m.key,!0),w(m.key,null);try{await _e(A.request),k(m.key,!1);const Z=(await r.refetch()).data?.settings.find(X=>X.key===m.key);Z&&N(X=>{const B=X[m.key];return B&&B.value===T.value&&B.cascadeBase===T.cascadeBase?{...X,[m.key]:et(Z)}:X})}catch(Q){k(m.key,!1),w(m.key,Q instanceof Error?Q.message:n("ui.settings.speech.speech_section.the_setting_could_not_be_saved"))}},Y=async m=>{k(m.key,!0),w(m.key,null);try{await _e({op:"settings.reset",key:m.key}),N(T=>({...T,[m.key]:et({...m,value:m.default,is_default:!0})})),k(m.key,!1),await r.refetch()}catch(T){k(m.key,!1),w(m.key,T instanceof Error?T.message:n("ui.settings.speech.speech_section.the_setting_could_not_be_reset"))}},W=l.useMemo(()=>Ud(d.data),[d.data]),S=W?Vd(W):null,I=d.isSuccess&&W===null,$=(s.data?null:s.error)??null,U=r.error,V=n("ui.settings.speech.speech_section.speech_voicing"),H=n("ui.settings.speech.speech_section.how_the_assistant_sounds_when_it_speaks_aloud");if(o==="pairing"){const{sentence:m}=Ht(a??null,n("ui.settings.speech.speech_section.speech_settings_could_not_be_loaded"),$);return t.jsx(ce,{title:V,icon:dt,description:H,sectionRef:e,children:t.jsx(ae,{variant:"warning",children:m})})}if(o==="older")return t.jsx(ce,{title:V,icon:dt,description:H,sectionRef:e,children:t.jsx(ae,{variant:"warning",children:n(Hd)})});if(U||!_){const{sentence:m,remedy:T}=Ht(a??null,n("ui.settings.speech.speech_section.speech_settings_could_not_be_loaded"),U);return t.jsx(ce,{title:V,icon:dt,description:H,sectionRef:e,children:t.jsx(ae,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:m}),T&&t.jsx(D,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{r.refetch()},children:n("ui.settings.speech.speech_section.retry")})]})})})}const q=S?!S.servable:u==="offline",te=S?S.rungs.find(m=>m.path===S.serving)??null:null;return t.jsx(ce,{title:V,icon:dt,description:H,sectionRef:e,children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsxs("section",{className:"flex flex-col gap-3",children:[d.isPending&&t.jsxs("p",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[t.jsx(ye,{}),vn("checking")]}),(d.isError||I)&&!S&&u!=="offline"&&t.jsx(ae,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("span",{children:[n(Ps)," ",d.error instanceof Error?d.error.message:""]}),t.jsx(D,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{d.refetch()},children:n("ui.settings.speech.speech_section.retry")})]})}),t.jsx(Di,{fallbackRender:qd,resetKeys:[d.dataUpdatedAt],children:S&&t.jsxs(t.Fragment,{children:[t.jsxs(rt,{children:[t.jsx(me,{label:n("ui.settings.speech.speech_section.speaks_through"),value:S.serving?$s(S.serving):n("ui.settings.speech.speech_section.nothing_yet")}),t.jsx(me,{label:n("ui.settings.speech.speech_section.availability"),value:S.servable?n("ui.settings.speech.speech_section.ready"):n("ui.settings.speech.speech_section.no_provider")})]}),S.reason&&S.reason!==te?.reason&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:S.reason}),t.jsx("ul",{className:"flex flex-col gap-1",children:S.rungs.map(m=>t.jsxs("li",{className:"flex flex-col gap-0.5 text-body-sm",children:[t.jsxs("span",{className:m.path===S.serving?"text-ink":"text-ink-muted",children:[m.name,t.jsxs("span",{className:m.path===S.serving?"text-ink-muted":"text-ink-dim",children:[" ",m.available?n("ui.settings.speech.speech_section.available"):n("ui.settings.speech.speech_section.not_available")]})]}),t.jsx("span",{className:"text-meta text-ink-dim",children:m.reason})]},m.path))})]})})]}),q&&t.jsx(ae,{variant:"warning",children:vn(u)}),t.jsx("div",{className:"flex flex-col gap-1",children:x.rows.map(m=>t.jsx(Ca,{setting:m,draft:v[m.key]??et(m),tier:Aa(m),saving:!!z[m.key],error:E[m.key]??null,onDraftChange:T=>N(A=>({...A,[m.key]:T})),onSave:()=>{G(m)},onReset:()=>{Y(m)}},m.key))}),x.missing.length>0&&t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.speech.speech_section.missing_voice_rows",{count:x.missing.length,rows:x.missing.join(", ")})})]})})},Wd=()=>{se();const{data:e,isLoading:s,error:a,refetch:i}=tl(),o=nl(),[r,d]=l.useState(""),[g,c]=l.useState(!1);l.useEffect(()=>{d(e?.content??""),c(!1)},[e]);const u=x=>{const v=x.target.value;d(v),c(v!==(e?.content??""))},y=async()=>{if(!(!g||o.isPending))try{const x={content:r};await o.mutateAsync(x),await i(),c(!1)}catch(x){console.error("Error updating system prompt:",x)}},p=()=>{d(e?.content??""),c(!1)},f=o.isPending,_=()=>t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Ee,{htmlFor:"app-system-prompt",children:n("ui.settings.model.system_prompt.instructions")}),t.jsx(ps,{id:"app-system-prompt",name:"systemPrompt",value:r,onChange:u,placeholder:n("ui.settings.model.system_prompt.enter_instructions_for_how_all_agents_should_behave_and_respond_t"),className:"min-h-50"})]}),t.jsxs("div",{className:"flex gap-3",children:[t.jsxs(D,{variant:"primary",onClick:y,disabled:!g||f,children:[f?t.jsx(ye,{size:"sm"}):t.jsx(gs,{}),f?n("ui.settings.model.system_prompt.saving"):n("ui.settings.model.system_prompt.save_changes")]}),t.jsx(D,{onClick:p,disabled:!g||f,children:n("ui.settings.model.system_prompt.cancel")})]}),e?.last_modified&&t.jsxs("p",{className:"text-ink-dim text-meta",children:[n("ui.settings.model.system_prompt.last_modified")," ",t.jsx("span",{className:"font-mono text-mono-sm",children:tn(e.last_modified)})]})]});return t.jsx(ce,{title:n("ui.settings.model.system_prompt.system_prompt"),icon:Ui,description:n("ui.settings.model.system_prompt.every_local_operator_agent_receives_this_prompt_in_addition_to_it"),children:s?t.jsx("div",{className:"flex min-h-50 items-center justify-center",children:t.jsx(ye,{size:"lg",label:n("ui.settings.model.system_prompt.loading_system_prompt")})}):a?t.jsx(ae,{variant:"danger",children:n("ui.settings.model.system_prompt.load_failed",{reason:a instanceof Error?a.message:n("ui.settings.model.system_prompt.unknown_error")})}):_()})},Qd=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"],Zd=e=>Qd.includes(e),Jd=e=>{const s=[];let a=0;for(const i of e){const o=Math.max(0,Math.floor(i.count)),r=Math.max(1,Math.floor(i.columns));for(let d=0;d<o;d+=r)s.push({start:a+d,count:Math.min(r,o-d)});a+=o}return s},Xd=({index:e,key:s,groups:a})=>{const i=Jd(a),o=i.reduce((r,d)=>r+d.count,0);if(!Number.isInteger(e)||e<0||e>=o)return e;switch(s){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=i.findIndex(c=>e>=c.start&&e<c.start+c.count),d=i[r+(s==="ArrowDown"?1:-1)];if(!d)return e;const g=e-i[r].start;return d.start+Math.min(g,d.count-1)}default:return e}},eu={localOperatorDark:ur,localOperatorLight:Ir,dracula:jr,dune:$o,sage:sr,monokai:hi,tokyoNight:pr,iceberg:Nr,radient:Zo,neon:Ra,obsidian:hs,synth:Xi,catppuccinMocha:wo,catppuccinLatte:rr,tokyoNightStorm:ho,gruvbox:ro,nord:Xr,oneDark:Zi,solarizedDark:Ar,rosePine:Bo,rosePineMoon:cr,rosePineDawn:ko,alucard:Ho,gruvboxLight:Io,tokyoNightDay:mr,oneLight:ir,catppuccinFrappe:Ao,catppuccinMacchiato:Xo,palenight:Ia,everforest:Hr,everforestLight:Br,kanagawaWave:Wr,kanagawaLotus:Ko,ayuDark:To,ayuMirage:Oo,ayuLight:yr,nightfox:xo,duskfox:Or,synthwave:fr,matrix:to,tron:_o,cyberpunk:pi,vaporwave:Kr,outrun:io,neonNoir:Gr,arcade:tr,forest:$r,ocean:Do,desert:Dr,autumn:Zr,lavender:Mr,arctic:vo,rosewood:Wo,solarizedLight:Tr,githubLight:Go,paper:Bi,linen:br,highContrastLight:Wi,mintLight:so},Wn="bg-[color-mix(in_srgb,var(--color-accent)_8%,var(--color-accent-wash))]",tu=({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"})]})]})]}),nu=({id:e,name:s,description:a,isSelected:i,isTabStop:o,onSelect:r,onFocusTile:d})=>{const g=eu[e];return t.jsx(Je,{side:"bottom",align:"start",content:a,children:t.jsxs("button",{type:"button","data-theme-tile":e,"aria-pressed":i,tabIndex:o?0:-1,onFocus:d,onClick:r,className:ue("relative flex flex-col gap-1.5 rounded-md p-1 text-start transition-colors duration-fast ease-out-quart",i?Wn:"hover:bg-surface"),children:[t.jsxs("span",{className:ue("relative block h-10 overflow-hidden rounded-sm border transition-colors duration-fast ease-out-quart",i?"border-accent":"border-hairline"),children:[t.jsx(tu,{id:e}),i&&t.jsx("span",{className:ue("pointer-events-none absolute top-0.5 end-0.5 flex h-4 w-4 items-center justify-center rounded-full",Wn),children:t.jsx(_s,{size:12,className:"text-accent","aria-hidden":"true"})})]}),t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx(g,{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:s})]})]})})},su=e=>[...e.querySelectorAll("[data-theme-grid]")].map(s=>{const a=[...s.querySelectorAll("[data-theme-tile]")],i=a[0]?.getBoundingClientRect().top??0;return{count:a.length,columns:Math.max(1,a.filter(o=>Math.abs(o.getBoundingClientRect().top-i)<1).length)}}),au=()=>{se();const{themeName:e,setTheme:s}=Ue(),a=Object.values(Us),i=[{label:n("ui.settings.appearance.theme_selector.dark"),items:a.filter(c=>c.theme.palette.mode==="dark")},{label:n("ui.settings.appearance.theme_selector.light"),items:a.filter(c=>c.theme.palette.mode==="light")}].filter(c=>c.items.length>0),[o,r]=l.useState(null),d=l.useMemo(()=>{const c=i.flatMap(u=>u.items.map(y=>y.id));return o&&c.includes(o)?o:c.includes(e)?e:c[0]},[i,o,e]),g=c=>{if(!Zd(c.key))return;const u=[...c.currentTarget.querySelectorAll("[data-theme-tile]")],y=u.indexOf(c.target);if(y<0)return;c.preventDefault();const p=Xd({index:y,key:c.key,groups:su(c.currentTarget)});p!==y&&u[p]?.focus()};return t.jsx($i,{children:t.jsx("div",{onKeyDown:g,className:"flex flex-col gap-6",children:i.map(c=>t.jsxs("div",{children:[t.jsx("h3",{className:"px-1 pb-2 text-meta text-ink-dim",children:c.label}),t.jsx("div",{"data-theme-grid":c.label,className:"grid grid-cols-[repeat(auto-fill,minmax(160px,1fr))] gap-2",children:c.items.map(({id:u,name:y,description:p})=>t.jsx(nu,{id:u,name:y,description:p,isSelected:u===e,isTabStop:u===d,onSelect:()=>s(u),onFocusTile:()=>r(u)},u))})]},c.label))})})},iu=({value:e,onChange:s})=>{se();const a=l.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:a,className:"flex min-h-6 items-center text-body text-ink",children:n("ui.settings.appearance.transcript_display_mode_setting.transcript_display")}),t.jsx("p",{className:"mt-0.5 max-w-2xl text-body-sm text-ink-muted",children:n("ui.settings.appearance.transcript_display_mode_setting.by_turn_condenses_each_turn_to_its_answer_by_response_keeps_every")})]}),t.jsx("div",{className:"flex h-6 shrink-0 items-center",children:t.jsx(jt,{value:e,onValueChange:i=>s(cs(i)),children:t.jsx(wt,{"aria-labelledby":a,children:si.map(i=>t.jsx(Qe,{value:i.value,children:i.value==="by-turn"?n("ui.settings.appearance.transcript_display_mode_setting.by_turn"):n("ui.settings.appearance.transcript_display_mode_setting.by_response")},i.value))})})})]})},ou=()=>{se();const{data:e,isLoading:s,error:a}=ol({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(Mo,{size:16,className:"shrink-0 text-ink-dim"}),n("ui.settings.account.settings_page.radient_pass")]}),s&&t.jsx(xe,{className:"h-6 w-36"}),a&&t.jsx(ae,{variant:"warning",children:n("ui.settings.account.settings_page.credit_balance_load_failed",{reason:a.message})}),e&&!s&&!a&&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:[n("ui.settings.account.settings_page.available_credits")," ",t.jsx("span",{className:"font-medium text-ink",children:e.balance.toFixed(2)})]}),t.jsx(D,{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(go,{}),n("ui.settings.account.settings_page.add_credits")]})})]})]})},ru=[{id:"credits",get label(){return n("ui.settings.account.settings_page.credits")}},{id:"tokens",get label(){return n("ui.settings.account.settings_page.tokens")}}],lu=()=>{se();const[e,s]=l.useState("credits"),a=l.useMemo(()=>{const g=new Date,c=sl(g);return{start_date:Mn(c),end_date:Mn(g),rollup:"daily"}},[]),{data:i,isLoading:o,error:r}=ll(a,{enabled:!0}),d=l.useMemo(()=>i?.data_points?[...i.data_points].sort((c,u)=>At(c.timestamp).getTime()-At(u.timestamp).getTime()).map(c=>({bucket:Pa(qi(At(c.timestamp),"yyyy-MM-dd")),value:e==="credits"?Number.parseFloat(c.total_cost.toFixed(2)):c.total_tokens})):[],[i,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(co,{size:16,className:"shrink-0 text-ink-dim"}),n("ui.settings.account.settings_page.usage_last_30_days")]}),t.jsxs("fieldset",{className:"m-0 w-fit border-0 p-0",children:[t.jsx("legend",{className:"sr-only",children:n("ui.settings.account.settings_page.usage_metric")}),t.jsx("div",{"data-glass-well":"",className:"flex gap-0.5 rounded-md bg-sunken p-0.5",children:ru.map(({id:g,label:c})=>t.jsx(D,{variant:"ghost",size:"sm","aria-pressed":e===g,onClick:()=>s(g),className:ue(e===g&&"bg-surface text-ink hover:bg-surface"),children:c},g))})]})]}),o&&t.jsx(xe,{className:"h-62 w-full"}),r&&t.jsx(ae,{variant:"warning",children:n("ui.settings.account.settings_page.usage_load_failed",{reason:r.message})}),!o&&!r&&i&&d.length>0&&t.jsx(Dd,{metric:e,data:d}),!o&&!r&&(!i||d.length===0)&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.account.settings_page.no_usage_recorded_in_the_last_30_days")})]})},cu=()=>(se(),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(Ci,{size:16,className:"shrink-0 text-ink-dim"}),n("ui.settings.account.settings_page.radient_account")]}),t.jsx(D,{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:[n("ui.settings.account.settings_page.go_to_radient_console"),t.jsx(Ka,{})]})})]})),wu=()=>{se();const e=Ta(),s=Ue(O=>O.showAgentReasoning),a=Ue(O=>O.setShowAgentReasoning),i=Ue(O=>O.transcriptDisplayMode),o=Ue(O=>O.setTranscriptDisplayMode),{data:r,isLoading:d,isFetching:g,error:c,refetch:u}=La(),{needsProvider:y}=Oa(),p=rs(),{sentence:f,remedy:_}=Ht(p??null,n("ui.settings.navigation.settings_page.your_settings_could_not_be_loaded"),c),x=fi(),[v,N]=l.useState(null),z=as(),{isAuthenticated:C,accountRead:E,isFetching:b,isRefreshing:k,refreshUser:w}=en(),G=st(O=>O.activeSessionId),Y=st(O=>O.sessions),W=Ll(),{accountId:S,snapshot:I,model:$}=us(),U=l.useRef(null);I.status?U.current={accountId:S,status:I.status}:I.checking||(U.current=null);const V=I.status??(U.current?.accountId===S?U.current.status:null),H=pl(W),q=l.useMemo(()=>xi.filter(O=>O.id!=="agent-messages"||W!=="absent"),[W]),te=l.useCallback(()=>$.check("surface_open",!0),[$]),[m,T]=l.useState("general"),[A,Q]=l.useState(!1),Z=l.useRef(null),X=l.useRef(null),{startTour:B}=yi(),J=ai(),Re=ls(),{data:Ne,refetch:ke}=Fa(),{refreshModels:pe}=Da(),M=l.useMemo(()=>Ne?.keys?[...Ne.keys].sort():[],[Ne?.keys]),P=l.useRef({keys:"",hosting:void 0});l.useEffect(()=>{const O=M.join(","),re=r?.values?.hosting;(P.current.keys!==O||P.current.hosting!==re)&&(P.current={keys:O,hosting:re},pe().catch(le=>{console.error("Failed to refresh models after credentials or hosting change:",le)}))},[M,r?.values?.hosting,pe]);const L=l.useRef({general:l.useRef(null),radient:l.useRef(null),integrations:l.useRef(null),appearance:l.useRef(null),speech:l.useRef(null),keyboard:l.useRef(null),providers:l.useRef(null),"agent-messages":l.useRef(null),backend:l.useRef(null),imports:l.useRef(null),updates:l.useRef(null)}).current,ie=l.useMemo(()=>new URLSearchParams(J.search).get("setting"),[J.search]),oe=l.useMemo(()=>new URLSearchParams(J.search).get("filter")??"",[J.search]),Be=l.useMemo(()=>new URLSearchParams(J.search).get("mcp")??void 0,[J.search]),fe=l.useMemo(()=>new URLSearchParams(J.search).get("provider"),[J.search]),Se=l.useCallback(O=>{T(O),Q(!0);const re=L[O],le=X.current;if(re?.current&&le){const Le=re.current.getBoundingClientRect().top-le.getBoundingClientRect().top;le.scrollHeight>le.clientHeight?le.scrollTo({top:Math.max(0,le.scrollTop+Le-80),behavior:"smooth"}):window.scrollTo({top:Math.max(0,re.current.getBoundingClientRect().top+window.scrollY-80),behavior:"smooth"}),clearTimeout(Z.current??void 0),Z.current=setTimeout(()=>{Q(!1),Z.current=null},800)}else Q(!1)},[L]);l.useEffect(()=>{const O=setTimeout(()=>{const re=X.current;if(!re)return;const le=()=>{if(A)return;const ve=re.getBoundingClientRect(),Le=ve.height;let he="",ze=0;for(const[je,He]of Object.entries(L))if(He.current){const Me=He.current.getBoundingClientRect(),we=ve.top,h=Me.top-we,j=Me.bottom-we,F=Me.height,ee=Math.max(0,h),be=Math.min(Le,j),Ce=Math.max(0,be-ee)/F,Oe=Ce+(h<Le*.3?.1:0);Oe>ze&&Ce>.1&&(ze=Oe,he=je)}he&&he!==m&&T(he)};return le(),re.addEventListener("scroll",le,{passive:!0}),()=>{re.removeEventListener("scroll",le),clearTimeout(Z.current??void 0)}},100);return()=>clearTimeout(O)},[L,m,A]),l.useEffect(()=>{const O=new URLSearchParams(J.search),re=O.get("section"),le=O.get("setting"),ve=le?bn(le,"backend"):re;if(ve==="agent-messages"&&!H)return;const Le=ve?L[ve]:void 0;if(!ve||!Le)return;let he=!1,ze=Number.NaN,je=0;const He=window.setTimeout(()=>{he||(he=!0,we.disconnect(),Se(ve))},2e3),Me=()=>{if(he)return;const h=Le.current;if(!h){je=requestAnimationFrame(Me);return}const j=Math.round(h.getBoundingClientRect().top+window.scrollY);if(j===ze&&j>0){he=!0,we.disconnect(),window.clearTimeout(He),Se(ve);return}ze=j,je=requestAnimationFrame(Me)},we=new ResizeObserver(()=>{he||(cancelAnimationFrame(je),je=requestAnimationFrame(Me))});return X.current&&we.observe(X.current),je=requestAnimationFrame(Me),()=>{he=!0,cancelAnimationFrame(je),we.disconnect(),window.clearTimeout(He)}},[J.search,L,Se,H]);const Te=async(O,re)=>{N(O);try{await x.mutateAsync({[O]:re}),await u()}catch(le){console.error(`Error updating ${O}:`,le)}finally{N(null)}},Ve=d,K=E==="checking",ne=os(E),ge=E==="ready"||E==="checking"||b,de=ds(Ve,4e3);return c?t.jsx("div",{className:"flex h-full w-full items-center justify-center bg-canvas p-6",children:t.jsx(ae,{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:f}),_&&t.jsx(D,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>void u(),disabled:g,children:g?n("ui.settings.navigation.settings_page.retrying"):n("ui.settings.navigation.settings_page.retry")})]})})}):Ve?t.jsxs("div",{role:"status",className:"flex h-full w-full flex-col items-center justify-center gap-3 bg-canvas",children:[t.jsx(ye,{size:"lg",label:de?void 0:n("ui.settings.navigation.settings_page.loading_settings")}),de&&t.jsx("p",{className:"max-w-sm text-center text-body-sm text-ink-muted",children:n("ui.settings.navigation.settings_page.the_local_operator_server_is_taking_longer_than_usual_to_answer_i")})]}):r?t.jsxs("div",{"data-glass-region":"canvas","data-glass-split":"",className:"panel-flush flex min-h-0 flex-1 overflow-hidden bg-canvas",children:[t.jsx("div",{className:"w-12 shrink-0 overflow-y-auto min-[1040px]:w-55",children:t.jsx(vi,{activeSection:m,onSelectSection:Se,sections:q})}),t.jsx("div",{ref:X,"data-settings-content":!0,"data-glass-region":"canvas-content","data-tour-tag":"settings-general-section",className:"panel-scroll 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(Ai,{title:n("ui.settings.page.title"),icon:jn}),t.jsxs("div",{className:"flex flex-col gap-8",children:[t.jsxs("div",{ref:L.general,className:"flex flex-col gap-8",children:[t.jsx(bi,{focus:ie===Pi}),t.jsxs(ce,{title:n("ui.settings.profile.title"),icon:ki,description:n(C?"ui.settings.profile.description_authenticated":"ui.settings.profile.description_anonymous"),children:[K&&t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.profile.account_checking")}),ne&&t.jsx(ae,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:n(E==="refused"?"ui.settings.profile.account_read_failed_refused":"ui.settings.profile.account_read_failed_retry")}),t.jsx(D,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>w(),disabled:k,children:k?n("ui.settings.profile.retrying"):n("ui.settings.profile.retry")})]})}),t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(wn,{value:z.profile.name,label:n("ui.settings.profile.display_name.label"),placeholder:n("ui.settings.profile.display_name.placeholder"),isSaving:v==="user_name",onSave:async O=>{N("user_name");try{z.updateName(O)}finally{N(null)}},readOnly:ge}),t.jsx(wn,{value:z.profile.email,label:n("ui.settings.profile.email.label"),placeholder:n("ui.settings.profile.email.placeholder"),isSaving:v==="user_email",onSave:async O=>{N("user_email");try{z.updateEmail(O)}finally{N(null)}},readOnly:ge})]})]}),t.jsx(ce,{title:n("ui.settings.tour.title"),description:n("ui.settings.tour.description"),children:t.jsxs(D,{variant:"secondary",onClick:()=>{B({forceModalCompleted:!0})},children:[t.jsx(za,{}),n("ui.settings.tour.action")]})}),t.jsx(ce,{id:"model-settings",title:n("ui.settings.model.settings_page.model_settings"),icon:ji,description:n("ui.settings.model.settings_page.configure_the_default_ai_model_and_hosting_providers_used_for_gen"),children:t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(wi,{value:r.values.hosting,isSaving:v==="hosting",onSave:O=>Te("hosting",O),filterByCredentials:!0,allowCustom:!0,allowDefault:!1,emptyHelperText:n("ui.settings.model.settings_page.no_hosting_options")}),t.jsx(Ni,{value:r.values.model_name,hostingId:r.values.hosting,isSaving:v==="model_name",onSave:O=>Te("model_name",O),allowCustom:!0,allowDefault:!1}),t.jsx(Ul,{hosting:r.values.hosting,modelName:r.values.model_name,focus:ie===pt}),y&&t.jsx(ae,{variant:"neutral",icon:t.jsx(St,{className:"size-4","aria-hidden":"true"}),children:t.jsxs("span",{children:[n("ui.settings.model.provider_callout.sentence"),t.jsx("button",{type:"button",className:"text-accent underline underline-offset-2",onClick:()=>{Se("providers"),L.providers.current?.focus({preventScroll:!0})},children:n("ui.settings.model.provider_callout.providers_link")}),"."]})})]})}),t.jsx(Wd,{}),t.jsx(ce,{title:n("ui.settings.configuration.settings_page.configuration_information"),icon:St,description:n("ui.settings.configuration.settings_page.system_information_about_the_current_configuration"),children:t.jsxs(rt,{children:[t.jsx(me,{label:n("ui.settings.configuration.settings_page.version"),value:t.jsx("span",{className:"text-mono-sm",children:r.version})}),t.jsx(me,{label:n("ui.settings.configuration.settings_page.created"),value:is(r.metadata.created_at)}),t.jsx(me,{label:n("ui.settings.configuration.settings_page.last_modified"),value:tn(r.metadata.last_modified)}),t.jsx(me,{label:n("ui.settings.configuration.settings_page.description"),value:r.metadata.description||n("ui.settings.configuration.settings_page.no_description_available")})]})})]}),t.jsx(ce,{title:n("ui.settings.appearance.settings_page.appearance"),icon:hs,description:n("ui.settings.appearance.settings_page.customize_the_look_and_feel_of_local_operator"),sectionRef:L.appearance,dataTourTag:"settings-appearance-section",children:t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(au,{}),t.jsx(fs,{value:s,label:n("ui.settings.appearance.settings_page.show_agent_reasoning"),description:n("ui.settings.appearance.settings_page.adds_the_agent_s_reasoning_and_thinking_rows_to_conversations_the"),onChange:async O=>a(O)}),t.jsx(iu,{value:cs(i),onChange:O=>o(O)}),t.jsx(gl,{state:e.state,onChange:e.set})]})}),t.jsx(Yd,{sectionRef:L.speech}),t.jsx(dc,{sectionRef:L.keyboard}),t.jsx(ce,{title:n("ui.settings.model.settings_page.model_providers"),icon:ss,description:n("ui.settings.navigation.settings_page.sign_in_to_the_services_your_agents_think_with_new_chats_use_your"),sectionRef:L.providers,id:"model-providers",className:"focus-visible:outline-none!",children:t.jsx(Si,{initialProviderId:fe,onChangeModel:()=>Se("general")})}),t.jsx(Rd,{sessionId:G??void 0,sectionRef:L.integrations,highlightServer:Be}),t.jsx(ce,{title:n("ui.settings.account.settings_page.radient_account"),titleComponent:t.jsx(cu,{}),description:n("ui.settings.account.settings_page.your_radient_account_radient_pass_details_and_credits_to_use_radi"),sectionRef:L.radient,dataTourTag:"settings-radient-account-section",children:t.jsxs("div",{className:"flex flex-col gap-8",children:[t.jsx(Fd,{onAfterCredentialUpdate:()=>{pe(),ke()}}),C&&t.jsxs(t.Fragment,{children:[t.jsx(ou,{}),t.jsx(lu,{})]})]})}),H&&t.jsx(ce,{title:n("ui.agentMessages.settings.section"),icon:Mi,description:n("ui.agentMessages.settings.description"),sectionRef:L["agent-messages"],id:"agent-messages",className:"border-b border-hairline pb-8",children:V?t.jsx(kl,{availability:W,status:V,accountId:S,refusal:I.refusal,onRefreshStatus:te,sessions:Y,onOpenSession:O=>{$.invalidateStatus(),Bs(Re,O)}}):I.refusal?t.jsxs(ae,{variant:"warning",children:[t.jsx(Nt,{children:n("ui.agentMessages.settings.error.title")}),t.jsxs(Ae,{children:[I.refusal.code!=="client_unavailable"&&t.jsx("span",{className:"block",children:xt(I.refusal)}),t.jsx("span",{className:"block",children:n("ui.agentMessages.settings.error.no_changes")}),t.jsx(D,{className:"mt-3",variant:"secondary",onClick:()=>void te(),children:n("ui.agentMessages.settings.error.retry")})]})]}):t.jsxs("div",{"aria-busy":"true",className:"flex flex-col gap-3",children:[t.jsx(xe,{className:"h-5 w-40"}),t.jsx(xe,{className:"h-4 w-full max-w-xl"})]})}),t.jsx(ce,{title:n("ui.settings.navigation.settings_page.backend_settings"),icon:jn,description:n("ui.settings.navigation.settings_page.every_setting_the_backend_registry_owns_searchable_with_typed_edi"),sectionRef:L.backend,children:t.jsx($a,{hideInterfaceLanguage:!0,hideModelEffort:!0,hideAgentMessages:!0,focusKey:ie&&bn(ie,"backend")==="backend"?ie:null,initialFilter:oe})}),t.jsx("div",{ref:L.imports,children:t.jsx(rc,{})}),t.jsx("div",{ref:L.updates,children:t.jsx(zl,{})})]})]})})]}):t.jsx("div",{className:"flex h-full w-full items-center justify-center bg-canvas p-6",children:t.jsx(ae,{variant:"warning",className:"w-full max-w-xl",children:n("ui.settings.navigation.settings_page.your_settings_could_not_be_loaded")})})};export{wu as SettingsPage};