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
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import{r as o,t as n,j as t,c as _e,e as Ks,L as Us}from"./index-BSn66J9q.js";import{cJ as Dt,cK as Bs,cL as xn,cM as Ke,b$ as Vs,$ as Re,af as Qn,ag as Xt,a2 as Zn,u as en,aO as Hs,aP as qs,cN as Gs,cO as Ys,cP as Ws,cQ as Qs,cR as Jn,cS as tn,ad as Xn,cT as Zs,cU as Js,aT as zt,cV as yn,cW as Ge,a as nn,c as $t,cX as Xs,cY as pt,cZ as ea,by as ta,c_ as na,c$ as sa,d0 as aa,d1 as ia,d as pe,d2 as Pt,bO as es,d3 as sn,ci as ht,bC as ra,d4 as ts,ab as oa,d5 as la,d6 as ca,d7 as da,d8 as ua,V as an,d9 as ga,da as ma,a1 as ns,aV as Kt,aW as Ut,db as _a,aI as pa,cv as Bt,ap as st,dc as ha,dd as fa,de as xa,df as Vt,dg as ya,dh as va,di as ba,aR as ka,dj as ss,dk as ja,dl as wa,dm as Na,aN as Sa,dn as as,aU as is,dp as rs,dq as Ma,dr as Ca,ds as Aa,dt as Ea,du as Ia,dv as Ra,dw as Ta,dx as La,a0 as Oa,bW as os,b7 as Fa,bx as Da,dy as et,dz as Ht,dA as vn,dB as za,dC as $a,dD as Pa,dE as Ka,dF as Ua,bJ as Ba,dG as Va,c2 as Ha,dH as qa,c1 as Ga,dI as Ya,dJ as Wa,dK as bn,dL as Qa,dM as Za,dN as Ja,ck as Xa}from"./conversation-input-sync-qFePp_gf.js";import{n as ei,K as ti,u as Ue,o as ni,q as si,r as ai,T as ii,s as ls}from"./ui-preferences-store-oc99NgQT.js";import{ca as cs,cb as ri,cc as oi,cd as ds,ce as li,cf as ci,cg as Fe,X as us,bK as ot,bL as me,ch as ce,ci as di,c5 as ui,cj as gi,a as kn,ck as mi,cl as _i,cm as dt,bJ as pi,bV as hi,cn as fi,co as xi,cp as yi,cq as vi,bz as jn,cr as bi,bp as ki,bG as wn,c4 as ji,bH as wi,bI as Ni,cs as Si,by as Mi,ct as Ci}from"./index-U5qrTe4P.js";import{P as Ai}from"./page-header-D3rux4P9.js";import{c as A,u as ne,a as F,S as ve,Q as gs,y as Je,a0 as kt,a1 as jt,a2 as Qe,A as ae,z as wt,E as Ee,x as ye,K as rn,M as on,N as ln,O as cn,P as Ze,L as Ie,I as De,a4 as Nt,R as Ei,B as it,C as qt,ac as Ii,h as ms,ag as Nn,T as _s,i as Ri,j as Ti,k as Li,m as Oi,l as Sn,H as Fi,G as Di,ah as zi,a8 as $i}from"./error-boundary-CIO9VaTx.js";import{R as Pi}from"./radient-auth-buttons-CD4FRlt9.js";import{N as Ki}from"./notebook-pen-pmBcBtK5.js";import{B as Ui}from"./book-open-DxzLWerU.js";import{a as Bi,p as Ct}from"./parseISO-BHJWTxrA.js";import{i as Vi,a as qe,f as Hi}from"./format-esAOn2VS.js";import{t as qi}from"./en-US-CHJkXXr4.js";import"./console-mirror-wrjuOlK5.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 Gi=[["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=A("aperture",Gi);/**
|
|
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 Wi=[["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"}]],Qi=A("atom",Wi);/**
|
|
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=A("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"}]],er=A("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 tr=[["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"}]],nr=A("candy",tr);/**
|
|
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 sr=[["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"}]],ar=A("car-front",sr);/**
|
|
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 ir=[["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"}]],rr=A("cassette-tape",ir);/**
|
|
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 or=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],lr=A("chart-line",or);/**
|
|
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 cr=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],dr=A("circle-plus",cr);/**
|
|
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 ur=[["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"}]],gr=A("circuit-board",ur);/**
|
|
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 mr=[["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"}]],_r=A("cloud-lightning",mr);/**
|
|
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 pr=[["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"}]],hr=A("cloud-moon",pr);/**
|
|
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 fr=[["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"}]],xr=A("cloud-snow",fr);/**
|
|
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 yr=[["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"}]],vr=A("cloud-sun",yr);/**
|
|
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 br=[["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"}]],kr=A("coffee",br);/**
|
|
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 jr=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 18a6 6 0 0 0 0-12v12z",key:"j4l70d"}]],ps=A("contrast",jr);/**
|
|
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 wr=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Nr=A("credit-card",wr);/**
|
|
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 Sr=[["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"}]],Mr=A("cup-soda",Sr);/**
|
|
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 Cr=[["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"}]],Ar=A("disc-3",Cr);/**
|
|
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 Er=[["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"}]],Ir=A("droplet",Er);/**
|
|
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 Rr=[["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"}]],Tr=A("droplets",Rr);/**
|
|
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 Lr=[["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"}]],Or=A("fish",Lr);/**
|
|
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 Fr=[["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"}]],Dr=A("flame",Fr);/**
|
|
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 zr=[["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"}]],$r=A("flower-2",zr);/**
|
|
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 Pr=[["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"}]],Kr=A("flower",Pr);/**
|
|
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 Ur=[["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"}]],Br=A("ghost",Ur);/**
|
|
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 Vr=[["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"}]],Hr=A("github",Vr);/**
|
|
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 qr=[["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"}]],Gr=A("guitar",qr);/**
|
|
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 Yr=[["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"}]],Wr=A("hexagon",Yr);/**
|
|
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 Qr=[["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"}]],Zr=A("ice-cream-bowl",Qr);/**
|
|
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 Jr=[["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"}]],Xr=A("joystick",Jr);/**
|
|
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 eo=[["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"}]],to=A("leaf",eo);/**
|
|
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 no=[["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"}]],so=A("lightbulb",no);/**
|
|
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 ao=[["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"}]],io=A("milk",ao);/**
|
|
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 ro=[["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"}]],oo=A("moon-star",ro);/**
|
|
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 lo=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],co=A("moon",lo);/**
|
|
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 uo=[["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"}]],go=A("mountain-snow",uo);/**
|
|
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 mo=[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]],_o=A("mountain",mo);/**
|
|
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 po=[["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"}]],ho=A("radio",po);/**
|
|
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 fo=[["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"}]],xo=A("sailboat",fo);/**
|
|
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 yo=[["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"}]],vo=A("shirt",yo);/**
|
|
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 bo=[["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"}]],ko=A("skull",bo);/**
|
|
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 jo=[["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"}]],wo=A("snowflake",jo);/**
|
|
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 No=[["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"}]],So=A("sparkle",No);/**
|
|
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 Mo=[["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"}]],Co=A("sun-dim",Mo);/**
|
|
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 Ao=[["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"}]],Eo=A("sun",Ao);/**
|
|
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 Io=[["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"}]],Ro=A("sunrise",Io);/**
|
|
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 To=[["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"}]],Lo=A("sunset",To);/**
|
|
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 Oo=[["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"}]],Fo=A("tent",Oo);/**
|
|
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 Do=[["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"}]],zo=A("tree-deciduous",Do);/**
|
|
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 $o=[["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"}]],Po=A("tree-palm",$o);/**
|
|
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 Ko=[["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"}]],Uo=A("tree-pine",Ko);/**
|
|
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 Bo=[["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"}]],Vo=A("trees",Bo);/**
|
|
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 Ho=[["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"}]],qo=A("umbrella",Ho);/**
|
|
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 Go=[["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"}]],Yo=A("waves",Go);/**
|
|
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 Wo=[["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"}]],Qo=A("wheat",Wo);/**
|
|
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 Zo=[["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"}]],Jo=A("wind",Zo),Xo=({appVersion:e=null,slowWaitHintMs:s})=>{ne();const a="https://local-operator.com/download",[i,r]=o.useState(!1),l=cs(i,s??ri),[d,u]=o.useState(!1),[c,g]=o.useState(null),[y,_]=o.useState("info"),[f,p]=o.useState(null),[x,b]=o.useState(null),M=e?.trim()?e.trim():null,z=o.useRef(!1),N=Dt(K=>K.openDetail),E=o.useRef(!1),v=o.useRef(0),k=o.useRef(!1),w=o.useCallback((K,q)=>{E.current=!1,g(K),_(q),u(!0)},[]),G=o.useCallback(K=>{E.current=!0,g(K),_("success"),u(!0)},[]),T=o.useCallback(()=>{E.current&&(E.current=!1,u(!1),g(null))},[]),{clearDeferredUpdate:$}=Bs();o.useEffect(()=>{const K=window.api.updater.onUpdateError(m=>{z.current&&m.includes("manually")&&(p({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),_("warning"),u(!0))}),q=window.api.updater.onBackendUpdateDevMode(m=>{z.current&&w(m,"info")}),V=()=>{k.current=!0,T()},Y=window.api.updater.onUpdateAvailable(V),H=window.api.updater.onUpdateNpxAvailable(V),te=window.api.updater.onBackendUpdateAvailable(V);return()=>{K(),q(),Y(),H(),te()}},[T,w]),o.useEffect(()=>{let K=!1;const q=()=>{window.api.updater.getLastInstallAttempt().then(Y=>{K||b(Y)}).catch(()=>{})};q();const V=window.api.updater.onUpdateInstallFailed(()=>q());return()=>{K=!0,V()}},[]);const R=async()=>{const K=++v.current;T(),k.current=!1;try{r(!0),z.current=!0,$(Ke.UI),$(Ke.BACKEND);const q=await window.api.updater.checkForAllUpdates({manual:!0});if(K!==v.current)return;q.app==="available"&&N(Ke.UI),q.server==="available"&&N(Ke.BACKEND),q?.affirmation&&!k.current?G(q.affirmation):T()}catch(q){if(K!==v.current)return;console.warn(`Update check failed; the app-level alert owns the report: ${oi(q)}`)}finally{K===v.current&&r(!1),setTimeout(()=>{z.current=!1},2e3)}},J=()=>{E.current=!1,u(!1),g(null)};return t.jsxs(t.Fragment,{children:[x&&t.jsxs("div",{className:"mb-3 rounded-sm bg-sunken p-3",children:[t.jsxs("p",{className:"text-body-sm text-ink",children:[n("ui.common.updates.check_for_updates_button.the_last_update_to_version"),x.targetVersion," ",n("ui.common.updates.check_for_updates_button.didn_t_finish"),x.attempts>1?n("ui.common.updates.check_for_updates_button.detail",{attempts:x.attempts,attemptsText:String(x.attempts)}):"",".",M?n("ui.common.updates.check_for_updates_button.version",{liveversion:String(M)}):null]}),t.jsxs("p",{className:"mt-1 text-meta text-ink-dim",children:[n("ui.common.updates.check_for_updates_button.detected")," ",x.detectedAt?new Date(x.detectedAt).toLocaleString():"at an unknown time",". ",x.detail]}),t.jsx(F,{variant:"outline",size:"sm",className:"mt-2",onClick:()=>void window.api.openExternal(a),children:n("ui.common.updates.check_for_updates_button.download_a_fresh_copy")})]}),t.jsxs(F,{variant:"outline",onClick:()=>void R(),disabled:i,children:[i?t.jsx(ve,{size:"sm"}):null,i?n("ui.common.updates.check_for_updates_button.checking"):n("ui.common.updates.check_for_updates_button.check_for_updates")]}),l&&t.jsx("p",{className:"mt-2 text-meta text-ink-muted",children:n("ui.common.updates.check_for_updates_button.still_checking_a_slow_or_stalled_connection_can_hold_this_for_abo")}),f&&t.jsxs(xn,{open:d,autoHideDuration:1e4,onClose:J,variant:"warning",children:[t.jsx("p",{className:"text-body-sm",children:f.message}),f.command&&t.jsx("code",{className:"mt-2 block rounded-sm bg-sunken p-2 text-mono-sm text-ink",children:f.command})]}),c&&y!=="danger"&&t.jsx(xn,{open:d,autoHideDuration:6e3,onClose:J,variant:y,children:c})]})},ft=["system-prompt"],el=()=>{const{shouldEnableQuery:e}=Vs();return Re({enabled:e({bypassInternetCheck:!0}),queryKey:ft,queryFn:async()=>{try{const a=await Qn(Xt.baseUrl).config.getSystemPrompt();if(a===null)return null;if(a.status>=400)throw new Error(a.message||"Failed to fetch system prompt");return a.result}catch(s){const a=s instanceof Error?s.message:"An unknown error occurred while fetching system prompt";throw Zn(a),s}},refetchOnWindowFocus:!1,staleTime:5e3})},tl=()=>{const e=en(),s=Qn(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 r=i instanceof Error?i.message:"An unknown error occurred while updating system prompt";throw Zn(r),i}},onSuccess:async a=>{await e.invalidateQueries({queryKey:ft,refetchType:"none"}),e.setQueryData(ft,i=>i&&{...i,...a}),await e.refetchQueries({queryKey:ft,type:"all"}),qs("System prompt updated")},onError:a=>{console.error("Error updating system prompt:",a)}})},hs=({value:e,label:s,description:a,onChange:i,icon:r,isSaving:l=!1,disabled:d=!1})=>{const[u,c]=o.useState(e),g=o.useId(),y=`${g}-label`,_=`${g}-description`,f=async p=>{if(!(l||d)){c(p);try{await i(p)}catch(x){c(!p),console.error("Error toggling setting:",x)}}};return t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("span",{id:y,className:"flex min-h-6 items-center gap-2 text-body text-ink",children:[r&&t.jsx(r,{size:14,"aria-hidden":"true",className:"shrink-0 text-ink-dim"}),s]}),a&&t.jsx("p",{id:_,className:"mt-0.5 max-w-2xl text-body-sm text-ink-muted",children:a})]}),t.jsx("div",{className:"flex h-6 shrink-0 items-center",children:l?t.jsx(ve,{size:"md",label:`Saving ${s}`}):t.jsx(gs,{checked:u,onCheckedChange:f,disabled:d,"aria-labelledby":y,"aria-describedby":a?_:void 0})})]})};function Mn(e,s){const a=qi(e,s?.in);if(!Vi(a))throw new RangeError("Invalid time value");const i=qe(a.getDate(),2),r=qe(a.getMonth()+1,2),l=a.getFullYear(),d=qe(a.getHours(),2),u=qe(a.getMinutes(),2),c=qe(a.getSeconds(),2);let g="",y="";const _=a.getTimezoneOffset();if(_!==0){const f=Math.abs(_),p=qe(Math.trunc(f/60),2),x=qe(f%60,2);y=`${_<0?"+":"-"}${p}:${x}`}else y="Z";return`${l}-${r}-${i}T${d}:${u}:${c}${g}${y}`}function nl(e,s,a){return Bi(e,-30,a)}var sl=Gs({chartName:"LineChart",GraphicalChild:Jn,axisComponents:[{axisType:"xAxis",AxisComp:Ys},{axisType:"yAxis",AxisComp:Ws}],formatAxisMap:Qs});const al=["radient","creditBalance"],il=e=>{const{user:s,isAuthenticated:a}=tn(),i=s?.account?.tenant_id,r=a&&!!i&&e?.enabled;return Re({queryKey:[al,i],queryFn:async()=>{if(!i)throw new Error("Tenant ID not available");const l=await Xn({operation:"credits",tenantId:i});if(!l||typeof l.balance!="number")throw new Error("Invalid credit balance response format");return l},enabled:r,staleTime:5*60*1e3,refetchOnWindowFocus:!0})},rl=["radient","usageRollup"],ol=(e,s)=>{const{user:a,isAuthenticated:i}=tn(),r=a?.account?.tenant_id,l=i&&!!r&&s?.enabled;return Re({queryKey:[...rl,r,e],queryFn:async()=>{if(!r)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:r,query:d});if(!u)throw new Error("Invalid usage rollup response format");return u},enabled:l,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:r})=>{const l=o.useId();return t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("span",{id:l,className:"flex min-h-6 items-center text-body text-ink",children:e}),t.jsx("p",{className:"mt-0.5 max-w-2xl text-body-sm text-ink-muted",children:s})]}),t.jsx("div",{className:"flex h-6 shrink-0 items-center",children:t.jsx(kt,{value:a,onValueChange:i,children:t.jsx(jt,{"aria-labelledby":l,children:r.map(d=>t.jsx(Qe,{value:d.value,children:d.label},d.value))})})})]})},ul=({state:e,onChange:s})=>{ne();const a=o.useId(),i=`${a}-description`,[r,l]=o.useState(null),d=o.useRef(!1),u=o.useRef(null),c=e?.settings.intensity??0;if(!e)return null;const g=!e.capability.supported,y=g?dl(e.capability.reason):null,_=async x=>{if(d.current){u.current=x;return}d.current=!0;try{await s({intensity:x})}finally{d.current=!1;const b=u.current;u.current=null,b!==null&&b!==x?_(b):l(null)}},f=e.settings.enabled,p=r??c;return t.jsxs("div",{className:"flex flex-col gap-4","data-window-glass":"","data-glass-gate":e.capability.reason,children:[t.jsx(Je,{content:y,disabled:!g,children:t.jsx("div",{className:g?"opacity-60":void 0,children:t.jsx(hs,{value:g?!1:f,disabled:g,label:n("ui.settings.appearance.window_glass.label"),description:n("ui.settings.appearance.window_glass.description"),onChange:async x=>s({enabled:x})},g?"unavailable":"available")})}),y&&t.jsx("p",{"data-glass-unsupported":e.capability.reason,className:"max-w-2xl text-body-sm text-ink-muted",children:y}),e.restartRequired&&t.jsx("output",{className:"block max-w-2xl text-body-sm text-ink","data-glass-restart":"",children:n("ui.settings.appearance.window_glass.restart_needed")}),f&&!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:x=>void s({coverage:x}),options:Zs.map(x=>({value:x,label:ll(x)}))}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex min-h-6 items-center justify-between gap-3",children:[t.jsx("label",{htmlFor:a,className:"text-body text-ink",children:n("ui.settings.appearance.window_glass.intensity_label")}),t.jsx("span",{"data-glass-readout":"",className:"shrink-0 text-meta text-ink-dim tabular-nums",children:n("ui.settings.appearance.window_glass.intensity_value",{value:String(p)})})]}),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:p,"aria-describedby":i,"aria-valuetext":n("ui.settings.appearance.window_glass.intensity_value",{value:String(p)}),onChange:x=>{const b=Number(x.target.value);l(b),_(b)},style:{"--fill":`${p}%`},className:"mt-3 h-4 w-full cursor-pointer appearance-none bg-transparent bg-center bg-no-repeat bg-[length:100%_6px] bg-[linear-gradient(to_right,var(--color-accent)_0_var(--fill),var(--color-sunken)_var(--fill)_100%)] [&::-webkit-slider-thumb]:size-4 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-accent [&::-webkit-slider-thumb]:transition-colors [&::-webkit-slider-thumb]:duration-fast [&::-webkit-slider-thumb]:ease-out-quart [&::-webkit-slider-thumb]:hover:bg-accent-hover"}),t.jsxs("div",{"aria-hidden":"true",className:"mt-1 flex justify-between text-meta text-ink-dim",children:[t.jsx("span",{children:n("ui.settings.appearance.window_glass.intensity_start")}),t.jsx("span",{children:n("ui.settings.appearance.window_glass.intensity_end")})]})]}),t.jsx(Cn,{label:n("ui.settings.appearance.window_glass.material_label"),description:n("ui.settings.appearance.window_glass.material_description"),value:e.settings.material,onValueChange:x=>void s({material:x}),options:e.capability.materials.map(x=>({value:x,label:cl(x)}))})]})]})},gl=new Set(["B","C","D","E","F"]);function ml(e){const{status:s,refused:a,everVisible:i,checking:r=!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":r&&i?"visible":a&&i?"error":"absent"}function _l(e,s){return e!=="absent"}function tt(e,s){if(e.surface_state==="F")return"F";const a=s.endpoint;return a?a.state==="paused"?"D":a.state==="disabled"?"E":"C":"B"}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 Gt(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,r)=>i.direction.localeCompare(r.direction)||i.effect.localeCompare(r.effect)||JSON.stringify(i.target).localeCompare(JSON.stringify(r.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(r=>r.direction===i&&r.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 xt(e){switch(e.code){case"bridge_signin_required":return n("ui.agentMessages.settings.refusal.sign_in");case"bridge_not_available":return n("ui.agentMessages.settings.refusal.not_available");case"bridge_disabled":return n("ui.agentMessages.settings.refusal.disabled");case"rate_limited":return n("ui.agentMessages.settings.refusal.rate_limited");case"invalid_request":return n("ui.agentMessages.settings.refusal.invalid_request");case"consent_version_unknown":return n("ui.agentMessages.settings.consent.changed");case"messaging_unavailable":return n("ui.agentMessages.settings.dark.body");default:return e.message||n("ui.agentMessages.settings.refusal.generic")}}const At="__none__";function yl({availability:e,status:s,accountId:a,refusal:i=null,api:r=ci,onRefreshStatus:l,sessions:d=[]}){ne();const[u,c]=o.useState({kind:"loading"}),[g,y]=o.useState(0),[_,f]=o.useState(null),[p,x]=o.useState(null),[b,M]=o.useState(s?.local.enabled??!1),[z,N]=o.useState(s?.local.session??""),E=s?.tenant_id??void 0,v=e==="visible",k=s?.account_id??null,w=k!==null&&k===a;o.useEffect(()=>{if(!v)return;let T=!1;return c({kind:"loading"}),x(null),(async()=>{try{const $=await r.settings(E);if(T)return;if(!$){c({kind:"error",refusal:{code:"invalid_response",message:n("ui.agentMessages.settings.error.unreadable")}});return}let R=null;if($.endpoint){if(R=await r.allowlist($.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:$,allowlist:R})}catch($){if(T)return;c({kind:"error",refusal:Fe($)})}})(),()=>{T=!0}},[v,a,k,E,g,r]),o.useEffect(()=>{if(!v||u.kind!=="ready"||!u.settings.endpoint||u.allowlist)return;let T=!1;return(async()=>{try{const $=await r.allowlist(u.settings.settings.tenant_id);if(T||!$)return;c(R=>R.kind==="ready"&&!R.allowlist?{...R,allowlist:$}:R)}catch($){T||x(Fe($))}})(),()=>{T=!0}},[v,u,r]),o.useEffect(()=>{s&&(M(s.local.enabled),N(s.local.session))},[s]);const G=()=>y(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(ae,{variant:"warning",children:[t.jsx(wt,{children:n("ui.agentMessages.settings.error.title")}),t.jsxs(Ee,{children:[i?xt(i):n("ui.agentMessages.settings.refusal.generic"),t.jsx(F,{className:"mt-3",variant:"secondary",onClick:()=>{G(),l(!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:[p&&t.jsx(ae,{variant:"warning",children:t.jsx(Ee,{children:xt(p)})}),u.kind==="loading"&&t.jsx(vl,{}),u.kind==="error"&&t.jsxs(ae,{variant:"warning",children:[t.jsx(wt,{children:n("ui.agentMessages.settings.error.title")}),t.jsxs(Ee,{children:[u.refusal.code!=="client_unavailable"&&t.jsx("span",{className:"block",children:xt(u.refusal)}),t.jsx("span",{className:"block",children:n("ui.agentMessages.settings.error.no_changes")}),t.jsx(F,{className:"mt-3",variant:"secondary",onClick:G,children:n("ui.agentMessages.settings.error.retry")})]})]}),u.kind==="ready"&&t.jsxs(t.Fragment,{children:[t.jsx(wl,{state:tt(s,u.settings),status:s,settings:u.settings,accountId:k??a,accountMatches:w,api:r,pending:_,localEnabled:b,onActionRefusal:x,onSettings:T=>c($=>$.kind==="ready"?{...$,settings:T}:$),onLocalEnabled:M,onRefreshStatus:l,setPending:f}),t.jsx(Nl,{value:z,sessions:d,pending:_==="session",disabled:_!==null,onSave:async T=>{f("session"),x(null);try{await r.localSetting("team_bridge.session",T),N(T),await l(!0)}catch($){x(Fe($))}finally{f(null)}}}),u.allowlist&&(tt(s,u.settings)==="C"||tt(s,u.settings)==="D"||tt(s,u.settings)==="F")&&t.jsx(Sl,{allowlist:u.allowlist,accountId:k??a,accountMatches:w,readOnly:s.read_only===!0&&tt(s,u.settings)==="F",pending:_!==null,onSaving:T=>f(T?"allowlist":null),onRefusal:x,onSaved:T=>c($=>$.kind==="ready"?{...$,allowlist:T}:$),api:r},u.allowlist.view.tenant_id??"tenant")]})]})}function vl(){return t.jsxs("div",{className:"flex flex-col gap-3","aria-busy":"true",children:[t.jsx(ye,{className:"h-5 w-40"}),t.jsx(ye,{className:"h-4 w-full max-w-xl"}),t.jsx(ye,{className:"h-9 w-36"}),t.jsx(ye,{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:r,api:l,pending:d,localEnabled:u,onActionRefusal:c,onSettings:g,onLocalEnabled:y,onRefreshStatus:_,setPending:f})=>{const p=fs(s),x=a.settings.tenant_id,b=d!==null||!r;async function M(k,w={}){if(!r)return null;f(k),c(null);try{const G=await l.updateSettings({expected_account_id:i,tenant_id:x,state:k,...w});if(g(G),k==="disabled")try{await l.localSetting("team_bridge.enabled",!1),y(!1)}catch(T){c(Fe(T))}return G}catch(G){const T=Fe(G);return c(T),T.code==="consent_version_unknown"&&await _(!0),null}finally{f(null)}}async function z(){if(!(!p||!r||!await M("active",{consent_version:p.version,consented_via:"settings"}))){f("local");try{await l.localSetting("team_bridge.enabled",!0),y(!0),await _(!0)}catch(w){c(Fe(w))}finally{f(null)}}}if(e==="F")return t.jsxs("div",{"data-agent-messages-state":e,className:"flex flex-col gap-3",children:[t.jsxs("div",{className:"rounded-md border border-hairline bg-sunken p-3",children:[t.jsx("p",{className:"text-body-sm text-ink",children:s.state_note?.trim()?s.state_note:n("ui.agentMessages.settings.state.turned_off_title")}),t.jsx("p",{className:"mt-1 text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.state.turned_off_org")})]}),t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.state.read_only")}),t.jsx(Et,{settings:a,status:s,readOnly:!0}),t.jsx(En,{value:u,disabled:b,description:n("ui.agentMessages.settings.local.stays_enrolled"),onChange:async k=>{f("local"),c(null);try{await l.localSetting("team_bridge.enabled",k),y(k),await _(!0)}catch(w){c(Fe(w))}finally{f(null)}}})]});const N=a.endpoint?.label?.trim(),E=a.endpoint?.consent??null,v=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:[p?t.jsx(bl,{text:p.text}):t.jsx(ae,{variant:"warning",children:t.jsx(Ee,{children:n("ui.agentMessages.settings.consent.unavailable")})}),t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsx(F,{"data-agent-messages-action":"enable",onClick:()=>void z(),disabled:b||!p,children:e==="B"?n("ui.agentMessages.settings.action.enable"):n("ui.agentMessages.settings.action.enable_again")}),t.jsx("span",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.off_by_default")})]})]}),e==="C"&&a.endpoint&&t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx(F,{"data-agent-messages-action":"pause",variant:"secondary",disabled:b,onClick:()=>void M("paused"),children:n("ui.agentMessages.settings.action.pause")}),t.jsx(F,{"data-agent-messages-action":"turn_off",variant:"secondary",disabled:b,onClick:()=>void M("disabled"),children:n("ui.agentMessages.settings.action.turn_off")})]}),t.jsx(Et,{settings:a,status:s}),v&&t.jsx(An,{onRenew:()=>void z(),disabled:b||!p}),t.jsx(En,{value:u,disabled:b,description:n("ui.agentMessages.settings.local.stays_enrolled"),onChange:async k=>{f("local"),c(null);try{await l.localSetting("team_bridge.enabled",k),y(k),await _(!0)}catch(w){c(Fe(w))}finally{f(null)}}})]}),e==="D"&&a.endpoint&&t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx(F,{"data-agent-messages-action":"resume",disabled:b||a.settings.consent_required&&p===null,onClick:()=>void M("active",a.settings.consent_required&&p?{consent_version:p.version,consented_via:"settings"}:{}),children:n("ui.agentMessages.settings.action.resume")}),t.jsx(F,{"data-agent-messages-action":"turn_off",variant:"secondary",disabled:b,onClick:()=>void M("disabled"),children:n("ui.agentMessages.settings.action.turn_off")})]}),a.settings.consent_required&&!p&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.consent.unavailable")}),t.jsx(Et,{settings:a,status:s}),v&&t.jsx(An,{onRenew:()=>void z(),disabled:b||!p})]})]})},An=({onRenew:e,disabled:s})=>t.jsx(ae,{variant:"warning",children:t.jsxs(Ee,{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")})]})}),Et=({settings:e,status:s,readOnly:a=!1})=>{const i=e.endpoint?.consent??null,r=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&&r&&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:r.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 r=o.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:r,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":r,checked:e,disabled:s,onCheckedChange:l=>void i(l)})]})},Nl=({value:e,sessions:s,pending:a,disabled:i,onSave:r})=>{const l=s.some(d=>d.session_id===e);return t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.agentMessages.settings.session.title")}),t.jsx("p",{className:"max-w-2xl text-meta text-ink-dim",children:n("ui.agentMessages.settings.session.help")}),t.jsxs(rn,{value:e===""?At:e,disabled:i,onValueChange:d=>void r(d===At?"":d),children:[t.jsx(on,{className:"w-full max-w-md","aria-label":n("ui.agentMessages.settings.session.title"),children:t.jsx(ln,{})}),t.jsxs(cn,{children:[t.jsx(Ze,{value:At,children:n("ui.agentMessages.settings.session.none")}),s.map(d=>t.jsx(Ze,{value:d.session_id,children:d.title?.trim()||d.session_id},d.session_id)),e!==""&&!l&&t.jsx(Ze,{value:e,children:e})]})]}),e!==""&&!l&&t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.session.unavailable")}),a&&t.jsx("p",{className:"text-meta text-ink-dim","aria-live":"polite",children:n("ui.agentMessages.settings.saving")})]})},Sl=({allowlist:e,accountId:s,accountMatches:a,readOnly:i,pending:r,api:l,onSaving:d,onRefusal:u,onSaved:c})=>{const[g,y]=o.useState(()=>Gt(e.allowlist.entries)),[_,f]=o.useState(()=>({send:e.view.directions.send.mode,receive:e.view.directions.receive.mode})),p=r||i||!a,x=xs(Yt(Ml(e),Cl(e))),b=hl({entries:g,modes:_,savedSignature:x,saving:r}),M=o.useRef(0),z=v=>y(k=>[...k,{...v,key:`${v.direction}:${v.effect}:${M.current++}`}]),N=v=>y(k=>k.filter(w=>w.key!==v)),E=async()=>{if(!p){d(!0),u(null);try{const v=await l.updateAllowlist({expected_account_id:s,tenant_id:e.allowlist.tenant_id,entries:Yt(g,_)}),k=Gt(v.allowlist.entries);y(k),f({send:v.view.directions.send.mode,receive:v.view.directions.receive.mode}),c(v)}catch(v){u(Fe(v))}finally{d(!1)}}};return t.jsxs("div",{"data-agent-messages-allowlist":"",className:"flex flex-col gap-5",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.agentMessages.settings.allowlist.title")}),t.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.allowlist.description")})]}),t.jsx(In,{direction:"receive",title:n("ui.agentMessages.settings.allowlist.receive"),mode:_.receive,cues:e.view.cues,entries:g.filter(v=>v.direction==="receive"),disabled:p,onMode:v=>f(k=>({...k,receive:v})),onAdd:v=>z({...v,direction:"receive"}),onRemove:N}),t.jsx(In,{direction:"send",title:n("ui.agentMessages.settings.allowlist.send"),mode:_.send,cues:e.view.cues,entries:g.filter(v=>v.direction==="send"),disabled:p,onMode:v=>f(k=>({...k,send:v})),onAdd:v=>z({...v,direction:"send"}),onRemove:N}),t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsxs(F,{onClick:()=>void E(),disabled:b.disabled||p,children:[t.jsx(us,{size:14}),n("ui.agentMessages.settings.allowlist.save")]}),b.disabled&&b.reason==="needs_entry"&&t.jsx("span",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.needs_entry")}),b.disabled&&b.reason==="unchanged"&&t.jsx("span",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.unchanged")}),i&&t.jsx("span",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.read_only")}),r&&t.jsx("span",{className:"text-meta text-ink-dim","aria-live":"polite",children:n("ui.agentMessages.settings.saving")})]})]})};function Ml(e){return Gt(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:r,disabled:l,onMode:d,onAdd:u,onRemove:c})=>{const g=r.filter(_=>_.effect==="allow"),y=r.filter(_=>_.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:l,onMode:d}),t.jsxs("div",{className:"flex flex-col gap-1 text-meta text-ink-dim",children:[i.allow_entry_switches_direction_to_listed_only&&t.jsx("p",{children:n("ui.agentMessages.settings.allowlist.cue_listed_only")}),i.removing_allow_does_not_stop_open_thread&&t.jsx("p",{children:n("ui.agentMessages.settings.allowlist.cue_remove")}),i.deny_stops_pair_both_directions&&t.jsx("p",{children:n("ui.agentMessages.settings.allowlist.cue_deny")})]}),a==="listed_only"&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.allowed_heading")}),g.length===0&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.allowlist.allowed_empty")}),g.map(_=>t.jsx(Rn,{entry:_,disabled:l,onRemove:()=>c(_.key)},_.key)),t.jsx(Tn,{label:n("ui.agentMessages.settings.allowlist.add_allowed"),disabled:l,onAdd:_=>u({..._,effect:"allow"})})]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.blocked_heading")}),y.length===0&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.allowlist.blocked_empty")}),y.map(_=>t.jsx(Rn,{entry:_,disabled:l,onRemove:()=>c(_.key)},_.key)),t.jsx(Tn,{label:n("ui.agentMessages.settings.allowlist.add_blocked"),disabled:l,onAdd:_=>u({..._,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(r=>t.jsx(F,{variant:"ghost",size:"sm","aria-pressed":e===r.value,disabled:s,onClick:()=>a(r.value),className:_e(e===r.value&&"bg-surface text-ink hover:bg-surface"),children:r.label},r.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,r]=o.useState("endpoint"),[l,d]=o.useState(""),[u,c]=o.useState(null),g=o.useId(),y=`${g}-help`,_=()=>{const f=xl(l.trim());c(f),!f&&(a({kind:i,id:l.trim()}),d(""))};return t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Ie,{htmlFor:g,children:e}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs(rn,{value:i,disabled:s,onValueChange:f=>r(f),children:[t.jsx(on,{className:"w-32","aria-label":n("ui.agentMessages.settings.allowlist.kind"),children:t.jsx(ln,{})}),t.jsxs(cn,{children:[t.jsx(Ze,{value:"endpoint",children:n("ui.agentMessages.settings.allowlist.kind_agent")}),t.jsx(Ze,{value:"account",children:n("ui.agentMessages.settings.allowlist.kind_person")})]})]}),t.jsx(De,{id:g,"aria-describedby":y,className:"max-w-xs",value:l,disabled:s,placeholder:n("ui.agentMessages.settings.allowlist.identifier"),onChange:f=>d(f.target.value),onKeyDown:f=>{f.key==="Enter"&&(f.preventDefault(),_())}}),t.jsx(F,{variant:"secondary",size:"sm",disabled:s,onClick:_,children:n("ui.agentMessages.settings.allowlist.add")})]}),t.jsx("p",{id:y,className:"text-meta text-ink-dim",children:i==="endpoint"?n("ui.agentMessages.settings.allowlist.identifier_help_agent"):n("ui.agentMessages.settings.allowlist.identifier_help_person")}),u&&t.jsx("p",{className:"text-meta text-danger",children:u})]})};function El(){const{snapshot:e}=ds(),[s,a]=o.useState(!1),i=ml({status:e.status,refused:e.refusal!==null,everVisible:s,checking:e.checking});return o.useEffect(()=>{i!=="absent"&&a(!0)},[i]),o.useEffect(()=>{li()},[]),i}const Ln={get[Ke.UI](){return n("ui.settings.updates.update_following.application_updates")},get[Ke.BACKEND](){return n("ui.settings.updates.update_following.server_updates")}},ut={patch:{get label(){return n("ui.settings.updates.update_following.patch_label")},get description(){return n("ui.settings.updates.update_following.patch_help")}},minor:{get label(){return n("ui.settings.updates.update_following.minor_label")},get description(){return n("ui.settings.updates.update_following.minor_help")}},major:{get label(){return n("ui.settings.updates.update_following.major_label")},get description(){return n("ui.settings.updates.update_following.major_help")}}},On=({type:e})=>{ne();const s=Dt(i=>i.followed[e]),a=Dt(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(rn,{value:s,onValueChange:i=>a(e,i),children:[t.jsx(on,{"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(Ze,{value:i,title:ut[i].description,children:ut[i].label},i))})]})]})},Il=()=>(ne(),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:Ke.UI}),t.jsx(On,{type:Ke.BACKEND})]})]})),Rl=({appVersion:e})=>t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(Il,{}),t.jsx(Xo,{appVersion:e})]}),Tl=e=>{if(!e)return null;try{return new URL(e).host}catch{return null}};function It(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=()=>{ne();const[e,s]=o.useState(null),[a,i]=o.useState({value:"Loading...",detail:null,degraded:!1}),[r,l]=o.useState({platform:"Loading...",arch:"...",nodeVersion:"Loading...",electronVersion:"Loading...",chromeVersion:"Loading..."});o.useEffect(()=>{let u=!0;const c=p=>{if(!u)return;const x=Tl(p.url);if(p.state==="connecting"){i({value:"Loading...",detail:null,degraded:!1});return}if(p.state==="detached"){i({value:"Not connected",detail:p.detail||null,degraded:!1});return}if(p.state==="wedged"){i({value:"Not attached",detail:p.detail||null,degraded:!1});return}const b=p.version||"Version unknown";i({value:x?`${b} · ${x}`:b,detail:p.detail||null,degraded:p.state==="degraded"})};let g=!1;const y=window.api?.backend?.onStatusChange(p=>{g=!0,c(p)}),_=async()=>{try{const[p,x]=await Promise.all([window.api.systemInfo.getAppVersion(),window.api.systemInfo.getPlatformInfo()]);u&&(s(p),l(x))}catch(p){console.error("Error fetching app information:",p)}},f=async()=>{try{const p=window.api?.backend;if(p){const M=await p.getStatus();g||c(M);return}const x=await yn.healthCheck(Xt.baseUrl),b=yn.getServerVersion(x);u&&i({value:b,detail:null,degraded:!1})}catch(p){console.error("Error fetching server version:",p),u&&i({value:"Unavailable",detail:null,degraded:!1})}};return _(),f(),()=>{u=!1,y?.()}},[]);const d=(u,c,g,y={})=>t.jsx(me,{label:t.jsx(Je,{content:g,children:t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx(Nt,{size:12,className:"shrink-0"}),u]})}),valueClassName:y.valueClassName,value:t.jsxs(t.Fragment,{children:[y.valueTooltip?t.jsx(Je,{content:y.valueTooltip,children:t.jsx("span",{"data-backend-version":y.valueHoverTarget?"":void 0,children:c})}):c,y.statusNote?t.jsx("span",{className:"mt-0.5 block text-meta text-ink-dim",children:y.statusNote}):null]})});return t.jsx(ce,{title:n("ui.settings.updates.app_updates_section.application_updates_and_info"),icon:zt,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"),It(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"),`${r.platform} (${r.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"),It(r.nodeVersion),n("ui.settings.updates.app_updates_section.the_javascript_runtime_environment_version")),d(n("ui.settings.updates.app_updates_section.electron_version"),It(r.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:Ge(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:Ge(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(r=>r.toLowerCase()===s))return null;const a=(e.resolvedLevel??"").trim(),i=a===""?"":dn(a,e.storable)??"";return i.trim().toLowerCase()===s?null:i}const yt="\0unread";function gt(e){return e.trim()===""?"":yt}function Dl(e){if(!e.supported)return{kind:"unsupported",options:[],selectedId:"",disabled:!0,helper:""};if(!e.hasHome)return Pe("no-home",n("ui.settings.model.default_effort.no_home"));if(!e.hasModel)return Pe("no-model",n("ui.settings.model.default_effort.no_model"),yt);if(e.settings==="loading")return Pe("settings-loading",n("ui.settings.model.default_effort.settings_loading"),yt);if(e.settings==="error")return Pe("settings-error",n("ui.settings.model.default_effort.settings_error"),yt);if(e.preview==="loading")return Pe("loading",n("ui.settings.model.default_effort.loading"),gt(e.stored));if(e.preview==="error")return Pe("error",n("ui.settings.model.default_effort.error"),gt(e.stored));if(e.ladder===null||!e.specResolved)return Pe("unresolved",n("ui.settings.model.default_effort.unresolved"),gt(e.stored));const s=e.ladder;if(s.length===0)return Pe("empty",n("ui.settings.model.default_effort.empty"),gt(e.stored));const a=vs(s,e.storable);if(a.length===0){const i=Ge(s[0]),r=s.length===1&&s[0].trim().toLowerCase()==="auto";return{kind:"one-level",options:[{id:"",name:i}],selectedId:"",disabled:!0,helper:r?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 Pe(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})=>{ne();const i=nn(),r=$t(i.data,"draft_preview"),l=Xs(),d=e!==""&&s!=="",u=Re({queryKey:Pt.all,queryFn:()=>pe({op:"settings.list"}),enabled:r,staleTime:1e4}),c=u.data?.settings.find(P=>P.key===pt),g=typeof c?.value=="string"?c.value:"",y=(c?.choices??[]).map(P=>P.value).filter(P=>typeof P=="string"),_={cwd:l??"",model:d?{provider:e,model_id:s,reasoning_effort:null}:null},f=u.isSuccess?g:null,p=Re({...ta(_),queryKey:[...ea(_),"model_effort",f],enabled:r&&!!l&&d}),x=p.isSuccess&&!p.isPlaceholderData,b=x?na(p.data?.snapshot,null).effort:null,M=x&&Array.isArray(b?.reasoning_efforts)?sa(b):null,z=x?aa(b):null,N=b!==null&&!ia(b),[E,v]=o.useState(!1),[k,w]=o.useState(!1),[G,T]=o.useState(null),[$,R]=o.useState(null),J=`${e}\0${s}`,K=en(),q=o.useRef(null),V=o.useRef(!1),Y=o.useCallback(async(P,ie)=>{v(!0),T(P),w(!1),ie===null&&R(null);try{await pe({op:"settings.edit",key:pt,value:P}),await K.invalidateQueries({queryKey:Pt.all}),ie!==null&&R(ie)}catch{w(!0)}finally{v(!1),T(null)}},[K]),H=typeof b?.display_name=="string"&&b.display_name.trim()||s,te=Dl({supported:r,hasHome:!!l,hasModel:d,settings:u.isError?"error":u.isSuccess?"ready":"loading",preview:p.isError?"error":x?"ready":"loading",ladder:M,specResolved:N,stored:g,resolvedLevel:z,storable:y}),m=Fl({stored:g,ladder:M,resolvedLevel:z,resolved:x&&N&&u.isSuccess,storable:y}),I=o.useRef(null);o.useEffect(()=>{if(m===null||E)return;const P=`${e}\0${s}\0${g}\0${m}`;if(I.current===P)return;I.current=P;const ie=m===""?n("ui.settings.model.default_effort.clamped_unset",{level:Ge(g),model:H}):n("ui.settings.model.default_effort.clamped",{level:Ge(g),model:H,resolved:Ge(m)});Y(m,{text:ie,model:J})},[m,g,E,Y,e,s,H,J]);const C=o.useMemo(()=>te.options.map($l),[te.options]);o.useEffect(()=>{if(!a){V.current=!1;return}te.disabled||V.current||(q.current?.querySelector("[role=combobox]")?.focus(),V.current=!0)},[a,te.disabled]);const W=G??te.selectedId,Q=C.find(P=>P.id===W)??(G!==null?{id:G,name:Ge(G)}:null),X=t.jsxs("span",{className:"flex flex-col gap-0.5",children:[t.jsx("span",{children:te.helper}),k&&t.jsx("span",{className:"text-danger",children:n("ui.settings.model.default_effort.save_failed")}),t.jsx("output",{"aria-live":"polite",children:$?.model===J?$.text:""})]});return te.kind==="unsupported"?null:t.jsx("div",{ref:q,"data-setting-key":pt,children:t.jsx(Ei,{label:n("ui.settings.model.default_effort.label"),icon:t.jsx(di,{size:16,"aria-hidden":"true"}),placeholder:n("ui.settings.model.default_effort.placeholder"),options:C,selected:Q,onSelect:P=>{Y(P.id,null)},helperText:X,busy:E,busyLabel:n("ui.settings.model.default_effort.busy"),disabled:te.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 r=new Set(a);let l=!1;for(const d of bs(e,s))if(!r.has(d.sourceId)){if(r.size>=i){l=!0;break}r.add(d.sourceId)}return{selected:r,capped:l}},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"}},Rt=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"}},ql=e=>{switch(e){case"resumed":return"ui.settings.imports.outcome_resumed";case"skipped_already_imported":return"ui.settings.imports.outcome_skipped";case"metadata_only":return"ui.settings.imports.outcome_metadata";case"failed":return"ui.settings.imports.outcome_failed";case"cancelled":return"ui.settings.imports.outcome_cancelled";default:return"ui.settings.imports.outcome_imported"}},Gl=e=>e==="failed"?"danger":e==="metadata_only"||e==="skipped_already_imported"?"neutral":e==="cancelled"?"warning":"success",Wt=e=>Pl(e.title)||e.sourceId,Dn=({path:e,label:s,onCopyPath:a})=>{const[i,r]=o.useState(!1);return t.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-md border border-hairline bg-surface p-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-body-sm text-ink",children:s}),t.jsx("p",{className:"mt-1 break-all font-mono text-meta text-ink-muted",children:e})]}),t.jsxs(F,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{a(e).then(l=>{l&&(r(!0),window.setTimeout(()=>r(!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])),r=e.sessionId,l=Math.max(0,e.total-e.completed-(r&&!i.has(r)?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!==r).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:Wt(u)}),t.jsx(it,{variant:"neutral",children:n("ui.settings.imports.session_pending")})]},u.sourceId)),r&&!i.has(r)&&t.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-hairline bg-surface p-2 text-body-sm text-ink-muted",children:[t.jsx(ht,{size:14,className:"animate-spin"}),t.jsx("span",{children:n("ui.settings.imports.session_importing")}),t.jsx("span",{className:"min-w-0 truncate",children:r})]}),l>0&&t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.progress_pending",{count:l})}),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(r=>Bl.test(r))?"cancelled":e.outcome;return t.jsxs("div",{className:"rounded-md border border-hairline bg-surface p-3",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"min-w-0 truncate text-body-sm text-ink",children:e.sourceId}),t.jsx(it,{variant:Gl(i),children:n(ql(i))}),t.jsx("span",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.session_meta",{messages:e.messages,compactions:e.compactions})})]}),e.targetSessionId&&(e.messages>0||e.outcome==="skipped_already_imported")&&t.jsx("p",{className:"mt-1 break-all font-mono text-meta text-ink-muted",children:n("ui.settings.imports.result_target",{target:e.targetSessionId})}),e.warnings.map(r=>t.jsx("p",{className:"mt-1 text-meta text-warning",children:r},r))]})},Wl=({sources:e,activeSource:s,sessions:a,query:i,selected:r,preview:l,previewStale:d,previewError:u,confirmed:c,busy:g,error:y,progress:_,result:f,cancelling:p,onSelectSource:x,onQueryChange:b,onToggleSession:M,onSelectAll:z,onClearSelection:N,onConfirmChange:E,onImport:v,onCancel:k,onRetry:w,onImportAnother:G,onRefresh:T,selectionNotice:$,onCopyPath:R})=>{ne();const J=e.find(m=>m.source===s),K=_!==null&&!Vl.has(_.state),q=_?.total??r.size,V=o.useMemo(()=>bs(a,i),[i,a]),Y=V.length>0&&V.every(m=>r.has(m.sourceId)),H=r.size,te=H>0&&l!==null&&!d&&c&&!g&&!_&&!f;return t.jsx(ce,{title:n("ui.settings.imports.title"),icon:zt,description:n("ui.settings.imports.description"),dataTourTag:"settings-import-section",children:t.jsxs("div",{className:"flex flex-col gap-5",children:[y&&t.jsxs(ae,{variant:"warning",children:[t.jsx(wt,{children:n("ui.settings.imports.title")}),t.jsx(Ee,{children:t.jsxs("span",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx("span",{children:y}),t.jsx(F,{variant:"secondary",size:"sm",onClick:w,children:n("ui.settings.imports.retry")})]})})]}),g==="sources"&&e.length===0?t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(ye,{className:"h-20 w-full"}),t.jsx(ye,{className:"h-20 w-full"}),t.jsx(ye,{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:K||g==="sources"||g==="sessions",children:[t.jsx(ui,{size:14,className:_e(g==="sources"&&"animate-spin")}),n("ui.settings.imports.refresh")]})]}),!e.some(m=>m.detected)&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.imports.empty_sources")}),t.jsx("div",{className:"grid gap-2 lg:grid-cols-3",children:e.map(m=>{const I=m.source===s,C=m.detected?n(Fn(m.availability)):n("ui.settings.imports.source_not_found");return t.jsxs("button",{type:"button","aria-pressed":I,disabled:K,onClick:()=>x(m.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",I?"border-accent bg-accent-wash":"border-hairline bg-surface hover:bg-sunken"),children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("span",{className:"text-body-sm font-medium text-ink",children:m.label}),t.jsx(it,{variant:m.detected&&m.availability==="full"?"success":"neutral",children:C})]}),t.jsx("p",{className:"mt-1 text-meta text-ink-muted",children:n("ui.settings.imports.source_sessions",{count:m.sessionCount})}),t.jsx("p",{className:"mt-1 break-all text-meta text-ink-dim",children:m.detail||m.root})]},m.source)})})]}),J&&!_&&!f&&t.jsxs("div",{className:"flex flex-col gap-3 border-t border-hairline pt-5",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[t.jsxs("h3",{className:"text-heading text-ink",children:[n("ui.settings.imports.source_heading")," · ",J.label]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(F,{variant:"secondary",size:"sm",onClick:Y?N:z,disabled:V.length===0,children:Y?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:H})})]})]}),$&&t.jsx("output",{className:"text-meta text-warning",children:$}),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(De,{value:i,onChange:m=>b(m.target.value),placeholder:n("ui.settings.imports.search_placeholder"),className:"pl-9"})]}),g==="sessions"?t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(ye,{className:"h-12 w-full"}),t.jsx(ye,{className:"h-12 w-full"}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.loading_sessions",{source:J.label})})]}):a.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.imports.empty_sessions",{source:J.label})}):V.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.imports.empty_filter")}):t.jsx("div",{className:"flex max-h-80 flex-col gap-1 overflow-y-auto",children:V.map(m=>{const I=`import-session-${m.source}-${m.sourceId}`;return t.jsxs("div",{className:_e("flex items-start gap-3 rounded-md border p-3",r.has(m.sourceId)?"border-accent bg-row-selected":"border-hairline bg-surface hover:bg-sunken"),children:[t.jsx(qt,{id:I,checked:r.has(m.sourceId),onCheckedChange:()=>M(m.sourceId),"aria-label":Wt(m),className:"mt-0.5"}),t.jsxs("label",{htmlFor:I,className:"min-w-0 flex-1 cursor-pointer 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:Wt(m)}),t.jsx(it,{variant:m.availability==="full"?"neutral":"warning",children:n(Fn(m.availability))})]}),t.jsxs("span",{className:"mt-1 flex flex-wrap gap-x-3 gap-y-1 text-meta text-ink-muted",children:[t.jsx("span",{children:n("ui.settings.imports.session_meta",{messages:m.messageCount??0,compactions:m.compactionCount})}),t.jsx("span",{children:n("ui.settings.imports.session_updated",{date:sn(new Date((m.updatedTs||m.createdTs)*1e3))})})]}),m.cwd&&t.jsx("span",{className:"mt-1 block break-all font-mono text-meta text-ink-dim",children:m.cwd}),m.availability==="metadata_only"&&t.jsx("span",{className:"mt-1 block text-meta text-warning",children:n("ui.settings.imports.metadata_only_explain")}),m.availability==="unsupported"&&t.jsx("span",{className:"mt-1 block text-meta text-warning",children:n("ui.settings.imports.session_index_only")})]})]},m.sourceId)})})]}),J&&H>0&&!_&&!f&&t.jsxs("div",{className:"flex flex-col gap-3 border-t border-hairline pt-5",children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.settings.imports.preview_heading")}),(g==="preview"||d||l===null&&!u)&&t.jsxs("p",{className:"flex items-center gap-2 text-meta text-ink-muted",children:[t.jsx(ht,{size:14,className:"animate-spin"}),n("ui.settings.imports.loading_preview")]}),l&&!d&&t.jsxs("div",{className:"flex flex-col gap-2 rounded-lg border border-hairline bg-surface p-4",children:[t.jsx("p",{className:"text-body-sm text-ink",children:n("ui.settings.imports.preview_summary",{sessions:l.totalSessions,messages:l.totalMessages,compactions:l.totalCompactions})}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.preview_memory",{records:l.totalMemoryRecords,tokens:l.projectedMemoryTokens.toLocaleString()})}),l.warnings.slice(0,4).map((m,I)=>t.jsx("p",{className:"text-meta text-warning",children:m.message},`${m.code}:${m.sessionId}:${I}`)),l.warnings.length>4&&t.jsx("p",{className:"text-meta text-warning",children:n("ui.settings.imports.warnings_heading",{count:l.warnings.length})}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.preview_confirm")})]}),t.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border border-hairline bg-surface p-4",children:[u&&t.jsx(ae,{variant:"warning",children:t.jsx(Ee,{children:t.jsxs("span",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx("span",{children:u}),t.jsx(F,{variant:"secondary",size:"sm",onClick:w,children:n("ui.settings.imports.retry")})]})})}),t.jsxs("div",{className:"flex items-start gap-2 text-body-sm text-ink",children:[t.jsx(qt,{checked:c,onCheckedChange:m=>E(m===!0),disabled:!l||d,"aria-label":n("ui.settings.imports.confirm_label"),className:"mt-0.5"}),t.jsx("span",{children:n("ui.settings.imports.confirm_label")})]}),t.jsxs(F,{variant:"primary",onClick:v,disabled:!te,className:"self-start",children:[g==="start"?t.jsx(ht,{size:14,className:"animate-spin"}):t.jsx(zt,{size:14}),n("ui.settings.imports.import_button",{count:H})]})]})]}),_&&!f&&t.jsxs("div",{className:"flex flex-col gap-3 border-t border-hairline pt-5",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.settings.imports.progress_heading")}),t.jsxs(F,{variant:"secondary",size:"sm",onClick:k,disabled:p||_.state==="done"||_.state==="cancelled"||_.state==="failed",children:[t.jsx(ra,{size:12}),p?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:_.jobId,state:n(Rt(_.state))})," · ",n(Hl(_.phase))]}),t.jsx(Ii,{value:_.total?_.completed/_.total*100:0,className:"h-1.5"}),t.jsx(Yl,{progress:_,sessions:a,selected:r})]}),f&&t.jsxs("div",{className:"flex flex-col gap-3 border-t border-hairline pt-5",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.settings.imports.result_heading")}),t.jsx(F,{variant:"secondary",size:"sm",onClick:G,children:n("ui.settings.imports.import_another")})]}),t.jsx("p",{className:"text-body-sm text-ink",children:f.state==="cancelled"?n("ui.settings.imports.result_summary_cancelled",{state:n(Rt(f.state)),sessions:f.sessions.length,total:q,messages:f.messages}):n("ui.settings.imports.result_summary",{state:n(Rt(f.state)),sessions:f.sessions.length,messages:f.messages})}),f.sessions.map(m=>t.jsx(js,{row:m,jobCancelled:f.state==="cancelled"},`${m.source}:${m.sourceId}:${m.targetSessionId}`)),(f.instructionReviewPath||f.memoryReviewPath)&&t.jsxs("div",{className:"flex flex-col gap-2",children:[f.instructionReviewPath&&t.jsx(Dn,{path:f.instructionReviewPath,label:n("ui.settings.imports.review_instructions"),onCopyPath:R}),f.memoryReviewPath&&t.jsx(Dn,{path:f.memoryReviewPath,label:n("ui.settings.imports.review_memory"),onCopyPath:R})]}),f.warnings.length>0&&t.jsx(ae,{variant:"warning",children:t.jsx(Ee,{children:t.jsxs("span",{className:"flex flex-col gap-1",children:[t.jsx("span",{children:n("ui.settings.imports.warnings_heading",{count:f.warnings.length})}),f.warnings.slice(0,4).map((m,I)=>t.jsx("span",{children:m.message},`${m.code}:${I}`))]})})}),f.error&&t.jsx(ae,{variant:"danger",children:t.jsx(Ee,{children:f.error})}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.rerun_safe")})]}),g==="start"&&!_&&t.jsxs("p",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[t.jsx(ht,{size:14,className:"animate-spin"}),n("ui.settings.imports.importing")]})]})})},un=e=>({source:e.source,sessionId:e.session_id,code:e.code,message:e.message}),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}),Ql=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?Ql(s.result):void 0}}async function nc(e){await pe({op:"imports.cancel",jobId:e})}const mt=new Set(["done","failed","cancelled"]),We=e=>e instanceof Error?e.message:String(e),sc=()=>{ne();const[e,s]=o.useState([]),[a,i]=o.useState(null),[r,l]=o.useState([]),[d,u]=o.useState(""),[c,g]=o.useState(new Set),[y,_]=o.useState(null),[f,p]=o.useState(null),[x,b]=o.useState(!1),[M,z]=o.useState(null),[N,E]=o.useState(null),[v,k]=o.useState(null),[w,G]=o.useState(null),[T,$]=o.useState(!1),[R,J]=o.useState(null),[K,q]=o.useState(0),V=o.useRef(0),Y=o.useRef(0),[H,te]=o.useState(null),[m,I]=o.useState(null),C=o.useRef(null),W=v!==null&&!mt.has(v.state),Q=o.useCallback(async()=>{z("sources"),E(null);try{const B=await Zl();s(B),i(ee=>B.some(ue=>ue.source===ee&&ue.detected)?ee:B.find(ue=>ue.detected)?.source??null)}catch(B){E(n("ui.settings.imports.error_sources",{reason:We(B)}))}finally{z(null)}},[]);o.useEffect(()=>{Q()},[Q]);const X=o.useCallback(async B=>{const ee=++V.current;z("sessions"),E(null);try{const ge=await Jl(B);if(ee!==V.current)return;l(ge)}catch(ge){if(ee!==V.current)return;l([]),E(n("ui.settings.imports.error_sessions",{source:B,reason:We(ge)}))}finally{ee===V.current&&z(null)}},[]);o.useEffect(()=>{if(!a){l([]);return}l([]),g(new Set),_(null),p(null),te(null),I(null),b(!1),G(null),k(null),X(a)},[a,X]);const P=o.useCallback(B=>{g(B),b(!1),te(null),I(null),J(null)},[]),ie=o.useCallback(B=>{W||(i(B),u(""))},[W]),de=o.useCallback(B=>{const ee=new Set(c);ee.has(B)?ee.delete(B):ee.add(B),P(ee)},[P,c]),Se=o.useCallback(()=>{const B=Ul(r,d,c);P(B.selected),B.capped&&J(n("ui.settings.imports.selection_limit",{max:ks}))},[d,P,c,r]),je=o.useCallback(()=>{P(new Set)},[P]),he=o.useMemo(()=>Kl(a,c),[a,c]),S=y!==null&&f!==he,U=o.useCallback(async()=>{if(!a||c.size===0)return;const B=++Y.current,ee=he;z("preview"),E(null),I(null);try{const ge=await Xl({sources:[a],sessionIds:{[a]:[...c].sort()}});if(B!==Y.current)return;_(ge),p(ee)}catch(ge){if(B!==Y.current)return;_(null),p(null),te(ee),I(n("ui.settings.imports.error_preview",{reason:We(ge)}))}finally{B===Y.current&&z(null)}},[a,he,c]);o.useEffect(()=>{if(!a||c.size===0||v||w||y&&f===he||!y&&H===he)return;const B=setTimeout(()=>{U()},250);return()=>clearTimeout(B)},[a,c,he,y,f,H,v,w,U]);const L=o.useCallback(async()=>{if(!(!a||c.size===0||!y||S||!x||v)){z("start"),E(null),G(null);try{const B=await ec({sources:[a],sessionIds:{[a]:[...c].sort()}}),ee=Date.now()/1e3;k({jobId:B,state:"queued",phase:"queued",source:a,sessionId:"",completed:0,total:c.size,results:[],warnings:[],error:"",startedAt:ee,updatedAt:ee})}catch(B){E(n("ui.settings.imports.error_start",{reason:We(B)}))}finally{z(null)}}},[a,x,y,S,v,c]),se=v?.jobId??null,re=v?.state??null;o.useEffect(()=>{if(!se||!re||mt.has(re))return;let B=!0,ee;const ge=async()=>{try{const ue=await tc(se);if(!B)return;if(C.current){const D=C.current;C.current=null,E(oe=>oe===D?null:oe)}k(ue),ue.result&&G({...ue.result,jobId:ue.jobId}),mt.has(ue.state)||(ee=setTimeout(ge,900))}catch(ue){if(!B)return;const D=n("ui.settings.imports.error_job",{reason:We(ue)});C.current=D,E(D),ee=setTimeout(ge,2e3)}};return ee=setTimeout(ge,K>0?0:700),()=>{B=!1,ee&&clearTimeout(ee)}},[se,re,K]);const Be=o.useCallback(async()=>{if(!(!v||mt.has(v.state))){$(!0),E(null);try{await nc(v.jobId)}catch(B){E(n("ui.settings.imports.error_cancel",{reason:We(B)}))}finally{$(!1)}}},[v]),xe=o.useCallback(()=>{g(new Set),_(null),p(null),te(null),I(null),b(!1),J(null),G(null),k(null),E(null),a&&X(a)},[a,X]),Me=o.useCallback(async B=>{try{return await navigator.clipboard.writeText(B),!0}catch{return!1}},[]),Te=o.useCallback(async()=>{W||(J(null),te(null),I(null),await Q(),a&&await X(a))},[a,W,X,Q]),Ve=o.useCallback(()=>{if(W){E(null),q(B=>B+1);return}te(null),I(null),Te()},[W,Te]);return t.jsx(Wl,{sources:e,activeSource:a,sessions:r,query:d,selected:c,preview:y,previewStale:S,previewError:m,confirmed:x,busy:M,error:N,progress:v,result:w,cancelling:T,onSelectSource:ie,onQueryChange:u,onToggleSession:de,onSelectAll:Se,onClearSelection:je,onConfirmChange:b,onImport:()=>void L(),onCancel:()=>void Be(),onRetry:Ve,onImportAnother:xe,onRefresh:Te,selectionNotice:R,onCopyPath:Me})},ac=e=>{const s=e.label.replace(/^Open\s+/,"");return s.charAt(0).toUpperCase()+s.slice(1)},ic=({action:e})=>{ne();const s=o.useId(),a=o.useRef(null),i=Ue(x=>x.shortcutBindings),r=i[e.id],l=Ue(x=>x.setShortcutBinding),d=Ue(x=>x.clearShortcutBinding),[u,c]=o.useState(!1),[g,y]=o.useState(null),_=o.useMemo(oa,[]),f=ni(e.id,i),p=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(Ie,{htmlFor:s,className:"w-32 text-body-sm text-ink",children:p}),t.jsx(De,{id:s,readOnly:!0,value:f===null?n("ui.settings.shortcuts.keyboard_shortcuts_section.no_shortcut"):si(f,_),"aria-label":n("ui.settings.shortcuts.keyboard_shortcuts_section.label_press_the_keys_you_want",{label:String(p)}),"data-shortcut-action":e.id,ref:a,className:_e("w-52",f===null?"text-body-sm":"font-mono text-body-sm"),onFocus:()=>c(!0),onBlur:()=>{c(!1),y(null)},onKeyDown:x=>{if(la.has(x.key))return;if(ca.has(x.key)){c(!1),y(null);return}if(da.has(x.key)||x.nativeEvent.isComposing)return;const b=ua({key:x.key,metaKey:x.metaKey,ctrlKey:x.ctrlKey,altKey:x.altKey,shiftKey:x.shiftKey}),M=ai(b,e.id,i,_);if(M!==null){x.preventDefault(),c(!0),y(M);return}if(b===f){c(!0),y(null);return}x.preventDefault(),c(!0),y(null),b===e.defaultChord?l(e.id,null):b!==null&&l(e.id,b)}}),f!==null&&t.jsx(F,{variant:"secondary",size:"sm","aria-label":n("ui.settings.shortcuts.keyboard_shortcuts_section.clear_label_s_shortcut",{label:String(p)}),onClick:()=>{d(e.id),a.current?.focus()},children:n("ui.settings.shortcuts.keyboard_shortcuts_section.clear")}),r!==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(p)}),onClick:()=>{l(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})]})},rc=({sectionRef:e})=>(ne(),t.jsx(ce,{title:n("ui.settings.shortcuts.keyboard_shortcuts_section.keyboard_shortcuts"),icon:gi,description:n("ui.settings.shortcuts.keyboard_shortcuts_section.shortcuts_for_the_panel_rail_focus_a_field_and_press_the_keys_you"),sectionRef:e,children:t.jsx("div",{className:"flex flex-col gap-4",children:ti.map(s=>t.jsx(ic,{action:s},s.id))})})),oc=[[[".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 oc)if(!(s.length<a.length)&&s.slice(-a.length).join("/")===a.join("/"))return i;return null}const vt=e=>n("ui.settings.integrations.integration_model.tool_count",{count:e}),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),Xe=(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)},Ye=(e,s)=>e?.[s]??dc,lt=(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")),St=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 r=Math.round(i/60);return r<24?n("ui.settings.integrations.integration_model.hours_h_ago",{hours:r}):n("ui.settings.integrations.integration_model.days_ago",{days:Math.round(r/24)})}function Tt(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 r=a.replace(/^(?:connection (?:closed|error|refused)|error|closed|failed)\s*:\s*/i,"").trim();if(r===a)break;a=r}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 r=Ye(a,e.name),l=Xe(e.name,s);if(l){if(l.action==="login"||l.action==="reauth")return{label:n("ui.settings.integrations.integration_model.signing_in"),tone:"info",detail:null,busy:!0};if(l.action==="logout")return{label:n("ui.settings.integrations.integration_model.signing_out"),tone:"info",detail:null,busy:!0}}if(!Ss(e.status))return{label:n("ui.settings.integrations.integration_model.status_unavailable"),tone:"neutral",detail:null,busy:!1};const d=lt(e.name,s,r),u=Mt(d)&&e.status!=="connected",c=gn(e,r),g=pn(d)&&e.status!=="connected",y=(d?.action==="login"||d?.action==="reauth")&&d.status==="failed";if(r.disconnectedAt!==null)return{label:n("ui.settings.integrations.integration_model.not_connected"),tone:"neutral",detail:null,busy:!1};switch(e.status){case"connected":return{label:typeof e.tool_count=="number"?n("ui.settings.integrations.integration_model.connected_with_tools",{tools:String(vt(e.tool_count))}):n("ui.settings.integrations.integration_model.connected"),tone:"success",detail:null,busy:!1};case"connecting":return{label:n("ui.settings.integrations.integration_model.connecting"),tone:"info",detail:null,busy:!0};case"needs_sign_in":return{label:e.auth.kind==="api_key"||at(e,s,r)?n("ui.settings.integrations.integration_model.needs_a_key"):n("ui.settings.integrations.integration_model.needs_sign_in"),tone:"warning",detail:Tt(e.status_reason),busy:!1};case"error":return{label:n("ui.settings.integrations.integration_model.couldn_t_start"),tone:"danger",detail:Tt(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(at(e,s,r))return{label:n("ui.settings.integrations.integration_model.needs_a_key"),tone:"warning",detail:null,busy:!1};if(y)return{label:n("ui.settings.integrations.integration_model.sign_in_didn_t_finish"),tone:"warning",detail:null,busy:!1};if(r.needsSignIn)return{label:e.auth.kind==="api_key"||at(e,s,r)?n("ui.settings.integrations.integration_model.needs_a_key"):n("ui.settings.integrations.integration_model.needs_sign_in"),tone:"warning",detail:Tt(e.status_reason),busy:!1};if(e.status_basis==="stored"&&c&&r.disconnectedAt===null){const _=r.connectedAt??Ms(e.last_seen_at,i);return{label:_!==null?n("ui.settings.integrations.integration_model.worked_when_with_tools",{when:String(fc(i,_)),tools:String(vt(e.tool_count))}):n("ui.settings.integrations.integration_model.worked_earlier_with_tools",{tools:String(vt(e.tool_count))}),tone:"success",detail:null,busy:!1}}return e.status_basis==="live"?{label:n("ui.settings.integrations.integration_model.not_connected"),tone:"neutral",detail:null,busy:!1}:{label:n("ui.settings.integrations.integration_model.ready"),tone:"neutral",detail:null,busy:!1}}}const 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(vt(e.tool_count))})),s&&a.push(e.scope==="project"?n("ui.settings.integrations.integration_model.this_project"):n("ui.settings.integrations.integration_model.global"));const i=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=Ye(a,e.name),r=Xe(e.name,s);if(r)return r.action==="login"||r.action==="reauth"?{kind:"sign_in",label:n("ui.settings.integrations.integration_model.continue_sign_in")}:null;const l=y=>e.actions.includes(y),d=St(e),u=at(e,s,i);if(!Ss(e.status))return l("test")?{kind:"test",label:n("ui.settings.integrations.integration_model.check_again")}:null;const c=lt(e.name,s,i),g=c?.status==="failed"&&ct(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")}:l("sign_in")?{kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")}:d?{kind:"set_key",label:n("ui.settings.integrations.integration_model.add_key")}:l("reauth")?{kind:"reauth",label:n("ui.settings.integrations.integration_model.sign_in_again")}:{kind:"fix",label:n("ui.settings.integrations.integration_model.fix")};case"error":return l("connect")?{kind:"connect",label:n("ui.settings.integrations.integration_model.reconnect")}:l("test")?{kind:"test",label:n("ui.settings.integrations.integration_model.retry")}:{kind:"fix",label:n("ui.settings.integrations.integration_model.fix")};default:{if(Mt(c)&&l("sign_in"))return{kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")};if(pn(c)&&l("sign_out"))return{kind:"sign_out",label:n("ui.settings.integrations.integration_model.sign_out_again")};if(i.disconnectedAt!==null&&l("connect"))return{kind:"connect",label:n("ui.settings.integrations.integration_model.connect")};if(i.needsSignIn){if(u&&d)return{kind:"set_key",label:n("ui.settings.integrations.integration_model.add_key")};if(l("sign_in"))return{kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")}}return u&&d?{kind:"set_key",label:n("ui.settings.integrations.integration_model.add_key")}:g&&l("sign_in")?{kind:"sign_in",label:n("ui.settings.integrations.integration_model.try_again")}:gn(e,i)&&!l("connect")?null:l("connect")?{kind:"connect",label:n("ui.settings.integrations.integration_model.connect"),...i.connectedAt===null&&e.status_basis!=="live"?{variant:"ghost"}:{}}:l("test")&&e.tool_count===null&&e.tool_count_basis===null?{kind:"test",label:n("ui.settings.integrations.integration_model.test"),variant:"ghost"}:null}}}const ct=e=>e.action==="login"||e.action==="reauth",Mt=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 at(e,s,a){if(!St(e))return!1;const i=lt(e.name,s,a);return i&&ct(i)&&i.status==="failed"&&Es.test(i.message??"")?!0:a.needsKey}function Nc(e,s=[],a){const i=_n(e,s,a)?.kind,r=mn(e,Ye(a,e.name)),l=c=>e.actions.includes(c),d=[],u=Xe(e.name,s);if(u&&d.push({kind:"cancel",label:n("ui.settings.integrations.integration_model.cancel")}),!u&&l("test")&&i!=="test"&&d.push({kind:"test",label:n("ui.settings.integrations.integration_model.test_connection")}),l("connect")&&i!=="connect"&&r!=="connected"&&d.push({kind:"connect",label:n("ui.settings.integrations.integration_model.reconnect")}),!u&&l("sign_in")&&i!=="sign_in"&&r!=="connected"&&d.push({kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")}),l("reload")&&d.push({kind:"reload",label:n("ui.settings.integrations.integration_model.reload")}),!u&&l("reauth")&&i!=="reauth"&&d.push({kind:"reauth",label:n("ui.settings.integrations.integration_model.sign_in_again")}),St(e)&&i!=="set_key"&&d.push({kind:"set_key",label:e.auth.secret_refs.length>0?n("ui.settings.integrations.integration_model.update_key"):n("ui.settings.integrations.integration_model.add_key")}),l("sign_out")&&d.push({kind:"sign_out",label:n("ui.settings.integrations.integration_model.sign_out")}),l("disconnect")&&r==="connected"&&d.push({kind:"disconnect",label:n("ui.settings.integrations.integration_model.disconnect")}),l("copy_setup")&&e.setup_prompt&&d.push({kind:"copy_setup",label:n("ui.settings.integrations.integration_model.copy_setup_prompt")}),i!=="fix"&&d.push({kind:"open_config",label:n("ui.settings.integrations.integration_model.open_config_file")}),l("remove"))d.push({kind:"remove",label:n("ui.settings.integrations.integration_model.remove"),destructive:!0});else if(!e.source.editable){const c=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=Ye(a,e.name),r=Xe(e.name,s),l=mn(e,i);if(r&&i.pinnedGroup&&i.pinnedOperationId===r.id)return i.pinnedGroup;if(l==="needs_sign_in"||l==="error")return"attention";const d=lt(e.name,s,i);return Mt(d)&&l!=="connected"||pn(d)&&l!=="connected"?"attention":i.disconnectedAt!==null?"ready":at(e,s,i)||i.needsSignIn&&l!=="connected"||d?.status==="failed"&&ct(d)&&l!=="connected"?"attention":l==="connected"||e.status_basis==="stored"&&gn(e,i)?"connected":r&&r.action!=="test"?"attention":"ready"}function Mc(e,s=[],a){return["attention","connected","ready"].map(r=>({id:r,title:Sc[r],rows:e.filter(l=>Is(l,s,a)===r)})).filter(r=>r.rows.length>0)}function Cc(e,s,a=Date.now()){if(!s)return e??{};const i={};for(const r of s.servers){const l=Ye(e,r.name),d=Xe(r.name,s.operations),u=lt(r.name,s.operations,l),c=Mt(u),g=r.status==="connected"&&(r.status_basis==="probe"||r.status_basis==="live"),y=l.holdUntil!==null&&a<l.holdUntil,_=!y&&!c&&l.connectedAt===null&&r.status_basis==="stored"&&r.tool_count_basis==="last_seen"?Ms(r.last_seen_at,a):null,f=!c,p=u?.status==="failed"&&ct(u)&&Es.test(u.message??""),x={connectedAt:g&&!y?a:_!==null?_:f?l.connectedAt:null,connectedToolCount:g&&!y||_!==null?r.tool_count??l.connectedToolCount:f?l.connectedToolCount:null,settledGroup:l.settledGroup,pinnedGroup:d&&l.pinnedOperationId===d.id?l.pinnedGroup:d?l.settledGroup:null,pinnedOperationId:d?d.id:null,needsKey:g?!1:l.needsKey||p,needsSignIn:g||c?!1:l.needsSignIn||r.status==="needs_sign_in",disconnectedAt:g&&!y?null:l.disconnectedAt,holdUntil:y?l.holdUntil:null,lastDecisive:u?_c(u):null};d||(x.settledGroup=Is(r,s.operations,{...i,[r.name]:x})),i[r.name]=x}return i}const Ac=(e,s)=>e!==null&&s===e,Qt="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 r=e[i.name];r&&(a[Rs(i.source.path,i.name)]=r)}return a}function Ic(e,s,a){if(!s)return e;let i=null;for(const r of s.servers){if(Object.prototype.hasOwnProperty.call(e,r.name))continue;const l=Lc(a[Rs(r.source.path,r.name)]);l&&(i=i??{...e},i[r.name]=l)}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,Lt=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=Lt(e.connectedAt),a=Lt(e.disconnectedAt),i=e.needsKey===!0,r=e.needsSignIn===!0,l=Tc(e.lastDecisive);return s===null&&a===null&&!i&&!r&&!l?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:r,disconnectedAt:a,holdUntil:Lt(e.holdUntil),lastDecisive:l}}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(r=>{const l=r.transport==="http",d=r.secret_refs??[],u=r.status==="connected"?"connected":r.status==="connecting"?"connecting":r.status==="auth-required"?"needs_sign_in":"not_started",c=[];u!=="connected"&&c.push("connect"),u==="connected"&&c.push("disconnect"),a||c.push("reload"),l&&r.transport_oauth_supported!==!1&&c.push("sign_in"),d.length>0&&c.push("set_key"),r.owned_scope&&c.push("remove"),r.setup?.text&&c.push("copy_setup");const g=Ns(r.source);return{id:r.name,name:r.name,scope:r.owned_scope??"global",project_cwd:null,source:{kind:Kc(r.source,g,r.owned_scope),path:r.source??"",editable:r.owned_scope!==null,owned_scope:r.owned_scope},transport:l?"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":l?"unknown":"none",signed_in:null,secret_refs:d.map(y=>({id:y.id,state:"missing"}))},tool_count:typeof r.tool_count=="number"?r.tool_count:null,tool_count_basis:typeof r.tool_count=="number"?"live":null,actions:c,setup_prompt:r.setup?.text??null}});return{cwd:"",project_scope_available:i.some(r=>r.source.owned_scope==="project"),global_path:"",project_path:null,status_source:a?"config":"live",session_id:s,servers:i,operations:(e?.operations??[]).map(r=>({...r}))}}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:r,initial:l})=>{ne();const[d,u]=o.useState(l?.name??""),[c,g]=o.useState(l?.mode??"command"),[y,_]=o.useState(l?.command??""),[f,p]=o.useState(l?.args??""),[x,b]=o.useState(l?.url??""),[M,z]=o.useState("global"),[N,E]=o.useState(l?.touched?{name:!0,command:!0,url:!0}:{}),[v,k]=o.useState(!!l?.touched),[w,G]=o.useState(!1),[T,$]=o.useState(null),R=o.useRef(null),J=o.useRef(null),K=o.useRef(null);o.useEffect(()=>{R.current?.focus()},[]);const q=zc(d,e),V=c==="command"&&!y.trim()?n("ui.settings.integrations.add_integration_form.enter_the_command_to_run"):null,Y=c==="url"?$c(x):null,H=C=>v||N[C],te=async C=>{if(C.preventDefault(),k(!0),q||V||Y){q?R.current?.focus():V?J.current?.focus():K.current?.focus();return}G(!0),$(null);const W=s?M:"global",Q=c==="command"?{name:d.trim(),scope:W,mode:c,command:y.trim(),args:Pc(f)}:{name:d.trim(),scope:W,mode:c,url:x.trim()},X=await i(Q);G(!1),$(X)},m=(C,W,Q)=>W&&H(Q)?t.jsx("p",{id:C,className:"text-body-sm text-danger",children:W}):null,I=C=>C.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:C=>void te(C),onKeyDown:C=>{C.key==="Escape"&&(C.stopPropagation(),r())},children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Ie,{htmlFor:"integration-add-name",children:n("ui.settings.integrations.add_integration_form.name")}),t.jsx(De,{ref:R,id:"integration-add-name",value:d,placeholder:n("ui.settings.integrations.add_integration_form.e_g_notion"),autoComplete:"off","aria-invalid":!!(q&&H("name")),"aria-describedby":q&&H("name")?"integration-add-name-error":void 0,onChange:C=>u(C.target.value),onBlur:()=>E(C=>({...C,name:!0}))}),m("integration-add-name-error",q,"name")]}),t.jsxs(kt,{value:c,onValueChange:C=>g(C==="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(jt,{"aria-labelledby":"integration-add-transport-label",children:[t.jsx(Qe,{value:"command","data-integration-transport":"command",children:n("ui.settings.integrations.add_integration_form.local_command")}),t.jsx(Qe,{value:"url","data-integration-transport":"url",children:n("ui.settings.integrations.add_integration_form.remote_url")})]}),t.jsx("p",{className:"text-ink-dim text-meta",children:n(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(Ie,{htmlFor:"integration-add-command",children:n("ui.settings.integrations.add_integration_form.command")}),t.jsx(De,{ref:J,id:"integration-add-command",value:y,placeholder:n("ui.settings.integrations.add_integration_form.e_g_npx"),autoComplete:"off",className:"font-mono","aria-invalid":!!(V&&H("command")),"aria-describedby":V&&H("command")?"integration-add-command-error":void 0,onChange:C=>_(C.target.value),onBlur:()=>E(C=>({...C,command:!0}))}),m("integration-add-command-error",V,"command")]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs(Ie,{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:f,rows:2,className:"font-mono",onChange:C=>p(C.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(Ie,{htmlFor:"integration-add-url",children:n("ui.settings.integrations.add_integration_form.url")}),t.jsx(De,{ref:K,id:"integration-add-url",type:"url",value:x,placeholder:n("ui.settings.integrations.add_integration_form.https_mcp_example_com_mcp"),autoComplete:"off",className:"font-mono","aria-invalid":!!(Y&&H("url")),"aria-describedby":Y&&H("url")?"integration-add-url-error":"integration-add-url-help",onChange:C=>b(C.target.value),onBlur:()=>E(C=>({...C,url:!0}))}),m("integration-add-url-error",Y,"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(kt,{value:M,onValueChange:C=>z(C==="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(jt,{"aria-labelledby":"integration-add-scope-label",children:[t.jsx(Qe,{value:"global","data-integration-scope":"global",children:n("ui.settings.integrations.add_integration_form.all_chats")}),t.jsx(Qe,{value:"project","data-integration-scope":"project",children:n("ui.settings.integrations.add_integration_form.this_project")})]}),a?t.jsx("p",{className:"text-ink-dim text-meta",children:M==="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:I,onClick:r,children:n("ui.settings.integrations.add_integration_form.cancel")}),t.jsxs(F,{type:"submit",variant:"primary",size:"md",disabled:w,onMouseDown:I,children:[w?t.jsx(ve,{size:"xs"}):null,n("ui.settings.integrations.add_integration_form.add_integration")]})]})]})]})},qc=4;function Gc(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>=qc?"drop":e.hold.landedOn.isConnected&&(!e.candidate||e.candidate===e.hold.landedOn)?"settled":e.active&&e.active!==e.body&&e.active!==e.hold.landedOn?"drop":e.candidate?.isConnected?"restore":"drop"}function Wc(e){const s=Gc({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 r=Yc({hold:{until:s,reanchors:e.hold.reanchors,landedOn:a},candidate:i,active:e.active,body:e.body,now:e.now});if(r==="settled")return{hold:{until:s,reanchors:e.hold.reanchors,landedOn:a},land:null};if(r==="drop")return{hold:null,land:null};const l=!a.isConnected;return{hold:{until:l?e.now+e.windowMs:s,reanchors:l?e.hold.reanchors+1:e.hold.reanchors,landedOn:i},land:i}}function Qc(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:r,values:l,replace:d,canReplace:u}=e;if(a){const c=Jt(s,i);return{values:{[c]:(l[Os]??"").trim()},confirmedReplace:d&&u?[c]:[],header:i.trim()}}return{values:Object.fromEntries(r.map(c=>[c,(l[c]??"").trim()])),confirmedReplace:d&&u?r:[],header:void 0}}function Jt(e,s){const a=Bn(e),i=Bn(s);if(!i)return"";const r=[a,i].filter(Boolean).join("_"),l=/^[A-Za-z_]/.test(r)?r:`K_${r}`;if(l.length<=Ot)return l;const d=ed(a),u=Ot-i.length-d.length-2,c=[a.slice(0,Math.max(u,0)),d,i].filter(Boolean).join("_");return c.length<=Ot?c:c.slice(-128)}const Ot=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:r,failure:l,onSave:d,onClose:u})=>{ne();const[c,g]=o.useState({}),[y,_]=o.useState(!1),[f,p]=o.useState(""),x=a?[Jt(e,f)]:[...s],b=a?[Os]:x,M=(a?Jt(e,f).length>0:!0)&&b.every(N=>(c[N]??"").trim()),z=x.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:!M||r,onClick:()=>{const N=Xc({name:e,keyless:a,freeName:f,names:x,values:c,replace:y,canReplace:z});d(N.values,N.confirmedReplace,N.header)},children:r?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(Ie,{htmlFor:"integration-key-name",children:n("ui.settings.integrations.integration_key_dialog.the_header_this_server_wants_the_key_in")}),t.jsx(De,{id:"integration-key-name",autoComplete:"off",placeholder:n("ui.settings.integrations.integration_key_dialog.e_g_authorization_or_x_api_key"),value:f,onChange:N=>p(N.target.value)}),t.jsx("p",{className:"-mx-1.5 text-ink-dim text-meta",children:n("ui.settings.integrations.integration_key_dialog.this_server_declares_no_key_of_its_own_so_local_operator_adds_one")})]}):null,b.filter(N=>a!==!0||N.trim().length>0).map(N=>t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Ie,{htmlFor:`integration-key-${N}`,className:"font-mono",children:a?"Key":N}),t.jsx(De,{id:`integration-key-${N}`,type:"password",autoComplete:"off",value:c[N]??"",onChange:E=>g(v=>({...v,[N]:E.target.value}))})]},N)),z?t.jsxs("div",{className:"flex items-center gap-2 text-body-sm",children:[t.jsx(qt,{id:"integration-key-replace",checked:y,onCheckedChange:N=>_(N===!0)}),t.jsx(Ie,{htmlFor:"integration-key-replace",className:"font-normal",children:Cs(x.length)})]}):null,l?t.jsx("p",{className:"-mx-1.5 text-body-sm text-danger",role:"alert",children:l}):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:r,highlighted:l=!1,rowRef:d,primaryRef:u,overflowRef:c,pending:g,failure:y,confirm:_,onPrimary:f,onOverflow:p,onConfirm:x,onCancelConfirm:b})=>{ne();const M=xc(e,s,a,i),z=l&&M.tone==="danger"?"text-ink":sd[M.tone],N=_n(e,s,a),E=Nc(e,s,a),v=wc(e,r),k=E.findIndex(w=>w.kind==="remove"||w.kind==="remove_elsewhere");return t.jsxs("li",{ref:d,"data-integration":e.name,"data-status":e.status,className:_e("flex min-h-14 flex-col justify-center gap-1 px-4 py-2.5",l&&"bg-row-selected"),onKeyDown:w=>{!_||w.key!=="Escape"||(w.stopPropagation(),b())},children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center",children:M.busy?t.jsx(ve,{size:"xs"}):t.jsx("span",{"aria-hidden":"true","data-tone":M.tone,className:_e("size-2 rounded-full",nd[M.tone])})}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[t.jsx("span",{className:"truncate font-medium text-body text-ink",title:e.name,children:e.name}),t.jsx("span",{className:"truncate text-ink-dim text-meta",children:v.map((w,G)=>t.jsxs("span",{children:[G>0?" · ":null,w.startsWith("Imported from")&&e.source.path?t.jsx(Je,{content:_a(e.source.path),children:t.jsx("span",{className:"underline decoration-dotted underline-offset-2",children:w})}):w]},w))})]}),Vn(M.label)?t.jsx(Je,{content:Vn(M.label),children:t.jsx("span",{className:_e("shrink-0 text-body-sm",z),children:M.label})}):t.jsx("span",{className:_e("shrink-0 text-body-sm",z),children:M.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:()=>f(N),children:[g?t.jsx(ve,{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((w,G)=>t.jsx(id,{item:w,separated:G===k&&G>0,onSelect:()=>p(w)},w.kind))})]})]}),M.detail?t.jsx("p",{className:_e("pl-7 text-body-sm",M.tone==="danger"?"text-ink-muted":"text-ink-dim"),children:M.detail}):null,y?t.jsx("p",{className:_e("pl-7 text-body-sm",l?"text-ink":"text-danger"),role:"alert",children:y}):null,_?t.jsxs("div",{className:"flex flex-wrap items-center gap-2 pl-7",children:[t.jsx("span",{className:"text-body-sm text-ink",children:_.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:_.kind==="remove"?n("ui.settings.integrations.integration_row.agents_in_every_chat_lose_access_to_name",{name:String(e.name)}):e.auth.kind==="oauth"?n("ui.settings.integrations.integration_row.the_saved_sign_in_is_removed_too"):n("ui.settings.integrations.integration_row.its_saved_credential_is_removed_too")}),t.jsx(F,{variant:"danger",size:"sm",onClick:x,"data-integration-confirm":_.kind,children:_.kind==="remove"?n("ui.settings.integrations.integration_row.remove"):n("ui.settings.integrations.integration_row.sign_out")}),t.jsx(F,{variant:"ghost",size:"sm",onClick:b,children:n("ui.settings.integrations.integration_row.keep")})]}):null]})},id=({item:e,separated:s,onSelect:a})=>(ne(),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 rd(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:od(s.message??null,a)}}function od(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:r,onCancel:l,onOpenLink:d,onClose:u})=>{ne();const c=i.kind==="running"?i.operation:null,g=i.kind==="running"?rd(e,c,a):null,y=i.kind==="starting"||i.kind==="running"&&g?.tone==="progress",_=g&&g.tone!=="progress",f=o.useRef(null),p=o.useRef(!1),x=ld(i,g);o.useEffect(()=>{if(!p.current){p.current=!0;return}x&&f.current?.focus()},[x]);const b=()=>u(g?.tone==="success"?"signed-in":"dismissed");return t.jsx(ns,{open:!0,onClose:b,maxWidth:"xs",fullWidth:!0,title:n("ui.settings.integrations.integration_sign_in_dialog.sign_in_to_name",{name:String(e)}),dialogProps:{onOpenAutoFocus:M=>{M.preventDefault(),f.current?.focus()}},actions:t.jsxs(t.Fragment,{children:[y&&c?t.jsx(Kt,{ref:f,onClick:()=>l(c.id),children:n("ui.settings.integrations.integration_sign_in_dialog.cancel_sign_in")}):t.jsx(Kt,{ref:i.kind==="ready"?void 0:f,onClick:b,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:f,onClick:r,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"?f:void 0,onClick:r,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(ve,{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:_?"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(ve,{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]:[\\/]/,bt=e=>{const s=e?.trim();return s&&(s.startsWith("/")||ud.test(s))?s:null};function gd(e){const r=e?.payload?.frontend?.snapshot?.cwd;return typeof r=="string"&&r.trim()?r:null}const rt="local-operator.settings.integrations.last-cwd";function md(e,s,a=typeof localStorage>"u"?null:localStorage){const i=bt(s);if(!(!e||!i||!a))try{const r=a.getItem(rt),l=r?JSON.parse(r):{};if(l[e]===i)return;a.setItem(rt,JSON.stringify({...l,[e]:i}))}catch{}}const Fs=()=>typeof localStorage>"u"?null:localStorage;function Ds(e=Fs()){if(!e)return{};try{const s=e.getItem(Qt);if(!s)return{};const a=JSON.parse(s);return!a||typeof a!="object"||Array.isArray(a)?{}:a}catch{return{}}}const Hn=256;function _d(e,s=Fs()){if(s)try{const a={...Ds(s),...e},i=Object.keys(a);if(i.length>Hn){const r={};for(const l of i.slice(-Hn))r[l]=a[l];s.setItem(Qt,JSON.stringify(r));return}s.setItem(Qt,JSON.stringify(a))}catch{}}function qn(e,s,a){if(e==="saved")return null;if(e==="replace_confirmation_required"){const r=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(r)})}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(rt);if(!a)return;const i=JSON.parse(a);if(!(e in i))return;const r={...i};delete r[e],s.setItem(rt,JSON.stringify(r))}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(rt);if(!a)return null;const r=JSON.parse(a)[e];return typeof r=="string"?r: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"),r=a?"catalog":i?"session":null,[l,d]=o.useState(null),u=en(),c=st(S=>S.sessions),g=st(S=>S.fetchSessions),y=st(S=>S.loading),_=o.useMemo(()=>c.find(S=>S.session_id===e)??null,[c,e]),f=o.useMemo(()=>r==="session"&&!e?dd(c):null,[r,e,c]),p=r==="session"?e??f?.session_id??null:null;o.useEffect(()=>{r!=="session"||e||c.length>0||g(ha)},[r,e,c.length,g]);const x=r==="catalog"?bt(_?.cwd):null,b=r==="catalog"&&!!e&&x===null,M=Re({queryKey:["desktop","session-cwd",e??""],queryFn:()=>pe({op:"sessions.get",sessionId:e??""}),enabled:b,staleTime:Number.POSITIVE_INFINITY,retry:!1}),z=b&&!M.isFetched,N=x??bt(gd(M.data))??(M.isFetched?bt(xd(e)):null),E=fd(N,l),v=r==="catalog"?E:null,k=r==="catalog"?e??null:null,w=fa.catalog(v,k);o.useEffect(()=>{r!=="catalog"||!e||!v||md(e,v)},[r,e,v]);const G=o.useRef(0),[T,$]=o.useState(0),R=o.useRef(null),J=o.useCallback((S,U)=>{const L=Date.now()+$n;G.current=L,R.current={name:S,expect:U},$(L)},[]),K=o.useCallback(S=>Date.now()<G.current?Ls:Oc(S),[]),q=Re({queryKey:w,queryFn:()=>va(v,k),enabled:r==="catalog"&&!z,staleTime:1e4,refetchInterval:S=>K(S.state.data)}),V=hd(q.error);o.useEffect(()=>{!V||!N||l===N||(d(N),pd(e))},[V,N,l,e]);const Y=Re({queryKey:Vt.list(p??""),queryFn:()=>ba(p??""),enabled:r==="session"&&!!p,staleTime:1e4,refetchInterval:S=>K(S.state.data?Zt(S.state.data,p??""):void 0)}),H=o.useMemo(()=>{if(r==="catalog")return q.data;if(r==="session"&&Y.data&&p)return Zt(Y.data,p)},[r,q.data,Y.data,p]),te=o.useCallback(()=>jd({queryClient:u,route:r,catalogKey:w,sessionId:p}),[r,w,u,p]);o.useEffect(()=>{if(!T)return;const S=R.current;if(!S)return;const U=H?.servers.find(se=>se.name===S.name);!U||!(S.expect==="connected"?U.status==="connected":U.status_basis==="live"&&U.status!=="connected")||(G.current=0,R.current=null,$(0))},[H,T]);const m=o.useRef({}),[I,C]=o.useState(0),W=o.useMemo(()=>(m.current=Cc(Ic(m.current,H,Ds()),H),m.current),[H,I]),Q=o.useRef("");o.useEffect(()=>{const S=Ec(W,H);if(!Object.keys(S).length)return;const U=JSON.stringify(S);U!==Q.current&&(Q.current=U,_d(S))},[W,H]);const X=o.useCallback(S=>{const U=Ye(m.current,S);U.needsKey||(m.current={...m.current,[S]:{...U,needsKey:!0}},C(L=>L+1))},[]),P=o.useCallback(S=>{if(S.action!=="disconnect"&&S.action!=="connect"&&S.action!=="reload")return;const U=Ye(m.current,S.name),L=Date.now()+$n,se=S.action==="disconnect"?{...U,connectedAt:null,disconnectedAt:Date.now(),holdUntil:L}:{...U,disconnectedAt:null,holdUntil:L};m.current={...m.current,[S.name]:se},J(S.name,yd(S)),C(re=>re+1)},[J]),ie=o.useCallback(async S=>{if(r==="catalog"){const U=vd(S);if(!U)return null;try{const L=await xa(v,U);return u.setQueryData(w,L),P(S),L.operation?.id??null}catch(L){throw L instanceof an&&L.status===409&&u.invalidateQueries({queryKey:w}),L}}if(r==="session"&&p){const U=await pe({op:"mcp.control",sessionId:p,control:bd(S)});P(S);const L=Vt.list(p),se=U?.data;return se&&"servers"in se&&Array.isArray(se.servers)?(u.setQueryData(L,se),null):(u.invalidateQueries({queryKey:L}),se&&"id"in se&&typeof se.id=="string"?se.id:null)}return null},[r,v,w,u,p,P]),de=o.useCallback(async S=>{if(r==="catalog"&&k&&(S.action==="connect"||S.action==="disconnect"||S.action==="reload")){try{await pe({op:"mcp.control",sessionId:k,control:{action:S.action,name:S.name,...S.action==="disconnect"?{confirmed:!0}:{}}})}catch(U){throw u.invalidateQueries({queryKey:w}),U}return P(S),await u.invalidateQueries({queryKey:w}),null}return ie(S)},[r,k,u,w,ie,P]),Se=o.useCallback(async(S,U,L,se)=>{if(r==="catalog"){const re=await ya(v,S,U,L,se);if(re.catalog&&u.setQueryData(w,re.catalog),re.code!=="saved")return{saved:!1,message:qn(re.code,re.failed_ids,U)};try{await ie({action:"test",name:S})}catch{}return{saved:!0,message:null}}if(r==="session"&&p){const re=await pe({op:"mcp.credentials.store",sessionId:p,name:S,values:U,confirmedReplace:L});if(re.data?.code!=="saved")return{saved:!1,message:qn(re.data?.code,re.data?.failed_ids??[],U)};try{await ie({action:"connect",name:S})}catch{}return{saved:!0,message:null}}return{saved:!1,message:null}},[r,v,w,u,ie,p]),je=r==="catalog"?q:Y,he=o.useCallback(()=>{je.refetch()},[je]);return{enabled:r!==null,route:r,sessionId:r==="catalog"?k:p,borrowed:f,noConversation:r==="session"&&!p&&!y,document:H,isLoading:s.isLoading||r==="catalog"&&(z||q.isLoading)||r==="session"&&(p?Y.isLoading:y),isError:je.isError,folderUnavailable:Ac(l,N),refetch:he,readDocument:te,control:de,storeKeys:Se,memories:W,markNeedsKey:X}}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,Ft="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})=>{ne();const i=kd({sessionId:e}),{document:r,control:l,readDocument:d}=i,u=ka(),c=r?.servers??[],g=r?.operations??[],y=r?.project_scope_available??!1,[_,f]=o.useState(!1),[p,x]=o.useState(""),[b,M]=o.useState(null),[z,N]=o.useState({}),[E,v]=o.useState(null),[k,w]=o.useState(null),[G,T]=o.useState({kind:"ready"}),[$,R]=o.useState(null),[J,K]=o.useState(null),[q,V]=o.useState(!1),Y=o.useRef({}),H=o.useRef({}),te=o.useRef({}),m=o.useRef(0),I=o.useRef(null),C=o.useRef(null),W=o.useRef(null),[Q,X]=o.useState(null),[P,ie]=o.useState(null),[de,Se]=o.useState(null),je=o.useCallback(()=>{const h=W.current;W.current=null,w(null),R(null),window.setTimeout(()=>{h?.isConnected&&h.focus()},0)},[]),he=o.useCallback(h=>{const j=window.document.activeElement;W.current=j instanceof HTMLElement?j:null,w(h)},[]),S=o.useCallback((h,j)=>{ie({name:h,waitForSignIn:j==="signed-in",until:Date.now()+nt,reanchors:0}),je()},[je]),U=o.useMemo(()=>wd(a,c.map(h=>h.name)),[a,c]),L=U?.kind==="matched"?U.name:null,se=o.useRef(null),re=o.useRef(null),Be=p.trim().toLowerCase(),xe=o.useMemo(()=>Be?c.filter(h=>h.name.toLowerCase().includes(Be)):c,[c,Be]),Me=Mc(xe,g,i.memories),Te=k?.kind==="sign_in"?c.find(h=>h.name===k.name)??null:null;o.useEffect(()=>{!L||re.current===L||!p||x("")},[L,p]),o.useEffect(()=>{!L||re.current===L||xe.some(h=>h.name===L)&&(re.current=L,se.current?.scrollIntoView({block:"center",behavior:"smooth"}))},[L,xe]),o.useEffect(()=>{if(!$)return;const h=g.find(j=>j.id===$)??null;T({kind:"running",operation:h})},[g,$]);const Ve=g.some(h=>h.status==="running"),B=h=>{const j=window.document.activeElement;j&&j!==window.document.body&&j.isConnected||ie({name:h,waitForSignIn:!1,until:Date.now()+nt,reanchors:0})},ee=async(h,j,O)=>{M(h),N(({[h]:$e,...Ae})=>Ae);let Z=null,ke=!1;try{Z=await O()}catch($e){ke=!0,N(Ae=>({...Ae,[h]:_t(Md[j]??"status",$e,Ve)}))}finally{M(null),j!=="sign_out"&&(j!=="remove"||ke)&&B(h)}return{operationId:Z,failed:ke}},ge=h=>c.find(j=>j.name===h),ue=h=>{h.source.path&&Na(h.source.path)},D=async(h,j)=>{T({kind:"starting"}),R(null);try{const O=await l({action:j,name:h});O?R(O):T({kind:"running",operation:null})}catch(O){O instanceof an&&O.code==="oauth_unsupported"&&i.markNeedsKey(h),T({kind:"refused",message:_t("grant",O,Ve)})}},oe=(h,j)=>{switch(j.kind){case"sign_in":case"reauth":{const O=g.find(Z=>Z.name===h.name&&Z.status==="running");O&&ct(O)?(T({kind:"running",operation:O}),R(O.id)):(T({kind:"ready"}),R(null)),he({kind:"sign_in",name:h.name,action:j.kind==="reauth"?"reauth":"login"});return}case"set_key":K(null),he({kind:"key",name:h.name,keyNames:h.auth.secret_refs.map(O=>O.id)});return;case"fix":ue(h);return;case"sign_out":v({name:h.name,kind:"sign_out"});return;default:{const O=j.kind;ee(h.name,O,()=>l({action:O,name:h.name}))}}},le=(h,j)=>{switch(j.kind){case"remove":case"sign_out":v({name:h.name,kind:j.kind});return;case"sign_in":case"reauth":case"set_key":oe(h,{kind:j.kind,label:j.label});return;case"open_config":ue(h);return;case"copy_setup":navigator.clipboard.writeText(h.setup_prompt??"").then(()=>Bt(n("ui.settings.integrations.mcp_management_section.setup_steps_copied_paste_them_into_a_chat"))).catch(()=>{});return;case"cancel":{const O=g.find(Z=>Z.name===h.name&&Z.status==="running");O&&ee(h.name,"cancel",()=>l({action:"cancel",operationId:O.id}));return}case"test":case"connect":case"disconnect":case"reload":{const O=j.kind;ee(h.name,O,()=>l({action:O,name:h.name}));return}default:return}},be=(h,j)=>{if(v(null),j==="remove"){const O=h.source.owned_scope;if(!O)return;const Z=xe.findIndex(ke=>ke.name===h.name);ee(h.name,"remove",()=>l({action:"remove",name:h.name,scope:O})).then(({operationId:ke,failed:$e})=>{$e||ke!==null||(Bt(n("ui.settings.integrations.mcp_management_section.removed_name",{name:String(h.name)})),Z>=0&&Se({index:Z}))});return}ee(h.name,"sign_out",()=>l({action:"logout",name:h.name})).then(()=>{ie({name:h.name,waitForSignIn:!1,until:Date.now()+nt,reanchors:0})})},Le=async h=>{try{return await l({action:"add",name:h.name,scope:h.scope,...h.mode==="command"?{command:h.command,args:h.args}:{url:h.url}}),f(!1),X(h.name),null}catch(j){return _t("add",j,!1)}},fe=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(Ft)}),t.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:n(Sd)})]}),i.enabled&&c.length>0&&!_?t.jsxs(F,{ref:I,variant:"secondary",size:"sm",onClick:()=>f(!0),"data-tour-tag":"mcp-add-server",children:[t.jsx(kn,{"aria-hidden":"true"}),n("ui.settings.integrations.mcp_management_section.add_integration")]}):null]});if(!i.enabled&&!i.isLoading)return t.jsx(ce,{title:n(Ft),titleComponent:fe,sectionRef:s,children:t.jsx(ae,{variant:"warning",children:n("ui.settings.integrations.mcp_management_section.integrations_need_a_newer_local_operator_backend_update_it_and_re")})});const ze=t.jsx(Hc,{existingNames:c.map(h=>h.name),projectScopeAvailable:y,projectLabel:r?.cwd?Ed(r.cwd):null,onSubmit:Le,onCancel:()=>{f(!1),window.setTimeout(()=>I.current?.focus(),0)}}),we=k?ge(k.name):void 0,He=Object.entries(z).filter(([h])=>!c.some(j=>j.name===h)),Ce=h=>N(({[h]:j,...O})=>O);o.useEffect(()=>{if(!Q)return;const h=Y.current[Q];if(!h){c.some(j=>j.name===Q)&&(H.current[Q]?.focus(),X(null));return}h.focus(),X(null)},[Q,c]),o.useEffect(()=>{if(!de)return;const j=xe[Math.min(de.index,xe.length-1)]??xe.at(-1);if(j){const O=Y.current[j.name]??H.current[j.name];if(!O)return;O.focus()}else I.current?.focus();Se(null)},[de,xe]);const Ne=o.useCallback((h,j)=>{const O=d()??r,Z=O?.servers.find(Ps=>Ps.name===h.name),ke=O?.operations??[],$e=Z?Z.status==="connecting"||Xe(Z.name,ke)!==null:!1;$e&&Z&&(m.current=j);const Ae=Z?_n(Z,ke,i.memories):null;if(Z&&h.waitForSignIn&&(Ae?.kind==="sign_in"||Ae?.kind==="reauth"))return"kept";const Oe=Wc({hold:h,now:j,windowMs:nt,rowMoving:$e,lastMovingAt:m.current,candidate:Z?Zc({primary:Ae?Y.current[Z.name]:null,overflow:H.current[Z.name]}):void 0,active:window.document.activeElement,body:window.document.body});if(!Oe.hold)return ie(null),"finished";if(!Oe.land)return"kept";ie({name:h.name,waitForSignIn:!1,until:Oe.hold.until,landedOn:Oe.land,reanchors:Oe.hold.reanchors});const fn=Oe.land;return window.setTimeout(()=>{fn.isConnected&&fn.focus()},0),"landed"},[d,r,i.memories]);return o.useEffect(()=>{if(!P)return;Ne(P,Date.now());let h=0,j=!1;const O=()=>{if(j)return;const Z=Jc({verdict:Ne(P,Date.now()),watchMs:Kn});Z!==null&&(h=window.setTimeout(O,Z))};return h=window.setTimeout(O,Kn),()=>{j=!0,window.clearTimeout(h)}},[P,Ne]),o.useEffect(()=>{if(!P)return;const h=j=>{Qc({target:j.target,row:te.current[P.name]})&&ie(null)};return window.document.addEventListener("pointerdown",h,!0),()=>{window.document.removeEventListener("pointerdown",h,!0)}},[P]),t.jsxs(ce,{title:n(Ft),titleComponent:fe,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(ve,{size:"lg",label:n("ui.settings.integrations.mcp_management_section.loading_integrations")})}):null,i.folderUnavailable?t.jsx(ae,{variant:"warning",children:t.jsx("span",{children:n("ui.settings.integrations.mcp_management_section.this_chat_s_folder_no_longer_exists_so_only_global_integrations_a")})}):null,i.isError?t.jsx(ae,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:n("ui.settings.integrations.mcp_management_section.integrations_couldn_t_be_loaded")}),t.jsx(F,{variant:"secondary",size:"sm",onClick:i.refetch,children:n("ui.settings.integrations.mcp_management_section.retry")})]})}):null,He.map(([h,j])=>t.jsx(ae,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:j}),t.jsx(F,{variant:"ghost",size:"sm",onClick:()=>Ce(h),children:n("ui.settings.integrations.mcp_management_section.dismiss")})]})},h)),_&&c.length>0?ze: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(De,{ref:C,value:p,onChange:h=>x(h.target.value),onKeyDown:h=>{h.key!=="Escape"||!p||(h.preventDefault(),x(""))},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,U?.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(U.asked)})}):null,U?.kind==="matched"&&U.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(U.name),asked:String(U.unresolved)})}):null,r&&c.length===0&&!i.isLoading?_?ze:t.jsxs("div",{className:"flex flex-col items-start gap-3 rounded-lg bg-surface p-6",children:[t.jsx(ss,{"aria-hidden":"true",className:"size-5 text-ink-muted"}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.settings.integrations.mcp_management_section.no_integrations_yet")}),t.jsx("p",{className:"max-w-xl text-body-sm text-ink-muted",children:n("ui.settings.integrations.mcp_management_section.integrations_let_agents_read_and_act_in_your_other_tools_like_not")})]}),t.jsxs(F,{variant:"primary",size:"md",onClick:()=>f(!0),"data-tour-tag":"mcp-add-server",children:[t.jsx(kn,{"aria-hidden":"true"}),n("ui.settings.integrations.mcp_management_section.add_integration")]})]}):null,c.length>0&&xe.length===0?t.jsxs("div",{className:"flex flex-col items-start gap-2",children:[t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.integrations.mcp_management_section.no_integrations_match_this_search")}),t.jsx(F,{variant:"secondary",size:"sm",onClick:()=>{x(""),window.setTimeout(()=>{(C.current??I.current)?.focus()},0)},children:n("ui.settings.integrations.mcp_management_section.clear_search")})]}):null,Me.map(h=>t.jsxs("section",{"aria-labelledby":`integrations-group-${h.id}`,className:"flex flex-col gap-1.5",children:[t.jsxs("h3",{id:`integrations-group-${h.id}`,className:"px-1 text-ink-dim text-meta",children:[h.title," · ",h.rows.length]}),t.jsx("ul",{className:"flex flex-col divide-y divide-hairline overflow-hidden rounded-lg bg-surface",children:h.rows.map(j=>t.jsx(ad,{row:j,operations:g,memories:i.memories,projectScopeAvailable:y,highlighted:j.name===L,rowRef:O=>{te.current[j.name]=O,j.name===L&&(se.current=O)},primaryRef:O=>{Y.current[j.name]=O},overflowRef:O=>{H.current[j.name]=O},pending:b===j.name,failure:z[j.name]??null,confirm:E?.name===j.name?{kind:E.kind}:null,onPrimary:O=>oe(j,O),onOverflow:O=>le(j,O),onConfirm:()=>E&&be(j,E.kind),onCancelConfirm:()=>{v(null),window.setTimeout(()=>{H.current[j.name]?.focus()},0)}},j.id))})]},h.id))]}),k?.kind==="sign_in"?t.jsx(cd,{name:k.name,action:k.action,keyRoute:Te?St(Te):!1,phase:G,onStart:()=>void D(k.name,k.action),onCancel:h=>void l({action:"cancel",operationId:h}).catch(()=>{}),onOpenLink:h=>void ja(h),onClose:h=>S(k.name,h)}):null,k?.kind==="key"?t.jsx(td,{name:k.name,keyNames:k.keyNames.length?k.keyNames:we?.auth.secret_refs.map(h=>h.id)??[],keyless:k.keyNames.length===0,savedKeys:we?.auth.secret_refs.filter(h=>h.state==="encrypted").map(h=>h.id),saving:q,failure:J,onClose:je,onSave:(h,j,O)=>{V(!0),K(null),i.storeKeys(k.name,h,j,O).then(Z=>{if(!Z.saved){K(Z.message);return}w(null),ie({name:k.name,waitForSignIn:!1,until:Date.now()+nt,reanchors:0})}).catch(Z=>K(_t("key",Z,!1))).finally(()=>V(!1))}}):null]})},nt=4e3,Ad=/^\/(?:Users|home)\/[^/]+(?=\/|$)/,Ed=e=>e.replace(Ad,"~"),Id=({verification:e})=>{ne();const{prices:s}=Ma(),a=e.grant_amount??s?.default_new_credits,{sentence:i,action:r}=Ca(e.signup_grant,Aa(a)),l=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(Nt,{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(l),children:r})]})]})},Rd=({onAfterCredentialUpdate:e})=>{ne();const{isAuthenticated:s,user:a,isLoading:i,accountRead:r,signOut:l}=Sa(),d=as(_=>_.isSigningOut),u=o.useCallback(async()=>{try{await l()}catch(_){console.error("Error signing out:",_)}},[l]),c=(()=>{if(!s||!a?.radientUser)return null;const{account:_,identity:f,verification:p}=a.radientUser,x=p!=null&&!p.email_verified&&p.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(it,{variant:"success",className:"capitalize",children:_.status})]})}),t.jsx(me,{label:n("ui.settings.account.radient_account_section.name"),value:_.name||n("ui.settings.account.radient_account_section.not_provided")}),t.jsx(me,{label:n("ui.settings.account.radient_account_section.email"),value:_.email}),t.jsx(me,{label:n("ui.settings.account.radient_account_section.account_id"),value:t.jsx("span",{className:"text-mono-sm",children:_.id})}),t.jsx(me,{label:n("ui.settings.account.radient_account_section.tenant_id"),value:t.jsx("span",{className:"text-mono-sm",children:_.tenant_id})}),t.jsx(me,{label:n("ui.settings.account.radient_account_section.provider"),value:t.jsx("span",{className:"capitalize",children:f.provider})}),t.jsx(me,{label:n("ui.settings.account.radient_account_section.created"),value:is(_.created_at)})]}),x&&p?t.jsx(Id,{verification:p}):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=r==="refused"?n("ui.settings.account.radient_account_section.radient_refused_the_sign_in_this_app_is_holding_so_your_account_d"):rs(r)?n("ui.settings.account.radient_account_section.your_radient_account_could_not_be_read_so_this_app_cannot_show_yo"):n("ui.settings.account.radient_account_section.you_are_not_currently_signed_in_to_radient"),y=s&&a?null:t.jsxs("div",{children:[t.jsxs("p",{className:"text-body-sm text-ink-muted",children:[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(ve,{size:"lg",label:n("ui.settings.account.radient_account_section.loading_account")}),!d&&t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.account.radient_account_section.loading_your_radient_account_details")})]}):s&&a?.radientUser?c:t.jsx("div",{className:"flex flex-col gap-4",children:y})};function Td({metric:e,data:s}){return ne(),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 Re({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 Gn(e){const s=new Map(e.map(r=>[r.key,r])),a=[],i=[];for(const r of Fd){const l=s.get(r);l?a.push(l):i.push(r)}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 r=i;if(!Yn(r.path)||typeof r.available!="boolean"||typeof r.reason!="string")return null;a.push({path:r.path,available:r.available,reason:r.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})=>(ne(),t.jsx(ae,{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})=>{ne();const s=nn(),a=os(),i=Fa(s.data,"tts"),r=Bd(i),l=Re({queryKey:Pt.all,queryFn:()=>pe({op:"settings.list"}),enabled:r==="ready",staleTime:1e4}),d=Od(r==="ready"),{hasRadientApiKey:u,hasRadientSession:c,speechBlock:g}=Da(),y=`${c}:${u}`,_=o.useRef(y),f=d.refetch;o.useEffect(()=>{_.current!==y&&(_.current=y,f())},[y,f]);const p=l.data,x=o.useMemo(()=>Gn(p?.settings??[]),[p]),[b,M]=o.useState({}),[z,N]=o.useState({}),[E,v]=o.useState({});o.useEffect(()=>{p&&M(m=>{let I=!1;const C={...m};for(const W of Gn(p.settings).rows){const Q=m[W.key];if(Q&&Q.value!==et(W).value)continue;const X=et(W);Q&&Q.value===X.value&&Q.cascadeBase===X.cascadeBase||(C[W.key]=X,I=!0)}return I?C:m})},[p]);const k=(m,I)=>N(C=>({...C,[m]:I})),w=(m,I)=>v(C=>({...C,[m]:I})),G=async m=>{const I=b[m.key];if(!I)return;const C=Pa(m,I);if(!C.ok){w(m.key,C.error);return}k(m.key,!0),w(m.key,null);try{await pe(C.request),k(m.key,!1);const Q=(await l.refetch()).data?.settings.find(X=>X.key===m.key);Q&&M(X=>{const P=X[m.key];return P&&P.value===I.value&&P.cascadeBase===I.cascadeBase?{...X,[m.key]:et(Q)}:X})}catch(W){k(m.key,!1),w(m.key,W instanceof Error?W.message:n("ui.settings.speech.speech_section.the_setting_could_not_be_saved"))}},T=async m=>{k(m.key,!0),w(m.key,null);try{await pe({op:"settings.reset",key:m.key}),M(I=>({...I,[m.key]:et({...m,value:m.default,is_default:!0})})),k(m.key,!1),await l.refetch()}catch(I){k(m.key,!1),w(m.key,I instanceof Error?I.message:n("ui.settings.speech.speech_section.the_setting_could_not_be_reset"))}},$=o.useMemo(()=>zd(d.data),[d.data]),R=$?Pd($):null,J=d.isSuccess&&$===null,K=(s.data?null:s.error)??null,q=l.error,V=n("ui.settings.speech.speech_section.speech_voicing"),Y=n("ui.settings.speech.speech_section.how_the_assistant_sounds_when_it_speaks_aloud");if(r==="pairing"){const{sentence:m}=Ht(a??null,n("ui.settings.speech.speech_section.speech_settings_could_not_be_loaded"),K);return t.jsx(ce,{title:V,icon:dt,description:Y,sectionRef:e,children:t.jsx(ae,{variant:"warning",children:m})})}if(r==="older")return t.jsx(ce,{title:V,icon:dt,description:Y,sectionRef:e,children:t.jsx(ae,{variant:"warning",children:n(Kd)})});if(q||!p){const{sentence:m,remedy:I}=Ht(a??null,n("ui.settings.speech.speech_section.speech_settings_could_not_be_loaded"),q);return t.jsx(ce,{title:V,icon:dt,description:Y,sectionRef:e,children:t.jsx(ae,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:m}),I&&t.jsx(F,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{l.refetch()},children:n("ui.settings.speech.speech_section.retry")})]})})})}const H=R?!R.servable:g==="offline",te=R?R.rungs.find(m=>m.path===R.serving)??null:null;return t.jsx(ce,{title:V,icon:dt,description:Y,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(ve,{}),vn("checking")]}),(d.isError||J)&&!R&&g!=="offline"&&t.jsx(ae,{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!==te?.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(m=>t.jsxs("li",{className:"flex flex-col gap-0.5 text-body-sm",children:[t.jsxs("span",{className:m.path===R.serving?"text-ink":"text-ink-muted",children:[m.name,t.jsxs("span",{className:m.path===R.serving?"text-ink-muted":"text-ink-dim",children:[" ",m.available?n("ui.settings.speech.speech_section.available"):n("ui.settings.speech.speech_section.not_available")]})]}),t.jsx("span",{className:"text-meta text-ink-dim",children:m.reason})]},m.path))})]})})]}),H&&t.jsx(ae,{variant:"warning",children:vn(g)}),t.jsx("div",{className:"flex flex-col gap-1",children:x.rows.map(m=>t.jsx(za,{setting:m,draft:b[m.key]??et(m),tier:$a(m),saving:!!z[m.key],error:E[m.key]??null,onDraftChange:I=>M(C=>({...C,[m.key]:I})),onSave:()=>{G(m)},onReset:()=>{T(m)}},m.key))}),x.missing.length>0&&t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.speech.speech_section.missing_voice_rows",{count:x.missing.length,rows:x.missing.join(", ")})})]})})},Hd=()=>{ne();const{data:e,isLoading:s,error:a,refetch:i}=el(),r=tl(),[l,d]=o.useState(""),[u,c]=o.useState(!1);o.useEffect(()=>{d(e?.content??""),c(!1)},[e]);const g=x=>{const b=x.target.value;d(b),c(b!==(e?.content??""))},y=async()=>{if(!(!u||r.isPending))try{const x={content:l};await r.mutateAsync(x),await i(),c(!1)}catch(x){console.error("Error updating system prompt:",x)}},_=()=>{d(e?.content??""),c(!1)},f=r.isPending,p=()=>t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Ie,{htmlFor:"app-system-prompt",children:n("ui.settings.model.system_prompt.instructions")}),t.jsx(_s,{id:"app-system-prompt",name:"systemPrompt",value:l,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:y,disabled:!u||f,children:[f?t.jsx(ve,{size:"sm"}):t.jsx(us,{}),f?n("ui.settings.model.system_prompt.saving"):n("ui.settings.model.system_prompt.save_changes")]}),t.jsx(F,{onClick:_,disabled:!u||f,children:n("ui.settings.model.system_prompt.cancel")})]}),e?.last_modified&&t.jsxs("p",{className:"text-ink-dim text-meta",children:[n("ui.settings.model.system_prompt.last_modified")," ",t.jsx("span",{className:"font-mono text-mono-sm",children:sn(e.last_modified)})]})]});return t.jsx(ce,{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(ve,{size:"lg",label:n("ui.settings.model.system_prompt.loading_system_prompt")})}):a?t.jsx(ae,{variant:"danger",children:n("ui.settings.model.system_prompt.load_failed",{reason:a instanceof Error?a.message:n("ui.settings.model.system_prompt.unknown_error")})}):p()})},qd=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"],Gd=e=>qd.includes(e),Yd=e=>{const s=[];let a=0;for(const i of e){const r=Math.max(0,Math.floor(i.count)),l=Math.max(1,Math.floor(i.columns));for(let d=0;d<r;d+=l)s.push({start:a+d,count:Math.min(l,r-d)});a+=r}return s},Wd=({index:e,key:s,groups:a})=>{const i=Yd(a),r=i.reduce((l,d)=>l+d.count,0);if(!Number.isInteger(e)||e<0||e>=r)return e;switch(s){case"Home":return 0;case"End":return r-1;case"ArrowLeft":return Math.max(0,e-1);case"ArrowRight":return Math.min(r-1,e+1);case"ArrowUp":case"ArrowDown":{const l=i.findIndex(c=>e>=c.start&&e<c.start+c.count),d=i[l+(s==="ArrowDown"?1:-1)];if(!d)return e;const u=e-i[l].start;return d.start+Math.min(u,d.count-1)}default:return e}},Qd={localOperatorDark:co,localOperatorLight:Eo,dracula:ko,dune:Dr,sage:to,monokai:hi,tokyoNight:_o,iceberg:wo,radient:Wr,neon:Ua,obsidian:ps,synth:Ji,catppuccinMocha:kr,catppuccinLatte:io,tokyoNightStorm:_r,gruvbox:rr,nord:Jo,oneDark:Qi,solarizedDark:Co,rosePine:Kr,rosePineMoon:oo,rosePineDawn:vr,alucard:Br,gruvboxLight:Ar,tokyoNightDay:go,oneLight:so,catppuccinFrappe:Mr,catppuccinMacchiato:Zr,palenight:Ka,everforest:Vo,everforestLight:Uo,kanagawaWave:Yo,kanagawaLotus:$r,ayuDark:Ir,ayuMirage:Tr,ayuLight:xo,nightfox:hr,duskfox:Lo,synthwave:ho,matrix:er,tron:gr,cyberpunk:pi,vaporwave:Po,outrun:ar,neonNoir:qo,arcade:Xr,forest:zo,ocean:Or,desert:Fo,autumn:Qo,lavender:So,arctic:xr,rosewood:Gr,solarizedLight:Ro,githubLight:Hr,paper:Ui,linen:vo,highContrastLight:Yi,mintLight:nr},Wn="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:r,onSelect:l,onFocusTile:d})=>{const u=Qd[e];return t.jsx(Je,{side:"bottom",align:"start",content:a,children:t.jsxs("button",{type:"button","data-theme-tile":e,"aria-pressed":i,tabIndex:r?0:-1,onFocus:d,onClick:l,className:_e("relative flex flex-col gap-1.5 rounded-md p-1 text-left transition-colors duration-fast ease-out-quart",i?Wn:"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",Wn),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(r=>Math.abs(r.getBoundingClientRect().top-i)<1).length)}}),eu=()=>{ne();const{themeName:e,setTheme:s}=Ue(),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),[r,l]=o.useState(null),d=o.useMemo(()=>{const c=i.flatMap(g=>g.items.map(y=>y.id));return r&&c.includes(r)?r:c.includes(e)?e:c[0]},[i,r,e]),u=c=>{if(!Gd(c.key))return;const g=[...c.currentTarget.querySelectorAll("[data-theme-tile]")],y=g.indexOf(c.target);if(y<0)return;c.preventDefault();const _=Wd({index:y,key:c.key,groups:Xd(c.currentTarget)});_!==y&&g[_]?.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:y,description:_})=>t.jsx(Jd,{id:g,name:y,description:_,isSelected:g===e,isTabStop:g===d,onSelect:()=>s(g),onFocusTile:()=>l(g)},g))})]},c.label))})})},tu=({value:e,onChange:s})=>{ne();const a=o.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(kt,{value:e,onValueChange:i=>s(ls(i)),children:t.jsx(jt,{"aria-labelledby":a,children:ii.map(i=>t.jsx(Qe,{value:i.value,children:i.value==="by-turn"?n("ui.settings.appearance.transcript_display_mode_setting.by_turn"):n("ui.settings.appearance.transcript_display_mode_setting.by_response")},i.value))})})})]})},nu=()=>{ne();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(Nr,{size:16,className:"shrink-0 text-ink-dim"}),n("ui.settings.account.settings_page.radient_pass")]}),s&&t.jsx(ye,{className:"h-6 w-36"}),a&&t.jsx(ae,{variant:"warning",children:n("ui.settings.account.settings_page.credit_balance_load_failed",{reason:a.message})}),e&&!s&&!a&&t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[t.jsxs("p",{className:"flex-1 text-body-sm text-ink-muted",children:[n("ui.settings.account.settings_page.available_credits")," ",t.jsx("span",{className:"font-medium text-ink",children:e.balance.toFixed(2)})]}),t.jsx(F,{variant:"secondary",size:"sm",asChild:!0,children:t.jsxs("a",{href:"https://console.radienthq.com/dashboard/billing",target:"_blank",rel:"noopener noreferrer",children:[t.jsx(dr,{}),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=()=>{ne();const[e,s]=o.useState("credits"),a=o.useMemo(()=>{const u=new Date,c=nl(u);return{start_date:Mn(c),end_date:Mn(u),rollup:"daily"}},[]),{data:i,isLoading:r,error:l}=ol(a,{enabled:!0}),d=o.useMemo(()=>i?.data_points?[...i.data_points].sort((c,g)=>Ct(c.timestamp).getTime()-Ct(g.timestamp).getTime()).map(c=>({bucket:Ja(Hi(Ct(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(lr,{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))})]})]}),r&&t.jsx(ye,{className:"h-62 w-full"}),l&&t.jsx(ae,{variant:"warning",children:n("ui.settings.account.settings_page.usage_load_failed",{reason:l.message})}),!r&&!l&&i&&d.length>0&&t.jsx(Td,{metric:e,data:d}),!r&&!l&&(!i||d.length===0)&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.account.settings_page.no_usage_recorded_in_the_last_30_days")})]})},iu=()=>(ne(),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=()=>{ne();const e=Ba("surface"),s=Va(),a=Ue(D=>D.showAgentReasoning),i=Ue(D=>D.setShowAgentReasoning),r=Ue(D=>D.transcriptDisplayMode),l=Ue(D=>D.setTranscriptDisplayMode),{data:d,isLoading:u,isFetching:c,error:g,refetch:y}=Ha(),{needsProvider:_}=qa(),f=os(),{sentence:p,remedy:x}=Ht(f??null,n("ui.settings.navigation.settings_page.your_settings_could_not_be_loaded"),g),b=fi(),[M,z]=o.useState(null),N=as(),{isAuthenticated:E,accountRead:v,isFetching:k,isRefreshing:w,refreshUser:G}=tn(),T=st(D=>D.activeSessionId),$=st(D=>D.sessions),R=El(),{accountId:J,snapshot:K,model:q}=ds(),V=o.useRef(null);K.status?V.current={accountId:J,status:K.status}:K.checking||(V.current=null);const Y=K.status??(V.current?.accountId===J?V.current.status:null),H=_l(R),te=o.useMemo(()=>xi.filter(D=>D.id!=="agent-messages"||R!=="absent"),[R]),m=o.useCallback(()=>q.check("surface_open",!0),[q]),[I,C]=o.useState("general"),[W,Q]=o.useState(!1),X=o.useRef(null),P=o.useRef(null),{startTour:ie}=yi(),de=Ga(),{data:Se,refetch:je}=Ya(),{refreshModels:he}=Wa(),S=o.useMemo(()=>Se?.keys?[...Se.keys].sort():[],[Se?.keys]),U=o.useRef({keys:"",hosting:void 0});o.useEffect(()=>{const D=S.join(","),oe=d?.values?.hosting;(U.current.keys!==D||U.current.hosting!==oe)&&(U.current={keys:D,hosting:oe},he().catch(le=>{console.error("Failed to refresh models after credentials or hosting change:",le)}))},[S,d?.values?.hosting,he]);const L=o.useRef({general:o.useRef(null),radient:o.useRef(null),integrations:o.useRef(null),appearance:o.useRef(null),speech:o.useRef(null),keyboard:o.useRef(null),providers:o.useRef(null),"agent-messages":o.useRef(null),backend:o.useRef(null),imports:o.useRef(null),updates:o.useRef(null)}).current,se=o.useMemo(()=>new URLSearchParams(de.search).get("setting"),[de.search]),re=o.useMemo(()=>new URLSearchParams(de.search).get("filter")??"",[de.search]),Be=o.useMemo(()=>new URLSearchParams(de.search).get("mcp")??void 0,[de.search]),xe=o.useMemo(()=>new URLSearchParams(de.search).get("provider"),[de.search]),Me=o.useCallback(D=>{C(D),Q(!0);const oe=L[D],le=P.current;if(oe?.current&&le){const Le=oe.current.getBoundingClientRect().top-le.getBoundingClientRect().top;le.scrollHeight>le.clientHeight?le.scrollTo({top:Math.max(0,le.scrollTop+Le-80),behavior:"smooth"}):window.scrollTo({top:Math.max(0,oe.current.getBoundingClientRect().top+window.scrollY-80),behavior:"smooth"}),clearTimeout(X.current??void 0),X.current=setTimeout(()=>{Q(!1),X.current=null},800)}else Q(!1)},[L]);o.useEffect(()=>{const D=setTimeout(()=>{const oe=P.current;if(!oe)return;const le=()=>{if(W)return;const be=oe.getBoundingClientRect(),Le=be.height;let fe="",ze=0;for(const[we,He]of Object.entries(L))if(He.current){const Ce=He.current.getBoundingClientRect(),Ne=be.top,h=Ce.top-Ne,j=Ce.bottom-Ne,O=Ce.height,Z=Math.max(0,h),ke=Math.min(Le,j),Ae=Math.max(0,ke-Z)/O,Oe=Ae+(h<Le*.3?.1:0);Oe>ze&&Ae>.1&&(ze=Oe,fe=we)}fe&&fe!==I&&C(fe)};return le(),oe.addEventListener("scroll",le,{passive:!0}),()=>{oe.removeEventListener("scroll",le),clearTimeout(X.current??void 0)}},100);return()=>clearTimeout(D)},[L,I,W]),o.useEffect(()=>{const D=new URLSearchParams(de.search),oe=D.get("section"),le=D.get("setting"),be=le?bn(le,"backend"):oe;if(be==="agent-messages"&&!H)return;const Le=be?L[be]:void 0;if(!be||!Le)return;let fe=!1,ze=Number.NaN,we=0;const He=window.setTimeout(()=>{fe||(fe=!0,Ne.disconnect(),Me(be))},2e3),Ce=()=>{if(fe)return;const h=Le.current;if(!h){we=requestAnimationFrame(Ce);return}const j=Math.round(h.getBoundingClientRect().top+window.scrollY);if(j===ze&&j>0){fe=!0,Ne.disconnect(),window.clearTimeout(He),Me(be);return}ze=j,we=requestAnimationFrame(Ce)},Ne=new ResizeObserver(()=>{fe||(cancelAnimationFrame(we),we=requestAnimationFrame(Ce))});return P.current&&Ne.observe(P.current),we=requestAnimationFrame(Ce),()=>{fe=!0,cancelAnimationFrame(we),Ne.disconnect(),window.clearTimeout(He)}},[de.search,L,Me,H]);const Te=async(D,oe)=>{z(D);try{await b.mutateAsync({[D]:oe}),await y()}catch(le){console.error(`Error updating ${D}:`,le)}finally{z(null)}},Ve=u,B=v==="checking",ee=rs(v),ge=v==="ready"||v==="checking"||k,ue=cs(Ve,4e3);return g?t.jsx("div",{className:"flex h-full w-full items-center justify-center bg-canvas p-6",children:t.jsx(ae,{variant:"warning",className:"w-full max-w-xl",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:p}),x&&t.jsx(F,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>void y(),disabled:c,children:c?n("ui.settings.navigation.settings_page.retrying"):n("ui.settings.navigation.settings_page.retry")})]})})}):Ve?t.jsxs("div",{role:"status",className:"flex h-full w-full flex-col items-center justify-center gap-3 bg-canvas",children:[t.jsx(ve,{size:"lg",label:ue?void 0:n("ui.settings.navigation.settings_page.loading_settings")}),ue&&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:I,onSelectSection:Me,sections:te})}),t.jsx("div",{ref:P,"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:se===Us}),t.jsxs(ce,{title:n("ui.settings.profile.title"),icon:ki,description:n(E?"ui.settings.profile.description_authenticated":"ui.settings.profile.description_anonymous"),children:[B&&t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.profile.account_checking")}),ee&&t.jsx(ae,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:n(v==="refused"?"ui.settings.profile.account_read_failed_refused":"ui.settings.profile.account_read_failed_retry")}),t.jsx(F,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>G(),disabled:w,children:w?n("ui.settings.profile.retrying"):n("ui.settings.profile.retry")})]})}),t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(wn,{value:N.profile.name,label:n("ui.settings.profile.display_name.label"),placeholder:n("ui.settings.profile.display_name.placeholder"),isSaving:M==="user_name",onSave:async D=>{z("user_name");try{N.updateName(D)}finally{z(null)}},readOnly:ge}),t.jsx(wn,{value:N.profile.email,label:n("ui.settings.profile.email.label"),placeholder:n("ui.settings.profile.email.placeholder"),isSaving:M==="user_email",onSave:async D=>{z("user_email");try{N.updateEmail(D)}finally{z(null)}},readOnly:ge})]})]}),t.jsx(ce,{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(Qa,{}),n("ui.settings.tour.action")]})}),t.jsx(ce,{id:"model-settings",title:n("ui.settings.model.settings_page.model_settings"),icon:ji,description:n("ui.settings.model.settings_page.configure_the_default_ai_model_and_hosting_providers_used_for_gen"),children:t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(wi,{value:d.values.hosting,isSaving:M==="hosting",onSave:D=>Te("hosting",D),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:M==="model_name",onSave:D=>Te("model_name",D),allowCustom:!0,allowDefault:!1}),t.jsx(zl,{hosting:d.values.hosting,modelName:d.values.model_name,focus:se===pt}),_&&t.jsx(ae,{variant:"neutral",icon:t.jsx(Nt,{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:()=>{Me("providers"),L.providers.current?.focus({preventScroll:!0})},children:n("ui.settings.model.provider_callout.providers_link")}),"."]})})]})}),t.jsx(Hd,{}),t.jsx(ce,{title:n("ui.settings.configuration.settings_page.configuration_information"),icon:Nt,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(ce,{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 D=>i(D)}),t.jsx(tu,{value:ls(r),onChange:D=>l(D)}),t.jsx(ul,{state:s.state,onChange:s.set})]})}),t.jsx(Vd,{sectionRef:L.speech}),t.jsx(rc,{sectionRef:L.keyboard}),t.jsx(ce,{title:n("ui.settings.model.settings_page.model_providers"),icon:ss,description:n("ui.settings.navigation.settings_page.sign_in_to_the_services_your_agents_think_with_new_chats_use_your"),sectionRef:L.providers,id:"model-providers",className:"focus-visible:outline-none!",children:t.jsx(Si,{initialProviderId:xe,onChangeModel:()=>Me("general")})}),t.jsx(Cd,{sessionId:T??void 0,sectionRef:L.integrations,highlightServer:Be}),t.jsx(ce,{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:()=>{he(),je()}}),E&&t.jsxs(t.Fragment,{children:[t.jsx(nu,{}),t.jsx(au,{})]})]})}),H&&t.jsx(ce,{title:n("ui.agentMessages.settings.section"),icon:Mi,description:n("ui.agentMessages.settings.description"),sectionRef:L["agent-messages"],id:"agent-messages",className:"border-b border-hairline pb-8",children:Y?t.jsx(yl,{availability:R,status:Y,accountId:J,refusal:K.refusal,onRefreshStatus:m,sessions:$}):K.refusal?t.jsxs(ae,{variant:"warning",children:[t.jsx(wt,{children:n("ui.agentMessages.settings.error.title")}),t.jsxs(Ee,{children:[K.refusal.code!=="client_unavailable"&&t.jsx("span",{className:"block",children:xt(K.refusal)}),t.jsx("span",{className:"block",children:n("ui.agentMessages.settings.error.no_changes")}),t.jsx(F,{className:"mt-3",variant:"secondary",onClick:()=>void m(),children:n("ui.agentMessages.settings.error.retry")})]})]}):t.jsxs("div",{"aria-busy":"true",className:"flex flex-col gap-3",children:[t.jsx(ye,{className:"h-5 w-40"}),t.jsx(ye,{className:"h-4 w-full max-w-xl"})]})}),t.jsx(ce,{title:n("ui.settings.navigation.settings_page.backend_settings"),icon:jn,description:n("ui.settings.navigation.settings_page.every_setting_the_backend_registry_owns_searchable_with_typed_edi"),sectionRef:L.backend,children:t.jsx(Za,{hideInterfaceLanguage:!0,hideModelEffort:!0,hideAgentMessages:!0,focusKey:se&&bn(se,"backend")==="backend"?se:null,initialFilter:re})}),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(ae,{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};
|