local-operator-ui 0.39.8 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/out/main/index.js +1027 -128
  2. package/out/preload/index.js +24 -2
  3. package/out/renderer/assets/{_basePickBy-DHPhZCA_.js → _basePickBy-DpS1gi-o.js} +1 -1
  4. package/out/renderer/assets/{_baseUniq-CEysnucn.js → _baseUniq-BU_W0zZ3.js} +1 -1
  5. package/out/renderer/assets/{agent-details-page-B-86aijV.js → agent-details-page-mS7IJBVP.js} +2 -2
  6. package/out/renderer/assets/agent-hub-page-CWGw4Aok.js +6 -0
  7. package/out/renderer/assets/agents-page-CzMpVd20.js +7 -0
  8. package/out/renderer/assets/arc-T0TkGR-7.js +1 -0
  9. package/out/renderer/assets/architectureDiagram-IEHRJDOE-FOFq1O67.js +36 -0
  10. package/out/renderer/assets/{blockDiagram-JOT3LUYC-B99Xv7BZ.js → blockDiagram-JOT3LUYC-Dbo2qDB8.js} +6 -6
  11. package/out/renderer/assets/{book-open-DFWmbD9W.js → book-open-Dt6NrEVH.js} +1 -1
  12. package/out/renderer/assets/browser-page-4D5CfHGL.js +1 -0
  13. package/out/renderer/assets/browser-webauthn-prompt-CwtoTzl0.js +1 -0
  14. package/out/renderer/assets/{building-2-CYyIaJBN.js → building-2-C1lADJ7I.js} +1 -1
  15. package/out/renderer/assets/{c4Diagram-VJAJSXHY-C1pdKX_l.js → c4Diagram-VJAJSXHY-B5h8VwBj.js} +1 -1
  16. package/out/renderer/assets/channel-ChMTCIo9.js +1 -0
  17. package/out/renderer/assets/{chunk-4BMEZGHF-C-BgaYzx.js → chunk-4BMEZGHF-MR8YxQC8.js} +1 -1
  18. package/out/renderer/assets/{chunk-A2AXSNBT-DacD51Pw.js → chunk-A2AXSNBT-DCwZuOlD.js} +1 -1
  19. package/out/renderer/assets/{chunk-AEK57VVT-C1LDIbWD.js → chunk-AEK57VVT-DiUHgqSA.js} +1 -1
  20. package/out/renderer/assets/{chunk-D6G4REZN-zKqzm1Fc.js → chunk-D6G4REZN-BLBf1anZ.js} +1 -1
  21. package/out/renderer/assets/{chunk-RZ5BOZE2-COMOaHrE.js → chunk-RZ5BOZE2-8iG8Y9sJ.js} +1 -1
  22. package/out/renderer/assets/{chunk-XZIHB7SX-BvOCuAGM.js → chunk-XZIHB7SX-BUzPkuyD.js} +1 -1
  23. package/out/renderer/assets/classDiagram-GIVACNV2-olxpExNZ.js +1 -0
  24. package/out/renderer/assets/classDiagram-v2-COTLJTTW-olxpExNZ.js +1 -0
  25. package/out/renderer/assets/clone-BH-xWYVr.js +1 -0
  26. package/out/renderer/assets/console-mirror-VlsurRTu.js +44 -0
  27. package/out/renderer/assets/consoleCapture-BAEbuUE1.js +1 -0
  28. package/out/renderer/assets/{conversation-input-sync-DnJ8rwD3.js → conversation-input-sync-D8QfxmnI.js} +249 -306
  29. package/out/renderer/assets/dagre-OKDRZEBW-BVOSa9Ir.js +4 -0
  30. package/out/renderer/assets/diagram-SSKATNLV-Cd2OUAVJ.js +43 -0
  31. package/out/renderer/assets/diagram-VNBRO52H-CtrjNGKr.js +24 -0
  32. package/out/renderer/assets/{erDiagram-Q7BY3M3F-BDuxU-l2.js → erDiagram-Q7BY3M3F-DfVP3bcN.js} +1 -1
  33. package/out/renderer/assets/error-boundary-B3EFBlFF.js +126 -0
  34. package/out/renderer/assets/{flowDiagram-4HSFHLVR-DZD7CEMt.js → flowDiagram-4HSFHLVR-CGAjhZfs.js} +1 -1
  35. package/out/renderer/assets/ganttDiagram-APWFNJXF-Drljtxgq.js +257 -0
  36. package/out/renderer/assets/gitGraphDiagram-7IBYFJ6S-BHemdXzF.js +65 -0
  37. package/out/renderer/assets/{graph-Cd4rdBHc.js → graph-CHQd8w8o.js} +1 -1
  38. package/out/renderer/assets/hash-CgPb_SeD.js +6 -0
  39. package/out/renderer/assets/heart-NsStSoql.js +6 -0
  40. package/out/renderer/assets/index-BkGcHmBa.css +1 -0
  41. package/out/renderer/assets/index-CGOyAbPs.js +7 -0
  42. package/out/renderer/assets/index-DAftzhq_.js +57 -0
  43. package/out/renderer/assets/index-Y7gJQGpG.js +1 -0
  44. package/out/renderer/assets/index-ew1hMKtY.js +835 -0
  45. package/out/renderer/assets/infoDiagram-PH2N3AL5-DAlyVNJm.js +2 -0
  46. package/out/renderer/assets/{installer-p8L5oHJJ.js → installer-BUHF69aB.js} +1 -1
  47. package/out/renderer/assets/{journeyDiagram-U35MCT3I-CHFBk0nL.js → journeyDiagram-U35MCT3I-1EO-cM2S.js} +1 -1
  48. package/out/renderer/assets/{kanban-definition-NDS4AKOZ-COmnjqTV.js → kanban-definition-NDS4AKOZ-BjWHx1j6.js} +1 -1
  49. package/out/renderer/assets/{layout-CuSBEVFA.js → layout-BITZWXG5.js} +1 -1
  50. package/out/renderer/assets/legacy-agents-page-EkXsYE5Y.js +33 -0
  51. package/out/renderer/assets/library-page-A0nXlev9.js +157 -0
  52. package/out/renderer/assets/{mermaid.core-CewojVRF.js → mermaid.core-BoximGnF.js} +5 -5
  53. package/out/renderer/assets/mesh-page-CbJ0YzZR.js +1 -0
  54. package/out/renderer/assets/mindmap-definition-ALO5MXBD-CtxUEaL0.js +95 -0
  55. package/out/renderer/assets/mini-B95cJkWv.js +1 -0
  56. package/out/renderer/assets/{notebook-pen-CG3SG58i.js → notebook-pen-BxTTwLf8.js} +1 -1
  57. package/out/renderer/assets/org-access-BO4A2FAr.js +1 -0
  58. package/out/renderer/assets/org-surface-gate-Bp_arWAv.js +1 -0
  59. package/out/renderer/assets/{page-header-DysvpDyJ.js → page-header-DhME4jBY.js} +1 -1
  60. package/out/renderer/assets/path-utils-DXMoAzHL.js +58 -0
  61. package/out/renderer/assets/{pieDiagram-IB7DONF6-Dq6TjFed.js → pieDiagram-IB7DONF6-BET_kuRa.js} +2 -2
  62. package/out/renderer/assets/{projects-page-Dwk8fTRp.js → projects-page-CrvzCjsd.js} +7 -7
  63. package/out/renderer/assets/publication-validation-BSKuV2BJ.js +1 -0
  64. package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-BVLv2vHo.js → quadrantDiagram-7GDLP6J5-Wn0SqLL-.js} +1 -1
  65. package/out/renderer/assets/{radar-MK3ICKWK-D_oonYMe.js → radar-MK3ICKWK-DrM9X8dD.js} +1 -1
  66. package/out/renderer/assets/radient-auth-buttons-DQnvQV0I.js +1 -0
  67. package/out/renderer/assets/{requirementDiagram-KVF5MWMF-fxCXjqlC.js → requirementDiagram-KVF5MWMF-BdDYpNvz.js} +1 -1
  68. package/out/renderer/assets/sankeyDiagram-QLVOVGJD-C5mpSMB8.js +10 -0
  69. package/out/renderer/assets/{schedules-page-CmHgL3u3.js → schedules-page-C4tiK1q4.js} +4 -4
  70. package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-B8wkqfL8.js → sequenceDiagram-X6HHIX6F-B3Cs3RcE.js} +1 -1
  71. package/out/renderer/assets/settings-page-BZEp-NUB.js +287 -0
  72. package/out/renderer/assets/smartart-0y9MEJnm.js +1 -0
  73. package/out/renderer/assets/stateDiagram-DGXRK772-TzXzPiSs.js +1 -0
  74. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-CvQ7ch2C.js +1 -0
  75. package/out/renderer/assets/team-bridge-page-ybfd-TgP.js +26 -0
  76. package/out/renderer/assets/{timeline-definition-BDJGKUSR-Bh7YlHts.js → timeline-definition-BDJGKUSR-D9poGZsh.js} +1 -1
  77. package/out/renderer/assets/use-download-agent-mutation-CpziX3j_.js +56 -0
  78. package/out/renderer/assets/use-session-snapshot-uuzUNGgk.js +1 -0
  79. package/out/renderer/assets/{xychartDiagram-VJFVF3MP-DxmxrN_J.js → xychartDiagram-VJFVF3MP-Bpq99cbF.js} +1 -1
  80. package/out/renderer/console-capture.html +5 -5
  81. package/out/renderer/index.html +7 -7
  82. package/out/renderer/installer.html +4 -4
  83. package/out/renderer/mini.html +7 -7
  84. package/package.json +2 -2
  85. package/out/renderer/assets/agent-hub-page-BcE7cjZA.js +0 -6
  86. package/out/renderer/assets/agents-page-CAw2yx4E.js +0 -7
  87. package/out/renderer/assets/arc-CHzPG6NW.js +0 -1
  88. package/out/renderer/assets/architectureDiagram-IEHRJDOE-BJ3tht1i.js +0 -36
  89. package/out/renderer/assets/browser-page-DaXgSgru.js +0 -1
  90. package/out/renderer/assets/browser-webauthn-prompt-Dw85slb5.js +0 -1
  91. package/out/renderer/assets/channel-BEYhBY3Q.js +0 -1
  92. package/out/renderer/assets/classDiagram-GIVACNV2-Dy5mXAMG.js +0 -1
  93. package/out/renderer/assets/classDiagram-v2-COTLJTTW-Dy5mXAMG.js +0 -1
  94. package/out/renderer/assets/clone-ORue-pxx.js +0 -1
  95. package/out/renderer/assets/console-mirror-c5UE-myF.js +0 -44
  96. package/out/renderer/assets/consoleCapture-DuZA4r4V.js +0 -1
  97. package/out/renderer/assets/dagre-OKDRZEBW-DDIe0sXd.js +0 -4
  98. package/out/renderer/assets/diagram-SSKATNLV-DIZoy4ar.js +0 -43
  99. package/out/renderer/assets/diagram-VNBRO52H-BmbTUCP7.js +0 -24
  100. package/out/renderer/assets/error-boundary-DtxCuvus.js +0 -126
  101. package/out/renderer/assets/ganttDiagram-APWFNJXF-sIzmsZR9.js +0 -257
  102. package/out/renderer/assets/gitGraphDiagram-7IBYFJ6S-CfsigYLP.js +0 -65
  103. package/out/renderer/assets/hash-g37EdE9w.js +0 -6
  104. package/out/renderer/assets/index-1TUQWJ6R.js +0 -57
  105. package/out/renderer/assets/index-A6KCjnE7.js +0 -1
  106. package/out/renderer/assets/index-B8F8dXxx.js +0 -835
  107. package/out/renderer/assets/index-CXsn7x-M.css +0 -1
  108. package/out/renderer/assets/index-DEpDOZ5B.js +0 -7
  109. package/out/renderer/assets/infoDiagram-PH2N3AL5-4mNxt66m.js +0 -2
  110. package/out/renderer/assets/legacy-agents-page-DQvyD51p.js +0 -33
  111. package/out/renderer/assets/library-page-B9lgNg45.js +0 -157
  112. package/out/renderer/assets/mesh-page-BhbouWc4.js +0 -1
  113. package/out/renderer/assets/mindmap-definition-ALO5MXBD-DwFas2ix.js +0 -95
  114. package/out/renderer/assets/mini-D0hYsF4Y.js +0 -1
  115. package/out/renderer/assets/org-access-Bdty9bY1.js +0 -1
  116. package/out/renderer/assets/org-surface-gate-D6nrFZGY.js +0 -1
  117. package/out/renderer/assets/publication-validation-BHs0kne8.js +0 -1
  118. package/out/renderer/assets/radient-auth-buttons-frGm4bTw.js +0 -1
  119. package/out/renderer/assets/sankeyDiagram-QLVOVGJD-DnTFr800.js +0 -10
  120. package/out/renderer/assets/settings-page-jrapatoZ.js +0 -287
  121. package/out/renderer/assets/smartart-CcbzfE85.js +0 -1
  122. package/out/renderer/assets/stateDiagram-DGXRK772-pBreQo8f.js +0 -1
  123. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-BQCYRzUG.js +0 -1
  124. package/out/renderer/assets/team-bridge-page-BclyCGPd.js +0 -11
  125. package/out/renderer/assets/ui-preferences-store-B55tTIxk.js +0 -1
  126. package/out/renderer/assets/use-download-agent-mutation-thVr_RZe.js +0 -61
  127. package/out/renderer/assets/use-session-snapshot-Dkz_K7sg.js +0 -1
@@ -1,287 +0,0 @@
1
- import{r,t as n,j as t,c as ue,e as Us,L as Bs}from"./index-1TUQWJ6R.js";import{cm as Wn,cn as Vs,co as Hs,cp as Zn,cq as qs,cr as Gs,cs as Le,ct as Ys,aa as Jn,bU as lt,bV as me,cu as le,cv as Qs,cg as Ws,cw as Zs,p as xn,cx as Js,cy as Xs,cz as ut,bT as ea,c3 as ta,cA as na,cB as sa,cC as aa,cD as ia,bJ as yn,cE as oa,bz as ra,bQ as vn,cf as la,bR as ca,bS as da,cF as ua,bI as ga,c4 as ma,cG as _a}from"./index-B8F8dXxx.js";import{cQ as zt,cR as pa,cS as bn,cT as Pe,b$ as ha,_ as Ee,af as Xn,ag as en,a2 as es,u as tn,aO as fa,aP as xa,cU as ya,cV as va,cW as ba,cX as ka,cY as ts,cZ as nn,ad as ns,c_ as ja,c$ as wa,aT as $t,d0 as kn,d1 as qe,a as sn,c as Pt,d2 as Na,d3 as ht,d4 as Sa,by as Ma,d5 as Ca,d6 as Aa,d7 as Ea,d8 as Ia,d as pe,d9 as Kt,bO as ss,da as an,ci as ft,bC as Ra,db as as,ab as Ta,dc as La,dd as Oa,de as Fa,df as Da,a0 as on,dg as za,dh as $a,a1 as is,aV as Ut,aW as Bt,di as Pa,aI as Ka,cy as Vt,ap as at,dj as Ua,dk as Ba,dl as Va,dm as Ht,dn as Ha,dp as qa,dq as Ga,aR as os,dr as rs,ds as Ya,dt as Qa,du as Wa,aN as Za,dv as ls,aU as cs,dw as ds,dx as Ja,dy as Xa,dz as ei,dA as ti,dB as ni,dC as si,dD as ai,dE as ii,$ as oi,bW as us,b7 as ri,bx as li,dF as tt,dG as qt,dH as jn,dI as ci,dJ as di,dK as ui,dL as gi,dM as mi,bJ as _i,dN as pi,c2 as hi,dO as fi,c1 as xi,dP as yi,dQ as vi,dR as wn,dS as bi,dT as ki,dU as ji,cn as wi}from"./conversation-input-sync-DnJ8rwD3.js";import{n as Ni,K as Si,u as Ke,o as Mi,q as Ci,r as Ai,T as Ei,s as gs}from"./ui-preferences-store-B55tTIxk.js";import{P as Ii}from"./page-header-DysvpDyJ.js";import{c as I,u as se,B as F,S as ke,Q as ms,y as Ze,a0 as jt,a1 as wt,a2 as Qe,A as ae,z as Nt,E as Ce,x as be,K as rn,M as ln,N as cn,O as dn,P as We,L as Ae,I as Oe,a4 as St,R as Ri,q as ot,C as Gt,ac as Ti,g as _s,ah as Nn,T as ps,h as Li,i as Oi,j as Fi,l as Di,k as Sn,H as zi,G as $i,ai as Pi,a8 as Ki}from"./error-boundary-DtxCuvus.js";import{R as Ui}from"./radient-auth-buttons-frGm4bTw.js";import{N as Bi}from"./notebook-pen-CG3SG58i.js";import{B as Vi}from"./book-open-DFWmbD9W.js";import{a as Hi,p as At}from"./parseISO-BHJWTxrA.js";import{i as qi,a as He,f as Gi}from"./format-esAOn2VS.js";import{t as Yi}from"./en-US-CHJkXXr4.js";import"./console-mirror-c5UE-myF.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 Qi=[["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=I("aperture",Qi);/**
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 Zi=[["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"}]],Ji=I("atom",Zi);/**
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 Xi=[["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"}]],eo=I("audio-waveform",Xi);/**
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 to=[["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"}]],no=I("binary",to);/**
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 so=[["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"}]],ao=I("candy",so);/**
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 io=[["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"}]],oo=I("car-front",io);/**
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 ro=[["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"}]],lo=I("cassette-tape",ro);/**
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 co=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],uo=I("chart-line",co);/**
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 go=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],mo=I("circle-plus",go);/**
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 _o=[["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"}]],po=I("circuit-board",_o);/**
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 ho=[["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"}]],fo=I("cloud-lightning",ho);/**
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 xo=[["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"}]],yo=I("cloud-moon",xo);/**
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 vo=[["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"}]],bo=I("cloud-snow",vo);/**
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 ko=[["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"}]],jo=I("cloud-sun",ko);/**
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 wo=[["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"}]],No=I("coffee",wo);/**
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 So=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 18a6 6 0 0 0 0-12v12z",key:"j4l70d"}]],hs=I("contrast",So);/**
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 Mo=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Co=I("credit-card",Mo);/**
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 Ao=[["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"}]],Eo=I("cup-soda",Ao);/**
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 Io=[["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"}]],Ro=I("disc-3",Io);/**
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 To=[["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"}]],Lo=I("droplet",To);/**
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 Oo=[["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"}]],Fo=I("droplets",Oo);/**
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 Do=[["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"}]],zo=I("fish",Do);/**
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 $o=[["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"}]],Po=I("flame",$o);/**
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 Ko=[["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"}]],Uo=I("flower-2",Ko);/**
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 Bo=[["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"}]],Vo=I("flower",Bo);/**
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 Ho=[["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"}]],qo=I("ghost",Ho);/**
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 Go=[["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"}]],Yo=I("github",Go);/**
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 Qo=[["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=I("guitar",Qo);/**
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 Zo=[["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"}]],Jo=I("hexagon",Zo);/**
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 Xo=[["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"}]],er=I("ice-cream-bowl",Xo);/**
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 tr=[["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"}]],nr=I("joystick",tr);/**
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 sr=[["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"}]],ar=I("leaf",sr);/**
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 ir=[["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"}]],or=I("lightbulb",ir);/**
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 rr=[["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"}]],lr=I("milk",rr);/**
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 cr=[["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"}]],dr=I("moon-star",cr);/**
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 ur=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],gr=I("moon",ur);/**
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 mr=[["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"}]],_r=I("mountain-snow",mr);/**
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 pr=[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]],hr=I("mountain",pr);/**
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 fr=[["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"}]],xr=I("radio",fr);/**
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 yr=[["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"}]],vr=I("sailboat",yr);/**
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 br=[["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"}]],kr=I("shirt",br);/**
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 jr=[["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"}]],wr=I("skull",jr);/**
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 Nr=[["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"}]],Sr=I("snowflake",Nr);/**
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 Mr=[["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"}]],Cr=I("sparkle",Mr);/**
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 Ar=[["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"}]],Er=I("sun-dim",Ar);/**
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 Ir=[["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"}]],Rr=I("sun",Ir);/**
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 Tr=[["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"}]],Lr=I("sunrise",Tr);/**
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 Or=[["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"}]],Fr=I("sunset",Or);/**
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 Dr=[["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"}]],zr=I("tent",Dr);/**
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 $r=[["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"}]],Pr=I("tree-deciduous",$r);/**
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 Kr=[["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"}]],Ur=I("tree-palm",Kr);/**
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 Br=[["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"}]],Vr=I("tree-pine",Br);/**
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 Hr=[["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"}]],qr=I("trees",Hr);/**
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 Gr=[["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"}]],Yr=I("umbrella",Gr);/**
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 Qr=[["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=I("waves",Qr);/**
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 Zr=[["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"}]],Jr=I("wheat",Zr);/**
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 Xr=[["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"}]],el=I("wind",Xr),tl=({appVersion:e=null,slowWaitHintMs:s})=>{se();const a="https://local-operator.com/download",[i,o]=r.useState(!1),l=Wn(i,s??Vs),[d,g]=r.useState(!1),[c,u]=r.useState(null),[y,h]=r.useState("info"),[f,_]=r.useState(null),[x,b]=r.useState(null),C=e?.trim()?e.trim():null,z=r.useRef(!1),N=zt(L=>L.openDetail),R=r.useRef(!1),v=r.useRef(0),k=r.useRef(!1),w=r.useCallback((L,V)=>{R.current=!1,u(L),h(V),g(!0)},[]),q=r.useCallback(L=>{R.current=!0,u(L),h("success"),g(!0)},[]),Q=r.useCallback(()=>{R.current&&(R.current=!1,g(!1),u(null))},[]),{clearDeferredUpdate:Z}=pa();r.useEffect(()=>{const L=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:""}),R.current=!1,u(null),h("warning"),g(!0))}),V=window.api.updater.onBackendUpdateDevMode(m=>{z.current&&w(m,"info")}),K=()=>{k.current=!0,Q()},G=window.api.updater.onUpdateAvailable(K),U=window.api.updater.onUpdateNpxAvailable(K),ne=window.api.updater.onBackendUpdateAvailable(K);return()=>{L(),V(),G(),U(),ne()}},[Q,w]),r.useEffect(()=>{let L=!1;const V=()=>{window.api.updater.getLastInstallAttempt().then(G=>{L||b(G)}).catch(()=>{})};V();const K=window.api.updater.onUpdateInstallFailed(()=>V());return()=>{L=!0,K()}},[]);const S=async()=>{const L=++v.current;Q(),k.current=!1;try{o(!0),z.current=!0,Z(Pe.UI),Z(Pe.BACKEND);const V=await window.api.updater.checkForAllUpdates({manual:!0});if(L!==v.current)return;V.app==="available"&&N(Pe.UI),V.server==="available"&&N(Pe.BACKEND),V?.affirmation&&!k.current?q(V.affirmation):Q()}catch(V){if(L!==v.current)return;console.warn(`Update check failed; the app-level alert owns the report: ${Hs(V)}`)}finally{L===v.current&&o(!1),setTimeout(()=>{z.current=!1},2e3)}},O=()=>{R.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)}):"",".",C?n("ui.common.updates.check_for_updates_button.version",{liveversion:String(C)}):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(F,{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(F,{variant:"outline",onClick:()=>void S(),disabled:i,children:[i?t.jsx(ke,{size:"sm"}):null,i?n("ui.common.updates.check_for_updates_button.checking"):n("ui.common.updates.check_for_updates_button.check_for_updates")]}),l&&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(bn,{open:d,autoHideDuration:1e4,onClose:O,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(bn,{open:d,autoHideDuration:6e3,onClose:O,variant:y,children:c})]})},xt=["system-prompt"],nl=()=>{const{shouldEnableQuery:e}=ha();return Ee({enabled:e({bypassInternetCheck:!0}),queryKey:xt,queryFn:async()=>{try{const a=await Xn(en.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 es(a),s}},refetchOnWindowFocus:!1,staleTime:5e3})},sl=()=>{const e=tn(),s=Xn(en.baseUrl);return fa({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 es(o),i}},onSuccess:async a=>{await e.invalidateQueries({queryKey:xt,refetchType:"none"}),e.setQueryData(xt,i=>i&&{...i,...a}),await e.refetchQueries({queryKey:xt,type:"all"}),xa("System prompt updated")},onError:a=>{console.error("Error updating system prompt:",a)}})},fs=({value:e,label:s,description:a,onChange:i,icon:o,isSaving:l=!1,disabled:d=!1})=>{const[g,c]=r.useState(e),u=r.useId(),y=`${u}-label`,h=`${u}-description`,f=async _=>{if(!(l||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:h,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:l?t.jsx(ke,{size:"md",label:`Saving ${s}`}):t.jsx(ms,{checked:g,onCheckedChange:f,disabled:d,"aria-labelledby":y,"aria-describedby":a?h:void 0})})]})};function Mn(e,s){const a=Yi(e,s?.in);if(!qi(a))throw new RangeError("Invalid time value");const i=He(a.getDate(),2),o=He(a.getMonth()+1,2),l=a.getFullYear(),d=He(a.getHours(),2),g=He(a.getMinutes(),2),c=He(a.getSeconds(),2);let u="",y="";const h=a.getTimezoneOffset();if(h!==0){const f=Math.abs(h),_=He(Math.trunc(f/60),2),x=He(f%60,2);y=`${h<0?"+":"-"}${_}:${x}`}else y="Z";return`${l}-${o}-${i}T${d}:${g}:${c}${u}${y}`}function al(e,s,a){return Hi(e,-30,a)}var il=ya({chartName:"LineChart",GraphicalChild:ts,axisComponents:[{axisType:"xAxis",AxisComp:va},{axisType:"yAxis",AxisComp:ba}],formatAxisMap:ka});const ol=["radient","creditBalance"],rl=e=>{const{user:s,isAuthenticated:a}=nn(),i=s?.account?.tenant_id,o=a&&!!i&&e?.enabled;return Ee({queryKey:[ol,i],queryFn:async()=>{if(!i)throw new Error("Tenant ID not available");const l=await ns({operation:"credits",tenantId:i});if(!l||typeof l.balance!="number")throw new Error("Invalid credit balance response format");return l},enabled:o,staleTime:5*60*1e3,refetchOnWindowFocus:!0})},ll=["radient","usageRollup"],cl=(e,s)=>{const{user:a,isAuthenticated:i}=nn(),o=a?.account?.tenant_id,l=i&&!!o&&s?.enabled;return Ee({queryKey:[...ll,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 ns({operation:"usage",tenantId:o,query:d});if(!g)throw new Error("Invalid usage rollup response format");return g},enabled:l,staleTime:5*60*1e3,refetchOnWindowFocus:!0})},dl=e=>e==="sidebars"?n("ui.settings.appearance.window_glass.coverage_sidebars"):n("ui.settings.appearance.window_glass.coverage_full"),ul=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")}},gl=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 l=r.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:l,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":l,children:o.map(d=>t.jsx(Qe,{value:d.value,children:d.label},d.value))})})})]})},ml=({state:e,onChange:s})=>{se();const a=r.useId(),i=`${a}-description`,[o,l]=r.useState(null),d=r.useRef(!1),g=r.useRef(null),c=e?.settings.intensity??0;if(!e)return null;const u=!e.capability.supported,y=u?gl(e.capability.reason):null,h=async x=>{if(d.current){g.current=x;return}d.current=!0;try{await s({intensity:x})}finally{d.current=!1;const b=g.current;g.current=null,b!==null&&b!==x?h(b):l(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(Ze,{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:ja.map(x=>({value:x,label:dl(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 b=Number(x.target.value);l(b),h(b)},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:ul(x)}))})]})]})},_l=new Set(["B","C","D","E","F"]);function pl(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&&_l.has(s.surface_state)?"visible":"absent":o&&i?"visible":a&&i?"error":"absent"}function hl(e,s){return e!=="absent"}function nt(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 fl="open_chief_of_staff";function xl(e){const s=e?.delivery_hold;if(!s||s.code!==fl||s.count<=0)return null;const a=s.session||e?.local.session||null;return{count:s.count,sessionId:a}}function xs(e){return Ni(e)}function yl(e){return e.target.endpoint_id?{kind:"endpoint",id:e.target.endpoint_id}:{kind:"account",id:e.target.account_id??""}}function Yt(e){return e.map((s,a)=>{const i=yl(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 Qt(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 vl(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(Qt(e.entries,e.modes))===e.savedSignature?{disabled:!0,reason:"unchanged"}:{disabled:!1}}const bl=/^[^\s\p{Cc}]{1,128}$/u;function kl(e){return e===""?n("ui.agentMessages.settings.allowlist.identifier_empty"):e.length>128?n("ui.agentMessages.settings.allowlist.identifier_long"):bl.test(e)?null:n("ui.agentMessages.settings.allowlist.identifier_invalid")}function yt(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 jl({availability:e,status:s,accountId:a,refusal:i=null,api:o=Gs,onRefreshStatus:l,sessions:d=[],onOpenSession:g}){se();const[c,u]=r.useState({kind:"loading"}),[y,h]=r.useState(0),[f,_]=r.useState(null),[x,b]=r.useState(null),[C,z]=r.useState(s?.local.enabled??!1),[N,R]=r.useState(s?.local.session??""),v=s?.tenant_id??void 0,k=e==="visible",w=s?.account_id??null,q=w!==null&&w===a;r.useEffect(()=>{if(!k)return;let S=!1;return u({kind:"loading"}),b(null),(async()=>{try{const O=await o.settings(v);if(S)return;if(!O){u({kind:"error",refusal:{code:"invalid_response",message:n("ui.agentMessages.settings.error.unreadable")}});return}let L=null;if(O.endpoint){if(L=await o.allowlist(O.settings.tenant_id),S)return;if(!L){u({kind:"error",refusal:{code:"invalid_response",message:n("ui.agentMessages.settings.error.unreadable")}});return}}u({kind:"ready",settings:O,allowlist:L})}catch(O){if(S)return;u({kind:"error",refusal:Le(O)})}})(),()=>{S=!0}},[k,a,w,v,y,o]),r.useEffect(()=>{if(!k||c.kind!=="ready"||!c.settings.endpoint||c.allowlist)return;let S=!1;return(async()=>{try{const O=await o.allowlist(c.settings.settings.tenant_id);if(S||!O)return;u(L=>L.kind==="ready"&&!L.allowlist?{...L,allowlist:O}:L)}catch(O){S||b(Le(O))}})(),()=>{S=!0}},[k,c,o]),r.useEffect(()=>{s&&(z(s.local.enabled),R(s.local.session))},[s]);const Q=()=>h(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(Ce,{children:[i?yt(i):n("ui.agentMessages.settings.refusal.generic"),t.jsx(F,{className:"mt-3",variant:"secondary",onClick:()=>{Q(),l(!0)},children:n("ui.agentMessages.settings.error.retry")})]})]})});if(!s||!a)return null;const Z=xl(s);return t.jsxs("div",{"data-agent-messages-section":"",className:"flex flex-col gap-6",children:[Z&&t.jsx(Nl,{count:Z.count,onMessage:Z.sessionId&&g?()=>g(Z.sessionId):void 0}),x&&t.jsx(ae,{variant:"warning",children:t.jsx(Ce,{children:yt(x)})}),c.kind==="loading"&&t.jsx(wl,{}),c.kind==="error"&&t.jsxs(ae,{variant:"warning",children:[t.jsx(Nt,{children:n("ui.agentMessages.settings.error.title")}),t.jsxs(Ce,{children:[c.refusal.code!=="client_unavailable"&&t.jsx("span",{className:"block",children:yt(c.refusal)}),t.jsx("span",{className:"block",children:n("ui.agentMessages.settings.error.no_changes")}),t.jsx(F,{className:"mt-3",variant:"secondary",onClick:Q,children:n("ui.agentMessages.settings.error.retry")})]})]}),c.kind==="ready"&&t.jsxs(t.Fragment,{children:[t.jsx(Al,{state:nt(s,c.settings),status:s,settings:c.settings,accountId:w??a,accountMatches:q,api:o,pending:f,localEnabled:C,onActionRefusal:b,onSettings:S=>u(O=>O.kind==="ready"?{...O,settings:S}:O),onLocalEnabled:z,onRefreshStatus:l,setPending:_}),t.jsx(El,{value:N,sessions:d,pending:f==="session",disabled:f!==null,onSave:async S=>{_("session"),b(null);try{await o.localSetting("team_bridge.session",S),R(S),await l(!0)}catch(O){b(Le(O))}finally{_(null)}}}),c.allowlist&&(nt(s,c.settings)==="C"||nt(s,c.settings)==="D"||nt(s,c.settings)==="F")&&t.jsx(Il,{allowlist:c.allowlist,accountId:w??a,accountMatches:q,readOnly:s.read_only===!0&&nt(s,c.settings)==="F",pending:f!==null,onSaving:S=>_(S?"allowlist":null),onRefusal:b,onSaved:S=>u(O=>O.kind==="ready"?{...O,allowlist:S}:O),api:o},c.allowlist.view.tenant_id??"tenant")]})]})}function wl(){return t.jsxs("div",{className:"flex flex-col gap-3","aria-busy":"true",children:[t.jsx(be,{className:"h-5 w-40"}),t.jsx(be,{className:"h-4 w-full max-w-xl"}),t.jsx(be,{className:"h-9 w-36"}),t.jsx(be,{className:"h-4 w-64"})]})}const Nl=({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(Ys,"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(F,{variant:"ghost",size:"sm",className:"shrink-0 text-ink",onClick:s,children:n("ui.agentMessages.settings.hold.open")})]})})}),Sl=({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})}),Ml={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"},Cl={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"},Al=({state:e,status:s,settings:a,accountId:i,accountMatches:o,api:l,pending:d,localEnabled:g,onActionRefusal:c,onSettings:u,onLocalEnabled:y,onRefreshStatus:h,setPending:f})=>{const _=xs(s),x=a.settings.tenant_id,b=d!==null||!o;async function C(k,w={}){if(!o)return null;f(k),c(null);try{const q=await l.updateSettings({expected_account_id:i,tenant_id:x,state:k,...w});if(u(q),k==="disabled")try{await l.localSetting("team_bridge.enabled",!1),y(!1)}catch(Q){c(Le(Q))}return q}catch(q){const Q=Le(q);return c(Q),Q.code==="consent_version_unknown"&&await h(!0),null}finally{f(null)}}async function z(){if(!(!_||!o||!await C("active",{consent_version:_.version,consented_via:"settings"}))){f("local");try{await l.localSetting("team_bridge.enabled",!0),y(!0),await h(!0)}catch(w){c(Le(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:b,description:n("ui.agentMessages.settings.local.stays_enrolled"),onChange:async k=>{f("local"),c(null);try{await l.localSetting("team_bridge.enabled",k),y(k),await h(!0)}catch(w){c(Le(w))}finally{f(null)}}})]});const N=a.endpoint?.label?.trim(),R=a.endpoint?.consent??null,v=R!==null&&!R.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(Ml[e])}),N&&t.jsx("span",{className:"text-body-sm text-ink-muted",children:N})]}),t.jsx("p",{className:"max-w-2xl text-body-sm text-ink-muted",children:n(Cl[e])}),(e==="B"||e==="E")&&t.jsxs("div",{className:"flex flex-col gap-3",children:[_?t.jsx(Sl,{text:_.text}):t.jsx(ae,{variant:"warning",children:t.jsx(Ce,{children:n("ui.agentMessages.settings.consent.unavailable")})}),t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsx(F,{"data-agent-messages-action":"enable",onClick:()=>void z(),disabled:b||!_,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(F,{"data-agent-messages-action":"pause",variant:"secondary",disabled:b,onClick:()=>void C("paused"),children:n("ui.agentMessages.settings.action.pause")}),t.jsx(F,{"data-agent-messages-action":"turn_off",variant:"secondary",disabled:b,onClick:()=>void C("disabled"),children:n("ui.agentMessages.settings.action.turn_off")})]}),t.jsx(It,{settings:a,status:s}),v&&t.jsx(An,{onRenew:()=>void z(),disabled:b||!_}),t.jsx(En,{value:g,disabled:b,description:n("ui.agentMessages.settings.local.stays_enrolled"),onChange:async k=>{f("local"),c(null);try{await l.localSetting("team_bridge.enabled",k),y(k),await h(!0)}catch(w){c(Le(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(F,{"data-agent-messages-action":"resume",disabled:b||a.settings.consent_required&&_===null,onClick:()=>void C("active",a.settings.consent_required&&_?{consent_version:_.version,consented_via:"settings"}:{}),children:n("ui.agentMessages.settings.action.resume")}),t.jsx(F,{"data-agent-messages-action":"turn_off",variant:"secondary",disabled:b,onClick:()=>void C("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}),v&&t.jsx(An,{onRenew:()=>void z(),disabled:b||!_})]})]})},An=({onRenew:e,disabled:s})=>t.jsx(ae,{variant:"warning",children:t.jsxs(Ce,{children:[n("ui.agentMessages.settings.consent.renew"),t.jsx(F,{"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(lt,{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=r.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:l=>void i(l)})]})},El=({value:e,sessions:s,pending:a,disabled:i,onSave:o})=>{const l=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(rn,{value:e===""?Et:e,disabled:i,onValueChange:d=>void o(d===Et?"":d),children:[t.jsx(ln,{className:"w-full max-w-md","aria-label":n("ui.agentMessages.settings.session.title"),children:t.jsx(cn,{})}),t.jsxs(dn,{children:[t.jsx(We,{value:Et,children:n("ui.agentMessages.settings.session.none")}),s.map(d=>t.jsx(We,{value:d.session_id,children:d.title?.trim()||d.session_id},d.session_id)),e!==""&&!l&&t.jsx(We,{value:e,children:e})]})]}),e!==""&&!l&&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")})]})},Il=({allowlist:e,accountId:s,accountMatches:a,readOnly:i,pending:o,api:l,onSaving:d,onRefusal:g,onSaved:c})=>{const[u,y]=r.useState(()=>Yt(e.allowlist.entries)),[h,f]=r.useState(()=>({send:e.view.directions.send.mode,receive:e.view.directions.receive.mode})),_=o||i||!a,x=ys(Qt(Rl(e),Tl(e))),b=vl({entries:u,modes:h,savedSignature:x,saving:o}),C=r.useRef(0),z=v=>y(k=>[...k,{...v,key:`${v.direction}:${v.effect}:${C.current++}`}]),N=v=>y(k=>k.filter(w=>w.key!==v)),R=async()=>{if(!_){d(!0),g(null);try{const v=await l.updateAllowlist({expected_account_id:s,tenant_id:e.allowlist.tenant_id,entries:Qt(u,h)}),k=Yt(v.allowlist.entries);y(k),f({send:v.view.directions.send.mode,receive:v.view.directions.receive.mode}),c(v)}catch(v){g(Le(v))}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:h.receive,cues:e.view.cues,entries:u.filter(v=>v.direction==="receive"),disabled:_,onMode:v=>f(k=>({...k,receive:v})),onAdd:v=>z({...v,direction:"receive"}),onRemove:N}),t.jsx(In,{direction:"send",title:n("ui.agentMessages.settings.allowlist.send"),mode:h.send,cues:e.view.cues,entries:u.filter(v=>v.direction==="send"),disabled:_,onMode:v=>f(k=>({...k,send:v})),onAdd:v=>z({...v,direction:"send"}),onRemove:N}),t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsxs(F,{onClick:()=>void R(),disabled:b.disabled||_,children:[t.jsx(Jn,{size:14}),n("ui.agentMessages.settings.allowlist.save")]}),b.disabled&&b.reason==="needs_entry"&&t.jsx("span",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.needs_entry")}),b.disabled&&b.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 Rl(e){return Yt(e.allowlist.entries)}function Tl(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:l,onMode:d,onAdd:g,onRemove:c})=>{const u=o.filter(h=>h.effect==="allow"),y=o.filter(h=>h.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(Ll,{mode:a,disabled:l,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(h=>t.jsx(Rn,{entry:h,disabled:l,onRemove:()=>c(h.key)},h.key)),t.jsx(Tn,{label:n("ui.agentMessages.settings.allowlist.add_allowed"),disabled:l,onAdd:h=>g({...h,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(h=>t.jsx(Rn,{entry:h,disabled:l,onRemove:()=>c(h.key)},h.key)),t.jsx(Tn,{label:n("ui.agentMessages.settings.allowlist.add_blocked"),disabled:l,onAdd:h=>g({...h,effect:"deny"})})]})]})},Ll=({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(F,{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(F,{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]=r.useState("endpoint"),[l,d]=r.useState(""),[g,c]=r.useState(null),u=r.useId(),y=`${u}-help`,h=()=>{const f=kl(l.trim());c(f),!f&&(a({kind:i,id:l.trim()}),d(""))};return t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Ae,{htmlFor:u,children:e}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs(rn,{value:i,disabled:s,onValueChange:f=>o(f),children:[t.jsx(ln,{className:"w-32","aria-label":n("ui.agentMessages.settings.allowlist.kind"),children:t.jsx(cn,{})}),t.jsxs(dn,{children:[t.jsx(We,{value:"endpoint",children:n("ui.agentMessages.settings.allowlist.kind_agent")}),t.jsx(We,{value:"account",children:n("ui.agentMessages.settings.allowlist.kind_person")})]})]}),t.jsx(Oe,{id:u,"aria-describedby":y,className:"max-w-xs",value:l,disabled:s,placeholder:n("ui.agentMessages.settings.allowlist.identifier"),onChange:f=>d(f.target.value),onKeyDown:f=>{f.key==="Enter"&&(f.preventDefault(),h())}}),t.jsx(F,{variant:"secondary",size:"sm",disabled:s,onClick:h,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 Ol(){const{snapshot:e}=Zn(),[s,a]=r.useState(!1),i=pl({status:e.status,refused:e.refusal!==null,everVisible:s,checking:e.checking});return r.useEffect(()=>{i!=="absent"&&a(!0)},[i]),r.useEffect(()=>{qs()},[]),i}const Ln={get[Pe.UI](){return n("ui.settings.updates.update_following.application_updates")},get[Pe.BACKEND](){return n("ui.settings.updates.update_following.server_updates")}},gt={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:gt[s].description})]}),t.jsxs(rn,{value:s,onValueChange:i=>a(e,i),children:[t.jsx(ln,{"aria-label":n("ui.settings.updates.update_following.surface_choice",{surface:Ln[e],choice:gt[s].label}),className:"w-full sm:w-56","data-followed-segment":e,children:t.jsx(cn,{})}),t.jsx(dn,{children:wa.map(i=>t.jsx(We,{value:i,title:gt[i].description,children:gt[i].label},i))})]})]})},Fl=()=>(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:Pe.UI}),t.jsx(On,{type:Pe.BACKEND})]})]})),Dl=({appVersion:e})=>t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(Fl,{}),t.jsx(tl,{appVersion:e})]}),zl=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 $l=()=>{se();const[e,s]=r.useState(null),[a,i]=r.useState({value:"Loading...",detail:null,degraded:!1}),[o,l]=r.useState({platform:"Loading...",arch:"...",nodeVersion:"Loading...",electronVersion:"Loading...",chromeVersion:"Loading..."});r.useEffect(()=>{let g=!0;const c=_=>{if(!g)return;const x=zl(_.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 b=_.version||"Version unknown";i({value:x?`${b} · ${x}`:b,detail:_.detail||null,degraded:_.state==="degraded"})};let u=!1;const y=window.api?.backend?.onStatusChange(_=>{u=!0,c(_)}),h=async()=>{try{const[_,x]=await Promise.all([window.api.systemInfo.getAppVersion(),window.api.systemInfo.getPlatformInfo()]);g&&(s(_),l(x))}catch(_){console.error("Error fetching app information:",_)}},f=async()=>{try{const _=window.api?.backend;if(_){const C=await _.getStatus();u||c(C);return}const x=await kn.healthCheck(en.baseUrl),b=kn.getServerVersion(x);g&&i({value:b,detail:null,degraded:!1})}catch(_){console.error("Error fetching server version:",_),g&&i({value:"Unavailable",detail:null,degraded:!1})}};return h(),f(),()=>{g=!1,y?.()}},[]);const d=(g,c,u,y={})=>t.jsx(me,{label:t.jsx(Ze,{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(Ze,{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(le,{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(lt,{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(Dl,{appVersion:e})]})})};function vs(e){const s={id:"",name:n("ui.settings.model.default_effort.model_default")};return e.resolvedLevel&&e.stored.trim()===""&&un(e.resolvedLevel,e.storable)!==null&&(s.description=n("ui.settings.model.default_effort.model_default_resolves",{level:qe(e.resolvedLevel)})),[s,...bs(e.ladder,e.storable)]}function un(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=un(a,s);return i===null?[]:[{id:i,name:qe(a)}]})}function Pl(e,s){const a=e.trim().toLowerCase();return a!==""&&s.some(i=>i.toLowerCase()===a)?s.find(i=>i.toLowerCase()===a)??"":""}function Kl(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===""?"":un(a,e.storable)??"";return i.trim().toLowerCase()===s?null:i}const vt="\0unread";function mt(e){return e.trim()===""?"":vt}function Ul(e){if(!e.supported)return{kind:"unsupported",options:[],selectedId:"",disabled:!0,helper:""};if(!e.hasHome)return $e("no-home",n("ui.settings.model.default_effort.no_home"));if(!e.hasModel)return $e("no-model",n("ui.settings.model.default_effort.no_model"),vt);if(e.settings==="loading")return $e("settings-loading",n("ui.settings.model.default_effort.settings_loading"),vt);if(e.settings==="error")return $e("settings-error",n("ui.settings.model.default_effort.settings_error"),vt);if(e.preview==="loading")return $e("loading",n("ui.settings.model.default_effort.loading"),mt(e.stored));if(e.preview==="error")return $e("error",n("ui.settings.model.default_effort.error"),mt(e.stored));if(e.ladder===null||!e.specResolved)return $e("unresolved",n("ui.settings.model.default_effort.unresolved"),mt(e.stored));const s=e.ladder;if(s.length===0)return $e("empty",n("ui.settings.model.default_effort.empty"),mt(e.stored));const a=bs(s,e.storable);if(a.length===0){const i=qe(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:Pl(e.stored,a.map(i=>i.id)),disabled:!1,helper:n("ui.settings.model.default_effort.helper_ready")}}function $e(e,s,a=""){return{kind:e,options:vs({ladder:[],resolvedLevel:null,stored:"",storable:[]}),selectedId:a,disabled:!0,helper:s}}const Bl=({hosting:e,modelName:s,focus:a=!1})=>{se();const i=sn(),o=Pt(i.data,"draft_preview"),l=Na(),d=e!==""&&s!=="",g=Ee({queryKey:Kt.all,queryFn:()=>pe({op:"settings.list"}),enabled:o,staleTime:1e4}),c=g.data?.settings.find($=>$.key===ht),u=typeof c?.value=="string"?c.value:"",y=(c?.choices??[]).map($=>$.value).filter($=>typeof $=="string"),h={cwd:l??"",model:d?{provider:e,model_id:s,reasoning_effort:null}:null},f=g.isSuccess?u:null,_=Ee({...Ma(h),queryKey:[...Sa(h),"model_effort",f],enabled:o&&!!l&&d}),x=_.isSuccess&&!_.isPlaceholderData,b=x?Ca(_.data?.snapshot,null).effort:null,C=x&&Array.isArray(b?.reasoning_efforts)?Aa(b):null,z=x?Ea(b):null,N=b!==null&&!Ia(b),[R,v]=r.useState(!1),[k,w]=r.useState(!1),[q,Q]=r.useState(null),[Z,S]=r.useState(null),O=`${e}\0${s}`,L=tn(),V=r.useRef(null),K=r.useRef(!1),G=r.useCallback(async($,oe)=>{v(!0),Q($),w(!1),oe===null&&S(null);try{await pe({op:"settings.edit",key:ht,value:$}),await L.invalidateQueries({queryKey:Kt.all}),oe!==null&&S(oe)}catch{w(!0)}finally{v(!1),Q(null)}},[L]),U=typeof b?.display_name=="string"&&b.display_name.trim()||s,ne=Ul({supported:o,hasHome:!!l,hasModel:d,settings:g.isError?"error":g.isSuccess?"ready":"loading",preview:_.isError?"error":x?"ready":"loading",ladder:C,specResolved:N,stored:u,resolvedLevel:z,storable:y}),m=Kl({stored:u,ladder:C,resolvedLevel:z,resolved:x&&N&&g.isSuccess,storable:y}),T=r.useRef(null);r.useEffect(()=>{if(m===null||R)return;const $=`${e}\0${s}\0${u}\0${m}`;if(T.current===$)return;T.current=$;const oe=m===""?n("ui.settings.model.default_effort.clamped_unset",{level:qe(u),model:U}):n("ui.settings.model.default_effort.clamped",{level:qe(u),model:U,resolved:qe(m)});G(m,{text:oe,model:O})},[m,u,R,G,e,s,U,O]);const A=r.useMemo(()=>ne.options.map(Vl),[ne.options]);r.useEffect(()=>{if(!a){K.current=!1;return}ne.disabled||K.current||(V.current?.querySelector("[role=combobox]")?.focus(),K.current=!0)},[a,ne.disabled]);const W=q??ne.selectedId,J=A.find($=>$.id===W)??(q!==null?{id:q,name:qe(q)}:null),ee=t.jsxs("span",{className:"flex flex-col gap-0.5",children:[t.jsx("span",{children:ne.helper}),k&&t.jsx("span",{className:"text-danger",children:n("ui.settings.model.default_effort.save_failed")}),t.jsx("output",{"aria-live":"polite",children:Z?.model===O?Z.text:""})]});return ne.kind==="unsupported"?null:t.jsx("div",{ref:V,"data-setting-key":ht,children:t.jsx(Ri,{label:n("ui.settings.model.default_effort.label"),icon:t.jsx(Qs,{size:16,"aria-hidden":"true"}),placeholder:n("ui.settings.model.default_effort.placeholder"),options:A,selected:J,onSelect:$=>{G($.id,null)},helperText:ee,busy:R,busyLabel:n("ui.settings.model.default_effort.busy"),disabled:ne.disabled||R})})};function Vl(e){return{id:e.id,name:e.name,description:e.description}}const Hl=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},ql=(e,s)=>`${e??""}\0${[...s].sort().join("\0")}`,js=5e3,Gl=(e,s,a,i=js)=>{const o=new Set(a);let l=!1;for(const d of ks(e,s))if(!o.has(d.sourceId)){if(o.size>=i){l=!0;break}o.add(d.sourceId)}return{selected:o,capped:l}},Yl=/cancel/i,Ql=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"}},Zl=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"}},Jl=e=>e==="failed"?"danger":e==="metadata_only"||e==="skipped_already_imported"?"neutral":e==="cancelled"?"warning":"success",Wt=e=>Hl(e.title)||e.sourceId,Dn=({path:e,label:s,onCopyPath:a})=>{const[i,o]=r.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(F,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{a(e).then(l=>{l&&(o(!0),window.setTimeout(()=>o(!1),1500))})},children:[i?t.jsx(_s,{size:14}):t.jsx(as,{size:14}),i?n("ui.settings.imports.copied"):n("ui.settings.imports.copy_path")]})]})},Xl=({progress:e,sessions:s,selected:a})=>{const i=new Map(e.results.map(g=>[g.sourceId,g])),o=e.sessionId,l=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(ot,{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(ft,{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})]}),l>0&&t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.progress_pending",{count:l})}),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=>Yl.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(ot,{variant:Jl(i),children:n(Zl(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))]})},ec=({sources:e,activeSource:s,sessions:a,query:i,selected:o,preview:l,previewStale:d,previewError:g,confirmed:c,busy:u,error:y,progress:h,result:f,cancelling:_,onSelectSource:x,onQueryChange:b,onToggleSession:C,onSelectAll:z,onClearSelection:N,onConfirmChange:R,onImport:v,onCancel:k,onRetry:w,onImportAnother:q,onRefresh:Q,selectionNotice:Z,onCopyPath:S})=>{se();const O=e.find(m=>m.source===s),L=h!==null&&!Ql.has(h.state),V=h?.total??o.size,K=r.useMemo(()=>ks(a,i),[i,a]),G=K.length>0&&K.every(m=>o.has(m.sourceId)),U=o.size,ne=U>0&&l!==null&&!d&&c&&!u&&!h&&!f;return t.jsx(le,{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(Ce,{children:t.jsxs("span",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx("span",{children:y}),t.jsx(F,{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(be,{className:"h-20 w-full"}),t.jsx(be,{className:"h-20 w-full"}),t.jsx(be,{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(F,{variant:"ghost",size:"sm",onClick:Q,disabled:L||u==="sources"||u==="sessions",children:[t.jsx(Ws,{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:L,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(ot,{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)})})]}),O&&!h&&!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")," · ",O.label]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(F,{variant:"secondary",size:"sm",onClick:G?N:z,disabled:K.length===0,children:G?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:U})})]})]}),Z&&t.jsx("output",{className:"text-meta text-warning",children:Z}),t.jsxs("div",{className:"relative",children:[t.jsx(ss,{size:15,className:"pointer-events-none absolute top-1/2 start-3 -translate-y-1/2 text-ink-dim"}),t.jsx(Oe,{value:i,onChange:m=>b(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(be,{className:"h-12 w-full"}),t.jsx(be,{className:"h-12 w-full"}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.loading_sessions",{source:O.label})})]}):a.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.imports.empty_sessions",{source:O.label})}):K.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:K.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(Gt,{id:T,checked:o.has(m.sourceId),onCheckedChange:()=>C(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(ot,{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:an(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)})})]}),O&&U>0&&!h&&!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||l===null&&!g)&&t.jsxs("p",{className:"flex items-center gap-2 text-meta text-ink-muted",children:[t.jsx(ft,{size:14,className:"animate-spin"}),n("ui.settings.imports.loading_preview")]}),l&&!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:l.totalSessions,messages:l.totalMessages,compactions:l.totalCompactions})}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.preview_memory",{records:l.totalMemoryRecords,tokens:l.projectedMemoryTokens.toLocaleString()})}),l.warnings.slice(0,4).map((m,T)=>t.jsx("p",{className:"text-meta text-warning",children:m.message},`${m.code}:${m.sessionId}:${T}`)),l.warnings.length>4&&t.jsx("p",{className:"text-meta text-warning",children:n("ui.settings.imports.warnings_heading",{count:l.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(Ce,{children:t.jsxs("span",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx("span",{children:g}),t.jsx(F,{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(Gt,{checked:c,onCheckedChange:m=>R(m===!0),disabled:!l||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(F,{variant:"primary",onClick:v,disabled:!ne,className:"self-start",children:[u==="start"?t.jsx(ft,{size:14,className:"animate-spin"}):t.jsx($t,{size:14}),n("ui.settings.imports.import_button",{count:U})]})]})]}),h&&!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(F,{variant:"secondary",size:"sm",onClick:k,disabled:_||h.state==="done"||h.state==="cancelled"||h.state==="failed",children:[t.jsx(Ra,{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:h.jobId,state:n(Tt(h.state))})," · ",n(Wl(h.phase))]}),t.jsx(Ti,{value:h.total?h.completed/h.total*100:0,className:"h-1.5"}),t.jsx(Xl,{progress:h,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(F,{variant:"secondary",size:"sm",onClick:q,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:V,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(Ce,{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(Ce,{children:f.error})}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.rerun_safe")})]}),u==="start"&&!h&&t.jsxs("p",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[t.jsx(ft,{size:14,className:"animate-spin"}),n("ui.settings.imports.importing")]})]})})},gn=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}),tc=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(gn),error:e.error});async function nc(){return(await pe({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 sc(e,s=!1){return(await pe({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 ac(e){const s=await pe({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(gn),instructionReviewPaths:s.instruction_review_paths}}async function ic(e){return(await pe({op:"imports.start",sources:e.sources,sessionIds:e.sessionIds,includeMemory:e.includeMemory??!0,includeInstructions:e.includeInstructions??!0})).job_id}async function oc(e){const s=await pe({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(gn),error:s.error,startedAt:s.started_at,updatedAt:s.updated_at,result:s.result?tc(s.result):void 0}}async function rc(e){await pe({op:"imports.cancel",jobId:e})}const _t=new Set(["done","failed","cancelled"]),Ye=e=>e instanceof Error?e.message:String(e),lc=()=>{se();const[e,s]=r.useState([]),[a,i]=r.useState(null),[o,l]=r.useState([]),[d,g]=r.useState(""),[c,u]=r.useState(new Set),[y,h]=r.useState(null),[f,_]=r.useState(null),[x,b]=r.useState(!1),[C,z]=r.useState(null),[N,R]=r.useState(null),[v,k]=r.useState(null),[w,q]=r.useState(null),[Q,Z]=r.useState(!1),[S,O]=r.useState(null),[L,V]=r.useState(0),K=r.useRef(0),G=r.useRef(0),[U,ne]=r.useState(null),[m,T]=r.useState(null),A=r.useRef(null),W=v!==null&&!_t.has(v.state),J=r.useCallback(async()=>{z("sources"),R(null);try{const P=await nc();s(P),i(te=>P.some(de=>de.source===te&&de.detected)?te:P.find(de=>de.detected)?.source??null)}catch(P){R(n("ui.settings.imports.error_sources",{reason:Ye(P)}))}finally{z(null)}},[]);r.useEffect(()=>{J()},[J]);const ee=r.useCallback(async P=>{const te=++K.current;z("sessions"),R(null);try{const _e=await sc(P);if(te!==K.current)return;l(_e)}catch(_e){if(te!==K.current)return;l([]),R(n("ui.settings.imports.error_sessions",{source:P,reason:Ye(_e)}))}finally{te===K.current&&z(null)}},[]);r.useEffect(()=>{if(!a){l([]);return}l([]),u(new Set),h(null),_(null),ne(null),T(null),b(!1),q(null),k(null),ee(a)},[a,ee]);const $=r.useCallback(P=>{u(P),b(!1),ne(null),T(null),O(null)},[]),oe=r.useCallback(P=>{W||(i(P),g(""))},[W]),ce=r.useCallback(P=>{const te=new Set(c);te.has(P)?te.delete(P):te.add(P),$(te)},[$,c]),Fe=r.useCallback(()=>{const P=Gl(o,d,c);$(P.selected),P.capped&&O(n("ui.settings.imports.selection_limit",{max:js}))},[d,$,c,o]),fe=r.useCallback(()=>{$(new Set)},[$]),xe=r.useMemo(()=>ql(a,c),[a,c]),M=y!==null&&f!==xe,B=r.useCallback(async()=>{if(!a||c.size===0)return;const P=++G.current,te=xe;z("preview"),R(null),T(null);try{const _e=await ac({sources:[a],sessionIds:{[a]:[...c].sort()}});if(P!==G.current)return;h(_e),_(te)}catch(_e){if(P!==G.current)return;h(null),_(null),ne(te),T(n("ui.settings.imports.error_preview",{reason:Ye(_e)}))}finally{P===G.current&&z(null)}},[a,xe,c]);r.useEffect(()=>{if(!a||c.size===0||v||w||y&&f===xe||!y&&U===xe)return;const P=setTimeout(()=>{B()},250);return()=>clearTimeout(P)},[a,c,xe,y,f,U,v,w,B]);const Y=r.useCallback(async()=>{if(!(!a||c.size===0||!y||M||!x||v)){z("start"),R(null),q(null);try{const P=await ic({sources:[a],sessionIds:{[a]:[...c].sort()}}),te=Date.now()/1e3;k({jobId:P,state:"queued",phase:"queued",source:a,sessionId:"",completed:0,total:c.size,results:[],warnings:[],error:"",startedAt:te,updatedAt:te})}catch(P){R(n("ui.settings.imports.error_start",{reason:Ye(P)}))}finally{z(null)}}},[a,x,y,M,v,c]),H=v?.jobId??null,ie=v?.state??null;r.useEffect(()=>{if(!H||!ie||_t.has(ie))return;let P=!0,te;const _e=async()=>{try{const de=await oc(H);if(!P)return;if(A.current){const Ie=A.current;A.current=null,R(D=>D===Ie?null:D)}k(de),de.result&&q({...de.result,jobId:de.jobId}),_t.has(de.state)||(te=setTimeout(_e,900))}catch(de){if(!P)return;const Ie=n("ui.settings.imports.error_job",{reason:Ye(de)});A.current=Ie,R(Ie),te=setTimeout(_e,2e3)}};return te=setTimeout(_e,L>0?0:700),()=>{P=!1,te&&clearTimeout(te)}},[H,ie,L]);const Ue=r.useCallback(async()=>{if(!(!v||_t.has(v.state))){Z(!0),R(null);try{await rc(v.jobId)}catch(P){R(n("ui.settings.imports.error_cancel",{reason:Ye(P)}))}finally{Z(!1)}}},[v]),ye=r.useCallback(()=>{u(new Set),h(null),_(null),ne(null),T(null),b(!1),O(null),q(null),k(null),R(null),a&&ee(a)},[a,ee]),Xe=r.useCallback(async P=>{try{return await navigator.clipboard.writeText(P),!0}catch{return!1}},[]),ve=r.useCallback(async()=>{W||(O(null),ne(null),T(null),await J(),a&&await ee(a))},[a,W,ee,J]),Be=r.useCallback(()=>{if(W){R(null),V(P=>P+1);return}ne(null),T(null),ve()},[W,ve]);return t.jsx(ec,{sources:e,activeSource:a,sessions:o,query:d,selected:c,preview:y,previewStale:M,previewError:m,confirmed:x,busy:C,error:N,progress:v,result:w,cancelling:Q,onSelectSource:oe,onQueryChange:g,onToggleSession:ce,onSelectAll:Fe,onClearSelection:fe,onConfirmChange:b,onImport:()=>void Y(),onCancel:()=>void Ue(),onRetry:Be,onImportAnother:ye,onRefresh:ve,selectionNotice:S,onCopyPath:Xe})},cc=e=>{const s=e.label.replace(/^Open\s+/,"");return s.charAt(0).toUpperCase()+s.slice(1)},dc=({action:e})=>{se();const s=r.useId(),a=r.useRef(null),i=Ke(x=>x.shortcutBindings),o=i[e.id],l=Ke(x=>x.setShortcutBinding),d=Ke(x=>x.clearShortcutBinding),[g,c]=r.useState(!1),[u,y]=r.useState(null),h=r.useMemo(Ta,[]),f=Mi(e.id,i),_=cc(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(Ae,{htmlFor:s,className:"w-32 text-body-sm text-ink",children:_}),t.jsx(Oe,{id:s,readOnly:!0,value:f===null?n("ui.settings.shortcuts.keyboard_shortcuts_section.no_shortcut"):Ci(f,h),"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(La.has(x.key))return;if(Oa.has(x.key)){c(!1),y(null);return}if(Fa.has(x.key)||x.nativeEvent.isComposing)return;const b=Da({key:x.key,metaKey:x.metaKey,ctrlKey:x.ctrlKey,altKey:x.altKey,shiftKey:x.shiftKey}),C=Ai(b,e.id,i,h);if(C!==null){x.preventDefault(),c(!0),y(C);return}if(b===f){c(!0),y(null);return}x.preventDefault(),c(!0),y(null),b===e.defaultChord?l(e.id,null):b!==null&&l(e.id,b)}}),f!==null&&t.jsx(F,{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(F,{variant:"secondary",size:"sm","aria-label":n("ui.settings.shortcuts.keyboard_shortcuts_section.reset_label_to_its_default",{label:String(_)}),onClick:()=>{l(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})]})},uc=({sectionRef:e})=>(se(),t.jsx(le,{title:n("ui.settings.shortcuts.keyboard_shortcuts_section.keyboard_shortcuts"),icon:Zs,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:Si.map(s=>t.jsx(dc,{action:s},s.id))})})),gc=[[[".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 gc)if(!(s.length<a.length)&&s.slice(-a.length).join("/")===a.join("/"))return i;return null}const bt=e=>n("ui.settings.integrations.integration_model.tool_count",{count:e}),mc=e=>n("ui.settings.integrations.integration_model.integration_count",{count:e}),_c=["connected","needs_sign_in","not_started","connecting","error"],Ms=e=>_c.includes(e),Je=(e,s)=>[...s].filter(a=>a.name===e&&a.status==="running").sort((a,i)=>i.created_at-a.created_at)[0]??null,pc={connectedAt:null,connectedToolCount:null,settledGroup:null,pinnedGroup:null,pinnedOperationId:null,needsKey:!1,needsSignIn:!1,disconnectedAt:null,holdUntil:null,lastDecisive:null},hc=1e12,fc=1e9,xc=60*60*1e3,Cs=(e,s=Date.now())=>{if(typeof e!="number"||!Number.isFinite(e))return null;const a=e>=hc?e:e<fc?null:e*1e3;return a===null||a>s+xc?null:Math.min(a,s)},Ge=(e,s)=>e?.[s]??pc,ct=(e,s,a)=>bc(e,s)??a?.lastDecisive??null,yc=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}:{}}),mn=(e,s)=>e.status==="not_started"&&typeof e.tool_count=="number"&&(s.connectedAt!==null||e.status_basis==="stored"&&e.tool_count_basis==="last_seen"),vc=(e,s)=>[...s].filter(a=>a.name===e).sort((a,i)=>i.created_at-a.created_at)[0]??null,bc=(e,s)=>vc(e,s.filter(a=>a.status!=="cancelled")),Mt=e=>e.actions.includes("set_key")||e.actions.includes("add_key");function kc(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 jc(e,s=[],a,i=Date.now()){const o=Ge(a,e.name),l=Je(e.name,s);if(l){if(l.action==="login"||l.action==="reauth")return{label:n("ui.settings.integrations.integration_model.signing_in"),tone:"info",detail:null,busy:!0};if(l.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=ct(e.name,s,o),g=Ct(d)&&e.status!=="connected",c=mn(e,o),u=hn(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(bt(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"||it(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(it(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"||it(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 h=o.connectedAt??Cs(e.last_seen_at,i);return{label:h!==null?n("ui.settings.integrations.integration_model.worked_when_with_tools",{when:String(kc(i,h)),tools:String(bt(e.tool_count))}):n("ui.settings.integrations.integration_model.worked_earlier_with_tools",{tools:String(bt(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}),wc=/[,;]?\s*(?:or|and)?\s*add (?:its|a|the) key instead\.?\s*$/i;function Nc(e,s){const a=e?.trim()??"";if(!a)return null;if(s)return a;const i=a.replace(wc,"").trim();return i?/\.$/.test(i)?i:`${i}.`:a}const Sc="ui.settings.integrations.integration_model.copy_ready_explanation",Mc="ui.settings.integrations.integration_model.copy_not_connected_explanation",Cc=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 Ac(e,s){const a=[Cc(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(bt(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 _n=(e,s)=>s.disconnectedAt!==null?"not_started":e.status;function pn(e,s=[],a){const i=Ge(a,e.name),o=Je(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 l=y=>e.actions.includes(y),d=Mt(e),g=it(e,s,i);if(!Ms(e.status))return l("test")?{kind:"test",label:n("ui.settings.integrations.integration_model.check_again")}:null;const c=ct(e.name,s,i),u=c?.status==="failed"&&dt(c);switch(_n(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")}:l("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")}:l("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 l("connect")?{kind:"connect",label:n("ui.settings.integrations.integration_model.reconnect")}:l("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)&&l("sign_in"))return{kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")};if(hn(c)&&l("sign_out"))return{kind:"sign_out",label:n("ui.settings.integrations.integration_model.sign_out_again")};if(i.disconnectedAt!==null&&l("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(l("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&&l("sign_in")?{kind:"sign_in",label:n("ui.settings.integrations.integration_model.try_again")}:mn(e,i)&&!l("connect")?null:l("connect")?{kind:"connect",label:n("ui.settings.integrations.integration_model.connect"),...i.connectedAt===null&&e.status_basis!=="live"?{variant:"ghost"}:{}}:l("test")&&e.tool_count===null&&e.tool_count_basis===null?{kind:"test",label:n("ui.settings.integrations.integration_model.test"),variant:"ghost"}:null}}}const dt=e=>e.action==="login"||e.action==="reauth",Ct=e=>!!(e&&e.action==="logout"&&e.status==="complete"),hn=e=>!!(e&&e.action==="logout"&&e.status!=="running"&&e.status!=="complete"),Is=/no oauth authorization server/i;function it(e,s,a){if(!Mt(e))return!1;const i=ct(e.name,s,a);return i&&dt(i)&&i.status==="failed"&&Is.test(i.message??"")?!0:a.needsKey}function Ec(e,s=[],a){const i=pn(e,s,a)?.kind,o=_n(e,Ge(a,e.name)),l=c=>e.actions.includes(c),d=[],g=Je(e.name,s);if(g&&d.push({kind:"cancel",label:n("ui.settings.integrations.integration_model.cancel")}),!g&&l("test")&&i!=="test"&&d.push({kind:"test",label:n("ui.settings.integrations.integration_model.test_connection")}),l("connect")&&i!=="connect"&&o!=="connected"&&d.push({kind:"connect",label:n("ui.settings.integrations.integration_model.reconnect")}),!g&&l("sign_in")&&i!=="sign_in"&&o!=="connected"&&d.push({kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")}),l("reload")&&d.push({kind:"reload",label:n("ui.settings.integrations.integration_model.reload")}),!g&&l("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")}),l("sign_out")&&d.push({kind:"sign_out",label:n("ui.settings.integrations.integration_model.sign_out")}),l("disconnect")&&o==="connected"&&d.push({kind:"disconnect",label:n("ui.settings.integrations.integration_model.disconnect")}),l("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")}),l("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 Ic={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=Ge(a,e.name),o=Je(e.name,s),l=_n(e,i);if(o&&i.pinnedGroup&&i.pinnedOperationId===o.id)return i.pinnedGroup;if(l==="needs_sign_in"||l==="error")return"attention";const d=ct(e.name,s,i);return Ct(d)&&l!=="connected"||hn(d)&&l!=="connected"?"attention":i.disconnectedAt!==null?"ready":it(e,s,i)||i.needsSignIn&&l!=="connected"||d?.status==="failed"&&dt(d)&&l!=="connected"?"attention":l==="connected"||e.status_basis==="stored"&&mn(e,i)?"connected":o&&o.action!=="test"?"attention":"ready"}function Rc(e,s=[],a){return["attention","connected","ready"].map(o=>({id:o,title:Ic[o],rows:e.filter(l=>Rs(l,s,a)===o)})).filter(o=>o.rows.length>0)}function Tc(e,s,a=Date.now()){if(!s)return e??{};const i={};for(const o of s.servers){const l=Ge(e,o.name),d=Je(o.name,s.operations),g=ct(o.name,s.operations,l),c=Ct(g),u=o.status==="connected"&&(o.status_basis==="probe"||o.status_basis==="live"),y=l.holdUntil!==null&&a<l.holdUntil,h=!y&&!c&&l.connectedAt===null&&o.status_basis==="stored"&&o.tool_count_basis==="last_seen"?Cs(o.last_seen_at,a):null,f=!c,_=g?.status==="failed"&&dt(g)&&Is.test(g.message??""),x={connectedAt:u&&!y?a:h!==null?h:f?l.connectedAt:null,connectedToolCount:u&&!y||h!==null?o.tool_count??l.connectedToolCount:f?l.connectedToolCount:null,settledGroup:l.settledGroup,pinnedGroup:d&&l.pinnedOperationId===d.id?l.pinnedGroup:d?l.settledGroup:null,pinnedOperationId:d?d.id:null,needsKey:u?!1:l.needsKey||_,needsSignIn:u||c?!1:l.needsSignIn||o.status==="needs_sign_in",disconnectedAt:u&&!y?null:l.disconnectedAt,holdUntil:y?l.holdUntil:null,lastDecisive:g?yc(g):null};d||(x.settledGroup=Rs(o,s.operations,{...i,[o.name]:x})),i[o.name]=x}return i}const Lc=(e,s)=>e!==null&&s===e,Zt="local-operator.settings.integrations.row-memory",Ts=(e,s)=>`${e}#${s}`;function Oc(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 Fc(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 l=$c(a[Ts(o.source.path,o.name)]);l&&(i=i??{...e},i[o.name]=l)}return i??e}const Dc=["attention","connected","ready"],Ls=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),fn=e=>typeof e=="number"&&Number.isFinite(e)?e:null,zn=e=>Dc.includes(e)?e:null,Ot=e=>{const s=fn(e);return s!==null&&s>=1e12?s:null};function zc(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:fn(e.created_at)??0,credential_removed:e.credential_removed===!0,...typeof e.message=="string"?{message:e.message}:{}}}function $c(e){if(!Ls(e))return null;const s=Ot(e.connectedAt),a=Ot(e.disconnectedAt),i=e.needsKey===!0,o=e.needsSignIn===!0,l=zc(e.lastDecisive);return s===null&&a===null&&!i&&!o&&!l?null:{connectedAt:s,connectedToolCount:fn(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:l}}const Os=2e3,$n=8e3;function Pc(e){return e&&(e.servers.some(a=>a.status==="connecting")||e.operations.some(a=>a.status==="running"))?Os:!1}const Kc=/^[A-Za-z0-9_.:-]{1,100}$/,Uc=/:\/\//;function Bc(e,s){const a=e.trim();return a?Kc.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 Vc(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"):Uc.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 Hc=e=>e.split(`
287
- `).map(s=>s.trim()).filter(Boolean);function Jt(e,s){const a=!!e?.cold,i=(e?.servers??[]).map(o=>{const l=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"),l&&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:qc(o.source,u,o.owned_scope),path:o.source??"",editable:o.owned_scope!==null,owned_scope:o.owned_scope},transport:l?"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":l?"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 qc=(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")}},Gc="ui.settings.integrations.integration_model.copy_catalog_refusal_fallback";function pt(e,s,a){if(s instanceof on&&s.status===409){const i=typeof s.code=="string"&&Object.prototype.hasOwnProperty.call(Pn,s.code)?Pn[s.code]:n(Gc);return`${za[e]}. ${i}`}return $a(e,s,a).message}const Yc="ui.settings.integrations.add_integration_form.copy_add_integration_pickup_note",Qc="ui.settings.integrations.add_integration_form.copy_transport_hint",Wc=({existingNames:e,projectScopeAvailable:s,projectLabel:a,onSubmit:i,onCancel:o,initial:l})=>{se();const[d,g]=r.useState(l?.name??""),[c,u]=r.useState(l?.mode??"command"),[y,h]=r.useState(l?.command??""),[f,_]=r.useState(l?.args??""),[x,b]=r.useState(l?.url??""),[C,z]=r.useState("global"),[N,R]=r.useState(l?.touched?{name:!0,command:!0,url:!0}:{}),[v,k]=r.useState(!!l?.touched),[w,q]=r.useState(!1),[Q,Z]=r.useState(null),S=r.useRef(null),O=r.useRef(null),L=r.useRef(null);r.useEffect(()=>{S.current?.focus()},[]);const V=Bc(d,e),K=c==="command"&&!y.trim()?n("ui.settings.integrations.add_integration_form.enter_the_command_to_run"):null,G=c==="url"?Vc(x):null,U=A=>v||N[A],ne=async A=>{if(A.preventDefault(),k(!0),V||K||G){V?S.current?.focus():K?O.current?.focus():L.current?.focus();return}q(!0),Z(null);const W=s?C:"global",J=c==="command"?{name:d.trim(),scope:W,mode:c,command:y.trim(),args:Hc(f)}:{name:d.trim(),scope:W,mode:c,url:x.trim()},ee=await i(J);q(!1),Z(ee)},m=(A,W,J)=>W&&U(J)?t.jsx("p",{id:A,className:"text-body-sm text-danger",children:W}):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 ne(A),onKeyDown:A=>{A.key==="Escape"&&(A.stopPropagation(),o())},children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Ae,{htmlFor:"integration-add-name",children:n("ui.settings.integrations.add_integration_form.name")}),t.jsx(Oe,{ref:S,id:"integration-add-name",value:d,placeholder:n("ui.settings.integrations.add_integration_form.e_g_notion"),autoComplete:"off","aria-invalid":!!(V&&U("name")),"aria-describedby":V&&U("name")?"integration-add-name-error":void 0,onChange:A=>g(A.target.value),onBlur:()=>R(A=>({...A,name:!0}))}),m("integration-add-name-error",V,"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(Qc)}),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(Ae,{htmlFor:"integration-add-command",children:n("ui.settings.integrations.add_integration_form.command")}),t.jsx(Oe,{ref:O,id:"integration-add-command",value:y,placeholder:n("ui.settings.integrations.add_integration_form.e_g_npx"),autoComplete:"off",className:"font-mono","aria-invalid":!!(K&&U("command")),"aria-describedby":K&&U("command")?"integration-add-command-error":void 0,onChange:A=>h(A.target.value),onBlur:()=>R(A=>({...A,command:!0}))}),m("integration-add-command-error",K,"command")]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs(Ae,{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(Ae,{htmlFor:"integration-add-url",children:n("ui.settings.integrations.add_integration_form.url")}),t.jsx(Oe,{ref:L,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":!!(G&&U("url")),"aria-describedby":G&&U("url")?"integration-add-url-error":"integration-add-url-help",onChange:A=>b(A.target.value),onBlur:()=>R(A=>({...A,url:!0}))}),m("integration-add-url-error",G,"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:C,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:C==="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,Q?t.jsx("p",{className:"text-body-sm text-danger",role:"alert",children:Q}):null,t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx("p",{className:ue("text-body-sm text-ink-dim"),children:n(Yc)}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(F,{type:"button",variant:"ghost",size:"md",onMouseDown:T,onClick:o,children:n("ui.settings.integrations.add_integration_form.cancel")}),t.jsxs(F,{type:"submit",variant:"primary",size:"md",disabled:w,onMouseDown:T,children:[w?t.jsx(ke,{size:"xs"}):null,n("ui.settings.integrations.add_integration_form.add_integration")]})]})]})]})},Zc=4;function Jc(e){return e.rowMoving?e.now+e.windowMs:Math.max(e.hold.until,e.lastMovingAt+e.windowMs)}function Xc(e){return e.now>e.hold.until||e.hold.reanchors>=Zc?"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 ed(e){const s=Jc({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=Xc({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 l=!a.isConnected;return{hold:{until:l?e.now+e.windowMs:s,reanchors:l?e.hold.reanchors+1:e.hold.reanchors,landedOn:i},land:i}}function td(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 nd(e){return Un(e.primary)?e.primary??null:Un(e.overflow)?e.overflow??null:null}function sd(e){return e.verdict==="finished"?null:e.watchMs}const Fs="key";function ad(e){const{name:s,keyless:a,freeName:i,names:o,values:l,replace:d,canReplace:g}=e;if(a){const c=Xt(s,i);return{values:{[c]:(l[Fs]??"").trim()},confirmedReplace:d&&g?[c]:[],header:i.trim()}}return{values:Object.fromEntries(o.map(c=>[c,(l[c]??"").trim()])),confirmedReplace:d&&g?o:[],header:void 0}}function Xt(e,s){const a=Bn(e),i=Bn(s);if(!i)return"";const o=[a,i].filter(Boolean).join("_"),l=/^[A-Za-z_]/.test(o)?o:`K_${o}`;if(l.length<=Ft)return l;const d=id(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,""),id=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)},od=({name:e,keyNames:s,keyless:a=!1,savedKeys:i=[],saving:o,failure:l,onSave:d,onClose:g})=>{se();const[c,u]=r.useState({}),[y,h]=r.useState(!1),[f,_]=r.useState(""),x=a?[Xt(e,f)]:[...s],b=a?[Fs]:x,C=(a?Xt(e,f).length>0:!0)&&b.every(N=>(c[N]??"").trim()),z=x.some(N=>i.includes(N));return t.jsx(is,{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(Ut,{onClick:g,children:n("ui.settings.integrations.integration_key_dialog.cancel")}),t.jsx(Bt,{disabled:!C||o,onClick:()=>{const N=ad({name:e,keyless:a,freeName:f,names:x,values:c,replace:y,canReplace:z});d(N.values,N.confirmedReplace,N.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(Ae,{htmlFor:"integration-key-name",children:n("ui.settings.integrations.integration_key_dialog.the_header_this_server_wants_the_key_in")}),t.jsx(Oe,{id:"integration-key-name",autoComplete:"off",placeholder:n("ui.settings.integrations.integration_key_dialog.e_g_authorization_or_x_api_key"),value:f,onChange:N=>_(N.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,b.filter(N=>a!==!0||N.trim().length>0).map(N=>t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Ae,{htmlFor:`integration-key-${N}`,className:"font-mono",children:a?"Key":N}),t.jsx(Oe,{id:`integration-key-${N}`,type:"password",autoComplete:"off",value:c[N]??"",onChange:R=>u(v=>({...v,[N]:R.target.value}))})]},N)),z?t.jsxs("div",{className:"flex items-center gap-2 text-body-sm",children:[t.jsx(Gt,{id:"integration-key-replace",checked:y,onCheckedChange:N=>h(N===!0)}),t.jsx(Ae,{htmlFor:"integration-key-replace",className:"font-normal",children:As(x.length)})]}):null,l?t.jsx("p",{className:"-mx-1.5 text-body-sm text-danger",role:"alert",children:l}):null]})})},rd={success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info",neutral:"bg-ink-dim"},ld={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(Sc);if(e===n("ui.settings.integrations.integration_model.not_connected"))return n(Mc)}const cd=({row:e,operations:s,memories:a,now:i,projectScopeAvailable:o,highlighted:l=!1,rowRef:d,primaryRef:g,overflowRef:c,pending:u,failure:y,confirm:h,onPrimary:f,onOverflow:_,onConfirm:x,onCancelConfirm:b})=>{se();const C=jc(e,s,a,i),z=l&&C.tone==="danger"?"text-ink":ld[C.tone],N=pn(e,s,a),R=Ec(e,s,a),v=Ac(e,o),k=R.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",l&&"bg-row-selected"),onKeyDown:w=>{!h||w.key!=="Escape"||(w.stopPropagation(),b())},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:C.busy?t.jsx(ke,{size:"xs"}):t.jsx("span",{"aria-hidden":"true","data-tone":C.tone,className:ue("size-2 rounded-full",rd[C.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:v.map((w,q)=>t.jsxs("span",{children:[q>0?" · ":null,w.startsWith("Imported from")&&e.source.path?t.jsx(Ze,{content:Pa(e.source.path),children:t.jsx("span",{className:"underline decoration-dotted underline-offset-2",children:w})}):w]},w))})]}),Vn(C.label)?t.jsx(Ze,{content:Vn(C.label),children:t.jsx("span",{className:ue("shrink-0 text-body-sm",z),children:C.label})}):t.jsx("span",{className:ue("shrink-0 text-body-sm",z),children:C.label}),N?t.jsxs(F,{ref:g,variant:N.variant??"secondary",size:"sm","aria-label":`${N.label} ${e.name}`,disabled:u,"data-integration-action":N.kind,onClick:()=>f(N),children:[u?t.jsx(ke,{size:"xs"}):null,N.label]}):null,t.jsxs(Li,{children:[t.jsx(Oi,{asChild:!0,children:t.jsx(F,{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(Ka,{"aria-hidden":"true"})})}),t.jsx(Fi,{align:"end",className:"min-w-48",children:R.map((w,q)=>t.jsx(dd,{item:w,separated:q===k&&q>0,onSelect:()=>_(w)},w.kind))})]})]}),C.detail?t.jsx("p",{className:ue("ps-7 text-body-sm",C.tone==="danger"?"text-ink-muted":"text-ink-dim"),children:C.detail}):null,y?t.jsx("p",{className:ue("ps-7 text-body-sm",l?"text-ink":"text-danger"),role:"alert",children:y}):null,h?t.jsxs("div",{className:"flex flex-wrap items-center gap-2 ps-7",children:[t.jsx("span",{className:"text-body-sm text-ink",children:h.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:h.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(F,{variant:"danger",size:"sm",onClick:x,"data-integration-confirm":h.kind,children:h.kind==="remove"?n("ui.settings.integrations.integration_row.remove"):n("ui.settings.integrations.integration_row.sign_out")}),t.jsx(F,{variant:"ghost",size:"sm",onClick:b,children:n("ui.settings.integrations.integration_row.keep")})]}):null]})},dd=({item:e,separated:s,onSelect:a})=>(se(),t.jsxs(t.Fragment,{children:[s?t.jsx(Di,{}):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 ud(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:Nc(s.message,a)??n("ui.settings.integrations.integration_sign_in_dialog.the_server_didn_t_say_why"),nextStep:gd(s.message??null,a)}}function gd(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 md(e,s){return e.kind==="ready"?"ready":e.kind==="running"&&s&&s.tone!=="progress"?s.tone==="success"?"success":"failure":"running"}const _d=({name:e,action:s,keyRoute:a,phase:i,onStart:o,onCancel:l,onOpenLink:d,onClose:g})=>{se();const c=i.kind==="running"?i.operation:null,u=i.kind==="running"?ud(e,c,a):null,y=i.kind==="starting"||i.kind==="running"&&u?.tone==="progress",h=u&&u.tone!=="progress",f=r.useRef(null),_=r.useRef(!1),x=md(i,u);r.useEffect(()=>{if(!_.current){_.current=!0;return}x&&f.current?.focus()},[x]);const b=()=>g(u?.tone==="success"?"signed-in":"dismissed");return t.jsx(is,{open:!0,onClose:b,maxWidth:"xs",fullWidth:!0,title:n("ui.settings.integrations.integration_sign_in_dialog.sign_in_to_name",{name:String(e)}),dialogProps:{onOpenAutoFocus:C=>{C.preventDefault(),f.current?.focus()}},actions:t.jsxs(t.Fragment,{children:[y&&c?t.jsx(Ut,{ref:f,onClick:()=>l(c.id),children:n("ui.settings.integrations.integration_sign_in_dialog.cancel_sign_in")}):t.jsx(Ut,{ref:i.kind==="ready"?void 0:f,onClick:b,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(Bt,{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(Bt,{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(ke,{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:h?"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(ke,{size:"xs",className:"mt-0.5"}):null,u.tone==="failure"?t.jsx(zi,{"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(F,{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(()=>Vt(n("ui.settings.integrations.integration_sign_in_dialog.sign_in_link_copied"))).catch(()=>{})},children:t.jsx(as,{"aria-hidden":"true"})})]}),t.jsx(F,{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]})})},pd=e=>e.reduce((s,a)=>s?(a.updated_at??0)>(s.updated_at??0)?a:s:a,null),hd=/^[A-Za-z]:[\\/]/,kt=e=>{const s=e?.trim();return s&&(s.startsWith("/")||hd.test(s))?s:null};function fd(e){const o=e?.payload?.frontend?.snapshot?.cwd;return typeof o=="string"&&o.trim()?o:null}const rt="local-operator.settings.integrations.last-cwd";function xd(e,s,a=typeof localStorage>"u"?null:localStorage){const i=kt(s);if(!(!e||!i||!a))try{const o=a.getItem(rt),l=o?JSON.parse(o):{};if(l[e]===i)return;a.setItem(rt,JSON.stringify({...l,[e]:i}))}catch{}}const Ds=()=>typeof localStorage>"u"?null:localStorage;function zs(e=Ds()){if(!e)return{};try{const s=e.getItem(Zt);if(!s)return{};const a=JSON.parse(s);return!a||typeof a!="object"||Array.isArray(a)?{}:a}catch{return{}}}const Hn=256;function yd(e,s=Ds()){if(s)try{const a={...zs(s),...e},i=Object.keys(a);if(i.length>Hn){const o={};for(const l of i.slice(-Hn))o[l]=a[l];s.setItem(Zt,JSON.stringify(o));return}s.setItem(Zt,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 vd(e,s=typeof localStorage>"u"?null:localStorage){if(!(!e||!s))try{const a=s.getItem(rt);if(!a)return;const i=JSON.parse(a);if(!(e in i))return;const o={...i};delete o[e],s.setItem(rt,JSON.stringify(o))}catch{}}const bd=e=>!!(e&&typeof e=="object"&&"code"in e&&e.code==="invalid_cwd"),kd=(e,s)=>s!==null&&e===s?null:e;function jd(e,s=typeof localStorage>"u"?null:localStorage){if(!e||!s)return null;try{const a=s.getItem(rt);if(!a)return null;const o=JSON.parse(a)[e];return typeof o=="string"?o:null}catch{return null}}const wd=e=>e.action==="disconnect"?"disconnected":"connected";function Nd(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 Sd(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 Md({sessionId:e}){const s=sn(),a=Pt(s.data,"mcp_catalog"),i=Pt(s.data,"mcp"),o=a?"catalog":i?"session":null,[l,d]=r.useState(null),g=tn(),c=at(M=>M.sessions),u=at(M=>M.fetchSessions),y=at(M=>M.loading),h=r.useMemo(()=>c.find(M=>M.session_id===e)??null,[c,e]),f=r.useMemo(()=>o==="session"&&!e?pd(c):null,[o,e,c]),_=o==="session"?e??f?.session_id??null:null;r.useEffect(()=>{o!=="session"||e||c.length>0||u(Ua)},[o,e,c.length,u]);const x=o==="catalog"?kt(h?.cwd):null,b=o==="catalog"&&!!e&&x===null,C=Ee({queryKey:["desktop","session-cwd",e??""],queryFn:()=>pe({op:"sessions.get",sessionId:e??""}),enabled:b,staleTime:Number.POSITIVE_INFINITY,retry:!1}),z=b&&!C.isFetched,N=x??kt(fd(C.data))??(C.isFetched?kt(jd(e)):null),R=kd(N,l),v=o==="catalog"?R:null,k=o==="catalog"?e??null:null,w=Ba.catalog(v,k);r.useEffect(()=>{o!=="catalog"||!e||!v||xd(e,v)},[o,e,v]);const q=r.useRef(0),[Q,Z]=r.useState(0),S=r.useRef(null),O=r.useCallback((M,B)=>{const Y=Date.now()+$n;q.current=Y,S.current={name:M,expect:B},Z(Y)},[]),L=r.useCallback(M=>Date.now()<q.current?Os:Pc(M),[]),V=Ee({queryKey:w,queryFn:()=>qa(v,k),enabled:o==="catalog"&&!z,staleTime:1e4,refetchInterval:M=>L(M.state.data)}),K=bd(V.error);r.useEffect(()=>{!K||!N||l===N||(d(N),vd(e))},[K,N,l,e]);const G=Ee({queryKey:Ht.list(_??""),queryFn:()=>Ga(_??""),enabled:o==="session"&&!!_,staleTime:1e4,refetchInterval:M=>L(M.state.data?Jt(M.state.data,_??""):void 0)}),U=r.useMemo(()=>{if(o==="catalog")return V.data;if(o==="session"&&G.data&&_)return Jt(G.data,_)},[o,V.data,G.data,_]),ne=r.useCallback(()=>Cd({queryClient:g,route:o,catalogKey:w,sessionId:_}),[o,w,g,_]);r.useEffect(()=>{if(!Q)return;const M=S.current;if(!M)return;const B=U?.servers.find(H=>H.name===M.name);!B||!(M.expect==="connected"?B.status==="connected":B.status_basis==="live"&&B.status!=="connected")||(q.current=0,S.current=null,Z(0))},[U,Q]);const m=r.useRef({}),[T,A]=r.useState(0),W=r.useMemo(()=>(m.current=Tc(Fc(m.current,U,zs()),U),m.current),[U,T]),J=r.useRef("");r.useEffect(()=>{const M=Oc(W,U);if(!Object.keys(M).length)return;const B=JSON.stringify(M);B!==J.current&&(J.current=B,yd(M))},[W,U]);const ee=r.useCallback(M=>{const B=Ge(m.current,M);B.needsKey||(m.current={...m.current,[M]:{...B,needsKey:!0}},A(Y=>Y+1))},[]),$=r.useCallback(M=>{if(M.action!=="disconnect"&&M.action!=="connect"&&M.action!=="reload")return;const B=Ge(m.current,M.name),Y=Date.now()+$n,H=M.action==="disconnect"?{...B,connectedAt:null,disconnectedAt:Date.now(),holdUntil:Y}:{...B,disconnectedAt:null,holdUntil:Y};m.current={...m.current,[M.name]:H},O(M.name,wd(M)),A(ie=>ie+1)},[O]),oe=r.useCallback(async M=>{if(o==="catalog"){const B=Nd(M);if(!B)return null;try{const Y=await Va(v,B);return g.setQueryData(w,Y),$(M),Y.operation?.id??null}catch(Y){throw Y instanceof on&&Y.status===409&&g.invalidateQueries({queryKey:w}),Y}}if(o==="session"&&_){const B=await pe({op:"mcp.control",sessionId:_,control:Sd(M)});$(M);const Y=Ht.list(_),H=B?.data;return H&&"servers"in H&&Array.isArray(H.servers)?(g.setQueryData(Y,H),null):(g.invalidateQueries({queryKey:Y}),H&&"id"in H&&typeof H.id=="string"?H.id:null)}return null},[o,v,w,g,_,$]),ce=r.useCallback(async M=>{if(o==="catalog"&&k&&(M.action==="connect"||M.action==="disconnect"||M.action==="reload")){try{await pe({op:"mcp.control",sessionId:k,control:{action:M.action,name:M.name,...M.action==="disconnect"?{confirmed:!0}:{}}})}catch(B){throw g.invalidateQueries({queryKey:w}),B}return $(M),await g.invalidateQueries({queryKey:w}),null}return oe(M)},[o,k,g,w,oe,$]),Fe=r.useCallback(async(M,B,Y,H)=>{if(o==="catalog"){const ie=await Ha(v,M,B,Y,H);if(ie.catalog&&g.setQueryData(w,ie.catalog),ie.code!=="saved")return{saved:!1,message:qn(ie.code,ie.failed_ids,B)};try{await oe({action:"test",name:M})}catch{}return{saved:!0,message:null}}if(o==="session"&&_){const ie=await pe({op:"mcp.credentials.store",sessionId:_,name:M,values:B,confirmedReplace:Y});if(ie.data?.code!=="saved")return{saved:!1,message:qn(ie.data?.code,ie.data?.failed_ids??[],B)};try{await oe({action:"connect",name:M})}catch{}return{saved:!0,message:null}}return{saved:!1,message:null}},[o,v,w,g,oe,_]),fe=o==="catalog"?V:G,xe=r.useCallback(()=>{fe.refetch()},[fe]);return{enabled:o!==null,route:o,sessionId:o==="catalog"?k:_,borrowed:f,noConversation:o==="session"&&!_&&!y,document:U,isLoading:s.isLoading||o==="catalog"&&(z||V.isLoading)||o==="session"&&(_?G.isLoading:y),isError:fe.isError,folderUnavailable:Lc(l,N),refetch:xe,readDocument:ne,control:ce,storeKeys:Fe,memories:W,markNeedsKey:ee}}function Cd(e){if(e.route==="catalog")return e.queryClient.getQueryData(e.catalogKey);if(e.route==="session"&&e.sessionId){const s=e.queryClient.getQueryData(Ht.list(e.sessionId));return s?Jt(s,e.sessionId):void 0}}const Ad=(e,s)=>{const a=e?.trim();if(!a)return null;const i=Qa(a,s);return i.kind==="auth"?{kind:"matched",name:i.name,unresolved:null}:{kind:"miss",asked:a}},Ed=6,Dt="ui.settings.integrations.mcp_management_section.copy_section_title",Id="ui.settings.integrations.mcp_management_section.copy_section_description",Rd={test:"test",connect:"reconnect",disconnect:"disconnect",reload:"reload",remove:"remove",sign_out:"disconnect",cancel:"cancel",login:"grant",reauth:"grant"},Td=({sessionId:e,sectionRef:s,highlightServer:a})=>{se();const i=Md({sessionId:e}),{document:o,control:l,readDocument:d}=i,g=os(),c=o?.servers??[],u=o?.operations??[],y=o?.project_scope_available??!1,[h,f]=r.useState(!1),[_,x]=r.useState(""),[b,C]=r.useState(null),[z,N]=r.useState({}),[R,v]=r.useState(null),[k,w]=r.useState(null),[q,Q]=r.useState({kind:"ready"}),[Z,S]=r.useState(null),[O,L]=r.useState(null),[V,K]=r.useState(!1),G=r.useRef({}),U=r.useRef({}),ne=r.useRef({}),m=r.useRef(0),T=r.useRef(null),A=r.useRef(null),W=r.useRef(null),[J,ee]=r.useState(null),[$,oe]=r.useState(null),[ce,Fe]=r.useState(null),fe=r.useCallback(()=>{const p=W.current;W.current=null,w(null),S(null),window.setTimeout(()=>{p?.isConnected&&p.focus()},0)},[]),xe=r.useCallback(p=>{const j=window.document.activeElement;W.current=j instanceof HTMLElement?j:null,w(p)},[]),M=r.useCallback((p,j)=>{oe({name:p,waitForSignIn:j==="signed-in",until:Date.now()+st,reanchors:0}),fe()},[fe]),B=r.useMemo(()=>Ad(a,c.map(p=>p.name)),[a,c]),Y=B?.kind==="matched"?B.name:null,H=r.useRef(null),ie=r.useRef(null),Ue=_.trim().toLowerCase(),ye=r.useMemo(()=>Ue?c.filter(p=>p.name.toLowerCase().includes(Ue)):c,[c,Ue]),Xe=Rc(ye,u,i.memories),ve=k?.kind==="sign_in"?c.find(p=>p.name===k.name)??null:null;r.useEffect(()=>{!Y||ie.current===Y||!_||x("")},[Y,_]),r.useEffect(()=>{!Y||ie.current===Y||ye.some(p=>p.name===Y)&&(ie.current=Y,H.current?.scrollIntoView({block:"center",behavior:"smooth"}))},[Y,ye]),r.useEffect(()=>{if(!Z)return;const p=u.find(j=>j.id===Z)??null;Q({kind:"running",operation:p})},[u,Z]);const Be=u.some(p=>p.status==="running"),P=p=>{const j=window.document.activeElement;j&&j!==window.document.body&&j.isConnected||oe({name:p,waitForSignIn:!1,until:Date.now()+st,reanchors:0})},te=async(p,j,E)=>{C(p),N(({[p]:Re,...ze})=>ze);let X=null,Ne=!1;try{X=await E()}catch(Re){Ne=!0,N(ze=>({...ze,[p]:pt(Rd[j]??"status",Re,Be)}))}finally{C(null),j!=="sign_out"&&(j!=="remove"||Ne)&&P(p)}return{operationId:X,failed:Ne}},_e=p=>c.find(j=>j.name===p),de=p=>{p.source.path&&Wa(p.source.path)},Ie=async(p,j)=>{Q({kind:"starting"}),S(null);try{const E=await l({action:j,name:p});E?S(E):Q({kind:"running",operation:null})}catch(E){E instanceof on&&E.code==="oauth_unsupported"&&i.markNeedsKey(p),Q({kind:"refused",message:pt("grant",E,Be)})}},D=(p,j)=>{switch(j.kind){case"sign_in":case"reauth":{const E=u.find(X=>X.name===p.name&&X.status==="running");E&&dt(E)?(Q({kind:"running",operation:E}),S(E.id)):(Q({kind:"ready"}),S(null)),xe({kind:"sign_in",name:p.name,action:j.kind==="reauth"?"reauth":"login"});return}case"set_key":L(null),xe({kind:"key",name:p.name,keyNames:p.auth.secret_refs.map(E=>E.id)});return;case"fix":de(p);return;case"sign_out":v({name:p.name,kind:"sign_out"});return;default:{const E=j.kind;te(p.name,E,()=>l({action:E,name:p.name}))}}},ge=(p,j)=>{switch(j.kind){case"remove":case"sign_out":v({name:p.name,kind:j.kind});return;case"sign_in":case"reauth":case"set_key":D(p,{kind:j.kind,label:j.label});return;case"open_config":de(p);return;case"copy_setup":navigator.clipboard.writeText(p.setup_prompt??"").then(()=>Vt(n("ui.settings.integrations.mcp_management_section.setup_steps_copied_paste_them_into_a_chat"))).catch(()=>{});return;case"cancel":{const E=u.find(X=>X.name===p.name&&X.status==="running");E&&te(p.name,"cancel",()=>l({action:"cancel",operationId:E.id}));return}case"test":case"connect":case"disconnect":case"reload":{const E=j.kind;te(p.name,E,()=>l({action:E,name:p.name}));return}default:return}},re=(p,j)=>{if(v(null),j==="remove"){const E=p.source.owned_scope;if(!E)return;const X=ye.findIndex(Ne=>Ne.name===p.name);te(p.name,"remove",()=>l({action:"remove",name:p.name,scope:E})).then(({operationId:Ne,failed:Re})=>{Re||Ne!==null||(Vt(n("ui.settings.integrations.mcp_management_section.removed_name",{name:String(p.name)})),X>=0&&Fe({index:X}))});return}te(p.name,"sign_out",()=>l({action:"logout",name:p.name})).then(()=>{oe({name:p.name,waitForSignIn:!1,until:Date.now()+st,reanchors:0})})},je=async p=>{try{return await l({action:"add",name:p.name,scope:p.scope,...p.mode==="command"?{command:p.command,args:p.args}:{url:p.url}}),f(!1),ee(p.name),null}catch(j){return pt("add",j,!1)}},Se=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(Id)})]}),i.enabled&&c.length>0&&!h?t.jsxs(F,{ref:T,variant:"secondary",size:"sm",onClick:()=>f(!0),"data-tour-tag":"mcp-add-server",children:[t.jsx(xn,{"aria-hidden":"true"}),n("ui.settings.integrations.mcp_management_section.add_integration")]}):null]});if(!i.enabled&&!i.isLoading)return t.jsx(le,{title:n(Dt),titleComponent:Se,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 he=t.jsx(Wc,{existingNames:c.map(p=>p.name),projectScopeAvailable:y,projectLabel:o?.cwd?Od(o.cwd):null,onSubmit:je,onCancel:()=>{f(!1),window.setTimeout(()=>T.current?.focus(),0)}}),De=k?_e(k.name):void 0,Me=Object.entries(z).filter(([p])=>!c.some(j=>j.name===p)),Ve=p=>N(({[p]:j,...E})=>E);r.useEffect(()=>{if(!J)return;const p=G.current[J];if(!p){c.some(j=>j.name===J)&&(U.current[J]?.focus(),ee(null));return}p.focus(),ee(null)},[J,c]),r.useEffect(()=>{if(!ce)return;const j=ye[Math.min(ce.index,ye.length-1)]??ye.at(-1);if(j){const E=G.current[j.name]??U.current[j.name];if(!E)return;E.focus()}else T.current?.focus();Fe(null)},[ce,ye]);const we=r.useCallback((p,j)=>{const E=d()??o,X=E?.servers.find(Ks=>Ks.name===p.name),Ne=E?.operations??[],Re=X?X.status==="connecting"||Je(X.name,Ne)!==null:!1;Re&&X&&(m.current=j);const ze=X?pn(X,Ne,i.memories):null;if(X&&p.waitForSignIn&&(ze?.kind==="sign_in"||ze?.kind==="reauth"))return"kept";const Te=ed({hold:p,now:j,windowMs:st,rowMoving:Re,lastMovingAt:m.current,candidate:X?nd({primary:ze?G.current[X.name]:null,overflow:U.current[X.name]}):void 0,active:window.document.activeElement,body:window.document.body});if(!Te.hold)return oe(null),"finished";if(!Te.land)return"kept";oe({name:p.name,waitForSignIn:!1,until:Te.hold.until,landedOn:Te.land,reanchors:Te.hold.reanchors});const et=Te.land;return window.setTimeout(()=>{et.isConnected&&et.focus()},0),"landed"},[d,o,i.memories]);return r.useEffect(()=>{if(!$)return;we($,Date.now());let p=0,j=!1;const E=()=>{if(j)return;const X=sd({verdict:we($,Date.now()),watchMs:Kn});X!==null&&(p=window.setTimeout(E,X))};return p=window.setTimeout(E,Kn),()=>{j=!0,window.clearTimeout(p)}},[$,we]),r.useEffect(()=>{if(!$)return;const p=j=>{td({target:j.target,row:ne.current[$.name]})&&oe(null)};return window.document.addEventListener("pointerdown",p,!0),()=>{window.document.removeEventListener("pointerdown",p,!0)}},[$]),t.jsxs(le,{title:n(Dt),titleComponent:Se,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(F,{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(ke,{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(F,{variant:"secondary",size:"sm",onClick:i.refetch,children:n("ui.settings.integrations.mcp_management_section.retry")})]})}):null,Me.map(([p,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(F,{variant:"ghost",size:"sm",onClick:()=>Ve(p),children:n("ui.settings.integrations.mcp_management_section.dismiss")})]})},p)),h&&c.length>0?he:null,c.length>=Ed?t.jsxs("div",{className:"relative",children:[t.jsx(ss,{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 start-3 size-4 -translate-y-1/2 text-ink-dim"}),t.jsx(Oe,{ref:A,value:_,onChange:p=>x(p.target.value),onKeyDown:p=>{p.key!=="Escape"||!_||(p.preventDefault(),x(""))},placeholder:n("ui.settings.integrations.mcp_management_section.search_integrations_placeholder",{integrations:mc(c.length)}),"aria-label":n("ui.settings.integrations.mcp_management_section.search_integrations"),className:"ps-9"})]}):null,B?.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(B.asked)})}):null,B?.kind==="matched"&&B.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(B.name),asked:String(B.unresolved)})}):null,o&&c.length===0&&!i.isLoading?h?he:t.jsxs("div",{className:"flex flex-col items-start gap-3 rounded-lg bg-surface p-6",children:[t.jsx(rs,{"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(F,{variant:"primary",size:"md",onClick:()=>f(!0),"data-tour-tag":"mcp-add-server",children:[t.jsx(xn,{"aria-hidden":"true"}),n("ui.settings.integrations.mcp_management_section.add_integration")]})]}):null,c.length>0&&ye.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(F,{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,Xe.map(p=>t.jsxs("section",{"aria-labelledby":`integrations-group-${p.id}`,className:"flex flex-col gap-1.5",children:[t.jsxs("h3",{id:`integrations-group-${p.id}`,className:"px-1 text-ink-dim text-meta",children:[p.title," · ",p.rows.length]}),t.jsx("ul",{className:"flex flex-col divide-y divide-hairline overflow-hidden rounded-lg bg-surface",children:p.rows.map(j=>t.jsx(cd,{row:j,operations:u,memories:i.memories,projectScopeAvailable:y,highlighted:j.name===Y,rowRef:E=>{ne.current[j.name]=E,j.name===Y&&(H.current=E)},primaryRef:E=>{G.current[j.name]=E},overflowRef:E=>{U.current[j.name]=E},pending:b===j.name,failure:z[j.name]??null,confirm:R?.name===j.name?{kind:R.kind}:null,onPrimary:E=>D(j,E),onOverflow:E=>ge(j,E),onConfirm:()=>R&&re(j,R.kind),onCancelConfirm:()=>{v(null),window.setTimeout(()=>{U.current[j.name]?.focus()},0)}},j.id))})]},p.id))]}),k?.kind==="sign_in"?t.jsx(_d,{name:k.name,action:k.action,keyRoute:ve?Mt(ve):!1,phase:q,onStart:()=>void Ie(k.name,k.action),onCancel:p=>void l({action:"cancel",operationId:p}).catch(()=>{}),onOpenLink:p=>void Ya(p),onClose:p=>M(k.name,p)}):null,k?.kind==="key"?t.jsx(od,{name:k.name,keyNames:k.keyNames.length?k.keyNames:De?.auth.secret_refs.map(p=>p.id)??[],keyless:k.keyNames.length===0,savedKeys:De?.auth.secret_refs.filter(p=>p.state==="encrypted").map(p=>p.id),saving:V,failure:O,onClose:fe,onSave:(p,j,E)=>{K(!0),L(null),i.storeKeys(k.name,p,j,E).then(X=>{if(!X.saved){L(X.message);return}w(null),oe({name:k.name,waitForSignIn:!1,until:Date.now()+st,reanchors:0})}).catch(X=>L(pt("key",X,!1))).finally(()=>K(!1))}}):null]})},st=4e3,Ld=/^\/(?:Users|home)\/[^/]+(?=\/|$)/,Od=e=>e.replace(Ld,"~"),Fd=({verification:e})=>{se();const{prices:s}=Ja(),a=e.grant_amount??s?.default_new_credits,{sentence:i,action:o}=Xa(e.signup_grant,ei(a)),l=ti(e.claim_url,ni);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(F,{variant:"secondary",size:"sm",onClick:()=>si(l),children:o})]})]})},Dd=({onAfterCredentialUpdate:e})=>{se();const{isAuthenticated:s,user:a,isLoading:i,accountRead:o,signOut:l}=Za(),d=ls(h=>h.isSigningOut),g=r.useCallback(async()=>{try{await l()}catch(h){console.error("Error signing out:",h)}},[l]),c=(()=>{if(!s||!a?.radientUser)return null;const{account:h,identity:f,verification:_}=a.radientUser,x=_!=null&&!_.email_verified&&_.signup_grant!=="claimed";return t.jsxs(t.Fragment,{children:[t.jsxs(lt,{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(ot,{variant:"success",className:"capitalize",children:h.status})]})}),t.jsx(me,{label:n("ui.settings.account.radient_account_section.name"),value:h.name||n("ui.settings.account.radient_account_section.not_provided")}),t.jsx(me,{label:n("ui.settings.account.radient_account_section.email"),value:h.email}),t.jsx(me,{label:n("ui.settings.account.radient_account_section.account_id"),value:t.jsx("span",{className:"text-mono-sm",children:h.id})}),t.jsx(me,{label:n("ui.settings.account.radient_account_section.tenant_id"),value:t.jsx("span",{className:"text-mono-sm",children:h.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:cs(h.created_at)})]}),x&&_?t.jsx(Fd,{verification:_}):null,t.jsx("div",{className:"mt-8",children:t.jsx(Js,{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(F,{variant:"danger",className:"mt-3",onClick:g,children:[t.jsx(Xs,{}),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"):ds(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(Ui,{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(ke,{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 zd({metric:e,data:s}){return se(),t.jsx(ai,{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)}`:ii(a),children:t.jsx(il,{data:s,children:t.jsx(ts,{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 $d={all:["desktop","tts-path-resolution"]};function Pd(e){return Ee({queryKey:$d.all,queryFn:()=>pe({op:"tts.paths"}),enabled:e,staleTime:Number.POSITIVE_INFINITY,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:oi})}const Kd=["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 Kd){const l=s.get(o);l?a.push(l):i.push(o)}return{rows:a,missing:i}}const Ud=["provider_tts_radient","provider_tts_elevenlabs","provider_tts_openai","none"];function Yn(e){return typeof e=="string"&&Ud.includes(e)}function Bd(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 Vd={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 Vd[e]}function Hd(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 qd="ui.settings.speech.speech_section.copy_backend_older_sentence",Ps="ui.settings.speech.speech_section.copy_unavailable_sentence",Gd=({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(F,{variant:"secondary",onClick:e,children:[t.jsx(Pi,{"aria-hidden":"true"}),n("ui.settings.speech.speech_section.try_again")]})]})}));function Yd(e){return e==="enabled"?"ready":e==="below-version"?"older":"pairing"}const Qd=({sectionRef:e})=>{se();const s=sn(),a=us(),i=ri(s.data,"tts"),o=Yd(i),l=Ee({queryKey:Kt.all,queryFn:()=>pe({op:"settings.list"}),enabled:o==="ready",staleTime:1e4}),d=Pd(o==="ready"),{hasRadientApiKey:g,hasRadientSession:c,speechBlock:u}=li(),y=`${c}:${g}`,h=r.useRef(y),f=d.refetch;r.useEffect(()=>{h.current!==y&&(h.current=y,f())},[y,f]);const _=l.data,x=r.useMemo(()=>Gn(_?.settings??[]),[_]),[b,C]=r.useState({}),[z,N]=r.useState({}),[R,v]=r.useState({});r.useEffect(()=>{_&&C(m=>{let T=!1;const A={...m};for(const W of Gn(_.settings).rows){const J=m[W.key];if(J&&J.value!==tt(W).value)continue;const ee=tt(W);J&&J.value===ee.value&&J.cascadeBase===ee.cascadeBase||(A[W.key]=ee,T=!0)}return T?A:m})},[_]);const k=(m,T)=>N(A=>({...A,[m]:T})),w=(m,T)=>v(A=>({...A,[m]:T})),q=async m=>{const T=b[m.key];if(!T)return;const A=ui(m,T);if(!A.ok){w(m.key,A.error);return}k(m.key,!0),w(m.key,null);try{await pe(A.request),k(m.key,!1);const J=(await l.refetch()).data?.settings.find(ee=>ee.key===m.key);J&&C(ee=>{const $=ee[m.key];return $&&$.value===T.value&&$.cascadeBase===T.cascadeBase?{...ee,[m.key]:tt(J)}:ee})}catch(W){k(m.key,!1),w(m.key,W instanceof Error?W.message:n("ui.settings.speech.speech_section.the_setting_could_not_be_saved"))}},Q=async m=>{k(m.key,!0),w(m.key,null);try{await pe({op:"settings.reset",key:m.key}),C(T=>({...T,[m.key]:tt({...m,value:m.default,is_default:!0})})),k(m.key,!1),await l.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"))}},Z=r.useMemo(()=>Bd(d.data),[d.data]),S=Z?Hd(Z):null,O=d.isSuccess&&Z===null,L=(s.data?null:s.error)??null,V=l.error,K=n("ui.settings.speech.speech_section.speech_voicing"),G=n("ui.settings.speech.speech_section.how_the_assistant_sounds_when_it_speaks_aloud");if(o==="pairing"){const{sentence:m}=qt(a??null,n("ui.settings.speech.speech_section.speech_settings_could_not_be_loaded"),L);return t.jsx(le,{title:K,icon:ut,description:G,sectionRef:e,children:t.jsx(ae,{variant:"warning",children:m})})}if(o==="older")return t.jsx(le,{title:K,icon:ut,description:G,sectionRef:e,children:t.jsx(ae,{variant:"warning",children:n(qd)})});if(V||!_){const{sentence:m,remedy:T}=qt(a??null,n("ui.settings.speech.speech_section.speech_settings_could_not_be_loaded"),V);return t.jsx(le,{title:K,icon:ut,description:G,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(F,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{l.refetch()},children:n("ui.settings.speech.speech_section.retry")})]})})})}const U=S?!S.servable:u==="offline",ne=S?S.rungs.find(m=>m.path===S.serving)??null:null;return t.jsx(le,{title:K,icon:ut,description:G,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(ke,{}),jn("checking")]}),(d.isError||O)&&!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(F,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{d.refetch()},children:n("ui.settings.speech.speech_section.retry")})]})}),t.jsx($i,{fallbackRender:Gd,resetKeys:[d.dataUpdatedAt],children:S&&t.jsxs(t.Fragment,{children:[t.jsxs(lt,{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!==ne?.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))})]})})]}),U&&t.jsx(ae,{variant:"warning",children:jn(u)}),t.jsx("div",{className:"flex flex-col gap-1",children:x.rows.map(m=>t.jsx(ci,{setting:m,draft:b[m.key]??tt(m),tier:di(m),saving:!!z[m.key],error:R[m.key]??null,onDraftChange:T=>C(A=>({...A,[m.key]:T})),onSave:()=>{q(m)},onReset:()=>{Q(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}=nl(),o=sl(),[l,d]=r.useState(""),[g,c]=r.useState(!1);r.useEffect(()=>{d(e?.content??""),c(!1)},[e]);const u=x=>{const b=x.target.value;d(b),c(b!==(e?.content??""))},y=async()=>{if(!(!g||o.isPending))try{const x={content:l};await o.mutateAsync(x),await i(),c(!1)}catch(x){console.error("Error updating system prompt:",x)}},h=()=>{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(Ae,{htmlFor:"app-system-prompt",children:n("ui.settings.model.system_prompt.instructions")}),t.jsx(ps,{id:"app-system-prompt",name:"systemPrompt",value:l,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(F,{variant:"primary",onClick:y,disabled:!g||f,children:[f?t.jsx(ke,{size:"sm"}):t.jsx(Jn,{}),f?n("ui.settings.model.system_prompt.saving"):n("ui.settings.model.system_prompt.save_changes")]}),t.jsx(F,{onClick:h,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:an(e.last_modified)})]})]});return t.jsx(le,{title:n("ui.settings.model.system_prompt.system_prompt"),icon:Bi,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(ke,{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")})}):_()})},Zd=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"],Jd=e=>Zd.includes(e),Xd=e=>{const s=[];let a=0;for(const i of e){const o=Math.max(0,Math.floor(i.count)),l=Math.max(1,Math.floor(i.columns));for(let d=0;d<o;d+=l)s.push({start:a+d,count:Math.min(l,o-d)});a+=o}return s},eu=({index:e,key:s,groups:a})=>{const i=Xd(a),o=i.reduce((l,d)=>l+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 l=i.findIndex(c=>e>=c.start&&e<c.start+c.count),d=i[l+(s==="ArrowDown"?1:-1)];if(!d)return e;const g=e-i[l].start;return d.start+Math.min(g,d.count-1)}default:return e}},tu={localOperatorDark:gr,localOperatorLight:Rr,dracula:wr,dune:Po,sage:ar,monokai:ta,tokyoNight:hr,iceberg:Sr,radient:Jo,neon:mi,obsidian:hs,synth:eo,catppuccinMocha:No,catppuccinLatte:lr,tokyoNightStorm:fo,gruvbox:lo,nord:el,oneDark:Ji,solarizedDark:Er,rosePine:Vo,rosePineMoon:dr,rosePineDawn:jo,alucard:qo,gruvboxLight:Ro,tokyoNightDay:_r,oneLight:or,catppuccinFrappe:Eo,catppuccinMacchiato:er,palenight:gi,everforest:qr,everforestLight:Vr,kanagawaWave:Wr,kanagawaLotus:Uo,ayuDark:Lo,ayuMirage:Fo,ayuLight:vr,nightfox:yo,duskfox:Fr,synthwave:xr,matrix:no,tron:po,cyberpunk:ea,vaporwave:Ur,outrun:oo,neonNoir:Yr,arcade:nr,forest:Pr,ocean:zo,desert:zr,autumn:Jr,lavender:Cr,arctic:bo,rosewood:Wo,solarizedLight:Lr,githubLight:Yo,paper:Vi,linen:kr,highContrastLight:Wi,mintLight:ao},Qn="bg-[color-mix(in_srgb,var(--color-accent)_8%,var(--color-accent-wash))]",nu=({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"})]})]})]}),su=({id:e,name:s,description:a,isSelected:i,isTabStop:o,onSelect:l,onFocusTile:d})=>{const g=tu[e];return t.jsx(Ze,{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:l,className:ue("relative flex flex-col gap-1.5 rounded-md p-1 text-start transition-colors duration-fast ease-out-quart",i?Qn:"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(nu,{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",Qn),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})]})]})})},au=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)}}),iu=()=>{se();const{themeName:e,setTheme:s}=Ke(),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,l]=r.useState(null),d=r.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(!Jd(c.key))return;const u=[...c.currentTarget.querySelectorAll("[data-theme-tile]")],y=u.indexOf(c.target);if(y<0)return;c.preventDefault();const h=eu({index:y,key:c.key,groups:au(c.currentTarget)});h!==y&&u[h]?.focus()};return t.jsx(Ki,{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:h})=>t.jsx(su,{id:u,name:y,description:h,isSelected:u===e,isTabStop:u===d,onSelect:()=>s(u),onFocusTile:()=>l(u)},u))})]},c.label))})})},ou=({value:e,onChange:s})=>{se();const a=r.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(gs(i)),children:t.jsx(wt,{"aria-labelledby":a,children:Ei.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))})})})]})},ru=()=>{se();const{data:e,isLoading:s,error:a}=rl({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(Co,{size:16,className:"shrink-0 text-ink-dim"}),n("ui.settings.account.settings_page.radient_pass")]}),s&&t.jsx(be,{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(F,{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(mo,{}),n("ui.settings.account.settings_page.add_credits")]})})]})]})},lu=[{id:"credits",get label(){return n("ui.settings.account.settings_page.credits")}},{id:"tokens",get label(){return n("ui.settings.account.settings_page.tokens")}}],cu=()=>{se();const[e,s]=r.useState("credits"),a=r.useMemo(()=>{const g=new Date,c=al(g);return{start_date:Mn(c),end_date:Mn(g),rollup:"daily"}},[]),{data:i,isLoading:o,error:l}=cl(a,{enabled:!0}),d=r.useMemo(()=>i?.data_points?[...i.data_points].sort((c,u)=>At(c.timestamp).getTime()-At(u.timestamp).getTime()).map(c=>({bucket:ji(Gi(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(uo,{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:lu.map(({id:g,label:c})=>t.jsx(F,{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(be,{className:"h-62 w-full"}),l&&t.jsx(ae,{variant:"warning",children:n("ui.settings.account.settings_page.usage_load_failed",{reason:l.message})}),!o&&!l&&i&&d.length>0&&t.jsx(zd,{metric:e,data:d}),!o&&!l&&(!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")})]})},du=()=>(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(_a,{size:16,className:"shrink-0 text-ink-dim"}),n("ui.settings.account.settings_page.radient_account")]}),t.jsx(F,{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(wi,{})]})})]})),wu=()=>{se();const e=_i("surface"),s=pi(),a=Ke(D=>D.showAgentReasoning),i=Ke(D=>D.setShowAgentReasoning),o=Ke(D=>D.transcriptDisplayMode),l=Ke(D=>D.setTranscriptDisplayMode),{data:d,isLoading:g,isFetching:c,error:u,refetch:y}=hi(),{needsProvider:h}=fi(),f=us(),{sentence:_,remedy:x}=qt(f??null,n("ui.settings.navigation.settings_page.your_settings_could_not_be_loaded"),u),b=na(),[C,z]=r.useState(null),N=ls(),{isAuthenticated:R,accountRead:v,isFetching:k,isRefreshing:w,refreshUser:q}=nn(),Q=at(D=>D.activeSessionId),Z=at(D=>D.sessions),S=Ol(),{accountId:O,snapshot:L,model:V}=Zn(),K=r.useRef(null);L.status?K.current={accountId:O,status:L.status}:L.checking||(K.current=null);const G=L.status??(K.current?.accountId===O?K.current.status:null),U=hl(S),ne=r.useMemo(()=>sa.filter(D=>D.id!=="agent-messages"||S!=="absent"),[S]),m=r.useCallback(()=>V.check("surface_open",!0),[V]),[T,A]=r.useState("general"),[W,J]=r.useState(!1),ee=r.useRef(null),$=r.useRef(null),{startTour:oe}=aa(),ce=xi(),Fe=os(),{data:fe,refetch:xe}=yi(),{refreshModels:M}=vi(),B=r.useMemo(()=>fe?.keys?[...fe.keys].sort():[],[fe?.keys]),Y=r.useRef({keys:"",hosting:void 0});r.useEffect(()=>{const D=B.join(","),ge=d?.values?.hosting;(Y.current.keys!==D||Y.current.hosting!==ge)&&(Y.current={keys:D,hosting:ge},M().catch(re=>{console.error("Failed to refresh models after credentials or hosting change:",re)}))},[B,d?.values?.hosting,M]);const H=r.useRef({general:r.useRef(null),radient:r.useRef(null),integrations:r.useRef(null),appearance:r.useRef(null),speech:r.useRef(null),keyboard:r.useRef(null),providers:r.useRef(null),"agent-messages":r.useRef(null),backend:r.useRef(null),imports:r.useRef(null),updates:r.useRef(null)}).current,ie=r.useMemo(()=>new URLSearchParams(ce.search).get("setting"),[ce.search]),Ue=r.useMemo(()=>new URLSearchParams(ce.search).get("filter")??"",[ce.search]),ye=r.useMemo(()=>new URLSearchParams(ce.search).get("mcp")??void 0,[ce.search]),Xe=r.useMemo(()=>new URLSearchParams(ce.search).get("provider"),[ce.search]),ve=r.useCallback(D=>{A(D),J(!0);const ge=H[D],re=$.current;if(ge?.current&&re){const Se=ge.current.getBoundingClientRect().top-re.getBoundingClientRect().top;re.scrollHeight>re.clientHeight?re.scrollTo({top:Math.max(0,re.scrollTop+Se-80),behavior:"smooth"}):window.scrollTo({top:Math.max(0,ge.current.getBoundingClientRect().top+window.scrollY-80),behavior:"smooth"}),clearTimeout(ee.current??void 0),ee.current=setTimeout(()=>{J(!1),ee.current=null},800)}else J(!1)},[H]);r.useEffect(()=>{const D=setTimeout(()=>{const ge=$.current;if(!ge)return;const re=()=>{if(W)return;const je=ge.getBoundingClientRect(),Se=je.height;let he="",De=0;for(const[Me,Ve]of Object.entries(H))if(Ve.current){const we=Ve.current.getBoundingClientRect(),p=je.top,j=we.top-p,E=we.bottom-p,X=we.height,Ne=Math.max(0,j),Re=Math.min(Se,E),Te=Math.max(0,Re-Ne)/X,et=Te+(j<Se*.3?.1:0);et>De&&Te>.1&&(De=et,he=Me)}he&&he!==T&&A(he)};return re(),ge.addEventListener("scroll",re,{passive:!0}),()=>{ge.removeEventListener("scroll",re),clearTimeout(ee.current??void 0)}},100);return()=>clearTimeout(D)},[H,T,W]),r.useEffect(()=>{const D=new URLSearchParams(ce.search),ge=D.get("section"),re=D.get("setting"),je=re?wn(re,"backend"):ge;if(je==="agent-messages"&&!U)return;const Se=je?H[je]:void 0;if(!je||!Se)return;let he=!1,De=Number.NaN,Me=0;const Ve=window.setTimeout(()=>{he||(he=!0,p.disconnect(),ve(je))},2e3),we=()=>{if(he)return;const j=Se.current;if(!j){Me=requestAnimationFrame(we);return}const E=Math.round(j.getBoundingClientRect().top+window.scrollY);if(E===De&&E>0){he=!0,p.disconnect(),window.clearTimeout(Ve),ve(je);return}De=E,Me=requestAnimationFrame(we)},p=new ResizeObserver(()=>{he||(cancelAnimationFrame(Me),Me=requestAnimationFrame(we))});return $.current&&p.observe($.current),Me=requestAnimationFrame(we),()=>{he=!0,cancelAnimationFrame(Me),p.disconnect(),window.clearTimeout(Ve)}},[ce.search,H,ve,U]);const Be=async(D,ge)=>{z(D);try{await b.mutateAsync({[D]:ge}),await y()}catch(re){console.error(`Error updating ${D}:`,re)}finally{z(null)}},P=g,te=v==="checking",_e=ds(v),de=v==="ready"||v==="checking"||k,Ie=Wn(P,4e3);return u?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:_}),x&&t.jsx(F,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>void y(),disabled:c,children:c?n("ui.settings.navigation.settings_page.retrying"):n("ui.settings.navigation.settings_page.retry")})]})})}):P?t.jsxs("div",{role:"status",className:"flex h-full w-full flex-col items-center justify-center gap-3 bg-canvas",children:[t.jsx(ke,{size:"lg",label:Ie?void 0:n("ui.settings.navigation.settings_page.loading_settings")}),Ie&&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")})]}):d?t.jsxs("div",{"data-glass-region":"canvas","data-glass-split":"",className:"flex h-full w-full overflow-hidden bg-canvas",children:[t.jsx("div",{ref:e,className:"w-12 shrink-0 overflow-y-auto min-[1040px]:w-55",children:t.jsx(ia,{activeSection:T,onSelectSection:ve,sections:ne})}),t.jsx("div",{ref:$,"data-settings-content":!0,"data-glass-region":"canvas-content","data-tour-tag":"settings-general-section",className:"flex-1 overflow-y-auto overflow-x-hidden p-4 sm:p-6 md:p-8",children:t.jsxs("div",{className:"mx-auto flex w-full max-w-4xl flex-col gap-8 pb-8",children:[t.jsx(Ii,{title:n("ui.settings.page.title"),icon:yn}),t.jsxs("div",{className:"flex flex-col gap-8",children:[t.jsxs("div",{ref:H.general,className:"flex flex-col gap-8",children:[t.jsx(oa,{focus:ie===Bs}),t.jsxs(le,{title:n("ui.settings.profile.title"),icon:ra,description:n(R?"ui.settings.profile.description_authenticated":"ui.settings.profile.description_anonymous"),children:[te&&t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.profile.account_checking")}),_e&&t.jsx(ae,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:n(v==="refused"?"ui.settings.profile.account_read_failed_refused":"ui.settings.profile.account_read_failed_retry")}),t.jsx(F,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>q(),disabled:w,children:w?n("ui.settings.profile.retrying"):n("ui.settings.profile.retry")})]})}),t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(vn,{value:N.profile.name,label:n("ui.settings.profile.display_name.label"),placeholder:n("ui.settings.profile.display_name.placeholder"),isSaving:C==="user_name",onSave:async D=>{z("user_name");try{N.updateName(D)}finally{z(null)}},readOnly:de}),t.jsx(vn,{value:N.profile.email,label:n("ui.settings.profile.email.label"),placeholder:n("ui.settings.profile.email.placeholder"),isSaving:C==="user_email",onSave:async D=>{z("user_email");try{N.updateEmail(D)}finally{z(null)}},readOnly:de})]})]}),t.jsx(le,{title:n("ui.settings.tour.title"),description:n("ui.settings.tour.description"),children:t.jsxs(F,{variant:"secondary",onClick:()=>{oe({forceModalCompleted:!0})},children:[t.jsx(bi,{}),n("ui.settings.tour.action")]})}),t.jsx(le,{id:"model-settings",title:n("ui.settings.model.settings_page.model_settings"),icon:la,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(ca,{value:d.values.hosting,isSaving:C==="hosting",onSave:D=>Be("hosting",D),filterByCredentials:!0,allowCustom:!0,allowDefault:!1,emptyHelperText:n("ui.settings.model.settings_page.no_hosting_options")}),t.jsx(da,{value:d.values.model_name,hostingId:d.values.hosting,isSaving:C==="model_name",onSave:D=>Be("model_name",D),allowCustom:!0,allowDefault:!1}),t.jsx(Bl,{hosting:d.values.hosting,modelName:d.values.model_name,focus:ie===ht}),h&&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:()=>{ve("providers"),H.providers.current?.focus({preventScroll:!0})},children:n("ui.settings.model.provider_callout.providers_link")}),"."]})})]})}),t.jsx(Wd,{}),t.jsx(le,{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(lt,{children:[t.jsx(me,{label:n("ui.settings.configuration.settings_page.version"),value:t.jsx("span",{className:"text-mono-sm",children:d.version})}),t.jsx(me,{label:n("ui.settings.configuration.settings_page.created"),value:cs(d.metadata.created_at)}),t.jsx(me,{label:n("ui.settings.configuration.settings_page.last_modified"),value:an(d.metadata.last_modified)}),t.jsx(me,{label:n("ui.settings.configuration.settings_page.description"),value:d.metadata.description||n("ui.settings.configuration.settings_page.no_description_available")})]})})]}),t.jsx(le,{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:H.appearance,dataTourTag:"settings-appearance-section",children:t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(iu,{}),t.jsx(fs,{value:a,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 D=>i(D)}),t.jsx(ou,{value:gs(o),onChange:D=>l(D)}),t.jsx(ml,{state:s.state,onChange:s.set})]})}),t.jsx(Qd,{sectionRef:H.speech}),t.jsx(uc,{sectionRef:H.keyboard}),t.jsx(le,{title:n("ui.settings.model.settings_page.model_providers"),icon:rs,description:n("ui.settings.navigation.settings_page.sign_in_to_the_services_your_agents_think_with_new_chats_use_your"),sectionRef:H.providers,id:"model-providers",className:"focus-visible:outline-none!",children:t.jsx(ua,{initialProviderId:Xe,onChangeModel:()=>ve("general")})}),t.jsx(Td,{sessionId:Q??void 0,sectionRef:H.integrations,highlightServer:ye}),t.jsx(le,{title:n("ui.settings.account.settings_page.radient_account"),titleComponent:t.jsx(du,{}),description:n("ui.settings.account.settings_page.your_radient_account_radient_pass_details_and_credits_to_use_radi"),sectionRef:H.radient,dataTourTag:"settings-radient-account-section",children:t.jsxs("div",{className:"flex flex-col gap-8",children:[t.jsx(Dd,{onAfterCredentialUpdate:()=>{M(),xe()}}),R&&t.jsxs(t.Fragment,{children:[t.jsx(ru,{}),t.jsx(cu,{})]})]})}),U&&t.jsx(le,{title:n("ui.agentMessages.settings.section"),icon:ga,description:n("ui.agentMessages.settings.description"),sectionRef:H["agent-messages"],id:"agent-messages",className:"border-b border-hairline pb-8",children:G?t.jsx(jl,{availability:S,status:G,accountId:O,refusal:L.refusal,onRefreshStatus:m,sessions:Z,onOpenSession:D=>{V.invalidateStatus(),ma(Fe,D)}}):L.refusal?t.jsxs(ae,{variant:"warning",children:[t.jsx(Nt,{children:n("ui.agentMessages.settings.error.title")}),t.jsxs(Ce,{children:[L.refusal.code!=="client_unavailable"&&t.jsx("span",{className:"block",children:yt(L.refusal)}),t.jsx("span",{className:"block",children:n("ui.agentMessages.settings.error.no_changes")}),t.jsx(F,{className:"mt-3",variant:"secondary",onClick:()=>void m(),children:n("ui.agentMessages.settings.error.retry")})]})]}):t.jsxs("div",{"aria-busy":"true",className:"flex flex-col gap-3",children:[t.jsx(be,{className:"h-5 w-40"}),t.jsx(be,{className:"h-4 w-full max-w-xl"})]})}),t.jsx(le,{title:n("ui.settings.navigation.settings_page.backend_settings"),icon:yn,description:n("ui.settings.navigation.settings_page.every_setting_the_backend_registry_owns_searchable_with_typed_edi"),sectionRef:H.backend,children:t.jsx(ki,{hideInterfaceLanguage:!0,hideModelEffort:!0,hideAgentMessages:!0,focusKey:ie&&wn(ie,"backend")==="backend"?ie:null,initialFilter:Ue})}),t.jsx("div",{ref:H.imports,children:t.jsx(lc,{})}),t.jsx("div",{ref:H.updates,children:t.jsx($l,{})})]})]})})]}):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};