local-operator-ui 0.48.11 → 0.48.13
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 +1575 -142
- package/out/preload/recording-encoder.js +18 -0
- package/out/renderer/assets/{_basePickBy-DFl9DUra.js → _basePickBy-CKmx30yF.js} +1 -1
- package/out/renderer/assets/{_baseUniq-BFXgChF-.js → _baseUniq-Bpi6IoVg.js} +1 -1
- package/out/renderer/assets/{agent-details-page-06GRVXIX.js → agent-details-page-DO7d_ih5.js} +1 -1
- package/out/renderer/assets/{agent-hub-page-BhNxrhRu.js → agent-hub-page-DqIdGNHj.js} +1 -1
- package/out/renderer/assets/agents-page-DMudbdAq.js +14 -0
- package/out/renderer/assets/{approvalsOverlay-uvA-Vt5X.js → approvalsOverlay-Bnfsw8L9.js} +1 -1
- package/out/renderer/assets/{arc-DWqWEzi9.js → arc-OIEGuBTn.js} +1 -1
- package/out/renderer/assets/{architectureDiagram-IEHRJDOE-DJogjK0_.js → architectureDiagram-IEHRJDOE-CzKyJ4cr.js} +1 -1
- package/out/renderer/assets/{avatar-cropper-SiLxEcIt.js → avatar-cropper-DXYS7VvI.js} +1 -1
- package/out/renderer/assets/{blockDiagram-JOT3LUYC-BjxLHnNm.js → blockDiagram-JOT3LUYC-ChQDHo8e.js} +1 -1
- package/out/renderer/assets/{book-open-BastYhxp.js → book-open-BAlAnYWc.js} +1 -1
- package/out/renderer/assets/browser-page-DKyFBSCV.js +1 -0
- package/out/renderer/assets/{browser-webauthn-prompt-C6vFP_2I.js → browser-webauthn-prompt-C7dwOBvW.js} +1 -1
- package/out/renderer/assets/{building-2-Dx-eOoNu.js → building-2-B4SNlD8W.js} +1 -1
- package/out/renderer/assets/{c4Diagram-VJAJSXHY-441IwSem.js → c4Diagram-VJAJSXHY-DP6s4-gF.js} +1 -1
- package/out/renderer/assets/channel-DXyM-LNQ.js +1 -0
- package/out/renderer/assets/{chunk-4BMEZGHF-DE74Ocw-.js → chunk-4BMEZGHF-CfMGVgaT.js} +1 -1
- package/out/renderer/assets/{chunk-A2AXSNBT-CvfIskY0.js → chunk-A2AXSNBT-C7LLSPSK.js} +1 -1
- package/out/renderer/assets/{chunk-AEK57VVT-Dg9iMQSH.js → chunk-AEK57VVT-ssRgcUgK.js} +1 -1
- package/out/renderer/assets/{chunk-D6G4REZN-B_1yVGsA.js → chunk-D6G4REZN-w9sKgwLw.js} +1 -1
- package/out/renderer/assets/{chunk-RZ5BOZE2-zoNgiWzT.js → chunk-RZ5BOZE2-C3JZadRL.js} +1 -1
- package/out/renderer/assets/{chunk-XZIHB7SX-D9i0ySOq.js → chunk-XZIHB7SX-A81zsT6l.js} +1 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-BouPcaGl.js +1 -0
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-BouPcaGl.js +1 -0
- package/out/renderer/assets/clone-BWgv46LY.js +1 -0
- package/out/renderer/assets/{console-mirror-Bd9dWCOG.js → console-mirror-Bd9Lx41W.js} +1 -1
- package/out/renderer/assets/{consoleCapture-DcDxwgX5.js → consoleCapture-TtI3yw3S.js} +1 -1
- package/out/renderer/assets/{conversation-input-sync-CE4opxo_.js → conversation-input-sync-B0udOX2P.js} +266 -260
- package/out/renderer/assets/{conversation-input-sync-Dp97JwKx.css → conversation-input-sync-BmGWvjex.css} +1 -1
- package/out/renderer/assets/{dagre-OKDRZEBW-7-fIaqjt.js → dagre-OKDRZEBW-futvc0Ip.js} +1 -1
- package/out/renderer/assets/{diagram-SSKATNLV-Bu5ERF6Y.js → diagram-SSKATNLV-DRqJ6jPO.js} +1 -1
- package/out/renderer/assets/{diagram-VNBRO52H-B-e-zp3r.js → diagram-VNBRO52H-CoXmeLca.js} +1 -1
- package/out/renderer/assets/{erDiagram-Q7BY3M3F-BjrAWWSl.js → erDiagram-Q7BY3M3F-DamfzVbu.js} +1 -1
- package/out/renderer/assets/{error-boundary-tDOEWhiX.js → error-boundary-DQKaFMb3.js} +1 -1
- package/out/renderer/assets/{flowDiagram-4HSFHLVR-D2brvAPw.js → flowDiagram-4HSFHLVR-D_JracNp.js} +1 -1
- package/out/renderer/assets/{ganttDiagram-APWFNJXF-DxYUXrbN.js → ganttDiagram-APWFNJXF-DxkMvvzu.js} +1 -1
- package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-CjAVMnY8.js → gitGraphDiagram-7IBYFJ6S-Ch2WfuGl.js} +1 -1
- package/out/renderer/assets/{graph-BdY3-j0d.js → graph-E23dAXFZ.js} +1 -1
- package/out/renderer/assets/{hash-B9N1GlDG.js → hash-Ccn2EAfy.js} +1 -1
- package/out/renderer/assets/{heart-i5FtUp5a.js → heart-DRuR5lyD.js} +1 -1
- package/out/renderer/assets/{image-plus-BirRYtMz.js → image-plus-CO38-orC.js} +1 -1
- package/out/renderer/assets/{index-CtJjbyMh.js → index-871YiMwJ.js} +1 -1
- package/out/renderer/assets/{index-BJiRq-wv.js → index-Cvms1u2n.js} +1 -1
- package/out/renderer/assets/{index-BuL7blPm.js → index-D8bU6n8S.js} +204 -204
- package/out/renderer/assets/{index-kR82CvO6.js → index-DszIY8oB.js} +1 -1
- package/out/renderer/assets/index-dyl6bCMv.css +1 -0
- package/out/renderer/assets/infoDiagram-PH2N3AL5-BzxTTi16.js +2 -0
- package/out/renderer/assets/{installer-D9ByBu_L.js → installer-BsEQzRI7.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-U35MCT3I-QMTzkgUq.js → journeyDiagram-U35MCT3I-7o71pCw6.js} +1 -1
- package/out/renderer/assets/{kanban-definition-NDS4AKOZ-BZCdzOwT.js → kanban-definition-NDS4AKOZ-Ba2fKg5g.js} +1 -1
- package/out/renderer/assets/{layout-DWrxkrqR.js → layout-u9aNonBe.js} +1 -1
- package/out/renderer/assets/{legacy-agents-page-DS_1qW0s.js → legacy-agents-page-BUZN75el.js} +2 -2
- package/out/renderer/assets/{library-page-DHdIJjSi.js → library-page-CnofZnaB.js} +3 -3
- package/out/renderer/assets/{mermaid.core-Ddb6Ozxy.js → mermaid.core-BO7pGBkG.js} +19 -19
- package/out/renderer/assets/{mesh-page-CcCqLeLA.js → mesh-page-BCIVB0Hi.js} +1 -1
- package/out/renderer/assets/{messages-aMLMjoGD.js → messages-BZscpRIC.js} +10 -10
- package/out/renderer/assets/{mindmap-definition-ALO5MXBD-BAFH5vG2.js → mindmap-definition-ALO5MXBD--7E9KpWa.js} +1 -1
- package/out/renderer/assets/{mini-CMXTYZwX.js → mini-CdnwZ2z8.js} +1 -1
- package/out/renderer/assets/{notebook-pen-QStzGWXW.js → notebook-pen-Dtk48ynr.js} +1 -1
- package/out/renderer/assets/{notifications-page-DBnBg_1b.js → notifications-page-DVFMPXXe.js} +1 -1
- package/out/renderer/assets/{org-access-udExX9j1.js → org-access-HM79rP3f.js} +1 -1
- package/out/renderer/assets/{org-surface-gate-CFYdT64x.js → org-surface-gate-DKBYiK5D.js} +1 -1
- package/out/renderer/assets/{page-header--Egdzoex.js → page-header-Y2McYPDx.js} +1 -1
- package/out/renderer/assets/{path-utils-Bblb7gI2.js → path-utils-BrLZulPz.js} +33 -33
- package/out/renderer/assets/{pieDiagram-IB7DONF6-CEnUlb7r.js → pieDiagram-IB7DONF6-D5TiBcOS.js} +1 -1
- package/out/renderer/assets/{project-markdown-BeCCWkWe.js → project-markdown-DM2zz9cY.js} +1 -1
- package/out/renderer/assets/{projects-page-CMs95LiG.js → projects-page-DQW7vu5M.js} +1 -1
- package/out/renderer/assets/{publication-validation-CNvZfxkg.js → publication-validation-CjUR3KXX.js} +1 -1
- package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-CLx--S0a.js → quadrantDiagram-7GDLP6J5-BxqgjzcX.js} +1 -1
- package/out/renderer/assets/{radar-MK3ICKWK-C8jcJ5ii.js → radar-MK3ICKWK-RhGIy4cy.js} +1 -1
- package/out/renderer/assets/{radient-auth-buttons-BI81mlJp.js → radient-auth-buttons-CjcIy4Ra.js} +1 -1
- package/out/renderer/assets/recordingEncoder-vsQVVLgp.js +1 -0
- package/out/renderer/assets/{requirementDiagram-KVF5MWMF-2LA0Av1t.js → requirementDiagram-KVF5MWMF-BbMnuHR5.js} +1 -1
- package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-Bwmm_Kef.js → sankeyDiagram-QLVOVGJD-B5rU7VZ5.js} +1 -1
- package/out/renderer/assets/{schedules-page-B7_dMaKI.js → schedules-page-D_c2nY3o.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-BnAqkczN.js → sequenceDiagram-X6HHIX6F-B3c6QPin.js} +1 -1
- package/out/renderer/assets/settings-page-AbHZDN8P.js +288 -0
- package/out/renderer/assets/{smartart-DWRhh-lL.js → smartart-K65nA3xt.js} +1 -1
- package/out/renderer/assets/{stateDiagram-DGXRK772-zu2cJm7e.js → stateDiagram-DGXRK772-BaaeHACk.js} +1 -1
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-B8p6qkit.js +1 -0
- package/out/renderer/assets/team-bridge-page-Cgvoi96Y.js +50 -0
- package/out/renderer/assets/{team-bridge-scope-preference-DlgQcIzl.js → team-bridge-scope-preference-CgR9TBFd.js} +1 -1
- package/out/renderer/assets/{timeline-definition-BDJGKUSR-B3CNpgws.js → timeline-definition-BDJGKUSR-DazTtN2a.js} +1 -1
- package/out/renderer/assets/{use-download-agent-mutation-BtMBnbn8.js → use-download-agent-mutation-DB5SyNA0.js} +1 -1
- package/out/renderer/assets/{use-session-snapshot-B1ZwqarE.js → use-session-snapshot-DbuqOFVq.js} +1 -1
- package/out/renderer/assets/{xychartDiagram-VJFVF3MP-C22FKAwz.js → xychartDiagram-VJFVF3MP-7wZpEaYI.js} +1 -1
- package/out/renderer/browser-approvals-overlay.html +2 -2
- package/out/renderer/console-capture.html +6 -6
- package/out/renderer/index.html +9 -9
- package/out/renderer/installer.html +5 -5
- package/out/renderer/mini.html +9 -9
- package/out/renderer/recording-encoder.html +23 -0
- package/package.json +1 -1
- package/out/renderer/assets/agents-page-CP7SXJ9K.js +0 -14
- package/out/renderer/assets/browser-page-DW2cfBgD.js +0 -1
- package/out/renderer/assets/channel-BdCrQtc5.js +0 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-CCQ8PKyo.js +0 -1
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-CCQ8PKyo.js +0 -1
- package/out/renderer/assets/clone-f_ugKI_v.js +0 -1
- package/out/renderer/assets/index-D2enLV5g.css +0 -1
- package/out/renderer/assets/infoDiagram-PH2N3AL5-DznqNbQh.js +0 -2
- package/out/renderer/assets/settings-page-BeBT1IGZ.js +0 -288
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-DqDAuirF.js +0 -1
- package/out/renderer/assets/team-bridge-page-qwUYdzut.js +0 -50
|
@@ -1,288 +0,0 @@
|
|
|
1
|
-
import{r as o,j as t,c as fe,t as Ra}from"./index-kR82CvO6.js";import{o as Ta}from"./console-mirror-Bd9dWCOG.js";import{eJ as ln,eK as La,eL as Bn,eM as $e,cA as Oa,b6 as As,b7 as kn,aH as Is,bu as Fa,aA as Da,eN as za,eO as $a,eP as Pa,eQ as Ua,eR as Rs,eS as jn,b4 as Ts,eT as Ka,eU as Ba,eV as At,eW as Ls,eX as qa,bw as cn,eY as qn,eZ as Va,e_ as He,e$ as zt,c2 as wn,f0 as Nn,cP as It,cg as Ha,f1 as Os,f2 as Ga,f3 as Wa,aW as Fs,by as dn,bz as un,a2 as Qa,aB as gn,f4 as Ya,f5 as Za,f6 as mn,f7 as Ja,f8 as Xa,f9 as ei,fa as Ds,fb as ti,fc as ni,fd as si,dn as Ge,ef as ai,dk as zs,dp as ii,b as Vn,fe as ri,ff as Sn,a1 as $s,bt as oi,fg as Ps,bx as Us,fh as Ks,fi as li,fj as ci,fk as di,fl as ui,fm as gi,fn as mi,dK as pi,b3 as fi,fo as _i,fp as hi,c7 as Bs,cc as xi,fq as tt,fr as Hn,fs as yi,ft as vi,fu as bi,cx as ki,fv as ji,fw as wi,cC as Ni,fx as Si,fy as Mi,fz as Ci,fA as Ei,ej as Ht,fB as Ai,fC as Ii}from"./conversation-input-sync-CE4opxo_.js";import{h as Ee,u as ut,ap as Ri,am as Ti,aq as Li,ar as Ue,a as gt,c as Qe,as as Oi,a4 as Fi,at as Di,au as zi,av as $i,aw as Pi,d as xe,H as Mn,ax as Ui,w as it,ay as Ki,o as qs,ad as Bi,F as we,r as qi,q as Vi,az as pn,B as at,aA as Hi,aB as Vs,a0 as Gi,a1 as Wi}from"./path-utils-Bblb7gI2.js";import{d3 as Hs,d4 as Qi,d5 as Yi,d6 as Gs,d7 as Zi,c8 as Ji,d8 as Oe,N as Xi,S as Ws,bE as mt,bF as he,d9 as lt,da as _e,db as Gt,dc as er,R as tr,a as Gn,dd as nr,de as sr,df as ar,dg as ir,dh as bt,di as kt,bD as rr,bO as or,dj as lr,dk as cr,dl as dr,dm as ur,bt as Wn,dn as gr,b4 as mr,bA as Qn,bY as pr,bB as fr,bC as _r,dp as hr,dq as xr,bs as yr,dr as vr}from"./index-BuL7blPm.js";import{P as br}from"./page-header--Egdzoex.js";import{c as P,u as ie,B as F,S as Me,_ as Qs,w as Ye,N as $t,O as Pt,P as Ve,A as le,q as Ut,x as Re,f as Se,R as Cn,U as En,V as An,W as In,Y as We,L as Te,K as Le,a6 as Kt,$ as Ys,i as ct,h as fn,af as kr,a as Zs,at as Yn,T as Rn,D as jr,b as wr,d as Nr,I as Sr,e as Zn,G as Mr,E as Cr,al as Er,aa as Ar}from"./error-boundary-tDOEWhiX.js";import{t as n,L as Wt}from"./messages-aMLMjoGD.js";import{u as Ir,a as Rr,D as Tr,b as Lr,d as Or,S as Fr}from"./team-bridge-scope-preference-DlgQcIzl.js";import{R as Dr}from"./radient-auth-buttons-BI81mlJp.js";import{u as zr,A as $r,d as Pr}from"./avatar-cropper-SiLxEcIt.js";import{N as Ur}from"./notebook-pen-QStzGWXW.js";import{B as Kr}from"./book-open-BastYhxp.js";import{i as Br,a as Pe,b as qr,p as Qt,f as Vr}from"./parseISO-CxPiCKvF.js";import{t as Hr}from"./en-US-CW_dDnkH.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 Gr=[["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"}]],Wr=P("aperture",Gr);/**
|
|
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 Qr=[["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"}]],Yr=P("atom",Qr);/**
|
|
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 Zr=[["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"}]],Jr=P("audio-waveform",Zr);/**
|
|
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 Xr=[["rect",{x:"14",y:"14",width:"4",height:"6",rx:"2",key:"p02svl"}],["rect",{x:"6",y:"4",width:"4",height:"6",rx:"2",key:"xm4xkj"}],["path",{d:"M6 20h4",key:"1i6q5t"}],["path",{d:"M14 10h4",key:"ru81e7"}],["path",{d:"M6 14h2v6",key:"16z9wg"}],["path",{d:"M14 4h2v6",key:"1idq9u"}]],eo=P("binary",Xr);/**
|
|
22
|
-
* @license lucide-react v0.507.0 - ISC
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the ISC license.
|
|
25
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const to=[["path",{d:"M10 7v10.9",key:"1gynux"}],["path",{d:"M14 6.1V17",key:"116kdf"}],["path",{d:"M16 7V3a1 1 0 0 1 1.707-.707 2.5 2.5 0 0 0 2.152.717 1 1 0 0 1 1.131 1.131 2.5 2.5 0 0 0 .717 2.152A1 1 0 0 1 21 8h-4",key:"gpb6xx"}],["path",{d:"M16.536 7.465a5 5 0 0 0-7.072 0l-2 2a5 5 0 0 0 0 7.07 5 5 0 0 0 7.072 0l2-2a5 5 0 0 0 0-7.07",key:"1tsln4"}],["path",{d:"M8 17v4a1 1 0 0 1-1.707.707 2.5 2.5 0 0 0-2.152-.717 1 1 0 0 1-1.131-1.131 2.5 2.5 0 0 0-.717-2.152A1 1 0 0 1 3 16h4",key:"qexcha"}]],no=P("candy",to);/**
|
|
27
|
-
* @license lucide-react v0.507.0 - ISC
|
|
28
|
-
*
|
|
29
|
-
* This source code is licensed under the ISC license.
|
|
30
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const so=[["path",{d:"m21 8-2 2-1.5-3.7A2 2 0 0 0 15.646 5H8.4a2 2 0 0 0-1.903 1.257L5 10 3 8",key:"1imjwt"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 14h.01",key:"7oqj8z"}],["rect",{width:"18",height:"8",x:"3",y:"10",rx:"2",key:"a7itu8"}],["path",{d:"M5 18v2",key:"ppbyun"}],["path",{d:"M19 18v2",key:"gy7782"}]],ao=P("car-front",so);/**
|
|
32
|
-
* @license lucide-react v0.507.0 - ISC
|
|
33
|
-
*
|
|
34
|
-
* This source code is licensed under the ISC license.
|
|
35
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/const io=[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["circle",{cx:"8",cy:"10",r:"2",key:"1xl4ub"}],["path",{d:"M8 12h8",key:"1wcyev"}],["circle",{cx:"16",cy:"10",r:"2",key:"r14t7q"}],["path",{d:"m6 20 .7-2.9A1.4 1.4 0 0 1 8.1 16h7.8a1.4 1.4 0 0 1 1.4 1l.7 3",key:"l01ucn"}]],ro=P("cassette-tape",io);/**
|
|
37
|
-
* @license lucide-react v0.507.0 - ISC
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the ISC license.
|
|
40
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/const oo=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],lo=P("chart-line",oo);/**
|
|
42
|
-
* @license lucide-react v0.507.0 - ISC
|
|
43
|
-
*
|
|
44
|
-
* This source code is licensed under the ISC license.
|
|
45
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
-
*/const co=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],uo=P("circle-plus",co);/**
|
|
47
|
-
* @license lucide-react v0.507.0 - ISC
|
|
48
|
-
*
|
|
49
|
-
* This source code is licensed under the ISC license.
|
|
50
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/const go=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M11 9h4a2 2 0 0 0 2-2V3",key:"1ve2rv"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"M7 21v-4a2 2 0 0 1 2-2h4",key:"1fwkro"}],["circle",{cx:"15",cy:"15",r:"2",key:"3i40o0"}]],mo=P("circuit-board",go);/**
|
|
52
|
-
* @license lucide-react v0.507.0 - ISC
|
|
53
|
-
*
|
|
54
|
-
* This source code is licensed under the ISC license.
|
|
55
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
-
*/const po=[["path",{d:"M6 16.326A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 .5 8.973",key:"1cez44"}],["path",{d:"m13 12-3 5h4l-3 5",key:"1t22er"}]],fo=P("cloud-lightning",po);/**
|
|
57
|
-
* @license lucide-react v0.507.0 - ISC
|
|
58
|
-
*
|
|
59
|
-
* This source code is licensed under the ISC license.
|
|
60
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
-
*/const _o=[["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"}]],ho=P("cloud-moon",_o);/**
|
|
62
|
-
* @license lucide-react v0.507.0 - ISC
|
|
63
|
-
*
|
|
64
|
-
* This source code is licensed under the ISC license.
|
|
65
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
-
*/const xo=[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M8 19h.01",key:"puxtts"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M12 21h.01",key:"h35vbk"}],["path",{d:"M16 15h.01",key:"rnfrdf"}],["path",{d:"M16 19h.01",key:"1vcnzz"}]],yo=P("cloud-snow",xo);/**
|
|
67
|
-
* @license lucide-react v0.507.0 - ISC
|
|
68
|
-
*
|
|
69
|
-
* This source code is licensed under the ISC license.
|
|
70
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
-
*/const vo=[["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}],["path",{d:"M15.947 12.65a4 4 0 0 0-5.925-4.128",key:"dpwdj0"}],["path",{d:"M13 22H7a5 5 0 1 1 4.9-6H13a3 3 0 0 1 0 6Z",key:"s09mg5"}]],bo=P("cloud-sun",vo);/**
|
|
72
|
-
* @license lucide-react v0.507.0 - ISC
|
|
73
|
-
*
|
|
74
|
-
* This source code is licensed under the ISC license.
|
|
75
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
-
*/const ko=[["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M14 2v2",key:"6buw04"}],["path",{d:"M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1",key:"pwadti"}],["path",{d:"M6 2v2",key:"colzsn"}]],jo=P("coffee",ko);/**
|
|
77
|
-
* @license lucide-react v0.507.0 - ISC
|
|
78
|
-
*
|
|
79
|
-
* This source code is licensed under the ISC license.
|
|
80
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
-
*/const wo=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 18a6 6 0 0 0 0-12v12z",key:"j4l70d"}]],Js=P("contrast",wo);/**
|
|
82
|
-
* @license lucide-react v0.507.0 - ISC
|
|
83
|
-
*
|
|
84
|
-
* This source code is licensed under the ISC license.
|
|
85
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
-
*/const No=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],So=P("credit-card",No);/**
|
|
87
|
-
* @license lucide-react v0.507.0 - ISC
|
|
88
|
-
*
|
|
89
|
-
* This source code is licensed under the ISC license.
|
|
90
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
-
*/const Mo=[["path",{d:"m6 8 1.75 12.28a2 2 0 0 0 2 1.72h4.54a2 2 0 0 0 2-1.72L18 8",key:"8166m8"}],["path",{d:"M5 8h14",key:"pcz4l3"}],["path",{d:"M7 15a6.47 6.47 0 0 1 5 0 6.47 6.47 0 0 0 5 0",key:"yjz344"}],["path",{d:"m12 8 1-6h2",key:"3ybfa4"}]],Co=P("cup-soda",Mo);/**
|
|
92
|
-
* @license lucide-react v0.507.0 - ISC
|
|
93
|
-
*
|
|
94
|
-
* This source code is licensed under the ISC license.
|
|
95
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
96
|
-
*/const Eo=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M6 12c0-1.7.7-3.2 1.8-4.2",key:"oqkarx"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M18 12c0 1.7-.7 3.2-1.8 4.2",key:"1eah9h"}]],Ao=P("disc-3",Eo);/**
|
|
97
|
-
* @license lucide-react v0.507.0 - ISC
|
|
98
|
-
*
|
|
99
|
-
* This source code is licensed under the ISC license.
|
|
100
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
101
|
-
*/const Io=[["path",{d:"M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z",key:"c7niix"}]],Ro=P("droplet",Io);/**
|
|
102
|
-
* @license lucide-react v0.507.0 - ISC
|
|
103
|
-
*
|
|
104
|
-
* This source code is licensed under the ISC license.
|
|
105
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
106
|
-
*/const To=[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]],Lo=P("droplets",To);/**
|
|
107
|
-
* @license lucide-react v0.507.0 - ISC
|
|
108
|
-
*
|
|
109
|
-
* This source code is licensed under the ISC license.
|
|
110
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
111
|
-
*/const Oo=[["path",{d:"M6.5 12c.94-3.46 4.94-6 8.5-6 3.56 0 6.06 2.54 7 6-.94 3.47-3.44 6-7 6s-7.56-2.53-8.5-6Z",key:"15baut"}],["path",{d:"M18 12v.5",key:"18hhni"}],["path",{d:"M16 17.93a9.77 9.77 0 0 1 0-11.86",key:"16dt7o"}],["path",{d:"M7 10.67C7 8 5.58 5.97 2.73 5.5c-1 1.5-1 5 .23 6.5-1.24 1.5-1.24 5-.23 6.5C5.58 18.03 7 16 7 13.33",key:"l9di03"}],["path",{d:"M10.46 7.26C10.2 5.88 9.17 4.24 8 3h5.8a2 2 0 0 1 1.98 1.67l.23 1.4",key:"1kjonw"}],["path",{d:"m16.01 17.93-.23 1.4A2 2 0 0 1 13.8 21H9.5a5.96 5.96 0 0 0 1.49-3.98",key:"1zlm23"}]],Fo=P("fish",Oo);/**
|
|
112
|
-
* @license lucide-react v0.507.0 - ISC
|
|
113
|
-
*
|
|
114
|
-
* This source code is licensed under the ISC license.
|
|
115
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
116
|
-
*/const Do=[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]],zo=P("flame",Do);/**
|
|
117
|
-
* @license lucide-react v0.507.0 - ISC
|
|
118
|
-
*
|
|
119
|
-
* This source code is licensed under the ISC license.
|
|
120
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
121
|
-
*/const $o=[["path",{d:"M12 5a3 3 0 1 1 3 3m-3-3a3 3 0 1 0-3 3m3-3v1M9 8a3 3 0 1 0 3 3M9 8h1m5 0a3 3 0 1 1-3 3m3-3h-1m-2 3v-1",key:"3pnvol"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["path",{d:"M12 10v12",key:"6ubwww"}],["path",{d:"M12 22c4.2 0 7-1.667 7-5-4.2 0-7 1.667-7 5Z",key:"9hd38g"}],["path",{d:"M12 22c-4.2 0-7-1.667-7-5 4.2 0 7 1.667 7 5Z",key:"ufn41s"}]],Po=P("flower-2",$o);/**
|
|
122
|
-
* @license lucide-react v0.507.0 - ISC
|
|
123
|
-
*
|
|
124
|
-
* This source code is licensed under the ISC license.
|
|
125
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
126
|
-
*/const Uo=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 16.5A4.5 4.5 0 1 1 7.5 12 4.5 4.5 0 1 1 12 7.5a4.5 4.5 0 1 1 4.5 4.5 4.5 4.5 0 1 1-4.5 4.5",key:"14wa3c"}],["path",{d:"M12 7.5V9",key:"1oy5b0"}],["path",{d:"M7.5 12H9",key:"eltsq1"}],["path",{d:"M16.5 12H15",key:"vk5kw4"}],["path",{d:"M12 16.5V15",key:"k7eayi"}],["path",{d:"m8 8 1.88 1.88",key:"nxy4qf"}],["path",{d:"M14.12 9.88 16 8",key:"1lst6k"}],["path",{d:"m8 16 1.88-1.88",key:"h2eex1"}],["path",{d:"M14.12 14.12 16 16",key:"uqkrx3"}]],Ko=P("flower",Uo);/**
|
|
127
|
-
* @license lucide-react v0.507.0 - ISC
|
|
128
|
-
*
|
|
129
|
-
* This source code is licensed under the ISC license.
|
|
130
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
131
|
-
*/const Bo=[["path",{d:"M9 10h.01",key:"qbtxuw"}],["path",{d:"M15 10h.01",key:"1qmjsl"}],["path",{d:"M12 2a8 8 0 0 0-8 8v12l3-3 2.5 2.5L12 19l2.5 2.5L17 19l3 3V10a8 8 0 0 0-8-8z",key:"uwwb07"}]],qo=P("ghost",Bo);/**
|
|
132
|
-
* @license lucide-react v0.507.0 - ISC
|
|
133
|
-
*
|
|
134
|
-
* This source code is licensed under the ISC license.
|
|
135
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
136
|
-
*/const Vo=[["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"}]],Ho=P("github",Vo);/**
|
|
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 Go=[["path",{d:"m11.9 12.1 4.514-4.514",key:"109xqo"}],["path",{d:"M20.1 2.3a1 1 0 0 0-1.4 0l-1.114 1.114A2 2 0 0 0 17 4.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 17.828 7h1.344a2 2 0 0 0 1.414-.586L21.7 5.3a1 1 0 0 0 0-1.4z",key:"txyc8t"}],["path",{d:"m6 16 2 2",key:"16qmzd"}],["path",{d:"M8.23 9.85A3 3 0 0 1 11 8a5 5 0 0 1 5 5 3 3 0 0 1-1.85 2.77l-.92.38A2 2 0 0 0 12 18a4 4 0 0 1-4 4 6 6 0 0 1-6-6 4 4 0 0 1 4-4 2 2 0 0 0 1.85-1.23z",key:"1de1vg"}]],Wo=P("guitar",Go);/**
|
|
142
|
-
* @license lucide-react v0.507.0 - ISC
|
|
143
|
-
*
|
|
144
|
-
* This source code is licensed under the ISC license.
|
|
145
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
146
|
-
*/const Qo=[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}]],Yo=P("hexagon",Qo);/**
|
|
147
|
-
* @license lucide-react v0.507.0 - ISC
|
|
148
|
-
*
|
|
149
|
-
* This source code is licensed under the ISC license.
|
|
150
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
151
|
-
*/const Zo=[["path",{d:"M12 17c5 0 8-2.69 8-6H4c0 3.31 3 6 8 6m-4 4h8m-4-3v3M5.14 11a3.5 3.5 0 1 1 6.71 0",key:"1uxfcu"}],["path",{d:"M12.14 11a3.5 3.5 0 1 1 6.71 0",key:"4k3m1s"}],["path",{d:"M15.5 6.5a3.5 3.5 0 1 0-7 0",key:"zmuahr"}]],Jo=P("ice-cream-bowl",Zo);/**
|
|
152
|
-
* @license lucide-react v0.507.0 - ISC
|
|
153
|
-
*
|
|
154
|
-
* This source code is licensed under the ISC license.
|
|
155
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
156
|
-
*/const Xo=[["path",{d:"M21 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-2Z",key:"jg2n2t"}],["path",{d:"M6 15v-2",key:"gd6mvg"}],["path",{d:"M12 15V9",key:"8c7uyn"}],["circle",{cx:"12",cy:"6",r:"3",key:"1gm2ql"}]],el=P("joystick",Xo);/**
|
|
157
|
-
* @license lucide-react v0.507.0 - ISC
|
|
158
|
-
*
|
|
159
|
-
* This source code is licensed under the ISC license.
|
|
160
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
161
|
-
*/const tl=[["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"}]],nl=P("leaf",tl);/**
|
|
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 sl=[["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"}]],al=P("lightbulb",sl);/**
|
|
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 il=[["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"}]],rl=P("milk",il);/**
|
|
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 ol=[["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"}]],ll=P("moon-star",ol);/**
|
|
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 cl=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],dl=P("moon",cl);/**
|
|
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 ul=[["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"}]],gl=P("mountain-snow",ul);/**
|
|
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 ml=[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]],pl=P("mountain",ml);/**
|
|
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 fl=[["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"}]],_l=P("radio",fl);/**
|
|
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 hl=[["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"}]],xl=P("sailboat",hl);/**
|
|
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 yl=[["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"}]],vl=P("shirt",yl);/**
|
|
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 bl=[["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"}]],kl=P("skull",bl);/**
|
|
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 jl=[["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"}]],wl=P("snowflake",jl);/**
|
|
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 Nl=[["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"}]],Sl=P("sparkle",Nl);/**
|
|
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 Ml=[["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"}]],Cl=P("sun-dim",Ml);/**
|
|
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 El=[["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"}]],Al=P("sun",El);/**
|
|
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 Il=[["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"}]],Rl=P("sunrise",Il);/**
|
|
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 Tl=[["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"}]],Ll=P("sunset",Tl);/**
|
|
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 Ol=[["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"}]],Fl=P("tent",Ol);/**
|
|
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 Dl=[["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"}]],zl=P("tree-deciduous",Dl);/**
|
|
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 $l=[["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"}]],Pl=P("tree-palm",$l);/**
|
|
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 Ul=[["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"}]],Kl=P("tree-pine",Ul);/**
|
|
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 Bl=[["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"}]],ql=P("trees",Bl);/**
|
|
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 Vl=[["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"}]],Hl=P("umbrella",Vl);/**
|
|
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 Gl=[["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"}]],Wl=P("waves",Gl);/**
|
|
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 Ql=[["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"}]],Yl=P("wheat",Ql);/**
|
|
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 Zl=[["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"}]],Jl=P("wind",Zl),Xl=({appVersion:e=null,slowWaitHintMs:s})=>{ie();const a="https://local-operator.com/download",[i,r]=o.useState(!1),l=Hs(i,s??Qi),[c,u]=o.useState(!1),[d,g]=o.useState(null),[p,f]=o.useState("info"),[h,x]=o.useState(null),[v,b]=o.useState(null),j=e?.trim()?e.trim():null,L=o.useRef(!1),C=ln(z=>z.openDetail),I=o.useRef(!1),N=o.useRef(0),S=o.useRef(!1),M=o.useCallback((z,V)=>{I.current=!1,g(z),f(V),u(!0)},[]),H=o.useCallback(z=>{I.current=!0,g(z),f("success"),u(!0)},[]),G=o.useCallback(()=>{I.current&&(I.current=!1,u(!1),g(null))},[]),{clearDeferredUpdate:O}=La();o.useEffect(()=>{const z=window.api.updater.onUpdateError(m=>{L.current&&m.includes("manually")&&(x({message:n("ui.common.updates.check_for_updates_button.the_server_is_installed_outside_the_app_so_use_the_tool_you_insta"),command:""}),I.current=!1,g(null),f("warning"),u(!0))}),V=window.api.updater.onBackendUpdateDevMode(m=>{L.current&&M(m,"info")}),Q=()=>{S.current=!0,G()},B=window.api.updater.onUpdateAvailable(Q),W=window.api.updater.onUpdateNpxAvailable(Q),te=window.api.updater.onBackendUpdateAvailable(Q);return()=>{z(),V(),B(),W(),te()}},[G,M]),o.useEffect(()=>{let z=!1;const V=()=>{window.api.updater.getLastInstallAttempt().then(B=>{z||b(B)}).catch(()=>{})};V();const Q=window.api.updater.onUpdateInstallFailed(()=>V());return()=>{z=!0,Q()}},[]);const K=async()=>{const z=++N.current;G(),S.current=!1;try{r(!0),L.current=!0,O($e.UI),O($e.BACKEND);const V=await window.api.updater.checkForAllUpdates({manual:!0});if(z!==N.current)return;V.app==="available"&&C($e.UI),V.server==="available"&&C($e.BACKEND),V?.affirmation&&!S.current?H(V.affirmation):G()}catch(V){if(z!==N.current)return;console.warn(`Update check failed; the app-level alert owns the report: ${Yi(V)}`)}finally{z===N.current&&r(!1),setTimeout(()=>{L.current=!1},2e3)}},q=()=>{I.current=!1,u(!1),g(null)};return t.jsxs(t.Fragment,{children:[v&&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"),v.targetVersion," ",n("ui.common.updates.check_for_updates_button.didn_t_finish"),v.attempts>1?n("ui.common.updates.check_for_updates_button.detail",{attempts:v.attempts,attemptsText:String(v.attempts)}):"",".",j?n("ui.common.updates.check_for_updates_button.version",{liveversion:String(j)}):null]}),t.jsxs("p",{className:"mt-1 text-meta text-ink-dim",children:[n("ui.common.updates.check_for_updates_button.detected")," ",v.detectedAt?new Date(v.detectedAt).toLocaleString():n("ui.common.updates.check_for_updates_button.at_an_unknown_time"),". ",v.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 K(),disabled:i,children:[i?t.jsx(Me,{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")}),h&&t.jsxs(Bn,{open:c,autoHideDuration:1e4,onClose:q,variant:"warning",children:[t.jsx("p",{className:"text-body-sm",children:h.message}),h.command&&t.jsx("code",{className:"mt-2 block rounded-sm bg-sunken p-2 text-mono-sm text-ink",children:h.command})]}),d&&p!=="danger"&&t.jsx(Bn,{open:c,autoHideDuration:6e3,onClose:q,variant:p,children:d})]})},Rt=["system-prompt"],ec=()=>{const{shouldEnableQuery:e}=Oa();return Ee({enabled:e({bypassInternetCheck:!0}),queryKey:Rt,queryFn:async()=>{try{const a=await As(kn.baseUrl).config.getSystemPrompt();if(a===null)return null;if(a.status>=400)throw new Error(a.message||n("ui.common.errors.system_prompt_fetch"));return a.result}catch(s){const a=s instanceof Error?s.message:n("ui.common.errors.system_prompt_fetch_unknown");throw Is(a),s}},refetchOnWindowFocus:!1,staleTime:5e3})},tc=()=>{const e=ut(),s=As(kn.baseUrl);return Fa({mutationFn:async a=>{try{const i=await s.config.updateSystemPrompt(a);if(i.status>=400)throw new Error(i.message||n("ui.common.errors.system_prompt_update"));return i.result}catch(i){const r=i instanceof Error?i.message:n("ui.common.errors.system_prompt_update_unknown");throw Is(r),i}},onSuccess:async a=>{await e.invalidateQueries({queryKey:Rt,refetchType:"none"}),e.setQueryData(Rt,i=>i&&{...i,...a}),await e.refetchQueries({queryKey:Rt,type:"all"}),Da(n("ui.notices.settings.system_prompt_updated"))},onError:a=>{console.error("Error updating system prompt:",a)}})},Xs=({searchRow:e,value:s,label:a,description:i,onChange:r,icon:l,isSaving:c=!1,disabled:u=!1})=>{ie();const[d,g]=o.useState(s),p=o.useId(),f=`${p}-label`,h=`${p}-description`,x=async v=>{if(!(c||u)){g(v);try{await r(v)}catch(b){g(!v),console.error("Error toggling setting:",b)}}};return t.jsxs("div",{"data-search-row":e,"data-search-control":e?"":void 0,className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("span",{id:f,"data-search-label":"",className:"flex min-h-6 items-center gap-2 text-body text-ink",children:[l&&t.jsx(l,{size:14,"aria-hidden":"true",className:"shrink-0 text-ink-dim"}),a]}),i&&t.jsx("p",{id:h,className:"mt-0.5 max-w-2xl text-body-sm text-ink-muted",children:i})]}),t.jsx("div",{className:"flex h-6 shrink-0 items-center",children:c?t.jsx(Me,{size:"md",label:n("ui.common.forms.toggle_setting.saving",{label:a})}):t.jsx(Qs,{checked:d,onCheckedChange:x,disabled:u,"aria-labelledby":f,"aria-describedby":i?h:void 0})})]})};function Jn(e,s){const a=Hr(e,s?.in);if(!Br(a))throw new RangeError("Invalid time value");const i=Pe(a.getDate(),2),r=Pe(a.getMonth()+1,2),l=a.getFullYear(),c=Pe(a.getHours(),2),u=Pe(a.getMinutes(),2),d=Pe(a.getSeconds(),2);let g="",p="";const f=a.getTimezoneOffset();if(f!==0){const h=Math.abs(f),x=Pe(Math.trunc(h/60),2),v=Pe(h%60,2);p=`${f<0?"+":"-"}${x}:${v}`}else p="Z";return`${l}-${r}-${i}T${c}:${u}:${d}${g}${p}`}function nc(e,s,a){return qr(e,-30,a)}var sc=za({chartName:"LineChart",GraphicalChild:Rs,axisComponents:[{axisType:"xAxis",AxisComp:$a},{axisType:"yAxis",AxisComp:Pa}],formatAxisMap:Ua});const ac=["radient","creditBalance"],ic=e=>{const{user:s,isAuthenticated:a}=jn(),i=s?.account?.tenant_id,r=a&&!!i&&e?.enabled;return Ee({queryKey:[ac,i],queryFn:async()=>{if(!i)throw new Error(n("ui.common.errors.tenant_missing"));const l=await Ts({operation:"credits",tenantId:i});if(!l||typeof l.balance!="number")throw new Error(n("ui.common.errors.credit_balance_invalid"));return l},enabled:r,staleTime:5*60*1e3,refetchOnWindowFocus:!0})},rc=["radient","usageRollup"],oc=(e,s)=>{const{user:a,isAuthenticated:i}=jn(),r=a?.account?.tenant_id,l=i&&!!r&&s?.enabled;return Ee({queryKey:[...rc,r,e],queryFn:async()=>{if(!r)throw new Error(n("ui.common.errors.tenant_missing"));const c={};for(const[d,g]of Object.entries(e))g!=null&&(c[d]=String(g));const u=await Ts({operation:"usage",tenantId:r,query:c});if(!u)throw new Error(n("ui.common.errors.usage_rollup_invalid"));return u},enabled:l,staleTime:5*60*1e3,refetchOnWindowFocus:!0})},lc=e=>e==="sidebars"?n("ui.settings.appearance.window_glass.coverage_sidebars"):n("ui.settings.appearance.window_glass.coverage_full"),cc=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")}},dc=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")}},Xn=({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($t,{value:a,onValueChange:i,children:t.jsx(Pt,{"aria-labelledby":l,children:r.map(c=>t.jsx(Ve,{value:c.value,children:c.label},c.value))})})})]})},uc=({state:e,onChange:s,searchRow:a})=>{ie();const i=o.useId(),r=`${i}-description`,[l,c]=o.useState(null),u=o.useRef(!1),d=o.useRef(null),g=e?.settings.intensity??0;if(!e)return null;const p=!e.capability.supported,f=p?dc(e.capability.reason):null,h=async b=>{if(u.current){d.current=b;return}u.current=!0;try{await s({intensity:b})}finally{u.current=!1;const j=d.current;d.current=null,j!==null&&j!==b?h(j):c(null)}},x=e.settings.enabled,v=l??g;return t.jsxs("div",{"data-search-row":a,"data-search-control":a?"":void 0,className:"flex flex-col gap-4","data-window-glass":"","data-glass-gate":e.capability.reason,children:[t.jsx(Ye,{content:f,disabled:!p,children:t.jsx("div",{className:p?"opacity-60":void 0,children:t.jsx(Xs,{value:p?!1:x,disabled:p,label:n("ui.settings.appearance.window_glass.label"),description:n("ui.settings.appearance.window_glass.description"),onChange:async b=>s({enabled:b})},p?"unavailable":"available")})}),f&&t.jsx("p",{"data-glass-unsupported":e.capability.reason,className:"max-w-2xl text-body-sm text-ink-muted",children:f}),e.restartRequired&&t.jsx("output",{className:"block max-w-2xl text-body-sm text-ink","data-glass-restart":"",children:n("ui.settings.appearance.window_glass.restart_needed")}),x&&!p&&t.jsxs(t.Fragment,{children:[t.jsx(Xn,{label:n("ui.settings.appearance.window_glass.coverage_label"),description:n("ui.settings.appearance.window_glass.coverage_description"),value:e.settings.coverage,onValueChange:b=>void s({coverage:b}),options:Ka.map(b=>({value:b,label:lc(b)}))}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex min-h-6 items-center justify-between gap-3",children:[t.jsx("label",{htmlFor:i,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(v)})})]}),t.jsx("p",{id:r,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:i,type:"range",min:0,max:100,step:5,value:v,"aria-describedby":r,"aria-valuetext":n("ui.settings.appearance.window_glass.intensity_value",{value:String(v)}),onChange:b=>{const j=Number(b.target.value);c(j),h(j)},style:{"--fill":`${v}%`},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(Xn,{label:n("ui.settings.appearance.window_glass.material_label"),description:n("ui.settings.appearance.window_glass.material_description"),value:e.settings.material,onValueChange:b=>void s({material:b}),options:e.capability.materials.map(b=>({value:b,label:cc(b)}))})]})]})},gc=new Set(["B","C","D","E","F"]);function mc(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&&gc.has(s.surface_state)?"visible":"absent":r&&i?"visible":a&&i?"error":"absent"}function pc(e,s){return e!=="absent"}function nt(e,s){if(e.surface_state==="F")return"F";const a=s.endpoint;return a?a.state==="paused"?"D":a.state==="disabled"?"E":"C":"B"}const fc="open_chief_of_staff";function _c(e){const s=e?.delivery_hold;if(!s||s.code!==fc||s.count<=0)return null;const a=s.session||e?.local.session||null;return{count:s.count,sessionId:a}}function ea(e){return Ri(e)}function hc(e){return e.target.endpoint_id?{kind:"endpoint",id:e.target.endpoint_id}:{kind:"account",id:e.target.account_id??""}}function _n(e){return e.map((s,a)=>{const i=hc(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 hn(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 ta(e){return JSON.stringify(e)}function xc(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"}:ta(hn(e.entries,e.modes))===e.savedSignature?{disabled:!0,reason:"unchanged"}:{disabled:!1}}const yc=/^[^\s\p{Cc}]{1,128}$/u;function vc(e){return e===""?n("ui.agentMessages.settings.allowlist.identifier_empty"):e.length>128?n("ui.agentMessages.settings.allowlist.identifier_long"):yc.test(e)?null:n("ui.agentMessages.settings.allowlist.identifier_invalid")}function Tt(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 bc=['[data-agent-messages-action="turn_on_again"]','[role="switch"]','[data-agent-messages-action="enable"]'],Yt="__none__";function kc({availability:e,status:s,accountId:a,refusal:i=null,api:r=Ji,onRefreshStatus:l,sessions:c=[],onOpenSession:u,focus:d=!1,focusNonce:g}){ie();const[p,f]=o.useState({kind:"loading"}),[h,x]=o.useState(0),[v,b]=o.useState(null),[j,L]=o.useState(null),[C,I]=o.useState(s?.local.enabled??!1),[N,S]=o.useState(s?.local.session??""),M=s?.tenant_id??void 0,H=e==="visible",G=s?.account_id??null,O=G!==null&&G===a;o.useEffect(()=>{if(!H)return;let m=!1;return f({kind:"loading"}),L(null),(async()=>{try{const k=await r.settings(M);if(m)return;if(!k){f({kind:"error",refusal:{code:"invalid_response",message:n("ui.agentMessages.settings.error.unreadable")}});return}let y=null;if(k.endpoint){if(y=await r.allowlist(k.settings.tenant_id),m)return;if(!y){f({kind:"error",refusal:{code:"invalid_response",message:n("ui.agentMessages.settings.error.unreadable")}});return}}f({kind:"ready",settings:k,allowlist:y})}catch(k){if(m)return;f({kind:"error",refusal:Oe(k)})}})(),()=>{m=!0}},[H,a,G,M,h,r]),o.useEffect(()=>{if(!H||p.kind!=="ready"||!p.settings.endpoint||p.allowlist)return;let m=!1;return(async()=>{try{const k=await r.allowlist(p.settings.settings.tenant_id);if(m||!k)return;f(y=>y.kind==="ready"&&!y.allowlist?{...y,allowlist:k}:y)}catch(k){m||L(Oe(k))}})(),()=>{m=!0}},[H,p,r]),o.useEffect(()=>{s&&(I(s.local.enabled),S(s.local.session))},[s]);const K=()=>x(m=>m+1),q=p.kind==="ready"?p.settings:null,z=Ir(s,q,G),V=Rr({api:r,accountId:O?G:null,tenantId:q?.settings.tenant_id??null,markerTenantId:s?.tenant_id??null,onSettings:m=>f(k=>k.kind==="ready"?{...k,settings:m}:k),onChanged:()=>l(!0)}),Q=o.useRef(null),B=o.useRef(!1),W=o.useRef(g);if(o.useEffect(()=>{g!==W.current&&(W.current=g,B.current=!1)},[g]),o.useEffect(()=>{if(!d){B.current=!1;return}if(B.current||p.kind!=="ready"||v!==null)return;const m=Q.current,k=bc.map(y=>m?.querySelector(`${y}:not(:disabled)`)).find(y=>y!=null);k&&(k.focus(),B.current=!0)},[d,g,p,v,s]),e==="absent")return null;if(e==="dark")return t.jsxs("div",{"data-agent-messages-section":"",className:"flex flex-col gap-2",children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.agentMessages.settings.dark.title")}),t.jsx("p",{className:"max-w-2xl text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.dark.body")}),t.jsx("p",{className:"max-w-2xl text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.dark.nothing_enabled")})]});if(e==="error")return t.jsx("div",{"data-agent-messages-section":"",children:t.jsxs(le,{variant:"warning",children:[t.jsx(Ut,{children:n("ui.agentMessages.settings.error.title")}),t.jsxs(Re,{children:[i?Tt(i):n("ui.agentMessages.settings.refusal.generic"),t.jsx(F,{className:"mt-3",variant:"secondary",onClick:()=>{K(),l(!0)},children:n("ui.agentMessages.settings.error.retry")})]})]})});if(!s||!a)return null;const te=_c(s);return t.jsxs("div",{ref:Q,"data-agent-messages-section":"",className:"flex flex-col gap-6",children:[te&&t.jsx(wc,{count:te.count,onMessage:te.sessionId&&u?()=>u(te.sessionId):void 0}),z&&t.jsx(Tr,{consentText:Ti(s,q),pending:V.pending,failure:V.failure,onTurnOff:()=>void V.turnOff(),onDismiss:()=>void V.dismiss()}),j&&t.jsx(le,{variant:"warning",children:t.jsx(Re,{children:Tt(j)})}),p.kind==="loading"&&t.jsx(jc,{}),p.kind==="error"&&t.jsxs(le,{variant:"warning",children:[t.jsx(Ut,{children:n("ui.agentMessages.settings.error.title")}),t.jsxs(Re,{children:[p.refusal.code!=="client_unavailable"&&t.jsx("span",{className:"block",children:Tt(p.refusal)}),t.jsx("span",{className:"block",children:n("ui.agentMessages.settings.error.no_changes")}),t.jsx(F,{className:"mt-3",variant:"secondary",onClick:K,children:n("ui.agentMessages.settings.error.retry")})]})]}),p.kind==="ready"&&t.jsxs(t.Fragment,{children:[t.jsx(Mc,{state:nt(s,p.settings),status:s,settings:p.settings,accountId:G??a,accountMatches:O,api:r,pending:v,localEnabled:C,onActionRefusal:L,onSettings:m=>f(k=>k.kind==="ready"?{...k,settings:m}:k),onLocalEnabled:I,onRefreshStatus:l,setPending:b}),t.jsx(Ec,{value:N,sessions:c,pending:v==="session",disabled:v!==null,onSave:async m=>{b("session"),L(null);try{await r.localSetting("team_bridge.session",m),S(m),await l(!0)}catch(k){L(Oe(k))}finally{b(null)}}}),p.allowlist&&(nt(s,p.settings)==="C"||nt(s,p.settings)==="D"||nt(s,p.settings)==="F")&&t.jsx(Ac,{allowlist:p.allowlist,accountId:G??a,accountMatches:O,readOnly:s.read_only===!0&&nt(s,p.settings)==="F",pending:v!==null,onSaving:m=>b(m?"allowlist":null),onRefusal:L,onSaved:m=>f(k=>k.kind==="ready"?{...k,allowlist:m}:k),api:r},p.allowlist.view.tenant_id??"tenant")]})]})}function jc(){return t.jsxs("div",{className:"flex flex-col gap-3","aria-busy":"true",children:[t.jsx(Se,{className:"h-5 w-40"}),t.jsx(Se,{className:"h-4 w-full max-w-xl"}),t.jsx(Se,{className:"h-9 w-36"}),t.jsx(Se,{className:"h-4 w-64"})]})}const wc=({count:e,onMessage:s})=>t.jsx("output",{className:"block","data-agent-messages-hold":"open_chief_of_staff",children:t.jsx(le,{variant:"info",className:fe(Xi,"border-transparent"),children:t.jsxs("div",{className:"flex w-full min-w-0 items-center gap-3",children:[t.jsx("p",{className:"min-w-0 flex-1 text-body-sm text-ink",children:s?n("ui.agentMessages.settings.hold.chief_of_staff",{count:e}):n("ui.agentMessages.settings.hold.chief_of_staff_unlinked",{count:e})}),s&&t.jsx(F,{variant:"ghost",size:"sm",className:"shrink-0 text-ink",onClick:s,children:n("ui.agentMessages.settings.hold.open")})]})})}),es=({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})}),na={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"},sa={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"};function Nc(e){return e==="B"?"ui.agentMessages.settings.default_on.b_title":na[e]}function Sc(e){return e==="B"?"ui.agentMessages.settings.default_on.b_body":e==="E"?"ui.agentMessages.settings.default_on.e_body":sa[e]}const Mc=({state:e,status:s,settings:a,accountId:i,accountMatches:r,api:l,pending:c,localEnabled:u,onActionRefusal:d,onSettings:g,onLocalEnabled:p,onRefreshStatus:f,setPending:h})=>{const x=ea(s),v=a.settings.tenant_id,b=c!==null||!r,j=Li(s);async function L(M,H={}){if(!r)return null;h(M),d(null);try{const G=await l.updateSettings({expected_account_id:i,tenant_id:v,state:M,...H});if(g(G),M==="disabled"&&!j)try{await l.localSetting("team_bridge.enabled",!1),p(!1)}catch(O){d(Oe(O))}return G}catch(G){const O=Oe(G);return d(O),O.code==="consent_version_unknown"&&await f(!0),null}finally{h(null)}}async function C(){if(!(!x||!r||!await L("active",{consent_version:x.version,consented_via:"settings"}))){h("local");try{await l.localSetting("team_bridge.enabled",!0),p(!0),await f(!0)}catch(H){d(Oe(H))}finally{h(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(Zt,{settings:a,status:s,readOnly:!0}),t.jsx(Jt,{searchRow:"agent-messages.enabled",searchTerms:"team bridge team_bridge enabled devices",value:u,disabled:b,description:n("ui.agentMessages.settings.local.stays_enrolled"),onChange:async M=>{h("local"),d(null);try{await l.localSetting("team_bridge.enabled",M),p(M),await f(!0)}catch(H){d(Oe(H))}finally{h(null)}}})]});const I=a.endpoint?.label?.trim(),N=a.endpoint?.consent??null,S=N!==null&&!N.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(j?Nc(e):na[e])}),I&&t.jsx("span",{className:"text-body-sm text-ink-muted",children:I})]}),t.jsx("p",{className:"max-w-2xl text-body-sm text-ink-muted",children:n(j?Sc(e):sa[e])}),j&&e==="E"&&t.jsxs("div",{className:"flex flex-col gap-3",children:[x?t.jsx(es,{text:x.text}):t.jsx(le,{variant:"warning",children:t.jsx(Re,{children:n("ui.agentMessages.settings.consent.unavailable")})}),t.jsx("div",{className:"flex flex-wrap items-center gap-3",children:t.jsx(F,{"data-agent-messages-action":"turn_on_again","data-search-row":"agent-messages.enabled","data-search-control":!0,onClick:()=>void C(),disabled:b||!x,children:n("ui.agentMessages.settings.action.turn_on_again")})})]}),!j&&(e==="B"||e==="E")&&t.jsxs("div",{className:"flex flex-col gap-3",children:[x?t.jsx(es,{text:x.text}):t.jsx(le,{variant:"warning",children:t.jsx(Re,{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","data-search-row":"agent-messages.enabled","data-search-control":!0,onClick:()=>void C(),disabled:b||!x,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 L("paused"),children:n("ui.agentMessages.settings.action.pause")}),t.jsx(F,{"data-agent-messages-action":"turn_off",variant:"secondary",disabled:b,onClick:()=>void L("disabled"),children:n("ui.agentMessages.settings.action.turn_off")})]}),t.jsx(Zt,{settings:a,status:s}),S&&!j&&t.jsx(ts,{onRenew:()=>void C(),disabled:b||!x}),t.jsx(Jt,{searchRow:"agent-messages.enabled",searchTerms:"team bridge team_bridge enabled devices",value:u,disabled:b,description:n("ui.agentMessages.settings.local.stays_enrolled"),onChange:async M=>{h("local"),d(null);try{await l.localSetting("team_bridge.enabled",M),p(M),await f(!0)}catch(H){d(Oe(H))}finally{h(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&&x===null,onClick:()=>void L("active",a.settings.consent_required&&x?{consent_version:x.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 L("disabled"),children:n("ui.agentMessages.settings.action.turn_off")})]}),a.settings.consent_required&&!x&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.consent.unavailable")}),t.jsx(Zt,{settings:a,status:s}),S&&!j&&t.jsx(ts,{onRenew:()=>void C(),disabled:b||!x}),t.jsx(Jt,{searchRow:"agent-messages.enabled",searchTerms:"team bridge team_bridge enabled devices",value:u,disabled:b,description:n("ui.agentMessages.settings.local.stays_enrolled"),onChange:async M=>{h("local"),d(null);try{await l.localSetting("team_bridge.enabled",M),p(M),await f(!0)}catch(H){d(Oe(H))}finally{h(null)}}})]})]})},ts=({onRenew:e,disabled:s})=>t.jsx(le,{variant:"warning",children:t.jsxs(Re,{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")})]})});function Cc(e){switch(e){case"dialog":return n("ui.agentMessages.settings.consent.via_dialog");case"settings":return n("ui.agentMessages.settings.consent.via_settings");case"default_on":return n("ui.agentMessages.settings.consent.via_default_on");default:return e}}const Zt=({settings:e,status:s,readOnly:a=!1})=>{const i=e.endpoint?.consent??null,r=ea(s);return i?t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsxs(mt,{children:[t.jsx(he,{label:n("ui.agentMessages.settings.consent.version"),value:i.version}),t.jsx(he,{label:n("ui.agentMessages.settings.consent.via"),value:Cc(i.consented_via)}),t.jsx(he,{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")})},Jt=({value:e,disabled:s,description:a,onChange:i,searchRow:r,searchTerms:l})=>{const c=o.useId();return t.jsxs("div",{"data-search-row":r,"data-search-control":r?"":void 0,"data-search-terms":l,className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{id:c,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(Qs,{"aria-labelledby":c,checked:e,disabled:s,onCheckedChange:u=>void i(u)})]})},Ec=({value:e,sessions:s,pending:a,disabled:i,onSave:r})=>{const l=s.some(c=>c.session_id===e);return t.jsxs("div",{"data-search-row":"agent-messages.session","data-search-control":!0,"data-search-terms":"team bridge team_bridge session",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(Cn,{value:e===""?Yt:e,disabled:i,onValueChange:c=>void r(c===Yt?"":c),children:[t.jsx(En,{className:"w-full max-w-md","aria-label":n("ui.agentMessages.settings.session.title"),children:t.jsx(An,{})}),t.jsxs(In,{children:[t.jsx(We,{value:Yt,children:n("ui.agentMessages.settings.session.none")}),s.map(c=>t.jsx(We,{value:c.session_id,children:c.title?.trim()||c.session_id},c.session_id)),e!==""&&!l&&t.jsx(We,{value:e,children:e})]})]}),e!==""&&!l&&t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.session.unavailable")}),a&&t.jsx("p",{className:"text-meta text-ink-dim","aria-live":"polite",children:n("ui.agentMessages.settings.saving")})]})},Ac=({allowlist:e,accountId:s,accountMatches:a,readOnly:i,pending:r,api:l,onSaving:c,onRefusal:u,onSaved:d})=>{const[g,p]=o.useState(()=>_n(e.allowlist.entries)),[f,h]=o.useState(()=>({send:e.view.directions.send.mode,receive:e.view.directions.receive.mode})),x=r||i||!a,v=ta(hn(Ic(e),Rc(e))),b=xc({entries:g,modes:f,savedSignature:v,saving:r}),j=o.useRef(0),L=N=>p(S=>[...S,{...N,key:`${N.direction}:${N.effect}:${j.current++}`}]),C=N=>p(S=>S.filter(M=>M.key!==N)),I=async()=>{if(!x){c(!0),u(null);try{const N=await l.updateAllowlist({expected_account_id:s,tenant_id:e.allowlist.tenant_id,entries:hn(g,f)}),S=_n(N.allowlist.entries);p(S),h({send:N.view.directions.send.mode,receive:N.view.directions.receive.mode}),d(N)}catch(N){u(Oe(N))}finally{c(!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(ns,{direction:"receive",title:n("ui.agentMessages.settings.allowlist.receive"),mode:f.receive,cues:e.view.cues,entries:g.filter(N=>N.direction==="receive"),disabled:x,onMode:N=>h(S=>({...S,receive:N})),onAdd:N=>L({...N,direction:"receive"}),onRemove:C}),t.jsx(ns,{direction:"send",title:n("ui.agentMessages.settings.allowlist.send"),mode:f.send,cues:e.view.cues,entries:g.filter(N=>N.direction==="send"),disabled:x,onMode:N=>h(S=>({...S,send:N})),onAdd:N=>L({...N,direction:"send"}),onRemove:C}),t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsxs(F,{onClick:()=>void I(),disabled:b.disabled||x,children:[t.jsx(Ws,{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 Ic(e){return _n(e.allowlist.entries)}function Rc(e){return{send:e.view.directions.send.mode,receive:e.view.directions.receive.mode}}const ns=({direction:e,title:s,mode:a,cues:i,entries:r,disabled:l,onMode:c,onAdd:u,onRemove:d})=>{const g=r.filter(f=>f.effect==="allow"),p=r.filter(f=>f.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(Tc,{mode:a,disabled:l,onMode:c}),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(f=>t.jsx(ss,{entry:f,disabled:l,onRemove:()=>d(f.key)},f.key)),t.jsx(as,{label:n("ui.agentMessages.settings.allowlist.add_allowed"),disabled:l,onAdd:f=>u({...f,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")}),p.length===0&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.allowlist.blocked_empty")}),p.map(f=>t.jsx(ss,{entry:f,disabled:l,onRemove:()=>d(f.key)},f.key)),t.jsx(as,{label:n("ui.agentMessages.settings.allowlist.add_blocked"),disabled:l,onAdd:f=>u({...f,effect:"deny"})})]})]})},Tc=({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:fe(e===r.value&&"bg-surface text-ink hover:bg-surface"),children:r.label},r.value))})]})},ss=({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")})]}),as=({label:e,disabled:s,onAdd:a})=>{const[i,r]=o.useState("endpoint"),[l,c]=o.useState(""),[u,d]=o.useState(null),g=o.useId(),p=`${g}-help`,f=()=>{const h=vc(l.trim());d(h),!h&&(a({kind:i,id:l.trim()}),c(""))};return t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Te,{htmlFor:g,children:e}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs(Cn,{value:i,disabled:s,onValueChange:h=>r(h),children:[t.jsx(En,{className:"w-32","aria-label":n("ui.agentMessages.settings.allowlist.kind"),children:t.jsx(An,{})}),t.jsxs(In,{children:[t.jsx(We,{value:"endpoint",children:n("ui.agentMessages.settings.allowlist.kind_agent")}),t.jsx(We,{value:"account",children:n("ui.agentMessages.settings.allowlist.kind_person")})]})]}),t.jsx(Le,{id:g,"aria-describedby":p,className:"max-w-xs",value:l,disabled:s,placeholder:n("ui.agentMessages.settings.allowlist.identifier"),onChange:h=>c(h.target.value),onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),f())}}),t.jsx(F,{variant:"secondary",size:"sm",disabled:s,onClick:f,children:n("ui.agentMessages.settings.allowlist.add")})]}),t.jsx("p",{id:p,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 Lc(){const{snapshot:e}=Gs(),[s,a]=o.useState(!1),i=mc({status:e.status,refused:e.refusal!==null,everVisible:s,checking:e.checking});return o.useEffect(()=>{i!=="absent"&&a(!0)},[i]),o.useEffect(()=>{Zi()},[]),i}function Tn(e){const s=a=>typeof a=="string"?lt(a):lt((a??[]).join(" "));return{label:s(e.label),synonym:s(e.synonym),key:s(e.key),choice:s(e.choice),section:s(e.section),description:s(e.description)}}function Oc(e){const s=new Map;for(const a of e??[])s.set(a.name,{label:a.title||a.name,folded:lt([a.title,a.name].join(" "))});return s}function Fc(e,s={}){if(!e)return[];const{startOrder:a=0,sections:i=[]}=s,r=Oc(e.sections),l=new Map(i.map(c=>[c.id,c.label]));return e.settings.map((c,u)=>{const d=r.get(c.section),g=At(c.key,"backend");return{id:`setting:${c.key}`,source:"registry",label:c.label||c.key,description:c.help??"",sectionId:g,sectionLabel:l.get(g)??"",detail:d?.label??c.section,order:a+u,settingKey:c.key,fields:Tn({label:c.label,synonym:c.synonyms??[],key:c.key,choice:(c.choices??[]).flatMap(p=>[p.label,p.description??""]),section:d?.folded??c.section,description:c.help})}})}function Dc(e,s=0){return e.map((a,i)=>({id:`section:${a.id}`,source:"section",label:a.label,sectionId:a.id,sectionLabel:a.label,order:s+i,fields:Tn({label:a.label})}))}function zc(e){const s=e.getAttribute("data-search-label");if(s?.trim())return s.trim();const a=e.querySelector("[data-search-label]");if(a?.textContent?.trim())return a.textContent.trim();const i=e.querySelector("h2, h3, h4, legend");if(i?.textContent?.trim())return i.textContent.trim();const r=e.getAttribute("aria-label");return r?.trim()?r.trim():((e.firstElementChild??e).textContent??"").trim()}function $c(e){const s=e.replace(/\s+/g," ").trim();if(s.length<=80)return s;const a=s.slice(0,80),i=a.lastIndexOf(" ");return`${(i>40?a.slice(0,i):a).trimEnd()}…`}function Pc(e){return e.closest("[data-search-section]")}function Uc(e,s){const a=(e.textContent??"").trim();if(!s)return a;const i=a.indexOf(s);return i<0?a:`${a.slice(0,i)} ${a.slice(i+s.length)}`.trim()}function Kc(e,s=0){return Array.from(e.querySelectorAll("[data-search-row]")).map((i,r)=>{const l=Pc(i),c=l?.getAttribute("data-search-section")??"",d=(l?.getAttribute("data-search-section-label")?.trim()??"")||l?.querySelector("[data-search-section-label], h2")?.textContent?.trim()||"",g=zc(i),p=i.getAttribute("data-search-terms")??"",f=Uc(i,g);return{id:`page:${i.getAttribute("data-search-row")??r}`,source:"page",label:$c(g),sectionId:c,sectionLabel:d,order:s+r,fields:Tn({label:g,synonym:p,section:[d,c],description:f})}})}function Bc(e){const s=Fc(e.registry,{startOrder:0,sections:e.sections}).filter(i=>!(i.settingKey&&i.settingKey in Ba)),a=[...e.rendered??[]].map((i,r)=>({...i,order:s.length+r}));return[...s,...a,...Dc(e.sections??[],s.length+a.length)]}const qc=12,is="input, textarea, select, button, [role='switch'], [role='tab'], [role='combobox'], [tabindex]";function Vc(e,s){return e.querySelector(`[data-search-row="${CSS.escape(s)}"]`)}function Hc(e){const a=(e.matches("[data-search-control]")?e:null)??e.querySelector("[data-search-control]");return a?a.matches(is)?a:a.querySelector(is)??a:e}function aa(e){return e.isConnected&&e.closest("[hidden]")===null}function Gc(e,s,a={}){const i=a.frames??qc,r=a.paint??Ls;return new Promise(l=>{let c=0;const u=()=>{const d=Vc(e,s);if(d&&aa(d)){const g=Hc(d);g===d&&(d.tabIndex=-1),g.scrollIntoView({block:"center"}),g.focus(),r(d),l("landed");return}if(c+=1,c>=i){l("missing");return}requestAnimationFrame(u)};requestAnimationFrame(u)})}function Wc(e,s,a={}){const i=e.querySelector(`[data-search-section="${CSS.escape(s)}"]`);return!i||!aa(i)?"missing":(i.scrollIntoView({block:"start"}),i.tabIndex<0&&(i.tabIndex=-1),i.focus(),(a.paint??Ls)(i),"landed")}const rs={get[$e.UI](){return n("ui.settings.updates.update_following.application_updates")},get[$e.BACKEND](){return n("ui.settings.updates.update_following.server_updates")}},jt={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")}}},os=({type:e})=>{ie();const s=ln(i=>i.followed[e]),a=ln(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:rs[e]}),t.jsx("div",{className:"mt-0.5 text-meta text-ink-muted",children:jt[s].description})]}),t.jsxs(Cn,{value:s,onValueChange:i=>a(e,i),children:[t.jsx(En,{"aria-label":n("ui.settings.updates.update_following.surface_choice",{surface:rs[e],choice:jt[s].label}),className:"w-full sm:w-56","data-followed-segment":e,children:t.jsx(An,{})}),t.jsx(In,{children:qa.map(i=>t.jsx(We,{value:i,title:jt[i].description,children:jt[i].label},i))})]})]})},Qc=()=>(ie(),t.jsxs("div",{className:fe("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(os,{type:$e.UI}),t.jsx(os,{type:$e.BACKEND})]})]})),Yc=({appVersion:e})=>t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(Qc,{}),t.jsx(Xl,{appVersion:e})]}),Zc=e=>{if(!e)return null;try{return new URL(e).host}catch{return null}},Jc=()=>{ie();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 d=x=>{if(!u)return;const v=Zc(x.url);if(x.state==="connecting"){i({value:"Loading...",detail:null,degraded:!1});return}if(x.state==="detached"){i({value:"Not connected",detail:x.detail||null,degraded:!1});return}if(x.state==="wedged"){i({value:"Not attached",detail:x.detail||null,degraded:!1});return}const b=x.version||"Version unknown";i({value:v?`${b} · ${v}`:b,detail:x.detail||null,degraded:x.state==="degraded"})};let g=!1;const p=window.api?.backend?.onStatusChange(x=>{g=!0,d(x)}),f=async()=>{try{const[x,v]=await Promise.all([window.api.systemInfo.getAppVersion(),window.api.systemInfo.getPlatformInfo()]);u&&(s(x),l(v))}catch(x){console.error("Error fetching app information:",x)}},h=async()=>{try{const x=window.api?.backend;if(x){const j=await x.getStatus();g||d(j);return}const v=await qn.healthCheck(kn.baseUrl),b=qn.getServerVersion(v);u&&i({value:b,detail:null,degraded:!1})}catch(x){console.error("Error fetching server version:",x),u&&i({value:"Unavailable",detail:null,degraded:!1})}};return f(),h(),()=>{u=!1,p?.()}},[]);const c=(u,d,g,p={})=>t.jsx(he,{label:t.jsx(Ye,{content:g,children:t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx(Kt,{size:12,className:"shrink-0"}),u]})}),valueClassName:p.valueClassName,value:t.jsxs(t.Fragment,{children:[p.valueTooltip?t.jsx(Ye,{content:p.valueTooltip,children:t.jsx("span",{"data-backend-version":p.valueHoverTarget?"":void 0,children:d})}):d,p.statusNote?t.jsx("span",{className:"mt-0.5 block text-meta text-ink-dim",children:p.statusNote}):null]})});return t.jsx(_e,{title:n("ui.settings.updates.app_updates_section.application_updates_and_info"),icon:cn,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(mt,{children:[c(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")),c(n("ui.settings.updates.app_updates_section.server_version"),Gt(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}),c(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")),c(n("ui.settings.updates.app_updates_section.node_js_version"),Gt(r.nodeVersion),n("ui.settings.updates.app_updates_section.the_javascript_runtime_environment_version")),c(n("ui.settings.updates.app_updates_section.electron_version"),Gt(r.electronVersion),n("ui.settings.updates.app_updates_section.the_framework_version_enabling_this_desktop_application"))]}),t.jsx(Yc,{appVersion:e})]})})};function ia(e){const s={id:"",name:n("ui.settings.model.default_effort.model_default")};return e.resolvedLevel&&e.stored.trim()===""&&Ln(e.resolvedLevel,e.storable)!==null&&(s.description=n("ui.settings.model.default_effort.model_default_resolves",{level:Ue(e.resolvedLevel)})),[s,...ra(e.ladder,e.storable)]}function Ln(e,s){const a=e.trim().toLowerCase();return a===""?null:s.find(i=>i.trim().toLowerCase()===a)??null}function ra(e,s){return e.flatMap(a=>{const i=Ln(a,s);return i===null?[]:[{id:i,name:Ue(a)}]})}function Xc(e,s){const a=e.trim().toLowerCase();return a!==""&&s.some(i=>i.toLowerCase()===a)?s.find(i=>i.toLowerCase()===a)??"":""}function ed(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===""?"":Ln(a,e.storable)??"";return i.trim().toLowerCase()===s?null:i}const Lt="\0unread";function wt(e){return e.trim()===""?"":Lt}function td(e){if(!e.supported)return{kind:"unsupported",options:[],selectedId:"",disabled:!0,helper:""};if(!e.hasHome)return ze("no-home",n("ui.settings.model.default_effort.no_home"));if(!e.hasModel)return ze("no-model",n("ui.settings.model.default_effort.no_model"),Lt);if(e.settings==="loading")return ze("settings-loading",n("ui.settings.model.default_effort.settings_loading"),Lt);if(e.settings==="error")return ze("settings-error",n("ui.settings.model.default_effort.settings_error"),Lt);if(e.preview==="loading")return ze("loading",n("ui.settings.model.default_effort.loading"),wt(e.stored));if(e.preview==="error")return ze("error",n("ui.settings.model.default_effort.error"),wt(e.stored));if(e.ladder===null||!e.specResolved)return ze("unresolved",n("ui.settings.model.default_effort.unresolved"),wt(e.stored));const s=e.ladder;if(s.length===0)return ze("empty",n("ui.settings.model.default_effort.empty"),wt(e.stored));const a=ra(s,e.storable);if(a.length===0){const i=Ue(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:ia({ladder:s,resolvedLevel:e.resolvedLevel,stored:e.stored,storable:e.storable}),selectedId:Xc(e.stored,a.map(i=>i.id)),disabled:!1,helper:n("ui.settings.model.default_effort.helper_ready")}}function ze(e,s,a=""){return{kind:e,options:ia({ladder:[],resolvedLevel:null,stored:"",storable:[]}),selectedId:a,disabled:!0,helper:s}}const nd=({hosting:e,modelName:s,focus:a=!1,focusNonce:i})=>{ie();const r=gt(),l=Qe(r.data,"draft_preview"),c=Va(),u=e!==""&&s!=="",d=Ee({queryKey:zt.all,queryFn:()=>xe({op:"settings.list"}),enabled:l,staleTime:1e4}),g=d.data?.settings.find(ce=>ce.key===He),p=typeof g?.value=="string"?g.value:"",f=(g?.choices??[]).map(ce=>ce.value).filter(ce=>typeof ce=="string"),h={cwd:c??"",model:u?{provider:e,model_id:s,reasoning_effort:null}:null},x=d.isSuccess?p:null,v=Ee({...Fi(h,Qe(r.data,"draft_fast")),queryKey:[...Oi(h),"model_effort",x],enabled:l&&!!c&&u}),b=v.isSuccess&&!v.isPlaceholderData,j=b?Di(v.data?.snapshot,null).effort:null,L=b&&Array.isArray(j?.reasoning_efforts)?zi(j):null,C=b?$i(j):null,I=j!==null&&!Pi(j),[N,S]=o.useState(!1),[M,H]=o.useState(!1),[G,O]=o.useState(null),[K,q]=o.useState(null),z=`${e}\0${s}`,V=ut(),Q=o.useRef(null),B=o.useRef(!1),W=o.useRef(i);o.useEffect(()=>{i!==W.current&&(W.current=i,B.current=!1)},[i]);const te=o.useCallback(async(ce,pe)=>{S(!0),O(ce),H(!1),pe===null&&q(null);try{await xe({op:"settings.edit",key:He,value:ce}),await V.invalidateQueries({queryKey:zt.all}),pe!==null&&q(pe)}catch{H(!0)}finally{S(!1),O(null)}},[V]),m=typeof j?.display_name=="string"&&j.display_name.trim()||s,k=td({supported:l,hasHome:!!c,hasModel:u,settings:d.isError?"error":d.isSuccess?"ready":"loading",preview:v.isError?"error":b?"ready":"loading",ladder:L,specResolved:I,stored:p,resolvedLevel:C,storable:f}),y=ed({stored:p,ladder:L,resolvedLevel:C,resolved:b&&I&&d.isSuccess,storable:f}),E=o.useRef(null);o.useEffect(()=>{if(y===null||N)return;const ce=`${e}\0${s}\0${p}\0${y}`;if(E.current===ce)return;E.current=ce;const pe=y===""?n("ui.settings.model.default_effort.clamped_unset",{level:Ue(p),model:m}):n("ui.settings.model.default_effort.clamped",{level:Ue(p),model:m,resolved:Ue(y)});te(y,{text:pe,model:z})},[y,p,N,te,e,s,m,z]);const J=o.useMemo(()=>k.options.map(sd),[k.options]);o.useEffect(()=>{if(!a){B.current=!1;return}k.disabled||B.current||(Q.current?.querySelector("[role=combobox]")?.focus(),B.current=!0)},[a,i,k.disabled]);const $=G??k.selectedId,ne=J.find(ce=>ce.id===$)??(G!==null?{id:G,name:Ue(G)}:null),ae=t.jsxs("span",{className:"flex flex-col gap-0.5",children:[t.jsx("span",{children:k.helper}),M&&t.jsx("span",{className:"text-danger",children:n("ui.settings.model.default_effort.save_failed")}),t.jsx("output",{"aria-live":"polite",children:K?.model===z?K.text:""})]});return k.kind==="unsupported"?null:t.jsx("div",{ref:Q,"data-setting-key":He,children:t.jsx(Ys,{label:n("ui.settings.model.default_effort.label"),icon:t.jsx(er,{size:16,"aria-hidden":"true"}),placeholder:n("ui.settings.model.default_effort.placeholder"),options:J,selected:ne,onSelect:ce=>{te(ce.id,null)},helperText:ae,busy:N,busyLabel:n("ui.settings.model.default_effort.busy"),disabled:k.disabled||N})})};function sd(e){return{id:e.id,name:e.name,description:e.description}}const ad=e=>e.replace(/[\p{Co}\p{Cc}]/gu," ").replace(/\s+/g," ").trim(),oa=(e,s)=>{const a=s.trim().toLocaleLowerCase();return a?e.filter(i=>`${i.title} ${i.cwd} ${i.sourceId}`.toLocaleLowerCase().includes(a)):e},id=(e,s)=>`${e??""}\0${[...s].sort().join("\0")}`,la=5e3,rd=(e,s,a,i=la)=>{const r=new Set(a);let l=!1;for(const c of oa(e,s))if(!r.has(c.sourceId)){if(r.size>=i){l=!0;break}r.add(c.sourceId)}return{selected:r,capped:l}},od=/cancel/i,ld=new Set(["done","failed","cancelled"]),ls=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"}},Xt=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"}},cd=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"}},dd=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"}},ud=e=>e==="failed"?"danger":e==="metadata_only"||e==="skipped_already_imported"?"neutral":e==="cancelled"?"warning":"success",xn=e=>ad(e.title)||e.sourceId,cs=({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(Zs,{size:14}):t.jsx(Os,{size:14}),i?n("ui.settings.imports.copied"):n("ui.settings.imports.copy_path")]})]})},gd=({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)),c=s.filter(u=>a.has(u.sourceId));return t.jsxs("div",{className:"flex flex-col gap-2",children:[e.results.map(u=>t.jsx(ca,{row:u,jobCancelled:e.state==="cancelled"},`${u.source}:${u.sourceId}`)),c.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:xn(u)}),t.jsx(ct,{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(It,{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}`))]})},ca=({row:e,jobCancelled:s=!1})=>{const i=s&&e.outcome==="failed"&&e.warnings.some(r=>od.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(ct,{variant:ud(i),children:n(dd(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))]})},md=({sources:e,activeSource:s,sessions:a,query:i,selected:r,preview:l,previewStale:c,previewError:u,confirmed:d,busy:g,error:p,progress:f,result:h,cancelling:x,onSelectSource:v,onQueryChange:b,onToggleSession:j,onSelectAll:L,onClearSelection:C,onConfirmChange:I,onImport:N,onCancel:S,onRetry:M,onImportAnother:H,onRefresh:G,selectionNotice:O,onCopyPath:K})=>{ie();const q=e.find(m=>m.source===s),z=f!==null&&!ld.has(f.state),V=f?.total??r.size,Q=o.useMemo(()=>oa(a,i),[i,a]),B=Q.length>0&&Q.every(m=>r.has(m.sourceId)),W=r.size,te=W>0&&l!==null&&!c&&d&&!g&&!f&&!h;return t.jsx(_e,{title:n("ui.settings.imports.title"),icon:cn,description:n("ui.settings.imports.description"),dataTourTag:"settings-import-section",children:t.jsxs("div",{className:"flex flex-col gap-5",children:[p&&t.jsxs(le,{variant:"warning",children:[t.jsx(Ut,{children:n("ui.settings.imports.title")}),t.jsx(Re,{children:t.jsxs("span",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx("span",{children:p}),t.jsx(F,{variant:"secondary",size:"sm",onClick:M,children:n("ui.settings.imports.retry")})]})})]}),g==="sources"&&e.length===0?t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Se,{className:"h-20 w-full"}),t.jsx(Se,{className:"h-20 w-full"}),t.jsx(Se,{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:G,disabled:z||g==="sources"||g==="sessions",children:[t.jsx(tr,{size:14,className:fe(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 k=m.source===s,y=m.detected?n(ls(m.availability)):n("ui.settings.imports.source_not_found");return t.jsxs("button",{type:"button","aria-pressed":k,disabled:z,onClick:()=>v(m.source),className:fe("rounded-lg border p-3 text-start transition-colors disabled:cursor-not-allowed disabled:opacity-60","focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2",k?"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(ct,{variant:m.detected&&m.availability==="full"?"success":"neutral",children:y})]}),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)})})]}),q&&!f&&!h&&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")," · ",q.label]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(F,{variant:"secondary",size:"sm",onClick:B?C:L,disabled:Q.length===0,children:B?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:W})})]})]}),O&&t.jsx("output",{className:"text-meta text-warning",children:O}),t.jsxs("div",{className:"relative",children:[t.jsx(wn,{size:15,className:"pointer-events-none absolute top-1/2 start-3 -translate-y-1/2 text-ink-dim"}),t.jsx(Le,{value:i,onChange:m=>b(m.target.value),placeholder:n("ui.settings.imports.search_placeholder"),className:"ps-9"})]}),g==="sessions"?t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Se,{className:"h-12 w-full"}),t.jsx(Se,{className:"h-12 w-full"}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.loading_sessions",{source:q.label})})]}):a.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.imports.empty_sessions",{source:q.label})}):Q.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:Q.map(m=>{const k=`import-session-${m.source}-${m.sourceId}`;return t.jsxs("div",{className:fe("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(fn,{id:k,checked:r.has(m.sourceId),onCheckedChange:()=>j(m.sourceId),"aria-label":xn(m),className:"mt-0.5"}),t.jsxs("label",{htmlFor:k,className:"min-w-0 flex-1 cursor-pointer text-start",children:[t.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"min-w-0 truncate text-body-sm text-ink",children:xn(m)}),t.jsx(ct,{variant:m.availability==="full"?"neutral":"warning",children:n(ls(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:Nn(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)})})]}),q&&W>0&&!f&&!h&&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"||c||l===null&&!u)&&t.jsxs("p",{className:"flex items-center gap-2 text-meta text-ink-muted",children:[t.jsx(It,{size:14,className:"animate-spin"}),n("ui.settings.imports.loading_preview")]}),l&&!c&&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,k)=>t.jsx("p",{className:"text-meta text-warning",children:m.message},`${m.code}:${m.sessionId}:${k}`)),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(le,{variant:"warning",children:t.jsx(Re,{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:M,children:n("ui.settings.imports.retry")})]})})}),t.jsxs("div",{className:"flex items-start gap-2 text-body-sm text-ink",children:[t.jsx(fn,{checked:d,onCheckedChange:m=>I(m===!0),disabled:!l||c,"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:N,disabled:!te,className:"self-start",children:[g==="start"?t.jsx(It,{size:14,className:"animate-spin"}):t.jsx(cn,{size:14}),n("ui.settings.imports.import_button",{count:W})]})]})]}),f&&!h&&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:S,disabled:x||f.state==="done"||f.state==="cancelled"||f.state==="failed",children:[t.jsx(Ha,{size:12}),x?n("ui.settings.imports.cancelling"):n("ui.settings.imports.cancel")]})]}),t.jsxs("p",{className:"text-meta text-ink-muted",children:[n("ui.settings.imports.progress_job",{job:f.jobId,state:n(Xt(f.state))})," · ",n(cd(f.phase))]}),t.jsx(kr,{value:f.total?f.completed/f.total*100:0,className:"h-1.5"}),t.jsx(gd,{progress:f,sessions:a,selected:r})]}),h&&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:H,children:n("ui.settings.imports.import_another")})]}),t.jsx("p",{className:"text-body-sm text-ink",children:h.state==="cancelled"?n("ui.settings.imports.result_summary_cancelled",{state:n(Xt(h.state)),sessions:h.sessions.length,total:V,messages:h.messages}):n("ui.settings.imports.result_summary",{state:n(Xt(h.state)),sessions:h.sessions.length,messages:h.messages})}),h.sessions.map(m=>t.jsx(ca,{row:m,jobCancelled:h.state==="cancelled"},`${m.source}:${m.sourceId}:${m.targetSessionId}`)),(h.instructionReviewPath||h.memoryReviewPath)&&t.jsxs("div",{className:"flex flex-col gap-2",children:[h.instructionReviewPath&&t.jsx(cs,{path:h.instructionReviewPath,label:n("ui.settings.imports.review_instructions"),onCopyPath:K}),h.memoryReviewPath&&t.jsx(cs,{path:h.memoryReviewPath,label:n("ui.settings.imports.review_memory"),onCopyPath:K})]}),h.warnings.length>0&&t.jsx(le,{variant:"warning",children:t.jsx(Re,{children:t.jsxs("span",{className:"flex flex-col gap-1",children:[t.jsx("span",{children:n("ui.settings.imports.warnings_heading",{count:h.warnings.length})}),h.warnings.slice(0,4).map((m,k)=>t.jsx("span",{children:m.message},`${m.code}:${k}`))]})})}),h.error&&t.jsx(le,{variant:"danger",children:t.jsx(Re,{children:h.error})}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.rerun_safe")})]}),g==="start"&&!f&&t.jsxs("p",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[t.jsx(It,{size:14,className:"animate-spin"}),n("ui.settings.imports.importing")]})]})})},On=e=>({source:e.source,sessionId:e.session_id,code:e.code,message:e.message}),da=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}),pd=e=>({jobId:e.job_id,state:e.state,sessions:e.sessions.map(da),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(On),error:e.error});async function fd(){return(await xe({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 _d(e,s=!1){return(await xe({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 hd(e){const s=await xe({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(On),instructionReviewPaths:s.instruction_review_paths}}async function xd(e){return(await xe({op:"imports.start",sources:e.sources,sessionIds:e.sessionIds,includeMemory:e.includeMemory??!0,includeInstructions:e.includeInstructions??!0})).job_id}async function yd(e){const s=await xe({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(da),warnings:s.warnings.map(On),error:s.error,startedAt:s.started_at,updatedAt:s.updated_at,result:s.result?pd(s.result):void 0}}async function vd(e){await xe({op:"imports.cancel",jobId:e})}const Nt=new Set(["done","failed","cancelled"]),qe=e=>e instanceof Error?e.message:String(e),bd=()=>{ie();const[e,s]=o.useState([]),[a,i]=o.useState(null),[r,l]=o.useState([]),[c,u]=o.useState(""),[d,g]=o.useState(new Set),[p,f]=o.useState(null),[h,x]=o.useState(null),[v,b]=o.useState(!1),[j,L]=o.useState(null),[C,I]=o.useState(null),[N,S]=o.useState(null),[M,H]=o.useState(null),[G,O]=o.useState(!1),[K,q]=o.useState(null),[z,V]=o.useState(0),Q=o.useRef(0),B=o.useRef(0),[W,te]=o.useState(null),[m,k]=o.useState(null),y=o.useRef(null),E=N!==null&&!Nt.has(N.state),J=o.useCallback(async()=>{L("sources"),I(null);try{const Z=await fd();s(Z),i(se=>Z.some(X=>X.source===se&&X.detected)?se:Z.find(X=>X.detected)?.source??null)}catch(Z){I(n("ui.settings.imports.error_sources",{reason:qe(Z)}))}finally{L(null)}},[]);o.useEffect(()=>{J()},[J]);const $=o.useCallback(async Z=>{const se=++Q.current;L("sessions"),I(null);try{const R=await _d(Z);if(se!==Q.current)return;l(R)}catch(R){if(se!==Q.current)return;l([]),I(n("ui.settings.imports.error_sessions",{source:Z,reason:qe(R)}))}finally{se===Q.current&&L(null)}},[]);o.useEffect(()=>{if(!a){l([]);return}l([]),g(new Set),f(null),x(null),te(null),k(null),b(!1),H(null),S(null),$(a)},[a,$]);const ne=o.useCallback(Z=>{g(Z),b(!1),te(null),k(null),q(null)},[]),ae=o.useCallback(Z=>{E||(i(Z),u(""))},[E]),ce=o.useCallback(Z=>{const se=new Set(d);se.has(Z)?se.delete(Z):se.add(Z),ne(se)},[ne,d]),pe=o.useCallback(()=>{const Z=rd(r,c,d);ne(Z.selected),Z.capped&&q(n("ui.settings.imports.selection_limit",{max:la}))},[c,ne,d,r]),ke=o.useCallback(()=>{ne(new Set)},[ne]),de=o.useMemo(()=>id(a,d),[a,d]),A=p!==null&&h!==de,Y=o.useCallback(async()=>{if(!a||d.size===0)return;const Z=++B.current,se=de;L("preview"),I(null),k(null);try{const R=await hd({sources:[a],sessionIds:{[a]:[...d].sort()}});if(Z!==B.current)return;f(R),x(se)}catch(R){if(Z!==B.current)return;f(null),x(null),te(se),k(n("ui.settings.imports.error_preview",{reason:qe(R)}))}finally{Z===B.current&&L(null)}},[a,de,d]);o.useEffect(()=>{if(!a||d.size===0||N||M||p&&h===de||!p&&W===de)return;const Z=setTimeout(()=>{Y()},250);return()=>clearTimeout(Z)},[a,d,de,p,h,W,N,M,Y]);const U=o.useCallback(async()=>{if(!(!a||d.size===0||!p||A||!v||N)){L("start"),I(null),H(null);try{const Z=await xd({sources:[a],sessionIds:{[a]:[...d].sort()}}),se=Date.now()/1e3;S({jobId:Z,state:"queued",phase:"queued",source:a,sessionId:"",completed:0,total:d.size,results:[],warnings:[],error:"",startedAt:se,updatedAt:se})}catch(Z){I(n("ui.settings.imports.error_start",{reason:qe(Z)}))}finally{L(null)}}},[a,v,p,A,N,d]),re=N?.jobId??null,ue=N?.state??null;o.useEffect(()=>{if(!re||!ue||Nt.has(ue))return;let Z=!0,se;const R=async()=>{try{const X=await yd(re);if(!Z)return;if(y.current){const oe=y.current;y.current=null,I(ge=>ge===oe?null:ge)}S(X),X.result&&H({...X.result,jobId:X.jobId}),Nt.has(X.state)||(se=setTimeout(R,900))}catch(X){if(!Z)return;const oe=n("ui.settings.imports.error_job",{reason:qe(X)});y.current=oe,I(oe),se=setTimeout(R,2e3)}};return se=setTimeout(R,z>0?0:700),()=>{Z=!1,se&&clearTimeout(se)}},[re,ue,z]);const Fe=o.useCallback(async()=>{if(!(!N||Nt.has(N.state))){O(!0),I(null);try{await vd(N.jobId)}catch(Z){I(n("ui.settings.imports.error_cancel",{reason:qe(Z)}))}finally{O(!1)}}},[N]),ve=o.useCallback(()=>{g(new Set),f(null),x(null),te(null),k(null),b(!1),q(null),H(null),S(null),I(null),a&&$(a)},[a,$]),je=o.useCallback(async Z=>{try{return await navigator.clipboard.writeText(Z),!0}catch{return!1}},[]),Ae=o.useCallback(async()=>{E||(q(null),te(null),k(null),await J(),a&&await $(a))},[a,E,$,J]),be=o.useCallback(()=>{if(E){I(null),V(Z=>Z+1);return}te(null),k(null),Ae()},[E,Ae]);return t.jsx(md,{sources:e,activeSource:a,sessions:r,query:c,selected:d,preview:p,previewStale:A,previewError:m,confirmed:v,busy:j,error:C,progress:N,result:M,cancelling:G,onSelectSource:ae,onQueryChange:u,onToggleSession:ce,onSelectAll:pe,onClearSelection:ke,onConfirmChange:b,onImport:()=>void U(),onCancel:()=>void Fe(),onRetry:be,onImportAnother:ve,onRefresh:Ae,selectionNotice:K,onCopyPath:je})},kd=[[[".claude.json"],"Claude Code"],[[".claude",".mcp.json"],"Claude Code"],[[".cursor","mcp.json"],"Cursor"],[[".vscode","mcp.json"],"VS Code"],[[".codex","config.toml"],"Codex CLI"]];function ua(e){if(!e)return null;const s=e.split("\\").join("/").split("/").filter(Boolean);for(const[a,i]of kd)if(!(s.length<a.length)&&s.slice(-a.length).join("/")===a.join("/"))return i;return null}const Ot=e=>n("ui.settings.integrations.integration_model.tool_count",{count:e}),jd=e=>n("ui.settings.integrations.integration_model.integration_count",{count:e}),wd=["connected","needs_sign_in","not_started","connecting","error"],ga=e=>wd.includes(e),Ze=(e,s)=>[...s].filter(a=>a.name===e&&a.status==="running").sort((a,i)=>i.created_at-a.created_at)[0]??null,Nd={connectedAt:null,connectedToolCount:null,settledGroup:null,pinnedGroup:null,pinnedOperationId:null,needsKey:!1,needsSignIn:!1,disconnectedAt:null,holdUntil:null,lastDecisive:null},Sd=1e12,Md=1e9,Cd=60*60*1e3,ma=(e,s=Date.now())=>{if(typeof e!="number"||!Number.isFinite(e))return null;const a=e>=Sd?e:e<Md?null:e*1e3;return a===null||a>s+Cd?null:Math.min(a,s)},Ke=(e,s)=>e?.[s]??Nd,pt=(e,s,a)=>Id(e,s)??a?.lastDecisive??null,Ed=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}:{}}),Fn=(e,s)=>e.status==="not_started"&&typeof e.tool_count=="number"&&(s.connectedAt!==null||e.status_basis==="stored"&&e.tool_count_basis==="last_seen"),Ad=(e,s)=>[...s].filter(a=>a.name===e).sort((a,i)=>i.created_at-a.created_at)[0]??null,Id=(e,s)=>Ad(e,s.filter(a=>a.status!=="cancelled")),Bt=e=>e.actions.includes("set_key")||e.actions.includes("add_key");function Rd(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 en(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 Td(e,s=[],a,i=Date.now()){const r=Ke(a,e.name),l=Ze(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(!ga(e.status))return{label:n("ui.settings.integrations.integration_model.status_unavailable"),tone:"neutral",detail:null,busy:!1};const c=pt(e.name,s,r),u=qt(c)&&e.status!=="connected",d=Fn(e,r),g=$n(c)&&e.status!=="connected",p=(c?.action==="login"||c?.action==="reauth")&&c.status==="failed";if(r.disconnectedAt!==null)return{label:n("ui.settings.integrations.integration_model.not_connected"),tone:"neutral",detail:null,busy:!1,explanation:n(ds)};switch(e.status){case"connected":return{label:typeof e.tool_count=="number"?n("ui.settings.integrations.integration_model.connected_with_tools",{tools:String(Ot(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"||rt(e,s,r)?n("ui.settings.integrations.integration_model.needs_a_key"):n("ui.settings.integrations.integration_model.needs_sign_in"),tone:"warning",detail:en(e.status_reason),busy:!1};case"error":return{label:n("ui.settings.integrations.integration_model.couldn_t_start"),tone:"danger",detail:en(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(rt(e,s,r))return{label:n("ui.settings.integrations.integration_model.needs_a_key"),tone:"warning",detail:null,busy:!1};if(p)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"||rt(e,s,r)?n("ui.settings.integrations.integration_model.needs_a_key"):n("ui.settings.integrations.integration_model.needs_sign_in"),tone:"warning",detail:en(e.status_reason),busy:!1};if(e.status_basis==="stored"&&d&&r.disconnectedAt===null){const f=r.connectedAt??ma(e.last_seen_at,i);return{label:f!==null?n("ui.settings.integrations.integration_model.worked_when_with_tools",{when:String(Rd(i,f)),tools:String(Ot(e.tool_count))}):n("ui.settings.integrations.integration_model.worked_earlier_with_tools",{tools:String(Ot(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,explanation:n(ds)}:{label:n("ui.settings.integrations.integration_model.ready"),tone:"neutral",detail:null,busy:!1,explanation:n(Fd)}}}const pa=e=>n("ui.settings.integrations.integration_model.replace_keys",{count:e}),Ld=/[,;]?\s*(?:or|and)?\s*add (?:its|a|the) key instead\.?\s*$/i;function Od(e,s){const a=e?.trim()??"";if(!a)return null;if(s)return a;const i=a.replace(Ld,"").trim();return i?/\.$/.test(i)?i:`${i}.`:a}const Fd="ui.settings.integrations.integration_model.copy_ready_explanation",ds="ui.settings.integrations.integration_model.copy_not_connected_explanation",Dd=e=>e.transport==="local_command"?n("ui.settings.integrations.integration_model.local_command"):n("ui.settings.integrations.integration_model.remote_url");function fa(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 ua(e.source.path)}}function zd(e,s){const a=[{text:Dd(e),importSource:!1}];e.status!=="connected"&&e.tool_count_basis==="last_seen"&&typeof e.tool_count=="number"&&a.push({text:n("ui.settings.integrations.integration_model.tools_when_last_checked",{tools:String(Ot(e.tool_count))}),importSource:!1}),s&&a.push({text:e.scope==="project"?n("ui.settings.integrations.integration_model.this_project"):n("ui.settings.integrations.integration_model.global"),importSource:!1});const i=fa(e);return i?a.push({text:n("ui.settings.integrations.integration_model.imported_from_origin",{origin:String(i)}),importSource:!0}):e.source.editable||a.push({text:n("ui.settings.integrations.integration_model.imported_from_a_project_file"),importSource:!0}),a}const Dn=(e,s)=>s.disconnectedAt!==null?"not_started":e.status;function zn(e,s=[],a){const i=Ke(a,e.name),r=Ze(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=p=>e.actions.includes(p),c=Bt(e),u=rt(e,s,i);if(!ga(e.status))return l("test")?{kind:"test",label:n("ui.settings.integrations.integration_model.check_again")}:null;const d=pt(e.name,s,i),g=d?.status==="failed"&&ft(d);switch(Dn(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")}:c?{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(qt(d)&&l("sign_in"))return{kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")};if($n(d)&&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&&c)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&&c?{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")}:Fn(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 ft=e=>e.action==="login"||e.action==="reauth",qt=e=>!!(e&&e.action==="logout"&&e.status==="complete"),$n=e=>!!(e&&e.action==="logout"&&e.status!=="running"&&e.status!=="complete"),_a=/no oauth authorization server/i;function rt(e,s,a){if(!Bt(e))return!1;const i=pt(e.name,s,a);return i&&ft(i)&&i.status==="failed"&&_a.test(i.message??"")?!0:a.needsKey}function $d(e,s=[],a){const i=zn(e,s,a)?.kind,r=Dn(e,Ke(a,e.name)),l=d=>e.actions.includes(d),c=[],u=Ze(e.name,s);if(u&&c.push({kind:"cancel",label:n("ui.settings.integrations.integration_model.cancel")}),!u&&l("test")&&i!=="test"&&c.push({kind:"test",label:n("ui.settings.integrations.integration_model.test_connection")}),l("connect")&&i!=="connect"&&r!=="connected"&&c.push({kind:"connect",label:n("ui.settings.integrations.integration_model.reconnect")}),!u&&l("sign_in")&&i!=="sign_in"&&r!=="connected"&&c.push({kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")}),l("reload")&&c.push({kind:"reload",label:n("ui.settings.integrations.integration_model.reload")}),!u&&l("reauth")&&i!=="reauth"&&c.push({kind:"reauth",label:n("ui.settings.integrations.integration_model.sign_in_again")}),Bt(e)&&i!=="set_key"&&c.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")&&c.push({kind:"sign_out",label:n("ui.settings.integrations.integration_model.sign_out")}),l("disconnect")&&r==="connected"&&c.push({kind:"disconnect",label:n("ui.settings.integrations.integration_model.disconnect")}),l("copy_setup")&&e.setup_prompt&&c.push({kind:"copy_setup",label:n("ui.settings.integrations.integration_model.copy_setup_prompt")}),i!=="fix"&&c.push({kind:"open_config",label:n("ui.settings.integrations.integration_model.open_config_file")}),l("remove"))c.push({kind:"remove",label:n("ui.settings.integrations.integration_model.remove"),destructive:!0});else if(!e.source.editable){const d=fa(e);c.push({kind:"remove_elsewhere",label:d?n("ui.settings.integrations.integration_model.remove_in_origin",{origin:String(d)}):n("ui.settings.integrations.integration_model.remove_in_its_own_file"),hint:d?n("ui.settings.integrations.integration_model.defined_in_origin_s_config_remove_it_there",{origin:String(d)}):n("ui.settings.integrations.integration_model.defined_in_a_file_this_app_doesn_t_write_remove_it_there")})}return c}const Pd={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 ha(e,s=[],a){const i=Ke(a,e.name),r=Ze(e.name,s),l=Dn(e,i);if(r&&i.pinnedGroup&&i.pinnedOperationId===r.id)return i.pinnedGroup;if(l==="needs_sign_in"||l==="error")return"attention";const c=pt(e.name,s,i);return qt(c)&&l!=="connected"||$n(c)&&l!=="connected"?"attention":i.disconnectedAt!==null?"ready":rt(e,s,i)||i.needsSignIn&&l!=="connected"||c?.status==="failed"&&ft(c)&&l!=="connected"?"attention":l==="connected"||e.status_basis==="stored"&&Fn(e,i)?"connected":r&&r.action!=="test"?"attention":"ready"}function Ud(e,s=[],a){return["attention","connected","ready"].map(r=>({id:r,title:Pd[r],rows:e.filter(l=>ha(l,s,a)===r)})).filter(r=>r.rows.length>0)}function Kd(e,s,a=Date.now()){if(!s)return e??{};const i={};for(const r of s.servers){const l=Ke(e,r.name),c=Ze(r.name,s.operations),u=pt(r.name,s.operations,l),d=qt(u),g=r.status==="connected"&&(r.status_basis==="probe"||r.status_basis==="live"),p=l.holdUntil!==null&&a<l.holdUntil,f=!p&&!d&&l.connectedAt===null&&r.status_basis==="stored"&&r.tool_count_basis==="last_seen"?ma(r.last_seen_at,a):null,h=!d,x=u?.status==="failed"&&ft(u)&&_a.test(u.message??""),v={connectedAt:g&&!p?a:f!==null?f:h?l.connectedAt:null,connectedToolCount:g&&!p||f!==null?r.tool_count??l.connectedToolCount:h?l.connectedToolCount:null,settledGroup:l.settledGroup,pinnedGroup:c&&l.pinnedOperationId===c.id?l.pinnedGroup:c?l.settledGroup:null,pinnedOperationId:c?c.id:null,needsKey:g?!1:l.needsKey||x,needsSignIn:g||d?!1:l.needsSignIn||r.status==="needs_sign_in",disconnectedAt:g&&!p?null:l.disconnectedAt,holdUntil:p?l.holdUntil:null,lastDecisive:u?Ed(u):null};c||(v.settledGroup=ha(r,s.operations,{...i,[r.name]:v})),i[r.name]=v}return i}const Bd=(e,s)=>e!==null&&s===e,yn="local-operator.settings.integrations.row-memory",xa=(e,s)=>`${e}#${s}`;function qd(e,s){const a={};if(!s)return a;for(const i of s.servers){const r=e[i.name];r&&(a[xa(i.source.path,i.name)]=r)}return a}function Vd(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=Wd(a[xa(r.source.path,r.name)]);l&&(i=i??{...e},i[r.name]=l)}return i??e}const Hd=["attention","connected","ready"],ya=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Pn=e=>typeof e=="number"&&Number.isFinite(e)?e:null,us=e=>Hd.includes(e)?e:null,tn=e=>{const s=Pn(e);return s!==null&&s>=1e12?s:null};function Gd(e){if(!ya(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:Pn(e.created_at)??0,credential_removed:e.credential_removed===!0,...typeof e.message=="string"?{message:e.message}:{}}}function Wd(e){if(!ya(e))return null;const s=tn(e.connectedAt),a=tn(e.disconnectedAt),i=e.needsKey===!0,r=e.needsSignIn===!0,l=Gd(e.lastDecisive);return s===null&&a===null&&!i&&!r&&!l?null:{connectedAt:s,connectedToolCount:Pn(e.connectedToolCount),settledGroup:us(e.settledGroup),pinnedGroup:us(e.pinnedGroup),pinnedOperationId:typeof e.pinnedOperationId=="string"?e.pinnedOperationId:null,needsKey:i,needsSignIn:r,disconnectedAt:a,holdUntil:tn(e.holdUntil),lastDecisive:l}}const va=2e3,gs=8e3;function Qd(e){return e&&(e.servers.some(a=>a.status==="connecting")||e.operations.some(a=>a.status==="running"))?va:!1}const Yd=/^[A-Za-z0-9_.:-]{1,100}$/,Zd=/:\/\//;function Jd(e,s){const a=e.trim();return a?Yd.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 Xd(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"):Zd.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 eu=e=>e.split(`
|
|
287
|
-
`).map(s=>s.trim()).filter(Boolean);function vn(e,s){const a=!!e?.cold,i=(e?.servers??[]).map(r=>{const l=r.transport==="http",c=r.secret_refs??[],u=r.status==="connected"?"connected":r.status==="connecting"?"connecting":r.status==="auth-required"?"needs_sign_in":"not_started",d=[];u!=="connected"&&d.push("connect"),u==="connected"&&d.push("disconnect"),a||d.push("reload"),l&&r.transport_oauth_supported!==!1&&d.push("sign_in"),c.length>0&&d.push("set_key"),r.owned_scope&&d.push("remove"),r.setup?.text&&d.push("copy_setup");const g=ua(r.source);return{id:r.name,name:r.name,scope:r.owned_scope??"global",project_cwd:null,source:{kind:tu(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:c.length?"api_key":l?"unknown":"none",signed_in:null,secret_refs:c.map(p=>({id:p.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:d,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 tu=(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",ms={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")}},nu="ui.settings.integrations.integration_model.copy_catalog_refusal_fallback";function St(e,s,a){if(s instanceof Mn&&s.status===409){const i=typeof s.code=="string"&&Object.prototype.hasOwnProperty.call(ms,s.code)?ms[s.code]:n(nu);return`${Ga[e]}. ${i}`}return Wa(e,s,a).message}const su="ui.settings.integrations.add_integration_form.copy_add_integration_pickup_note",au="ui.settings.integrations.add_integration_form.copy_transport_hint",iu=({existingNames:e,projectScopeAvailable:s,projectLabel:a,onSubmit:i,onCancel:r,initial:l})=>{ie();const[c,u]=o.useState(l?.name??""),[d,g]=o.useState(l?.mode??"command"),[p,f]=o.useState(l?.command??""),[h,x]=o.useState(l?.args??""),[v,b]=o.useState(l?.url??""),[j,L]=o.useState("global"),[C,I]=o.useState(l?.touched?{name:!0,command:!0,url:!0}:{}),[N,S]=o.useState(!!l?.touched),[M,H]=o.useState(!1),[G,O]=o.useState(null),K=o.useRef(null),q=o.useRef(null),z=o.useRef(null);o.useEffect(()=>{K.current?.focus()},[]);const V=Jd(c,e),Q=d==="command"&&!p.trim()?n("ui.settings.integrations.add_integration_form.enter_the_command_to_run"):null,B=d==="url"?Xd(v):null,W=y=>N||C[y],te=async y=>{if(y.preventDefault(),S(!0),V||Q||B){V?K.current?.focus():Q?q.current?.focus():z.current?.focus();return}H(!0),O(null);const E=s?j:"global",J=d==="command"?{name:c.trim(),scope:E,mode:d,command:p.trim(),args:eu(h)}:{name:c.trim(),scope:E,mode:d,url:v.trim()},$=await i(J);H(!1),O($)},m=(y,E,J)=>E&&W(J)?t.jsx("p",{id:y,className:"text-body-sm text-danger",children:E}):null,k=y=>y.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:y=>void te(y),onKeyDown:y=>{y.key==="Escape"&&(y.stopPropagation(),r())},children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Te,{htmlFor:"integration-add-name",children:n("ui.settings.integrations.add_integration_form.name")}),t.jsx(Le,{ref:K,id:"integration-add-name",value:c,placeholder:n("ui.settings.integrations.add_integration_form.e_g_notion"),autoComplete:"off","aria-invalid":!!(V&&W("name")),"aria-describedby":V&&W("name")?"integration-add-name-error":void 0,onChange:y=>u(y.target.value),onBlur:()=>I(y=>({...y,name:!0}))}),m("integration-add-name-error",V,"name")]}),t.jsxs($t,{value:d,onValueChange:y=>g(y==="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(Pt,{"aria-labelledby":"integration-add-transport-label",children:[t.jsx(Ve,{value:"command","data-integration-transport":"command",children:n("ui.settings.integrations.add_integration_form.local_command")}),t.jsx(Ve,{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(au)}),t.jsxs(Yn,{value:"command",className:"mt-0 flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Te,{htmlFor:"integration-add-command",children:n("ui.settings.integrations.add_integration_form.command")}),t.jsx(Le,{ref:q,id:"integration-add-command",value:p,placeholder:n("ui.settings.integrations.add_integration_form.e_g_npx"),autoComplete:"off",className:"font-mono","aria-invalid":!!(Q&&W("command")),"aria-describedby":Q&&W("command")?"integration-add-command-error":void 0,onChange:y=>f(y.target.value),onBlur:()=>I(y=>({...y,command:!0}))}),m("integration-add-command-error",Q,"command")]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs(Te,{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(Rn,{id:"integration-add-args",value:h,rows:2,className:"font-mono",onChange:y=>x(y.target.value)})]})]}),t.jsx(Yn,{value:"url",className:"mt-0 flex flex-col gap-4",children:t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Te,{htmlFor:"integration-add-url",children:n("ui.settings.integrations.add_integration_form.url")}),t.jsx(Le,{ref:z,id:"integration-add-url",type:"url",value:v,placeholder:n("ui.settings.integrations.add_integration_form.https_mcp_example_com_mcp"),autoComplete:"off",className:"font-mono","aria-invalid":!!(B&&W("url")),"aria-describedby":B&&W("url")?"integration-add-url-error":"integration-add-url-help",onChange:y=>b(y.target.value),onBlur:()=>I(y=>({...y,url:!0}))}),m("integration-add-url-error",B,"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($t,{value:j,onValueChange:y=>L(y==="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(Pt,{"aria-labelledby":"integration-add-scope-label",children:[t.jsx(Ve,{value:"global","data-integration-scope":"global",children:n("ui.settings.integrations.add_integration_form.all_chats")}),t.jsx(Ve,{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:j==="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,G?t.jsx("p",{className:"text-body-sm text-danger",role:"alert",children:G}):null,t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx("p",{className:fe("text-body-sm text-ink-dim"),children:n(su)}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(F,{type:"button",variant:"ghost",size:"md",onMouseDown:k,onClick:r,children:n("ui.settings.integrations.add_integration_form.cancel")}),t.jsxs(F,{type:"submit",variant:"primary",size:"md",disabled:M,onMouseDown:k,children:[M?t.jsx(Me,{size:"xs"}):null,n("ui.settings.integrations.add_integration_form.add_integration")]})]})]})]})},ru=4;function ou(e){return e.rowMoving?e.now+e.windowMs:Math.max(e.hold.until,e.lastMovingAt+e.windowMs)}function lu(e){return e.now>e.hold.until||e.hold.reanchors>=ru?"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 cu(e){const s=ou({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=lu({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 du(e){const{row:s,target:a}=e;return!s||!a||typeof a.nodeType!="number"?!1:!s.contains(a)}const ps=250;function fs(e){return e?!e.disabled:!1}function uu(e){return fs(e.primary)?e.primary??null:fs(e.overflow)?e.overflow??null:null}function gu(e){return e.verdict==="finished"?null:e.watchMs}const ba="key";function mu(e){const{name:s,keyless:a,freeName:i,names:r,values:l,replace:c,canReplace:u}=e;if(a){const d=bn(s,i);return{values:{[d]:(l[ba]??"").trim()},confirmedReplace:c&&u?[d]:[],header:i.trim()}}return{values:Object.fromEntries(r.map(d=>[d,(l[d]??"").trim()])),confirmedReplace:c&&u?r:[],header:void 0}}function bn(e,s){const a=_s(e),i=_s(s);if(!i)return"";const r=[a,i].filter(Boolean).join("_"),l=/^[A-Za-z_]/.test(r)?r:`K_${r}`;if(l.length<=nn)return l;const c=pu(a),u=nn-i.length-c.length-2,d=[a.slice(0,Math.max(u,0)),c,i].filter(Boolean).join("_");return d.length<=nn?d:d.slice(-128)}const nn=128,_s=e=>e.trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,""),pu=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)},fu=({name:e,keyNames:s,keyless:a=!1,savedKeys:i=[],saving:r,failure:l,onSave:c,onClose:u})=>{ie();const[d,g]=o.useState({}),[p,f]=o.useState(!1),[h,x]=o.useState(""),v=a?[bn(e,h)]:[...s],b=a?[ba]:v,j=(a?bn(e,h).length>0:!0)&&b.every(C=>(d[C]??"").trim()),L=v.some(C=>i.includes(C));return t.jsx(Fs,{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(dn,{onClick:u,children:n("ui.settings.integrations.integration_key_dialog.cancel")}),t.jsx(un,{disabled:!j||r,onClick:()=>{const C=mu({name:e,keyless:a,freeName:h,names:v,values:d,replace:p,canReplace:L});c(C.values,C.confirmedReplace,C.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(Te,{htmlFor:"integration-key-name",children:n("ui.settings.integrations.integration_key_dialog.the_header_this_server_wants_the_key_in")}),t.jsx(Le,{id:"integration-key-name",autoComplete:"off",placeholder:n("ui.settings.integrations.integration_key_dialog.e_g_authorization_or_x_api_key"),value:h,onChange:C=>x(C.target.value)}),t.jsx("p",{className:"-mx-1.5 text-ink-dim text-meta",children:n("ui.settings.integrations.integration_key_dialog.this_server_declares_no_key_of_its_own_so_local_operator_adds_one")})]}):null,b.filter(C=>a!==!0||C.trim().length>0).map(C=>t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Te,{htmlFor:`integration-key-${C}`,className:"font-mono",children:a?"Key":C}),t.jsx(Le,{id:`integration-key-${C}`,type:"password",autoComplete:"off",value:d[C]??"",onChange:I=>g(N=>({...N,[C]:I.target.value}))})]},C)),L?t.jsxs("div",{className:"flex items-center gap-2 text-body-sm",children:[t.jsx(fn,{id:"integration-key-replace",checked:p,onCheckedChange:C=>f(C===!0)}),t.jsx(Te,{htmlFor:"integration-key-replace",className:"font-normal",children:pa(v.length)})]}):null,l?t.jsx("p",{className:"-mx-1.5 text-body-sm text-danger",role:"alert",children:l}):null]})})},_u={success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info",neutral:"bg-ink-dim"},hu={success:"text-ink-muted",warning:"text-warning",danger:"text-danger",info:"text-ink-muted",neutral:"text-ink-dim"},xu=({row:e,operations:s,memories:a,now:i,projectScopeAvailable:r,highlighted:l=!1,rowRef:c,primaryRef:u,overflowRef:d,pending:g,failure:p,confirm:f,onPrimary:h,onOverflow:x,onConfirm:v,onCancelConfirm:b})=>{ie();const j=Td(e,s,a,i),L=l&&j.tone==="danger"?"text-ink":hu[j.tone],C=zn(e,s,a),I=$d(e,s,a),N=zd(e,r),S=I.findIndex(M=>M.kind==="remove"||M.kind==="remove_elsewhere");return t.jsxs("li",{ref:c,"data-integration":e.name,"data-search-row":`integration.${e.id}`,"data-search-control":!0,"data-status":e.status,className:fe("flex min-h-14 flex-col justify-center gap-1 px-4 py-2.5",l&&"bg-row-selected"),onKeyDown:M=>{!f||M.key!=="Escape"||(M.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:j.busy?t.jsx(Me,{size:"xs"}):t.jsx("span",{"aria-hidden":"true","data-tone":j.tone,className:fe("size-2 rounded-full",_u[j.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:N.map((M,H)=>t.jsxs("span",{children:[H>0?" · ":null,M.importSource&&e.source.path?t.jsx(Ye,{content:Ui(e.source.path),children:t.jsx("span",{className:"underline decoration-dotted underline-offset-2",children:M.text})}):M.text]},M.text))})]}),j.explanation?t.jsx(Ye,{content:j.explanation,children:t.jsx("span",{className:fe("shrink-0 text-body-sm",L),children:j.label})}):t.jsx("span",{className:fe("shrink-0 text-body-sm",L),children:j.label}),C?t.jsxs(F,{ref:u,variant:C.variant??"secondary",size:"sm","aria-label":`${C.label} ${e.name}`,disabled:g,"data-integration-action":C.kind,onClick:()=>h(C),children:[g?t.jsx(Me,{size:"xs"}):null,C.label]}):null,t.jsxs(jr,{children:[t.jsx(wr,{asChild:!0,children:t.jsx(F,{ref:d,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(Qa,{"aria-hidden":"true"})})}),t.jsx(Nr,{align:"end",className:"min-w-48",children:I.map((M,H)=>t.jsx(yu,{item:M,separated:H===S&&H>0,onSelect:()=>x(M)},M.kind))})]})]}),j.detail?t.jsx("p",{className:fe("ps-7 text-body-sm",j.tone==="danger"?"text-ink-muted":"text-ink-dim"),children:j.detail}):null,p?t.jsx("p",{className:fe("ps-7 text-body-sm",l?"text-ink":"text-danger"),role:"alert",children:p}):null,f?t.jsxs("div",{className:"flex flex-wrap items-center gap-2 ps-7",children:[t.jsx("span",{className:"text-body-sm text-ink",children:f.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:f.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:v,"data-integration-confirm":f.kind,children:f.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]})},yu=({item:e,separated:s,onSelect:a})=>(ie(),t.jsxs(t.Fragment,{children:[s?t.jsx(Sr,{}):null,e.kind==="remove_elsewhere"?t.jsxs(Zn,{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(Zn,{destructive:e.kind==="remove",onSelect:a,"data-integration-menu":e.kind,children:e.label})]}));function vu(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:Od(s.message,a)??n("ui.settings.integrations.integration_sign_in_dialog.the_server_didn_t_say_why"),nextStep:bu(s.message??null,a)}}function bu(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 ku(e,s){return e.kind==="ready"?"ready":e.kind==="running"&&s&&s.tone!=="progress"?s.tone==="success"?"success":"failure":"running"}const ju=({name:e,action:s,keyRoute:a,phase:i,onStart:r,onCancel:l,onOpenLink:c,onClose:u})=>{ie();const d=i.kind==="running"?i.operation:null,g=i.kind==="running"?vu(e,d,a):null,p=i.kind==="starting"||i.kind==="running"&&g?.tone==="progress",f=g&&g.tone!=="progress",h=o.useRef(null),x=o.useRef(!1),v=ku(i,g);o.useEffect(()=>{if(!x.current){x.current=!0;return}v&&h.current?.focus()},[v]);const b=()=>u(g?.tone==="success"?"signed-in":"dismissed");return t.jsx(Fs,{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:j=>{j.preventDefault(),h.current?.focus()}},actions:t.jsxs(t.Fragment,{children:[p&&d?t.jsx(dn,{ref:h,onClick:()=>l(d.id),children:n("ui.settings.integrations.integration_sign_in_dialog.cancel_sign_in")}):t.jsx(dn,{ref:i.kind==="ready"?void 0:h,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(un,{ref:h,onClick:r,children:n("ui.settings.integrations.integration_sign_in_dialog.continue_in_browser")}):null,i.kind==="refused"||g?.tone==="failure"?t.jsx(un,{ref:g?.tone==="failure"?h: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(Me,{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:f?"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(Me,{size:"xs",className:"mt-0.5"}):null,g.tone==="failure"?t.jsx(Mr,{"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(()=>gn(n("ui.settings.integrations.integration_sign_in_dialog.sign_in_link_copied"))).catch(()=>{})},children:t.jsx(Os,{"aria-hidden":"true"})})]}),t.jsx(F,{variant:"link",size:"sm",onClick:()=>c(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]})})},wu=e=>e.reduce((s,a)=>s?(a.updated_at??0)>(s.updated_at??0)?a:s:a,null),Nu=/^[A-Za-z]:[\\/]/,Ft=e=>{const s=e?.trim();return s&&(s.startsWith("/")||Nu.test(s))?s:null};function Su(e){const r=e?.payload?.frontend?.snapshot?.cwd;return typeof r=="string"&&r.trim()?r:null}const dt="local-operator.settings.integrations.last-cwd";function Mu(e,s,a=typeof localStorage>"u"?null:localStorage){const i=Ft(s);if(!(!e||!i||!a))try{const r=a.getItem(dt),l=r?JSON.parse(r):{};if(l[e]===i)return;a.setItem(dt,JSON.stringify({...l,[e]:i}))}catch{}}const ka=()=>typeof localStorage>"u"?null:localStorage;function ja(e=ka()){if(!e)return{};try{const s=e.getItem(yn);if(!s)return{};const a=JSON.parse(s);return!a||typeof a!="object"||Array.isArray(a)?{}:a}catch{return{}}}const hs=256;function Cu(e,s=ka()){if(s)try{const a={...ja(s),...e},i=Object.keys(a);if(i.length>hs){const r={};for(const l of i.slice(-hs))r[l]=a[l];s.setItem(yn,JSON.stringify(r));return}s.setItem(yn,JSON.stringify(a))}catch{}}function xs(e,s,a){if(e==="saved")return null;if(e==="replace_confirmation_required"){const r=pa(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 Eu(e,s=typeof localStorage>"u"?null:localStorage){if(!(!e||!s))try{const a=s.getItem(dt);if(!a)return;const i=JSON.parse(a);if(!(e in i))return;const r={...i};delete r[e],s.setItem(dt,JSON.stringify(r))}catch{}}const Au=e=>!!(e&&typeof e=="object"&&"code"in e&&e.code==="invalid_cwd"),Iu=(e,s)=>s!==null&&e===s?null:e;function Ru(e,s=typeof localStorage>"u"?null:localStorage){if(!e||!s)return null;try{const a=s.getItem(dt);if(!a)return null;const r=JSON.parse(a)[e];return typeof r=="string"?r:null}catch{return null}}const Tu=e=>e.action==="disconnect"?"disconnected":"connected";function Lu(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 Ou(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 Fu({sessionId:e}){const s=gt(),a=Qe(s.data,"mcp_catalog"),i=Qe(s.data,"mcp"),r=a?"catalog":i?"session":null,[l,c]=o.useState(null),u=ut(),d=it(A=>A.sessions),g=it(A=>A.fetchSessions),p=it(A=>A.loading),f=o.useMemo(()=>d.find(A=>A.session_id===e)??null,[d,e]),h=o.useMemo(()=>r==="session"&&!e?wu(d):null,[r,e,d]),x=r==="session"?e??h?.session_id??null:null;o.useEffect(()=>{r!=="session"||e||d.length>0||g(Ki)},[r,e,d.length,g]);const v=r==="catalog"?Ft(f?.cwd):null,b=r==="catalog"&&!!e&&v===null,j=Ee({queryKey:["desktop","session-cwd",e??""],queryFn:()=>xe({op:"sessions.get",sessionId:e??""}),enabled:b,staleTime:Number.POSITIVE_INFINITY,retry:!1}),L=b&&!j.isFetched,C=v??Ft(Su(j.data))??(j.isFetched?Ft(Ru(e)):null),I=Iu(C,l),N=r==="catalog"?I:null,S=r==="catalog"?e??null:null,M=Ya.catalog(N,S);o.useEffect(()=>{r!=="catalog"||!e||!N||Mu(e,N)},[r,e,N]);const H=o.useRef(0),[G,O]=o.useState(0),K=o.useRef(null),q=o.useCallback((A,Y)=>{const U=Date.now()+gs;H.current=U,K.current={name:A,expect:Y},O(U)},[]),z=o.useCallback(A=>Date.now()<H.current?va:Qd(A),[]),V=Ee({queryKey:M,queryFn:()=>Xa(N,S),enabled:r==="catalog"&&!L,staleTime:1e4,refetchInterval:A=>z(A.state.data)}),Q=Au(V.error);o.useEffect(()=>{!Q||!C||l===C||(c(C),Eu(e))},[Q,C,l,e]);const B=Ee({queryKey:mn.list(x??""),queryFn:()=>ei(x??""),enabled:r==="session"&&!!x,staleTime:1e4,refetchInterval:A=>z(A.state.data?vn(A.state.data,x??""):void 0)}),W=o.useMemo(()=>{if(r==="catalog")return V.data;if(r==="session"&&B.data&&x)return vn(B.data,x)},[r,V.data,B.data,x]),te=o.useCallback(()=>Du({queryClient:u,route:r,catalogKey:M,sessionId:x}),[r,M,u,x]);o.useEffect(()=>{if(!G)return;const A=K.current;if(!A)return;const Y=W?.servers.find(re=>re.name===A.name);!Y||!(A.expect==="connected"?Y.status==="connected":Y.status_basis==="live"&&Y.status!=="connected")||(H.current=0,K.current=null,O(0))},[W,G]);const m=o.useRef({}),[k,y]=o.useState(0),E=o.useMemo(()=>(m.current=Kd(Vd(m.current,W,ja()),W),m.current),[W,k]),J=o.useRef("");o.useEffect(()=>{const A=qd(E,W);if(!Object.keys(A).length)return;const Y=JSON.stringify(A);Y!==J.current&&(J.current=Y,Cu(A))},[E,W]);const $=o.useCallback(A=>{const Y=Ke(m.current,A);Y.needsKey||(m.current={...m.current,[A]:{...Y,needsKey:!0}},y(U=>U+1))},[]),ne=o.useCallback(A=>{if(A.action!=="disconnect"&&A.action!=="connect"&&A.action!=="reload")return;const Y=Ke(m.current,A.name),U=Date.now()+gs,re=A.action==="disconnect"?{...Y,connectedAt:null,disconnectedAt:Date.now(),holdUntil:U}:{...Y,disconnectedAt:null,holdUntil:U};m.current={...m.current,[A.name]:re},q(A.name,Tu(A)),y(ue=>ue+1)},[q]),ae=o.useCallback(async A=>{if(r==="catalog"){const Y=Lu(A);if(!Y)return null;try{const U=await Za(N,Y);return u.setQueryData(M,U),ne(A),U.operation?.id??null}catch(U){throw U instanceof Mn&&U.status===409&&u.invalidateQueries({queryKey:M}),U}}if(r==="session"&&x){const Y=await xe({op:"mcp.control",sessionId:x,control:Ou(A)});ne(A);const U=mn.list(x),re=Y?.data;return re&&"servers"in re&&Array.isArray(re.servers)?(u.setQueryData(U,re),null):(u.invalidateQueries({queryKey:U}),re&&"id"in re&&typeof re.id=="string"?re.id:null)}return null},[r,N,M,u,x,ne]),ce=o.useCallback(async A=>{if(r==="catalog"&&S&&(A.action==="connect"||A.action==="disconnect"||A.action==="reload")){try{await xe({op:"mcp.control",sessionId:S,control:{action:A.action,name:A.name,...A.action==="disconnect"?{confirmed:!0}:{}}})}catch(Y){throw u.invalidateQueries({queryKey:M}),Y}return ne(A),await u.invalidateQueries({queryKey:M}),null}return ae(A)},[r,S,u,M,ae,ne]),pe=o.useCallback(async(A,Y,U,re)=>{if(r==="catalog"){const ue=await Ja(N,A,Y,U,re);if(ue.catalog&&u.setQueryData(M,ue.catalog),ue.code!=="saved")return{saved:!1,message:xs(ue.code,ue.failed_ids,Y)};try{await ae({action:"test",name:A})}catch{}return{saved:!0,message:null}}if(r==="session"&&x){const ue=await xe({op:"mcp.credentials.store",sessionId:x,name:A,values:Y,confirmedReplace:U});if(ue.data?.code!=="saved")return{saved:!1,message:xs(ue.data?.code,ue.data?.failed_ids??[],Y)};try{await ae({action:"connect",name:A})}catch{}return{saved:!0,message:null}}return{saved:!1,message:null}},[r,N,M,u,ae,x]),ke=r==="catalog"?V:B,de=o.useCallback(()=>{ke.refetch()},[ke]);return{enabled:r!==null,route:r,sessionId:r==="catalog"?S:x,borrowed:h,noConversation:r==="session"&&!x&&!p,document:W,isLoading:s.isLoading||r==="catalog"&&(L||V.isLoading)||r==="session"&&(x?B.isLoading:p),isError:ke.isError,folderUnavailable:Bd(l,C),refetch:de,readDocument:te,control:ce,storeKeys:pe,memories:E,markNeedsKey:$}}function Du(e){if(e.route==="catalog")return e.queryClient.getQueryData(e.catalogKey);if(e.route==="session"&&e.sessionId){const s=e.queryClient.getQueryData(mn.list(e.sessionId));return s?vn(s,e.sessionId):void 0}}const zu=(e,s)=>{const a=e?.trim();if(!a)return null;const i=ni(a,s);return i.kind==="auth"?{kind:"matched",name:i.name,unresolved:null}:{kind:"miss",asked:a}},$u=6,sn="ui.settings.integrations.mcp_management_section.copy_section_title",Pu="ui.settings.integrations.mcp_management_section.copy_section_description",Uu={test:"test",connect:"reconnect",disconnect:"disconnect",reload:"reload",remove:"remove",sign_out:"disconnect",cancel:"cancel",login:"grant",reauth:"grant"},Ku=({sessionId:e,sectionRef:s,highlightServer:a})=>{ie();const i=Fu({sessionId:e}),{document:r,control:l,readDocument:c}=i,u=qs(),d=r?.servers??[],g=r?.operations??[],p=r?.project_scope_available??!1,[f,h]=o.useState(!1),[x,v]=o.useState(""),[b,j]=o.useState(null),[L,C]=o.useState({}),[I,N]=o.useState(null),[S,M]=o.useState(null),[H,G]=o.useState({kind:"ready"}),[O,K]=o.useState(null),[q,z]=o.useState(null),[V,Q]=o.useState(!1),B=o.useRef({}),W=o.useRef({}),te=o.useRef({}),m=o.useRef(0),k=o.useRef(null),y=o.useRef(null),E=o.useRef(null),[J,$]=o.useState(null),[ne,ae]=o.useState(null),[ce,pe]=o.useState(null),ke=o.useCallback(()=>{const _=E.current;E.current=null,M(null),K(null),window.setTimeout(()=>{_?.isConnected&&_.focus()},0)},[]),de=o.useCallback(_=>{const w=window.document.activeElement;E.current=w instanceof HTMLElement?w:null,M(_)},[]),A=o.useCallback((_,w)=>{ae({name:_,waitForSignIn:w==="signed-in",until:Date.now()+st,reanchors:0}),ke()},[ke]),Y=o.useMemo(()=>zu(a,d.map(_=>_.name)),[a,d]),U=Y?.kind==="matched"?Y.name:null,re=o.useRef(null),ue=o.useRef(null),Fe=x.trim().toLowerCase(),ve=o.useMemo(()=>Fe?d.filter(_=>_.name.toLowerCase().includes(Fe)):d,[d,Fe]),je=Ud(ve,g,i.memories),Ae=S?.kind==="sign_in"?d.find(_=>_.name===S.name)??null:null;o.useEffect(()=>{!U||ue.current===U||!x||v("")},[U,x]),o.useEffect(()=>{!U||ue.current===U||ve.some(_=>_.name===U)&&(ue.current=U,re.current?.scrollIntoView({block:"center",behavior:"smooth"}))},[U,ve]),o.useEffect(()=>{if(!O)return;const _=g.find(w=>w.id===O)??null;G({kind:"running",operation:_})},[g,O]);const be=g.some(_=>_.status==="running"),Z=_=>{const w=window.document.activeElement;w&&w!==window.document.body&&w.isConnected||ae({name:_,waitForSignIn:!1,until:Date.now()+st,reanchors:0})},se=async(_,w,T)=>{j(_),C(({[_]:Ne,...ye})=>ye);let ee=null,me=!1;try{ee=await T()}catch(Ne){me=!0,C(ye=>({...ye,[_]:St(Uu[w]??"status",Ne,be)}))}finally{j(null),w!=="sign_out"&&(w!=="remove"||me)&&Z(_)}return{operationId:ee,failed:me}},R=_=>d.find(w=>w.name===_),X=_=>{_.source.path&&si(_.source.path)},oe=async(_,w)=>{G({kind:"starting"}),K(null);try{const T=await l({action:w,name:_});T?K(T):G({kind:"running",operation:null})}catch(T){T instanceof Mn&&T.code==="oauth_unsupported"&&i.markNeedsKey(_),G({kind:"refused",message:St("grant",T,be)})}},ge=(_,w)=>{switch(w.kind){case"sign_in":case"reauth":{const T=g.find(ee=>ee.name===_.name&&ee.status==="running");T&&ft(T)?(G({kind:"running",operation:T}),K(T.id)):(G({kind:"ready"}),K(null)),de({kind:"sign_in",name:_.name,action:w.kind==="reauth"?"reauth":"login"});return}case"set_key":z(null),de({kind:"key",name:_.name,keyNames:_.auth.secret_refs.map(T=>T.id)});return;case"fix":X(_);return;case"sign_out":N({name:_.name,kind:"sign_out"});return;default:{const T=w.kind;se(_.name,T,()=>l({action:T,name:_.name}))}}},Be=(_,w)=>{switch(w.kind){case"remove":case"sign_out":N({name:_.name,kind:w.kind});return;case"sign_in":case"reauth":case"set_key":ge(_,{kind:w.kind,label:w.label});return;case"open_config":X(_);return;case"copy_setup":navigator.clipboard.writeText(_.setup_prompt??"").then(()=>gn(n("ui.settings.integrations.mcp_management_section.setup_steps_copied_paste_them_into_a_chat"))).catch(()=>{});return;case"cancel":{const T=g.find(ee=>ee.name===_.name&&ee.status==="running");T&&se(_.name,"cancel",()=>l({action:"cancel",operationId:T.id}));return}case"test":case"connect":case"disconnect":case"reload":{const T=w.kind;se(_.name,T,()=>l({action:T,name:_.name}));return}default:return}},Vt=(_,w)=>{if(N(null),w==="remove"){const T=_.source.owned_scope;if(!T)return;const ee=ve.findIndex(me=>me.name===_.name);se(_.name,"remove",()=>l({action:"remove",name:_.name,scope:T})).then(({operationId:me,failed:Ne})=>{Ne||me!==null||(gn(n("ui.settings.integrations.mcp_management_section.removed_name",{name:String(_.name)})),ee>=0&&pe({index:ee}))});return}se(_.name,"sign_out",()=>l({action:"logout",name:_.name})).then(()=>{ae({name:_.name,waitForSignIn:!1,until:Date.now()+st,reanchors:0})})},_t=async _=>{try{return await l({action:"add",name:_.name,scope:_.scope,..._.mode==="command"?{command:_.command,args:_.args}:{url:_.url}}),h(!1),$(_.name),null}catch(w){return St("add",w,!1)}},Je=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(sn)}),t.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:n(Pu)})]}),i.enabled&&d.length>0&&!f?t.jsxs(F,{ref:k,variant:"secondary",size:"sm",onClick:()=>h(!0),"data-tour-tag":"mcp-add-server",children:[t.jsx(Gn,{"aria-hidden":"true"}),n("ui.settings.integrations.mcp_management_section.add_integration")]}):null]});if(!i.enabled&&!i.isLoading)return t.jsx(_e,{title:n(sn),titleComponent:Je,sectionRef:s,searchSection:"integrations",searchSectionLabel:n("ui.settings.navigation.settings_sidebar.integrations"),children:t.jsx(le,{variant:"warning",children:n("ui.settings.integrations.mcp_management_section.integrations_need_a_newer_local_operator_backend_update_it_and_re")})});const ht=t.jsx(iu,{existingNames:d.map(_=>_.name),projectScopeAvailable:p,projectLabel:r?.cwd?qu(r.cwd):null,onSubmit:_t,onCancel:()=>{h(!1),window.setTimeout(()=>k.current?.focus(),0)}}),xt=S?R(S.name):void 0,yt=Object.entries(L).filter(([_])=>!d.some(w=>w.name===_)),vt=_=>C(({[_]:w,...T})=>T);o.useEffect(()=>{if(!J)return;const _=B.current[J];if(!_){d.some(w=>w.name===J)&&(W.current[J]?.focus(),$(null));return}_.focus(),$(null)},[J,d]),o.useEffect(()=>{if(!ce)return;const w=ve[Math.min(ce.index,ve.length-1)]??ve.at(-1);if(w){const T=B.current[w.name]??W.current[w.name];if(!T)return;T.focus()}else k.current?.focus();pe(null)},[ce,ve]);const D=o.useCallback((_,w)=>{const T=c()??r,ee=T?.servers.find(De=>De.name===_.name),me=T?.operations??[],Ne=ee?ee.status==="connecting"||Ze(ee.name,me)!==null:!1;Ne&&ee&&(m.current=w);const ye=ee?zn(ee,me,i.memories):null;if(ee&&_.waitForSignIn&&(ye?.kind==="sign_in"||ye?.kind==="reauth"))return"kept";const Ce=cu({hold:_,now:w,windowMs:st,rowMoving:Ne,lastMovingAt:m.current,candidate:ee?uu({primary:ye?B.current[ee.name]:null,overflow:W.current[ee.name]}):void 0,active:window.document.activeElement,body:window.document.body});if(!Ce.hold)return ae(null),"finished";if(!Ce.land)return"kept";ae({name:_.name,waitForSignIn:!1,until:Ce.hold.until,landedOn:Ce.land,reanchors:Ce.hold.reanchors});const Ie=Ce.land;return window.setTimeout(()=>{Ie.isConnected&&Ie.focus()},0),"landed"},[c,r,i.memories]);return o.useEffect(()=>{if(!ne)return;D(ne,Date.now());let _=0,w=!1;const T=()=>{if(w)return;const ee=gu({verdict:D(ne,Date.now()),watchMs:ps});ee!==null&&(_=window.setTimeout(T,ee))};return _=window.setTimeout(T,ps),()=>{w=!0,window.clearTimeout(_)}},[ne,D]),o.useEffect(()=>{if(!ne)return;const _=w=>{du({target:w.target,row:te.current[ne.name]})&&ae(null)};return window.document.addEventListener("pointerdown",_,!0),()=>{window.document.removeEventListener("pointerdown",_,!0)}},[ne]),t.jsxs(_e,{title:n(sn),titleComponent:Je,sectionRef:s,searchSection:"integrations",searchSectionLabel:n("ui.settings.navigation.settings_sidebar.integrations"),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(Me,{size:"lg",label:n("ui.settings.integrations.mcp_management_section.loading_integrations")})}):null,i.folderUnavailable?t.jsx(le,{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(le,{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,yt.map(([_,w])=>t.jsx(le,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:w}),t.jsx(F,{variant:"ghost",size:"sm",onClick:()=>vt(_),children:n("ui.settings.integrations.mcp_management_section.dismiss")})]})},_)),f&&d.length>0?ht:null,d.length>=$u?t.jsxs("div",{className:"relative",children:[t.jsx(wn,{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 start-3 size-4 -translate-y-1/2 text-ink-dim"}),t.jsx(Le,{ref:y,value:x,onChange:_=>v(_.target.value),onKeyDown:_=>{_.key!=="Escape"||!x||(_.preventDefault(),v(""))},placeholder:n("ui.settings.integrations.mcp_management_section.search_integrations_placeholder",{integrations:jd(d.length)}),"aria-label":n("ui.settings.integrations.mcp_management_section.search_integrations"),className:"ps-9"})]}):null,Y?.kind==="miss"&&d.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(Y.asked)})}):null,Y?.kind==="matched"&&Y.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(Y.name),asked:String(Y.unresolved)})}):null,r&&d.length===0&&!i.isLoading?f?ht:t.jsxs("div",{className:"flex flex-col items-start gap-3 rounded-lg bg-surface p-6",children:[t.jsx(Ds,{"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:()=>h(!0),"data-tour-tag":"mcp-add-server",children:[t.jsx(Gn,{"aria-hidden":"true"}),n("ui.settings.integrations.mcp_management_section.add_integration")]})]}):null,d.length>0&&ve.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:()=>{v(""),window.setTimeout(()=>{(y.current??k.current)?.focus()},0)},children:n("ui.settings.integrations.mcp_management_section.clear_search")})]}):null,je.map(_=>t.jsxs("section",{"aria-labelledby":`integrations-group-${_.id}`,className:"flex flex-col gap-1.5",children:[t.jsxs("h3",{id:`integrations-group-${_.id}`,className:"px-1 text-ink-dim text-meta",children:[_.title," · ",_.rows.length]}),t.jsx("ul",{className:"flex flex-col divide-y divide-hairline overflow-hidden rounded-lg bg-surface",children:_.rows.map(w=>t.jsx(xu,{row:w,operations:g,memories:i.memories,projectScopeAvailable:p,highlighted:w.name===U,rowRef:T=>{te.current[w.name]=T,w.name===U&&(re.current=T)},primaryRef:T=>{B.current[w.name]=T},overflowRef:T=>{W.current[w.name]=T},pending:b===w.name,failure:L[w.name]??null,confirm:I?.name===w.name?{kind:I.kind}:null,onPrimary:T=>ge(w,T),onOverflow:T=>Be(w,T),onConfirm:()=>I&&Vt(w,I.kind),onCancelConfirm:()=>{N(null),window.setTimeout(()=>{W.current[w.name]?.focus()},0)}},w.id))})]},_.id))]}),S?.kind==="sign_in"?t.jsx(ju,{name:S.name,action:S.action,keyRoute:Ae?Bt(Ae):!1,phase:H,onStart:()=>void oe(S.name,S.action),onCancel:_=>void l({action:"cancel",operationId:_}).catch(()=>{}),onOpenLink:_=>void ti(_),onClose:_=>A(S.name,_)}):null,S?.kind==="key"?t.jsx(fu,{name:S.name,keyNames:S.keyNames.length?S.keyNames:xt?.auth.secret_refs.map(_=>_.id)??[],keyless:S.keyNames.length===0,savedKeys:xt?.auth.secret_refs.filter(_=>_.state==="encrypted").map(_=>_.id),saving:V,failure:q,onClose:ke,onSave:(_,w,T)=>{Q(!0),z(null),i.storeKeys(S.name,_,w,T).then(ee=>{if(!ee.saved){z(ee.message);return}M(null),ae({name:S.name,waitForSignIn:!1,until:Date.now()+st,reanchors:0})}).catch(ee=>z(St("key",ee,!1))).finally(()=>Q(!1))}}):null]})},st=4e3,Bu=/^\/(?:Users|home)\/[^/]+(?=\/|$)/,qu=e=>e.replace(Bu,"~"),ot=new WeakMap,ys=new WeakSet;function wa(e,s){if(!ys.has(e)){ys.add(e);let i=Ge(e);ai(e,()=>{const r=Ge(e);i!==r&&(i=r,ot.delete(e))})}if(!s.startsWith(`${Ge(e)}:`))return;const a=ot.get(e);if(a?.key===s)return a;ot.delete(e)}function Vu(e,s,a){if(s.startsWith(`${Ge(e)}:`)){if(wa(e,s),!Object.keys(a).length){ot.delete(e);return}ot.set(e,{key:s,fields:a})}}const Hu=we.object({display_name:we.string(),title:we.string(),description:we.string(),timezone:we.string()}),Gu=Hu.extend({account_id:we.string(),display_label:we.string(),avatar_url:we.string().optional(),avatar:we.object({source:we.string(),hash:we.string(),updated_at:we.string().optional()}).optional()}),Wu=we.object({scope:we.string().regex(/^[a-f0-9]{64}$/),profile:Gu});class vs extends Error{constructor(s,a){super("Account profile request failed"),this.code=s,this.status=a}}async function Mt(e,s=null){const a=await Bi(e,s);if(a.kind!=="json")throw new vs(a.kind==="error"?a.code:void 0,a.kind==="error"?a.status:null);const i=Wu.parse(a.body.result);if(i.profile.account_id!==e.expectedAccountId)throw new vs("account_mismatch",409);return i}const Ct={read:e=>Mt({op:"account.profile",expectedAccountId:e}),update:(e,s,a)=>Mt({op:"account.profile.update",expectedAccountId:e,scope:s,fields:a}),upload:(e,s,a)=>Mt({op:"account.avatar.put",expectedAccountId:e,scope:s},a),remove:(e,s,a)=>Mt({op:"account.avatar.delete",expectedAccountId:e,scope:s,mode:a,confirmed:!0})};function an(e,s){return Object.fromEntries(Object.keys(e).filter(a=>e[a]!==s[a]).map(a=>[a,s[a]]))}const Na={snapshot:(e,s)=>["account-profile",e,s]};function rn(e,s,a){if(Ge(e)!==s||ii(e).accountId!==a.profile.account_id)throw new Error("Account authority changed");e.setQueryData(Na.snapshot(a.profile.account_id,s),a),e.setQueryData(Vn.user(),i=>{if(!i||i.account.id!==a.profile.account_id)return i;const{display_name:r,title:l,description:c,timezone:u,avatar:d,avatar_url:g}=a.profile;return{...i,account:{...i.account,profile:{...i.account.profile,display_name:r,title:l,description:c,timezone:u,avatar:d},avatar_url:g}}}),e.invalidateQueries({predicate:i=>i.queryKey[0]==="team-bridge"&&i.queryKey.some((r,l)=>r==="account"&&i.queryKey[l+1]===a.profile.account_id)}),e.invalidateQueries({queryKey:Vn.user()})}function Qu(e=!0,s=()=>"personal"){const a=ut(),i=zs(),r=i.accountId,l=s(),c=Ee({queryKey:Na.snapshot(r??"unresolved",i.token),enabled:e&&!!r,retry:!1,queryFn:()=>ri(a,r,()=>Ct.read(r??""))}),u=()=>{if(!r||Ge(a)!==i.token||s()!==l)throw new Error("Account authority changed")};return{...c,authority:i,async update(d){if(u(),!c.data||!r)throw new Error("Account profile unresolved");const g=await Ct.update(r,c.data.scope,d);return u(),rn(a,i.token,g),g},async upload(d){if(u(),!c.data||!r)throw new Error("Account profile unresolved");const g=await Ct.upload(r,c.data.scope,d);return u(),rn(a,i.token,g),g},async remove(d){if(u(),!c.data||!r)throw new Error("Account profile unresolved");const g=await Ct.remove(r,c.data.scope,d);return u(),rn(a,i.token,g),g}}}const Yu=1024*1024;function Zu(e){const s=new DataView(e.buffer,e.byteOffset,e.byteLength);if(e.length>=24&&s.getUint32(0)===2303741511&&s.getUint32(4)===218765834&&s.getUint32(12)===1229472850)return{width:s.getUint32(16),height:s.getUint32(20)};if(e.length>=4&&e[0]===255&&e[1]===216){let a=2;for(;a+3<e.length;){if(e[a++]!==255)return null;for(;e[a]===255;)a++;const i=e[a++];if(i===217||i===218||a+2>e.length)return null;if(i===1||i>=208&&i<=215)continue;const r=s.getUint16(a);if(r<2||a+r>e.length)return null;if([192,193,194,195,197,198,199,201,202,203,205,206,207].includes(i)&&r>=8)return{width:s.getUint16(a+5),height:s.getUint16(a+3)};a+=r}}if(e.length>=25&&s.getUint32(0)===1380533830&&s.getUint32(8)===1464156752&&s.getUint32(4,!0)+8===e.length){const a=s.getUint32(12);if(a===1448097880&&e.length>=30)return{width:1+e[24]+(e[25]<<8)+(e[26]<<16),height:1+e[27]+(e[28]<<8)+(e[29]<<16)};if(a===1448097824&&e.length>=30&&e[23]===157&&e[24]===1&&e[25]===42)return{width:s.getUint16(26,!0)&16383,height:s.getUint16(28,!0)&16383};if(a===1448097868&&e[20]===47)return{width:1+((e[22]&63)<<8|e[21]),height:1+((e[24]&15)<<10|e[23]<<2|(e[22]&192)>>6)}}return null}function bs(e){return!!(e&&e.width>0&&e.height>0&&e.width<=4096&&e.height<=4096&&e.width*e.height<=16e6)}async function Ju(e){if(!e.size||e.size>Yu||!["image/png","image/jpeg","image/webp"].includes(e.type))throw new Error("Profile image refused");const s=new Uint8Array(await e.arrayBuffer());if(!bs(Zu(s)))throw new Error("Profile image dimensions refused");const a=await createImageBitmap(e,{imageOrientation:"from-image"});if(!bs(a))throw a.close(),new Error("Profile decoded image dimensions refused");return a}const Et=e=>({display_name:e.profile.display_name,title:e.profile.title,description:e.profile.description,timezone:e.profile.timezone}),Dt={display_name:64,title:80,description:500},Xu=e=>Dt[e]*2,ks=8,js=e=>e.formatToParts(new Date).find(s=>s.type==="timeZoneName")?.value;function eg(){return[...new Set(["UTC",...Intl.supportedValuesOf("timeZone")])].map(e=>{const s=js(new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"shortOffset"})),a=js(new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"short"})),i=[s,a].filter(r=>!!r&&r!==e);return{id:e,name:e.split("_").join(" "),description:s,keywords:i}})}function tg({snapshot:e,initialDraft:s,onDraftChange:a,photoUrl:i,onSave:r,onUpload:l,onRemove:c}){ie();const u=o.useId(),[d,g]=o.useState(()=>Et(e)),[p,f]=o.useState(()=>({...Et(e),...s})),[h,x]=o.useState(!1),[v,b]=o.useState(!1),[j,L]=o.useState(),[C,I]=o.useState(),[N,S]=o.useState(),[M,H]=o.useState(),[G,O]=o.useState(),[K,q]=o.useState(),z={heading:o.useRef(null),photo:o.useRef(null),remove:o.useRef(null),remove_cancel:o.useRef(null),cancel:o.useRef(null),keep_editing:o.useRef(null),display_name:o.useRef(null),title:o.useRef(null),description:o.useRef(null)},V=o.useMemo(eg,[]),[Q,B]=o.useState(!1),[W,te]=o.useState(!1),[m,k]=o.useState(),y=zr(m),E=o.useRef(null),J=o.useRef(void 0),$=o.useRef(!0),ne=o.useRef(0),ae=Object.keys(an(d,p)).length>0;o.useEffect(()=>{a?.(an(d,p))},[d,p,a]);const ce=N==="photo_invalid"?n("ui.settings.personal_profile.photo_invalid"):N?n("ui.settings.personal_profile.photo_error"):void 0,pe=e.profile.avatar,ke=pe?.source==="uploaded"?"uploaded":"provider",de=h||v;o.useEffect(()=>($.current=!0,()=>{$.current=!1,ne.current++,J.current?.close()}),[]),o.useEffect(()=>{K&&(z[K].current?.focus(),q(void 0))});const A=()=>{ne.current++,J.current?.close(),J.current=void 0,k(void 0),S(void 0)},Y=()=>{A(),q("photo")},U=()=>{B(!1),q("cancel")},re=()=>{te(!1),q("remove")},ue=(R,X=!1)=>oe=>{oe.key!=="Escape"||X||(oe.preventDefault(),oe.stopPropagation(),R())},Fe=async R=>{if(!R||de)return;const X=++ne.current;S(void 0),b(!0),O(void 0);try{const oe=await Ju(R);if(!$.current||X!==ne.current){oe.close();return}J.current?.close(),J.current=oe,k(oe),te(!1)}catch{$.current&&X===ne.current&&S("photo_invalid")}finally{$.current&&X===ne.current&&b(!1)}},ve=async()=>{if(!$.current||de||!ae)return;const R=an(d,p),X=Object.keys(Dt).map(oe=>oe in R&&[...p[oe]].length>Dt[oe]?{field:oe,reason:"length"}:oe==="description"&&p.description.split(`
|
|
288
|
-
`).length>ks?{field:oe,reason:"lines"}:void 0).find(Boolean);if(X){I(X),q(X.field);return}x(!0),L(void 0),I(void 0),H(void 0);try{const oe=await r(R);if(!$.current)return;g(Et(oe)),f(Et(oe)),H("saved"),q("heading")}catch{$.current&&L("save_error")}finally{$.current&&x(!1)}},je=async R=>{if(!$.current||de)return;b(!0),S(void 0),O(void 0);const X=ne.current,oe=y.capture();try{if(R.size>1024*1024)throw new Error("Profile crop too large");if(!await Pr(y,oe,()=>R.arrayBuffer(),Be=>{if(!(!$.current||X!==ne.current))return l(new Uint8Array(Be))})||!$.current)return;A(),O("photo_saved"),q("photo")}catch{$.current&&S("photo_error")}finally{$.current&&b(!1)}},Ae=async()=>{if(!(!$.current||de)){b(!0),S(void 0),O(void 0);try{await c(ke),$.current&&(te(!1),O("photo_removed"),q("photo"))}catch{$.current&&S("photo_error")}finally{$.current&&b(!1)}}},be=(R,X)=>{h||(f(oe=>({...oe,[R]:X})),H(void 0),L(void 0),C?.field===R&&I(void 0),B(!1))},Z=R=>C?.field!==R?void 0:C.reason==="lines"?n("ui.settings.personal_profile.description_lines",{count:String(ks)}):n("ui.settings.personal_profile.field_too_long",{count:String(Dt[R])}),se=(R,X,oe)=>{const ge=Z(R);return t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Te,{htmlFor:`${u}-${R}`,children:X}),oe({id:`${u}-${R}`,value:p[R],maxLength:Xu(R),readOnly:h,"aria-invalid":ge?!0:void 0,"aria-describedby":ge?`${u}-${R}-error`:void 0}),ge&&t.jsx("p",{id:`${u}-${R}-error`,className:"text-meta text-danger",children:ge})]})};return t.jsxs("section",{"aria-labelledby":`${u}-heading`,className:"flex min-w-0 flex-col gap-4","data-account-profile-editor":"",children:[t.jsx("h3",{ref:z.heading,id:`${u}-heading`,tabIndex:-1,className:"text-section font-semibold text-ink focus:outline-none",children:n("ui.settings.personal_profile.heading")}),t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsx("span",{className:"inline-flex size-16 shrink-0 items-center justify-center overflow-hidden rounded-full bg-sunken text-ink-muted","aria-hidden":"true",children:i?t.jsx("img",{alt:"",src:i,className:"size-full object-cover"}):e.profile.display_label.trim()[0]||"?"}),t.jsx(F,{ref:z.photo,variant:"secondary",size:"sm",disabled:de,onClick:()=>E.current?.click(),children:pe?.hash?n("ui.settings.personal_profile.replace"):n("ui.settings.personal_profile.choose")}),pe?.hash&&t.jsx(F,{ref:z.remove,variant:"ghost",size:"sm",disabled:de,onClick:()=>{te(!0),A(),q("remove_cancel")},children:n("ui.settings.personal_profile.remove")}),t.jsx("input",{ref:E,type:"file",accept:"image/png,image/jpeg,image/webp",className:"sr-only",tabIndex:-1,"aria-hidden":"true",disabled:de,onChange:R=>{const X=R.currentTarget.files?.[0];R.currentTarget.value="",Fe(X)}})]}),t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.personal_profile.photo_help")}),t.jsx("output",{className:"text-meta text-ink-muted empty:hidden",children:G==="photo_saved"?n("ui.settings.personal_profile.photo_saved"):G==="photo_removed"?n("ui.settings.personal_profile.photo_removed"):null}),m&&t.jsx("div",{onKeyDown:ue(Y,v),children:t.jsx($r,{source:m,outputEdge:256,onSave:R=>void je(R),onCancel:Y,saving:v,error:ce,previewSizes:[{id:"profile",px:64,label:n("ui.settings.personal_profile.preview"),caption:n("ui.settings.personal_profile.preview_caption")}],copy:{cropArea:n("ui.settings.personal_profile.crop_area"),instructions:(R,X)=>n("ui.settings.personal_profile.crop_instructions",{width:String(R),height:String(X)}),zoom:n("ui.settings.personal_profile.zoom"),zoomIn:n("ui.settings.personal_profile.zoom_in"),zoomOut:n("ui.settings.personal_profile.zoom_out"),zoomValue:R=>n("ui.settings.personal_profile.zoom_value",{value:R}),recenter:n("ui.settings.personal_profile.recenter"),previews:n("ui.settings.personal_profile.previews"),save:n("ui.settings.personal_profile.save_photo"),saving:n("ui.settings.personal_profile.saving"),cancel:n("ui.common.actions.cancel"),errorEncode:n("ui.settings.personal_profile.crop_error")}})}),W&&t.jsxs("fieldset",{className:"flex flex-col gap-2","aria-label":n("ui.settings.personal_profile.remove"),onKeyDown:ue(re,v),children:[t.jsx("p",{className:"text-body-sm text-ink",children:ke==="uploaded"?n("ui.settings.personal_profile.remove_uploaded"):n("ui.settings.personal_profile.remove_provider")}),t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx(F,{variant:"danger",size:"sm",disabled:de,onClick:()=>void Ae(),children:v?n("ui.settings.personal_profile.saving"):n("ui.settings.personal_profile.remove")}),t.jsx(F,{ref:z.remove_cancel,variant:"secondary",size:"sm",disabled:de,onClick:re,children:n("ui.common.actions.cancel")})]})]}),N&&!m&&t.jsx("p",{role:"alert",className:"text-meta text-danger",children:ce}),t.jsxs("form",{className:"flex min-w-0 flex-col gap-4",onSubmit:R=>{R.preventDefault(),ve()},"aria-busy":h,children:[se("display_name",n("ui.settings.personal_profile.display_name"),R=>t.jsx(Le,{ref:z.display_name,...R,onChange:X=>be("display_name",X.target.value),autoComplete:"nickname"})),se("title",n("ui.settings.personal_profile.title"),R=>t.jsx(Le,{ref:z.title,...R,onChange:X=>be("title",X.target.value),autoComplete:"organization-title"})),se("description",n("ui.settings.personal_profile.description"),R=>t.jsx(Rn,{ref:z.description,...R,onChange:X=>be("description",X.target.value),rows:3})),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Te,{asChild:!0,children:t.jsx("span",{"aria-hidden":"true",children:n("ui.settings.personal_profile.timezone")})}),t.jsx(Ys,{showLabel:!1,ariaLabel:n("ui.settings.personal_profile.timezone"),placeholder:n("ui.settings.personal_profile.timezone_placeholder"),busyLabel:n("ui.settings.personal_profile.loading"),options:V,selected:p.timezone?V.find(R=>R.id===p.timezone)??{id:p.timezone,name:p.timezone.split("_").join(" ")}:null,onSelect:R=>be("timezone",R.id),onClear:()=>be("timezone","")})]}),j&&t.jsx("p",{role:"alert",className:"text-meta text-danger",children:n("ui.settings.personal_profile.save_error")}),Q?t.jsxs("div",{className:"flex flex-col gap-2",onKeyDown:ue(U),children:[t.jsx("p",{role:"alert",className:"text-body-sm text-ink",children:n("ui.settings.personal_profile.discard")}),t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx(F,{type:"button",variant:"secondary",size:"sm",onClick:()=>{f(d),B(!1),L(void 0),I(void 0),q("heading")},children:n("ui.settings.personal_profile.discard_action")}),t.jsx(F,{ref:z.keep_editing,type:"button",variant:"primary",size:"sm",onClick:U,children:n("ui.settings.personal_profile.keep_editing")})]})]}):t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx(F,{type:"submit",variant:"primary",size:"sm",disabled:!ae||de,children:h?n("ui.settings.personal_profile.saving"):n("ui.settings.personal_profile.save")}),t.jsx(F,{ref:z.cancel,type:"button",variant:"secondary",size:"sm",disabled:!ae||h,onClick:()=>{B(!0),q("keep_editing")},children:n("ui.common.actions.cancel")})]})]}),t.jsx("output",{className:"text-meta text-ink-muted empty:hidden",children:M==="saved"?n("ui.settings.personal_profile.saved"):null}),t.jsxs(F,{variant:"link",size:"sm",className:"w-fit",onClick:()=>Sn("https://console.radienthq.com/dashboard/account"),children:[n("ui.settings.personal_profile.manage"),t.jsx($s,{"aria-hidden":"true"})]})]})}function ng(){return ie(),t.jsx("output",{className:"text-body-sm text-ink-muted",children:n("ui.settings.personal_profile.loading")})}function sg({onRetry:e}){return ie(),t.jsxs("div",{className:"flex flex-col items-start gap-2",children:[t.jsx("p",{role:"alert",className:"text-body-sm text-danger",children:n("ui.settings.personal_profile.load_error")}),t.jsx(F,{variant:"secondary",size:"sm",onClick:e,children:n("ui.common.actions.retry")})]})}const ag=/^[a-f0-9]{16}$/;function ig(){ie();const e=gt(),s=Qe(e.data,"account_profile"),a=zs(),i=o.useCallback(()=>{try{return JSON.stringify(a.accountId?Lr(window.localStorage,a.accountId)??"personal":"unresolved")}catch{return"unresolved"}},[a.accountId]),r=o.useCallback(v=>{const b=j=>{(j.key===Fr||j.key===null)&&v()};return window.addEventListener("storage",b),()=>window.removeEventListener("storage",b)},[]),l=o.useSyncExternalStore(r,i,i),c=Qu(s,i),u=o.useRef(null),d=c.data,g=ut(),p=`${c.authority.token}:${l}:${d?.scope??""}`,f=d?wa(g,p):void 0,h=d?.profile.avatar?.hash,x=nr(d&&h&&ag.test(h)?{accountId:d.profile.account_id,hash:h}:null,256);return o.useEffect(()=>{!d||!Or(c.authority.token)||(u.current?.scrollIntoView({block:"start"}),u.current?.focus({preventScroll:!0}))},[d,c.authority.token]),s?!c.authority.accountId||c.isPending?t.jsx(ng,{}):d?t.jsx("div",{ref:u,tabIndex:-1,"aria-label":n("ui.settings.personal_profile.heading"),className:"focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2",children:t.jsx(tg,{snapshot:d,initialDraft:f?.fields,onDraftChange:v=>Vu(g,p,v),photoUrl:x,onSave:c.update,onUpload:c.upload,onRemove:c.remove},p)}):t.jsx(sg,{onRetry:()=>void c.refetch()}):t.jsx(F,{variant:"secondary",size:"sm",onClick:()=>Sn("https://console.radienthq.com/dashboard/account"),children:n("ui.settings.personal_profile.manage")})}const rg=({verification:e})=>{ie();const{prices:s}=li(),a=e.grant_amount??s?.default_new_credits,{sentence:i,action:r}=ci(e.signup_grant,di(a)),l=ui(e.claim_url,gi);return t.jsxs("div",{className:"mt-8 flex items-start gap-3 rounded-sm border border-hairline bg-surface p-3",children:[t.jsx(Kt,{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:()=>Sn(l),children:r})]})]})},og=({onAfterCredentialUpdate:e})=>{ie();const{isAuthenticated:s,user:a,isLoading:i,accountRead:r,signOut:l}=oi(),c=Ps(f=>f.isSigningOut),u=o.useCallback(async()=>{try{await l()}catch(f){console.error("Error signing out:",f)}},[l]),d=(()=>{if(!s||!a?.radientUser)return null;const{account:f,identity:h,verification:x}=a.radientUser,v=x!=null&&!x.email_verified&&x.signup_grant!=="claimed";return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"mb-8",children:t.jsx(ig,{})}),t.jsxs(mt,{children:[t.jsx(he,{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(ct,{variant:"success",className:"capitalize",children:f.status})]})}),t.jsx(he,{label:n("ui.settings.account.radient_account_section.name"),value:f.name||n("ui.settings.account.radient_account_section.not_provided")}),t.jsx(he,{label:n("ui.settings.account.radient_account_section.email"),value:f.email}),t.jsx(he,{label:n("ui.settings.account.radient_account_section.account_id"),value:t.jsx("span",{className:"text-mono-sm",children:f.id})}),t.jsx(he,{label:n("ui.settings.account.radient_account_section.tenant_id"),value:t.jsx("span",{className:"text-mono-sm",children:f.tenant_id})}),t.jsx(he,{label:n("ui.settings.account.radient_account_section.provider"),value:t.jsx("span",{className:"capitalize",children:h.provider})}),t.jsx(he,{label:n("ui.settings.account.radient_account_section.created"),value:Us(f.created_at)})]}),v&&x?t.jsx(rg,{verification:x}):null,t.jsx("div",{className:"mt-8",children:t.jsx(sr,{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(ar,{}),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"):Ks(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"),p=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(Dr,{titleText:"",onAfterCredentialUpdate:e,descriptionText:"",onSignInSuccess:()=>{}})})]});return i||c?t.jsxs("div",{className:"flex min-h-36 flex-col items-center justify-center gap-3",children:[t.jsx(Me,{size:"lg",label:n("ui.settings.account.radient_account_section.loading_account")}),!c&&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?d:t.jsx("div",{className:"flex flex-col gap-4",children:p})},on={label:1,synonym:.8,key:.75,choice:.7,section:.6,description:.4},lg={exact:1,prefix:.92,substring:.7,subsequence:.45};function Sa(e){return e.length<4||!e.endsWith("s")?e:/(?:ch|sh|ss|x|z)es$/.test(e)?e.slice(0,-2):e.slice(0,-1)}function ws(e){let s=!1;const a=e.split(" ").map(i=>{const r=Sa(i);return r!==i&&(s=!0),r}).join(" ");return s?a:e}const Ns=new WeakMap,Ss={exact:3,prefix:2,substring:1};function cg(e,s,a){const i=Sa(a),r=[bt(e,a)];i!==a&&r.push(bt(e,i)),s!==e&&(r.push(bt(s,a)),i!==a&&r.push(bt(s,i)));let l=null;for(const c of r)!c||c==="subsequence"||(!l||Ss[c]>Ss[l])&&(l=c);return l}const dg=12,ug=2;function gg(e,s){let a=0,i=-1,r=null,l=Ns.get(e.fields);if(!l){l={};for(const c of Object.keys(on)){const u=e.fields[c];u&&(l[c]=ws(u))}Ns.set(e.fields,l)}for(const c of s){let u=-1,d=null;for(const g of Object.keys(on)){const p=e.fields[g];if(!p)continue;const f=cg(p,l[g]??ws(p),c);if(!f)continue;const h=on[g]*lg[f];h>u&&(u=h,d=g)}if(d===null)return null;a+=u,u>i&&(i=u,r=d)}return r?{score:a,reason:r}:null}function mg(e,s,a=dg){const i=ir(s);if(i.length===0)return{results:[],total:0};const r=lt(s),l=[];for(const c of e){const u=gg(c,i);if(!u)continue;const d=c.fields.label!==""&&c.fields.label===r;l.push({entry:c,reason:u.reason,score:d?u.score+ug:u.score})}return l.sort((c,u)=>u.score-c.score||c.entry.fields.label.length-u.entry.fields.label.length||c.entry.order-u.entry.order),{results:l.slice(0,Math.max(0,a)).map(({entry:c,reason:u})=>({entry:c,reason:u})),total:l.length}}function pg(e){return lt(e)===""}function fg(e){const s=new Map;for(const r of e){const l=r.entry.sectionId||"",c=s.get(l);if(c){c.results.push(r);continue}s.set(l,{sectionId:l,sectionLabel:r.entry.sectionLabel,results:[r]})}const a=[...s.values()],i=a.filter(r=>r.sectionId==="");return[...a.filter(r=>r.sectionId!==""),...i]}const _g={label:"ui.settings.search.reason.label",synonym:"ui.settings.search.reason.synonym",key:"ui.settings.search.reason.key",choice:"ui.settings.search.reason.choice",section:"ui.settings.search.reason.section",description:"ui.settings.search.reason.description"};function hg(e){const{registry:s,sections:a,build:i=Bc}=e,r=ie();return o.useMemo(()=>i({registry:s,sections:a}),[i,s,a,r])}function xg(){return fi()==="mac"?"⌘F":"Ctrl+F"}const yg=o.forwardRef(function({index:s,readRendered:a,onJump:i,onDismiss:r,className:l},c){ie();const u=o.useRef(null),d=o.useRef(null),[g,p]=o.useState(null),[f,h]=o.useState(""),[x,v]=o.useState(!1),[b,j]=o.useState(-1),[L,C]=o.useState(""),I=o.useId();o.useImperativeHandle(c,()=>({focus:()=>{u.current?.focus(),v(!0)}}));const N=o.useCallback(()=>a?.()??[],[a]),S=o.useCallback(()=>{p(N())},[N]),M=o.useCallback(()=>{p(y=>y??N())},[N]),H=o.useCallback(()=>{const y=g;return y&&y.length>0?[...s,...y]:s},[s,g]),G=pg(f),{results:O,total:K}=o.useMemo(()=>mg(H(),f),[H,f]),q=o.useMemo(()=>fg(O),[O]),z=b<0||O.length===0?-1:Math.min(b,O.length-1),V=z>=0?O[z]:void 0,Q=o.useMemo(()=>new Map(O.map((y,E)=>[y.entry.id,E])),[O]),B=o.useCallback(y=>{y!==void 0&&h(y),v(!1),j(-1),r?.()},[r]),W=o.useCallback(async y=>{if(await i(y)==="missing"){C(n("ui.settings.search.jump.missing"));return}C(""),v(!1),j(-1)},[i]),te=y=>`${I}-option-${y}`,m=y=>{switch(y.key){case"ArrowDown":y.preventDefault(),v(!0),j(E=>O.length===0?-1:E<0?0:(E+1)%O.length);return;case"ArrowUp":y.preventDefault(),v(!0),j(E=>O.length===0?-1:E<0?O.length-1:(E-1+O.length)%O.length);return;case"Home":if(!x)return;y.preventDefault(),j(0);return;case"End":if(!x)return;y.preventDefault(),j(Math.max(0,O.length-1));return;case"Enter":if(y.preventDefault(),!x){v(!0);return}{const E=V??O[0];E&&W(E.entry)}return;case"Escape":if(y.preventDefault(),f!==""){h(""),C(""),j(-1);return}B();return;default:return}},k=G?"":n("ui.settings.search.results.count",{count:K});return t.jsxs("div",{ref:d,className:fe("relative @container w-full",l),onBlur:y=>{const E=y.relatedTarget;E&&d.current?.contains(E)||(v(!1),j(-1),r?.())},children:[t.jsxs("div",{className:"relative",children:[t.jsx(wn,{size:14,"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 left-2.5 -translate-y-1/2 text-ink-dim"}),t.jsx(Le,{ref:u,role:"combobox","aria-expanded":x,"aria-controls":x?I:void 0,"aria-activedescendant":x&&V?te(z):void 0,"aria-autocomplete":"list","aria-label":n("ui.settings.search.field.label"),placeholder:n("ui.settings.search.field.placeholder"),value:f,type:"text",className:"pl-8",onFocus:()=>{S(),v(!0)},onChange:y=>{M(),h(y.currentTarget.value),j(-1),C(""),v(!0)},onKeyDown:m})]}),x&&t.jsxs("div",{id:I,role:"listbox",tabIndex:-1,"aria-label":n("ui.settings.search.panel.label"),className:"absolute top-full right-0 z-40 mt-2 flex max-h-[min(24rem,60vh)] w-full min-w-80 flex-col overflow-y-auto rounded-md border border-hairline bg-elevated p-1 shadow-overlay",children:[L&&t.jsx("p",{"data-search-notice":"","aria-hidden":"true",className:"px-2 pt-2 pb-1 text-body-sm text-ink",children:L}),G?t.jsxs("div",{className:"flex flex-col gap-1 px-2 py-2",children:[t.jsx("p",{className:"text-body-sm text-ink",children:n("ui.settings.search.empty.summary")}),t.jsx("p",{className:"text-meta text-ink-dim",children:t.jsx(mi,{text:n("ui.settings.search.empty.shortcut",{shortcut:pi(xg())})})})]}):O.length===0?t.jsxs("div",{className:"flex flex-col gap-2 px-2 py-2",children:[t.jsx("p",{className:"text-body-sm text-ink",children:n("ui.settings.search.no_results.title",{query:f})}),t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.search.no_results.hint")}),t.jsx("button",{type:"button",className:"min-h-6 w-fit rounded-sm px-1.5 py-1 text-body-sm text-accent underline-offset-2 hover:underline focus-visible:outline-2",onMouseDown:y=>y.preventDefault(),onClick:()=>{B(""),u.current?.focus()},children:n("ui.settings.search.no_results.clear")})]}):t.jsxs(t.Fragment,{children:[q.map(y=>t.jsxs("div",{role:y.sectionLabel?"group":void 0,"aria-label":y.sectionLabel||void 0,children:[y.sectionLabel&&t.jsx("p",{className:"px-2 pt-2 pb-1 font-medium text-ink-muted text-meta",children:y.sectionLabel}),y.results.map(E=>{const J=Q.get(E.entry.id)??0,$=J===z;return t.jsxs("div",{id:te(J),role:"option","aria-selected":$,"data-search-result-id":E.entry.id,className:fe("flex cursor-pointer flex-col gap-0.5 rounded-sm px-2 py-1.5 @[40rem]:flex-row @[40rem]:items-baseline @[40rem]:justify-between @[40rem]:gap-4",$?"bg-accent-wash outline-solid outline-1 -outline-offset-1 outline-control":"hover:bg-row-hover"),onMouseDown:ne=>ne.preventDefault(),onMouseEnter:()=>j(J),onClick:()=>W(E.entry),children:[t.jsx("span",{className:"min-w-0 text-body-sm text-ink",children:E.entry.label}),t.jsxs("span",{className:"@[40rem]:shrink-0 @[40rem]:text-right text-meta text-ink-dim",children:[E.entry.sectionLabel&&n("ui.settings.search.row.section_hint",{section:E.entry.sectionLabel}),E.entry.sectionLabel&&" · ",n(_g[E.reason]),E.entry.detail&&E.entry.detail!==E.entry.sectionLabel&&t.jsxs(t.Fragment,{children:[" · ",E.entry.detail]})]})]},E.entry.id)})]},y.sectionId||"no-section")),K>O.length&&t.jsx("p",{"data-search-more":"",className:"px-2 pt-1 pb-2 text-meta text-ink-dim",children:n("ui.settings.search.results.more",{count:K-O.length})})]})]}),t.jsx("output",{"aria-live":"polite",className:"sr-only",children:L||k})]})});function vg({metric:e,data:s}){return ie(),t.jsx(_i,{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)}`:hi(a),children:t.jsx(sc,{data:s,children:t.jsx(Rs,{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 bg={all:["desktop","tts-path-resolution"]};function kg(e){return Ee({queryKey:bg.all,queryFn:()=>xe({op:"tts.paths"}),enabled:e,staleTime:Number.POSITIVE_INFINITY,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:qi})}const jg=["speech.voice.gender","speech.voice.tone","speech.voice.expressiveness","speech.voice.pace","speech.voice.language","speech.voice.accent","speech.voice.instructions"];function Ms(e){const s=new Map(e.map(r=>[r.key,r])),a=[],i=[];for(const r of jg){const l=s.get(r);l?a.push(l):i.push(r)}return{rows:a,missing:i}}const wg=["provider_tts_radient","provider_tts_elevenlabs","provider_tts_openai","none"];function Cs(e){return typeof e=="string"&&wg.includes(e)}function Ng(e){if(e===null||typeof e!="object")return null;const s=e;if(!Cs(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(!Cs(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 Sg={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 Ma(e){return Sg[e]}function Mg(e){return{servable:e.servable,serving:e.path==="none"?null:e.path,reason:e.reason,rungs:e.rungs.map(s=>({path:s.path,name:Ma(s.path),available:s.available,reason:s.reason}))}}const Cg="ui.settings.speech.speech_section.copy_backend_older_sentence",Ca="ui.settings.speech.speech_section.copy_unavailable_sentence",Eg=({resetErrorBoundary:e})=>(ie(),t.jsx(le,{variant:"warning",children:t.jsxs("div",{className:"flex flex-col items-start gap-3",children:[t.jsx("span",{children:n(Ca)}),t.jsxs(F,{variant:"secondary",onClick:e,children:[t.jsx(Er,{"aria-hidden":"true"}),n("ui.settings.speech.speech_section.try_again")]})]})}));function Ag(e){return e==="enabled"?"ready":e==="below-version"?"older":"pairing"}const Ig=({sectionRef:e})=>{ie();const s=gt(),a=Bs(),i=Vi(s.data,"tts"),r=Ag(i),l=Ee({queryKey:zt.all,queryFn:()=>xe({op:"settings.list"}),enabled:r==="ready",staleTime:1e4}),c=kg(r==="ready"),{hasRadientApiKey:u,hasRadientSession:d,speechBlock:g}=xi(),p=`${d}:${u}`,f=o.useRef(p),h=c.refetch;o.useEffect(()=>{f.current!==p&&(f.current=p,h())},[p,h]);const x=l.data,v=o.useMemo(()=>Ms(x?.settings??[]),[x]),[b,j]=o.useState({}),[L,C]=o.useState({}),[I,N]=o.useState({});o.useEffect(()=>{x&&j(m=>{let k=!1;const y={...m};for(const E of Ms(x.settings).rows){const J=m[E.key];if(J&&J.value!==tt(E).value)continue;const $=tt(E);J&&J.value===$.value&&J.cascadeBase===$.cascadeBase||(y[E.key]=$,k=!0)}return k?y:m})},[x]);const S=(m,k)=>C(y=>({...y,[m]:k})),M=(m,k)=>N(y=>({...y,[m]:k})),H=async m=>{const k=b[m.key];if(!k)return;const y=bi(m,k);if(!y.ok){M(m.key,y.error);return}S(m.key,!0),M(m.key,null);try{await xe(y.request),S(m.key,!1);const J=(await l.refetch()).data?.settings.find($=>$.key===m.key);J&&j($=>{const ne=$[m.key];return ne&&ne.value===k.value&&ne.cascadeBase===k.cascadeBase?{...$,[m.key]:tt(J)}:$})}catch(E){S(m.key,!1),M(m.key,E instanceof Error?E.message:n("ui.settings.speech.speech_section.the_setting_could_not_be_saved"))}},G=async m=>{S(m.key,!0),M(m.key,null);try{await xe({op:"settings.reset",key:m.key}),j(k=>({...k,[m.key]:tt({...m,value:m.default,is_default:!0})})),S(m.key,!1),await l.refetch()}catch(k){S(m.key,!1),M(m.key,k instanceof Error?k.message:n("ui.settings.speech.speech_section.the_setting_could_not_be_reset"))}},O=o.useMemo(()=>Ng(c.data),[c.data]),K=O?Mg(O):null,q=c.isSuccess&&O===null,z=(s.data?null:s.error)??null,V=l.error,Q=n("ui.settings.speech.speech_section.speech_voicing"),B=n("ui.settings.speech.speech_section.how_the_assistant_sounds_when_it_speaks_aloud");if(r==="pairing"){const{sentence:m}=pn(a??null,n("ui.settings.speech.speech_section.speech_settings_could_not_be_loaded"),z);return t.jsx(_e,{title:Q,icon:kt,description:B,sectionRef:e,children:t.jsx(le,{variant:"warning",children:m})})}if(r==="older")return t.jsx(_e,{title:Q,icon:kt,description:B,sectionRef:e,children:t.jsx(le,{variant:"warning",children:n(Cg)})});if(V||!x){const{sentence:m,remedy:k}=pn(a??null,n("ui.settings.speech.speech_section.speech_settings_could_not_be_loaded"),V);return t.jsx(_e,{title:Q,icon:kt,description:B,sectionRef:e,children:t.jsx(le,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:m}),k&&t.jsx(F,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{l.refetch()},children:n("ui.settings.speech.speech_section.retry")})]})})})}const W=K?!K.servable:g==="offline",te=K?K.rungs.find(m=>m.path===K.serving)??null:null;return t.jsx(_e,{title:Q,icon:kt,description:B,sectionRef:e,searchSection:"speech",searchSectionLabel:n("ui.settings.navigation.settings_sidebar.speech_voicing"),searchIgnore:"speech rows are registry keys read from the daemon's own selection",children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsxs("section",{className:"flex flex-col gap-3",children:[c.isPending&&t.jsxs("p",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[t.jsx(Me,{}),Hn("checking")]}),(c.isError||q)&&!K&&g!=="offline"&&t.jsx(le,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("span",{children:[n(Ca)," ",c.error instanceof Error?c.error.message:""]}),t.jsx(F,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{c.refetch()},children:n("ui.settings.speech.speech_section.retry")})]})}),t.jsx(Cr,{fallbackRender:Eg,resetKeys:[c.dataUpdatedAt],children:K&&t.jsxs(t.Fragment,{children:[t.jsxs(mt,{children:[t.jsx(he,{label:n("ui.settings.speech.speech_section.speaks_through"),value:K.serving?Ma(K.serving):n("ui.settings.speech.speech_section.nothing_yet")}),t.jsx(he,{label:n("ui.settings.speech.speech_section.availability"),value:K.servable?n("ui.settings.speech.speech_section.ready"):n("ui.settings.speech.speech_section.no_provider")})]}),K.reason&&K.reason!==te?.reason&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:K.reason}),t.jsx("ul",{className:"flex flex-col gap-1",children:K.rungs.map(m=>t.jsxs("li",{className:"flex flex-col gap-0.5 text-body-sm",children:[t.jsxs("span",{className:m.path===K.serving?"text-ink":"text-ink-muted",children:[m.name,t.jsxs("span",{className:m.path===K.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))})]})})]}),W&&t.jsx(le,{variant:"warning",children:Hn(g)}),t.jsx("div",{className:"flex flex-col gap-1",children:v.rows.map(m=>t.jsx(yi,{setting:m,draft:b[m.key]??tt(m),tier:vi(m),saving:!!L[m.key],error:I[m.key]??null,onDraftChange:k=>j(y=>({...y,[m.key]:k})),onSave:()=>{H(m)},onReset:()=>{G(m)}},m.key))}),v.missing.length>0&&t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.speech.speech_section.missing_voice_rows",{count:v.missing.length,rows:v.missing.join(", ")})})]})})},Rg=()=>{ie();const{data:e,isLoading:s,error:a,refetch:i}=ec(),r=tc(),[l,c]=o.useState(""),[u,d]=o.useState(!1);o.useEffect(()=>{c(e?.content??""),d(!1)},[e]);const g=v=>{const b=v.target.value;c(b),d(b!==(e?.content??""))},p=async()=>{if(!(!u||r.isPending))try{const v={content:l};await r.mutateAsync(v),await i(),d(!1)}catch(v){console.error("Error updating system prompt:",v)}},f=()=>{c(e?.content??""),d(!1)},h=r.isPending,x=()=>t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Te,{htmlFor:"app-system-prompt",children:n("ui.settings.model.system_prompt.instructions")}),t.jsx(Rn,{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:p,disabled:!u||h,children:[h?t.jsx(Me,{size:"sm"}):t.jsx(Ws,{}),h?n("ui.settings.model.system_prompt.saving"):n("ui.settings.model.system_prompt.save_changes")]}),t.jsx(F,{onClick:f,disabled:!u||h,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:Nn(e.last_modified)})]})]});return t.jsx(_e,{title:n("ui.settings.model.system_prompt.system_prompt"),icon:Ur,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(Me,{size:"lg",label:n("ui.settings.model.system_prompt.loading_system_prompt")})}):a?t.jsx(le,{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")})}):x()})},Tg=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"],Lg=e=>Tg.includes(e),Og=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 c=0;c<r;c+=l)s.push({start:a+c,count:Math.min(l,r-c)});a+=r}return s},Fg=({index:e,key:s,groups:a})=>{const i=Og(a),r=i.reduce((l,c)=>l+c.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(d=>e>=d.start&&e<d.start+d.count),c=i[l+(s==="ArrowDown"?1:-1)];if(!c)return e;const u=e-i[l].start;return c.start+Math.min(u,c.count-1)}default:return e}},Dg={localOperatorDark:dl,localOperatorLight:Al,dracula:kl,dune:zo,sage:nl,monokai:or,tokyoNight:pl,iceberg:wl,radient:Yo,neon:ji,obsidian:Js,synth:Jr,catppuccinMocha:jo,catppuccinLatte:rl,tokyoNightStorm:fo,gruvbox:ro,nord:Jl,oneDark:Yr,solarizedDark:Cl,rosePine:Ko,rosePineMoon:ll,rosePineDawn:bo,alucard:qo,gruvboxLight:Ao,tokyoNightDay:gl,oneLight:al,catppuccinFrappe:Co,catppuccinMacchiato:Jo,palenight:ki,everforest:ql,everforestLight:Kl,kanagawaWave:Wl,kanagawaLotus:Po,ayuDark:Ro,ayuMirage:Lo,ayuLight:xl,nightfox:ho,duskfox:Ll,synthwave:_l,matrix:eo,tron:mo,cyberpunk:rr,vaporwave:Pl,outrun:ao,neonNoir:Hl,arcade:el,forest:zl,ocean:Fo,desert:Fl,autumn:Yl,lavender:Sl,arctic:yo,rosewood:Wo,solarizedLight:Rl,githubLight:Ho,paper:Kr,linen:vl,highContrastLight:Wr,mintLight:no},Es="bg-[color-mix(in_srgb,var(--color-accent)_8%,var(--color-accent-wash))]",zg=({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"})]})]})]}),$g=({id:e,name:s,description:a,isSelected:i,isTabStop:r,onSelect:l,onFocusTile:c})=>{const u=Dg[e];return t.jsx(Ye,{side:"bottom",align:"start",content:a,children:t.jsxs("button",{type:"button","data-theme-tile":e,"aria-pressed":i,tabIndex:r?0:-1,onFocus:c,onClick:l,className:fe("relative flex flex-col gap-1.5 rounded-md p-1 text-start transition-colors duration-fast ease-out-quart",i?Es:"hover:bg-surface"),children:[t.jsxs("span",{className:fe("relative block h-10 overflow-hidden rounded-sm border transition-colors duration-fast ease-out-quart",i?"border-accent":"border-hairline"),children:[t.jsx(zg,{id:e}),i&&t.jsx("span",{className:fe("pointer-events-none absolute top-0.5 end-0.5 flex h-4 w-4 items-center justify-center rounded-full",Es),children:t.jsx(Zs,{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})]})]})})},Pg=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)}}),Ug=()=>{ie();const{themeName:e,setTheme:s}=at(),a=Object.values(Ra),i=[{label:n("ui.settings.appearance.theme_selector.dark"),items:a.filter(d=>d.theme.palette.mode==="dark")},{label:n("ui.settings.appearance.theme_selector.light"),items:a.filter(d=>d.theme.palette.mode==="light")}].filter(d=>d.items.length>0),[r,l]=o.useState(null),c=o.useMemo(()=>{const d=i.flatMap(g=>g.items.map(p=>p.id));return r&&d.includes(r)?r:d.includes(e)?e:d[0]},[i,r,e]),u=d=>{if(!Lg(d.key))return;const g=[...d.currentTarget.querySelectorAll("[data-theme-tile]")],p=g.indexOf(d.target);if(p<0)return;d.preventDefault();const f=Fg({index:p,key:d.key,groups:Pg(d.currentTarget)});f!==p&&g[f]?.focus()};return t.jsx(Ar,{children:t.jsx("div",{onKeyDown:u,"data-search-ignore":"the theme picker is a grid of fifty-nine choices; the Appearance section result is its destination",className:"flex flex-col gap-6",children:i.map(d=>t.jsxs("div",{children:[t.jsx("h3",{className:"px-1 pb-2 text-meta text-ink-dim",children:d.label}),t.jsx("div",{"data-theme-grid":d.label,className:"grid grid-cols-[repeat(auto-fill,minmax(160px,1fr))] gap-2",children:d.items.map(({id:g,name:p,description:f})=>t.jsx($g,{id:g,name:p,description:f,isSelected:g===e,isTabStop:g===c,onSelect:()=>s(g),onFocusTile:()=>l(g)},g))})]},d.label))})})},Kg=({value:e,onChange:s,searchRow:a})=>{ie();const i=o.useId();return t.jsxs("div",{"data-search-row":a,"data-search-control":a?"":void 0,className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("span",{id:i,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($t,{value:e,onValueChange:r=>s(Vs(r)),children:t.jsx(Pt,{"aria-labelledby":i,children:Hi.map(r=>t.jsx(Ve,{value:r.value,children:r.value==="by-turn"?n("ui.settings.appearance.transcript_display_mode_setting.by_turn"):n("ui.settings.appearance.transcript_display_mode_setting.by_response")},r.value))})})})]})},Bg=()=>{ie();const{data:e,isLoading:s,error:a}=ic({enabled:!0});return t.jsxs("div",{children:[t.jsxs("h3",{className:"mb-3 flex items-center gap-2 text-heading text-ink",children:[t.jsx(So,{size:16,className:"shrink-0 text-ink-dim"}),n("ui.settings.account.settings_page.radient_pass")]}),s&&t.jsx(Se,{className:"h-6 w-36"}),a&&t.jsx(le,{variant:"warning",children:n("ui.settings.account.settings_page.credit_balance_load_failed",{reason:a.message})}),e&&!s&&!a&&t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[t.jsxs("p",{className:"flex-1 text-body-sm text-ink-muted",children:[n("ui.settings.account.settings_page.available_credits")," ",t.jsx("span",{className:"font-medium text-ink",children:e.balance.toFixed(2)})]}),t.jsx(F,{variant:"secondary",size:"sm",asChild:!0,children:t.jsxs("a",{href:"https://console.radienthq.com/dashboard/billing",target:"_blank",rel:"noopener noreferrer",children:[t.jsx(uo,{}),n("ui.settings.account.settings_page.add_credits")]})})]})]})},qg=[{id:"credits",get label(){return n("ui.settings.account.settings_page.credits")}},{id:"tokens",get label(){return n("ui.settings.account.settings_page.tokens")}}],Vg=()=>{ie();const[e,s]=o.useState("credits"),a=o.useMemo(()=>{const u=new Date,d=nc(u);return{start_date:Jn(d),end_date:Jn(u),rollup:"daily"}},[]),{data:i,isLoading:r,error:l}=oc(a,{enabled:!0}),c=o.useMemo(()=>i?.data_points?[...i.data_points].sort((d,g)=>Qt(d.timestamp).getTime()-Qt(g.timestamp).getTime()).map(d=>({bucket:Ii(Vr(Qt(d.timestamp),"yyyy-MM-dd")),value:e==="credits"?Number.parseFloat(d.total_cost.toFixed(2)):d.total_tokens})):[],[i,e]);return t.jsxs("div",{children:[t.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[t.jsxs("h3",{className:"flex items-center gap-2 text-heading text-ink",children:[t.jsx(lo,{size:16,className:"shrink-0 text-ink-dim"}),n("ui.settings.account.settings_page.usage_last_30_days")]}),t.jsxs("fieldset",{className:"m-0 w-fit border-0 p-0",children:[t.jsx("legend",{className:"sr-only",children:n("ui.settings.account.settings_page.usage_metric")}),t.jsx("div",{"data-glass-well":"",className:"flex gap-0.5 rounded-md bg-sunken p-0.5",children:qg.map(({id:u,label:d})=>t.jsx(F,{variant:"ghost",size:"sm","aria-pressed":e===u,onClick:()=>s(u),className:fe(e===u&&"bg-surface text-ink hover:bg-surface"),children:d},u))})]})]}),r&&t.jsx(Se,{className:"h-62 w-full"}),l&&t.jsx(le,{variant:"warning",children:n("ui.settings.account.settings_page.usage_load_failed",{reason:l.message})}),!r&&!l&&i&&c.length>0&&t.jsx(vg,{metric:e,data:c}),!r&&!l&&(!i||c.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")})]})},Hg=()=>(ie(),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(vr,{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($s,{})]})})]})),cm=()=>{ie();const e=wi(),s=at(D=>D.showAgentReasoning),a=at(D=>D.setShowAgentReasoning),i=at(D=>D.transcriptDisplayMode),r=at(D=>D.setTranscriptDisplayMode),{data:l,isLoading:c,isFetching:u,error:d,refetch:g}=Ni(),{needsProvider:p}=Si(),f=Bs(),{sentence:h,remedy:x}=pn(f??null,n("ui.settings.navigation.settings_page.your_settings_could_not_be_loaded"),d),v=lr(),[b,j]=o.useState(null),L=Ps(),{isAuthenticated:C,accountRead:I,isFetching:N,isRefreshing:S,refreshUser:M}=jn(),H=it(D=>D.activeSessionId),G=it(D=>D.sessions),O=Lc(),{accountId:K,snapshot:q,model:z}=Gs(),V=o.useRef(null);q.status?V.current={accountId:K,status:q.status}:q.checking||(V.current=null);const Q=q.status??(V.current?.accountId===K?V.current.status:null),B=pc(O),W=o.useMemo(()=>cr.filter(D=>D.id!=="agent-messages"||O!=="absent"),[O]),te=o.useCallback(()=>z.check("surface_open",!0),[z]),[m,k]=o.useState("general"),[y,E]=o.useState(!1),J=o.useRef(null),$=o.useRef(null),{startTour:ne}=dr(),ae=Gi(),ce=qs(),{data:pe,refetch:ke}=Mi(),{refreshModels:de}=Ci(),A=o.useMemo(()=>pe?.keys?[...pe.keys].sort():[],[pe?.keys]),Y=o.useRef({keys:"",hosting:void 0});o.useEffect(()=>{const D=A.join(","),_=l?.values?.hosting;(Y.current.keys!==D||Y.current.hosting!==_)&&(Y.current={keys:D,hosting:_},de().catch(w=>{console.error("Failed to refresh models after credentials or hosting change:",w)}))},[A,l?.values?.hosting,de]);const U=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,re=o.useMemo(()=>new URLSearchParams(ae.search).get("setting"),[ae.search]),ue=o.useMemo(()=>new URLSearchParams(ae.search).get("filter")??"",[ae.search]),Fe=o.useMemo(()=>new URLSearchParams(ae.search).get("mcp")??void 0,[ae.search]),ve=o.useMemo(()=>new URLSearchParams(ae.search).get("provider"),[ae.search]),je=o.useCallback(D=>{k(D),E(!0);const _=U[D],w=$.current;if(_?.current&&w){const ee=_.current.getBoundingClientRect().top-w.getBoundingClientRect().top;w.scrollHeight>w.clientHeight?w.scrollTo({top:Math.max(0,w.scrollTop+ee-80),behavior:"smooth"}):window.scrollTo({top:Math.max(0,_.current.getBoundingClientRect().top+window.scrollY-80),behavior:"smooth"}),clearTimeout(J.current??void 0),J.current=setTimeout(()=>{E(!1),J.current=null},800)}else E(!1)},[U]),Ae=o.useRef(null),be=o.useRef(null),Z=gt(),se=Qe(Z.data,"settings"),R=Ee({queryKey:zt.all,queryFn:()=>xe({op:"settings.list"}),enabled:se,staleTime:1e4}),X=hg({registry:R.data,sections:W}),oe=o.useCallback(()=>$.current?Kc($.current):[],[]),[ge,Be]=o.useState(null),Vt=o.useCallback(async D=>{be.current=null;const _=$.current??document;if(D.source==="page")return Gc(_,D.id.slice(5));if(D.source==="section")return Wc(_,D.sectionId);const w=D.settingKey;if(!w)return"missing";const T=At(w,"backend");return R.data&&!R.data.settings.some(ee=>ee.key===w)?"missing":(je(T),Be({key:w,nonce:Date.now()}),_.querySelector(`[data-search-section="${T}"]`)?"landed":"missing")},[je,R.data]);o.useEffect(()=>{Be(null)},[ae.search]),o.useEffect(()=>{const D=_=>{!(_.metaKey||_.ctrlKey)||_.altKey||_.key.toLowerCase()==="f"&&(Wi(_.target)||(_.preventDefault(),be.current=$.current?.scrollTop??null,Ae.current?.focus()))};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[]),o.useEffect(()=>{const D=setTimeout(()=>{const _=$.current;if(!_)return;const w=()=>{if(y)return;const T=_.getBoundingClientRect(),ee=T.height;let me="",Ne=0;for(const[ye,Ce]of Object.entries(U))if(Ce.current){const Ie=Ce.current.getBoundingClientRect(),De=T.top,Xe=Ie.top-De,et=Ie.bottom-De,Ea=Ie.height,Aa=Math.max(0,Xe),Ia=Math.min(ee,et),Un=Math.max(0,Ia-Aa)/Ea,Kn=Un+(Xe<ee*.3?.1:0);Kn>Ne&&Un>.1&&(Ne=Kn,me=ye)}me&&me!==m&&k(me)};return w(),_.addEventListener("scroll",w,{passive:!0}),()=>{_.removeEventListener("scroll",w),clearTimeout(J.current??void 0)}},100);return()=>clearTimeout(D)},[U,m,y]),o.useEffect(()=>{const D=new URLSearchParams(ae.search),_=D.get("section"),w=D.get("setting"),T=w?At(w,"backend"):_;if(T==="agent-messages"&&!B)return;const ee=T?U[T]:void 0;if(!T||!ee)return;let me=!1,Ne=Number.NaN,ye=0;const Ce=window.setTimeout(()=>{me||(me=!0,De.disconnect(),je(T))},2e3),Ie=()=>{if(me)return;const Xe=ee.current;if(!Xe){ye=requestAnimationFrame(Ie);return}const et=Math.round(Xe.getBoundingClientRect().top+window.scrollY);if(et===Ne&&et>0){me=!0,De.disconnect(),window.clearTimeout(Ce),je(T);return}Ne=et,ye=requestAnimationFrame(Ie)},De=new ResizeObserver(()=>{me||(cancelAnimationFrame(ye),ye=requestAnimationFrame(Ie))});return $.current&&De.observe($.current),ye=requestAnimationFrame(Ie),()=>{me=!0,cancelAnimationFrame(ye),De.disconnect(),window.clearTimeout(Ce)}},[ae.search,U,je,B]);const _t=async(D,_)=>{j(D);try{await v.mutateAsync({[D]:_}),await g()}catch(w){console.error(`Error updating ${D}:`,w)}finally{j(null)}},Je=c,ht=I==="checking",xt=Ks(I),yt=I==="ready"||I==="checking"||N,vt=Hs(Je,4e3);return d?t.jsx("div",{className:"flex h-full w-full items-center justify-center bg-canvas p-6",children:t.jsx(le,{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:h}),x&&t.jsx(F,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>void g(),disabled:u,children:u?n("ui.settings.navigation.settings_page.retrying"):n("ui.settings.navigation.settings_page.retry")})]})})}):Je?t.jsxs("div",{role:"status",className:"flex h-full w-full flex-col items-center justify-center gap-3 bg-canvas",children:[t.jsx(Me,{size:"lg",label:vt?void 0:n("ui.settings.navigation.settings_page.loading_settings")}),vt&&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")})]}):l?t.jsxs("div",{"data-glass-region":"canvas","data-glass-split":"",className:"panel-flush flex min-h-0 flex-1 overflow-hidden bg-canvas",children:[t.jsx("div",{className:"w-12 shrink-0 overflow-y-auto min-[1040px]:w-55",children:t.jsx(ur,{activeSection:m,onSelectSection:je,sections:W})}),t.jsx("div",{ref:$,"data-settings-content":!0,"data-glass-region":"canvas-content","data-tour-tag":"settings-general-section",className:"panel-scroll flex-1 overflow-y-auto overflow-x-hidden p-4 sm:p-6 md:p-8",children:t.jsxs("div",{className:"mx-auto flex w-full max-w-4xl flex-col gap-8 pb-8",children:[t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(br,{title:n("ui.settings.page.title"),icon:Wn}),t.jsx(yg,{onDismiss:()=>{const D=be.current;be.current=null,D!==null&&$.current?.scrollTo({top:D})},ref:Ae,index:X,readRendered:oe,onJump:Vt})]}),t.jsxs("div",{className:"flex flex-col gap-8",children:[t.jsxs("div",{ref:U.general,"data-search-section":"general","data-search-section-label":n("ui.settings.navigation.settings_sidebar.general_settings"),className:"flex flex-col gap-8",children:[t.jsx(gr,{focus:re===Wt||ge?.key===Wt,focusNonce:ge?.key===Wt?ge.nonce:void 0}),t.jsxs(_e,{title:n("ui.settings.profile.title"),icon:mr,description:n(C?"ui.settings.profile.description_authenticated":"ui.settings.profile.description_anonymous"),children:[ht&&t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.profile.account_checking")}),xt&&t.jsx(le,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:n(I==="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:()=>M(),disabled:S,children:S?n("ui.settings.profile.retrying"):n("ui.settings.profile.retry")})]})}),t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(Qn,{searchRow:"general.profile.name",value:L.profile.name,label:n("ui.settings.profile.display_name.label"),placeholder:n("ui.settings.profile.display_name.placeholder"),isSaving:b==="user_name",onSave:async D=>{j("user_name");try{L.updateName(D)}finally{j(null)}},readOnly:yt}),t.jsx(Qn,{searchRow:"general.profile.email",value:L.profile.email,label:n("ui.settings.profile.email.label"),placeholder:n("ui.settings.profile.email.placeholder"),isSaving:b==="user_email",onSave:async D=>{j("user_email");try{L.updateEmail(D)}finally{j(null)}},readOnly:yt})]})]}),t.jsx(_e,{title:n("ui.settings.tour.title"),description:n("ui.settings.tour.description"),children:t.jsxs(F,{variant:"secondary","data-search-row":"general.tour","data-search-control":!0,onClick:()=>{ne({forceModalCompleted:!0})},children:[t.jsx(Ei,{}),n("ui.settings.tour.action")]})}),t.jsx(_e,{id:"model-settings",title:n("ui.settings.model.settings_page.model_settings"),icon:pr,description:n("ui.settings.model.settings_page.configure_the_default_ai_model_and_hosting_providers_used_for_gen"),children:t.jsxs("div",{"data-search-row":"general.model","data-search-control":!0,"data-search-label":n("ui.settings.model.settings_page.model_settings"),"data-search-terms":[n("ui.common.models.hosting_select.hosting_provider"),n("ui.common.models.model_select.model"),n("ui.settings.model.default_effort.label")].join(" "),className:"flex flex-col gap-4",children:[t.jsx(fr,{value:l.values.hosting,isSaving:b==="hosting",onSave:D=>_t("hosting",D),filterByCredentials:!0,allowCustom:!0,allowDefault:!1,emptyHelperText:n("ui.settings.model.settings_page.no_hosting_options")}),t.jsx(_r,{value:l.values.model_name,hostingId:l.values.hosting,isSaving:b==="model_name",onSave:D=>_t("model_name",D),allowCustom:!0,allowDefault:!1}),t.jsx(nd,{hosting:l.values.hosting,modelName:l.values.model_name,focus:re===He||ge?.key===He,focusNonce:ge?.key===He?ge.nonce:void 0}),p&&t.jsx(le,{variant:"neutral",icon:t.jsx(Kt,{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:()=>{je("providers"),U.providers.current?.focus({preventScroll:!0})},children:n("ui.settings.model.provider_callout.providers_link")}),"."]})})]})}),t.jsx(Rg,{}),t.jsx(_e,{title:n("ui.settings.configuration.settings_page.configuration_information"),icon:Kt,description:n("ui.settings.configuration.settings_page.system_information_about_the_current_configuration"),children:t.jsxs(mt,{children:[t.jsx(he,{label:n("ui.settings.configuration.settings_page.version"),value:t.jsx("span",{className:"text-mono-sm",children:l.version})}),t.jsx(he,{label:n("ui.settings.configuration.settings_page.created"),value:Us(l.metadata.created_at)}),t.jsx(he,{label:n("ui.settings.configuration.settings_page.last_modified"),value:Nn(l.metadata.last_modified)}),t.jsx(he,{label:n("ui.settings.configuration.settings_page.description"),value:l.metadata.description||n("ui.settings.configuration.settings_page.no_description_available")})]})})]}),t.jsx(_e,{title:n("ui.settings.appearance.settings_page.appearance"),icon:Js,description:n("ui.settings.appearance.settings_page.customize_the_look_and_feel_of_local_operator"),sectionRef:U.appearance,dataTourTag:"settings-appearance-section",searchSection:"appearance",searchSectionLabel:n("ui.settings.navigation.settings_sidebar.appearance"),children:t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(Ug,{}),t.jsx(Xs,{searchRow:"appearance.reasoning",value:s,label:n("ui.settings.appearance.settings_page.show_agent_reasoning"),description:n("ui.settings.appearance.settings_page.adds_the_agent_s_reasoning_and_thinking_rows_to_conversations_the"),onChange:async D=>a(D)}),t.jsx(Kg,{searchRow:"appearance.transcript",value:Vs(i),onChange:D=>r(D)}),t.jsx(uc,{searchRow:"appearance.glass",state:e.state,onChange:e.set})]})}),t.jsx(Ig,{sectionRef:U.speech}),t.jsx(hr,{sectionRef:U.keyboard,focusKey:re}),t.jsx(_e,{title:n("ui.settings.model.settings_page.model_providers"),icon:Ds,description:n("ui.settings.navigation.settings_page.sign_in_to_the_services_your_agents_think_with_new_chats_use_your"),sectionRef:U.providers,searchSection:"providers",searchSectionLabel:n("ui.settings.navigation.settings_sidebar.model_providers"),id:"model-providers",className:"focus-visible:outline-none!",children:t.jsx(xr,{initialProviderId:ve,onChangeModel:()=>je("general")})}),t.jsx(Ku,{sessionId:H??void 0,sectionRef:U.integrations,highlightServer:Fe}),t.jsx(_e,{title:n("ui.settings.account.settings_page.radient_account"),titleComponent:t.jsx(Hg,{}),description:n("ui.settings.account.settings_page.your_radient_account_radient_pass_details_and_credits_to_use_radi"),sectionRef:U.radient,dataTourTag:"settings-radient-account-section",searchSection:"radient",searchSectionLabel:n("ui.settings.navigation.settings_sidebar.radient_account"),searchIgnore:"account, billing and usage are read-only or remote",children:t.jsxs("div",{className:"flex flex-col gap-8",children:[t.jsx(og,{onAfterCredentialUpdate:()=>{de(),ke()}}),C&&t.jsxs(t.Fragment,{children:[t.jsx(Bg,{}),t.jsx(Vg,{})]})]})}),B&&t.jsx(_e,{title:n("ui.agentMessages.settings.section"),icon:yr,description:n("ui.agentMessages.settings.description"),sectionRef:U["agent-messages"],id:"agent-messages",searchSection:"agent-messages",searchSectionLabel:n("ui.agentMessages.settings.section"),searchIgnore:"agent messages is a consent state machine; its registry rows are searchable",className:"border-b border-hairline pb-8",children:Q?t.jsx(kc,{availability:O,status:Q,accountId:K,refusal:q.refusal,onRefreshStatus:te,sessions:G,focus:re===Ht||ge?.key===Ht,focusNonce:ge?.key===Ht?ge.nonce:void 0,onOpenSession:D=>{z.invalidateStatus(),Ta(ce,D)}}):q.refusal?t.jsxs(le,{variant:"warning",children:[t.jsx(Ut,{children:n("ui.agentMessages.settings.error.title")}),t.jsxs(Re,{children:[q.refusal.code!=="client_unavailable"&&t.jsx("span",{className:"block",children:Tt(q.refusal)}),t.jsx("span",{className:"block",children:n("ui.agentMessages.settings.error.no_changes")}),t.jsx(F,{className:"mt-3",variant:"secondary",onClick:()=>void te(),children:n("ui.agentMessages.settings.error.retry")})]})]}):t.jsxs("div",{"aria-busy":"true",className:"flex flex-col gap-3",children:[t.jsx(Se,{className:"h-5 w-40"}),t.jsx(Se,{className:"h-4 w-full max-w-xl"})]})}),t.jsx(_e,{title:n("ui.settings.navigation.settings_page.backend_settings"),icon:Wn,description:n("ui.settings.navigation.settings_page.every_setting_the_backend_registry_owns_searchable_with_typed_edi"),sectionRef:U.backend,searchSection:"backend",searchSectionLabel:n("ui.settings.navigation.settings_sidebar.backend_settings"),searchIgnore:"registry rows are searched by the Backend section's own filter",children:t.jsx(Ai,{hideInterfaceLanguage:!0,hideModelEffort:!0,hideAgentMessages:!0,hideSpeechShortcuts:!0,focusKey:ge?ge.key:re&&At(re,"backend")==="backend"?re:null,focusNonce:ge?.nonce,initialFilter:ue})}),t.jsx("div",{ref:U.imports,"data-search-section":"imports","data-search-section-label":n("ui.settings.imports.title"),"data-search-ignore":"imports are a one-off task list, not a setting",children:t.jsx(bd,{})}),t.jsx("div",{ref:U.updates,"data-search-section":"updates","data-search-section-label":n("ui.settings.navigation.settings_sidebar.application_updates"),"data-search-ignore":"application updates are an action surface, not a setting",children:t.jsx(Jc,{})})]})]})})]}):t.jsx("div",{className:"flex h-full w-full items-center justify-center bg-canvas p-6",children:t.jsx(le,{variant:"warning",className:"w-full max-w-xl",children:n("ui.settings.navigation.settings_page.your_settings_could_not_be_loaded")})})};export{cm as SettingsPage};
|