limixbot 0.2.3 → 0.2.5

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.
Files changed (125) hide show
  1. package/dist/app-icon-192.png +0 -0
  2. package/dist/app-icon-512.png +0 -0
  3. package/dist/app-icon.svg +1 -4
  4. package/dist/apple-touch-icon.png +0 -0
  5. package/dist/assets/{ActivityPanel-SyXMCej4.js → ActivityPanel-DC3XVGOc.js} +1 -1
  6. package/dist/assets/{App-X_zk2xl3.js → App-Dc7eNHIo.js} +9 -9
  7. package/dist/assets/{AppEventEditor-B-cNA9KG.js → AppEventEditor-MqHYrUPZ.js} +1 -1
  8. package/dist/assets/{BotSettingsDialog-CmheslCU.js → BotSettingsDialog-BrmKiJZJ.js} +1 -1
  9. package/dist/assets/{BrowserPanel-BHNWYfsE.js → BrowserPanel-CGq-8k9k.js} +1 -1
  10. package/dist/assets/{BrowserProfilesManager-TkQi-a3T.js → BrowserProfilesManager-N5zHMoeH.js} +1 -1
  11. package/dist/assets/{CloudAddDialog-CqMPQ-0_.js → CloudAddDialog-DIm-M9CF.js} +1 -1
  12. package/dist/assets/{ComputerFilesPane-C2_Khy6Z.js → ComputerFilesPane-CP_exuaN.js} +1 -1
  13. package/dist/assets/{ComputerPanel-Zc6gSPqv.js → ComputerPanel-SaUcSoW6.js} +2 -2
  14. package/dist/assets/{DataPanel-BQfys1jK.js → DataPanel-CBVx04Rh.js} +1 -1
  15. package/dist/assets/{DesktopViewer-CmQvv2Qp.js → DesktopViewer-Cya-HlUY.js} +1 -1
  16. package/dist/assets/{FilesView-DIvdjTfH.js → FilesView-BS2JAg48.js} +1 -1
  17. package/dist/assets/{GrokMoveDialog-ClB9Gmym.js → GrokMoveDialog-kG0ReJlG.js} +1 -1
  18. package/dist/assets/{InspectorPanel-D86H4VDB.js → InspectorPanel-BT3llt3b.js} +1 -1
  19. package/dist/assets/{KeyboardShortcutsModal--OBnvszl.js → KeyboardShortcutsModal-L8FD783r.js} +1 -1
  20. package/dist/assets/{LiveDesktop-qaS7h5XB.js → LiveDesktop-n3XPWd5c.js} +1 -1
  21. package/dist/assets/{LocalVmWorkspace-B-P5zHz6.js → LocalVmWorkspace-v7UlCW9t.js} +1 -1
  22. package/dist/assets/{MacLocalControl-BYNcLKoB.js → MacLocalControl-v51B79TD.js} +1 -1
  23. package/dist/assets/{MarkdownFilePreview-DlUycNRH.js → MarkdownFilePreview-B2U1b00V.js} +1 -1
  24. package/dist/assets/{MenuMotion-V6wxTHIu.js → MenuMotion-BjmjRIR3.js} +1 -1
  25. package/dist/assets/{NewBotDialog-oiX-W3q2.js → NewBotDialog-FgTNwkT5.js} +1 -1
  26. package/dist/assets/{PhoneAppDialog-PE1xfgqx.js → PhoneAppDialog-BAqdCsuh.js} +1 -1
  27. package/dist/assets/PlacesRail-msEDHUXY.js +57 -0
  28. package/dist/assets/{PluginsPanel-DObrpruo.js → PluginsPanel-BROkmoVw.js} +1 -1
  29. package/dist/assets/{ProIntroduction-CC1iFzJ8.js → ProIntroduction-D8SaBehJ.js} +1 -1
  30. package/dist/assets/{RemoteAgentSettingsPanel-BmTQFEnJ.js → RemoteAgentSettingsPanel-BdJpTB-X.js} +1 -1
  31. package/dist/assets/{RoomPanel-Dqe-JRuH.js → RoomPanel-BltzAc2X.js} +1 -1
  32. package/dist/assets/{RoutinesPage-DF0vugaB.js → RoutinesPage-CRvNKmna.js} +1 -1
  33. package/dist/assets/SettingsModal-B5Fjq814.js +11 -0
  34. package/dist/assets/{ShareTeamDialog-CAAPet8R.js → ShareTeamDialog-BrYsQ1YB.js} +1 -1
  35. package/dist/assets/{SignedInSites-DMOzwYFf.js → SignedInSites-BGsMS1IG.js} +1 -1
  36. package/dist/assets/{TeamLibraryPanel-D4zeyxsY.js → TeamLibraryPanel-C3YIy7_M.js} +1 -1
  37. package/dist/assets/{TeamMapPage-DG7S7JTR.js → TeamMapPage-DjqBIDae.js} +1 -1
  38. package/dist/assets/{TriggersPage--3O5UVSD.js → TriggersPage-By978rcW.js} +1 -1
  39. package/dist/assets/{VisibilitySection-DQw13aWS.js → VisibilitySection-BMxXxacO.js} +1 -1
  40. package/dist/assets/{WebhookTrigger-D9RAfcql.js → WebhookTrigger-B0TCdhpi.js} +1 -1
  41. package/dist/assets/{WorksOnGrid-CviOksXp.js → WorksOnGrid-BYivdc01.js} +1 -1
  42. package/dist/assets/{abnfDiagram-YUKMZFIV-BLZgYnje.js → abnfDiagram-YUKMZFIV-C05fUibh.js} +1 -1
  43. package/dist/assets/{activity-DCHcmn3c.js → activity-cUbbx7sx.js} +1 -1
  44. package/dist/assets/{architectureDiagram-47P4ROYG-D0neESJD.js → architectureDiagram-47P4ROYG-NfpIFKPz.js} +1 -1
  45. package/dist/assets/{blockDiagram-E7TT5TSB-CrnkLSzZ.js → blockDiagram-E7TT5TSB-8M_Yd-sD.js} +1 -1
  46. package/dist/assets/{c4Diagram-CRA5TL53-D0tNc6O-.js → c4Diagram-CRA5TL53-V7Ru-p8C.js} +1 -1
  47. package/dist/assets/{calendar-days-C5I0mEXB.js → calendar-days-Cj-W81bu.js} +1 -1
  48. package/dist/assets/channel-g_Dn_OGJ.js +1 -0
  49. package/dist/assets/{chunk-2Q5K7J3B-DGtBJhY1.js → chunk-2Q5K7J3B-BYHHX_Gv.js} +1 -1
  50. package/dist/assets/{chunk-5VM5RSS4-D5kTbdEy.js → chunk-5VM5RSS4-C3e0S7UU.js} +1 -1
  51. package/dist/assets/{chunk-7TKQ45FW-DaN8eX-m.js → chunk-7TKQ45FW-Do-zCrfY.js} +1 -1
  52. package/dist/assets/{chunk-AW2ZBBNX-DMhIBKZU.js → chunk-AW2ZBBNX-BqIHZ9wm.js} +1 -1
  53. package/dist/assets/{chunk-FVRAUYC3-Dos86Pqk.js → chunk-FVRAUYC3-DR-XXMxd.js} +2 -2
  54. package/dist/assets/{chunk-HTAEGDNF-CsLodVYj.js → chunk-HTAEGDNF-Bfo8GCM2.js} +1 -1
  55. package/dist/assets/{chunk-JWPE2WC7-6THZlDrB.js → chunk-JWPE2WC7-CihnqCYu.js} +1 -1
  56. package/dist/assets/{chunk-KQW6MTUR-CoD74fHy.js → chunk-KQW6MTUR-CaCMq-KE.js} +1 -1
  57. package/dist/assets/{chunk-XXDRQBXY-DMl-0hJf.js → chunk-XXDRQBXY-D9V51Esf.js} +1 -1
  58. package/dist/assets/{classDiagram-v2-K4WV4PDN-BscLWNpw.js → classDiagram-v2-K4WV4PDN-CAJUY4h-.js} +1 -1
  59. package/dist/assets/{coins-CZu-SgM9.js → coins-CxC_dI0J.js} +1 -1
  60. package/dist/assets/{core-BDlOAqLn.js → core-CcNJeiz-.js} +1 -1
  61. package/dist/assets/{cose-bilkent-JH36ORCC-BeKB4nW9.js → cose-bilkent-JH36ORCC-9vWz4wK0.js} +1 -1
  62. package/dist/assets/{cynefin-EF2NZ3EQ-D0aWGmzz.js → cynefin-EF2NZ3EQ-DCUYk2lC.js} +1 -1
  63. package/dist/assets/{cynefinDiagram-3GCD6N5R-4SW-h53B.js → cynefinDiagram-3GCD6N5R-DdjMYI6o.js} +1 -1
  64. package/dist/assets/{dagre-W4DXFKR2-DNq2AGoj.js → dagre-W4DXFKR2-DGIBnF7r.js} +1 -1
  65. package/dist/assets/{diagram-2UJZ2QOL-lSLAkRD3.js → diagram-2UJZ2QOL-B3r3D9sZ.js} +1 -1
  66. package/dist/assets/{diagram-OVF4WLC6-BHf__HqF.js → diagram-OVF4WLC6-B1u7LfGA.js} +1 -1
  67. package/dist/assets/{diagram-PFPMY2P6-B5YmPbc0.js → diagram-PFPMY2P6-vVzEd5hO.js} +1 -1
  68. package/dist/assets/{diagram-UMYRVEAY-DdOUcYJA.js → diagram-UMYRVEAY-WinDNDJc.js} +1 -1
  69. package/dist/assets/{diagram-YEKJPTXX-r41O-hkk.js → diagram-YEKJPTXX-7g_9oznG.js} +1 -1
  70. package/dist/assets/{diagram-ZIFT7M5P-DKV_3_Sr.js → diagram-ZIFT7M5P-BqrG5z2v.js} +1 -1
  71. package/dist/assets/{ebnfDiagram-VR2GEFS7-CD4xgv0O.js → ebnfDiagram-VR2GEFS7-BpNGIiLF.js} +1 -1
  72. package/dist/assets/{elk-IJKZMXRS-D0Vwqj3g.js → elk-IJKZMXRS-BCv8wGAA.js} +1 -1
  73. package/dist/assets/{erDiagram-O2IAPWRE-C388tpIL.js → erDiagram-O2IAPWRE-Do-qhVwx.js} +1 -1
  74. package/dist/assets/{file-up-DGhlT3MD.js → file-up-Gm3ZlE_0.js} +1 -1
  75. package/dist/assets/{flowDiagram-OXPTDLAJ-B1p6s4tu.js → flowDiagram-OXPTDLAJ-R-Kh5wq9.js} +1 -1
  76. package/dist/assets/{ganttDiagram-R7TSEDQI-BzJAoXbd.js → ganttDiagram-R7TSEDQI-B3l0oJP5.js} +1 -1
  77. package/dist/assets/{gitGraphDiagram-XJZIOB7I-Bb3SHitI.js → gitGraphDiagram-XJZIOB7I-BYib7PqD.js} +1 -1
  78. package/dist/assets/{import-name-B7AGian6.js → import-name-1v6bgYwg.js} +1 -1
  79. package/dist/assets/{index-DJPPxxyF.js → index-BEBI8eA5.js} +2 -2
  80. package/dist/assets/{index-C-EiNxm_.js → index-DjRLXqpq.js} +1 -1
  81. package/dist/assets/{index-CmUdQ2of.js → index-tkGe0e3F.js} +1 -1
  82. package/dist/assets/{infoDiagram-5W2HQ5XZ-DUF-NVrB.js → infoDiagram-5W2HQ5XZ-DqcpfbG0.js} +1 -1
  83. package/dist/assets/{ishikawaDiagram-K3B6WC7H-CITswxnS.js → ishikawaDiagram-K3B6WC7H-CVNaP0rR.js} +1 -1
  84. package/dist/assets/{journeyDiagram-COXZFDF6-C8xhr3tj.js → journeyDiagram-COXZFDF6-BXHOKVEA.js} +1 -1
  85. package/dist/assets/{kanban-definition-P3RFRI5V-C94FCxQq.js → kanban-definition-P3RFRI5V-Bb8Vpv2-.js} +1 -1
  86. package/dist/assets/{mcp-servers-Cu4E6BBW.js → mcp-servers-BdjmXJSB.js} +1 -1
  87. package/dist/assets/{mermaid.core-5_WMXhyJ.js → mermaid.core-CnUFOtXD.js} +4 -4
  88. package/dist/assets/{mindmap-definition-LZFPQGKD-Dgq8HUHz.js → mindmap-definition-LZFPQGKD-DeV-Tw7G.js} +1 -1
  89. package/dist/assets/{minimize-C8Om8qhk.js → minimize-lhY0HYEB.js} +1 -1
  90. package/dist/assets/{monitor-DUEBF6Jm.js → monitor-DagRnmYm.js} +1 -1
  91. package/dist/assets/{new-bot-DKmgM4tN.js → new-bot-R2d69ePy.js} +1 -1
  92. package/dist/assets/{org-library-BqY2D4NK.js → org-library-CTZWRg3z.js} +1 -1
  93. package/dist/assets/{package-format-BZOfdy7w.js → package-format-D4k7Rh0H.js} +1 -1
  94. package/dist/assets/{pegDiagram-BGZESJAR-DM0SAjez.js → pegDiagram-BGZESJAR-B9zfytOo.js} +1 -1
  95. package/dist/assets/{pieDiagram-CAPJLFHJ-okeIqCL5.js → pieDiagram-CAPJLFHJ-Co2k1c9h.js} +1 -1
  96. package/dist/assets/{quadrantDiagram-GDMTTRAM-ihMGhHs3.js → quadrantDiagram-GDMTTRAM-D7jzEAY-.js} +1 -1
  97. package/dist/assets/{rail-JcqaOG9e.js → rail-B_8Y8FUg.js} +1 -1
  98. package/dist/assets/{railroadDiagram-SM67HX2B-CkWYP-ib.js → railroadDiagram-SM67HX2B-BvPh7fmA.js} +1 -1
  99. package/dist/assets/{remote-desktop-panel-ij2w_JZy.js → remote-desktop-panel-ipZYKPLT.js} +1 -1
  100. package/dist/assets/{requirementDiagram-X7JNWC4A-CSZ3nQJ1.js → requirementDiagram-X7JNWC4A-yg9WIdG5.js} +1 -1
  101. package/dist/assets/{sankeyDiagram-UM26HJRW-RL7DTxjH.js → sankeyDiagram-UM26HJRW-BKhYJMCX.js} +1 -1
  102. package/dist/assets/{sequenceDiagram-ZO4K6R2Y-C6MjuYtv.js → sequenceDiagram-ZO4K6R2Y-B3hAFJ3r.js} +1 -1
  103. package/dist/assets/{sizeCapture-INFHLROL-QtHNQM-7.js → sizeCapture-INFHLROL-B5ubpsDi.js} +1 -1
  104. package/dist/assets/{stateDiagram-v2-TBUQTH76-CwPZ7nQm.js → stateDiagram-v2-TBUQTH76-DDviCg3l.js} +1 -1
  105. package/dist/assets/{styles-Bj-lDRZL.js → styles-BYp3glRK.js} +1 -1
  106. package/dist/assets/{swimlanes-N4OXWK64-BfcwKeNi.js → swimlanes-N4OXWK64-YthTzBgy.js} +1 -1
  107. package/dist/assets/swimlanesDiagram-K3J5GTZL-CywojYgU.js +8 -0
  108. package/dist/assets/{team-share-BQnZfIPS.js → team-share-By8wCeng.js} +1 -1
  109. package/dist/assets/{timeline-definition-YOQAKGHF-COZpJ85U.js → timeline-definition-YOQAKGHF-CH_BuHOF.js} +1 -1
  110. package/dist/assets/{usecaseDiagram-VIAY4XPW-B6vldE5m.js → usecaseDiagram-VIAY4XPW-zmJ_6-S0.js} +1 -1
  111. package/dist/assets/{vennDiagram-BLWOH2XV-Cmgzf72_.js → vennDiagram-BLWOH2XV-Cdq5FiyY.js} +1 -1
  112. package/dist/assets/{wardleyDiagram-YMQ3BMBF-XlosqW3x.js → wardleyDiagram-YMQ3BMBF-CUm4PvZj.js} +1 -1
  113. package/dist/assets/{xychartDiagram-TAQBALBS-Byro5SJm.js → xychartDiagram-TAQBALBS-BFRcupRR.js} +1 -1
  114. package/dist/index.html +2 -2
  115. package/dist/rail.html +4 -4
  116. package/dist-server/package.json +1 -1
  117. package/dist-server/shared/mascot-bodies.js +4 -4
  118. package/package.json +1 -1
  119. package/dist/assets/PlacesRail-B9RHHjvB.js +0 -57
  120. package/dist/assets/SettingsModal--kx8POGb.js +0 -11
  121. package/dist/assets/channel-uYq3EMr8.js +0 -1
  122. package/dist/assets/cursor-128-D_P4sIyM.webp +0 -0
  123. package/dist/assets/cursor-192-TWSdnzcT.webp +0 -0
  124. package/dist/assets/cursor-256-Mw4jC-Z3.webp +0 -0
  125. package/dist/assets/swimlanesDiagram-K3J5GTZL-D3m_eGXn.js +0 -8
@@ -1,4 +1,4 @@
1
- import{c as dn,t as n,r as d,j as e,X as es,aj as ts,a as G,f as Ye,o as Xt,b as Bt,aD as ws,S as Ns,i as _t}from"./styles-Bj-lDRZL.js";import{S as un,n as w,u as et,eq as As,er as Cs,es as Ss,et as ht,D as Rs,eu as Es,ev as zs,l as Is,G as Sn,ew as Ts,ex as Os,cI as Bs,T as Ps,ah as en,br as Ms,ey as Rt,ez as ns,eA as Et,eB as ss,an as as,eC as zt,eD as Ls,eE as is,eF as It,eG as os,eH as Us,eI as Rn,eJ as $s,Y as cs,eK as Nt,eL as Fs,eM as Ks,eN as Ds,eO as Qs,eP as Hs,eQ as ct,eR as En,eS as Js,eT as zn,e4 as In,eU as _s,eV as Vs,eW as Gs,eX as Vt,eY as qs,eZ as Zs,e_ as Ws,e$ as Ys,f0 as Xs,f1 as ea,f2 as ta,f3 as na,f4 as sa,f5 as aa,f6 as ia}from"./App-X_zk2xl3.js";import{L as ae,P as rs,X as oa,a as ca,y as pn,E as ra,$ as la,B as da}from"./PlacesRail-B9RHHjvB.js";import{u as Gt}from"./mcp-servers-Cu4E6BBW.js";import{C as ls,R as tn}from"./MenuMotion-V6wxTHIu.js";import{u as ua}from"./ProIntroduction-CC1iFzJ8.js";import"./index-DJPPxxyF.js";import"./monitor-DUEBF6Jm.js";const pa=[["path",{d:"M13 2a9 9 0 0 1 9 9",key:"1itnx2"}],["path",{d:"M13 6a5 5 0 0 1 5 5",key:"11nki7"}],["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],ma=dn("phone-call",pa);const ha=[["path",{d:"M4.9 16.1C1 12.2 1 5.8 4.9 1.9",key:"s0qx1y"}],["path",{d:"M7.8 4.7a6.14 6.14 0 0 0-.8 7.5",key:"1idnkw"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}],["path",{d:"M16.2 4.8c2 2 2.26 5.11.8 7.47",key:"ojru2q"}],["path",{d:"M19.1 1.9a9.96 9.96 0 0 1 0 14.1",key:"rhi7fg"}],["path",{d:"M9.5 18h5",key:"mfy3pd"}],["path",{d:"m8 22 4-11 4 11",key:"25yftu"}]],xa=dn("radio-tower",ha);const fa=[["path",{d:"m10.852 14.772-.383.923",key:"11vil6"}],["path",{d:"M13.148 14.772a3 3 0 1 0-2.296-5.544l-.383-.923",key:"1v3clb"}],["path",{d:"m13.148 9.228.383-.923",key:"t2zzyc"}],["path",{d:"m13.53 15.696-.382-.924a3 3 0 1 1-2.296-5.544",key:"1bxfiv"}],["path",{d:"m14.772 10.852.923-.383",key:"k9m8cz"}],["path",{d:"m14.772 13.148.923.383",key:"1xvhww"}],["path",{d:"M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5",key:"tn8das"}],["path",{d:"M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5",key:"1g2pve"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"m9.228 10.852-.923-.383",key:"1wtb30"}],["path",{d:"m9.228 13.148-.923.383",key:"1a830x"}]],qt=dn("server-cog",fa),ga=new Set(["twitter","x"]);function Tn(t,s){return t!=="managed"||!ga.has(s.trim().toLowerCase())?null:"Twitter/X needs your own X Developer app and Composio auth config. Use self-hosted connected apps for now."}const ba=5,ya=3,Tt=4;function ka(t,s=ba,c=[]){const o=new Map;for(const g of t)for(const k of new Set(g.categories??[]))o.set(k,(o.get(k)??0)+1);const r=[...o].sort((g,k)=>k[1]-g[1]||g[0].localeCompare(k[0])).map(([g])=>g),l=c.filter(g=>r.indexOf(g)>=s),y=[...r.slice(0,Math.max(0,s-l.length)),...l];return{inline:y,more:r.filter(g=>!y.includes(g))}}function nn(t,s){return s===null||(t.categories??[]).includes(s)}function ja(t,s,c){const o=[],r=t.filter(l=>s(l.slug));r.length&&o.push({kind:"connected",cards:r});for(const l of c.slice(0,ya)){const y=t.filter(g=>!s(g.slug)&&nn(g,l));y.length&&o.push({kind:"category",category:l,cards:y.slice(0,Tt),more:y.length>Tt})}return o.push({kind:"all",cards:t.filter(l=>!s(l.slug))}),o}const va={productivity:"productivity","developer tools":"developerTools",communication:"communication",files:"files","sales and crm":"salesCrm",design:"design",marketing:"marketing",analytics:"analytics",social:"social"},wa={"google calendar":"googleCalendar","google sheets":"googleSheets","google docs":"googleDocs",notion:"notion",github:"github",linear:"linear",sentry:"sentry",jira:"jira",slack:"slack",gmail:"gmail",discord:"discord","google drive":"googleDrive",posthog:"posthog","x (twitter)":"xTwitter",reddit:"reddit",zapier:"zapier",hubspot:"hubspot",salesforce:"salesforce",asana:"asana",trello:"trello",dropbox:"dropbox",airtable:"airtable",figma:"figma",stripe:"stripe"};function rt(t){const s=va[t.trim().toLowerCase()];return s?n(`apps.category.${s}`):t}function On(t){const s=wa[t.label.trim().toLowerCase()];return s?n(`apps.catalog.${s}.blurb`):t.blurb}function Na({server:t,disabled:s,onSaved:c}){const[o,r]=d.useState(!1),[l,y]=d.useState(null);if(typeof t.apps!="boolean"||t.apps&&t.hasApps!==!0)return null;const g=t.apps,k=async()=>{r(!0),y(null);try{const p=await w(`/api/mcp/servers/${encodeURIComponent(t.name)}`,{method:"PATCH",body:JSON.stringify({apps:!g})});c(p.servers??[])}catch(p){y(p instanceof Error?p.message:String(p))}finally{r(!1)}};return e.jsxs("div",{"data-mcp-apps":t.name,className:"mt-3 flex items-center gap-3 border-t border-hairline/40 pt-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-[13px] font-medium text-ink",children:n("mcp.apps.title")}),e.jsx("div",{role:l?"alert":void 0,className:l?"mt-0.5 text-[12px] text-danger":"mt-0.5 text-[12px] text-ink-secondary",children:l??n("mcp.apps.desc")})]}),o&&e.jsx(ae,{"aria-hidden":"true",size:13,className:"animate-spin text-ink-secondary"}),e.jsx(un,{checked:g,disabled:s||o,onClick:()=>{k()},"aria-label":n("mcp.apps.toggleAria",{name:t.name}),className:"disabled:opacity-40"})]})}function Bn({feature:t,enabled:s,prefix:c}){const{dispatch:o}=et(),[r,l]=d.useState(!1),[y,g]=d.useState(!1),k=async()=>{if(!r){l(!0),g(!1);try{const p=await w("/api/config",{method:"PATCH",body:JSON.stringify({features:{[t]:!s}})});o({type:"configStatus",config:p})}catch{g(!0)}finally{l(!1)}}};return e.jsxs("div",{className:"mt-4 flex items-start justify-between gap-4 rounded-2xl border border-hairline/50 bg-card px-4 py-4 sm:px-5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:n(`${c}.title`)}),e.jsx("p",{className:"mt-1 text-[12px] leading-relaxed text-ink-secondary",children:n(`${c}.desc`)}),y&&e.jsx("p",{role:"alert",className:"mt-1 text-[12px] text-danger",children:n("mcp.claude.error")})]}),e.jsx(un,{checked:s,"aria-label":n(`${c}.aria`),disabled:r,onClick:()=>{k()},className:"mt-0.5 shrink-0 disabled:cursor-wait disabled:opacity-50"})]})}function Aa(){const{state:t}=et();return e.jsxs(e.Fragment,{children:[e.jsx(Bn,{feature:"claudeUserMcp",enabled:As(t.config),prefix:"mcp.claude"}),e.jsx(Bn,{feature:"claudeUserSkills",enabled:Cs(t.config),prefix:"mcp.claudeSkills"})]})}function Pn({app:t}){if("image"in t.icon)return e.jsx("img",{src:t.icon.image,alt:"",className:"size-10 shrink-0 rounded-xl object-contain"});const s=t.icon.glyph;return e.jsx("span",{className:"flex size-10 shrink-0 items-center justify-center rounded-xl bg-raised text-ink-secondary",children:e.jsx(s,{size:19,"aria-hidden":"true"})})}class me extends Error{key;constructor(s){super(s),this.key=s}}const sn=/^https?:\/\//i,ds=/^[A-Za-z_][A-Za-z0-9_]*=/,Ca=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+:/,Sa=new Set(["npx","uvx","bunx"]),Ra=new Set(["pnpm","yarn"]);function Ea(t,s=[]){const c=za(t).trim();if(!c)return null;try{const o=/^[{[]/.test(c)?La(c):sn.test(c)&&!/\s/.test(c)?[mn(void 0,c,void 0,[])]:Ia(c);return{ok:!0,servers:Da(o,s)}}catch(o){if(o instanceof me)return{ok:!1,error:o.key};throw o}}function za(t){return t.replace(/[“”„]/g,'"').replace(/[‘’]/g,"'").replace(/(^|\s)[–—](?=[a-z])/g,"$1--")}function us(t){const s=[];let c=[],o="",r=!1;const l=()=>{r&&c.push(o),o="",r=!1},y=()=>{l(),c.length&&s.push(c),c=[]},g=k=>t[k]===`
1
+ import{c as dn,t as n,r as d,j as e,X as es,aj as ts,a as G,f as Ye,o as Xt,b as Bt,aD as ws,S as Ns,i as _t}from"./styles-BYp3glRK.js";import{S as un,n as w,u as et,eq as As,er as Cs,es as Ss,et as ht,D as Rs,eu as Es,ev as zs,l as Is,G as Sn,ew as Ts,ex as Os,cI as Bs,T as Ps,ah as en,br as Ms,ey as Rt,ez as ns,eA as Et,eB as ss,an as as,eC as zt,eD as Ls,eE as is,eF as It,eG as os,eH as Us,eI as Rn,eJ as $s,Y as cs,eK as Nt,eL as Fs,eM as Ks,eN as Ds,eO as Qs,eP as Hs,eQ as ct,eR as En,eS as Js,eT as zn,e4 as In,eU as _s,eV as Vs,eW as Gs,eX as Vt,eY as qs,eZ as Zs,e_ as Ws,e$ as Ys,f0 as Xs,f1 as ea,f2 as ta,f3 as na,f4 as sa,f5 as aa,f6 as ia}from"./App-Dc7eNHIo.js";import{L as ae,P as rs,X as oa,a as ca,y as pn,E as ra,$ as la,B as da}from"./PlacesRail-msEDHUXY.js";import{u as Gt}from"./mcp-servers-BdjmXJSB.js";import{C as ls,R as tn}from"./MenuMotion-BjmjRIR3.js";import{u as ua}from"./ProIntroduction-D8SaBehJ.js";import"./index-BEBI8eA5.js";import"./monitor-DagRnmYm.js";const pa=[["path",{d:"M13 2a9 9 0 0 1 9 9",key:"1itnx2"}],["path",{d:"M13 6a5 5 0 0 1 5 5",key:"11nki7"}],["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],ma=dn("phone-call",pa);const ha=[["path",{d:"M4.9 16.1C1 12.2 1 5.8 4.9 1.9",key:"s0qx1y"}],["path",{d:"M7.8 4.7a6.14 6.14 0 0 0-.8 7.5",key:"1idnkw"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}],["path",{d:"M16.2 4.8c2 2 2.26 5.11.8 7.47",key:"ojru2q"}],["path",{d:"M19.1 1.9a9.96 9.96 0 0 1 0 14.1",key:"rhi7fg"}],["path",{d:"M9.5 18h5",key:"mfy3pd"}],["path",{d:"m8 22 4-11 4 11",key:"25yftu"}]],xa=dn("radio-tower",ha);const fa=[["path",{d:"m10.852 14.772-.383.923",key:"11vil6"}],["path",{d:"M13.148 14.772a3 3 0 1 0-2.296-5.544l-.383-.923",key:"1v3clb"}],["path",{d:"m13.148 9.228.383-.923",key:"t2zzyc"}],["path",{d:"m13.53 15.696-.382-.924a3 3 0 1 1-2.296-5.544",key:"1bxfiv"}],["path",{d:"m14.772 10.852.923-.383",key:"k9m8cz"}],["path",{d:"m14.772 13.148.923.383",key:"1xvhww"}],["path",{d:"M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5",key:"tn8das"}],["path",{d:"M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5",key:"1g2pve"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"m9.228 10.852-.923-.383",key:"1wtb30"}],["path",{d:"m9.228 13.148-.923.383",key:"1a830x"}]],qt=dn("server-cog",fa),ga=new Set(["twitter","x"]);function Tn(t,s){return t!=="managed"||!ga.has(s.trim().toLowerCase())?null:"Twitter/X needs your own X Developer app and Composio auth config. Use self-hosted connected apps for now."}const ba=5,ya=3,Tt=4;function ka(t,s=ba,c=[]){const o=new Map;for(const g of t)for(const k of new Set(g.categories??[]))o.set(k,(o.get(k)??0)+1);const r=[...o].sort((g,k)=>k[1]-g[1]||g[0].localeCompare(k[0])).map(([g])=>g),l=c.filter(g=>r.indexOf(g)>=s),y=[...r.slice(0,Math.max(0,s-l.length)),...l];return{inline:y,more:r.filter(g=>!y.includes(g))}}function nn(t,s){return s===null||(t.categories??[]).includes(s)}function ja(t,s,c){const o=[],r=t.filter(l=>s(l.slug));r.length&&o.push({kind:"connected",cards:r});for(const l of c.slice(0,ya)){const y=t.filter(g=>!s(g.slug)&&nn(g,l));y.length&&o.push({kind:"category",category:l,cards:y.slice(0,Tt),more:y.length>Tt})}return o.push({kind:"all",cards:t.filter(l=>!s(l.slug))}),o}const va={productivity:"productivity","developer tools":"developerTools",communication:"communication",files:"files","sales and crm":"salesCrm",design:"design",marketing:"marketing",analytics:"analytics",social:"social"},wa={"google calendar":"googleCalendar","google sheets":"googleSheets","google docs":"googleDocs",notion:"notion",github:"github",linear:"linear",sentry:"sentry",jira:"jira",slack:"slack",gmail:"gmail",discord:"discord","google drive":"googleDrive",posthog:"posthog","x (twitter)":"xTwitter",reddit:"reddit",zapier:"zapier",hubspot:"hubspot",salesforce:"salesforce",asana:"asana",trello:"trello",dropbox:"dropbox",airtable:"airtable",figma:"figma",stripe:"stripe"};function rt(t){const s=va[t.trim().toLowerCase()];return s?n(`apps.category.${s}`):t}function On(t){const s=wa[t.label.trim().toLowerCase()];return s?n(`apps.catalog.${s}.blurb`):t.blurb}function Na({server:t,disabled:s,onSaved:c}){const[o,r]=d.useState(!1),[l,y]=d.useState(null);if(typeof t.apps!="boolean"||t.apps&&t.hasApps!==!0)return null;const g=t.apps,k=async()=>{r(!0),y(null);try{const p=await w(`/api/mcp/servers/${encodeURIComponent(t.name)}`,{method:"PATCH",body:JSON.stringify({apps:!g})});c(p.servers??[])}catch(p){y(p instanceof Error?p.message:String(p))}finally{r(!1)}};return e.jsxs("div",{"data-mcp-apps":t.name,className:"mt-3 flex items-center gap-3 border-t border-hairline/40 pt-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-[13px] font-medium text-ink",children:n("mcp.apps.title")}),e.jsx("div",{role:l?"alert":void 0,className:l?"mt-0.5 text-[12px] text-danger":"mt-0.5 text-[12px] text-ink-secondary",children:l??n("mcp.apps.desc")})]}),o&&e.jsx(ae,{"aria-hidden":"true",size:13,className:"animate-spin text-ink-secondary"}),e.jsx(un,{checked:g,disabled:s||o,onClick:()=>{k()},"aria-label":n("mcp.apps.toggleAria",{name:t.name}),className:"disabled:opacity-40"})]})}function Bn({feature:t,enabled:s,prefix:c}){const{dispatch:o}=et(),[r,l]=d.useState(!1),[y,g]=d.useState(!1),k=async()=>{if(!r){l(!0),g(!1);try{const p=await w("/api/config",{method:"PATCH",body:JSON.stringify({features:{[t]:!s}})});o({type:"configStatus",config:p})}catch{g(!0)}finally{l(!1)}}};return e.jsxs("div",{className:"mt-4 flex items-start justify-between gap-4 rounded-2xl border border-hairline/50 bg-card px-4 py-4 sm:px-5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:n(`${c}.title`)}),e.jsx("p",{className:"mt-1 text-[12px] leading-relaxed text-ink-secondary",children:n(`${c}.desc`)}),y&&e.jsx("p",{role:"alert",className:"mt-1 text-[12px] text-danger",children:n("mcp.claude.error")})]}),e.jsx(un,{checked:s,"aria-label":n(`${c}.aria`),disabled:r,onClick:()=>{k()},className:"mt-0.5 shrink-0 disabled:cursor-wait disabled:opacity-50"})]})}function Aa(){const{state:t}=et();return e.jsxs(e.Fragment,{children:[e.jsx(Bn,{feature:"claudeUserMcp",enabled:As(t.config),prefix:"mcp.claude"}),e.jsx(Bn,{feature:"claudeUserSkills",enabled:Cs(t.config),prefix:"mcp.claudeSkills"})]})}function Pn({app:t}){if("image"in t.icon)return e.jsx("img",{src:t.icon.image,alt:"",className:"size-10 shrink-0 rounded-xl object-contain"});const s=t.icon.glyph;return e.jsx("span",{className:"flex size-10 shrink-0 items-center justify-center rounded-xl bg-raised text-ink-secondary",children:e.jsx(s,{size:19,"aria-hidden":"true"})})}class me extends Error{key;constructor(s){super(s),this.key=s}}const sn=/^https?:\/\//i,ds=/^[A-Za-z_][A-Za-z0-9_]*=/,Ca=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+:/,Sa=new Set(["npx","uvx","bunx"]),Ra=new Set(["pnpm","yarn"]);function Ea(t,s=[]){const c=za(t).trim();if(!c)return null;try{const o=/^[{[]/.test(c)?La(c):sn.test(c)&&!/\s/.test(c)?[mn(void 0,c,void 0,[])]:Ia(c);return{ok:!0,servers:Da(o,s)}}catch(o){if(o instanceof me)return{ok:!1,error:o.key};throw o}}function za(t){return t.replace(/[“”„]/g,'"').replace(/[‘’]/g,"'").replace(/(^|\s)[–—](?=[a-z])/g,"$1--")}function us(t){const s=[];let c=[],o="",r=!1;const l=()=>{r&&c.push(o),o="",r=!1},y=()=>{l(),c.length&&s.push(c),c=[]},g=k=>t[k]===`
2
2
  `?1:t[k]==="\r"&&t[k+1]===`
3
3
  `?2:0;for(let k=0;k<t.length;k+=1){const p=t[k];if(p==="\\"||(p==="`"||p==="^")&&g(k+1)){const h=g(k+1);if(h){k+=h;continue}k+1<t.length&&(o+=t[k+1],r=!0,k+=1);continue}if(p==="'"){const h=t.indexOf("'",k+1);if(h<0)throw new me("mcp.paste.notRecognized");o+=t.slice(k+1,h),r=!0,k=h;continue}if(p==='"'){let h=k+1;for(;h<t.length&&t[h]!=='"';h+=1){if(t[h]==="\\"&&h+1<t.length){const A=g(h+1);if(A){h+=A;continue}if('"\\$`'.includes(t[h+1])){o+=t[h+1],h+=1;continue}}o+=t[h]}if(h>=t.length)throw new me("mcp.paste.notRecognized");r=!0,k=h;continue}if(p==="$"&&t[k+1]==="("){const h=t.indexOf(")",k+2);if(h<0)throw new me("mcp.paste.notRecognized");o+=t.slice(k,h+1),r=!0,k=h;continue}if(p==="#"&&!r){for(;k+1<t.length&&t[k+1]!==`
4
4
  `;)k+=1;continue}if(p===`
@@ -1 +1 @@
1
- import{r as p,h as w,k as f,l as g,m as b,j as e,t,u as y,q as j,g as N}from"./styles-Bj-lDRZL.js";import{u as k,a2 as C,a3 as h,a4 as A}from"./App-X_zk2xl3.js";function x(n,s){const r=n&&!window.ogb?.remoteClient?.active?window.ogb?.cloudAccount:void 0,[i,o]=p.useState(null),a=r?.offer?JSON.stringify(s??null):null;return p.useEffect(()=>{if(a===null||!r?.offer)return;let l=!0;return r.offer().then(c=>{l&&o(c)},()=>{}),()=>{l=!1}},[r,a]),r?.offer?i:null}function m(){const n=window.ogb?.remoteClient?.active?void 0:window.ogb?.cloudAccount,[s,r]=p.useState(null);return p.useEffect(()=>{if(!n)return;let i=!0,o=!1;const a=n.onState(l=>{o=!0,i&&r(l)});return n.state().then(l=>{i&&!o&&r(l)}).catch(()=>{}),()=>{i=!1,a()}},[n]),n?{view:w(s),account:s}:null}function I(){const{dispatch:n}=k(),s=m(),r=s!==null&&f(s.view),i=x(r,s?.account?.offer);if(!s)return null;const{view:o}=s;if(r){const l=g(i)!==null,c=b(i),u=i?Math.min(...i.plans.map(d=>d.amount)):null;return e.jsxs("section",{"aria-label":t("pro.name"),"data-cloud-offer":l?"trial":i?"plans":"none",className:"flex flex-wrap items-center justify-between gap-3 rounded-xl border border-hairline/50 p-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(C,{className:"text-ink-secondary",size:18,"aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-[14px] font-semibold text-ink",children:t("pro.name")}),e.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:t("pro.settingsSummary")}),u!==null&&e.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:t("pro.fromPrice",{price:y(u/100)})}),c&&e.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:c}),e.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:t("pro.disclaimer")})]})]}),e.jsxs("div",{className:"flex flex-col items-end gap-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx("button",{type:"button",className:"cursor-pointer text-[13px] text-ink-secondary underline underline-offset-2 hover:text-ink",onClick:()=>n({type:"openCloudAdd",source:"app_settings"}),children:t("pro.seePlans")}),e.jsx("button",{type:"button",className:"ui-button ui-button-primary",onClick:()=>n({type:"openCloudAdd",source:"app_settings"}),children:t(l?"cloudIntro.start":"cloudAccount.upgrade")})]}),o.kind==="signed-out"&&e.jsx("button",{type:"button",className:"cursor-pointer text-[13px] font-medium text-accent-text underline underline-offset-2 hover:text-ink",onClick:()=>n({type:"openCloudAdd",source:"app_settings",signIn:!0}),children:t("cloudAccount.signIn")})]})]})}const a=j(o);return!a&&o.kind!=="reauth"?null:e.jsxs("section",{"aria-label":t("settings.section.cloudAccount"),"data-cloud-plan":o.kind,className:"flex flex-wrap items-center justify-between gap-3 rounded-xl border border-hairline/50 p-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(N,{className:"text-ink-secondary",size:18,"aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-[14px] font-semibold text-ink",children:t("settings.section.cloudAccount")}),e.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:o.kind==="reauth"?t("pro.reauthShort"):a})]})]}),e.jsx("button",{type:"button",className:"ui-button",onClick:()=>n({type:"toggleAppSettings",open:!0,section:"cloudAccount"}),children:t("pro.openCloudSettings")})]})}function _({place:n,usage:s=null,upgrade:r}){const{dispatch:i}=k(),o=m(),a=o!==null&&f(o.view),l=x(a,o?.account?.offer);if(!o)return null;if(a){const u=g(l)!==null,d=l&&l.plans.length?Math.min(...l.plans.map(v=>v.amount)):null;return e.jsx(h,{title:t("pro.name"),subtitle:n==="plan"&&d!==null?t("pro.fromPrice",{price:y(d/100)}):t("pro.settingsSummary"),children:e.jsxs("div",{className:"flex items-center gap-3",children:[n==="plan"&&o.view.kind==="signed-out"&&e.jsx("button",{type:"button",className:"cursor-pointer text-[13px] text-ink-secondary hover:text-ink",onClick:()=>i({type:"openCloudAdd",source:"app_settings",signIn:!0}),children:t("cloudAccount.signIn")}),e.jsx("button",{type:"button","data-cloud-offer":u?"trial":"plans",className:"ui-button ui-button-primary",onClick:()=>i({type:"openCloudAdd",source:"app_settings"}),children:t(u?"cloudIntro.start":"cloudAccount.upgrade")})]})})}const c=o.view.kind==="reauth"?t("pro.reauthShort"):j(o.view);return c?e.jsx(h,{title:t("pro.name"),subtitle:c,children:n==="account"?e.jsx("button",{type:"button","data-cloud-plan":o.view.kind,className:"ui-button",onClick:()=>i({type:"toggleAppSettings",open:!0,section:"cloudAccount"}),children:t("settings.simple.account.manage")}):s&&r?e.jsx(A,{usage:s,upgrade:r}):null}):null}function B(){const n=m(),s=n!==null&&f(n.view),r=x(s,n?.account?.offer);return s?[t("pro.disclaimer"),b(r)].filter(Boolean).join(" "):null}export{_ as C,I as P,x as a,B as b,m as u};
1
+ import{r as p,h as w,k as f,l as g,m as b,j as e,t,u as y,q as j,g as N}from"./styles-BYp3glRK.js";import{u as k,a2 as C,a3 as h,a4 as A}from"./App-Dc7eNHIo.js";function x(n,s){const r=n&&!window.ogb?.remoteClient?.active?window.ogb?.cloudAccount:void 0,[i,o]=p.useState(null),a=r?.offer?JSON.stringify(s??null):null;return p.useEffect(()=>{if(a===null||!r?.offer)return;let l=!0;return r.offer().then(c=>{l&&o(c)},()=>{}),()=>{l=!1}},[r,a]),r?.offer?i:null}function m(){const n=window.ogb?.remoteClient?.active?void 0:window.ogb?.cloudAccount,[s,r]=p.useState(null);return p.useEffect(()=>{if(!n)return;let i=!0,o=!1;const a=n.onState(l=>{o=!0,i&&r(l)});return n.state().then(l=>{i&&!o&&r(l)}).catch(()=>{}),()=>{i=!1,a()}},[n]),n?{view:w(s),account:s}:null}function I(){const{dispatch:n}=k(),s=m(),r=s!==null&&f(s.view),i=x(r,s?.account?.offer);if(!s)return null;const{view:o}=s;if(r){const l=g(i)!==null,c=b(i),u=i?Math.min(...i.plans.map(d=>d.amount)):null;return e.jsxs("section",{"aria-label":t("pro.name"),"data-cloud-offer":l?"trial":i?"plans":"none",className:"flex flex-wrap items-center justify-between gap-3 rounded-xl border border-hairline/50 p-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(C,{className:"text-ink-secondary",size:18,"aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-[14px] font-semibold text-ink",children:t("pro.name")}),e.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:t("pro.settingsSummary")}),u!==null&&e.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:t("pro.fromPrice",{price:y(u/100)})}),c&&e.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:c}),e.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:t("pro.disclaimer")})]})]}),e.jsxs("div",{className:"flex flex-col items-end gap-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx("button",{type:"button",className:"cursor-pointer text-[13px] text-ink-secondary underline underline-offset-2 hover:text-ink",onClick:()=>n({type:"openCloudAdd",source:"app_settings"}),children:t("pro.seePlans")}),e.jsx("button",{type:"button",className:"ui-button ui-button-primary",onClick:()=>n({type:"openCloudAdd",source:"app_settings"}),children:t(l?"cloudIntro.start":"cloudAccount.upgrade")})]}),o.kind==="signed-out"&&e.jsx("button",{type:"button",className:"cursor-pointer text-[13px] font-medium text-accent-text underline underline-offset-2 hover:text-ink",onClick:()=>n({type:"openCloudAdd",source:"app_settings",signIn:!0}),children:t("cloudAccount.signIn")})]})]})}const a=j(o);return!a&&o.kind!=="reauth"?null:e.jsxs("section",{"aria-label":t("settings.section.cloudAccount"),"data-cloud-plan":o.kind,className:"flex flex-wrap items-center justify-between gap-3 rounded-xl border border-hairline/50 p-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(N,{className:"text-ink-secondary",size:18,"aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-[14px] font-semibold text-ink",children:t("settings.section.cloudAccount")}),e.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:o.kind==="reauth"?t("pro.reauthShort"):a})]})]}),e.jsx("button",{type:"button",className:"ui-button",onClick:()=>n({type:"toggleAppSettings",open:!0,section:"cloudAccount"}),children:t("pro.openCloudSettings")})]})}function _({place:n,usage:s=null,upgrade:r}){const{dispatch:i}=k(),o=m(),a=o!==null&&f(o.view),l=x(a,o?.account?.offer);if(!o)return null;if(a){const u=g(l)!==null,d=l&&l.plans.length?Math.min(...l.plans.map(v=>v.amount)):null;return e.jsx(h,{title:t("pro.name"),subtitle:n==="plan"&&d!==null?t("pro.fromPrice",{price:y(d/100)}):t("pro.settingsSummary"),children:e.jsxs("div",{className:"flex items-center gap-3",children:[n==="plan"&&o.view.kind==="signed-out"&&e.jsx("button",{type:"button",className:"cursor-pointer text-[13px] text-ink-secondary hover:text-ink",onClick:()=>i({type:"openCloudAdd",source:"app_settings",signIn:!0}),children:t("cloudAccount.signIn")}),e.jsx("button",{type:"button","data-cloud-offer":u?"trial":"plans",className:"ui-button ui-button-primary",onClick:()=>i({type:"openCloudAdd",source:"app_settings"}),children:t(u?"cloudIntro.start":"cloudAccount.upgrade")})]})})}const c=o.view.kind==="reauth"?t("pro.reauthShort"):j(o.view);return c?e.jsx(h,{title:t("pro.name"),subtitle:c,children:n==="account"?e.jsx("button",{type:"button","data-cloud-plan":o.view.kind,className:"ui-button",onClick:()=>i({type:"toggleAppSettings",open:!0,section:"cloudAccount"}),children:t("settings.simple.account.manage")}):s&&r?e.jsx(A,{usage:s,upgrade:r}):null}):null}function B(){const n=m(),s=n!==null&&f(n.view),r=x(s,n?.account?.offer);return s?[t("pro.disclaimer"),b(r)].filter(Boolean).join(" "):null}export{_ as C,I as P,x as a,B as b,m as u};
@@ -1 +1 @@
1
- import{r,j as e,C as w,t as n,X as C,a as S}from"./styles-Bj-lDRZL.js";import{u as A,I as z,T,B as p,V as L,k as P,S as B,m as E,n as I}from"./App-X_zk2xl3.js";import{u as R,B as F,L as U,b as V}from"./PlacesRail-B9RHHjvB.js";import"./index-DJPPxxyF.js";import"./monitor-DUEBF6Jm.js";import"./MenuMotion-V6wxTHIu.js";function M({bot:t,overlay:b=!1}){const{dispatch:f}=A(),{dragProps:k}=R(),[x,g]=r.useState(!1),[h,l]=r.useState(""),[v,j]=r.useState(!1),d=r.useRef(null),o=r.useRef(null),c=r.useRef(null),y=()=>f({type:"toggleSettings",open:!1}),i=a=>{if(o.current={...o.current,...a},c.current)return c.current;g(!0),l("");const s=async()=>{for(;o.current;){const u=o.current;o.current=null,l("");try{const m=await I(`/api/bots/${t.id}/profile`,{method:"PATCH",body:JSON.stringify(u)});f({type:"botPatched",bot:m.bot})}catch(m){l(m instanceof Error?m.message:n("remoteAgent.updateFailed"))}}};return c.current=s().finally(()=>{c.current=null,g(!1)}),c.current},N=async a=>{if(a){j(!0),l("");try{const s=await E(a),u=s?V(s.path):null;if(!u)throw new Error(n("settings.profile.avatar.invalidType"));await i({avatarUrl:u,avatarCrop:t.avatarCrop==="square"?"square":"circle"})}catch(s){l(s instanceof Error?s.message:String(s))}finally{j(!1),d.current&&(d.current.value="")}}};return e.jsxs("aside",{className:S("animate-panel-in absolute inset-0 z-40 flex h-full min-w-0 flex-col border-l border-hairline/40 bg-panel",b?"md:left-auto md:w-[400px] md:shadow-2xl":"md:relative md:z-20 md:w-[400px] md:shrink-0"),children:[e.jsxs("div",{...k,className:"flex items-center justify-between px-4 py-3",children:[e.jsx("button",{onClick:y,"aria-label":n("remoteAgent.collapse"),className:"flex size-10 items-center justify-center rounded-md text-ink-secondary hover:bg-control hover:text-ink",children:e.jsx(w,{size:18})}),e.jsx("span",{className:"text-[15px] font-semibold text-ink",children:n("remoteAgent.title")}),e.jsx("button",{onClick:y,"aria-label":n("remoteAgent.close"),className:"flex size-10 items-center justify-center rounded-md text-ink-secondary hover:bg-control hover:text-ink",children:e.jsx(C,{size:18})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-5 pb-5",children:e.jsxs("div",{className:"flex flex-col gap-4 pt-4",children:[e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[e.jsx(F,{bot:t,state:"idle",size:64,motion:"none",motionKey:0,animated:!1}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{ref:d,type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",className:"sr-only",onChange:a=>{N(a.target.files?.[0])}}),e.jsxs("button",{type:"button",disabled:v||x,onClick:()=>d.current?.click(),className:"flex items-center gap-1.5 rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[v?e.jsx(U,{size:14,className:"animate-spin"}):e.jsx(z,{size:14})," ",n("botIdentity.avatar")]}),t.avatarUrl&&e.jsx("button",{type:"button",disabled:x,onClick:()=>{i({avatarUrl:null,avatarCrop:"mascot"})},"aria-label":n("remoteAgent.removeAvatar"),className:"flex size-9 items-center justify-center rounded-lg text-ink-secondary hover:bg-control hover:text-danger",children:e.jsx(T,{size:14})})]})]}),e.jsxs("label",{className:"block text-[12px] font-medium text-ink-secondary",children:[n("botSettings.identity.name"),e.jsx("input",{defaultValue:t.name,maxLength:p.name,onBlur:a=>{const s=a.currentTarget.value.trim();s&&s!==t.name&&i({name:s})},className:"mt-1 w-full rounded-lg bg-inset px-3 py-2 text-[14px] text-ink focus:outline-none focus:ring-1 focus:ring-accent"},t.id)]}),e.jsxs("label",{className:"mt-3 block text-[12px] font-medium text-ink-secondary",children:[n("botSettings.identity.title"),e.jsx("input",{defaultValue:t.title??"",maxLength:p.title,onBlur:a=>{a.currentTarget.value!==(t.title??"")&&i({title:a.currentTarget.value})},className:"mt-1 w-full rounded-lg bg-inset px-3 py-2 text-[14px] text-ink focus:outline-none focus:ring-1 focus:ring-accent"},t.id)]}),e.jsxs("label",{className:"mt-3 block text-[12px] font-medium text-ink-secondary",children:[n("remoteAgent.description"),e.jsx("textarea",{defaultValue:t.description??"",maxLength:p.description,rows:4,onBlur:a=>{a.currentTarget.value!==(t.description??"")&&i({description:a.currentTarget.value})},className:"mt-1 w-full resize-y rounded-lg bg-inset px-3 py-2 text-[13px] leading-relaxed text-ink focus:outline-none focus:ring-1 focus:ring-accent"},t.id)]})]}),e.jsx(L,{bot:t,workspaceConfigurationLocked:!0,onPatch:a=>{i(a)}}),e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-xl bg-card p-4",children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[e.jsx(P,{size:16,className:"mt-0.5 shrink-0 text-ink-secondary"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:n("notifications.title")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:n("remoteAgent.notificationsHint")})]})]}),e.jsx(B,{checked:t.notifications,disabled:x,"aria-label":n("remoteAgent.notifications"),onClick:()=>{i({notifications:!t.notifications})}})]}),h?e.jsx("div",{role:"alert",className:"text-[12px] text-danger",children:h}):null]})})]})}export{M as RemoteAgentSettingsPanel};
1
+ import{r,j as e,C as w,t as n,X as C,a as S}from"./styles-BYp3glRK.js";import{u as A,I as z,T,B as p,V as L,k as P,S as B,m as E,n as I}from"./App-Dc7eNHIo.js";import{u as R,B as F,L as U,b as V}from"./PlacesRail-msEDHUXY.js";import"./index-BEBI8eA5.js";import"./monitor-DagRnmYm.js";import"./MenuMotion-BjmjRIR3.js";function M({bot:t,overlay:b=!1}){const{dispatch:f}=A(),{dragProps:k}=R(),[x,g]=r.useState(!1),[h,l]=r.useState(""),[v,j]=r.useState(!1),d=r.useRef(null),o=r.useRef(null),c=r.useRef(null),y=()=>f({type:"toggleSettings",open:!1}),i=a=>{if(o.current={...o.current,...a},c.current)return c.current;g(!0),l("");const s=async()=>{for(;o.current;){const u=o.current;o.current=null,l("");try{const m=await I(`/api/bots/${t.id}/profile`,{method:"PATCH",body:JSON.stringify(u)});f({type:"botPatched",bot:m.bot})}catch(m){l(m instanceof Error?m.message:n("remoteAgent.updateFailed"))}}};return c.current=s().finally(()=>{c.current=null,g(!1)}),c.current},N=async a=>{if(a){j(!0),l("");try{const s=await E(a),u=s?V(s.path):null;if(!u)throw new Error(n("settings.profile.avatar.invalidType"));await i({avatarUrl:u,avatarCrop:t.avatarCrop==="square"?"square":"circle"})}catch(s){l(s instanceof Error?s.message:String(s))}finally{j(!1),d.current&&(d.current.value="")}}};return e.jsxs("aside",{className:S("animate-panel-in absolute inset-0 z-40 flex h-full min-w-0 flex-col border-l border-hairline/40 bg-panel",b?"md:left-auto md:w-[400px] md:shadow-2xl":"md:relative md:z-20 md:w-[400px] md:shrink-0"),children:[e.jsxs("div",{...k,className:"flex items-center justify-between px-4 py-3",children:[e.jsx("button",{onClick:y,"aria-label":n("remoteAgent.collapse"),className:"flex size-10 items-center justify-center rounded-md text-ink-secondary hover:bg-control hover:text-ink",children:e.jsx(w,{size:18})}),e.jsx("span",{className:"text-[15px] font-semibold text-ink",children:n("remoteAgent.title")}),e.jsx("button",{onClick:y,"aria-label":n("remoteAgent.close"),className:"flex size-10 items-center justify-center rounded-md text-ink-secondary hover:bg-control hover:text-ink",children:e.jsx(C,{size:18})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-5 pb-5",children:e.jsxs("div",{className:"flex flex-col gap-4 pt-4",children:[e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[e.jsx(F,{bot:t,state:"idle",size:64,motion:"none",motionKey:0,animated:!1}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{ref:d,type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",className:"sr-only",onChange:a=>{N(a.target.files?.[0])}}),e.jsxs("button",{type:"button",disabled:v||x,onClick:()=>d.current?.click(),className:"flex items-center gap-1.5 rounded-lg bg-control px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50",children:[v?e.jsx(U,{size:14,className:"animate-spin"}):e.jsx(z,{size:14})," ",n("botIdentity.avatar")]}),t.avatarUrl&&e.jsx("button",{type:"button",disabled:x,onClick:()=>{i({avatarUrl:null,avatarCrop:"mascot"})},"aria-label":n("remoteAgent.removeAvatar"),className:"flex size-9 items-center justify-center rounded-lg text-ink-secondary hover:bg-control hover:text-danger",children:e.jsx(T,{size:14})})]})]}),e.jsxs("label",{className:"block text-[12px] font-medium text-ink-secondary",children:[n("botSettings.identity.name"),e.jsx("input",{defaultValue:t.name,maxLength:p.name,onBlur:a=>{const s=a.currentTarget.value.trim();s&&s!==t.name&&i({name:s})},className:"mt-1 w-full rounded-lg bg-inset px-3 py-2 text-[14px] text-ink focus:outline-none focus:ring-1 focus:ring-accent"},t.id)]}),e.jsxs("label",{className:"mt-3 block text-[12px] font-medium text-ink-secondary",children:[n("botSettings.identity.title"),e.jsx("input",{defaultValue:t.title??"",maxLength:p.title,onBlur:a=>{a.currentTarget.value!==(t.title??"")&&i({title:a.currentTarget.value})},className:"mt-1 w-full rounded-lg bg-inset px-3 py-2 text-[14px] text-ink focus:outline-none focus:ring-1 focus:ring-accent"},t.id)]}),e.jsxs("label",{className:"mt-3 block text-[12px] font-medium text-ink-secondary",children:[n("remoteAgent.description"),e.jsx("textarea",{defaultValue:t.description??"",maxLength:p.description,rows:4,onBlur:a=>{a.currentTarget.value!==(t.description??"")&&i({description:a.currentTarget.value})},className:"mt-1 w-full resize-y rounded-lg bg-inset px-3 py-2 text-[13px] leading-relaxed text-ink focus:outline-none focus:ring-1 focus:ring-accent"},t.id)]})]}),e.jsx(L,{bot:t,workspaceConfigurationLocked:!0,onPatch:a=>{i(a)}}),e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-xl bg-card p-4",children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[e.jsx(P,{size:16,className:"mt-0.5 shrink-0 text-ink-secondary"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[15px] font-medium text-ink",children:n("notifications.title")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:n("remoteAgent.notificationsHint")})]})]}),e.jsx(B,{checked:t.notifications,disabled:x,"aria-label":n("remoteAgent.notifications"),onClick:()=>{i({notifications:!t.notifications})}})]}),h?e.jsx("div",{role:"alert",className:"text-[12px] text-danger",children:h}):null]})})]})}export{M as RemoteAgentSettingsPanel};
@@ -1,2 +1,2 @@
1
- import{j as e,a as z,t,J as F,r as d,S as L,X as B}from"./styles-Bj-lDRZL.js";import{E as O,C as $,T as G,B as E,j as K,u as q,r as H}from"./PlacesRail-B9RHHjvB.js";import{an as U,u as g,ao as A,ap as W,aq as J,ar as X,as as _,at as Q,au as V,av as Y,aw as M,ax as Z,ay as ee,az as ae,M as te,aA as se,aB as ne,aC as oe,aD as re,aE as le,aF as ie,aG as ce,aH as P,aI as R,aJ as de,aK as ue,aL as pe,aM as S,aN as k,aO as me,d as fe,aP as xe,aQ as he,aR as be,aS as je,aT as ye,aU as ke,aV as ge,aW as C,aX as we,ac as ve,aY as Re}from"./App-X_zk2xl3.js";import{C as Se}from"./MenuMotion-V6wxTHIu.js";import"./monitor-DUEBF6Jm.js";import"./index-DJPPxxyF.js";function N(a){return a===60?t("room.panel.hour"):a%60===0?t("room.panel.hours",{hours:a/60}):t("room.panel.minutes",{minutes:a})}function Ce(a){const{dispatch:n}=g(),l=F(),u=A(a.threadId),o=W(a),[p,r]=d.useState(null),f=a.messages,h=f.length>0,s=()=>oe({title:a.name,messages:f,isGroup:!0}),x=l?[]:J(a.tasks??[]),m=X(a.usage);return{items:[{key:"find",label:t("chat.find"),icon:e.jsx(L,{size:16}),active:u,trailing:e.jsx(Q,{id:"find-conversation"}),onSelect:()=>_(a.threadId)},...l?[]:[{key:"new-thread",heading:t("task.list"),separatorBefore:!0,label:t("task.newShort"),icon:e.jsx(V,{size:16}),onSelect:()=>n({type:"newGroupTask",groupId:a.id})}],...x.length<2?[]:[{key:"threads",label:t("task.switch"),icon:e.jsx(M,{size:16}),value:String(x.length),submenu:x.map(i=>({key:`thread:${i.threadId}`,label:Y(i.title||t("task.newShort")),active:i.threadId===a.threadId,onSelect:()=>n({type:"switchGroupTask",groupId:a.id,threadId:i.threadId})})),onSelect:()=>{}}],{key:"copy",heading:t("chat.export.heading"),separatorBefore:!0,label:t("chat.export.copy"),icon:e.jsx($,{size:16}),disabled:!h,keepOpen:!0,trailing:p&&e.jsx("span",{role:"status",className:"text-[11px] text-ink-secondary",children:t(p==="copied"?"chat.export.copied":"chat.export.copyFailed")}),onSelect:()=>{Z(s()).then(i=>r(i?"copied":"failed"))}},{key:"download",label:t("chat.export.download"),icon:e.jsx(te,{size:16}),disabled:!h,onSelect:()=>ee(ae(a.name),s())},{key:"turn-limit",label:t("room.panel.turnLimit"),icon:e.jsx(G,{size:16}),separatorBefore:!0,value:N(o.saved??o.globalMinutes),submenu:[{key:"turn-limit:default",label:t("room.turnLimit.default",{minutes:o.globalMinutes}),active:o.saved===null,onSelect:()=>o.save(null)},...se.map(i=>({key:`turn-limit:${i}`,label:N(i),active:o.saved===i,onSelect:()=>o.save(i)}))],onSelect:()=>{}},...m?[{key:"usage",label:t("chat.usage.menu"),icon:e.jsx(ne,{size:16}),keepOpen:!0,trailing:e.jsx("span",{title:m.title,"data-testid":"group-usage-chip",className:"tabular-nums text-[12px] text-ink-secondary",children:m.short}),onSelect:()=>{}}]:[]],on:u}}function Ne({group:a}){const{items:n,on:l}=Ce(a);return e.jsx(U,{items:n,ariaLabel:t("chat.more"),triggerClassName:"rounded-full",triggerTitle:t("chat.more"),renderTrigger:({open:u})=>e.jsx("span",{"data-testid":"room-more",className:z("flex size-8 items-center justify-center rounded-full bg-raised/50 transition-colors hover:bg-raised","max-md:size-9 max-md:border max-md:border-hairline max-md:bg-card",u||l?"text-accent":"text-ink"),children:e.jsx(O,{size:16})})})}function Te({group:a}){return e.jsx(Ne,{group:a},a.threadId)}function ze({group:a,members:n}){const{state:l,dispatch:u}=g(),o=re(l.config),p=le(a,n),r=ie(p),f=s=>{s!==r&&u({type:"patchGroup",groupId:a.id,patch:{defaultResponder:de(s,p)}})},h=[{choice:"auto",title:t("room.panel.responder.autoOption"),hint:o?void 0:t("room.responder.autoOff",{name:ce(a,n)??t("room.responder.leadFallback")})},{choice:"everyone",title:t("room.panel.responder.everyone")},{choice:"mentions",title:t("room.panel.responder.mentions")}];return e.jsx("div",{role:"radiogroup","aria-label":t("room.panel.whoResponds"),children:e.jsxs(P,{children:[n.map(s=>e.jsx(R,{"data-panel-choice":`member:${s.id}`,title:e.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[e.jsx(E,{bot:s,state:K(s.mascotExpression)??"happy",size:22,animated:!1}),e.jsx("span",{className:"truncate",children:s.name})]}),checked:r===`member:${s.id}`,onClick:()=>f(`member:${s.id}`)},s.id)),h.map(({choice:s,title:x,hint:m})=>e.jsx(R,{"data-panel-choice":s,title:x,hint:m,checked:r===s,onClick:()=>f(s)},s))]})})}const T={responder:{title:"room.panel.whoResponds",intro:"room.panel.responder.intro"},folder:{title:"room.folder.title",intro:"room.folder.detail"}};function Ee({group:a,members:n}){return e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx("div",{"data-room-panel-faces":!0,className:"mt-0.5 flex -space-x-3",children:n.slice(0,3).map(l=>e.jsx(E,{bot:l,state:"happy",size:52,animated:!1},l.id))}),e.jsx("h2",{id:"room-panel-title",className:"mt-2.5 max-w-full truncate px-1.5 text-[18px] font-semibold text-ink",children:a.name}),a.description&&e.jsx("p",{className:"mt-px line-clamp-2 max-w-full text-[13px] text-ink-secondary",children:a.description})]})}function Me({group:a}){const n=ke(a),l=d.useRef(null),u=d.useRef(!1);d.useEffect(()=>{n.open||!u.current||(u.current=!1,l.current?.focus())},[n.open]);const o=r=>{r.key==="Escape"&&(r.preventDefault(),r.stopPropagation()),(r.key==="Escape"||r.key==="Enter"&&(r.metaKey||r.ctrlKey))&&(u.current=!0),n.onKeyDown(r)};if(n.open)return e.jsxs(ge,{"data-panel-row":"instructions",children:[e.jsx(C,{title:t("room.panel.instructions")}),e.jsx("textarea",{autoFocus:!0,dir:"auto","aria-label":t("room.panel.instructions"),value:n.draft,onChange:r=>n.setDraft(r.target.value),onBlur:n.save,onKeyDown:o,placeholder:t("room.bulletin.placeholder"),rows:6,className:"w-full resize-y rounded-lg border border-hairline bg-inset px-2.5 py-2 text-[13px] leading-relaxed text-ink outline-none placeholder:text-ink-tertiary focus:border-accent-border"}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{type:"button","data-panel-done":"instructions",onMouseDown:r=>r.preventDefault(),onClick:()=>{u.current=!0,n.save()},className:we,children:t("botSettings.simple.done")})})]});const p=a.bulletin.split(`
1
+ import{j as e,a as z,t,J as F,r as d,S as L,X as B}from"./styles-BYp3glRK.js";import{E as O,C as $,T as G,B as E,j as K,u as q,r as H}from"./PlacesRail-msEDHUXY.js";import{an as U,u as g,ao as A,ap as W,aq as J,ar as X,as as _,at as Q,au as V,av as Y,aw as M,ax as Z,ay as ee,az as ae,M as te,aA as se,aB as ne,aC as oe,aD as re,aE as le,aF as ie,aG as ce,aH as P,aI as R,aJ as de,aK as ue,aL as pe,aM as S,aN as k,aO as me,d as fe,aP as xe,aQ as he,aR as be,aS as je,aT as ye,aU as ke,aV as ge,aW as C,aX as we,ac as ve,aY as Re}from"./App-Dc7eNHIo.js";import{C as Se}from"./MenuMotion-BjmjRIR3.js";import"./monitor-DagRnmYm.js";import"./index-BEBI8eA5.js";function N(a){return a===60?t("room.panel.hour"):a%60===0?t("room.panel.hours",{hours:a/60}):t("room.panel.minutes",{minutes:a})}function Ce(a){const{dispatch:n}=g(),l=F(),u=A(a.threadId),o=W(a),[p,r]=d.useState(null),f=a.messages,h=f.length>0,s=()=>oe({title:a.name,messages:f,isGroup:!0}),x=l?[]:J(a.tasks??[]),m=X(a.usage);return{items:[{key:"find",label:t("chat.find"),icon:e.jsx(L,{size:16}),active:u,trailing:e.jsx(Q,{id:"find-conversation"}),onSelect:()=>_(a.threadId)},...l?[]:[{key:"new-thread",heading:t("task.list"),separatorBefore:!0,label:t("task.newShort"),icon:e.jsx(V,{size:16}),onSelect:()=>n({type:"newGroupTask",groupId:a.id})}],...x.length<2?[]:[{key:"threads",label:t("task.switch"),icon:e.jsx(M,{size:16}),value:String(x.length),submenu:x.map(i=>({key:`thread:${i.threadId}`,label:Y(i.title||t("task.newShort")),active:i.threadId===a.threadId,onSelect:()=>n({type:"switchGroupTask",groupId:a.id,threadId:i.threadId})})),onSelect:()=>{}}],{key:"copy",heading:t("chat.export.heading"),separatorBefore:!0,label:t("chat.export.copy"),icon:e.jsx($,{size:16}),disabled:!h,keepOpen:!0,trailing:p&&e.jsx("span",{role:"status",className:"text-[11px] text-ink-secondary",children:t(p==="copied"?"chat.export.copied":"chat.export.copyFailed")}),onSelect:()=>{Z(s()).then(i=>r(i?"copied":"failed"))}},{key:"download",label:t("chat.export.download"),icon:e.jsx(te,{size:16}),disabled:!h,onSelect:()=>ee(ae(a.name),s())},{key:"turn-limit",label:t("room.panel.turnLimit"),icon:e.jsx(G,{size:16}),separatorBefore:!0,value:N(o.saved??o.globalMinutes),submenu:[{key:"turn-limit:default",label:t("room.turnLimit.default",{minutes:o.globalMinutes}),active:o.saved===null,onSelect:()=>o.save(null)},...se.map(i=>({key:`turn-limit:${i}`,label:N(i),active:o.saved===i,onSelect:()=>o.save(i)}))],onSelect:()=>{}},...m?[{key:"usage",label:t("chat.usage.menu"),icon:e.jsx(ne,{size:16}),keepOpen:!0,trailing:e.jsx("span",{title:m.title,"data-testid":"group-usage-chip",className:"tabular-nums text-[12px] text-ink-secondary",children:m.short}),onSelect:()=>{}}]:[]],on:u}}function Ne({group:a}){const{items:n,on:l}=Ce(a);return e.jsx(U,{items:n,ariaLabel:t("chat.more"),triggerClassName:"rounded-full",triggerTitle:t("chat.more"),renderTrigger:({open:u})=>e.jsx("span",{"data-testid":"room-more",className:z("flex size-8 items-center justify-center rounded-full bg-raised/50 transition-colors hover:bg-raised","max-md:size-9 max-md:border max-md:border-hairline max-md:bg-card",u||l?"text-accent":"text-ink"),children:e.jsx(O,{size:16})})})}function Te({group:a}){return e.jsx(Ne,{group:a},a.threadId)}function ze({group:a,members:n}){const{state:l,dispatch:u}=g(),o=re(l.config),p=le(a,n),r=ie(p),f=s=>{s!==r&&u({type:"patchGroup",groupId:a.id,patch:{defaultResponder:de(s,p)}})},h=[{choice:"auto",title:t("room.panel.responder.autoOption"),hint:o?void 0:t("room.responder.autoOff",{name:ce(a,n)??t("room.responder.leadFallback")})},{choice:"everyone",title:t("room.panel.responder.everyone")},{choice:"mentions",title:t("room.panel.responder.mentions")}];return e.jsx("div",{role:"radiogroup","aria-label":t("room.panel.whoResponds"),children:e.jsxs(P,{children:[n.map(s=>e.jsx(R,{"data-panel-choice":`member:${s.id}`,title:e.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[e.jsx(E,{bot:s,state:K(s.mascotExpression)??"happy",size:22,animated:!1}),e.jsx("span",{className:"truncate",children:s.name})]}),checked:r===`member:${s.id}`,onClick:()=>f(`member:${s.id}`)},s.id)),h.map(({choice:s,title:x,hint:m})=>e.jsx(R,{"data-panel-choice":s,title:x,hint:m,checked:r===s,onClick:()=>f(s)},s))]})})}const T={responder:{title:"room.panel.whoResponds",intro:"room.panel.responder.intro"},folder:{title:"room.folder.title",intro:"room.folder.detail"}};function Ee({group:a,members:n}){return e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx("div",{"data-room-panel-faces":!0,className:"mt-0.5 flex -space-x-3",children:n.slice(0,3).map(l=>e.jsx(E,{bot:l,state:"happy",size:52,animated:!1},l.id))}),e.jsx("h2",{id:"room-panel-title",className:"mt-2.5 max-w-full truncate px-1.5 text-[18px] font-semibold text-ink",children:a.name}),a.description&&e.jsx("p",{className:"mt-px line-clamp-2 max-w-full text-[13px] text-ink-secondary",children:a.description})]})}function Me({group:a}){const n=ke(a),l=d.useRef(null),u=d.useRef(!1);d.useEffect(()=>{n.open||!u.current||(u.current=!1,l.current?.focus())},[n.open]);const o=r=>{r.key==="Escape"&&(r.preventDefault(),r.stopPropagation()),(r.key==="Escape"||r.key==="Enter"&&(r.metaKey||r.ctrlKey))&&(u.current=!0),n.onKeyDown(r)};if(n.open)return e.jsxs(ge,{"data-panel-row":"instructions",children:[e.jsx(C,{title:t("room.panel.instructions")}),e.jsx("textarea",{autoFocus:!0,dir:"auto","aria-label":t("room.panel.instructions"),value:n.draft,onChange:r=>n.setDraft(r.target.value),onBlur:n.save,onKeyDown:o,placeholder:t("room.bulletin.placeholder"),rows:6,className:"w-full resize-y rounded-lg border border-hairline bg-inset px-2.5 py-2 text-[13px] leading-relaxed text-ink outline-none placeholder:text-ink-tertiary focus:border-accent-border"}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{type:"button","data-panel-done":"instructions",onMouseDown:r=>r.preventDefault(),onClick:()=>{u.current=!0,n.save()},className:we,children:t("botSettings.simple.done")})})]});const p=a.bulletin.split(`
2
2
  `)[0]?.trim();return e.jsxs("button",{ref:l,type:"button","data-panel-edit":"instructions","aria-label":`${t("botSettings.simple.edit")}: ${t("room.panel.instructions")}`,onClick:n.start,className:z(Re,"w-full text-left hover:bg-ink/[0.03]"),children:[e.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-lg bg-ink/[0.05] text-ink-secondary max-md:size-8 max-md:rounded-full","aria-hidden":"true",children:e.jsx(ve,{size:15})}),e.jsx(C,{title:t("room.panel.instructions"),hint:e.jsx("span",{dir:"auto",className:"line-clamp-1",children:p||t("room.panel.instructionsHint")})}),e.jsx(Se,{size:15,className:"shrink-0 text-ink-tertiary","aria-hidden":"true"})]})}function Oe({group:a,overlay:n=!1}){const{state:l}=g(),{dragProps:u}=q(),[o,p]=d.useState(null),[r,f]=d.useState(!1),h=d.useRef(null),s=d.useRef(null),x=d.useRef(null),m=d.useRef(null),b=d.useMemo(()=>a.memberIds.map(c=>l.bots.find(y=>y.id===c)).filter(c=>!!c),[a.memberIds,l.bots]),i=ue(a),I=d.useCallback(()=>f(!1),[]),w=c=>{p(c),s.current?.scrollTo({top:0})},v=()=>{m.current=o,p(null)};d.useEffect(()=>{o!==null?s.current?.querySelector("[data-panel-back]")?.focus():m.current&&(s.current?.querySelector(`[data-panel-page="${m.current}"]`)?.focus(),m.current=null)},[o]),d.useEffect(()=>{const c=h.current;c?.focus();const y=j=>{j.key!=="Escape"||j.defaultPrevented||c&&j.target instanceof Node&&!c.contains(j.target)||(j.preventDefault(),S({refocus:!0}))};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[]);const D=c=>{c.key!=="Escape"||c.defaultPrevented||o===null||(c.preventDefault(),c.stopPropagation(),v())};return e.jsxs(e.Fragment,{children:[e.jsxs("aside",{ref:h,role:"dialog","aria-labelledby":"room-panel-title",tabIndex:-1,"data-room-panel":!0,onKeyDown:D,className:je(n,!0),children:[e.jsxs("div",{...u,className:"flex h-[52px] shrink-0 items-center justify-end gap-2 px-3.5",children:[e.jsx(Te,{group:a}),e.jsx("button",{type:"button",onClick:()=>S({refocus:!0}),"aria-label":t("botSettings.simple.close"),className:pe,children:e.jsx(B,{size:16,className:"pointer-events-none"})})]}),e.jsx("div",{ref:s,className:"@container relative min-h-0 flex-1 overflow-y-auto px-5 pb-7",children:o===null?e.jsxs(e.Fragment,{children:[e.jsx(Ee,{group:a,members:b}),e.jsxs(P,{children:[e.jsx(k,{"data-panel-page":"responder",icon:M,title:t("room.panel.whoResponds"),value:me(a,b),onClick:()=>w("responder")}),e.jsx(k,{"data-panel-page":"folder",icon:fe,title:t("room.folder.title"),value:i?.name??t("room.panel.folder.own"),tooltip:i?.path,onClick:()=>w("folder")}),e.jsx(Me,{group:a}),e.jsx(k,{ref:x,"data-panel-row":"members",icon:xe,title:t("room.panel.members"),value:String(b.length),onClick:()=>f(!0)})]})]}):e.jsxs("div",{"data-panel-page-view":o,children:[e.jsx("span",{id:"room-panel-title",className:"sr-only",children:a.name}),e.jsx(he,{back:a.name,title:t(T[o].title),intro:t(T[o].intro),onBack:v}),e.jsx("div",{className:"mt-4 flex flex-col gap-3",children:o==="responder"?e.jsx(ze,{group:a,members:b}):e.jsx(be,{group:a,heading:!1})})]})})]}),r&&H.createPortal(e.jsx(ye,{group:a,onClose:I,triggerRef:x}),document.body)]})}export{Oe as RoomPanel};
@@ -1,2 +1,2 @@
1
- import{c as tt,r as x,j as e,t as n,a as C,i as Le,bp as Un,k as Yn,am as ln,g as dn,L as cn,X as Me,S as Zn,J as Vn}from"./styles-Bj-lDRZL.js";import{b as Jn}from"./remote-desktop-DDRRx8uY.js";import{ak as Kn,a$ as Qn,B as Ve,c as Xn,L as ze,y as Te}from"./PlacesRail-B9RHHjvB.js";import{je as Je,cg as es,D as U,aP as ts,jf as ns,jg as un,bh as ss,cR as as,jh as rs,ji as xn,u as nt,jj as is,a9 as jt,jk as os,fg as X,af as ls,jl as kt,jm as ee,jn as ht,gq as ds,jo as qe,jp as pn,cO as mn,cL as Ye,jq as ut,jr as Xt,js as en,jt as Re,y as Ze,ju as tn,jv as cs,jw as gt,cJ as hn,ac as st,jx as Ke,jy as us,m as xs,jz as ps,br as gn,jA as ms,jB as hs,n as Ne,jC as gs,jD as bs,jE as Nt,jF as nn,jG as vs,a7 as fs,ad as xt,x as ys,cG as sn,cH as js,dB as ks,T as Ns,jH as ws,jI as Ue,cv as Ss,bq as Cs,fP as Is}from"./App-X_zk2xl3.js";import{u as Ds}from"./ProIntroduction-CC1iFzJ8.js";import{C as Ts}from"./MenuMotion-V6wxTHIu.js";const Rs=[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]],Ms=tt("hourglass",Rs);const zs=[["path",{d:"m2 9 3-3 3 3",key:"1ltn5i"}],["path",{d:"M13 18H7a2 2 0 0 1-2-2V6",key:"1r6tfw"}],["path",{d:"m22 15-3 3-3-3",key:"4rnwn2"}],["path",{d:"M11 6h6a2 2 0 0 1 2 2v10",key:"2f72bc"}]],Ls=tt("repeat-2",zs);const Os=[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M19 16v6",key:"tddt3s"}],["path",{d:"M22 19h-6",key:"vcuq98"}]],bt=tt("user-round-plus",Os);const As=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],vt=tt("video",As);function Qe(t,s){if(!t.config?.team)return;const r=t.bots.find(i=>i.id===s);if(r?.defaultBot?.person)return null;const o=r&&t.activeView==="chat"&&t.selectedId===r.id?r.tasks?.find(i=>i.threadId===r.threadId):void 0;return o&&o.private!==!0&&!o.routineRunId?r.mainThreadId??null:Je}function Es(t,s,r){const o=i=>typeof i=="string"&&!!t.tasks?.some(u=>u.threadId===i&&u.private===!0);return!!t.defaultBot?.person||s===Je||o(s)||o(r)}function bn({team:t,bot:s,value:r,madeIn:o}){if(!t||!s)return null;const i=Es(s,r,o),u=i?Kn:ts;return e.jsxs("p",{role:"note","data-routine-audience":i?"me":"shared",className:"mt-2 flex items-center gap-1 text-[12px] leading-4 text-ink-secondary",children:[e.jsx(u,{size:12,"aria-hidden":"true",className:"shrink-0"}),e.jsx("span",{children:i?n("team.privateHeader"):ns(t.name,s.onlyPeopleAdded)})]})}function vn({bot:t,value:s,allowCurrent:r=!1,team:o,onChange:i}){const u=x.useId(),m=es();if(o??m!==null)return e.jsx(Ps,{id:u,bot:t,value:s,allowCurrent:r,onChange:i});const c=(t?.tasks??[]).filter(l=>!l.routineRunId),h=typeof s=="string"&&!c.some(l=>l.threadId===s),N=[...t?.projects??[],{id:"",name:n("folder.none")}];return e.jsxs("div",{className:"min-w-0 space-y-1.5",children:[e.jsx("label",{htmlFor:u,className:"block text-[12px] font-medium text-ink",children:n("routines.results.label")}),e.jsxs(U,{className:"w-full",id:u,"aria-describedby":`${u}-help`,disabled:!t,value:s??(s===null?"new":"current"),onChange:l=>i(l.target.value==="new"?null:l.target.value==="current"?void 0:l.target.value),children:[r&&e.jsx("option",{value:"current",children:n("routines.results.keep")}),e.jsx("option",{value:"new",children:n("routines.results.main")}),h&&e.jsx("option",{value:s,disabled:!0,children:n("routines.results.unavailable")}),N.map(l=>{const $=c.filter(S=>l.id?S.projectId===l.id:!t?.projects?.some(v=>v.id===S.projectId));return $.length?e.jsx("optgroup",{label:l.name,children:$.map(S=>e.jsx("option",{value:S.threadId,children:S.title},S.threadId))},l.id):null})]}),e.jsx("p",{id:`${u}-help`,className:"text-[11px] leading-relaxed text-ink-secondary",children:n("routines.results.mainHelp")})]})}function Ps({id:t,bot:s,value:r,allowCurrent:o,onChange:i}){const u=typeof r=="string"&&!!s?.tasks?.some(c=>c.threadId===r&&c.private===!0),m=r===void 0&&o?"current":r===Je||u?"me":"shared";return e.jsxs("div",{className:"min-w-0 space-y-1.5",children:[e.jsx("label",{htmlFor:t,className:"block text-[12px] font-medium text-ink",children:n("routines.results.label")}),e.jsxs(U,{className:"w-full",id:t,"aria-describedby":`${t}-help`,disabled:!s,value:m,onChange:c=>i(c.target.value==="current"?void 0:c.target.value==="me"?u?r:Je:s?.mainThreadId??null),children:[m==="current"&&e.jsx("option",{value:"current",children:n("routines.results.keep")}),e.jsx("option",{value:"me",children:n("routines.results.justMe")}),e.jsx("option",{value:"shared",children:n("task.sharedChat")})]}),e.jsx("p",{id:`${t}-help`,className:"text-[11px] leading-relaxed text-ink-secondary",children:n("routines.results.teamHelp")})]})}const pt="min-w-0 rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[13px] text-ink outline-none focus:border-accent [color-scheme:dark]",Hs=t=>Array.from({length:12},(s,r)=>new Intl.DateTimeFormat(t,{month:"long",timeZone:"UTC"}).format(new Date(Date.UTC(2024,r,1)))),$s=["UTC",...typeof Intl.supportedValuesOf=="function"?Intl.supportedValuesOf("timeZone"):[]];function fn({runs:t,timeZone:s,paused:r=!1}){if(!t.length)return null;const o=new Intl.DateTimeFormat(Le(),{timeZone:s,weekday:"short",year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"});return e.jsxs("div",{className:"space-y-1 text-[11px] leading-relaxed text-ink-secondary","aria-label":n(r?"routines.cron.pausedPreviewLabel":"routines.cron.nextRunsLabel"),children:[e.jsxs("div",{className:"font-medium",children:[n(r?"routines.cron.pausedPreview":"routines.cron.nextRuns")," · ",s]}),t.map(i=>e.jsx("div",{children:e.jsx("time",{dateTime:new Date(i).toISOString(),children:o.format(i)})},i)),e.jsx("div",{className:"pt-1",children:n("routines.cron.clockChanges")})]})}function _s({schedule:t,paused:s=!1}){const r=x.useMemo(()=>{try{return un(t,Date.now(),3)}catch{return[]}},[t]);return e.jsx(fn,{runs:r,timeZone:t.timeZone,paused:s})}function Fs({choice:t,value:s,onChange:r,runs:o,error:i}){const u=m=>r({...s,...m});return e.jsxs("div",{className:"space-y-3",children:[t==="cron"?e.jsxs("label",{className:"block space-y-1.5 text-[12px] text-ink-secondary",children:[e.jsx("span",{children:n("routines.cron.expression")}),e.jsx("input",{value:s.expression,onChange:m=>u({expression:m.target.value}),placeholder:"0 9 1 * *",spellCheck:!1,autoComplete:"off","aria-invalid":!!i,"aria-describedby":"routine-cron-help routine-cron-error",className:C(pt,"w-full font-mono")}),e.jsx("span",{id:"routine-cron-help",className:"block text-[11px]",children:n("routines.cron.expressionHelp")})]}):e.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[t==="yearly"&&e.jsxs("label",{className:"space-y-1.5 text-[12px] text-ink-secondary",children:[e.jsx("span",{className:"block",children:n("routines.cron.month")}),e.jsx(U,{value:s.month,onChange:m=>u({month:m.target.value}),children:Hs(Le()).map((m,c)=>e.jsx("option",{value:String(c+1),children:m},m))})]}),e.jsxs("label",{className:"space-y-1.5 text-[12px] text-ink-secondary",children:[e.jsx("span",{className:"block",children:n("routines.cron.dayOfMonth")}),e.jsxs(U,{value:s.day,onChange:m=>u({day:m.target.value}),children:[Array.from({length:31},(m,c)=>e.jsx("option",{value:String(c+1),children:c+1},c+1)),e.jsx("option",{value:"L",children:n("routines.cron.lastDay")})]})]}),e.jsxs("label",{className:"space-y-1.5 text-[12px] text-ink-secondary",children:[e.jsx("span",{className:"block",children:n("routines.cron.time")}),e.jsx("input",{type:"time",step:60,value:s.time,onChange:m=>u({time:m.target.value}),className:pt})]})]}),t!=="cron"&&Number(s.day)>28&&e.jsx("p",{className:"text-[11px] text-ink-secondary",children:n("routines.cron.skippedMonths")}),e.jsxs("label",{className:"block space-y-1.5 text-[12px] text-ink-secondary",children:[e.jsx("span",{children:n("routines.cron.timeZone")}),e.jsx("input",{list:"routine-time-zones",value:s.timeZone,onChange:m=>u({timeZone:m.target.value}),placeholder:"America/New_York",spellCheck:!1,autoComplete:"off","aria-invalid":!!i,"aria-describedby":"routine-cron-error",className:C(pt,"block w-full")})]}),e.jsx("datalist",{id:"routine-time-zones",children:$s.map(m=>e.jsx("option",{value:m},m))}),i&&e.jsx("p",{id:"routine-cron-error",role:"alert",className:"text-[12px] text-danger",children:i}),!i&&e.jsx(fn,{runs:o,timeZone:s.timeZone.trim()})]})}const ge=t=>["monthly","yearly","cron"].includes(t);function yn(t){const s=t.trim().split(/\s+/);if(s.length!==5)return null;const[r,o,i,u,m]=s;return!/^\d+$/.test(r)||Number(r)>59||!/^\d+$/.test(o)||Number(o)>23||!(i==="L"||/^\d+$/.test(i)&&Number(i)>=1&&Number(i)<=31)||!(u==="*"||/^\d+$/.test(u)&&Number(u)>=1&&Number(u)<=12)||m!=="*"?null:{day:i==="L"?i:String(Number(i)),month:u,time:`${String(Number(o)).padStart(2,"0")}:${String(Number(r)).padStart(2,"0")}`}}function Bs(t){const s=yn(t.expression);return s?s.month==="*"?"monthly":"yearly":"cron"}function Ws(t,s){const r=t?.timeZone??Intl.DateTimeFormat().resolvedOptions().timeZone,o=t&&yn(t.expression);let i;try{i=new Intl.DateTimeFormat("en-US",{timeZone:r,month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(s)}catch{i=new Intl.DateTimeFormat("en-US",{timeZone:"UTC",month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(s)}const u=h=>i.find(N=>N.type===h).value,m=o?.time??`${u("hour")}:${u("minute")}`,c=o?.day??u("day");return{expression:t?.expression??`${Number(m.slice(3))} ${Number(m.slice(0,2))} ${c} * *`,timeZone:r,day:c,month:o&&o.month!=="*"?String(Number(o.month)):u("month"),time:m}}function Gs(t,s,r,o){try{if(t!=="cron"&&!/^\d{2}:\d{2}$/.test(s.time))throw new Error(n("routines.cron.chooseTime"));const[i,u]=s.time.split(":"),m=o??{type:"cron",timeZone:s.timeZone,expression:t==="cron"?s.expression:`${Number(u)} ${Number(i)} ${s.day} ${t==="yearly"?s.month:"*"} *`},c=ss(m,r);return{schedule:o??c,runs:un(c,r,3),error:""}}catch(i){return{schedule:null,runs:[],error:i instanceof Error?i.message:String(i)}}}function qs({value:t,botEngine:s,onChange:r}){const o=as(),i=t.engine||s||o[0]?.engine||"",u=[...new Set([...s?[s]:[],...o.map(c=>c.engine),...i?[i]:[]])],m=o.find(c=>c.engine===i)?.resetsAt??null;return e.jsxs("div",{className:"space-y-2 text-[13px] text-ink","data-testid":"limit-reset-fields",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:n("routines.limitReset.engine")}),e.jsx(U,{"aria-label":n("routines.limitReset.engine"),value:i,onChange:c=>r({...t,engine:c.target.value}),children:u.map(c=>e.jsx("option",{value:c,children:rs(c)},c))}),e.jsxs(U,{"aria-label":n("routines.limitReset.repeat"),value:t.repeat,onChange:c=>r({...t,engine:i,repeat:c.target.value}),children:[e.jsx("option",{value:"once",children:n("routines.limitReset.once")}),e.jsx("option",{value:"every_reset",children:n("routines.limitReset.every")})]})]}),e.jsx("div",{className:"text-[12px] text-ink-secondary",children:m!==null&&m>Date.now()?n("routines.limitReset.next",{time:xn(m)}):n("routines.limitReset.unknown")})]})}function Us({cloudHome:t,local:s,plan:r,ready:o,offersAllowed:i}){return t?{kind:"cloud"}:s?r?.kind==="paid"?{kind:"local",next:o?"open-cloud":null}:{kind:"local",next:r&&i&&Yn(r)?"add-cloud":null}:{kind:"server"}}function Ys(){const{state:t,dispatch:s}=nt(),r=Ds(),o=is()&&window.ogb?.remoteClient?.active!==!0,i=Us({cloudHome:t.config?.cloudHome===!0,local:o,plan:r?.view??null,ready:r?.account?.machine?.status==="ready",offersAllowed:Un().source!=="file"}),u="text-left underline underline-offset-2 hover:text-ink",m=()=>{window.confirm(n("routines.scheduleNote.leave"))&&window.ogb?.cloudAccount?.connectHome().catch(()=>{})};return e.jsx("p",{"data-routine-schedule-note":i.kind==="local"?i.next??"local":i.kind,className:"text-[11px] leading-relaxed text-ink-secondary",children:i.kind==="cloud"?n("routines.scheduleNote.cloud"):i.kind==="server"?n("routines.scheduleNote.server"):e.jsxs(e.Fragment,{children:[n("routines.scheduleNote.local"),i.next==="add-cloud"&&e.jsxs(e.Fragment,{children:[" ",e.jsx("button",{type:"button",className:u,onClick:()=>s({type:"openCloudAdd",source:"app_routines"}),children:n("routines.scheduleNote.addCloud")})]}),i.next==="open-cloud"&&e.jsxs(e.Fragment,{children:[" ",n("routines.scheduleNote.openCloud")," ",e.jsx("button",{type:"button",className:u,onClick:m,children:n("cloudHome.connect")})]})]})})}const Xe="application/x-openmaus-bot",we="application/x-openmaus-calendar-event",Zs=t=>t.dataTransfer.types.includes(Xe)||t.dataTransfer.types.includes(we);function Vs(t){const s=t.dataTransfer.getData(Xe);if(s)return{botId:s};try{const r=JSON.parse(t.dataTransfer.getData(we));return(r.kind==="routine"||r.kind==="call")&&typeof r.id=="string"&&typeof r.at=="number"?{event:{kind:r.kind,id:r.id,at:r.at}}:null}catch{return null}}function Js({marker:t,hourHeight:s,onDrop:r}){const[o,i]=x.useState(!1),u=new Date(t.at),m=n("limits.marker",{engine:t.name,time:xn(t.at,t.at)});return e.jsxs("div",{"data-limit-marker":t.engine,role:"note","aria-label":m,title:n("limits.markerDrop",{engine:t.name}),className:"absolute inset-x-0 z-[25] -translate-y-1/2 py-1.5",style:{top:(u.getHours()*60+u.getMinutes())/60*s},onPointerDown:c=>c.stopPropagation(),onDragOver:c=>{!r||!Zs(c)||(c.preventDefault(),c.stopPropagation(),c.dataTransfer.dropEffect="copy",i(!0))},onDragLeave:()=>i(!1),onDrop:c=>{c.preventDefault(),c.stopPropagation(),i(!1);const h=Vs(c);h&&r?.(h)},children:[e.jsx("div",{className:C("h-0 border-t-2 border-dashed",o?"border-accent":"border-warning/80")}),e.jsxs("span",{className:C("absolute left-1 top-0 flex max-w-[calc(100%-8px)] items-center gap-1 truncate rounded-full border px-1.5 py-0.5 text-[10px] font-medium shadow-sm",o?"border-accent bg-accent text-accent-ink":"border-warning/50 bg-panel text-ink"),children:[e.jsx(Ms,{size:10,className:"shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"truncate",children:m})]})]})}const G=64;function jn(t){return t==="running"?"working":t==="waiting"?"curious":t==="completed"?"proud":t==="failed"||t==="missed"?"sad":t==="cancelled"?"sleeping":"drowsy"}function Ks(t){return t>=44?"roomy":t>=22?"compact":"tiny"}function Qs({item:t,bots:s,groups:r,compact:o,layout:i,selected:u=!1,onOpen:m,onResize:c}){const h=t.kind==="call",N=t.kind==="routine"?t.routine:null,l=t.kind==="routine"?t.run:null,S=!h&&(l?.target??N?.target)==="room-goal"?l?.groupId??N?.groupId:void 0,v=S?r.find(F=>F.id===S)??{name:n("routines.group")}:void 0,L=(h?t.call.botIds:[l?.botId??N?.botId??""]).flatMap(F=>s.find(y=>y.id===F)??[]),A=L[0],_=h?t.call.name:l?.routineName??N?.name??n("routines.event.automation"),B=h?"var(--color-accent)":A?Qn[A.color]:"var(--color-ink-tertiary)",E=!!(N&&!l&&!N.enabled),[M,d]=x.useState(t.durationMinutes);x.useEffect(()=>d(t.durationMinutes),[t.durationMinutes]);const b=l?.status,T=b==="failed"||b==="missed"||b==="waiting"||t.kind==="routine"&&!l&&t.needsYou===!0,P=l?jt(l):void 0,g=h||!!(N&&!l&&!E&&N.schedule.type!=="cron"),j=h?t.call.schedule:N?.schedule,I=!!(j&&j.type!=="once"),D=j?.type==="interval"?os(j.everyMinutes):null,z=Math.max(16,M/60*G),p=Ks(z),H=h?n(L.length===1?"routines.botCountOne":"routines.botCountMany",{count:L.length}):v?v.name:A?.name,w=[_,X(t.at),H,D,E?(N&&ls(N))??n("routines.pausedSchedule"):P].filter(Boolean).join(" · "),R=N?.schedule.type==="cron"?n("routines.event.cronMoveHint"):"",Z=F=>{F.preventDefault(),F.stopPropagation();const y=F.clientY,de=M;let Q=de;const be=ve=>{Q=Math.max(ee,Math.min(240,Math.round((de+(ve.clientY-y)/G*60)/ee)*ee)),d(Q)},ce=()=>{if(document.removeEventListener("pointermove",be),document.removeEventListener("pointerup",ce),Q!==t.durationMinutes){if(I&&!window.confirm(n("routines.event.resizeSeries"))){d(t.durationMinutes);return}c(Q)}};document.addEventListener("pointermove",be),document.addEventListener("pointerup",ce,{once:!0})},te=!h&&e.jsx("span",{"data-event-status":E?"paused":T?"needs-you":"working",className:C("size-1.5 shrink-0 rounded-full",E?"bg-ink-tertiary":T?"bg-warning":"bg-success")}),le=F=>h?e.jsx(vt,{size:13,className:"mt-0.5 shrink-0"}):A?e.jsx(Ve,{bot:A,state:b?jn(b):E?"sleeping":"idle",size:F,animated:b==="running"||b==="waiting"}):null;return e.jsxs("button",{"data-event-card":!0,"data-event-fit":p,type:"button",draggable:g,title:R?`${w}
1
+ import{c as tt,r as x,j as e,t as n,a as C,i as Le,bp as Un,k as Yn,am as ln,g as dn,L as cn,X as Me,S as Zn,J as Vn}from"./styles-BYp3glRK.js";import{b as Jn}from"./remote-desktop-DDRRx8uY.js";import{ak as Kn,a$ as Qn,B as Ve,c as Xn,L as ze,y as Te}from"./PlacesRail-msEDHUXY.js";import{je as Je,cg as es,D as U,aP as ts,jf as ns,jg as un,bh as ss,cR as as,jh as rs,ji as xn,u as nt,jj as is,a9 as jt,jk as os,fg as X,af as ls,jl as kt,jm as ee,jn as ht,gq as ds,jo as qe,jp as pn,cO as mn,cL as Ye,jq as ut,jr as Xt,js as en,jt as Re,y as Ze,ju as tn,jv as cs,jw as gt,cJ as hn,ac as st,jx as Ke,jy as us,m as xs,jz as ps,br as gn,jA as ms,jB as hs,n as Ne,jC as gs,jD as bs,jE as Nt,jF as nn,jG as vs,a7 as fs,ad as xt,x as ys,cG as sn,cH as js,dB as ks,T as Ns,jH as ws,jI as Ue,cv as Ss,bq as Cs,fP as Is}from"./App-Dc7eNHIo.js";import{u as Ds}from"./ProIntroduction-D8SaBehJ.js";import{C as Ts}from"./MenuMotion-BjmjRIR3.js";const Rs=[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]],Ms=tt("hourglass",Rs);const zs=[["path",{d:"m2 9 3-3 3 3",key:"1ltn5i"}],["path",{d:"M13 18H7a2 2 0 0 1-2-2V6",key:"1r6tfw"}],["path",{d:"m22 15-3 3-3-3",key:"4rnwn2"}],["path",{d:"M11 6h6a2 2 0 0 1 2 2v10",key:"2f72bc"}]],Ls=tt("repeat-2",zs);const Os=[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M19 16v6",key:"tddt3s"}],["path",{d:"M22 19h-6",key:"vcuq98"}]],bt=tt("user-round-plus",Os);const As=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],vt=tt("video",As);function Qe(t,s){if(!t.config?.team)return;const r=t.bots.find(i=>i.id===s);if(r?.defaultBot?.person)return null;const o=r&&t.activeView==="chat"&&t.selectedId===r.id?r.tasks?.find(i=>i.threadId===r.threadId):void 0;return o&&o.private!==!0&&!o.routineRunId?r.mainThreadId??null:Je}function Es(t,s,r){const o=i=>typeof i=="string"&&!!t.tasks?.some(u=>u.threadId===i&&u.private===!0);return!!t.defaultBot?.person||s===Je||o(s)||o(r)}function bn({team:t,bot:s,value:r,madeIn:o}){if(!t||!s)return null;const i=Es(s,r,o),u=i?Kn:ts;return e.jsxs("p",{role:"note","data-routine-audience":i?"me":"shared",className:"mt-2 flex items-center gap-1 text-[12px] leading-4 text-ink-secondary",children:[e.jsx(u,{size:12,"aria-hidden":"true",className:"shrink-0"}),e.jsx("span",{children:i?n("team.privateHeader"):ns(t.name,s.onlyPeopleAdded)})]})}function vn({bot:t,value:s,allowCurrent:r=!1,team:o,onChange:i}){const u=x.useId(),m=es();if(o??m!==null)return e.jsx(Ps,{id:u,bot:t,value:s,allowCurrent:r,onChange:i});const c=(t?.tasks??[]).filter(l=>!l.routineRunId),h=typeof s=="string"&&!c.some(l=>l.threadId===s),N=[...t?.projects??[],{id:"",name:n("folder.none")}];return e.jsxs("div",{className:"min-w-0 space-y-1.5",children:[e.jsx("label",{htmlFor:u,className:"block text-[12px] font-medium text-ink",children:n("routines.results.label")}),e.jsxs(U,{className:"w-full",id:u,"aria-describedby":`${u}-help`,disabled:!t,value:s??(s===null?"new":"current"),onChange:l=>i(l.target.value==="new"?null:l.target.value==="current"?void 0:l.target.value),children:[r&&e.jsx("option",{value:"current",children:n("routines.results.keep")}),e.jsx("option",{value:"new",children:n("routines.results.main")}),h&&e.jsx("option",{value:s,disabled:!0,children:n("routines.results.unavailable")}),N.map(l=>{const $=c.filter(S=>l.id?S.projectId===l.id:!t?.projects?.some(v=>v.id===S.projectId));return $.length?e.jsx("optgroup",{label:l.name,children:$.map(S=>e.jsx("option",{value:S.threadId,children:S.title},S.threadId))},l.id):null})]}),e.jsx("p",{id:`${u}-help`,className:"text-[11px] leading-relaxed text-ink-secondary",children:n("routines.results.mainHelp")})]})}function Ps({id:t,bot:s,value:r,allowCurrent:o,onChange:i}){const u=typeof r=="string"&&!!s?.tasks?.some(c=>c.threadId===r&&c.private===!0),m=r===void 0&&o?"current":r===Je||u?"me":"shared";return e.jsxs("div",{className:"min-w-0 space-y-1.5",children:[e.jsx("label",{htmlFor:t,className:"block text-[12px] font-medium text-ink",children:n("routines.results.label")}),e.jsxs(U,{className:"w-full",id:t,"aria-describedby":`${t}-help`,disabled:!s,value:m,onChange:c=>i(c.target.value==="current"?void 0:c.target.value==="me"?u?r:Je:s?.mainThreadId??null),children:[m==="current"&&e.jsx("option",{value:"current",children:n("routines.results.keep")}),e.jsx("option",{value:"me",children:n("routines.results.justMe")}),e.jsx("option",{value:"shared",children:n("task.sharedChat")})]}),e.jsx("p",{id:`${t}-help`,className:"text-[11px] leading-relaxed text-ink-secondary",children:n("routines.results.teamHelp")})]})}const pt="min-w-0 rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[13px] text-ink outline-none focus:border-accent [color-scheme:dark]",Hs=t=>Array.from({length:12},(s,r)=>new Intl.DateTimeFormat(t,{month:"long",timeZone:"UTC"}).format(new Date(Date.UTC(2024,r,1)))),$s=["UTC",...typeof Intl.supportedValuesOf=="function"?Intl.supportedValuesOf("timeZone"):[]];function fn({runs:t,timeZone:s,paused:r=!1}){if(!t.length)return null;const o=new Intl.DateTimeFormat(Le(),{timeZone:s,weekday:"short",year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"});return e.jsxs("div",{className:"space-y-1 text-[11px] leading-relaxed text-ink-secondary","aria-label":n(r?"routines.cron.pausedPreviewLabel":"routines.cron.nextRunsLabel"),children:[e.jsxs("div",{className:"font-medium",children:[n(r?"routines.cron.pausedPreview":"routines.cron.nextRuns")," · ",s]}),t.map(i=>e.jsx("div",{children:e.jsx("time",{dateTime:new Date(i).toISOString(),children:o.format(i)})},i)),e.jsx("div",{className:"pt-1",children:n("routines.cron.clockChanges")})]})}function _s({schedule:t,paused:s=!1}){const r=x.useMemo(()=>{try{return un(t,Date.now(),3)}catch{return[]}},[t]);return e.jsx(fn,{runs:r,timeZone:t.timeZone,paused:s})}function Fs({choice:t,value:s,onChange:r,runs:o,error:i}){const u=m=>r({...s,...m});return e.jsxs("div",{className:"space-y-3",children:[t==="cron"?e.jsxs("label",{className:"block space-y-1.5 text-[12px] text-ink-secondary",children:[e.jsx("span",{children:n("routines.cron.expression")}),e.jsx("input",{value:s.expression,onChange:m=>u({expression:m.target.value}),placeholder:"0 9 1 * *",spellCheck:!1,autoComplete:"off","aria-invalid":!!i,"aria-describedby":"routine-cron-help routine-cron-error",className:C(pt,"w-full font-mono")}),e.jsx("span",{id:"routine-cron-help",className:"block text-[11px]",children:n("routines.cron.expressionHelp")})]}):e.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[t==="yearly"&&e.jsxs("label",{className:"space-y-1.5 text-[12px] text-ink-secondary",children:[e.jsx("span",{className:"block",children:n("routines.cron.month")}),e.jsx(U,{value:s.month,onChange:m=>u({month:m.target.value}),children:Hs(Le()).map((m,c)=>e.jsx("option",{value:String(c+1),children:m},m))})]}),e.jsxs("label",{className:"space-y-1.5 text-[12px] text-ink-secondary",children:[e.jsx("span",{className:"block",children:n("routines.cron.dayOfMonth")}),e.jsxs(U,{value:s.day,onChange:m=>u({day:m.target.value}),children:[Array.from({length:31},(m,c)=>e.jsx("option",{value:String(c+1),children:c+1},c+1)),e.jsx("option",{value:"L",children:n("routines.cron.lastDay")})]})]}),e.jsxs("label",{className:"space-y-1.5 text-[12px] text-ink-secondary",children:[e.jsx("span",{className:"block",children:n("routines.cron.time")}),e.jsx("input",{type:"time",step:60,value:s.time,onChange:m=>u({time:m.target.value}),className:pt})]})]}),t!=="cron"&&Number(s.day)>28&&e.jsx("p",{className:"text-[11px] text-ink-secondary",children:n("routines.cron.skippedMonths")}),e.jsxs("label",{className:"block space-y-1.5 text-[12px] text-ink-secondary",children:[e.jsx("span",{children:n("routines.cron.timeZone")}),e.jsx("input",{list:"routine-time-zones",value:s.timeZone,onChange:m=>u({timeZone:m.target.value}),placeholder:"America/New_York",spellCheck:!1,autoComplete:"off","aria-invalid":!!i,"aria-describedby":"routine-cron-error",className:C(pt,"block w-full")})]}),e.jsx("datalist",{id:"routine-time-zones",children:$s.map(m=>e.jsx("option",{value:m},m))}),i&&e.jsx("p",{id:"routine-cron-error",role:"alert",className:"text-[12px] text-danger",children:i}),!i&&e.jsx(fn,{runs:o,timeZone:s.timeZone.trim()})]})}const ge=t=>["monthly","yearly","cron"].includes(t);function yn(t){const s=t.trim().split(/\s+/);if(s.length!==5)return null;const[r,o,i,u,m]=s;return!/^\d+$/.test(r)||Number(r)>59||!/^\d+$/.test(o)||Number(o)>23||!(i==="L"||/^\d+$/.test(i)&&Number(i)>=1&&Number(i)<=31)||!(u==="*"||/^\d+$/.test(u)&&Number(u)>=1&&Number(u)<=12)||m!=="*"?null:{day:i==="L"?i:String(Number(i)),month:u,time:`${String(Number(o)).padStart(2,"0")}:${String(Number(r)).padStart(2,"0")}`}}function Bs(t){const s=yn(t.expression);return s?s.month==="*"?"monthly":"yearly":"cron"}function Ws(t,s){const r=t?.timeZone??Intl.DateTimeFormat().resolvedOptions().timeZone,o=t&&yn(t.expression);let i;try{i=new Intl.DateTimeFormat("en-US",{timeZone:r,month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(s)}catch{i=new Intl.DateTimeFormat("en-US",{timeZone:"UTC",month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(s)}const u=h=>i.find(N=>N.type===h).value,m=o?.time??`${u("hour")}:${u("minute")}`,c=o?.day??u("day");return{expression:t?.expression??`${Number(m.slice(3))} ${Number(m.slice(0,2))} ${c} * *`,timeZone:r,day:c,month:o&&o.month!=="*"?String(Number(o.month)):u("month"),time:m}}function Gs(t,s,r,o){try{if(t!=="cron"&&!/^\d{2}:\d{2}$/.test(s.time))throw new Error(n("routines.cron.chooseTime"));const[i,u]=s.time.split(":"),m=o??{type:"cron",timeZone:s.timeZone,expression:t==="cron"?s.expression:`${Number(u)} ${Number(i)} ${s.day} ${t==="yearly"?s.month:"*"} *`},c=ss(m,r);return{schedule:o??c,runs:un(c,r,3),error:""}}catch(i){return{schedule:null,runs:[],error:i instanceof Error?i.message:String(i)}}}function qs({value:t,botEngine:s,onChange:r}){const o=as(),i=t.engine||s||o[0]?.engine||"",u=[...new Set([...s?[s]:[],...o.map(c=>c.engine),...i?[i]:[]])],m=o.find(c=>c.engine===i)?.resetsAt??null;return e.jsxs("div",{className:"space-y-2 text-[13px] text-ink","data-testid":"limit-reset-fields",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:n("routines.limitReset.engine")}),e.jsx(U,{"aria-label":n("routines.limitReset.engine"),value:i,onChange:c=>r({...t,engine:c.target.value}),children:u.map(c=>e.jsx("option",{value:c,children:rs(c)},c))}),e.jsxs(U,{"aria-label":n("routines.limitReset.repeat"),value:t.repeat,onChange:c=>r({...t,engine:i,repeat:c.target.value}),children:[e.jsx("option",{value:"once",children:n("routines.limitReset.once")}),e.jsx("option",{value:"every_reset",children:n("routines.limitReset.every")})]})]}),e.jsx("div",{className:"text-[12px] text-ink-secondary",children:m!==null&&m>Date.now()?n("routines.limitReset.next",{time:xn(m)}):n("routines.limitReset.unknown")})]})}function Us({cloudHome:t,local:s,plan:r,ready:o,offersAllowed:i}){return t?{kind:"cloud"}:s?r?.kind==="paid"?{kind:"local",next:o?"open-cloud":null}:{kind:"local",next:r&&i&&Yn(r)?"add-cloud":null}:{kind:"server"}}function Ys(){const{state:t,dispatch:s}=nt(),r=Ds(),o=is()&&window.ogb?.remoteClient?.active!==!0,i=Us({cloudHome:t.config?.cloudHome===!0,local:o,plan:r?.view??null,ready:r?.account?.machine?.status==="ready",offersAllowed:Un().source!=="file"}),u="text-left underline underline-offset-2 hover:text-ink",m=()=>{window.confirm(n("routines.scheduleNote.leave"))&&window.ogb?.cloudAccount?.connectHome().catch(()=>{})};return e.jsx("p",{"data-routine-schedule-note":i.kind==="local"?i.next??"local":i.kind,className:"text-[11px] leading-relaxed text-ink-secondary",children:i.kind==="cloud"?n("routines.scheduleNote.cloud"):i.kind==="server"?n("routines.scheduleNote.server"):e.jsxs(e.Fragment,{children:[n("routines.scheduleNote.local"),i.next==="add-cloud"&&e.jsxs(e.Fragment,{children:[" ",e.jsx("button",{type:"button",className:u,onClick:()=>s({type:"openCloudAdd",source:"app_routines"}),children:n("routines.scheduleNote.addCloud")})]}),i.next==="open-cloud"&&e.jsxs(e.Fragment,{children:[" ",n("routines.scheduleNote.openCloud")," ",e.jsx("button",{type:"button",className:u,onClick:m,children:n("cloudHome.connect")})]})]})})}const Xe="application/x-openmaus-bot",we="application/x-openmaus-calendar-event",Zs=t=>t.dataTransfer.types.includes(Xe)||t.dataTransfer.types.includes(we);function Vs(t){const s=t.dataTransfer.getData(Xe);if(s)return{botId:s};try{const r=JSON.parse(t.dataTransfer.getData(we));return(r.kind==="routine"||r.kind==="call")&&typeof r.id=="string"&&typeof r.at=="number"?{event:{kind:r.kind,id:r.id,at:r.at}}:null}catch{return null}}function Js({marker:t,hourHeight:s,onDrop:r}){const[o,i]=x.useState(!1),u=new Date(t.at),m=n("limits.marker",{engine:t.name,time:xn(t.at,t.at)});return e.jsxs("div",{"data-limit-marker":t.engine,role:"note","aria-label":m,title:n("limits.markerDrop",{engine:t.name}),className:"absolute inset-x-0 z-[25] -translate-y-1/2 py-1.5",style:{top:(u.getHours()*60+u.getMinutes())/60*s},onPointerDown:c=>c.stopPropagation(),onDragOver:c=>{!r||!Zs(c)||(c.preventDefault(),c.stopPropagation(),c.dataTransfer.dropEffect="copy",i(!0))},onDragLeave:()=>i(!1),onDrop:c=>{c.preventDefault(),c.stopPropagation(),i(!1);const h=Vs(c);h&&r?.(h)},children:[e.jsx("div",{className:C("h-0 border-t-2 border-dashed",o?"border-accent":"border-warning/80")}),e.jsxs("span",{className:C("absolute left-1 top-0 flex max-w-[calc(100%-8px)] items-center gap-1 truncate rounded-full border px-1.5 py-0.5 text-[10px] font-medium shadow-sm",o?"border-accent bg-accent text-accent-ink":"border-warning/50 bg-panel text-ink"),children:[e.jsx(Ms,{size:10,className:"shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"truncate",children:m})]})]})}const G=64;function jn(t){return t==="running"?"working":t==="waiting"?"curious":t==="completed"?"proud":t==="failed"||t==="missed"?"sad":t==="cancelled"?"sleeping":"drowsy"}function Ks(t){return t>=44?"roomy":t>=22?"compact":"tiny"}function Qs({item:t,bots:s,groups:r,compact:o,layout:i,selected:u=!1,onOpen:m,onResize:c}){const h=t.kind==="call",N=t.kind==="routine"?t.routine:null,l=t.kind==="routine"?t.run:null,S=!h&&(l?.target??N?.target)==="room-goal"?l?.groupId??N?.groupId:void 0,v=S?r.find(F=>F.id===S)??{name:n("routines.group")}:void 0,L=(h?t.call.botIds:[l?.botId??N?.botId??""]).flatMap(F=>s.find(y=>y.id===F)??[]),A=L[0],_=h?t.call.name:l?.routineName??N?.name??n("routines.event.automation"),B=h?"var(--color-accent)":A?Qn[A.color]:"var(--color-ink-tertiary)",E=!!(N&&!l&&!N.enabled),[M,d]=x.useState(t.durationMinutes);x.useEffect(()=>d(t.durationMinutes),[t.durationMinutes]);const b=l?.status,T=b==="failed"||b==="missed"||b==="waiting"||t.kind==="routine"&&!l&&t.needsYou===!0,P=l?jt(l):void 0,g=h||!!(N&&!l&&!E&&N.schedule.type!=="cron"),j=h?t.call.schedule:N?.schedule,I=!!(j&&j.type!=="once"),D=j?.type==="interval"?os(j.everyMinutes):null,z=Math.max(16,M/60*G),p=Ks(z),H=h?n(L.length===1?"routines.botCountOne":"routines.botCountMany",{count:L.length}):v?v.name:A?.name,w=[_,X(t.at),H,D,E?(N&&ls(N))??n("routines.pausedSchedule"):P].filter(Boolean).join(" · "),R=N?.schedule.type==="cron"?n("routines.event.cronMoveHint"):"",Z=F=>{F.preventDefault(),F.stopPropagation();const y=F.clientY,de=M;let Q=de;const be=ve=>{Q=Math.max(ee,Math.min(240,Math.round((de+(ve.clientY-y)/G*60)/ee)*ee)),d(Q)},ce=()=>{if(document.removeEventListener("pointermove",be),document.removeEventListener("pointerup",ce),Q!==t.durationMinutes){if(I&&!window.confirm(n("routines.event.resizeSeries"))){d(t.durationMinutes);return}c(Q)}};document.addEventListener("pointermove",be),document.addEventListener("pointerup",ce,{once:!0})},te=!h&&e.jsx("span",{"data-event-status":E?"paused":T?"needs-you":"working",className:C("size-1.5 shrink-0 rounded-full",E?"bg-ink-tertiary":T?"bg-warning":"bg-success")}),le=F=>h?e.jsx(vt,{size:13,className:"mt-0.5 shrink-0"}):A?e.jsx(Ve,{bot:A,state:b?jn(b):E?"sleeping":"idle",size:F,animated:b==="running"||b==="waiting"}):null;return e.jsxs("button",{"data-event-card":!0,"data-event-fit":p,type:"button",draggable:g,title:R?`${w}
2
2
  ${R}`:w,onDragStart:F=>{if(!g)return F.preventDefault();F.dataTransfer.effectAllowed="move",F.dataTransfer.setData(we,JSON.stringify({kind:t.kind,id:h?t.call.id:N.id,at:t.at}))},onClick:F=>{F.stopPropagation(),m()},"aria-pressed":u,"aria-label":`${_}, ${X(t.at)}${E?`, ${n("routines.pausedSchedule")}`:P?`, ${P}`:""}`,className:C("group absolute z-10 overflow-hidden rounded-md border border-l-[3px] text-left transition hover:z-20 focus:z-20 focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",p==="roomy"?"px-1.5 py-1":"px-1.5 py-0",E&&"border-dashed opacity-70",b==="cancelled"&&"opacity-55",(b==="failed"||b==="missed")&&(l&&kt(l)?"border-warning/60":"border-danger/60"),u&&"z-20 ring-2 ring-accent ring-offset-1 ring-offset-app"),style:{left:`calc(${i.column/i.columns*100}% + 2px)`,width:`calc(${100/i.columns}% - 4px)`,top:`${(new Date(t.at).getHours()*60+new Date(t.at).getMinutes())/60*G}px`,height:`${z}px`,background:`color-mix(in srgb, ${B} ${E?6:16}%, var(--color-card))`,borderColor:`color-mix(in srgb, ${B} 40%, transparent)`,borderLeftColor:B,color:`color-mix(in srgb, ${B} 55%, var(--color-ink))`},children:[p==="roomy"?e.jsxs("div",{className:"flex min-w-0 items-start gap-1.5",children:[le(o?18:22),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-[11px] font-semibold leading-tight",children:_}),e.jsxs("div",{className:"mt-0.5 flex min-w-0 items-center gap-1 text-[10px] opacity-80",children:[te,e.jsxs("span",{className:"truncate",children:[X(t.at)," · ",D&&!v&&!h?`${H??""} · ${D}`:H]})]})]}),L.length>1&&e.jsxs("span",{className:"rounded bg-inset/60 px-1 py-0.5 text-[8px]",children:["+",L.length-1]})]}):p==="compact"?e.jsxs("div",{className:"flex h-full min-w-0 items-center gap-1",children:[h&&e.jsx(vt,{size:11,className:"shrink-0"}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] font-semibold leading-none",children:_}),te,e.jsx("span",{className:"shrink-0 text-[10px] leading-none tabular-nums opacity-80",children:X(t.at)})]}):e.jsx("div",{className:"flex h-full min-w-0 items-center truncate text-[10px] font-semibold leading-none",children:_}),h&&e.jsx("div",{onPointerDown:Z,className:"absolute inset-x-1 bottom-0 h-1.5 cursor-ns-resize rounded-full opacity-0 transition group-hover:opacity-100","aria-label":n("routines.event.resize"),children:e.jsx("div",{className:"mx-auto mt-0.5 h-0.5 w-5 rounded-full bg-current opacity-50"})})]})}const ft=[0,1,2,3,4,5,6],et=[1,2,3,4,5],mt=[5,10,15,30,60],an=Array.from({length:240/ee},(t,s)=>(s+1)*ee);function kn(t,s){return t?t.memberIds.flatMap(r=>{const o=s.find(i=>i.id===r);return o&&!o.hidden?[o]:[]}):s.filter(r=>!r.hidden)}function Xs(t){return t.dm?!1:!(Object.prototype.hasOwnProperty.call(t,"setupCompletedAt")||Object.prototype.hasOwnProperty.call(t,"setupSkippedAt"))||t.setupCompletedAt!=null||t.setupSkippedAt!=null||(t.messages?.length??0)>0}function rn(t,s,r){const o=kn(t,s),i=t?.defaultResponder.kind==="member"?t.defaultResponder.botId:void 0;return o.find(u=>u.id===r)??o.find(u=>u.id===i)??o.find(u=>u.chiefOfStaff)??o[0]}function on(){const t=new Date(Date.now()+36e5);return t.setMinutes(0,0,0),t.getTime()}function ea(t,s){return!!(t&&t.length===s.length&&t.every((r,o)=>r===s[o]))}function ta(t){return t.type!=="interval"||!t.weekdays||t.weekdays.length===7?"every-day":ea(t.weekdays,et)?"weekdays":"custom"}function na(t){const s=new Date(`${t}T00:00`);return s.setHours(23,59,59,999),s.getTime()}function sa(t,s){return t.type==="once"?"none":t.type==="limit_reset"?"limit_reset":t.type==="interval"?"interval":t.type==="cron"?Bs(t):t.weekdays.length===7?"daily":t.weekdays.join(",")==="1,2,3,4,5"?"weekdays":t.weekdays.length===1&&t.weekdays[0]===new Date(s).getDay()?"weekly":"custom"}function Nn(t,s,r){if(t==="none")return{type:"once",at:s};const o=t==="daily"?ft:t==="weekdays"?et:t==="weekly"?[new Date(s).getDay()]:r;return{type:"daily",time:pn(s),weekdays:[...o].sort()}}function aa(t,s,r,o,i){return t==="interval"?{type:"interval",everyMinutes:o,...i}:Nn(t,s,r)}function wn({attachments:t,onRemove:s}){return t.length?e.jsx("div",{className:"flex flex-wrap gap-2",children:t.map(r=>e.jsxs("div",{className:"flex max-w-[260px] items-center gap-2 rounded-lg border border-hairline/50 bg-inset px-2.5 py-2 text-[12px] text-ink",children:[e.jsx(st,{size:14,className:"shrink-0 text-accent"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:r.name}),s&&e.jsx("button",{type:"button",onClick:()=>s(r.id),className:"rounded p-0.5 text-ink-secondary hover:bg-raised hover:text-ink","aria-label":n("routines.attachment.remove",{name:r.name}),children:e.jsx(Me,{size:12})})]},r.id))}):null}function yt({bots:t,selected:s,multiple:r,locked:o,onChange:i}){const[u,m]=x.useState(""),c=t.filter(h=>`${h.name} ${h.title}`.toLowerCase().includes(u.toLowerCase()));return e.jsxs("div",{className:"rounded-xl border border-hairline/50 bg-inset/60 p-2",children:[!o&&t.length>5&&e.jsxs("label",{className:"mb-2 flex items-center gap-2 rounded-lg border border-transparent bg-panel px-2.5 py-2 text-ink-secondary focus-within:border-focus",children:[e.jsx(Zn,{size:14}),e.jsx("input",{value:u,onChange:h=>m(h.target.value),placeholder:n("routines.findBot"),className:"min-w-0 flex-1 bg-transparent text-[12px] text-ink outline-none placeholder:text-ink-tertiary"})]}),e.jsx("div",{className:"grid max-h-48 grid-cols-1 gap-1 overflow-y-auto sm:grid-cols-2",children:c.map(h=>{const N=s.includes(h.id);return e.jsxs("button",{type:"button",disabled:o,onClick:()=>i(r?N?s.filter(l=>l!==h.id):[...s,h.id]:[h.id]),className:C("flex min-w-0 items-center gap-2 rounded-lg px-2 py-2 text-left transition",N?"bg-accent/12 ring-1 ring-accent/50":"hover:bg-raised",o&&"cursor-default"),children:[e.jsx(Ve,{bot:h,state:N?"happy":"idle",size:32,animated:!1}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-medium text-ink",children:h.name}),N&&e.jsx(gn,{size:14,className:"shrink-0 text-accent"})]},h.id)})})]})}function ra(t){return t.flatMap(s=>s.kind==="paste"||s.kind==="citation"?[]:[{id:s.id,kind:s.kind,name:s.name,path:s.path,size:s.size}])}function ia({seed:t,bots:s,lockedBotId:r,defaultRunOn:o,routinesOnly:i=!1,plain:u=!1,onClose:m,onSavedCall:c}){const{state:h,dispatch:N}=nt(),l=t.routine,{request:$}=ds(),S=t.call,[v,J]=x.useState(i?"routine":t.kind),[L]=x.useState(()=>Date.now()),[A,_]=x.useState(l?.name??S?.name??t.name??""),[B,E]=x.useState(l?.prompt??S?.description??t.description??""),M=l?.schedule.type==="once"?l.schedule.at:l?.schedule.type==="daily"?ht(t.at,l.schedule.time):l?.schedule.type==="interval"?l.schedule.anchorAt:S?.schedule.type==="once"?S.schedule.at:S?.schedule.type==="daily"?ht(t.at,S.schedule.time):t.at,d=l?.schedule??S?.schedule??{type:"once",at:M},[b,T]=x.useState(qe(M)),[P,g]=x.useState(pn(M)),[j,I]=x.useState(l?.durationMinutes??S?.durationMinutes??t.durationMinutes),[D,z]=x.useState(l?.timeoutMinutes??null),[p,H]=x.useState(!!l),[w,R]=x.useState(l?.overlap??"skip"),[Z,te]=x.useState(!!l?.continuity),[le,F]=x.useState(!!l?.runOnStartup),[y,de]=x.useState(t.limitReset?"limit_reset":sa(d,M)),[Q,be]=x.useState(d.type==="limit_reset"?d:{engine:t.limitReset?.engine??"",repeat:"once"}),[ce,ve]=x.useState(()=>Ws(d.type==="cron"?d:void 0,M)),[at,Oe]=x.useState(!1),[fe,Ae]=x.useState(d.type==="daily"?d.weekdays:[new Date(M).getDay()]),[q,Se]=x.useState(d.type==="interval"?d.everyMinutes:15),[ne,rt]=x.useState(()=>ta(d)),[f,K]=x.useState(()=>d.type==="interval"&&d.weekdays?.length?d.weekdays:[...ft]),[pe,se]=x.useState(d.type==="interval"&&d.window?"custom":"all-day"),[Ee,Sn]=x.useState(d.type==="interval"?d.window?.start??"09:00":"09:00"),[Pe,Cn]=x.useState(d.type==="interval"?d.window?.end??"17:00":"17:00"),[He,In]=x.useState(d.type==="interval"&&d.endsAt!=null?"on-date":"never"),[wt,Dn]=x.useState(()=>d.type==="interval"&&d.endsAt!=null?qe(d.endsAt):qe(mn(Ye(Math.max(Date.now(),M)),7))),[W,St]=x.useState(r?[r]:l?[l.botId]:S?.botIds??t.botIds),[it,Ct]=x.useState(()=>(l?l.resultsThreadId:t.resultsThreadId??Qe(h,W[0]))??null),$e=a=>{a[0]!==W[0]&&Ct(Qe(h,a[0])??null),St(a)},[V,Tn]=x.useState(l?.target??"bot"),[me,ot]=x.useState(l?.groupId??""),[ye,_e]=x.useState(l?.runOn??o??"maus"),[Ce,lt]=x.useState(l?.target==="room-goal"?[]:l?.attachments??S?.attachments??[]),[It,Dt]=x.useState(!1),[Tt,Rt]=x.useState(""),[Mt,zt]=x.useState(""),[Rn,Lt]=x.useState(0),Fe=Rn>0,Ot=x.useRef(null),Mn=!!(h.config?.box.configured&&W.length>0&&W.every(a=>Jn(h.instances,s.find(k=>k.id===a)?.modelSelection.instanceId)?.snapshot.state==="available")),Be=h.groups.filter(Xs),ue=Be.find(a=>a.id===me),dt=ue?kn(ue,h.bots):s,ae=v==="routine"&&V==="room-goal",At=h.config?.cloudHome===!0,We=ut(b,P,l||S?M:void 0),zn=We+j*6e4,Ie=W.flatMap(a=>s.find(k=>k.id===a)??[]),Et=x.useRef(null),De=y==="interval"&&(!Number.isInteger(q)||q<5||q>1440),je=y==="interval"&&ne==="custom"&&f.length===0,Pt=ut("2000-01-01",Pe)-ut("2000-01-01",Ee),re=y==="interval"&&pe==="custom"&&(!Ee||!Pe||!Number.isFinite(Pt)||Pt<q*6e4),ct=l?.schedule.type==="interval"?l.schedule:void 0,Ht=Xt(L,Math.max(5,q||5),ct),ke=He==="on-date"?na(wt):null,he=y==="interval"&&He==="on-date"&&(ke==null||!Number.isSafeInteger(ke)||ke<Ht),$t=ne==="every-day"?void 0:ne==="weekdays"?et:f,Ln=pe==="custom"?{start:Ee,end:Pe}:void 0,xe=ge(y)?Gs(y,ce,L,!at&&d.type==="cron"?d:void 0):null,_t=a=>{a==="interval"&&!p&&(z(k=>k??30),H(!0)),ge(a)&&(a==="cron"&&xe?.schedule&&ve(k=>({...k,expression:xe.schedule.expression})),Oe(!0)),de(a)},On=a=>{a==="custom"&&ne!=="custom"&&K(ne==="weekdays"?[...et]:[...ft]),rt(a)},Ft=a=>{if(Tn(a),a==="bot"){ot("");return}_e("maus"),lt([]),zt("");const k=ue??Be[0];ot(k?.id??"");const O=rn(k,h.bots,W[0]);$e(O?[O.id]:[])},An=a=>{const k=Be.find(ie=>ie.id===a);ot(a);const O=rn(k,h.bots,W[0]);$e(O?[O.id]:[])},En=async a=>{if(!(!a?.length||ae)){Lt(k=>k+1);try{const k=await us(Array.from(a),{allowImages:!0,getPath:ps,uploadImage:xs}),O=ra(k.attachments);O.length&&(lt(ie=>[...ie,...O].slice(0,20)),ye==="cloud"&&_e("maus")),k.notice&&zt(k.notice)}finally{Lt(k=>Math.max(0,k-1))}}},Pn=async()=>{if(!Fe){Dt(!0),Rt("");try{if(v==="routine"||i){const a=Date.now(),k=ms(a,q,ct);if(y==="interval"&&ke!=null&&ke<Xt(a,q,ct))throw new Error(n("routines.interval.endAfterFirstRun"));const O=Q.engine||s.find(qn=>qn.id===(r??W[0]))?.modelSelection?.instanceId||"",ie=y==="limit_reset"?{type:"limit_reset",engine:O,repeat:Q.repeat}:ge(y)?xe?.schedule:aa(y,We,fe,q,{anchorAt:k,weekdays:$t?[...$t].sort():null,window:Ln??null,endsAt:ke});if(!ie)throw new Error(xe?.error||n("routines.error.invalidSchedule"));const Wn={name:A,prompt:B,target:V,botId:r??W[0]??"",groupId:V==="room-goal"&&me?me:null,runOn:V==="room-goal"?"maus":ye,enabled:l&&(l.enabled||!hs(l,a))?void 0:!0,schedule:ie,durationMinutes:j,timeoutMinutes:D,overlap:w,continuity:V==="bot"&&y!=="none"&&Z,runOnStartup:y!=="none"&&le,attachments:V==="room-goal"?[]:Ce,...V==="bot"?{resultsThreadId:it}:{}},Gn=await $(l?`/api/routines/${l.id}`:"/api/routines",{method:l?"PATCH":"POST",body:JSON.stringify(Wn)});N({type:"routinePatched",routine:Gn.routine})}else{if(y==="interval"||y==="limit_reset"||ge(y))throw new Error(n("routines.error.callSchedule"));const a=Nn(y,We,fe),k={name:A,description:B,botIds:W,schedule:a,durationMinutes:j,attachments:Ce},O=await Ne(S?`/api/calendar-calls/${S.id}`:"/api/calendar-calls",{method:S?"PATCH":"POST",body:JSON.stringify(k)});c(O.call)}m()}catch(a){Rt(a instanceof Error?a.message:String(a))}finally{Dt(!1)}}},Hn=!!(A.trim()&&(v==="call"||B.trim())&&(!r||W[0]===r)&&(v==="call"?W.length>0:V==="room-goal"?(!me||ue)&&W[0]&&dt.some(a=>a.id===W[0]):W.length>0)&&!De&&!je&&!re&&!he&&!xe?.error),$n=!i&&!l&&!S&&!r,Y=ln()&&!u,[Ge,_n]=x.useState(()=>!["none","daily","weekdays","weekly"].includes(y)||V==="room-goal"||Ce.length>0||ye==="cloud"||D!=null||le||w==="queue");Xn(Et,m);const Bt=$n&&e.jsxs("div",{className:C(Y&&"ml-10","inline-flex rounded-lg bg-inset p-1"),children:[e.jsx("button",{type:"button",onClick:()=>{J("routine"),St(a=>a.slice(0,1))},className:C("rounded-md px-4 py-1.5 text-[13px] font-medium",v==="routine"?"bg-raised text-ink shadow":"text-ink-secondary"),children:n("routines.kind.routine")}),e.jsx("button",{type:"button",onClick:()=>{J("call"),(y==="interval"||y==="limit_reset"||ge(y))&&de("none")},className:C("rounded-md px-4 py-1.5 text-[13px] font-medium",v==="call"?"bg-raised text-ink shadow":"text-ink-secondary"),children:n("routines.kind.call")})]}),Wt=v==="routine"&&!r&&e.jsxs("div",{className:C(Y&&"ml-10"),children:[e.jsx("div",{className:"mb-2 text-[11px] font-medium uppercase tracking-wider text-ink-secondary",children:n("routines.editor.type")}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[e.jsxs("button",{type:"button",onClick:()=>Ft("bot"),className:C("flex items-start gap-3 rounded-xl border p-3 text-left transition",V==="bot"?"border-accent/60 bg-accent/10":"border-hairline/50 bg-inset hover:bg-raised"),children:[e.jsx(bt,{size:17,className:C("mt-0.5 shrink-0",V==="bot"?"text-accent":"text-ink-secondary")}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-[13px] font-medium text-ink",children:n("routines.editor.botTask")}),e.jsx("span",{className:"mt-1 block text-[11px] leading-relaxed text-ink-secondary",children:n("routines.editor.botTaskHelp")})]})]}),e.jsxs("button",{type:"button",onClick:()=>Ft("room-goal"),className:C("flex items-start gap-3 rounded-xl border p-3 text-left transition",V==="room-goal"?"border-accent/60 bg-accent/10":"border-hairline/50 bg-inset hover:bg-raised"),children:[e.jsx(en,{size:17,className:C("mt-0.5 shrink-0",V==="room-goal"?"text-accent":"text-ink-secondary")}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-[13px] font-medium text-ink",children:n("routines.editor.teamGoal")}),e.jsx("span",{className:"mt-1 block text-[11px] leading-relaxed text-ink-secondary",children:n("routines.editor.teamGoalHelp")})]})]})]})]}),Gt=y!=="interval"&&y!=="limit_reset"&&!ge(y)&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[v==="routine"&&y==="none"&&e.jsx("span",{className:"text-[12px] font-medium text-ink-secondary",children:n("routines.editor.starts")}),v==="routine"&&y==="weekly"&&e.jsx("span",{className:"text-[12px] font-medium text-ink-secondary",children:n("routines.editor.on")}),(v==="call"||y==="none"||y==="weekly")&&e.jsx("input",{type:"date",value:b,onChange:a=>T(a.target.value),className:"rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[13px] text-ink outline-none focus:border-accent [color-scheme:dark]"}),e.jsx("input",{type:"time",step:ee*60,value:P,onChange:a=>g(a.target.value),className:"rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[13px] text-ink outline-none focus:border-accent [color-scheme:dark]"}),v==="call"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[12px] text-ink-secondary",children:n("routines.editor.to")}),e.jsx("span",{className:"rounded-lg border border-hairline/40 bg-inset/60 px-3 py-2 text-[13px] text-ink",children:X(zn)}),e.jsx(U,{"aria-label":n("routines.editor.callDuration"),value:j,onChange:a=>I(Number(a.target.value)),children:an.map(a=>e.jsx("option",{value:a,children:Re(a)},a))})]})]}),qt=e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(Ls,{size:14,className:"text-ink-secondary"}),e.jsxs(U,{"aria-label":n("routines.editor.repeat"),value:y,onChange:a=>_t(a.target.value),children:[e.jsx("option",{value:"none",children:n("routines.repeat.none")}),v==="routine"&&e.jsx("option",{value:"interval",children:n("routines.repeat.interval")}),e.jsx("option",{value:"daily",children:n("routines.repeat.dailyOption")}),e.jsx("option",{value:"weekdays",children:n("routines.repeat.weekdaysOption")}),e.jsx("option",{value:"weekly",children:n("routines.schedule.weeklyOn",{day:Ze(new Date(We).getDay())})}),e.jsx("option",{value:"custom",children:n("routines.repeat.selectedWeekdays")}),v==="routine"&&e.jsxs(e.Fragment,{children:[e.jsx("option",{value:"monthly",children:n("routines.repeat.monthly")}),e.jsx("option",{value:"yearly",children:n("routines.repeat.yearly")}),e.jsx("option",{value:"cron",children:n("routines.repeat.customCron")})]}),v==="routine"&&e.jsx("option",{value:"limit_reset",children:n("routines.limitReset.option")})]})]}),Ut=v==="routine"&&e.jsx(Ys,{}),Yt=e.jsxs(e.Fragment,{children:[y==="limit_reset"&&v==="routine"&&e.jsx(qs,{value:Q,botEngine:s.find(a=>a.id===(r??W[0]))?.modelSelection?.instanceId,onChange:be}),ge(y)&&v==="routine"&&xe&&e.jsx(Fs,{choice:y,value:ce,onChange:a=>{ve(a),Oe(!0)},runs:xe.runs,error:xe.error}),y==="custom"&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:tn.map((a,k)=>e.jsx("button",{type:"button",onClick:()=>Ae(O=>O.includes(k)?O.length===1?O:O.filter(ie=>ie!==k):[...O,k].sort()),className:C("size-8 rounded-full text-[10px] font-semibold",fe.includes(k)?"bg-accent text-white":"bg-inset text-ink-secondary hover:bg-raised hover:text-ink"),children:Ze(k).charAt(0).toLocaleUpperCase(Le())},a))}),y==="interval"&&v==="routine"&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[13px] text-ink",children:[e.jsx("span",{className:"font-medium",children:n("routines.interval.runsEvery")}),e.jsxs(U,{value:mt.includes(q)?String(q):"custom",onChange:a=>Se(a.target.value==="custom"?0:Number(a.target.value)),"aria-label":n("routines.interval.howOften"),children:[mt.map(a=>e.jsx("option",{value:a,children:a},a)),e.jsx("option",{value:"custom",children:n("routines.interval.custom")})]}),!mt.includes(q)&&e.jsx("input",{type:"number",min:5,max:1440,step:1,value:q||"",onChange:a=>Se(Number(a.target.value)),"aria-label":n("routines.interval.customMinutes"),"aria-invalid":De,"aria-describedby":De?"routine-interval-error":"routine-interval-help",autoFocus:!0,className:C("w-20 rounded-lg border bg-inset px-3 py-2 text-[13px] tabular-nums text-ink outline-none focus:border-accent",De?"border-danger/70":"border-hairline/50")}),e.jsx("span",{children:n("routines.interval.minutesUnit")})]}),e.jsxs("div",{className:"grid items-center gap-2 text-[13px] text-ink sm:flex sm:flex-wrap",children:[e.jsxs("span",{className:"inline-flex items-center gap-2 whitespace-nowrap",children:[e.jsx("span",{className:"font-medium",children:n("routines.interval.on")}),e.jsxs(U,{value:ne,onChange:a=>On(a.target.value),"aria-label":n("routines.interval.daysLabel"),"aria-invalid":je,"aria-describedby":je?"routine-interval-days-error":void 0,children:[e.jsx("option",{value:"every-day",children:n("routines.repeat.daily")}),e.jsx("option",{value:"weekdays",children:n("routines.repeat.weekdays")}),e.jsx("option",{value:"custom",children:n("routines.interval.custom")})]})]}),e.jsx("span",{"aria-hidden":"true",className:"hidden text-ink-secondary sm:inline",children:"·"}),e.jsxs("span",{className:"inline-flex items-center gap-2 whitespace-nowrap",children:[e.jsx("span",{className:"font-medium",children:n("routines.interval.during")}),e.jsxs(U,{value:pe,onChange:a=>se(a.target.value),"aria-label":n("routines.interval.hoursLabel"),"aria-invalid":re,"aria-describedby":re?"routine-interval-window-error":void 0,children:[e.jsx("option",{value:"all-day",children:n("routines.interval.allDay")}),e.jsx("option",{value:"custom",children:n("routines.interval.customHours")})]})]}),e.jsx("span",{"aria-hidden":"true",className:"hidden text-ink-secondary sm:inline",children:"·"}),e.jsxs("span",{className:"inline-flex items-center gap-2 whitespace-nowrap",children:[e.jsx("span",{className:"font-medium",children:n("routines.interval.ends")}),e.jsxs(U,{value:He,onChange:a=>In(a.target.value),"aria-label":n("routines.interval.endsLabel"),"aria-invalid":he,"aria-describedby":he?"routine-interval-end-error":void 0,children:[e.jsx("option",{value:"never",children:n("routines.interval.never")}),e.jsx("option",{value:"on-date",children:n("routines.interval.onDate")})]})]})]}),ne==="custom"&&e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-[11px] font-medium text-ink-secondary",children:n("routines.interval.chooseDays")}),e.jsx("div",{role:"group","aria-label":n("routines.interval.customDays"),"aria-invalid":je,"aria-describedby":je?"routine-interval-days-error":void 0,className:"flex flex-wrap gap-1.5",children:tn.map((a,k)=>e.jsx("button",{type:"button",onClick:()=>K(O=>O.includes(k)?O.filter(ie=>ie!==k):[...O,k].sort()),"aria-label":n(f.includes(k)?"routines.interval.daySelected":"routines.interval.dayNotSelected",{day:Ze(k)}),"aria-pressed":f.includes(k),className:C("size-8 rounded-full text-[10px] font-semibold",f.includes(k)?"bg-accent text-white":"bg-inset text-ink-secondary hover:bg-raised hover:text-ink"),children:n("routines.interval.dayChips").split(" ")[k]},a))})]}),pe==="custom"&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[12px] text-ink",children:[e.jsx("span",{className:"font-medium text-ink-secondary",children:n("routines.interval.runBetween")}),e.jsx("input",{"aria-label":n("routines.interval.windowStart"),"aria-invalid":re,"aria-describedby":re?"routine-interval-window-error":void 0,type:"time",step:ee*60,value:Ee,onChange:a=>Sn(a.target.value),className:C("rounded-lg border bg-inset px-3 py-2 text-[13px] text-ink outline-none focus:border-accent [color-scheme:dark]",re?"border-danger/70":"border-hairline/50")}),e.jsx("span",{className:"text-ink-secondary",children:n("routines.interval.and")}),e.jsx("input",{"aria-label":n("routines.interval.windowEnd"),"aria-invalid":re,"aria-describedby":re?"routine-interval-window-error":void 0,type:"time",step:ee*60,value:Pe,onChange:a=>Cn(a.target.value),className:C("rounded-lg border bg-inset px-3 py-2 text-[13px] text-ink outline-none focus:border-accent [color-scheme:dark]",re?"border-danger/70":"border-hairline/50")})]}),He==="on-date"&&e.jsxs("label",{className:"flex flex-wrap items-center gap-2 text-[12px] text-ink",children:[e.jsx("span",{className:"font-medium text-ink-secondary",children:n("routines.interval.stopAfter")}),e.jsx("input",{"aria-label":n("routines.interval.endDate"),"aria-invalid":he,"aria-describedby":he?"routine-interval-end-error":void 0,type:"date",min:qe(Ht),value:wt,onChange:a=>Dn(a.target.value),className:C("rounded-lg border bg-inset px-3 py-2 text-[13px] text-ink outline-none focus:border-accent [color-scheme:dark]",he?"border-danger/70":"border-hairline/50")})]}),De&&e.jsx("div",{id:"routine-interval-error",className:"text-[11px] text-danger",children:n("routines.interval.invalidMinutes")}),je&&e.jsx("div",{id:"routine-interval-days-error",className:"text-[11px] text-danger",children:n("routines.interval.invalidDays")}),re&&e.jsx("div",{id:"routine-interval-window-error",className:"text-[11px] text-danger",children:n("routines.interval.invalidWindow",{minutes:q||5})}),he&&e.jsx("div",{id:"routine-interval-end-error",className:"text-[11px] text-danger",children:n("routines.interval.endAfterFirstRun")}),e.jsx("div",{id:"routine-interval-help",className:"text-[11px] leading-relaxed text-ink-secondary",children:n(w==="queue"?"routines.overlapQueueHelp":"routines.overlapSkipHelp")})]})]}),Zt=v==="routine"&&e.jsxs("details",{className:"rounded-xl border border-hairline/40 bg-inset/40 px-3 py-2.5",children:[e.jsx("summary",{className:"cursor-pointer select-none text-[12px] font-medium text-ink-secondary hover:text-ink",children:D==null?n("routines.runLimit.none"):n("routines.runLimit.some",{duration:Re(D)})}),e.jsxs("div",{className:"mt-3 border-t border-hairline/35 pt-3",children:[e.jsxs("label",{className:"flex flex-wrap items-center gap-2 text-[12px] text-ink",children:[e.jsx("span",{children:n("routines.runLimit.stopAfter")}),e.jsxs(U,{"aria-label":n("routines.runLimit.label"),value:D??"",onChange:a=>z(a.target.value?Number(a.target.value):null),children:[e.jsx("option",{value:"",children:n("routines.runLimit.noLimit")}),an.map(a=>e.jsx("option",{value:a,children:Re(a)},a))]})]}),e.jsx("div",{className:"mt-1.5 text-[11px] leading-relaxed text-ink-secondary",children:n("routines.runLimit.help")}),y!=="none"&&e.jsxs("div",{className:"mt-3",children:[e.jsxs("label",{className:"flex flex-wrap items-center gap-2 text-[12px] text-ink",children:[e.jsx("span",{children:n("routines.overlapLabel")}),e.jsxs(U,{"aria-label":n("routines.overlapLabel"),value:w,onChange:a=>R(a.target.value==="queue"?"queue":"skip"),children:[e.jsx("option",{value:"skip",children:n("routines.overlapSkip")}),e.jsx("option",{value:"queue",children:n("routines.overlapQueue")})]})]}),e.jsx("p",{className:"mt-1.5 text-[11px] leading-relaxed text-ink-secondary",children:n(w==="queue"?"routines.overlapQueueHelp":"routines.overlapSkipHelp")})]}),y!=="none"&&e.jsxs("label",{className:"mt-3 flex items-start gap-2 text-[12px] text-ink",children:[e.jsx("input",{type:"checkbox","aria-label":n("routines.runOnStartupLabel"),checked:le,onChange:a=>F(a.target.checked),className:"mt-0.5 accent-accent"}),e.jsxs("span",{children:[e.jsx("span",{className:"block",children:n("routines.runOnStartupLabel")}),e.jsx("span",{className:"mt-1 block text-[11px] leading-relaxed text-ink-secondary",children:n("routines.runOnStartupHelp")})]})]})]})]}),Fn=v==="routine"&&!ae&&y!=="none"&&e.jsxs("label",{className:C("flex items-start gap-3 rounded-xl border border-hairline/40 bg-inset/40 px-3.5 py-3",Y&&"ml-8"),children:[e.jsx("input",{type:"checkbox","aria-label":n("routines.continuityLabel"),checked:Z,onChange:a=>te(a.target.checked),className:"mt-0.5 accent-accent"}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-[13px] font-medium text-ink",children:n("routines.continuityLabel")}),e.jsx("span",{className:"mt-1 block text-[11px] leading-relaxed text-ink-secondary",children:n("routines.continuityHelp")})]})]}),Vt=v==="routine"&&!ae&&e.jsx("div",{className:C(Y&&"ml-8"),children:e.jsx(vn,{bot:s.find(a=>a.id===W[0]),value:it,allowCurrent:!!l,onChange:Ct})}),Jt=e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(cs,{size:18,className:"mt-2.5 shrink-0 text-ink-secondary"}),ae?e.jsxs("div",{className:"min-w-0 flex-1 rounded-xl border border-hairline/50 bg-inset px-3.5 py-3",children:[e.jsx("div",{className:"text-[13px] font-medium text-ink",children:n("routines.editor.groupContext")}),e.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-ink-secondary",children:n("routines.editor.teamGoalAttachments")})]}):e.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[e.jsx("input",{ref:Ot,type:"file",multiple:!0,className:"hidden",onChange:a=>{En(a.target.files),a.target.value=""}}),e.jsx("button",{type:"button",onClick:()=>Ot.current?.click(),className:"rounded-lg border border-hairline/50 px-3 py-2 text-[13px] font-medium text-ink hover:bg-raised",children:n("routines.attachment.add")}),e.jsx(wn,{attachments:Ce,onRemove:a=>lt(k=>k.filter(O=>O.id!==a))}),e.jsx("div",{className:"text-[11px] leading-relaxed text-ink-secondary",children:v==="routine"?n("routines.attachment.routineHelp"):Ie.length>1?n("routines.attachment.callSharedHelp"):n("routines.attachment.callKeptHelp")}),Mt&&e.jsx("div",{className:"text-[12px] text-warning",children:Mt})]})]}),Kt=v==="routine"&&e.jsxs("div",{className:"flex items-start gap-4",children:[ae?e.jsx(en,{size:18,className:"mt-2.5 shrink-0 text-ink-secondary"}):ye==="cloud"?e.jsx(dn,{size:18,className:"mt-2.5 shrink-0 text-ink-secondary"}):e.jsx(cn,{size:18,className:"mt-2.5 shrink-0 text-ink-secondary"}),e.jsx("div",{className:"min-w-0 flex-1",children:ae?e.jsxs("div",{className:"rounded-xl border border-accent/35 bg-accent/[0.07] p-3",children:[e.jsx("div",{className:"text-[13px] font-medium text-ink",children:n(At?"routines.editor.goalRunsOnCloud":"routines.editor.goalRunsOnComputer")}),e.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-ink-secondary",children:n("routines.editor.roomGoalKept")})]}):e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>_e("maus"),className:C("rounded-xl border p-3 text-left",ye==="maus"?"border-accent/60 bg-accent/10":"border-hairline/50 bg-inset hover:bg-raised"),children:[e.jsx("div",{className:"text-[13px] font-medium text-ink",children:n("routines.editor.currentSetup")}),e.jsx("div",{className:"mt-1 text-[11px] text-ink-secondary",children:"Keeps its model and configured computer, including a self-hosted VPS."})]}),e.jsxs("button",{type:"button",disabled:!Mn||Ce.length>0,onClick:()=>_e("cloud"),className:C("rounded-xl border p-3 text-left disabled:cursor-not-allowed disabled:opacity-45",ye==="cloud"?"border-accent/60 bg-accent/10":"border-hairline/50 bg-inset hover:bg-raised"),children:[e.jsx("div",{className:"text-[13px] font-medium text-ink",children:n("routines.runsOn.boat")}),e.jsx("div",{className:"mt-1 text-[11px] text-ink-secondary",children:n(At?"routines.runsOn.boatHintCloudHome":"routines.runsOn.boatHint")})]})]})})]}),Bn=!Y&&v==="routine"?n(u?l?"automations.editor.edit":"automations.editor.new":l?"routines.editor.edit":"routines.editor.new"):n(l||S?"routines.event.edit":"routines.event.new"),Qt=[["none","routines.repeat.once"],["daily","routines.repeat.daily"],["weekdays","routines.repeat.weekdays"],["weekly","routines.repeat.weekly"]];return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/65 p-3",onMouseDown:a=>a.target===a.currentTarget&&m(),children:e.jsxs("div",{ref:Et,role:"dialog","aria-modal":"true","aria-label":n(l||S?"routines.event.editLabel":"routines.event.createLabel"),tabIndex:-1,className:"max-h-[94vh] w-full max-w-[760px] overflow-y-auto rounded-2xl border border-hairline/60 bg-panel shadow-2xl",children:[e.jsxs("div",{className:"sticky top-0 z-20 flex items-center justify-between border-b border-hairline/40 bg-panel/95 px-5 py-3.5 backdrop-blur",children:[e.jsx("div",{className:"text-[15px] font-semibold text-ink",children:Bn}),e.jsx("button",{onClick:m,className:"rounded-full p-2 text-ink-secondary hover:bg-raised hover:text-ink","aria-label":n("common.close"),children:e.jsx(Me,{size:18})})]}),e.jsxs("div",{className:"space-y-5 px-5 py-5 sm:px-8",children:[Y&&Bt,Y&&Wt,e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("span",{className:"mt-3 size-4 shrink-0 rounded bg-accent"}),e.jsx("input",{autoFocus:!0,value:A,onChange:a=>_(a.target.value),"aria-label":n("routines.editor.titleLabel"),placeholder:v==="routine"?Y?n("routines.event.addTitle"):n("routines.editor.titlePlaceholder"):n("routines.event.addCallTitle"),className:"min-w-0 flex-1 border-b border-hairline/60 bg-transparent px-1 pb-2 text-[22px] font-medium text-ink outline-none placeholder:text-ink-tertiary focus:border-accent"})]}),Y?e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(gt,{size:18,className:"mt-2.5 shrink-0 text-ink-secondary"}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-3",children:[Gt,qt,Ut,Yt,Zt]})]}):e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(gt,{size:18,className:"mt-2.5 shrink-0 text-ink-secondary"}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-3",children:[e.jsx("div",{className:"text-[13px] font-medium text-ink",children:n("routines.editor.when")}),Gt,e.jsx("div",{role:"group","aria-label":n("routines.editor.repeat"),className:"flex flex-wrap gap-1.5",children:Qt.map(([a,k])=>e.jsx("button",{type:"button","aria-pressed":y===a,onClick:()=>_t(a),className:C("rounded-full border px-3 py-1.5 text-[12px] font-medium transition",y===a?"border-accent-border bg-accent/15 text-accent-text":"border-hairline/50 bg-inset text-ink-secondary hover:bg-raised hover:text-ink"),children:n(k)},a))}),!Qt.some(([a])=>a===y)&&e.jsx("div",{className:"text-[12px] text-ink-secondary",children:n("routines.editor.customRepeat")})]})]}),e.jsxs("div",{className:"flex items-start gap-4",children:[ae?e.jsx(hn,{size:18,className:"mt-2.5 shrink-0 text-ink-secondary"}):e.jsx(bt,{size:18,className:"mt-2.5 shrink-0 text-ink-secondary"}),e.jsx("div",{className:"min-w-0 flex-1",children:ae?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"routine-goal-room",className:"mb-2 block text-[13px] font-medium text-ink",children:n("routines.editor.goalWhere")}),e.jsxs(U,{id:"routine-goal-room",value:me,onChange:a=>An(a.target.value),className:"w-full",children:[me&&!ue&&e.jsx("option",{value:me,disabled:!0,children:n("routines.editor.roomMissing")}),e.jsx("option",{value:"",children:n("routines.editor.goalOneOnOne")}),Be.map(a=>e.jsx("option",{value:a.id,children:a.name},a.id))]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-[13px] font-medium text-ink",children:ue?n("routines.goal.chooseLead"):n("routines.editor.who")}),dt.length>0?e.jsxs(e.Fragment,{children:[e.jsx(yt,{bots:dt,selected:W,multiple:!1,onChange:$e}),e.jsx("div",{className:"mt-2 text-[12px] text-ink-secondary",children:ue?n("routines.goal.leadHelp",{name:ue.name}):n("routines.editor.goalOneOnOneHelp")})]}):e.jsx("div",{className:"rounded-xl border border-warning/30 bg-warning/10 px-3.5 py-3 text-[12px] text-warning",children:n("routines.goal.noMembers")})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-2 text-[13px] font-medium text-ink",children:v==="routine"?Y?n("routines.event.assignBot"):n("routines.editor.who"):n("routines.event.addGuests")}),s.length>0?e.jsxs(e.Fragment,{children:[e.jsx(yt,{bots:s,selected:W,multiple:v==="call",locked:!!r,onChange:$e}),e.jsx("div",{className:"mt-2 text-[12px] text-ink-secondary",children:v==="routine"?n("routines.event.botOwnsRuns"):n(Ie.length===0?"routines.event.invitedNone":Ie.length===1?"routines.event.invitedOne":"routines.event.invitedMany",{count:Ie.length})}),v==="routine"&&e.jsx(bn,{team:h.config?.team,bot:Ie[0],value:it,madeIn:l?.sourceThreadId})]}):e.jsxs("button",{type:"button",onClick:()=>{N({type:"newBot"}),m()},className:"w-full rounded-xl border border-dashed border-accent/45 bg-accent/[0.06] px-4 py-4 text-left hover:bg-accent/10",children:[e.jsx("div",{className:"text-[13px] font-medium text-accent",children:n("routines.event.createFirstBot")}),e.jsx("div",{className:"mt-1 text-[12px] text-ink-secondary",children:n("routines.event.needsBot")})]})]})})]}),Y&&Vt,e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(st,{size:18,className:"mt-2.5 shrink-0 text-ink-secondary"}),e.jsx("textarea",{value:B,onChange:a=>E(a.target.value),rows:5,"aria-label":n("routines.editor.descriptionLabel"),placeholder:ae?n("routines.goal.instructionsPlaceholder"):v==="routine"?Y?n("routines.event.instructionsPlaceholder"):n("routines.editor.instructionsPlaceholder"):n("routines.event.agendaPlaceholder"),className:"min-w-0 flex-1 resize-y rounded-xl border border-hairline/50 bg-inset px-3.5 py-3 text-[13px] leading-relaxed text-ink outline-none placeholder:text-ink-tertiary focus:border-accent"})]}),Fn,Y&&Jt,Y&&Kt,!Y&&e.jsxs("div",{children:[e.jsxs("button",{type:"button","aria-expanded":Ge,"aria-controls":"routine-more-options",onClick:()=>_n(a=>!a),className:"flex items-center gap-1.5 rounded-lg px-2 py-1.5 text-[13px] font-medium text-accent-text hover:bg-raised",children:[e.jsx(Ts,{size:14,className:C("transition-transform",Ge&&"rotate-90")}),n(Ge?"routines.editor.fewer":"routines.editor.more")]}),Ge&&e.jsxs("div",{id:"routine-more-options",className:"mt-3 space-y-5 rounded-xl border border-hairline/40 bg-inset/30 p-4",children:[Bt,Wt,e.jsxs("div",{className:"space-y-3",children:[qt,Ut,Yt,Zt]}),Vt,Jt,Kt]})]}),Tt&&e.jsxs("div",{className:"ml-10 flex items-start gap-2 rounded-xl border border-danger/30 bg-danger/10 px-3 py-2.5 text-[13px] text-danger",children:[e.jsx(Ke,{size:15,className:"mt-0.5 shrink-0"}),Tt]})]}),e.jsxs("div",{className:"sticky bottom-0 flex items-center justify-end gap-2 border-t border-hairline/40 bg-panel/95 px-5 py-3.5 backdrop-blur",children:[e.jsx("button",{onClick:m,className:"rounded-lg px-4 py-2 text-[13px] text-ink-secondary hover:bg-raised hover:text-ink",children:n("common.cancel")}),e.jsxs("button",{onClick:Pn,disabled:It||Fe||!Hn,className:"flex items-center gap-2 rounded-lg bg-accent px-5 py-2 text-[13px] font-semibold text-white hover:brightness-110 disabled:opacity-40",children:[(It||Fe)&&e.jsx(ze,{size:14,className:"animate-spin"}),Fe?n("routines.attachment.attaching"):l||S||v==="routine"&&!ae?n("automations.editor.app.save"):n(v==="call"?"routines.event.scheduleCall":"routines.goal.schedule")]})]})]})})}function ga({seed:t,bots:s,routinesOnly:r=!1,onClose:o,onMore:i,onSavedRoutine:u,onSavedCall:m}){const{state:c,dispatch:h}=nt(),[N,l]=x.useState(r||t.limitReset?"routine":t.kind),[$,S]=x.useState(t.name??""),[v,J]=x.useState(t.description??""),[L,A]=x.useState(t.botIds.length?t.botIds:s[0]?[s[0].id]:[]),[_,B]=x.useState(()=>t.resultsThreadId??Qe(c,L[0])??null),E=p=>{p[0]!==L[0]&&B(Qe(c,p[0])??null),A(p)},[M,d]=x.useState(!1),[b,T]=x.useState(""),P=x.useRef(null),[g,j]=x.useState(null),I=N==="routine"?30:t.durationMinutes;x.useLayoutEffect(()=>{if(!t.anchor){j(null);return}const p=P.current;if(!p)return;const H=()=>{const R=p.getBoundingClientRect();let Z=t.anchor.x+12,te=t.anchor.y+12;Z+R.width>window.innerWidth-12&&(Z=t.anchor.x-R.width-12),te+R.height>window.innerHeight-12&&(te=t.anchor.y-R.height-12),j({left:Math.max(12,Math.min(Z,window.innerWidth-R.width-12)),top:Math.max(12,Math.min(te,window.innerHeight-R.height-12))})};return H(),window.addEventListener("resize",H),()=>window.removeEventListener("resize",H)},[N,t.anchor]);const D=async()=>{d(!0),T("");try{if(N==="routine"||r){const p=await Ne("/api/routines",{method:"POST",body:JSON.stringify({name:$,prompt:v,botId:L[0],runOn:"maus",enabled:!0,schedule:t.limitReset?{type:"limit_reset",engine:t.limitReset.engine,repeat:"once"}:{type:"once",at:t.at},durationMinutes:I,attachments:[],resultsThreadId:_})});u(p.routine)}else{const p=await Ne("/api/calendar-calls",{method:"POST",body:JSON.stringify({name:$,description:v,botIds:L,schedule:{type:"once",at:t.at},durationMinutes:I})});m(p.call)}o()}catch(p){T(p instanceof Error?p.message:String(p))}finally{d(!1)}},z=!!($.trim()&&L.length&&(N==="call"||v.trim()));return e.jsxs("div",{ref:P,role:"dialog","aria-label":n("routines.quick.label"),style:g??void 0,className:C("fixed z-50 max-h-[calc(100vh-24px)] w-[min(430px,calc(100vw-24px))] overflow-y-auto rounded-2xl border border-hairline/60 bg-panel shadow-2xl",!g&&"left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"),children:[e.jsxs("div",{className:"flex items-center justify-between bg-raised/70 px-4 py-2.5",children:[e.jsx("div",{className:"text-[12px] font-medium text-ink-secondary",children:n("routines.quick.title")}),e.jsx("button",{onClick:o,className:"rounded-full p-1.5 text-ink-secondary hover:bg-inset hover:text-ink","aria-label":n("common.close"),children:e.jsx(Me,{size:16})})]}),e.jsxs("div",{className:"space-y-3 p-4",children:[e.jsx("input",{autoFocus:!0,value:$,onChange:p=>S(p.target.value),"aria-label":n("routines.editor.titleLabel"),placeholder:n("routines.event.addTitle"),onKeyDown:p=>{p.key==="Enter"&&z&&D()},className:"w-full border-b border-hairline/60 bg-transparent pb-2 text-[18px] font-medium text-ink outline-none placeholder:text-ink-tertiary focus:border-accent"}),!r&&!t.limitReset&&e.jsxs("div",{className:"flex items-center gap-1 border-b border-hairline/35 pb-2",children:[e.jsx("button",{type:"button",onClick:()=>{l("routine"),A(p=>p.slice(0,1))},className:C("rounded-lg px-3 py-1.5 text-[12px] font-medium",N==="routine"?"bg-accent/15 text-accent":"text-ink-secondary hover:bg-raised hover:text-ink"),children:n("routines.kind.routine")}),e.jsx("button",{type:"button",onClick:()=>l("call"),className:C("rounded-lg px-3 py-1.5 text-[12px] font-medium",N==="call"?"bg-accent/15 text-accent":"text-ink-secondary hover:bg-raised hover:text-ink"),children:n("routines.kind.call")})]}),e.jsxs("div",{className:"flex items-start gap-3 text-[13px] text-ink",children:[e.jsx(gt,{size:16,className:"mt-0.5 shrink-0 text-ink-secondary"}),t.limitReset?e.jsx("div",{"data-testid":"quick-limit-reset",children:ws({engine:t.limitReset.engine,repeat:"once"})}):e.jsxs("div",{children:[e.jsx("div",{children:Nt(t.at)}),e.jsxs("div",{className:"mt-0.5 text-ink-secondary",children:[X(t.at),N==="call"?` – ${X(t.at+I*6e4)}`:""]})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(bt,{size:16,className:"mt-2.5 shrink-0 text-ink-secondary"}),s.length===0?e.jsxs("button",{type:"button",onClick:()=>{h({type:"newBot"}),o()},className:"min-w-0 flex-1 rounded-xl border border-dashed border-accent/45 bg-accent/[0.06] px-3 py-3 text-left hover:bg-accent/10",children:[e.jsx("div",{className:"text-[12px] font-medium text-accent",children:n("routines.event.createFirstBot")}),e.jsx("div",{className:"mt-0.5 text-[11px] text-ink-secondary",children:n("routines.quick.comeBack")})]}):N==="routine"?e.jsxs(U,{value:L[0]??"",onChange:p=>E([p.target.value]),className:"flex-1",children:[e.jsx("option",{value:"",children:n("routines.event.assignBot")}),s.map(p=>e.jsx("option",{value:p.id,children:p.name},p.id))]}):e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(yt,{bots:s,selected:L,multiple:!0,onChange:E})})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(st,{size:16,className:"mt-2.5 shrink-0 text-ink-secondary"}),e.jsx("textarea",{value:v,onChange:p=>J(p.target.value),rows:3,"aria-label":n("routines.editor.descriptionLabel"),placeholder:n(N==="routine"?"routines.quick.whatToDo":"routines.quick.description"),className:"min-w-0 flex-1 resize-none rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[13px] leading-relaxed text-ink outline-none placeholder:text-ink-tertiary focus:border-accent"})]}),N==="routine"&&e.jsx(vn,{bot:s.find(p=>p.id===L[0]),value:_,onChange:p=>B(p??null)}),N==="routine"&&e.jsx(bn,{team:c.config?.team,bot:s.find(p=>p.id===L[0]),value:_}),b&&e.jsx("div",{className:"rounded-lg bg-danger/10 px-3 py-2 text-[12px] text-danger",children:b})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-hairline/40 px-4 py-3",children:[e.jsx("button",{onClick:()=>i({...t,kind:N,botIds:L,name:$,description:v,durationMinutes:I,resultsThreadId:_}),title:n("routines.quick.moreTitle"),className:"rounded-lg px-3 py-2 text-[12px] font-medium text-accent hover:bg-accent/10",children:n("routines.editor.more")}),e.jsxs("button",{onClick:D,disabled:!z||M,className:"flex items-center gap-1.5 rounded-lg bg-accent px-4 py-2 text-[12px] font-semibold text-white hover:brightness-110 disabled:opacity-40",children:[M&&e.jsx(ze,{size:13,className:"animate-spin"}),n("common.save")]})]})]})}function ba({anchor:t,days:s,items:r,bots:o,groups:i,selectedId:u,onOpen:m,onCreate:c,onMove:h,onResize:N,markers:l=[],onDropOnReset:$}){const S=x.useRef(null),[v,J]=x.useState(null),[L,A]=x.useState(null),_=Ye(Date.now()),B=Array.from({length:s},(g,j)=>mn(t,j)),E=s===7?64:s===3?180:280,M=`64px repeat(${s}, minmax(${E}px, 1fr))`,d=64+s*E;x.useEffect(()=>{const g=S.current;if(!g)return;const j=new Date,I=B.includes(_)?Math.max(0,j.getHours()-2):7;g.scrollTo({top:I*G})},[s]);const b=(g,j)=>{if(g.button!==0||g.target.closest("[data-event-card]"))return;const I=g.currentTarget.getBoundingClientRect(),D=Ue(j,g.clientY,I.top,G);let z=D+30*6e4;J({day:j,start:D,end:z});const p=w=>{const R=Ue(j,w.clientY,I.top,G);z=Math.max(D+ee*6e4,R+ee*6e4),J({day:j,start:D,end:z})},H=w=>{document.removeEventListener("pointermove",p),document.removeEventListener("pointerup",H),J(null),c({kind:"routine",at:D,durationMinutes:Math.max(ee,Math.round((z-D)/6e4)),botIds:[],anchor:{x:w.clientX,y:w.clientY}})};document.addEventListener("pointermove",p),document.addEventListener("pointerup",H,{once:!0})},T=(g,j)=>{g.preventDefault(),A(null);const I=g.currentTarget.getBoundingClientRect(),D=Ue(j,g.clientY,I.top,G),z=g.dataTransfer.getData(Xe);if(z)return c({kind:"routine",at:D,durationMinutes:30,botIds:[z],anchor:{x:g.clientX,y:g.clientY}});const p=g.dataTransfer.getData(we);if(p)try{const H=JSON.parse(p);h(H,D)}catch{}},P=(g,j)=>{if(!g.dataTransfer.types.includes(Xe)&&!g.dataTransfer.types.includes(we))return;g.preventDefault(),g.dataTransfer.dropEffect=g.dataTransfer.types.includes(we)?"move":"copy";const I=g.currentTarget.getBoundingClientRect(),D=Ue(j,g.clientY,I.top,G);A(z=>z?.day===j&&z.at===D?z:{day:j,at:D})};return e.jsxs("div",{ref:S,className:"min-h-0 flex-1 overflow-auto border-l border-t border-hairline/40 bg-app",children:[e.jsxs("div",{className:"sticky top-0 z-30 grid bg-app/95 backdrop-blur",style:{gridTemplateColumns:M,minWidth:d},children:[e.jsx("div",{className:"border-b border-r border-hairline/40 px-2 py-3 text-center text-[9px] uppercase tracking-wider text-ink-secondary",children:gs(-new Date(t).getTimezoneOffset())}),B.map(g=>{const j=new Date(g),I=g===_;return e.jsxs("div",{role:"columnheader",className:C("border-b border-r border-hairline/40 px-2 py-2 text-center last:border-r-0",I&&"bg-accent/[0.035]"),children:[e.jsx("div",{className:C("text-[10px] font-medium uppercase tracking-[0.14em]",I?"text-accent":"text-ink-secondary"),children:Ze(j.getDay())}),e.jsx("div",{className:C("mx-auto mt-1 flex size-8 items-center justify-center rounded-full text-[15px] font-medium",I?"bg-accent text-accent-ink":"text-ink"),children:j.getDate()})]},g)})]}),e.jsxs("div",{role:"grid","aria-label":n("routines.calendar.label"),onDragEnd:()=>A(null),className:"relative grid",style:{height:G*24,gridTemplateColumns:M,minWidth:d},children:[e.jsx("div",{className:"relative border-r border-hairline/40",children:Array.from({length:24},(g,j)=>e.jsx("div",{className:"absolute right-2 -translate-y-1/2 text-[10px] tabular-nums text-ink-tertiary",style:{top:j*G},children:j===0?"":new Date(2e3,0,1,j).toLocaleTimeString(Le(),{hour:"numeric"})},j))}),B.map(g=>{const j=new Date,I=(j.getHours()*60+j.getMinutes())/60*G,D=r.filter(w=>Ye(w.at)===g),z=bs(D),p=v?.day===g?v:null,H=L?.day===g?L:null;return e.jsxs("div",{role:"gridcell","aria-label":n("routines.calendar.day",{date:Nt(g)}),onPointerDown:w=>b(w,g),onDragOver:w=>P(w,g),onDragLeave:w=>{(!(w.relatedTarget instanceof Node)||!w.currentTarget.contains(w.relatedTarget))&&A(null)},onDrop:w=>T(w,g),className:C("relative border-r border-hairline/40 last:border-r-0",g===_&&"bg-accent/[0.025]"),children:[Array.from({length:48},(w,R)=>e.jsx("div",{className:C("pointer-events-none absolute inset-x-0 border-t",R%2===0?"border-hairline/30":"border-hairline/10"),style:{top:R/2*G}},R)),g===_&&e.jsxs("div",{className:"pointer-events-none absolute inset-x-0 z-20 flex items-center",style:{top:I},children:[e.jsx("span",{className:"-ml-1 size-2 rounded-full bg-danger"}),e.jsx("span",{className:"h-px flex-1 bg-danger/80"})]}),p&&e.jsx("div",{className:"pointer-events-none absolute inset-x-1 z-10 rounded-md border border-accent/70 bg-accent/20",style:{top:(new Date(p.start).getHours()*60+new Date(p.start).getMinutes())/60*G,height:Math.max(16,(p.end-p.start)/36e5*G)}}),H&&e.jsx("div",{className:"pointer-events-none absolute inset-x-1 z-20 rounded-md border border-accent/80 bg-accent/25 shadow-sm",style:{top:(new Date(H.at).getHours()*60+new Date(H.at).getMinutes())/60*G,height:G/2},children:e.jsx("div",{className:"px-2 py-1 text-[10px] font-medium text-accent",children:X(H.at)})}),l.filter(w=>Ye(w.at)===g).map(w=>e.jsx(Js,{marker:w,hourHeight:G,onDrop:$&&(R=>$(R,w))},w.engine)),D.map(w=>e.jsx(Qs,{item:w,bots:o,groups:i,compact:s===7,layout:z.get(w.id)??{column:0,columns:1},selected:w.id===u,onOpen:()=>m(w),onResize:R=>N(w,R)},w.id))]},g)})]})]})}function va({item:t,bots:s,onClose:r,onEdit:o,onCallChanged:i,onOpenRoom:u,onOpenRun:m}){const{state:c,dispatch:h}=nt(),N=ln(),l=Vn(),[$,S]=x.useState(!1),v=x.useRef(!1),[J,L]=x.useState(!1),[A,_]=x.useState(void 0),[B,E]=x.useState(""),M=t.kind==="call",d=t.kind==="routine"?t.routine:null,b=A===void 0?t.kind==="routine"?t.run:null:A&&(c.routineRuns.find(f=>f.id===A.id)??A),T=t.kind==="call"?t.call:null,P=!M&&(b?.target??d?.target)==="room-goal",g=P?b?b.groupId:d?.groupId:void 0,j=c.groups.find(f=>f.id===g),I=b?.executionThreadId??b?.threadId,D=T?.botIds??[b?.botId??d?.botId??""],z=D.flatMap(f=>s.find(K=>K.id===f)??[]),p=z[0],H=P&&g?j:p,w=!!(I&&(H?.threadId===I||H?.tasks?.some(f=>f.threadId===I))),R=b?b.resultsThreadId??b.sourceThreadId:d?.resultsThreadId,Z=R??(!b&&d?.target==="bot"?p?.mainThreadId:void 0),te=Z&&[...c.bots,...c.groups].some(f=>f.threadId===Z||f.tasks?.some(K=>K.threadId===Z)),le=T?.name??b?.routineName??d?.name??"Routine",F=T?.description??b?.prompt??d?.prompt??"",y=T?.attachments??b?.attachments??d?.attachments??[],de=T?.botIds.length===1?p?.id:void 0,Q=b?b.timeoutMinutes:d?.timeoutMinutes,be=()=>{I&&(P&&g?(h({type:"switchGroupTask",groupId:g,threadId:I}),u(g)):p&&Is(h,p,I,l),r())},ce=async(f,K="POST",pe)=>{S(!0),E("");try{const se=await Ne(f,{method:K,...pe?{body:JSON.stringify(pe)}:{}});se.routine&&h({type:"routinePatched",routine:se.routine}),se.run&&h({type:"routineRunPatched",run:se.run})}catch(se){E(se instanceof Error?se.message:String(se))}finally{S(!1)}},ve=()=>{!d||$||v.current||(v.current=!0,L(!0),_(null),S(!0),E(""),h({type:"runRoutine",routineId:d.id,onStarted:_,onError:f=>E(f instanceof Error?f.message:String(f)),onSettled:()=>{v.current=!1,L(!1),S(!1)}}))},at=async()=>{if(T){S(!0),E("");try{const{group:f}=await Ne(`/api/calendar-calls/${T.id}/room`,{method:"POST"});h({type:"groupPatched",group:f}),u(f.id)}catch(f){E(f instanceof Error?f.message:String(f))}finally{S(!1)}}},Oe=async()=>{window.confirm(n("routines.event.deleteConfirm",{title:le}))&&(T?(await Ne(`/api/calendar-calls/${T.id}`,{method:"DELETE"}),i(T.id)):d&&h({type:"deleteRoutine",routineId:d.id}),r())},fe=d?.id??b?.routineId,Ae=fe?c.routineRuns.filter(f=>f.routineId===fe).sort((f,K)=>nn(K)-nn(f)).slice(0,3):[],q=b?.runOn??d?.runOn,Se=vs({roomGoal:P,runOn:q,computer:p?.computer,cloudHome:c.config?.cloudHome===!0}),ne=R?[...c.bots,...c.groups].find(f=>f.threadId===R||f.tasks?.some(K=>K.threadId===R)):void 0,rt=R?ne?.tasks?.find(f=>f.threadId===R)?.title??ne?.name??n("routines.results.missing"):n("routines.results.main");return e.jsxs("aside",{"aria-label":n("routines.drawer.label"),className:"flex h-full w-[min(310px,100vw)] shrink-0 flex-col border-l border-hairline/40 bg-panel",children:[e.jsxs("div",{className:"flex items-start gap-3 border-b border-hairline/40 px-4 py-3.5",children:[M?e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-accent/15 text-accent-text",children:e.jsx(vt,{size:16})}):P?e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-accent/15 text-accent-text",children:e.jsx(hn,{size:16})}):p&&e.jsx(Ve,{bot:p,state:b?jn(b.status):d?.enabled===!1?"sleeping":"idle",size:36,animated:!1}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"break-words text-[15px] font-semibold leading-snug text-ink",children:le}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:[d&&e.jsx("span",{className:C("rounded-full px-2 py-0.5 text-[11px] font-medium",d.enabled?"bg-success/15 text-success":"bg-inset text-ink-secondary"),children:fs(d)}),e.jsxs("span",{className:"text-[11px] text-ink-secondary",children:[Nt(t.at)," · ",X(t.at),M?` – ${X(t.at+t.durationMinutes*6e4)}`:""]})]})]}),e.jsx("button",{type:"button",onClick:r,className:"rounded-full p-1.5 text-ink-secondary hover:bg-raised hover:text-ink","aria-label":n("routines.drawer.close"),children:e.jsx(Me,{size:16})})]}),e.jsxs("div",{className:"min-h-0 flex-1 space-y-4 overflow-y-auto px-4 py-4",children:[b&&e.jsxs("div",{role:"status","aria-live":"polite",className:"rounded-xl border border-hairline/40 bg-inset p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[12px] font-medium text-ink",children:[b.status==="running"&&e.jsx(ze,{size:13,className:"animate-spin text-accent"}),jt(b)]}),b.output&&e.jsx("div",{className:"mt-2 max-h-48 overflow-y-auto whitespace-pre-wrap text-[12px] leading-relaxed text-ink-secondary",children:xt(b,"output")}),b.error&&e.jsx("div",{className:C("mt-2 text-[12px]",kt(b)?"text-warning":"text-danger"),children:xt(b,"error")})]}),b?.attention&&e.jsxs("div",{className:"flex items-start gap-2 rounded-xl border border-warning/30 bg-warning/10 px-3 py-2.5 text-warning",children:[e.jsx(Ke,{size:15,className:"mt-0.5 shrink-0"}),e.jsx("div",{className:"min-w-0 whitespace-pre-wrap text-[12px] leading-relaxed",children:xt(b,"attention")})]}),b?.status==="waiting"&&!b.attention&&e.jsx("div",{className:"rounded-xl border border-warning/30 bg-warning/10 px-3 py-2.5 text-[12px] text-warning",children:n("routines.drawer.runWaiting")}),e.jsx(oe,{label:M?n("routines.drawer.guests"):P?n("routines.drawer.lead"):n("routines.drawer.bot"),children:e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[z.map(f=>e.jsxs("div",{className:"flex items-center gap-1.5 rounded-full border border-hairline/50 bg-inset py-0.5 pl-0.5 pr-2.5",children:[e.jsx(Ve,{bot:f,state:"idle",size:22,animated:!1}),e.jsx("span",{className:"text-[12px] text-ink",children:f.name})]},f.id)),z.length===0&&e.jsx("span",{className:"text-[13px] text-ink-secondary",children:n("routines.unavailableBot")})]})}),P&&g&&e.jsx(oe,{label:n("routines.drawer.group"),children:e.jsx("div",{className:"text-[13px] text-ink",children:j?.name??n("routines.drawer.groupUnavailable")})}),(d||T)&&e.jsxs(oe,{label:n("routines.drawer.schedule"),children:[e.jsx("div",{className:"text-[13px] text-ink",children:ys((d??T).schedule)}),d?.schedule.type==="cron"&&e.jsx("div",{className:"mt-2",children:e.jsx(_s,{schedule:d.schedule,paused:!d.enabled})})]}),F&&e.jsx(oe,{label:M?n("routines.drawer.agenda"):n("routines.drawer.what"),children:e.jsx("div",{className:"whitespace-pre-wrap text-[13px] leading-relaxed text-ink",children:F})}),!M&&e.jsxs(oe,{label:n("routines.drawer.runsOn"),children:[e.jsxs("div",{className:"flex items-start gap-2 text-[13px] text-ink",children:[q==="cloud"?e.jsx(dn,{size:14,className:"mt-0.5 shrink-0 text-ink-secondary"}):e.jsx(cn,{size:14,className:"mt-0.5 shrink-0 text-ink-secondary"}),e.jsx("span",{children:Se.label})]}),e.jsx("div",{className:"mt-0.5 text-[11px] leading-relaxed text-ink-secondary",children:Se.hint})]}),!M&&!P&&e.jsx(oe,{label:n("routines.results.label"),children:e.jsx("div",{className:"text-[13px] text-ink",children:rt})}),y.length>0&&e.jsxs(oe,{label:n("routines.drawer.attachments"),children:[e.jsx(wn,{attachments:y}),T&&e.jsx("div",{className:"mt-1.5 text-[11px] leading-relaxed text-ink-secondary",children:n(T.botIds.length>1?"routines.drawer.callSharedHelp":"routines.drawer.callKeptHelp")})]}),N&&!M&&e.jsx(oe,{label:n("routines.drawer.runLimit"),children:e.jsx("div",{className:"text-[13px] text-ink",children:Q==null?n("routines.drawer.noTimeLimit"):n("routines.drawer.stopsAfter",{duration:Re(Q)})})}),!M&&e.jsx(oe,{label:n("routines.logs"),action:d&&e.jsxs("button",{type:"button",onClick:()=>{h({type:"showRoutines",section:"logs",routineId:d.id,botId:d.botId}),r()},className:"flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[11px] text-accent-text hover:bg-raised",children:[e.jsx(st,{size:11}),n("routines.drawer.allRuns")]}),children:Ae.length===0?e.jsx("div",{className:"text-[12px] text-ink-secondary",children:n("routines.drawer.noRuns")}):e.jsx("div",{className:"space-y-1",children:Ae.map(f=>e.jsx(la,{run:f,current:f.id===b?.id,onOpen:()=>m?.(f)},f.id))})}),B&&e.jsx("div",{role:"alert",className:"rounded-lg bg-danger/10 px-3 py-2 text-[12px] text-danger",children:B})]}),e.jsxs("div",{className:"space-y-2 border-t border-hairline/40 px-4 py-3",children:[d&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:ve,disabled:$,className:"flex flex-1 items-center justify-center gap-1.5 rounded-lg bg-accent px-3 py-2 text-[12px] font-semibold text-accent-ink hover:brightness-110 disabled:opacity-50",children:[J?e.jsx(ze,{size:13,className:"animate-spin"}):e.jsx(sn,{size:13}),J?n("routines.starting"):n("routines.runNow")]}),e.jsxs("button",{disabled:$,onClick:()=>{ce(`/api/routines/${d.id}`,"PATCH",{enabled:!d.enabled})},title:n(d.enabled?"routines.drawer.pauseRoutine":"routines.drawer.resumeRoutine"),className:"flex flex-1 items-center justify-center gap-1.5 rounded-lg border border-hairline/50 bg-control px-3 py-2 text-[12px] font-medium text-ink hover:bg-raised-hover disabled:opacity-40",children:[d.enabled?e.jsx(js,{size:13}):e.jsx(sn,{size:13}),d.enabled?n("routines.pause"):n("routines.resume")]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[de&&e.jsxs("button",{onClick:()=>u(de),className:"flex items-center gap-1.5 rounded-lg bg-accent px-3 py-2 text-[12px] font-semibold text-accent-ink hover:brightness-110",children:[e.jsx(Te,{size:13}),n("routines.drawer.joinGroup")]}),T&&T.botIds.length>1&&e.jsxs("button",{onClick:at,disabled:$,className:"flex items-center gap-1.5 rounded-lg bg-accent px-3 py-2 text-[12px] font-semibold text-accent-ink hover:brightness-110 disabled:opacity-50",children:[e.jsx(Te,{size:13}),n("routines.drawer.joinGroup")]}),P&&j&&!I&&e.jsxs("button",{onClick:()=>{u(j.id),r()},className:"flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[12px] text-ink-secondary hover:bg-raised hover:text-ink",children:[e.jsx(Te,{size:13}),n("routines.drawer.openGroup")]}),w&&e.jsxs("button",{onClick:be,className:"flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[12px] text-ink-secondary hover:bg-raised hover:text-ink",children:[e.jsx(Te,{size:13}),n(P&&g?"routines.drawer.openGroupThread":"routines.drawer.openThread")]}),te&&Z&&e.jsxs("button",{type:"button",onClick:()=>{ks(h,{botId:D[0],threadId:Z},c,l),r()},className:"flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[12px] text-ink-secondary hover:bg-raised hover:text-ink",children:[e.jsx(Te,{size:13}),n("routines.results.open")]}),b&&["queued","running","waiting"].includes(b.status)&&e.jsxs("button",{onClick:()=>{ce(`/api/routine-runs/${b.id}/cancel`)},disabled:$,className:"flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[12px] text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-40",children:[e.jsx(Me,{size:13}),n("routines.drawer.cancelRun")]}),e.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[(d||T)&&e.jsx("button",{onClick:o,className:"rounded-lg px-2.5 py-1.5 text-[12px] font-medium text-ink hover:bg-raised",children:n("routines.edit")}),(d||T)&&e.jsx("button",{onClick:()=>{Oe()},className:"rounded-lg p-2 text-ink-secondary hover:bg-danger/10 hover:text-danger",title:n("routines.delete"),"aria-label":n("routines.delete"),children:e.jsx(Ns,{size:14})})]})]})]})]})}function oe({label:t,action:s,children:r}){return e.jsxs("section",{children:[e.jsxs("div",{className:"mb-1.5 flex items-center justify-between gap-2",children:[e.jsx("h3",{className:"text-[11px] font-semibold uppercase tracking-wider text-ink-tertiary",children:t}),s]}),r]})}function oa(t){if(t.startedAt==null||t.finishedAt==null||t.finishedAt<t.startedAt)return null;const s=Math.round((t.finishedAt-t.startedAt)/1e3);return s<60?`${s}s`:Re(Math.round(s/60))}function la({run:t,current:s,onOpen:r}){const o=t.startedAt??t.scheduledFor,i=oa(t),u=t.status==="completed"&&(!t.goalStatus||t.goalStatus==="completed"),m=Ss(t)||t.goalStatus==="failed"||t.goalStatus==="blocked",c=["queued","running","waiting"].includes(t.status);return e.jsxs("button",{type:"button",onClick:r,"aria-label":n("routines.openRun",{name:t.routineName,status:jt(t)}),"aria-current":s||void 0,className:C("flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-left hover:bg-raised",s&&"bg-raised"),children:[u?e.jsx(gn,{size:14,className:"shrink-0 text-success","aria-hidden":"true"}):m?kt(t)?e.jsx(Ke,{size:14,className:"shrink-0 text-warning","aria-hidden":"true"}):e.jsx(Cs,{size:14,className:"shrink-0 text-danger","aria-hidden":"true"}):c?e.jsx(ze,{size:14,className:"shrink-0 animate-spin text-accent","aria-hidden":"true"}):e.jsx(Ke,{size:14,className:"shrink-0 text-ink-tertiary","aria-hidden":"true"}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-[12px] text-ink",children:new Date(o).toLocaleDateString(Le(),{month:"short",day:"numeric"})}),e.jsxs("span",{className:"shrink-0 text-[11px] tabular-nums text-ink-secondary",children:[X(o),i?` · ${i}`:""]})]})}function da({routine:t,bots:s,lockedBotId:r,initialBotId:o,defaultRunOn:i,plain:u,onClose:m}){const c=t?.schedule.type==="once"?t.schedule.at:t?.schedule.type==="daily"?ht(Date.now(),t.schedule.time):t?.schedule.type==="interval"?t.schedule.anchorAt:t?.schedule.type==="cron"?t.nextRunAt??on():on();return e.jsx(ia,{seed:{kind:"routine",at:c,durationMinutes:t?.durationMinutes??30,botIds:r?[r]:t?[t.botId]:o?[o]:s.length===1?[s[0].id]:[],routine:t},bots:s,lockedBotId:r,defaultRunOn:i,plain:u,onClose:m,onSavedCall:()=>{}})}const fa=Object.freeze(Object.defineProperty({__proto__:null,RoutineEditor:da},Symbol.toStringTag,{value:"Module"}));export{ba as C,va as E,Ms as H,ga as Q,da as R,Ls as a,ia as b,fa as c};