limixbot 0.3.81 → 0.3.83
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/dist/assets/{ActivityPanel-BXFEtu90.js → ActivityPanel-DHr018lI.js} +1 -1
- package/dist/assets/{App-Di_RKfDE.js → App-B87W_53r.js} +122 -122
- package/dist/assets/{AppEventEditor-Bxo59GaM.js → AppEventEditor-C3C0vsQs.js} +1 -1
- package/dist/assets/BotSettingsDialog-BE1y9Mh4.js +16 -0
- package/dist/assets/{BrowserPanel-8mHeGOLP.js → BrowserPanel-B0CcmG3D.js} +1 -1
- package/dist/assets/{BrowserProfilesManager-DNDenex_.js → BrowserProfilesManager-Vq_INgTe.js} +1 -1
- package/dist/assets/{CloudAddDialog-B3mItSdo.js → CloudAddDialog-BScZQg6s.js} +1 -1
- package/dist/assets/{ComputerFilesPane-DUM3BGn5.js → ComputerFilesPane-D1pogAwW.js} +1 -1
- package/dist/assets/{ComputerPanel-B1ProOmB.js → ComputerPanel-DuVyjdZU.js} +2 -2
- package/dist/assets/{DataPanel-B9dG-xFC.js → DataPanel-CO-it_l5.js} +1 -1
- package/dist/assets/{DesktopViewer-CxgTWyru.js → DesktopViewer-CsD0VUUU.js} +1 -1
- package/dist/assets/{FilesView-BdErJPbS.js → FilesView-C8iMQMcP.js} +1 -1
- package/dist/assets/{GrokMoveDialog-DmZmbC5L.js → GrokMoveDialog-CWad1BUn.js} +1 -1
- package/dist/assets/{InspectorPanel-B1sIo1J5.js → InspectorPanel-BO7pmDrc.js} +1 -1
- package/dist/assets/{KeyboardShortcutsModal-C5hjzxvv.js → KeyboardShortcutsModal-yc93OBB1.js} +1 -1
- package/dist/assets/{LiveDesktop-CN8YTqUZ.js → LiveDesktop-DoVeYQ0i.js} +1 -1
- package/dist/assets/{LocalVmWorkspace-C3kwGTKa.js → LocalVmWorkspace-DnP0FeUc.js} +1 -1
- package/dist/assets/{MacLocalControl-OTlnJ0ZN.js → MacLocalControl-C9lOAQla.js} +1 -1
- package/dist/assets/{MarkdownFilePreview-Da65BUFR.js → MarkdownFilePreview-BgDXx4kS.js} +1 -1
- package/dist/assets/{MenuMotion-B5n2ZkGC.js → MenuMotion-VqAEkiFI.js} +1 -1
- package/dist/assets/{NewBotDialog-yIDxcMQJ.js → NewBotDialog-B7b_tl0W.js} +1 -1
- package/dist/assets/{PhoneAppDialog-Bl38QRBo.js → PhoneAppDialog-BK4SkUJ4.js} +1 -1
- package/dist/assets/PlacesRail-vM_KJSQM.js +1 -0
- package/dist/assets/{PluginsPanel-uBfd1z73.js → PluginsPanel-CC5ORkTx.js} +1 -1
- package/dist/assets/{ProIntroduction-CJI7fYhZ.js → ProIntroduction-ZLLkMtoe.js} +1 -1
- package/dist/assets/{RemoteAgentSettingsPanel-B5JBGc4J.js → RemoteAgentSettingsPanel-Cn40yids.js} +1 -1
- package/dist/assets/{RoomPanel-B8o0-I0t.js → RoomPanel-icIjxB8c.js} +1 -1
- package/dist/assets/{RoutinesPage-K_BfBMn8.js → RoutinesPage-nHKPxSZ-.js} +1 -1
- package/dist/assets/{SettingsModal-DXSZCYBo.js → SettingsModal-DXa7NglH.js} +4 -4
- package/dist/assets/{ShareTeamDialog-DTyuq4lx.js → ShareTeamDialog-DIT8PFEI.js} +1 -1
- package/dist/assets/{SignedInSites-C-qamp3R.js → SignedInSites-C55Dmjnk.js} +1 -1
- package/dist/assets/{TeamLibraryPanel-D18289iU.js → TeamLibraryPanel-Cfl4SgFV.js} +1 -1
- package/dist/assets/{TeamMapPage-CtEOY0Vl.js → TeamMapPage-BsxTPcV5.js} +1 -1
- package/dist/assets/{TriggersPage-Cjpc4tVU.js → TriggersPage-B1b4uS07.js} +1 -1
- package/dist/assets/{VisibilitySection-BFDrnzbh.js → VisibilitySection-DhvasLjK.js} +1 -1
- package/dist/assets/{WebhookTrigger-YBoFyBq8.js → WebhookTrigger-Dvz6B2CI.js} +1 -1
- package/dist/assets/{WorksOnGrid-CAcjXdeB.js → WorksOnGrid-DslGZf0e.js} +1 -1
- package/dist/assets/{abnfDiagram-YUKMZFIV-B5MGbjZP.js → abnfDiagram-YUKMZFIV-DxXITSez.js} +1 -1
- package/dist/assets/{activity-i4SOTxBA.js → activity-DZde1m02.js} +1 -1
- package/dist/assets/{architectureDiagram-47P4ROYG-z1L1R8jr.js → architectureDiagram-47P4ROYG-BegpVo5x.js} +1 -1
- package/dist/assets/{blockDiagram-E7TT5TSB-BgCJ5XqR.js → blockDiagram-E7TT5TSB-B1AbK2wd.js} +1 -1
- package/dist/assets/{c4Diagram-CRA5TL53-BxQ3fhnE.js → c4Diagram-CRA5TL53-_egqWLuQ.js} +1 -1
- package/dist/assets/{calendar-days-D81dmGeW.js → calendar-days-DMjgLhUz.js} +1 -1
- package/dist/assets/channel-6pMRe_Fb.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-CSVcU4dl.js → chunk-2Q5K7J3B-CJtxaHPe.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-HqrufCgf.js → chunk-5VM5RSS4-Bm6NQEd_.js} +1 -1
- package/dist/assets/{chunk-7TKQ45FW-D6I-6CLD.js → chunk-7TKQ45FW-q71by55S.js} +1 -1
- package/dist/assets/{chunk-AW2ZBBNX-nl3ozUZV.js → chunk-AW2ZBBNX-DMlXSjM_.js} +1 -1
- package/dist/assets/{chunk-FVRAUYC3-wr6Np7EE.js → chunk-FVRAUYC3-Bsob3PK1.js} +2 -2
- package/dist/assets/{chunk-HTAEGDNF-XZGyfK8y.js → chunk-HTAEGDNF-De4EMeYW.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-pVRLXa0H.js → chunk-JWPE2WC7-K2rQQBXP.js} +1 -1
- package/dist/assets/{chunk-KQW6MTUR-Cb22vGIM.js → chunk-KQW6MTUR-sQodirIW.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-CmETcGZq.js → chunk-XXDRQBXY-oV0DKDc-.js} +1 -1
- package/dist/assets/{classDiagram-v2-K4WV4PDN-eKf7q2Qc.js → classDiagram-v2-K4WV4PDN-2Gxoi60_.js} +1 -1
- package/dist/assets/{coins-GsXVRnl_.js → coins-DCCwfrcW.js} +1 -1
- package/dist/assets/{core-B-k_7y0P.js → core-CWX_nHRS.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-D4VzuikC.js → cose-bilkent-JH36ORCC-CIJZoY4Q.js} +1 -1
- package/dist/assets/{cynefin-EF2NZ3EQ-CeoYk0bd.js → cynefin-EF2NZ3EQ-ef9lS7GC.js} +1 -1
- package/dist/assets/{cynefinDiagram-3GCD6N5R-ru8_qbbj.js → cynefinDiagram-3GCD6N5R-CFFzbLRo.js} +1 -1
- package/dist/assets/{dagre-W4DXFKR2-wL6sYRlF.js → dagre-W4DXFKR2-Bao1CgNA.js} +1 -1
- package/dist/assets/{diagram-2UJZ2QOL-BbNSoiqa.js → diagram-2UJZ2QOL-DI8Z00Ve.js} +1 -1
- package/dist/assets/{diagram-OVF4WLC6-k8AAT5zq.js → diagram-OVF4WLC6-B83cEM_l.js} +1 -1
- package/dist/assets/{diagram-PFPMY2P6-ifjP4RXu.js → diagram-PFPMY2P6-BaG0xDQR.js} +1 -1
- package/dist/assets/{diagram-UMYRVEAY-Ew2tVPDg.js → diagram-UMYRVEAY-DQteYbOy.js} +1 -1
- package/dist/assets/{diagram-YEKJPTXX-Dovy7WaK.js → diagram-YEKJPTXX-KvfZg6TE.js} +1 -1
- package/dist/assets/{diagram-ZIFT7M5P-rtKhjRxK.js → diagram-ZIFT7M5P-DEsM8IFL.js} +1 -1
- package/dist/assets/{ebnfDiagram-VR2GEFS7-BE67RFVg.js → ebnfDiagram-VR2GEFS7-C1FKsXjd.js} +1 -1
- package/dist/assets/{elk-IJKZMXRS-By_AEbig.js → elk-IJKZMXRS-BiTC7j93.js} +1 -1
- package/dist/assets/{erDiagram-O2IAPWRE-NMF3USSg.js → erDiagram-O2IAPWRE-BIMFgrMa.js} +1 -1
- package/dist/assets/{file-up-CwVtVDwM.js → file-up-ButWWy32.js} +1 -1
- package/dist/assets/{flowDiagram-OXPTDLAJ-7VJ7i6mz.js → flowDiagram-OXPTDLAJ-B9H0KRFf.js} +1 -1
- package/dist/assets/{ganttDiagram-R7TSEDQI-BsGUeaLq.js → ganttDiagram-R7TSEDQI-CslmQ6dq.js} +1 -1
- package/dist/assets/{gitGraphDiagram-XJZIOB7I-B5SdxDl8.js → gitGraphDiagram-XJZIOB7I-CeeH7iR_.js} +1 -1
- package/dist/assets/{import-name-CF2rJETO.js → import-name-BMW8IMu5.js} +1 -1
- package/dist/assets/index-3sQyiFZk.js +3 -0
- package/dist/assets/{index-BoIJ2PWD.js → index-Dqnw8jxz.js} +1 -1
- package/dist/assets/{infoDiagram-5W2HQ5XZ-BqpdF76u.js → infoDiagram-5W2HQ5XZ-DiaTKw3C.js} +1 -1
- package/dist/assets/{ishikawaDiagram-K3B6WC7H-ChPuwoRo.js → ishikawaDiagram-K3B6WC7H-RmdqzAJb.js} +1 -1
- package/dist/assets/{journeyDiagram-COXZFDF6-AJsQ9Sal.js → journeyDiagram-COXZFDF6-QxGZsV-N.js} +1 -1
- package/dist/assets/{kanban-definition-P3RFRI5V-Cbf53EMp.js → kanban-definition-P3RFRI5V-HiZl80pb.js} +1 -1
- package/dist/assets/{mcp-servers-BjChYca1.js → mcp-servers-C7qDUZg-.js} +1 -1
- package/dist/assets/{mermaid.core-5XOzwbA1.js → mermaid.core-CDSTO7q5.js} +4 -4
- package/dist/assets/{mindmap-definition-LZFPQGKD-CD-WwEpo.js → mindmap-definition-LZFPQGKD-BVgamkZ1.js} +1 -1
- package/dist/assets/{minimize-BBAOsm2F.js → minimize-5RBZSnye.js} +1 -1
- package/dist/assets/{monitor-ByVtOtHb.js → monitor-CYH7yk0j.js} +1 -1
- package/dist/assets/{new-bot-Brnt-vsQ.js → new-bot-DuQBJa1L.js} +1 -1
- package/dist/assets/{org-library-BqPtAtfm.js → org-library-DTcgGL1w.js} +1 -1
- package/dist/assets/{package-format-DswU6LQA.js → package-format-B97T2pyg.js} +1 -1
- package/dist/assets/{pegDiagram-BGZESJAR-p2NJ2LJo.js → pegDiagram-BGZESJAR-B2gShywE.js} +1 -1
- package/dist/assets/{pieDiagram-CAPJLFHJ-BiLTUs2q.js → pieDiagram-CAPJLFHJ-DC_Ao0v8.js} +1 -1
- package/dist/assets/{quadrantDiagram-GDMTTRAM-BLtReWzy.js → quadrantDiagram-GDMTTRAM-V5QiTdDj.js} +1 -1
- package/dist/assets/{rail-B292SI4O.js → rail-B5HZ46VV.js} +1 -1
- package/dist/assets/{railroadDiagram-SM67HX2B-CmU-L8x-.js → railroadDiagram-SM67HX2B-B5JVf86S.js} +1 -1
- package/dist/assets/{remote-desktop-panel-C320nXM7.js → remote-desktop-panel-Cdb9gCdG.js} +1 -1
- package/dist/assets/{requirementDiagram-X7JNWC4A-C7POybJi.js → requirementDiagram-X7JNWC4A-DGueixXR.js} +1 -1
- package/dist/assets/{sankeyDiagram-UM26HJRW-Bh1astOc.js → sankeyDiagram-UM26HJRW-CWhQ9Gkt.js} +1 -1
- package/dist/assets/{sequenceDiagram-ZO4K6R2Y-j_M4G1u_.js → sequenceDiagram-ZO4K6R2Y-4Ve3J4hO.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-Ca-8iWQF.js → sizeCapture-INFHLROL-ChjcQKOb.js} +1 -1
- package/dist/assets/{stateDiagram-v2-TBUQTH76-BEwcaRZx.js → stateDiagram-v2-TBUQTH76-CiQ2XCFs.js} +1 -1
- package/dist/assets/{styles-DdM6yn_a.js → styles-C2j6j2OJ.js} +1 -1
- package/dist/assets/{swimlanes-N4OXWK64-DmlmxFf2.js → swimlanes-N4OXWK64-CH8vWWGf.js} +1 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-CJhdbzp5.js +8 -0
- package/dist/assets/{team-share-DI90Vqwa.js → team-share-BltEF7sJ.js} +1 -1
- package/dist/assets/{timeline-definition-YOQAKGHF-CHX-HOfh.js → timeline-definition-YOQAKGHF-DyylwCgM.js} +1 -1
- package/dist/assets/{usecaseDiagram-VIAY4XPW-eeJvKlcE.js → usecaseDiagram-VIAY4XPW-CAABLJPt.js} +1 -1
- package/dist/assets/{vennDiagram-BLWOH2XV-DylhYeUG.js → vennDiagram-BLWOH2XV-DijQKILS.js} +1 -1
- package/dist/assets/vi-7mNxNB4v.js +15 -0
- package/dist/assets/{wardleyDiagram-YMQ3BMBF-CUUtluRt.js → wardleyDiagram-YMQ3BMBF-CLXPmbAV.js} +1 -1
- package/dist/assets/{xychartDiagram-TAQBALBS-C-gwkNiy.js → xychartDiagram-TAQBALBS-DIsFY1_L.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/rail.html +4 -4
- package/dist-server/index.js +32 -26
- package/dist-server/package.json +1 -1
- package/dist-server/server/bot-channels/adapters.js +7 -2
- package/dist-server/server/bot-channels/engine.js +6 -3
- package/dist-server/server/bot-channels/messenger.js +106 -0
- package/dist-server/server/index.js +4 -4
- package/package.json +1 -1
- package/dist/assets/BotSettingsDialog-BtdhqHMV.js +0 -16
- package/dist/assets/PlacesRail-PNE_Y9GC.js +0 -1
- package/dist/assets/channel-Nvi2Z0SJ.js +0 -1
- package/dist/assets/index-BOBBoSRI.js +0 -3
- package/dist/assets/swimlanesDiagram-K3J5GTZL-rbSiIYPg.js +0 -8
- package/dist/assets/vi-CcmBtVzr.js +0 -15
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import{c as Ie,t as s,b as se,aF as Fs,j as e,i as Be,ae as fe,a as O,r as u,S as Xe,ah as qt,X as et,f as dt}from"./styles-DdM6yn_a.js";import{fg as zs,fh as Hs,a2 as tt,bB as _s,dj as Wt,w as Ks,fi as Us,fj as qs,K as Vt,fk as Ws,R as Zt,eu as Vs,x as Zs,fl as mt,bv as pt,fm as Gt,n as G,u as $,fn as Gs,aj as st,F as Yt,A as Jt,S as Pe,af as Te,T as Qt,W as Ys,fo as Js,fp as Qs,fq as Xs,fr as ea,fs as ta,ft as ut,fu as sa,fv as aa,fw as na,fx as ia,bb as ra,fy as oa,fz as la,fA as ca,I as da,fB as Se,bR as at,fC as ma,aK as L,aQ as ee,ee as pa,dL as ua,fD as xa,aL as Ve,cq as ha,d_ as fa,d$ as ga,fE as ya,fF as Xt,fG as es,fH as ba,fI as va,fJ as ka,fK as ja,dO as Ze,at as xt,fL as $e,fM as wa,fN as Oe,ax as Na,fO as ts,fP as ht,am as Ge,fQ as Sa,fR as Ca,fS as Pa,fT as ss,fU as Oa,fV as Ea,fW as Ra,fX as Ia,fY as X,aZ as ae,a$ as Q,fZ as Ta,f_ as Aa,f$ as La,d6 as Ma,d as Ba,G as $a,d4 as as,al as Da,g0 as V,aY as de,g1 as me,by as C,g2 as Fa,dq as za,g3 as Ae,a_ as re,g4 as Ha,g5 as _a,g6 as Ka,ei as Ua,g7 as ft,g8 as qa,g9 as Wa,ga as Va,gb as Za,gc as Ga,gd as Ya,aE as Ja,ge as ns,gf as Qa,gg as Xa,gh as en,gi as tn,gj as sn,gk as an,gl as nn,gm as rn,gn as on,go as ln,gp as cn,gq as dn,gr as nt,k as mn,B as Ye,gs as pn,gt as un,gu as xn,gv as hn,b_ as fn,gw as is,J as gt,eY as gn,gx as yt,gy as yn,gz as bn,cN as bt,bz as vn,d3 as kn,gA as jn,gB as rs,gC as we,gD as vt,gE as wn,aO as De,e0 as Nn,gF as Sn,aT as Cn,C as Pn,cr as On,gG as En,gH as Rn,gI as In,aV as Tn}from"./App-Di_RKfDE.js";import{v as os,d as ve,a1 as Ee,a2 as An,a3 as Ln,a4 as kt,a5 as Fe,a6 as Mn,a7 as Bn,a8 as $n,a9 as Dn,aa as Fn,ab as jt,ac as zn,ad as Hn,L as Ce,N as _n,B as Je,P as ke,r as ls,ae as Kn,a0 as Un,u as cs}from"./PlacesRail-PNE_Y9GC.js";import{C as qn}from"./coins-GsXVRnl_.js";import{C as be,a as Wn}from"./MenuMotion-B5n2ZkGC.js";import{b as te,m as ds,i as Qe,f as it,c as xe,d as wt,e as Re,o as Vn,g as Zn,h as ce,n as ze,t as ms,s as rt,j as ps,k as Gn,l as Yn,p as Jn,r as us,q as Qn,u as Xn,w as ei,x as xs,y as hs,z as Nt,B as ti,C as fs,R as St,D as si,E as ai,F as ni,G as ii,H as ri,J as oi,O as li,K as ci,L as gs,N as Ct,V as di,P as mi,M as pi,A as ui,a as xi,S as hi,I as fi}from"./VisibilitySection-BFDrnzbh.js";import{s as gi,r as yi,a as bi,R as vi}from"./ComputerFilesPane-DUM3BGn5.js";import{M as Pt}from"./monitor-ByVtOtHb.js";import{a as ys,m as bs,b as ki,c as ji}from"./mcp-servers-BjChYca1.js";import{R as wi}from"./RoutinesPage-K_BfBMn8.js";import{S as Ni}from"./SignedInSites-C-qamp3R.js";import"./index-BOBBoSRI.js";import"./org-library-BqPtAtfm.js";import"./package-format-DswU6LQA.js";import"./WorksOnGrid-CAcjXdeB.js";import"./ProIntroduction-CJI7fYhZ.js";import"./remote-desktop-DDRRx8uY.js";const Si=[["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M19 16v6",key:"tddt3s"}],["path",{d:"M21 12.598V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8.5",key:"1glfrc"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]],Ci=Ie("calendar-plus",Si);const Pi=[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]],Oi=Ie("library",Pi);const Ei=[["rect",{width:"3",height:"8",x:"13",y:"2",rx:"1.5",key:"diqz80"}],["path",{d:"M19 8.5V10h1.5A1.5 1.5 0 1 0 19 8.5",key:"183iwg"}],["rect",{width:"3",height:"8",x:"8",y:"14",rx:"1.5",key:"hqg7r1"}],["path",{d:"M5 15.5V14H3.5A1.5 1.5 0 1 0 5 15.5",key:"76g71w"}],["rect",{width:"8",height:"3",x:"14",y:"13",rx:"1.5",key:"1kmz0a"}],["path",{d:"M15.5 19H14v1.5a1.5 1.5 0 1 0 1.5-1.5",key:"jc4sz0"}],["rect",{width:"8",height:"3",x:"2",y:"8",rx:"1.5",key:"1omvl4"}],["path",{d:"M8.5 5H10V3.5A1.5 1.5 0 1 0 8.5 5",key:"16f3cl"}]],vs=Ie("slack",Ei);const Ri=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],Ii=Ie("tag",Ri),Ti=[{id:"overview",label:"Overview",labelKey:"botSettings.sections.overview",icon:zs,keywords:["summary","status","what it does","won't","prompt","what the model sees"]},{id:"identity",label:"Identity",labelKey:"botSettings.sections.identity",icon:Hs,keywords:["name","title","avatar","blurb","instructions"]},{id:"slack",label:"Slack",icon:vs,keywords:["slack","slack app","admin","message","direct messages","mentions"]},{id:"soul",label:"Soul",labelKey:"botSettings.sections.soul",icon:tt,keywords:["standing instructions","instructions","persona","rules","soul.md"]},{id:"skills",label:"Skills",labelKey:"botSettings.sections.skills",icon:_s,keywords:["skills","learned","procedures","teach"]},{id:"memory",label:"Memory",labelKey:"botSettings.sections.memory",icon:Wt,keywords:["memory","notes","remember","topics"]},{id:"library",label:"Library",labelKey:"botPanel.tab.library",icon:Oi,keywords:["library","made","pages","apps","files","published"]},{id:"routines",label:"Routines",labelKey:"botSettings.sections.routines",icon:Ks,keywords:["schedule","routines","cron","tasks"]},{id:"access",label:"Access",labelKey:"botSettings.sections.access",icon:Us,keywords:["works on","computer","vm","cloud","vps","folder","workspace","browser","connected apps","composio","webhooks","always allow","grants","tool selection","tools","mcp","allow","exclude"]},{id:"model",label:"Model",labelKey:"botSettings.sections.model",icon:qs,keywords:["engine","model","provider","cli","effort"]},{id:"permissions",label:"Permissions",labelKey:"botSettings.sections.permissions",icon:Vt,keywords:["auto mode","approve","auto approve","review","routine approvals","coordination","chief of staff","section"]},{id:"voice",label:"Voice & alerts",labelKey:"botSettings.sections.voice",icon:Ws,keywords:["voice","alerts","notifications","speak"]},{id:"visibility",label:"Who can see it",labelKey:"botSettings.visibility.title",icon:Zt,keywords:["visibility","who can see","private","people","admins","members","access","hide"]},{id:"history",label:"History",labelKey:"botSettings.sections.history",icon:Vs,keywords:["history","changes","undo","rollback","log"]},{id:"usage",label:"Usage",labelKey:"botSettings.sections.usage",icon:qn,keywords:["tokens","cost","billing"]}],Ot={completed:"botOverview.routine.last.completed",failed:"botOverview.routine.last.failed",missed:"botOverview.routine.last.missed",cancelled:"botOverview.routine.last.cancelled",running:"botOverview.routine.last.running",queued:"botOverview.routine.last.queued",waiting:"botOverview.routine.last.waiting"};function Ai(t,a=se()){if(!t||a==="en")return null;if(t.paused)return s("botOverview.routine.paused",{name:t.name});const n=t.lastRun;if(n&&!Object.hasOwn(Ot,n.status))return null;try{return[s("botOverview.routine.line",{schedule:Zs(t.schedule),name:t.name}),...t.nextRunAt!=null?[s("botOverview.routine.next",{time:mt(t.nextRunAt)})]:[],...n?[s(Ot[n.status],{time:mt(n.at)})]:[]].join(" ")}catch{return null}}const Et={"Works in its private workspace.":"botOverview.line.privateWorkspace","Has the built-in browser.":"botOverview.line.browser","Has no connected apps.":"botOverview.line.noApps","Won't act on a schedule.":"botOverview.line.noSchedule","Can talk to the other bot.":"botOverview.line.talksToOne","Talks only to the bots chosen for it.":"botOverview.line.talksToChosen","Cannot initiate contact with other bots.":"botOverview.line.noPeerContact","Command approvals use Ask mode; saved permissions and provider rules still apply.":"botOverview.line.askMode","Command approvals follow the provider's custom configuration.":"botOverview.line.customApprovals","Asks before contacting other bots.":"botOverview.line.asksPeers","Can't use a computer.":"botOverview.line.noComputer","Profile proposal cards require your approval.":"botOverview.line.profileApproval","Connected apps could not be checked.":"botOverview.line.appsUnchecked"},Rt={"Auto; availability is checked when a task starts":"botOverview.preference.auto","cloud computer":"botOverview.preference.cloud","Local VM":"botOverview.preference.vm","this computer":"botOverview.preference.local","browser only":"botOverview.preference.browser"};function It(t,a){return!a||a.map(n=>n||"General").join(", ")!==t?t:a.map(n=>n||s("botAccess.teams.general")).join(", ")}const Tt=t=>Object.hasOwn(Rt,t)?s(Rt[t]):t,At=(t,a,n)=>Number(t)===1?a:n,Li=[{line:/^Can talk to all (\d+) other bots, in any department\.$/,key:()=>"botOverview.line.talksToAll",params:([,t])=>({count:Number(t)})},{line:/^Also in charge of these departments: (.+)\.$/,key:()=>"botOverview.line.alsoInCharge",params:([,t],a)=>({departments:It(t,a)})},{line:/^Can talk to (\d+) other bots? in its (?:section|department)\.$/,key:([,t])=>At(t,"botOverview.line.peersSectionOne","botOverview.line.peersSectionMany"),params:([,t])=>({count:Number(t)})},{line:/^Can talk to (\d+) other bots? in its allowed (?:teams|departments)\.$/,key:([,t])=>At(t,"botOverview.line.peersTeamsOne","botOverview.line.peersTeamsMany"),params:([,t])=>({count:Number(t)})},{line:/^Coordinates its (?:section|department) as Chief of Staff\.$/,key:()=>"botOverview.line.chief",params:()=>({role:s("sidebar.bot.chiefOfStaff")})},{line:/^May also coordinate these (?:teams|departments): (.+)\.$/,key:()=>"botOverview.line.alsoTeams",params:([,t],a)=>({teams:It(t,a)})}],Mi=t=>se()!=="en"&&Object.hasOwn(Fs[se()]??{},t);function Bi(t,a){for(const n of Li){const o=n.line.exec(t);if(!o)continue;const i=n.key(o);return Mi(i)?s(i,n.params(o,a)):t}return null}function He(t,a){if(Object.hasOwn(Et,t))return s(Et[t]);const n=Bi(t,a);if(n!==null)return n;const o=/^Can use (\d+) connected apps?: (.+)\.$/.exec(t);if(o)return s(o[1]==="1"?"botOverview.line.appsOne":"botOverview.line.appsMany",{count:Number(o[1]),apps:o[2]});const i=se()==="en"?null:/^Computer preference: (.+), which isn't available on My Cloud\.$/.exec(t);if(i)return s("botOverview.line.computerNotOnCloud",{preference:Tt(i[1])});const r=/^Computer preference: (.+)\.$/.exec(t);if(r)return s("botOverview.line.computer",{preference:Tt(r[1])});const d=/^Works in (.+)\.$/.exec(t);if(d)return s("botOverview.line.folder",{folder:d[1]});const c=/^Knows how to (.+)\.$/.exec(t);if(c)return s("botOverview.line.skill",{skill:c[1]});const l=/^Listens for “(.+)” webhooks\.$/.exec(t);return l?s("botOverview.line.webhook",{name:l[1]}):t}const Lt={name:"approval.applied.field.name",title:"approval.applied.field.title",description:"approval.applied.field.description",soul:"approval.applied.field.soul",cwd:"approval.applied.field.cwd",notifications:"approval.applied.field.notifications",speakReplies:"approval.applied.field.speakReplies"};function $i(t,a=se()){const n=/^(\w+): /.exec(t)?.[1];return a==="en"||!n||!Object.hasOwn(Lt,n)?t:`${s(Lt[n])}: ${t.slice(n.length+2)}`}function Di({data:t,error:a,open:n,onToggle:o}){return e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsxs("button",{type:"button",onClick:o,"aria-expanded":n,className:"flex w-full items-center justify-between gap-3 text-left",children:[e.jsx("span",{className:"text-[15px] font-medium text-ink",children:t?s("botOverview.promptPreviewCount",{bytes:t.totalBytes.toLocaleString(Be()),tokens:t.approxTokens.toLocaleString(Be())}):s("botOverview.promptPreview")}),e.jsx(fe,{size:16,className:O("shrink-0 text-ink-secondary transition-transform",n&&"rotate-180")})]}),n&&!t&&a&&e.jsx("div",{className:"mt-3 text-[13px] text-ink-secondary",children:s("botOverview.promptError")}),n&&!t&&!a&&e.jsx("div",{className:"mt-3 text-[13px] text-ink-secondary",children:s("botOverview.loading")}),n&&t&&e.jsxs("div",{className:"mt-3 flex flex-col gap-2",children:[t.sections.map(i=>e.jsxs("details",{className:"rounded-lg border border-hairline/40 bg-inset px-3 py-2",children:[e.jsxs("summary",{className:"flex cursor-pointer items-center justify-between gap-3 text-[13px] text-ink",children:[e.jsx("span",{children:i.label}),e.jsx("span",{className:"shrink-0 tabular-nums text-ink-secondary",children:s("botOverview.bytes",{count:i.bytes.toLocaleString(Be())})})]}),e.jsx("pre",{className:"mt-2 max-h-48 overflow-auto whitespace-pre-wrap break-words font-mono text-[12px] leading-relaxed text-ink",children:i.text})]},i.id)),t.note&&e.jsx("div",{className:"text-[11px] text-ink-secondary",children:t.note})]})]})}function Fi({overview:t,refreshError:a,prompt:n,promptError:o,onOpen:i,onSetup:r}){const[d,c]=u.useState(!1);if(!t)return e.jsx("div",{className:"text-[13px] text-ink-secondary",children:s("botOverview.loading")});const m=(t.setup??[]).filter(f=>!f.done),p=(f,k)=>s(`botOverview.setup.${f}`)||k;return e.jsxs("div",{className:"flex flex-col gap-4",children:[a&&e.jsx("div",{className:"rounded-lg bg-inset px-3 py-2 text-[13px] text-ink-secondary",children:s("botOverview.refreshError")}),m.length>0&&e.jsxs("div",{className:"rounded-xl border border-accent/30 bg-accent/[0.06] p-4",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:s("botSetup.ideas")}),e.jsx("p",{className:"mt-1 text-[13px] text-ink-secondary",children:s("botSetup.optional")}),e.jsx("ul",{className:"mt-2 flex flex-col gap-1",children:m.map(f=>e.jsx("li",{children:f.section?e.jsxs("button",{type:"button",onClick:()=>i(f.section),className:"flex w-full items-center gap-2.5 rounded-lg px-1 py-1 text-left text-[13px] text-ink hover:bg-inset",children:[e.jsx(pt,{"aria-hidden":"true",size:14,className:"shrink-0 text-ink-secondary"}),e.jsx("span",{className:"flex-1",children:p(f.id,f.label)}),e.jsx(be,{size:14,"aria-hidden":"true",className:"shrink-0 text-ink-secondary rtl:-scale-x-100"})]}):e.jsxs("div",{className:"flex items-center gap-2.5 px-1 py-1 text-[13px] text-ink",children:[e.jsx(pt,{"aria-hidden":"true",size:14,className:"shrink-0 text-ink-secondary"}),e.jsx("span",{children:p(f.id,f.label)})]})},f.id))}),r&&e.jsxs("div",{className:"mt-3 flex items-center gap-3",children:[e.jsxs("button",{type:"button",onClick:r,className:"flex items-center gap-1.5 rounded-lg bg-accent px-3 py-2 text-[13px] font-medium text-accent-ink hover:brightness-110",children:[e.jsx(tt,{size:14})," ",s("botSetup.withBot")]}),e.jsx("span",{className:"text-[12px] text-ink-secondary",children:s("botSetup.help")})]})]}),e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:t.who.name}),t.who.title&&e.jsx("div",{className:"mt-0.5 text-[13px] text-ink-secondary",children:t.who.title}),t.who.blurb&&e.jsx("p",{className:"mt-2 text-[13px] leading-relaxed text-ink",children:t.who.blurb}),t.who.soulLead&&e.jsxs("div",{className:"mt-3 rounded-lg bg-inset px-3 py-2.5",children:[e.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:t.who.soulLead}),e.jsx("button",{type:"button",onClick:()=>i("soul"),className:"mt-1.5 rounded-md text-[12px] font-medium text-accent-text hover:underline",children:s("botOverview.readAll")})]})]}),e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:s("botOverview.does")}),t.does.length===0?e.jsx("p",{className:"mt-2 text-[13px] text-ink-secondary",children:s("botOverview.doesEmpty")}):e.jsx("ul",{className:"mt-2 flex flex-col gap-1.5 text-[13px] leading-relaxed text-ink",children:t.does.map((f,k)=>e.jsx("li",{children:Ai(t.doesRoutines?.[k])??He(f)},k))})]}),e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:s("botOverview.canReach")}),t.reaches.length===0?e.jsx("p",{className:"mt-2 text-[13px] text-ink-secondary",children:s("botOverview.reachEmpty")}):e.jsx("ul",{className:"mt-2 flex flex-col gap-1.5 text-[13px] leading-relaxed text-ink",children:t.reaches.map((f,k)=>e.jsx("li",{children:He(f,t.managedSections)},k))})]}),e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:s("botOverview.wont")}),e.jsx("ul",{className:"mt-2 flex flex-col gap-1.5 text-[13px] leading-relaxed text-ink",children:t.wont.map((f,k)=>e.jsx("li",{children:He(f,t.managedSections)},k))})]}),e.jsx(Di,{data:n,error:o,open:d,onToggle:()=>c(f=>!f)}),e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:s("botOverview.recentChanges")}),e.jsxs("button",{type:"button",onClick:()=>i("history"),className:"shrink-0 text-[12px] text-ink-secondary hover:text-ink",children:[s("botOverview.viewAll")," ",e.jsx(be,{size:14,"aria-hidden":"true",className:"inline align-[-2px] rtl:-scale-x-100"})]})]}),t.recent.length===0?e.jsx("p",{className:"mt-2 text-[13px] text-ink-secondary",children:s("botOverview.recentEmpty")}):e.jsx("ul",{className:"mt-2 flex flex-col gap-1.5 text-[13px] text-ink",children:t.recent.map((f,k)=>e.jsxs("li",{className:"flex items-baseline justify-between gap-3",children:[e.jsx("span",{className:"min-w-0 truncate",children:$i(f.summary)}),e.jsxs("span",{className:"shrink-0 text-[12px] text-ink-secondary",children:["· ",Gt(f.at)]})]},k))})]})]})}function zi({managementUrl:t}){return e.jsxs("div",{className:"flex flex-col gap-3 text-[13px] leading-relaxed text-ink-secondary",children:[e.jsx("p",{children:s("botSlack.body")}),e.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"flex w-fit items-center gap-2 rounded-lg bg-control px-3 py-2 font-medium text-ink hover:bg-control/70",children:[s("botSlack.manage")," ",e.jsx(os,{size:14,"aria-hidden":"true"})]})]})}function Hi(t){if(!t||typeof t!="object")return null;const{available:a,managementUrl:n}=t;if(a!==!0||typeof n!="string")return null;try{return new URL(n).protocol==="https:"?n:null}catch{return null}}function ks(t){const[a,n]=u.useState(null);return u.useEffect(()=>{const o=new AbortController;return G(`/api/bots/${encodeURIComponent(t)}/slack-management`,{signal:o.signal,timeoutMs:1e4}).then(i=>{o.signal.aborted||n({botId:t,url:Hi(i)})}).catch(()=>{o.signal.aborted||n({botId:t,url:null})}),()=>o.abort()},[t]),a?.botId===t?a.url:null}const ie="rounded-lg bg-control px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",_e="rounded-md px-2 py-1 text-[13px] text-ink-secondary hover:bg-control hover:text-ink disabled:opacity-50",ne=t=>t instanceof Error?t.message:String(t);function js(t){const a=[],n=(i,r,d)=>{i&&a.push(s(i===1?r:d,{count:i}))};n(t.expired,"memory.upkeep.summary.archived.one","memory.upkeep.summary.archived.many"),n(t.duplicates,"memory.upkeep.summary.merged.one","memory.upkeep.summary.merged.many"),n(t.superseded,"memory.upkeep.summary.crossed.one","memory.upkeep.summary.crossed.many"),n(t.organized,"memory.upkeep.summary.filed.one","memory.upkeep.summary.filed.many");const o=a.length?a.join(", "):s("memory.upkeep.summary.none");return o.charAt(0).toUpperCase()+o.slice(1)}function _i(t,a){const n=t.via==="team-setup"?s("memory.journal.actor.teamSetup"):t.actor==="bot"?a:t.actor==="import"?s("memory.journal.actor.import"):t.actor==="upkeep"?s("memory.journal.actor.upkeep"):s("memory.journal.actor.you"),o=Qn(t.path),i=t.path===te?o:t.path===Xn?s("memory.journal.instructions"):t.path.startsWith("memory/log/")?s("memory.journal.log",{file:o}):s("memory.journal.topic",{file:o}),r=d=>s(d===1?"memory.journal.line.one":"memory.journal.line.many",{count:d});return t.kind==="created"?s("memory.journal.created",{who:n,topic:i,detail:t.added?s("memory.journal.withLines",{lines:r(t.added)}):""}):t.kind==="deleted"?s("memory.journal.deleted",{who:n,topic:i}):t.added&&!t.removed?s("memory.journal.added",{who:n,lines:r(t.added),topic:i}):t.removed&&!t.added?s("memory.journal.removed",{who:n,lines:r(t.removed),topic:i}):s("memory.journal.rewrote",{who:n,lines:r(Math.max(t.added,t.removed)),topic:i})}function ws({changed:t,stale:a,busy:n,onReviewed:o}){return e.jsxs("div",{role:"status",className:"rounded-xl border border-danger/40 bg-card p-4",children:[e.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:s(a?"memory.lendingReviewStale":"memory.lendingReview")}),t.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-2 text-[12px] text-ink-secondary",children:s("memory.lendingReviewChanged")}),e.jsx("ul",{className:"mt-1 space-y-0.5",children:t.map(i=>e.jsx("li",{className:"break-all font-mono text-[12px] text-ink",children:i},i))})]}),e.jsx("button",{type:"button",className:O(ie,"mt-3"),disabled:n,onClick:o,children:s("memory.lendingReviewed")})]})}function Ki({bot:t,active:a=!0,onToggle:n}){const{capabilities:o}=ve(),[i,r]=u.useState(null),[d,c]=u.useState(null),[l,m]=u.useState(null),[p,f]=u.useState(null),[k,g]=u.useState(null),[v,j]=u.useState(null),[P,b]=u.useState(null),[w,x]=u.useState(!1),[S,M]=u.useState(null),[F,B]=u.useState(""),[T,H]=u.useState(null),[A,h]=u.useState(!1),[I,D]=u.useState(null),[_,K]=u.useState(!1),[J,Y]=u.useState(!1),{state:U,dispatch:y}=$(),z=Gs(U.config),[oe,pe]=u.useState(!1),[ge,E]=u.useState(""),q=async N=>{const[R,Le,Ds]=await Promise.all([it(t.id),xe(t.id),wt(t.id).catch(()=>null)]);if(r(R),D(R.lendingReview??null),c(Le),H(Ds),N){const Me=await Re(t.id,N);m({path:Me.path,text:Me.text,hash:Me.hash,dirty:!1,readOnly:N.startsWith("memory/log/")})}};u.useEffect(()=>{if(!a)return;let N=!1;j(null);const R=l?.dirty===!0;return q(R?void 0:l?.path??te).catch(Le=>{N||j(ne(Le))}),()=>{N=!0}},[a,t.id]);const Z=async N=>{j(null),f(null);try{const R=await Re(t.id,N);m({path:R.path,text:R.text,hash:R.hash,dirty:!1,readOnly:N.startsWith("memory/log/")})}catch(R){j(ne(R))}},W=async N=>{if(l){x(!0),j(null);try{const R=await rt(t.id,l.path,l.text,N);if(!R.ok){f({path:l.path,current:R.current,currentHash:R.currentHash});return}f(null),g(null),m({...l,text:R.doc.text,hash:R.doc.hash,dirty:!1}),r(R.overview),c(await xe(t.id))}catch(R){j(ne(R))}finally{x(!1)}}},le=()=>{!p||!l||(g(l.text),m({...l,text:p.current,hash:p.currentHash,dirty:!1}),f(null))},je=async N=>{if(window.confirm(s("memory.confirmDelete",{name:N.name}))){j(null);try{const{overview:R}=await ps(t.id,N.path);r(R),c(await xe(t.id)),l?.path===N.path&&m(null)}catch(R){j(ne(R))}}},lt=async()=>{const N=Gn(F);if(!N){j(s("memory.topicNameError"));return}B(""),await Z(`memory/${N}`),m(R=>R&&{...R,dirty:!0,text:R.text||Ui(N)})},As=async N=>{M(N.id),j(null);try{const R=await us(t.id,N.id);r(R.overview),c(await xe(t.id)),l?.path===N.path&&!l.dirty&&m({...l,text:R.text,hash:R.hash}),b(s("memory.restored",{path:N.path}))}catch(R){j(ne(R))}finally{M(null)}},ct=async N=>{j(null),b(null);try{await Vn(t.id,N)}catch(R){j(ne(R))}},Ls=()=>{const N=t.memoryUpkeep===!1;y({type:"updateBot",botId:t.id,patch:{memoryUpkeep:N}}),H(R=>R&&{...R,enabled:N})},Ms=async()=>{if(!oe){pe(!0),E("");try{const N=await G("/api/config",{method:"PATCH",body:JSON.stringify({features:{roomMemoryCapture:!z}})});y({type:"configStatus",config:N})}catch(N){E(N instanceof Error?N.message:s("memory.learnFromRooms.error"))}finally{pe(!1)}}},Bs=async()=>{h(!0),j(null),b(null);try{const{report:N,overview:R}=await ms(t.id);r(R),c(await xe(t.id)),H(await wt(t.id)),l&&!l.dirty&&await Z(l.path),b(`${js(N)}.${N.note?` ${N.note}`:""}`)}catch(N){j(ne(N))}finally{h(!1)}},$s=o.host.homeDir;return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:s("memory.title")}),e.jsxs("label",{className:"mt-3 flex items-center gap-2 text-[13px] text-ink",children:[e.jsx("input",{type:"checkbox",checked:t.memoryEnabled!==!1,disabled:t.busy,onChange:N=>n(N.target.checked)}),s("memory.enable")]}),e.jsxs("p",{className:"mt-1 text-[13px] text-ink-secondary",children:[s("memory.enableHelp"),t.busy?` ${s("memory.busyHelp")}`:""]}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:s("memory.notesHelp")}),i&&e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[12px] text-ink-secondary",title:i.workspacePath,children:st(i.workspacePath,$s)}),e.jsx("button",{type:"button",className:ie,onClick:()=>{ct("obsidian")},children:s("memory.openObsidian")}),e.jsxs("button",{type:"button",className:O(ie,"inline-flex items-center gap-1.5"),onClick:()=>{ct("folder")},children:[e.jsx(Yt,{size:14}),s("memory.showFileManager")]})]})]}),I&&e.jsx(ws,{changed:I.changed,stale:_,busy:J,onReviewed:()=>{Y(!0),ds(t.id,I.token).then(()=>{D(null),K(!1)}).catch(N=>{if(N instanceof Jt&&N.status===409)return K(!0),q();j(ne(N))}).finally(()=>Y(!1))}}),i&&e.jsx(Wi,{index:i.index}),t.memoryEnabled!==!1&&e.jsx(qi,{enabled:t.memoryUpkeep!==!1,status:T,tidying:A,onToggle:Ls,onTidy:()=>{Bs()},rooms:{enabled:z,saving:oe,error:ge,onToggle:()=>{Ms()}}}),l&&e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"truncate font-mono text-[13px] text-ink",children:l.path}),l.path!==te&&e.jsx("button",{type:"button",className:_e,onClick:()=>{Z(te)},children:s("memory.backToIndex")})]}),p&&e.jsx(Ns,{botName:t.name,busy:w,onReload:le,onOverwrite:()=>{W(p.currentHash)}}),e.jsx("textarea",{className:O(Qe,"mt-2 min-h-[200px] resize-y font-mono text-[13px] leading-relaxed"),value:l.text,readOnly:l.readOnly,placeholder:l.path===te?s("memory.indexPlaceholder"):s("memory.notePlaceholder"),"aria-label":l.path===te?s("memory.botMemory"):s("memory.fileLabel",{path:l.path}),onChange:N=>m({...l,text:N.target.value,dirty:!0})}),l.readOnly?e.jsx("p",{className:"mt-2 text-[12px] text-ink-secondary",children:s("memory.logsReadOnly")}):e.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>{W(l.hash)},disabled:w||!l.dirty,className:ie,children:w?s("memory.saving"):s("memory.save")}),l.dirty&&e.jsx("button",{type:"button",className:_e,disabled:w,onClick:()=>{Z(l.path)},children:s("memory.discard")})]}),k!==null&&e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"mb-1 text-[12px] text-ink-secondary",children:s("memory.unsavedDraft")}),e.jsx("pre",{className:"max-h-[160px] overflow-auto whitespace-pre-wrap rounded-lg border border-hairline/40 bg-inset p-3 font-mono text-[12px] leading-relaxed text-ink",children:k}),e.jsx("button",{type:"button",className:O(_e,"mt-1"),onClick:()=>g(null),children:s("memory.dismissDraft")})]})]}),i&&e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsx(Bt,{title:s("memory.topicFiles"),hint:s("memory.topicFilesHint"),files:i.topics,selected:l?.path,onOpen:N=>{Z(N.path)},onDelete:N=>{je(N)}}),e.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[e.jsx("input",{className:O(Qe,"py-1.5 text-[13px]"),value:F,placeholder:s("memory.newTopicPlaceholder"),"aria-label":s("memory.newTopicLabel"),onChange:N=>B(N.target.value),onKeyDown:N=>{N.key==="Enter"&<()}}),e.jsx("button",{type:"button",className:ie,disabled:!F.trim(),onClick:()=>{lt()},children:s("memory.newTopic")})]}),i.logs.length>0&&e.jsx("div",{className:"mt-4",children:e.jsx(Bt,{title:s("memory.dailyLogs"),hint:s("memory.dailyLogsHint"),files:i.logs,selected:l?.path,onOpen:N=>{Z(N.path)},onDelete:N=>{je(N)}})})]}),e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:s("memory.changes")}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:s("memory.changesHelp")}),e.jsx("div",{className:"mt-3",children:e.jsx(ot,{rows:d,botName:t.name,reverting:S,onRevert:N=>{As(N)}})})]}),P&&e.jsx("div",{className:"text-[13px] text-ink-secondary",children:P}),v&&e.jsx("div",{className:"text-[13px] text-danger",children:v})]})}function Ui(t){return`---
|
|
2
|
-
title: ${t.replace(/\.md$/,"")}
|
|
3
|
-
description:
|
|
4
|
-
aliases: []
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
`}function qi({enabled:t,status:a,tidying:n,onToggle:o,onTidy:i,rooms:r}){return e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:s("memory.upkeep.title")}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:s("memory.upkeep.help")})]}),e.jsx(Pe,{checked:t,"aria-label":s("memory.upkeep.title"),onClick:o})]}),t&&r&&e.jsxs("div",{className:"mt-3 flex items-start justify-between gap-3 border-t border-hairline/40 pt-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[13px] font-medium text-ink",children:s("memory.learnFromRooms.title")}),e.jsx("p",{className:"mt-0.5 text-[13px] leading-relaxed text-ink-secondary",children:s("memory.learnFromRooms.subtitle")}),a&&!a.modelSteps&&e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:s("memory.learnFromRooms.noModelSteps")}),r.error&&e.jsx("p",{role:"alert",className:"mt-1 text-[13px] text-danger",children:r.error})]}),e.jsx(Pe,{checked:r.enabled,"aria-label":s("memory.learnFromRooms.title"),disabled:r.saving,onClick:r.onToggle,className:"disabled:cursor-wait disabled:opacity-50"})]}),t&&a&&!a.modelSteps&&e.jsx("p",{className:"mt-2 text-[13px] text-ink-secondary",children:s("memory.upkeep.noModelSteps")}),t&&e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3",children:[e.jsx("button",{type:"button",className:ie,disabled:n,onClick:i,children:n?s("memory.upkeep.tidying"):s("memory.upkeep.tidyNow")}),e.jsxs("span",{className:"text-[13px] text-ink-secondary",children:[a?.lastTidy?s("memory.upkeep.lastTidy",{time:Ee(a.lastTidy.at,se()),summary:js(a.lastTidy).toLowerCase()}):s("memory.upkeep.notTidied"),a?.lastCapture&&ze(a.lastCapture)?` ${s(ze(a.lastCapture)===1?"memory.upkeep.lastNoticed.one":"memory.upkeep.lastNoticed.many",{count:ze(a.lastCapture),time:Ee(a.lastCapture.at,se())})}`:""]})]})]})}function Wi({index:t}){const a=Zn(t),n=a.level==="over"?"bg-danger":a.level==="near"?"bg-warning":"bg-accent";return e.jsxs("div",{className:O("rounded-xl p-4",a.level==="over"?"border border-danger/30 bg-danger/10":"bg-card"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 text-[13px]",children:[e.jsx("span",{className:"font-medium text-ink",children:s("memory.capacity.title")}),e.jsx("span",{className:O("text-[12px]",a.level==="over"?"text-danger":"text-ink-secondary"),children:s("memory.capacity.summary",{lines:t.lines,maxLines:t.maxLines,bytes:ce(t.bytes),maxBytes:ce(t.maxBytes)})})]}),e.jsx(Mt,{label:s("memory.capacity.lines"),share:a.lineShare,fill:n}),e.jsx(Mt,{label:s("memory.capacity.size"),share:a.byteShare,fill:n}),e.jsx("p",{className:O("mt-2 text-[13px] leading-relaxed",a.level==="over"?"text-danger":"text-ink-secondary"),children:a.warning??s("memory.capacity.sentence",{lines:t.lines,maxLines:t.maxLines,bytes:ce(t.bytes),maxBytes:ce(t.maxBytes),maxLoaded:t.maxLines})}),a.warning&&e.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:s("memory.capacity.sentence",{lines:t.lines,maxLines:t.maxLines,bytes:ce(t.bytes),maxBytes:ce(t.maxBytes),maxLoaded:t.maxLines})})]})}function Mt({label:t,share:a,fill:n}){const o=`${Math.min(100,Math.round(a*100))}%`;return e.jsxs("div",{className:"mt-2 flex items-center gap-2 text-[12px] text-ink-secondary",children:[e.jsx("span",{className:"w-10 shrink-0",children:t}),e.jsx("div",{className:"h-1.5 flex-1 overflow-hidden rounded-full bg-inset",role:"meter","aria-label":s("memory.capacity.used",{label:t}),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.min(100,Math.round(a*100)),children:e.jsx("div",{className:O("h-full rounded-full",n),style:{width:o}})})]})}function Ns({botName:t,busy:a,onReload:n,onOverwrite:o}){return e.jsxs("div",{className:"mt-2 rounded-lg border border-warning/25 bg-warning/10 p-3 text-[13px] leading-relaxed text-ink",children:[e.jsx("div",{className:"font-medium",children:s("memory.conflict.title",{name:t})}),e.jsx("div",{className:"mt-0.5 text-ink-secondary",children:s("memory.conflict.help",{name:t})}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[e.jsx("button",{type:"button",className:ie,disabled:a,onClick:n,children:s("memory.reload")}),e.jsx("button",{type:"button",className:ie,disabled:a,onClick:o,children:s("memory.overwrite")})]})]})}function Bt({title:t,hint:a,files:n,selected:o,onOpen:i,onDelete:r}){return e.jsxs("div",{children:[e.jsx("div",{className:"text-[12px] font-medium uppercase tracking-[0.08em] text-ink-secondary",children:t}),e.jsx("div",{className:"mt-0.5 text-[12px] text-ink-secondary",children:a}),n.length===0?e.jsx("div",{className:"mt-2 text-[13px] text-ink-secondary",children:s("memory.noneYet")}):e.jsx("div",{className:"mt-2 overflow-hidden rounded-lg border border-hairline/40",children:n.map(d=>e.jsxs("div",{className:O("flex items-center gap-2 border-b border-hairline/40 px-3 py-2 last:border-b-0",o===d.path?"bg-control/60":"hover:bg-control/40"),children:[e.jsxs("button",{type:"button",onClick:()=>i(d),className:"flex min-w-0 flex-1 items-center gap-2 text-left",children:[e.jsx(Te,{size:14,className:"shrink-0 text-ink-secondary"}),e.jsx("span",{className:"truncate font-mono text-[13px] text-ink",children:d.name}),e.jsxs("span",{className:"shrink-0 text-[12px] text-ink-secondary",children:[ce(d.bytes)," · ",Ee(d.modifiedAt,se())]})]}),e.jsx("button",{type:"button",onClick:()=>r(d),"aria-label":s("memory.deleteFile",{name:d.name}),title:s("memory.delete"),className:"shrink-0 rounded-md p-1 text-ink-secondary hover:bg-control hover:text-danger",children:e.jsx(Qt,{size:14})})]},d.path))})]})}function ot({rows:t,botName:a,reverting:n,onRevert:o,now:i=Date.now()}){return t?t.length===0?e.jsx("div",{className:"text-[13px] text-ink-secondary",children:s("memory.noChanges")}):e.jsx("div",{className:"flex flex-col gap-2",children:t.map(r=>{const d=Yn(r),c=Jn(r);return e.jsxs("div",{className:"rounded-lg bg-inset px-3 py-2",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1 text-[13px] leading-relaxed text-ink",children:[e.jsx("span",{children:_i(r,a)})," · ",e.jsx("span",{className:"text-ink-secondary",children:Ee(r.at,se(),i)}),d&&e.jsxs(e.Fragment,{children:[" · ",e.jsx("span",{className:"text-ink-secondary",children:c?s(c,r.threadTitle?{title:r.threadTitle}:void 0):d})]})]}),r.canRevert?e.jsxs("button",{type:"button",disabled:n!==null,onClick:()=>o(r),className:"inline-flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-[12px] font-medium text-accent-text hover:bg-accent/10 disabled:opacity-50",children:[e.jsx(Ys,{size:12}),n===r.id?s("memory.undoing"):s("memory.undo")]}):e.jsx("span",{className:"shrink-0 text-[12px] text-ink-secondary",title:r.revertUnavailableReason,children:s("memory.cantUndo")})]}),r.diff&&e.jsxs("details",{className:"mt-1",children:[e.jsxs("summary",{className:"cursor-pointer text-[12px] text-ink-secondary",children:["+",r.added," −",r.removed," · ",s("memory.showChanged")]}),e.jsx("pre",{className:"mt-1 max-h-[240px] overflow-auto whitespace-pre-wrap rounded-md bg-card p-2 font-mono text-[12px] leading-relaxed text-ink",children:r.diff})]})]},r.id)})}):e.jsx("div",{className:"text-[13px] text-ink-secondary",children:s("memory.loading")})}function Vi({bot:t,rows:a,refreshError:n,onRollback:o,rollingBack:i}){if(!a)return e.jsx("div",{className:"text-[13px] text-ink-secondary",children:s("history.loading")});if(a.length===0)return e.jsx("div",{className:"text-[13px] text-ink-secondary",children:s("history.empty")});const r=[...a].sort((d,c)=>c.at-d.at);return e.jsxs("div",{className:"flex flex-col gap-2",children:[n&&e.jsx("div",{className:"rounded-lg bg-inset px-3 py-2 text-[13px] text-ink-secondary",children:s("history.refreshError")}),r.map(d=>e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1 text-[13px] leading-relaxed text-ink",children:[e.jsx("span",{className:"text-ink-secondary",children:Gt(d.at)})," · ",e.jsxs("span",{children:[d.actor," via ",d.via]})," · ",e.jsx("span",{children:d.summary})]}),d.field==="soul"&&d.canRestore===!0&&e.jsx("button",{type:"button",disabled:i,onClick:()=>o(d.id),className:"shrink-0 rounded-md px-2 py-1 text-[12px] font-medium text-accent-text hover:bg-accent/10 disabled:opacity-50",children:s("history.undo")})]}),d.field==="soul"&&d.canRestore!==!0&&e.jsx("p",{className:"mt-2 text-[12px] leading-relaxed text-ink-secondary",children:d.restoreUnavailableReason??s("history.restoreUnavailable")})]},`${t.id}-${d.id}`))]})}function Zi({bot:t,bare:a=!1}){const{state:n,dispatch:o}=$(),i=Js(t),r=n.instances.find(d=>d.instanceId===t.modelSelection.instanceId);return i.turns===0?e.jsx("div",{className:O(a?"":"rounded-xl bg-card p-4","text-[13px] text-ink-secondary"),children:s("usage.bot.empty")}):e.jsxs("div",{className:a?void 0:"rounded-xl bg-card p-4",children:[!a&&e.jsxs("div",{className:"flex items-baseline justify-between",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:s("usage.title")}),e.jsxs("button",{onClick:()=>o({type:"toggleAppSettings",open:!0,section:"usage"}),className:"text-[12px] text-ink-secondary hover:text-ink",children:[s("usage.allBots")," ",e.jsx(be,{size:14,"aria-hidden":"true",className:"inline align-[-2px] rtl:-scale-x-100"})]})]}),e.jsxs("div",{className:O("grid grid-cols-3 gap-3 text-[13px]",!a&&"mt-3"),children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[12px] uppercase tracking-wide text-ink-secondary",children:s("usage.colTurns")}),e.jsx("div",{className:"mt-0.5 tabular-nums text-ink",children:i.turns})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[12px] uppercase tracking-wide text-ink-secondary",children:Qs(i)}),e.jsx("div",{className:"mt-0.5 tabular-nums text-ink",title:ta(i),children:Xs(ea(i))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[12px] uppercase tracking-wide text-ink-secondary",children:s("usage.colCost")}),e.jsx("div",{className:"mt-0.5 tabular-nums text-ink",children:ut(i.costUsd)?sa(i.costUsd):"—"})]})]}),e.jsx("div",{className:"mt-2 text-[12px] text-ink-secondary",children:ut(i.costUsd)?s("usage.costLine",{caption:aa(r?.snapshot.billing)}):s("usage.bot.unpriced")})]})}const Gi=[["bot","botPanel.avatar.tabBot"],["generate","botPanel.avatar.tabGenerate"],["upload","botPanel.avatar.tabUpload"]],Yi=["circle","rounded","square"],Ji={circle:"botPanel.avatar.circle",rounded:"botPanel.avatar.rounded",square:"botPanel.avatar.square"},Qi={idle:"botPanel.face.idle",happy:"botPanel.face.happy",curious:"botPanel.face.curious",drowsy:"botPanel.face.drowsy",working:"botPanel.face.working",thinking:"botPanel.face.thinking",listening:"botPanel.face.listening",sleeping:"botPanel.face.sleeping",suspicious:"botPanel.face.suspicious",proud:"botPanel.face.proud"},Xi=t=>{const a=Qi[t];return a?s(a):t};function er({bot:t,activeState:a,onPatch:n,onClose:o}){const i=na(t,n),{fileRef:r,crop:d,uploading:c,generating:l,busy:m,error:p,upload:f,removeImage:k,generate:g}=i,v=d!=="mascot"&&!!t.avatarUrl,[j,P]=u.useState(v?"upload":"bot"),b=u.useRef(null);u.useEffect(()=>{b.current?.querySelector('[aria-selected="true"]')?.focus()},[]);const w=h=>n(d==="mascot"?h:{...h,avatarCrop:"mascot"}),x=t.mascotBody??"cursor",S=An(),M=Ln(t.mascotBody,t.color,S),[F,B]=u.useState(()=>!!S||kt(x)||!!(t.mascotExpression&&t.mascotExpression!=="idle")),T=S&&M!==x&&kt(M)?Fe(M):null,H=(h,I)=>e.jsx("button",{type:"button",disabled:m,"aria-pressed":!v&&x===h,"aria-label":s("mascot.useBody",{name:I}),title:I,onClick:()=>w({mascotBody:h}),className:O("flex h-[58px] items-center justify-center rounded-xl disabled:opacity-50",!v&&x===h?"bg-ink/[0.08] ring-[1.5px] ring-inset ring-ink/25":"hover:bg-ink/[0.05]"),children:e.jsx(_n,{color:t.color,faceColor:t.mascotFaceColor,bodyId:h,size:40,animated:!1,trackPointer:!1})},h),A=h=>{h.key==="Escape"&&(h.preventDefault(),h.stopPropagation(),o())};return e.jsxs("div",{role:"dialog","aria-label":s("botPanel.avatar.edit"),"data-panel-avatar-editor":!0,"data-look":"popover",onKeyDown:A,className:"popover-surface absolute inset-x-[-5px] top-[80px] z-30 overflow-hidden rounded-2xl border border-ink/[0.08] bg-menu text-left shadow-2xl shadow-black/50",children:[e.jsxs("div",{ref:b,className:"flex items-center gap-0.5 border-b border-ink/[0.06] p-2",children:[Gi.map(([h,I])=>e.jsx("button",{type:"button",role:"tab","aria-selected":j===h,"data-avatar-tab":h,onClick:()=>P(h),className:O("rounded-lg px-[11px] py-[5px] text-[13px]",j===h?"bg-ink/[0.08] font-medium text-ink":"text-ink-secondary hover:text-ink"),children:s(I)},h)),e.jsx("button",{type:"button","data-avatar-reset":!0,disabled:m,onClick:()=>n(ia),className:"ml-auto rounded-lg px-[11px] py-[5px] text-[13px] text-ink-secondary hover:text-ink disabled:opacity-50",children:s("botPanel.avatar.reset")})]}),e.jsxs("div",{className:"p-3",children:[j==="bot"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-5 gap-1.5",children:Mn.map(h=>H(h,Fe(h)))}),e.jsx("div",{className:"flex flex-wrap justify-center gap-2 px-1 pb-1 pt-3.5",children:ra.map(h=>e.jsx("button",{type:"button",disabled:m,"aria-pressed":t.color===h,"aria-label":s("mascot.useColor",{color:Dn(h)}),title:s($n[h]),onClick:()=>w({color:h}),className:O("size-6 rounded-full disabled:opacity-50",t.color===h&&"ring-2 ring-ink/80 ring-offset-2 ring-offset-menu"),style:{background:Bn(h)}},h))}),e.jsx(ei,{bot:t,disabled:m,onPatch:w}),e.jsxs("button",{type:"button","data-avatar-more":!0,"aria-expanded":F,onClick:()=>B(h=>!h),className:"mx-auto mt-2.5 flex items-center gap-1 rounded-full px-2.5 py-1 text-[12px] text-ink-secondary hover:bg-ink/[0.04] hover:text-ink",children:[s("botPanel.avatar.more"),e.jsx(fe,{size:13,"aria-hidden":"true",className:O("transition-transform",F&&"rotate-180")})]}),F&&e.jsxs("div",{"data-avatar-more-looks":!0,children:[Fn.map(h=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 px-1 pb-1.5 pt-2 text-[12px] text-ink-tertiary",children:[e.jsx("span",{children:jt(h)}),h===S&&T&&e.jsx("span",{"data-avatar-costume":!0,children:s("botPanel.avatar.costume",{name:T,skin:jt(h)})})]}),e.jsx("div",{className:"grid grid-cols-5 gap-1.5","data-festival-bodies":h,children:zn[h].bodies.map(I=>H(I,Fe(I)))})]},h)),e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-1.5 pt-2.5",role:"group","aria-label":s("botPanel.avatar.face"),children:[e.jsx("span",{className:"mr-0.5 text-[12px] text-ink-tertiary",children:s("botPanel.avatar.face")}),Hn.map(h=>e.jsx("button",{type:"button",disabled:m,"data-avatar-face":h,"aria-pressed":a===h,onClick:()=>w({mascotExpression:h}),className:O("rounded-full px-2.5 py-1 text-[12px] disabled:opacity-50",a===h?"bg-ink/[0.15] text-ink":"bg-ink/[0.04] text-ink-secondary hover:text-ink"),children:Xi(h)},h))]})]})]}),j==="generate"&&e.jsx("div",{className:"[&>div:first-child]:mt-0 [&>div:first-child]:border-0 [&>div:first-child]:pt-0",children:e.jsx(oa,{botLabel:t.title||t.name,disabled:c,generating:l,onGenerate:g})}),j==="upload"&&e.jsxs(e.Fragment,{children:[e.jsx(la,{busy:m,onUpload:h=>{f(h)}}),v&&e.jsx(ca,{bot:t,disabled:m,onPatch:n}),e.jsx("input",{ref:r,type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",className:"sr-only",onChange:h=>{f(h.target.files?.[0])}}),e.jsxs("button",{type:"button","data-avatar-drop":!0,disabled:m,onClick:()=>r.current?.click(),onDragOver:h=>h.preventDefault(),onDrop:h=>{h.preventDefault(),f(h.dataTransfer.files?.[0])},className:"flex w-full flex-col items-center gap-1.5 rounded-xl border-[1.5px] border-dashed border-ink/15 px-3 py-6 text-center text-[13px] text-ink-secondary hover:border-ink/25 hover:text-ink disabled:opacity-50",children:[c?e.jsx(Ce,{size:22,className:"animate-spin"}):e.jsx(da,{size:22}),e.jsx("span",{children:s("botPanel.avatar.drop")}),e.jsx("span",{className:"text-[12px] text-ink-tertiary",children:s("botPanel.avatar.types")})]}),e.jsxs("div",{className:"mt-2.5 flex items-center gap-2.5",children:[e.jsx("span",{className:"shrink-0 text-[12px] text-ink-secondary",children:s("botPanel.avatar.shape")}),e.jsx(Se,{attr:"data-avatar-crop",label:s("botPanel.avatar.shape"),value:v?d:null,onChange:h=>n({avatarCrop:h}),options:Yi.map(h=>({value:h,label:s(Ji[h]),disabled:m||!t.avatarUrl}))}),t.avatarUrl&&e.jsx("button",{type:"button",onClick:k,disabled:m,"aria-label":s("botIdentity.removeAvatar"),title:s("botPanel.avatar.remove"),className:"flex size-8 shrink-0 items-center justify-center rounded-lg text-ink-secondary hover:bg-control hover:text-danger disabled:opacity-50",children:e.jsx(Qt,{size:14})})]}),!v&&e.jsx("p",{className:"mt-2 text-[12px] text-ink-tertiary",children:s("botPanel.avatar.uploadHint")})]}),p&&e.jsx("div",{role:"alert",className:"mt-3 text-[12px] text-danger",children:p})]})]})}const tr=()=>s("place.off");function Ss(t){const{dispatch:a}=$();return(n="computer")=>{ua(t.id,n),a({type:"toggleSettings",open:!1}),a({type:"toggleComputer",open:!0})}}function sr(t,a){const[n,o]=u.useState(null);return u.useEffect(()=>{if(!a)return;let i=!1;return G(`/api/browser-sites?bot=${encodeURIComponent(t.id)}`).then(r=>{i||o({botId:t.id,count:r.sites?.length??0})}).catch(()=>{}),()=>{i=!0}},[t.id,a]),n?.botId===t.id?n.count:null}function Cs(t){const{state:a}=$(),{capabilities:n}=ve(),o=n.host?.platform??"other",i=xa(t),r=t.computer??"auto",d=a.config?.browserEngine?.myChrome===!0&&(a.config?.browserProfiles??[]).some(g=>g.id===t.browserProfile&&g.browser==="chrome"),c=g=>g==="browser"&&d?s("settings.profiles.myChrome"):ga(g,o),l=g=>{const{view:v,reachable:j}=i[g];return{value:g,label:c(g),disabled:!j,hint:!j||fa(v)?v.line:void 0}},m=[{value:"auto",label:s("computer.simple.dest.letItChoose")},...i.local.policy?[l("local")]:[],...i.browser.policy||r==="browser"?[l("browser")]:[],...i.cloud.policy?[l("cloud")]:[],...i.vm.policy||r==="vm"?[l("vm")]:[],...r==="off"?[{value:r,label:tr(),disabled:!0}]:[]],p=t.tasks?.find(g=>g.threadId===t.threadId)?.surface,f=p&&p!==r?c(p):null,k=m.find(g=>g.value===r)?.label??(r==="auto"||r==="off"?void 0:c(r));return{options:m,current:r,currentLabel:k,usingNow:f}}function ar({bot:t,derived:a}){const{dispatch:n}=$(),{options:o,current:i,usingNow:r}=Cs(t),[d,c]=u.useState(null),{patch:l,approvalMode:m}=a,p=f=>{if(!(f===i||f==="off")){if(f==="local"&&m==="auto"){c({botId:t.id,patch:{computer:"local",acknowledgeLocalAuto:!0}});return}l(f==="browser"?{computer:"browser",browser:!0}:{computer:f==="auto"?null:f})}};return e.jsxs(e.Fragment,{children:[e.jsx(L,{children:e.jsx("div",{role:"radiogroup","aria-label":s("computer.simple.whereWorks",{name:t.name}),className:"flex flex-col divide-y divide-ink/[0.05]",children:o.map(f=>e.jsx(Ve,{"data-panel-choice":f.value,title:f.label,hint:f.hint,checked:i===f.value,disabled:f.disabled,onClick:()=>p(f.value)},f.value))})}),r&&e.jsx("p",{"data-panel-using-now":!0,className:"mx-1 text-[13px] text-ink-secondary",children:s("computer.simple.usingNow",{place:r})}),e.jsx(ha,{open:d!==null,onCancel:()=>c(null),onConfirm:()=>{const f=d;c(null),f&&n({type:"updateBot",botId:f.botId,patch:f.patch})}})]})}function nr({bot:t,derived:a,onOpen:n}){const o=Ss(t),i=at(),{browserEnabled:r}=a,d=sr(t,r&&t.computer!=="off"&&i!==!1),{currentLabel:c,usingNow:l}=Cs(t),m=s("computer.screenOf",{name:t.name}),p=[...t.messages].reverse().find(k=>k.kind==="screen"&&(k.hasImage||k.png)),f=p?ma({threadId:t.threadId,messageId:p.id},p.mime).src:null;return e.jsxs("div",{"data-panel-tabpanel":"computer",children:[e.jsxs("button",{type:"button","data-panel-action":"open-computer","aria-label":`${s("place.action.watch")}: ${m}`,onClick:()=>o(),className:"group relative mt-2.5 flex aspect-[16/10] w-full flex-col items-center justify-center gap-2 overflow-hidden rounded-xl bg-composer ring-1 ring-inset ring-ink/[0.06] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-border",children:[f?e.jsx("img",{src:f,alt:"",className:"absolute inset-0 size-full object-cover"}):t.busy?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"opacity-55",children:e.jsx(Je,{bot:t,size:52,animated:!1})}),e.jsx("span",{className:"max-w-[80%] text-center text-[13px] text-ink-secondary",children:s("botPanel.screen.working")})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"opacity-60",children:e.jsx(Je,{bot:t,size:44,state:"sleeping",animated:!1})}),e.jsx("span",{className:"max-w-[80%] text-center text-[13px] font-medium text-ink",children:s("botPanel.screen.resting")})]}),e.jsxs("span",{"aria-hidden":"true",className:"absolute bottom-2.5 right-2.5 flex h-7 items-center gap-1.5 rounded-full border border-ink/10 bg-panel/80 px-2.5 text-[12px] text-ink opacity-0 backdrop-blur-sm transition-opacity group-hover:opacity-100 group-focus-within:opacity-100 touch:opacity-100",children:[e.jsx(Pt,{size:13,"aria-hidden":"true"}),s("place.action.watch")]})]}),e.jsx("div",{className:"mt-3 text-center text-[13px] text-ink-tertiary",children:m}),e.jsxs(L,{anchor:"where",children:[e.jsx(ee,{"data-panel-page":"where",icon:Pt,title:s("computer.simple.whereWorks",{name:t.name}),hint:l?s("computer.simple.usingNow",{place:l}):void 0,value:c,onClick:()=>n("where")}),e.jsx(ee,{"data-panel-page":"browser",icon:pa,title:s("settings.sites.title"),value:d??void 0,onClick:()=>n("browser")})]})]})}const ir=3,$t="[&_.font-semibold]:font-medium [&_time]:text-[12px] [&_time]:text-ink-tertiary [&_span.bg-accent]:size-2",rr=8,or=200,ue=new Map,Ke=new Set,Dt=t=>`${t.threadId}@${ss(t)}`;function lr(t,a){const[,n]=u.useState(0),i=a.filter(c=>c.threadId!==t.threadId).map(Dt).filter(c=>!ue.has(c)&&!Ke.has(c)).join(",");u.useEffect(()=>{if(i)for(const c of i.split(",")){Ke.add(c);const l=c.slice(0,c.lastIndexOf("@"));G(`/api/threads/${encodeURIComponent(l)}/messages?limit=${rr}`,{background:!0}).then(m=>{ue.set(c,Ge({messages:m.messages??[],activeLeafId:m.activeLeafId??void 0})),ue.size>or&&ue.delete(ue.keys().next().value),n(p=>p+1)}).catch(()=>{}).finally(()=>Ke.delete(c))}},[i]);const r=Ge(t),d=new Map(a.map(c=>[c.threadId,Dt(c)]));return c=>c===t.threadId?r:ue.get(d.get(c)??"")}function cr({bot:t}){const{state:a,dispatch:n}=$(),o=ya(),i=!Xt(es,!0),[r,d]=u.useState(""),[c,l]=u.useState(!1),[m,p]=u.useState(!1),[f,k]=u.useState(!1),g=ba(a.config),v=u.useMemo(()=>{const{onRename:y,onRegenerateTitle:z,onDelete:oe,onMove:pe,onPin:ge,onArchive:E}=va(t.id,n,g);return{onRename:y,onRegenerateTitle:z,onDelete:oe,onMove:pe,onPin:ge,onArchive:E}},[t.id,n,g]),j=ka(t),P=t.tasks??[{threadId:t.threadId,title:s("task.newShort"),createdAt:0}],b=(j?ja({...t,tasks:P},j):P).filter(y=>!y.routineRunId).map(y=>{const z=Ze(t,y.threadId);return{...y,busy:z.busy,activity:z.activity,waitingForTeammates:z.waitingForTeammates,turnStartedAt:z.turnStartedAt??void 0,queued:!!a.pendingQueued[y.threadId]?.length}}),w=xt(b.filter(y=>!$e(y)||y.threadId===t.threadId)),x=xt(b.filter(y=>$e(y)&&y.threadId!==t.threadId)),S=r.trim(),M=w.filter((y,z)=>z<ir||y.threadId===t.threadId),F=lr(t,[...S||m?w:M,...f?x:[]]),B=y=>{const z=F(y);return z?Sa(Ze(t,y),z,a.instances,!1):void 0},T=wa(w,S),H=S?[...T,...w.filter(y=>!T.includes(y)&&B(y.threadId)?.toLowerCase().includes(S.toLowerCase()))]:w,A=S?H:m?w:M,h=w.length-M.length,I=t.projects?.find(y=>y.id===t.tasks?.find(z=>z.threadId===t.threadId)?.projectId),D=()=>{i&&n({type:"toggleSettings",open:!1})},_=y=>{y.threadId!==t.threadId&&Oa(n,t,y.threadId,!1),D()},K=()=>{n({type:"newTask",botId:t.id,...I?{projectId:I.id}:{}}),D()},J=()=>{d(""),l(!1)},Y=w.length>=2||c||w.some(y=>y.threadId===t.threadId&&$e(y)),U=y=>e.jsx("div",{role:"listitem","data-conversation":y.threadId,children:e.jsx(Ca,{panel:!0,preview:B(y.threadId),task:y,ownerId:t.id,current:y.threadId===t.threadId,folders:t.projects,now:Pa(ss(y),o),locale:se(),onSelect:_,...v})},y.threadId);return e.jsxs("section",{"data-panel-card":"conversations","aria-label":s("botPanel.conversations.title"),children:[e.jsx(Oe,{action:Y&&e.jsx("button",{type:"button","data-conversations-search":!0,"aria-label":s("botPanel.conversations.search"),title:s("botPanel.conversations.search"),"aria-pressed":c,onClick:()=>c?J():l(!0),className:O("-me-1 flex size-6 shrink-0 items-center justify-center rounded-[6px] text-ink-secondary transition-colors hover:bg-ink/[0.06] hover:text-ink",c&&"bg-ink/[0.06] text-ink"),children:e.jsx(Xe,{size:14,"aria-hidden":"true"})}),children:s("botPanel.conversations.title")}),e.jsx("div",{className:O("flex items-center gap-2",Y&&"mb-2"),children:t.yourAccess!=="view"&&j!=="team"&&e.jsxs("button",{type:"button","data-conversations-new":!0,"aria-label":s("botPanel.conversations.new"),onClick:K,className:O(ts,"flex-1"),children:[e.jsx(Na,{size:15,"aria-hidden":"true",className:"shrink-0 text-ink-secondary"}),e.jsx("span",{className:"truncate",children:s("botPanel.conversations.new")})]})}),Y&&c&&e.jsx("input",{autoFocus:!0,type:"search","data-conversations-query":!0,value:r,onChange:y=>d(y.target.value),onKeyDown:y=>{y.key==="Escape"&&(y.preventDefault(),y.stopPropagation(),J())},placeholder:s("botPanel.conversations.searchPlaceholder",{name:t.name}),"aria-label":s("botPanel.conversations.searchPlaceholder",{name:t.name}),className:"mb-1.5 w-full rounded-[8px] border border-hairline/60 bg-inset px-3 py-1.5 text-[13px] text-ink outline-none placeholder:text-ink-tertiary focus:border-focus"}),Y&&e.jsx("div",{role:"list","aria-label":s("botPanel.conversations.title"),className:O("flex flex-col gap-px",$t),children:A.map(U)}),Y&&S&&A.length===0&&e.jsx("p",{className:"px-3 py-3 text-[13px] text-ink-secondary",children:s("task.noMatch",{query:S})}),Y&&!S&&h>0&&e.jsxs("button",{type:"button","data-conversations-more":!0,"aria-expanded":m,onClick:()=>p(y=>!y),className:"mt-0.5 flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-[13px] text-ink-secondary hover:bg-ink/[0.04] hover:text-ink",children:[m?e.jsx(ht,{size:14,"aria-hidden":"true"}):e.jsx(fe,{size:14,"aria-hidden":"true"}),m?s("botPanel.conversations.showFewer"):s("botPanel.conversations.showMore",{count:h})]}),!S&&x.length>0&&e.jsxs("button",{type:"button","data-conversations-archived":!0,"aria-expanded":f,onClick:()=>k(y=>!y),className:"mt-0.5 flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-[13px] text-ink-secondary hover:bg-ink/[0.04] hover:text-ink",children:[f?e.jsx(ht,{size:14,"aria-hidden":"true"}):e.jsx(fe,{size:14,"aria-hidden":"true"}),s("task.archivedList",{count:x.length})]}),!S&&f&&x.length>0&&e.jsx("div",{role:"list","aria-label":s("task.archivedList",{count:x.length}),className:O("flex flex-col gap-px",$t),children:x.map(U)})]})}function dr({bot:t}){const{dispatch:a}=$();return qt()||!t.defaultBot?null:e.jsx(L,{label:s("botPanel.tryAsking"),anchor:"try-asking",children:Ea.map(o=>e.jsx("button",{type:"button","data-panel-ask":o,onClick:()=>a({type:"send",botId:t.id,text:s(o),threadId:t.threadId}),className:"flex h-9 w-full items-center px-3.5 text-left text-[14px] text-ink transition-colors hover:bg-ink/[0.03]",children:e.jsx("span",{className:"truncate",children:s(o)})},o))})}const mr=["find","start-fresh","usage","activity","inspector"];function pr({item:t}){const a=t.key==="usage";return e.jsxs("button",{type:"button","data-panel-item":t.key,disabled:t.disabled,title:t.title,"aria-pressed":t.active||void 0,onClick:t.onSelect,className:O(Q,"w-full rounded-[8px] text-left enabled:hover:bg-ink/[0.04] disabled:cursor-default disabled:opacity-45"),children:[e.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center text-ink-secondary [&_svg]:size-4","aria-hidden":"true",children:t.icon}),e.jsx("span",{className:O("min-w-0 truncate text-[14px] font-medium",!a&&"flex-1",t.active?"text-accent-text":"text-ink"),children:t.label}),t.trailing&&e.jsx("span",{className:O("flex items-center",a?"min-w-0 flex-1 justify-end text-right":"shrink-0"),children:t.trailing}),t.key!=="find"&&t.key!=="start-fresh"&&e.jsx(be,{size:15,"aria-hidden":"true",className:"shrink-0 text-ink-tertiary rtl:-scale-x-100"})]})}function ur({bot:t,derived:a,onOpen:n}){const{items:o}=Ra(t),{dispatch:i}=$(),r=a.botRoutines.filter(c=>c.enabled).length,d=mr.flatMap(c=>o.filter(l=>l.key===c));return e.jsxs("div",{"data-panel-tabpanel":"details",children:[e.jsx("section",{"data-panel-card":"model",className:"pt-2",children:e.jsx("div",{"data-panel-row":"model",className:O(Q,"rounded-[8px]"),children:e.jsx(Ia,{bot:t,contained:!0,threadId:t.threadId,label:e.jsxs("span",{className:"flex shrink-0 items-center gap-2.5",children:[e.jsx(X,{icon:tt}),e.jsx(ae,{title:s("model.simple.model")})]})})})}),e.jsx(cr,{bot:t}),e.jsx(dr,{bot:t}),d.length>0&&e.jsxs("section",{"data-panel-card":"conversation",children:[e.jsx(Oe,{children:s("botPanel.section.conversation")}),d.map(c=>e.jsx(pr,{item:c},c.key))]}),a.botRoutines.length===0?e.jsxs("section",{"data-panel-empty":"routines",children:[e.jsx(Oe,{action:e.jsx(Ta,{"data-panel-automations":"",onClick:()=>i({type:"showRoutines",view:"list"}),children:s("sidebar.nav.automations")}),children:s("botSettings.simple.routines")}),e.jsxs("button",{type:"button","data-panel-page":"routines",title:s("botPanel.routines.emptyHint"),onClick:()=>n("routines"),className:O(ts,"w-full"),children:[e.jsx(Ci,{size:15,"aria-hidden":"true",className:"shrink-0 text-ink-secondary"}),e.jsx("span",{className:"truncate",children:s("botPanel.routines.add")})]})]}):e.jsx(L,{label:s("botSettings.simple.routines"),anchor:"routines",children:e.jsx(ee,{"data-panel-page":"routines",icon:Aa,title:s("botSettings.simple.routines"),value:r>0?s("botPanel.routinesOn",{count:r}):s("botPanel.none"),onClick:()=>n("routines")})})]})}const Ps=/^\s*[-*]\s+(.+?)\s*$/;function xr(t){return t.split(`
|
|
8
|
-
`).flatMap((a,n)=>{const o=Ps.exec(a)?.[1];return o?[{line:n,text:o}]:[]})}function hr(t,a){const n=t.split(`
|
|
9
|
-
`);return Ps.test(n[a]??"")?(n.splice(a,1),n.join(`
|
|
10
|
-
`)):t}function fr(t,a){const n=t.replace(/\s+$/,""),o=`- ${a.trim().replace(/\s*\n\s*/g," ")}`;return n?`${n}
|
|
11
|
-
${o}
|
|
12
|
-
`:`${o}
|
|
13
|
-
`}function Os(t){return t.flatMap(a=>{const n=xr(a.text).map(i=>({path:a.path,...i}));if(n.length||a.path===te)return n;const o=a.text.split(`
|
|
14
|
-
`).map(i=>i.replace(/^#+\s*/,"").trim()).filter(Boolean).join(" ");return o?[{path:a.path,line:null,text:o}]:[]})}async function gr(t,a){if(!a)return[await Re(t,te)];const n=await it(t,!0);return Promise.all([te,...n.topics.map(o=>o.path)].map(o=>Re(t,o,!0)))}function Es(t){const a=!!$().state.config?.team,[n,o]=u.useState({botId:t.id,docs:null,error:!1}),i=t.memoryEnabled!==!1,r=async(l,m)=>{try{const p=await gr(l,a);m?.()||o({botId:l,docs:p,error:!1})}catch{m?.()||o({botId:l,docs:null,error:!0})}},d=!!t.busy;u.useEffect(()=>{if(!i)return;let l=!1;return r(t.id,()=>l),()=>{l=!0}},[t.id,i,d,a]);const c=n.botId===t.id;return{docs:c?n.docs:null,error:c&&n.error,mine:a,setDoc:l=>o(m=>({botId:t.id,docs:(m.botId===t.id?m.docs??[]:[]).map(p=>p.path===l.path?l:p),error:!1})),reload:()=>r(t.id)}}function yr(t,a=Ge(t)){const n=[],o=[],i=new Set;for(const m of[...a].reverse()){const p=m.publishedPage;p?.state==="live"&&p.url&&!i.has(p.url)&&(i.add(p.url),n.push({messageId:m.id,title:p.title||p.url,url:p.url})),m.kind==="app"&&m.app?.doc&&o.push({messageId:m.id,title:m.app.title})}const r=gi(t),d=[],c=new Set;for(const m of r.values())c.has(m.file.path)||(c.add(m.file.path),d.push(m));const l=yi(t).filter(m=>!r.has(m));return{pages:n,apps:o,shared:d,unshared:l}}const br=t=>t.slice(Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"))+1);function Rs({bot:t,onOpen:a}){const{dispatch:n}=$(),{capabilities:o}=ve(),i=La(),r=!Xt(es,!0),d=xs(t),c=Es(t),{pages:l,apps:m,shared:p,unshared:f}=u.useMemo(()=>yr(t),[t]),k=b=>{n({type:"focusMessage",threadId:t.threadId,messageId:b}),r&&n({type:"toggleSettings",open:!1})},g=d.skills.filter(hs).length,v=c.docs?Os(c.docs).length:null,j=t.memoryEnabled===!1?s("botPanel.memory.off"):v===null?c.error?s("botPanel.memory.nothingYet"):void 0:v===0?s("botPanel.memory.nothingYet"):v===1?s("botPanel.memory.note"):s("botPanel.memory.notes",{count:v}),P=e.jsxs(L,{anchor:"keeps",children:[e.jsx(ee,{"data-panel-page":"memory",icon:Wt,title:s("botPanel.memoryRow"),value:j,onClick:()=>a("memory")}),e.jsx(ee,{"data-panel-page":"skills",icon:Ma,title:s("botSettings.simple.skills"),value:d.loading?void 0:g>0?g:s("botPanel.none"),onClick:()=>a("skills")}),e.jsx(ee,{"data-panel-page":"folder",icon:Ba,title:s("computer.files.folder"),value:t.cwd?st(t.cwd,o.host?.homeDir):s("botPanel.folder.private"),onClick:()=>a("folder")})]});return l.length+m.length+p.length+f.length===0?e.jsxs("div",{"data-panel-tabpanel":"library",children:[e.jsx("p",{"data-panel-empty":"library",className:"px-3 py-7 text-center text-[13px] leading-[18px] text-ink-tertiary",children:s("botPanel.library.empty")}),P]}):e.jsxs("div",{"data-panel-tabpanel":"library",children:[l.length>0&&e.jsx(L,{label:s("botPanel.library.pages"),anchor:"pages",children:l.map(b=>e.jsx(ee,{"data-panel-row":"page",icon:$a,title:e.jsx("span",{className:"block truncate",children:b.title}),hint:e.jsx("span",{className:"block truncate",children:b.url}),onClick:()=>i(b.url)},b.url))}),m.length>0&&e.jsx(L,{label:s("botPanel.library.apps"),anchor:"apps",children:m.map(b=>e.jsx(ee,{"data-panel-row":"app",icon:as,title:e.jsx("span",{className:"block truncate",children:b.title}),onClick:()=>k(b.messageId)},b.messageId))}),p.length+f.length>0&&e.jsxs("section",{"data-panel-card":"files",children:[e.jsx(Oe,{children:s("botPanel.library.files")}),e.jsxs("ul",{className:"flex flex-col gap-1.5",children:[p.map(b=>e.jsx("li",{className:"min-w-0",children:e.jsx(Da,{file:b.file,message:b.message,linked:b.file.linked,className:"w-full max-w-none"})},`${b.message.messageId}:${b.file.path}`)),f.map(b=>e.jsxs("li",{title:s("computer.files.notSharedHint"),className:"flex min-w-0 items-center gap-2 rounded-lg border border-hairline/40 px-2.5 py-2",children:[e.jsx(Te,{size:14,className:"shrink-0 text-ink-secondary","aria-hidden":"true"}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] text-ink",children:br(b)}),e.jsx("span",{className:"shrink-0 text-[11px] text-ink-tertiary",children:s("computer.files.notShared")})]},b))]})]}),e.jsx("p",{className:"mt-3 text-center text-[12px] text-ink-tertiary",children:s("botPanel.library.scope")}),P]})}function vr({bot:t,browserEnabled:a,onOpenBrowser:n}){const{state:o}=$(),i=at(),r=t.browserProfile??"",d=(o.config?.browserProfiles??[]).find(p=>p.id===r),c=r==="guest",l=d?.browser==="chrome"&&o.config?.browserEngine?.myChrome===!0,m=r&&!c?o.bots.filter(p=>p.browserProfile===r).map(p=>p.name):[t.name];return e.jsx(L,{anchor:"logins",children:a?c?e.jsx(V,{children:s("settings.profiles.temporaryHint")}):l?e.jsx(V,{children:s("settings.profiles.myChromeHint")}):e.jsxs(e.Fragment,{children:[i!==!1&&(r===""||d)&&e.jsx(de,{children:e.jsx(Ni,{bare:!0,target:{bot:t.id},sharedBy:m,disabled:!!t.busy},`${t.id}:${r}`)}),e.jsx(V,{children:s("botSettings.simple.loginsHint",{name:t.name})}),e.jsx(me,{"data-panel-action":"add-login",icon:ke,onClick:n,children:s("botSettings.simple.addLogin")})]}):e.jsx(V,{children:s("botSettings.simple.loginsOff",{name:t.name})})})}const kr=[["all",()=>C("Tất cả","All")],["added",()=>C("Bot đang có","On this bot")],["more",()=>C("Chưa thêm","Not added")]],jr=t=>({bundled:C("Có sẵn","Built in"),library:C("Đã tải về","Downloaded"),imported:C("Từ máy tính","From this computer")})[t],Ue="inline-flex shrink-0 items-center gap-1.5 rounded-lg border border-hairline/60 bg-raised px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50";async function Ft(t,a){const n=await fetch(t,a===void 0?void 0:{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(a)}),o=await n.json().catch(()=>({}));if(!n.ok)throw new Error(o.error??C(`Lỗi ${n.status}`,`Error ${n.status}`));return o.skills??[]}function wr({botId:t,botName:a,onClose:n,onOpenSettings:o}){const[i,r]=u.useState(null),[d,c]=u.useState(""),[l,m]=u.useState("all"),[p,f]=u.useState(""),[k,g]=u.useState(""),v=`/api/limix/skill-store/${encodeURIComponent(t)}`;u.useEffect(()=>{let x=!1;return Ft(v).then(S=>{x||r(S)}).catch(S=>{x||(r([]),g(S.message))}),()=>{x=!0}},[v]),u.useEffect(()=>{const x=S=>{S.key==="Escape"&&n()};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[n]);const j=u.useMemo(()=>{const x=d.trim().toLowerCase();return(i??[]).filter(S=>(l==="all"||(l==="added"?S.added:!S.added))&&(!x||`${S.name} ${S.description}`.toLowerCase().includes(x)))},[i,d,l]),P=async(x,S)=>{if(!p){f(x.name),g("");try{r(await Ft(v,{name:x.name,kind:x.kind,add:S}))}catch(M){g(M instanceof Error?M.message:C("Không đổi được kĩ năng này.","Couldn't change this skill."))}finally{f("")}}},b=(i??[]).filter(x=>x.added).length,w=e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-6",onMouseDown:x=>x.stopPropagation(),children:e.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"limix-skill-store-title",className:"flex max-h-full w-full max-w-[640px] flex-col rounded-2xl border border-hairline/50 bg-panel shadow-2xl",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 px-6 pb-3 pt-5",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"limix-skill-store-title",className:"text-[17px] font-semibold text-ink",children:C("Kho Kĩ Năng (Skills)","Skills Store")}),e.jsx("p",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:C(`Chọn kĩ năng riêng cho ${a}. Chỉ những kĩ năng được thêm mới nằm trong lời nhắc của bot, nên bot không bị quá tải. Gõ /tên-kĩ-năng trong chat để gọi.`,`Pick skills just for ${a}. Only added skills go into the bot's prompt, so it never gets overloaded. Type /skill-name in chat to call one.`)})]}),e.jsx("button",{type:"button",onClick:n,"aria-label":C("Đóng","Close"),className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised hover:text-ink",children:e.jsx(et,{size:16})})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-6 pb-3",children:[e.jsxs("label",{className:"flex min-w-[200px] flex-1 items-center gap-2 rounded-lg border border-hairline/40 bg-inset px-3 py-2",children:[e.jsx(Xe,{size:14,className:"text-ink-tertiary"}),e.jsx("input",{value:d,onChange:x=>c(x.target.value),placeholder:C("Tìm kĩ năng…","Search skills…"),"aria-label":C("Tìm kĩ năng","Search skills"),className:"w-full bg-transparent text-[14px] text-ink placeholder:text-ink-secondary focus:outline-none"})]}),e.jsx("div",{className:"flex gap-1",role:"tablist","aria-label":C("Lọc kĩ năng","Filter skills"),children:kr.map(([x,S])=>e.jsxs("button",{type:"button",role:"tab","aria-selected":l===x,onClick:()=>m(x),className:`rounded-lg px-2.5 py-1.5 text-[13px] ${l===x?"bg-raised text-ink":"text-ink-secondary hover:bg-raised"}`,children:[S(),x==="added"&&i?` ${b}`:""]},x))})]}),k&&e.jsx("p",{role:"alert",className:"mx-6 mb-2 rounded-lg bg-danger/10 px-3 py-2 text-[12px] text-danger",children:k}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-6",children:i===null?e.jsxs("p",{className:"flex items-center gap-2 py-6 text-[13px] text-ink-secondary",children:[e.jsx(Ce,{size:14,className:"animate-spin"}),C("Đang tải kho…","Loading the store…")]}):j.length===0?e.jsx("p",{className:"py-6 text-[13px] text-ink-secondary",children:i.length===0?C("Kho chưa có kĩ năng nào.","The store has no skills yet."):C("Không có kĩ năng khớp.","No matching skills.")}):e.jsx("ul",{className:"flex flex-col divide-y divide-hairline/40 rounded-xl border border-hairline/40",children:j.map(x=>e.jsxs("li",{className:"flex items-start gap-3 px-3 py-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[e.jsx("span",{className:"font-mono text-[13px] text-ink",children:x.name}),e.jsx("span",{className:"text-[12px] text-ink-tertiary",children:x.core?C("Kĩ năng gốc","Core skill"):jr(x.kind)}),x.warnings>0&&e.jsxs("span",{className:"text-[12px] text-warning",children:[x.warnings," ",C("cảnh báo","warnings")]})]}),e.jsx("p",{className:"mt-0.5 line-clamp-2 text-[12px] leading-relaxed text-ink-secondary",children:x.description})]}),x.core?e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 px-1 py-1.5 text-[12px] text-ink-secondary",children:[e.jsx(dt,{size:14}),C("Luôn bật","Always on")]}):x.added?e.jsxs("button",{type:"button",className:Ue,disabled:!!p,onClick:()=>{P(x,!1)},"aria-label":C(`Bỏ ${x.name} khỏi bot`,`Remove ${x.name} from this bot`),children:[p===x.name?e.jsx(Ce,{size:14,className:"animate-spin"}):e.jsx(dt,{size:14}),C("Đã thêm","Added")]}):e.jsxs("button",{type:"button",className:Ue,disabled:!!p||!x.ready,onClick:()=>{P(x,!0)},"aria-label":C(`Thêm ${x.name} cho bot`,`Add ${x.name} to this bot`),children:[p===x.name?e.jsx(Ce,{size:14,className:"animate-spin"}):e.jsx(ke,{size:14}),C("Thêm","Add")]})]},`${x.kind}:${x.name}`))})}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 px-6 pb-5 pt-3",children:[e.jsx("p",{className:"text-[12px] text-ink-tertiary",children:C('Bấm "Đã thêm" để bỏ kĩ năng khỏi bot này.','Press "Added" to remove a skill from this bot.')}),e.jsx("button",{type:"button",className:Ue,onClick:o,children:C("Tải thêm kĩ năng","Get more skills")})]})]})});return typeof document>"u"?w:ls.createPortal(w,document.body)}const qe=[{kind:"telegram",label:"Telegram",placeholder:"123456789:AA…",howTo:()=>C("Tạo bot với @BotFather (lệnh /newbot), rồi dán token vào đây.","Make a bot with @BotFather (/newbot), then paste its token here."),where:t=>`@${t.username}`,linkFrom:t=>C(`Nhắn cho @${t.username}: `,`Send @${t.username}: `)},{kind:"discord",label:"Discord",placeholder:"MTA…",howTo:()=>C("Vào discord.com/developers → New Application → Bot → Reset Token, dán token vào đây. Mời bot vào server: OAuth2 → URL Generator → chọn bot và quyền Send Messages. Trong server, gọi bot bằng @tên-bot.","At discord.com/developers: New Application → Bot → Reset Token, paste it here. Invite it with OAuth2 → URL Generator (bot, Send Messages). In a server, call it with @its-name."),where:t=>`@${t.username}`,linkFrom:()=>C("Nhắn riêng cho bot trên Discord: ","Send the bot a direct message on Discord: ")},{kind:"zalo",label:"Zalo",howTo:()=>C("Quét mã QR bằng ứng dụng Zalo của tài khoản sẽ làm bot.","Scan the QR code with the Zalo app of the account that will be the bot."),note:()=>C("Nên dùng tài khoản Zalo phụ: đây là cách đăng nhập không chính thức (như Zalo Web), Zalo có thể khoá tài khoản. Mở Zalo Web bằng tài khoản này ở nơi khác sẽ ngắt bot.","Use a spare Zalo account: this sign-in is unofficial (like Zalo Web) and Zalo may lock the account. Opening Zalo Web with it elsewhere disconnects the bot."),where:t=>t.name||t.username||"Zalo",linkFrom:()=>C("Từ Zalo của bạn, nhắn cho tài khoản bot: ","From your own Zalo, message the bot's account: ")},{kind:"facebook",label:"Facebook Page",placeholder:"EAA…",howTo:()=>C("Dán Page Access Token: developers.facebook.com → tạo app → thêm Messenger → Access Tokens → chọn Page → Generate token.","Paste a Page access token: developers.facebook.com → create an app → add Messenger → Access Tokens → pick the Page → Generate token."),note:()=>C("Bot trả lời khách nhắn vào Page sau khoảng 10–20 giây. Muốn trả lời mọi khách, app Meta cần được duyệt quyền pages_messaging.","The bot answers people who message the Page within about 10–20 seconds. To answer everyone, the Meta app needs pages_messaging approved."),where:t=>t.name||"Page",linkFrom:()=>C("Từ Facebook cá nhân, nhắn cho Page: ","From your own Facebook, message the Page: ")}],he="rounded-lg bg-control px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover disabled:cursor-not-allowed disabled:opacity-50";function Nr({bot:t,className:a}){const[n,o]=u.useState("telegram"),[i,r]=u.useState({});u.useEffect(()=>{let c=!0;r({});for(const l of qe)G(`/api/bots/${t.id}/${l.kind}`).then(m=>{c&&r(p=>({...p,[l.kind]:m}))}).catch(()=>{});return()=>{c=!1}},[t.id]);const d=qe.find(c=>c.kind===n);return e.jsxs("div",{className:O("rounded-xl bg-card p-4",a),"data-testid":"channels-card",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:C("Kênh chat","Chat channels")}),e.jsx("div",{className:"mt-0.5 text-[13px] text-ink-secondary",children:C(`Cho ${t.name} trả lời tin nhắn ngoài app.`,`Let ${t.name} answer messages outside the app.`)}),e.jsx("div",{role:"tablist",className:"mt-3 flex flex-wrap gap-1.5",children:qe.map(c=>{const l=i[c.kind];return e.jsxs("button",{type:"button",role:"tab","aria-selected":n===c.kind,onClick:()=>o(c.kind),"data-testid":`channel-tab-${c.kind}`,className:O("flex items-center gap-1.5 rounded-lg px-2.5 py-1 text-[13px]",n===c.kind?"bg-control text-ink":"text-ink-secondary hover:bg-raised-hover"),children:[l?.connected&&e.jsx("span",{className:O("size-1.5 rounded-full",l.error?"bg-danger":l.enabled?"bg-success":"bg-ink-tertiary")}),c.label]},c.kind)})}),e.jsx(Sr,{bot:t,channel:d,view:i[n],onView:c=>r(l=>({...l,[n]:c}))},`${t.id}:${n}`)]})}function Sr({bot:t,channel:a,view:n,onView:o}){const i=`/api/bots/${t.id}/${a.kind}`,[r,d]=u.useState(""),[c,l]=u.useState(null),[m,p]=u.useState(!1),[f,k]=u.useState(null),g=!!(n?.login&&!n.login.error&&!n.connected);u.useEffect(()=>{if(!g)return;const P=setInterval(()=>{G(i).then(o).catch(()=>{})},2e3);return()=>clearInterval(P)},[g,i,o]);const v=async P=>{p(!0),k(null);try{const{code:b,...w}=await P();o(w),b&&l(b)}catch(b){k(b instanceof Error?b.message:String(b))}finally{p(!1)}},j=(P,b="")=>v(()=>G(`${i}${b}`,{method:"POST",body:JSON.stringify(P??{})}));return n?e.jsxs("div",{className:"mt-3 text-[13px]","data-testid":`channel-${a.kind}`,children:[!n.connected&&e.jsxs("div",{className:"flex flex-col gap-2 text-ink-secondary",children:[e.jsx("span",{children:a.howTo()}),a.note&&e.jsx("span",{className:"text-[12px]",children:a.note()}),a.placeholder?e.jsxs("form",{className:"flex gap-2",onSubmit:P=>{P.preventDefault(),r.trim()&&j({token:r.trim()}).then(()=>d(""))},children:[e.jsx("input",{type:"password",autoComplete:"off",spellCheck:!1,value:r,onChange:P=>d(P.target.value),placeholder:a.placeholder,"aria-label":C(`Token ${a.label}`,`${a.label} token`),className:"min-w-0 flex-1 rounded-lg bg-inset px-3 py-1.5 font-mono text-[13px] text-ink outline-none","data-testid":`channel-token-${a.kind}`}),e.jsx("button",{type:"submit",disabled:m||!r.trim(),className:he,"data-testid":`channel-connect-${a.kind}`,children:C("Kết nối","Connect")})]}):e.jsx(Cr,{view:n,busy:m,start:()=>{j({},"/login")},cancel:()=>{v(()=>G(`${i}/login`,{method:"DELETE"}))}})]}),n.connected&&e.jsxs("div",{className:"flex flex-col gap-2.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 text-ink",children:[e.jsx("span",{children:C(`${t.name} trả lời tin nhắn gửi tới ${a.where(n)}.`,`${t.name} answers messages sent to ${a.where(n)}.`)}),e.jsx(Pe,{"aria-label":C(`Bật ${a.label}`,`${a.label} on`),checked:n.enabled===!0,disabled:m,onClick:()=>{j({enabled:!n.enabled})},"data-testid":`channel-switch-${a.kind}`})]}),a.note&&a.kind==="facebook"&&e.jsx("span",{className:"text-[12px] text-ink-secondary",children:a.note()}),n.owner?e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-ink-secondary",children:[e.jsx("span",{children:C(`Chủ bot: ${n.owner}. Nhắn riêng ở đó như nhắn trong app, toàn quyền.`,`Owner: ${n.owner}. Direct messages there work as in the app, with full access.`)}),e.jsx("button",{type:"button",className:he,disabled:m,onClick:()=>{j({},"/unlink")},children:C("Bỏ liên kết","Unlink")})]}):e.jsxs("div",{className:"flex flex-col gap-1.5 text-ink-secondary",children:[e.jsx("span",{children:C("Liên kết tài khoản của bạn để nhắn với bot như trong app:","Link your own account to talk to the bot as in the app:")}),c?e.jsxs("span",{className:"text-ink","data-testid":`channel-code-${a.kind}`,children:[a.linkFrom(n),e.jsxs("code",{className:"rounded bg-inset px-1.5 py-0.5 font-mono",children:["/link ",c]}),C(" (hết hạn sau 15 phút)"," (expires in 15 minutes)")]}):e.jsx("button",{type:"button",className:O(he,"self-start"),disabled:m,onClick:()=>{j({},"/link")},"data-testid":`channel-link-${a.kind}`,children:C("Tạo mã liên kết","Make a link code")})]}),e.jsxs("label",{className:"flex items-center justify-between gap-3 text-ink",children:[e.jsxs("span",{children:[C("Trả lời cả người khác","Answer other people too"),e.jsx("span",{className:"block text-[12px] text-ink-secondary",children:C("Người khác và nhóm nhắn được bot ở chế độ an toàn: không dùng công cụ, không thấy cuộc trò chuyện của bạn.","Others and groups can write to the bot in safe mode: no tools, none of your conversations.")})]}),e.jsx(Pe,{"aria-label":C("Trả lời cả người khác","Answer other people too"),checked:n.access==="everyone",disabled:m,onClick:()=>{j({access:n.access==="everyone"?"owner":"everyone"})},"data-testid":`channel-everyone-${a.kind}`})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{type:"button",className:he,disabled:m,onClick:()=>{v(()=>G(i,{method:"DELETE"}))},"data-testid":`channel-remove-${a.kind}`,children:C("Gỡ kết nối","Disconnect")})})]}),(f||n.error)&&e.jsx("div",{role:"alert",className:"mt-2 text-[13px] text-danger",children:f??n.error})]}):e.jsx("div",{className:"mt-3 text-[13px] text-ink-secondary",children:"…"})}function Cr({view:t,busy:a,start:n,cancel:o}){const i=t.login;return!i||i.error?e.jsxs("div",{className:"flex flex-col gap-1.5",children:[i?.error&&e.jsx("span",{className:"text-danger",children:i.error}),e.jsx("button",{type:"button",className:O(he,"self-start"),disabled:a,onClick:n,"data-testid":"channel-qr-zalo",children:C("Tạo mã QR đăng nhập","Show a sign-in QR code")})]}):e.jsxs("div",{className:"flex items-start gap-3",children:[i.qr?e.jsx("img",{src:i.qr,alt:C("Mã QR đăng nhập Zalo","Zalo sign-in QR code"),className:"size-44 rounded-lg bg-white p-1.5","data-testid":"channel-qr-image"}):e.jsx("div",{className:"flex size-44 items-center justify-center rounded-lg bg-inset",children:"…"}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-ink",children:i.scanned?C(`${i.scanned} đã quét. Xác nhận đăng nhập trong ứng dụng Zalo.`,`${i.scanned} scanned it. Confirm the sign-in in the Zalo app.`):C("Mở Zalo trên điện thoại → biểu tượng quét mã → quét mã này.","Open Zalo on the phone → scan icon → scan this code.")}),e.jsx("button",{type:"button",className:O(he,"self-start"),onClick:o,children:C("Huỷ","Cancel")})]})]})}const Pr=5,Or={instanceId:"",model:""},Is=(t,a)=>`${t}\0${a}`,Er=new Set;function zt({bot:t,current:a,exclude:n,onPick:o,label:i,title:r,buttonRef:d,className:c,children:l,...m}){const{state:p,dispatch:f,refreshInstances:k,refreshModels:g}=$(),[v,j]=u.useState(!1),[P,b]=u.useState(""),[w,x]=u.useState(()=>new Set),[S,M]=u.useState(!1),[F,B]=u.useState(null),[T,H]=u.useState(null),A=u.useRef(null),h=d??A,I=u.useRef(null),D=u.useRef(null),_=u.useRef(!1),K=u.useId(),J=Wn(v),Y=u.useRef({contains:E=>[h.current,I.current].some(q=>q?.contains(E))});Ua(v,Y,()=>j(!1)),u.useLayoutEffect(()=>{if(!v)return;const E=q=>{if(q?.type==="scroll"&&q.target instanceof Node&&I.current?.contains(q.target))return;const Z=h.current?.getBoundingClientRect(),W=I.current;!Z||!W||H(le=>Va(Z,{width:ft,height:W.offsetHeight},{width:window.innerWidth,height:window.innerHeight},le??void 0))};return E(),window.addEventListener("resize",E),window.addEventListener("scroll",E,!0),()=>{window.removeEventListener("resize",E),window.removeEventListener("scroll",E,!0)}},[v,h]),u.useEffect(()=>{if(!v||!T||!_.current)return;_.current=!1;const E=I.current;(E?.querySelector("[data-menu-search]")??E?.querySelector("[data-current-model]")??E?.querySelector("[data-menu-row]:not(:disabled)")??E)?.focus({preventScroll:!0})},[v,T]);const U=E=>{j(!1),E&&h.current?.focus({preventScroll:!0})},y=()=>{b(""),x(new Set),H(null),_.current=!0,j(!0),M(!0),k().catch(()=>{}).finally(()=>M(!1))},z=E=>{F||(B(E.instanceId),g(E.instanceId).catch(()=>{}).finally(()=>B(null)))},oe=()=>{U(!1),f({type:"toggleAppSettings",open:!0,section:"engines"})},pe=()=>{const E=Ga(p.instances,a?.instanceId).flatMap(W=>{const le=W.models.options.filter(je=>!n.has(Is(W.instanceId,je.id)));return le.length===W.models.options.length?[W]:le.length?[{...W,models:{...W.models,options:le}}]:[]}),q=Ya({instances:p.instances,listed:E,selection:a??Or,bot:{name:t.name,selection:t.modelSelection},query:P,expanded:w,probing:Er,loading:S,refreshing:F}),Z=q.groups.map(W=>W.instance.instanceId===t.modelSelection.instanceId?{...W,note:s("botPanel.backups.sameAccount")}:W);return{...q,groups:Z,...a?{}:{current:null}}},ge=E=>{if(!(E.nativeEvent.isComposing||E.defaultPrevented)){if(E.key!=="Escape")return Za(E,{query:P,typed:D,close:()=>U(!0)});E.preventDefault(),E.stopPropagation(),P?b(""):U(!0)}};return e.jsxs(e.Fragment,{children:[e.jsx("button",{ref:h,type:"button",...m,"aria-label":i,title:r,"aria-haspopup":"dialog","aria-expanded":v,"aria-controls":v?K:void 0,onClick:()=>v?U(!1):y(),onKeyDown:E=>{E.key==="Escape"&&v?(E.preventDefault(),E.stopPropagation(),U(!1)):(E.key==="ArrowDown"||E.key==="ArrowUp")&&!v&&(E.preventDefault(),y())},className:c,children:l}),J.shown&&ls.createPortal(e.jsx("div",{ref:I,id:K,"data-backup-menu":!0,role:"dialog","aria-label":s("botPanel.backups.choose"),"aria-modal":"false",tabIndex:-1,...J.exitProps,onKeyDown:ge,onPointerMove:qa,style:{position:"fixed",left:T?.left??0,top:T?.top,bottom:T?.bottom,width:T?.width??ft,maxHeight:T?.maxHeight,transformOrigin:T?.origin,visibility:T?void 0:"hidden"},className:O("menu-surface z-[80] flex flex-col overflow-hidden",J.className),children:e.jsx(Wa,{menu:pe(),query:P,bot:t,botModel:{label:"",title:""},idPrefix:K,onQuery:b,onPick:(E,q)=>{E.policy||(o({instanceId:E.instanceId,model:q}),U(!0))},onPickCurrent:()=>U(!0),onFollowBot:()=>U(!0),onToggle:E=>x(q=>{const Z=new Set(q);return Z.delete(E.instanceId)||Z.add(E.instanceId),Z}),onSetUp:oe,onCheckAgain:z,onManage:oe})}),document.body)]})}function Rr({bot:t,onChange:a}){const{state:n}=$(),o=t.fallback??[],i=u.useRef(null),r=c=>new Set([t.modelSelection,...o.filter((l,m)=>m!==c)].map(l=>Is(l.instanceId,l.model))),d=c=>{const l=n.instances.find(f=>f.instanceId===c.instanceId),m=l?.models.options.find(f=>f.id===c.model),p=Ha(l,c.model);return{instance:l,name:p,short:l&&m?_a(m.label,Ka(l)):p}};return e.jsx(L,{anchor:"backups",children:e.jsxs(de,{"data-panel-row":"backups",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(X,{icon:Fa}),e.jsx(ae,{title:s("botPanel.backups.title")})]}),e.jsx("p",{className:"-mt-1 pl-[38px] text-[13px] leading-[1.35] text-ink-secondary",children:s("botPanel.backups.hint",{name:t.name})}),o.length>0&&e.jsx("ol",{"aria-label":s("botPanel.backups.title"),className:"flex flex-col gap-1 pl-[38px]",children:o.map((c,l)=>{const{instance:m,name:p,short:f}=d(c);return e.jsxs("li",{"data-backup":c.instanceId,className:"flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{className:"w-3 shrink-0 text-[12px] tabular-nums text-ink-tertiary","aria-hidden":"true",children:l+1}),e.jsxs(zt,{bot:t,current:c,exclude:r(l),onPick:k=>a(o.map((g,v)=>v===l?k:g)),label:s("botPanel.backups.row",{position:l+1,model:p}),title:m?`${m.displayName} · ${p}`:p,"data-panel-action":"backup-change",className:"group flex h-8 min-w-0 flex-1 items-center gap-2 rounded-[8px] bg-ink/[0.04] pl-2.5 pr-2 text-left text-[13px] text-ink hover:bg-ink/[0.07] aria-expanded:bg-ink/[0.08]",children:[m?e.jsx(za,{instance:m,size:14,subtle:!0}):e.jsx("span",{className:"size-3.5 shrink-0 rounded-full bg-ink/[0.08]","aria-hidden":"true"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:f}),!m&&e.jsx("span",{className:"shrink-0 text-[12px] text-warning",children:s("model.simple.unavailable")}),e.jsx(fe,{size:12,strokeWidth:2,"aria-hidden":"true",className:"shrink-0 text-ink-tertiary group-hover:text-ink-secondary"})]}),e.jsx(Ae,{"data-panel-action":"backup-remove",label:s("botPanel.backups.remove",{model:p}),onClick:()=>{a(o.filter((k,g)=>g!==l)),i.current?.focus({preventScroll:!0})}})]},l)})}),o.length<Pr&&e.jsx("div",{className:"pl-[38px]",children:e.jsxs(zt,{bot:t,current:null,exclude:r(null),onPick:c=>a([...o,c]),label:s("model.fallback.add"),buttonRef:i,"data-panel-action":"backup-add",className:O(re,"aria-expanded:bg-raised-hover"),children:[e.jsx(ke,{size:14,"aria-hidden":"true"}),s("model.fallback.add")]})})]})})}function Ir({bot:t}){const{dispatch:a}=$(),[n,o]=u.useState(!1),[i,r]=u.useState(!1),[d,c]=u.useState(0),l=t.memoryEnabled!==!1&&t.memoryUpkeep!==!1;if(u.useEffect(()=>{if(!l)return;let p=!0;return G(`/api/bots/${t.id}/system-prompt`).then(f=>{p&&o(f.heavy===!0)},()=>{}),()=>{p=!1}},[t.id,l,d]),!l||!n)return null;const m=async()=>{r(!0);try{await ms(t.id)}catch(p){a({type:"error",message:p instanceof Error&&p.message?p.message:s("common.tryAgain")})}finally{r(!1),c(p=>p+1)}};return e.jsx(L,{anchor:"heavy",children:e.jsxs("div",{"data-panel-row":"heavy",className:Q,children:[e.jsx(X,{icon:Ja}),e.jsx(ae,{title:s("botPanel.heavy")}),e.jsx("button",{type:"button","data-panel-action":"tidy-memory",disabled:i,onClick:()=>{m()},className:re,children:i?s("memory.upkeep.tidying"):s("botPanel.tidyMemory")})]})})}const Tr=5;function Ar({bot:t}){const{dispatch:a,flushBotPatches:n}=$(),[o,i]=u.useState([]),[r,d]=u.useState(null),c=u.useCallback(()=>Nt(t.id).then(m=>i(m.rows.slice(0,Tr)),()=>{}),[t.id]);if(u.useEffect(()=>{c()},[c,t.soul]),!o.length)return null;const l=async m=>{if(!r){d(m.id);try{await n(t.id);const{revision:p}=await Nt(t.id);await ti(t.id,m.id,p)}catch(p){a({type:"error",message:p instanceof Error&&p.message?p.message:s("botOverview.undoFailed")})}finally{d(null),await c()}}};return e.jsxs("div",{"data-panel-row":"soul-changes",className:"flex flex-col gap-1.5",children:[e.jsx("div",{className:"text-[12px] font-medium text-ink-secondary",children:s("memory.changes")}),e.jsx(ot,{rows:o,botName:t.name,reverting:r,onRevert:m=>{l(m)}})]})}const We={ask:()=>s("botSettings.simple.ask"),full:()=>s("botSettings.simple.justDoIt"),auto:()=>s("botSettings.simple.decide"),edits:()=>s("approvalMode.edits.label"),custom:()=>s("botPanel.acts.custom")};function Lr({bot:t,derived:a,onOpen:n,editingInstructions:o=!1,onEditInstructions:i}){const{state:r,dispatch:d,flushBotPatches:c}=$(),{capabilities:l,ready:m}=ve(),p=ns(t),{servers:f}=ys(),k=Qa(Ze(t)),g=Xa(),v=ks(t.id),j=fs(),[P,b]=u.useState(null),{patch:w,approvalMode:x,engine:S}=a,M=t.name,F=()=>{P!==null&&P.trim()!==t.title.trim()&&w({title:P.trim()}),b(null)},B=S?.driverKind==="antigravityAgent"&&x==="auto"?"ask":x,T=[{value:"ask",label:We.ask(),tooltip:s("botSettings.simple.askHint")},{value:"full",label:We.full(),tooltip:s("botSettings.simple.fullHint")},...B==="ask"||B==="full"?[]:[{value:B,label:We[B](),disabled:!0,tooltip:B==="custom"?s("botPanel.acts.customHint"):void 0}]],H=y=>{y===x||y!=="ask"&&y!=="full"||d({type:"updateBot",botId:t.id,patch:{approvalMode:y,applyToAllThreads:!0}})},A=!m||en(l,r.config),h=un(g,{turnsHere:A,canLive:!0}),I=A?null:tn(l,!!an()?.speechStart,sn(r.config)),D=nn.map(y=>({value:y.id,label:s(y.label),disabled:y.id==="turns"&&I!==null,tooltip:y.id==="turns"&&I?`${I.label}. ${I.reason}`:y.id==="live"?s("call.mode.liveHint"):rn("turns")})),_=on.map(y=>({value:y,label:s(St[y][0]),tooltip:s(St[y][1])})),K=()=>{const y=!t.notifications;y&&xn(),w({notifications:y})},J=t.alwaysAllow??[],Y=o||!!t.soulDrift,U=[...p.apps.filter(y=>y.scope!==null).map(y=>y.label),...f?bs(f,t.mcpServers,t.id).map(y=>y.name):[]];return e.jsxs("div",{"data-panel-settings":!0,children:[e.jsx(si,{bot:t}),e.jsx(L,{anchor:"instructions",children:Y?e.jsxs(de,{"data-panel-row":"soul",children:[e.jsx(ai,{bot:t,onPatch:w,simple:{label:s("botSettings.simple.instructions"),placeholder:s("botSettings.simple.instructionsPlaceholder",{name:M})}}),e.jsx(Ar,{bot:t}),o&&e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{type:"button","data-panel-done":"soul",onClick:()=>{c(t.id),i?.(!1)},className:re,children:s("botSettings.simple.done")})})]}):e.jsxs("button",{type:"button","data-panel-edit":"soul","aria-label":`${s("botSettings.simple.edit")}: ${s("botSettings.simple.instructions")}`,onClick:()=>i?.(!0),className:O(Q,"w-full text-left hover:bg-ink/[0.03]"),children:[e.jsx(X,{icon:Te}),e.jsx(ae,{title:s("botSettings.simple.instructions"),hint:e.jsx("span",{className:"line-clamp-1",children:ni(t.soul??"")||s("botPanel.instructionsHint",{name:M})})}),e.jsx(be,{size:15,className:"shrink-0 text-ink-tertiary","aria-hidden":"true"})]})}),e.jsx(Ir,{bot:t}),e.jsx(L,{anchor:"approval",children:e.jsxs(de,{"data-panel-row":"approval",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(X,{icon:Vt}),e.jsx(ae,{title:s("botSettings.simple.beforeActs",{name:M}),hint:t.busy?s("approvalMode.whileWorking"):void 0})]}),e.jsx("div",{className:"pl-[38px]",children:e.jsx(Se,{attr:"data-approval-choice",label:s("botSettings.simple.beforeActs",{name:M}),value:B,onChange:H,options:T})}),k.choice&&e.jsxs("div",{"data-panel-row":"thread-approval",className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 pl-[38px]",children:[e.jsx("span",{className:"text-[13px] text-ink-secondary",children:s("botPanel.thisConversation")}),e.jsx("span",{className:"ms-auto flex",children:e.jsx(ln,{choice:k.choice})})]}),J.length>0&&e.jsxs("div",{"data-panel-row":"always-allow",className:"flex min-w-0 flex-col gap-1 pl-[38px]",children:[e.jsx("span",{className:"text-[13px] text-ink-secondary",children:s("botAccess.always.title")}),J.map(y=>e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[12px] text-ink",children:y}),e.jsx(Ae,{"data-panel-action":`always-allow:${y}`,label:s("botAccess.always.remove",{entry:y}),onClick:()=>w({alwaysAllow:J.filter(z=>z!==y)})})]},y))]})]})}),e.jsx(Rr,{bot:t,onChange:y=>w({fallback:y})}),e.jsx(L,{anchor:"call",children:e.jsxs(de,{"data-panel-row":"call-mode",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(X,{icon:Kn}),e.jsx(ae,{title:s("call.mode.menu")})]}),e.jsx("div",{className:"pl-[38px]",children:e.jsx(Se,{attr:"data-call-mode",label:s("call.mode.menu"),value:h,onChange:cn,options:D})})]})}),e.jsxs(L,{anchor:"replies",children:[e.jsxs(de,{"data-panel-row":"reply-style",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(X,{icon:dn}),e.jsx(ae,{title:s("botSettings.replyStyle.title")})]}),e.jsx("div",{className:"pl-[38px]",children:e.jsx(Se,{attr:"data-reply-style",label:s("botSettings.replyStyle.title"),value:t.replyStyle??"default",onChange:y=>w({replyStyle:y}),options:_})})]}),e.jsx(nt,{"data-panel-row":"notifications",icon:mn,title:s("voice.notifications.title"),color:t.color,checked:t.notifications,onChange:K})]}),e.jsxs(L,{anchor:"uses",children:[e.jsx(ee,{"data-panel-page":"apps",icon:as,title:s("botPanel.appsRow"),value:U.length>0?U.join(", "):s("botPanel.appsNoneYet"),onClick:()=>n?.("apps")}),e.jsxs("label",{"data-panel-row":"job",className:O(Q,"cursor-text"),children:[e.jsx(X,{icon:Ii}),e.jsx("span",{className:"shrink-0 text-[14px] font-medium text-ink",children:s("botSettings.simple.job")}),e.jsx("input",{"data-panel-job":!0,value:P??t.title,placeholder:s("botSettings.simple.jobPlaceholder"),"aria-label":s("botSettings.simple.job"),maxLength:Ye.title,onChange:y=>b(y.target.value),onBlur:F,onKeyDown:y=>{y.key==="Enter"?(y.preventDefault(),y.currentTarget.blur()):y.key==="Escape"&&P!==null&&(y.preventDefault(),y.stopPropagation(),b(null))},className:"min-w-0 flex-1 bg-transparent text-right text-[13px] text-ink-secondary outline-none placeholder:text-ink-tertiary focus:text-ink"})]}),v&&e.jsxs("a",{"data-panel-row":"slack",href:v,target:"_blank",rel:"noopener noreferrer",className:O(Q,"hover:bg-ink/[0.03]"),children:[e.jsx(X,{icon:vs}),e.jsx(ae,{title:s("botPanel.page.slack"),hint:s("botSlack.manage")}),e.jsx(os,{size:14,className:"shrink-0 text-ink-tertiary","aria-hidden":"true"})]}),j&&e.jsx(ee,{"data-panel-page":"visibility",icon:Zt,title:s("botSettings.visibility.title"),value:ii(t.visibility),onClick:()=>n?.("visibility")})]}),t.yourAccess!=="view"&&!t.defaultBot&&e.jsx(Nr,{bot:t,className:"mt-3.5"}),e.jsx(ri,{bot:t,webhooksLink:!0,className:"mt-3.5"}),e.jsx(pn,{bot:t}),k.dialogs]})}const Mr=5;function Br({bot:t,onChanged:a}){const{dispatch:n}=$(),[o,i]=u.useState([]),[r,d]=u.useState(null),[c,l]=u.useState(null),m=u.useCallback(async()=>{const[g,v]=await Promise.all([it(t.id),xe(t.id)]);d(j=>g.lendingReview?{value:g.lendingReview,stale:j?.stale??!1}:null),i(v.slice(0,Mr))},[t.id]);u.useEffect(()=>{m().catch(()=>{})},[m,t.busy]);const p=g=>n({type:"error",message:g instanceof Error&&g.message?g.message:s("common.tryAgain")}),f=async g=>{l(g.id);try{await us(t.id,g.id),await a()}catch(v){p(v)}finally{l(null),await m().catch(()=>{})}},k=async g=>{l("review");try{await ds(t.id,g.value.token),d(null)}catch(v){v instanceof Jt&&v.status===409?(d({...g,stale:!0}),await m().catch(()=>{})):p(v)}finally{l(null)}};return e.jsxs(e.Fragment,{children:[r&&e.jsx(ws,{changed:r.value.changed,stale:r.stale,busy:c!==null,onReviewed:()=>{k(r)}}),e.jsx(L,{children:e.jsx(nt,{"data-panel-row":"memory-upkeep",title:s("memory.upkeep.title"),checked:t.memoryUpkeep!==!1,color:t.color,onChange:()=>n({type:"updateBot",botId:t.id,patch:{memoryUpkeep:t.memoryUpkeep===!1}})})}),o.length>0&&e.jsx(L,{label:s("memory.changes"),children:e.jsx("div",{"data-panel-row":"memory-changes",className:"px-3.5 py-3",children:e.jsx(ot,{rows:o,botName:t.name,reverting:c,onRevert:g=>{f(g)}})})})]})}const $r="flex flex-col gap-3",Ht="https://www.skills.sh";function ye(t,a){return t instanceof Error&&t.message?t.message:a}function Dr({bot:t,derived:a}){const{dispatch:n}=$(),o=ns(t),{servers:i,error:r}=ys(),{patch:d,canUseConnectedApps:c}=a,l=i?ki(i,t.id):[],m=new Set(bs(l,t.mcpServers,t.id).map(g=>g.name)),p=g=>{const v=bn(t,o.connectedSlugs,g.slug,g.scope===null);Object.keys(v).length>0&&d(v)},f=g=>{t.busy||r||d({mcpServers:ji(l,t.mcpServers,g)})},k=c?o.phase==="loading"?s("common.checking"):o.phase==="unknown"?s("botSettings.simple.appsUnknown"):o.apps.length===0?s("botSettings.simple.appsNone"):null:s("botSettings.simple.appsCannot",{name:t.name});return e.jsxs(e.Fragment,{children:[e.jsxs(L,{children:[k&&e.jsx(V,{children:k}),c&&o.apps.map(g=>e.jsxs("div",{"data-simple-app":g.slug,className:Q,children:[e.jsx(gn,{card:g.card,className:"size-7 shrink-0"},`${g.card.logo}:${g.card.domain}`),e.jsx("div",{className:"min-w-0 flex-1 truncate text-[14px] font-medium text-ink",children:g.label}),e.jsx(yt,{color:t.color,checked:g.scope!==null,"aria-label":s("botSettings.simple.appToggle",{name:t.name,app:g.label}),disabled:!!t.busy,onClick:()=>p(g),className:"disabled:cursor-not-allowed"})]},g.slug))]}),(l.length>0||r)&&e.jsxs(L,{label:s("connectors.tab.mcp"),children:[r&&e.jsx(V,{children:s("botAccess.mcpRefreshError")}),l.map(g=>e.jsxs("div",{"data-simple-mcp":g.name,className:Q,children:[e.jsx(X,{icon:Un}),e.jsx(ae,{title:e.jsx("span",{className:"block truncate",children:g.name}),hint:g.enabled?g.offFor?.includes(t.id)?s("mcp.offFor",{bots:t.name}):void 0:s("botAccess.mcpDisabled")}),e.jsx(yt,{color:t.color,checked:m.has(g.name),"aria-label":s("botSettings.simple.appToggle",{name:t.name,app:g.name}),disabled:!g.enabled||!!t.busy||r,onClick:()=>f(g.name),className:"disabled:cursor-not-allowed"})]},g.name))]}),e.jsx(L,{children:e.jsx(me,{"data-panel-link":"add-app",icon:ke,onClick:()=>yn(n,t.id),children:s("botPanel.apps.connectAnother")})})]})}function Fr({bot:t,derived:a}){const{state:n,dispatch:o}=$(),[i,r]=u.useState(()=>a.botRoutines.length===0?"new":null);return e.jsxs(e.Fragment,{children:[e.jsx(bi,{routines:a.botRoutines,runs:n.routineRuns,pausedBots:n.config?.pausedBots,heldBots:n.config?.heldBots,loading:n.routinesLoadState==="loading"&&a.botRoutines.length===0,error:n.routinesLoadState==="error",onOpen:r,onLogs:d=>o({type:"showRoutines",section:"logs",botId:t.id,routineId:d.id}),onToggle:d=>o({type:"updateRoutine",routineId:d.id,patch:{enabled:!d.enabled}})}),e.jsx(L,{children:e.jsx(me,{"data-panel-action":"new-routine",icon:ke,onClick:()=>r("new"),children:s("botPanel.routines.add")})}),e.jsx("p",{className:"mx-1 text-[13px] leading-normal text-ink-secondary",children:s("botPanel.routines.ask",{name:t.name})}),i&&e.jsx(wi,{routine:i==="new"?void 0:i,bots:[t],lockedBotId:t.id,onClose:()=>r(null)},t.id)]})}function zr({bot:t}){const a=Es(t),[n,o]=u.useState(""),[i,r]=u.useState(null),[d,c]=u.useState(!1),[l,m]=u.useState(null),p=t.memoryEnabled!==!1,f=a.docs?Os(a.docs):null,k=a.docs?.find(b=>b.path===te)??null;u.useEffect(()=>r(null),[t.id,p]);const g=async b=>{if(d)return!1;c(!0),m(null);try{return await b()}catch(w){return m(ye(w,s("botPanel.library.memoryError"))),!1}finally{c(!1)}},v=(b,w)=>g(async()=>{const x=await rt(t.id,b.path,w,b.exists?b.hash:void 0,a.mine);return x.ok?(a.setDoc(x.doc),!0):(await a.reload(),m(s("memory.conflict.title",{name:t.name})),!1)}),j=b=>{const w=a.docs?.find(x=>x.path===b.path);w&&(b.line!==null?v(w,hr(w.text,b.line)):g(async()=>(await ps(t.id,w.path,a.mine),await a.reload(),!0)))},P=async()=>{!k||!n.trim()||await v(k,fr(k.text,n))&&o("")};return p&&i?.botId===t.id?e.jsx(Hr,{bot:t,doc:i.doc,mine:a.mine,onDone:b=>{b&&a.setDoc(b),r(null),m(null)}}):e.jsxs(e.Fragment,{children:[e.jsxs(L,{children:[p?a.error?e.jsx(V,{tone:"warn",children:s("botPanel.library.memoryError")}):f===null?e.jsx(V,{children:s("common.checking")}):f.length===0?e.jsx(V,{children:s("botPanel.memory.empty")}):f.map(b=>e.jsxs("div",{"data-memory-note":b.line??b.path,className:Q,children:[e.jsx("div",{className:"min-w-0 flex-1 text-[13px] leading-[1.45] text-ink",children:b.text}),e.jsx(Ae,{label:s("botPanel.memory.forget"),disabled:d,onClick:()=>j(b)})]},`${b.path}:${b.line}:${b.text}`)):e.jsx(V,{children:s("botPanel.library.memoryOff",{name:t.name})}),l&&e.jsx(V,{tone:"warn",children:l})]}),p&&e.jsxs(L,{children:[e.jsx(is,{"data-panel-form":"memory-add",value:n,placeholder:s("botPanel.memory.addPlaceholder",{name:t.name}),label:s("botPanel.memory.addPlaceholder",{name:t.name}),action:s("common.add"),disabled:d||k===null,onChange:o,onSubmit:()=>{P()}}),k&&e.jsx(me,{"data-panel-link":"memory-text",icon:Te,onClick:()=>r({botId:t.id,doc:k}),children:s("botPanel.memory.editText")})]}),p&&!a.mine&&e.jsx(Br,{bot:t,onChanged:a.reload})]})}function Hr({bot:t,doc:a,mine:n,onDone:o}){const[i,r]=u.useState({text:a.text,hash:a.hash}),[d,c]=u.useState(a.text),[l,m]=u.useState(null),[p,f]=u.useState(null),[k,g]=u.useState(!1),[v,j]=u.useState(null),P=u.useRef(!0);u.useEffect(()=>(P.current=!0,()=>{P.current=!1}),[]);const b=async x=>{g(!0),j(null);try{const S=await rt(t.id,a.path,d,x,n);if(!P.current)return;S.ok?o(S.doc):m({current:S.current,currentHash:S.currentHash})}catch(S){j(ye(S,s("botPanel.library.memoryError")))}finally{g(!1)}},w=()=>{l&&(f(x=>x===null||x===d?d:`${x}
|
|
15
|
-
|
|
16
|
-
${d}`),r({text:l.current,hash:l.currentHash}),c(l.current),m(null))};return e.jsx(L,{children:e.jsxs(de,{"data-panel-row":"memory-text",children:[l&&e.jsx(Ns,{botName:t.name,busy:k,onReload:w,onOverwrite:()=>{b(l.currentHash)}}),e.jsx("textarea",{"data-memory-text":"",className:O(Qe,"min-h-[280px] resize-y font-mono text-[13px] leading-relaxed"),value:d,placeholder:s("memory.indexPlaceholder"),"aria-label":s("memory.botMemory"),readOnly:k,onChange:x=>c(x.target.value)}),v&&e.jsx("div",{className:"text-[13px] text-warning",children:v}),p!==null&&e.jsxs("div",{"data-memory-draft":"",children:[e.jsx("div",{className:"mb-1 text-[12px] text-ink-secondary",children:s("memory.unsavedDraft")}),e.jsx("pre",{className:"max-h-[160px] overflow-auto whitespace-pre-wrap rounded-lg border border-hairline/40 bg-inset p-3 font-mono text-[12px] leading-relaxed text-ink",children:p}),e.jsx("button",{type:"button",className:O(re,"mt-1"),onClick:()=>f(null),children:s("memory.dismissDraft")})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{type:"button",className:re,disabled:k,onClick:()=>o(null),children:s("common.cancel")}),e.jsx("button",{type:"button","data-panel-done":"memory-text",className:re,disabled:k||d===i.text,onClick:()=>{b(i.hash)},children:k?s("memory.saving"):s("memory.save")})]})]})})}function _r({bot:t}){const{request:a}=hn(),{state:n,dispatch:o}=$(),i=xs(t),[r,d]=u.useState(""),[c,l]=u.useState(!1),[m,p]=u.useState([]),f=fn(n.config),k=async x=>{if(!i.working&&window.confirm(s(x.origin==="library"?"skills.unassignConfirm":"botPanel.skills.removeConfirm",{name:x.name}))){i.setWorking(x.name),i.setError("");try{await a(`/api/bots/${t.id}/skills/${encodeURIComponent(x.name)}`,{method:"DELETE"}),await i.refresh()}catch(S){i.setError(ye(S,s("botPanel.skills.removeFailed")))}finally{i.setWorking("")}}},g=async()=>{const x=r.trim();if(!(!x||c)){l(!0),i.setError(""),p([]);try{const S=await a(`/api/bots/${t.id}/skills`,{method:"POST",body:JSON.stringify({source:x})});p(Ct(S.imported??[])),d(""),await i.refresh()}catch(S){i.setError(ye(S,s("botPanel.skills.importFailed")))}finally{l(!1)}}},v=async()=>{const x=await window.ogb?.pickFolder?.();if(!(!x||c)){l(!0),i.setError(""),p([]);try{const S=await a(`/api/bots/${t.id}/skills`,{method:"POST",body:JSON.stringify({source:`local-folder:${x}`})});p(Ct(S.imported??[])),await i.refresh()}catch(S){i.setError(ye(S,s("botPanel.skills.importFailed")))}finally{l(!1)}}},[j,P]=u.useState(!1),b=()=>{P(!1),o({type:"toggleSettings",open:!1}),o({type:"toggleAppSettings",open:!0,section:"skills"})},w=()=>{if(f){P(!0);return}gt(Ht)};return e.jsxs(e.Fragment,{children:[e.jsxs(L,{children:[i.loading?e.jsx(V,{children:s("skills.loading")}):i.skills.length===0?e.jsx(V,{children:s("botSettings.simple.noSkills")}):i.skills.map(x=>e.jsx(nt,{"data-panel-row":`skill:${x.name}`,title:x.name,hint:x.description||x.source,label:s("botSettings.simple.skillToggle",{name:x.name}),color:t.color,checked:hs(x),disabled:!!i.working||x.core===!0,onChange:()=>{i.toggle(x)},extra:x.origin==="imported"||x.origin==="native"||x.origin==="bundled"?void 0:e.jsx(Ae,{"data-panel-action":`remove-skill:${x.name}`,label:s("botPanel.skills.remove",{name:x.name}),disabled:!!i.working,onClick:()=>{k(x)}})},x.name)),i.error&&!i.reviewing&&e.jsx(V,{tone:"warn",children:i.error})]}),e.jsx(li,{bot:t,onAdded:()=>{i.refresh()}}),e.jsxs(L,{children:[e.jsx(is,{"data-panel-form":"skill-import",value:r,placeholder:s("botPanel.skills.importPlaceholder"),label:s("skills.import.label"),action:c?s("skills.import.importing"):s("common.add"),disabled:c,onChange:d,onSubmit:()=>{g()}}),m.map(x=>e.jsx(V,{children:x},x)),e.jsx(me,{"data-panel-link":"skills-sh",onClick:()=>{gt(Ht)},children:s("botPanel.skills.skillsSh")}),e.jsx(me,{"data-panel-link":"browse-skills",onClick:w,children:s("botPanel.skills.bundled")}),window.ogb?.pickFolder&&e.jsx(me,{"data-panel-link":"skills-folder",onClick:()=>{v()},children:s("botPanel.skills.fromFolder")})]}),j&&e.jsx(wr,{botId:t.id,botName:t.name,onOpenSettings:b,onClose:()=>{P(!1),i.refresh()}}),i.reviewing&&e.jsx(ci,{skill:i.reviewing.skill,text:i.reviewing.text,error:i.error,working:i.working===i.reviewing.skill.name,onCancel:()=>i.setReviewing(null),onEnable:()=>{i.enableReviewed()}})]})}function Kr({bot:t}){const{capabilities:a}=ve(),n=a.host?.homeDir,{draft:o,setDraft:i,error:r,saving:d,canPick:c,save:l,pick:m}=oi(t),[p,f]=u.useState(!1),k=!!t.cwd||p,g=()=>{if(c){m();return}f(!0)};return e.jsxs(e.Fragment,{children:[e.jsxs(L,{children:[e.jsx(Ve,{"data-panel-choice":"private",title:s("botPanel.folder.own"),hint:s("botPanel.folder.ownHint"),checked:!k,disabled:d,onClick:()=>{f(!1),t.cwd&&l(null)}}),e.jsx(Ve,{"data-panel-choice":"pick",title:s("botPanel.folder.pick"),hint:s("botPanel.folder.pickHint"),checked:k,disabled:d,onClick:()=>{t.cwd||g()}})]}),k&&e.jsxs(L,{children:[c?e.jsxs("div",{className:Q,children:[e.jsx("div",{className:"min-w-0 flex-1 truncate rounded-lg border border-hairline/40 bg-inset px-3 py-2 font-mono text-[13px] text-ink",title:t.cwd,children:t.cwd?st(t.cwd,n):e.jsx("span",{className:"text-ink-secondary",children:s("botAccess.folder.private")})}),e.jsxs("button",{type:"button","data-panel-action":"pick-folder",disabled:d,onClick:()=>{m()},className:re,children:[e.jsx(Yt,{size:14,"aria-hidden":"true"}),s("botAccess.folder.choose")]})]}):e.jsxs("form",{"data-panel-form":"folder-path",className:Q,onSubmit:v=>{v.preventDefault();const j=(o??t.cwd??"").trim();j&&l(j)},children:[e.jsx("input",{value:o??t.cwd??"",placeholder:s("botAccess.folder.placeholder"),"aria-label":s("botAccess.folder.title"),onChange:v=>i(v.target.value),className:"h-8 min-w-0 flex-1 rounded-lg border border-hairline bg-inset px-2.5 font-mono text-[13px] text-ink outline-none placeholder:text-ink-tertiary focus:border-accent-border"}),e.jsx("button",{type:"submit",disabled:d||o===null,className:re,children:s("botAccess.folder.save")})]}),r&&e.jsx(V,{tone:"warn",children:r})]})]})}function Ur({bot:t,derived:a}){const n=Ss(t);return e.jsx(vr,{bot:t,browserEnabled:a.browserEnabled,onOpenBrowser:()=>n("browser")})}function qr({bot:t}){return fs()?e.jsx(gs,{bot:t}):null}function Wr({page:t,onOpen:a,editingInstructions:n,onEditInstructions:o,...i}){switch(t){case"settings":return e.jsx(Lr,{...i,onOpen:a,editingInstructions:n,onEditInstructions:o});case"where":return e.jsx(ar,{...i});case"apps":return e.jsx(Dr,{...i});case"routines":return e.jsx(Fr,{...i});case"visibility":return e.jsx(qr,{...i});case"memory":return e.jsx(zr,{...i});case"skills":return e.jsx(_r,{...i});case"folder":return e.jsx(Kr,{...i});case"browser":return e.jsx(Ur,{...i})}}const _t="rounded-lg border border-accent-border bg-inset px-2 py-[3px] text-center text-ink outline-none placeholder:text-ink-tertiary";function Kt(t){const[a,n]=u.useState(null),o=u.useRef(!1),i=u.useRef(!1),r=u.useRef(null);u.useEffect(()=>{a!==null||!i.current||(i.current=!1,r.current?.focus())},[a]);const d=p=>{o.current=!1,n(p)},c=()=>{a!==null&&t(a),n(null)};return{draft:a,setDraft:n,start:d,onKeyDown:p=>{if(kn(p.nativeEvent)){p.stopPropagation();return}p.key==="Enter"?(p.preventDefault(),o.current=!0,i.current=!0,c()):p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),o.current=!0,i.current=!0,n(null))},onBlur:()=>{o.current||c()},buttonRef:r}}function Vr({bot:t,activeState:a,patch:n,editorOpen:o,onToggleEditor:i}){const r=Kt(l=>{const m=l.trim();m&&m!==t.name&&n({name:m})}),d=Kt(l=>{const m=l.trim();m!==t.title.trim()&&n({title:m})}),c=t.title.trim();return e.jsxs("div",{className:"group/hero flex flex-col items-center text-center",children:[e.jsxs("button",{type:"button","data-panel-avatar":!0,"aria-label":s("botPanel.avatar.edit"),"aria-expanded":o,onClick:i,className:"group relative rounded-[18px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-border",children:[e.jsx(Je,{bot:t,size:64,state:a}),e.jsx("span",{"aria-hidden":"true",className:"absolute inset-0 flex items-center justify-center rounded-[18px] bg-black/0 text-white opacity-0 transition-[opacity,background-color] group-hover:bg-black/40 group-hover:opacity-100 group-focus-visible:bg-black/40 group-focus-visible:opacity-100 group-focus-within:opacity-100 touch:opacity-100 motion-reduce:transition-none",children:e.jsx(bt,{size:20})}),t.chiefOfStaff&&e.jsxs("span",{"data-panel-chief":!0,title:s("chat.chiefOfStaff"),className:"absolute -bottom-0.5 -right-0.5 flex size-[22px] items-center justify-center rounded-full bg-accent text-accent-ink ring-[3px] ring-app",children:[e.jsx(vn,{size:12,"aria-hidden":"true"}),e.jsx("span",{className:"sr-only",children:s("chat.chiefOfStaff")})]}),e.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute left-1/2 top-[calc(100%+4px)] z-10 -translate-x-1/2 whitespace-nowrap rounded-md border border-hairline bg-menu px-[7px] py-0.5 text-[12px] text-ink opacity-0 transition-opacity group-hover:opacity-100",children:s("botPanel.avatar.edit")})]}),e.jsx("div",{"data-panel-name-row":!0,className:"mt-2 flex max-w-full items-center justify-center",children:e.jsx("h2",{id:"bot-settings-title",className:"flex min-w-0 justify-center",children:r.draft!==null?e.jsx("input",{autoFocus:!0,"data-panel-rename-input":!0,"aria-label":s("botSettings.simple.name"),maxLength:Ye.name,value:r.draft,onChange:l=>r.setDraft(l.target.value),onKeyDown:r.onKeyDown,onBlur:r.onBlur,className:O(_t,"w-[220px] max-w-full text-[17px] font-medium leading-6")}):e.jsxs("button",{ref:r.buttonRef,type:"button","data-panel-rename":!0,title:s("botPanel.rename"),onClick:()=>r.start(t.name),className:"group/name relative inline-flex max-w-full items-center rounded-[8px] px-1.5 text-[17px] font-medium leading-6 text-ink hover:bg-ink/[0.04]",children:[e.jsx("span",{className:"min-w-0 truncate",children:t.name}),e.jsx(bt,{size:13,"aria-hidden":"true",className:"absolute -right-4 shrink-0 text-ink-tertiary opacity-0 transition-opacity group-hover/name:opacity-100 group-focus-visible/name:opacity-100 group-focus-within/name:opacity-100 touch:opacity-100"})]})})}),d.draft!==null?e.jsx("input",{autoFocus:!0,"data-panel-label-input":!0,"aria-label":s("botSettings.simple.job"),placeholder:s("botSettings.simple.jobPlaceholder"),maxLength:Ye.title,value:d.draft,onChange:l=>d.setDraft(l.target.value),onKeyDown:d.onKeyDown,onBlur:d.onBlur,className:O(_t,"mt-[3px] w-[200px] max-w-full text-[13px]")}):c&&e.jsx("button",{ref:d.buttonRef,type:"button","data-panel-label":!0,onClick:()=>d.start(t.title),className:"mt-px max-w-full truncate rounded-md px-1.5 py-px text-[13px] text-ink-secondary hover:bg-ink/[0.04]",children:c})]})}function Ne(t,a){return t?rs(t,a):{tab:"details"}}function Zr({bot:t,derived:a,linkedSection:n,onClose:o}){const{dragProps:i}=cs(),r=jn(),[d,c]=u.useState(()=>Ne(n,r).tab),[l,m]=u.useState(()=>{const h=Ne(n,r).page;return h?[h]:[]}),[p,f]=u.useState(()=>Ne(n,r).anchor??null),[k,g]=u.useState(!1),[v,j]=u.useState(()=>!!Ne(n,r).editInstructions),P=u.useRef(null),b=u.useRef(null),w=l.at(-1)??null,x=()=>P.current?.scrollTo({top:0}),S=h=>{c(h.tab),m(h.page?[h.page]:[]),f(h.anchor??null),g(!1),j(!!h.editInstructions),x()},M=h=>S({tab:h}),F=h=>{m(I=>[...I,h]),g(!1),x()},B=()=>{g(!1),b.current?.querySelector("[data-panel-avatar]")?.focus()},T=()=>{m(h=>h.slice(0,-1)),x()};u.useEffect(()=>{n&&S(rs(n,r))},[n,r]),u.useEffect(()=>{p&&(P.current?.querySelector(`[data-panel-card="${p}"]`)?.scrollIntoView({block:"start"}),f(null))},[p,w,d]);const H=h=>{if(h.key!=="Escape"||h.defaultPrevented)return;const I=h.target,D=typeof I?.closest=="function"?I.closest('[role="dialog"], [role="alertdialog"]'):null;if(!(D&&!D.contains(h.currentTarget)&&D!==b.current&&!b.current?.contains(D))){if(k)B();else if(l.length>0)T();else return;h.preventDefault(),h.stopPropagation()}},A=l.length>1?s(we[l[l.length-2]].title,{name:t.name}):s(vt[d]);return e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",onKeyDown:H,children:[e.jsxs("div",{...i,className:"flex h-[50px] shrink-0 items-start justify-end gap-2.5 px-[13px] pt-[13px]",children:[e.jsx(wn,{bot:t,className:De}),e.jsx("button",{type:"button","data-panel-gear":!0,"aria-label":s("botPanel.page.settings"),title:s("botPanel.page.settings"),"aria-current":w==="settings"?"page":void 0,onClick:()=>S({tab:"details",page:"settings"}),className:De,children:e.jsx(Nn,{size:16,className:"pointer-events-none"})}),e.jsx("button",{type:"button",onClick:o,"aria-label":s("botSettings.simple.close"),className:De,children:e.jsx(et,{size:16,className:"pointer-events-none"})})]}),e.jsx("div",{ref:P,className:"@container relative min-h-0 flex-1 overflow-y-auto px-4 pb-7",children:w===null?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative mt-3.5",ref:b,children:[e.jsx(Vr,{bot:t,activeState:a.activeState,patch:a.patch,editorOpen:k,onToggleEditor:()=>g(h=>!h)}),k&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-20","aria-hidden":"true","data-panel-scrim":!0,onClick:B}),e.jsx(er,{bot:t,activeState:a.activeState,onPatch:a.patch,onClose:B})]})]}),e.jsx("div",{role:"tablist","aria-label":s("botSettings.simple.tabs"),className:"sticky top-0 z-[1] -mx-4 mt-[15px] flex justify-center bg-app px-4 pb-2.5 pt-1 after:pointer-events-none after:absolute after:inset-x-0 after:top-full after:h-3 after:bg-linear-to-b after:from-app after:to-transparent",children:e.jsx("div",{className:"flex min-w-0 gap-0.5 rounded-full bg-ink/[0.05] p-[3px]",children:Sn.map(h=>e.jsx("button",{type:"button",role:"tab","aria-selected":d===h,"data-panel-tab":h,onClick:()=>M(h),className:O("h-[26px] min-w-0 shrink truncate rounded-full px-3 text-[13px] leading-[18px] transition-colors",d===h?"bg-ink/[0.1] font-medium text-ink":"text-ink-secondary hover:text-ink"),children:s(vt[h])},h))})}),e.jsxs("div",{role:"tabpanel",children:[d==="details"&&e.jsx(ur,{bot:t,derived:a,onOpen:F}),d==="library"&&e.jsx(Rs,{bot:t,onOpen:F}),d==="computer"&&e.jsx(nr,{bot:t,derived:a,onOpen:F})]})]}):e.jsxs("div",{"data-panel-page-view":w,children:[e.jsx("span",{id:"bot-settings-title",className:"sr-only",children:t.name}),e.jsx(Cn,{back:A,title:s(we[w].title,{name:t.name}),intro:we[w].intro?s(we[w].intro,{name:t.name}):void 0,onBack:T}),e.jsx("div",{className:O("mt-4",$r),children:e.jsx(Wr,{page:w,bot:t,derived:a,onOpen:F,editingInstructions:v,onEditInstructions:j})})]})})]})}function Gr(t,a){const{state:n,flushBotPatches:o}=$(),[i,r]=u.useState(null),[d,c]=u.useState(!1),[l,m]=u.useState(null),[p,f]=u.useState(!1),k=u.useMemo(()=>JSON.stringify([t.name,t.title,t.description,t.soul,t.computer,t.cloudBackend,t.cwd,t.autoApprove,t.section,t.composio,t.browser,t.mcpServers,t.chiefOfStaff,t.managedSections,t.modelSelection]),[t.name,t.title,t.description,t.soul,t.computer,t.cloudBackend,t.cwd,t.autoApprove,t.section,t.composio,t.browser,t.mcpServers,t.chiefOfStaff,t.managedSections,t.modelSelection]),g=a.followEdits??!0,v=g?k:null,j=g?n.routines:null,P=g?n.webhooks:null;return u.useEffect(()=>{if(!a.overview&&!a.prompt)return;let b=!1;return(async()=>(await o(t.id),!b&&(a.overview&&G(`/api/bots/${t.id}/overview`).then(x=>{b||(r(x),c(!1))}).catch(()=>{b||c(!0)}),a.prompt&&G(`/api/bots/${t.id}/system-prompt`).then(x=>{b||(m(x),f(!1))}).catch(()=>{b||f(!0)}))))(),()=>{b=!0}},[t.id,a.overview,a.prompt,v,j,P,o]),{overview:i,overviewError:d,prompt:l,promptError:p}}function Yr(t,a){const{dispatch:n,flushBotPatches:o}=$(),[i,r]=u.useState(null),[d,c]=u.useState(!1),[l,m]=u.useState(null),p=u.useRef(0),[f,k]=u.useState(!1),[g,v]=u.useState(null),j=u.useCallback(()=>{const w=++p.current;return c(!1),o(t.id).then(()=>G(`/api/bots/${t.id}/history?limit=100`)).then(x=>{w===p.current&&(r(x.rows),m(x.revision))}).catch(()=>{w===p.current&&c(!0)})},[t.id,o]);return u.useEffect(()=>{if(a)return j(),()=>{p.current++}},[a,j]),{rows:i,error:d,revision:l,rollingBack:f,rollbackTarget:g,setRollbackTarget:v,rollback:async w=>{if(!f){v(null),k(!0);try{await o(t.id),await G(`/api/bots/${t.id}/history/rollback`,{method:"POST",body:JSON.stringify(w)})}catch(x){n({type:"error",message:x instanceof Error?x.message:s("botOverview.undoFailed")})}finally{await j(),k(!1)}}},requestRollback:w=>{l&&v({id:w,expectedRevision:l})}}}function Jr({history:t,returnFocusRef:a}){const{rollbackTarget:n,setRollbackTarget:o,rollback:i}=t;return e.jsx(Pn,{open:n!==null,title:s("botOverview.restoreSoul.title"),body:s("botOverview.restoreSoul.body"),confirmLabel:s("botOverview.restoreSoul.confirm"),tone:"neutral",returnFocusRef:a,onCancel:()=>o(null),onConfirm:()=>{n&&i(n)}})}const Qr={memory:"memory",skills:"skills",folder:"access"},Ts=t=>t.labelKey?s(t.labelKey):t.label;function Ut(t,a){return a?[t.label,Ts(t),...t.keywords].some(n=>n.toLowerCase().includes(a)):!0}function go({bot:t,overlay:a=!1}){const{state:n,dispatch:o}=$(),i=n.botSettingsSection,r=On(t),d=u.useRef(null),{dragProps:c}=cs(),[l,m]=u.useState(""),p=!n.botSettingsExpandAccordion,f=l.trim().toLowerCase(),g=!qt(),v=!p&&!n.botSettingsExpandRemembered?i:null,j=ks(t.id),P=at(),b=En(),w=Ti.filter(A=>A.id!=="slack"||j!==null).filter(A=>A.id!=="visibility"||!window.ogb&&P===!0&&!b),x=w.filter(A=>Ut(A,f)),{overview:S,overviewError:M,prompt:F,promptError:B}=Gr(t,{overview:i==="overview"&&!g,prompt:i==="overview"&&!g}),T=Yr(t,i==="history"&&!g);u.useEffect(()=>{if(!p){if(f){m("");return}d.current?.querySelector(`[data-bot-settings-section="${i}"]`)?.scrollIntoView({block:"nearest"})}},[p,i,f]),u.useEffect(()=>{const A=document.activeElement instanceof HTMLElement?document.activeElement:null,h=d.current;h?.focus();const I=D=>{const _=h?.querySelector('[role="dialog"], [role="alertdialog"]');_&&_.getClientRects().length>0||h&&D.target instanceof Node&&!h.contains(D.target)||D.key==="Escape"&&!D.defaultPrevented&&(D.preventDefault(),o({type:"toggleSettings",open:!1}))};return window.addEventListener("keydown",I),()=>{window.removeEventListener("keydown",I),A?.focus()}},[o]);const H=A=>{switch(A){case"overview":return S===null&&M?e.jsx("div",{className:"rounded-xl bg-card p-4 text-[13px] text-ink-secondary",children:s("botSettings.overviewFailed")}):e.jsx(Fi,{overview:S,refreshError:S!==null&&M,prompt:F,promptError:B,onOpen:h=>o({type:"toggleSettings",open:!0,section:h}),onSetup:r.canCoordinate&&!t.busy?()=>{o({type:"toggleSettings",open:!1}),o({type:"send",botId:t.id,text:"/setup",threadId:t.threadId})}:void 0});case"identity":return e.jsx(fi,{bot:t,patch:r.patch,activeState:r.activeState,mascotMotion:r.mascotMotion});case"soul":return e.jsx(hi,{bot:t,patch:r.patch});case"slack":return j?e.jsx(zi,{managementUrl:j}):null;case"skills":return e.jsx(xi,{bot:t});case"memory":return e.jsx(Ki,{bot:t,active:!p&&i==="memory",onToggle:h=>r.patch({memoryEnabled:h})});case"library":return e.jsx(Rs,{bot:t,onOpen:h=>o({type:"toggleSettings",open:!0,section:Qr[h]??"overview"})});case"routines":return e.jsx(vi,{bot:t,routines:r.botRoutines,runs:n.routineRuns});case"access":return e.jsx(ui,{bot:t,derived:r});case"model":return e.jsx(pi,{bot:t});case"permissions":return e.jsx(mi,{bot:t,derived:r});case"voice":return e.jsx(di,{bot:t,derived:r});case"visibility":return e.jsx(gs,{bot:t});case"history":return T.rows===null&&T.error?e.jsx("div",{className:"rounded-xl bg-card p-4 text-[13px] text-ink-secondary",children:s("botSettings.historyFailed")}):e.jsx(Vi,{bot:t,rows:T.rows,refreshError:T.rows!==null&&T.error,onRollback:T.requestRollback,rollingBack:T.rollingBack||!T.revision});case"usage":return e.jsx(Zi,{bot:t});default:return null}};return e.jsxs(e.Fragment,{children:[e.jsx("aside",{ref:d,id:g?Rn:void 0,role:"dialog","aria-labelledby":"bot-settings-title",tabIndex:-1,className:Tn(a,g),children:g?e.jsx(Zr,{bot:t,derived:r,linkedSection:v,onClose:()=>o({type:"toggleSettings",open:!1})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{...c,className:"flex shrink-0 items-center justify-between px-4 py-3",children:[e.jsx("span",{id:"bot-settings-title",className:"truncate text-[15px] font-semibold text-ink",children:t.name}),e.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[e.jsx(In,{bot:t,className:"rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink"}),e.jsx("button",{type:"button",onClick:()=>o({type:"toggleSettings",open:!1}),"aria-label":s("botSettings.simple.close"),className:"rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink",children:e.jsx(et,{size:18,className:"pointer-events-none"})})]})]}),e.jsxs("div",{className:"mx-4 mb-2 flex shrink-0 items-center gap-2 rounded-lg border border-transparent bg-control/70 px-2.5 py-2 focus-within:border-focus",children:[e.jsx(Xe,{size:14,className:"shrink-0 text-ink-secondary"}),e.jsx("input",{value:l,onChange:A=>{m(A.target.value),o({type:"toggleSettings",open:!0})},onKeyDown:A=>{A.key==="Escape"&&(A.stopPropagation(),l?m(""):o({type:"toggleSettings",open:!1}))},placeholder:s("botSettings.search"),"aria-label":s("botSettings.searchAria"),className:"w-full bg-transparent text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto",children:[x.length===0&&e.jsx("div",{className:"px-4 py-4 text-[13px] leading-relaxed text-ink-secondary",children:s("botSettings.searchNone",{query:l.trim()})}),w.map(A=>{const{id:h,icon:I}=A,D=Ts(A),_=Ut(A,f);if(!_&&h!=="memory")return null;const K=!p&&i===h;return e.jsxs("div",{"data-bot-settings-section":h,className:"border-b border-hairline/30",hidden:!_,children:[e.jsxs("button",{type:"button",onClick:()=>{if(i===h&&!p){o({type:"toggleSettings",open:!0});return}o({type:"toggleSettings",open:!0,section:h})},"aria-expanded":K,className:O("flex w-full shrink-0 items-center gap-2.5 px-4 py-2.5 text-left text-[14px]",K?"bg-control/60 text-ink":"text-ink-secondary hover:bg-control/40 hover:text-ink"),children:[e.jsx(I,{size:15,className:"shrink-0"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:D}),e.jsx(fe,{size:16,className:O("shrink-0 text-ink-secondary transition-transform",K&&"rotate-180")})]}),h==="memory"?e.jsx("div",{hidden:!K,className:"px-4 pb-4 pt-1",children:H("memory")}):K&&e.jsx("div",{className:"px-4 pb-4 pt-1",children:H(h)})]},h)})]})]})}),e.jsx(Jr,{history:T,returnFocusRef:d})]})}export{go as BotSettingsDialog};
|