limixbot 0.3.11 → 0.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ActivityPanel-BODxWmfO.js → ActivityPanel-WwnzdBwg.js} +1 -1
- package/dist/assets/{App-DPG1sq1r.js → App-xm5evxQc.js} +125 -125
- package/dist/assets/{AppEventEditor-QyHQdp7V.js → AppEventEditor-D4R4y0yV.js} +1 -1
- package/dist/assets/{BotSettingsDialog-BCNOcqOS.js → BotSettingsDialog-B6Nl9Kqn.js} +4 -4
- package/dist/assets/{BrowserPanel-BqPnj2Bz.js → BrowserPanel-D95FHyTZ.js} +1 -1
- package/dist/assets/{BrowserProfilesManager-BMk7i2tc.js → BrowserProfilesManager-7KU0ynoV.js} +1 -1
- package/dist/assets/CloudAddDialog-eJTjUT_W.js +1 -0
- package/dist/assets/{ComputerFilesPane-BWmAv8JT.js → ComputerFilesPane-CDm1oiQb.js} +1 -1
- package/dist/assets/ComputerPanel-DsSTgobP.js +2 -0
- package/dist/assets/{DataPanel-BgfqxYo9.js → DataPanel-BtBpnpvo.js} +1 -1
- package/dist/assets/{DesktopViewer-BMD84CFj.js → DesktopViewer-BRzNtGEm.js} +1 -1
- package/dist/assets/{FilesView-CGYpajry.js → FilesView-BIOj6w1e.js} +1 -1
- package/dist/assets/{GrokMoveDialog-B3aEa4hb.js → GrokMoveDialog-C-UmQzuZ.js} +1 -1
- package/dist/assets/{InspectorPanel-CTNcZYHr.js → InspectorPanel-C13p36PD.js} +1 -1
- package/dist/assets/{KeyboardShortcutsModal-CBmbtwhH.js → KeyboardShortcutsModal-CWOIkT5q.js} +1 -1
- package/dist/assets/{LiveDesktop-7h7Mxr41.js → LiveDesktop-B-OYWCWR.js} +1 -1
- package/dist/assets/LocalVmWorkspace-X4vOLsJm.js +1 -0
- package/dist/assets/MacLocalControl-DMOrG-td.js +1 -0
- package/dist/assets/{MarkdownFilePreview-_1MC5Db0.js → MarkdownFilePreview-B4WXm-Zz.js} +1 -1
- package/dist/assets/{MenuMotion-C1J3xC0E.js → MenuMotion-BDYr4RxL.js} +1 -1
- package/dist/assets/{NewBotDialog-C35vqYL4.js → NewBotDialog-D5FKUF9t.js} +1 -1
- package/dist/assets/PhoneAppDialog-DGaR3ZqK.js +1 -0
- package/dist/assets/{PlacesRail-DnedL3jM.js → PlacesRail-yZdo57pP.js} +1 -1
- package/dist/assets/{PluginsPanel-CvZhoTE-.js → PluginsPanel-Rr0WYhLE.js} +1 -1
- package/dist/assets/{ProIntroduction-B1QqcZmr.js → ProIntroduction-Bma87PIr.js} +1 -1
- package/dist/assets/{RemoteAgentSettingsPanel-DU6QyjIY.js → RemoteAgentSettingsPanel-BEygLori.js} +1 -1
- package/dist/assets/{RoomPanel-Om9r5yMG.js → RoomPanel-xOsJAq9r.js} +1 -1
- package/dist/assets/{RoutinesPage-BWJ5Z1Sk.js → RoutinesPage-ntwDQROW.js} +2 -2
- package/dist/assets/SettingsModal-CZ_GMpWi.js +11 -0
- package/dist/assets/{ShareTeamDialog-DkKdhm01.js → ShareTeamDialog-C_2Klxsb.js} +1 -1
- package/dist/assets/{SignedInSites-Dxnqcjlx.js → SignedInSites-6gzIcTSf.js} +1 -1
- package/dist/assets/{TeamLibraryPanel-C3QFOJmQ.js → TeamLibraryPanel-B1t0-XZ-.js} +1 -1
- package/dist/assets/TeamMapPage-Cb2qYz3_.js +1 -0
- package/dist/assets/TriggersPage-wBKXT1VB.js +1 -0
- package/dist/assets/{VisibilitySection-DiD7SczA.js → VisibilitySection-Bd8MQdKE.js} +1 -1
- package/dist/assets/{WebhookTrigger-w_Pjci5K.js → WebhookTrigger-Bvx80Ue5.js} +1 -1
- package/dist/assets/{WorksOnGrid-B84wDbPo.js → WorksOnGrid-TTZtT4m-.js} +1 -1
- package/dist/assets/{abnfDiagram-YUKMZFIV-Dr-8nZOt.js → abnfDiagram-YUKMZFIV-Boj-Bkbs.js} +1 -1
- package/dist/assets/{activity-bTJO9mSI.js → activity-MpAxS_kw.js} +1 -1
- package/dist/assets/{architectureDiagram-47P4ROYG-23P1y-s5.js → architectureDiagram-47P4ROYG-Cl-ocqce.js} +1 -1
- package/dist/assets/{blockDiagram-E7TT5TSB-D1mBvWuR.js → blockDiagram-E7TT5TSB-0nSQiv6g.js} +1 -1
- package/dist/assets/{c4Diagram-CRA5TL53-BKK5iCAq.js → c4Diagram-CRA5TL53-Cx9iymkb.js} +1 -1
- package/dist/assets/{calendar-days-Ckb7s5k5.js → calendar-days-DXHDRm_4.js} +1 -1
- package/dist/assets/channel-BStWWrSt.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-C6ElI8Gj.js → chunk-2Q5K7J3B-0rIrumUG.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-B9VKa5BI.js → chunk-5VM5RSS4-w9e6iKvs.js} +1 -1
- package/dist/assets/{chunk-7TKQ45FW-CrgJv6B8.js → chunk-7TKQ45FW-c4KxVKkf.js} +1 -1
- package/dist/assets/{chunk-AW2ZBBNX-CVe28FV5.js → chunk-AW2ZBBNX-DmaBcuOP.js} +1 -1
- package/dist/assets/{chunk-FVRAUYC3-BLPrVPPQ.js → chunk-FVRAUYC3-BLzfqLHR.js} +2 -2
- package/dist/assets/{chunk-HTAEGDNF-BB9kWhE5.js → chunk-HTAEGDNF-BN48XtBm.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-y2b0u5g-.js → chunk-JWPE2WC7-D2NACa6i.js} +1 -1
- package/dist/assets/{chunk-KQW6MTUR-BMp5NWQw.js → chunk-KQW6MTUR-CbAfnxxG.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-gUdzE10_.js → chunk-XXDRQBXY-Bwg-DPP_.js} +1 -1
- package/dist/assets/{classDiagram-v2-K4WV4PDN-DNfrg4LR.js → classDiagram-v2-K4WV4PDN-Dh3ohoZp.js} +1 -1
- package/dist/assets/{coins-CBbaS4z-.js → coins-Bv8-qll4.js} +1 -1
- package/dist/assets/{core-BNIINisk.js → core-Dr_lGnx7.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-D84YhUzh.js → cose-bilkent-JH36ORCC-DCHadn0L.js} +1 -1
- package/dist/assets/{cynefin-EF2NZ3EQ-DMBZCt-X.js → cynefin-EF2NZ3EQ-ClpPPxUg.js} +1 -1
- package/dist/assets/{cynefinDiagram-3GCD6N5R-BZhcnyNF.js → cynefinDiagram-3GCD6N5R-DZ5l7nkL.js} +1 -1
- package/dist/assets/{dagre-W4DXFKR2-DY68eKcA.js → dagre-W4DXFKR2-BagTvT62.js} +1 -1
- package/dist/assets/{diagram-2UJZ2QOL-Bv-0-qqw.js → diagram-2UJZ2QOL-DuByootb.js} +1 -1
- package/dist/assets/{diagram-OVF4WLC6-CEnRLa7p.js → diagram-OVF4WLC6-BQ8Cvr0D.js} +1 -1
- package/dist/assets/{diagram-PFPMY2P6-D3UjLOE9.js → diagram-PFPMY2P6-D_pklaf9.js} +1 -1
- package/dist/assets/{diagram-UMYRVEAY-CJCYH8n7.js → diagram-UMYRVEAY-1BuHq7tR.js} +1 -1
- package/dist/assets/{diagram-YEKJPTXX-D_YEp1XW.js → diagram-YEKJPTXX-CK0cPx8n.js} +1 -1
- package/dist/assets/{diagram-ZIFT7M5P-C7RgDQ_I.js → diagram-ZIFT7M5P-DVzPho45.js} +1 -1
- package/dist/assets/{ebnfDiagram-VR2GEFS7-CVbikCfA.js → ebnfDiagram-VR2GEFS7-D8UO_5sE.js} +1 -1
- package/dist/assets/{elk-IJKZMXRS-BQv73EB6.js → elk-IJKZMXRS-BRigfR5V.js} +1 -1
- package/dist/assets/{erDiagram-O2IAPWRE-ZMuLXVBq.js → erDiagram-O2IAPWRE-CXHPobWj.js} +1 -1
- package/dist/assets/{file-up-BsMMeeDy.js → file-up-CQezfdJk.js} +1 -1
- package/dist/assets/{flowDiagram-OXPTDLAJ-CkF5DDZj.js → flowDiagram-OXPTDLAJ-CqKD6jh8.js} +1 -1
- package/dist/assets/{ganttDiagram-R7TSEDQI-BaYEK3at.js → ganttDiagram-R7TSEDQI-C9FV3gsA.js} +1 -1
- package/dist/assets/{gitGraphDiagram-XJZIOB7I-eVpEz6un.js → gitGraphDiagram-XJZIOB7I-CRu4dnr_.js} +1 -1
- package/dist/assets/{import-name-DzZIJafj.js → import-name-CrmN5zUf.js} +1 -1
- package/dist/assets/{index-BSIcl6wl.js → index-D8CUjCIJ.js} +1 -1
- package/dist/assets/{index-BkcZ5EE3.js → index-aOwy9fcM.js} +2 -2
- package/dist/assets/{infoDiagram-5W2HQ5XZ-cLDLLbyG.js → infoDiagram-5W2HQ5XZ-CCRjb2CQ.js} +1 -1
- package/dist/assets/{ishikawaDiagram-K3B6WC7H-Dxie_tdO.js → ishikawaDiagram-K3B6WC7H-TaNPsGZS.js} +1 -1
- package/dist/assets/{journeyDiagram-COXZFDF6-DWzHn4oz.js → journeyDiagram-COXZFDF6-Dz7YIIc2.js} +1 -1
- package/dist/assets/{kanban-definition-P3RFRI5V-BFNqkDTK.js → kanban-definition-P3RFRI5V-Cg69Fpp8.js} +1 -1
- package/dist/assets/{mcp-servers-DJceaBjT.js → mcp-servers-DwkY4xUh.js} +1 -1
- package/dist/assets/{mermaid.core-Cn7buzY3.js → mermaid.core-DiG3LoLz.js} +4 -4
- package/dist/assets/{mindmap-definition-LZFPQGKD-DVS-3JPN.js → mindmap-definition-LZFPQGKD-nxP4f0fq.js} +1 -1
- package/dist/assets/{minimize-BpyGl78C.js → minimize-B_k_fmmo.js} +1 -1
- package/dist/assets/{monitor-FKQbSjca.js → monitor-BfmnPU-I.js} +1 -1
- package/dist/assets/{new-bot-Df7cGS3Z.js → new-bot-D8qQ_VN7.js} +2 -2
- package/dist/assets/{org-library-CT3HZbof.js → org-library-DfX89pz8.js} +1 -1
- package/dist/assets/{package-format-CgnYlqV5.js → package-format-DLfgEUES.js} +1 -1
- package/dist/assets/{pegDiagram-BGZESJAR-qwRUMAPC.js → pegDiagram-BGZESJAR-gPjpGcNH.js} +1 -1
- package/dist/assets/{pieDiagram-CAPJLFHJ-CTzsGZac.js → pieDiagram-CAPJLFHJ-Cgh25Z4_.js} +1 -1
- package/dist/assets/{quadrantDiagram-GDMTTRAM-B7Mx793h.js → quadrantDiagram-GDMTTRAM-DD9luyqA.js} +1 -1
- package/dist/assets/{rail-B_BFwBxk.js → rail-B1mj4zlo.js} +1 -1
- package/dist/assets/{railroadDiagram-SM67HX2B-zMy3LSMK.js → railroadDiagram-SM67HX2B-CS_TYko7.js} +1 -1
- package/dist/assets/{remote-desktop-panel-DPutXzoI.js → remote-desktop-panel-Gb0B8rvx.js} +1 -1
- package/dist/assets/{requirementDiagram-X7JNWC4A-Dm_K18IR.js → requirementDiagram-X7JNWC4A-BePHia6E.js} +1 -1
- package/dist/assets/{sankeyDiagram-UM26HJRW-Dx_FP9cL.js → sankeyDiagram-UM26HJRW-24ExCXGS.js} +1 -1
- package/dist/assets/{sequenceDiagram-ZO4K6R2Y-D3tIz4Te.js → sequenceDiagram-ZO4K6R2Y-Dtmx27I5.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-CwiX8-_Z.js → sizeCapture-INFHLROL-2LvmoT1T.js} +1 -1
- package/dist/assets/{stateDiagram-v2-TBUQTH76-Biv0Rjec.js → stateDiagram-v2-TBUQTH76-moL2SIo9.js} +1 -1
- package/dist/assets/{styles-Cm26P6hN.js → styles-6RbfQIY7.js} +1 -1
- package/dist/assets/{swimlanes-N4OXWK64-Daie2jEh.js → swimlanes-N4OXWK64-D95Pk8qh.js} +1 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-DByi9G3i.js +8 -0
- package/dist/assets/{team-share-DyK3j6N2.js → team-share-0GXKeixY.js} +1 -1
- package/dist/assets/{timeline-definition-YOQAKGHF-_OnzqB6-.js → timeline-definition-YOQAKGHF-HM-J25k2.js} +1 -1
- package/dist/assets/{usecaseDiagram-VIAY4XPW-CITmAUqx.js → usecaseDiagram-VIAY4XPW-C6q6bCzJ.js} +1 -1
- package/dist/assets/{vennDiagram-BLWOH2XV-BAx_UxlU.js → vennDiagram-BLWOH2XV-hf0dh2yT.js} +1 -1
- package/dist/assets/{vi-GKa1-xWX.js → vi-CVDyZGky.js} +1 -1
- package/dist/assets/{wardleyDiagram-YMQ3BMBF-DjWzxLzl.js → wardleyDiagram-YMQ3BMBF-CpT_eRn9.js} +1 -1
- package/dist/assets/{xychartDiagram-TAQBALBS-DpQbiSMS.js → xychartDiagram-TAQBALBS-D6g1V9DG.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/rail.html +4 -4
- package/dist-server/openmausbot.js +17 -16
- package/dist-server/package.json +1 -1
- package/dist-server/pair-cli.js +17 -16
- package/package.json +1 -1
- package/dist/assets/CloudAddDialog-S7ngrMRc.js +0 -1
- package/dist/assets/ComputerPanel-BDPrbwmC.js +0 -2
- package/dist/assets/LocalVmWorkspace-Bxvn8CQX.js +0 -1
- package/dist/assets/MacLocalControl-C3rHusSl.js +0 -1
- package/dist/assets/PhoneAppDialog-DhEEfxbl.js +0 -1
- package/dist/assets/SettingsModal-DmFTwQIH.js +0 -11
- package/dist/assets/TeamMapPage-CpPh11mE.js +0 -1
- package/dist/assets/TriggersPage-YjklCz2p.js +0 -1
- package/dist/assets/channel-_uzpXF9W.js +0 -1
- package/dist/assets/index-DvRd5uj9.js +0 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-EP8Nb7CO.js +0 -8
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DataPanel-BgfqxYo9.js","assets/styles-Cm26P6hN.js","assets/styles-bUbK33f1.css","assets/App-DPG1sq1r.js","assets/index-BkcZ5EE3.js","assets/PlacesRail-DnedL3jM.js","assets/monitor-FKQbSjca.js","assets/MenuMotion-C1J3xC0E.js","assets/calendar-days-Ckb7s5k5.js","assets/LiveDesktop-7h7Mxr41.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-Cm26P6hN.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-DPG1sq1r.js";import{L as O,p as Nn,M as ys,w as ws}from"./MacLocalControl-C3rHusSl.js";import{R as ks,C as js}from"./ComputerFilesPane-BWmAv8JT.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-DnedL3jM.js";import{u as Bt,B as Es}from"./BrowserPanel-BqPnj2Bz.js";import{M as De}from"./monitor-FKQbSjca.js";import{C as Ln,w as Rs,a as Ps,p as zs,W as Ts}from"./WorksOnGrid-B84wDbPo.js";import{C as As}from"./MenuMotion-C1J3xC0E.js";import"./index-BkcZ5EE3.js";import"./RoutinesPage-BWJ5Z1Sk.js";import"./ProIntroduction-B1QqcZmr.js";import"./BrowserProfilesManager-BMk7i2tc.js";import"./SignedInSites-Dxnqcjlx.js";import"./minimize-BpyGl78C.js";import"./file-up-BsMMeeDy.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-BgfqxYo9.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(s=>({default:s.DataPanel}))),_n=()=>Pn(()=>import("./LiveDesktop-7h7Mxr41.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 +0,0 @@
|
|
|
1
|
-
import{t as l,r as i,p as ve,j as c,X as he,a as Q}from"./styles-Cm26P6hN.js";import{u as we,Z as xe,_ as ee,$ as ae,n as q,D as be,Y as te,a0 as ke}from"./App-DPG1sq1r.js";import{o as ce,s as ie,e as O,_ as I,n as ye,u as ge,L as T,f as Ne}from"./PlacesRail-DnedL3jM.js";import{M as le}from"./monitor-FKQbSjca.js";import{R as Ce}from"./MenuMotion-C1J3xC0E.js";import"./index-BkcZ5EE3.js";function je(s,e){const u=(n,o)=>n.left<o.right&&n.right>o.left&&n.top<o.bottom&&n.bottom>o.top;return e.some(n=>n.visible&&n.rect.width>0&&n.rect.height>0&&(n.explicit||n.zIndex!==null&&n.zIndex>=10)&&s.some(o=>u(n.rect,o)))}async function Se(s,e,u,n){e&&e!==u&&(await s.setInteractive(null),await s.release(e));const o=await s.take(u);if(!o.held)throw new Error(l("vm.workspace.holdNotAcquired"));if(o.owned!==!0)return{status:"held-elsewhere",botId:u,snapshot:o};try{await s.setInteractive(n)}catch(d){throw await s.setInteractive(null).catch(()=>{}),await s.release(u).catch(()=>{}),d}return{status:"controlled",botId:u,snapshot:o}}async function U(s,e){return e?(await s.setInteractive(null).catch(()=>{}),s.release(e)):null}function ue(s){return s.filter(e=>e.computer==="vm"&&e.hidden!==!0).map(e=>e.id)}function Ee(s,e){const u=ue(s),n=u.includes(e)?e:u[0]??null;return[n,u.find(o=>o!==n)??null]}function Re(s,e,u){const n=[...s],o=e===0?1:0;return u&&n[o]===u&&(n[o]=n[e]),n[e]=u,n}function Le(s,e){const u=ue(e),n=new Set(u),o=[null,null];for(const d of[0,1]){const m=s[d];m&&n.delete(m)&&(o[d]=m)}for(const d of[0,1]){if(o[d])continue;const m=[...n][0];m&&(o[d]=m,n.delete(m))}return o}const ze=ce({mode:I(["shared","per-bot","pool"]).optional(),max_instances:ye().int().positive().optional(),container:I(["running","stopped","missing"]).optional(),network:I(["loopback","unsafe","unknown"]).optional(),security:I(["hardened","unsafe","unknown"]).optional(),persistence:I(["durable","unsafe","unknown"]).optional(),desktopReady:O().optional(),ready:O().optional(),viewer_url:ie().min(1).optional()});function de(s){const e=ze.safeParse(s);return e.success?e.data:null}function H(s){const e=de(s),u=e?.mode??"unknown",n=e?.container??"unknown",o=e?.network??"unknown",d=e?.security??"unknown",m=e?.persistence??"unknown",w=e?.max_instances??0,h=e?.desktopReady===!0,x=!!(e?.ready===!0&&n==="running"&&o==="loopback"&&d==="hardened"&&m==="durable"&&h);return{mode:u,maxInstances:w,container:n,network:o,security:d,persistence:m,desktopReady:h,ready:x}}function Ve(s){const e=de(s);return!e||!H(s).ready?null:e.viewer_url??null}const J=["local-vm-workspace:left","local-vm-workspace:right"],pe=ce({held:O(),helpReason:ie().nullable(),help:Ne().optional().transform(ke),owned:O().optional(),acquired:O().optional(),released:O().optional()});async function ne(s,e,u){const n=await q(`/api/bots/${s}/computer/control`,{method:"POST",body:JSON.stringify({action:e,controlLeaseId:u})}),o=pe.safeParse(n);if(!o.success)throw new Error("invalid-control-snapshot");return o.data}async function Oe(s){const e=pe.safeParse(await q(`/api/bots/${s}/computer/control`));if(!e.success)throw new Error("invalid-control-snapshot");return e.data}function re(s,e){fetch(`/api/bots/${s}/computer/control`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"release",controlLeaseId:e}),keepalive:!0}).then(async u=>{u.ok}).catch(()=>{})}async function se(s,e){return!0}function D(s,e,u){s({type:"computerControl",botId:e,held:u.held,helpReason:u.helpReason,help:u.help??null})}function oe(s){const e=s.current?.getBoundingClientRect();return!e||e.width<1||e.height<1?null:{x:Math.round(e.left),y:Math.round(e.top),width:Math.round(e.width),height:Math.round(e.height)}}const Be=['[aria-modal="true"]','[role="dialog"]','[role="menu"]',"[popover]","[data-native-view-overlay]",".fixed",".absolute"].join(",");function _e(){const s=[...document.querySelectorAll("[data-native-view-host]")],e=s.map(n=>n.getBoundingClientRect()).filter(n=>n.width>0&&n.height>0);if(e.length===0)return!1;const u=[...document.querySelectorAll(Be)].filter(n=>!s.some(o=>n===o||n.contains(o)||o.contains(n))).map(n=>{const o=window.getComputedStyle(n),d=n.matches('[aria-modal="true"], [role="dialog"], [role="menu"], [popover], [data-native-view-overlay]'),m=Number.parseInt(o.zIndex,10);return{rect:n.getBoundingClientRect(),explicit:d,visible:o.display!=="none"&&o.visibility!=="hidden"&&Number(o.opacity)!==0,zIndex:Number.isFinite(m)?m:null}});return je(e,u)}function Ie(s){const[e,u]=i.useState(!1);return i.useEffect(()=>{let n=0;const o=()=>u(_e()),d=()=>{n||(n=requestAnimationFrame(()=>{n=0,o()}))};o();const m=new MutationObserver(d);m.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["class","style","aria-hidden","aria-modal","role","open","popover"]});const w=new ResizeObserver(d);w.observe(document.body);for(const x of document.querySelectorAll("[data-native-view-host]"))w.observe(x);const h=["toggle","animationstart","animationend","transitionstart","transitionend"];for(const x of h)document.addEventListener(x,d,!0);return window.addEventListener("resize",d),window.addEventListener("scroll",d,!0),()=>{n&&cancelAnimationFrame(n),m.disconnect(),w.disconnect();for(const x of h)document.removeEventListener(x,d,!0);window.removeEventListener("resize",d),window.removeEventListener("scroll",d,!0)}},[]),s||e}function Ae(s,e){return s?s.container==="missing"?l("vm.workspace.status.missing"):s.container==="stopped"?l("vm.workspace.status.stopped"):s.ready?e==="error"?l("vm.workspace.status.viewerUnavailable"):e!=="ready"?l("vm.workspace.status.connecting"):l("vm.workspace.status.live"):l("vm.workspace.status.unavailable"):l("vm.workspace.status.checking")}function We({index:s,bot:e,bots:u,otherBotId:n,obscured:o,active:d,heldElsewhere:m,controlPending:w,onSelect:h,onTake:x,onRelease:B,onOpenComputer:A}){const v=J[s],p=e?.id??null,_=e?.name??l("vm.workspace.localVm"),b=i.useRef(null),k=i.useRef(Promise.resolve()),z=i.useRef(o),[W,V]=i.useState(0),[j,N]=i.useState(null),[C,y]=i.useState({contextId:v,open:!1,status:"closed",interactive:!1}),[E,g]=i.useState(null),R=i.useCallback(async t=>{if(p)try{const a=await q(`/api/bots/${p}/local-computer`,{signal:t});t?.aborted||N(H(a))}catch{}},[p]),F=i.useRef(R);i.useEffect(()=>{F.current=R},[R]),i.useEffect(()=>{z.current=o},[o]),i.useEffect(()=>window.ogb?.desktopWorkspace?.onState(a=>{a.contextId===v&&(y(a),(a.status==="error"||a.status==="closed")&&F.current())}),[v]),i.useEffect(()=>{const t=window.ogb?.desktopWorkspace;let a=!0;const f=new AbortController;N(null),g(null),y({contextId:v,open:!1,status:"closed",interactive:!1});const M=async()=>{if(t&&await t.close(v).catch(()=>{}),!(!a||!p)){if(!t){g(l("vm.workspace.desktopRequired"));return}try{const S=await q(`/api/bots/${p}/local-computer`,{signal:f.signal});if(!a)return;const X=H(S);N(X);const Y=Ve(S);if(!X.ready||!Y||(await new Promise(me=>{let G=!1;const K=()=>{G||(G=!0,me())},fe=setTimeout(K,100);requestAnimationFrame(()=>{clearTimeout(fe),K()})}),!a))return;const $=oe(b);if(!$)throw new Error("layout-unavailable");const Z=await t.open({contextId:v,url:Y,title:l("vm.workspace.windowTitle",{name:_}),bounds:$});if(!a){await t.close(v).catch(()=>{});return}y(Z),await t.layout([{contextId:v,bounds:$,visible:!z.current&&Z.open}])}catch(S){if(!a||f.signal.aborted)return;g(S instanceof Error&&S.message==="layout-unavailable"?l("vm.workspace.layoutUnavailable"):l("vm.workspace.connectFailed"))}}};return k.current=k.current.catch(()=>{}).then(M),()=>{a=!1,f.abort(),t&&(k.current=k.current.catch(()=>{}).then(()=>t.close(v).then(()=>{}).catch(()=>{})))}},[p,_,v,W]),i.useEffect(()=>{if(!p)return;const t=new AbortController,a=window.setInterval(()=>{R(t.signal)},3e4);return()=>{t.abort(),window.clearInterval(a)}},[p,R]);const L=i.useCallback(()=>{const t=window.ogb?.desktopWorkspace,a=oe(b);!t||!a||!C.open||t.layout([{contextId:v,bounds:a,visible:!o}]).catch(()=>g(l("vm.workspace.positionFailed")))},[v,C.open,o]);i.useEffect(()=>{const t=b.current;if(!t)return;const a=new ResizeObserver(L);a.observe(t),window.addEventListener("resize",L);const f=requestAnimationFrame(L);return()=>{cancelAnimationFrame(f),a.disconnect(),window.removeEventListener("resize",L)}},[L]);const P=Ae(j,C.status),r=!!(e&&j?.ready&&C.status==="ready"&&C.open);return c.jsxs("section",{className:Q("flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border bg-panel",d?"border-accent/80 shadow-[0_0_0_1px_rgb(var(--accent)/0.35)]":"border-hairline/50"),children:[c.jsxs("div",{className:"flex min-h-[68px] items-center gap-3 border-b border-hairline/40 px-3 py-2.5",children:[c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("label",{className:"sr-only",htmlFor:`local-vm-slot-${s}`,children:l("vm.workspace.paneLabel",{number:s+1})}),c.jsxs(be,{size:"sm",className:"w-full",id:`local-vm-slot-${s}`,value:e?.id??"",onChange:t=>h(t.target.value||null),disabled:w,children:[c.jsx("option",{value:"",children:l("vm.workspace.chooseBot")}),u.map(t=>c.jsx("option",{value:t.id,disabled:t.id===n,children:t.name},t.id))]}),c.jsxs("div",{className:"mt-1 flex items-center gap-1.5 text-[11px] text-ink-secondary",children:[c.jsx("span",{className:Q("h-1.5 w-1.5 rounded-full",d?"bg-accent":C.status==="ready"?"bg-success":C.status==="error"?"bg-danger":"bg-ink-secondary/50")}),d?l("vm.workspace.youHaveControl"):m?l("vm.workspace.controlElsewhere"):P]})]}),e&&d?c.jsxs("button",{type:"button",onClick:B,disabled:w,className:"flex shrink-0 items-center gap-1.5 rounded-lg bg-accent px-2.5 py-2 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[w?c.jsx(T,{size:13,className:"animate-spin"}):c.jsx(te,{size:13}),l("vm.workspace.handBack")]}):e?c.jsxs("button",{type:"button",onClick:()=>x(e.id),disabled:!r||w||m,className:"flex shrink-0 items-center gap-1.5 rounded-lg bg-raised px-2.5 py-2 text-[12px] text-ink hover:bg-raised-hover disabled:opacity-45",title:l("vm.workspace.takeControlTitle"),children:[w?c.jsx(T,{size:13,className:"animate-spin"}):c.jsx(te,{size:13}),m?l("vm.workspace.heldElsewhere"):l("vm.workspace.takeControl")]}):null]}),c.jsx("div",{ref:b,"data-native-view-host":!0,className:"relative min-h-0 flex-1 bg-[#070707]",children:c.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-6 text-center",children:e?!j&&!E?c.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-ink-secondary",children:[c.jsx(T,{size:15,className:"animate-spin"})," ",l("vm.workspace.checking",{name:e.name})]}):j?.ready&&C.status!=="error"&&!E?c.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-ink-secondary",children:[c.jsx(T,{size:15,className:"animate-spin"})," ",l("vm.workspace.connecting")]}):c.jsxs("div",{className:"flex max-w-[300px] flex-col items-center gap-3 text-ink-secondary",children:[c.jsx(ae,{size:21,className:"text-warning"}),c.jsx("div",{className:"text-[12px] leading-relaxed",children:E??(j?.container==="missing"?l("vm.workspace.notCreated",{name:e.name}):j?.container==="stopped"?l("vm.workspace.stopped",{name:e.name}):l("vm.workspace.notReady",{name:e.name}))}),c.jsxs("div",{className:"flex gap-2",children:[c.jsxs("button",{type:"button",onClick:()=>V(t=>t+1),className:"flex items-center gap-1.5 rounded-lg bg-raised px-3 py-2 text-[12px] text-ink hover:bg-raised-hover",children:[c.jsx(Ce,{size:13})," ",l("vm.workspace.retryStatus")]}),c.jsx("button",{type:"button",onClick:()=>A(e.id),className:"rounded-lg bg-raised px-3 py-2 text-[12px] text-ink hover:bg-raised-hover",children:l("vm.workspace.openComputer")})]})]}):c.jsxs("div",{className:"flex max-w-[260px] flex-col items-center gap-2 text-ink-secondary",children:[c.jsx(le,{size:22}),c.jsx("span",{className:"text-[12px]",children:l("vm.workspace.chooseAnother")})]})})})]})}function Ue({primaryBotId:s,overlayOpen:e,onClose:u,onOpenComputer:n}){const{state:o,dispatch:d}=we(),{dragProps:m}=ge(),w=i.useMemo(()=>o.bots.filter(r=>r.computer==="vm"&&!r.hidden),[o.bots]),[h,x]=i.useState(()=>Ee(o.bots,s)),B=i.useRef(h),[A,v]=i.useState(null),p=i.useRef(null),_=i.useRef(null),b=_.current??xe();_.current=b;const k=i.useRef(!1),z=i.useRef(!0),[W,V]=i.useState(!1),[j,N]=i.useState(null),C=Ie(e);i.useEffect(()=>{B.current=h},[h]);const y=i.useMemo(()=>({async take(r){const t=await ee({action:"take",syncNativeBrowser:!0,requestControl:a=>ne(r,a,b),setNativeBrowserControl:a=>se()});return D(d,r,t),t.held&&t.owned===!0?p.current=r:p.current===r&&(p.current=null),t},async release(r){const t=await ee({action:"release",syncNativeBrowser:!0,requestControl:a=>ne(r,a,b),setNativeBrowserControl:a=>se()});return D(d,r,t),p.current===r&&(p.current=null),t},async setInteractive(r){const t=window.ogb?.desktopWorkspace;if(!t)throw new Error(l("vm.workspace.bridgeUnavailable"));return t.setInteractive(r)}}),[b,d]);i.useEffect(()=>{x(r=>{const t=Le(r,o.bots);return t[0]===r[0]&&t[1]===r[1]?r:t})},[o.bots]),i.useEffect(()=>{let r=!0;return(async()=>{for(const a of h)if(a)try{const f=await Oe(a);r&&D(d,a,f)}catch{}})(),()=>{r=!1}},[d,h]),i.useEffect(()=>{const r=p.current;!r||h.includes(r)||U(y,r).then(()=>{v(null)}).catch(()=>{N(l("vm.workspace.handoffFailed"))})},[y,h]),i.useEffect(()=>(z.current=!0,()=>{z.current=!1;const r=p.current,t=window.ogb?.desktopWorkspace;if(!t){r&&re(r,b);return}t.setInteractive(null).catch(()=>{}).then(()=>(r&&re(r,b),t.close())).catch(()=>{})}),[b]);const E=i.useCallback(r=>{const t=B.current.indexOf(r);return t<0?null:J[t]},[]),g=i.useCallback(async()=>{const r=p.current;if(!r)return!0;if(k.current)return!1;k.current=!0,V(!0),N(null);try{return await U(y,r),v(null),!0}catch{return N(l("vm.workspace.handBackFailed",{app:ve()})),!1}finally{k.current=!1,V(!1)}},[y]),R=i.useCallback(async r=>{if(k.current||p.current===r)return;const t=window.ogb?.desktopWorkspace,a=E(r);if(!(!t||!a)){k.current=!0,V(!0),N(null);try{const f={...y,async setInteractive(S){if(S&&E(r)!==S)throw new Error(l("vm.workspace.paneChanged"));return y.setInteractive(S)}},M=await Se(f,p.current,r,a);if(v(null),M.status==="held-elsewhere"){N(l("vm.workspace.alreadyControlled"));return}if(!z.current){await U(y,r).catch(()=>{});return}v(r)}catch{v(p.current),N(l("vm.workspace.switchFailed"))}finally{k.current=!1,V(!1)}}},[E,y]),F=i.useCallback(async(r,t)=>{if(k.current)return;const a=B.current[r];a!==t&&(a&&p.current===a&&!await g()||x(f=>Re(f,r,t)))},[g]),L=i.useCallback(async()=>{p.current&&!await g()||u()},[g,u]),P=i.useCallback(async r=>{p.current&&!await g()||n(r)},[g,n]);return c.jsxs("main",{className:"flex h-full min-w-0 flex-1 flex-col bg-app",children:[c.jsxs("header",{...m,className:"flex min-h-[60px] items-center gap-3 border-b border-hairline/40 px-5 py-3",children:[c.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-accent/15 text-accent",children:c.jsx(le,{size:18})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("h1",{className:"truncate text-[14px] font-semibold text-ink",children:l("vm.workspace.viewTitle")}),c.jsx("p",{className:"truncate text-[12px] text-ink-secondary",children:l("vm.workspace.viewSubtitle")})]}),c.jsx("button",{type:"button",onClick:()=>{L()},disabled:W,className:"rounded-md p-1.5 text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-50","aria-label":l("vm.workspace.closeView"),children:c.jsx(he,{size:18})})]}),j&&c.jsxs("div",{className:"mx-3 mt-3 flex items-center gap-2 rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-[12px] text-danger",children:[c.jsx(ae,{size:14,className:"shrink-0"})," ",j]}),c.jsx("div",{className:"grid min-h-0 flex-1 grid-cols-2 gap-3 p-3",children:[0,1].map(r=>{const t=h[r],a=w.find(f=>f.id===t)??null;return c.jsx(We,{index:r,bot:a,bots:w,otherBotId:h[r===0?1:0],obscured:C,active:!!(a&&A===a.id),heldElsewhere:!!(a&&o.computerControl[a.id]?.held&&A!==a.id),controlPending:W,onSelect:f=>{F(r,f)},onTake:f=>{R(f)},onRelease:()=>{g()},onOpenComputer:f=>{P(f)}},J[r])})})]})}export{Ue as LocalVmWorkspace};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as v,t as n,r as u,j as t}from"./styles-Cm26P6hN.js";import{d as L,L as k}from"./PlacesRail-DnedL3jM.js";import{bj as C,bk as j,$ as N,bl as M,bm as S}from"./App-DPG1sq1r.js";const E=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],T=v("shield",E);async function I(e,r,s,a=6e4){const o=Date.now()+a;let c=e;for(;!c.ready&&c.container==="running"&&Date.now()<o;)s.throwIfAborted(),await new Promise((p,d)=>{const m=()=>{window.clearTimeout(l),d(s.reason)},l=window.setTimeout(()=>{s.removeEventListener("abort",m),p()},2e3);s.addEventListener("abort",m,{once:!0})}),c=await r();return s.throwIfAborted(),c}function g(e){if(!e)return e??null;const s={"Create the Local VM":"computer.problem.createVm","The Local VM is stopped; start it to continue":"computer.problem.vmStopped","The Local VM started, but Cua Driver is not ready yet":"computer.problem.cuaNotReady","The existing Local VM uses an older desktop or Cua Driver; recreate it":"computer.problem.oldImage","The existing container was not created by Limix Bot; recreate it":"computer.problem.unmanaged","The existing Local VM exposes its viewer publicly; recreate it":"computer.problem.publicViewer","The existing Local VM is missing safety limits; recreate it":"computer.problem.missingLimits","The existing Local VM is missing its durable folder; recreate it":"computer.problem.missingDurableFolder","Per-bot Local VMs require Docker or Podman because Apple container requires a fixed host port":"computer.problem.perBotRuntime","Install a supported container runtime first":"computer.problem.noRuntime"}[e];if(s)return n(s);const a=/^Start (\S+) first$/.exec(e);if(a)return n("computer.problem.startRuntime",{runtime:a[1]});const o=/^The Local VM desktop failed to start: (.+)$/.exec(e);return o?n("computer.problem.desktopFailed",{detail:o[1]}):e}class V extends Error{constructor(r,s,a){super(r),this.key=r,this.problem=s,this.fallbackKey=a}key;problem;fallbackKey}function K(e){return e instanceof V?n(e.key,e.fallbackKey?{problem:g(e.problem)??n(e.fallbackKey)}:void 0):g(e instanceof Error?e.message:e)}let f=!1;const b=new Set,R=e=>(b.add(e),()=>{b.delete(e)}),w=()=>f;function D(){f=!0;for(const e of b)e()}async function P(e=r=>window.ogb?.permOpenSettings?.(r)){await e("accessibility"),!f&&await e("screen")}function B(){const{capabilities:e}=L(),r=u.useSyncExternalStore(R,w,w),s=e.localComputer.available?null:e.localComputer.message,a=C(j(s)),[o,c]=u.useState(!1),[p,d]=u.useState(!1),[m,l]=u.useState(null),h=async()=>{c(!0),l(null);try{await window.ogb?.localControl?.retry()}catch(i){l(i instanceof Error?i.message:String(i))}finally{c(!1)}},y=async()=>{l(null),d(!0);try{await P()}catch(i){d(!1),l(i instanceof Error?i.message:String(i))}};return u.useEffect(()=>{if(!p||r)return;let i=!1;const x=()=>{i||document.visibilityState==="visible"&&(i=!0,d(!1),h())};return window.addEventListener("focus",x),document.addEventListener("visibilitychange",x),()=>{window.removeEventListener("focus",x),document.removeEventListener("visibilitychange",x)}},[p,r]),e.host.platform!=="darwin"||e.localComputer.reasonCode==="remote-server"||e.localComputer.available||r?null:t.jsx("section",{className:"mt-4 rounded-xl border border-warning/25 bg-warning/10 p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx(T,{size:16,className:"mt-0.5 shrink-0 text-warning"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-[14px] font-medium text-ink",children:n("computer.mac.allowTitle")}),t.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:a??n("computer.mac.permission.generic")}),s&&t.jsxs("details",{className:"mt-2 text-[12px] text-ink-secondary",children:[t.jsx("summary",{className:"cursor-pointer",children:n("computer.mac.permission.driverDetail")}),t.jsx("p",{className:"mt-1 break-words",children:s})]}),m&&t.jsxs("div",{className:"mt-2 flex gap-1.5 text-[12px] text-danger",children:[t.jsx(N,{size:13,className:"mt-0.5 shrink-0"}),t.jsx("span",{children:m})]}),t.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[a&&s&&t.jsx(M,{reason:s}),!a&&t.jsx("button",{type:"button",onClick:()=>{y()},disabled:o,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:n("computer.mac.openSystemSettings")}),t.jsxs("button",{type:"button",onClick:()=>{h()},disabled:o,className:"inline-flex items-center gap-1.5 rounded-lg border border-hairline/50 px-3 py-1.5 text-[13px] font-medium text-ink hover:bg-raised disabled:opacity-50",children:[o&&t.jsx(k,{size:13,className:"animate-spin"}),n("commandAllowlist.retry")]}),!o&&t.jsx(S,{onClick:D})]})]})]})})}export{V as L,B as M,g as l,K as p,I as w};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as d,j as t,t as n}from"./styles-Cm26P6hN.js";import{r as c}from"./PlacesRail-DnedL3jM.js";import{Q as x}from"./index-DvRd5uj9.js";import{E as p,H as m,J as u}from"./App-DPG1sq1r.js";import"./monitor-FKQbSjca.js";import"./index-BkcZ5EE3.js";import"./MenuMotion-C1J3xC0E.js";const f=[{id:"ios",nameKey:"phoneApp.ios",actionKey:"phoneApp.iosAction",url:p},{id:"android",nameKey:"phoneApp.android",actionKey:"phoneApp.androidAction",url:m}];function N({open:r,onClose:o,connect:i=[]}){const a=d.useRef(null);if(d.useEffect(()=>{if(!r)return;a.current?.focus();const e=l=>{l.key==="Escape"&&(l.preventDefault(),o())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[r,o]),!r)return null;const s=t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-6",onMouseDown:e=>e.target===e.currentTarget&&o(),children:t.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"phone-app-dialog-title",className:"max-h-full w-full max-w-[460px] overflow-y-auto rounded-2xl border border-hairline/50 bg-panel p-6 shadow-2xl",children:[t.jsx("h2",{id:"phone-app-dialog-title",className:"text-[17px] font-semibold text-ink",children:n("phoneApp.title")}),t.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:n("phoneApp.subtitle")}),t.jsx("ul",{className:"mt-4 grid grid-cols-1 gap-3 sm:grid-cols-2",children:f.map(e=>t.jsxs("li",{"data-phone-app":e.id,className:"flex flex-col items-center gap-3 rounded-xl bg-card p-4 text-center",children:[t.jsx("div",{className:"text-[14px] font-medium text-ink",children:n(e.nameKey)}),t.jsx("div",{className:"rounded-md bg-white p-2",children:t.jsx(x,{value:e.url,size:132,level:"M",bgColor:"#ffffff",fgColor:"#111111",title:n(e.actionKey)})}),t.jsx("button",{type:"button",onClick:()=>{u(e.url)},className:"text-[13px] text-accent hover:underline",children:n(e.actionKey)})]},e.id))}),i.length?t.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[t.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:n("phoneApp.next")}),i.map((e,l)=>t.jsxs("button",{type:"button","data-phone-app-connect":e.key,onClick:()=>{o(),e.onSelect()},className:l===0?"flex w-full flex-col items-center rounded-xl bg-accent px-4 py-2 text-[13px] font-medium text-accent-ink hover:opacity-90":"flex w-full flex-col items-center rounded-xl border border-hairline/50 px-4 py-2 text-[13px] font-medium text-ink hover:bg-raised",children:[t.jsx("span",{children:n("sidebar.menu.connectPhone")}),t.jsx("span",{className:"text-[12px] font-normal opacity-80",children:e.subtitle})]},e.key))]}):null,t.jsx("button",{ref:a,type:"button",onClick:o,className:"mt-3 w-full rounded-xl bg-raised px-4 py-2 text-[13px] font-medium text-ink hover:brightness-110",children:n("common.close")})]})});return typeof document>"u"?s:c.createPortal(s,document.body)}export{f as PHONE_APPS,N as PhoneAppDialog};
|