local-operator-ui 0.36.6 → 0.36.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/main/index.js +739 -27
- package/out/preload/index.js +40 -0
- package/out/renderer/assets/{_basePickBy-B0B_HryP.js → _basePickBy-D11ygq2l.js} +1 -1
- package/out/renderer/assets/{_baseUniq-BC6WfZEZ.js → _baseUniq-_Pf0yG1r.js} +1 -1
- package/out/renderer/assets/{agent-details-page-CIKeI8ax.js → agent-details-page-LU973LFV.js} +2 -2
- package/out/renderer/assets/{agent-hub-page-NKE7fJK1.js → agent-hub-page-DegTVxlE.js} +2 -2
- package/out/renderer/assets/{agents-page-BIRTx9kB.js → agents-page-B6Y-wB7u.js} +3 -3
- package/out/renderer/assets/{arc-DyL52bz_.js → arc-BedtwWh_.js} +1 -1
- package/out/renderer/assets/{architectureDiagram-IEHRJDOE-OQsI3Nan.js → architectureDiagram-IEHRJDOE-DyIP0L4b.js} +1 -1
- package/out/renderer/assets/{arrow-up-BpuHf_sB.js → arrow-up-BD8jieeb.js} +1 -1
- package/out/renderer/assets/{blockDiagram-JOT3LUYC-CS1fz58m.js → blockDiagram-JOT3LUYC-w5b-ZzdW.js} +1 -1
- package/out/renderer/assets/{book-open-BiI_r4jM.js → book-open-DxzLWerU.js} +1 -1
- package/out/renderer/assets/browser-page-Bm5bblrV.js +1 -0
- package/out/renderer/assets/{browser-webauthn-prompt-ja8N1ehh.js → browser-webauthn-prompt-CbE9FFZv.js} +1 -1
- package/out/renderer/assets/{building-2-Dar5h3t0.js → building-2-DtOQfBQY.js} +1 -1
- package/out/renderer/assets/{c4Diagram-VJAJSXHY-C6RZIvJP.js → c4Diagram-VJAJSXHY-CnSFoHWb.js} +1 -1
- package/out/renderer/assets/channel-BJPW3C83.js +1 -0
- package/out/renderer/assets/{chunk-4BMEZGHF-Cpn-cLXo.js → chunk-4BMEZGHF-CY0scau5.js} +1 -1
- package/out/renderer/assets/{chunk-A2AXSNBT-S8Vffyme.js → chunk-A2AXSNBT-B_cWmZiK.js} +1 -1
- package/out/renderer/assets/{chunk-AEK57VVT-K1GcoFUy.js → chunk-AEK57VVT-BRm1a_Ub.js} +1 -1
- package/out/renderer/assets/{chunk-D6G4REZN-CyqTe7_6.js → chunk-D6G4REZN-CmZT-cQT.js} +1 -1
- package/out/renderer/assets/{chunk-RZ5BOZE2-QWUc1JND.js → chunk-RZ5BOZE2-Cwg1etHt.js} +1 -1
- package/out/renderer/assets/{chunk-XZIHB7SX-v3MFY8Qn.js → chunk-XZIHB7SX-a-OtMrnF.js} +1 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-BjlJ_E71.js +1 -0
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-BjlJ_E71.js +1 -0
- package/out/renderer/assets/clone-BuzQaJVT.js +1 -0
- package/out/renderer/assets/{console-mirror-BfM9Le8Y.js → console-mirror-wrjuOlK5.js} +1 -1
- package/out/renderer/assets/{consoleCapture-mqMk3W7y.js → consoleCapture-CGsX86Ez.js} +1 -1
- package/out/renderer/assets/{conversation-input-sync-BD8ZrQRq.js → conversation-input-sync-qFePp_gf.js} +276 -276
- package/out/renderer/assets/{dagre-OKDRZEBW-D1-V7-Tj.js → dagre-OKDRZEBW-ujAbOxN1.js} +1 -1
- package/out/renderer/assets/{diagram-SSKATNLV-D7jQdHV1.js → diagram-SSKATNLV-BGt8bOqa.js} +1 -1
- package/out/renderer/assets/{diagram-VNBRO52H-DB_YZ9C8.js → diagram-VNBRO52H-DGmIp--B.js} +1 -1
- package/out/renderer/assets/{erDiagram-Q7BY3M3F-Blv-3W3v.js → erDiagram-Q7BY3M3F-Czgf2xtG.js} +1 -1
- package/out/renderer/assets/{error-boundary-Bpk2r3Ma.js → error-boundary-CIO9VaTx.js} +2 -2
- package/out/renderer/assets/{flowDiagram-4HSFHLVR-BTShSZPF.js → flowDiagram-4HSFHLVR-BSuzI5ul.js} +1 -1
- package/out/renderer/assets/{ganttDiagram-APWFNJXF-_SXfULy-.js → ganttDiagram-APWFNJXF-DjjvFPP9.js} +1 -1
- package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-9E7LTj7S.js → gitGraphDiagram-7IBYFJ6S-qgMylPGx.js} +1 -1
- package/out/renderer/assets/{graph-BhaFec28.js → graph-C_PIARec.js} +1 -1
- package/out/renderer/assets/{hash-CrDnkZ9w.js → hash-BTR-wmLC.js} +1 -1
- package/out/renderer/assets/index-B5ZsvNme.js +7 -0
- package/out/renderer/assets/index-B9Z9fABA.js +1 -0
- package/out/renderer/assets/index-BSn66J9q.js +57 -0
- package/out/renderer/assets/index-BzHpKJoz.css +1 -0
- package/out/renderer/assets/index-U5qrTe4P.js +824 -0
- package/out/renderer/assets/{infoDiagram-PH2N3AL5-CCsEuNFb.js → infoDiagram-PH2N3AL5-CXhZsMAw.js} +1 -1
- package/out/renderer/assets/{installer-CJRb2tgb.js → installer-DsBvKWJk.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-U35MCT3I-LXUs-hfi.js → journeyDiagram-U35MCT3I-BfRBfFPi.js} +1 -1
- package/out/renderer/assets/{kanban-definition-NDS4AKOZ-GLYV-Ku1.js → kanban-definition-NDS4AKOZ-BjBPm0Wp.js} +1 -1
- package/out/renderer/assets/{layout-erSNWSH-.js → layout-CxH8v5Lh.js} +1 -1
- package/out/renderer/assets/{legacy-agents-page-CtFhdgCi.js → legacy-agents-page-CiirOdbB.js} +7 -7
- package/out/renderer/assets/{library-page-C6-aUarQ.js → library-page-CH3E7s4_.js} +3 -3
- package/out/renderer/assets/{mermaid.core-BGROKqtx.js → mermaid.core-Bx5BMQp8.js} +5 -5
- package/out/renderer/assets/mesh-page-DXuH0pWs.js +1 -0
- package/out/renderer/assets/{mindmap-definition-ALO5MXBD-C1KlK3C5.js → mindmap-definition-ALO5MXBD-Cnp-gOUf.js} +1 -1
- package/out/renderer/assets/{mini-Dnf6EgXd.js → mini-Cxcx9-Gz.js} +1 -1
- package/out/renderer/assets/{notebook-pen-CTurnI5u.js → notebook-pen-pmBcBtK5.js} +1 -1
- package/out/renderer/assets/{org-access-DTXfQgW5.js → org-access-BBS-iiGY.js} +1 -1
- package/out/renderer/assets/{org-surface-gate-CDaexKo1.js → org-surface-gate-B9JbfoNw.js} +1 -1
- package/out/renderer/assets/{page-header-Does21Km.js → page-header-D3rux4P9.js} +1 -1
- package/out/renderer/assets/{pieDiagram-IB7DONF6-DaaMC8-4.js → pieDiagram-IB7DONF6-BXGlHMJD.js} +1 -1
- package/out/renderer/assets/{projects-page-Bw0c4vc_.js → projects-page-DjaYWghP.js} +17 -17
- package/out/renderer/assets/publication-validation-Dent7Wyb.js +1 -0
- package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-BVFqf3uw.js → quadrantDiagram-7GDLP6J5-DTE1LofJ.js} +1 -1
- package/out/renderer/assets/{radar-MK3ICKWK-BbBjm1y3.js → radar-MK3ICKWK-C5aiTbpi.js} +1 -1
- package/out/renderer/assets/{radient-auth-buttons-BeDvFHK7.js → radient-auth-buttons-CD4FRlt9.js} +1 -1
- package/out/renderer/assets/{requirementDiagram-KVF5MWMF-luASPwgm.js → requirementDiagram-KVF5MWMF-B-kbiFxO.js} +1 -1
- package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-DJ-Xk1mH.js → sankeyDiagram-QLVOVGJD-8mSg8Gx1.js} +1 -1
- package/out/renderer/assets/{schedules-page-D7XfeTME.js → schedules-page-M0NGG3zh.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-C9vBEHGW.js → sequenceDiagram-X6HHIX6F-Ctz7PqiC.js} +1 -1
- package/out/renderer/assets/settings-page-Cy2SAtSh.js +287 -0
- package/out/renderer/assets/{smartart-DCxfy3Tv.js → smartart-DmOeXeJs.js} +1 -1
- package/out/renderer/assets/{stateDiagram-DGXRK772-DCbA594R.js → stateDiagram-DGXRK772-x8oSqtIw.js} +1 -1
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-CUVgaWvm.js +1 -0
- package/out/renderer/assets/{tags-input-chips-BSg2kzIn.js → tags-input-chips-BAP2XNbQ.js} +1 -1
- package/out/renderer/assets/team-bridge-page-CYehSZqj.js +11 -0
- package/out/renderer/assets/{timeline-definition-BDJGKUSR-AlhVX480.js → timeline-definition-BDJGKUSR-DZ5836tF.js} +1 -1
- package/out/renderer/assets/ui-preferences-store-oc99NgQT.js +1 -0
- package/out/renderer/assets/{use-download-agent-mutation-DmirSifx.js → use-download-agent-mutation-Bgwi0JGB.js} +4 -4
- package/out/renderer/assets/{use-session-snapshot-DQQ3D8W6.js → use-session-snapshot-DQs7iPEs.js} +1 -1
- package/out/renderer/assets/{xychartDiagram-VJFVF3MP-djayCUFZ.js → xychartDiagram-VJFVF3MP-CQNe5VvP.js} +1 -1
- package/out/renderer/console-capture.html +5 -5
- package/out/renderer/index.html +7 -7
- package/out/renderer/installer.html +4 -4
- package/out/renderer/mini.html +7 -7
- package/package.json +3 -3
- package/out/renderer/assets/browser-page-CvUjgYjV.js +0 -1
- package/out/renderer/assets/channel-Ca9itbEI.js +0 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-BDSTmyjZ.js +0 -1
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-BDSTmyjZ.js +0 -1
- package/out/renderer/assets/clone-OIhREtCX.js +0 -1
- package/out/renderer/assets/index-BgwxrPpP.css +0 -1
- package/out/renderer/assets/index-BuM037wD.js +0 -824
- package/out/renderer/assets/index-ByYW6G08.js +0 -57
- package/out/renderer/assets/index-ClCIwVJj.js +0 -7
- package/out/renderer/assets/index-Shz25Z8Y.js +0 -1
- package/out/renderer/assets/mesh-page-CzSDWDfu.js +0 -1
- package/out/renderer/assets/publication-validation-MxGQJEQj.js +0 -1
- package/out/renderer/assets/settings-page-BubJ0gmV.js +0 -287
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-P9yjg6o0.js +0 -1
- package/out/renderer/assets/team-bridge-page-DshgiIxJ.js +0 -1
- package/out/renderer/assets/ui-preferences-store-CAt3Nng3.js +0 -1
- package/out/renderer/assets/use-memberships-query-fzcoT-92.js +0 -1
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
import{r as l,t as n,j as t,c as _e,e as Ks,L as Us}from"./index-ByYW6G08.js";import{cU as zt,cV as Bs,cW as xn,cX as $e,bZ as Vs,C as Ie,ak as Wn,al as Xt,a7 as Zn,u as en,aN as Hs,aO as Gs,cY as qs,cZ as Ys,c_ as Qs,c$ as Ws,d0 as Jn,d1 as tn,ai as Xn,d2 as Zs,d3 as Js,aS as pt,d4 as yn,d5 as Ve,a as nn,c as $t,d6 as Xs,d7 as ht,d8 as ea,bw as ta,d9 as na,da as sa,db as aa,dc as ia,d as pe,dd as Pt,bN as es,de as sn,cg as ft,bA as oa,df as ts,ag as ra,dg as la,dh as ca,di as da,dj as ua,Z as an,dk as ga,dl as ma,a6 as ns,aU as Kt,aV as Ut,dm as _a,b4 as pa,cG as Bt,au as nt,dn as ha,dp as fa,dq as xa,dr as Vt,ds as ya,dt as va,du as ba,aQ as ka,dv as ss,dw as ja,dx as wa,dy as Na,B as Sa,dz as as,aT as is,dA as os,dB as Ma,dC as Ca,dD as Aa,dE as Ea,dF as Ia,dG as Ra,dH as Ta,dI as La,D as Oa,bU as rs,b5 as Fa,bv as Da,dJ as Xe,dK as Ht,dL as vn,dM as za,dN as $a,dO as Pa,dP as Ka,dQ as Ua,bI as Ba,dR as Va,c0 as Ha,dS as Ga,b$ as qa,dT as Ya,dU as Qa,dV as bn,dW as Wa,dX as Za,dY as Ja,ci as Xa}from"./conversation-input-sync-BD8ZrQRq.js";import{n as ei,K as ti,u as Pe,o as ni,q as si,r as ai,T as ii,s as ls}from"./ui-preferences-store-CAt3Nng3.js";import{bG as cs,bH as oi,bI as ri,bJ as ds,bK as li,bL as ci,bM as Le,S as us,bf as ot,bg as me,bN as le,bO as di,bC as ui,bP as gi,a as kn,bQ as mi,bR as _i,bS as dt,be as pi,bq as hi,bT as fi,bU as xi,bV as yi,bW as vi,b4 as jn,bX as bi,a$ as ki,bb as wn,bB as ji,bc as wi,bd as Ni,bY as Si,b3 as Mi,bZ as Ci}from"./index-BuM037wD.js";import{P as Ai}from"./page-header-Does21Km.js";import{c as I,u as ee,a as F,S as ye,Q as gs,y as We,a0 as jt,a1 as wt,a2 as Ye,A as se,z as Nt,E as Ae,x as xe,K as on,M as rn,N as ln,O as cn,P as Qe,L as Ee,I as Oe,a4 as St,R as Ei,B as at,C as Gt,ac as Ii,s as ms,ag as Nn,T as _s,h as Ri,i as Ti,k as Li,p as Oi,q as Sn,H as Fi,G as Di,ah as zi,a8 as $i}from"./error-boundary-Bpk2r3Ma.js";import{R as Pi}from"./radient-auth-buttons-BeDvFHK7.js";import{N as Ki}from"./notebook-pen-CTurnI5u.js";import{B as Ui}from"./book-open-BiI_r4jM.js";import{a as Bi,p as At}from"./parseISO-BHJWTxrA.js";import{i as Vi,a as Be,f as Hi}from"./format-esAOn2VS.js";import{t as Gi}from"./en-US-CHJkXXr4.js";import"./console-mirror-BfM9Le8Y.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"}]],Yi=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 Qi=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M20.2 20.2c2.04-2.03.02-7.36-4.5-11.9-4.54-4.52-9.87-6.54-11.9-4.5-2.04 2.03-.02 7.36 4.5 11.9 4.54 4.52 9.87 6.54 11.9 4.5Z",key:"1l2ple"}],["path",{d:"M15.7 15.7c4.52-4.54 6.54-9.87 4.5-11.9-2.03-2.04-7.36-.02-11.9 4.5-4.52 4.54-6.54 9.87-4.5 11.9 2.03 2.04 7.36.02 11.9-4.5Z",key:"1wam0m"}]],Wi=I("atom",Qi);/**
|
|
12
|
-
* @license lucide-react v0.507.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const Zi=[["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"}]],Ji=I("audio-waveform",Zi);/**
|
|
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 Xi=[["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"}]],eo=I("binary",Xi);/**
|
|
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 to=[["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"}]],no=I("candy",to);/**
|
|
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 so=[["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"}]],ao=I("car-front",so);/**
|
|
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 io=[["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"}]],oo=I("cassette-tape",io);/**
|
|
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 ro=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],lo=I("chart-line",ro);/**
|
|
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 co=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],uo=I("circle-plus",co);/**
|
|
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 go=[["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"}]],mo=I("circuit-board",go);/**
|
|
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 _o=[["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"}]],po=I("cloud-lightning",_o);/**
|
|
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 ho=[["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"}]],fo=I("cloud-moon",ho);/**
|
|
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 xo=[["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"}]],yo=I("cloud-snow",xo);/**
|
|
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 vo=[["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"}]],bo=I("cloud-sun",vo);/**
|
|
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 ko=[["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"}]],jo=I("coffee",ko);/**
|
|
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 wo=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 18a6 6 0 0 0 0-12v12z",key:"j4l70d"}]],ps=I("contrast",wo);/**
|
|
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 No=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],So=I("credit-card",No);/**
|
|
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 Mo=[["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"}]],Co=I("cup-soda",Mo);/**
|
|
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 Ao=[["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"}]],Eo=I("disc-3",Ao);/**
|
|
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 Io=[["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"}]],Ro=I("droplet",Io);/**
|
|
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 To=[["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"}]],Lo=I("droplets",To);/**
|
|
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 Oo=[["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"}]],Fo=I("fish",Oo);/**
|
|
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 Do=[["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"}]],zo=I("flame",Do);/**
|
|
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 $o=[["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"}]],Po=I("flower-2",$o);/**
|
|
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 Ko=[["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"}]],Uo=I("flower",Ko);/**
|
|
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 Bo=[["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"}]],Vo=I("ghost",Bo);/**
|
|
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 Ho=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],Go=I("github",Ho);/**
|
|
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"}]],Yo=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 Qo=[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}]],Wo=I("hexagon",Qo);/**
|
|
147
|
-
* @license lucide-react v0.507.0 - ISC
|
|
148
|
-
*
|
|
149
|
-
* This source code is licensed under the ISC license.
|
|
150
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
151
|
-
*/const Zo=[["path",{d:"M12 17c5 0 8-2.69 8-6H4c0 3.31 3 6 8 6m-4 4h8m-4-3v3M5.14 11a3.5 3.5 0 1 1 6.71 0",key:"1uxfcu"}],["path",{d:"M12.14 11a3.5 3.5 0 1 1 6.71 0",key:"4k3m1s"}],["path",{d:"M15.5 6.5a3.5 3.5 0 1 0-7 0",key:"zmuahr"}]],Jo=I("ice-cream-bowl",Zo);/**
|
|
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 Xo=[["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"}]],er=I("joystick",Xo);/**
|
|
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 tr=[["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"}]],nr=I("leaf",tr);/**
|
|
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 sr=[["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"}]],ar=I("lightbulb",sr);/**
|
|
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 ir=[["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"}]],or=I("milk",ir);/**
|
|
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 rr=[["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"}]],lr=I("moon-star",rr);/**
|
|
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 cr=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],dr=I("moon",cr);/**
|
|
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 ur=[["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"}]],gr=I("mountain-snow",ur);/**
|
|
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 mr=[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]],_r=I("mountain",mr);/**
|
|
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 pr=[["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"}]],hr=I("radio",pr);/**
|
|
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 fr=[["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"}]],xr=I("sailboat",fr);/**
|
|
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 yr=[["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"}]],vr=I("shirt",yr);/**
|
|
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 br=[["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"}]],kr=I("skull",br);/**
|
|
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 jr=[["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"}]],wr=I("snowflake",jr);/**
|
|
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 Nr=[["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"}]],Sr=I("sparkle",Nr);/**
|
|
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 Mr=[["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"}]],Cr=I("sun-dim",Mr);/**
|
|
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 Ar=[["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"}]],Er=I("sun",Ar);/**
|
|
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 Ir=[["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"}]],Rr=I("sunrise",Ir);/**
|
|
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 Tr=[["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"}]],Lr=I("sunset",Tr);/**
|
|
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 Or=[["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"}]],Fr=I("tent",Or);/**
|
|
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 Dr=[["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"}]],zr=I("tree-deciduous",Dr);/**
|
|
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 $r=[["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"}]],Pr=I("tree-palm",$r);/**
|
|
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 Kr=[["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"}]],Ur=I("tree-pine",Kr);/**
|
|
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 Br=[["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"}]],Vr=I("trees",Br);/**
|
|
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 Hr=[["path",{d:"M22 12a10.06 10.06 1 0 0-20 0Z",key:"1teyop"}],["path",{d:"M12 12v8a2 2 0 0 0 4 0",key:"ulpmoc"}],["path",{d:"M12 2v1",key:"11qlp1"}]],Gr=I("umbrella",Hr);/**
|
|
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"}]],Yr=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 Qr=[["path",{d:"M2 22 16 8",key:"60hf96"}],["path",{d:"M3.47 12.53 5 11l1.53 1.53a3.5 3.5 0 0 1 0 4.94L5 19l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1rdhi6"}],["path",{d:"M7.47 8.53 9 7l1.53 1.53a3.5 3.5 0 0 1 0 4.94L9 15l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1sdzmb"}],["path",{d:"M11.47 4.53 13 3l1.53 1.53a3.5 3.5 0 0 1 0 4.94L13 11l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"eoatbi"}],["path",{d:"M20 2h2v2a4 4 0 0 1-4 4h-2V6a4 4 0 0 1 4-4Z",key:"19rau1"}],["path",{d:"M11.47 17.47 13 19l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L5 19l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"tc8ph9"}],["path",{d:"M15.47 13.47 17 15l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L9 15l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"2m8kc5"}],["path",{d:"M19.47 9.47 21 11l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L13 11l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"vex3ng"}]],Wr=I("wheat",Qr);/**
|
|
282
|
-
* @license lucide-react v0.507.0 - ISC
|
|
283
|
-
*
|
|
284
|
-
* This source code is licensed under the ISC license.
|
|
285
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
286
|
-
*/const Zr=[["path",{d:"M12.8 19.6A2 2 0 1 0 14 16H2",key:"148xed"}],["path",{d:"M17.5 8a2.5 2.5 0 1 1 2 4H2",key:"1u4tom"}],["path",{d:"M9.8 4.4A2 2 0 1 1 11 8H2",key:"75valh"}]],Jr=I("wind",Zr),Xr=({appVersion:e=null,slowWaitHintMs:s})=>{ee();const a="https://local-operator.com/download",[i,o]=l.useState(!1),r=cs(i,s??oi),[d,u]=l.useState(!1),[c,g]=l.useState(null),[h,m]=l.useState("info"),[x,_]=l.useState(null),[f,k]=l.useState(null),C=e?.trim()?e.trim():null,D=l.useRef(!1),N=zt($=>$.openDetail),E=l.useRef(!1),b=l.useRef(0),j=l.useRef(!1),S=l.useCallback(($,G)=>{E.current=!1,g($),m(G),u(!0)},[]),q=l.useCallback($=>{E.current=!0,g($),m("success"),u(!0)},[]),T=l.useCallback(()=>{E.current&&(E.current=!1,u(!1),g(null))},[]),{clearDeferredUpdate:z}=Bs();l.useEffect(()=>{const $=window.api.updater.onUpdateError(v=>{D.current&&v.includes("manually")&&(_({message:n("ui.common.updates.check_for_updates_button.the_server_is_installed_outside_the_app_so_use_the_tool_you_insta"),command:""}),E.current=!1,g(null),m("warning"),u(!0))}),G=window.api.updater.onBackendUpdateDevMode(v=>{D.current&&S(v,"info")}),Y=()=>{j.current=!0,T()},V=window.api.updater.onUpdateAvailable(Y),K=window.api.updater.onUpdateNpxAvailable(Y),Z=window.api.updater.onBackendUpdateAvailable(Y);return()=>{$(),G(),V(),K(),Z()}},[T,S]),l.useEffect(()=>{let $=!1;const G=()=>{window.api.updater.getLastInstallAttempt().then(V=>{$||k(V)}).catch(()=>{})};G();const Y=window.api.updater.onUpdateInstallFailed(()=>G());return()=>{$=!0,Y()}},[]);const R=async()=>{const $=++b.current;T(),j.current=!1;try{o(!0),D.current=!0,z($e.UI),z($e.BACKEND);const G=await window.api.updater.checkForAllUpdates({manual:!0});if($!==b.current)return;G.app==="available"&&N($e.UI),G.server==="available"&&N($e.BACKEND),G?.affirmation&&!j.current?q(G.affirmation):T()}catch(G){if($!==b.current)return;console.warn(`Update check failed; the app-level alert owns the report: ${ri(G)}`)}finally{$===b.current&&o(!1),setTimeout(()=>{D.current=!1},2e3)}},te=()=>{E.current=!1,u(!1),g(null)};return t.jsxs(t.Fragment,{children:[f&&t.jsxs("div",{className:"mb-3 rounded-sm bg-sunken p-3",children:[t.jsxs("p",{className:"text-body-sm text-ink",children:[n("ui.common.updates.check_for_updates_button.the_last_update_to_version"),f.targetVersion," ",n("ui.common.updates.check_for_updates_button.didn_t_finish"),f.attempts>1?n("ui.common.updates.check_for_updates_button.detail",{attempts:f.attempts,attemptsText:String(f.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")," ",f.detectedAt?new Date(f.detectedAt).toLocaleString():"at an unknown time",". ",f.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 R(),disabled:i,children:[i?t.jsx(ye,{size:"sm"}):null,i?n("ui.common.updates.check_for_updates_button.checking"):n("ui.common.updates.check_for_updates_button.check_for_updates")]}),r&&t.jsx("p",{className:"mt-2 text-meta text-ink-muted",children:n("ui.common.updates.check_for_updates_button.still_checking_a_slow_or_stalled_connection_can_hold_this_for_abo")}),x&&t.jsxs(xn,{open:d,autoHideDuration:1e4,onClose:te,variant:"warning",children:[t.jsx("p",{className:"text-body-sm",children:x.message}),x.command&&t.jsx("code",{className:"mt-2 block rounded-sm bg-sunken p-2 text-mono-sm text-ink",children:x.command})]}),c&&h!=="danger"&&t.jsx(xn,{open:d,autoHideDuration:6e3,onClose:te,variant:h,children:c})]})},xt=["system-prompt"],el=()=>{const{shouldEnableQuery:e}=Vs();return Ie({enabled:e({bypassInternetCheck:!0}),queryKey:xt,queryFn:async()=>{try{const a=await Wn(Xt.baseUrl).config.getSystemPrompt();if(a===null)return null;if(a.status>=400)throw new Error(a.message||"Failed to fetch system prompt");return a.result}catch(s){const a=s instanceof Error?s.message:"An unknown error occurred while fetching system prompt";throw Zn(a),s}},refetchOnWindowFocus:!1,staleTime:5e3})},tl=()=>{const e=en(),s=Wn(Xt.baseUrl);return Hs({mutationFn:async a=>{try{const i=await s.config.updateSystemPrompt(a);if(i.status>=400)throw new Error(i.message||"Failed to update system prompt");return i.result}catch(i){const o=i instanceof Error?i.message:"An unknown error occurred while updating system prompt";throw Zn(o),i}},onSuccess:async a=>{await e.invalidateQueries({queryKey:xt,refetchType:"none"}),e.setQueryData(xt,i=>i&&{...i,...a}),await e.refetchQueries({queryKey:xt,type:"all"}),Gs("System prompt updated")},onError:a=>{console.error("Error updating system prompt:",a)}})},hs=({value:e,label:s,description:a,onChange:i,icon:o,isSaving:r=!1,disabled:d=!1})=>{const[u,c]=l.useState(e),g=l.useId(),h=`${g}-label`,m=`${g}-description`,x=async _=>{if(!(r||d)){c(_);try{await i(_)}catch(f){c(!_),console.error("Error toggling setting:",f)}}};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:h,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:m,className:"mt-0.5 max-w-2xl text-body-sm text-ink-muted",children:a})]}),t.jsx("div",{className:"flex h-6 shrink-0 items-center",children:r?t.jsx(ye,{size:"md",label:`Saving ${s}`}):t.jsx(gs,{checked:u,onCheckedChange:x,disabled:d,"aria-labelledby":h,"aria-describedby":a?m:void 0})})]})};function Mn(e,s){const a=Gi(e,s?.in);if(!Vi(a))throw new RangeError("Invalid time value");const i=Be(a.getDate(),2),o=Be(a.getMonth()+1,2),r=a.getFullYear(),d=Be(a.getHours(),2),u=Be(a.getMinutes(),2),c=Be(a.getSeconds(),2);let g="",h="";const m=a.getTimezoneOffset();if(m!==0){const x=Math.abs(m),_=Be(Math.trunc(x/60),2),f=Be(x%60,2);h=`${m<0?"+":"-"}${_}:${f}`}else h="Z";return`${r}-${o}-${i}T${d}:${u}:${c}${g}${h}`}function nl(e,s,a){return Bi(e,-30,a)}var sl=qs({chartName:"LineChart",GraphicalChild:Jn,axisComponents:[{axisType:"xAxis",AxisComp:Ys},{axisType:"yAxis",AxisComp:Qs}],formatAxisMap:Ws});const al=["radient","creditBalance"],il=e=>{const{user:s,isAuthenticated:a}=tn(),i=s?.account?.tenant_id,o=a&&!!i&&e?.enabled;return Ie({queryKey:[al,i],queryFn:async()=>{if(!i)throw new Error("Tenant ID not available");const r=await Xn({operation:"credits",tenantId:i});if(!r||typeof r.balance!="number")throw new Error("Invalid credit balance response format");return r},enabled:o,staleTime:5*60*1e3,refetchOnWindowFocus:!0})},ol=["radient","usageRollup"],rl=(e,s)=>{const{user:a,isAuthenticated:i}=tn(),o=a?.account?.tenant_id,r=i&&!!o&&s?.enabled;return Ie({queryKey:[...ol,o,e],queryFn:async()=>{if(!o)throw new Error("Tenant ID not available");const d={};for(const[c,g]of Object.entries(e))g!=null&&(d[c]=String(g));const u=await Xn({operation:"usage",tenantId:o,query:d});if(!u)throw new Error("Invalid usage rollup response format");return u},enabled:r,staleTime:5*60*1e3,refetchOnWindowFocus:!0})},ll=e=>e==="sidebars"?n("ui.settings.appearance.window_glass.coverage_sidebars"):n("ui.settings.appearance.window_glass.coverage_full"),cl=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")}},dl=e=>{switch(e){case"reduced-transparency":return n("ui.settings.appearance.window_glass.unsupported_reduced_transparency");case"windows-too-old":return n("ui.settings.appearance.window_glass.unsupported_windows_too_old");case"windows-unverified":return n("ui.settings.appearance.window_glass.unsupported_windows_unverified");case"linux-compositor-dependent":return n("ui.settings.appearance.window_glass.unsupported_linux");case"hardware-acceleration-disabled":return n("ui.settings.appearance.window_glass.unsupported_acceleration");case"gpu-unavailable":return n("ui.settings.appearance.window_glass.unsupported_gpu");case"backdrop-filter-unavailable":return n("ui.settings.appearance.window_glass.unsupported_backdrop_filter");default:return n("ui.settings.appearance.window_glass.unsupported_other")}},Cn=({label:e,description:s,value:a,onValueChange:i,options:o})=>{const r=l.useId();return t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("span",{id:r,className:"flex min-h-6 items-center text-body text-ink",children:e}),t.jsx("p",{className:"mt-0.5 max-w-2xl text-body-sm text-ink-muted",children:s})]}),t.jsx("div",{className:"flex h-6 shrink-0 items-center",children:t.jsx(jt,{value:a,onValueChange:i,children:t.jsx(wt,{"aria-labelledby":r,children:o.map(d=>t.jsx(Ye,{value:d.value,children:d.label},d.value))})})})]})},ul=({state:e,onChange:s})=>{ee();const a=l.useId(),i=`${a}-description`,[o,r]=l.useState(null),d=l.useRef(!1),u=l.useRef(null),c=e?.settings.intensity??0;if(!e)return null;const g=!e.capability.supported,h=g?dl(e.capability.reason):null,m=async f=>{if(d.current){u.current=f;return}d.current=!0;try{await s({intensity:f})}finally{d.current=!1;const k=u.current;u.current=null,k!==null&&k!==f?m(k):r(null)}},x=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(We,{content:h,disabled:!g,children:t.jsx("div",{className:g?"opacity-60":void 0,children:t.jsx(hs,{value:g?!1:x,disabled:g,label:n("ui.settings.appearance.window_glass.label"),description:n("ui.settings.appearance.window_glass.description"),onChange:async f=>s({enabled:f})},g?"unavailable":"available")})}),h&&t.jsx("p",{"data-glass-unsupported":e.capability.reason,className:"max-w-2xl text-body-sm text-ink-muted",children:h}),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")}),x&&!g&&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:f=>void s({coverage:f}),options:Zs.map(f=>({value:f,label:ll(f)}))}),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:f=>{const k=Number(f.target.value);r(k),m(k)},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:f=>void s({material:f}),options:e.capability.materials.map(f=>({value:f,label:cl(f)}))})]})]})},gl=new Set(["B","C","D","E","F"]);function ml(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&&gl.has(s.surface_state)?"visible":"absent":o&&i?"visible":a&&i?"error":"absent"}function _l(e,s){return e!=="absent"}function et(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"}function fs(e){return ei(e)}function pl(e){return e.target.endpoint_id?{kind:"endpoint",id:e.target.endpoint_id}:{kind:"account",id:e.target.account_id??""}}function qt(e){return e.map((s,a)=>{const i=pl(s);return{key:`${s.direction}:${s.effect}:${i.kind}:${i.id}:${a}`,direction:s.direction,effect:s.effect,kind:i.kind,id:i.id}})}function Yt(e,s){return e.filter(i=>i.effect==="deny"||s[i.direction]==="listed_only").map(i=>({direction:i.direction,effect:i.effect,target:i.kind==="endpoint"?{endpoint_id:i.id}:{account_id:i.id}})).sort((i,o)=>i.direction.localeCompare(o.direction)||i.effect.localeCompare(o.effect)||JSON.stringify(i.target).localeCompare(JSON.stringify(o.target)))}function xs(e){return JSON.stringify(e)}function hl(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"}:xs(Yt(e.entries,e.modes))===e.savedSignature?{disabled:!0,reason:"unchanged"}:{disabled:!1}}const fl=/^[^\s\p{Cc}]{1,128}$/u;function xl(e){return e===""?n("ui.agentMessages.settings.allowlist.identifier_empty"):e.length>128?n("ui.agentMessages.settings.allowlist.identifier_long"):fl.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 yl({availability:e,status:s,accountId:a,refusal:i=null,api:o=ci,onRefreshStatus:r,sessions:d=[]}){ee();const[u,c]=l.useState({kind:"loading"}),[g,h]=l.useState(0),[m,x]=l.useState(null),[_,f]=l.useState(null),[k,C]=l.useState(s?.local.enabled??!1),[D,N]=l.useState(s?.local.session??""),E=s?.tenant_id??void 0,b=e==="visible",j=s?.account_id??null,S=j!==null&&j===a;l.useEffect(()=>{if(!b)return;let T=!1;return c({kind:"loading"}),f(null),(async()=>{try{const z=await o.settings(E);if(T)return;if(!z){c({kind:"error",refusal:{code:"invalid_response",message:n("ui.agentMessages.settings.error.unreadable")}});return}let R=null;if(z.endpoint){if(R=await o.allowlist(z.settings.tenant_id),T)return;if(!R){c({kind:"error",refusal:{code:"invalid_response",message:n("ui.agentMessages.settings.error.unreadable")}});return}}c({kind:"ready",settings:z,allowlist:R})}catch(z){if(T)return;c({kind:"error",refusal:Le(z)})}})(),()=>{T=!0}},[b,a,j,E,g,o]),l.useEffect(()=>{if(!b||u.kind!=="ready"||!u.settings.endpoint||u.allowlist)return;let T=!1;return(async()=>{try{const z=await o.allowlist(u.settings.settings.tenant_id);if(T||!z)return;c(R=>R.kind==="ready"&&!R.allowlist?{...R,allowlist:z}:R)}catch(z){T||f(Le(z))}})(),()=>{T=!0}},[b,u,o]),l.useEffect(()=>{s&&(C(s.local.enabled),N(s.local.session))},[s]);const q=()=>h(T=>T+1);return e==="absent"?null:e==="dark"?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")})]}):e==="error"?t.jsx("div",{"data-agent-messages-section":"",children:t.jsxs(se,{variant:"warning",children:[t.jsx(Nt,{children:n("ui.agentMessages.settings.error.title")}),t.jsxs(Ae,{children:[i?yt(i):n("ui.agentMessages.settings.refusal.generic"),t.jsx(F,{className:"mt-3",variant:"secondary",onClick:()=>{q(),r(!0)},children:n("ui.agentMessages.settings.error.retry")})]})]})}):!s||!a?null:t.jsxs("div",{"data-agent-messages-section":"",className:"flex flex-col gap-6",children:[_&&t.jsx(se,{variant:"warning",children:t.jsx(Ae,{children:yt(_)})}),u.kind==="loading"&&t.jsx(vl,{}),u.kind==="error"&&t.jsxs(se,{variant:"warning",children:[t.jsx(Nt,{children:n("ui.agentMessages.settings.error.title")}),t.jsxs(Ae,{children:[u.refusal.code!=="client_unavailable"&&t.jsx("span",{className:"block",children:yt(u.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")})]})]}),u.kind==="ready"&&t.jsxs(t.Fragment,{children:[t.jsx(wl,{state:et(s,u.settings),status:s,settings:u.settings,accountId:j??a,accountMatches:S,api:o,pending:m,localEnabled:k,onActionRefusal:f,onSettings:T=>c(z=>z.kind==="ready"?{...z,settings:T}:z),onLocalEnabled:C,onRefreshStatus:r,setPending:x}),t.jsx(Nl,{value:D,sessions:d,pending:m==="session",disabled:m!==null,onSave:async T=>{x("session"),f(null);try{await o.localSetting("team_bridge.session",T),N(T),await r(!0)}catch(z){f(Le(z))}finally{x(null)}}}),u.allowlist&&(et(s,u.settings)==="C"||et(s,u.settings)==="D"||et(s,u.settings)==="F")&&t.jsx(Sl,{allowlist:u.allowlist,accountId:j??a,accountMatches:S,readOnly:s.read_only===!0&&et(s,u.settings)==="F",pending:m!==null,onSaving:T=>x(T?"allowlist":null),onRefusal:f,onSaved:T=>c(z=>z.kind==="ready"?{...z,allowlist:T}:z),api:o},u.allowlist.view.tenant_id??"tenant")]})]})}function vl(){return t.jsxs("div",{className:"flex flex-col gap-3","aria-busy":"true",children:[t.jsx(xe,{className:"h-5 w-40"}),t.jsx(xe,{className:"h-4 w-full max-w-xl"}),t.jsx(xe,{className:"h-9 w-36"}),t.jsx(xe,{className:"h-4 w-64"})]})}const bl=({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})}),kl={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"},jl={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"},wl=({state:e,status:s,settings:a,accountId:i,accountMatches:o,api:r,pending:d,localEnabled:u,onActionRefusal:c,onSettings:g,onLocalEnabled:h,onRefreshStatus:m,setPending:x})=>{const _=fs(s),f=a.settings.tenant_id,k=d!==null||!o;async function C(j,S={}){if(!o)return null;x(j),c(null);try{const q=await r.updateSettings({expected_account_id:i,tenant_id:f,state:j,...S});if(g(q),j==="disabled")try{await r.localSetting("team_bridge.enabled",!1),h(!1)}catch(T){c(Le(T))}return q}catch(q){const T=Le(q);return c(T),T.code==="consent_version_unknown"&&await m(!0),null}finally{x(null)}}async function D(){if(!(!_||!o||!await C("active",{consent_version:_.version,consented_via:"settings"}))){x("local");try{await r.localSetting("team_bridge.enabled",!0),h(!0),await m(!0)}catch(S){c(Le(S))}finally{x(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:u,disabled:k,description:n("ui.agentMessages.settings.local.stays_enrolled"),onChange:async j=>{x("local"),c(null);try{await r.localSetting("team_bridge.enabled",j),h(j),await m(!0)}catch(S){c(Le(S))}finally{x(null)}}})]});const N=a.endpoint?.label?.trim(),E=a.endpoint?.consent??null,b=E!==null&&!E.current;return t.jsxs("div",{"data-agent-messages-state":e,className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("h3",{className:"text-heading text-ink",children:n(kl[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(jl[e])}),(e==="B"||e==="E")&&t.jsxs("div",{className:"flex flex-col gap-3",children:[_?t.jsx(bl,{text:_.text}):t.jsx(se,{variant:"warning",children:t.jsx(Ae,{children:n("ui.agentMessages.settings.consent.unavailable")})}),t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsx(F,{"data-agent-messages-action":"enable",onClick:()=>void D(),disabled:k||!_,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:k,onClick:()=>void C("paused"),children:n("ui.agentMessages.settings.action.pause")}),t.jsx(F,{"data-agent-messages-action":"turn_off",variant:"secondary",disabled:k,onClick:()=>void C("disabled"),children:n("ui.agentMessages.settings.action.turn_off")})]}),t.jsx(It,{settings:a,status:s}),b&&t.jsx(An,{onRenew:()=>void D(),disabled:k||!_}),t.jsx(En,{value:u,disabled:k,description:n("ui.agentMessages.settings.local.stays_enrolled"),onChange:async j=>{x("local"),c(null);try{await r.localSetting("team_bridge.enabled",j),h(j),await m(!0)}catch(S){c(Le(S))}finally{x(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:k||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:k,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}),b&&t.jsx(An,{onRenew:()=>void D(),disabled:k||!_})]})]})},An=({onRenew:e,disabled:s})=>t.jsx(se,{variant:"warning",children:t.jsxs(Ae,{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=fs(s);return i?t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsxs(ot,{children:[t.jsx(me,{label:n("ui.agentMessages.settings.consent.version"),value:i.version}),t.jsx(me,{label:n("ui.agentMessages.settings.consent.via"),value:n(`ui.agentMessages.settings.consent.via_${i.consented_via}`)}),t.jsx(me,{label:n("ui.agentMessages.settings.consent.at"),value:i.consented_at})]}),!a&&o&&t.jsxs("details",{children:[t.jsx("summary",{className:"cursor-pointer text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.consent.show")}),t.jsx("p",{className:"mt-2 whitespace-pre-wrap text-body-sm text-ink-muted",children:o.text})]})]}):t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.consent.no_record")})},En=({value:e,disabled:s,description:a,onChange:i})=>{const o=l.useId();return t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{id:o,className:"text-body-sm text-ink",children:n("ui.agentMessages.settings.local.label")}),t.jsx("p",{className:"mt-0.5 text-meta text-ink-dim",children:a})]}),t.jsx(gs,{"aria-labelledby":o,checked:e,disabled:s,onCheckedChange:r=>void i(r)})]})},Nl=({value:e,sessions:s,pending:a,disabled:i,onSave:o})=>{const r=s.some(d=>d.session_id===e);return t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.agentMessages.settings.session.title")}),t.jsx("p",{className:"max-w-2xl text-meta text-ink-dim",children:n("ui.agentMessages.settings.session.help")}),t.jsxs(on,{value:e===""?Et:e,disabled:i,onValueChange:d=>void o(d===Et?"":d),children:[t.jsx(rn,{className:"w-full max-w-md","aria-label":n("ui.agentMessages.settings.session.title"),children:t.jsx(ln,{})}),t.jsxs(cn,{children:[t.jsx(Qe,{value:Et,children:n("ui.agentMessages.settings.session.none")}),s.map(d=>t.jsx(Qe,{value:d.session_id,children:d.title?.trim()||d.session_id},d.session_id)),e!==""&&!r&&t.jsx(Qe,{value:e,children:e})]})]}),e!==""&&!r&&t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.session.unavailable")}),a&&t.jsx("p",{className:"text-meta text-ink-dim","aria-live":"polite",children:n("ui.agentMessages.settings.saving")})]})},Sl=({allowlist:e,accountId:s,accountMatches:a,readOnly:i,pending:o,api:r,onSaving:d,onRefusal:u,onSaved:c})=>{const[g,h]=l.useState(()=>qt(e.allowlist.entries)),[m,x]=l.useState(()=>({send:e.view.directions.send.mode,receive:e.view.directions.receive.mode})),_=o||i||!a,f=xs(Yt(Ml(e),Cl(e))),k=hl({entries:g,modes:m,savedSignature:f,saving:o}),C=l.useRef(0),D=b=>h(j=>[...j,{...b,key:`${b.direction}:${b.effect}:${C.current++}`}]),N=b=>h(j=>j.filter(S=>S.key!==b)),E=async()=>{if(!_){d(!0),u(null);try{const b=await r.updateAllowlist({expected_account_id:s,tenant_id:e.allowlist.tenant_id,entries:Yt(g,m)}),j=qt(b.allowlist.entries);h(j),x({send:b.view.directions.send.mode,receive:b.view.directions.receive.mode}),c(b)}catch(b){u(Le(b))}finally{d(!1)}}};return t.jsxs("div",{"data-agent-messages-allowlist":"",className:"flex flex-col gap-5",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.agentMessages.settings.allowlist.title")}),t.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.allowlist.description")})]}),t.jsx(In,{direction:"receive",title:n("ui.agentMessages.settings.allowlist.receive"),mode:m.receive,cues:e.view.cues,entries:g.filter(b=>b.direction==="receive"),disabled:_,onMode:b=>x(j=>({...j,receive:b})),onAdd:b=>D({...b,direction:"receive"}),onRemove:N}),t.jsx(In,{direction:"send",title:n("ui.agentMessages.settings.allowlist.send"),mode:m.send,cues:e.view.cues,entries:g.filter(b=>b.direction==="send"),disabled:_,onMode:b=>x(j=>({...j,send:b})),onAdd:b=>D({...b,direction:"send"}),onRemove:N}),t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsxs(F,{onClick:()=>void E(),disabled:k.disabled||_,children:[t.jsx(us,{size:14}),n("ui.agentMessages.settings.allowlist.save")]}),k.disabled&&k.reason==="needs_entry"&&t.jsx("span",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.needs_entry")}),k.disabled&&k.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 Ml(e){return qt(e.allowlist.entries)}function Cl(e){return{send:e.view.directions.send.mode,receive:e.view.directions.receive.mode}}const In=({direction:e,title:s,mode:a,cues:i,entries:o,disabled:r,onMode:d,onAdd:u,onRemove:c})=>{const g=o.filter(m=>m.effect==="allow"),h=o.filter(m=>m.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(Al,{mode:a,disabled:r,onMode:d}),t.jsxs("div",{className:"flex flex-col gap-1 text-meta text-ink-dim",children:[i.allow_entry_switches_direction_to_listed_only&&t.jsx("p",{children:n("ui.agentMessages.settings.allowlist.cue_listed_only")}),i.removing_allow_does_not_stop_open_thread&&t.jsx("p",{children:n("ui.agentMessages.settings.allowlist.cue_remove")}),i.deny_stops_pair_both_directions&&t.jsx("p",{children:n("ui.agentMessages.settings.allowlist.cue_deny")})]}),a==="listed_only"&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.allowed_heading")}),g.length===0&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.allowlist.allowed_empty")}),g.map(m=>t.jsx(Rn,{entry:m,disabled:r,onRemove:()=>c(m.key)},m.key)),t.jsx(Tn,{label:n("ui.agentMessages.settings.allowlist.add_allowed"),disabled:r,onAdd:m=>u({...m,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")}),h.length===0&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.allowlist.blocked_empty")}),h.map(m=>t.jsx(Rn,{entry:m,disabled:r,onRemove:()=>c(m.key)},m.key)),t.jsx(Tn,{label:n("ui.agentMessages.settings.allowlist.add_blocked"),disabled:r,onAdd:m=>u({...m,effect:"deny"})})]})]})},Al=({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:_e(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]=l.useState("endpoint"),[r,d]=l.useState(""),[u,c]=l.useState(null),g=l.useId(),h=`${g}-help`,m=()=>{const x=xl(r.trim());c(x),!x&&(a({kind:i,id:r.trim()}),d(""))};return t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Ee,{htmlFor:g,children:e}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs(on,{value:i,disabled:s,onValueChange:x=>o(x),children:[t.jsx(rn,{className:"w-32","aria-label":n("ui.agentMessages.settings.allowlist.kind"),children:t.jsx(ln,{})}),t.jsxs(cn,{children:[t.jsx(Qe,{value:"endpoint",children:n("ui.agentMessages.settings.allowlist.kind_agent")}),t.jsx(Qe,{value:"account",children:n("ui.agentMessages.settings.allowlist.kind_person")})]})]}),t.jsx(Oe,{id:g,"aria-describedby":h,className:"max-w-xs",value:r,disabled:s,placeholder:n("ui.agentMessages.settings.allowlist.identifier"),onChange:x=>d(x.target.value),onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),m())}}),t.jsx(F,{variant:"secondary",size:"sm",disabled:s,onClick:m,children:n("ui.agentMessages.settings.allowlist.add")})]}),t.jsx("p",{id:h,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")}),u&&t.jsx("p",{className:"text-meta text-danger",children:u})]})};function El(){const{snapshot:e}=ds(),[s,a]=l.useState(!1),i=ml({status:e.status,refused:e.refusal!==null,everVisible:s,checking:e.checking});return l.useEffect(()=>{i!=="absent"&&a(!0)},[i]),l.useEffect(()=>{li()},[]),i}const Ln={get[$e.UI](){return n("ui.settings.updates.update_following.application_updates")},get[$e.BACKEND](){return n("ui.settings.updates.update_following.server_updates")}},ut={patch:{get label(){return n("ui.settings.updates.update_following.patch_label")},get description(){return n("ui.settings.updates.update_following.patch_help")}},minor:{get label(){return n("ui.settings.updates.update_following.minor_label")},get description(){return n("ui.settings.updates.update_following.minor_help")}},major:{get label(){return n("ui.settings.updates.update_following.major_label")},get description(){return n("ui.settings.updates.update_following.major_help")}}},On=({type:e})=>{ee();const s=zt(i=>i.followed[e]),a=zt(i=>i.setFollowedSegment);return t.jsxs("div",{className:"flex flex-col gap-1.5 sm:flex-row sm:items-center sm:justify-between sm:gap-6",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-body-sm text-ink",children:Ln[e]}),t.jsx("div",{className:"mt-0.5 text-meta text-ink-muted",children:ut[s].description})]}),t.jsxs(on,{value:s,onValueChange:i=>a(e,i),children:[t.jsx(rn,{"aria-label":n("ui.settings.updates.update_following.surface_choice",{surface:Ln[e],choice:ut[s].label}),className:"w-full sm:w-56","data-followed-segment":e,children:t.jsx(ln,{})}),t.jsx(cn,{children:Js.map(i=>t.jsx(Qe,{value:i,title:ut[i].description,children:ut[i].label},i))})]})]})},Il=()=>(ee(),t.jsxs("div",{className:_e("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:$e.UI}),t.jsx(On,{type:$e.BACKEND})]})]})),Rl=({appVersion:e})=>t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(Il,{}),t.jsx(Xr,{appVersion:e})]}),Tl=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 Ll=()=>{ee();const[e,s]=l.useState(null),[a,i]=l.useState({value:"Loading...",detail:null,degraded:!1}),[o,r]=l.useState({platform:"Loading...",arch:"...",nodeVersion:"Loading...",electronVersion:"Loading...",chromeVersion:"Loading..."});l.useEffect(()=>{let u=!0;const c=_=>{if(!u)return;const f=Tl(_.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 k=_.version||"Version unknown";i({value:f?`${k} · ${f}`:k,detail:_.detail||null,degraded:_.state==="degraded"})};let g=!1;const h=window.api?.backend?.onStatusChange(_=>{g=!0,c(_)}),m=async()=>{try{const[_,f]=await Promise.all([window.api.systemInfo.getAppVersion(),window.api.systemInfo.getPlatformInfo()]);u&&(s(_),r(f))}catch(_){console.error("Error fetching app information:",_)}},x=async()=>{try{const _=window.api?.backend;if(_){const C=await _.getStatus();g||c(C);return}const f=await yn.healthCheck(Xt.baseUrl),k=yn.getServerVersion(f);u&&i({value:k,detail:null,degraded:!1})}catch(_){console.error("Error fetching server version:",_),u&&i({value:"Unavailable",detail:null,degraded:!1})}};return m(),x(),()=>{u=!1,h?.()}},[]);const d=(u,c,g,h={})=>t.jsx(me,{label:t.jsx(We,{content:g,children:t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx(St,{size:12,className:"shrink-0"}),u]})}),valueClassName:h.valueClassName,value:t.jsxs(t.Fragment,{children:[h.valueTooltip?t.jsx(We,{content:h.valueTooltip,children:t.jsx("span",{"data-backend-version":h.valueHoverTarget?"":void 0,children:c})}):c,h.statusNote?t.jsx("span",{className:"mt-0.5 block text-meta text-ink-dim",children:h.statusNote}):null]})});return t.jsx(le,{title:n("ui.settings.updates.app_updates_section.application_updates_and_info"),icon:pt,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(ot,{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(Rl,{appVersion:e})]})})};function ys(e){const s={id:"",name:n("ui.settings.model.default_effort.model_default")};return e.resolvedLevel&&e.stored.trim()===""&&dn(e.resolvedLevel,e.storable)!==null&&(s.description=n("ui.settings.model.default_effort.model_default_resolves",{level:Ve(e.resolvedLevel)})),[s,...vs(e.ladder,e.storable)]}function dn(e,s){const a=e.trim().toLowerCase();return a===""?null:s.find(i=>i.trim().toLowerCase()===a)??null}function vs(e,s){return e.flatMap(a=>{const i=dn(a,s);return i===null?[]:[{id:i,name:Ve(a)}]})}function Ol(e,s){const a=e.trim().toLowerCase();return a!==""&&s.some(i=>i.toLowerCase()===a)?s.find(i=>i.toLowerCase()===a)??"":""}function Fl(e){if(!e.resolved||e.ladder===null)return null;const s=e.stored.trim().toLowerCase();if(s===""||e.ladder.some(o=>o.toLowerCase()===s))return null;const a=(e.resolvedLevel??"").trim(),i=a===""?"":dn(a,e.storable)??"";return i.trim().toLowerCase()===s?null:i}const vt="\0unread";function gt(e){return e.trim()===""?"":vt}function Dl(e){if(!e.supported)return{kind:"unsupported",options:[],selectedId:"",disabled:!0,helper:""};if(!e.hasHome)return ze("no-home",n("ui.settings.model.default_effort.no_home"));if(!e.hasModel)return ze("no-model",n("ui.settings.model.default_effort.no_model"),vt);if(e.settings==="loading")return ze("settings-loading",n("ui.settings.model.default_effort.settings_loading"),vt);if(e.settings==="error")return ze("settings-error",n("ui.settings.model.default_effort.settings_error"),vt);if(e.preview==="loading")return ze("loading",n("ui.settings.model.default_effort.loading"),gt(e.stored));if(e.preview==="error")return ze("error",n("ui.settings.model.default_effort.error"),gt(e.stored));if(e.ladder===null||!e.specResolved)return ze("unresolved",n("ui.settings.model.default_effort.unresolved"),gt(e.stored));const s=e.ladder;if(s.length===0)return ze("empty",n("ui.settings.model.default_effort.empty"),gt(e.stored));const a=vs(s,e.storable);if(a.length===0){const i=Ve(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:ys({ladder:s,resolvedLevel:e.resolvedLevel,stored:e.stored,storable:e.storable}),selectedId:Ol(e.stored,a.map(i=>i.id)),disabled:!1,helper:n("ui.settings.model.default_effort.helper_ready")}}function ze(e,s,a=""){return{kind:e,options:ys({ladder:[],resolvedLevel:null,stored:"",storable:[]}),selectedId:a,disabled:!0,helper:s}}const zl=({hosting:e,modelName:s,focus:a=!1})=>{ee();const i=nn(),o=$t(i.data,"draft_preview"),r=Xs(),d=e!==""&&s!=="",u=Ie({queryKey:Pt.all,queryFn:()=>pe({op:"settings.list"}),enabled:o,staleTime:1e4}),c=u.data?.settings.find(U=>U.key===ht),g=typeof c?.value=="string"?c.value:"",h=(c?.choices??[]).map(U=>U.value).filter(U=>typeof U=="string"),m={cwd:r??"",model:d?{provider:e,model_id:s,reasoning_effort:null}:null},x=u.isSuccess?g:null,_=Ie({...ta(m),queryKey:[...ea(m),"model_effort",x],enabled:o&&!!r&&d}),f=_.isSuccess&&!_.isPlaceholderData,k=f?na(_.data?.snapshot,null).effort:null,C=f&&Array.isArray(k?.reasoning_efforts)?sa(k):null,D=f?aa(k):null,N=k!==null&&!ia(k),[E,b]=l.useState(!1),[j,S]=l.useState(!1),[q,T]=l.useState(null),[z,R]=l.useState(null),te=`${e}\0${s}`,$=en(),G=l.useRef(null),Y=l.useRef(!1),V=l.useCallback(async(U,ie)=>{b(!0),T(U),S(!1),ie===null&&R(null);try{await pe({op:"settings.edit",key:ht,value:U}),await $.invalidateQueries({queryKey:Pt.all}),ie!==null&&R(ie)}catch{S(!0)}finally{b(!1),T(null)}},[$]),K=typeof k?.display_name=="string"&&k.display_name.trim()||s,Z=Dl({supported:o,hasHome:!!r,hasModel:d,settings:u.isError?"error":u.isSuccess?"ready":"loading",preview:_.isError?"error":f?"ready":"loading",ladder:C,specResolved:N,stored:g,resolvedLevel:D,storable:h}),v=Fl({stored:g,ladder:C,resolvedLevel:D,resolved:f&&N&&u.isSuccess,storable:h}),y=l.useRef(null);l.useEffect(()=>{if(v===null||E)return;const U=`${e}\0${s}\0${g}\0${v}`;if(y.current===U)return;y.current=U;const ie=v===""?n("ui.settings.model.default_effort.clamped_unset",{level:Ve(g),model:K}):n("ui.settings.model.default_effort.clamped",{level:Ve(g),model:K,resolved:Ve(v)});V(v,{text:ie,model:te})},[v,g,E,V,e,s,K,te]);const M=l.useMemo(()=>Z.options.map($l),[Z.options]);l.useEffect(()=>{if(!a){Y.current=!1;return}Z.disabled||Y.current||(G.current?.querySelector("[role=combobox]")?.focus(),Y.current=!0)},[a,Z.disabled]);const J=q??Z.selectedId,X=M.find(U=>U.id===J)??(q!==null?{id:q,name:Ve(q)}:null),ae=t.jsxs("span",{className:"flex flex-col gap-0.5",children:[t.jsx("span",{children:Z.helper}),j&&t.jsx("span",{className:"text-danger",children:n("ui.settings.model.default_effort.save_failed")}),t.jsx("output",{"aria-live":"polite",children:z?.model===te?z.text:""})]});return Z.kind==="unsupported"?null:t.jsx("div",{ref:G,"data-setting-key":ht,children:t.jsx(Ei,{label:n("ui.settings.model.default_effort.label"),icon:t.jsx(di,{size:16,"aria-hidden":"true"}),placeholder:n("ui.settings.model.default_effort.placeholder"),options:M,selected:X,onSelect:U=>{V(U.id,null)},helperText:ae,busy:E,busyLabel:n("ui.settings.model.default_effort.busy"),disabled:Z.disabled||E})})};function $l(e){return{id:e.id,name:e.name,description:e.description}}const Pl=e=>e.replace(/[\p{Co}\p{Cc}]/gu," ").replace(/\s+/g," ").trim(),bs=(e,s)=>{const a=s.trim().toLocaleLowerCase();return a?e.filter(i=>`${i.title} ${i.cwd} ${i.sourceId}`.toLocaleLowerCase().includes(a)):e},Kl=(e,s)=>`${e??""}\0${[...s].sort().join("\0")}`,ks=5e3,Ul=(e,s,a,i=ks)=>{const o=new Set(a);let r=!1;for(const d of bs(e,s))if(!o.has(d.sourceId)){if(o.size>=i){r=!0;break}o.add(d.sourceId)}return{selected:o,capped:r}},Bl=/cancel/i,Vl=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"}},Hl=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"}},Gl=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"}},ql=e=>e==="failed"?"danger":e==="metadata_only"||e==="skipped_already_imported"?"neutral":e==="cancelled"?"warning":"success",Qt=e=>Pl(e.title)||e.sourceId,Dn=({path:e,label:s,onCopyPath:a})=>{const[i,o]=l.useState(!1);return t.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-md border border-hairline bg-surface p-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-body-sm text-ink",children:s}),t.jsx("p",{className:"mt-1 break-all font-mono text-meta text-ink-muted",children:e})]}),t.jsxs(F,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{a(e).then(r=>{r&&(o(!0),window.setTimeout(()=>o(!1),1500))})},children:[i?t.jsx(ms,{size:14}):t.jsx(ts,{size:14}),i?n("ui.settings.imports.copied"):n("ui.settings.imports.copy_path")]})]})},Yl=({progress:e,sessions:s,selected:a})=>{const i=new Map(e.results.map(u=>[u.sourceId,u])),o=e.sessionId,r=Math.max(0,e.total-e.completed-(o&&!i.has(o)?1:0)),d=s.filter(u=>a.has(u.sourceId));return t.jsxs("div",{className:"flex flex-col gap-2",children:[e.results.map(u=>t.jsx(js,{row:u,jobCancelled:e.state==="cancelled"},`${u.source}:${u.sourceId}`)),d.filter(u=>!i.has(u.sourceId)&&u.sourceId!==o).map(u=>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:Qt(u)}),t.jsx(at,{variant:"neutral",children:n("ui.settings.imports.session_pending")})]},u.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})]}),r>0&&t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.progress_pending",{count:r})}),e.warnings.map(u=>t.jsx("p",{className:"text-meta text-warning",children:u.message},`${u.code}:${u.sessionId}:${u.message}`))]})},js=({row:e,jobCancelled:s=!1})=>{const i=s&&e.outcome==="failed"&&e.warnings.some(o=>Bl.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(at,{variant:ql(i),children:n(Gl(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))]})},Ql=({sources:e,activeSource:s,sessions:a,query:i,selected:o,preview:r,previewStale:d,confirmed:u,busy:c,error:g,progress:h,result:m,cancelling:x,onSelectSource:_,onQueryChange:f,onToggleSession:k,onSelectAll:C,onClearSelection:D,onPreview:N,onConfirmChange:E,onImport:b,onCancel:j,onRetry:S,onImportAnother:q,onRefresh:T,selectionNotice:z,onCopyPath:R})=>{ee();const te=l.useRef(null),$=e.find(y=>y.source===s),G=h!==null&&!Vl.has(h.state),Y=h?.total??o.size;l.useEffect(()=>{r&&!d&&!h&&!m&&te.current?.scrollIntoView({block:"start",inline:"nearest"})},[r,d,h,m]);const V=l.useMemo(()=>bs(a,i),[i,a]),K=V.length>0&&V.every(y=>o.has(y.sourceId)),Z=o.size,v=Z>0&&r!==null&&!d&&u&&!c&&!h&&!m;return t.jsx(le,{title:n("ui.settings.imports.title"),icon:pt,description:n("ui.settings.imports.description"),dataTourTag:"settings-import-section",children:t.jsxs("div",{className:"flex flex-col gap-5",children:[g&&t.jsxs(se,{variant:"warning",children:[t.jsx(Nt,{children:n("ui.settings.imports.title")}),t.jsx(Ae,{children:t.jsxs("span",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx("span",{children:g}),t.jsx(F,{variant:"secondary",size:"sm",onClick:S,children:n("ui.settings.imports.retry")})]})})]}),c==="sources"&&e.length===0?t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(xe,{className:"h-20 w-full"}),t.jsx(xe,{className:"h-20 w-full"}),t.jsx(xe,{className:"h-20 w-full"}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.loading_sources")})]}):e.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.imports.empty_sources")}):t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.settings.imports.source_heading")}),t.jsxs(F,{variant:"ghost",size:"sm",onClick:T,disabled:G||c==="sources"||c==="sessions",children:[t.jsx(ui,{size:14,className:_e(c==="sources"&&"animate-spin")}),n("ui.settings.imports.refresh")]})]}),!e.some(y=>y.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(y=>{const M=y.source===s,J=y.detected?n(Fn(y.availability)):n("ui.settings.imports.source_not_found");return t.jsxs("button",{type:"button","aria-pressed":M,disabled:G,onClick:()=>_(y.source),className:_e("rounded-lg border p-3 text-left transition-colors disabled:cursor-not-allowed disabled:opacity-60","focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2",M?"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:y.label}),t.jsx(at,{variant:y.detected&&y.availability==="full"?"success":"neutral",children:J})]}),t.jsx("p",{className:"mt-1 text-meta text-ink-muted",children:n("ui.settings.imports.source_sessions",{count:y.sessionCount})}),t.jsx("p",{className:"mt-1 break-all text-meta text-ink-dim",children:y.detail||y.root})]},y.source)})})]}),$&&!h&&!m&&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")," · ",$.label]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(F,{variant:"secondary",size:"sm",onClick:K?D:C,disabled:V.length===0,children:K?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:Z})})]})]}),z&&t.jsx("output",{className:"text-meta text-warning",children:z}),t.jsxs("div",{className:"relative",children:[t.jsx(es,{size:15,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-ink-dim"}),t.jsx(Oe,{value:i,onChange:y=>f(y.target.value),placeholder:n("ui.settings.imports.search_placeholder"),className:"pl-9"})]}),c==="sessions"?t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(xe,{className:"h-12 w-full"}),t.jsx(xe,{className:"h-12 w-full"}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.loading_sessions",{source:$.label})})]}):a.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.imports.empty_sessions",{source:$.label})}):V.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.imports.empty_filter")}):t.jsx("div",{className:"flex max-h-80 flex-col gap-1 overflow-y-auto",children:V.map(y=>t.jsxs("div",{className:"flex items-start gap-3 rounded-md border border-hairline bg-surface p-3 hover:bg-sunken",children:[t.jsx(Gt,{checked:o.has(y.sourceId),onCheckedChange:()=>k(y.sourceId),"aria-label":Qt(y),className:"mt-0.5"}),t.jsxs("button",{type:"button",onClick:()=>k(y.sourceId),className:"min-w-0 flex-1 text-left",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:Qt(y)}),t.jsx(at,{variant:y.availability==="full"?"neutral":"warning",children:n(Fn(y.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:y.messageCount??0,compactions:y.compactionCount})}),t.jsx("span",{children:n("ui.settings.imports.session_updated",{date:sn(new Date((y.updatedTs||y.createdTs)*1e3))})})]}),y.cwd&&t.jsx("span",{className:"mt-1 block break-all font-mono text-meta text-ink-dim",children:y.cwd}),y.availability==="metadata_only"&&t.jsx("span",{className:"mt-1 block text-meta text-warning",children:n("ui.settings.imports.metadata_only_explain")}),y.availability==="unsupported"&&t.jsx("span",{className:"mt-1 block text-meta text-warning",children:n("ui.settings.imports.session_index_only")})]})]},y.sourceId))})]}),$&&Z>0&&!h&&!m&&t.jsxs("div",{ref:te,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.preview_heading")}),t.jsxs(F,{variant:"secondary",size:"sm",onClick:N,disabled:c==="preview"||c==="start",children:[c==="preview"?t.jsx(ft,{size:14,className:"animate-spin"}):t.jsx(pt,{size:14}),c==="preview"?n("ui.settings.imports.loading_preview"):n("ui.settings.imports.preview_heading")]})]}),d&&t.jsx(se,{variant:"warning",children:t.jsx(Ae,{children:n("ui.settings.imports.preview_required")})}),r&&!d&&t.jsxs("div",{className:"flex flex-col gap-2 rounded-lg border border-hairline bg-surface p-4",children:[t.jsx("p",{className:"text-body-sm text-ink",children:n("ui.settings.imports.preview_summary",{sessions:r.totalSessions,messages:r.totalMessages,compactions:r.totalCompactions})}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.preview_memory",{records:r.totalMemoryRecords,tokens:r.projectedMemoryTokens.toLocaleString()})}),r.warnings.slice(0,4).map((y,M)=>t.jsx("p",{className:"text-meta text-warning",children:y.message},`${y.code}:${y.sessionId}:${M}`)),r.warnings.length>4&&t.jsx("p",{className:"text-meta text-warning",children:n("ui.settings.imports.warnings_heading",{count:r.warnings.length})}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.preview_confirm")})]}),t.jsxs("div",{className:"flex items-start gap-2 text-body-sm text-ink",children:[t.jsx(Gt,{checked:u,onCheckedChange:y=>E(y===!0),disabled:!r||d,"aria-label":n("ui.settings.imports.confirm_label"),className:"mt-0.5"}),t.jsx("span",{children:n("ui.settings.imports.confirm_label")})]}),t.jsxs(F,{variant:"primary",onClick:b,disabled:!v,className:"self-start",children:[c==="start"?t.jsx(ft,{size:14,className:"animate-spin"}):t.jsx(pt,{size:14}),n("ui.settings.imports.import_button",{count:Z})]})]}),h&&!m&&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:j,disabled:x||h.state==="done"||h.state==="cancelled"||h.state==="failed",children:[t.jsx(oa,{size:12}),x?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(Hl(h.phase))]}),t.jsx(Ii,{value:h.total?h.completed/h.total*100:0,className:"h-1.5"}),t.jsx(Yl,{progress:h,sessions:a,selected:o})]}),m&&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:m.state==="cancelled"?n("ui.settings.imports.result_summary_cancelled",{state:n(Tt(m.state)),sessions:m.sessions.length,total:Y,messages:m.messages}):n("ui.settings.imports.result_summary",{state:n(Tt(m.state)),sessions:m.sessions.length,messages:m.messages})}),m.sessions.map(y=>t.jsx(js,{row:y,jobCancelled:m.state==="cancelled"},`${y.source}:${y.sourceId}:${y.targetSessionId}`)),(m.instructionReviewPath||m.memoryReviewPath)&&t.jsxs("div",{className:"flex flex-col gap-2",children:[m.instructionReviewPath&&t.jsx(Dn,{path:m.instructionReviewPath,label:n("ui.settings.imports.review_instructions"),onCopyPath:R}),m.memoryReviewPath&&t.jsx(Dn,{path:m.memoryReviewPath,label:n("ui.settings.imports.review_memory"),onCopyPath:R})]}),m.warnings.length>0&&t.jsx(se,{variant:"warning",children:t.jsx(Ae,{children:t.jsxs("span",{className:"flex flex-col gap-1",children:[t.jsx("span",{children:n("ui.settings.imports.warnings_heading",{count:m.warnings.length})}),m.warnings.slice(0,4).map((y,M)=>t.jsx("span",{children:y.message},`${y.code}:${M}`))]})})}),m.error&&t.jsx(se,{variant:"danger",children:t.jsx(Ae,{children:m.error})}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.rerun_safe")})]}),c==="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")]})]})})},un=e=>({source:e.source,sessionId:e.session_id,code:e.code,message:e.message}),ws=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}),Wl=e=>({jobId:e.job_id,state:e.state,sessions:e.sessions.map(ws),messages:e.messages,compactions:e.compactions,memoryImported:e.memory_imported,memorySkipped:e.memory_skipped,memoryReviewPath:e.memory_review_path,instructionReviewPath:e.instruction_review_path,redactions:e.redactions,warnings:e.warnings.map(un),error:e.error});async function Zl(){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 Jl(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 Xl(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(un),instructionReviewPaths:s.instruction_review_paths}}async function ec(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 tc(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(ws),warnings:s.warnings.map(un),error:s.error,startedAt:s.started_at,updatedAt:s.updated_at,result:s.result?Wl(s.result):void 0}}async function nc(e){await pe({op:"imports.cancel",jobId:e})}const mt=new Set(["done","failed","cancelled"]),qe=e=>e instanceof Error?e.message:String(e),sc=()=>{ee();const[e,s]=l.useState([]),[a,i]=l.useState(null),[o,r]=l.useState([]),[d,u]=l.useState(""),[c,g]=l.useState(new Set),[h,m]=l.useState(null),[x,_]=l.useState(null),[f,k]=l.useState(!1),[C,D]=l.useState(null),[N,E]=l.useState(null),[b,j]=l.useState(null),[S,q]=l.useState(null),[T,z]=l.useState(!1),[R,te]=l.useState(null),[$,G]=l.useState(0),Y=l.useRef(0),V=l.useRef(null),K=b!==null&&!mt.has(b.state),Z=l.useCallback(async()=>{D("sources"),E(null);try{const B=await Zl();s(B),i(Q=>B.some(de=>de.source===Q&&de.detected)?Q:B.find(de=>de.detected)?.source??null)}catch(B){E(n("ui.settings.imports.error_sources",{reason:qe(B)}))}finally{D(null)}},[]);l.useEffect(()=>{Z()},[Z]);const v=l.useCallback(async B=>{const Q=++Y.current;D("sessions"),E(null);try{const ge=await Jl(B);if(Q!==Y.current)return;r(ge)}catch(ge){if(Q!==Y.current)return;r([]),E(n("ui.settings.imports.error_sessions",{source:B,reason:qe(ge)}))}finally{Q===Y.current&&D(null)}},[]);l.useEffect(()=>{if(!a){r([]);return}r([]),g(new Set),m(null),_(null),k(!1),q(null),j(null),v(a)},[a,v]);const y=l.useCallback(B=>{g(B),m(null),_(null),k(!1),te(null)},[]),M=l.useCallback(B=>{K||(i(B),u(""))},[K]),J=l.useCallback(B=>{const Q=new Set(c);Q.has(B)?Q.delete(B):Q.add(B),y(Q)},[y,c]),X=l.useCallback(()=>{const B=Ul(o,d,c);y(B.selected),B.capped&&te(n("ui.settings.imports.selection_limit",{max:ks}))},[d,y,c,o]),ae=l.useCallback(()=>{y(new Set)},[y]),U=l.useMemo(()=>Kl(a,c),[a,c]),ie=h!==null&&x!==U,ce=l.useCallback(async()=>{if(!(!a||c.size===0)){D("preview"),E(null);try{const B=await Xl({sources:[a],sessionIds:{[a]:[...c].sort()}});m(B),_(U)}catch(B){m(null),_(null),E(n("ui.settings.imports.error_preview",{reason:qe(B)}))}finally{D(null)}}},[a,U,c]),Ne=l.useCallback(async()=>{if(!(!a||c.size===0||!h||ie||!f||b)){D("start"),E(null),q(null);try{const B=await ec({sources:[a],sessionIds:{[a]:[...c].sort()}}),Q=Date.now()/1e3;j({jobId:B,state:"queued",phase:"queued",source:a,sessionId:"",completed:0,total:c.size,results:[],warnings:[],error:"",startedAt:Q,updatedAt:Q})}catch(B){E(n("ui.settings.imports.error_start",{reason:qe(B)}))}finally{D(null)}}},[a,f,h,ie,b,c]),fe=b?.jobId??null,ve=b?.state??null;l.useEffect(()=>{if(!fe||!ve||mt.has(ve))return;let B=!0,Q;const ge=async()=>{try{const de=await tc(fe);if(!B)return;if(V.current){const Se=V.current;V.current=null,E(Ge=>Ge===Se?null:Ge)}j(de),de.result&&q({...de.result,jobId:de.jobId}),mt.has(de.state)||(Q=setTimeout(ge,900))}catch(de){if(!B)return;const Se=n("ui.settings.imports.error_job",{reason:qe(de)});V.current=Se,E(Se),Q=setTimeout(ge,2e3)}};return Q=setTimeout(ge,$>0?0:700),()=>{B=!1,Q&&clearTimeout(Q)}},[fe,ve,$]);const A=l.useCallback(async()=>{if(!(!b||mt.has(b.state))){z(!0),E(null);try{await nc(b.jobId)}catch(B){E(n("ui.settings.imports.error_cancel",{reason:qe(B)}))}finally{z(!1)}}},[b]),H=l.useCallback(()=>{g(new Set),m(null),_(null),k(!1),te(null),q(null),j(null),E(null),a&&v(a)},[a,v]),L=l.useCallback(async B=>{try{return await navigator.clipboard.writeText(B),!0}catch{return!1}},[]),ne=l.useCallback(async()=>{K||(te(null),await Z(),a&&await v(a))},[a,K,v,Z]),oe=l.useCallback(()=>{if(K){E(null),G(B=>B+1);return}ne()},[K,ne]);return t.jsx(Ql,{sources:e,activeSource:a,sessions:o,query:d,selected:c,preview:h,previewStale:ie,confirmed:f,busy:C,error:N,progress:b,result:S,cancelling:T,onSelectSource:M,onQueryChange:u,onToggleSession:J,onSelectAll:X,onClearSelection:ae,onPreview:()=>void ce(),onConfirmChange:k,onImport:()=>void Ne(),onCancel:()=>void A(),onRetry:oe,onImportAnother:H,onRefresh:ne,selectionNotice:R,onCopyPath:L})},ac=e=>{const s=e.label.replace(/^Open\s+/,"");return s.charAt(0).toUpperCase()+s.slice(1)},ic=({action:e})=>{ee();const s=l.useId(),a=l.useRef(null),i=Pe(f=>f.shortcutBindings),o=i[e.id],r=Pe(f=>f.setShortcutBinding),d=Pe(f=>f.clearShortcutBinding),[u,c]=l.useState(!1),[g,h]=l.useState(null),m=l.useMemo(ra,[]),x=ni(e.id,i),_=ac(e);return t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx(Ee,{htmlFor:s,className:"w-32 text-body-sm text-ink",children:_}),t.jsx(Oe,{id:s,readOnly:!0,value:x===null?n("ui.settings.shortcuts.keyboard_shortcuts_section.no_shortcut"):si(x,m),"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:_e("w-52",x===null?"text-body-sm":"font-mono text-body-sm"),onFocus:()=>c(!0),onBlur:()=>{c(!1),h(null)},onKeyDown:f=>{if(la.has(f.key))return;if(ca.has(f.key)){c(!1),h(null);return}if(da.has(f.key)||f.nativeEvent.isComposing)return;const k=ua({key:f.key,metaKey:f.metaKey,ctrlKey:f.ctrlKey,altKey:f.altKey,shiftKey:f.shiftKey}),C=ai(k,e.id,i,m);if(C!==null){f.preventDefault(),c(!0),h(C);return}if(k===x){c(!0),h(null);return}f.preventDefault(),c(!0),h(null),k===e.defaultChord?r(e.id,null):k!==null&&r(e.id,k)}}),x!==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:()=>{r(e.id,null),a.current?.focus()},children:n("ui.settings.shortcuts.keyboard_shortcuts_section.reset")})]}),u&&t.jsx("span",{className:"text-meta text-ink-dim",children:n("ui.settings.shortcuts.keyboard_shortcuts_section.press_the_keys_you_want_esc_cancels")}),g!==null&&t.jsx("output",{className:"text-meta text-danger",children:g})]})},oc=({sectionRef:e})=>(ee(),t.jsx(le,{title:n("ui.settings.shortcuts.keyboard_shortcuts_section.keyboard_shortcuts"),icon:gi,description:n("ui.settings.shortcuts.keyboard_shortcuts_section.shortcuts_for_the_panel_rail_focus_a_field_and_press_the_keys_you"),sectionRef:e,children:t.jsx("div",{className:"flex flex-col gap-4",children:ti.map(s=>t.jsx(ic,{action:s},s.id))})})),rc=[[[".claude.json"],"Claude Code"],[[".claude",".mcp.json"],"Claude Code"],[[".cursor","mcp.json"],"Cursor"],[[".vscode","mcp.json"],"VS Code"],[[".codex","config.toml"],"Codex CLI"]];function Ns(e){if(!e)return null;const s=e.split("\\").join("/").split("/").filter(Boolean);for(const[a,i]of rc)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}),lc=e=>n("ui.settings.integrations.integration_model.integration_count",{count:e}),cc=["connected","needs_sign_in","not_started","connecting","error"],Ss=e=>cc.includes(e),Ze=(e,s)=>[...s].filter(a=>a.name===e&&a.status==="running").sort((a,i)=>i.created_at-a.created_at)[0]??null,dc={connectedAt:null,connectedToolCount:null,settledGroup:null,pinnedGroup:null,pinnedOperationId:null,needsKey:!1,needsSignIn:!1,disconnectedAt:null,holdUntil:null,lastDecisive:null},uc=1e12,gc=1e9,mc=60*60*1e3,Ms=(e,s=Date.now())=>{if(typeof e!="number"||!Number.isFinite(e))return null;const a=e>=uc?e:e<gc?null:e*1e3;return a===null||a>s+mc?null:Math.min(a,s)},He=(e,s)=>e?.[s]??dc,rt=(e,s,a)=>hc(e,s)??a?.lastDecisive??null,_c=e=>({id:e.id,name:e.name,action:e.action,status:e.status,created_at:e.created_at,credential_removed:e.credential_removed,...e.message?{message:e.message}:{}}),gn=(e,s)=>e.status==="not_started"&&typeof e.tool_count=="number"&&(s.connectedAt!==null||e.status_basis==="stored"&&e.tool_count_basis==="last_seen"),pc=(e,s)=>[...s].filter(a=>a.name===e).sort((a,i)=>i.created_at-a.created_at)[0]??null,hc=(e,s)=>pc(e,s.filter(a=>a.status!=="cancelled")),Mt=e=>e.actions.includes("set_key")||e.actions.includes("add_key");function fc(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 xc(e,s=[],a,i=Date.now()){const o=He(a,e.name),r=Ze(e.name,s);if(r){if(r.action==="login"||r.action==="reauth")return{label:n("ui.settings.integrations.integration_model.signing_in"),tone:"info",detail:null,busy:!0};if(r.action==="logout")return{label:n("ui.settings.integrations.integration_model.signing_out"),tone:"info",detail:null,busy:!0}}if(!Ss(e.status))return{label:n("ui.settings.integrations.integration_model.status_unavailable"),tone:"neutral",detail:null,busy:!1};const d=rt(e.name,s,o),u=Ct(d)&&e.status!=="connected",c=gn(e,o),g=pn(d)&&e.status!=="connected",h=(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"||st(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(u)return{label:n("ui.settings.integrations.integration_model.signed_out"),tone:"warning",detail:null,busy:!1};if(g)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(st(e,s,o))return{label:n("ui.settings.integrations.integration_model.needs_a_key"),tone:"warning",detail:null,busy:!1};if(h)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"||st(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 m=o.connectedAt??Ms(e.last_seen_at,i);return{label:m!==null?n("ui.settings.integrations.integration_model.worked_when_with_tools",{when:String(fc(i,m)),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 Cs=e=>n("ui.settings.integrations.integration_model.replace_keys",{count:e}),yc=/[,;]?\s*(?:or|and)?\s*add (?:its|a|the) key instead\.?\s*$/i;function vc(e,s){const a=e?.trim()??"";if(!a)return null;if(s)return a;const i=a.replace(yc,"").trim();return i?/\.$/.test(i)?i:`${i}.`:a}const bc="ui.settings.integrations.integration_model.copy_ready_explanation",kc="ui.settings.integrations.integration_model.copy_not_connected_explanation",jc=e=>e.transport==="local_command"?n("ui.settings.integrations.integration_model.local_command"):n("ui.settings.integrations.integration_model.remote_url");function As(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 Ns(e.source.path)}}function wc(e,s){const a=[jc(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=As(e);return i?a.push(n("ui.settings.integrations.integration_model.imported_from_origin",{origin:String(i)})):e.source.editable||a.push(n("ui.settings.integrations.integration_model.imported_from_a_project_file")),a}const mn=(e,s)=>s.disconnectedAt!==null?"not_started":e.status;function _n(e,s=[],a){const i=He(a,e.name),o=Ze(e.name,s);if(o)return o.action==="login"||o.action==="reauth"?{kind:"sign_in",label:n("ui.settings.integrations.integration_model.continue_sign_in")}:null;const r=h=>e.actions.includes(h),d=Mt(e),u=st(e,s,i);if(!Ss(e.status))return r("test")?{kind:"test",label:n("ui.settings.integrations.integration_model.check_again")}:null;const c=rt(e.name,s,i),g=c?.status==="failed"&<(c);switch(mn(e,i)){case"connected":case"connecting":return null;case"needs_sign_in":return u?{kind:"set_key",label:n("ui.settings.integrations.integration_model.add_key")}:r("sign_in")?{kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")}:d?{kind:"set_key",label:n("ui.settings.integrations.integration_model.add_key")}:r("reauth")?{kind:"reauth",label:n("ui.settings.integrations.integration_model.sign_in_again")}:{kind:"fix",label:n("ui.settings.integrations.integration_model.fix")};case"error":return r("connect")?{kind:"connect",label:n("ui.settings.integrations.integration_model.reconnect")}:r("test")?{kind:"test",label:n("ui.settings.integrations.integration_model.retry")}:{kind:"fix",label:n("ui.settings.integrations.integration_model.fix")};default:{if(Ct(c)&&r("sign_in"))return{kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")};if(pn(c)&&r("sign_out"))return{kind:"sign_out",label:n("ui.settings.integrations.integration_model.sign_out_again")};if(i.disconnectedAt!==null&&r("connect"))return{kind:"connect",label:n("ui.settings.integrations.integration_model.connect")};if(i.needsSignIn){if(u&&d)return{kind:"set_key",label:n("ui.settings.integrations.integration_model.add_key")};if(r("sign_in"))return{kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")}}return u&&d?{kind:"set_key",label:n("ui.settings.integrations.integration_model.add_key")}:g&&r("sign_in")?{kind:"sign_in",label:n("ui.settings.integrations.integration_model.try_again")}:gn(e,i)&&!r("connect")?null:r("connect")?{kind:"connect",label:n("ui.settings.integrations.integration_model.connect"),...i.connectedAt===null&&e.status_basis!=="live"?{variant:"ghost"}:{}}:r("test")&&e.tool_count===null&&e.tool_count_basis===null?{kind:"test",label:n("ui.settings.integrations.integration_model.test"),variant:"ghost"}:null}}}const lt=e=>e.action==="login"||e.action==="reauth",Ct=e=>!!(e&&e.action==="logout"&&e.status==="complete"),pn=e=>!!(e&&e.action==="logout"&&e.status!=="running"&&e.status!=="complete"),Es=/no oauth authorization server/i;function st(e,s,a){if(!Mt(e))return!1;const i=rt(e.name,s,a);return i&<(i)&&i.status==="failed"&&Es.test(i.message??"")?!0:a.needsKey}function Nc(e,s=[],a){const i=_n(e,s,a)?.kind,o=mn(e,He(a,e.name)),r=c=>e.actions.includes(c),d=[],u=Ze(e.name,s);if(u&&d.push({kind:"cancel",label:n("ui.settings.integrations.integration_model.cancel")}),!u&&r("test")&&i!=="test"&&d.push({kind:"test",label:n("ui.settings.integrations.integration_model.test_connection")}),r("connect")&&i!=="connect"&&o!=="connected"&&d.push({kind:"connect",label:n("ui.settings.integrations.integration_model.reconnect")}),!u&&r("sign_in")&&i!=="sign_in"&&o!=="connected"&&d.push({kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")}),r("reload")&&d.push({kind:"reload",label:n("ui.settings.integrations.integration_model.reload")}),!u&&r("reauth")&&i!=="reauth"&&d.push({kind:"reauth",label:n("ui.settings.integrations.integration_model.sign_in_again")}),Mt(e)&&i!=="set_key"&&d.push({kind:"set_key",label:e.auth.secret_refs.length>0?n("ui.settings.integrations.integration_model.update_key"):n("ui.settings.integrations.integration_model.add_key")}),r("sign_out")&&d.push({kind:"sign_out",label:n("ui.settings.integrations.integration_model.sign_out")}),r("disconnect")&&o==="connected"&&d.push({kind:"disconnect",label:n("ui.settings.integrations.integration_model.disconnect")}),r("copy_setup")&&e.setup_prompt&&d.push({kind:"copy_setup",label:n("ui.settings.integrations.integration_model.copy_setup_prompt")}),i!=="fix"&&d.push({kind:"open_config",label:n("ui.settings.integrations.integration_model.open_config_file")}),r("remove"))d.push({kind:"remove",label:n("ui.settings.integrations.integration_model.remove"),destructive:!0});else if(!e.source.editable){const c=As(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 Sc={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 Is(e,s=[],a){const i=He(a,e.name),o=Ze(e.name,s),r=mn(e,i);if(o&&i.pinnedGroup&&i.pinnedOperationId===o.id)return i.pinnedGroup;if(r==="needs_sign_in"||r==="error")return"attention";const d=rt(e.name,s,i);return Ct(d)&&r!=="connected"||pn(d)&&r!=="connected"?"attention":i.disconnectedAt!==null?"ready":st(e,s,i)||i.needsSignIn&&r!=="connected"||d?.status==="failed"&<(d)&&r!=="connected"?"attention":r==="connected"||e.status_basis==="stored"&&gn(e,i)?"connected":o&&o.action!=="test"?"attention":"ready"}function Mc(e,s=[],a){return["attention","connected","ready"].map(o=>({id:o,title:Sc[o],rows:e.filter(r=>Is(r,s,a)===o)})).filter(o=>o.rows.length>0)}function Cc(e,s,a=Date.now()){if(!s)return e??{};const i={};for(const o of s.servers){const r=He(e,o.name),d=Ze(o.name,s.operations),u=rt(o.name,s.operations,r),c=Ct(u),g=o.status==="connected"&&(o.status_basis==="probe"||o.status_basis==="live"),h=r.holdUntil!==null&&a<r.holdUntil,m=!h&&!c&&r.connectedAt===null&&o.status_basis==="stored"&&o.tool_count_basis==="last_seen"?Ms(o.last_seen_at,a):null,x=!c,_=u?.status==="failed"&<(u)&&Es.test(u.message??""),f={connectedAt:g&&!h?a:m!==null?m:x?r.connectedAt:null,connectedToolCount:g&&!h||m!==null?o.tool_count??r.connectedToolCount:x?r.connectedToolCount:null,settledGroup:r.settledGroup,pinnedGroup:d&&r.pinnedOperationId===d.id?r.pinnedGroup:d?r.settledGroup:null,pinnedOperationId:d?d.id:null,needsKey:g?!1:r.needsKey||_,needsSignIn:g||c?!1:r.needsSignIn||o.status==="needs_sign_in",disconnectedAt:g&&!h?null:r.disconnectedAt,holdUntil:h?r.holdUntil:null,lastDecisive:u?_c(u):null};d||(f.settledGroup=Is(o,s.operations,{...i,[o.name]:f})),i[o.name]=f}return i}const Ac=(e,s)=>e!==null&&s===e,Wt="local-operator.settings.integrations.row-memory",Rs=(e,s)=>`${e}#${s}`;function Ec(e,s){const a={};if(!s)return a;for(const i of s.servers){const o=e[i.name];o&&(a[Rs(i.source.path,i.name)]=o)}return a}function Ic(e,s,a){if(!s)return e;let i=null;for(const o of s.servers){if(Object.prototype.hasOwnProperty.call(e,o.name))continue;const r=Lc(a[Rs(o.source.path,o.name)]);r&&(i=i??{...e},i[o.name]=r)}return i??e}const Rc=["attention","connected","ready"],Ts=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),hn=e=>typeof e=="number"&&Number.isFinite(e)?e:null,zn=e=>Rc.includes(e)?e:null,Ot=e=>{const s=hn(e);return s!==null&&s>=1e12?s:null};function Tc(e){if(!Ts(e)||typeof e.id!="string"||typeof e.name!="string")return null;const s=e.action,a=e.status;return s!=="login"&&s!=="logout"&&s!=="reauth"&&s!=="test"||a!=="running"&&a!=="complete"&&a!=="cancelled"&&a!=="failed"?null:{id:e.id,name:e.name,action:s,status:a,created_at:hn(e.created_at)??0,credential_removed:e.credential_removed===!0,...typeof e.message=="string"?{message:e.message}:{}}}function Lc(e){if(!Ts(e))return null;const s=Ot(e.connectedAt),a=Ot(e.disconnectedAt),i=e.needsKey===!0,o=e.needsSignIn===!0,r=Tc(e.lastDecisive);return s===null&&a===null&&!i&&!o&&!r?null:{connectedAt:s,connectedToolCount:hn(e.connectedToolCount),settledGroup:zn(e.settledGroup),pinnedGroup:zn(e.pinnedGroup),pinnedOperationId:typeof e.pinnedOperationId=="string"?e.pinnedOperationId:null,needsKey:i,needsSignIn:o,disconnectedAt:a,holdUntil:Ot(e.holdUntil),lastDecisive:r}}const Ls=2e3,$n=8e3;function Oc(e){return e&&(e.servers.some(a=>a.status==="connecting")||e.operations.some(a=>a.status==="running"))?Ls:!1}const Fc=/^[A-Za-z0-9_.:-]{1,100}$/,Dc=/:\/\//;function zc(e,s){const a=e.trim();return a?Fc.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 $c(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"):Dc.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 Pc=e=>e.split(`
|
|
287
|
-
`).map(s=>s.trim()).filter(Boolean);function Zt(e,s){const a=!!e?.cold,i=(e?.servers??[]).map(o=>{const r=o.transport==="http",d=o.secret_refs??[],u=o.status==="connected"?"connected":o.status==="connecting"?"connecting":o.status==="auth-required"?"needs_sign_in":"not_started",c=[];u!=="connected"&&c.push("connect"),u==="connected"&&c.push("disconnect"),a||c.push("reload"),r&&o.transport_oauth_supported!==!1&&c.push("sign_in"),d.length>0&&c.push("set_key"),o.owned_scope&&c.push("remove"),o.setup?.text&&c.push("copy_setup");const g=Ns(o.source);return{id:o.name,name:o.name,scope:o.owned_scope??"global",project_cwd:null,source:{kind:Kc(o.source,g,o.owned_scope),path:o.source??"",editable:o.owned_scope!==null,owned_scope:o.owned_scope},transport:r?"remote_url":"local_command",endpoint:{command:null,url:null,endpoint_redacted:!1},status:u,status_reason:null,status_observed_at:null,last_seen_at:null,status_basis:a?"stored":"live",auth:{kind:d.length?"api_key":r?"unknown":"none",signed_in:null,secret_refs:d.map(h=>({id:h.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 Kc=(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")}},Uc="ui.settings.integrations.integration_model.copy_catalog_refusal_fallback";function _t(e,s,a){if(s instanceof an&&s.status===409){const i=typeof s.code=="string"&&Object.prototype.hasOwnProperty.call(Pn,s.code)?Pn[s.code]:n(Uc);return`${ga[e]}. ${i}`}return ma(e,s,a).message}const Bc="ui.settings.integrations.add_integration_form.copy_add_integration_pickup_note",Vc="ui.settings.integrations.add_integration_form.copy_transport_hint",Hc=({existingNames:e,projectScopeAvailable:s,projectLabel:a,onSubmit:i,onCancel:o,initial:r})=>{ee();const[d,u]=l.useState(r?.name??""),[c,g]=l.useState(r?.mode??"command"),[h,m]=l.useState(r?.command??""),[x,_]=l.useState(r?.args??""),[f,k]=l.useState(r?.url??""),[C,D]=l.useState("global"),[N,E]=l.useState(r?.touched?{name:!0,command:!0,url:!0}:{}),[b,j]=l.useState(!!r?.touched),[S,q]=l.useState(!1),[T,z]=l.useState(null),R=l.useRef(null),te=l.useRef(null),$=l.useRef(null);l.useEffect(()=>{R.current?.focus()},[]);const G=zc(d,e),Y=c==="command"&&!h.trim()?n("ui.settings.integrations.add_integration_form.enter_the_command_to_run"):null,V=c==="url"?$c(f):null,K=M=>b||N[M],Z=async M=>{if(M.preventDefault(),j(!0),G||Y||V){G?R.current?.focus():Y?te.current?.focus():$.current?.focus();return}q(!0),z(null);const J=s?C:"global",X=c==="command"?{name:d.trim(),scope:J,mode:c,command:h.trim(),args:Pc(x)}:{name:d.trim(),scope:J,mode:c,url:f.trim()},ae=await i(X);q(!1),z(ae)},v=(M,J,X)=>J&&K(X)?t.jsx("p",{id:M,className:"text-body-sm text-danger",children:J}):null,y=M=>M.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:M=>void Z(M),onKeyDown:M=>{M.key==="Escape"&&(M.stopPropagation(),o())},children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Ee,{htmlFor:"integration-add-name",children:n("ui.settings.integrations.add_integration_form.name")}),t.jsx(Oe,{ref:R,id:"integration-add-name",value:d,placeholder:n("ui.settings.integrations.add_integration_form.e_g_notion"),autoComplete:"off","aria-invalid":!!(G&&K("name")),"aria-describedby":G&&K("name")?"integration-add-name-error":void 0,onChange:M=>u(M.target.value),onBlur:()=>E(M=>({...M,name:!0}))}),v("integration-add-name-error",G,"name")]}),t.jsxs(jt,{value:c,onValueChange:M=>g(M==="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(Ye,{value:"command","data-integration-transport":"command",children:n("ui.settings.integrations.add_integration_form.local_command")}),t.jsx(Ye,{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(Vc)}),t.jsxs(Nn,{value:"command",className:"mt-0 flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Ee,{htmlFor:"integration-add-command",children:n("ui.settings.integrations.add_integration_form.command")}),t.jsx(Oe,{ref:te,id:"integration-add-command",value:h,placeholder:n("ui.settings.integrations.add_integration_form.e_g_npx"),autoComplete:"off",className:"font-mono","aria-invalid":!!(Y&&K("command")),"aria-describedby":Y&&K("command")?"integration-add-command-error":void 0,onChange:M=>m(M.target.value),onBlur:()=>E(M=>({...M,command:!0}))}),v("integration-add-command-error",Y,"command")]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs(Ee,{htmlFor:"integration-add-args",children:[n("ui.settings.integrations.add_integration_form.arguments")," ",t.jsx("span",{className:"font-normal text-ink-dim",children:n("ui.settings.integrations.add_integration_form.one_per_line")})]}),t.jsx(_s,{id:"integration-add-args",value:x,rows:2,className:"font-mono",onChange:M=>_(M.target.value)})]})]}),t.jsx(Nn,{value:"url",className:"mt-0 flex flex-col gap-4",children:t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Ee,{htmlFor:"integration-add-url",children:n("ui.settings.integrations.add_integration_form.url")}),t.jsx(Oe,{ref:$,id:"integration-add-url",type:"url",value:f,placeholder:n("ui.settings.integrations.add_integration_form.https_mcp_example_com_mcp"),autoComplete:"off",className:"font-mono","aria-invalid":!!(V&&K("url")),"aria-describedby":V&&K("url")?"integration-add-url-error":"integration-add-url-help",onChange:M=>k(M.target.value),onBlur:()=>E(M=>({...M,url:!0}))}),v("integration-add-url-error",V,"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:M=>D(M==="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(Ye,{value:"global","data-integration-scope":"global",children:n("ui.settings.integrations.add_integration_form.all_chats")}),t.jsx(Ye,{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,T?t.jsx("p",{className:"text-body-sm text-danger",role:"alert",children:T}):null,t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx("p",{className:_e("text-body-sm text-ink-dim"),children:n(Bc)}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(F,{type:"button",variant:"ghost",size:"md",onMouseDown:y,onClick:o,children:n("ui.settings.integrations.add_integration_form.cancel")}),t.jsxs(F,{type:"submit",variant:"primary",size:"md",disabled:S,onMouseDown:y,children:[S?t.jsx(ye,{size:"xs"}):null,n("ui.settings.integrations.add_integration_form.add_integration")]})]})]})]})},Gc=4;function qc(e){return e.rowMoving?e.now+e.windowMs:Math.max(e.hold.until,e.lastMovingAt+e.windowMs)}function Yc(e){return e.now>e.hold.until||e.hold.reanchors>=Gc?"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 Qc(e){const s=qc({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=Yc({hold:{until:s,reanchors:e.hold.reanchors,landedOn:a},candidate:i,active:e.active,body:e.body,now:e.now});if(o==="settled")return{hold:{until:s,reanchors:e.hold.reanchors,landedOn:a},land:null};if(o==="drop")return{hold:null,land:null};const r=!a.isConnected;return{hold:{until:r?e.now+e.windowMs:s,reanchors:r?e.hold.reanchors+1:e.hold.reanchors,landedOn:i},land:i}}function Wc(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 Zc(e){return Un(e.primary)?e.primary??null:Un(e.overflow)?e.overflow??null:null}function Jc(e){return e.verdict==="finished"?null:e.watchMs}const Os="key";function Xc(e){const{name:s,keyless:a,freeName:i,names:o,values:r,replace:d,canReplace:u}=e;if(a){const c=Jt(s,i);return{values:{[c]:(r[Os]??"").trim()},confirmedReplace:d&&u?[c]:[],header:i.trim()}}return{values:Object.fromEntries(o.map(c=>[c,(r[c]??"").trim()])),confirmedReplace:d&&u?o:[],header:void 0}}function Jt(e,s){const a=Bn(e),i=Bn(s);if(!i)return"";const o=[a,i].filter(Boolean).join("_"),r=/^[A-Za-z_]/.test(o)?o:`K_${o}`;if(r.length<=Ft)return r;const d=ed(a),u=Ft-i.length-d.length-2,c=[a.slice(0,Math.max(u,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,""),ed=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)},td=({name:e,keyNames:s,keyless:a=!1,savedKeys:i=[],saving:o,failure:r,onSave:d,onClose:u})=>{ee();const[c,g]=l.useState({}),[h,m]=l.useState(!1),[x,_]=l.useState(""),f=a?[Jt(e,x)]:[...s],k=a?[Os]:f,C=(a?Jt(e,x).length>0:!0)&&k.every(N=>(c[N]??"").trim()),D=f.some(N=>i.includes(N));return t.jsx(ns,{open:!0,onClose:u,maxWidth:"xs",title:n("ui.settings.integrations.integration_key_dialog.add_keys_heading",{count:a?1:s.length,name:e}),actions:t.jsxs(t.Fragment,{children:[t.jsx(Kt,{onClick:u,children:n("ui.settings.integrations.integration_key_dialog.cancel")}),t.jsx(Ut,{disabled:!C||o,onClick:()=>{const N=Xc({name:e,keyless:a,freeName:x,names:f,values:c,replace:h,canReplace:D});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(Ee,{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:x,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,k.filter(N=>a!==!0||N.trim().length>0).map(N=>t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Ee,{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:E=>g(b=>({...b,[N]:E.target.value}))})]},N)),D?t.jsxs("div",{className:"flex items-center gap-2 text-body-sm",children:[t.jsx(Gt,{id:"integration-key-replace",checked:h,onCheckedChange:N=>m(N===!0)}),t.jsx(Ee,{htmlFor:"integration-key-replace",className:"font-normal",children:Cs(f.length)})]}):null,r?t.jsx("p",{className:"-mx-1.5 text-body-sm text-danger",role:"alert",children:r}):null]})})},nd={success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info",neutral:"bg-ink-dim"},sd={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(bc);if(e===n("ui.settings.integrations.integration_model.not_connected"))return n(kc)}const ad=({row:e,operations:s,memories:a,now:i,projectScopeAvailable:o,highlighted:r=!1,rowRef:d,primaryRef:u,overflowRef:c,pending:g,failure:h,confirm:m,onPrimary:x,onOverflow:_,onConfirm:f,onCancelConfirm:k})=>{ee();const C=xc(e,s,a,i),D=r&&C.tone==="danger"?"text-ink":sd[C.tone],N=_n(e,s,a),E=Nc(e,s,a),b=wc(e,o),j=E.findIndex(S=>S.kind==="remove"||S.kind==="remove_elsewhere");return t.jsxs("li",{ref:d,"data-integration":e.name,"data-status":e.status,className:_e("flex min-h-14 flex-col justify-center gap-1 px-4 py-2.5",r&&"bg-row-selected"),onKeyDown:S=>{!m||S.key!=="Escape"||(S.stopPropagation(),k())},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(ye,{size:"xs"}):t.jsx("span",{"aria-hidden":"true","data-tone":C.tone,className:_e("size-2 rounded-full",nd[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:b.map((S,q)=>t.jsxs("span",{children:[q>0?" · ":null,S.startsWith("Imported from")&&e.source.path?t.jsx(We,{content:_a(e.source.path),children:t.jsx("span",{className:"underline decoration-dotted underline-offset-2",children:S})}):S]},S))})]}),Vn(C.label)?t.jsx(We,{content:Vn(C.label),children:t.jsx("span",{className:_e("shrink-0 text-body-sm",D),children:C.label})}):t.jsx("span",{className:_e("shrink-0 text-body-sm",D),children:C.label}),N?t.jsxs(F,{ref:u,variant:N.variant??"secondary",size:"sm","aria-label":`${N.label} ${e.name}`,disabled:g,"data-integration-action":N.kind,onClick:()=>x(N),children:[g?t.jsx(ye,{size:"xs"}):null,N.label]}):null,t.jsxs(Ri,{children:[t.jsx(Ti,{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:g,children:t.jsx(pa,{"aria-hidden":"true"})})}),t.jsx(Li,{align:"end",className:"min-w-48",children:E.map((S,q)=>t.jsx(id,{item:S,separated:q===j&&q>0,onSelect:()=>_(S)},S.kind))})]})]}),C.detail?t.jsx("p",{className:_e("pl-7 text-body-sm",C.tone==="danger"?"text-ink-muted":"text-ink-dim"),children:C.detail}):null,h?t.jsx("p",{className:_e("pl-7 text-body-sm",r?"text-ink":"text-danger"),role:"alert",children:h}):null,m?t.jsxs("div",{className:"flex flex-wrap items-center gap-2 pl-7",children:[t.jsx("span",{className:"text-body-sm text-ink",children:m.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:m.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:f,"data-integration-confirm":m.kind,children:m.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:k,children:n("ui.settings.integrations.integration_row.keep")})]}):null]})},id=({item:e,separated:s,onSelect:a})=>(ee(),t.jsxs(t.Fragment,{children:[s?t.jsx(Oi,{}):null,e.kind==="remove_elsewhere"?t.jsxs(Sn,{disabled:!0,className:"flex-col items-start gap-0.5",children:[t.jsx("span",{children:e.label}),t.jsx("span",{className:"text-meta text-ink-dim",children:e.hint})]}):t.jsx(Sn,{destructive:e.kind==="remove",onSelect:a,"data-integration-menu":e.kind,children:e.label})]}));function od(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:vc(s.message,a)??n("ui.settings.integrations.integration_sign_in_dialog.the_server_didn_t_say_why"),nextStep:rd(s.message??null,a)}}function rd(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 ld(e,s){return e.kind==="ready"?"ready":e.kind==="running"&&s&&s.tone!=="progress"?s.tone==="success"?"success":"failure":"running"}const cd=({name:e,action:s,keyRoute:a,phase:i,onStart:o,onCancel:r,onOpenLink:d,onClose:u})=>{ee();const c=i.kind==="running"?i.operation:null,g=i.kind==="running"?od(e,c,a):null,h=i.kind==="starting"||i.kind==="running"&&g?.tone==="progress",m=g&&g.tone!=="progress",x=l.useRef(null),_=l.useRef(!1),f=ld(i,g);l.useEffect(()=>{if(!_.current){_.current=!0;return}f&&x.current?.focus()},[f]);const k=()=>u(g?.tone==="success"?"signed-in":"dismissed");return t.jsx(ns,{open:!0,onClose:k,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(),x.current?.focus()}},actions:t.jsxs(t.Fragment,{children:[h&&c?t.jsx(Kt,{ref:x,onClick:()=>r(c.id),children:n("ui.settings.integrations.integration_sign_in_dialog.cancel_sign_in")}):t.jsx(Kt,{ref:i.kind==="ready"?void 0:x,onClick:k,children:g?.tone==="success"?n("ui.settings.integrations.integration_sign_in_dialog.done"):n("ui.settings.integrations.integration_sign_in_dialog.close")}),i.kind==="ready"?t.jsx(Ut,{ref:x,onClick:o,children:n("ui.settings.integrations.integration_sign_in_dialog.continue_in_browser")}):null,i.kind==="refused"||g?.tone==="failure"?t.jsx(Ut,{ref:g?.tone==="failure"?x:void 0,onClick:o,children:n("ui.settings.integrations.integration_sign_in_dialog.try_again")}):null]}),children:t.jsxs("div",{className:"flex flex-col gap-3 p-1.5 text-body text-ink-muted","aria-live":"polite",children:[i.kind==="ready"?t.jsx("p",{className:"-mx-1.5",children:n("ui.settings.integrations.integration_sign_in_dialog.browser_approval_notice",{name:e,replaces:s==="reauth"?"yes":"no"})}):null,i.kind==="starting"?t.jsxs("p",{className:"-mx-1.5 flex items-center gap-2",children:[t.jsx(ye,{size:"xs"}),n("ui.settings.integrations.integration_sign_in_dialog.starting_sign_in")]}):null,g?t.jsxs("div",{className:"flex flex-col gap-1",role:m?"status":void 0,children:[t.jsxs("p",{className:(g.tone==="success","-mx-1.5 flex items-start gap-2 text-ink"),children:[g.tone==="progress"?t.jsx(ye,{size:"xs",className:"mt-0.5"}):null,g.tone==="failure"?t.jsx(Fi,{"aria-hidden":"true",className:"mt-0.5 size-4 shrink-0 text-danger"}):null,t.jsx("span",{children:g.message})]}),g.reason?t.jsx("p",{className:"-mx-1.5 text-ink-muted",children:g.reason}):null,g.nextStep?t.jsx("p",{className:"-mx-1.5 text-ink-muted",children:g.nextStep}):null]}):null,g?.link&&g.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:g.link,children:g.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(g.link??"").then(()=>Bt(n("ui.settings.integrations.integration_sign_in_dialog.sign_in_link_copied"))).catch(()=>{})},children:t.jsx(ts,{"aria-hidden":"true"})})]}),t.jsx(F,{variant:"link",size:"sm",onClick:()=>d(g.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]})})},dd=e=>e.reduce((s,a)=>s?(a.updated_at??0)>(s.updated_at??0)?a:s:a,null),ud=/^[A-Za-z]:[\\/]/,kt=e=>{const s=e?.trim();return s&&(s.startsWith("/")||ud.test(s))?s:null};function gd(e){const o=e?.payload?.frontend?.snapshot?.cwd;return typeof o=="string"&&o.trim()?o:null}const it="local-operator.settings.integrations.last-cwd";function md(e,s,a=typeof localStorage>"u"?null:localStorage){const i=kt(s);if(!(!e||!i||!a))try{const o=a.getItem(it),r=o?JSON.parse(o):{};if(r[e]===i)return;a.setItem(it,JSON.stringify({...r,[e]:i}))}catch{}}const Fs=()=>typeof localStorage>"u"?null:localStorage;function Ds(e=Fs()){if(!e)return{};try{const s=e.getItem(Wt);if(!s)return{};const a=JSON.parse(s);return!a||typeof a!="object"||Array.isArray(a)?{}:a}catch{return{}}}const Hn=256;function _d(e,s=Fs()){if(s)try{const a={...Ds(s),...e},i=Object.keys(a);if(i.length>Hn){const o={};for(const r of i.slice(-Hn))o[r]=a[r];s.setItem(Wt,JSON.stringify(o));return}s.setItem(Wt,JSON.stringify(a))}catch{}}function Gn(e,s,a){if(e==="saved")return null;if(e==="replace_confirmation_required"){const o=Cs(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 pd(e,s=typeof localStorage>"u"?null:localStorage){if(!(!e||!s))try{const a=s.getItem(it);if(!a)return;const i=JSON.parse(a);if(!(e in i))return;const o={...i};delete o[e],s.setItem(it,JSON.stringify(o))}catch{}}const hd=e=>!!(e&&typeof e=="object"&&"code"in e&&e.code==="invalid_cwd"),fd=(e,s)=>s!==null&&e===s?null:e;function xd(e,s=typeof localStorage>"u"?null:localStorage){if(!e||!s)return null;try{const a=s.getItem(it);if(!a)return null;const o=JSON.parse(a)[e];return typeof o=="string"?o:null}catch{return null}}const yd=e=>e.action==="disconnect"?"disconnected":"connected";function vd(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 bd(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 kd({sessionId:e}){const s=nn(),a=$t(s.data,"mcp_catalog"),i=$t(s.data,"mcp"),o=a?"catalog":i?"session":null,[r,d]=l.useState(null),u=en(),c=nt(A=>A.sessions),g=nt(A=>A.fetchSessions),h=nt(A=>A.loading),m=l.useMemo(()=>c.find(A=>A.session_id===e)??null,[c,e]),x=l.useMemo(()=>o==="session"&&!e?dd(c):null,[o,e,c]),_=o==="session"?e??x?.session_id??null:null;l.useEffect(()=>{o!=="session"||e||c.length>0||g(ha)},[o,e,c.length,g]);const f=o==="catalog"?kt(m?.cwd):null,k=o==="catalog"&&!!e&&f===null,C=Ie({queryKey:["desktop","session-cwd",e??""],queryFn:()=>pe({op:"sessions.get",sessionId:e??""}),enabled:k,staleTime:Number.POSITIVE_INFINITY,retry:!1}),D=k&&!C.isFetched,N=f??kt(gd(C.data))??(C.isFetched?kt(xd(e)):null),E=fd(N,r),b=o==="catalog"?E:null,j=o==="catalog"?e??null:null,S=fa.catalog(b,j);l.useEffect(()=>{o!=="catalog"||!e||!b||md(e,b)},[o,e,b]);const q=l.useRef(0),[T,z]=l.useState(0),R=l.useRef(null),te=l.useCallback((A,H)=>{const L=Date.now()+$n;q.current=L,R.current={name:A,expect:H},z(L)},[]),$=l.useCallback(A=>Date.now()<q.current?Ls:Oc(A),[]),G=Ie({queryKey:S,queryFn:()=>va(b,j),enabled:o==="catalog"&&!D,staleTime:1e4,refetchInterval:A=>$(A.state.data)}),Y=hd(G.error);l.useEffect(()=>{!Y||!N||r===N||(d(N),pd(e))},[Y,N,r,e]);const V=Ie({queryKey:Vt.list(_??""),queryFn:()=>ba(_??""),enabled:o==="session"&&!!_,staleTime:1e4,refetchInterval:A=>$(A.state.data?Zt(A.state.data,_??""):void 0)}),K=l.useMemo(()=>{if(o==="catalog")return G.data;if(o==="session"&&V.data&&_)return Zt(V.data,_)},[o,G.data,V.data,_]),Z=l.useCallback(()=>jd({queryClient:u,route:o,catalogKey:S,sessionId:_}),[o,S,u,_]);l.useEffect(()=>{if(!T)return;const A=R.current;if(!A)return;const H=K?.servers.find(ne=>ne.name===A.name);!H||!(A.expect==="connected"?H.status==="connected":H.status_basis==="live"&&H.status!=="connected")||(q.current=0,R.current=null,z(0))},[K,T]);const v=l.useRef({}),[y,M]=l.useState(0),J=l.useMemo(()=>(v.current=Cc(Ic(v.current,K,Ds()),K),v.current),[K,y]),X=l.useRef("");l.useEffect(()=>{const A=Ec(J,K);if(!Object.keys(A).length)return;const H=JSON.stringify(A);H!==X.current&&(X.current=H,_d(A))},[J,K]);const ae=l.useCallback(A=>{const H=He(v.current,A);H.needsKey||(v.current={...v.current,[A]:{...H,needsKey:!0}},M(L=>L+1))},[]),U=l.useCallback(A=>{if(A.action!=="disconnect"&&A.action!=="connect"&&A.action!=="reload")return;const H=He(v.current,A.name),L=Date.now()+$n,ne=A.action==="disconnect"?{...H,connectedAt:null,disconnectedAt:Date.now(),holdUntil:L}:{...H,disconnectedAt:null,holdUntil:L};v.current={...v.current,[A.name]:ne},te(A.name,yd(A)),M(oe=>oe+1)},[te]),ie=l.useCallback(async A=>{if(o==="catalog"){const H=vd(A);if(!H)return null;try{const L=await xa(b,H);return u.setQueryData(S,L),U(A),L.operation?.id??null}catch(L){throw L instanceof an&&L.status===409&&u.invalidateQueries({queryKey:S}),L}}if(o==="session"&&_){const H=await pe({op:"mcp.control",sessionId:_,control:bd(A)});U(A);const L=Vt.list(_),ne=H?.data;return ne&&"servers"in ne&&Array.isArray(ne.servers)?(u.setQueryData(L,ne),null):(u.invalidateQueries({queryKey:L}),ne&&"id"in ne&&typeof ne.id=="string"?ne.id:null)}return null},[o,b,S,u,_,U]),ce=l.useCallback(async A=>{if(o==="catalog"&&j&&(A.action==="connect"||A.action==="disconnect"||A.action==="reload")){try{await pe({op:"mcp.control",sessionId:j,control:{action:A.action,name:A.name,...A.action==="disconnect"?{confirmed:!0}:{}}})}catch(H){throw u.invalidateQueries({queryKey:S}),H}return U(A),await u.invalidateQueries({queryKey:S}),null}return ie(A)},[o,j,u,S,ie,U]),Ne=l.useCallback(async(A,H,L,ne)=>{if(o==="catalog"){const oe=await ya(b,A,H,L,ne);if(oe.catalog&&u.setQueryData(S,oe.catalog),oe.code!=="saved")return{saved:!1,message:Gn(oe.code,oe.failed_ids,H)};try{await ie({action:"test",name:A})}catch{}return{saved:!0,message:null}}if(o==="session"&&_){const oe=await pe({op:"mcp.credentials.store",sessionId:_,name:A,values:H,confirmedReplace:L});if(oe.data?.code!=="saved")return{saved:!1,message:Gn(oe.data?.code,oe.data?.failed_ids??[],H)};try{await ie({action:"connect",name:A})}catch{}return{saved:!0,message:null}}return{saved:!1,message:null}},[o,b,S,u,ie,_]),fe=o==="catalog"?G:V,ve=l.useCallback(()=>{fe.refetch()},[fe]);return{enabled:o!==null,route:o,sessionId:o==="catalog"?j:_,borrowed:x,noConversation:o==="session"&&!_&&!h,document:K,isLoading:s.isLoading||o==="catalog"&&(D||G.isLoading)||o==="session"&&(_?V.isLoading:h),isError:fe.isError,folderUnavailable:Ac(r,N),refetch:ve,readDocument:Z,control:ce,storeKeys:Ne,memories:J,markNeedsKey:ae}}function jd(e){if(e.route==="catalog")return e.queryClient.getQueryData(e.catalogKey);if(e.route==="session"&&e.sessionId){const s=e.queryClient.getQueryData(Vt.list(e.sessionId));return s?Zt(s,e.sessionId):void 0}}const wd=(e,s)=>{const a=e?.trim();if(!a)return null;const i=wa(a,s);return i.kind==="auth"?{kind:"matched",name:i.name,unresolved:null}:{kind:"miss",asked:a}},Nd=6,Dt="ui.settings.integrations.mcp_management_section.copy_section_title",Sd="ui.settings.integrations.mcp_management_section.copy_section_description",Md={test:"test",connect:"reconnect",disconnect:"disconnect",reload:"reload",remove:"remove",sign_out:"disconnect",cancel:"cancel",login:"grant",reauth:"grant"},Cd=({sessionId:e,sectionRef:s,highlightServer:a})=>{ee();const i=kd({sessionId:e}),{document:o,control:r,readDocument:d}=i,u=ka(),c=o?.servers??[],g=o?.operations??[],h=o?.project_scope_available??!1,[m,x]=l.useState(!1),[_,f]=l.useState(""),[k,C]=l.useState(null),[D,N]=l.useState({}),[E,b]=l.useState(null),[j,S]=l.useState(null),[q,T]=l.useState({kind:"ready"}),[z,R]=l.useState(null),[te,$]=l.useState(null),[G,Y]=l.useState(!1),V=l.useRef({}),K=l.useRef({}),Z=l.useRef({}),v=l.useRef(0),y=l.useRef(null),M=l.useRef(null),J=l.useRef(null),[X,ae]=l.useState(null),[U,ie]=l.useState(null),[ce,Ne]=l.useState(null),fe=l.useCallback(()=>{const p=J.current;J.current=null,S(null),R(null),window.setTimeout(()=>{p?.isConnected&&p.focus()},0)},[]),ve=l.useCallback(p=>{const w=window.document.activeElement;J.current=w instanceof HTMLElement?w:null,S(p)},[]),A=l.useCallback((p,w)=>{ie({name:p,waitForSignIn:w==="signed-in",until:Date.now()+tt,reanchors:0}),fe()},[fe]),H=l.useMemo(()=>wd(a,c.map(p=>p.name)),[a,c]),L=H?.kind==="matched"?H.name:null,ne=l.useRef(null),oe=l.useRef(null),B=_.trim().toLowerCase(),Q=l.useMemo(()=>B?c.filter(p=>p.name.toLowerCase().includes(B)):c,[c,B]),ge=Mc(Q,g,i.memories),de=j?.kind==="sign_in"?c.find(p=>p.name===j.name)??null:null;l.useEffect(()=>{!L||oe.current===L||!_||f("")},[L,_]),l.useEffect(()=>{!L||oe.current===L||Q.some(p=>p.name===L)&&(oe.current=L,ne.current?.scrollIntoView({block:"center",behavior:"smooth"}))},[L,Q]),l.useEffect(()=>{if(!z)return;const p=g.find(w=>w.id===z)??null;T({kind:"running",operation:p})},[g,z]);const Se=g.some(p=>p.status==="running"),Ge=p=>{const w=window.document.activeElement;w&&w!==window.document.body&&w.isConnected||ie({name:p,waitForSignIn:!1,until:Date.now()+tt,reanchors:0})},Ke=async(p,w,O)=>{C(p),N(({[p]:De,...Ce})=>Ce);let W=null,ke=!1;try{W=await O()}catch(De){ke=!0,N(Ce=>({...Ce,[p]:_t(Md[w]??"status",De,Se)}))}finally{C(null),w!=="sign_out"&&(w!=="remove"||ke)&&Ge(p)}return{operationId:W,failed:ke}},ct=p=>c.find(w=>w.name===p),Je=p=>{p.source.path&&Na(p.source.path)},P=async(p,w)=>{T({kind:"starting"}),R(null);try{const O=await r({action:w,name:p});O?R(O):T({kind:"running",operation:null})}catch(O){O instanceof an&&O.code==="oauth_unsupported"&&i.markNeedsKey(p),T({kind:"refused",message:_t("grant",O,Se)})}},ue=(p,w)=>{switch(w.kind){case"sign_in":case"reauth":{const O=g.find(W=>W.name===p.name&&W.status==="running");O&<(O)?(T({kind:"running",operation:O}),R(O.id)):(T({kind:"ready"}),R(null)),ve({kind:"sign_in",name:p.name,action:w.kind==="reauth"?"reauth":"login"});return}case"set_key":$(null),ve({kind:"key",name:p.name,keyNames:p.auth.secret_refs.map(O=>O.id)});return;case"fix":Je(p);return;case"sign_out":b({name:p.name,kind:"sign_out"});return;default:{const O=w.kind;Ke(p.name,O,()=>r({action:O,name:p.name}))}}},re=(p,w)=>{switch(w.kind){case"remove":case"sign_out":b({name:p.name,kind:w.kind});return;case"sign_in":case"reauth":case"set_key":ue(p,{kind:w.kind,label:w.label});return;case"open_config":Je(p);return;case"copy_setup":navigator.clipboard.writeText(p.setup_prompt??"").then(()=>Bt(n("ui.settings.integrations.mcp_management_section.setup_steps_copied_paste_them_into_a_chat"))).catch(()=>{});return;case"cancel":{const O=g.find(W=>W.name===p.name&&W.status==="running");O&&Ke(p.name,"cancel",()=>r({action:"cancel",operationId:O.id}));return}case"test":case"connect":case"disconnect":case"reload":{const O=w.kind;Ke(p.name,O,()=>r({action:O,name:p.name}));return}default:return}},be=(p,w)=>{if(b(null),w==="remove"){const O=p.source.owned_scope;if(!O)return;const W=Q.findIndex(ke=>ke.name===p.name);Ke(p.name,"remove",()=>r({action:"remove",name:p.name,scope:O})).then(({operationId:ke,failed:De})=>{De||ke!==null||(Bt(n("ui.settings.integrations.mcp_management_section.removed_name",{name:String(p.name)})),W>=0&&Ne({index:W}))});return}Ke(p.name,"sign_out",()=>r({action:"logout",name:p.name})).then(()=>{ie({name:p.name,waitForSignIn:!1,until:Date.now()+tt,reanchors:0})})},Re=async p=>{try{return await r({action:"add",name:p.name,scope:p.scope,...p.mode==="command"?{command:p.command,args:p.args}:{url:p.url}}),x(!1),ae(p.name),null}catch(w){return _t("add",w,!1)}},he=t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"text-heading text-ink",children:n(Dt)}),t.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:n(Sd)})]}),i.enabled&&c.length>0&&!m?t.jsxs(F,{ref:y,variant:"secondary",size:"sm",onClick:()=>x(!0),"data-tour-tag":"mcp-add-server",children:[t.jsx(kn,{"aria-hidden":"true"}),n("ui.settings.integrations.mcp_management_section.add_integration")]}):null]});if(!i.enabled&&!i.isLoading)return t.jsx(le,{title:n(Dt),titleComponent:he,sectionRef:s,children:t.jsx(se,{variant:"warning",children:n("ui.settings.integrations.mcp_management_section.integrations_need_a_newer_local_operator_backend_update_it_and_re")})});const Fe=t.jsx(Hc,{existingNames:c.map(p=>p.name),projectScopeAvailable:h,projectLabel:o?.cwd?Ed(o.cwd):null,onSubmit:Re,onCancel:()=>{x(!1),window.setTimeout(()=>y.current?.focus(),0)}}),je=j?ct(j.name):void 0,Ue=Object.entries(D).filter(([p])=>!c.some(w=>w.name===p)),Me=p=>N(({[p]:w,...O})=>O);l.useEffect(()=>{if(!X)return;const p=V.current[X];if(!p){c.some(w=>w.name===X)&&(K.current[X]?.focus(),ae(null));return}p.focus(),ae(null)},[X,c]),l.useEffect(()=>{if(!ce)return;const w=Q[Math.min(ce.index,Q.length-1)]??Q.at(-1);if(w){const O=V.current[w.name]??K.current[w.name];if(!O)return;O.focus()}else y.current?.focus();Ne(null)},[ce,Q]);const we=l.useCallback((p,w)=>{const O=d()??o,W=O?.servers.find(Ps=>Ps.name===p.name),ke=O?.operations??[],De=W?W.status==="connecting"||Ze(W.name,ke)!==null:!1;De&&W&&(v.current=w);const Ce=W?_n(W,ke,i.memories):null;if(W&&p.waitForSignIn&&(Ce?.kind==="sign_in"||Ce?.kind==="reauth"))return"kept";const Te=Qc({hold:p,now:w,windowMs:tt,rowMoving:De,lastMovingAt:v.current,candidate:W?Zc({primary:Ce?V.current[W.name]:null,overflow:K.current[W.name]}):void 0,active:window.document.activeElement,body:window.document.body});if(!Te.hold)return ie(null),"finished";if(!Te.land)return"kept";ie({name:p.name,waitForSignIn:!1,until:Te.hold.until,landedOn:Te.land,reanchors:Te.hold.reanchors});const fn=Te.land;return window.setTimeout(()=>{fn.isConnected&&fn.focus()},0),"landed"},[d,o,i.memories]);return l.useEffect(()=>{if(!U)return;we(U,Date.now());let p=0,w=!1;const O=()=>{if(w)return;const W=Jc({verdict:we(U,Date.now()),watchMs:Kn});W!==null&&(p=window.setTimeout(O,W))};return p=window.setTimeout(O,Kn),()=>{w=!0,window.clearTimeout(p)}},[U,we]),l.useEffect(()=>{if(!U)return;const p=w=>{Wc({target:w.target,row:Z.current[U.name]})&&ie(null)};return window.document.addEventListener("pointerdown",p,!0),()=>{window.document.removeEventListener("pointerdown",p,!0)}},[U]),t.jsxs(le,{title:n(Dt),titleComponent:he,sectionRef:s,children:[t.jsxs("div",{className:"flex flex-col gap-4",children:[i.route==="session"&&i.borrowed?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.integrations.mcp_management_section.borrowed_chat_notice",{chat:i.borrowed.title?.trim()||i.borrowed.session_id.slice(0,6)})}):null,i.noConversation?t.jsxs("div",{className:"flex flex-col items-start gap-2",children:[t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.integrations.mcp_management_section.integrations_can_be_managed_here_once_a_chat_has_started")}),t.jsx(F,{variant:"primary",size:"sm",onClick:()=>u("/chat"),children:n("ui.settings.integrations.mcp_management_section.start_a_chat")}),t.jsx("p",{className:"text-ink-dim text-meta",children:n("ui.settings.integrations.mcp_management_section.updating_local_operator_removes_this_step")})]}):null,i.isLoading?t.jsx("div",{className:"flex h-24 items-center justify-center",children:t.jsx(ye,{size:"lg",label:n("ui.settings.integrations.mcp_management_section.loading_integrations")})}):null,i.folderUnavailable?t.jsx(se,{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(se,{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,Ue.map(([p,w])=>t.jsx(se,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:w}),t.jsx(F,{variant:"ghost",size:"sm",onClick:()=>Me(p),children:n("ui.settings.integrations.mcp_management_section.dismiss")})]})},p)),m&&c.length>0?Fe:null,c.length>=Nd?t.jsxs("div",{className:"relative",children:[t.jsx(es,{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-ink-dim"}),t.jsx(Oe,{ref:M,value:_,onChange:p=>f(p.target.value),onKeyDown:p=>{p.key!=="Escape"||!_||(p.preventDefault(),f(""))},placeholder:n("ui.settings.integrations.mcp_management_section.search_integrations_placeholder",{integrations:lc(c.length)}),"aria-label":n("ui.settings.integrations.mcp_management_section.search_integrations"),className:"pl-9"})]}):null,H?.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(H.asked)})}):null,H?.kind==="matched"&&H.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(H.name),asked:String(H.unresolved)})}):null,o&&c.length===0&&!i.isLoading?m?Fe:t.jsxs("div",{className:"flex flex-col items-start gap-3 rounded-lg bg-surface p-6",children:[t.jsx(ss,{"aria-hidden":"true",className:"size-5 text-ink-muted"}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.settings.integrations.mcp_management_section.no_integrations_yet")}),t.jsx("p",{className:"max-w-xl text-body-sm text-ink-muted",children:n("ui.settings.integrations.mcp_management_section.integrations_let_agents_read_and_act_in_your_other_tools_like_not")})]}),t.jsxs(F,{variant:"primary",size:"md",onClick:()=>x(!0),"data-tour-tag":"mcp-add-server",children:[t.jsx(kn,{"aria-hidden":"true"}),n("ui.settings.integrations.mcp_management_section.add_integration")]})]}):null,c.length>0&&Q.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:()=>{f(""),window.setTimeout(()=>{(M.current??y.current)?.focus()},0)},children:n("ui.settings.integrations.mcp_management_section.clear_search")})]}):null,ge.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(w=>t.jsx(ad,{row:w,operations:g,memories:i.memories,projectScopeAvailable:h,highlighted:w.name===L,rowRef:O=>{Z.current[w.name]=O,w.name===L&&(ne.current=O)},primaryRef:O=>{V.current[w.name]=O},overflowRef:O=>{K.current[w.name]=O},pending:k===w.name,failure:D[w.name]??null,confirm:E?.name===w.name?{kind:E.kind}:null,onPrimary:O=>ue(w,O),onOverflow:O=>re(w,O),onConfirm:()=>E&&be(w,E.kind),onCancelConfirm:()=>{b(null),window.setTimeout(()=>{K.current[w.name]?.focus()},0)}},w.id))})]},p.id))]}),j?.kind==="sign_in"?t.jsx(cd,{name:j.name,action:j.action,keyRoute:de?Mt(de):!1,phase:q,onStart:()=>void P(j.name,j.action),onCancel:p=>void r({action:"cancel",operationId:p}).catch(()=>{}),onOpenLink:p=>void ja(p),onClose:p=>A(j.name,p)}):null,j?.kind==="key"?t.jsx(td,{name:j.name,keyNames:j.keyNames.length?j.keyNames:je?.auth.secret_refs.map(p=>p.id)??[],keyless:j.keyNames.length===0,savedKeys:je?.auth.secret_refs.filter(p=>p.state==="encrypted").map(p=>p.id),saving:G,failure:te,onClose:fe,onSave:(p,w,O)=>{Y(!0),$(null),i.storeKeys(j.name,p,w,O).then(W=>{if(!W.saved){$(W.message);return}S(null),ie({name:j.name,waitForSignIn:!1,until:Date.now()+tt,reanchors:0})}).catch(W=>$(_t("key",W,!1))).finally(()=>Y(!1))}}):null]})},tt=4e3,Ad=/^\/(?:Users|home)\/[^/]+(?=\/|$)/,Ed=e=>e.replace(Ad,"~"),Id=({verification:e})=>{ee();const{prices:s}=Ma(),a=e.grant_amount??s?.default_new_credits,{sentence:i,action:o}=Ca(e.signup_grant,Aa(a)),r=Ea(e.claim_url,Ia);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:()=>Ra(r),children:o})]})]})},Rd=({onAfterCredentialUpdate:e})=>{ee();const{isAuthenticated:s,user:a,isLoading:i,accountRead:o,signOut:r}=Sa(),d=as(m=>m.isSigningOut),u=l.useCallback(async()=>{try{await r()}catch(m){console.error("Error signing out:",m)}},[r]),c=(()=>{if(!s||!a?.radientUser)return null;const{account:m,identity:x,verification:_}=a.radientUser,f=_!=null&&!_.email_verified&&_.signup_grant!=="claimed";return t.jsxs(t.Fragment,{children:[t.jsxs(ot,{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(at,{variant:"success",className:"capitalize",children:m.status})]})}),t.jsx(me,{label:n("ui.settings.account.radient_account_section.name"),value:m.name||n("ui.settings.account.radient_account_section.not_provided")}),t.jsx(me,{label:n("ui.settings.account.radient_account_section.email"),value:m.email}),t.jsx(me,{label:n("ui.settings.account.radient_account_section.account_id"),value:t.jsx("span",{className:"text-mono-sm",children:m.id})}),t.jsx(me,{label:n("ui.settings.account.radient_account_section.tenant_id"),value:t.jsx("span",{className:"text-mono-sm",children:m.tenant_id})}),t.jsx(me,{label:n("ui.settings.account.radient_account_section.provider"),value:t.jsx("span",{className:"capitalize",children:x.provider})}),t.jsx(me,{label:n("ui.settings.account.radient_account_section.created"),value:is(m.created_at)})]}),f&&_?t.jsx(Id,{verification:_}):null,t.jsx("div",{className:"mt-8",children:t.jsx(mi,{offerSignIn:!0})}),t.jsxs("div",{className:"mt-8",children:[t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.account.radient_account_section.need_to_sign_out_or_switch_accounts")}),t.jsxs(F,{variant:"danger",className:"mt-3",onClick:u,children:[t.jsx(_i,{}),n("ui.settings.account.radient_account_section.sign_out_from_radient")]})]})]})})(),g=o==="refused"?n("ui.settings.account.radient_account_section.radient_refused_the_sign_in_this_app_is_holding_so_your_account_d"):os(o)?n("ui.settings.account.radient_account_section.your_radient_account_could_not_be_read_so_this_app_cannot_show_yo"):n("ui.settings.account.radient_account_section.you_are_not_currently_signed_in_to_radient"),h=s&&a?null:t.jsxs("div",{children:[t.jsxs("p",{className:"text-body-sm text-ink-muted",children:[g," ",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(Pi,{titleText:"",onAfterCredentialUpdate:e,descriptionText:"",onSignInSuccess:()=>{}})})]});return i||d?t.jsxs("div",{className:"flex min-h-36 flex-col items-center justify-center gap-3",children:[t.jsx(ye,{size:"lg",label:n("ui.settings.account.radient_account_section.loading_account")}),!d&&t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.account.radient_account_section.loading_your_radient_account_details")})]}):s&&a?.radientUser?c:t.jsx("div",{className:"flex flex-col gap-4",children:h})};function Td({metric:e,data:s}){return ee(),t.jsx(Ta,{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)}`:La(a),children:t.jsx(sl,{data:s,children:t.jsx(Jn,{type:"monotone",dataKey:"value",strokeWidth:2,dot:!1,activeDot:{r:4,strokeWidth:0},name:e==="credits"?n("ui.settings.account.settings_usage_chart.credits_consumed"):n("ui.settings.account.settings_usage_chart.tokens_used")})})})}const Ld={all:["desktop","tts-path-resolution"]};function Od(e){return Ie({queryKey:Ld.all,queryFn:()=>pe({op:"tts.paths"}),enabled:e,staleTime:Number.POSITIVE_INFINITY,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:Oa})}const Fd=["speech.voice.gender","speech.voice.tone","speech.voice.expressiveness","speech.voice.pace","speech.voice.language","speech.voice.accent","speech.voice.instructions"];function qn(e){const s=new Map(e.map(o=>[o.key,o])),a=[],i=[];for(const o of Fd){const r=s.get(o);r?a.push(r):i.push(o)}return{rows:a,missing:i}}const Dd=["provider_tts_radient","provider_tts_elevenlabs","provider_tts_openai","none"];function Yn(e){return typeof e=="string"&&Dd.includes(e)}function zd(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 $d={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 zs(e){return $d[e]}function Pd(e){return{servable:e.servable,serving:e.path==="none"?null:e.path,reason:e.reason,rungs:e.rungs.map(s=>({path:s.path,name:zs(s.path),available:s.available,reason:s.reason}))}}const Kd="ui.settings.speech.speech_section.copy_backend_older_sentence",$s="ui.settings.speech.speech_section.copy_unavailable_sentence",Ud=({resetErrorBoundary:e})=>(ee(),t.jsx(se,{variant:"warning",children:t.jsxs("div",{className:"flex flex-col items-start gap-3",children:[t.jsx("span",{children:n($s)}),t.jsxs(F,{variant:"secondary",onClick:e,children:[t.jsx(zi,{"aria-hidden":"true"}),n("ui.settings.speech.speech_section.try_again")]})]})}));function Bd(e){return e==="enabled"?"ready":e==="below-version"?"older":"pairing"}const Vd=({sectionRef:e})=>{ee();const s=nn(),a=rs(),i=Fa(s.data,"tts"),o=Bd(i),r=Ie({queryKey:Pt.all,queryFn:()=>pe({op:"settings.list"}),enabled:o==="ready",staleTime:1e4}),d=Od(o==="ready"),{hasRadientApiKey:u,hasRadientSession:c,speechBlock:g}=Da(),h=`${c}:${u}`,m=l.useRef(h),x=d.refetch;l.useEffect(()=>{m.current!==h&&(m.current=h,x())},[h,x]);const _=r.data,f=l.useMemo(()=>qn(_?.settings??[]),[_]),[k,C]=l.useState({}),[D,N]=l.useState({}),[E,b]=l.useState({});l.useEffect(()=>{_&&C(v=>{let y=!1;const M={...v};for(const J of qn(_.settings).rows){const X=v[J.key];if(X&&X.value!==Xe(J).value)continue;const ae=Xe(J);X&&X.value===ae.value&&X.cascadeBase===ae.cascadeBase||(M[J.key]=ae,y=!0)}return y?M:v})},[_]);const j=(v,y)=>N(M=>({...M,[v]:y})),S=(v,y)=>b(M=>({...M,[v]:y})),q=async v=>{const y=k[v.key];if(!y)return;const M=Pa(v,y);if(!M.ok){S(v.key,M.error);return}j(v.key,!0),S(v.key,null);try{await pe(M.request),j(v.key,!1);const X=(await r.refetch()).data?.settings.find(ae=>ae.key===v.key);X&&C(ae=>{const U=ae[v.key];return U&&U.value===y.value&&U.cascadeBase===y.cascadeBase?{...ae,[v.key]:Xe(X)}:ae})}catch(J){j(v.key,!1),S(v.key,J instanceof Error?J.message:n("ui.settings.speech.speech_section.the_setting_could_not_be_saved"))}},T=async v=>{j(v.key,!0),S(v.key,null);try{await pe({op:"settings.reset",key:v.key}),C(y=>({...y,[v.key]:Xe({...v,value:v.default,is_default:!0})})),j(v.key,!1),await r.refetch()}catch(y){j(v.key,!1),S(v.key,y instanceof Error?y.message:n("ui.settings.speech.speech_section.the_setting_could_not_be_reset"))}},z=l.useMemo(()=>zd(d.data),[d.data]),R=z?Pd(z):null,te=d.isSuccess&&z===null,$=(s.data?null:s.error)??null,G=r.error,Y=n("ui.settings.speech.speech_section.speech_voicing"),V=n("ui.settings.speech.speech_section.how_the_assistant_sounds_when_it_speaks_aloud");if(o==="pairing"){const{sentence:v}=Ht(a??null,n("ui.settings.speech.speech_section.speech_settings_could_not_be_loaded"),$);return t.jsx(le,{title:Y,icon:dt,description:V,sectionRef:e,children:t.jsx(se,{variant:"warning",children:v})})}if(o==="older")return t.jsx(le,{title:Y,icon:dt,description:V,sectionRef:e,children:t.jsx(se,{variant:"warning",children:n(Kd)})});if(G||!_){const{sentence:v,remedy:y}=Ht(a??null,n("ui.settings.speech.speech_section.speech_settings_could_not_be_loaded"),G);return t.jsx(le,{title:Y,icon:dt,description:V,sectionRef:e,children:t.jsx(se,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:v}),y&&t.jsx(F,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{r.refetch()},children:n("ui.settings.speech.speech_section.retry")})]})})})}const K=R?!R.servable:g==="offline",Z=R?R.rungs.find(v=>v.path===R.serving)??null:null;return t.jsx(le,{title:Y,icon:dt,description:V,sectionRef:e,children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsxs("section",{className:"flex flex-col gap-3",children:[d.isPending&&t.jsxs("p",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[t.jsx(ye,{}),vn("checking")]}),(d.isError||te)&&!R&&g!=="offline"&&t.jsx(se,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("span",{children:[n($s)," ",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(Di,{fallbackRender:Ud,resetKeys:[d.dataUpdatedAt],children:R&&t.jsxs(t.Fragment,{children:[t.jsxs(ot,{children:[t.jsx(me,{label:n("ui.settings.speech.speech_section.speaks_through"),value:R.serving?zs(R.serving):n("ui.settings.speech.speech_section.nothing_yet")}),t.jsx(me,{label:n("ui.settings.speech.speech_section.availability"),value:R.servable?n("ui.settings.speech.speech_section.ready"):n("ui.settings.speech.speech_section.no_provider")})]}),R.reason&&R.reason!==Z?.reason&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:R.reason}),t.jsx("ul",{className:"flex flex-col gap-1",children:R.rungs.map(v=>t.jsxs("li",{className:"flex flex-col gap-0.5 text-body-sm",children:[t.jsxs("span",{className:v.path===R.serving?"text-ink":"text-ink-muted",children:[v.name,t.jsxs("span",{className:v.path===R.serving?"text-ink-muted":"text-ink-dim",children:[" ",v.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:v.reason})]},v.path))})]})})]}),K&&t.jsx(se,{variant:"warning",children:vn(g)}),t.jsx("div",{className:"flex flex-col gap-1",children:f.rows.map(v=>t.jsx(za,{setting:v,draft:k[v.key]??Xe(v),tier:$a(v),saving:!!D[v.key],error:E[v.key]??null,onDraftChange:y=>C(M=>({...M,[v.key]:y})),onSave:()=>{q(v)},onReset:()=>{T(v)}},v.key))}),f.missing.length>0&&t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.speech.speech_section.missing_voice_rows",{count:f.missing.length,rows:f.missing.join(", ")})})]})})},Hd=()=>{ee();const{data:e,isLoading:s,error:a,refetch:i}=el(),o=tl(),[r,d]=l.useState(""),[u,c]=l.useState(!1);l.useEffect(()=>{d(e?.content??""),c(!1)},[e]);const g=f=>{const k=f.target.value;d(k),c(k!==(e?.content??""))},h=async()=>{if(!(!u||o.isPending))try{const f={content:r};await o.mutateAsync(f),await i(),c(!1)}catch(f){console.error("Error updating system prompt:",f)}},m=()=>{d(e?.content??""),c(!1)},x=o.isPending,_=()=>t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Ee,{htmlFor:"app-system-prompt",children:n("ui.settings.model.system_prompt.instructions")}),t.jsx(_s,{id:"app-system-prompt",name:"systemPrompt",value:r,onChange:g,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:h,disabled:!u||x,children:[x?t.jsx(ye,{size:"sm"}):t.jsx(us,{}),x?n("ui.settings.model.system_prompt.saving"):n("ui.settings.model.system_prompt.save_changes")]}),t.jsx(F,{onClick:m,disabled:!u||x,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:sn(e.last_modified)})]})]});return t.jsx(le,{title:n("ui.settings.model.system_prompt.system_prompt"),icon:Ki,description:n("ui.settings.model.system_prompt.every_local_operator_agent_receives_this_prompt_in_addition_to_it"),children:s?t.jsx("div",{className:"flex min-h-50 items-center justify-center",children:t.jsx(ye,{size:"lg",label:n("ui.settings.model.system_prompt.loading_system_prompt")})}):a?t.jsx(se,{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")})}):_()})},Gd=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"],qd=e=>Gd.includes(e),Yd=e=>{const s=[];let a=0;for(const i of e){const o=Math.max(0,Math.floor(i.count)),r=Math.max(1,Math.floor(i.columns));for(let d=0;d<o;d+=r)s.push({start:a+d,count:Math.min(r,o-d)});a+=o}return s},Qd=({index:e,key:s,groups:a})=>{const i=Yd(a),o=i.reduce((r,d)=>r+d.count,0);if(!Number.isInteger(e)||e<0||e>=o)return e;switch(s){case"Home":return 0;case"End":return o-1;case"ArrowLeft":return Math.max(0,e-1);case"ArrowRight":return Math.min(o-1,e+1);case"ArrowUp":case"ArrowDown":{const r=i.findIndex(c=>e>=c.start&&e<c.start+c.count),d=i[r+(s==="ArrowDown"?1:-1)];if(!d)return e;const u=e-i[r].start;return d.start+Math.min(u,d.count-1)}default:return e}},Wd={localOperatorDark:dr,localOperatorLight:Er,dracula:kr,dune:zo,sage:nr,monokai:hi,tokyoNight:_r,iceberg:wr,radient:Wo,neon:Ua,obsidian:ps,synth:Ji,catppuccinMocha:jo,catppuccinLatte:or,tokyoNightStorm:po,gruvbox:oo,nord:Jr,oneDark:Wi,solarizedDark:Cr,rosePine:Uo,rosePineMoon:lr,rosePineDawn:bo,alucard:Vo,gruvboxLight:Eo,tokyoNightDay:gr,oneLight:ar,catppuccinFrappe:Co,catppuccinMacchiato:Jo,palenight:Ka,everforest:Vr,everforestLight:Ur,kanagawaWave:Yr,kanagawaLotus:Po,ayuDark:Ro,ayuMirage:Lo,ayuLight:xr,nightfox:fo,duskfox:Lr,synthwave:hr,matrix:eo,tron:mo,cyberpunk:pi,vaporwave:Pr,outrun:ao,neonNoir:Gr,arcade:er,forest:zr,ocean:Fo,desert:Fr,autumn:Wr,lavender:Sr,arctic:yo,rosewood:Yo,solarizedLight:Rr,githubLight:Go,paper:Ui,linen:vr,highContrastLight:Yi,mintLight:no},Qn="bg-[color-mix(in_srgb,var(--color-accent)_8%,var(--color-accent-wash))]",Zd=({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"})]})]})]}),Jd=({id:e,name:s,description:a,isSelected:i,isTabStop:o,onSelect:r,onFocusTile:d})=>{const u=Wd[e];return t.jsx(We,{side:"bottom",align:"start",content:a,children:t.jsxs("button",{type:"button","data-theme-tile":e,"aria-pressed":i,tabIndex:o?0:-1,onFocus:d,onClick:r,className:_e("relative flex flex-col gap-1.5 rounded-md p-1 text-left transition-colors duration-fast ease-out-quart",i?Qn:"hover:bg-surface"),children:[t.jsxs("span",{className:_e("relative block h-10 overflow-hidden rounded-sm border transition-colors duration-fast ease-out-quart",i?"border-accent":"border-hairline"),children:[t.jsx(Zd,{id:e}),i&&t.jsx("span",{className:_e("pointer-events-none absolute top-0.5 right-0.5 flex h-4 w-4 items-center justify-center rounded-full",Qn),children:t.jsx(ms,{size:12,className:"text-accent","aria-hidden":"true"})})]}),t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx(u,{size:12,className:"shrink-0 text-ink-dim","aria-hidden":"true"}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-meta text-ink",children:s})]})]})})},Xd=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)}}),eu=()=>{ee();const{themeName:e,setTheme:s}=Pe(),a=Object.values(Ks),i=[{label:n("ui.settings.appearance.theme_selector.dark"),items:a.filter(c=>c.theme.palette.mode==="dark")},{label:n("ui.settings.appearance.theme_selector.light"),items:a.filter(c=>c.theme.palette.mode==="light")}].filter(c=>c.items.length>0),[o,r]=l.useState(null),d=l.useMemo(()=>{const c=i.flatMap(g=>g.items.map(h=>h.id));return o&&c.includes(o)?o:c.includes(e)?e:c[0]},[i,o,e]),u=c=>{if(!qd(c.key))return;const g=[...c.currentTarget.querySelectorAll("[data-theme-tile]")],h=g.indexOf(c.target);if(h<0)return;c.preventDefault();const m=Qd({index:h,key:c.key,groups:Xd(c.currentTarget)});m!==h&&g[m]?.focus()};return t.jsx($i,{children:t.jsx("div",{onKeyDown:u,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:g,name:h,description:m})=>t.jsx(Jd,{id:g,name:h,description:m,isSelected:g===e,isTabStop:g===d,onSelect:()=>s(g),onFocusTile:()=>r(g)},g))})]},c.label))})})},tu=({value:e,onChange:s})=>{ee();const a=l.useId();return t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("span",{id:a,className:"flex min-h-6 items-center text-body text-ink",children:n("ui.settings.appearance.transcript_display_mode_setting.transcript_display")}),t.jsx("p",{className:"mt-0.5 max-w-2xl text-body-sm text-ink-muted",children:n("ui.settings.appearance.transcript_display_mode_setting.by_turn_condenses_each_turn_to_its_answer_by_response_keeps_every")})]}),t.jsx("div",{className:"flex h-6 shrink-0 items-center",children:t.jsx(jt,{value:e,onValueChange:i=>s(ls(i)),children:t.jsx(wt,{"aria-labelledby":a,children:ii.map(i=>t.jsx(Ye,{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))})})})]})},nu=()=>{ee();const{data:e,isLoading:s,error:a}=il({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(So,{size:16,className:"shrink-0 text-ink-dim"}),n("ui.settings.account.settings_page.radient_pass")]}),s&&t.jsx(xe,{className:"h-6 w-36"}),a&&t.jsx(se,{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(uo,{}),n("ui.settings.account.settings_page.add_credits")]})})]})]})},su=[{id:"credits",get label(){return n("ui.settings.account.settings_page.credits")}},{id:"tokens",get label(){return n("ui.settings.account.settings_page.tokens")}}],au=()=>{ee();const[e,s]=l.useState("credits"),a=l.useMemo(()=>{const u=new Date,c=nl(u);return{start_date:Mn(c),end_date:Mn(u),rollup:"daily"}},[]),{data:i,isLoading:o,error:r}=rl(a,{enabled:!0}),d=l.useMemo(()=>i?.data_points?[...i.data_points].sort((c,g)=>At(c.timestamp).getTime()-At(g.timestamp).getTime()).map(c=>({bucket:Ja(Hi(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(lo,{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:su.map(({id:u,label:c})=>t.jsx(F,{variant:"ghost",size:"sm","aria-pressed":e===u,onClick:()=>s(u),className:_e(e===u&&"bg-surface text-ink hover:bg-surface"),children:c},u))})]})]}),o&&t.jsx(xe,{className:"h-62 w-full"}),r&&t.jsx(se,{variant:"warning",children:n("ui.settings.account.settings_page.usage_load_failed",{reason:r.message})}),!o&&!r&&i&&d.length>0&&t.jsx(Td,{metric:e,data:d}),!o&&!r&&(!i||d.length===0)&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.account.settings_page.no_usage_recorded_in_the_last_30_days")})]})},iu=()=>(ee(),t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[t.jsxs("h2",{className:"flex items-center gap-2 text-heading text-ink",children:[t.jsx(Ci,{size:16,className:"shrink-0 text-ink-dim"}),n("ui.settings.account.settings_page.radient_account")]}),t.jsx(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(Xa,{})]})})]})),yu=()=>{ee();const e=Ba("surface"),s=Va(),a=Pe(P=>P.showAgentReasoning),i=Pe(P=>P.setShowAgentReasoning),o=Pe(P=>P.transcriptDisplayMode),r=Pe(P=>P.setTranscriptDisplayMode),{data:d,isLoading:u,isFetching:c,error:g,refetch:h}=Ha(),{needsProvider:m}=Ga(),x=rs(),{sentence:_,remedy:f}=Ht(x??null,n("ui.settings.navigation.settings_page.your_settings_could_not_be_loaded"),g),k=fi(),[C,D]=l.useState(null),N=as(),{isAuthenticated:E,accountRead:b,isFetching:j,isRefreshing:S,refreshUser:q}=tn(),T=nt(P=>P.activeSessionId),z=nt(P=>P.sessions),R=El(),{accountId:te,snapshot:$,model:G}=ds(),Y=l.useRef(null);$.status?Y.current={accountId:te,status:$.status}:$.checking||(Y.current=null);const V=$.status??(Y.current?.accountId===te?Y.current.status:null),K=_l(R),Z=l.useMemo(()=>xi.filter(P=>P.id!=="agent-messages"||R!=="absent"),[R]),v=l.useCallback(()=>G.check("surface_open",!0),[G]),[y,M]=l.useState("general"),[J,X]=l.useState(!1),ae=l.useRef(null),U=l.useRef(null),{startTour:ie}=yi(),ce=qa(),{data:Ne,refetch:fe}=Ya(),{refreshModels:ve}=Qa(),A=l.useMemo(()=>Ne?.keys?[...Ne.keys].sort():[],[Ne?.keys]),H=l.useRef({keys:"",hosting:void 0});l.useEffect(()=>{const P=A.join(","),ue=d?.values?.hosting;(H.current.keys!==P||H.current.hosting!==ue)&&(H.current={keys:P,hosting:ue},ve().catch(re=>{console.error("Failed to refresh models after credentials or hosting change:",re)}))},[A,d?.values?.hosting,ve]);const L=l.useRef({general:l.useRef(null),radient:l.useRef(null),integrations:l.useRef(null),appearance:l.useRef(null),speech:l.useRef(null),keyboard:l.useRef(null),providers:l.useRef(null),"agent-messages":l.useRef(null),backend:l.useRef(null),imports:l.useRef(null),updates:l.useRef(null)}).current,ne=l.useMemo(()=>new URLSearchParams(ce.search).get("setting"),[ce.search]),oe=l.useMemo(()=>new URLSearchParams(ce.search).get("filter")??"",[ce.search]),B=l.useMemo(()=>new URLSearchParams(ce.search).get("mcp")??void 0,[ce.search]),Q=l.useMemo(()=>new URLSearchParams(ce.search).get("provider"),[ce.search]),ge=l.useCallback(P=>{M(P),X(!0);const ue=L[P],re=U.current;if(ue?.current&&re){const Re=ue.current.getBoundingClientRect().top-re.getBoundingClientRect().top;re.scrollHeight>re.clientHeight?re.scrollTo({top:Math.max(0,re.scrollTop+Re-80),behavior:"smooth"}):window.scrollTo({top:Math.max(0,ue.current.getBoundingClientRect().top+window.scrollY-80),behavior:"smooth"}),clearTimeout(ae.current??void 0),ae.current=setTimeout(()=>{X(!1),ae.current=null},800)}else X(!1)},[L]);l.useEffect(()=>{const P=setTimeout(()=>{const ue=U.current;if(!ue)return;const re=()=>{if(J)return;const be=ue.getBoundingClientRect(),Re=be.height;let he="",Fe=0;for(const[je,Ue]of Object.entries(L))if(Ue.current){const Me=Ue.current.getBoundingClientRect(),we=be.top,p=Me.top-we,w=Me.bottom-we,O=Me.height,W=Math.max(0,p),ke=Math.min(Re,w),Ce=Math.max(0,ke-W)/O,Te=Ce+(p<Re*.3?.1:0);Te>Fe&&Ce>.1&&(Fe=Te,he=je)}he&&he!==y&&M(he)};return re(),ue.addEventListener("scroll",re,{passive:!0}),()=>{ue.removeEventListener("scroll",re),clearTimeout(ae.current??void 0)}},100);return()=>clearTimeout(P)},[L,y,J]),l.useEffect(()=>{const P=new URLSearchParams(ce.search),ue=P.get("section"),re=P.get("setting"),be=re?bn(re,"backend"):ue;if(be==="agent-messages"&&!K)return;const Re=be?L[be]:void 0;if(!be||!Re)return;let he=!1,Fe=Number.NaN,je=0;const Ue=window.setTimeout(()=>{he||(he=!0,we.disconnect(),ge(be))},2e3),Me=()=>{if(he)return;const p=Re.current;if(!p){je=requestAnimationFrame(Me);return}const w=Math.round(p.getBoundingClientRect().top+window.scrollY);if(w===Fe&&w>0){he=!0,we.disconnect(),window.clearTimeout(Ue),ge(be);return}Fe=w,je=requestAnimationFrame(Me)},we=new ResizeObserver(()=>{he||(cancelAnimationFrame(je),je=requestAnimationFrame(Me))});return U.current&&we.observe(U.current),je=requestAnimationFrame(Me),()=>{he=!0,cancelAnimationFrame(je),we.disconnect(),window.clearTimeout(Ue)}},[ce.search,L,ge,K]);const de=async(P,ue)=>{D(P);try{await k.mutateAsync({[P]:ue}),await h()}catch(re){console.error(`Error updating ${P}:`,re)}finally{D(null)}},Se=u,Ge=b==="checking",Ke=os(b),ct=b==="ready"||b==="checking"||j,Je=cs(Se,4e3);return g?t.jsx("div",{className:"flex h-full w-full items-center justify-center bg-canvas p-6",children:t.jsx(se,{variant:"warning",className:"w-full max-w-xl",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:_}),f&&t.jsx(F,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>void h(),disabled:c,children:c?n("ui.settings.navigation.settings_page.retrying"):n("ui.settings.navigation.settings_page.retry")})]})})}):Se?t.jsxs("div",{role:"status",className:"flex h-full w-full flex-col items-center justify-center gap-3 bg-canvas",children:[t.jsx(ye,{size:"lg",label:Je?void 0:n("ui.settings.navigation.settings_page.loading_settings")}),Je&&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(vi,{activeSection:y,onSelectSection:ge,sections:Z})}),t.jsx("div",{ref:U,"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(Ai,{title:n("ui.settings.page.title"),icon:jn}),t.jsxs("div",{className:"flex flex-col gap-8",children:[t.jsxs("div",{ref:L.general,className:"flex flex-col gap-8",children:[t.jsx(bi,{focus:ne===Us}),t.jsxs(le,{title:n("ui.settings.profile.title"),icon:ki,description:n(E?"ui.settings.profile.description_authenticated":"ui.settings.profile.description_anonymous"),children:[Ge&&t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.profile.account_checking")}),Ke&&t.jsx(se,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:n(b==="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:S,children:S?n("ui.settings.profile.retrying"):n("ui.settings.profile.retry")})]})}),t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(wn,{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 P=>{D("user_name");try{N.updateName(P)}finally{D(null)}},readOnly:ct}),t.jsx(wn,{value:N.profile.email,label:n("ui.settings.profile.email.label"),placeholder:n("ui.settings.profile.email.placeholder"),isSaving:C==="user_email",onSave:async P=>{D("user_email");try{N.updateEmail(P)}finally{D(null)}},readOnly:ct})]})]}),t.jsx(le,{title:n("ui.settings.tour.title"),description:n("ui.settings.tour.description"),children:t.jsxs(F,{variant:"secondary",onClick:()=>{ie({forceModalCompleted:!0})},children:[t.jsx(Wa,{}),n("ui.settings.tour.action")]})}),t.jsx(le,{id:"model-settings",title:n("ui.settings.model.settings_page.model_settings"),icon:ji,description:n("ui.settings.model.settings_page.configure_the_default_ai_model_and_hosting_providers_used_for_gen"),children:t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(wi,{value:d.values.hosting,isSaving:C==="hosting",onSave:P=>de("hosting",P),filterByCredentials:!0,allowCustom:!0,allowDefault:!1,emptyHelperText:n("ui.settings.model.settings_page.no_hosting_options")}),t.jsx(Ni,{value:d.values.model_name,hostingId:d.values.hosting,isSaving:C==="model_name",onSave:P=>de("model_name",P),allowCustom:!0,allowDefault:!1}),t.jsx(zl,{hosting:d.values.hosting,modelName:d.values.model_name,focus:ne===ht}),m&&t.jsx(se,{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:()=>{ge("providers"),L.providers.current?.focus({preventScroll:!0})},children:n("ui.settings.model.provider_callout.providers_link")}),"."]})})]})}),t.jsx(Hd,{}),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(ot,{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:is(d.metadata.created_at)}),t.jsx(me,{label:n("ui.settings.configuration.settings_page.last_modified"),value:sn(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:ps,description:n("ui.settings.appearance.settings_page.customize_the_look_and_feel_of_local_operator"),sectionRef:L.appearance,dataTourTag:"settings-appearance-section",children:t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(eu,{}),t.jsx(hs,{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 P=>i(P)}),t.jsx(tu,{value:ls(o),onChange:P=>r(P)}),t.jsx(ul,{state:s.state,onChange:s.set})]})}),t.jsx(Vd,{sectionRef:L.speech}),t.jsx(oc,{sectionRef:L.keyboard}),t.jsx(le,{title:n("ui.settings.model.settings_page.model_providers"),icon:ss,description:n("ui.settings.navigation.settings_page.sign_in_to_the_services_your_agents_think_with_new_chats_use_your"),sectionRef:L.providers,id:"model-providers",className:"focus-visible:outline-none!",children:t.jsx(Si,{initialProviderId:Q,onChangeModel:()=>ge("general")})}),t.jsx(Cd,{sessionId:T??void 0,sectionRef:L.integrations,highlightServer:B}),t.jsx(le,{title:n("ui.settings.account.settings_page.radient_account"),titleComponent:t.jsx(iu,{}),description:n("ui.settings.account.settings_page.your_radient_account_radient_pass_details_and_credits_to_use_radi"),sectionRef:L.radient,dataTourTag:"settings-radient-account-section",children:t.jsxs("div",{className:"flex flex-col gap-8",children:[t.jsx(Rd,{onAfterCredentialUpdate:()=>{ve(),fe()}}),E&&t.jsxs(t.Fragment,{children:[t.jsx(nu,{}),t.jsx(au,{})]})]})}),K&&t.jsx(le,{title:n("ui.agentMessages.settings.section"),icon:Mi,description:n("ui.agentMessages.settings.description"),sectionRef:L["agent-messages"],id:"agent-messages",className:"border-b border-hairline pb-8",children:V?t.jsx(yl,{availability:R,status:V,accountId:te,refusal:$.refusal,onRefreshStatus:v,sessions:z}):$.refusal?t.jsxs(se,{variant:"warning",children:[t.jsx(Nt,{children:n("ui.agentMessages.settings.error.title")}),t.jsxs(Ae,{children:[$.refusal.code!=="client_unavailable"&&t.jsx("span",{className:"block",children:yt($.refusal)}),t.jsx("span",{className:"block",children:n("ui.agentMessages.settings.error.no_changes")}),t.jsx(F,{className:"mt-3",variant:"secondary",onClick:()=>void v(),children:n("ui.agentMessages.settings.error.retry")})]})]}):t.jsxs("div",{"aria-busy":"true",className:"flex flex-col gap-3",children:[t.jsx(xe,{className:"h-5 w-40"}),t.jsx(xe,{className:"h-4 w-full max-w-xl"})]})}),t.jsx(le,{title:n("ui.settings.navigation.settings_page.backend_settings"),icon:jn,description:n("ui.settings.navigation.settings_page.every_setting_the_backend_registry_owns_searchable_with_typed_edi"),sectionRef:L.backend,children:t.jsx(Za,{hideInterfaceLanguage:!0,hideModelEffort:!0,hideAgentMessages:!0,focusKey:ne&&bn(ne,"backend")==="backend"?ne:null,initialFilter:oe})}),t.jsx("div",{ref:L.imports,children:t.jsx(sc,{})}),t.jsx("div",{ref:L.updates,children:t.jsx(Ll,{})})]})]})})]}):t.jsx("div",{className:"flex h-full w-full items-center justify-center bg-canvas p-6",children:t.jsx(se,{variant:"warning",className:"w-full max-w-xl",children:n("ui.settings.navigation.settings_page.your_settings_could_not_be_loaded")})})};export{yu as SettingsPage};
|