limixbot 0.3.2 → 0.3.3
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-BDwrkDBX.js → ActivityPanel-CagbdBtd.js} +1 -1
- package/dist/assets/{App-Cb2UOJS6.js → App-DFjF9FvF.js} +119 -119
- package/dist/assets/{AppEventEditor-B383TR3m.js → AppEventEditor-BgX3KO6T.js} +1 -1
- package/dist/assets/{BotSettingsDialog-CbbZerHF.js → BotSettingsDialog-ieeszW_3.js} +4 -4
- package/dist/assets/{BrowserPanel-DY-yCZ9T.js → BrowserPanel-BB3qz5lN.js} +2 -2
- package/dist/assets/{BrowserProfilesManager-BmOMzdgM.js → BrowserProfilesManager-CVdcfOF8.js} +1 -1
- package/dist/assets/CloudAddDialog-Bl1bRrYD.js +1 -0
- package/dist/assets/{ComputerFilesPane-CB2u6MXN.js → ComputerFilesPane-piKNDkt6.js} +1 -1
- package/dist/assets/ComputerPanel-COQweEJR.js +2 -0
- package/dist/assets/{DataPanel-fAjB6GSn.js → DataPanel-DdHxcsUa.js} +1 -1
- package/dist/assets/{DesktopViewer-mWGetNwB.js → DesktopViewer-BNIgo9Nm.js} +1 -1
- package/dist/assets/{FilesView-CLR6NiY2.js → FilesView-Dy1gKmcM.js} +1 -1
- package/dist/assets/{GrokMoveDialog-lZOa5ZKz.js → GrokMoveDialog-CUnJWZi7.js} +6 -6
- package/dist/assets/{InspectorPanel-lOPEUSb8.js → InspectorPanel-CWdxtHne.js} +2 -2
- package/dist/assets/{KeyboardShortcutsModal-BGRMc9wJ.js → KeyboardShortcutsModal-6FMUgbpC.js} +1 -1
- package/dist/assets/{LiveDesktop-LRjYEzUz.js → LiveDesktop-CDbI9dPy.js} +1 -1
- package/dist/assets/LocalVmWorkspace-CslSGvNI.js +1 -0
- package/dist/assets/{MacLocalControl-DuTxY3A3.js → MacLocalControl-CwHtEWES.js} +1 -1
- package/dist/assets/MarkdownFilePreview-DrdGFCnN.js +1 -0
- package/dist/assets/{MenuMotion-DKMkKESs.js → MenuMotion-IQitGKH4.js} +1 -1
- package/dist/assets/{NewBotDialog-Bpi6-xSj.js → NewBotDialog-V2wMpLPn.js} +1 -1
- package/dist/assets/PhoneAppDialog-DmBPVDxr.js +1 -0
- package/dist/assets/{PlacesRail-4ErVypbT.js → PlacesRail-v1XIqiBG.js} +9 -9
- package/dist/assets/{PluginsPanel-Cw8XeQBF.js → PluginsPanel-CMARnTMq.js} +2 -2
- package/dist/assets/{ProIntroduction-DPYk--IK.js → ProIntroduction--jIMb4bL.js} +1 -1
- package/dist/assets/{RemoteAgentSettingsPanel-qxzESq_H.js → RemoteAgentSettingsPanel-Co34aJHb.js} +1 -1
- package/dist/assets/{RoomPanel-DaoRmKS_.js → RoomPanel-ClyWQx9x.js} +2 -2
- package/dist/assets/{RoutinesPage-CD1DvtyW.js → RoutinesPage-DRwSDyGu.js} +1 -1
- package/dist/assets/SettingsModal-CHa_Zc-J.js +11 -0
- package/dist/assets/{ShareTeamDialog-rc1xx02E.js → ShareTeamDialog-BQ9h2Rd2.js} +1 -1
- package/dist/assets/{SignedInSites-CPp5ofCJ.js → SignedInSites-B16Ruhd0.js} +1 -1
- package/dist/assets/{TeamLibraryPanel-D-iDVZPU.js → TeamLibraryPanel-NwC4Fc9C.js} +1 -1
- package/dist/assets/TeamMapPage-DabJFxkf.js +1 -0
- package/dist/assets/{TriggersPage-D2ovyRGM.js → TriggersPage-Cn_f8AcZ.js} +1 -1
- package/dist/assets/{VisibilitySection-oSi2vtmx.js → VisibilitySection-DyGNmx9n.js} +1 -1
- package/dist/assets/{WebhookTrigger-CyP8At0y.js → WebhookTrigger-C-9-FE3w.js} +1 -1
- package/dist/assets/WorksOnGrid-M_5NkZch.js +1 -0
- package/dist/assets/{abnfDiagram-YUKMZFIV-C7wn2CLu.js → abnfDiagram-YUKMZFIV-CBzJU2O6.js} +1 -1
- package/dist/assets/{activity-Cru8B1z7.js → activity-bd7MWK8m.js} +1 -1
- package/dist/assets/{architectureDiagram-47P4ROYG-DgFc7YIC.js → architectureDiagram-47P4ROYG-DVR1DP3v.js} +1 -1
- package/dist/assets/{blockDiagram-E7TT5TSB-qR-t8DMo.js → blockDiagram-E7TT5TSB-BYqUHhoh.js} +1 -1
- package/dist/assets/{c4Diagram-CRA5TL53-DdmUjVbB.js → c4Diagram-CRA5TL53-BtQERHwr.js} +1 -1
- package/dist/assets/{calendar-days-CN7x0QvP.js → calendar-days-YMHxUvlg.js} +1 -1
- package/dist/assets/channel-D6e78p3W.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-D09jrdDt.js → chunk-2Q5K7J3B-Cwf_xeHP.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-DJXT-XDN.js → chunk-5VM5RSS4-Doo-zxI4.js} +1 -1
- package/dist/assets/{chunk-7TKQ45FW-CaULsRlr.js → chunk-7TKQ45FW-CD2AgrRj.js} +1 -1
- package/dist/assets/{chunk-AW2ZBBNX-BcEB179w.js → chunk-AW2ZBBNX-e5OuWeq_.js} +1 -1
- package/dist/assets/{chunk-FVRAUYC3-DMhPq4_N.js → chunk-FVRAUYC3-C8jo43it.js} +2 -2
- package/dist/assets/{chunk-HTAEGDNF-DcoWRcH-.js → chunk-HTAEGDNF-DLsD4agj.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-CpN6DEZO.js → chunk-JWPE2WC7-UZDUbeTy.js} +1 -1
- package/dist/assets/{chunk-KQW6MTUR-BxIldIqB.js → chunk-KQW6MTUR-DR9SuVX3.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY--M4TxaOR.js → chunk-XXDRQBXY-DwEl4815.js} +1 -1
- package/dist/assets/{classDiagram-v2-K4WV4PDN-DQUUn5pg.js → classDiagram-v2-K4WV4PDN-CQZho8e0.js} +1 -1
- package/dist/assets/{coins-DxQLVJqa.js → coins-DpzGN3sd.js} +1 -1
- package/dist/assets/{core-CjjU--NA.js → core-BNopzNRl.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-DCCMLnpT.js → cose-bilkent-JH36ORCC-DUZ9OWzu.js} +1 -1
- package/dist/assets/{cynefin-EF2NZ3EQ-iK--S4gB.js → cynefin-EF2NZ3EQ-DVHnJdjN.js} +1 -1
- package/dist/assets/{cynefinDiagram-3GCD6N5R-DiwEQVzk.js → cynefinDiagram-3GCD6N5R-dYhbIkRt.js} +1 -1
- package/dist/assets/{dagre-W4DXFKR2-Bb-WXIrp.js → dagre-W4DXFKR2-DqJNpw5w.js} +1 -1
- package/dist/assets/{diagram-2UJZ2QOL-CU1G-LPy.js → diagram-2UJZ2QOL-DKNDqAnE.js} +1 -1
- package/dist/assets/{diagram-OVF4WLC6-KUL_hQtY.js → diagram-OVF4WLC6-DENMVM-d.js} +1 -1
- package/dist/assets/{diagram-PFPMY2P6-Du0EMvGo.js → diagram-PFPMY2P6-CrRFeR5V.js} +1 -1
- package/dist/assets/{diagram-UMYRVEAY-BUNv47Vc.js → diagram-UMYRVEAY-B5w-desO.js} +1 -1
- package/dist/assets/{diagram-YEKJPTXX-DyWO406P.js → diagram-YEKJPTXX-C7AVX3MB.js} +1 -1
- package/dist/assets/{diagram-ZIFT7M5P-DGps1w58.js → diagram-ZIFT7M5P-BgkTRwwr.js} +1 -1
- package/dist/assets/{ebnfDiagram-VR2GEFS7-BxaaJRK8.js → ebnfDiagram-VR2GEFS7-yY_2KNsK.js} +1 -1
- package/dist/assets/{elk-IJKZMXRS-BuVZZmTr.js → elk-IJKZMXRS-xWtfkoqT.js} +1 -1
- package/dist/assets/{erDiagram-O2IAPWRE-qhhsO6Fp.js → erDiagram-O2IAPWRE-BMM4saPI.js} +1 -1
- package/dist/assets/{file-up-BiK20g0M.js → file-up-Bl7ViNTL.js} +1 -1
- package/dist/assets/{flowDiagram-OXPTDLAJ-BsRrcKnA.js → flowDiagram-OXPTDLAJ-BCRe8i6T.js} +1 -1
- package/dist/assets/{ganttDiagram-R7TSEDQI-jVqCmREp.js → ganttDiagram-R7TSEDQI-COBrcDi7.js} +1 -1
- package/dist/assets/{gitGraphDiagram-XJZIOB7I-COi9bChD.js → gitGraphDiagram-XJZIOB7I-Dc4RKydD.js} +1 -1
- package/dist/assets/{import-name-CrWA8Hw3.js → import-name-DA_MmEsd.js} +1 -1
- package/dist/assets/{index-Dy5VWChH.js → index-BXLNny-w.js} +1 -1
- package/dist/assets/index-CwYJ9TX8.js +2 -0
- package/dist/assets/{index-BIC6c7Sg.js → index-D6huutPz.js} +1 -1
- package/dist/assets/{infoDiagram-5W2HQ5XZ-CUfzOgVW.js → infoDiagram-5W2HQ5XZ-BV8RRI_4.js} +1 -1
- package/dist/assets/{ishikawaDiagram-K3B6WC7H-DMR_Ey1I.js → ishikawaDiagram-K3B6WC7H-H-XILdGm.js} +1 -1
- package/dist/assets/{journeyDiagram-COXZFDF6-UiPc_2sp.js → journeyDiagram-COXZFDF6-ChLduKEj.js} +1 -1
- package/dist/assets/{kanban-definition-P3RFRI5V-VvQXCMxr.js → kanban-definition-P3RFRI5V-FSZ9F3JH.js} +1 -1
- package/dist/assets/{mcp-servers-CBCpG62C.js → mcp-servers-CYvHVOYi.js} +1 -1
- package/dist/assets/{mermaid.core-BZKmLobY.js → mermaid.core-BRsJ02Pz.js} +4 -4
- package/dist/assets/{mindmap-definition-LZFPQGKD-BJi3q0s6.js → mindmap-definition-LZFPQGKD-TWHzZjNT.js} +1 -1
- package/dist/assets/{minimize-B78LHbd3.js → minimize-BYscOtPM.js} +1 -1
- package/dist/assets/{monitor-UBjV7Qf5.js → monitor-DFEzCfQk.js} +1 -1
- package/dist/assets/{new-bot-D0DDXTKe.js → new-bot-_oEUbcDw.js} +2 -2
- package/dist/assets/{org-library-BdlqWown.js → org-library-CapoiPaN.js} +1 -1
- package/dist/assets/{package-format-EwGfXp1v.js → package-format-Cn4nABBW.js} +1 -1
- package/dist/assets/{pegDiagram-BGZESJAR-C6W87HN9.js → pegDiagram-BGZESJAR-LQWOF7IE.js} +1 -1
- package/dist/assets/{pieDiagram-CAPJLFHJ-B1E_Ycub.js → pieDiagram-CAPJLFHJ-BRXp4qFw.js} +1 -1
- package/dist/assets/{quadrantDiagram-GDMTTRAM-BasGTzC_.js → quadrantDiagram-GDMTTRAM-DyIdGBZo.js} +1 -1
- package/dist/assets/{rail-BFRrwJ6b.js → rail-Du7tlPwj.js} +1 -1
- package/dist/assets/{railroadDiagram-SM67HX2B-BZVzOUlx.js → railroadDiagram-SM67HX2B-BrL1MhW1.js} +1 -1
- package/dist/assets/{remote-desktop-panel--ikzFjV8.js → remote-desktop-panel-DbxYe3uv.js} +1 -1
- package/dist/assets/{requirementDiagram-X7JNWC4A-C8s2XakO.js → requirementDiagram-X7JNWC4A-DTYjaC8j.js} +1 -1
- package/dist/assets/{sankeyDiagram-UM26HJRW-CCCP1mnQ.js → sankeyDiagram-UM26HJRW-BR9dASO5.js} +1 -1
- package/dist/assets/{sequenceDiagram-ZO4K6R2Y-BvwC79vw.js → sequenceDiagram-ZO4K6R2Y-BR1k8h2_.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-DzRVDjCL.js → sizeCapture-INFHLROL-u8zOvZVi.js} +1 -1
- package/dist/assets/{stateDiagram-v2-TBUQTH76-CKVmZfLe.js → stateDiagram-v2-TBUQTH76-mQ64BAFv.js} +1 -1
- package/dist/assets/{styles-Bo7bYxUt.js → styles-BlayaJti.js} +6 -6
- package/dist/assets/{swimlanes-N4OXWK64-BaSkTx2s.js → swimlanes-N4OXWK64-CmzC3Mu0.js} +1 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-Coei7rJr.js +8 -0
- package/dist/assets/{team-share-BgI5VFVf.js → team-share-C3w1L3WL.js} +1 -1
- package/dist/assets/{timeline-definition-YOQAKGHF-Np9aXu8d.js → timeline-definition-YOQAKGHF-9aPCRsK2.js} +1 -1
- package/dist/assets/{usecaseDiagram-VIAY4XPW-CaHpESyo.js → usecaseDiagram-VIAY4XPW--ngAouwr.js} +1 -1
- package/dist/assets/{vennDiagram-BLWOH2XV-BpnM9QrV.js → vennDiagram-BLWOH2XV-C3zKxuAB.js} +1 -1
- package/dist/assets/{vi-B8BbvT0G.js → vi-uLErku_e.js} +1 -1
- package/dist/assets/{wardleyDiagram-YMQ3BMBF-Cb0psm8G.js → wardleyDiagram-YMQ3BMBF-CZWsQPSF.js} +1 -1
- package/dist/assets/{xychartDiagram-TAQBALBS-Bi_SjN1M.js → xychartDiagram-TAQBALBS-BTcsDP6v.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/rail.html +4 -4
- package/dist-server/package.json +1 -1
- package/package.json +1 -1
- package/dist/assets/CloudAddDialog-DP5-ha1H.js +0 -1
- package/dist/assets/ComputerPanel-DI10c-7Z.js +0 -2
- package/dist/assets/LocalVmWorkspace-Bwq-s97O.js +0 -1
- package/dist/assets/MarkdownFilePreview-B69UWgiO.js +0 -1
- package/dist/assets/PhoneAppDialog-V46SXKel.js +0 -1
- package/dist/assets/SettingsModal-C359HBUM.js +0 -11
- package/dist/assets/TeamMapPage-od4f3NJr.js +0 -1
- package/dist/assets/WorksOnGrid-DbfBPgPv.js +0 -1
- package/dist/assets/channel-BIffrG1w.js +0 -1
- package/dist/assets/index-Bhz3ZrDI.js +0 -2
- package/dist/assets/module-DCUsy2BQ.js +0 -3
- package/dist/assets/swimlanesDiagram-K3J5GTZL-D67LlSLv.js +0 -8
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DataPanel-DdHxcsUa.js","assets/styles-BlayaJti.js","assets/styles-bUbK33f1.css","assets/App-DFjF9FvF.js","assets/index-CwYJ9TX8.js","assets/PlacesRail-v1XIqiBG.js","assets/monitor-DFEzCfQk.js","assets/MenuMotion-IQitGKH4.js","assets/calendar-days-YMHxUvlg.js","assets/LiveDesktop-CDbI9dPy.js","assets/desktop-connection-Dfaq6k5a.js","assets/desktop-viewer-CF-OpSo0.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{c as ht,r as a,t as n,j as e,a as K,ad as hr,X as gr,ae as vr,_ as Pn}from"./styles-BlayaJti.js";import{c as yr,a as wr,b as kr,i as jr,d as Nr}from"./remote-desktop-DDRRx8uY.js";import{v as Sr}from"./desktop-viewer-CF-OpSo0.js";import{dF as Ge,S as zn,K as Cr,D as Ir,bG as Er,bs as Rr,U as pt,X as Pr,Y as Xe,dG as zr,$ as Ye,br as Tr,F as Ar,dH as Dr,G as Ft,w as Tn,dI as $t,dJ as dt,u as Lr,dK as Mr,dL as Or,dM as Vr,dN as _r,a3 as Fr,dO as $r,dP as Br,dQ as Wr,dR as Kr,dS as Ur,o as Hr,bL as qr,bK as yn,n as F,dT as Xr,dU as Yr,l as Gr,_ as Jr,bN as wn,dV as Zr,dW as Qr,a4 as es,dX as kn,dY as ts,dZ as ns,d_ as rs,p as jn,d$ as ss,e0 as Vt,a9 as as,aa as os,co as is,e1 as ls,e2 as cs,a0 as ds,A as us,e3 as ps,e4 as ms,e5 as xs,e6 as bs,q as fs,e7 as hs,e8 as gs,e9 as vs}from"./App-DFjF9FvF.js";import{L as O,p as Nn,M as ys,w as ws}from"./MacLocalControl-CwHtEWES.js";import{R as ks,C as js}from"./ComputerFilesPane-piKNDkt6.js";import{L as A,Y as An,u as Dn,d as Je,c as Ns,z as Sn,g as mt,X as Cn,o as Ss,e as In,f as Cs,s as Is}from"./PlacesRail-v1XIqiBG.js";import{u as Bt,B as Es}from"./BrowserPanel-BB3qz5lN.js";import{M as De}from"./monitor-DFEzCfQk.js";import{C as Ln,w as Rs,a as Ps,p as zs,W as Ts}from"./WorksOnGrid-M_5NkZch.js";import{C as As}from"./MenuMotion-IQitGKH4.js";import"./index-CwYJ9TX8.js";import"./RoutinesPage-DRwSDyGu.js";import"./ProIntroduction--jIMb4bL.js";import"./BrowserProfilesManager-CVdcfOF8.js";import"./SignedInSites-B16Ruhd0.js";import"./minimize-BYscOtPM.js";import"./file-up-Bl7ViNTL.js";const Ds=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Ls=ht("columns-2",Ds);const Ms=[["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m14.305 7.53.923-.382",key:"1mlnsw"}],["path",{d:"m15.228 4.852-.923-.383",key:"82mpwg"}],["path",{d:"m16.852 3.228-.383-.924",key:"ln4sir"}],["path",{d:"m16.852 8.772-.383.923",key:"1dejw0"}],["path",{d:"m19.148 3.228.383-.924",key:"192kgf"}],["path",{d:"m19.53 9.696-.382-.924",key:"fiavlr"}],["path",{d:"m20.772 4.852.924-.383",key:"1j8mgp"}],["path",{d:"m20.772 7.148.924.383",key:"zix9be"}],["path",{d:"M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7",key:"1tnzv8"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}]],Os=ht("monitor-cog",Ms);const Vs=[["path",{d:"m14.5 12.5-5-5",key:"1jahn5"}],["path",{d:"m9.5 12.5 5-5",key:"1k2t7b"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]],_s=ht("monitor-x",Vs);const Fs=[["circle",{cx:"10",cy:"7",r:"1",key:"dypaad"}],["circle",{cx:"4",cy:"20",r:"1",key:"22iqad"}],["path",{d:"M4.7 19.3 19 5",key:"1enqfc"}],["path",{d:"m21 3-3 1 2 2Z",key:"d3ov82"}],["path",{d:"M9.26 7.68 5 12l2 5",key:"1esawj"}],["path",{d:"m10 14 5 2 3.5-3.5",key:"v8oal5"}],["path",{d:"m18 12 1-1 1 1-1 1Z",key:"1bh22v"}]],$s=ht("usb",Fs);function Bs({src:s,name:i,error:d,starting:S,opening:f,disabled:v,refreshing:k=!1,retry:j=0,onOpen:y,onRetry:P}){const[u,m]=a.useState(null),[h,g]=a.useState(null);a.useEffect(()=>{g(null)},[j]);const x=!!(s&&u===s&&h!==s),w=d??(s&&h===s?n("computer.preview.imageFailed"):null);return e.jsxs("div",{className:"relative h-full w-full","aria-busy":!w&&(!x||f||k),children:[s&&e.jsxs("button",{type:"button",onClick:y,disabled:v||S||f||!x,className:"group absolute inset-0 flex h-full w-full items-center justify-center disabled:cursor-wait","aria-label":n("computer.openLiveDesktopAria",{name:i}),title:n("computer.openLiveDesktop"),children:[e.jsx("img",{src:s,alt:n("computer.screenOf",{name:i}),onLoad:()=>{m(s),g(null)},onError:()=>g(s),className:`h-full w-full object-contain transition group-hover:brightness-75 ${x?"":"invisible"}`},j),x&&e.jsxs("span",{className:"absolute right-2 top-2 flex items-center gap-1 rounded-md bg-black/70 px-2 py-1 text-[11px] font-medium text-white",children:[f?e.jsx(A,{size:12,className:"animate-spin"}):e.jsx(Ge,{size:12}),f?n("computer.preview.connecting"):n("computer.open")]})]}),!x&&!w&&e.jsxs("div",{role:"status",className:"absolute inset-0 flex flex-col items-center justify-center gap-2 px-6 text-center text-[12px] text-ink-secondary",children:[e.jsx(A,{size:18,className:"animate-spin"}),S?n("computer.phase.starting"):n("computer.preview.connectingScreen")]}),x&&k&&!w&&e.jsxs("div",{role:"status",className:"absolute bottom-2 left-2 flex items-center gap-1 rounded-md bg-black/70 px-2 py-1 text-[11px] text-white",children:[e.jsx(A,{size:12,className:"animate-spin"}),n("computer.preview.connectingScreen")]}),w&&e.jsxs("div",{role:"alert",className:`absolute inset-x-0 flex flex-col items-center justify-center gap-2 bg-card/95 p-4 text-center text-[12px] text-ink-secondary ${x?"bottom-0":"inset-y-0"}`,children:[!x&&e.jsx(De,{size:22}),e.jsxs("span",{children:[x?n("computer.preview.paused"):n("computer.preview.cantConnect")," ",w]}),e.jsx("button",{type:"button",onClick:()=>P(!x),className:"rounded-md bg-control px-3 py-1.5 text-ink hover:bg-raised-hover",children:n("computer.preview.retry")})]})]})}function Ws({bot:s,backend:i,onBackend:d,onAutoStart:S}){return e.jsxs("div",{"data-testid":"vps-choices",children:[e.jsx(Ln,{compact:!0,value:i,onChange:d}),!s.computer&&e.jsxs("div",{className:"mt-3 flex items-center justify-between gap-4 rounded-lg bg-inset px-3 py-2.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[13px] text-ink",children:n("botAccess.cloud.startVps")}),e.jsx("div",{className:"mt-0.5 text-[12px] text-ink-secondary",children:n("botAccess.cloud.startVpsDescription")})]}),e.jsx(zn,{checked:!!s.autoStartVps,"aria-label":n("botAccess.cloud.startVps"),onClick:S})]})]})}const Ks={available:!1,devices:[]};function Us(){const s=window.ogb?.androidDevice,[i,d]=a.useState(Ks),[S,f]=a.useState(!1),v=Bt();return a.useEffect(()=>{if(!s){f(!0);return}if(!v)return;let k=!0,j=0,y=0;const P=async()=>{const m=++j,h=()=>m<y;try{const g=await s.status();k&&!h()&&(y=m,d(g))}catch(g){k&&!h()&&(y=m,d({available:!1,devices:[],reasonCode:"adb-failed",message:g instanceof Error?g.message:String(g)}))}finally{k&&!h()&&f(!0)}};P();const u=window.setInterval(()=>{P()},2e3);return()=>{k=!1,window.clearInterval(u)}},[s,v]),{...i,scanned:S}}function ct(s){return s.model==="Android device"?s.serial:s.model}function Hs({status:s}){const i=window.ogb?.androidDevice,d=Bt(),S=s.devices.filter(p=>p.state==="device"),[f,v]=a.useState(S[0]?.serial??s.devices[0]?.serial??""),[k,j]=a.useState(null),[y,P]=a.useState({width:0,height:0}),[u,m]=a.useState(null),h=a.useRef(null),g=a.useRef(null),x=a.useRef({x:0,y:0,timer:null}),w=s.devices.find(p=>p.serial===f)??s.devices[0],$=w?.serial,R=w?.state;a.useEffect(()=>{!w&&s.devices[0]&&v(s.devices[0].serial),w&&!s.devices.some(p=>p.serial===w.serial)&&v(s.devices[0]?.serial??"")},[w,s.devices]),a.useEffect(()=>{if(!i||!$||R!=="device"||!d){if(!d)return;j(null);return}let p=!0,C=null;const V=async()=>{try{const _=await i.frame($);p&&(j(_.dataUrl),m(null))}catch(_){p&&m(_ instanceof Error?_.message:String(_))}finally{p&&(C=window.setTimeout(()=>{V()},850))}};return V(),()=>{p=!1,C!==null&&window.clearTimeout(C)}},[i,$,R,d]),a.useEffect(()=>()=>{x.current.timer&&clearTimeout(x.current.timer)},[]);const D=p=>{!i||!w||w.state!=="device"||i.input(w.serial,p).catch(C=>{m(C instanceof Error?C.message:String(C))})},B=(p,C=!1)=>{if(!h.current||!y.width||!y.height)return null;const _=p.currentTarget.getBoundingClientRect(),L=Math.min(_.width/y.width,_.height/y.height),X=y.width*L,Z=y.height*L,Y=_.left+(_.width-X)/2,Le=_.top+(_.height-Z)/2,Ce=(p.clientX-Y)/X,te=(p.clientY-Le)/Z;return C?{x:Math.max(0,Math.min(1,Ce)),y:Math.max(0,Math.min(1,te))}:Ce>=0&&Ce<=1&&te>=0&&te<=1?{x:Ce,y:te}:null},ye=p=>{if(p.metaKey||p.ctrlKey||p.altKey)return;const C={ArrowDown:"down",ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",Backspace:"delete",Delete:"delete",Enter:"enter",Escape:"back",Tab:"tab"};C[p.key]?(p.preventDefault(),D({type:"key",key:C[p.key]})):/^[A-Za-z0-9 _.,@-]$/.test(p.key)&&(p.preventDefault(),D({type:"text",text:p.key}))},me=p=>{if(!y.width||!y.height)return;p.preventDefault();const C=x.current;C.x+=p.deltaX,C.y+=p.deltaY,C.timer&&clearTimeout(C.timer),C.timer=setTimeout(()=>{const V=Math.abs(C.x)>Math.abs(C.y),_=V?C.x:C.y;if(C.x=0,C.y=0,C.timer=null,Math.abs(_)<2)return;const L=Math.max(.18,Math.min(.45,Math.abs(_)/500)),X=_>0?-1:1,Z=V?{x:.5,y:.5}:{x:.5,y:.65},Y=V?{x:Z.x+X*L,y:Z.y}:{x:Z.x,y:Z.y+X*L};D({type:"swipe",fromX:Z.x,fromY:Z.y,toX:Y.x,toY:Y.y,durationMs:260,width:y.width,height:y.height})},80)};if(!w)return null;const r=w.state==="device";return e.jsxs("div",{className:"space-y-3 pb-5",children:[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",{children:[e.jsxs("div",{className:"flex items-center gap-2 text-[15px] font-medium text-ink",children:[e.jsx(An,{size:16,className:"text-success"})," ",ct(w)]}),e.jsx("div",{className:"mt-1 text-[12px] leading-relaxed text-ink-secondary",children:n("computer.android.usbSubtitle")})]}),e.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-[11px] text-success",children:[e.jsx(Cr,{size:12})," ",n("computer.android.usb")]})]}),s.devices.length>1&&e.jsx(Ir,{value:w.serial,onChange:p=>v(p.target.value),className:"mt-3 w-full",children:s.devices.map(p=>e.jsxs("option",{value:p.serial,children:[ct(p)," · ",p.state]},p.serial))})]}),r?e.jsxs(e.Fragment,{children:[e.jsx("div",{role:"application","aria-label":n("computer.android.screenAria",{name:ct(w)}),tabIndex:0,onKeyDown:ye,onWheel:me,onPointerDown:p=>{const C=B(p);C&&(p.currentTarget.setPointerCapture(p.pointerId),g.current={point:C,at:performance.now()})},onPointerUp:p=>{const C=g.current,V=B(p,!0);if(g.current=null,!C||!V)return;Math.hypot(V.x-C.point.x,V.y-C.point.y)<.012?D({type:"tap",...V,...y}):D({type:"swipe",fromX:C.point.x,fromY:C.point.y,toX:V.x,toY:V.y,durationMs:performance.now()-C.at,...y}),p.currentTarget.focus()},onPointerCancel:()=>{g.current=null},className:"mx-auto flex h-[520px] w-full touch-none cursor-pointer items-center justify-center overflow-hidden overscroll-none rounded-[28px] bg-black outline-none ring-1 ring-white/10 focus:ring-2 focus:ring-accent",children:k?e.jsx("img",{ref:h,src:k,alt:n("computer.android.screenAlt",{name:ct(w)}),draggable:!1,onLoad:p=>{P({width:p.currentTarget.naturalWidth,height:p.currentTarget.naturalHeight})},className:"pointer-events-none h-full w-full select-none object-contain"}):e.jsx(A,{size:20,className:"animate-spin text-ink-secondary"})}),e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsxs("button",{onClick:()=>D({type:"key",key:"back"}),className:"flex items-center justify-center gap-1.5 rounded-lg bg-raised py-2 text-[12px] text-ink hover:bg-raised-hover",children:[e.jsx(Er,{size:13})," ",n("computer.android.back")]}),e.jsxs("button",{onClick:()=>D({type:"key",key:"home"}),className:"flex items-center justify-center gap-1.5 rounded-lg bg-raised py-2 text-[12px] text-ink hover:bg-raised-hover",children:[e.jsx(Rr,{size:12})," ",n("computer.android.home")]}),e.jsxs("button",{onClick:()=>D({type:"key",key:"recent"}),className:"flex items-center justify-center gap-1.5 rounded-lg bg-raised py-2 text-[12px] text-ink hover:bg-raised-hover",children:[e.jsx(pt,{size:13})," ",n("computer.android.recent")]})]}),e.jsx("div",{className:"text-center text-[11px] leading-relaxed text-ink-secondary",children:n("computer.android.hint")})]}):e.jsx("div",{className:"rounded-xl border border-warning/25 bg-warning/10 p-4 text-[12px] leading-relaxed text-warning",children:w.state==="unauthorized"?n("computer.android.unauthorized"):n("computer.android.badState",{state:w.state})}),u&&e.jsx("div",{className:"rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-[12px] text-danger",children:u}),e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[13px] font-medium text-ink",children:[e.jsx($s,{size:15,className:"text-accent"})," ",n("computer.android.setupTitle")]}),e.jsxs("ol",{className:"mt-2 list-decimal space-y-1.5 pl-4 text-[12px] leading-relaxed text-ink-secondary",children:[e.jsx("li",{children:n("computer.android.step1")}),e.jsx("li",{children:n("computer.android.step2").split(/(\{buildNumber\}|\{usbDebugging\})/).map((p,C)=>p==="{buildNumber}"||p==="{usbDebugging}"?e.jsx("span",{className:"text-ink",children:n(p==="{buildNumber}"?"computer.android.buildNumber":"computer.android.usbDebugging")},C):p)}),e.jsxs("li",{children:[n("computer.android.step3a")," ",e.jsx("span",{className:"text-ink",children:n("computer.android.allowUsbDebugging")})," ",n("computer.android.step3b")]})]}),e.jsx("div",{className:"mt-2 text-[11px] leading-relaxed text-ink-secondary",children:n("computer.android.agentNote")}),e.jsx("div",{className:"mt-2 rounded-lg bg-inset px-3 py-2 text-[11px] leading-relaxed text-ink-secondary",children:n("computer.android.harnessNote")})]})]})}const qs=1500,Xs=2e5,Mn=()=>Array.from(crypto.getRandomValues(new Uint8Array(18)),s=>s.toString(16).padStart(2,"0")).join("");function Ys(s,i){const d=window.setInterval(()=>{s.closed&&(window.clearInterval(d),i())},1e3)}async function Gs({botId:s,title:i,held:d,request:S,join:f,current:v}){let k=null,j=null;!window.ogb?.desktopViewer&&!window.ogb?.openExternal&&(j=window.open("","_blank"),j&&(j.opener=null));const y=()=>new DOMException("The selected conversation changed","AbortError");try{if(!d&&(k=Mn(),!(await S("take",k)).held))throw new O("computer.err.confirmControl");if(!v())throw y();const{joinUrl:P}=await f(AbortSignal.timeout(Xs)),u=typeof P=="string"&&P?P:null;if(!v())throw y();if(!u)throw new O("computer.err.noDesktopLink");if(window.ogb?.desktopViewer){if(!await window.ogb.desktopViewer.open(u,i,s))throw new O("computer.err.openDesktop")}else if(j){j.location.replace(u);const m=k;m&&Ys(j,()=>{S("release",m).catch(()=>{})})}else if(window.ogb?.openExternal){if(!await window.ogb.openExternal(u))throw new O("computer.err.openDesktopLink")}else if(!window.open(u,"_blank","noopener"))throw new O("computer.err.popupBlocked")}catch(P){throw j?.close(),k&&await S("release",k).catch(()=>{}),P}}function _t(s,i){fetch(s,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(i),keepalive:!0}).catch(()=>{})}function Js({botId:s,session:i,held:d,request:S,viewerClose:f}){const[v,k]=a.useState(!1),[j,y]=a.useState(!1),[P,u]=a.useState(!1),m=a.useRef(null),h=a.useRef(f);h.current=f;const g=a.useCallback(()=>{k(!1),y(!1)},[]),x=a.useCallback(()=>{const R=m.current;m.current=null,g(),R&&(_t(`/api/bots/${s}/computer/control`,{action:"release",controlLeaseId:R.id}),R.viewerClose&&_t(R.viewerClose,{}))},[s,g]),w=a.useCallback(async(R=!1)=>{const D=Mn(),B=await S("take",D);if(!B.held)throw new O("computer.err.confirmControl");m.current=B.owned?{id:D,viewerClose:h.current}:null,k(!0),y(R)},[S]),$=a.useCallback(async()=>{const R=m.current?.viewerClose??h.current;m.current=null,g(),u(!0);try{await S("release")}finally{u(!1),R&&_t(R,{})}},[g,S]);return a.useEffect(()=>x,[i,x]),a.useEffect(()=>(window.addEventListener("pagehide",x),()=>window.removeEventListener("pagehide",x)),[x]),a.useEffect(()=>{if(!v||d)return;const R=setTimeout(()=>{m.current=null,g()},qs);return()=>clearTimeout(R)},[v,d,g]),{here:v,expanded:j,setExpanded:y,handingBack:P,take:w,handBack:$,leave:x}}function Zs({held:s,frame:i,name:d,disabled:S,takeDisabled:f,error:v,onTakeControl:k}){const[j,y]=a.useState(!1),P=a.useCallback(()=>y(!1),[]);return a.useEffect(()=>{s&&y(!1)},[s]),e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:()=>s?k(!0):y(!0),disabled:S,className:"flex flex-auto items-center justify-center gap-2 whitespace-nowrap rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",title:n(s?"computer.openLiveDesktop":"computer.watchFullScreenTitle"),children:[e.jsx(Ge,{size:14}),n("computer.fullScreen")]}),j&&!s&&e.jsx(Qs,{frame:i,name:d,takeDisabled:f,error:v,onClose:P,onTakeControl:()=>k(!0)})]})}function Qs({frame:s,name:i,takeDisabled:d,error:S,onClose:f,onTakeControl:v}){const k=a.useRef(null),j=a.useRef(null),{dragProps:y,noDragStyle:P}=Dn(),u=Je().capabilities.windowChrome==="mac-inset",m=a.useRef(null),[h,g]=a.useState(!1);Ns(k,f),a.useEffect(()=>j.current?.focus(),[]),a.useEffect(()=>{const $=R=>{R.key!=="Escape"||R.defaultPrevented||!(R.target instanceof Node)||!k.current?.contains(R.target)||(R.preventDefault(),R.stopPropagation(),f())};return window.addEventListener("keydown",$,!0),()=>window.removeEventListener("keydown",$,!0)},[f]),a.useEffect(()=>{const $=document.activeElement;d&&($===m.current||$===document.body)&&k.current?.focus()},[d]);const x="flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[12px] focus-visible:outline-2 focus-visible:outline-focus disabled:opacity-50",w=n("computer.screenOf",{name:i});return e.jsxs("div",{ref:k,tabIndex:-1,"data-watch-full-screen":!0,role:"dialog","aria-modal":"true","aria-label":w,className:"fixed inset-0 z-[65] flex flex-col bg-app outline-none",children:[e.jsxs("header",{...y,className:K("flex shrink-0 flex-wrap items-center gap-2 border-b border-hairline/40 bg-panel px-3 py-2",u&&"pl-[86px]"),children:[e.jsx("span",{className:"min-w-0 truncate text-[13px] font-medium text-ink",children:w}),e.jsx("span",{className:"pointer-events-none rounded-full bg-black/70 px-2.5 py-1 text-[11px] font-medium text-white shadow-sm",children:n("computer.watchingBotWorks")}),e.jsxs("button",{ref:j,type:"button",style:P,onClick:f,"aria-label":n("desktopViewer.exitFullscreen"),className:K(x,"ml-auto bg-control text-ink hover:bg-raised-hover"),children:[e.jsx(Pr,{size:14,"aria-hidden":"true"}),e.jsx("span",{className:"max-sm:hidden",children:n("desktopViewer.exitFullscreen")})]}),e.jsxs("button",{ref:m,type:"button",style:P,onClick:()=>{g(!0),v()},disabled:d,className:K(x,"bg-accent font-medium text-accent-ink hover:brightness-110"),title:n("computer.takeControlTitle"),children:[e.jsx(Xe,{size:14,"aria-hidden":"true"}),n("computer.takeControl")]})]}),h&&S&&e.jsx("div",{role:"alert",className:"shrink-0 border-b border-danger/30 bg-danger/10 px-3 py-2 text-[12px] text-danger",children:S}),e.jsx("div",{className:"relative flex min-h-0 flex-1 items-center justify-center overflow-hidden bg-inset",children:s?e.jsx("img",{src:s,alt:w,className:"h-full w-full object-contain"}):e.jsxs("span",{role:"status",className:"flex items-center gap-2 text-[12px] text-ink-secondary",children:[e.jsx(A,{size:16,className:"animate-spin","aria-hidden":"true"}),n("computer.waitingFrame")]})})]})}function ut(s){for(const i of s?.getTracks()??[])i.stop()}function ea(s){const i=s instanceof DOMException?s.name:"";return i==="NotAllowedError"||i==="AbortError"?{ok:!1,phase:"cancelled",messageKey:"computer.screen.cancelled"}:i==="NotFoundError"||i==="NotReadableError"||i==="NotSupportedError"||i==="SecurityError"?{ok:!1,phase:"unavailable",messageKey:"computer.screen.unavailableNow"}:{ok:!1,phase:"error",messageKey:"computer.screen.error"}}async function ta({beginIntent:s,getDisplayMedia:i}){try{if(!s())return{ok:!1,phase:"unavailable",messageKey:"computer.screen.unavailableWindow"};const d=await i({video:!0,audio:!1});return d.getVideoTracks().length===0?(ut(d),{ok:!1,phase:"unavailable",messageKey:"computer.screen.noVideoTrack"}):{ok:!0,stream:d}}catch(d){return ea(d)}}const qe={idle:"computer.screen.idle",ended:"computer.screen.ended",unavailable:"computer.screen.unavailable"};function na(){const{capabilities:s,ready:i}=Je(),d=s.screenPreview,S=s.host.platform==="linux",[f,v]=a.useState("idle"),[k,j]=a.useState(qe.idle),[y,P]=a.useState(""),u=a.useRef(null),m=a.useRef(null),h=a.useRef(0),g=a.useCallback((R,D)=>{h.current+=1;const B=m.current;m.current=null,u.current&&(u.current.srcObject=null),ut(B),v(R),j(D)},[]);a.useEffect(()=>()=>{h.current+=1;const R=m.current;m.current=null,ut(R)},[]);const x=async()=>{if(!d.available||!window.ogb?.beginScreenPreviewIntent||!navigator.mediaDevices?.getDisplayMedia){v("unavailable"),j(qe.unavailable);return}g("requesting","computer.screen.waiting");const R=h.current,D=await ta({beginIntent:()=>window.ogb.beginScreenPreviewIntent(),getDisplayMedia:r=>navigator.mediaDevices.getDisplayMedia(r)});if(R!==h.current){D.ok&&ut(D.stream);return}if(!D.ok){v(D.phase),j(D.messageKey);return}const B=D.stream,ye=B.getVideoTracks()[0];m.current=B,P(ye.label),ye.addEventListener("ended",()=>{m.current===B&&g("ended",qe.ended)},{once:!0});const me=u.current;if(!me){g("error","computer.screen.displayFailed");return}me.srcObject=B;try{await me.play()}catch{R===h.current&&m.current===B&&g("error","computer.screen.displayFailed");return}R!==h.current||m.current!==B||(v("streaming"),j("computer.screen.active"))};if(!S)return null;const w=y||n("computer.screen.selected"),$=f==="cancelled"||f==="ended"||f==="unavailable"||f==="error";return e.jsxs("section",{className:"mt-4 rounded-xl bg-card p-4","aria-labelledby":"local-preview-title",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{id:"local-preview-title",className:"text-[15px] font-medium text-ink",children:n("computer.screen.title")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:n("computer.screen.subtitle")})]}),e.jsx("span",{className:"shrink-0 rounded-full bg-raised px-2 py-1 text-[10px] font-medium text-ink-secondary",children:n("computer.screen.badge")})]}),e.jsxs("div",{className:"relative mt-3 flex aspect-[16/10] items-center justify-center overflow-hidden rounded-lg bg-panel",children:[e.jsx("video",{ref:u,autoPlay:!0,muted:!0,playsInline:!0,"aria-label":n("computer.screen.videoAria"),className:f==="streaming"?"h-full w-full object-contain":"hidden"}),f!=="streaming"&&e.jsxs("div",{className:"flex flex-col items-center gap-2 px-6 text-center text-ink-secondary",children:[f==="requesting"?e.jsx(A,{size:18,className:"animate-spin"}):e.jsx(De,{size:22}),e.jsx("span",{className:"text-[12px]","aria-live":"polite",children:i?n(d.available?k:qe.unavailable):n("computer.screen.checking")})]})]}),f==="streaming"&&e.jsxs("div",{className:"mt-2 flex items-center justify-between gap-3 text-[11px] text-ink-secondary",children:[e.jsx("span",{className:"truncate",title:w,children:d.interaction==="portal-picker"?w:n("vm.dest.local")}),e.jsxs("span",{className:"flex items-center gap-1.5 text-success",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-success"})," ",n("computer.screen.sharing")]})]}),e.jsxs("button",{type:"button",disabled:f==="requesting"||!d.available&&f!=="streaming",onClick:f==="streaming"?()=>g("idle",qe.idle):()=>{x()},className:"mt-3 flex w-full items-center justify-center gap-2 rounded-lg bg-raised py-2 text-[13px] text-ink hover:bg-raised-hover disabled:cursor-not-allowed disabled:opacity-50",children:[f==="requesting"?e.jsx(A,{size:14,className:"animate-spin"}):f==="streaming"?e.jsx(zr,{size:13}):$?e.jsx(pt,{size:14}):e.jsx(De,{size:14}),f==="requesting"?n("computer.screen.choosing"):f==="streaming"?n("computer.screen.stop"):$?n("computer.linux.tryAgain"):d.interaction==="portal-picker"?n("computer.screen.choose"):n("computer.screen.start")]})]})}const ra="https://github.com/milind-soni/OpenMausBot/blob/main/docs/linux-desktop.md#enable-local-control",sa="https://github.com/milind-soni/OpenMausBot/blob/main/docs/linux-desktop.md#omarchy-hyprland-experimental",aa="https://cua.ai/docs/cua-sdk/guides/omarchy";function oa(){const{capabilities:s}=Je(),i=s.localComputer,[d,S]=a.useState(null),[f,v]=a.useState(null);if(s.host.platform!=="linux")return null;const k=d!==null||i.status==="checking"||i.status==="starting",j=i.available,y=i.reasonCode==="linux-wayland-seat-safety-blocked",P=i.reasonCode==="linux-hyprland-plugin-required",u=i.compositor==="hyprland",m=s.host.session==="wayland",h=i.driverSource==="bundled",g=async x=>{if(window.ogb?.localControl){S(x),v(null);try{if((x==="disable"||x==="retry")&&!(await fetch("/api/local-computer/interrupt",{method:"POST"})).ok){v({key:"computer.linux.stopFailed"});return}await window.ogb.localControl[x]()}catch(w){v(w instanceof Error?w.message:String(w))}finally{S(null)}}};return e.jsxs("section",{className:"mt-4 rounded-xl bg-card p-4","aria-labelledby":"linux-local-control-title",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs("div",{id:"linux-local-control-title",className:"flex items-center gap-2 text-[15px] font-medium text-ink",children:[e.jsx(Os,{size:16,className:j?"text-success":"text-ink-secondary"}),n("computer.linux.title")]}),e.jsx("div",{className:"mt-1 text-[12px] leading-relaxed text-ink-secondary",children:u?n("computer.linux.metaOmarchy"):n("computer.linux.meta",{session:m?"Wayland":"Xorg"})})]}),e.jsx("span",{className:K("shrink-0 rounded-full px-2 py-1 text-[10px] font-medium",j?"bg-success/10 text-success":y?"bg-danger/10 text-danger":P||i.enabled?"bg-warning/10 text-warning":"bg-raised text-ink-secondary"),children:j?n("computer.linux.ready"):y?n("computer.linux.waylandBadge"):P?n("computer.linux.pluginBadge"):i.enabled?n("vm.state.attention"):n("vm.dest.off")})]}),y?e.jsx("div",{className:"mt-3 rounded-lg border border-danger/20 bg-danger/5 p-3",children:e.jsxs("div",{className:"flex gap-2 text-[12px] leading-relaxed text-ink-secondary",children:[e.jsx(Ye,{size:15,className:"mt-0.5 shrink-0 text-danger"}),e.jsxs("span",{children:[n("computer.linux.waylandBefore")," ",e.jsx("strong",{className:"font-medium text-ink",children:n("computer.linux.waylandXorg")})," ",n("computer.linux.waylandAfter")]})]})}):P?e.jsxs("div",{className:"mt-3 rounded-lg border border-warning/20 bg-warning/5 p-3","data-linux-hyprland-plugin-required":!0,children:[e.jsxs("div",{className:"flex gap-2 text-[12px] leading-relaxed text-ink-secondary",children:[e.jsx(Ye,{size:15,className:"mt-0.5 shrink-0 text-warning"}),e.jsx("span",{children:n("computer.linux.hyprlandPlugin")})]}),e.jsxs("button",{type:"button",onClick:()=>window.open(aa,"_blank","noopener,noreferrer"),className:"mt-2 flex items-center gap-1.5 text-[12px] font-medium text-accent hover:underline",children:[n("computer.linux.omarchyGuide")," ",e.jsx(Sn,{size:11})]})]}):i.enabled?e.jsxs("div",{className:"mt-3 rounded-lg bg-panel p-3 text-[12px] text-ink-secondary",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[j?e.jsx(Tr,{size:15,className:"mt-0.5 shrink-0 text-success"}):k?e.jsx(A,{size:15,className:"mt-0.5 shrink-0 animate-spin"}):e.jsx(Ye,{size:15,className:"mt-0.5 shrink-0 text-warning"}),e.jsx("span",{"aria-live":"polite",children:j?n(u?"computer.linux.hyprlandReady":"computer.linux.readyMsg"):i.message??n("computer.linux.checking")})]}),i.driverPath&&e.jsxs("div",{className:"mt-2 break-all font-mono text-[10px] text-ink-tertiary",title:i.driverPath,children:[h?n("computer.linux.bundledDriver"):i.driverPath,i.driverVersion?` · ${i.driverVersion}`:""]})]}):e.jsx("div",{className:"mt-3 rounded-lg border border-warning/20 bg-warning/5 p-3",children:e.jsxs("div",{className:"flex gap-2 text-[12px] leading-relaxed text-ink-secondary",children:[e.jsx(Ye,{size:15,className:"mt-0.5 shrink-0 text-warning"}),e.jsxs("span",{children:[n("computer.linux.enableBefore")," ",e.jsx("strong",{className:"font-medium text-ink",children:n("vm.dest.local")})," ",n("computer.linux.enableAfter"),m&&!u&&` ${n("computer.linux.waylandInput")}`]})]})}),f&&e.jsx("div",{className:"mt-2 text-[12px] text-danger",children:typeof f=="string"?f:n(f.key)}),!y&&e.jsx("div",{className:"mt-3 flex gap-2",children:P?e.jsxs("button",{type:"button",disabled:k,onClick:()=>{g("enable")},className:"flex flex-1 items-center justify-center gap-2 rounded-lg bg-raised py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[d==="enable"?e.jsx(A,{size:14,className:"animate-spin"}):e.jsx(pt,{size:14}),n("computer.linux.tryAgain")]}):i.enabled?e.jsxs(e.Fragment,{children:[!j&&e.jsxs("button",{type:"button",disabled:k,onClick:()=>{g("retry")},className:"flex flex-1 items-center justify-center gap-2 rounded-lg bg-raised py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[d==="retry"?e.jsx(A,{size:14,className:"animate-spin"}):e.jsx(pt,{size:14}),n("computer.linux.tryAgain")]}),e.jsxs("button",{type:"button",disabled:d!==null,onClick:()=>{g("disable")},className:"flex flex-1 items-center justify-center gap-2 rounded-lg bg-raised py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[d==="disable"?e.jsx(A,{size:14,className:"animate-spin"}):e.jsx(mt,{size:14}),n("computer.linux.disable")]})]}):e.jsxs("button",{type:"button",disabled:k,onClick:()=>{g("enable")},className:"flex flex-1 items-center justify-center gap-2 rounded-lg bg-accent py-2 text-[13px] font-medium text-white hover:opacity-90 disabled:opacity-50",children:[d==="enable"?e.jsx(A,{size:14,className:"animate-spin"}):e.jsx(mt,{size:14}),n("computer.linux.enable")]})}),e.jsxs("button",{type:"button",onClick:()=>window.open(u?sa:ra,"_blank","noopener,noreferrer"),className:"mt-2 flex w-full items-center justify-center gap-1.5 rounded-lg py-1.5 text-[11px] text-ink-secondary hover:bg-raised hover:text-ink",children:[s.host.packaged?n("computer.linux.guide"):n("computer.linux.driverSetup")," ",e.jsx(Sn,{size:11})]})]})}function ia(){const{capabilities:s}=Je(),[i,d]=a.useState(!1),[S,f]=a.useState(null),v=s.localComputer;if(s.host.platform!=="win32"||v.reasonCode==="remote-server"||v.available)return null;const k=async()=>{d(!0),f(null);try{await window.ogb?.localControl?.retry()}catch(j){f(j instanceof Error?j.message:String(j))}finally{d(!1)}};return e.jsx("section",{"data-windows-local-control":v.reasonCode??"unavailable",className:"mt-4 rounded-xl border border-warning/25 bg-warning/10 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(_s,{size:16,className:"mt-0.5 shrink-0 text-warning","aria-hidden":"true"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:n("computer.windows.title")}),e.jsxs("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:[n("computer.windows.body"),v.reasonCode==="cua-driver-blocked"&&e.jsxs(e.Fragment,{children:[" ",n("computer.windows.blocked")]})]}),v.message&&e.jsxs("details",{className:"mt-2 text-[12px] text-ink-secondary",children:[e.jsx("summary",{className:"cursor-pointer",children:n("computer.windows.detail")}),e.jsx("p",{className:"mt-1 break-words",children:v.message})]}),S&&e.jsxs("div",{role:"alert",className:"mt-2 flex gap-1.5 text-[12px] text-danger",children:[e.jsx(Ye,{size:13,className:"mt-0.5 shrink-0","aria-hidden":"true"}),e.jsx("span",{children:S})]}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:e.jsxs("button",{type:"button",onClick:()=>{k()},disabled:i,className:"inline-flex items-center gap-1.5 rounded-lg bg-accent px-3 py-1.5 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[i&&e.jsx(A,{size:13,className:"animate-spin","aria-hidden":"true"}),n(i?"computer.windows.starting":"computer.windows.start")]})})]})]})})}const la={computer:{Icon:De,label:"computer.tab.computer"},routines:{Icon:Tn,label:"computer.tab.routines"},android:{Icon:An,label:"computer.tab.android"},browser:{Icon:Ft,label:"computer.tab.browser",tour:"computer-browser"},data:{Icon:Dr,label:"computer.tab.data",tour:"computer-data"},files:{Icon:Ar,label:"computer.tab.files"}},Ne="outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/60",xt=s=>`computer-panel-tabs-tab-${s}`,On=s=>`computer-panel-tabs-panel-${s}`,ca=(s,i)=>({id:xt(s),role:"tab","aria-selected":i,"aria-controls":On(s),tabIndex:i?0:-1}),Se=s=>({role:"tabpanel",id:On(s),"aria-labelledby":xt(s),tabIndex:0});function da(s){const i=s.currentTarget;Math.abs(s.deltaY)<=Math.abs(s.deltaX)||i.scrollWidth<=i.clientWidth||(i.scrollLeft+=s.deltaY)}function ua(s,i,d){if(s.ctrlKey||s.metaKey||s.altKey)return;const S=Math.max(0,i.findIndex(k=>xt(k)===s.target.id)),f=s.key==="ArrowRight"?1:s.key==="ArrowLeft"?-1:0,v=s.key==="Home"?i[0]:s.key==="End"?i[i.length-1]:f?i[(S+f+i.length)%i.length]:void 0;v&&(s.preventDefault(),d(v),document.getElementById(xt(v))?.focus())}function pa(s,i,d){const S=i.scanned&&i.devices.length===0&&i.reasonCode!=="adb-unavailable"&&i.reasonCode!=="adb-failed";a.useEffect(()=>{!S||$t(s)!=="android"||(d("computer"),dt(s,"computer"))},[s,S,d])}const Vn="omb-computer-panel-width",bt=360,ft=960,ma=400,En=40;function xa(){try{const s=Number(localStorage.getItem(Vn));if(Number.isFinite(s)&&s>=bt&&s<=ft)return s}catch{}return ma}function ba(){const[s,i]=a.useState(xa),d=a.useRef(null),S=h=>{try{localStorage.setItem(Vn,String(h))}catch{}},f=h=>{d.current={x:h.clientX,width:s},h.currentTarget.setPointerCapture(h.pointerId)},v=h=>{if(!d.current)return;const g=Math.min(ft,Math.max(bt,d.current.width+(d.current.x-h.clientX)));i(g)},k=h=>{d.current&&(d.current=null,h.currentTarget.releasePointerCapture(h.pointerId),S(s))},j=h=>{i(g=>{const x=Math.min(ft,Math.max(bt,g+h));return S(x),x})},y=a.useRef(null),[P,u]=a.useState(null);return a.useEffect(()=>{const h=y.current?.closest("aside");if(!h)return;const g=()=>u(h.offsetWidth);g();const x=new ResizeObserver(g);return x.observe(h),()=>x.disconnect()},[]),{panelWidth:s,separatorRef:y,separatorWidth:P,onSeparatorKeyDown:h=>{if(h.ctrlKey||h.metaKey||h.altKey)return;const g=h.key==="ArrowLeft"?En:h.key==="ArrowRight"?-En:null;g===null||P===null||(h.preventDefault(),j(g))},onResizeStart:f,onResizeMove:v,onResizeEnd:k}}const fa=a.lazy(()=>Pn(()=>import("./DataPanel-DdHxcsUa.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(s=>({default:s.DataPanel}))),_n=()=>Pn(()=>import("./LiveDesktop-CDbI9dPy.js"),__vite__mapDeps([9,1,2,10,11,5,6,7,3,4])).then(s=>({default:s.LiveDesktop})),ha=a.lazy(_n),Rn=Ss({held:In().optional().default(!1),helpReason:Is().nullable().optional().default(null),help:Cs().optional().transform(ds),owned:In().optional()}).passthrough();function Ma({bot:s,onOpenVmWorkspace:i}){const{dragProps:d}=Dn(),{panelWidth:S,separatorRef:f,separatorWidth:v,onSeparatorKeyDown:k,onResizeStart:j,onResizeMove:y,onResizeEnd:P}=ba(),{state:u,dispatch:m,flushBotPatches:h}=Lr(),g=s.tasks?.find(t=>t.threadId===s.threadId),x=Mr(s,g),w=Or(g),$=Vr(s),R=`${s.id}:${s.threadId}:${x}:${s.cloudBackend??"box"}:${$.modelSelection.instanceId}`,[D,B]=a.useState(null),ye=D?.key===R,me=x!=="auto"||ye,r={...$,computer:x==="auto"?ye?D.surface:void 0:x},p=`${r.id}:${r.threadId}:${r.computer}:${r.cloudBackend??"box"}`,C=a.useRef(p);C.current=p;const V=a.useRef(null);a.useEffect(()=>()=>V.current?.abort(),[p]);const _=!!r.busy,L=a.useCallback(t=>`/api/bots/${s.id}/${t}?threadId=${encodeURIComponent(s.threadId)}`,[s.id,s.threadId]),X=s.computer==="cloud"&&x==="cloud",Z=s.computer==="vm"&&x==="vm",{capabilities:Y,ready:Le}=Je(),Ce=Y.localComputer.available,te=Y.host.platform==="linux",Me=_r(u.instances,r),Wt=Fr("local",u.config)&&$r({capabilities:Y,providerSupportsLocal:Me}),[Kt,gt]=a.useState(null),Ut=Br({capabilities:Y,providerSupportsLocal:Me}),Fn=Wr(u.config,Y),[c,N]=a.useState("checking"),[Oe,Ht]=a.useState(null),[xe,ne]=a.useState(null),[vt,yt]=a.useState(null),z=r.cloudBackend??"box",Ze=!!(Oe&&Oe.botId===r.id&&Oe.computer===s.computer&&Oe.cloudBackend===z&&Oe.section===(r.section?.trim()??"")),U=!!(xe&&xe.botId===r.id&&xe.threadId===r.threadId&&xe.computer===r.computer&&xe.cloudBackend===z),we=U&&x==="auto"&&z==="box"&&vt?.botId===r.id&&vt.section===(r.section?.trim()??"")?vt:null,W=U&&Kr({computer:r.computer,cloudBackend:z,phase:c,botId:r.id,resolvedBotId:xe?.botId??null,resolvedComputer:xe?.computer??null,resolvedCloudBackend:xe?.cloudBackend??null}),Ie=a.useCallback(t=>{ne(null),yt(null),N("checking"),m({type:"updateBot",botId:r.id,patch:t})},[r.id,m]);a.useEffect(()=>{let t=!0;return Ht(null),h(r.id).then(o=>{t&&(o&&!Ur({computer:s.computer,cloudBackend:z,persistedBot:o})||o&&(o.section?.trim()??"")!==(r.section?.trim()??"")||Ht({botId:r.id,computer:s.computer,cloudBackend:z,section:r.section?.trim()??""}))}),()=>{t=!1}},[r.id,s.computer,r.section,z,h]);const[Ve,ae]=a.useState(null),[wt,Qe]=a.useState(null),[$n,ce]=a.useState(null),[Bn,Ee]=a.useState(!1),[qt,Wn]=a.useState(0),[Kn,kt]=a.useState(null),[G,et]=a.useState(null),[Xt,jt]=a.useState(null),[Un,Yt]=a.useState(null),[E,oe]=a.useState(null),[ie,Re]=a.useState(!1),[tt,Gt]=a.useState(!1),[nt,I]=a.useState(null),be=Nn(nt),Q=hr(),[Hn,_e]=a.useState(()=>$t(r.id)),Fe=u.dataResultFocus?.botId===r.id?u.dataResultFocus:void 0,[qn,Xn]=a.useState(),Nt=Us(),St=Nt.devices.length>0,Jt=xs({advanced:Q,androidConnected:St}),M=ls(Hn,{advanced:Q,androidConnected:St}),Ct=Hr(s.id,M),Zt=qr(u.config),fe=yn(u.config)&&r.browser!==!1&&(Zt||u.config?.browserEngine?.installable===!0),[Qt,Pe]=a.useState(0),[Yn,Gn]=a.useState(!1);a.useEffect(()=>{if(x!=="auto"||!Ze)return;const t=new AbortController;return B(null),F(L("computer"),{signal:t.signal}).then(o=>{if(t.signal.aborted)return;const l=o.surface;B({key:R,surface:l==="cloud"||l==="vm"||l==="local"||l==="browser"||l==="off"?l:void 0})}).catch(o=>{t.signal.aborted||(I(o instanceof Error?o:String(o)),N("error"))}),()=>t.abort()},[R,x,Ze,L,Qt]);const It=c==="vm-unavailable"&&G?.resumable===!0,$e=a.useRef(0),ke=a.useRef(null);a.useEffect(()=>(ke.current?.signal.aborted&&(ke.current=null,oe(null)),()=>{ke.current?.abort()}),[r.id,r.threadId,r.computer,M]);const rt=u.instances.find(t=>t.instanceId===r.modelSelection.instanceId),Be=a.useRef(!1),st=t=>{Be.current=!0,_e(t),dt(r.id,t)},en=a.useRef(null),at=`${s.id}:${s.threadId}:${x}:${s.cloudBackend??"box"}`;a.useEffect(()=>{const t=en.current;t===at&&(Be.current||!(r.computer==="browser"&&fe))||(t!==at&&(Be.current=!1),en.current=at,_e(r.computer==="browser"&&fe?"browser":t===null?$t(r.id):"computer"))},[at,r.id,r.computer,fe]),a.useEffect(()=>{!Fe||Fe.consumed||(Be.current=!0,Xn(Fe),_e("data"),dt(r.id,"data"),m({type:"dataResultFocusConsumed",requestId:Fe.requestId}))},[r.id,m,Fe]);const he=u.signInFocus?.botId===r.id?u.signInFocus:void 0,[Jn,Zn]=a.useState(),[Qn,er]=a.useState();Xr(r.id,t=>{st("browser"),er(t)}),a.useEffect(()=>{if(!he||he.consumed)return;const t=he.place==="browser"?"browser":"computer";Be.current=!0,_e(t),dt(r.id,t),t==="browser"&&Zn({url:he.url,site:he.site,nonce:he.requestId}),m({type:"signInFocusConsumed",requestId:he.requestId})},[r.id,m,he]),a.useEffect(()=>{let t=!0;const o=window.ogb?.desktopViewer;o?.currentState&&o.currentState().then(b=>{t&&Gt(b.open&&b.contextId===r.id)}).catch(()=>{});const l=o?.onState(b=>{b.contextId===r.id&&Gt(b.open)});return()=>{t=!1,l?.()}},[r.id]),pa(r.id,Nt,_e),a.useEffect(()=>{$e.current=0},[r.id,r.computer]);const tn=!!(rt?.snapshot.state==="available"&&rt.capabilities?.computerMcp),Et=yr(wr(rt)),nn=u.routines.filter(t=>t.botId===r.id).sort((t,o)=>Number(o.enabled)-Number(t.enabled)||(t.nextRunAt??1/0)-(o.nextRunAt??1/0)),tr=!!(u.config?.box.configured&&kr(u.instances,r.modelSelection.instanceId)?.snapshot.state==="available"),We=u.routineRuns.find(t=>t.botId===r.id&&["queued","running","waiting"].includes(t.status));a.useEffect(()=>{if(M!=="computer")return;let t=!0;if(ne(null),yt(null),N("checking"),Qe(null),ce(null),kt(null),et(null),jt(null),Yt(null),I(null),!(!Ze||!me)){if(r.computer===void 0){N("auto-unavailable");return}if(r.computer==="off"){N("off");return}if(r.computer==="browser"){N("browser");return}if(r.computer==="local"){Me||I(new O("computer.err.localEngine")),N(Le&&Ce&&Me?"local":"local-unavailable"),ne({botId:r.id,threadId:r.threadId,computer:r.computer,cloudBackend:z});return}if(r.computer==="vm"){if(!tn){I(new O("computer.err.vmEngine")),N("vm-unavailable");return}let o;return F(L("local-computer")).then(l=>{if(!t)return;const b=l;if(ne({botId:r.id,threadId:r.threadId,computer:r.computer,cloudBackend:z}),et(b),b.ready)$e.current=0,N("vm");else if(b.container==="running"&&b.imageMatches&&b.managed&&b.network==="loopback"&&b.security==="hardened"&&b.persistence==="durable"&&!b.desktopReady&&$e.current<15)$e.current+=1,I(null),N("checking"),o=window.setTimeout(()=>Pe(T=>T+1),2e3);else{const T=b.mode==="per-bot"&&b.container==="missing"&&b.image&&b.create_supported;I(T||b.resumable?null:new O("computer.err.vmOpenSettings",b.problem,"computer.err.vmNotReady")),N("vm-unavailable")}}).catch(l=>{t&&(I(l.message),N("vm-unavailable"))}),()=>{t=!1,o!==void 0&&window.clearTimeout(o)}}if(r.computer==="cloud"&&!Et){N("error");return}if(!(r.computer!=="cloud"&&!Le))return z==="vps"?(F(L("computer")).then(o=>{if(!t)return;const l=o;if(jt(l),ne({botId:r.id,threadId:r.threadId,computer:r.computer,cloudBackend:z}),!l.configured){I(new O("computer.err.vpsAlias")),N("vps-unconfigured");return}if(l.ready){ae(l.container??null),N("ready");return}if(l.managed&&l.container!=="missing"&&!l.imageMatches){I(l.problem),N("vps-incompatible");return}if(X)return N("starting"),F(`/api/bots/${r.id}/computer/provision`,{method:"POST"}).then(b=>{t&&(ae(b.container??null),b.ready?(ne({botId:r.id,threadId:r.threadId,computer:r.computer,cloudBackend:z}),N("ready")):(I(b.problem??new O("computer.err.vpsNotReady")),N("error")))});ae(l.container??null),I(r.autoStartVps?new O("computer.err.vpsAuto",l.problem,"computer.err.vpsNoContainer"):new O("computer.err.vpsManual",l.problem,"computer.err.vpsNoContainer")),N(l.container==="stopped"?"vps-stopped":"vps-unconfigured")}).catch(o=>{t&&(I(o.message),N("error"))}),()=>{t=!1}):(F(L("computer")).then(o=>{if(!t)return;const l=Yr({computer:x==="cloud"?"cloud":void 0,configured:!!o.configured,boatState:typeof o.box?.state=="string"?o.box.state:null,canUseCloud:Et,autoLocal:!1,teamComputer:typeof o.teamComputer?.id=="string"&&typeof o.teamComputer?.name=="string",busy:s.busy});if(ne({botId:r.id,threadId:r.threadId,computer:r.computer,cloudBackend:z}),!o.configured&&r.computer==="cloud"&&!o.teamComputer){N("unconfigured");return}if(l==="team-boat"){yt({id:o.teamComputer.id,name:o.teamComputer.name,botId:r.id,section:r.section?.trim()??""}),ae(typeof o.box?.state=="string"?o.box.state:o.configured?"missing":"unavailable"),I(typeof o.problem=="string"?o.problem:null),N("team-boat");return}if(l==="attach-ready-boat"||r.computer==="cloud"&&l==="show-ready-boat"){ae(typeof o.box?.state=="string"?o.box.state:null),N("ready");return}ae(typeof o.box?.state=="string"?o.box.state:null),N(l)}).catch(o=>{t&&(I(o.message),N("error"))}),()=>{t=!1})}},[r.id,r.threadId,r.computer,r.section,r.autoStartVps,r.vpsAlias,z,Qt,Le,Wt,te,Me,rt?.driverKind,tn,Et,u.config?.vps?.sshAlias,M,Ze,me,X,x,L]),a.useEffect(()=>{if(c!=="busy-boat")return;let t=!0;const o=()=>{if(!s.busy&&x==="cloud"){Pe(b=>b+1);return}F(L("computer"),{background:!0}).then(b=>{if(!t)return;const T=typeof b.box?.state=="string"?b.box.state:null;ae(T),cs(T)&&N("ready")}).catch(()=>{})},l=window.setInterval(o,5e3);return()=>{t=!1,window.clearInterval(l)}},[c,L,s.busy,x]);const H=u.computerControl[r.id]??{held:!1,helpReason:null},ot=a.useCallback(async(t,o)=>{const l=Rn.parse(await F(`/api/bots/${r.id}/computer/control`,{method:"POST",body:JSON.stringify({action:t,...o?{controlLeaseId:o}:{}})}));return m({type:"computerControl",botId:r.id,held:l.held===!0,helpReason:l.helpReason,help:l.help}),l},[r.id,m]),ee=U?c==="vm"&&G?.viewer_url&&G.target_key?Sr({key:G.target_key}):W&&z==="vps"?`vps/${r.id}`:null:null,le=Js({botId:r.id,session:`${p}:${M}`,held:H.held,request:ot,viewerClose:ee?.startsWith("vps/")?L("computer/viewer-close"):null}),pe=le.here&&!!ee;a.useEffect(()=>{ee&&_n()},[ee]);const ze=Bt(),Te=a.useRef(0),Rt=a.useRef(r.busy);a.useEffect(()=>{Rt.current=r.busy},[r.busy]),a.useEffect(()=>{if(Te.current=0,!!W)return Gr({screens:!0,onFrame:t=>{t.kind!=="screen"||t.botId!==r.id||t.threadId!==r.threadId||(Te.current=Date.now(),Qe({png:t.png,mime:t.mime??"image/png"}),ce(null),Ee(!1))}})},[W,r.id,r.threadId]),a.useEffect(()=>{if(M!=="computer"||!W||tt||pe||!ze||E||ie)return;let t=!1,o=-1/0,l=null,b=null;const T=new AbortController;ce(null),Ee(!0);const se=async()=>{if(t||T.signal.aborted||Date.now()-o<(l??(Rt.current?4e3:3e4))||Rt.current&&Date.now()-Te.current<1e4)return;t=!0,l=null;const q=Date.now();try{const{png:J,format:Ae}=await F(L("computer/screenshot"),{method:"POST",signal:AbortSignal.any([T.signal,AbortSignal.timeout(9e4)])});if(!T.signal.aborted&&Te.current<=q){if(typeof J!="string"||!J.trim())throw new O("computer.err.emptyFrame");Qe({png:J,mime:Ae==="jpeg"?"image/jpeg":"image/png"}),ce(null),Ee(!1),b=null}}catch(J){if(!T.signal.aborted&&Te.current<=q)if(J instanceof us&&jr(J)){l=1e3,b??=Date.now();const Ae=Date.now()-b>=1e4;ce(Ae?J:null),Ee(!Ae)}else b=null,Ee(!1),ce(J instanceof Error&&J.name==="TimeoutError"?new O("computer.err.frameTimeout"):J instanceof Error?J:new O("computer.err.screenUnavailable"))}finally{t=!1,o=Date.now()}};se();const ue=setInterval(se,1e3);return()=>{T.abort(),clearInterval(ue)}},[M,W,L,z,tt,pe,ze,E,ie,qt]),a.useEffect(()=>{if(M!=="computer"||c!=="vm"||!U||tt||pe||!ze)return;const t=new AbortController;let o=!1,l=-1/0,b=null,T=!0;const se=async()=>{if(!(o||t.signal.aborted)&&!(Date.now()-l<(b??(r.busy?3e3:3e4)))){o=!0,b=null;try{const{image:q}=await F(L("local-computer/screenshot"),{method:"POST",signal:t.signal});!t.signal.aborted&&typeof q=="string"&&(kt(q),ce(null))}catch(q){t.signal.aborted||(b=5e3,T?I(q instanceof Error?q.message:String(q)):ce(q instanceof Error?q:new O("computer.err.screenUnavailable")))}finally{o=!1,T=!1,l=Date.now()}}};se();const ue=window.setInterval(()=>{se()},r.busy?3e3:3e4);return()=>{t.abort(),window.clearInterval(ue)}},[M,c,U,L,tt,pe,ze,r.busy,I,ce,kt]);const[rn,Pt]=a.useState(0);a.useEffect(()=>{if(M!=="computer"||c!=="local"||!U||!window.ogb||te||!ze)return;let t=!0;Pt(0);const o=async()=>{try{const b=await window.ogb.screenFrame();t&&b?Yt(b):t&&Pt(T=>T+1)}catch{t&&Pt(b=>b+1)}};o();const l=setInterval(o,r.busy?3e3:3e4);return()=>{t=!1,clearInterval(l)}},[M,c,U,te,ze,r.busy,r.id,r.threadId]);const ge=U?c==="vm"?Kn:c==="local"&&!te?Un:W||r.computer==="cloud"&&c==="starting"?wt&&`data:${wt.mime};base64,${wt.png}`:null:null,nr=!!(ge&&(ee||W)),de=H.help??null,rr=de?u.bots.find(t=>t.id===de.botId)?.name??r.name:r.name;a.useEffect(()=>{let t=!0;return F(`/api/bots/${r.id}/computer/control`).then(o=>{if(!t)return;const l=Rn.parse(o);m({type:"computerControl",botId:r.id,held:l.held===!0,helpReason:l.helpReason,help:l.help})}).catch(()=>{}),()=>{t=!1}},[r.id]);const sn=a.useCallback(async()=>!0,[]),an=a.useCallback(async t=>Jr({action:t,syncNativeBrowser:M!=="browser",requestControl:ot,setNativeBrowserControl:sn}),[M,ot,sn]),sr=a.useCallback(async t=>{Re(!0),I(null);try{return await an(t),!0}catch(o){return I(o instanceof Error?o.message:String(o)),!1}finally{Re(!1)}},[an]),it=!!(de&&de.place!=="browser"&&de.place!=="local"&&(W||c==="vm"||we)),on=t=>de&&e.jsx(fs,{help:de,askerName:rr,takeControl:t&&{onClick:t,disabled:ie||E==="join",pending:E==="join"},onError:I}),ar=async()=>{const t=new AbortController;V.current=t;const o=()=>!t.signal.aborted&&C.current===p;oe("join"),Re(!0),I(null);try{await Gs({botId:r.id,title:n("computer.viewerTitle",{name:r.name}),held:H.held,request:ot,join:l=>F(L("computer/join"),{method:"POST",signal:AbortSignal.any([t.signal,l])}),current:o})}catch(l){o()&&I(l instanceof Error?l:String(l))}finally{V.current===t&&(V.current=null,oe(null),Re(!1))}},zt=E==="join"||c==="vm"&&!ee,ve=async(t=!1)=>{if(!ee)return W?ar():void 0;if(le.here)return le.setExpanded(t||le.expanded);Re(!0),I(null);try{await le.take(t)}catch(o){I(o instanceof Error?o:String(o))}finally{Re(!1)}},ln=async()=>{I(null),window.ogb?.desktopViewer?.close(r.id),await le.handBack().catch(t=>I(t instanceof Error?t:String(t)))},Tt=t=>{oe(t),I(null),F(`/api/bots/${r.id}/computer/${t}`,{method:"POST"}).then(o=>{t==="provision"&&(ae(o.container??null),o.ready?(r.computer==="cloud"&&ne({botId:r.id,threadId:r.threadId,computer:r.computer,cloudBackend:z}),N("ready")):(I(o.problem??new O("computer.err.vpsNotReady")),N("error"))),t==="sleep"&&(ne(null),ae(z==="vps"?"stopped":"archived"),N(z==="vps"?"vps-stopped":X?"cloud-asleep":"show-sleeping-boat"))}).catch(o=>{I(o.message)}).finally(()=>oe(null))},or=()=>{oe("provision"),I(null),N("starting"),F(`/api/bots/${r.id}/computer/provision`,{method:"POST"}).then(t=>{ae(t.state??null),ne({botId:r.id,threadId:r.threadId,computer:r.computer,cloudBackend:z}),N("ready")}).catch(t=>{if(Nr(t)){N("busy-boat");return}I(t.message),N("error")}).finally(()=>oe(null))},At=async t=>{if((t==="vm-recreate"||t==="vm-delete")&&!window.confirm(t==="vm-delete"?n("computer.confirm.deleteVm",{name:r.name}):n("computer.confirm.replaceVm",{name:r.name}))||ke.current)return;const o=new AbortController;ke.current=o,oe(t),I(null),$e.current=0;try{if((t==="vm-recreate"||t==="vm-delete")&&await F(`/api/bots/${r.id}/local-computer/remove`,{method:"POST",body:"{}",signal:o.signal}),t!=="vm-delete"){const l=t==="vm-start"&&G?.mode!=="per-bot"?"/api/local-computer/start":`/api/bots/${r.id}/local-computer/${t==="vm-start"?"start":"run"}`,b=await F(l,{method:"POST",body:"{}",signal:o.signal}),T=await ws(b,()=>F(L("local-computer"),{signal:o.signal}),o.signal);if(!T.ready)throw new Error(T.problem??n("computer.err.vmNotReady"));et(T),N("vm")}else et(l=>l&&{...l,container:"missing",ready:!1}),N("vm-unavailable")}catch(l){if(o.signal.aborted)return;I(l instanceof Error?l.message:String(l)),N("vm-unavailable")}finally{ke.current===o&&!o.signal.aborted&&(ke.current=null,oe(null),Pe(l=>l+1))}},ir=async()=>{if(window.confirm(n("computer.confirm.replaceVps",{name:r.name}))){oe("vps-replace"),I(null);try{await F(`/api/bots/${r.id}/computer/remove`,{method:"POST",body:"{}"});const t=await F(`/api/bots/${r.id}/computer/provision`,{method:"POST",body:"{}"});jt(t),ae(t.container??null),t.ready&&r.computer==="cloud"&&ne({botId:r.id,threadId:r.threadId,computer:r.computer,cloudBackend:z}),N(t.ready?"ready":"error"),t.ready||I(t.problem??new O("computer.err.vpsReplaceNotReady"))}catch(t){I(t instanceof Error?t.message:String(t)),N("error")}finally{oe(null),Pe(t=>t+1)}}},cn=()=>{window.sessionStorage.setItem("openmausbot.settings.section","computer"),m({type:"toggleAppSettings",open:!0})},dn=()=>m(hs("vps")),un=U&&(c==="vps-unconfigured"||c==="vps-stopped"||c==="vps-incompatible"),pn=U&&X&&(c==="vps-stopped"||c==="vps-unconfigured"&&!!Xt?.configured),mn=U&&X&&c==="vps-incompatible"&&!!Xt?.managed,Dt=Zt||u.config?.browserEngine?.installable===!0,[xn,bn]=a.useState(!1),fn=async()=>{if(!xn){bn(!0),I(null);try{if(!yn(u.config)){const t=await F("/api/config",{method:"PATCH",body:JSON.stringify({features:{browser:!0}})});m({type:"configStatus",config:t})}s.browser===!1&&m({type:"updateBot",botId:s.id,patch:{browser:!0}})}catch(t){I(t instanceof Error?t.message:n("settings.experimental.error"))}finally{bn(!1)}}},lr=()=>{I(null),m({type:"updateBot",botId:s.id,patch:{browser:!1}})},hn=e.jsxs("div",{"data-testid":"browser-switch-row",className:"mb-3 flex items-center gap-3 rounded-xl bg-card px-3 py-2.5",children:[e.jsx(Ft,{size:15,className:"shrink-0 text-ink-secondary","aria-hidden":"true"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-[13px] font-medium text-ink",children:n("computer.browserSwitch.title",{name:r.name})}),!Dt&&e.jsx("div",{className:"text-[12px] text-ink-secondary",children:wn(u.config)})]}),e.jsx(zn,{checked:fe,disabled:xn||!fe&&!Dt,"aria-label":n("computer.browserSwitch.title",{name:r.name}),onClick:()=>fe?lr():void fn()})]}),cr=u.config?.managedPolicy,Lt=Zr(Ve,s.busy===!0),dr=!U||x!=="cloud"||z!=="box"?void 0:c==="starting"?"starting":c==="busy-boat"?Lt.spinner?"starting":Lt.line==="computer.cloud.asleep"?"asleep":"none":c==="ready"?"on":Ve==="archived"||Ve==="stopped"?"asleep":void 0,Ke=(t,o)=>ps({...ms({bot:r,place:t,seat:Fn,config:u.config,instances:u.instances,local:{ready:Wt,reason:Ut??n("computer.unavailableLocal")},...t==="cloud"?{computer:dr}:{},...t==="auto"&&we?{teamComputer:we.name}:{}}),...o?{refusal:o}:{}}),Mt=r.computer==="cloud"&&z==="box"&&c==="error"&&nt&&!(nt instanceof O)?Qr({message:be??"",status:Number(nt.status??0)||void 0},u.config?.box?.included===!0):void 0,re=Ke("cloud",Mt),je=Ke("auto"),ur=es(Y),Ue=Rs(u.config,Y).map(([t,o,l,b])=>{const T=Ps(t,s.computer,Y),se=zs(t,s.cloudBackend,cr),ue=t===null?je:t==="cloud"?re:Ke(t),q=!!se||kn(ue),J=!se&&ts(ue),Ae=se??(J?ue.line:t==="browser"?n("computer.browserOnlyTitle"):void 0);return{mode:t,labelKey:o,descriptionKey:l,Icon:b,simpleLabel:ns(t??void 0,Y.host.platform),selected:T,managedBy:se,disabled:q,unavailableTitle:Ae,view:ue,issue:J}}),lt=Ue.find(({selected:t})=>t)?.view??je,pr=t=>{if(t==="start"||t==="wake")return or();if(t==="try-again")return Pe(o=>o+1);if(t==="turn-on-browser")return void fn();if(t==="open-vm-settings")return cn();vs(t,{botId:s.id,threadId:s.threadId},m)},mr=t=>!!t&&t!=="watch"&&t!=="open-computer-panel"&&(t!=="start"&&t!=="wake"||X&&!s.busy),He=(t,o="mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover")=>t.action&&mr(t.action.id)?e.jsx("button",{type:"button","data-testid":"place-action",onClick:()=>pr(t.action.id),className:o,children:t.action.label}):null,gn=t=>{t===null&&s.computer===void 0||t===s.computer||(t==="local"&&gs(s)==="auto"?gt(r.id):Ie(t==="browser"?{computer:t,browser:!0}:{computer:t}))},xr=()=>{s.computer==="local"&&ur&&Ie({computer:null}),m({type:"updateTask",botId:s.id,threadId:s.threadId,patch:{surface:null}})},Ot=w&&s.computer!=="off"&&w!==s.computer?w:void 0,br=t=>K("flex shrink-0 items-center gap-1.5 rounded-full px-3 py-1 text-[13px] transition-colors @max-[28rem]/paneltabs:[&>svg]:hidden @max-[22rem]/paneltabs:px-2",t?"bg-raised text-ink shadow-sm":"text-ink-secondary hover:text-ink"),vn=t=>{t==="browser"&&I(null),st(t)},fr={checking:n("computer.phase.checking"),starting:z==="vps"?n("computer.phase.starting"):re.line,"busy-boat":re.line,unconfigured:re.line,"auto-unavailable":je.line,"team-boat":je.line,"show-ready-boat":n("computer.phase.showReadyBoat"),"show-sleeping-boat":n("computer.phase.showSleepingBoat"),"show-pending-boat":n("computer.phase.showPendingBoat"),"cloud-new":re.line,"cloud-asleep":re.line,"vps-unconfigured":n("computer.phase.vpsUnconfigured"),"vps-incompatible":n("computer.phase.vpsIncompatible"),"vps-stopped":n("computer.phase.vpsStopped"),"local-unavailable":Ut??n("computer.phase.localUnavailable"),"vm-unavailable":n("computer.phase.vmUnavailable"),browser:Ke("browser").line,off:Ke("off").line,error:r.computer==="cloud"&&(Mt||kn(re))?re.line:n("computer.phase.error")};return e.jsxs(e.Fragment,{children:[e.jsxs("aside",{className:K("animate-panel-in relative flex h-full shrink-0 flex-col border-l border-hairline/40 bg-panel","max-md:absolute max-md:inset-0 max-md:z-40 max-md:w-full!"),ref:Ct,"data-computer-panel":!0,style:{width:S},children:[e.jsx("div",{ref:f,role:"separator","aria-orientation":"vertical","aria-label":n("computer.resizeAria"),"aria-valuemin":bt,"aria-valuemax":ft,"aria-valuenow":v??void 0,tabIndex:0,onKeyDown:k,onPointerDown:j,onPointerMove:y,onPointerUp:P,onPointerCancel:P,className:"absolute inset-y-0 left-0 z-10 w-1.5 cursor-col-resize hover:bg-accent/40 focus-visible:bg-accent/60 max-md:hidden"}),e.jsx("div",{...d,className:"@container/paneltabs ml-1.5 py-3 pl-2.5 pr-4",children:e.jsxs("div",{className:"relative flex min-h-7 items-center justify-center",children:[Q&&e.jsx("button",{onClick:()=>{jn(Ct.current,r.id),m({type:"toggleComputer",open:!1}),m({type:"toggleSettings",open:!0,section:"access"})},className:"absolute left-0 top-1/2 -translate-y-1/2 rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink",title:n("computer.botSettings"),children:e.jsx(rs,{size:18})}),e.jsx("div",{className:"mx-9 flex min-w-0 touch-pan-x gap-0.5 overflow-x-auto whitespace-nowrap rounded-full bg-inset p-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden","data-tour":"computer-tabs","data-testid":"computer-tabs",role:"tablist","aria-label":n("computer.tabsAria"),onWheel:da,onKeyDown:t=>ua(t,Jt,vn),children:Jt.map(t=>{const{Icon:o,label:l,tour:b}=la[t],T=_?t==="computer"&&bs(x)?"computer-tab-live":t==="browser"&&x==="browser"?"browser-tab-live":void 0:void 0;return e.jsxs("button",{type:"button","data-tour":b,...ca(t,t===M),title:n(l),onClick:()=>vn(t),className:br(t===M),children:[e.jsx(o,{size:13})," ",n(l),T&&e.jsx("span",{className:"size-1.5 animate-pulse rounded-full bg-success",role:"img","aria-label":n("place.live"),"data-testid":T})]},t)})}),e.jsx("button",{"data-computer-panel-close":!0,onClick:()=>{jn(Ct.current,r.id),m({type:"toggleComputer",open:!1})},className:"absolute right-0 top-1/2 -translate-y-1/2 rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink","aria-label":n("computer.close"),title:n("computer.close"),children:e.jsx(gr,{size:18})})]})}),M==="routines"?e.jsx("div",{...Se("routines"),className:K("min-h-0 flex-1 overflow-y-auto px-4 pb-4",Ne),children:e.jsx(ks,{bot:r,routines:nn,runs:u.routineRuns,defaultRunOn:tr?"cloud":"maus"},r.id)}):M==="browser"&&fe?e.jsxs("div",{...Se("browser"),className:K("flex min-h-0 flex-1 flex-col px-4 pb-4",Ne),children:[hn,de?.place==="browser"&&e.jsx("div",{className:"-mt-1 mb-3",children:on()}),e.jsx(Es,{bot:r,signIn:Jn,page:Qn}),be&&e.jsx("div",{role:"alert",className:"mt-2 rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-[12px] text-danger",children:be})]}):M==="browser"?e.jsxs("div",{...Se("browser"),className:K("flex-1 overflow-y-auto px-5 pb-5",Ne),"data-testid":"browser-off",children:[hn,e.jsxs("div",{className:"mt-2 flex flex-col items-center gap-3 rounded-xl bg-card px-6 py-8 text-center",children:[e.jsx(Ft,{size:22,className:"text-ink-secondary","aria-hidden":"true"}),e.jsx("div",{className:"text-[14px] font-medium text-ink",children:n("computer.browserOff.title")}),e.jsx("p",{className:"text-[12px] leading-5 text-ink-secondary",children:Dt?n("computer.browserOff.body",{name:r.name}):wn(u.config)}),be&&e.jsx("div",{role:"alert",className:"w-full rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-[12px] text-danger",children:be})]})]}):M==="data"?e.jsx("div",{...Se("data"),className:K("flex min-h-0 flex-1 flex-col overflow-hidden",Ne),children:e.jsx(a.Suspense,{fallback:e.jsx("div",{className:"flex flex-1 items-center justify-center text-[13px] text-ink-secondary",role:"status",children:n("data.loading")}),children:e.jsx(fa,{bot:r,requestedCard:qn},r.id)})}):M==="files"?e.jsx("div",{...Se("files"),className:K("flex min-h-0 flex-1 flex-col",Ne),children:e.jsx(js,{bot:r})}):M==="android"&&St?e.jsx("div",{...Se("android"),className:K("flex-1 overflow-y-auto px-4 pt-2",Ne),children:e.jsx(Hs,{status:Nt})}):e.jsxs("div",{...Se("computer"),className:K("flex-1 overflow-y-auto px-5 pb-5",Ne),children:[e.jsxs("div",{className:"mb-1.5 mt-2 flex items-center justify-between text-[13px] text-ink-secondary",children:[e.jsx("span",{children:n("computer.screenOf",{name:r.name})}),we&&e.jsx("span",{className:"text-[11px]",children:je.short}),c==="local"&&e.jsx("span",{className:"text-[11px]",children:n("computer.badge.local")}),pe&&e.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] font-medium text-ink",children:[e.jsx("span",{className:"size-1.5 rounded-full bg-success"}),n("computer.inControl")]}),c==="vm"&&!pe&&e.jsx("span",{className:"text-[11px]",children:n("vm.dest.vm")}),(c==="show-ready-boat"||c==="show-sleeping-boat"||c==="show-pending-boat")&&e.jsx("span",{className:"text-[11px]",children:n("computer.badge.autoBoat")}),U&&r.computer==="cloud"&&z==="vps"&&(c==="ready"||c==="starting")&&!pe&&e.jsx("span",{className:"text-[11px]",children:n("computer.badge.vps")})]}),e.jsx("div",{className:K("relative flex aspect-[16/10] w-full items-center justify-center overflow-hidden rounded-xl bg-card",pe&&"ring-2 ring-accent"),children:pe&&ee?e.jsx(a.Suspense,{fallback:e.jsx(A,{size:18,className:"animate-spin text-ink-secondary"}),children:e.jsx(ha,{target:ee,threadId:r.threadId,name:r.name,poster:ge,expanded:le.expanded,onExpandedChange:le.setExpanded,onHandBack:()=>{ln()},handingBack:le.handingBack,onUnreachable:()=>{le.leave(),I(new O("computer.err.openDesktop"))}})}):W||r.computer==="cloud"&&c==="starting"?e.jsx(Bs,{src:ge,name:r.name,error:Nn($n),refreshing:Bn,retry:qt,starting:c==="starting",opening:E==="join",disabled:ie,onOpen:()=>{ve()},onRetry:t=>{Te.current=0,t&&Qe(null),ce(null),Ee(!0),Wn(o=>o+1)}},`${r.id}:${r.threadId}:${r.computer}:${z}`):ge&&nr?e.jsxs("button",{type:"button",onClick:()=>{ve()},disabled:ie||E==="join",className:"group relative flex h-full w-full cursor-pointer items-center justify-center focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-wait","aria-label":n("computer.openLiveDesktopAria",{name:r.name}),title:n("computer.openLiveDesktop"),children:[e.jsx("img",{src:ge,alt:n("computer.screenOf",{name:r.name}),className:"h-full w-full object-contain transition group-hover:brightness-75 group-focus-visible:brightness-75"}),e.jsxs("span",{className:"pointer-events-none absolute right-2 top-2 flex items-center gap-1 rounded-md bg-black/70 px-2 py-1 text-[11px] font-medium text-white opacity-80 shadow-sm transition group-hover:opacity-100 group-focus-visible:opacity-100",children:[E==="join"?e.jsx(A,{size:12,className:"animate-spin"}):e.jsx(Ge,{size:12}),n("computer.open")]})]}):ge?e.jsx("img",{src:ge,alt:n("computer.screenOf",{name:r.name}),className:"h-full w-full object-contain",title:c==="vm"?n("computer.watchOnly"):void 0}):e.jsxs("div",{className:"flex flex-col items-center gap-2 px-6 text-center text-ink-secondary",children:[c==="checking"||c==="starting"||c==="busy-boat"&&Lt.spinner||c==="vm"||c==="local"&&!te?e.jsx(A,{size:18,className:"animate-spin"}):c==="off"?e.jsx(mt,{size:22}):e.jsx(De,{size:22}),e.jsx("span",{className:"text-[12px]",children:we?je.line:W?n("computer.waitingFrame"):c==="ready"?n("computer.autoChooseCloudOpen"):c==="vm"?n("computer.capturingVm"):c==="local"?te?n("computer.linuxReady"):rn>=3?n("computer.needsScreenPerm"):n("computer.capturingLocal"):It?n(E==="vm-start"?"vm.setup.starting":"computer.phase.vmStopped"):fr[c]}),we&&He(je),r.computer==="cloud"&&(c==="unconfigured"||c==="error")&&re.action?.id!=="add-boat-key"&&He(re),c==="local"&&!te&&rn>=3&&e.jsx("button",{onClick:()=>window.ogb?.permOpenSettings?.("screen"),className:"mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover",children:n("computer.openSettings")}),c==="browser"&&fe&&e.jsx("button",{onClick:()=>st("browser"),className:"mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover",children:n("computer.openBrowserTab")}),(c==="show-ready-boat"||c==="show-sleeping-boat"||c==="show-pending-boat")&&e.jsx("button",{type:"button",onClick:()=>Ie({computer:"cloud"}),className:"mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover",children:c==="show-sleeping-boat"?n("computer.chooseCloudWake"):c==="show-ready-boat"?n("computer.chooseCloudOpen"):n("computer.chooseCloudManage")}),E===null&&(c==="cloud-new"||c==="cloud-asleep")&&He(re),It&&E!=="vm-start"&&e.jsx("p",{className:"text-[12px]",children:n(G?.stop_reason==="idle"?"vm.stopped.idle":"vm.stopped.detail")}),c==="vm-unavailable"&&(Z&&It&&G.mode!=="pool"?e.jsxs("button",{onClick:()=>{At("vm-start")},disabled:E!==null,"aria-busy":E==="vm-start",className:"mt-1 flex items-center gap-1.5 rounded-lg bg-accent px-3 py-1.5 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[E==="vm-start"&&e.jsx(A,{size:13,className:"animate-spin"}),n(E==="vm-start"?"vm.setup.starting":"vm.setup.start")]}):Z&&G?.mode==="per-bot"&&G.image&&G.create_supported?e.jsxs("button",{onClick:()=>{At(G.container==="missing"?"vm-create":"vm-recreate")},disabled:E!==null,className:"mt-1 rounded-lg bg-accent px-3 py-1.5 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[(E==="vm-create"||E==="vm-recreate")&&e.jsx(A,{size:13,className:"mr-1.5 inline animate-spin"}),G.container==="missing"?n("computer.createVm",{name:r.name}):n("computer.replaceVm",{name:r.name})]}):e.jsx("button",{onClick:cn,className:"mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover",children:n("computer.openVmSetup")})),!Q&&un&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-[12px]",children:n("computer.simple.needsSetup",{name:r.name})}),!pn&&!mn&&e.jsx("button",{type:"button",onClick:()=>vr(!0),className:"mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover",children:n("computer.simple.showAdvanced")})]}),Q&&U&&(c==="vps-unconfigured"||c==="vps-stopped")&&e.jsx("button",{onClick:dn,className:"mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover",children:n("computer.openVpsSettings")}),pn&&e.jsxs("button",{onClick:()=>Tt("provision"),disabled:E==="provision",className:"mt-1 rounded-lg bg-control px-3 py-1.5 text-[12px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[E==="provision"&&e.jsx(A,{size:13,className:"mr-1.5 inline animate-spin"}),c==="vps-stopped"?n("computer.startVps"):n("computer.prepareVps")]}),mn&&e.jsxs("button",{onClick:()=>{ir()},disabled:E==="vps-replace",className:"mt-1 rounded-lg bg-accent px-3 py-1.5 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[E==="vps-replace"&&e.jsx(A,{size:13,className:"mr-1.5 inline animate-spin"}),n("computer.replaceVps")]})]})}),be&&!Mt&&e.jsx("div",{className:"mt-2 rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-[12px] text-danger",children:be}),(Yn||c==="unconfigured"&&re.action?.id==="add-boat-key")&&e.jsx("div",{"data-boat-key":!0,className:"mt-3 rounded-xl bg-card py-1.5",children:e.jsx(ss,{id:"box",via:"computer_panel",onSaved:t=>{Gn(!0),t&&Pe(o=>o+1)}})}),Q&&c==="vps-unconfigured"&&e.jsxs("div",{className:"mt-3 rounded-xl bg-card p-4",children:[e.jsx("div",{className:"mb-3 text-[13px] text-ink-secondary",children:n("computer.vpsAliasHint")}),e.jsx("button",{onClick:dn,className:"rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover",children:n("computer.openVpsSettings")})]}),Q&&c==="vm"&&G?.mode==="per-bot"&&window.ogb?.desktopWorkspace&&i&&e.jsxs("button",{type:"button",onClick:()=>i(r.id),disabled:E!==null,className:"mt-3 flex w-full items-center justify-center gap-2 rounded-lg border border-accent/30 bg-accent/10 py-2 text-[13px] font-medium text-ink hover:bg-accent/15 disabled:opacity-50",title:n("computer.twoDesktopsTitle"),children:[e.jsx(Ls,{size:14}),n("computer.twoDesktops")]}),de&&de.place!=="browser"&&on(it&&!H.held?()=>c==="vm"||W?void ve():void sr("take"):void 0),(W||c==="vm"||we)&&H.held&&e.jsxs("div",{className:"mt-3 rounded-xl border border-accent/25 bg-accent/10 p-4",children:[e.jsxs("div",{className:"text-[13px] leading-relaxed text-ink",children:[n("computer.youHaveWheel"),W&&!ee&&` ${n(Q?"computer.useOpenDesktop":"computer.simple.useFullScreen")}`]}),e.jsxs("button",{onClick:()=>{ln()},disabled:ie||le.handingBack,className:"mt-2 flex w-full items-center justify-center gap-2 rounded-lg bg-accent py-2 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[e.jsx(Xe,{size:14}),n("computer.handBack")]})]}),Q&&c==="vm"&&(H.held||!it)&&e.jsxs("button",{onClick:()=>{ve(H.held)},disabled:ie||!ee,className:"mt-3 flex w-full items-center justify-center gap-2 rounded-lg bg-control py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",title:H.held?n("computer.openLiveDesktop"):n("computer.takeControlTitle"),children:[ie?e.jsx(A,{size:14,className:"animate-spin"}):H.held?e.jsx(Ge,{size:14}):e.jsx(Xe,{size:14}),n(H.held?"computer.fullScreen":"computer.takeControl")]}),Q&&Z&&c==="vm"&&G?.mode==="per-bot"&&e.jsxs("button",{onClick:()=>{At("vm-delete")},disabled:E!==null||s.busy,className:"mt-2 flex w-full items-center justify-center gap-2 rounded-lg border border-danger/30 py-2 text-[13px] text-danger hover:bg-danger/10 disabled:opacity-50",title:s.busy?n("computer.deleteVmBlocked"):n("computer.deleteVmTitle",{name:r.name}),children:[E==="vm-delete"?e.jsx(A,{size:14,className:"animate-spin"}):e.jsx(mt,{size:14}),n("computer.deleteVm")]}),!Q&&(W||c==="vm")&&e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2","data-testid":"computer-actions",children:[!H.held&&!it&&e.jsxs("button",{type:"button",onClick:()=>{ve()},disabled:ie||zt,className:"flex flex-auto items-center justify-center gap-2 whitespace-nowrap rounded-lg bg-accent px-3 py-2 text-[13px] font-medium text-accent-ink hover:brightness-110 disabled:opacity-50",title:n("computer.takeControlTitle"),children:[E==="join"?e.jsx(A,{size:14,className:"animate-spin"}):e.jsx(Xe,{size:14}),n("computer.takeControl")]}),e.jsx(Zs,{held:H.held,frame:ge,name:r.name,onTakeControl:t=>{ve(t)},disabled:H.held&&zt,takeDisabled:ie||zt,error:be}),W&&X&&(z==="vps"||Ve!=="archived")&&e.jsxs("button",{type:"button",onClick:()=>Tt("sleep"),disabled:E==="sleep"||s.busy,className:"flex flex-auto items-center justify-center gap-2 whitespace-nowrap rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",title:n("computer.sleepTitle"),children:[E==="sleep"?e.jsx(A,{size:14,className:"animate-spin"}):e.jsx(Cn,{size:14}),n("vm.cloud.sleep")]})]}),Q&&W&&e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[!H.held&&!it&&e.jsxs("button",{onClick:()=>{ve()},disabled:ie||E==="join",className:"flex flex-auto items-center justify-center gap-2 whitespace-nowrap rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",title:n("computer.takeControlTitle"),children:[E==="join"?e.jsx(A,{size:14,className:"animate-spin"}):e.jsx(Xe,{size:14}),n("computer.takeControl")]}),H.held&&e.jsxs("button",{onClick:()=>{ve(!0)},disabled:E==="join",className:"flex flex-auto items-center justify-center gap-2 whitespace-nowrap rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[E==="join"?e.jsx(A,{size:14,className:"animate-spin"}):ee?e.jsx(Ge,{size:14}):e.jsx(De,{size:14}),n(ee?"computer.fullScreen":"computer.openLiveDesktop")]}),X&&(z==="vps"||Ve!=="archived")&&e.jsxs("button",{onClick:()=>Tt("sleep"),disabled:E==="sleep"||s.busy,className:"flex flex-auto items-center justify-center gap-2 whitespace-nowrap rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",title:n("computer.sleepTitle"),children:[E==="sleep"?e.jsx(A,{size:14,className:"animate-spin"}):e.jsx(Cn,{size:14}),n("vm.cloud.sleep")]})]}),c!=="team-boat"&&(r.computer!==void 0||U)&&e.jsxs(e.Fragment,{children:[e.jsx(na,{}),e.jsx(oa,{}),e.jsx(ys,{}),e.jsx(ia,{})]}),Q?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mt-4 rounded-xl bg-card p-4",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:n("computer.worksOn")}),e.jsx("p",{className:"mt-1 text-[12px] leading-5 text-ink-secondary",children:n(u.config?.cloudHome?"computer.worksOnHintCloudHome":"computer.worksOnHint")}),e.jsx(Ts,{options:Ue,onSelect:gn}),w&&e.jsx("p",{className:"mt-2 text-[12px] leading-5 text-ink-secondary","data-testid":"place-pinned-note",children:n("place.pinnedNote",{place:n(Vt(w))})}),e.jsxs("div",{className:"mt-3 border-t border-hairline/40 pt-3 text-[12px] leading-5 text-ink-secondary","aria-live":"polite","data-testid":"place-line",children:[lt.line,He(lt,"mt-1 block font-medium text-accent hover:underline")]}),s.computer==="cloud"&&e.jsx(Ln,{compact:!0,value:z,onChange:t=>Ie({cloudBackend:t})})]}),e.jsxs("button",{type:"button",onClick:()=>st("routines"),className:"mt-4 flex w-full items-start gap-3 rounded-xl bg-card p-4 text-left hover:bg-raised",children:[e.jsx(Tn,{size:17,className:"mt-0.5 shrink-0 text-accent"}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsxs("span",{className:"block text-[14px] font-medium text-ink",children:[n("computer.tab.routines")," ",e.jsx("span",{className:"ml-1 text-[11px] text-ink-secondary",children:nn.length})]}),e.jsx("span",{className:K("mt-1 block truncate text-[12px]",We?os(We):"text-ink-secondary"),children:We?`${We.routineName} · ${as(We)}`:n("computer.routines.openTitle")})]}),e.jsx(As,{size:14,className:"shrink-0 text-ink-secondary rtl:-scale-x-100","aria-hidden":"true"})]})]}):e.jsxs("div",{className:"mt-4 rounded-xl bg-card p-4","data-testid":"where-works",children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:n("computer.simple.whereWorks",{name:r.name})}),e.jsx("div",{role:"group","aria-label":n("computer.destinationAria"),className:"mt-3 grid grid-cols-3 gap-2",children:Ue.map(({mode:t,Icon:o,selected:l,disabled:b,unavailableTitle:T,simpleLabel:se,issue:ue,view:q})=>e.jsxs("button",{type:"button",disabled:b,title:T,"aria-pressed":l,onClick:()=>gn(t),className:K("flex min-w-0 flex-col items-center gap-1.5 rounded-lg border px-1.5 py-2.5 text-center transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-card",l?"border-accent/60 bg-accent/10 text-ink":"border-hairline/50 bg-panel/30 text-ink-secondary",b?"cursor-not-allowed opacity-50":"hover:border-accent/40 hover:bg-control/60"),children:[e.jsx(o,{size:16,className:K("shrink-0",l?"text-accent":"text-ink-secondary"),"aria-hidden":"true"}),e.jsx("span",{className:"w-full truncate text-[12px] font-medium leading-4",children:se}),ue&&e.jsx("span",{className:"w-full truncate text-[11px] leading-3 text-ink-secondary",children:q.short})]},t??"auto"))}),e.jsxs("div",{className:"mt-3 text-[12px] leading-5 text-ink-secondary","data-testid":"place-line",children:[lt.line,He(lt,"mt-1 block font-medium text-accent hover:underline")]}),Ot&&e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx("p",{className:"min-w-0 flex-1 text-[12px] leading-5 text-ink-secondary","data-testid":"place-pinned-note",children:n("place.pinnedNoteSimple",{place:Ue.find(({mode:t})=>t===Ot)?.simpleLabel??n(Vt(Ot))})}),e.jsx("button",{type:"button",disabled:!!r.busy,title:r.busy?n("place.busy"):void 0,onClick:xr,className:"shrink-0 rounded-md px-2 py-0.5 text-[12px] font-medium leading-5 text-accent-text transition-colors hover:bg-control focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-45 disabled:hover:bg-transparent","data-testid":"place-unpin",children:n("place.unpinSimple",{place:Ue.find(({selected:t})=>t)?.simpleLabel??n(Vt(s.computer??"auto"))})})]}),un&&e.jsx(Ws,{bot:r,backend:z,onBackend:t=>Ie({cloudBackend:t}),onAutoStart:()=>m({type:"updateBot",botId:r.id,patch:{autoStartVps:!r.autoStartVps}})})]})]})]}),e.jsx(is,{open:Kt!==null,onCancel:()=>gt(null),onConfirm:()=>{const t=Kt;gt(null),t&&(t===r.id&&(ne(null),N("checking")),m({type:"updateBot",botId:t,patch:{computer:"local",acknowledgeLocalAuto:!0}}))}})]})}export{Ma as ComputerPanel};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as Sl,j as F,t as J,r as C,R as E,S as iy,f as su,a as nc,
|
|
1
|
+
import{c as Sl,j as F,t as J,r as C,R as E,S as iy,f as su,a as nc,aa as Tp}from"./styles-BlayaJti.js";import{ef as gs,eg as sy,eh as Pp,ei as ny,ej as oy,bG as ry,ek as nu,el as ly,em as Ap,en as ay,n as Tr,eo as Pr,ep as cy,W as hy,P as dy,eq as uy,er as Fp,u as fy,es as gy,et as py,dq as my,X as Cy,dF as wy,dH as vy}from"./App-DFjF9FvF.js";import{$ as by,r as Mp,K as Ep,L as to}from"./PlacesRail-v1XIqiBG.js";import{C as yy}from"./calendar-days-YMHxUvlg.js";import"./index-CwYJ9TX8.js";import"./monitor-DFEzCfQk.js";import"./MenuMotion-IQitGKH4.js";const Sy=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],xy=Sl("columns-3",Sy);const Ry=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M10 18h4",key:"1ulq68"}]],ky=Sl("list-filter",Ry);const Dy=[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],Ty=Sl("toggle-left",Dy);const Py=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],Ay=Sl("type",Py);function Fy({sources:t}){return t.length===0?null:F.jsx("ul",{className:"m-0 mt-1 flex max-h-10 list-none flex-wrap gap-x-4 overflow-y-auto p-0 text-[12px] text-ink-tertiary","aria-label":J("data.sources.label"),"data-testid":"sources-strip",children:t.map(e=>F.jsxs("li",{className:"flex items-baseline gap-2 py-0.5",children:[F.jsx("span",{className:"min-w-0 truncate font-mono",children:e.sqlName??e.name}),F.jsx("span",{className:"shrink-0",children:J("data.sources.rows",{count:gs(e.rowCount)})})]},e.name))})}var V={BACKSPACE:"Backspace",TAB:"Tab",ENTER:"Enter",ESCAPE:"Escape",SPACE:" ",LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown",DELETE:"Delete",F2:"F2",PAGE_UP:"PageUp",PAGE_DOWN:"PageDown",PAGE_HOME:"Home",PAGE_END:"End",A:"KeyA",C:"KeyC",D:"KeyD",V:"KeyV",X:"KeyX",Y:"KeyY",Z:"KeyZ"},My=65,Ey=67,Ly=86,Iy=68,Oy=90,By=89;function Lp(t){const{keyCode:e}=t;let i;switch(e){case My:i=V.A;break;case Ey:i=V.C;break;case Ly:i=V.V;break;case Iy:i=V.D;break;case Oy:i=V.Z;break;case By:i=V.Y;break;default:i=t.code}return i}var oc="36.2.0",Hy=':where([class^=ag-]),:where([class^=ag-]):after,:where([class^=ag-]):before{box-sizing:border-box}:where([class^=ag-]):where(button){color:inherit}:where([class^=ag-]):where(input:not([type]),input[type=text],input[type=number],input[type=tel],input[type=date],input[type=datetime-local],textarea){font-family:inherit;font-size:inherit;line-height:inherit;padding:0}:where([class^=ag-]):where(div,span,label):focus-visible{box-shadow:inset var(--ag-focus-shadow);outline:none;&:where(.invalid){box-shadow:inset var(--ag-focus-error-shadow)}}:where([class^=ag-]) ::-ms-clear{display:none}.ag-hidden{display:none!important}.ag-invisible{visibility:hidden!important}.ag-tab-guard{display:block;height:0;position:absolute;width:0}.ag-tab-guard-top{top:1px}.ag-tab-guard-bottom{bottom:1px}.ag-measurement-container{height:0;overflow:hidden;visibility:hidden;width:0}.ag-measurement-element-border{display:inline-block}.ag-measurement-element-border:before{border-left:var(--ag-internal-measurement-border);content:"";display:block}.ag-aria-description-container{border:0;clip-path:inset(50%);height:1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px;z-index:9999}.ag-popup{background-color:var(--ag-wrapper-background-color)}.ag-popup-child{max-width:min(100%,calc(100vw - 30px));top:0;z-index:5}.ag-popup-child:where(:not(.ag-tooltip-custom)){box-shadow:var(--ag-popup-shadow)}.ag-input-wrapper,.ag-picker-field-wrapper{align-items:center;display:flex;flex:1 1 auto;line-height:normal;position:relative}.ag-input-field{align-items:center;display:flex;flex-direction:row}.ag-input-field-input:where(:not([type=checkbox],[type=radio])){flex:1 1 auto;min-width:0;width:100%}.ag-styled-root{cursor:default;display:contents;line-height:normal;white-space:normal;-webkit-font-smoothing:antialiased;color:var(--ag-text-color);color-scheme:var(--ag-browser-color-scheme);font-family:var(--ag-font-family);font-size:var(--ag-font-size);font-weight:var(--ag-font-weight);--ag-indentation-level:0}:where(.ag-toolbar) .ag-react-container:where(:not(.ag-react-wrapper-block)){display:contents}:where(.ag-icon):before{align-items:center;background-color:currentcolor;color:inherit;content:"";display:flex;font-family:inherit;font-size:var(--ag-icon-size);font-style:normal;font-variant:normal;height:var(--ag-icon-size);justify-content:center;line-height:var(--ag-icon-size);-webkit-mask-size:contain;mask-size:contain;text-transform:none;width:var(--ag-icon-size)}.ag-icon{background-position:50%;background-repeat:no-repeat;background-size:contain;color:var(--ag-icon-color);display:block;height:var(--ag-icon-size);position:relative;-webkit-print-color-adjust:exact;print-color-adjust:exact;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:var(--ag-icon-size)}.ag-disabled .ag-icon,[disabled] .ag-icon{opacity:.5}.ag-icon-grip.ag-disabled,.ag-icon-grip[disabled]{opacity:.35}.ag-icon-loading{animation-duration:1s;animation-iteration-count:infinite;animation-name:spin;animation-timing-function:linear}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.ag-resizer{pointer-events:none;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:1}:where(.ag-resizer){&.ag-resizer-topLeft{cursor:nwse-resize;height:5px;left:0;top:0;width:5px}&.ag-resizer-top{cursor:ns-resize;height:5px;left:5px;right:5px;top:0}&.ag-resizer-topRight{cursor:nesw-resize;height:5px;right:0;top:0;width:5px}&.ag-resizer-right{bottom:5px;cursor:ew-resize;right:0;top:5px;width:5px}&.ag-resizer-bottomRight{bottom:0;cursor:nwse-resize;height:5px;right:0;width:5px}&.ag-resizer-bottom{bottom:0;cursor:ns-resize;height:5px;left:5px;right:5px}&.ag-resizer-bottomLeft{bottom:0;cursor:nesw-resize;height:5px;left:0;width:5px}&.ag-resizer-left{bottom:5px;cursor:ew-resize;left:0;top:5px;width:5px}}.ag-menu{background-color:var(--ag-menu-background-color);border:var(--ag-menu-border);border-radius:var(--ag-border-radius);box-shadow:var(--ag-menu-shadow);color:var(--ag-menu-text-color);max-height:100%;overflow-y:auto;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}',Ny=typeof window!="object"||!window?.document?.fonts?.forEach,Gy=!1,Hh=()=>Ny&&!0||Gy,Ss=(t,e,i,s,n,o,r=!1)=>{if(Hh())return;let l=t;s&&(l=`@layer ${CSS.escape(s).replaceAll("\\.",".")} { ${t} }`);let a=li.map.get(e);if(a||(a=[],li.map.set(e,a)),a.some(u=>u.injectedCss===l))return;const c=document.createElement("style");o&&c.setAttribute("nonce",o),c.dataset.agCss=i,c.dataset.agCssVersion=oc,c.textContent=l;const h={rawCss:t,injectedCss:l,el:c,priority:n,isParams:r};let d;for(const u of a){if(u.priority>n)break;d=u}if(d){d.el.after(c);const u=a.indexOf(d);a.splice(u+1,0,h)}else e.nodeName==="STYLE"?e.after(c):e.insertBefore(c,e.querySelector(":not(title, meta)")),a.push(h)},Ip=(t,e,i,s)=>{Ss(Hy,t,"shared",e,0,i),s?.forEach((n,o)=>n.forEach(r=>Ss(r,t,o,e,0,i)))},Wy=(t,e,i,s,n,o)=>{if(Hh())return;const r=li.grids.get(t);r?r.paramsCss=e:li.grids.set(t,{styleContainer:s,paramsCss:e}),rc(s),e&&i&&Ss(e,s,i,n,2,o,!0)},Vy=t=>{const e=li.grids.get(t)?.styleContainer;if(!e)return;li.grids.delete(t),Array.from(li.grids.values()).some(s=>s.styleContainer===e)?rc(e):(rc(e,!0),li.map.delete(e))},rc=(t,e=!1)=>{const i=new Set;for(const n of li.grids.values())n.styleContainer===t&&i.add(n.paramsCss);const s=li.map.get(t)??[];for(let n=s.length-1;n>=0;n--)(e||s[n].isParams&&!i.has(s[n].rawCss))&&(s[n].el.remove(),s.splice(n,1))},Op=()=>{const t=globalThis.agStyleInjectionVersions??(globalThis.agStyleInjectionVersions=new Map);let e=t.get(oc);return e||(e={map:new WeakMap,grids:new Map,paramsId:0},t.set(oc,e)),e},li=Op(),gi=t=>new Bp(t),Oi="$default",_y=0,Bp=class{constructor({feature:t,params:e,modeParams:i={},css:s,cssImports:n}){this.feature=t,this.css=s,this.cssImports=n,this.modeParams={[Oi]:{...i[Oi]??{},...e??{}},...i}}use(t,e,i){let s=this._inject;if(s==null){let{css:n}=this;if(n){const o=`ag-theme-${this.feature??"part"}-${++_y}`;typeof n=="function"&&(n=n()),n=`:where(.${o}) {
|
|
2
2
|
${n}
|
|
3
3
|
}
|
|
4
4
|
`;for(const r of this.cssImports??[])n=`@import url(${JSON.stringify(r)});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as W,r as s,t,j as e,a as d,C as X,X as $}from"./styles-
|
|
1
|
+
import{c as W,r as s,t,j as e,a as d,C as X,X as $}from"./styles-BlayaJti.js";import{c as G,D as J,t as Q}from"./desktop-connection-Dfaq6k5a.js";import{u as Y,a as Z,K as ee,R as te,C as ne,S as se}from"./MenuMotion-IQitGKH4.js";import{M as oe}from"./monitor-DFEzCfQk.js";import{M as ie,a as re}from"./minimize-BYscOtPM.js";import"./desktop-viewer-CF-OpSo0.js";const ae=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],le=W("clipboard",ae);function ce(u){return window.addEventListener("hashchange",u),()=>window.removeEventListener("hashchange",u)}const de=()=>location.hash;function me(){const u=s.useRef(null),o=s.useRef(null),[v,m]=s.useState(0),[x,p]=s.useState("connecting"),i=x==="connected",L=t(`desktopViewer.${x}`),[a,w]=s.useState(null),[b,S]=s.useState(!0),[f,B]=s.useState(!1),[M,P]=s.useState(""),[H,k]=s.useState(""),g=Y(a),y=Z(!b),r=g.value==="keyboard",R=s.useRef(a);R.current=a;const[j,C]=s.useState(""),O=s.useSyncExternalStore(ce,de),D=new URLSearchParams(O.slice(1)),N=D.get("target"),V=D.get("threadId");s.useEffect(()=>{k(""),C(""),w(null)},[N,V]),s.useEffect(()=>{const n=new AbortController;let l;const q=document.title;document.title=t("desktopViewer.title"),p("connecting"),G(u.current,N??"",{threadId:V,signal:n.signal,events:{connected:()=>p("connected"),disconnected:()=>p("disconnected"),clipboard:k}}).then(c=>{if(n.signal.aborted)return c.disconnect();l=c,o.current=c,c.focusOnClick=R.current===null},c=>{n.signal.aborted||p(c instanceof J&&c.invalid?"invalid":"disconnected")});const z=()=>{n.abort(),l?.disconnect()},K=c=>{c.persisted&&m(U=>U+1)};return window.addEventListener("pagehide",z),window.addEventListener("pageshow",K),()=>{z(),o.current===l&&(o.current=null),window.removeEventListener("pagehide",z),window.removeEventListener("pageshow",K),document.title=q}},[N,V,v]),s.useEffect(()=>{o.current&&(o.current.focusOnClick=a===null)},[a]),s.useEffect(()=>{const n=()=>B(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",n),()=>document.removeEventListener("fullscreenchange",n)},[]);const _=async()=>{P("");try{document.fullscreenElement?await document.exitFullscreen():await document.documentElement.requestFullscreen()}catch{P(t("desktopViewer.fullscreenFailed"))}},F=()=>{w(null),a&&document.getElementById(a)?.focus()},I=n=>requestAnimationFrame(()=>document.getElementById(n)?.focus()),T=n=>w(l=>l===n?null:n),A="transition-[width,translate,opacity] duration-[240ms] ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none",E="ui-button min-h-11 rounded-xl focus-visible:outline-2 focus-visible:outline-focus";return e.jsxs("div",{className:"relative flex h-dvh overflow-hidden bg-app text-sm text-ink",style:{paddingLeft:"env(safe-area-inset-left)",paddingRight:"env(safe-area-inset-right)"},children:[e.jsx("aside",{"aria-label":t("desktopViewer.controls"),"aria-hidden":!b,inert:!b,className:d("z-10 flex shrink-0 items-center justify-center py-3",A,b?"w-[72px]":"w-0"),children:e.jsxs("div",{className:d("flex max-h-full w-14 shrink-0 flex-col items-center gap-1 overflow-y-auto rounded-2xl border border-hairline bg-panel p-1 shadow-xl",A,b?"translate-x-0 opacity-100":"-translate-x-12 opacity-0"),children:[e.jsxs("div",{className:"relative flex h-11 w-11 shrink-0 items-center justify-center text-ink-secondary",title:L,children:[e.jsx(oe,{size:20,"aria-hidden":"true"}),e.jsx("span",{className:d("absolute right-2 bottom-2 size-2 rounded-full ring-2 ring-panel",i?"bg-success":"bg-warning")})]}),e.jsx("div",{className:"my-1 h-px w-7 shrink-0 bg-hairline"}),e.jsx(h,{id:"keyboard",label:t("desktopViewer.keyboard"),icon:ee,disabled:!i,active:a==="keyboard",expanded:a==="keyboard",onClick:()=>T("keyboard")}),e.jsx(h,{id:"clipboard",label:t("desktopViewer.clipboard"),icon:le,disabled:!i,active:a==="clipboard",expanded:a==="clipboard",onClick:()=>T("clipboard")}),document.fullscreenEnabled&&e.jsx(h,{id:"fullscreen",label:t(f?"desktopViewer.exitFullscreen":"desktopViewer.fullscreen"),icon:f?ie:re,onClick:()=>{_()}}),e.jsx("div",{className:"my-1 h-px w-7 shrink-0 bg-hairline"}),e.jsx(h,{id:"retry",label:t("desktopViewer.reconnect"),icon:te,onClick:()=>{k(""),m(n=>n+1)}}),e.jsx(h,{id:"hide-controls",label:t("desktopViewer.hideControls"),icon:X,onClick:()=>{S(!1),w(null),I("show-controls")}})]})}),y.shown&&e.jsx("div",{...y.exitProps,className:d("absolute left-0 top-1/2 z-10 -translate-y-1/2 rounded-r-2xl border border-l-0 border-hairline bg-panel p-1 shadow-xl",y.className),children:e.jsx(h,{id:"show-controls",label:t("desktopViewer.showControls"),icon:ne,onClick:()=>{S(!0),I("hide-controls")}})}),e.jsxs("main",{className:d("relative flex min-w-0 flex-1 items-center justify-center overflow-hidden bg-inset",!f&&"my-2 mr-2 rounded-2xl border border-hairline",!f&&!b&&"ml-2"),children:[e.jsx("div",{id:"screen",ref:u,role:"application","aria-label":t("desktopViewer.title"),className:d("overflow-hidden",f?"h-full w-full":"h-[95%] w-[95%]")}),e.jsx("div",{className:i?"sr-only":"pointer-events-none absolute inset-x-3 top-3 flex justify-center",children:e.jsx("span",{id:"status",role:"status",className:"max-w-full rounded-full border border-hairline bg-panel/95 px-3 py-1.5 text-center text-xs text-ink-secondary shadow-sm",children:L})}),M&&e.jsx("p",{role:"alert",className:"absolute inset-x-3 bottom-3 rounded-xl border border-hairline bg-panel p-3 text-ink",children:M})]}),e.jsx("a",{id:"viewer-notice",href:"/novnc-NOTICE.txt",target:"_blank",rel:"license noopener noreferrer",title:t("desktopViewer.notice"),"aria-label":t("desktopViewer.notice"),className:"absolute bottom-2 right-2 z-10 flex min-h-6 w-11 items-center justify-center rounded-lg bg-app/80 text-[10px] text-ink-secondary hover:text-ink hover:underline",style:{marginRight:"env(safe-area-inset-right)",marginBottom:"env(safe-area-inset-bottom)"},children:"noVNC"}),g.shown&&e.jsxs("section",{...g.exitProps,"aria-label":t(r?"desktopViewer.keyboard":"desktopViewer.clipboard"),onKeyDown:n=>{n.key==="Escape"&&(n.stopPropagation(),F())},className:d("absolute left-[72px] top-1/2 z-20 max-h-[calc(100dvh-24px)] w-[min(320px,calc(100%-84px))] -translate-y-1/2 overflow-y-auto rounded-2xl border border-hairline bg-panel p-4 shadow-2xl",g.className),style:{marginLeft:"env(safe-area-inset-left)"},children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between gap-2",children:[e.jsx("h1",{className:"font-medium",children:t(r?"desktopViewer.keyboard":"desktopViewer.clipboard")}),e.jsx("button",{type:"button",title:t("desktopViewer.closePanel"),"aria-label":t("desktopViewer.closePanel"),onClick:F,className:"ui-icon-button shrink-0",children:e.jsx($,{size:18,"aria-hidden":"true"})})]}),e.jsxs("form",{onSubmit:n=>{n.preventDefault(),!(!o.current||!i||!r)&&(Q(o.current,j),C(""))},children:[e.jsx("label",{className:"mb-2 block text-xs leading-relaxed text-ink-secondary",htmlFor:r?"text":"clipboard-text",children:t(r?"desktopViewer.text":"desktopViewer.clipboardHint")}),e.jsx("textarea",{id:r?"text":"clipboard-text",className:"w-full resize-y rounded-xl border border-hairline bg-inset p-3 text-base text-ink outline-none focus:border-focus",rows:4,maxLength:r?4096:65536,autoComplete:"off",autoCapitalize:"off",spellCheck:!1,value:r?j:H,disabled:!r&&!i,onChange:n=>{const l=n.target.value;r?C(l):(k(l),i&&o.current?.clipboardPasteFrom(l))}}),r&&e.jsxs("button",{id:"send",type:"submit",className:"mt-3 flex min-h-11 w-full items-center justify-center gap-2 rounded-xl bg-accent px-3 font-medium text-accent-ink transition-opacity hover:opacity-90 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus disabled:opacity-40",disabled:!i||!j,children:[e.jsx(se,{size:16,"aria-hidden":"true"}),t("desktopViewer.send")]})]}),r&&e.jsxs("div",{className:"mt-4 grid grid-cols-2 gap-2 border-t border-hairline pt-4",children:[e.jsx("button",{className:E,disabled:!i,onClick:()=>o.current?.sendKey(65289,"Tab"),children:t("desktopViewer.keyTab")}),e.jsx("button",{className:E,disabled:!i,onClick:()=>o.current?.sendKey(65307,"Escape"),children:t("desktopViewer.keyEscape")}),e.jsx("button",{id:"ctrl-alt-del",className:d(E,"col-span-2"),disabled:!i,onClick:()=>o.current?.sendCtrlAltDel(),children:t("desktopViewer.keyCtrlAltDel")})]})]})]})}function h({id:u,label:o,icon:v,disabled:m,active:x,expanded:p,onClick:i}){return e.jsx("button",{id:u,type:"button",title:o,"aria-label":o,"aria-pressed":x,"aria-expanded":p,disabled:m,onClick:i,className:d("ui-icon-button size-11 min-h-11 shrink-0 rounded-xl focus-visible:outline-2 focus-visible:outline-focus",x?"bg-accent/15 text-accent-text hover:bg-accent/25":"text-ink-secondary hover:bg-raised-hover hover:text-ink"),children:e.jsx(v,{size:19,strokeWidth:1.75,"aria-hidden":"true"})})}export{me as DesktopViewer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as e,t,r as m,a as j,b as D}from"./styles-
|
|
1
|
+
import{j as e,t,r as m,a as j,b as D}from"./styles-BlayaJti.js";import{u as $,r as A,E as R,M as I}from"./PlacesRail-v1XIqiBG.js";import{c as K,F as L,u as M,b as H,S as U,C as S,d as _}from"./App-DFjF9FvF.js";import"./monitor-DFEzCfQk.js";import"./index-CwYJ9TX8.js";import"./MenuMotion-IQitGKH4.js";const G={"too-broad":"files.refusal.tooBroad","app-data":"files.refusal.appData","already-shared":"files.refusal.alreadyShared","not-a-folder":"files.refusal.notAFolder",private:"files.refusal.private"},z={type:"toggleAppSettings",open:!0,section:"cloudAccount"},y=s=>new Intl.NumberFormat(D()).format(s),N=s=>{const i=s>=1073741824?3:s>=1048576?2:1;return`${new Intl.NumberFormat(D(),{maximumFractionDigits:i===3?1:0}).format(s/1024**i)} ${["","KB","MB","GB"][i]}`};function F(s){return`${s.partial?t("files.countMore",{count:y(s.files)}):s.files===1?t("files.countOne"):t("files.count",{count:y(s.files)})} · ${N(s.bytes)}`}function E(s,i=!1){return t(i&&s==="not-a-folder"?"files.refusal.notAFolderListed":G[s]??"files.refusal.other")}const W=10080*6e4;function V(s,i=Date.now()){const o=s.kept?.[0];return o&&i-o.at<W&&(s.status==="synced"||s.status==="copying")?t("files.status.keptBoth",{file:o.path,copy:o.beside}):s.status==="copying"?t("files.status.copying",{done:y(s.done),files:y(s.files)}):s.status==="confirm-deletes"?t(s.pendingDeletes===1?"files.status.deletesOne":"files.status.deletes",{count:y(s.pendingDeletes)}):s.status==="problem"?s.problem||t("files.status.problem"):t(s.status==="waiting"?"files.status.waiting":s.status==="missing"?"files.status.missing":"files.status.synced")}function C(s){const o=(s instanceof Error?s.message:String(s??"")).replace(/^Error invoking remote method '[^']*': (?:\w*Error: )?/,"").split(`
|
|
2
2
|
`)[0].trim();return o?t("files.failedWith",{reason:o}):t("files.failed")}function ne(){const{dragProps:s}=$(),i=K();return e.jsxs("main",{className:"flex min-w-0 flex-1 flex-col overflow-hidden bg-app text-ink",children:[e.jsxs("header",{...s,className:"flex shrink-0 items-center gap-2.5 border-b border-hairline/40 px-6 py-4 max-md:pl-12",children:[e.jsx(L,{size:18,className:"text-ink-secondary"}),e.jsx("h1",{className:"text-[17px] font-semibold",children:t("files.title")})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-8 px-6 py-6",children:i?e.jsx(q,{bridge:i}):e.jsx(O,{})})})]})}function O(){const{dispatch:s}=M();return e.jsxs("div",{className:"flex flex-col items-start gap-3",children:[e.jsx("p",{className:"text-[14px] text-ink",children:t("files.unavailable")}),e.jsx("button",{type:"button",className:"ui-button",onClick:()=>s(z),children:t("files.openSettings")})]})}function q({bridge:s}){const{state:i,dispatch:o}=M(),[n,u]=H(s),[a,c]=m.useState(null),[p,d]=m.useState(!1),[f,x]=m.useState(null),w=i.filesSuggest,k=n!==null&&n.phase!=="unavailable";m.useEffect(()=>{if(!k||!w)return;let l=!0;return s.checkFolders(w).then(r=>{l&&r.length&&c({kind:"suggest",checks:r,chosen:r.filter(g=>!g.refusal).map(g=>g.token)})}).catch(r=>{l&&x(C(r))}),()=>{l=!1}},[s,w,k]);const b=async l=>{d(!0),x(null);try{const r=await l();r&&u(r)}catch(r){x(C(r))}finally{d(!1)}},h=()=>c(null),v=l=>{h(),b(async()=>{let r;for(const g of l)r=await s.share(g);return r})},P=()=>{b(()=>s.moreSpace())};return n?n.phase==="unavailable"?e.jsx(O,{}):e.jsxs(e.Fragment,{children:[(n.phase==="offline"||n.phase==="asleep")&&e.jsx("p",{role:"status","data-files-phase":n.phase,className:"rounded-xl bg-card px-4 py-3 text-[13px] text-ink-secondary",children:t(n.phase==="asleep"?"files.asleep":"files.offline")}),n.phase==="signed-out"&&e.jsxs("div",{role:"status",className:"flex flex-wrap items-center justify-between gap-3 rounded-xl bg-card px-4 py-3",children:[e.jsx("p",{className:"text-[13px] text-ink",children:t("files.signedOut")}),e.jsx("button",{type:"button",className:"ui-button",onClick:()=>o(z),children:t("files.openSettings")})]}),f&&e.jsx("p",{role:"alert",className:"text-[13px] text-danger",children:f}),e.jsxs("section",{"aria-labelledby":"files-shared",className:"flex flex-col gap-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"files-shared",className:"text-[15px] font-medium text-ink",children:t("files.shared.title")}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:t("files.shared.help")})]}),n.shared.length>0?e.jsx("ul",{className:"flex flex-col divide-y divide-hairline/40 rounded-xl bg-card",children:n.shared.map(l=>e.jsx(J,{folder:l,bridge:s,busy:p,run:b,onStop:()=>c({kind:"stop",folder:l})},l.id))}):e.jsx("p",{className:"text-[13px] text-ink-secondary",children:t("files.empty")}),e.jsx("button",{type:"button",disabled:p,className:"ui-button self-start",onClick:()=>{b(async()=>{const l=await s.pickFolder();l&&c({kind:"share",check:l})})},children:t("files.add")}),n.disk&&e.jsx(X,{disk:n.disk,busy:p,onMore:P})]}),e.jsxs("section",{"aria-labelledby":"files-outputs",className:"flex flex-col gap-3",children:[e.jsx("h2",{id:"files-outputs",className:"text-[15px] font-medium text-ink",children:t("files.outputs.title")}),e.jsxs("div",{className:"flex flex-col items-start gap-3 rounded-xl bg-card p-4",children:[e.jsxs("div",{className:"flex w-full items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{id:"files-outputs-switch",className:"text-[14px] text-ink",children:t("files.outputs.switch")}),e.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:t("files.outputs.help")})]}),e.jsx(U,{checked:n.outputs.enabled,disabled:p,"aria-labelledby":"files-outputs-switch",onClick:()=>{b(()=>s.setOutputs(!n.outputs.enabled))}})]}),n.outputs.problem&&e.jsx("p",{className:"text-[12px] text-danger",children:n.outputs.problem}),n.outputs.enabled&&e.jsx("button",{type:"button",className:"ui-button",onClick:()=>{b(()=>s.open({outputs:!0}))},children:t("files.outputs.open")})]})]}),a?.kind==="share"&&(a.check.refusal?e.jsx(B,{label:E(a.check.refusal),onClose:h,actions:e.jsx("button",{type:"button",autoFocus:!0,className:"ui-button ui-button-primary",onClick:h,children:t("files.ok")})}):e.jsx(S,{open:!0,tone:"neutral",icon:e.jsx(L,{size:18}),title:t("files.share.title",{name:a.check.name}),body:t("files.share.body",{size:F(a.check)}),confirmLabel:t("files.share.confirm"),onCancel:h,onConfirm:()=>v([a.check.token])})),a?.kind==="stop"&&e.jsx(S,{open:!0,title:t("files.stop.title",{name:a.folder.name}),body:t("files.stop.body"),confirmLabel:t("files.stop"),onCancel:h,onConfirm:()=>{h(),b(()=>s.stopSharing(a.folder.id))}}),a?.kind==="suggest"&&e.jsxs(B,{label:t("files.suggest.title"),onClose:h,actions:e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",autoFocus:!0,className:"ui-button",onClick:h,children:t("files.cancel")}),e.jsx("button",{type:"button",disabled:!a.chosen.length,className:"ui-button ui-button-primary",onClick:()=>v(a.chosen),children:t("files.share.confirm")})]}),children:[e.jsx("p",{className:"mt-1.5 text-[13px] leading-relaxed text-ink-secondary",children:t("files.suggest.body")}),e.jsx("ul",{className:"mt-3 flex max-h-72 flex-col gap-1 overflow-y-auto",children:a.checks.map((l,r)=>e.jsx("li",{children:e.jsxs("label",{className:j("flex items-start gap-3 rounded-lg px-2 py-2",l.refusal&&"opacity-50"),children:[e.jsx("input",{type:"checkbox",className:"mt-1",disabled:!!l.refusal,checked:!l.refusal&&a.chosen.includes(l.token),onChange:g=>c({...a,chosen:g.target.checked?[...a.chosen,l.token]:a.chosen.filter(T=>T!==l.token)})}),e.jsxs("span",{className:"flex min-w-0 flex-col",children:[e.jsx("span",{className:"truncate text-[14px] text-ink",title:l.pcPath,children:l.name}),e.jsx("span",{className:"text-[12px] text-ink-secondary",children:l.refusal?E(l.refusal,!0):F(l)})]})]})},`${r}:${l.pcPath}`))})]})]}):null}function J({folder:s,bridge:i,busy:o,run:n,onStop:u}){const a=(p,d,f=!1)=>e.jsx("button",{type:"button",disabled:o,className:j("ui-button ui-button-sm",f&&"ui-button-primary"),onClick:d,children:p}),c=s.status==="waiting"?a(t("files.moreSpace"),()=>{n(()=>i.moreSpace())}):s.status==="confirm-deletes"?e.jsxs(e.Fragment,{children:[a(t("files.deletes.remove"),()=>{n(()=>i.answerDeletes(s.id,!0))}),a(t("files.deletes.keep"),()=>{n(()=>i.answerDeletes(s.id,!1))})]}):s.status==="missing"?e.jsxs(e.Fragment,{children:[a(t("files.locate"),()=>{n(()=>i.locate(s.id))},!0),a(t("files.stop"),u)]}):null;return e.jsxs("li",{"data-files-folder":s.status,className:"flex items-start gap-3 px-4 py-3",children:[e.jsx(_,{size:18,className:"mt-0.5 shrink-0 text-ink-secondary"}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[e.jsx("span",{className:"truncate text-[14px] text-ink",title:s.pcPath,children:s.name}),e.jsx("span",{className:j("text-[12px]",s.status==="problem"||s.status==="missing"?"text-danger":"text-ink-secondary"),children:V(s)}),c&&e.jsx("div",{className:"mt-1.5 flex flex-wrap gap-2",children:c})]}),e.jsx(Q,{name:s.name,busy:o,onOpen:()=>{n(()=>i.open({folderId:s.id}))},onStop:u})]})}function Q({name:s,busy:i,onOpen:o,onStop:n}){const[u,a]=m.useState(!1),c=m.useRef(null);m.useEffect(()=>{if(!u)return;const d=x=>{x.key==="Escape"&&(x.stopPropagation(),a(!1))},f=x=>{x.target instanceof Node&&!c.current?.contains(x.target)&&a(!1)};return window.addEventListener("keydown",d,!0),window.addEventListener("pointerdown",f),()=>{window.removeEventListener("keydown",d,!0),window.removeEventListener("pointerdown",f)}},[u]);const p=(d,f,x=!1)=>e.jsx("button",{type:"button",role:"menuitem",disabled:i,className:j("ui-menu-row w-full text-left",x?"text-danger":"text-ink"),onClick:()=>{a(!1),f()},children:d});return e.jsxs("div",{ref:c,className:"relative shrink-0",children:[e.jsx("button",{type:"button","aria-haspopup":"menu","aria-expanded":u,"aria-label":t("files.more",{name:s}),className:"ui-icon-button hover:bg-control hover:text-ink",onClick:()=>a(d=>!d),children:e.jsx(R,{size:16})}),u&&e.jsxs("div",{role:"menu",className:j("absolute right-0 top-full z-40 mt-1 w-[220px] overflow-hidden text-[13px]",I),children:[p(t("files.openHere"),o),p(t("files.stop"),n,!0)]})]})}function X({disk:s,busy:i,onMore:o}){const n=s.totalBytes>0?Math.min(100,Math.round(s.usedBytes/s.totalBytes*100)):0;return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[12px] text-ink-secondary",children:t("files.storage",{used:N(s.usedBytes),total:N(s.totalBytes)})}),e.jsx("div",{className:"h-1 w-full overflow-hidden rounded-full bg-control","aria-hidden":"true",children:e.jsx("div",{className:j("h-full rounded-full",s.warn?"bg-warning":"bg-accent"),style:{width:`${n}%`}})}),s.warn&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"text-[12px] text-warning",children:t("files.almostFull")}),e.jsx("button",{type:"button",disabled:i,className:"ui-button ui-button-sm",onClick:o,children:t("files.moreSpace")})]})]})}function B({label:s,children:i,actions:o,onClose:n}){const u=m.useRef(n);return u.current=n,m.useEffect(()=>{const a=c=>{c.key==="Escape"&&(c.preventDefault(),u.current())};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[]),A.createPortal(e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/55 p-6",onMouseDown:a=>a.target===a.currentTarget&&n(),children:e.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"files-dialog-label",className:"w-full max-w-[440px] rounded-2xl border border-hairline/50 bg-panel p-5 shadow-2xl",children:[e.jsx("h2",{id:"files-dialog-label",className:"text-[15px] font-semibold text-ink",children:s}),i,e.jsx("div",{className:"mt-5 flex justify-end gap-2",children:o})]})}),document.body)}export{ne as FilesView,C as failureText,F as folderSize,V as folderStatus,E as refusalText};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as c,r as y,j as
|
|
1
|
+
import{t as c,r as y,j as i,X as ke,a as G,f as xe}from"./styles-BlayaJti.js";import{L as ye,x as be,C as ve,y as we}from"./PlacesRail-v1XIqiBG.js";import{t as je,a as Me}from"./import-name-DA_MmEsd.js";import{bc as ue,bd as Ne,be as ee,bf as Ee,bg as Ae,bh as Se,B as _e,n as q,u as Oe,bi as $e}from"./App-DFjF9FvF.js";import{A as Ce,u as T,S as te,b as Le,a as Re,P as Ie,c as Te}from"./package-format-Cn4nABBW.js";import{F as Fe}from"./file-up-Bl7ViNTL.js";import"./monitor-DFEzCfQk.js";import"./index-CwYJ9TX8.js";import"./MenuMotion-IQitGKH4.js";const de="grok-bot-export",Pe="openmaus.grok/1",me=4*1024*1024,Be=50,ne=["green","blue","red","orange","purple","cyan","pink","yellow","teal","coral"],Ge=50,ze=`I'm moving to another assistant and need a complete, machine-readable copy of your setup. Do not change, pause or delete anything.
|
|
2
2
|
|
|
3
3
|
Write one JSON document with exactly this shape, then save it as grok-bot-export-<your name>.json (your name in lowercase, spaces as hyphens): in my Downloads folder if you can write to my computer, otherwise in your workspace, and attach it to your reply. If you cannot attach files, put the whole document in a single \`\`\`json code block instead.
|
|
4
4
|
|
|
@@ -41,7 +41,7 @@ description: ${Ee(r)}
|
|
|
41
41
|
---
|
|
42
42
|
|
|
43
43
|
${o}
|
|
44
|
-
`;if(T(l)>Ae)return null;const u=ee(l);return"error"in u||u.description!==r?null:{name:t,description:r,instructions:l}}const tt=/key|token|secret|pass|auth|sig|session|credential/i,nt=/^(?=.*\d)(?=.*[a-zA-Z])[A-Za-z0-9_-]{24,}$/;function st(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!=="https:")return null;t.username="",t.password="";for(const o of Array.from(t.searchParams.keys()))tt.test(o)&&t.searchParams.delete(o);const s=t.toString();return/«redacted|%C2%ABredacted/i.test(s)||ue(s)!==s||t.pathname.split("/").some(o=>nt.test(o))?null:s}const ot=/^[!#$%&'*+.^_`|~0-9A-Za-z-]{1,128}$/,
|
|
44
|
+
`;if(T(l)>Ae)return null;const u=ee(l);return"error"in u||u.description!==r?null:{name:t,description:r,instructions:l}}const tt=/key|token|secret|pass|auth|sig|session|credential/i,nt=/^(?=.*\d)(?=.*[a-zA-Z])[A-Za-z0-9_-]{24,}$/;function st(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!=="https:")return null;t.username="",t.password="";for(const o of Array.from(t.searchParams.keys()))tt.test(o)&&t.searchParams.delete(o);const s=t.toString();return/«redacted|%C2%ABredacted/i.test(s)||ue(s)!==s||t.pathname.split("/").some(o=>nt.test(o))?null:s}const ot=/^[!#$%&'*+.^_`|~0-9A-Za-z-]{1,128}$/,ie="memory/grok-bot-event-routines.md",rt=e=>e.replace(/\s+/g," ").trim().toLowerCase(),ae=(e,t)=>e.filter(s=>{const n=rt(s);return t.has(n)?!1:(t.add(n),!0)});function it(e){const t=new Set,s=ae(e.memories.map(l=>l.replace(/\s*\n\s*/g," ")),t),n=ae(e.userFacts.map(l=>l.replace(/\s*\n\s*/g," ")),t),o=s.length+n.length;if(!o)return{count:o,text:null};const r=(l,u)=>u.length?`## ${l}
|
|
45
45
|
|
|
46
46
|
${u.map(m=>`- ${m}`).join(`
|
|
47
47
|
`)}
|
|
@@ -49,8 +49,8 @@ ${u.map(m=>`- ${m}`).join(`
|
|
|
49
49
|
`:"";return{count:o,text:`# Notes from Grok Bot
|
|
50
50
|
|
|
51
51
|
${r("What I remember",s)}${r("About the person",n)}`.trimEnd()+`
|
|
52
|
-
`}}function
|
|
53
|
-
`)}function lt(e,t={}){const s=t.timeZone?.trim()||"UTC",n=v(e.name||"Grok Bot",100),o=J(n,60)||"grok-bot",r=qe(e.instructions.trim(),_e.soul),l=new Set,u=new Map,m=[],N=[];for(const[f,
|
|
52
|
+
`}}function at(e,t){const s=t.flatMap(n=>[`## ${n.name||"routine"}`,"",`- Trigger: ${n.trigger||"unknown"}`,`- Details: ${n.details||n.when||"n/a"}`,"",n.instruction,""]);return[`# ${e}: Grok Bot routines that run on an event`,"","These start on something happening instead of a schedule, so they were not turned into routines. Set up each one again here.","",...s].join(`
|
|
53
|
+
`)}function lt(e,t={}){const s=t.timeZone?.trim()||"UTC",n=v(e.name||"Grok Bot",100),o=J(n,60)||"grok-bot",r=qe(e.instructions.trim(),_e.soul),l=new Set,u=new Map,m=[],N=[];for(const[f,a]of e.skills.entries()){if(m.length>=Ce||!a.instructions.trim())continue;const p=et(a,X(a.name,`skill-${f+1}`,l));p&&(m.push(p),u.set(a.name.trim().toLowerCase(),p.name),N.push({folder:p.name,name:$(a.name)||String(f+1),on:Ne(p.instructions).length===0}))}const E=new Set,d=new Set,w=[],k=[];for(const[f,a]of e.routines.entries()){if(!a.instruction)continue;const p=Qe(a,s);if(!p){k.push(a);continue}if(w.length>=Be)continue;const b=$(a.name)||"routine",h=v(`${n}: ${b}`,74);let S=h;for(let B=2;d.has(S);B+=1)S=`${h} (${B})`;d.add(S);const Q=a.skills.flatMap(B=>u.get(B.toLowerCase())??[]);w.push({key:X(b,`routine-${f+1}`,E),name:S,agent:o,prompt:`${a.instruction}${Q.length?`
|
|
54
54
|
|
|
55
|
-
Use these skills: ${Q.join(", ")}.`:""}`.slice(0,2e4),runOn:"maus",schedule:p,durationMinutes:30,enabledAfterInstall:!1})}const _=
|
|
56
|
-
${r}`),I=`${o}-${R.toString(16).padStart(8,"0").slice(0,6)}`,U={format:Te,version:Ie,package:{id:I,release:"1.0.0",name:n,tagline:v($(L),160),summary:L,category:"Imported",author:{name:"Grok Bot"},license:"See source",outcomes:[v(`${n} runs in Limix Bot with your own engine and apps.`,240)],setupMinutes:5,requirements:{apps:[],capabilities:[]},team:{name:v(n,60)},agents:[{key:o,name:n,...e.title?{title:v(e.title,200)}:{},...C?{description:v(C,4e3)}:{},...r?{soul:r}:{},appearance:{color:ne[R%ne.length]},...m.length?{skills:m.map(f=>f.name)}:{},...j.length?{connections:j.map(f=>f.key)}:{},...Object.keys(x).length?{seed:{memory:x}}:{}}],...w.length?{routines:w}:{},...j.length?{connections:j}:{},...m.length?{skills:{version:1,entries:m}}:{}}};let P;try{P=Re(U,{trust:"file"})}catch{throw new O("unusable")}return{name:n,packageId:I,document:P,skills:N,routines:w.length,notes:x[ae]?k.length:0,memories:x["MEMORY.md"]?_.count:0,apps:A}}const fe={files:[],bots:[]};function ct(){return q("/api/setup-import/grok",{timeoutMs:1e4}).then(e=>({files:Array.isArray(e?.files)?e.files:[],bots:Array.isArray(e?.bots)?e.bots:[]}),()=>fe)}function he(e){return e instanceof O?c(`grokMove.error.${e.code}`,{keys:e.keys.join(", ")}):e instanceof Error?e.message:String(e)}function ut(e){const t=[],s=[...e].sort((n,o)=>n.modifiedAt-o.modifiedAt).flatMap(n=>{try{return V(n.text)}catch(o){return t.push({file:n.name,error:he(o)}),[]}});return{bots:pe(s),refused:t}}function dt(e,t){const s=new Set(t.bots.flatMap(l=>l.installedPackage?.id??[])),n=new Set(t.bots.map(l=>l.name.trim().toLowerCase())),o=new Set(t.servers),r={plans:[],moved:[],unreadable:[]};for(const l of e)try{const u=lt(l,{timeZone:t.timeZone,takenServers:o});if(s.has(u.packageId)){r.moved.push(u.name);continue}for(const m of u.document.package.connections??[])o.add(m.key);r.plans.push({...u,addedAs:je(u.name,n)})}catch{r.unreadable.push(l.name)}return r}async function mt(e,t){const s={bots:[],moved:e.moved,unreadable:e.unreadable,failed:[]};for(const n of e.plans)try{const o=(await Me(n.document,t)).first;if(!o)throw new Error("no bot");const r=[];for(const l of n.skills)l.on&&await q(`/api/bots/${o.id}/skills/${encodeURIComponent(l.folder)}`,{method:"PATCH",body:JSON.stringify({enabled:!0})}).then(()=>!0,()=>!1)||r.push(l.name);s.bots.push({name:o.name,skills:n.skills.length,skillsOff:r,routines:n.routines,notes:n.notes,memories:n.memories,apps:n.apps})}catch{s.failed.push(n.name)}return s}const D="ui-button ui-button-primary min-h-9 px-4 text-[14px]",K="ui-button min-h-9 px-4 text-[14px]",ge="text-[13px] leading-relaxed text-ink-secondary";function le({heading:e,skills:t,routines:s,memories:n,notes:o,skillsOff:r}){const l=[[c("grokMove.count.skills"),t],[c("grokMove.count.routines"),s],[c("grokMove.count.memories"),n],[c("grokMove.count.notes"),o]];return a.jsxs("section",{"data-grok-move-bot":!0,className:"flex flex-col gap-1.5",children:[a.jsx("h3",{className:"break-words text-[15px] font-semibold text-ink",children:e}),a.jsx("dl",{className:"flex flex-col gap-1 text-[14px]",children:l.filter(([,u])=>u>0).map(([u,m])=>a.jsxs("div",{className:"flex items-baseline justify-between gap-4",children:[a.jsx("dt",{className:"text-ink-secondary",children:u}),a.jsx("dd",{className:"tabular-nums text-ink",children:m})]},u))}),r.length>0&&a.jsx("p",{className:ge,children:c("grokMove.skillsOff",{names:r.join(", ")})})]})}function ce({paused:e,files:t=null,apps:s,moved:n,unreadable:o,failed:r=[]}){const l=[e,t,s===1?c("grokMove.appsOne"):s>1?c("grokMove.appsMany",{count:s}):null,n.length?c("grokMove.alreadyHere",{names:n.join(", ")}):null,o.length?c("grokMove.unreadable",{names:o.join(", ")}):null,r.length?c("grokMove.notAdded",{names:r.join(", ")}):null].filter(u=>u!==null);return l.length>0&&a.jsx("div",{className:"flex flex-col gap-1",children:l.map(u=>a.jsx("p",{className:ge,children:u},u))})}function pt({local:e,look:t,found:s,reply:n,error:o,onReply:r,onFile:l,onFound:u}){const m=y.useRef(null),{state:N,copy:E}=ve(ze);return a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:c("grokMove.intro")}),a.jsxs("section",{className:"flex flex-col items-start gap-1.5",children:[a.jsx("h3",{className:"text-[14px] font-medium text-ink",children:c("grokMove.step1")}),a.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:c("grokMove.step1Hint")}),e&&t.bots.length>0&&a.jsx("p",{"data-grok-move-roster":!0,className:"text-[13px] text-ink-secondary",children:c("grokMove.roster",{names:t.bots.join(", ")})}),a.jsxs("button",{type:"button","data-grok-move-copy":!0,onClick:E,className:G(K,"mt-1 inline-flex items-center gap-2"),children:[N==="copied"?a.jsx(xe,{size:15}):a.jsx(we,{size:15}),N==="copied"?c("grokMove.copied"):N==="failed"?c("grokMove.copyFailed"):c("grokMove.copy")]})]}),a.jsxs("section",{className:"flex flex-col gap-1.5",children:[a.jsx("h3",{className:"text-[14px] font-medium text-ink",children:c("grokMove.step2")}),a.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:c("grokMove.step2Hint")}),s.bots.length>0&&a.jsxs("div",{"data-grok-move-found":!0,className:"mt-1 flex items-center justify-between gap-3 rounded-xl border border-accent/40 bg-accent/[0.06] px-3 py-2",children:[a.jsx("span",{className:"min-w-0 break-words text-[13px] text-ink",children:c("grokMove.found",{names:s.bots.map(d=>d.name).join(", ")})}),a.jsx("button",{type:"button","data-grok-move-use-found":!0,onClick:u,className:G(D,"shrink-0"),children:c("grokMove.useFound")})]}),s.refused.map(d=>a.jsx("p",{role:"alert",className:"text-[13px] leading-relaxed text-danger",children:c("grokMove.refused",{file:d.file,reason:d.error})},d.file)),a.jsx("textarea",{value:n,onChange:d=>r(d.target.value),rows:4,"aria-label":c("grokMove.replyLabel"),placeholder:c("grokMove.replyPlaceholder"),className:"mt-1 w-full resize-y rounded-xl border border-hairline/40 bg-inset px-3 py-2.5 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"}),o&&a.jsx("p",{role:"alert",className:"text-[13px] leading-relaxed text-danger",children:o}),a.jsxs("div",{children:[a.jsxs("button",{type:"button",onClick:()=>m.current?.click(),className:G(K,"inline-flex items-center gap-2"),children:[a.jsx(Fe,{size:15}),c("grokMove.chooseFile")]}),a.jsx("input",{ref:m,type:"file",accept:".json,.md,.txt,application/json,text/plain,text/markdown",className:"hidden",onChange:d=>{l(d.target.files?.[0]),d.target.value=""}})]})]})]})}function jt({onClose:e,inline:t=!1}){const{state:s,dispatch:n}=Oe(),o=$e(s.config?.cloudHome===!0),[r,l]=y.useState(fe),[u,m]=y.useState(""),[N,E]=y.useState(""),[d,w]=y.useState(null),[k,_]=y.useState(null),[x,F]=y.useState(!1),j=y.useRef(null),A=y.useCallback(()=>{o&&ct().then(l)},[o]);y.useEffect(()=>(A(),window.addEventListener("focus",A),()=>window.removeEventListener("focus",A)),[A]),y.useEffect(()=>j.current?.focus({preventScroll:!0}),[d,k]);const C=y.useMemo(()=>ut(r.files),[r.files]),L=async i=>{try{const p=i(),b=await q("/api/mcp/servers").then(h=>h.servers??[],()=>[]);w(dt(p,{bots:s.bots,servers:new Set(b.map(h=>h.name)),timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone})),E("")}catch(p){E(he(p))}},R=y.useRef(()=>{});R.current=i=>{if(i){if(i.size>me)return E(c("grokMove.error.tooLarge"));i.text().then(p=>L(()=>V(p)))}};const I=!d&&!k;y.useEffect(()=>{const i=h=>{h.stopPropagation(),h.preventDefault()},b=[["dragenter",i],["dragover",i],["dragleave",i],["drop",h=>{i(h),I&&R.current(h.dataTransfer?.files[0])}]];for(const[h,S]of b)window.addEventListener(h,S,!0);return()=>{for(const[h,S]of b)window.removeEventListener(h,S,!0)}},[I]);const U=async()=>{if(!d)return;F(!0);const i=await mt(d,n);ye("team_imported",{members:d.plans.length,source:"grok",mode:"add",format:"package"}),_(i),w(null),F(!1)},P=()=>{_(null),m(""),E(""),A()},f=a.jsxs("div",{ref:j,tabIndex:-1,...t?{}:{role:"dialog","aria-modal":!0,"aria-labelledby":"grok-move-title"},"data-grok-move":k?"report":d?"preview":"start",onKeyDown:i=>{t||i.key!=="Escape"||x||(i.preventDefault(),i.stopPropagation(),d?w(null):e())},className:t?"mt-3 flex flex-col rounded-lg border border-hairline/40 text-left outline-none":"ui-modal animate-pop-in flex max-h-[min(720px,calc(100dvh-32px))] w-[560px] max-w-full flex-col overflow-hidden text-left outline-none",children:[(!t||d)&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex h-[52px] shrink-0 items-center justify-between pl-4 pr-3",children:[a.jsx("h2",{id:"grok-move-title",className:"text-[14px] font-semibold leading-[22px] text-ink",children:d?c("grokMove.previewTitle"):c("settings.import.grokTitle")}),!t&&a.jsx("button",{type:"button",disabled:x,onClick:e,"aria-label":c("common.close"),title:c("common.close"),className:"flex size-7 items-center justify-center rounded-full text-ink-secondary transition-colors hover:bg-ink/[0.06] hover:text-ink disabled:opacity-40",children:a.jsx(ke,{size:16})})]}),a.jsx("div",{className:"ui-modal-divider shrink-0"})]}),a.jsx("div",{"data-grok-move-body":!0,className:"flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto p-4 [scrollbar-width:thin]",children:k?a.jsxs(a.Fragment,{children:[k.bots.map(i=>a.jsx(le,{heading:c("grokMove.isHere",{name:i.name}),...i},i.name)),a.jsx(ce,{paused:k.bots.some(i=>i.routines>0)?c("grokMove.pausedReport"):null,files:c("grokMove.filesStay"),apps:k.bots.reduce((i,p)=>i+p.apps,0),moved:k.moved,unreadable:k.unreadable,failed:k.failed})]}):d?a.jsxs(a.Fragment,{children:[d.plans.map(i=>a.jsx(le,{heading:i.addedAs,skills:i.skills.length,routines:i.routines,memories:i.memories,notes:i.notes,skillsOff:i.skills.filter(p=>!p.on).map(p=>p.name)},i.packageId)),a.jsx(ce,{paused:d.plans.some(i=>i.routines>0)?c("grokMove.pausedPreview"):null,apps:d.plans.reduce((i,p)=>i+p.apps,0),moved:d.moved,unreadable:d.unreadable})]}):a.jsx(pt,{local:o,look:r,found:C,reply:u,error:N,onReply:m,onFile:i=>R.current(i),onFound:()=>{L(()=>C.bots)}})},k?"report":d?"preview":"start"),a.jsx("div",{className:"ui-modal-divider shrink-0"}),a.jsx("div",{className:"flex shrink-0 justify-end gap-2 p-3",children:k?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button","data-grok-move-another":!0,onClick:P,className:K,children:c("grokMove.another")}),a.jsx("button",{type:"button","data-grok-move-done":!0,onClick:e,className:D,children:c("common.done")})]}):d?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",disabled:x,onClick:()=>w(null),className:K,children:c("grokMove.back")}),a.jsxs("button",{type:"button","data-grok-move-import":!0,disabled:x||!d.plans.length,onClick:()=>{U()},className:G(D,"inline-flex items-center gap-2"),children:[x&&a.jsx(be,{size:15,className:"animate-spin"}),x?c("grokMove.importing"):c("grokMove.import")]})]}):a.jsx("button",{type:"button","data-grok-move-continue":!0,disabled:!u.trim(),onClick:()=>{L(()=>V(u))},className:D,children:c("onboarding.continue")})})]});return t?f:a.jsx("div",{className:"ui-scrim fixed inset-0 z-[60] flex items-center justify-center p-4",onMouseDown:i=>{i.target===i.currentTarget&&!x&&e()},children:f})}export{le as BotCounts,jt as GrokMoveDialog,ce as GrokMoveLines};
|
|
55
|
+
Use these skills: ${Q.join(", ")}.`:""}`.slice(0,2e4),runOn:"maus",schedule:p,durationMinutes:30,enabledAfterInstall:!1})}const _=it(e),x={};if(_.text&&T(_.text)<=te&&(x["MEMORY.md"]=_.text),k.length){const f=at(n,k);T(f)<=te&&(x[ie]=f)}const F=new Set,j=[];let A=0;for(const f of e.apps){const a=v(f.name,100),p=f.mcpUrl?st(f.mcpUrl):null,b=J(`${/^[a-z]/i.test(a)?"":"server-"}${a}`,25)||`server-${j.length+1}`;p&&t.takenServers?.has(b)||(A+=1,!(!p||j.length>=Le)&&j.push({key:X(b,b,F,28),label:a,reason:v(`${n} used ${a} in Grok Bot.`,240),mcp:{transport:f.transport==="sse"||/\/sse\/?$/.test(new URL(p).pathname)?"sse":"http",url:p,valueNames:f.headerNames.filter(h=>ot.test(h)).slice(0,32)}}))}const C=e.description.trim(),L=v(C||e.title||`${n}, brought over from Grok Bot.`,2e3),R=Je(`${n}
|
|
56
|
+
${r}`),I=`${o}-${R.toString(16).padStart(8,"0").slice(0,6)}`,U={format:Te,version:Ie,package:{id:I,release:"1.0.0",name:n,tagline:v($(L),160),summary:L,category:"Imported",author:{name:"Grok Bot"},license:"See source",outcomes:[v(`${n} runs in Limix Bot with your own engine and apps.`,240)],setupMinutes:5,requirements:{apps:[],capabilities:[]},team:{name:v(n,60)},agents:[{key:o,name:n,...e.title?{title:v(e.title,200)}:{},...C?{description:v(C,4e3)}:{},...r?{soul:r}:{},appearance:{color:ne[R%ne.length]},...m.length?{skills:m.map(f=>f.name)}:{},...j.length?{connections:j.map(f=>f.key)}:{},...Object.keys(x).length?{seed:{memory:x}}:{}}],...w.length?{routines:w}:{},...j.length?{connections:j}:{},...m.length?{skills:{version:1,entries:m}}:{}}};let P;try{P=Re(U,{trust:"file"})}catch{throw new O("unusable")}return{name:n,packageId:I,document:P,skills:N,routines:w.length,notes:x[ie]?k.length:0,memories:x["MEMORY.md"]?_.count:0,apps:A}}const fe={files:[],bots:[]};function ct(){return q("/api/setup-import/grok",{timeoutMs:1e4}).then(e=>({files:Array.isArray(e?.files)?e.files:[],bots:Array.isArray(e?.bots)?e.bots:[]}),()=>fe)}function he(e){return e instanceof O?c(`grokMove.error.${e.code}`,{keys:e.keys.join(", ")}):e instanceof Error?e.message:String(e)}function ut(e){const t=[],s=[...e].sort((n,o)=>n.modifiedAt-o.modifiedAt).flatMap(n=>{try{return V(n.text)}catch(o){return t.push({file:n.name,error:he(o)}),[]}});return{bots:pe(s),refused:t}}function dt(e,t){const s=new Set(t.bots.flatMap(l=>l.installedPackage?.id??[])),n=new Set(t.bots.map(l=>l.name.trim().toLowerCase())),o=new Set(t.servers),r={plans:[],moved:[],unreadable:[]};for(const l of e)try{const u=lt(l,{timeZone:t.timeZone,takenServers:o});if(s.has(u.packageId)){r.moved.push(u.name);continue}for(const m of u.document.package.connections??[])o.add(m.key);r.plans.push({...u,addedAs:je(u.name,n)})}catch{r.unreadable.push(l.name)}return r}async function mt(e,t){const s={bots:[],moved:e.moved,unreadable:e.unreadable,failed:[]};for(const n of e.plans)try{const o=(await Me(n.document,t)).first;if(!o)throw new Error("no bot");const r=[];for(const l of n.skills)l.on&&await q(`/api/bots/${o.id}/skills/${encodeURIComponent(l.folder)}`,{method:"PATCH",body:JSON.stringify({enabled:!0})}).then(()=>!0,()=>!1)||r.push(l.name);s.bots.push({name:o.name,skills:n.skills.length,skillsOff:r,routines:n.routines,notes:n.notes,memories:n.memories,apps:n.apps})}catch{s.failed.push(n.name)}return s}const D="ui-button ui-button-primary min-h-9 px-4 text-[14px]",K="ui-button min-h-9 px-4 text-[14px]",ge="text-[13px] leading-relaxed text-ink-secondary";function le({heading:e,skills:t,routines:s,memories:n,notes:o,skillsOff:r}){const l=[[c("grokMove.count.skills"),t],[c("grokMove.count.routines"),s],[c("grokMove.count.memories"),n],[c("grokMove.count.notes"),o]];return i.jsxs("section",{"data-grok-move-bot":!0,className:"flex flex-col gap-1.5",children:[i.jsx("h3",{className:"break-words text-[15px] font-semibold text-ink",children:e}),i.jsx("dl",{className:"flex flex-col gap-1 text-[14px]",children:l.filter(([,u])=>u>0).map(([u,m])=>i.jsxs("div",{className:"flex items-baseline justify-between gap-4",children:[i.jsx("dt",{className:"text-ink-secondary",children:u}),i.jsx("dd",{className:"tabular-nums text-ink",children:m})]},u))}),r.length>0&&i.jsx("p",{className:ge,children:c("grokMove.skillsOff",{names:r.join(", ")})})]})}function ce({paused:e,files:t=null,apps:s,moved:n,unreadable:o,failed:r=[]}){const l=[e,t,s===1?c("grokMove.appsOne"):s>1?c("grokMove.appsMany",{count:s}):null,n.length?c("grokMove.alreadyHere",{names:n.join(", ")}):null,o.length?c("grokMove.unreadable",{names:o.join(", ")}):null,r.length?c("grokMove.notAdded",{names:r.join(", ")}):null].filter(u=>u!==null);return l.length>0&&i.jsx("div",{className:"flex flex-col gap-1",children:l.map(u=>i.jsx("p",{className:ge,children:u},u))})}function pt({local:e,look:t,found:s,reply:n,error:o,onReply:r,onFile:l,onFound:u}){const m=y.useRef(null),{state:N,copy:E}=be(ze);return i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:c("grokMove.intro")}),i.jsxs("section",{className:"flex flex-col items-start gap-1.5",children:[i.jsx("h3",{className:"text-[14px] font-medium text-ink",children:c("grokMove.step1")}),i.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:c("grokMove.step1Hint")}),e&&t.bots.length>0&&i.jsx("p",{"data-grok-move-roster":!0,className:"text-[13px] text-ink-secondary",children:c("grokMove.roster",{names:t.bots.join(", ")})}),i.jsxs("button",{type:"button","data-grok-move-copy":!0,onClick:E,className:G(K,"mt-1 inline-flex items-center gap-2"),children:[N==="copied"?i.jsx(xe,{size:15}):i.jsx(ve,{size:15}),N==="copied"?c("grokMove.copied"):N==="failed"?c("grokMove.copyFailed"):c("grokMove.copy")]})]}),i.jsxs("section",{className:"flex flex-col gap-1.5",children:[i.jsx("h3",{className:"text-[14px] font-medium text-ink",children:c("grokMove.step2")}),i.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:c("grokMove.step2Hint")}),s.bots.length>0&&i.jsxs("div",{"data-grok-move-found":!0,className:"mt-1 flex items-center justify-between gap-3 rounded-xl border border-accent/40 bg-accent/[0.06] px-3 py-2",children:[i.jsx("span",{className:"min-w-0 break-words text-[13px] text-ink",children:c("grokMove.found",{names:s.bots.map(d=>d.name).join(", ")})}),i.jsx("button",{type:"button","data-grok-move-use-found":!0,onClick:u,className:G(D,"shrink-0"),children:c("grokMove.useFound")})]}),s.refused.map(d=>i.jsx("p",{role:"alert",className:"text-[13px] leading-relaxed text-danger",children:c("grokMove.refused",{file:d.file,reason:d.error})},d.file)),i.jsx("textarea",{value:n,onChange:d=>r(d.target.value),rows:4,"aria-label":c("grokMove.replyLabel"),placeholder:c("grokMove.replyPlaceholder"),className:"mt-1 w-full resize-y rounded-xl border border-hairline/40 bg-inset px-3 py-2.5 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"}),o&&i.jsx("p",{role:"alert",className:"text-[13px] leading-relaxed text-danger",children:o}),i.jsxs("div",{children:[i.jsxs("button",{type:"button",onClick:()=>m.current?.click(),className:G(K,"inline-flex items-center gap-2"),children:[i.jsx(Fe,{size:15}),c("grokMove.chooseFile")]}),i.jsx("input",{ref:m,type:"file",accept:".json,.md,.txt,application/json,text/plain,text/markdown",className:"hidden",onChange:d=>{l(d.target.files?.[0]),d.target.value=""}})]})]})]})}function jt({onClose:e,inline:t=!1}){const{state:s,dispatch:n}=Oe(),o=$e(s.config?.cloudHome===!0),[r,l]=y.useState(fe),[u,m]=y.useState(""),[N,E]=y.useState(""),[d,w]=y.useState(null),[k,_]=y.useState(null),[x,F]=y.useState(!1),j=y.useRef(null),A=y.useCallback(()=>{o&&ct().then(l)},[o]);y.useEffect(()=>(A(),window.addEventListener("focus",A),()=>window.removeEventListener("focus",A)),[A]),y.useEffect(()=>j.current?.focus({preventScroll:!0}),[d,k]);const C=y.useMemo(()=>ut(r.files),[r.files]),L=async a=>{try{const p=a(),b=await q("/api/mcp/servers").then(h=>h.servers??[],()=>[]);w(dt(p,{bots:s.bots,servers:new Set(b.map(h=>h.name)),timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone})),E("")}catch(p){E(he(p))}},R=y.useRef(()=>{});R.current=a=>{if(a){if(a.size>me)return E(c("grokMove.error.tooLarge"));a.text().then(p=>L(()=>V(p)))}};const I=!d&&!k;y.useEffect(()=>{const a=h=>{h.stopPropagation(),h.preventDefault()},b=[["dragenter",a],["dragover",a],["dragleave",a],["drop",h=>{a(h),I&&R.current(h.dataTransfer?.files[0])}]];for(const[h,S]of b)window.addEventListener(h,S,!0);return()=>{for(const[h,S]of b)window.removeEventListener(h,S,!0)}},[I]);const U=async()=>{if(!d)return;F(!0);const a=await mt(d,n);we("team_imported",{members:d.plans.length}),_(a),w(null),F(!1)},P=()=>{_(null),m(""),E(""),A()},f=i.jsxs("div",{ref:j,tabIndex:-1,...t?{}:{role:"dialog","aria-modal":!0,"aria-labelledby":"grok-move-title"},"data-grok-move":k?"report":d?"preview":"start",onKeyDown:a=>{t||a.key!=="Escape"||x||(a.preventDefault(),a.stopPropagation(),d?w(null):e())},className:t?"mt-3 flex flex-col rounded-lg border border-hairline/40 text-left outline-none":"ui-modal animate-pop-in flex max-h-[min(720px,calc(100dvh-32px))] w-[560px] max-w-full flex-col overflow-hidden text-left outline-none",children:[(!t||d)&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex h-[52px] shrink-0 items-center justify-between pl-4 pr-3",children:[i.jsx("h2",{id:"grok-move-title",className:"text-[14px] font-semibold leading-[22px] text-ink",children:d?c("grokMove.previewTitle"):c("settings.import.grokTitle")}),!t&&i.jsx("button",{type:"button",disabled:x,onClick:e,"aria-label":c("common.close"),title:c("common.close"),className:"flex size-7 items-center justify-center rounded-full text-ink-secondary transition-colors hover:bg-ink/[0.06] hover:text-ink disabled:opacity-40",children:i.jsx(ke,{size:16})})]}),i.jsx("div",{className:"ui-modal-divider shrink-0"})]}),i.jsx("div",{"data-grok-move-body":!0,className:"flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto p-4 [scrollbar-width:thin]",children:k?i.jsxs(i.Fragment,{children:[k.bots.map(a=>i.jsx(le,{heading:c("grokMove.isHere",{name:a.name}),...a},a.name)),i.jsx(ce,{paused:k.bots.some(a=>a.routines>0)?c("grokMove.pausedReport"):null,files:c("grokMove.filesStay"),apps:k.bots.reduce((a,p)=>a+p.apps,0),moved:k.moved,unreadable:k.unreadable,failed:k.failed})]}):d?i.jsxs(i.Fragment,{children:[d.plans.map(a=>i.jsx(le,{heading:a.addedAs,skills:a.skills.length,routines:a.routines,memories:a.memories,notes:a.notes,skillsOff:a.skills.filter(p=>!p.on).map(p=>p.name)},a.packageId)),i.jsx(ce,{paused:d.plans.some(a=>a.routines>0)?c("grokMove.pausedPreview"):null,apps:d.plans.reduce((a,p)=>a+p.apps,0),moved:d.moved,unreadable:d.unreadable})]}):i.jsx(pt,{local:o,look:r,found:C,reply:u,error:N,onReply:m,onFile:a=>R.current(a),onFound:()=>{L(()=>C.bots)}})},k?"report":d?"preview":"start"),i.jsx("div",{className:"ui-modal-divider shrink-0"}),i.jsx("div",{className:"flex shrink-0 justify-end gap-2 p-3",children:k?i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button","data-grok-move-another":!0,onClick:P,className:K,children:c("grokMove.another")}),i.jsx("button",{type:"button","data-grok-move-done":!0,onClick:e,className:D,children:c("common.done")})]}):d?i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",disabled:x,onClick:()=>w(null),className:K,children:c("grokMove.back")}),i.jsxs("button",{type:"button","data-grok-move-import":!0,disabled:x||!d.plans.length,onClick:()=>{U()},className:G(D,"inline-flex items-center gap-2"),children:[x&&i.jsx(ye,{size:15,className:"animate-spin"}),x?c("grokMove.importing"):c("grokMove.import")]})]}):i.jsx("button",{type:"button","data-grok-move-continue":!0,disabled:!u.trim(),onClick:()=>{L(()=>V(u))},className:D,children:c("onboarding.continue")})})]});return t?f:i.jsx("div",{className:"ui-scrim fixed inset-0 z-[60] flex items-center justify-center p-4",onMouseDown:a=>{a.target===a.currentTarget&&!x&&e()},children:f})}export{le as BotCounts,jt as GrokMoveDialog,ce as GrokMoveLines};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as f,j as o,t as d,f as te,a as j,
|
|
1
|
+
import{r as f,j as o,t as d,f as te,a as j,a9 as ne,X as se,b as J,aa as re}from"./styles-BlayaJti.js";import{bn as ae,bo as ie,bp as oe,bc as D,bq as ce,br as le,bs as ue,u as de,aj as pe,l as me,bt as fe,bu as xe}from"./App-DFjF9FvF.js";import{C as he,L as ge,K as ye,u as be}from"./PlacesRail-v1XIqiBG.js";import{R as ke,C as $e}from"./MenuMotion-IQitGKH4.js";import"./index-CwYJ9TX8.js";import"./monitor-DFEzCfQk.js";const $=(e,n=120)=>e.length>n?`${e.slice(0,n-1)}…`:e,v=e=>e.replace(/\s+/g," ").trim(),F=119;function H(e,n){const a=e?{...e}:{text:"",pendingSpace:!1,overflow:!1};if(a.overflow)return a;for(const i of n){if(/\s/.test(i)){a.text&&(a.pendingSpace=!0);continue}if(a.pendingSpace){if(a.text.length>=F){a.overflow=!0;break}a.text+=" ",a.pendingSpace=!1}if(a.text.length>=F){a.overflow=!0;break}a.text+=i}return a}const B=e=>`${e.text}${e.overflow?"…":""}`;function ve(e){switch(e.type){case"session.started":return{summary:`session ${e.sessionId??"(none)"}${e.model?` · ${e.model}`:""}`,tone:"plain"};case"session.exited":return{summary:`session exited${e.reason?` · ${e.reason}`:""}`,tone:"plain"};case"turn.started":return{summary:`turn started${e.turnId?` · ${e.turnId.slice(0,8)}`:""}`,tone:"boundary"};case"turn.retrying":return{summary:`retrying (${e.reason}) · attempt ${e.attempt} · ${Math.round(e.delayMs/1e3)}s`,tone:"plain"};case"turn.completed":{const n=[e.ok?"turn ok":"turn failed"];return e.stopReason&&n.push(e.stopReason),typeof e.cost=="number"&&n.push(ae(e.cost,4)),e.denials?.length&&n.push(`${e.denials.length} denied`),{summary:n.join(" · "),tone:e.ok?"boundary":"error"}}case"turn.wait_started":return{summary:`waiting for ${e.resource.startsWith("browser:")?"browser":"computer"} — ${e.holder?`${e.holder.name}${e.holder.task?` (${e.holder.task})`:""}`:"holder unknown"}`,tone:"plain"};case"turn.wait_ended":{const n=Math.round(e.waitedMs/1e3),a=e.waitedMs<1e3?"under a second":`${n}s`;return e.outcome==="acquired"?{summary:`${e.resource.startsWith("browser:")?"browser":"computer"} acquired after ${a}`,tone:"boundary"}:e.outcome==="parked"?{summary:`computer wait parked after ${a}`,tone:"plain"}:e.outcome==="gave_up"?{summary:`computer wait gave up after ${a}`,tone:"error"}:{summary:`computer wait stopped after ${a}`,tone:"plain"}}case"item.started":return{summary:`${e.itemType}${e.title?`: ${$(v(e.title))}`:" started"}`,tone:"plain"};case"item.updated":return{summary:`${e.itemType} updated${typeof e.tokens=="number"?` · ${e.tokens} tok`:""}`,tone:"plain"};case"turn.progress":return{summary:`live: ${[e.activity,e.tool,e.file,typeof e.bytes=="number"?`${e.bytes} bytes`:void 0].filter(Boolean).join(" · ")}`,tone:"plain"};case"item.completed":return e.itemType==="assistant_text"?{summary:`assistant: ${$(v(e.text))}`,tone:"plain"}:e.itemType==="assistant_image"?{summary:"assistant image generated",tone:"plain"}:{summary:`tool ${e.ok?"ok":"failed"}`,tone:e.ok?"plain":"error"};case"content.delta":return{summary:`${e.streamKind}: ${$(v(e.delta))}`,tone:"plain"};case"request.opened":return{summary:`${e.requestType}${e.origin==="output"?" (agent-composed)":""}: ${e.tool} — ${$(v(e.summary))}`,tone:"plain"};case"request.resolved":return{summary:`resolved ${e.behavior} · ${e.source}`,tone:"plain"};case"thread.token-usage.updated":return{summary:`tokens in ${e.input} · out ${e.output}`,tone:"plain"};case"runtime.error":return{summary:`${e.setup?"setup: ":""}${$(v(e.message))}`,tone:"error"};case"runtime.notice":return{summary:`notice: ${$(v(e.message))}`,tone:"plain"};default:return{summary:e.type,tone:"plain"}}}function we(e){const n=e.msg;if(!n||typeof n!="object")return String(e.msg);const a=typeof n.method=="string"?n.method:void 0,i=typeof n.type=="string"?n.type:void 0,s=n.id!==void 0?` #${String(n.id)}`:"";if(a)return`${a}${s}`;if(typeof n.event=="string"){const t=n.result?.status;return typeof t=="string"?`${n.event} · ${t}`:n.event}if(i){const t=n.message,x=typeof t?.role=="string"?` · ${t.role}`:"",l=typeof n.subtype=="string"?` · ${n.subtype}`:"";return`${i}${l}${x}`}return n.result!==void 0?`result${s}`:n.error!==void 0?`error${s}`:$(v(JSON.stringify(n)))}function U(e){const n=[];for(const[a,i]of e.entries()){if(i.kind==="native"){n.push({key:`n${a}`,kind:"native",at:i.at,tag:i.data.dir==="out"?"→ out":"← in",summary:`${i.data.source} · ${we(i.data)}`,tone:"plain",data:i.data,count:1});continue}const s=i.data,t=n.at(-1);if(s.type==="content.delta"&&t?.kind==="runtime"&&t.tag==="content.delta"&&t.data[0]?.type==="content.delta"&&t.data[0].streamKind===s.streamKind){const y=t.data;y.push(s),t.count=y.length,t.preview=H(t.preview,s.delta),t.summary=`${s.streamKind}: ${B(t.preview)}`;continue}const{summary:x,tone:l}=ve(s),u=s.type==="content.delta"?H(void 0,s.delta):void 0,b=s.type==="content.delta"?s.streamKind:void 0;n.push({key:s.eventId||`r${a}`,kind:"runtime",at:i.at,tag:s.type,summary:u&&b?`${b}: ${B(u)}`:x,tone:l,data:s.type==="content.delta"?[s]:s,count:1,preview:u})}return n}function je(e){const n=new Date(e);if(Number.isNaN(n.getTime()))return"--:--:--";const a=String(n.getHours()).padStart(2,"0"),i=String(n.getMinutes()).padStart(2,"0"),s=String(n.getSeconds()).padStart(2,"0"),t=String(n.getMilliseconds()).padStart(3,"0");return`${a}:${i}:${s}.${t}`}function Se(e,n){const a=ie(e,n),i=[];let s=!1;for(const t of e)if(t.kind==="text"&&t.role==="user"&&t.text?.trim())i.push({id:t.id,at:t.at,label:s?"User input":"Task started",state:"observed",kind:"task"}),s=!0;else if(t.kind==="activity"&&t.tool){const x=oe(t.tool.name),l=t.tool.ok===!1||x!==null;i.push({id:t.id,at:t.at,label:D(x??t.tool.name),...t.tool.summary?{command:D(t.tool.summary)}:{},state:l?"failed":t.tool.ok===!0?"complete":a.has(t.id)?"running":"unverified",kind:"tool"})}else t.kind==="screen"?i.push({id:t.id,at:t.at,label:"Screen observed",state:"observed",kind:"screen"}):t.kind==="text"&&t.role==="bot"&&t.text?.trim()&&i.push({id:t.id,at:t.at,label:"Response recorded",state:"complete",kind:"result"});return i}function Ne(e){return D(e.map(n=>`[${new Date(n.at).toISOString()}] ${n.state} · ${n.label}${n.command?`
|
|
2
2
|
${n.command}`:""}`).join(`
|
|
3
|
-
`))}const Ie={running:"inspector.run.running",complete:"inspector.run.complete",failed:"inspector.run.failed",observed:"inspector.run.observed",unverified:"inspector.run.unverified"};function Te({events:e}){const[n,a]=f.useState("idle"),i=e.slice(-200),s=async()=>{const t=await ye(Ne(i));t!=="empty"&&a(t)};return o.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[o.jsxs("div",{className:"flex items-start gap-3 px-4 py-3",children:[o.jsx("p",{className:"min-w-0 flex-1 text-[12px] leading-relaxed text-ink-secondary",children:d("inspector.run.hint")}),i.length>0&&o.jsx("button",{type:"button",onClick:()=>{s()},"aria-label":d("inspector.run.copy"),title:d("inspector.run.copy"),className:"rounded-md p-1.5 text-ink-secondary hover:bg-raised hover:text-ink focus-visible:outline-2 focus-visible:outline-accent",children:n==="copied"?o.jsx(te,{size:14}):o.jsx(he,{size:14})})]}),n!=="idle"&&o.jsx("p",{role:"status",className:"px-4 pb-2 text-[12px] text-ink-secondary",children:d(n==="copied"?"inspector.run.copied":"inspector.run.copyFailed")}),e.length>i.length&&o.jsx("p",{className:"px-4 pb-2 text-[12px] text-ink-secondary",children:d("inspector.run.recent",{count:i.length})}),i.length===0?o.jsx("p",{className:"px-4 py-6 text-[13px] text-ink-secondary",children:d("inspector.run.empty")}):o.jsx("ol",{"aria-label":d("inspector.run.title"),className:"px-4 pb-4",children:i.map(t=>{const x=t.state==="failed"?ce:t.state==="complete"?le:t.state==="running"?ge:ue,l=t.kind==="task"?d("inspector.run.userInput"):t.kind==="screen"?d("inspector.run.screen"):t.kind==="result"?d("inspector.run.response"):t.label;return o.jsxs("li",{className:"border-t border-hairline/30 py-3",children:[o.jsxs("div",{className:"flex items-start gap-2 text-[12px]",children:[o.jsx(x,{size:14,"aria-hidden":"true",className:j("mt-0.5 shrink-0",t.state==="failed"?"text-danger":t.state==="running"?"animate-spin text-accent":"text-ink-secondary")}),o.jsx("span",{className:"min-w-0 flex-1 break-words font-medium text-ink",children:l}),o.jsx("time",{dateTime:new Date(t.at).toISOString(),className:"shrink-0 tabular-nums text-ink-secondary",children:ne(t.at)})]}),t.command&&o.jsx("pre",{className:"mt-2 whitespace-pre-wrap break-all rounded-lg bg-inset p-2 font-mono text-[12px] leading-relaxed text-ink",children:t.command}),t.kind==="tool"&&o.jsx("p",{className:j("mt-1 pl-[22px] text-[11px]",t.state==="failed"?"text-danger":"text-ink-secondary"),children:d(Ie[t.state])})]},t.id)})})]})}const K=400,T=new WeakMap;function X(e){const n={runtime:0,native:0},a=[];for(let i=e.length-1;i>=0;i--){const s=e[i];++n[s.kind]<=K&&a.push(s)}return a.length===e.length?e:a.reverse()}function G(e,n){if(!n.length)return e;const a=e??{entries:[],total:{runtime:0,native:0}},i=new Set(a.entries.flatMap(u=>u.kind==="runtime"?[u.data.eventId]:[])),s=[];for(const u of n)i.has(u.eventId)||(i.add(u.eventId),s.push({kind:"runtime",at:u.createdAt,data:u}));if(!s.length)return e;const t=X([...a.entries,...s]),x=new Set([...T.get(a)??[],...s.map(u=>u.data.eventId)]),l={entries:t,total:{...a.total,runtime:a.total.runtime+s.length}};return T.set(l,new Set(t.flatMap(u=>u.kind==="runtime"&&x.has(u.data.eventId)?[u.data.eventId]:[]))),l}function Re(e,n){const a={...n,entries:X(n.entries)};if(!e)return a;const i=e.entries.flatMap(m=>m.kind==="runtime"?[m.data]:[]),s=T.get(e)??new Set,t=a.entries.filter(m=>m.kind==="runtime"),x=new Set(t.map(m=>m.data.eventId)),l=i.findLastIndex(m=>x.has(m.eventId)),u=t.at(-1)?.at,b=(l>=0?i.slice(l+1):i.filter(m=>u===void 0||m.createdAt>=u)).filter(m=>s.has(m.eventId)),y=G(a,b),R={...y,total:{...y.total,runtime:Math.max(e.total.runtime,y.total.runtime)}};return T.set(R,T.get(y)??new Set),R}const Ce=e=>
|
|
3
|
+
`))}const Ie={running:"inspector.run.running",complete:"inspector.run.complete",failed:"inspector.run.failed",observed:"inspector.run.observed",unverified:"inspector.run.unverified"};function Te({events:e}){const[n,a]=f.useState("idle"),i=e.slice(-200),s=async()=>{const t=await ye(Ne(i));t!=="empty"&&a(t)};return o.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[o.jsxs("div",{className:"flex items-start gap-3 px-4 py-3",children:[o.jsx("p",{className:"min-w-0 flex-1 text-[12px] leading-relaxed text-ink-secondary",children:d("inspector.run.hint")}),i.length>0&&o.jsx("button",{type:"button",onClick:()=>{s()},"aria-label":d("inspector.run.copy"),title:d("inspector.run.copy"),className:"rounded-md p-1.5 text-ink-secondary hover:bg-raised hover:text-ink focus-visible:outline-2 focus-visible:outline-accent",children:n==="copied"?o.jsx(te,{size:14}):o.jsx(he,{size:14})})]}),n!=="idle"&&o.jsx("p",{role:"status",className:"px-4 pb-2 text-[12px] text-ink-secondary",children:d(n==="copied"?"inspector.run.copied":"inspector.run.copyFailed")}),e.length>i.length&&o.jsx("p",{className:"px-4 pb-2 text-[12px] text-ink-secondary",children:d("inspector.run.recent",{count:i.length})}),i.length===0?o.jsx("p",{className:"px-4 py-6 text-[13px] text-ink-secondary",children:d("inspector.run.empty")}):o.jsx("ol",{"aria-label":d("inspector.run.title"),className:"px-4 pb-4",children:i.map(t=>{const x=t.state==="failed"?ce:t.state==="complete"?le:t.state==="running"?ge:ue,l=t.kind==="task"?d("inspector.run.userInput"):t.kind==="screen"?d("inspector.run.screen"):t.kind==="result"?d("inspector.run.response"):t.label;return o.jsxs("li",{className:"border-t border-hairline/30 py-3",children:[o.jsxs("div",{className:"flex items-start gap-2 text-[12px]",children:[o.jsx(x,{size:14,"aria-hidden":"true",className:j("mt-0.5 shrink-0",t.state==="failed"?"text-danger":t.state==="running"?"animate-spin text-accent":"text-ink-secondary")}),o.jsx("span",{className:"min-w-0 flex-1 break-words font-medium text-ink",children:l}),o.jsx("time",{dateTime:new Date(t.at).toISOString(),className:"shrink-0 tabular-nums text-ink-secondary",children:ne(t.at)})]}),t.command&&o.jsx("pre",{className:"mt-2 whitespace-pre-wrap break-all rounded-lg bg-inset p-2 font-mono text-[12px] leading-relaxed text-ink",children:t.command}),t.kind==="tool"&&o.jsx("p",{className:j("mt-1 pl-[22px] text-[11px]",t.state==="failed"?"text-danger":"text-ink-secondary"),children:d(Ie[t.state])})]},t.id)})})]})}const K=400,T=new WeakMap;function X(e){const n={runtime:0,native:0},a=[];for(let i=e.length-1;i>=0;i--){const s=e[i];++n[s.kind]<=K&&a.push(s)}return a.length===e.length?e:a.reverse()}function G(e,n){if(!n.length)return e;const a=e??{entries:[],total:{runtime:0,native:0}},i=new Set(a.entries.flatMap(u=>u.kind==="runtime"?[u.data.eventId]:[])),s=[];for(const u of n)i.has(u.eventId)||(i.add(u.eventId),s.push({kind:"runtime",at:u.createdAt,data:u}));if(!s.length)return e;const t=X([...a.entries,...s]),x=new Set([...T.get(a)??[],...s.map(u=>u.data.eventId)]),l={entries:t,total:{...a.total,runtime:a.total.runtime+s.length}};return T.set(l,new Set(t.flatMap(u=>u.kind==="runtime"&&x.has(u.data.eventId)?[u.data.eventId]:[]))),l}function Re(e,n){const a={...n,entries:X(n.entries)};if(!e)return a;const i=e.entries.flatMap(m=>m.kind==="runtime"?[m.data]:[]),s=T.get(e)??new Set,t=a.entries.filter(m=>m.kind==="runtime"),x=new Set(t.map(m=>m.data.eventId)),l=i.findLastIndex(m=>x.has(m.eventId)),u=t.at(-1)?.at,b=(l>=0?i.slice(l+1):i.filter(m=>u===void 0||m.createdAt>=u)).filter(m=>s.has(m.eventId)),y=G(a,b),R={...y,total:{...y.total,runtime:Math.max(e.total.runtime,y.total.runtime)}};return T.set(R,T.get(y)??new Set),R}const Ce=e=>J()==="en"?d(e):xe(d(e));function qe({bot:e}){const{dispatch:n}=de(),{dragProps:a}=be(),i=e.threadId,[s,t]=f.useState("run"),x=f.useMemo(()=>Se(pe(e),e),[e]),[l,u]=f.useState(null),[b,y]=f.useState(null),[R,m]=f.useState(()=>new Set),E=f.useRef(null),z=f.useRef(!0),S=f.useRef(null),C=f.useRef(()=>{}),L=f.useCallback(async()=>{S.current?.abort();const r=new AbortController;S.current=r;try{const c=await fetch(`/api/threads/${i}/events?limit=${K}`,{signal:r.signal});if(!c.ok)throw new Error(`${c.status}`);const p=await c.json();if(r.signal.aborted)return;u(h=>Re(h,p)),m(h=>new Set([...h].filter(M=>M.startsWith("runtime:")))),y(null)}catch(c){if(r.signal.aborted)return;y(c instanceof Error?c.message:String(c))}finally{S.current===r&&(S.current=null)}},[i]);f.useEffect(()=>(u(null),m(new Set),z.current=!0,()=>S.current?.abort()),[L]),f.useEffect(()=>{let r=!0,c=null,p=0,h=!1;const M=[];let N=[],w=null;const q=()=>{w&&clearTimeout(w),w=null;const g=N;N=[],g.length&&u(k=>G(k,g))},W=g=>{N.push(g),N.length>=K?q():w??=setTimeout(q,16)},Y=()=>{for(const g of M.splice(0))W(g)},Z=async()=>{q();const g=++p;h=!0,await L(),!(!r||g!==p)&&(h=!1,Y())},I=()=>{Z()};C.current=I;const ee=me({onMissedFrames:I,onFrame:g=>{if(g.kind!=="runtime")return;const k=g.event;k.threadId===i&&(h?M.push(k):W(k),(k.type==="turn.completed"||k.type==="runtime.error")&&(c&&clearTimeout(c),c=setTimeout(I,400)))}});return I(),()=>{r=!1,C.current===I&&(C.current=()=>{}),ee(),c&&clearTimeout(c),w&&clearTimeout(w),N=[]}},[i,L]);const A=f.useMemo(()=>l?l.entries.filter(r=>s==="raw"?r.kind==="native":r.kind==="runtime"):[],[l,s]),O=f.useMemo(()=>U(A),[A]);f.useEffect(()=>{const r=new Set(["runtime","native"].flatMap(c=>U(l?.entries.filter(p=>p.kind===c)??[]).map(p=>`${p.kind}:${p.key}`)));m(c=>{const p=new Set([...c].filter(h=>r.has(h)));return p.size===c.size?c:p})},[l]),f.useEffect(()=>{const r=E.current;r&&z.current&&(r.scrollTop=r.scrollHeight)},[l,O.length,s]);const V=()=>{const r=E.current;r&&(z.current=r.scrollHeight-r.scrollTop-r.clientHeight<40)},Q=r=>m(c=>{const p=new Set(c);return p.has(r)?p.delete(r):p.add(r),p}),_=A.length,P=s==="raw"?l?.total.native??0:l?.total.runtime??0;return o.jsxs("aside",{"aria-label":d("inspector.title"),className:"animate-panel-in absolute inset-0 z-40 flex h-full min-w-0 flex-col border-l border-hairline/40 bg-panel md:static md:z-auto md:w-[min(460px,45vw)] md:shrink-0",children:[o.jsxs("div",{...a,className:"flex items-center justify-between px-4 py-3",children:[o.jsxs("span",{className:"flex items-center gap-2 text-[15px] font-semibold text-ink",children:[o.jsx(fe,{size:16,className:"text-ink-secondary"})," ",d("inspector.title")]}),o.jsx("button",{onClick:()=>n({type:"toggleInspector",open:!1}),"aria-label":d("inspector.close"),title:d("inspector.close"),className:"rounded-md p-1 text-ink-secondary hover:bg-raised hover:text-ink",children:o.jsx(se,{size:18})})]}),o.jsxs("div",{className:"flex items-center gap-2 border-b border-hairline/40 px-4 pb-3",children:[o.jsx("div",{role:"tablist","aria-label":d("inspector.views"),className:"flex rounded-lg bg-inset p-0.5",onKeyDown:r=>{const c=Array.from(r.currentTarget.querySelectorAll('[role="tab"]')),p=c.indexOf(document.activeElement),h=r.key==="ArrowRight"?(p+1)%c.length:r.key==="ArrowLeft"?(p+c.length-1)%c.length:r.key==="Home"?0:r.key==="End"?c.length-1:-1;h<0||(r.preventDefault(),c[h].focus(),c[h].click())},children:["run","events","raw"].map(r=>o.jsx("button",{type:"button",role:"tab",id:`inspector-tab-${r}`,"aria-selected":s===r,"aria-controls":`inspector-panel-${r}`,tabIndex:s===r?0:-1,onClick:()=>t(r),className:j("rounded-md px-2.5 py-1 text-[12px] font-medium",J()==="en"&&"capitalize",s===r?"bg-raised text-ink":"text-ink-secondary hover:text-ink"),children:Ce(r==="run"?"inspector.run.title":r==="events"?"inspector.tab.events":"inspector.tab.raw")},r))}),s!=="run"&&o.jsx("span",{className:"ml-auto text-[11px] text-ink-secondary",children:l?_<P?d("inspector.entries.lastOf",{shown:_,total:P}):d("inspector.entries.count",{count:_}):d("inspector.entries.loading")}),s!=="run"&&o.jsx("button",{onClick:()=>C.current(),className:"rounded-md p-1 text-ink-secondary hover:bg-raised hover:text-ink",title:d("inspector.reload"),children:o.jsx(ke,{size:14})})]}),o.jsx("div",{role:"tabpanel",id:`inspector-panel-${s}`,"aria-labelledby":`inspector-tab-${s}`,tabIndex:0,className:"flex min-h-0 flex-1 flex-col outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/60",children:s==="run"?o.jsx(Te,{events:x},i):o.jsxs("div",{ref:E,onScroll:V,className:"min-h-0 flex-1 overflow-y-auto font-mono text-[12px]",children:[b&&o.jsx("div",{className:"px-4 py-3 text-danger",children:d("inspector.loadFailed",{error:b})}),l&&O.length===0&&!b&&o.jsx("div",{className:"px-4 py-6 text-ink-secondary",children:d(s==="raw"?"inspector.emptyRaw":"inspector.emptyEvents")}),O.map(r=>o.jsx(Me,{row:r,open:R.has(`${r.kind}:${r.key}`),onToggle:()=>Q(`${r.kind}:${r.key}`)},r.key))]})})]})}function Me({row:e,open:n,onToggle:a}){return o.jsxs("div",{className:j("border-b border-hairline/20",e.tone==="boundary"&&"bg-raised/40",e.tone==="error"&&"bg-danger/10"),children:[o.jsxs("button",{onClick:a,className:"flex w-full items-start gap-2 px-3 py-1.5 text-left hover:bg-raised/60",children:[o.jsx("span",{className:"mt-[1px] shrink-0 text-ink-secondary",children:n?o.jsx(re,{size:12}):o.jsx($e,{size:12})}),o.jsx("span",{className:"shrink-0 tabular-nums text-ink-secondary",children:je(e.at)}),o.jsxs("span",{className:j("shrink-0 rounded px-1 text-[11px]",e.kind==="native"?"bg-accent/15 text-accent":e.tone==="error"?"bg-danger/20 text-danger":"bg-inset text-ink-secondary"),children:[e.tag,e.count>1?` ×${e.count}`:""]}),o.jsx("span",{className:j("min-w-0 flex-1 truncate",e.tone==="error"?"text-danger":"text-ink"),children:e.summary})]}),n&&o.jsx("pre",{className:"max-h-[50vh] overflow-auto whitespace-pre-wrap break-all border-t border-hairline/20 bg-app px-3 py-2 text-[11px] leading-relaxed text-ink",children:JSON.stringify(e.data,null,2)})]})}export{qe as InspectorPanel};
|