@openhands/agent-canvas 1.2.0 → 1.2.1

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/README.md +1 -1
  2. package/README.windows.md +2 -2
  3. package/build/assets/{active-backend-context-DRFevVIj.js → active-backend-context-u2tdYRgH.js} +1 -1
  4. package/build/assets/{add-backend-modal-DzuB9zlG.js → add-backend-modal-DIEyAkA4.js} +1 -1
  5. package/build/assets/{agent-profiles-settings-BfAwTshW.js → agent-profiles-settings-BovdV4N8.js} +1 -1
  6. package/build/assets/{agent-server-conversation-service.api-DfH2k6Sx.js → agent-server-conversation-service.api-BP73yONA.js} +1 -1
  7. package/build/assets/agent-settings-FGL3Yvkp.js +1 -0
  8. package/build/assets/{agent-settings-DjVlKgaP.js → agent-settings-Ofbh6UTD.js} +1 -1
  9. package/build/assets/{api-key-entry-screen-O8gS-fnF.js → api-key-entry-screen-CZIdRmUJ.js} +1 -1
  10. package/build/assets/{app-settings-SlZvaXlk.js → app-settings-BHJ9nKti.js} +1 -1
  11. package/build/assets/{automation-detail-CwsNJ9AM.js → automation-detail-DwYGzLkp.js} +1 -1
  12. package/build/assets/{automations-list-B9cPtugh.js → automations-list-CuAfJmMW.js} +1 -1
  13. package/build/assets/{backend-form-modal-D2EDGVAc.js → backend-form-modal-BiaOB2C4.js} +1 -1
  14. package/build/assets/{backend-synced-settings-badge-6OCwIuLY.js → backend-synced-settings-badge-Bs3FSXsS.js} +1 -1
  15. package/build/assets/{color-themes-Dd1sO5U6.js → color-themes-DPBzNtVg.js} +3 -3
  16. package/build/assets/{condenser-settings-BhxvlfoY.js → condenser-settings-D_5vY4m3.js} +1 -1
  17. package/build/assets/conversation-DnVC6vRV.js +1 -0
  18. package/build/assets/conversation-panel-ZEz-z3az.js +1 -0
  19. package/build/assets/{conversation-service.api-Ch9kR9aE.js → conversation-service.api-CqZcHr1c.js} +1 -1
  20. package/build/assets/{conversation-B8prFAZF.js → conversation-xkBS3AHC.js} +3 -3
  21. package/build/assets/{edit-automation-modal-BoibW8cd.js → edit-automation-modal-B6U96gVV.js} +1 -1
  22. package/build/assets/{entry.client-BgWj9jL_.js → entry.client-Dy--3GeA.js} +1 -1
  23. package/build/assets/{extensions-hub-MtC8lK3A.js → extensions-hub-CksKNpP9.js} +1 -1
  24. package/build/assets/{extensions-navigation-BtV14oQL.js → extensions-navigation-Di9rJ-b5.js} +1 -1
  25. package/build/assets/{files-tab-DHqtsKLy.js → files-tab-61Vaihc6.js} +1 -1
  26. package/build/assets/{git-provider-icon-CGU7_KiU.js → git-provider-icon-aQRcUVI-.js} +1 -1
  27. package/build/assets/{home-BgjWP_UN.js → home-5gOtUe-n.js} +1 -1
  28. package/build/assets/{install-server-modal-J_eQ6lhG.js → install-server-modal-BRab9inF.js} +1 -1
  29. package/build/assets/{launch-DamfAY5L.js → launch-1TJRKkkX.js} +1 -1
  30. package/build/assets/{lesson-plan-HD886V64.js → lesson-plan-BtrZUCuj.js} +1 -1
  31. package/build/assets/{llm-not-configured-banner-DTrLsVr_.js → llm-not-configured-banner-BrU5uHto.js} +1 -1
  32. package/build/assets/{llm-settings-BgSFkbHC.js → llm-settings-BpdU51Jo.js} +1 -1
  33. package/build/assets/llm-settings-DsInf6yD.js +1 -0
  34. package/build/assets/{manage-backends-modal-BUzj5_Lq.js → manage-backends-modal-BREySP-J.js} +1 -1
  35. package/build/assets/{manifest-4d6a1552.js → manifest-a5bb7568.js} +1 -1
  36. package/build/assets/{mcp-DvqJYDbz.js → mcp-XXf8k6mb.js} +1 -1
  37. package/build/assets/{messages-C4KEFkPk.js → messages-D2oZb47Z.js} +1 -1
  38. package/build/assets/{onboarding-gGIqoxvA.js → onboarding-D32kiGME.js} +1 -1
  39. package/build/assets/{onboarding-modal-CGHPoMp7.js → onboarding-modal-C084vkv7.js} +1 -1
  40. package/build/assets/{option-service.api-Dz7Eomnx.js → option-service.api-Cl5VLGyw.js} +1 -1
  41. package/build/assets/{path-utils-CBaRYg35.js → path-utils-BeOmjIcE.js} +1 -1
  42. package/build/assets/{planner-tab-G4j36bJk.js → planner-tab-AZMjJx31.js} +1 -1
  43. package/build/assets/{providers-CPoq0VXm.js → providers-vX9jk9Vy.js} +1 -1
  44. package/build/assets/recommended-automations-launcher-Bk8tQ-Cn.js +58 -0
  45. package/build/assets/{root-layout-CvxdHJ6j.js → root-layout-CoWw4kpz.js} +2 -2
  46. package/build/assets/{root-S6CfVoNm.js → root-tuEPDx-i.js} +2 -2
  47. package/build/assets/{schema-field-DwUzlw6b.js → schema-field-nvq_Juo2.js} +1 -1
  48. package/build/assets/{sdk-section-page-BUXONTx6.js → sdk-section-page-CgT70FaZ.js} +1 -1
  49. package/build/assets/{secrets-settings-ZxyfRBgx.js → secrets-settings-BCxk9p9s.js} +1 -1
  50. package/build/assets/{settings-Bx6vn-g8.js → settings-CedTdtb5.js} +1 -1
  51. package/build/assets/{settings-index-D4SM26d5.js → settings-index-Cct3PJSP.js} +1 -1
  52. package/build/assets/{settings-modal-BoC8oMlg.js → settings-modal-DwLybV_O.js} +1 -1
  53. package/build/assets/{shared-conversation-DMiaQFsj.js → shared-conversation-DnDwfLgg.js} +1 -1
  54. package/build/assets/{sidebar-mobile-menu-toggle-CaV3tQFF.js → sidebar-mobile-menu-toggle-B8k3qu84.js} +1 -1
  55. package/build/assets/{skills-plugins-D2WkrXkr.js → skills-plugins-B68ay6Pu.js} +1 -1
  56. package/build/assets/{skills-settings-CZGVOp_t.js → skills-settings-A6sUy0T7.js} +1 -1
  57. package/build/assets/{terminal-B0aL_iDZ.js → terminal-BmT0_gIH.js} +1 -1
  58. package/build/assets/{use-acp-credential-form-rzaqkJ1n.js → use-acp-credential-form-Bs6s0DTU.js} +1 -1
  59. package/build/assets/{use-activate-agent-profile-DY0txItX.js → use-activate-agent-profile-CKtTToSx.js} +1 -1
  60. package/build/assets/{use-active-agent-profile-Cp5AFONR.js → use-active-agent-profile-CWLPpOtK.js} +1 -1
  61. package/build/assets/{use-active-conversation-DvcFBqFe.js → use-active-conversation-DI5S5M1w.js} +1 -1
  62. package/build/assets/{use-agent-profiles-DnH16_Vm.js → use-agent-profiles-DPcaYLpm.js} +1 -1
  63. package/build/assets/{use-agent-state-BvRcEzY4.js → use-agent-state-Buh3bQDh.js} +1 -1
  64. package/build/assets/{use-backends-health-e-Ull4wz.js → use-backends-health-CxkvJy2N.js} +1 -1
  65. package/build/assets/{use-can-manage-org-profiles-OIhplvQ0.js → use-can-manage-org-profiles-DeX2Mfje.js} +1 -1
  66. package/build/assets/{use-cloud-current-user-id-ekU7UXDT.js → use-cloud-current-user-id-D_PQGfmT.js} +1 -1
  67. package/build/assets/{use-config-Dwf5gla-.js → use-config-ur0RbjCP.js} +1 -1
  68. package/build/assets/{use-create-conversation-CvAXfA3T.js → use-create-conversation-D9OWYcte.js} +1 -1
  69. package/build/assets/{use-create-secret-BKeXCo__.js → use-create-secret-CVFSlhlR.js} +1 -1
  70. package/build/assets/{use-handle-plan-click-cAXS-Hft.js → use-handle-plan-click-Dug8egQl.js} +1 -1
  71. package/build/assets/{use-llm-profiles-BcLibtGb.js → use-llm-profiles-DjackuP1.js} +1 -1
  72. package/build/assets/use-runtime-is-ready-Diiq65Q-.js +1 -0
  73. package/build/assets/{use-save-agent-profile-DFjxHhNx.js → use-save-agent-profile-aKKLqDJM.js} +1 -1
  74. package/build/assets/{use-save-settings-5xPYpSQM.js → use-save-settings-CChDyjOB.js} +1 -1
  75. package/build/assets/{use-settings-B07msZ2Z.js → use-settings-dX4fKUPF.js} +1 -1
  76. package/build/assets/{use-settings-nav-items-CswsOEyw.js → use-settings-nav-items-D6pHnvxg.js} +1 -1
  77. package/build/assets/{use-skills-Aoaoq_ei.js → use-skills-Dqo-pDDx.js} +1 -1
  78. package/build/assets/{use-tracking-CqODdfO4.js → use-tracking-GtXCHmTv.js} +1 -1
  79. package/build/assets/{use-user-conversation-BPHQ-dm-.js → use-user-conversation-6uOXFP95.js} +1 -1
  80. package/build/assets/{vendor~root-layout~home~conversation-panel~conversation~launch~skills-settings~automations-~ki5qnp0d-DJHl5b-B.js → vendor~root-layout~home~conversation-panel~conversation~launch~skills-settings~automations-~ki5qnp0d-rV6d1Iv_.js} +267 -27
  81. package/build/assets/vendor~root-layout~home~mcp~automations-list~onboarding-modal-CXyYYvYh.js +1 -0
  82. package/build/assets/{verification-settings-DZQ-JvKH.js → verification-settings-D_zsNB_c.js} +1 -1
  83. package/build/index.html +4 -4
  84. package/config/defaults.json +1 -1
  85. package/dist/config/defaults.cjs +1 -1
  86. package/dist/config/defaults.cjs.map +1 -1
  87. package/dist/config/defaults.js +1 -1
  88. package/dist/config/defaults.js.map +1 -1
  89. package/dist/node_modules/@openhands/extensions/integrations/catalog/atlassian.cjs +1 -1
  90. package/dist/node_modules/@openhands/extensions/integrations/catalog/atlassian.cjs.map +1 -1
  91. package/dist/node_modules/@openhands/extensions/integrations/catalog/atlassian.js +70 -3
  92. package/dist/node_modules/@openhands/extensions/integrations/catalog/atlassian.js.map +1 -1
  93. package/dist/node_modules/@openhands/extensions/integrations/catalog/datadog.cjs +1 -1
  94. package/dist/node_modules/@openhands/extensions/integrations/catalog/datadog.cjs.map +1 -1
  95. package/dist/node_modules/@openhands/extensions/integrations/catalog/datadog.js +27 -2
  96. package/dist/node_modules/@openhands/extensions/integrations/catalog/datadog.js.map +1 -1
  97. package/dist/node_modules/@openhands/extensions/integrations/catalog/superhuman-mail.cjs +2 -0
  98. package/dist/node_modules/@openhands/extensions/integrations/catalog/superhuman-mail.cjs.map +1 -0
  99. package/dist/node_modules/@openhands/extensions/integrations/catalog/superhuman-mail.js +33 -0
  100. package/dist/node_modules/@openhands/extensions/integrations/catalog/superhuman-mail.js.map +1 -0
  101. package/dist/node_modules/@openhands/extensions/integrations/catalog-index.cjs +1 -1
  102. package/dist/node_modules/@openhands/extensions/integrations/catalog-index.cjs.map +1 -1
  103. package/dist/node_modules/@openhands/extensions/integrations/catalog-index.js +48 -46
  104. package/dist/node_modules/@openhands/extensions/integrations/catalog-index.js.map +1 -1
  105. package/dist/node_modules/@openhands/extensions/skills/index.cjs +267 -27
  106. package/dist/node_modules/@openhands/extensions/skills/index.cjs.map +1 -1
  107. package/dist/node_modules/@openhands/extensions/skills/index.js +36 -30
  108. package/dist/node_modules/@openhands/extensions/skills/index.js.map +1 -1
  109. package/dist/package.cjs +1 -1
  110. package/dist/package.cjs.map +1 -1
  111. package/dist/package.js +2 -2
  112. package/dist/package.js.map +1 -1
  113. package/dist/themes/color-themes.cjs +3 -3
  114. package/dist/themes/color-themes.cjs.map +1 -1
  115. package/dist/themes/color-themes.d.ts +13 -2
  116. package/dist/themes/color-themes.js +2 -2
  117. package/dist/themes/color-themes.js.map +1 -1
  118. package/package.json +2 -2
  119. package/build/assets/agent-settings-CMMms-0q.js +0 -1
  120. package/build/assets/conversation-DGVDwGn8.js +0 -1
  121. package/build/assets/conversation-panel-C7DC4Cxx.js +0 -1
  122. package/build/assets/llm-settings-Bkc8C5Bi.js +0 -1
  123. package/build/assets/recommended-automations-launcher-CXaEK1rW.js +0 -50
  124. package/build/assets/use-runtime-is-ready-CBFe69Ew.js +0 -1
  125. package/build/assets/vendor~root-layout~home~mcp~automations-list~onboarding-modal-L2sdihTY.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/files-tab-DHqtsKLy.js","assets/rolldown-runtime-BFRubm34.js","assets/vendor-styling-CI0PQ3ab.js","assets/active-backend-context-DRFevVIj.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~ncdxw0bh-ClHnt5lR.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~d1e18dtv-5Q6lQJdE.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~i3v2mlbw-BrJQ3XZH.js","assets/createLucideIcon-CVAsW2Yo.js","assets/declaration-B9kpCaYl.js","assets/agent-server-client-options-DVLRd9sw.js","assets/utils-CE0lDWtb.js","assets/common-Dh7OqABE.js","assets/vendor~files-tab-B02k3xvx.js","assets/iconBase-DaTRRUjy.js","assets/vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~enjl5xdm-mMKDm94D.js","assets/useQuery-CpjHYtZc.js","assets/suspense-X5dBsJzn.js","assets/mouse-pointer-click-PdEQPL6v.js","assets/useTranslation-Cgy4JA_g.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-d8aETPbZ.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-9UMeuPV6.js","assets/objectWithoutPropertiesLoose-BgYIAs2y.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-D7EUmQ8Y.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-DTzw2x50.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-CqXiHwjU.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-BD0GaRGa.js","assets/react-DPDgL6du.js","assets/agent-server-conversation-service.api-DfH2k6Sx.js","assets/vendor~root-layout~home~conversation-panel~conversation~launch~skills-settings~automations-~ki5qnp0d-DJHl5b-B.js","assets/v4-DbCkTSoU.js","assets/proxy-CHmFkV16.js","assets/profiles-service.api-CeYEmSM3.js","assets/settings-service.api-DldkFI1x.js","assets/settings-mQUckT0g.js","assets/llm-subscription-service-CKyaV24y.js","assets/llm-subscription-DtsX5Lhg.js","assets/acp-providers-D_D8VUpP.js","assets/use-event-store-YSOxy9FC.js","assets/runtime-waiting-state-DkzLgvMn.js","assets/loading-spinner-DHAIPZkP.js","assets/typography-YGPBGzOG.js","assets/dist-CodhvuAP.js","assets/conversation-tab-empty-state-m8IUkfMj.js","assets/segmented-toggle-Cen5AMUc.js","assets/markdown-renderer-D8mayGjI.js","assets/vendor~root-layout~home~conversation-panel~conversation~shared-conversation~alert-banner~pl~rqjteh0a-CZM4hwUT.js","assets/copy-to-clipboard-button-Aj9wFmt2.js","assets/checkmark-h7udgXMM.js","assets/copy-BLmGeJcd.js","assets/use-active-conversation-DvcFBqFe.js","assets/conversation-service.api-Ch9kR9aE.js","assets/navigation-context-DPs2G0X8.js","assets/use-user-conversation-BPHQ-dm-.js","assets/use-agent-state-BvRcEzY4.js","assets/conversation-state-store-B2Bp32XI.js","assets/use-runtime-is-ready-CBFe69Ew.js","assets/files-tab-store-DJsPxYdg.js","assets/folder-mMWFvaw0.js","assets/get-language-from-path-CPNnuVhI.js","assets/link-external-DfKQroKX.js","assets/conversation-local-storage-F6zVMM--.js","assets/git-status-mapper-BI8FyUVp.js","assets/browser-tab-aiDg7aEn.js","assets/external-link-D2zJjE9G.js","assets/vendor~browser-tab-Di0kh5Zw.js","assets/browser-store-BI6uklCG.js","assets/planner-tab-G4j36bJk.js","assets/list-todo-BfH6yYUK.js","assets/plan-components-j9X4AxYM.js","assets/brand-button-DKPMEKcW.js","assets/form-control-classes-9rkU4usZ.js","assets/use-handle-plan-click-cAXS-Hft.js","assets/use-create-conversation-CvAXfA3T.js","assets/useMutation-DCE9RcgK.js","assets/use-agent-profiles-DnH16_Vm.js","assets/plugins-management-service-BAp70KN7.js","assets/use-llm-profiles-BcLibtGb.js","assets/use-tracking-CqODdfO4.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~nn5zty47-Zl0G1QCy.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~k6tszsdc-Bb-xMtbv.js","assets/use-settings-B07msZ2Z.js","assets/conversation-store-LptbOvKa.js","assets/middleware-DYHYNAnP.js","assets/task-list-tab-BAThr9Ex.js","assets/use-task-list-CmWGElgb.js","assets/u-check-circle-half-LiwZkuFe.js","assets/u-check-circle-BqoIxNz_.js","assets/terminal-B0aL_iDZ.js","assets/vendor~terminal-aeP3PnKf.js","assets/vendor~terminal-T4IDBjWs.css","assets/square-chevron-right-Czw3FFWc.js","assets/command-store-D8J5LMW1.js"])))=>i.map(i=>d[i]);
2
- import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,St as n,_t as r,bt as i,et as a,gt as o,h as s,o as c,xt as l}from"./vendor-styling-CI0PQ3ab.js";import{A as u,L as d,M as f,k as p}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{n as m}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~i3v2mlbw-BrJQ3XZH.js";import{a as h,c as g,f as _,i as v,u as y}from"./path-utils-CBaRYg35.js";import{n as b,r as x}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~d1e18dtv-5Q6lQJdE.js";import{t as S}from"./useMutation-DCE9RcgK.js";import{t as C}from"./useQuery-CpjHYtZc.js";import{t as w}from"./Trans-De9RwQhA.js";import{t as T}from"./useTranslation-Cgy4JA_g.js";import{t as E}from"./declaration-B9kpCaYl.js";import{A as D,j as O,k,n as A}from"./active-backend-context-DRFevVIj.js";import{t as j}from"./createLucideIcon-CVAsW2Yo.js";import{a as M,c as ee,d as te,f as N,g as P,h as F,i as ne,l as re,m as ie,n as I,o as L,p as ae,r as R,s as oe,t as se,u as ce}from"./messages-C4KEFkPk.js";import{t as le}from"./check-Bvi71siz.js";import{n as ue,t as z}from"./vendor~root-layout~conversation-panel~conversation-CpiTHpHl.js";import{t as de}from"./copy-3JCw_XFB.js";import{t as fe}from"./external-link-D2zJjE9G.js";import{t as B}from"./list-todo-BfH6yYUK.js";import{t as pe}from"./loader-circle-BEykUKYG.js";import{t as me}from"./square-chevron-right-Czw3FFWc.js";import{t as he}from"./x-Cb0WAtak.js";import{A as ge,C as V,E as _e,I as ve,S as H,T as ye,b as be,c as xe,d as Se,h as Ce,l as we,o as Te,t as U,u as Ee,w as De,x as Oe}from"./utils-CE0lDWtb.js";import{t as ke}from"./common-Dh7OqABE.js";import{c as Ae,i as je}from"./agent-server-client-options-DVLRd9sw.js";import{t as Me}from"./proxy-CHmFkV16.js";import{t as Ne}from"./modal-backdrop-zVwfOJZr.js";import{n as Pe}from"./modal-body-Dcu5McCa.js";import{r as Fe}from"./base-modal-CC5Pp8CF.js";import{t as Ie}from"./brand-button-DKPMEKcW.js";import{t as Le}from"./loading-spinner-DHAIPZkP.js";import{n as Re}from"./navigation-context-DPs2G0X8.js";import{t as ze}from"./styled-tooltip-DsKsFjuq.js";import{r as Be,u as Ve}from"./dropdown-classes-CgQ45JmQ.js";import{_ as He,f as Ue,h as We,n as Ge,p as Ke,s as qe}from"./git-provider-icon-CGU7_KiU.js";import{t as Je}from"./react-DPDgL6du.js";import{n as Ye}from"./middleware-DYHYNAnP.js";import{i as Xe,s as Ze}from"./conversation-local-storage-F6zVMM--.js";import{t as W}from"./conversation-store-LptbOvKa.js";import{t as Qe}from"./modal-close-button-CTCX4nCH.js";import{r as $e}from"./use-settings-B07msZ2Z.js";import{t as et}from"./use-tracking-CqODdfO4.js";import{t as tt}from"./v4-DbCkTSoU.js";import{a as nt,i as rt,t as it}from"./agent-server-conversation-service.api-DfH2k6Sx.js";import{t as at}from"./use-is-authed-_dhQ2Xuj.js";import{c as ot,d as st,f as ct,i as lt,l as ut,n as dt,r as ft,s as pt,t as mt,u as ht}from"./sidebar-mobile-menu-toggle-CaV3tQFF.js";import{t as gt}from"./use-click-outside-element-Bf4Omzot.js";import{t as _t}from"./use-create-conversation-CvAXfA3T.js";import{r as vt,t as yt}from"./conversation-service.api-Ch9kR9aE.js";import{n as bt,t as G}from"./context-menu-list-item-DBFzplWW.js";import{i as K,r as xt,t as St}from"./ellipsis-button-1BV9Sga8.js";import{t as Ct}from"./u-edit-DJ90xc8Z.js";import{t as wt}from"./skills-9cDZONKh.js";import{t as Tt}from"./use-user-conversation-BPHQ-dm-.js";import{t as Et}from"./conversation-state-store-B2Bp32XI.js";import{t as Dt}from"./copy-BLmGeJcd.js";import{r as Ot}from"./typography-YGPBGzOG.js";import{C as kt,D as At,E as jt,I as Mt,L as Nt,M as Pt,N as Ft,O as It,P as Lt,S as Rt,T as zt,V as Bt,_ as Vt,a as Ht,b as Ut,f as Wt,g as Gt,h as Kt,i as qt,j as Jt,k as Yt,m as Xt,n as Zt,o as Qt,p as $t,r as en,t as tn,v as nn,w as rn,x as an,y as on,z as sn}from"./llm-not-configured-banner-DTrLsVr_.js";import{n as q,r as cn,t as J}from"./use-active-conversation-DvcFBqFe.js";import{t as Y}from"./use-agent-state-BvRcEzY4.js";import{a as ln,c as un,d as dn,f as fn,h as pn,l as mn,m as X,n as hn,p as gn,r as _n,s as vn,u as yn}from"./lesson-plan-HD886V64.js";import{D as bn,c as xn,l as Sn,m as Cn,t as Z}from"./use-event-store-YSOxy9FC.js";import{t as wn}from"./command-store-D8J5LMW1.js";import{t as Tn}from"./use-runtime-is-ready-CBFe69Ew.js";import{r as En}from"./plan-components-j9X4AxYM.js";import{t as Dn}from"./use-breakpoint-B-O0lQ84.js";import{t as On}from"./use-task-list-CmWGElgb.js";import{t as kn}from"./vendor~conversation-panel~conversation~alert-banner-DHDkknt5.js";var An=j(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),jn=j(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),Mn=e=>!e.isLayoutDirty&&e.willUpdate(!1);function Nn(){let e=new Set,t=new WeakMap,n=()=>e.forEach(Mn);return{add:r=>{e.add(r),t.set(r,r.addEventListener(`willUpdate`,n))},remove:r=>{e.delete(r);let i=t.get(r);i&&(i(),t.delete(r)),n()},dirty:n}}var Q=i(),$=e(t(),1),Pn=(0,$.createContext)(null);function Fn(){let e=(0,$.useRef)(!1);return o(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function In(){let e=Fn(),[t,n]=(0,$.useState)(0),r=(0,$.useCallback)(()=>{e.current&&n(t+1)},[t]);return[(0,$.useCallback)(()=>a.postRender(r),[r]),t]}var Ln=e=>e===!0,Rn=e=>Ln(e===!0)||e===`id`,zn=({children:e,id:t,inherit:n=!0})=>{let i=(0,$.useContext)(r),a=(0,$.useContext)(Pn),[o,s]=In(),c=(0,$.useRef)(null),l=i.id||a;c.current===null&&(Rn(n)&&l&&(t=t?l+`-`+t:l),c.current={id:t,group:Ln(n)&&i.group||Nn()});let u=(0,$.useMemo)(()=>({...c.current,forceRender:o}),[s]);return(0,Q.jsx)(r.Provider,{value:u,children:e})},Bn={curAgentState:V.LOADING},Vn=Je(e=>({...Bn,setCurrentAgentState:t=>e({curAgentState:t}),reset:()=>e(Bn)})),Hn=`openhands-last-conversation-by-backend`;function Un(e,t){return t?`${e}::${t}`:e}function Wn(){if(typeof window>`u`)return{};try{let e=window.localStorage.getItem(Hn);if(!e)return{};let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n={};for(let[e,r]of Object.entries(t))typeof r==`string`&&r.length>0&&(n[e]=r);return n}catch{return{}}}function Gn(e){if(!(typeof window>`u`))try{window.localStorage.setItem(Hn,JSON.stringify(e))}catch{}}function Kn(e,t,n){if(!n)return;let r=Wn();r[Un(e,t)]=n,Gn(r)}function qn(e,t){let n=Wn(),r=Un(e,t);r in n&&(delete n[r],Gn(n))}var Jn=e=>({action:F.CHANGE_AGENT_STATE,args:{agent_state:e}}),Yn=e=>`error`in e,Xn=e=>`type`in e&&e.type===`error`,Zn=()=>{let{send:e}=ie(),t=Z(e=>e.events);$.useEffect(()=>{if(!t.length)return;let n=t[t.length-1];if(!(Sn(n)&&xn(n))){if(Yn(n)){if(n.error_code===401){D(`Session expired.`);return}typeof n.error==`string`?D(n.error):D(n.message);return}Xn(n)&&`${n.message??``}`.startsWith(`Agent reached maximum`)&&e(Jn(V.PAUSED))}},[t.length])},Qn=()=>{let{curAgentState:e}=Y();return{runtimeActive:!De.includes(e)}};function $n({children:e}){return Zn(),Qn(),e}var er=`ACPAuthRequired`,tr={ACPAuthRequired:E.ERROR$ACP_AUTH_REQUIRED_TITLE,ACPSpawnError:E.CHAT_INTERFACE$AGENT_ERROR_MESSAGE,ACPInitError:E.CHAT_INTERFACE$AGENT_ERROR_MESSAGE,ACPPromptError:E.CHAT_INTERFACE$AGENT_ERROR_MESSAGE,UsagePolicyRefusal:E.CHAT_INTERFACE$AGENT_ERROR_MESSAGE};function nr(e){return e?tr[e]??null:null}function rr(e){return e===er}var ir={entriesByConversation:{}},ar=(e,t,n)=>({entriesByConversation:{...e.entriesByConversation,[t]:n(e.entriesByConversation[t]??[])}}),or=Je()(Ye(e=>({...ir,addPending:(t,n)=>{let r=tt();return e(e=>ar(e,t,e=>[...e,{id:r,question:n,status:`pending`}])),r},resolve:(t,n,r)=>e(e=>ar(e,t,e=>e.map(e=>e.id===n?{...e,response:r,status:`done`}:e))),fail:(t,n,r)=>e(e=>ar(e,t,e=>e.map(e=>e.id===n?{...e,response:r,status:`error`}:e))),dismiss:(t,n)=>e(e=>ar(e,t,e=>e.filter(e=>e.id!==n)))}),{name:`BtwStore`}));function sr({onClick:e}){let{t}=T(`openhands`);return(0,Q.jsxs)(`button`,{type:`button`,onClick:e,className:`flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-normal text-success bg-success/10 hover:bg-success/20 border border-success/30 transition-colors`,children:[(0,Q.jsx)(te,{className:`w-3.5 h-3.5 fill-success`}),(0,Q.jsx)(`span`,{children:t(E.CHAT_INTERFACE$BTW_GOT_IT)})]})}function cr({conversationId:e}){let{t}=T(`openhands`),n=or(e=>e.entriesByConversation),r=or(e=>e.dismiss),i=e?n[e]??[]:[];return!e||i.length===0?null:(0,Q.jsx)(`div`,{"data-testid":`btw-messages`,className:`flex flex-col w-full`,children:i.map(n=>{let i=n.status===`pending`;return(0,Q.jsx)(N,{title:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`opacity-60`,children:t(E.CHAT_INTERFACE$BTW_PREFIX)}),(0,Q.jsx)(`span`,{children:n.question}),i&&(0,Q.jsx)(`span`,{"data-testid":`btw-spinner`,className:`inline-block w-3.5 h-3.5 ml-2 rounded-full border-2 border-transparent border-t-[var(--oh-border-input)] animate-spin`})]}),details:i?t(E.CHAT_INTERFACE$BTW_WAITING_FOR_ANSWER):n.response??``,initiallyExpanded:!i,chevronPosition:`before`,titleTrailing:!i&&(0,Q.jsx)(sr,{onClick:()=>r(e,n.id)})},n.id)})})}function lr({conversationId:e}){let t=gn(e=>e.statusByConversation),n=e?t[e]:void 0;return n?.active?(0,Q.jsx)(ce,{status:n}):null}var ur=`${_e} `,dr=(e,t)=>{let n=or(e=>e.addPending),r=or(e=>e.resolve),i=or(e=>e.fail);return(0,$.useCallback)(a=>{let o=a.trim(),s=o===`/btw`||o.startsWith(ur);if(!e||!s){t(a);return}let c=o.slice(_e.length).trim();if(!c)return;let l=n(e,c);v(e,c).then(({response:t})=>r(e,l,t)).catch(t=>i(e,l,t?.message??`Failed to ask agent`))},[e,t,n,r,i])},fr=`${ge} `,pr=/^--max(?:=|\s+)(\d+)\s*/,mr=(e,t)=>{let{t:n}=T();return(0,$.useCallback)(r=>{let i=r.trim(),a=i===`/goal`||i.startsWith(fr);if(!e||!a){t(r);return}let o=i.slice(ge.length).trim(),s,c=o.match(pr);c&&(s=parseInt(c[1],10),o=o.slice(c[0].length).trim());let l=o;if(!l){D(n(E.GOAL$OBJECTIVE_REQUIRED));return}let u={objective:l};s&&s>=1&&(u.max_iterations=s),y(e,u).catch(e=>{let t=n(E.GOAL$START_FAILED);D(e instanceof Error&&e.message?e.message:t)})},[e,t,n])},hr=`flex flex-row gap-1 items-center justify-center rounded-[100px]`;function gr(e){return U(hr,e?`bg-[var(--oh-surface)] hover:bg-tertiary cursor-pointer text-white`:`bg-[var(--oh-surface)] cursor-not-allowed opacity-50 text-[var(--oh-muted)]`)}function _r(e){return e?`white`:`var(--oh-muted)`}var vr=`font-normal text-sm leading-5 truncate`;function yr({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,isConversationReady:r=!0}){let{t:i}=T(`openhands`),{trackPullButtonClick:a}=et(),o=n&&t&&r;return(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{a(),e(xe())},disabled:!o,className:U(gr(o),`px-0.5 py-1 w-[76px] min-w-[76px]`),children:[(0,Q.jsx)(`div`,{className:`w-3 h-3 flex items-center justify-center`,children:(0,Q.jsx)(At,{width:12,height:12,color:_r(o)})}),(0,Q.jsx)(`div`,{className:U(vr,`max-w-[76px]`),title:i(E.COMMON$PULL),children:i(E.COMMON$PULL)})]})}function br({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,currentGitProvider:r,isConversationReady:i=!0}){let{t:a}=T(`openhands`),{trackPushButtonClick:o}=et(),s=n&&t&&i;return(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{o(),e(we(r))},disabled:!s,className:U(gr(s),`px-2 py-1 w-[77px] min-w-[77px]`),children:[(0,Q.jsx)(`div`,{className:`w-3 h-3 flex items-center justify-center`,children:(0,Q.jsx)(It,{width:12,height:12,color:_r(s)})}),(0,Q.jsx)(`div`,{className:U(vr,`max-w-[77px]`),title:a(E.COMMON$PUSH),children:a(E.COMMON$PUSH)})]})}function xr({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,currentGitProvider:r,isConversationReady:i=!0}){let{t:a}=T(`openhands`),{trackCreatePrButtonClick:o}=et(),s=n&&t&&i;return(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{o(),e(Te(r))},disabled:!s,className:U(gr(s),`px-2 py-1 w-[126px] min-w-[126px] h-7`),children:[(0,Q.jsx)(`div`,{className:`w-3 h-3 flex items-center justify-center`,children:(0,Q.jsx)(jt,{width:12,height:12,color:_r(s)})}),(0,Q.jsx)(`div`,{className:U(vr,`max-w-[126px]`),title:a(E.COMMON$PULL_REQUEST),children:a(E.COMMON$PULL_REQUEST)})]})}function Sr(e){return e.kind===`BashCommand`}function Cr(e){return e.kind===`BashOutput`}function wr(e){return e.kind===`BashError`}function Tr(e,t,n){let r=(0,$.useRef)(null),i=(0,$.useRef)([]),a=(0,$.useRef)([]),o=(0,$.useRef)(new Map);return(0,$.useEffect)(()=>{if(!n)return;let s=je(e,t),c=new WebSocket(s);r.current=c,c.onopen=()=>{for(let{command:e,cwd:t,timeout:n,resolve:r,reject:o}of i.current)a.current.push({resolve:r,reject:o}),c.send(JSON.stringify({command:e,cwd:t,timeout:n}));i.current=[]},c.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}if(Sr(t)){let e=a.current.shift();e&&o.current.set(t.id,{...e,stdout:[],stderr:[]})}else if(Cr(t)&&t.command_id){let e=o.current.get(t.command_id);e&&(t.stdout&&e.stdout.push(t.stdout),t.stderr&&e.stderr.push(t.stderr),t.exit_code!=null&&(o.current.delete(t.command_id),e.resolve({exit_code:t.exit_code,stdout:e.stdout.join(``),stderr:e.stderr.join(``)})))}else wr(t)&&l(`Bash error: ${t.code}: ${t.detail}`)};function l(e){let t=Error(e);for(let{reject:e}of i.current)e(t);i.current=[];for(let e of a.current)e.reject(t);a.current=[];for(let e of o.current.values())e.reject(t);o.current.clear()}return c.onclose=()=>{r.current=null,l(`Bash WebSocket closed`)},c.onerror=()=>{r.current=null,l(`Bash WebSocket error`)},()=>{c.onclose=null,c.onerror=null,c.close(),r.current=null,l(`Bash WebSocket unmounted`)}},[n,e,t]),(0,$.useCallback)((e,t,n)=>new Promise((o,s)=>{let c=r.current;if(!c||c.readyState===WebSocket.CLOSED||c.readyState===WebSocket.CLOSING){s(Error(`Bash WebSocket not available`));return}c.readyState===WebSocket.CONNECTING?i.current.push({command:e,cwd:t,timeout:n,resolve:o,reject:s}):(a.current.push({resolve:o,reject:s}),c.send(JSON.stringify({command:e,cwd:t,timeout:n})))}),[])}var Er={"github.com":`github`,"gitlab.com":`gitlab`,"bitbucket.org":`bitbucket`,"dev.azure.com":`azure_devops`};function Dr(e){return e.replace(/\.git$/,``)}function Or(e){return e?Er[e.toLowerCase()]??null:null}function kr(e){let t=e.split(`/`).filter(Boolean),n=t.indexOf(`_git`);return n===-1?t.join(`/`):[...t.slice(0,n),...t.slice(n+1)].join(`/`)}function Ar(e,t,n){let r=Dr(n.replace(/^\/+/,``)),i=Or(t);return{url:e,host:t,repository:(i===`azure_devops`?kr(r):r)||null,provider:i}}function jr(e){let t=e?.trim();if(!t)return null;let n=t.match(/^[^@\s]+@([^:\s]+):(.+)$/);if(n){let e=n[1];return Ar(t,e,n[2])}try{let e=new URL(t);return Ar(t,e.hostname||null,e.pathname)}catch{return null}}var Mr={repository:null,branch:null,provider:null,remoteUrl:null},Nr=[`r=$(git remote get-url origin 2>/dev/null)`,`b=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)`,`if [ -z "$r$b" ]; then`,`n=$(find . -mindepth 2 -maxdepth 4 -name .git 2>/dev/null | cut -c3- | sed 's|/.git$||' | sort -u)`,`c=$(printf '%s\\n' "$n" | grep -c '[^[:space:]]')`,`if [ "$c" = "1" ] && [ -n "$n" ]; then`,`r=$(git -C "$n" remote get-url origin 2>/dev/null)`,`b=$(git -C "$n" rev-parse --abbrev-ref HEAD 2>/dev/null)`,`fi`,`fi`,`printf '%s\\n%s' "$r" "$b"`].join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/files-tab-61Vaihc6.js","assets/rolldown-runtime-BFRubm34.js","assets/vendor-styling-CI0PQ3ab.js","assets/active-backend-context-u2tdYRgH.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~ncdxw0bh-ClHnt5lR.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~d1e18dtv-5Q6lQJdE.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~i3v2mlbw-BrJQ3XZH.js","assets/createLucideIcon-CVAsW2Yo.js","assets/declaration-B9kpCaYl.js","assets/agent-server-client-options-DVLRd9sw.js","assets/utils-CE0lDWtb.js","assets/common-Dh7OqABE.js","assets/vendor~files-tab-B02k3xvx.js","assets/iconBase-DaTRRUjy.js","assets/vendor~root-layout~home~conversation-panel~conversation~launch~settings~settings-index~agen~enjl5xdm-mMKDm94D.js","assets/useQuery-CpjHYtZc.js","assets/suspense-X5dBsJzn.js","assets/mouse-pointer-click-PdEQPL6v.js","assets/useTranslation-Cgy4JA_g.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-d8aETPbZ.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-9UMeuPV6.js","assets/objectWithoutPropertiesLoose-BgYIAs2y.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-D7EUmQ8Y.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-DTzw2x50.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-CqXiHwjU.js","assets/vendor~home~conversation-panel~conversation~shared-conversation~planner-tab~files-tab-BD0GaRGa.js","assets/react-DPDgL6du.js","assets/agent-server-conversation-service.api-BP73yONA.js","assets/vendor~root-layout~home~conversation-panel~conversation~launch~skills-settings~automations-~ki5qnp0d-rV6d1Iv_.js","assets/v4-DbCkTSoU.js","assets/proxy-CHmFkV16.js","assets/profiles-service.api-CeYEmSM3.js","assets/settings-service.api-DldkFI1x.js","assets/settings-mQUckT0g.js","assets/llm-subscription-service-CKyaV24y.js","assets/llm-subscription-DtsX5Lhg.js","assets/acp-providers-D_D8VUpP.js","assets/use-event-store-YSOxy9FC.js","assets/runtime-waiting-state-DkzLgvMn.js","assets/loading-spinner-DHAIPZkP.js","assets/typography-YGPBGzOG.js","assets/dist-CodhvuAP.js","assets/conversation-tab-empty-state-m8IUkfMj.js","assets/segmented-toggle-Cen5AMUc.js","assets/markdown-renderer-D8mayGjI.js","assets/vendor~root-layout~home~conversation-panel~conversation~shared-conversation~alert-banner~pl~rqjteh0a-CZM4hwUT.js","assets/copy-to-clipboard-button-Aj9wFmt2.js","assets/checkmark-h7udgXMM.js","assets/copy-BLmGeJcd.js","assets/use-active-conversation-DI5S5M1w.js","assets/conversation-service.api-CqZcHr1c.js","assets/navigation-context-DPs2G0X8.js","assets/use-user-conversation-6uOXFP95.js","assets/use-agent-state-Buh3bQDh.js","assets/conversation-state-store-B2Bp32XI.js","assets/use-runtime-is-ready-Diiq65Q-.js","assets/files-tab-store-DJsPxYdg.js","assets/folder-mMWFvaw0.js","assets/get-language-from-path-CPNnuVhI.js","assets/link-external-DfKQroKX.js","assets/conversation-local-storage-F6zVMM--.js","assets/git-status-mapper-BI8FyUVp.js","assets/browser-tab-aiDg7aEn.js","assets/external-link-D2zJjE9G.js","assets/vendor~browser-tab-Di0kh5Zw.js","assets/browser-store-BI6uklCG.js","assets/planner-tab-AZMjJx31.js","assets/list-todo-BfH6yYUK.js","assets/plan-components-j9X4AxYM.js","assets/brand-button-DKPMEKcW.js","assets/form-control-classes-9rkU4usZ.js","assets/use-handle-plan-click-Dug8egQl.js","assets/use-create-conversation-D9OWYcte.js","assets/useMutation-DCE9RcgK.js","assets/use-agent-profiles-DPcaYLpm.js","assets/plugins-management-service-BAp70KN7.js","assets/use-llm-profiles-DjackuP1.js","assets/use-tracking-GtXCHmTv.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~nn5zty47-Zl0G1QCy.js","assets/vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~skills-set~k6tszsdc-Bb-xMtbv.js","assets/use-settings-dX4fKUPF.js","assets/conversation-store-LptbOvKa.js","assets/middleware-DYHYNAnP.js","assets/task-list-tab-BAThr9Ex.js","assets/use-task-list-CmWGElgb.js","assets/u-check-circle-half-LiwZkuFe.js","assets/u-check-circle-BqoIxNz_.js","assets/terminal-BmT0_gIH.js","assets/vendor~terminal-aeP3PnKf.js","assets/vendor~terminal-T4IDBjWs.css","assets/square-chevron-right-Czw3FFWc.js","assets/command-store-D8J5LMW1.js"])))=>i.map(i=>d[i]);
2
+ import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,St as n,_t as r,bt as i,et as a,gt as o,h as s,o as c,xt as l}from"./vendor-styling-CI0PQ3ab.js";import{A as u,L as d,M as f,k as p}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{n as m}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~i3v2mlbw-BrJQ3XZH.js";import{a as h,c as g,f as _,i as v,u as y}from"./path-utils-BeOmjIcE.js";import{n as b,r as x}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~d1e18dtv-5Q6lQJdE.js";import{t as S}from"./useMutation-DCE9RcgK.js";import{t as C}from"./useQuery-CpjHYtZc.js";import{t as w}from"./Trans-De9RwQhA.js";import{t as T}from"./useTranslation-Cgy4JA_g.js";import{t as E}from"./declaration-B9kpCaYl.js";import{A as D,j as O,k,n as A}from"./active-backend-context-u2tdYRgH.js";import{t as j}from"./createLucideIcon-CVAsW2Yo.js";import{a as M,c as ee,d as te,f as N,g as P,h as F,i as ne,l as re,m as ie,n as I,o as L,p as ae,r as R,s as oe,t as se,u as ce}from"./messages-D2oZb47Z.js";import{t as le}from"./check-Bvi71siz.js";import{n as ue,t as z}from"./vendor~root-layout~conversation-panel~conversation-CpiTHpHl.js";import{t as de}from"./copy-3JCw_XFB.js";import{t as fe}from"./external-link-D2zJjE9G.js";import{t as B}from"./list-todo-BfH6yYUK.js";import{t as pe}from"./loader-circle-BEykUKYG.js";import{t as me}from"./square-chevron-right-Czw3FFWc.js";import{t as he}from"./x-Cb0WAtak.js";import{A as ge,C as V,E as _e,I as ve,S as H,T as ye,b as be,c as xe,d as Se,h as Ce,l as we,o as Te,t as U,u as Ee,w as De,x as Oe}from"./utils-CE0lDWtb.js";import{t as ke}from"./common-Dh7OqABE.js";import{c as Ae,i as je}from"./agent-server-client-options-DVLRd9sw.js";import{t as Me}from"./proxy-CHmFkV16.js";import{t as Ne}from"./modal-backdrop-zVwfOJZr.js";import{n as Pe}from"./modal-body-Dcu5McCa.js";import{r as Fe}from"./base-modal-CC5Pp8CF.js";import{t as Ie}from"./brand-button-DKPMEKcW.js";import{t as Le}from"./loading-spinner-DHAIPZkP.js";import{n as Re}from"./navigation-context-DPs2G0X8.js";import{t as ze}from"./styled-tooltip-DsKsFjuq.js";import{r as Be,u as Ve}from"./dropdown-classes-CgQ45JmQ.js";import{_ as He,f as Ue,h as We,n as Ge,p as Ke,s as qe}from"./git-provider-icon-aQRcUVI-.js";import{t as Je}from"./react-DPDgL6du.js";import{n as Ye}from"./middleware-DYHYNAnP.js";import{i as Xe,s as Ze}from"./conversation-local-storage-F6zVMM--.js";import{t as W}from"./conversation-store-LptbOvKa.js";import{t as Qe}from"./modal-close-button-CTCX4nCH.js";import{r as $e}from"./use-settings-dX4fKUPF.js";import{t as et}from"./use-tracking-GtXCHmTv.js";import{t as tt}from"./v4-DbCkTSoU.js";import{a as nt,i as rt,t as it}from"./agent-server-conversation-service.api-BP73yONA.js";import{t as at}from"./use-is-authed-_dhQ2Xuj.js";import{c as ot,d as st,f as ct,i as lt,l as ut,n as dt,r as ft,s as pt,t as mt,u as ht}from"./sidebar-mobile-menu-toggle-B8k3qu84.js";import{t as gt}from"./use-click-outside-element-Bf4Omzot.js";import{t as _t}from"./use-create-conversation-D9OWYcte.js";import{r as vt,t as yt}from"./conversation-service.api-CqZcHr1c.js";import{n as bt,t as G}from"./context-menu-list-item-DBFzplWW.js";import{i as K,r as xt,t as St}from"./ellipsis-button-1BV9Sga8.js";import{t as Ct}from"./u-edit-DJ90xc8Z.js";import{t as wt}from"./skills-9cDZONKh.js";import{t as Tt}from"./use-user-conversation-6uOXFP95.js";import{t as Et}from"./conversation-state-store-B2Bp32XI.js";import{t as Dt}from"./copy-BLmGeJcd.js";import{r as Ot}from"./typography-YGPBGzOG.js";import{C as kt,D as At,E as jt,I as Mt,L as Nt,M as Pt,N as Ft,O as It,P as Lt,S as Rt,T as zt,V as Bt,_ as Vt,a as Ht,b as Ut,f as Wt,g as Gt,h as Kt,i as qt,j as Jt,k as Yt,m as Xt,n as Zt,o as Qt,p as $t,r as en,t as tn,v as nn,w as rn,x as an,y as on,z as sn}from"./llm-not-configured-banner-BrU5uHto.js";import{n as q,r as cn,t as J}from"./use-active-conversation-DI5S5M1w.js";import{t as Y}from"./use-agent-state-Buh3bQDh.js";import{a as ln,c as un,d as dn,f as fn,h as pn,l as mn,m as X,n as hn,p as gn,r as _n,s as vn,u as yn}from"./lesson-plan-BtrZUCuj.js";import{D as bn,c as xn,l as Sn,m as Cn,t as Z}from"./use-event-store-YSOxy9FC.js";import{t as wn}from"./command-store-D8J5LMW1.js";import{t as Tn}from"./use-runtime-is-ready-Diiq65Q-.js";import{r as En}from"./plan-components-j9X4AxYM.js";import{t as Dn}from"./use-breakpoint-B-O0lQ84.js";import{t as On}from"./use-task-list-CmWGElgb.js";import{t as kn}from"./vendor~conversation-panel~conversation~alert-banner-DHDkknt5.js";var An=j(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),jn=j(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),Mn=e=>!e.isLayoutDirty&&e.willUpdate(!1);function Nn(){let e=new Set,t=new WeakMap,n=()=>e.forEach(Mn);return{add:r=>{e.add(r),t.set(r,r.addEventListener(`willUpdate`,n))},remove:r=>{e.delete(r);let i=t.get(r);i&&(i(),t.delete(r)),n()},dirty:n}}var Q=i(),$=e(t(),1),Pn=(0,$.createContext)(null);function Fn(){let e=(0,$.useRef)(!1);return o(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function In(){let e=Fn(),[t,n]=(0,$.useState)(0),r=(0,$.useCallback)(()=>{e.current&&n(t+1)},[t]);return[(0,$.useCallback)(()=>a.postRender(r),[r]),t]}var Ln=e=>e===!0,Rn=e=>Ln(e===!0)||e===`id`,zn=({children:e,id:t,inherit:n=!0})=>{let i=(0,$.useContext)(r),a=(0,$.useContext)(Pn),[o,s]=In(),c=(0,$.useRef)(null),l=i.id||a;c.current===null&&(Rn(n)&&l&&(t=t?l+`-`+t:l),c.current={id:t,group:Ln(n)&&i.group||Nn()});let u=(0,$.useMemo)(()=>({...c.current,forceRender:o}),[s]);return(0,Q.jsx)(r.Provider,{value:u,children:e})},Bn={curAgentState:V.LOADING},Vn=Je(e=>({...Bn,setCurrentAgentState:t=>e({curAgentState:t}),reset:()=>e(Bn)})),Hn=`openhands-last-conversation-by-backend`;function Un(e,t){return t?`${e}::${t}`:e}function Wn(){if(typeof window>`u`)return{};try{let e=window.localStorage.getItem(Hn);if(!e)return{};let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n={};for(let[e,r]of Object.entries(t))typeof r==`string`&&r.length>0&&(n[e]=r);return n}catch{return{}}}function Gn(e){if(!(typeof window>`u`))try{window.localStorage.setItem(Hn,JSON.stringify(e))}catch{}}function Kn(e,t,n){if(!n)return;let r=Wn();r[Un(e,t)]=n,Gn(r)}function qn(e,t){let n=Wn(),r=Un(e,t);r in n&&(delete n[r],Gn(n))}var Jn=e=>({action:F.CHANGE_AGENT_STATE,args:{agent_state:e}}),Yn=e=>`error`in e,Xn=e=>`type`in e&&e.type===`error`,Zn=()=>{let{send:e}=ie(),t=Z(e=>e.events);$.useEffect(()=>{if(!t.length)return;let n=t[t.length-1];if(!(Sn(n)&&xn(n))){if(Yn(n)){if(n.error_code===401){D(`Session expired.`);return}typeof n.error==`string`?D(n.error):D(n.message);return}Xn(n)&&`${n.message??``}`.startsWith(`Agent reached maximum`)&&e(Jn(V.PAUSED))}},[t.length])},Qn=()=>{let{curAgentState:e}=Y();return{runtimeActive:!De.includes(e)}};function $n({children:e}){return Zn(),Qn(),e}var er=`ACPAuthRequired`,tr={ACPAuthRequired:E.ERROR$ACP_AUTH_REQUIRED_TITLE,ACPSpawnError:E.CHAT_INTERFACE$AGENT_ERROR_MESSAGE,ACPInitError:E.CHAT_INTERFACE$AGENT_ERROR_MESSAGE,ACPPromptError:E.CHAT_INTERFACE$AGENT_ERROR_MESSAGE,UsagePolicyRefusal:E.CHAT_INTERFACE$AGENT_ERROR_MESSAGE};function nr(e){return e?tr[e]??null:null}function rr(e){return e===er}var ir={entriesByConversation:{}},ar=(e,t,n)=>({entriesByConversation:{...e.entriesByConversation,[t]:n(e.entriesByConversation[t]??[])}}),or=Je()(Ye(e=>({...ir,addPending:(t,n)=>{let r=tt();return e(e=>ar(e,t,e=>[...e,{id:r,question:n,status:`pending`}])),r},resolve:(t,n,r)=>e(e=>ar(e,t,e=>e.map(e=>e.id===n?{...e,response:r,status:`done`}:e))),fail:(t,n,r)=>e(e=>ar(e,t,e=>e.map(e=>e.id===n?{...e,response:r,status:`error`}:e))),dismiss:(t,n)=>e(e=>ar(e,t,e=>e.filter(e=>e.id!==n)))}),{name:`BtwStore`}));function sr({onClick:e}){let{t}=T(`openhands`);return(0,Q.jsxs)(`button`,{type:`button`,onClick:e,className:`flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-normal text-success bg-success/10 hover:bg-success/20 border border-success/30 transition-colors`,children:[(0,Q.jsx)(te,{className:`w-3.5 h-3.5 fill-success`}),(0,Q.jsx)(`span`,{children:t(E.CHAT_INTERFACE$BTW_GOT_IT)})]})}function cr({conversationId:e}){let{t}=T(`openhands`),n=or(e=>e.entriesByConversation),r=or(e=>e.dismiss),i=e?n[e]??[]:[];return!e||i.length===0?null:(0,Q.jsx)(`div`,{"data-testid":`btw-messages`,className:`flex flex-col w-full`,children:i.map(n=>{let i=n.status===`pending`;return(0,Q.jsx)(N,{title:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`opacity-60`,children:t(E.CHAT_INTERFACE$BTW_PREFIX)}),(0,Q.jsx)(`span`,{children:n.question}),i&&(0,Q.jsx)(`span`,{"data-testid":`btw-spinner`,className:`inline-block w-3.5 h-3.5 ml-2 rounded-full border-2 border-transparent border-t-[var(--oh-border-input)] animate-spin`})]}),details:i?t(E.CHAT_INTERFACE$BTW_WAITING_FOR_ANSWER):n.response??``,initiallyExpanded:!i,chevronPosition:`before`,titleTrailing:!i&&(0,Q.jsx)(sr,{onClick:()=>r(e,n.id)})},n.id)})})}function lr({conversationId:e}){let t=gn(e=>e.statusByConversation),n=e?t[e]:void 0;return n?.active?(0,Q.jsx)(ce,{status:n}):null}var ur=`${_e} `,dr=(e,t)=>{let n=or(e=>e.addPending),r=or(e=>e.resolve),i=or(e=>e.fail);return(0,$.useCallback)(a=>{let o=a.trim(),s=o===`/btw`||o.startsWith(ur);if(!e||!s){t(a);return}let c=o.slice(_e.length).trim();if(!c)return;let l=n(e,c);v(e,c).then(({response:t})=>r(e,l,t)).catch(t=>i(e,l,t?.message??`Failed to ask agent`))},[e,t,n,r,i])},fr=`${ge} `,pr=/^--max(?:=|\s+)(\d+)\s*/,mr=(e,t)=>{let{t:n}=T();return(0,$.useCallback)(r=>{let i=r.trim(),a=i===`/goal`||i.startsWith(fr);if(!e||!a){t(r);return}let o=i.slice(ge.length).trim(),s,c=o.match(pr);c&&(s=parseInt(c[1],10),o=o.slice(c[0].length).trim());let l=o;if(!l){D(n(E.GOAL$OBJECTIVE_REQUIRED));return}let u={objective:l};s&&s>=1&&(u.max_iterations=s),y(e,u).catch(e=>{let t=n(E.GOAL$START_FAILED);D(e instanceof Error&&e.message?e.message:t)})},[e,t,n])},hr=`flex flex-row gap-1 items-center justify-center rounded-[100px]`;function gr(e){return U(hr,e?`bg-[var(--oh-surface)] hover:bg-tertiary cursor-pointer text-white`:`bg-[var(--oh-surface)] cursor-not-allowed opacity-50 text-[var(--oh-muted)]`)}function _r(e){return e?`white`:`var(--oh-muted)`}var vr=`font-normal text-sm leading-5 truncate`;function yr({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,isConversationReady:r=!0}){let{t:i}=T(`openhands`),{trackPullButtonClick:a}=et(),o=n&&t&&r;return(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{a(),e(xe())},disabled:!o,className:U(gr(o),`px-0.5 py-1 w-[76px] min-w-[76px]`),children:[(0,Q.jsx)(`div`,{className:`w-3 h-3 flex items-center justify-center`,children:(0,Q.jsx)(At,{width:12,height:12,color:_r(o)})}),(0,Q.jsx)(`div`,{className:U(vr,`max-w-[76px]`),title:i(E.COMMON$PULL),children:i(E.COMMON$PULL)})]})}function br({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,currentGitProvider:r,isConversationReady:i=!0}){let{t:a}=T(`openhands`),{trackPushButtonClick:o}=et(),s=n&&t&&i;return(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{o(),e(we(r))},disabled:!s,className:U(gr(s),`px-2 py-1 w-[77px] min-w-[77px]`),children:[(0,Q.jsx)(`div`,{className:`w-3 h-3 flex items-center justify-center`,children:(0,Q.jsx)(It,{width:12,height:12,color:_r(s)})}),(0,Q.jsx)(`div`,{className:U(vr,`max-w-[77px]`),title:a(E.COMMON$PUSH),children:a(E.COMMON$PUSH)})]})}function xr({onSuggestionsClick:e,hasRepository:t,providerTokensReady:n,currentGitProvider:r,isConversationReady:i=!0}){let{t:a}=T(`openhands`),{trackCreatePrButtonClick:o}=et(),s=n&&t&&i;return(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{o(),e(Te(r))},disabled:!s,className:U(gr(s),`px-2 py-1 w-[126px] min-w-[126px] h-7`),children:[(0,Q.jsx)(`div`,{className:`w-3 h-3 flex items-center justify-center`,children:(0,Q.jsx)(jt,{width:12,height:12,color:_r(s)})}),(0,Q.jsx)(`div`,{className:U(vr,`max-w-[126px]`),title:a(E.COMMON$PULL_REQUEST),children:a(E.COMMON$PULL_REQUEST)})]})}function Sr(e){return e.kind===`BashCommand`}function Cr(e){return e.kind===`BashOutput`}function wr(e){return e.kind===`BashError`}function Tr(e,t,n){let r=(0,$.useRef)(null),i=(0,$.useRef)([]),a=(0,$.useRef)([]),o=(0,$.useRef)(new Map);return(0,$.useEffect)(()=>{if(!n)return;let s=je(e,t),c=new WebSocket(s);r.current=c,c.onopen=()=>{for(let{command:e,cwd:t,timeout:n,resolve:r,reject:o}of i.current)a.current.push({resolve:r,reject:o}),c.send(JSON.stringify({command:e,cwd:t,timeout:n}));i.current=[]},c.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}if(Sr(t)){let e=a.current.shift();e&&o.current.set(t.id,{...e,stdout:[],stderr:[]})}else if(Cr(t)&&t.command_id){let e=o.current.get(t.command_id);e&&(t.stdout&&e.stdout.push(t.stdout),t.stderr&&e.stderr.push(t.stderr),t.exit_code!=null&&(o.current.delete(t.command_id),e.resolve({exit_code:t.exit_code,stdout:e.stdout.join(``),stderr:e.stderr.join(``)})))}else wr(t)&&l(`Bash error: ${t.code}: ${t.detail}`)};function l(e){let t=Error(e);for(let{reject:e}of i.current)e(t);i.current=[];for(let e of a.current)e.reject(t);a.current=[];for(let e of o.current.values())e.reject(t);o.current.clear()}return c.onclose=()=>{r.current=null,l(`Bash WebSocket closed`)},c.onerror=()=>{r.current=null,l(`Bash WebSocket error`)},()=>{c.onclose=null,c.onerror=null,c.close(),r.current=null,l(`Bash WebSocket unmounted`)}},[n,e,t]),(0,$.useCallback)((e,t,n)=>new Promise((o,s)=>{let c=r.current;if(!c||c.readyState===WebSocket.CLOSED||c.readyState===WebSocket.CLOSING){s(Error(`Bash WebSocket not available`));return}c.readyState===WebSocket.CONNECTING?i.current.push({command:e,cwd:t,timeout:n,resolve:o,reject:s}):(a.current.push({resolve:o,reject:s}),c.send(JSON.stringify({command:e,cwd:t,timeout:n})))}),[])}var Er={"github.com":`github`,"gitlab.com":`gitlab`,"bitbucket.org":`bitbucket`,"dev.azure.com":`azure_devops`};function Dr(e){return e.replace(/\.git$/,``)}function Or(e){return e?Er[e.toLowerCase()]??null:null}function kr(e){let t=e.split(`/`).filter(Boolean),n=t.indexOf(`_git`);return n===-1?t.join(`/`):[...t.slice(0,n),...t.slice(n+1)].join(`/`)}function Ar(e,t,n){let r=Dr(n.replace(/^\/+/,``)),i=Or(t);return{url:e,host:t,repository:(i===`azure_devops`?kr(r):r)||null,provider:i}}function jr(e){let t=e?.trim();if(!t)return null;let n=t.match(/^[^@\s]+@([^:\s]+):(.+)$/);if(n){let e=n[1];return Ar(t,e,n[2])}try{let e=new URL(t);return Ar(t,e.hostname||null,e.pathname)}catch{return null}}var Mr={repository:null,branch:null,provider:null,remoteUrl:null},Nr=[`r=$(git remote get-url origin 2>/dev/null)`,`b=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)`,`if [ -z "$r$b" ]; then`,`n=$(find . -mindepth 2 -maxdepth 4 -name .git 2>/dev/null | cut -c3- | sed 's|/.git$||' | sort -u)`,`c=$(printf '%s\\n' "$n" | grep -c '[^[:space:]]')`,`if [ "$c" = "1" ] && [ -n "$n" ]; then`,`r=$(git -C "$n" remote get-url origin 2>/dev/null)`,`b=$(git -C "$n" rev-parse --abbrev-ref HEAD 2>/dev/null)`,`fi`,`fi`,`printf '%s\\n%s' "$r" "$b"`].join(`
3
3
  `);async function Pr(e,t){let n=await e(Nr,t,10);if(n.exit_code!==0)return Mr;let r=n.stdout.indexOf(`
4
4
  `),i=(r>=0?n.stdout.slice(0,r):n.stdout).trim(),a=(r>=0?n.stdout.slice(r+1):``).trim(),o=a&&a!==`HEAD`?a:null;if(!i&&!o)return Mr;let s=jr(i);return{repository:s?.repository??null,provider:s?.provider??null,remoteUrl:i||null,branch:o}}var Fr=()=>{let{data:e}=J(),t=Tn(),{backend:n}=A(),r=n.kind===`local`,i=e?.id,a=e?.conversation_url,o=e?.session_api_key,s=e?.workspace?.working_dir?.trim(),c=!!e?.selected_repository,l=!!e?.git_provider,u=!!e?.selected_branch,d=r&&t&&!!i&&!!s&&(!c||!l||!u),f=Tr(a,o,d),p=(0,$.useRef)(f);return p.current=f,C({queryKey:[`local-git-info`,i,a,o,s],queryFn:async()=>Pr((e,t,n)=>p.current(e,t,n),s),enabled:d,retry:!1,staleTime:1e4,refetchInterval:1e4,gcTime:1e3*60*5,meta:{disableToast:!0}})},Ir=()=>{let e=m(),{t}=T(`openhands`);return S({mutationFn:e=>it.updateConversationRepository(e.conversationId,e.repository,e.branch,e.gitProvider),onMutate:async t=>{let n=[`user`,`conversation`,t.conversationId];await e.cancelQueries({queryKey:n});let r=e.getQueriesData({queryKey:n});return e.setQueriesData({queryKey:n},e=>e&&{...e,selected_repository:t.repository,selected_branch:t.branch??null,git_provider:t.gitProvider??null}),{previousEntries:r}},onError:(n,r,i)=>{i?.previousEntries.forEach(([t,n])=>{e.setQueryData(t,n)}),D(t(E.CONVERSATION$FAILED_TO_UPDATE_REPOSITORY))},onSuccess:()=>{O(t(E.CONVERSATION$REPOSITORY_UPDATED))},onSettled:(t,n,r)=>{e.invalidateQueries({queryKey:[`user`,`conversation`,r.conversationId]}),e.invalidateQueries({queryKey:[`user`,`conversations`]}),e.invalidateQueries({queryKey:[`local-git-info`,r.conversationId]})}})};function Lr({children:e,tooltipMessage:t,testId:n,shouldShowTooltip:r}){return r?(0,Q.jsx)(ze,{content:t,placement:`top`,showArrow:!0,tooltipClassName:`bg-white text-black`,children:(0,Q.jsx)(`span`,{"data-testid":n,className:`hover:opacity-100`,children:e})}):e}function Rr({isOpen:e,onClose:t,onLaunch:n,defaultProvider:r=`github`}){let{t:i}=T(`openhands`),{providers:a}=qe(),[o,s]=(0,$.useState)(null),[c,l]=(0,$.useState)(null),[u,d]=(0,$.useState)(null);(0,$.useEffect)(()=>{a.length===1&&!o?s(a[0]):a.length>1&&!o&&r&&a.includes(r)&&s(r)},[a,o,r]);let f=(0,$.useCallback)(e=>{e!==o&&(s(e),l(null),d(null))},[o]),p=(0,$.useCallback)(e=>{e?(l(e),d(null)):(l(null),d(null))},[]),m=(0,$.useCallback)(e=>{d(e)},[]),h=()=>{!c||!u||(n(c,u),l(null),d(null),t())},g=()=>{s(null),l(null),d(null),t()};if(!e)return null;let _=c?.git_provider||o||r,v=!!c&&!!u;return(0,Q.jsx)(Ne,{onClose:g,children:(0,Q.jsxs)(Pe,{width:`sm`,className:`relative items-start border border-[var(--oh-border)] !gap-4`,children:[(0,Q.jsx)(Qe,{onClose:g,testId:`close-open-repository-modal`}),(0,Q.jsx)(`div`,{className:`w-full pr-6`,children:(0,Q.jsx)(Fe,{title:i(E.CONVERSATION$OPEN_REPOSITORY)})}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 w-full`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsx)(`span`,{className:`text-sm text-white font-normal leading-[22px]`,children:i(E.CONVERSATION$SELECT_OR_INSERT_LINK)}),a.length>1&&(0,Q.jsx)(Qt,{providers:a,value:o,onChange:f})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-[10px] w-full`,children:[(0,Q.jsx)(qt,{provider:_,value:c?.id||null,repositoryName:c?.full_name||null,onChange:p,className:`w-full`}),(0,Q.jsx)(Ht,{repository:c?.full_name||null,provider:_,selectedBranch:u,onBranchSelect:m,defaultBranch:c?.main_branch||null,disabled:!c,className:`w-full`})]})]}),(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2 w-full`,onClick:e=>e.stopPropagation(),children:[(0,Q.jsx)(Ie,{type:`button`,variant:`secondary`,onClick:g,children:i(E.BUTTON$CANCEL)}),(0,Q.jsx)(Ie,{type:`button`,variant:`primary`,onClick:h,isDisabled:!v,children:i(E.BUTTON$LAUNCH)})]})]})})}function zr({onSuggestionsClick:e}){let{t}=T(`openhands`),{conversationId:n}=q(),[r,i]=(0,$.useState)(!1),[a,o]=(0,$.useState)(!1),s=(0,$.useRef)(null),{addRecentRepository:c}=Ge(),l=X(e=>e.enqueuePendingMessage),u=X(e=>e.markPendingMessageError),{backend:d}=A(),f=d.kind===`local`,{providers:p}=qe(),m=f||p.length>0,{data:h}=J(),{repositoryInfo:g}=Ft(),{data:_}=Fr(),v=sn(),y=_n()?.isLoadingHistory??!1,b=(0,$.useRef)(v);(0,$.useEffect)(()=>{b.current=v},[v]);let{send:x}=ie(),S=(0,$.useRef)(x);(0,$.useEffect)(()=>{S.current=x},[x]);let C=ee(),{mutate:w}=Ir(),{mutate:O,isPending:k}=_t(),j=h?.selected_repository||g?.selectedRepository,M=h?.git_provider||g?.gitProvider,te=h?.selected_branch||g?.selectedBranch,N=j||_?.repository||void 0,P=M||_?.provider,F=te||_?.branch||void 0,ne=(h?.id?nt(h.id):null)?.selected_workspace??null,re=ne&&ne.replace(/\/+$/,``).split(`/`).pop()||null,I=!!N&&!!P,L=!!h&&v===`OPEN`&&!y;(0,$.useEffect)(()=>{if(!a)return;let e=e=>{s.current&&!s.current.contains(e.target)&&o(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[a]),(0,$.useEffect)(()=>{if(!a)return;let e=e=>{e.key===`Escape`&&o(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[a]);let ae=(e,r)=>{n&&(c(e),w({conversationId:n,repository:e.full_name,branch:r.name,gitProvider:e.git_provider},{onSuccess:()=>{if(b.current!==`OPEN`){D(t(E.CONVERSATION$CLONE_COMMAND_FAILED_DISCONNECTED));return}let i=e.git_provider.charAt(0).toUpperCase()+e.git_provider.slice(1),a=`Clone ${e.full_name} from ${i} and checkout branch ${r.name}.`,o=n?l({conversationId:n,text:a}):null;C?.scrollDomToBottom(),Promise.resolve(S.current({action:`message`,args:{content:a,timestamp:new Date().toISOString()}})).catch(e=>{o&&u(o,e instanceof Error?e.message:t(E.CHAT_INTERFACE$FAILED_TO_SEND_MESSAGE))})}}))},R=!f||!!N||!!re,oe=f&&!I;return R||F||I?(0,Q.jsxs)(`div`,{className:`flex flex-row items-center`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-row gap-2.5 items-center overflow-x-auto flex-nowrap relative scrollbar-hide`,children:[R?(0,Q.jsx)(en,{selectedRepository:N,gitProvider:P,workspaceName:re,onClick:()=>i(!0),disabled:!L||oe}):null,F?(0,Q.jsx)(Zt,{selectedBranch:F,selectedRepository:N,gitProvider:P}):null,I?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Lr,{tooltipMessage:t(E.COMMON$GIT_TOOLS_DISABLED_CONTENT),testId:`git-control-bar-pull-button-tooltip`,shouldShowTooltip:!I,children:(0,Q.jsx)(yr,{onSuggestionsClick:e,hasRepository:I,providerTokensReady:m,isConversationReady:L})}),(0,Q.jsx)(Lr,{tooltipMessage:t(E.COMMON$GIT_TOOLS_DISABLED_CONTENT),testId:`git-control-bar-push-button-tooltip`,shouldShowTooltip:!I,children:(0,Q.jsx)(br,{onSuggestionsClick:e,hasRepository:I,providerTokensReady:m,currentGitProvider:P,isConversationReady:L})}),(0,Q.jsx)(Lr,{tooltipMessage:t(E.COMMON$GIT_TOOLS_DISABLED_CONTENT),testId:`git-control-bar-pr-button-tooltip`,shouldShowTooltip:!I,children:(0,Q.jsx)(xr,{onSuggestionsClick:e,hasRepository:I,providerTokensReady:m,currentGitProvider:P,isConversationReady:L})})]}):null]}),(0,Q.jsx)(Rr,{isOpen:r,onClose:()=>i(!1),onLaunch:ae,defaultProvider:P})]}):null}function Br({onSubmit:e,disabled:t=!1}){let{images:n,files:r,imagesMarkedUploadAsFile:i,clearAllFiles:a,subConversationTaskId:o}=W(),{curAgentState:s}=Y(),{data:c}=J(),{conversationId:l}=cn(),u=l??c?.id??null,{taskStatus:d}=Pt(o,c?.id||null),{handleUpload:f}=Wt(),p=Xt(u,mr(u,dr(u,t=>{let{imagesToEmbed:o,imagesAsFiles:s}=Bt(n,i);e(t,o,[...r,...s]),a()})));return(0,Q.jsxs)(`div`,{"data-testid":`interactive-chat-box`,children:[(0,Q.jsx)(Kt,{disabled:t||s===V.AWAITING_USER_CONFIRMATION||Ce(d),isNewConversationPending:t,onSubmit:p,onFilesPaste:f}),(0,Q.jsx)(`div`,{className:`mt-3 pb-3`,children:(0,Q.jsx)(zr,{onSuggestionsClick:e=>{p(e)}})})]})}function Vr(){let e=Z(e=>e.events),t=Z(e=>e.uiEvents),n=$.useMemo(()=>t.filter(un),[t]),r=$.useMemo(()=>e,[e]),i=$.useMemo(()=>n.length,[n]),a=$.useMemo(()=>r.some(e=>e.source===`agent`&&!bn(e)&&!Cn(e)),[r]),o=vn(r);return{storeEvents:e,uiEvents:t,renderableEvents:n,allConversationEvents:r,totalEvents:i,hasSubstantiveAgentActions:a,conversationUserEventsExist:o,userEventsExist:o}}var Hr=e=>`timestamp`in e?e.timestamp:void 0,Ur=e=>{let t=!!e&&Xe(e),n=t?void 0:e,{data:r}=Tt(e??null),{data:i,isFetched:a}=mn(n??void 0),o=Z(e=>e.addEvents),[s,c]=$.useState(!1),[l,u]=$.useState(!0),d=$.useRef(!1),f=$.useRef(!0);return $.useEffect(()=>{if(d.current=!1,c(!1),t){f.current=!1,u(!1);return}f.current=!0,u(!0)},[e,t]),$.useEffect(()=>{t||!a||!i||i.hasMore||(f.current=!1,u(!1))},[t,a,i?.hasMore,n]),{isLoading:s,hasMore:l,loadOlder:$.useCallback(async()=>{if(!e||Xe(e)||d.current||!f.current||!r)return;let{events:t}=Z.getState(),n=t[0];if(!n)return;let i=Hr(n);if(!i){f.current=!1,u(!1);return}d.current=!0,c(!0);try{let t=await dn.searchEvents(e,r?.conversation_url??null,r?.session_api_key??null,{limit:50,sortOrder:`TIMESTAMP_DESC`,timestampLt:i});if(!Array.isArray(t.items))throw Error(`Invalid older-events response: expected page.items to be an array.`);let n=[...t.items].reverse();n.length>0&&(o(n),ln(e,Z.getState().uiEvents)),(!t.next_page_id||t.items.length<50)&&(f.current=!1,u(!1))}finally{d.current=!1,c(!1)}},[e,r,r?.conversation_url,r?.session_api_key,o])}};function Wr(){return(0,Q.jsxs)(`div`,{className:`flex items-center space-x-1.5 rounded-full bg-[var(--oh-surface)] px-3 py-1.5`,children:[(0,Q.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-[var(--oh-muted)] animate-[bounce_0.5s_infinite] translate-y-[1px] [animation-delay:0ms]`}),(0,Q.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-[var(--oh-muted)] animate-[bounce_0.5s_infinite] translate-y-[1px] [animation-delay:75ms]`}),(0,Q.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-[var(--oh-muted)] animate-[bounce_0.5s_infinite] translate-y-[1px] [animation-delay:150ms]`})]})}function Gr({suggestion:e,onClick:t}){let{t:n}=T(`openhands`);return(0,Q.jsxs)(`button`,{type:`button`,className:`list-none border border-[var(--oh-border)] rounded-[15px] hover:bg-surface-raised hover:border-[var(--oh-interactive-hover)] transition-colors flex-1 flex items-center justify-center cursor-pointer gap-[10px] h-[55px] px-4`,onClick:()=>t(e.value),children:[(0,$.useMemo)(()=>{switch(e.label){case`INCREASE_TEST_COVERAGE`:return(0,Q.jsx)(zt,{width:24,height:24,color:`#fff`});case`AUTO_MERGE_PRS`:return(0,Q.jsx)(rn,{width:19,height:20,color:`#fff`});case`FIX_README`:return(0,Q.jsx)(kt,{width:24,height:24,color:`#fff`});case`CLEAN_DEPENDENCIES`:return(0,Q.jsx)(Rt,{width:24,height:24,color:`#fff`});default:return null}},[e]),(0,Q.jsx)(`span`,{"data-testid":`suggestion`,className:`text-[15px] font-normal leading-5 text-white text-center cursor-pointer`,children:n(e.label)})]})}function Kr({suggestions:e,onSuggestionClick:t}){return(0,Q.jsx)(`div`,{"data-testid":`suggestions`,className:`grid grid-cols-2 gap-5 max-w-fit`,children:e.map((e,n)=>(0,Q.jsx)(Gr,{suggestion:e,onClick:t},n))})}var qr=E.SUGGESTIONS$HACKER_NEWS,Jr=`Please write a bash script which displays the top story on Hacker News. It should show the title, the link, and the number of points.
5
5
  The script should only use tools that are widely available on unix systems, like curl and grep.`,Yr=E.SUGGESTIONS$HELLO_WORLD,Xr=`I want to create a Hello World app in Javascript that:
@@ -16,4 +16,4 @@ The script should only use tools that are widely available on unix systems, like
16
16
 
17
17
  This should be a client-only app with no backend. The list should persist in localStorage.`,$r={repo:an,"non-repo":{[qr]:Jr,[Yr]:Xr,[Zr]:Qr}};function ei({onSuggestionsClick:e}){let{t}=T(`openhands`),{shouldHideSuggestions:n}=W();return(0,Q.jsx)(s,{children:!n&&(0,Q.jsxs)(z.div,{"data-testid":`chat-suggestions`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3,ease:`easeInOut`},className:`pointer-events-auto absolute inset-x-4 bottom-[151px] top-0 flex flex-col items-center justify-center md:inset-x-8`,children:[(0,Q.jsx)(`div`,{className:`flex flex-col items-center p-4 rounded-xl w-full`,children:(0,Q.jsx)(`span`,{className:`pb-6 text-[32px] font-medium leading-5 text-white`,children:t(E.LANDING$TITLE)})}),(0,Q.jsx)(Kr,{suggestions:Object.entries($r.repo).slice(0,4).map(([e,t])=>({label:e,value:t})),onSuggestionClick:e})]})})}var ti={files:[],initialPrompt:null,selectedRepository:null,selectedRepositoryProvider:null,replayJson:null},ni=Je(e=>({...ti,addFile:t=>e(e=>({files:[...e.files,t]})),removeFile:t=>e(e=>({files:e.files.filter((e,n)=>n!==t)})),clearFiles:()=>e(()=>({files:[]})),setInitialPrompt:t=>e(()=>({initialPrompt:t})),clearInitialPrompt:()=>e(()=>({initialPrompt:null})),setSelectedRepository:t=>e(()=>({selectedRepository:t})),clearSelectedRepository:()=>e(()=>({selectedRepository:null})),setSelectedRepositoryProvider:t=>e(()=>({selectedRepositoryProvider:t})),setReplayJson:t=>e(()=>({replayJson:t})),reset:()=>e(()=>ti)})),ri=e=>(0,Q.jsx)(`svg`,{width:12,height:17,viewBox:`0 0 12 17`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,Q.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M11.5304 6.46978L10.4697 7.53044L6.75006 3.81077L6.75006 17.0001H5.25006L5.25006 3.81077L1.53039 7.53044L0.469727 6.46978L6.00006 0.939453L11.5304 6.46978Z`,fill:`currentColor`})});function ii({onClick:e}){return(0,Q.jsx)(`button`,{type:`button`,onClick:e,"data-testid":`scroll-to-bottom`,className:`flex items-center justify-center size-8 rounded-full bg-[var(--oh-surface)] text-[var(--oh-muted)] hover:bg-tertiary hover:text-white rotate-180 cursor-pointer transition-colors`,children:(0,Q.jsx)(ri,{width:15,height:15})})}var ai=[{width:`w-[25%]`,height:`h-4`,align:`justify-end`},{width:`w-[60%]`,height:`h-4`,align:`justify-start`},{width:`w-[45%]`,height:`h-4`,align:`justify-start`},{width:`w-[65%]`,height:`h-20`,align:`justify-start`},{width:`w-[35%]`,height:`h-4`,align:`justify-end`},{width:`w-[50%]`,height:`h-4`,align:`justify-start`},{width:`w-[30%]`,height:`h-4`,align:`justify-end`},{width:`w-[75%]`,height:`h-4`,align:`justify-start`},{width:`w-[55%]`,height:`h-4`,align:`justify-start`}];function oi({width:e,height:t}){return(0,Q.jsx)(`div`,{className:U(`rounded-md bg-foreground/5 animate-pulse`,e,t)})}function si(){let{t:e}=T(`openhands`);return(0,Q.jsx)(`div`,{className:`flex flex-col gap-6 p-4 w-full h-full overflow-hidden`,"data-testid":`chat-messages-skeleton`,"aria-label":e(E.CHAT_INTERFACE$LOADING_CONVERSATION),children:ai.map((e,t)=>(0,Q.jsx)(`div`,{className:U(`flex w-full`,e.align),children:(0,Q.jsx)(oi,{width:e.width,height:e.height})},t))})}var ci=220;function li({message:e,code:t,onDismiss:n,onRetry:r,onReauth:i}){let{t:a,i18n:o}=T(`openhands`),s=nr(t),[c,l]=$.useState(!1),[u,d]=$.useState(!1),[f,p]=$.useState(!1),m=$.useRef(null),h=o.exists(e,{ns:`openhands`}),g=h?String(a(e)):e,_=g.length>ci,v=_&&!c;return $.useEffect(()=>{if(!f)return;let e=setTimeout(()=>{p(!1)},2e3);return()=>clearTimeout(e)},[f]),$.useEffect(()=>{p(!1)},[g]),$.useLayoutEffect(()=>{let e=m.current;if(!e)return;let t=()=>{let t=Number.parseFloat(getComputedStyle(e).lineHeight);if(!Number.isFinite(t)||t<=0){d(!1);return}d(e.getBoundingClientRect().height>t*1.5)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[g,v,c,e]),(0,Q.jsxs)(`div`,{className:U(`flex w-full gap-2 rounded-lg border border-[var(--oh-border)] bg-[var(--oh-surface-raised)] p-2 text-[var(--oh-foreground)]`,u?`items-start`:`items-center`),"data-testid":`error-message-banner`,children:[(0,Q.jsx)(x,{"aria-hidden":!0,className:`h-4 w-4 shrink-0`,strokeWidth:2,style:{color:ve},"data-testid":`error-message-banner-icon`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[s&&(0,Q.jsx)(`div`,{className:`text-sm font-medium text-[var(--oh-foreground)]`,"data-testid":`error-message-banner-header`,children:a(s)}),(0,Q.jsx)(`div`,{ref:m,className:U(`whitespace-pre-wrap break-words text-sm text-[var(--oh-muted)]`,v&&`line-clamp-3`),"data-testid":`error-message-banner-content`,children:h?(0,Q.jsx)(w,{ns:`openhands`,i18nKey:e}):e}),i&&(0,Q.jsx)(`button`,{type:`button`,onClick:i,className:`mt-2 cursor-pointer rounded-md border border-[var(--oh-border)] px-2 py-1 text-xs font-normal text-[var(--oh-foreground)] hover:bg-[var(--oh-interactive-hover)]`,"data-testid":`error-message-banner-reauth`,children:a(E.ERROR$ACP_UPDATE_CREDENTIALS)}),_&&(0,Q.jsx)(`button`,{type:`button`,className:`mt-1 cursor-pointer text-xs font-normal text-[var(--oh-foreground)] underline`,onClick:()=>l(e=>!e),"data-testid":`error-message-banner-toggle`,children:a(c?E.COMMON$VIEW_LESS:E.COMMON$VIEW_MORE)})]}),(0,Q.jsxs)(`div`,{className:U(`flex shrink-0 gap-1`,u?`self-start`:`items-center`),children:[r&&(0,Q.jsx)(`button`,{type:`button`,onClick:r,className:`cursor-pointer rounded-md border border-[var(--oh-border)] px-2 py-1 text-xs font-normal text-[var(--oh-foreground)] hover:bg-[var(--oh-interactive-hover)]`,"data-testid":`error-message-banner-retry`,children:a(E.CHAT_INTERFACE$MESSAGE_RETRY)}),(0,Q.jsx)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(g),p(!0)}catch{D(a(E.CHAT_INTERFACE$CHAT_MESSAGE_COPY_FAILED))}},className:`shrink-0 cursor-pointer rounded-md p-1 text-[var(--oh-muted)] hover:bg-[var(--oh-interactive-hover)] hover:text-[var(--oh-foreground)]`,"aria-label":a(f?E.BUTTON$COPIED:E.BUTTON$COPY),"data-testid":`error-message-banner-copy`,children:f?(0,Q.jsx)(le,{className:`h-4 w-4`,"aria-hidden":!0}):(0,Q.jsx)(de,{className:`h-4 w-4`,"aria-hidden":!0})}),n&&(0,Q.jsx)(`button`,{type:`button`,onClick:n,className:`shrink-0 cursor-pointer rounded-md p-1 text-[var(--oh-muted)] hover:bg-[var(--oh-interactive-hover)] hover:text-[var(--oh-foreground)]`,"aria-label":a(E.BUTTON$CLOSE),"data-testid":`error-message-banner-dismiss`,children:(0,Q.jsx)(he,{className:`h-4 w-4`,"aria-hidden":!0})})]})]})}function ui(){let{t:e}=T(`openhands`),{conversationId:t}=cn(),n=X(e=>e.pendingMessages),r=X(e=>e.markPendingMessageError),i=X(e=>e.markPendingMessageSending),a=X(e=>e.removePendingMessage),o=W(e=>e.restoreMessageToInputIfEmpty),{send:s}=ie(),c=$.useMemo(()=>t?n.filter(e=>Lt(t,e.conversationId)):[],[n,t]),l=$.useCallback(async t=>{let n=X.getState().pendingMessages.find(e=>e.id===t);if(n){i(t);try{await s(ae(n.text,n.imageUrls,n.fileUrls,n.timestamp))}catch(n){r(t,n instanceof Error?n.message:e(E.CHAT_INTERFACE$FAILED_TO_SEND_MESSAGE))}}},[s,r,i,e]),u=$.useCallback((e,t)=>{o(t),a(e)},[o,a]);return c.length===0?null:(0,Q.jsx)(Q.Fragment,{children:c.map(e=>(0,Q.jsx)(ne,{type:`user`,message:e.text,pendingStatus:e.status,onRetry:e.status===`error`?()=>l(e.id):void 0,onStop:e.status===`sending`?()=>u(e.id,e.text):void 0,children:e.imageUrls.length>0&&(0,Q.jsx)(I,{size:`small`,images:e.imageUrls})},e.id))})}var di=()=>{let{data:e}=J();return S({mutationKey:[`unified-upload-files`],mutationFn:async t=>{let{conversationId:n,files:r}=t;return vt(n,r,e)},meta:{disableToast:!0}})},fi=e=>(0,Q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,Q.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 3.25C9.92893 3.25 8.25 4.92893 8.25 7V10H7C6.44772 10 6 10.4477 6 11V19C6 19.5523 6.44772 20 7 20H17C17.5523 20 18 19.5523 18 19V11C18 10.4477 17.5523 10 17 10H15.75V7C15.75 4.92893 14.0711 3.25 12 3.25ZM14.25 10V7C14.25 5.75736 13.2426 4.75 12 4.75C10.7574 4.75 9.75 5.75736 9.75 7V10H14.25Z`,fill:`currentColor`})});function pi(){let{t:e}=T(`openhands`),{data:t}=$e();return t?.confirmation_mode?(0,Q.jsx)(ze,{closeDelay:100,content:e(E.COMMON$CONFIRMATION_MODE_ENABLED),tooltipClassName:`bg-white text-black hover:bg-transparent`,children:(0,Q.jsx)(`div`,{className:`flex items-center justify-center w-[26px] h-[26px] rounded-lg bg-[var(--oh-surface)]`,children:(0,Q.jsx)(fi,{width:15,height:15})})}):null}var mi=e=>(0,Q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,Q.jsx)(`path`,{d:`M15 12C15 12.7956 14.6839 13.5587 14.1213 14.1213C13.5587 14.6839 12.7956 15 12 15C11.2044 15 10.4413 14.6839 9.87868 14.1213C9.31607 13.5587 9 12.7956 9 12C9 11.2044 9.31607 10.4413 9.87868 9.87868C10.4413 9.31607 11.2044 9 12 9C12.7956 9 13.5587 9.31607 14.1213 9.87868C14.6839 10.4413 15 11.2044 15 12Z`,fill:`currentColor`})});function hi({status:e,statusColor:t}){return(0,Q.jsx)(`div`,{"data-testid":`chat-status-indicator`,className:c(`w-full max-w-full rounded-[100px] p-1 bg-[var(--oh-surface)] flex items-center gap-1`),children:(0,Q.jsxs)(s,{mode:`wait`,children:[(0,Q.jsx)(z.span,{className:`flex-shrink-0 animate-[pulse_1.2s_ease-in-out_infinite]`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},children:(0,Q.jsx)(mi,{className:`w-4 h-4`,color:t})},`dot-${e}`),(0,Q.jsx)(z.span,{initial:{opacity:0,y:-2},animate:{opacity:1,y:0},exit:{opacity:0,y:2},transition:{duration:.3},className:`pr-1.5 font-normal text-[11px] leading-[16px] normal-case break-words whitespace-normal`,children:e},`text-${e}`)]})})}var gi=()=>{let e=m(),{navigate:t}=Re(),{t:n}=T(`openhands`),{data:r}=J(),{trackConversationCreated:i}=et();return S({mutationFn:async()=>{if(!r?.id)throw Error(`No active conversation`);let e=await it.createConversation(void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,r.sandbox_id??void 0);if(e.status===`ERROR`)throw Error(e.detail||`Failed to create new conversation`);return{newConversationId:e.app_conversation_id?e.app_conversation_id:`task-${e.id}`,oldConversationId:r.id,taskId:e.id}},onMutate:()=>{b.loading(n(E.CONVERSATION$CLEARING),{...k,id:`clear-conversation`})},onSuccess:r=>{i({conversationId:r.newConversationId,taskId:r.taskId,hasRepository:!1,hasWorkspace:!1,hasInitialQuery:!1,hasParentConversation:!1,entryPoint:`new_command`}),b.dismiss(`clear-conversation`),O(n(E.CONVERSATION$CLEAR_SUCCESS)),t(`/conversations/${r.newConversationId}`),e.invalidateQueries({queryKey:[`user`,`conversations`]}),e.invalidateQueries({queryKey:[`v1-batch-get-app-conversations`]})},onError:e=>{b.dismiss(`clear-conversation`);let t=n(E.CONVERSATION$CLEAR_UNKNOWN_ERROR);e instanceof Error?t=e.message:typeof e==`string`&&(t=e),D(n(E.CONVERSATION$CLEAR_FAILED,{error:t}))}})};function _i(e,t){return e?`github`:t?`replay`:`direct`}function vi(){let{trackInitialQuerySubmitted:e,trackUserMessageSent:t}=et(),{setMessageToSend:n}=W(),{errorMessage:r,errorCode:i,removeErrorMessage:a,setErrorMessage:o}=pn(),s=f(),{isTask:c,taskStatus:l,taskDetail:u}=Ft(),d=c,p=_n(),{send:m}=ie(),{renderableEvents:h,allConversationEvents:g,totalEvents:_,hasSubstantiveAgentActions:v,userEventsExist:y}=Vr(),b=X(e=>e.enqueuePendingMessage),x=X(e=>e.markPendingMessageError),S=X(e=>e.pendingMessages),{t:C}=T(`openhands`),w=$.useRef(null),{scrollDomToBottom:O,onChatBodyScroll:k,hitBottom:A,autoScroll:j,setAutoScroll:M,setHitBottom:ee}=En(w),{mutate:te,isPending:N}=gi(),{curAgentState:P}=Y(),{handleBuildPlanClick:F}=L(),{data:ne}=J(),I=ne?.sandbox_status??null,R=on(),{isConfigured:ce,isLoading:le}=$t(),ue=!le&&!ce,z=P===V.RUNNING||P===V.LOADING;$.useEffect(()=>{if(z)return;let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),F(e),O())};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[z,F,O]);let{selectedRepository:de,replayJson:fe}=ni(),{conversationId:B}=cn(),pe=gn(e=>{let t=B?e.statusByConversation[B]:void 0;return t?.active?`${t.iteration}:${t.status}`:null}),{mutateAsync:me}=di(),{isLoading:he,hasMore:ge,loadOlder:_e}=Ur(B),ve=$.useRef(null),H=$.useCallback(e=>{if(d||he||!ge)return;let t=e.scrollTop<=80,n=e.scrollHeight<=e.clientHeight+80;!t&&!n||(ve.current={scrollHeight:e.scrollHeight,scrollTop:e.scrollTop},_e().catch(e=>{ve.current=null,o(e instanceof Error&&e.message?e.message:C(E.ERROR$GENERIC))}))},[ge,he,d,_e,o,C]),ye=$.useCallback(e=>{e.deltaY<0&&e.currentTarget.scrollTop<=0&&H(e.currentTarget)},[H]),be=$.useMemo(()=>B?S.some(e=>Lt(B,e.conversationId)):!1,[S,B]),xe=g.length>0||be||!p?.isLoadingHistory,Ce=!!B,we=!xe&&!c,Te=fn(e=>B?(e.entriesByConversation[B]?.length??0)>0:!1),U=async(r,i,a)=>{if(r.trim()===`/new`){if(!B){D(C(E.CONVERSATION$CLEAR_NO_ID));return}if(_===0){D(C(E.CONVERSATION$CLEAR_EMPTY));return}if(N)return;te();return}let o=[...i],s=[...a];_===0?e({entryPoint:_i(de!==null,fe!==null),queryCharacterLength:r.length,replayJsonSize:fe?.length}):t({sessionMessageCount:_,currentMessageLength:r.length});let c=Mt([...o,...s]);if(!c.isValid){D(`Error: ${c.errorMessage}`);return}let l=o.map(e=>Nt(e)),u=await Promise.all(l),d=new Date().toISOString(),{skipped_files:f,uploaded_files:p}=s.length>0?await me({conversationId:B,files:s}):{skipped_files:[],uploaded_files:[]};f.forEach(e=>D(e.reason));let h=`${C(E.CHAT_INTERFACE$AUGMENTED_PROMPT_FILES_TITLE)}: ${p.join(`
18
18
 
19
- `)}`,g=p.length>0?`${r}\n\n${h}`:r,v=b({conversationId:B,text:r,content:g,imageUrls:u,fileUrls:p,timestamp:d});O(),n(``);try{await m(ae(g,u,p,d))}catch(e){x(v,e instanceof Error?e.message:C(E.CHAT_INTERFACE$FAILED_TO_SEND_MESSAGE))}};$.useEffect(()=>{if(ve.current&&w.current){let{scrollHeight:e,scrollTop:t}=ve.current,n=w.current,r=n.scrollHeight-e;r>0&&(n.scrollTop=t+r),ve.current=null;return}j&&O()},[h.length,be,pe,O]);let De=$.useRef(H);$.useEffect(()=>{De.current=H}),$.useEffect(()=>{let e=w.current;e&&De.current(e)},[h.length,ge]);let Oe={scrollRef:w,autoScroll:j,setAutoScroll:M,scrollDomToBottom:O,hitBottom:A,setHitBottom:ee,onChatBodyScroll:k},ke=P===V.LOADING||P===V.INIT,Ae=P===V.STOPPED,je=P===V.PAUSED,Me=Ee({isPausing:je,isTask:c,taskStatus:l,isStartingStatus:ke,isStopStatus:Ae,curAgentState:P}),Ne=Se({isPausing:je,isTask:c,taskStatus:l,taskDetail:u,isStartingStatus:ke,isStopStatus:Ae,curAgentState:P,errorMessage:r,t:C});return(0,Q.jsx)(oe,{value:Oe,children:(0,Q.jsxs)(`div`,{className:`relative flex h-full flex-col justify-between px-4`,"data-testid":`chat-interface`,children:[!v&&!be&&!y&&!Te&&!we&&!d&&_===0&&!R&&!ue&&(0,Q.jsx)(ei,{onSuggestionsClick:e=>n(e)}),(0,Q.jsxs)(`div`,{ref:w,"data-testid":`chat-scroll-container`,onScroll:e=>{k(e.currentTarget),H(e.currentTarget)},onWheel:ye,className:`custom-scrollbar-always flex min-h-0 grow flex-col gap-2 overflow-x-hidden overflow-y-auto px-0 pt-4 pb-8 md:px-4`,children:[we&&Ce&&(0,Q.jsx)(si,{}),we&&!Ce&&(0,Q.jsx)(`div`,{className:`flex justify-center`,"data-testid":`loading-spinner`,children:(0,Q.jsx)(Le,{size:`small`})}),he&&(0,Q.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-3 text-sm text-neutral-400`,"data-testid":`loading-older-events`,children:[(0,Q.jsx)(Le,{size:`small`}),(0,Q.jsx)(`span`,{children:C(E.CHAT_INTERFACE$FETCHING_OLDER_MESSAGES)})]}),(0,Q.jsx)(re,{conversationId:B,anchorEventId:null}),xe&&h.length>0&&(0,Q.jsx)(se,{messages:h,allEvents:g}),(0,Q.jsx)(ui,{}),(0,Q.jsx)(lr,{conversationId:B})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-[6px] pb-4`,children:[(0,Q.jsx)(cr,{conversationId:B}),r&&(0,Q.jsx)(li,{message:r,code:i,onDismiss:a,onRetry:r===`Unable to connect to server`?()=>p?.reconnect():void 0,onReauth:rr(i)?()=>s(`/settings/agents`):void 0}),ue&&!R&&(0,Q.jsx)(tn,{}),R?(0,Q.jsxs)(`div`,{"data-testid":`archived-conversation-banner`,className:`mx-1 px-4 py-3 rounded-lg bg-[var(--oh-surface)] border border-[var(--oh-border-subtle)]`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-semibold text-[var(--oh-foreground)]`,children:C(I===`ERROR`?E.CHAT_INTERFACE$ERROR_SANDBOX_TITLE:E.CHAT_INTERFACE$ARCHIVED_SANDBOX_TITLE)}),(0,Q.jsx)(`p`,{className:`text-xs text-[var(--oh-muted)] mt-0.5`,children:C(I===`ERROR`?E.CHAT_INTERFACE$ERROR_SANDBOX_DESCRIPTION:E.CHAT_INTERFACE$ARCHIVED_SANDBOX_DESCRIPTION)})]}):(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-full mb-1 z-20`,children:(0,Q.jsxs)(`div`,{className:`flex justify-between relative`,children:[(0,Q.jsxs)(`div`,{className:`flex items-end gap-1 pointer-events-auto`,children:[(0,Q.jsx)(pi,{}),ke&&(0,Q.jsx)(hi,{statusColor:Me,status:Ne})]}),A?P===V.RUNNING&&(0,Q.jsx)(`div`,{className:`absolute left-1/2 transform -translate-x-1/2 bottom-0 pointer-events-auto`,children:(0,Q.jsx)(Wr,{})}):(0,Q.jsx)(`div`,{className:`absolute left-1/2 transform -translate-x-1/2 bottom-0 pointer-events-auto`,children:(0,Q.jsx)(ii,{onClick:O})})]})}),(0,Q.jsx)(Br,{onSubmit:U,disabled:N||ue})]})]})]})})}function yi({isRightPanelShown:e}){return(0,Q.jsx)(`div`,{className:`flex justify-center w-full h-full`,children:(0,Q.jsx)(`div`,{className:`w-full min-w-0 max-w-[800px] h-full flex flex-col min-h-0 transition-all duration-300 ease-in-out`,children:(0,Q.jsx)(vi,{})})})}function bi({children:e}){return(0,Q.jsx)(`div`,{className:`absolute inset-0`,children:e})}function xi({children:e}){return(0,Q.jsx)(`div`,{className:`flex flex-col h-full w-full`,children:e})}function Si({children:e}){return(0,Q.jsx)(`div`,{className:`overflow-hidden flex-grow h-full w-full relative`,children:e})}function Ci({className:e}){let{t}=T(`openhands`);return(0,Q.jsxs)(`div`,{className:U(`bg-[var(--oh-surface)] flex h-full w-full flex-col items-center justify-center gap-3`,e),children:[(0,Q.jsx)(pe,{className:`h-8 w-8 shrink-0 animate-spin text-tertiary-light`,"aria-hidden":!0}),(0,Q.jsx)(M,{as:`p`,role:`status`,"aria-live":`polite`,className:`block w-full text-center text-base font-normal leading-5`,duration:1,spread:2,children:t(E.HOME$LOADING)})]})}function wi({children:e,onReady:t}){return(0,$.useLayoutEffect)(()=>{t()},[t]),e}function Ti({onPending:e}){return(0,$.useLayoutEffect)(()=>{e()},[e]),(0,Q.jsx)(Ci,{})}var Ei={duration:.35,ease:`easeInOut`};function Di({showAgentLoading:e,tabKey:t,children:n}){let r=P(),[i,a]=(0,$.useState)(!1);(0,$.useLayoutEffect)(()=>{a(!1)},[t]);let o=(0,$.useCallback)(()=>{a(!0)},[]),c=(0,$.useCallback)(()=>{a(!1)},[]),l=e||i;return r?(0,Q.jsx)(`div`,{className:`relative h-full w-full overflow-hidden`,children:l?(0,Q.jsx)(Ci,{}):(0,Q.jsx)($.Suspense,{fallback:(0,Q.jsx)(Ti,{onPending:o}),children:(0,Q.jsx)(wi,{onReady:c,children:n})})}):(0,Q.jsxs)(`div`,{className:`relative h-full w-full overflow-hidden`,children:[(0,Q.jsx)(z.div,{className:`absolute inset-0 h-full w-full`,initial:!1,animate:{opacity:+!l},transition:Ei,"aria-hidden":l,children:(0,Q.jsx)($.Suspense,{fallback:(0,Q.jsx)(Ti,{onPending:o}),children:(0,Q.jsx)(wi,{onReady:c,children:n})})}),(0,Q.jsx)(s,{children:l?(0,Q.jsx)(z.div,{className:`absolute inset-0 z-10 h-full w-full`,initial:{opacity:1},animate:{opacity:1},exit:{opacity:0},transition:Ei,children:(0,Q.jsx)(Ci,{})},`conversation-tab-loading-overlay`):null})]})}var Oi=(0,$.lazy)(()=>n(()=>import(`./files-tab-DHqtsKLy.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61]))),ki=(0,$.lazy)(()=>n(()=>import(`./browser-tab-aiDg7aEn.js`),__vite__mapDeps([62,2,1,63,7,8,18,64,13,42,10,11,65,26]))),Ai=(0,$.lazy)(()=>n(()=>import(`./planner-tab-G4j36bJk.js`),__vite__mapDeps([66,1,2,67,7,8,18,42,10,11,44,22,20,21,23,24,45,13,19,25,46,47,48,68,69,70,71,3,4,5,6,9,72,73,74,15,16,30,27,28,14,29,31,32,33,34,35,36,75,76,77,78,79,80,49,50,51,52,81,82,26,60]))),ji=(0,$.lazy)(()=>n(()=>import(`./task-list-tab-BAThr9Ex.js`),__vite__mapDeps([83,1,2,8,18,42,10,11,84,37,26,85,86,40,41]))),Mi=(0,$.lazy)(()=>n(()=>import(`./terminal-B0aL_iDZ.js`),__vite__mapDeps([87,1,2,88,89,90,7,8,18,38,39,10,11,40,41,42,53,49,50,4,14,27,3,5,6,9,28,29,30,31,32,33,34,35,36,51,52,15,16,54,26,91]))),Ni={tasklist:{component:ji},files:{component:Oi},browser:{component:ki},terminal:{component:Mi},planner:{component:Ai}};function Pi(){let{selectedTab:e,shouldShownAgentLoading:t}=W(),{conversationId:n}=q(),r=(0,$.useMemo)(()=>Ni[e]??Ni.files,[e]).component,i=e===`terminal`?`${e}-${n}`:e??`files`;return(0,Q.jsx)(xi,{children:(0,Q.jsx)(Si,{children:(0,Q.jsx)(Di,{showAgentLoading:t,tabKey:i,children:(0,Q.jsx)(bi,{children:(0,Q.jsx)(r,{})},i)})})})}var Fi=()=>{let e=m(),t=pn(e=>e.removeErrorMessage);return S({mutationKey:[`start-conversation`],mutationFn:async e=>g(e.conversationId),onMutate:async()=>(await e.cancelQueries({queryKey:[`user`,`conversations`]}),{previousConversations:e.getQueryData([`user`,`conversations`])}),onError:(t,n,r)=>{r?.previousConversations&&e.setQueryData([`user`,`conversations`],r.previousConversations)},onSettled:(t,n,r)=>{h(e,r.conversationId)},onSuccess:(n,r)=>{t(),_(e,r.conversationId,ke.RUNNING)}})},Ii=e=>(0,Q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,Q.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22ZM10 9H14A1 1 0 0 1 15 10V14A1 1 0 0 1 14 15H10A1 1 0 0 1 9 14V10A1 1 0 0 1 10 9Z`,fill:`currentColor`})}),Li=e=>(0,Q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:[(0,Q.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12.9 1.50004C15.3 1.65004 17.55 2.85004 19.2 4.50004C21.15 6.60004 22.2 9.15004 22.2 12.15C22.2 14.55 21.3 16.8 19.8 18.75C18.3 20.55 16.2 21.9 13.8 22.35C11.4 22.8 9 22.5 6.9 21.3C4.8 20.1 3.15 18.3 2.25 16.05C1.35 13.8 1.2 11.25 1.95 9.00004C2.7 6.60004 4.05 4.65004 6.15 3.30004C8.1 1.95004 10.5 1.35004 12.9 1.50004ZM13.65 20.85C15.6 20.4 17.4 19.35 18.75 17.7C19.95 16.05 20.7 14.1 20.55 12C20.55 9.60004 19.65 7.20004 18 5.55004C16.5 4.05004 14.7 3.15004 12.6 3.00004C10.65 2.85004 8.55 3.30004 6.9 4.50004C5.25 5.70004 4.05 7.35004 3.45 9.45004C2.85 11.4 2.85 13.5 3.75 15.45C4.65 17.4 6 18.9 7.8 19.95C9.6 21 11.7 21.3 13.65 20.85Z`,fill:`currentColor`}),(0,Q.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M9 7.49998L10.1655 6.87598L16.9155 11.376V12.624L10.1655 17.124L9 16.5V7.49998ZM10.5 8.90098V15.099L15.1485 12L10.5 8.90098Z`,fill:`currentColor`})]});function Ri({icon:e,text:t,onClick:n,testId:r}){return(0,Q.jsx)(G,{testId:r,onClick:n,children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 w-full items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,Q.jsx)(`span`,{className:Ve,"aria-hidden":!0,children:e})]})})}function zi({className:e=``,executionStatus:t,isPausing:n=!1}){let{curAgentState:r}=Y(),{isTask:i,taskStatus:a,taskDetail:o}=Ft(),{t:s}=T(`openhands`),{errorMessage:c}=pn(),l=r===V.LOADING||r===V.INIT,u=Oe(t)||H(t),d=Ee({isPausing:n,isTask:i,taskStatus:a,isStartingStatus:l,isStopStatus:u,curAgentState:r}),f=Se({isPausing:n,isTask:i,taskStatus:a,taskDetail:o,isStartingStatus:l,isStopStatus:u,curAgentState:r,errorMessage:c,t:s});return(0,Q.jsx)(`div`,{className:e,"data-testid":`server-status`,children:(0,Q.jsxs)(`div`,{className:`flex items-center`,children:[(0,Q.jsx)(mi,{className:`w-6 h-6 shrink-0`,color:d}),(0,Q.jsx)(`span`,{className:`text-[13px] text-white font-normal`,children:f})]})})}function Bi({onClose:e,onStopServer:t,onStartServer:n,executionStatus:r,position:i=`top`,className:a=``,isPausing:o=!1}){let{t:s}=T(`openhands`),c=gt(e),l=be(r),u=H(r),d=l||u;return(0,Q.jsxs)(bt,{ref:c,testId:`server-status-context-menu`,position:i,alignment:`left`,size:`default`,className:U(`left-2 w-fit min-w-42`,a),children:[(0,Q.jsx)(zi,{executionStatus:r,isPausing:o,className:`pl-0 pr-2 py-1`}),d&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(He,{inset:`menu`}),l&&t&&(0,Q.jsx)(Ri,{icon:(0,Q.jsx)(Ii,{width:18,height:18}),text:s(E.COMMON$STOP_RUNTIME),onClick:t,testId:`stop-server-button`}),u&&n&&(0,Q.jsx)(Ri,{icon:(0,Q.jsx)(Li,{width:18,height:18}),text:s(E.COMMON$START_RUNTIME),onClick:n,testId:`start-server-button`})]})]})}var Vi=e(l(),1);function Hi({isPublic:e,onToggle:t,ariaLabel:n}){return(0,Q.jsxs)(`label`,{className:`relative inline-flex shrink-0 cursor-pointer items-center`,children:[(0,Q.jsx)(`input`,{hidden:!0,type:`checkbox`,"data-testid":`share-publicly-button`,checked:e,"aria-label":n,onChange:e=>t(e.target.checked)}),(0,Q.jsx)(`span`,{"aria-hidden":!0,className:U(`inline-flex h-3.5 w-7 items-center rounded-full px-0.5 py-px transition-colors duration-200 ease-in-out`,e?`bg-white`:`bg-base-secondary`),children:(0,Q.jsx)(`span`,{className:U(`block h-2 w-2 shrink-0 rounded-full transition-transform duration-200 ease-in-out`,e?`translate-x-[calc(1rem-1px)] bg-base-secondary`:`translate-x-px bg-tertiary-light`)})})]})}function Ui({onClose:e,onRename:t,onDelete:n,onStop:r,onDisplayCost:i,onShowAgentTools:a,onShowSkills:o,onShowHooks:s,onTogglePublic:c,onCopyShareLink:l,onDownloadConversation:u,shareUrl:d,position:f=`bottom`,anchorRef:p}){let m=Dn(),{t:h}=T(`openhands`),{backend:g}=A(),{data:_}=J(),v=on(),y=gt(e),b=p?.current??null,[x,S]=$.useState();$.useLayoutEffect(()=>{if(!b)return;let e=()=>{let e=b.getBoundingClientRect();if(!e)return;let t={position:`fixed`,zIndex:9999};f===`top`?t.bottom=window.innerHeight-e.top+8:t.top=e.bottom+8,t.left=e.left,S(t)};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[b,f]);let C=!!(a||o||s),w=!!i,D=!!(r||n),O=g.kind===`cloud`?E.COMMON$CLOSE_CONVERSATION_STOP_RUNTIME:E.COMMON$STOP_CONVERSATION,k=g.kind===`cloud`&&!!c,j=_?.public||!1,M=!!b,ee=(0,Q.jsxs)(bt,{ref:y,testId:`conversation-name-context-menu`,position:f,alignment:`left`,className:U(m?`right-0 translate-x-[34%] left-auto`:``,M?`!static !top-auto !bottom-auto !left-auto !right-auto !mt-0`:``),children:[t&&(0,Q.jsx)(G,{testId:`rename-button`,onClick:t,children:(0,Q.jsx)(K,{icon:(0,Q.jsx)(Ct,{width:16,height:16}),text:h(E.BUTTON$RENAME)})}),C&&(0,Q.jsx)(He,{testId:`separator-tools`,inset:`menu`}),o&&(0,Q.jsx)(Ut,{isDisabled:v,children:(0,Q.jsx)(G,{testId:`show-skills-button`,onClick:o,isDisabled:v,children:(0,Q.jsx)(K,{icon:(0,Q.jsx)(wt,{width:16,height:16,className:`stroke-[1.75]`,"aria-hidden":!0}),text:h(E.CONVERSATION$SHOW_SKILLS)})})}),s&&(0,Q.jsx)(Ut,{isDisabled:v,children:(0,Q.jsx)(G,{testId:`show-hooks-button`,onClick:s,isDisabled:v,children:(0,Q.jsx)(K,{icon:(0,Q.jsx)(Yt,{width:16,height:16,"aria-hidden":!0}),text:h(E.CONVERSATION$SHOW_HOOKS)})})}),a&&(0,Q.jsx)(Ut,{isDisabled:v,children:(0,Q.jsx)(G,{testId:`show-agent-tools-button`,onClick:a,isDisabled:v,children:(0,Q.jsx)(K,{icon:(0,Q.jsx)(Ke,{width:16,height:16}),text:h(E.BUTTON$SHOW_AGENT_TOOLS_AND_METADATA)})})}),u&&(0,Q.jsx)(G,{testId:`download-trajectory-button`,onClick:u,children:(0,Q.jsx)(K,{icon:(0,Q.jsx)(ot,{width:16,height:16}),text:h(E.BUTTON$EXPORT_CONVERSATION)})}),(w||D)&&(0,Q.jsx)(He,{testId:`separator-info-control`,inset:`menu`}),i&&(0,Q.jsx)(G,{testId:`display-cost-button`,onClick:i,children:(0,Q.jsx)(K,{icon:(0,Q.jsx)(pt,{width:16,height:16}),text:h(E.BUTTON$DISPLAY_COST)})}),k&&c&&(0,Q.jsxs)(`li`,{className:`flex w-full items-center gap-2 rounded px-2 py-2 hover:bg-[var(--oh-interactive-hover)]`,children:[(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center text-[var(--oh-muted)]`,"aria-hidden":!0,children:(0,Q.jsx)(jn,{size:16})}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:h(E.CONVERSATION$SHARE_PUBLICLY)}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center`,children:[j&&d&&l&&(0,Q.jsxs)(`div`,{className:`mr-2 flex items-center gap-0.5`,children:[(0,Q.jsx)(`button`,{type:`button`,"data-testid":`copy-share-link-button`,onClick:l,className:`rounded p-0.5 text-[var(--oh-muted)] hover:bg-[var(--oh-interactive-selected)] hover:text-[var(--oh-foreground)] cursor-pointer [&_svg]:text-current`,title:h(E.BUTTON$COPY_TO_CLIPBOARD),children:(0,Q.jsx)(Dt,{width:14,height:14})}),(0,Q.jsx)(`a`,{"data-testid":`open-share-link-button`,href:d,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),className:`rounded p-0.5 text-[var(--oh-muted)] no-underline visited:text-[var(--oh-muted)] hover:bg-[var(--oh-interactive-selected)] hover:text-[var(--oh-foreground)] cursor-pointer [&_svg]:text-current`,title:h(E.BUTTON$OPEN_IN_NEW_TAB),children:(0,Q.jsx)(fe,{size:14,"aria-hidden":!0})})]}),(0,Q.jsx)(Hi,{isPublic:j,onToggle:c,ariaLabel:h(E.CONVERSATION$SHARE_PUBLICLY)})]})]}),r&&(0,Q.jsx)(Ut,{isDisabled:v,children:(0,Q.jsx)(G,{testId:`stop-button`,onClick:r,isDisabled:v,children:(0,Q.jsx)(K,{icon:(0,Q.jsx)(Ue,{width:16,height:16}),text:h(O)})})}),n&&(0,Q.jsx)(G,{testId:`delete-button`,onClick:n,children:(0,Q.jsx)(K,{icon:(0,Q.jsx)(xt,{width:16,height:16}),text:h(E.COMMON$DELETE_CONVERSATION)})})]});return M?typeof document>`u`||!x?null:Vi.createPortal((0,Q.jsx)(`div`,{style:x,children:ee}),document.body):ee}function Wi({onClose:e}){let{t}=T(`openhands`);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Qe,{onClose:e,testId:`close-metrics-modal`}),(0,Q.jsx)(`div`,{className:`w-full pr-6`,children:(0,Q.jsx)(Fe,{title:t(E.CONVERSATION$METRICS_INFO)})})]})}function Gi({currentCost:e,maxBudget:t}){let n=e/t*100;return(0,Q.jsx)(`div`,{className:`w-full h-1.5 bg-tertiary rounded-full overflow-hidden mt-1`,children:(0,Q.jsx)(`div`,{className:U(`h-full transition-all duration-300`,n>80?`bg-red-500`:`bg-blue-500`),style:{width:`${Math.min(100,n)}%`}})})}function Ki({currentCost:e,maxBudget:t}){let{t:n}=T(`openhands`),r=e/t*100;return(0,Q.jsx)(`div`,{className:`flex justify-end`,children:(0,Q.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:n(E.CONVERSATION$BUDGET_USAGE_FORMAT,{currentCost:`$${e.toFixed(4)}`,maxBudget:`$${t.toFixed(4)}`,usagePercentage:r.toFixed(2),used:n(E.CONVERSATION$USED)})})})}function qi({cost:e,maxBudgetPerTask:t}){let{t:n}=T(`openhands`);return e===null?null:(0,Q.jsx)(`div`,{className:`border-b border-[var(--oh-border-subtle)]`,children:t!==null&&t>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Gi,{currentCost:e,maxBudget:t}),(0,Q.jsx)(Ki,{currentCost:e,maxBudget:t})]}):(0,Q.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:n(E.CONVERSATION$NO_BUDGET_LIMIT)})})}function Ji({cost:e,maxBudgetPerTask:t}){let{t:n}=T(`openhands`);return e===null?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex justify-between items-center pb-2`,children:[(0,Q.jsx)(`span`,{className:`text-lg font-semibold`,children:n(E.CONVERSATION$TOTAL_COST)}),(0,Q.jsxs)(`span`,{className:`font-semibold`,children:[`$`,e.toFixed(4)]})]}),(0,Q.jsx)(qi,{cost:e,maxBudgetPerTask:t})]})}function Yi({label:e,value:t,labelClassName:n=``,valueClassName:r=`font-semibold`}){return(0,Q.jsxs)(`div`,{className:`flex justify-between items-center border-b border-[var(--oh-border-subtle)] pb-2`,children:[(0,Q.jsx)(`span`,{className:n,children:e}),(0,Q.jsx)(`span`,{className:r,children:t})]})}function Xi({usage:e}){let{t}=T(`openhands`);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Yi,{label:t(E.CONVERSATION$INPUT),value:e.prompt_tokens.toLocaleString()}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 pl-4 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-[var(--oh-muted)]`,children:t(E.CONVERSATION$CACHE_HIT)}),(0,Q.jsx)(`span`,{className:`text-right`,children:e.cache_read_tokens.toLocaleString()}),(0,Q.jsx)(`span`,{className:`text-[var(--oh-muted)]`,children:t(E.CONVERSATION$CACHE_WRITE)}),(0,Q.jsx)(`span`,{className:`text-right`,children:e.cache_write_tokens.toLocaleString()})]}),(0,Q.jsx)(Yi,{label:t(E.CONVERSATION$OUTPUT),value:e.completion_tokens.toLocaleString()}),(0,Q.jsx)(Yi,{label:t(E.CONVERSATION$TOTAL),value:(e.prompt_tokens+e.completion_tokens).toLocaleString(),labelClassName:`font-semibold`,valueClassName:`font-bold`})]})}function Zi({perTurnToken:e,contextWindow:t}){let{t:n}=T(`openhands`),r=t>0?e/t*100:0,i=Math.min(100,r);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,Q.jsx)(`span`,{className:`font-semibold`,children:n(E.CONVERSATION$CONTEXT_WINDOW)})}),(0,Q.jsx)(`div`,{className:`w-full h-1.5 bg-tertiary rounded-full overflow-hidden`,children:(0,Q.jsx)(`div`,{className:`h-full bg-foreground transition-all duration-300`,style:{width:`${i}%`}})}),(0,Q.jsx)(`div`,{className:`flex justify-end`,children:(0,Q.jsxs)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:[e.toLocaleString(),` / `,t.toLocaleString(),` (`,r.toFixed(2),`% `,n(E.CONVERSATION$USED),`)`]})})]})}function Qi(){let{t:e}=T(`openhands`);return(0,Q.jsx)(`div`,{className:`text-center`,children:(0,Q.jsx)(`p`,{className:`text-[var(--oh-muted)]`,children:e(E.CONVERSATION$NO_METRICS)})})}function $i(e){let{stats:t}=e;if(!t?.usage_to_metrics)return{accumulated_cost:0,max_budget_per_task:null,accumulated_token_usage:null};let n=0,r=null,i=null;for(let e of Object.values(t.usage_to_metrics))n+=e.accumulated_cost,r===null&&e.max_budget_per_task!==null&&(r=e.max_budget_per_task),e.accumulated_token_usage&&(i=i===null?{...e.accumulated_token_usage}:{prompt_tokens:i.prompt_tokens+e.accumulated_token_usage.prompt_tokens,completion_tokens:i.completion_tokens+e.accumulated_token_usage.completion_tokens,cache_read_tokens:i.cache_read_tokens+e.accumulated_token_usage.cache_read_tokens,cache_write_tokens:i.cache_write_tokens+e.accumulated_token_usage.cache_write_tokens,context_window:Math.max(i.context_window,e.accumulated_token_usage.context_window),per_turn_token:Math.max(i.per_turn_token,e.accumulated_token_usage.per_turn_token)});return{accumulated_cost:n,max_budget_per_task:r,accumulated_token_usage:i}}var ea=(e,t,n,r=!0)=>{let i=C({queryKey:[`conversation-metrics`,e,t,n],queryFn:async()=>{if(!e)throw Error(`Conversation ID is required`);return $i(await it.getRuntimeConversation(e,t,n))},enabled:r&&!!e&&!!t,staleTime:1e3*30,gcTime:1e3*60*5,refetchInterval:1e3*30,retry:!1});return{data:i.data,isLoading:i.isLoading,error:i.error}};function ta({isOpen:e,onOpenChange:t}){let n=yn(),{data:r}=J(),i=r?.id,a=r?.conversation_url,o=r?.session_api_key,{data:s}=ea(i,a,o,e),c=(0,$.useMemo)(()=>s?{cost:s.accumulated_cost,max_budget_per_task:s.max_budget_per_task,usage:s.accumulated_token_usage?{prompt_tokens:s.accumulated_token_usage.prompt_tokens??0,completion_tokens:s.accumulated_token_usage.completion_tokens??0,cache_read_tokens:s.accumulated_token_usage.cache_read_tokens??0,cache_write_tokens:s.accumulated_token_usage.cache_write_tokens??0,context_window:s.accumulated_token_usage.context_window??0,per_turn_token:s.accumulated_token_usage.per_turn_token??0}:null}:n,[s,n]);return e?(0,Q.jsx)(Ne,{onClose:()=>t(!1),children:(0,Q.jsxs)(Pe,{testID:`metrics-modal`,className:`relative items-start border border-[var(--oh-border)]`,children:[(0,Q.jsx)(Wi,{onClose:()=>t(!1)}),(0,Q.jsxs)(`div`,{className:`w-full`,children:[(c?.cost!==null||c?.usage!==null)&&(0,Q.jsx)(`div`,{className:`rounded-md border border-[var(--oh-border)] bg-surface-raised p-3`,children:(0,Q.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Q.jsx)(Ji,{cost:c?.cost??null,maxBudgetPerTask:c?.max_budget_per_task??null}),c?.usage!==null&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Xi,{usage:c.usage}),(0,Q.jsx)(Zi,{perTurnToken:c.usage.per_turn_token,contextWindow:c.usage.context_window})]})]})}),!c?.cost&&!c?.usage&&(0,Q.jsx)(`div`,{className:`rounded-md border border-[var(--oh-border)] bg-surface-raised p-3`,children:(0,Q.jsx)(Qi,{})})]})]})}):null}function na(){let{t:e}=T(`openhands`),{conversationId:t}=q(),{data:n}=J(),{mutate:r}=ht(),[i,a]=$.useState(`view`),[o,s]=$.useState(!1),c=$.useRef(null),l=$.useRef(null),{handleDelete:u,handleStop:d,handleDownloadConversation:f,handleDisplayCost:p,handleShowAgentTools:m,handleShowSkills:h,handleShowHooks:g,handleTogglePublic:_,handleCopyShareLink:v,shareUrl:y,handleConfirmDelete:b,handleConfirmStop:x,metricsModalVisible:S,setMetricsModalVisible:C,systemModalVisible:w,setSystemModalVisible:D,skillsModalVisible:k,setSkillsModalVisible:A,hooksModalVisible:j,setHooksModalVisible:M,confirmDeleteModalVisible:ee,setConfirmDeleteModalVisible:te,confirmStopModalVisible:N,setConfirmStopModalVisible:P,systemMessage:F,shouldShowStop:ne,shouldShowDownloadConversation:re,shouldShowDisplayCost:ie,shouldShowAgentTools:I,shouldShowSkills:L,shouldShowHooks:ae}=Jt({conversationId:t,executionStatus:n?.execution_status,showOptions:!0,onContextMenuToggle:s});return $.useEffect(()=>{i===`edit`&&c.current?.focus()},[i]),n?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 h-[22px] text-base font-normal text-left pl-0 lg:pl-1 min-w-0`,"data-testid":`conversation-name`,children:[i===`edit`?(0,Q.jsx)(`input`,{ref:c,"data-testid":`conversation-name-input`,onClick:e=>{i===`edit`&&(e.preventDefault(),e.stopPropagation())},onBlur:()=>{if(c.current?.value&&t){let i=c.current.value.trim();i!==n?.title&&r({conversationId:t,newTitle:i},{onSuccess:()=>{O(e(E.CONVERSATION$TITLE_UPDATED))}})}else c.current&&(c.current.value=n?.title??``);a(`view`)},onKeyUp:e=>{e.nativeEvent.isComposing||e.key===`Enter`&&e.currentTarget.blur()},type:`text`,defaultValue:n.title||``,className:`text-white leading-5 bg-transparent border-none outline-none text-base font-normal w-fit max-w-fit field-sizing-content`}):(0,Q.jsx)(`div`,{className:`text-white leading-5 truncate`,"data-testid":`conversation-name-title`,onDoubleClick:()=>{a(`edit`)},title:n.title||``,children:n.title}),i!==`edit`&&(0,Q.jsxs)(`div`,{ref:l,className:`relative flex items-center shrink-0`,children:[(0,Q.jsx)(St,{onClick:e=>{e.preventDefault(),e.stopPropagation(),s(!o)}}),o&&(0,Q.jsx)(Ui,{onClose:()=>s(!1),onRename:e=>{e.preventDefault(),e.stopPropagation(),a(`edit`),s(!1)},onDelete:u,onStop:ne?d:void 0,onDisplayCost:ie?p:void 0,onShowAgentTools:I?m:void 0,onShowSkills:L?h:void 0,onShowHooks:ae?g:void 0,onTogglePublic:_,onCopyShareLink:v,shareUrl:y,onDownloadConversation:re?f:void 0,position:`bottom`,anchorRef:l})]})]}),(0,Q.jsx)(ta,{isOpen:S,onOpenChange:C}),(0,Q.jsx)(nn,{isOpen:w,onClose:()=>D(!1),systemMessage:F||null}),k&&(0,Q.jsx)(Vt,{onClose:()=>A(!1)}),j&&(0,Q.jsx)(Gt,{onClose:()=>M(!1)}),ee&&(0,Q.jsx)(ct,{onConfirm:b,onCancel:()=>te(!1),conversationTitle:n?.title||``}),N&&(0,Q.jsx)(st,{onConfirm:x,onCancel:()=>P(!1)})]}):null}function ra({children:e,tooltip:t,ariaLabel:n}){return(0,Q.jsx)(ze,{content:t,placement:`bottom`,tooltipClassName:`bg-white text-black text-xs font-medium leading-5`,children:(0,Q.jsx)(`span`,{"data-aria-label":n,children:e})})}function ia({className:e}){let{t}=T(`openhands`),n=Dn(),r=on(),i=f(),{conversationId:a}=q(),{isRightPanelShown:o,setHasRightPanelToggled:s,setIsRightPanelShown:c,setSelectedTab:l}=W(),u=()=>{if(r)return;if(n){if(!a)return;s(!0),c(!0);let{selectedTab:e}=W.getState();e||l(`files`),i(`/conversations/${a}/panel`);return}let e=!o;if(s(e),e){let{selectedTab:e}=W.getState();e||l(`files`)}},d=t(r?E.CONVERSATION$UNAVAILABLE_FOR_ARCHIVES:n?E.COMMON$SHOW_PANEL:o?E.COMMON$HIDE_PANEL:E.COMMON$SHOW_PANEL),p=n?!1:o;return(0,Q.jsx)(ra,{tooltip:d,ariaLabel:d,children:(0,Q.jsx)(`button`,{type:`button`,onClick:u,disabled:r,className:U(ft,r&&`cursor-not-allowed opacity-50 hover:bg-transparent hover:text-[var(--oh-muted)]`,e),"aria-label":d,"aria-pressed":p,"aria-disabled":r,"data-testid":`right-panel-toggle`,children:(0,Q.jsx)(dt,{className:`w-5 h-5 -scale-x-100`})})})}function aa(){let{conversationId:e}=q(),{data:t}=J(),{curAgentState:n}=Y(),{isTask:r,taskStatus:i}=Ft(),{mutate:a}=We(),{mutate:o}=Fi(),{providers:s}=qe(),c=t?.execution_status??null,l=Ee({isPausing:!1,isTask:r,taskStatus:i,isStartingStatus:n===V.LOADING||n===V.INIT,isStopStatus:Oe(c),curAgentState:n});return(0,Q.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`group relative shrink-0`,children:[(0,Q.jsx)(mi,{className:`ml-[3.5px] w-6 h-6 cursor-pointer`,color:l}),(0,Q.jsx)(Bi,{onClose:()=>{},onStopServer:be(c)?t=>{t.preventDefault(),t.stopPropagation(),e&&a({conversationId:e})}:void 0,onStartServer:H(c)?t=>{t.preventDefault(),t.stopPropagation(),e&&o({conversationId:e,providers:s})}:void 0,executionStatus:c,position:`bottom`,className:`opacity-0 invisible pointer-events-none group-hover:opacity-100 group-hover:visible group-hover:pointer-events-auto bottom-full left-0 mt-0 min-h-fit`,isPausing:!1})]}),(0,Q.jsx)(na,{})]}),(0,Q.jsx)(ia,{className:`mr-2`})]})}var oa=e=>(0,Q.jsxs)(`svg`,{width:20,height:20,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,Q.jsx)(`path`,{d:`M3 10.5L6.5 14L14 6`,stroke:`currentColor`,strokeWidth:2.2,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,Q.jsx)(`path`,{d:`M7 10.5L10.5 14L18 6`,stroke:`currentColor`,strokeWidth:2.2,strokeLinecap:`round`,strokeLinejoin:`round`})]}),sa=160,ca={duration:.22,ease:[.4,0,.2,1]};function la({tabValue:e,icon:t,onClick:n,isActive:r,label:i,className:a,measureOnly:o,suppressLayoutAnimation:s=!1}){let c=P(),l=o||c||!1,u=!l&&!s,d=U(`flex items-center rounded-md cursor-pointer`,`pl-1.5 pr-2 py-1 lg:py-1.5`,`text-[var(--oh-muted)] bg-transparent`,r&&`bg-[var(--oh-interactive-active)] text-white`,r?`hover:text-white hover:bg-[var(--oh-interactive-hover)]`:`hover:text-white hover:bg-white/5`,r?`focus-within:text-white`:`focus-within:text-[var(--oh-muted)]`,a),f=(0,Q.jsx)(t,{className:U(`h-4 w-4 shrink-0 text-inherit`)}),p=i&&r?(0,Q.jsx)(`span`,{className:`whitespace-nowrap text-sm font-normal`,children:i}):null,m=i?(0,Q.jsx)(z.span,{initial:!1,animate:{maxWidth:r?sa:0,opacity:+!!r,marginLeft:r?8:0},transition:ca,className:`block overflow-hidden whitespace-nowrap text-sm font-normal`,"aria-hidden":!r,children:i}):null;return l?(0,Q.jsxs)(`button`,{type:`button`,onClick:n,...o?{}:{"data-testid":`conversation-tab-${e}`},"data-tab-measure":o?`true`:void 0,className:U(d,`gap-2`),children:[f,p]}):(0,Q.jsxs)(z.button,{layout:u?`position`:!1,type:`button`,onClick:n,...o?{}:{"data-testid":`conversation-tab-${e}`},"data-tab-measure":o?`true`:void 0,className:d,transition:u?{layout:ca}:void 0,children:[f,m]})}var ua=e=>(0,Q.jsx)(`svg`,{viewBox:`0 0 128 128`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,Q.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`,d:`M90.767 127.126a7.968 7.968 0 0 0 6.35-.244l26.353-12.681a8 8 0 0 0 4.53-7.209V21.009a8 8 0 0 0-4.53-7.21L97.117 1.12a7.97 7.97 0 0 0-9.093 1.548l-50.45 46.026L15.6 32.013a5.328 5.328 0 0 0-6.807.302l-7.048 6.411a5.335 5.335 0 0 0-.006 7.888L20.796 64 1.74 81.387a5.336 5.336 0 0 0 .006 7.887l7.048 6.411a5.327 5.327 0 0 0 6.807.303l21.974-16.68 50.45 46.025a7.96 7.96 0 0 0 2.743 1.793Zm5.252-92.183L57.74 64l38.28 29.058V34.943Z`})});function da(){let e=Ae().backend;if(e.kind!==`cloud`)throw Error(`Cloud sandboxes call requires a cloud backend.`);return e}async function fa(e){if(e.length===0)return[];let t=da(),n=new URLSearchParams;for(let t of e)n.append(`id`,t);return await Me({backend:t,method:`GET`,path:`/api/v1/sandboxes?${n.toString()}`})??[]}var pa=e=>{let t=A(),n=t.backend.kind===`cloud`;return C({queryKey:[`cloud`,`sandbox`,t.backend.id,t.orgId,e],queryFn:async()=>{if(!e)return null;let[t]=await fa([e]);return t??null},enabled:n&&!!e,staleTime:1e3*60*5,gcTime:1e3*60*15})},ma=`VSCODE`,ha=()=>{let{t:e}=T(`openhands`),{conversationId:t}=q(),n=Tn({allowAgentError:!0}),{data:r}=J(),i=A(),a=r?.conversation_url??null,o=r?.session_api_key??null,s=r?.sandbox_id??null,c=i.backend.kind===`cloud`,l=pa(c?s:null),u=C({queryKey:[`unified`,`vscode_url`,`local`,t,a,o],queryFn:async()=>{if(!t)throw Error(`No conversation ID`);return{url:ut((await it.getVSCodeUrl(t,a,o).catch(()=>yt.getVSCodeUrl(t))).vscode_url)}},enabled:!c&&n&&!!t,refetchOnMount:!0,retry:3}),d,f,p,m,h,g,_;if(c){let e=l.data?.exposed_urls?.find(e=>e.name===ma)?.url??null;d=l.isSuccess?{url:ut(e)}:void 0,f=l.isLoading,p=l.isError,m=l.isSuccess,h=l.status,g=l.error,_=async()=>{let e=await l.refetch(),t=e.data?.exposed_urls?.find(e=>e.name===ma)?.url??null;return{data:e.data?{url:ut(t)}:void 0}}}else d=u.data,f=u.isLoading,p=u.isError,m=u.isSuccess,h=u.status,g=u.error,_=async()=>({data:(await u.refetch()).data});let v=d&&!d.url?e(E.VSCODE$URL_NOT_AVAILABLE):null;return{data:d?{...d,error:v}:void 0,error:g,isLoading:f,isError:p,isSuccess:m,status:h,refetch:_}};function ga(){let{t:e}=T(`openhands`),{curAgentState:t}=Y(),{data:n,refetch:r,isLoading:i}=ha(),a=ye.includes(t);return(0,Q.jsxs)(`button`,{type:`button`,onClick:async()=>{let e=n?.url;e||=(await r()).data?.url??null,e&&window.open(e,`_blank`,`noopener,noreferrer`)},disabled:i||a,"aria-label":e(E.VSCODE$OPEN),title:e(E.VSCODE$OPEN),"data-testid":`drawer-vscode-link`,className:U(`inline-flex items-center gap-1.5 rounded-[7px] border border-[var(--oh-border)] bg-base-secondary px-2 py-1 text-xs`,`text-[var(--oh-muted)] transition-colors hover:enabled:bg-surface-raised hover:enabled:text-white`,`cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed`),children:[(0,Q.jsx)(ua,{className:`h-[15px] w-[15px] shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:e(E.FILES$VSCODE)}),(0,Q.jsx)(fe,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0,strokeWidth:2})]})}var _a=e=>(0,Q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,Q.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M7.13832 8.76476C8.25957 8.17949 9.52697 7.9727 10.7515 8.14436L14.9025 2.52826L21.4717 9.09737L15.8555 13.2484C16.0272 14.4729 15.8204 15.7403 15.2351 16.8616C15.1872 16.9535 15.1366 17.0444 15.0836 17.1343C14.8318 17.5605 14.5228 17.9624 14.1566 18.3286L10.4443 14.6163L4.75207 20.3085H3.69141V19.2478L9.38361 13.5556L5.6713 9.84332C6.03755 9.47708 6.43936 9.16808 6.86562 8.91632C6.95547 8.86326 7.04641 8.81274 7.13832 8.76476ZM15.0735 4.82054L19.1794 8.92641L14.2461 12.5727L14.3701 13.4567C14.492 14.3266 14.3596 15.2233 13.9758 16.0265L7.97338 10.0241C8.77665 9.64035 9.67335 9.50789 10.5432 9.62984L11.4272 9.75376L15.0735 4.82054Z`,fill:`currentColor`})}),va=e=>(0,Q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,Q.jsx)(`path`,{d:`M10.9706 10.1586C10.2819 10.0621 9.56905 10.1784 8.93842 10.5075C8.88672 10.5345 8.83557 10.5629 8.78504 10.5928C8.54529 10.7344 8.3193 10.9082 8.11331 11.1142L9.83702 12.8372L7.00054 15.75L7 17H8.25064L11.1628 14.1632L12.8857 15.8865C13.0917 15.6805 13.2655 15.4545 13.4071 15.2147C13.437 15.1642 13.4654 15.1131 13.4924 15.0614C13.8215 14.4308 13.9378 13.718 13.8413 13.0293L17 10.6946L13.3053 7L10.9706 10.1586Z`,fill:`currentColor`})});function ya({isOpen:e,onClose:t,ignoreOutsideClickRef:n,anchorRef:r}){let i=gt(t,n),[a,o]=(0,$.useState)();(0,$.useLayoutEffect)(()=>{if(!e||!r?.current){o(void 0);return}let t=()=>{let e=r.current?.getBoundingClientRect();e&&o({position:`fixed`,zIndex:9999,top:e.bottom+8,left:e.left})};return t(),window.addEventListener(`resize`,t),window.addEventListener(`scroll`,t,!0),()=>{window.removeEventListener(`resize`,t),window.removeEventListener(`scroll`,t,!0)}},[e,r]);let{t:s}=T(`openhands`),{conversationId:c}=q(),{state:l,setUnpinnedTabs:u,setSelectedTab:d}=Ze(c),{selectedTab:f,isRightPanelShown:p,setSelectedTab:m}=W(),{navigateToTab:h}=R(),{hasTaskList:g}=On(),{backend:_}=A(),v=on(),y=[{tab:`planner`,icon:B,i18nKey:E.COMMON$PLANNER},{tab:`files`,icon:kt,i18nKey:E.COMMON$FILES},{tab:`terminal`,icon:me,i18nKey:E.COMMON$TERMINAL},{tab:`browser`,icon:An,i18nKey:E.COMMON$BROWSER}];g&&y.unshift({tab:`tasklist`,icon:oa,i18nKey:E.COMMON$TASK_LIST});let b=y.filter(({tab:e})=>e!==`planner`||_.kind===`cloud`),x=e=>{v||(h(e),t())},S=(e,t)=>{if(v){t.preventDefault(),t.stopPropagation();return}if(t.preventDefault(),t.stopPropagation(),l.unpinnedTabs.includes(e))u(l.unpinnedTabs.filter(t=>t!==e));else{let t=[...l.unpinnedTabs,e];if(u(t),f===e&&p){let n=b.find(({tab:n})=>n!==e&&!t.includes(n));n&&(m(n.tab),d(n.tab))}}};if(!e)return null;let C=!!(r?.current&&a),w=(0,Q.jsx)(bt,{ref:i,theme:C?`popover`:`default`,position:C?`none`:`bottom`,alignment:C?`none`:`left`,spacing:C?`none`:`default`,className:U(`z-[9999] w-fit`,C?`mt-0`:`mt-2`),children:b.map(({tab:e,icon:t,i18nKey:n})=>{let r=!l.unpinnedTabs.includes(e);return(0,Q.jsx)(`li`,{className:`list-none`,children:(0,Q.jsx)(Ut,{isDisabled:v,children:(0,Q.jsxs)(`div`,{className:U(`group flex h-[30px] w-full min-w-0 items-stretch rounded`,!v&&`hover:bg-[var(--oh-interactive-hover)]`,v&&`opacity-50`),children:[(0,Q.jsxs)(`button`,{type:`button`,"data-testid":`conversation-tabs-menu-open-${e}`,disabled:v,className:U(`flex min-w-0 flex-1 items-center gap-2 rounded-l p-2 text-start text-white`,Be,v?`cursor-not-allowed`:`cursor-pointer`),onClick:()=>x(e),children:[(0,Q.jsx)(`span`,{className:Ve,"aria-hidden":!0,children:(0,Q.jsx)(t,{className:`h-4 w-4`})}),(0,Q.jsx)(`span`,{className:`text-sm`,children:s(n)})]}),(0,Q.jsx)(`button`,{type:`button`,"data-testid":`conversation-tabs-menu-pin-${e}`,disabled:v,className:U(`flex shrink-0 items-center justify-center rounded-r px-2 text-white`,Be,v?`cursor-not-allowed`:`cursor-pointer hover:bg-white/10`),"aria-pressed":r,"aria-label":s(r?E.CONVERSATION$UNPIN_TAB:E.CONVERSATION$PIN_TAB),onClick:t=>S(e,t),children:r?(0,Q.jsx)(`span`,{className:U(`-mr-[5px] ml-auto`,Ve),"aria-hidden":!0,children:(0,Q.jsx)(va,{className:`h-7 w-7`})}):(0,Q.jsx)(`span`,{className:U(`ml-auto`,Ve),"aria-hidden":!0,children:(0,Q.jsx)(_a,{className:`h-4.5 w-4.5`})})})]})})},e)})});return C&&a&&typeof document<`u`?Vi.createPortal((0,Q.jsx)(`div`,{style:a,children:w}),document.body):w}function ba({variant:e=`default`,isPanelResizing:t=!1}){let{conversationId:n}=q(),{setSelectedTab:r,planContent:i}=W(),[a,o]=(0,$.useState)(!1),{state:s}=Ze(n),{hasTaskList:c}=On(),{backend:l}=A(),{handleBuildPlanClick:u}=L(),{curAgentState:d}=Y(),{selectTab:f,isTabActive:p,onTabChange:m,selectedTab:h,isRightPanelShown:g}=R();(0,$.useEffect)(()=>{r(s.selectedTab)},[r,s.selectedTab]),(0,$.useEffect)(()=>{g&&(h||m(`files`))},[g,h,m]);let{t:_,i18n:v}=T(`openhands`),y=[{tabValue:`files`,isActive:p(`files`),icon:kt,onClick:()=>f(`files`),tooltipContent:_(E.COMMON$FILES),tooltipAriaLabel:_(E.COMMON$FILES),label:_(E.COMMON$FILES)},{tabValue:`planner`,isActive:p(`planner`),icon:B,onClick:()=>f(`planner`),tooltipContent:_(E.COMMON$PLANNER),tooltipAriaLabel:_(E.COMMON$PLANNER),label:_(E.COMMON$PLANNER)},{tabValue:`terminal`,isActive:p(`terminal`),icon:me,onClick:()=>f(`terminal`),tooltipContent:_(E.COMMON$TERMINAL),tooltipAriaLabel:_(E.COMMON$TERMINAL),label:_(E.COMMON$TERMINAL),className:`pl-2`},{tabValue:`browser`,isActive:p(`browser`),icon:An,onClick:()=>f(`browser`),tooltipContent:_(E.COMMON$BROWSER),tooltipAriaLabel:_(E.COMMON$BROWSER),label:_(E.COMMON$BROWSER)}];c&&y.splice(1,0,{tabValue:`tasklist`,isActive:p(`tasklist`),icon:oa,onClick:()=>f(`tasklist`),tooltipContent:_(E.COMMON$TASK_LIST),tooltipAriaLabel:_(E.COMMON$TASK_LIST),label:_(E.COMMON$TASK_LIST)});let b=y.filter(e=>e.tabValue===`planner`&&l.kind!==`cloud`?!1:s.unpinnedTabs.includes(e.tabValue)?h===e.tabValue:!0),x=s.unpinnedTabs.join(`,`),S=d===V.RUNNING||d===V.LOADING||!i,C=(0,$.useRef)(null),w=(0,$.useRef)(null),D=(0,$.useRef)(null),O=(0,$.useRef)(null),k=(0,$.useRef)(null),[j,M]=(0,$.useState)(b.length);(0,$.useLayoutEffect)(()=>{let e=C.current,t=w.current,n=D.current,r=O.current;if(!e||!t||!n||!r)return;let i=()=>{let i=t.querySelectorAll(`[data-tab-measure="true"]`),a=i.length,o=e.getBoundingClientRect().width;if(o===0){M(a);return}let s=Array.from(i).map(e=>e.getBoundingClientRect().width);if(s.length!==a||a===0){M(Math.max(0,a));return}let c=n.getBoundingClientRect().width,l=r.getBoundingClientRect().width,u=getComputedStyle(e).columnGap||getComputedStyle(e).gap,d=parseFloat(u)||6,f=0;for(let e=a;e>=0;--e){let t=c+l;for(let n=0;n<e;n+=1)t+=s[n]??0;if(e>0&&(t+=e*d),t<=o+.5){f=e;break}}M(e=>e===f?e:f)};if(i(),typeof ResizeObserver>`u`)return;let a=new ResizeObserver(i);return a.observe(e),()=>a.disconnect()},[x,b.length,c,l.kind,h,g,v.language]);let ee=Math.min(j,b.length);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:U(`relative w-full min-w-0`,e===`compact`?`flex h-full min-h-0 items-center py-0 pl-0 pr-1`:`min-h-10 p-1`),children:[(0,Q.jsx)(`div`,{ref:w,"aria-hidden":!0,className:`pointer-events-none absolute top-0 left-[-10000px] flex flex-nowrap items-center gap-1.5`,children:b.map(({tabValue:e,icon:t,isActive:n,tooltipContent:r,tooltipAriaLabel:i,label:a,className:o},s)=>(0,Q.jsx)(ra,{tooltip:r,ariaLabel:i,children:(0,Q.jsx)(la,{tabValue:e,icon:t,onClick:()=>{},isActive:n,label:a,className:U(o,`shrink-0`),measureOnly:!0})},`measure-${e}-${s}`))}),(0,Q.jsxs)(`div`,{ref:C,className:`flex w-full min-w-0 flex-nowrap items-center justify-start`,children:[(0,Q.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center justify-start overflow-hidden`,children:(0,Q.jsxs)(`div`,{className:`flex w-fit max-w-full min-w-0 items-center gap-1.5`,children:[(0,Q.jsx)(zn,{id:`conversation-drawer-tabs`,children:(0,Q.jsx)(`div`,{className:`flex w-fit max-w-full min-w-0 flex-nowrap items-center gap-1.5 overflow-x-hidden`,children:b.slice(0,ee).map(({tabValue:e,icon:n,onClick:r,isActive:i,tooltipContent:a,tooltipAriaLabel:o,label:s,className:c},l)=>(0,Q.jsx)(ra,{tooltip:a,ariaLabel:o,children:(0,Q.jsx)(la,{tabValue:e,icon:n,onClick:r,isActive:i,label:s,className:U(c,`shrink-0`),suppressLayoutAnimation:t})},`${e}-${l}`))})}),(0,Q.jsxs)(`div`,{ref:D,className:`relative shrink-0`,children:[(0,Q.jsx)(St,{ref:k,onClick:()=>o(!a),ariaLabel:_(E.COMMON$MORE_OPTIONS),iconClassName:e===`compact`?lt:void 0}),(0,Q.jsx)(ya,{isOpen:a,onClose:()=>o(!1),ignoreOutsideClickRef:k,anchorRef:k})]})]})}),(0,Q.jsx)(`div`,{ref:O,className:U(`ml-auto shrink-0`,l.kind===`cloud`&&`pr-1`),children:l.kind===`cloud`&&(0,Q.jsx)(ga,{})})]})]}),p(`planner`)&&(0,Q.jsx)(`div`,{className:U(`flex h-10 min-h-10 shrink-0 items-center border-t border-[var(--oh-border)] pl-[10px] pr-1`),children:(0,Q.jsx)(`button`,{type:`button`,onClick:u,disabled:S,className:U(`flex h-5 min-w-17 items-center justify-center rounded bg-white px-2 transition-opacity`,S?`cursor-not-allowed opacity-50`:`cursor-pointer hover:opacity-90`),"data-testid":`planner-tab-build-button`,children:(0,Q.jsxs)(Ot.Text,{className:`text-[11px] font-normal leading-5 text-black`,children:[_(E.COMMON$BUILD),` ⌘↩`]})})})]})}function xa({onMouseDown:e,className:t,isDragging:n=!1}){let[r,i]=(0,$.useState)(!1),a=n||r;return(0,Q.jsxs)(`div`,{className:U(`relative z-10 w-0 shrink-0 self-stretch`,t),"aria-hidden":!0,children:[(0,Q.jsx)(`div`,{className:`absolute inset-y-0 left-1/2 w-3 min-w-[12px] -translate-x-1/2 cursor-ew-resize`,onMouseDown:e,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1)}),(0,Q.jsx)(`div`,{className:U(`pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 transition-colors`,a?`bg-white`:`bg-transparent`),"aria-hidden":!0})]})}var Sa=200;function Ca({defaultLeftWidth:e=50,minLeftWidth:t=30,maxLeftWidth:n=80,storageKey:r=`desktop-layout-panel-width`}={}){let[i,a]=kn(r,e),o=(0,$.useCallback)(e=>Math.max(t,Math.min(n,e)),[t,n]),[s,c]=(0,$.useState)(()=>o(i)),[l,u]=(0,$.useState)(!1),d=(0,$.useRef)(null),f=(0,$.useCallback)(e=>{e.preventDefault(),u(!0)},[]),p=(0,$.useCallback)(e=>{if(!l||!d.current)return;let t=d.current.getBoundingClientRect();c(o((e.clientX-t.left)/t.width*100))},[l,o]),m=(0,$.useCallback)(()=>{l&&(u(!1),a(s))},[l,s,a]);return(0,$.useLayoutEffect)(()=>{if(!l)return;let e=document.createElement(`div`);return e.setAttribute(`aria-hidden`,`true`),e.dataset.panelDragShield=``,Object.assign(e.style,{position:`fixed`,inset:`0`,zIndex:String(Sa),cursor:`ew-resize`}),document.body.appendChild(e),document.addEventListener(`mousemove`,p),document.addEventListener(`mouseup`,m),document.body.style.cursor=`ew-resize`,document.body.style.userSelect=`none`,()=>{document.removeEventListener(`mousemove`,p),document.removeEventListener(`mouseup`,m),document.body.style.cursor=``,document.body.style.userSelect=``,e.remove()}},[l,p,m]),{leftWidth:s,rightWidth:100-s,isDragging:l,containerRef:d,handleMouseDown:f}}function wa(e){return e?`translate-x-0 opacity-100`:`w-0 translate-x-full opacity-0`}function Ta(){let e=Dn(),t=Dn(767),{isRightPanelShown:n}=W(),{leftWidth:r,rightWidth:i,isDragging:a,containerRef:o,handleMouseDown:s}=Ca({defaultLeftWidth:50,minLeftWidth:30,maxLeftWidth:80,storageKey:`desktop-layout-panel-width`});return(0,Q.jsx)(`div`,{className:U(e?`relative min-h-0 flex-1 flex flex-col`:`h-full flex flex-col overflow-hidden`),children:(0,Q.jsxs)(`div`,{ref:o,className:U(`flex flex-1 overflow-hidden`,e?`flex-col`:`transition-all duration-300 ease-in-out`),style:e?void 0:{transitionProperty:a?`none`:`all`},children:[(0,Q.jsxs)(`div`,{className:U(`flex flex-col bg-base overflow-hidden`,e?`flex-1`:`transition-all duration-300 ease-in-out`),style:e?void 0:{width:n?`${r}%`:`100%`,transitionProperty:a?`none`:`all`},children:[(0,Q.jsxs)(`div`,{"data-testid":`chat-pane-header`,className:U(`flex h-10 min-h-10 shrink-0 items-center`,t&&`gap-2 pl-2.5`),children:[t?(0,Q.jsx)(mt,{}):null,(0,Q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Q.jsx)(aa,{})})]}),(0,Q.jsx)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:(0,Q.jsx)(yi,{isRightPanelShown:!e&&n})})]}),!e&&n&&(0,Q.jsx)(xa,{onMouseDown:s,isDragging:a}),!e&&(0,Q.jsx)(`div`,{className:U(`transition-all duration-300 ease-in-out overflow-hidden`,wa(n)),style:{width:n?`${i}%`:`0%`,transitionProperty:a?`opacity, transform`:`all`},children:(0,Q.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col flex-1 min-h-0 bg-[var(--oh-surface)] border-l border-[var(--oh-border)] overflow-hidden`,children:[(0,Q.jsx)(`div`,{"data-testid":`tabs-pane-header`,className:`flex shrink-0 flex-col border-b border-[var(--oh-border)]`,children:(0,Q.jsx)(ba,{isPanelResizing:a})}),(0,Q.jsx)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:(0,Q.jsx)(Pi,{})})]})})})]})})}function Ea({onNavigateBack:e}){let{t}=T(`openhands`),{setIsRightPanelShown:n,setHasRightPanelToggled:r,setSelectedTab:i}=W();return $.useLayoutEffect(()=>(n(!0),r(!0),W.getState().selectedTab||i(`files`),()=>{n(!1),r(!1)}),[n,r,i]),(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-[var(--oh-surface)]`,children:[(0,Q.jsxs)(`div`,{"data-testid":`conversation-mobile-panel-top`,className:`flex h-10 min-h-10 shrink-0 items-center gap-1.5 border-b border-[var(--oh-border)] pl-2.5`,children:[(0,Q.jsx)(`button`,{type:`button`,"data-testid":`conversation-mobile-panel-back`,onClick:()=>{e()},"aria-label":t(E.COMMON$BACK),className:ft,children:(0,Q.jsx)(ue,{size:20,className:lt,"aria-hidden":!0,strokeWidth:2})}),(0,Q.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 items-center self-stretch`,children:(0,Q.jsx)(`div`,{"data-testid":`tabs-pane-header`,className:`flex h-full min-h-0 w-full min-w-0 flex-col justify-center`,children:(0,Q.jsx)(ba,{variant:`compact`})})})]}),(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-[var(--oh-surface)]`,children:(0,Q.jsx)(Pi,{})})]})}var Da=1e3*60*5,Oa=1e3*60*15,ka=e=>{let t=e||[],n=A();return C({queryKey:[`v1`,`sub-conversations`,t,n.backend.id,n.orgId],queryFn:async()=>t.length===0?[]:it.batchGetAppConversations(t),enabled:t.length>0,staleTime:Da,gcTime:Oa,retry:!1})};function Aa({children:e,conversationId:t}){let{data:n}=J(),{data:r}=ka(n?.sub_conversation_ids??[]),i=r?.filter(e=>e!==null);return(0,Q.jsx)(hn,{conversationId:t,conversationUrl:n?.sandbox_status===`PAUSED`?null:n?.conversation_url,sessionApiKey:n?.session_api_key,subConversationIds:n?.sub_conversation_ids,subConversations:i,children:e})}function ja(){let{t:e}=T(`openhands`),{conversationId:t}=q(),n=u(`/conversations/:conversationId/panel`),{isTask:r,taskStatus:i,taskDetail:a}=Ft(),o=A(),s=$.useRef(o.backend.id),c=$.useRef(o.orgId),l=s.current!==o.backend.id||c.current!==o.orgId,{data:d,isFetched:m}=J(),{data:h}=at(),{resetConversationState:g}=W(),_=f(),v=p(),y=wn(e=>e.clearTerminal),b=Et(e=>e.reset),x=Vn(e=>e.setCurrentAgentState),S=pn(e=>e.removeErrorMessage);$.useEffect(()=>{y(),g(),b(),x(V.LOADING),S()},[t,y,g,b,x,S]),$.useEffect(()=>{if(r&&i===`ERROR`){D(a||e(E.CONVERSATION$FAILED_TO_START_FROM_TASK));let t=v.state?.resumedFromConversationId;_(t?`/conversations/${t}`:`/conversations`,{replace:!0})}},[r,i,a,e,_,v.state]),$.useEffect(()=>{!m||!h||l||d||(qn(o.backend.id,o.orgId),D(e(E.CONVERSATION$NOT_EXIST_OR_NO_PERMISSION)),_(`/conversations`))},[d,m,h,_,e,l,o.backend.id,o.orgId]),$.useEffect(()=>{l||t&&(t.startsWith(`task-`)||Kn(o.backend.id,o.orgId,t))},[t,l,o.backend.id,o.orgId]);let C=$.useRef(null);return $.useEffect(()=>{!m||!d||o.backend.kind===`cloud`&&d.sandbox_status===`PAUSED`&&d.sandbox_id&&C.current!==d.id&&(C.current=d.id,rt(d.sandbox_id).catch(()=>{D(e(E.CONVERSATION$FAILED_TO_START_FROM_TASK))}))},[m,d?.id,d?.sandbox_status,d?.sandbox_id,o.backend.kind,e]),l?null:(0,Q.jsx)(Aa,{conversationId:t,children:(0,Q.jsx)($n,{children:(0,Q.jsx)(`div`,{"data-testid":`app-route`,className:`flex h-full flex-col`,children:n?(0,Q.jsx)(Ea,{onNavigateBack:()=>_(`/conversations/${t}`)}):(0,Q.jsx)(Ta,{})})})})}function Ma(){return(0,Q.jsx)(ja,{})}var Na=d(Ma);export{Na as t};
19
+ `)}`,g=p.length>0?`${r}\n\n${h}`:r,v=b({conversationId:B,text:r,content:g,imageUrls:u,fileUrls:p,timestamp:d});O(),n(``);try{await m(ae(g,u,p,d))}catch(e){x(v,e instanceof Error?e.message:C(E.CHAT_INTERFACE$FAILED_TO_SEND_MESSAGE))}};$.useEffect(()=>{if(ve.current&&w.current){let{scrollHeight:e,scrollTop:t}=ve.current,n=w.current,r=n.scrollHeight-e;r>0&&(n.scrollTop=t+r),ve.current=null;return}j&&O()},[h.length,be,pe,O]);let De=$.useRef(H);$.useEffect(()=>{De.current=H}),$.useEffect(()=>{let e=w.current;e&&De.current(e)},[h.length,ge]);let Oe={scrollRef:w,autoScroll:j,setAutoScroll:M,scrollDomToBottom:O,hitBottom:A,setHitBottom:ee,onChatBodyScroll:k},ke=P===V.LOADING||P===V.INIT,Ae=P===V.STOPPED,je=P===V.PAUSED,Me=Ee({isPausing:je,isTask:c,taskStatus:l,isStartingStatus:ke,isStopStatus:Ae,curAgentState:P}),Ne=Se({isPausing:je,isTask:c,taskStatus:l,taskDetail:u,isStartingStatus:ke,isStopStatus:Ae,curAgentState:P,errorMessage:r,t:C});return(0,Q.jsx)(oe,{value:Oe,children:(0,Q.jsxs)(`div`,{className:`relative flex h-full flex-col justify-between px-4`,"data-testid":`chat-interface`,children:[!v&&!be&&!y&&!Te&&!we&&!d&&_===0&&!R&&!ue&&(0,Q.jsx)(ei,{onSuggestionsClick:e=>n(e)}),(0,Q.jsxs)(`div`,{ref:w,"data-testid":`chat-scroll-container`,onScroll:e=>{k(e.currentTarget),H(e.currentTarget)},onWheel:ye,className:`custom-scrollbar-always flex min-h-0 grow flex-col gap-2 overflow-x-hidden overflow-y-auto px-0 pt-4 pb-8 md:px-4`,children:[we&&Ce&&(0,Q.jsx)(si,{}),we&&!Ce&&(0,Q.jsx)(`div`,{className:`flex justify-center`,"data-testid":`loading-spinner`,children:(0,Q.jsx)(Le,{size:`small`})}),he&&(0,Q.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-3 text-sm text-neutral-400`,"data-testid":`loading-older-events`,children:[(0,Q.jsx)(Le,{size:`small`}),(0,Q.jsx)(`span`,{children:C(E.CHAT_INTERFACE$FETCHING_OLDER_MESSAGES)})]}),(0,Q.jsx)(re,{conversationId:B,anchorEventId:null}),xe&&h.length>0&&(0,Q.jsx)(se,{messages:h,allEvents:g}),(0,Q.jsx)(ui,{}),(0,Q.jsx)(lr,{conversationId:B})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-[6px] pb-4`,children:[(0,Q.jsx)(cr,{conversationId:B}),r&&(0,Q.jsx)(li,{message:r,code:i,onDismiss:a,onRetry:r===`Unable to connect to server`?()=>p?.reconnect():void 0,onReauth:rr(i)?()=>s(`/settings/agents`):void 0}),ue&&!R&&(0,Q.jsx)(tn,{}),R?(0,Q.jsxs)(`div`,{"data-testid":`archived-conversation-banner`,className:`mx-1 px-4 py-3 rounded-lg bg-[var(--oh-surface)] border border-[var(--oh-border-subtle)]`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-semibold text-[var(--oh-foreground)]`,children:C(I===`ERROR`?E.CHAT_INTERFACE$ERROR_SANDBOX_TITLE:E.CHAT_INTERFACE$ARCHIVED_SANDBOX_TITLE)}),(0,Q.jsx)(`p`,{className:`text-xs text-[var(--oh-muted)] mt-0.5`,children:C(I===`ERROR`?E.CHAT_INTERFACE$ERROR_SANDBOX_DESCRIPTION:E.CHAT_INTERFACE$ARCHIVED_SANDBOX_DESCRIPTION)})]}):(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-full mb-1 z-20`,children:(0,Q.jsxs)(`div`,{className:`flex justify-between relative`,children:[(0,Q.jsxs)(`div`,{className:`flex items-end gap-1 pointer-events-auto`,children:[(0,Q.jsx)(pi,{}),ke&&(0,Q.jsx)(hi,{statusColor:Me,status:Ne})]}),A?P===V.RUNNING&&(0,Q.jsx)(`div`,{className:`absolute left-1/2 transform -translate-x-1/2 bottom-0 pointer-events-auto`,children:(0,Q.jsx)(Wr,{})}):(0,Q.jsx)(`div`,{className:`absolute left-1/2 transform -translate-x-1/2 bottom-0 pointer-events-auto`,children:(0,Q.jsx)(ii,{onClick:O})})]})}),(0,Q.jsx)(Br,{onSubmit:U,disabled:N||ue})]})]})]})})}function yi({isRightPanelShown:e}){return(0,Q.jsx)(`div`,{className:`flex justify-center w-full h-full`,children:(0,Q.jsx)(`div`,{className:`w-full min-w-0 max-w-[800px] h-full flex flex-col min-h-0 transition-all duration-300 ease-in-out`,children:(0,Q.jsx)(vi,{})})})}function bi({children:e}){return(0,Q.jsx)(`div`,{className:`absolute inset-0`,children:e})}function xi({children:e}){return(0,Q.jsx)(`div`,{className:`flex flex-col h-full w-full`,children:e})}function Si({children:e}){return(0,Q.jsx)(`div`,{className:`overflow-hidden flex-grow h-full w-full relative`,children:e})}function Ci({className:e}){let{t}=T(`openhands`);return(0,Q.jsxs)(`div`,{className:U(`bg-[var(--oh-surface)] flex h-full w-full flex-col items-center justify-center gap-3`,e),children:[(0,Q.jsx)(pe,{className:`h-8 w-8 shrink-0 animate-spin text-tertiary-light`,"aria-hidden":!0}),(0,Q.jsx)(M,{as:`p`,role:`status`,"aria-live":`polite`,className:`block w-full text-center text-base font-normal leading-5`,duration:1,spread:2,children:t(E.HOME$LOADING)})]})}function wi({children:e,onReady:t}){return(0,$.useLayoutEffect)(()=>{t()},[t]),e}function Ti({onPending:e}){return(0,$.useLayoutEffect)(()=>{e()},[e]),(0,Q.jsx)(Ci,{})}var Ei={duration:.35,ease:`easeInOut`};function Di({showAgentLoading:e,tabKey:t,children:n}){let r=P(),[i,a]=(0,$.useState)(!1);(0,$.useLayoutEffect)(()=>{a(!1)},[t]);let o=(0,$.useCallback)(()=>{a(!0)},[]),c=(0,$.useCallback)(()=>{a(!1)},[]),l=e||i;return r?(0,Q.jsx)(`div`,{className:`relative h-full w-full overflow-hidden`,children:l?(0,Q.jsx)(Ci,{}):(0,Q.jsx)($.Suspense,{fallback:(0,Q.jsx)(Ti,{onPending:o}),children:(0,Q.jsx)(wi,{onReady:c,children:n})})}):(0,Q.jsxs)(`div`,{className:`relative h-full w-full overflow-hidden`,children:[(0,Q.jsx)(z.div,{className:`absolute inset-0 h-full w-full`,initial:!1,animate:{opacity:+!l},transition:Ei,"aria-hidden":l,children:(0,Q.jsx)($.Suspense,{fallback:(0,Q.jsx)(Ti,{onPending:o}),children:(0,Q.jsx)(wi,{onReady:c,children:n})})}),(0,Q.jsx)(s,{children:l?(0,Q.jsx)(z.div,{className:`absolute inset-0 z-10 h-full w-full`,initial:{opacity:1},animate:{opacity:1},exit:{opacity:0},transition:Ei,children:(0,Q.jsx)(Ci,{})},`conversation-tab-loading-overlay`):null})]})}var Oi=(0,$.lazy)(()=>n(()=>import(`./files-tab-61Vaihc6.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61]))),ki=(0,$.lazy)(()=>n(()=>import(`./browser-tab-aiDg7aEn.js`),__vite__mapDeps([62,2,1,63,7,8,18,64,13,42,10,11,65,26]))),Ai=(0,$.lazy)(()=>n(()=>import(`./planner-tab-AZMjJx31.js`),__vite__mapDeps([66,1,2,67,7,8,18,42,10,11,44,22,20,21,23,24,45,13,19,25,46,47,48,68,69,70,71,3,4,5,6,9,72,73,74,15,16,30,27,28,14,29,31,32,33,34,35,36,75,76,77,78,79,80,49,50,51,52,81,82,26,60]))),ji=(0,$.lazy)(()=>n(()=>import(`./task-list-tab-BAThr9Ex.js`),__vite__mapDeps([83,1,2,8,18,42,10,11,84,37,26,85,86,40,41]))),Mi=(0,$.lazy)(()=>n(()=>import(`./terminal-BmT0_gIH.js`),__vite__mapDeps([87,1,2,88,89,90,7,8,18,38,39,10,11,40,41,42,53,49,50,4,14,27,3,5,6,9,28,29,30,31,32,33,34,35,36,51,52,15,16,54,26,91]))),Ni={tasklist:{component:ji},files:{component:Oi},browser:{component:ki},terminal:{component:Mi},planner:{component:Ai}};function Pi(){let{selectedTab:e,shouldShownAgentLoading:t}=W(),{conversationId:n}=q(),r=(0,$.useMemo)(()=>Ni[e]??Ni.files,[e]).component,i=e===`terminal`?`${e}-${n}`:e??`files`;return(0,Q.jsx)(xi,{children:(0,Q.jsx)(Si,{children:(0,Q.jsx)(Di,{showAgentLoading:t,tabKey:i,children:(0,Q.jsx)(bi,{children:(0,Q.jsx)(r,{})},i)})})})}var Fi=()=>{let e=m(),t=pn(e=>e.removeErrorMessage);return S({mutationKey:[`start-conversation`],mutationFn:async e=>g(e.conversationId),onMutate:async()=>(await e.cancelQueries({queryKey:[`user`,`conversations`]}),{previousConversations:e.getQueryData([`user`,`conversations`])}),onError:(t,n,r)=>{r?.previousConversations&&e.setQueryData([`user`,`conversations`],r.previousConversations)},onSettled:(t,n,r)=>{h(e,r.conversationId)},onSuccess:(n,r)=>{t(),_(e,r.conversationId,ke.RUNNING)}})},Ii=e=>(0,Q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,Q.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22ZM10 9H14A1 1 0 0 1 15 10V14A1 1 0 0 1 14 15H10A1 1 0 0 1 9 14V10A1 1 0 0 1 10 9Z`,fill:`currentColor`})}),Li=e=>(0,Q.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:[(0,Q.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12.9 1.50004C15.3 1.65004 17.55 2.85004 19.2 4.50004C21.15 6.60004 22.2 9.15004 22.2 12.15C22.2 14.55 21.3 16.8 19.8 18.75C18.3 20.55 16.2 21.9 13.8 22.35C11.4 22.8 9 22.5 6.9 21.3C4.8 20.1 3.15 18.3 2.25 16.05C1.35 13.8 1.2 11.25 1.95 9.00004C2.7 6.60004 4.05 4.65004 6.15 3.30004C8.1 1.95004 10.5 1.35004 12.9 1.50004ZM13.65 20.85C15.6 20.4 17.4 19.35 18.75 17.7C19.95 16.05 20.7 14.1 20.55 12C20.55 9.60004 19.65 7.20004 18 5.55004C16.5 4.05004 14.7 3.15004 12.6 3.00004C10.65 2.85004 8.55 3.30004 6.9 4.50004C5.25 5.70004 4.05 7.35004 3.45 9.45004C2.85 11.4 2.85 13.5 3.75 15.45C4.65 17.4 6 18.9 7.8 19.95C9.6 21 11.7 21.3 13.65 20.85Z`,fill:`currentColor`}),(0,Q.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M9 7.49998L10.1655 6.87598L16.9155 11.376V12.624L10.1655 17.124L9 16.5V7.49998ZM10.5 8.90098V15.099L15.1485 12L10.5 8.90098Z`,fill:`currentColor`})]});function Ri({icon:e,text:t,onClick:n,testId:r}){return(0,Q.jsx)(G,{testId:r,onClick:n,children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 w-full items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,Q.jsx)(`span`,{className:Ve,"aria-hidden":!0,children:e})]})})}function zi({className:e=``,executionStatus:t,isPausing:n=!1}){let{curAgentState:r}=Y(),{isTask:i,taskStatus:a,taskDetail:o}=Ft(),{t:s}=T(`openhands`),{errorMessage:c}=pn(),l=r===V.LOADING||r===V.INIT,u=Oe(t)||H(t),d=Ee({isPausing:n,isTask:i,taskStatus:a,isStartingStatus:l,isStopStatus:u,curAgentState:r}),f=Se({isPausing:n,isTask:i,taskStatus:a,taskDetail:o,isStartingStatus:l,isStopStatus:u,curAgentState:r,errorMessage:c,t:s});return(0,Q.jsx)(`div`,{className:e,"data-testid":`server-status`,children:(0,Q.jsxs)(`div`,{className:`flex items-center`,children:[(0,Q.jsx)(mi,{className:`w-6 h-6 shrink-0`,color:d}),(0,Q.jsx)(`span`,{className:`text-[13px] text-white font-normal`,children:f})]})})}function Bi({onClose:e,onStopServer:t,onStartServer:n,executionStatus:r,position:i=`top`,className:a=``,isPausing:o=!1}){let{t:s}=T(`openhands`),c=gt(e),l=be(r),u=H(r),d=l||u;return(0,Q.jsxs)(bt,{ref:c,testId:`server-status-context-menu`,position:i,alignment:`left`,size:`default`,className:U(`left-2 w-fit min-w-42`,a),children:[(0,Q.jsx)(zi,{executionStatus:r,isPausing:o,className:`pl-0 pr-2 py-1`}),d&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(He,{inset:`menu`}),l&&t&&(0,Q.jsx)(Ri,{icon:(0,Q.jsx)(Ii,{width:18,height:18}),text:s(E.COMMON$STOP_RUNTIME),onClick:t,testId:`stop-server-button`}),u&&n&&(0,Q.jsx)(Ri,{icon:(0,Q.jsx)(Li,{width:18,height:18}),text:s(E.COMMON$START_RUNTIME),onClick:n,testId:`start-server-button`})]})]})}var Vi=e(l(),1);function Hi({isPublic:e,onToggle:t,ariaLabel:n}){return(0,Q.jsxs)(`label`,{className:`relative inline-flex shrink-0 cursor-pointer items-center`,children:[(0,Q.jsx)(`input`,{hidden:!0,type:`checkbox`,"data-testid":`share-publicly-button`,checked:e,"aria-label":n,onChange:e=>t(e.target.checked)}),(0,Q.jsx)(`span`,{"aria-hidden":!0,className:U(`inline-flex h-3.5 w-7 items-center rounded-full px-0.5 py-px transition-colors duration-200 ease-in-out`,e?`bg-white`:`bg-base-secondary`),children:(0,Q.jsx)(`span`,{className:U(`block h-2 w-2 shrink-0 rounded-full transition-transform duration-200 ease-in-out`,e?`translate-x-[calc(1rem-1px)] bg-base-secondary`:`translate-x-px bg-tertiary-light`)})})]})}function Ui({onClose:e,onRename:t,onDelete:n,onStop:r,onDisplayCost:i,onShowAgentTools:a,onShowSkills:o,onShowHooks:s,onTogglePublic:c,onCopyShareLink:l,onDownloadConversation:u,shareUrl:d,position:f=`bottom`,anchorRef:p}){let m=Dn(),{t:h}=T(`openhands`),{backend:g}=A(),{data:_}=J(),v=on(),y=gt(e),b=p?.current??null,[x,S]=$.useState();$.useLayoutEffect(()=>{if(!b)return;let e=()=>{let e=b.getBoundingClientRect();if(!e)return;let t={position:`fixed`,zIndex:9999};f===`top`?t.bottom=window.innerHeight-e.top+8:t.top=e.bottom+8,t.left=e.left,S(t)};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[b,f]);let C=!!(a||o||s),w=!!i,D=!!(r||n),O=g.kind===`cloud`?E.COMMON$CLOSE_CONVERSATION_STOP_RUNTIME:E.COMMON$STOP_CONVERSATION,k=g.kind===`cloud`&&!!c,j=_?.public||!1,M=!!b,ee=(0,Q.jsxs)(bt,{ref:y,testId:`conversation-name-context-menu`,position:f,alignment:`left`,className:U(m?`right-0 translate-x-[34%] left-auto`:``,M?`!static !top-auto !bottom-auto !left-auto !right-auto !mt-0`:``),children:[t&&(0,Q.jsx)(G,{testId:`rename-button`,onClick:t,children:(0,Q.jsx)(K,{icon:(0,Q.jsx)(Ct,{width:16,height:16}),text:h(E.BUTTON$RENAME)})}),C&&(0,Q.jsx)(He,{testId:`separator-tools`,inset:`menu`}),o&&(0,Q.jsx)(Ut,{isDisabled:v,children:(0,Q.jsx)(G,{testId:`show-skills-button`,onClick:o,isDisabled:v,children:(0,Q.jsx)(K,{icon:(0,Q.jsx)(wt,{width:16,height:16,className:`stroke-[1.75]`,"aria-hidden":!0}),text:h(E.CONVERSATION$SHOW_SKILLS)})})}),s&&(0,Q.jsx)(Ut,{isDisabled:v,children:(0,Q.jsx)(G,{testId:`show-hooks-button`,onClick:s,isDisabled:v,children:(0,Q.jsx)(K,{icon:(0,Q.jsx)(Yt,{width:16,height:16,"aria-hidden":!0}),text:h(E.CONVERSATION$SHOW_HOOKS)})})}),a&&(0,Q.jsx)(Ut,{isDisabled:v,children:(0,Q.jsx)(G,{testId:`show-agent-tools-button`,onClick:a,isDisabled:v,children:(0,Q.jsx)(K,{icon:(0,Q.jsx)(Ke,{width:16,height:16}),text:h(E.BUTTON$SHOW_AGENT_TOOLS_AND_METADATA)})})}),u&&(0,Q.jsx)(G,{testId:`download-trajectory-button`,onClick:u,children:(0,Q.jsx)(K,{icon:(0,Q.jsx)(ot,{width:16,height:16}),text:h(E.BUTTON$EXPORT_CONVERSATION)})}),(w||D)&&(0,Q.jsx)(He,{testId:`separator-info-control`,inset:`menu`}),i&&(0,Q.jsx)(G,{testId:`display-cost-button`,onClick:i,children:(0,Q.jsx)(K,{icon:(0,Q.jsx)(pt,{width:16,height:16}),text:h(E.BUTTON$DISPLAY_COST)})}),k&&c&&(0,Q.jsxs)(`li`,{className:`flex w-full items-center gap-2 rounded px-2 py-2 hover:bg-[var(--oh-interactive-hover)]`,children:[(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center text-[var(--oh-muted)]`,"aria-hidden":!0,children:(0,Q.jsx)(jn,{size:16})}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:h(E.CONVERSATION$SHARE_PUBLICLY)}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center`,children:[j&&d&&l&&(0,Q.jsxs)(`div`,{className:`mr-2 flex items-center gap-0.5`,children:[(0,Q.jsx)(`button`,{type:`button`,"data-testid":`copy-share-link-button`,onClick:l,className:`rounded p-0.5 text-[var(--oh-muted)] hover:bg-[var(--oh-interactive-selected)] hover:text-[var(--oh-foreground)] cursor-pointer [&_svg]:text-current`,title:h(E.BUTTON$COPY_TO_CLIPBOARD),children:(0,Q.jsx)(Dt,{width:14,height:14})}),(0,Q.jsx)(`a`,{"data-testid":`open-share-link-button`,href:d,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),className:`rounded p-0.5 text-[var(--oh-muted)] no-underline visited:text-[var(--oh-muted)] hover:bg-[var(--oh-interactive-selected)] hover:text-[var(--oh-foreground)] cursor-pointer [&_svg]:text-current`,title:h(E.BUTTON$OPEN_IN_NEW_TAB),children:(0,Q.jsx)(fe,{size:14,"aria-hidden":!0})})]}),(0,Q.jsx)(Hi,{isPublic:j,onToggle:c,ariaLabel:h(E.CONVERSATION$SHARE_PUBLICLY)})]})]}),r&&(0,Q.jsx)(Ut,{isDisabled:v,children:(0,Q.jsx)(G,{testId:`stop-button`,onClick:r,isDisabled:v,children:(0,Q.jsx)(K,{icon:(0,Q.jsx)(Ue,{width:16,height:16}),text:h(O)})})}),n&&(0,Q.jsx)(G,{testId:`delete-button`,onClick:n,children:(0,Q.jsx)(K,{icon:(0,Q.jsx)(xt,{width:16,height:16}),text:h(E.COMMON$DELETE_CONVERSATION)})})]});return M?typeof document>`u`||!x?null:Vi.createPortal((0,Q.jsx)(`div`,{style:x,children:ee}),document.body):ee}function Wi({onClose:e}){let{t}=T(`openhands`);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Qe,{onClose:e,testId:`close-metrics-modal`}),(0,Q.jsx)(`div`,{className:`w-full pr-6`,children:(0,Q.jsx)(Fe,{title:t(E.CONVERSATION$METRICS_INFO)})})]})}function Gi({currentCost:e,maxBudget:t}){let n=e/t*100;return(0,Q.jsx)(`div`,{className:`w-full h-1.5 bg-tertiary rounded-full overflow-hidden mt-1`,children:(0,Q.jsx)(`div`,{className:U(`h-full transition-all duration-300`,n>80?`bg-red-500`:`bg-blue-500`),style:{width:`${Math.min(100,n)}%`}})})}function Ki({currentCost:e,maxBudget:t}){let{t:n}=T(`openhands`),r=e/t*100;return(0,Q.jsx)(`div`,{className:`flex justify-end`,children:(0,Q.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:n(E.CONVERSATION$BUDGET_USAGE_FORMAT,{currentCost:`$${e.toFixed(4)}`,maxBudget:`$${t.toFixed(4)}`,usagePercentage:r.toFixed(2),used:n(E.CONVERSATION$USED)})})})}function qi({cost:e,maxBudgetPerTask:t}){let{t:n}=T(`openhands`);return e===null?null:(0,Q.jsx)(`div`,{className:`border-b border-[var(--oh-border-subtle)]`,children:t!==null&&t>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Gi,{currentCost:e,maxBudget:t}),(0,Q.jsx)(Ki,{currentCost:e,maxBudget:t})]}):(0,Q.jsx)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:n(E.CONVERSATION$NO_BUDGET_LIMIT)})})}function Ji({cost:e,maxBudgetPerTask:t}){let{t:n}=T(`openhands`);return e===null?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex justify-between items-center pb-2`,children:[(0,Q.jsx)(`span`,{className:`text-lg font-semibold`,children:n(E.CONVERSATION$TOTAL_COST)}),(0,Q.jsxs)(`span`,{className:`font-semibold`,children:[`$`,e.toFixed(4)]})]}),(0,Q.jsx)(qi,{cost:e,maxBudgetPerTask:t})]})}function Yi({label:e,value:t,labelClassName:n=``,valueClassName:r=`font-semibold`}){return(0,Q.jsxs)(`div`,{className:`flex justify-between items-center border-b border-[var(--oh-border-subtle)] pb-2`,children:[(0,Q.jsx)(`span`,{className:n,children:e}),(0,Q.jsx)(`span`,{className:r,children:t})]})}function Xi({usage:e}){let{t}=T(`openhands`);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Yi,{label:t(E.CONVERSATION$INPUT),value:e.prompt_tokens.toLocaleString()}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 pl-4 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-[var(--oh-muted)]`,children:t(E.CONVERSATION$CACHE_HIT)}),(0,Q.jsx)(`span`,{className:`text-right`,children:e.cache_read_tokens.toLocaleString()}),(0,Q.jsx)(`span`,{className:`text-[var(--oh-muted)]`,children:t(E.CONVERSATION$CACHE_WRITE)}),(0,Q.jsx)(`span`,{className:`text-right`,children:e.cache_write_tokens.toLocaleString()})]}),(0,Q.jsx)(Yi,{label:t(E.CONVERSATION$OUTPUT),value:e.completion_tokens.toLocaleString()}),(0,Q.jsx)(Yi,{label:t(E.CONVERSATION$TOTAL),value:(e.prompt_tokens+e.completion_tokens).toLocaleString(),labelClassName:`font-semibold`,valueClassName:`font-bold`})]})}function Zi({perTurnToken:e,contextWindow:t}){let{t:n}=T(`openhands`),r=t>0?e/t*100:0,i=Math.min(100,r);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,Q.jsx)(`span`,{className:`font-semibold`,children:n(E.CONVERSATION$CONTEXT_WINDOW)})}),(0,Q.jsx)(`div`,{className:`w-full h-1.5 bg-tertiary rounded-full overflow-hidden`,children:(0,Q.jsx)(`div`,{className:`h-full bg-foreground transition-all duration-300`,style:{width:`${i}%`}})}),(0,Q.jsx)(`div`,{className:`flex justify-end`,children:(0,Q.jsxs)(`span`,{className:`text-xs text-[var(--oh-muted)]`,children:[e.toLocaleString(),` / `,t.toLocaleString(),` (`,r.toFixed(2),`% `,n(E.CONVERSATION$USED),`)`]})})]})}function Qi(){let{t:e}=T(`openhands`);return(0,Q.jsx)(`div`,{className:`text-center`,children:(0,Q.jsx)(`p`,{className:`text-[var(--oh-muted)]`,children:e(E.CONVERSATION$NO_METRICS)})})}function $i(e){let{stats:t}=e;if(!t?.usage_to_metrics)return{accumulated_cost:0,max_budget_per_task:null,accumulated_token_usage:null};let n=0,r=null,i=null;for(let e of Object.values(t.usage_to_metrics))n+=e.accumulated_cost,r===null&&e.max_budget_per_task!==null&&(r=e.max_budget_per_task),e.accumulated_token_usage&&(i=i===null?{...e.accumulated_token_usage}:{prompt_tokens:i.prompt_tokens+e.accumulated_token_usage.prompt_tokens,completion_tokens:i.completion_tokens+e.accumulated_token_usage.completion_tokens,cache_read_tokens:i.cache_read_tokens+e.accumulated_token_usage.cache_read_tokens,cache_write_tokens:i.cache_write_tokens+e.accumulated_token_usage.cache_write_tokens,context_window:Math.max(i.context_window,e.accumulated_token_usage.context_window),per_turn_token:Math.max(i.per_turn_token,e.accumulated_token_usage.per_turn_token)});return{accumulated_cost:n,max_budget_per_task:r,accumulated_token_usage:i}}var ea=(e,t,n,r=!0)=>{let i=C({queryKey:[`conversation-metrics`,e,t,n],queryFn:async()=>{if(!e)throw Error(`Conversation ID is required`);return $i(await it.getRuntimeConversation(e,t,n))},enabled:r&&!!e&&!!t,staleTime:1e3*30,gcTime:1e3*60*5,refetchInterval:1e3*30,retry:!1});return{data:i.data,isLoading:i.isLoading,error:i.error}};function ta({isOpen:e,onOpenChange:t}){let n=yn(),{data:r}=J(),i=r?.id,a=r?.conversation_url,o=r?.session_api_key,{data:s}=ea(i,a,o,e),c=(0,$.useMemo)(()=>s?{cost:s.accumulated_cost,max_budget_per_task:s.max_budget_per_task,usage:s.accumulated_token_usage?{prompt_tokens:s.accumulated_token_usage.prompt_tokens??0,completion_tokens:s.accumulated_token_usage.completion_tokens??0,cache_read_tokens:s.accumulated_token_usage.cache_read_tokens??0,cache_write_tokens:s.accumulated_token_usage.cache_write_tokens??0,context_window:s.accumulated_token_usage.context_window??0,per_turn_token:s.accumulated_token_usage.per_turn_token??0}:null}:n,[s,n]);return e?(0,Q.jsx)(Ne,{onClose:()=>t(!1),children:(0,Q.jsxs)(Pe,{testID:`metrics-modal`,className:`relative items-start border border-[var(--oh-border)]`,children:[(0,Q.jsx)(Wi,{onClose:()=>t(!1)}),(0,Q.jsxs)(`div`,{className:`w-full`,children:[(c?.cost!==null||c?.usage!==null)&&(0,Q.jsx)(`div`,{className:`rounded-md border border-[var(--oh-border)] bg-surface-raised p-3`,children:(0,Q.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Q.jsx)(Ji,{cost:c?.cost??null,maxBudgetPerTask:c?.max_budget_per_task??null}),c?.usage!==null&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Xi,{usage:c.usage}),(0,Q.jsx)(Zi,{perTurnToken:c.usage.per_turn_token,contextWindow:c.usage.context_window})]})]})}),!c?.cost&&!c?.usage&&(0,Q.jsx)(`div`,{className:`rounded-md border border-[var(--oh-border)] bg-surface-raised p-3`,children:(0,Q.jsx)(Qi,{})})]})]})}):null}function na(){let{t:e}=T(`openhands`),{conversationId:t}=q(),{data:n}=J(),{mutate:r}=ht(),[i,a]=$.useState(`view`),[o,s]=$.useState(!1),c=$.useRef(null),l=$.useRef(null),{handleDelete:u,handleStop:d,handleDownloadConversation:f,handleDisplayCost:p,handleShowAgentTools:m,handleShowSkills:h,handleShowHooks:g,handleTogglePublic:_,handleCopyShareLink:v,shareUrl:y,handleConfirmDelete:b,handleConfirmStop:x,metricsModalVisible:S,setMetricsModalVisible:C,systemModalVisible:w,setSystemModalVisible:D,skillsModalVisible:k,setSkillsModalVisible:A,hooksModalVisible:j,setHooksModalVisible:M,confirmDeleteModalVisible:ee,setConfirmDeleteModalVisible:te,confirmStopModalVisible:N,setConfirmStopModalVisible:P,systemMessage:F,shouldShowStop:ne,shouldShowDownloadConversation:re,shouldShowDisplayCost:ie,shouldShowAgentTools:I,shouldShowSkills:L,shouldShowHooks:ae}=Jt({conversationId:t,executionStatus:n?.execution_status,showOptions:!0,onContextMenuToggle:s});return $.useEffect(()=>{i===`edit`&&c.current?.focus()},[i]),n?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 h-[22px] text-base font-normal text-left pl-0 lg:pl-1 min-w-0`,"data-testid":`conversation-name`,children:[i===`edit`?(0,Q.jsx)(`input`,{ref:c,"data-testid":`conversation-name-input`,onClick:e=>{i===`edit`&&(e.preventDefault(),e.stopPropagation())},onBlur:()=>{if(c.current?.value&&t){let i=c.current.value.trim();i!==n?.title&&r({conversationId:t,newTitle:i},{onSuccess:()=>{O(e(E.CONVERSATION$TITLE_UPDATED))}})}else c.current&&(c.current.value=n?.title??``);a(`view`)},onKeyUp:e=>{e.nativeEvent.isComposing||e.key===`Enter`&&e.currentTarget.blur()},type:`text`,defaultValue:n.title||``,className:`text-white leading-5 bg-transparent border-none outline-none text-base font-normal w-fit max-w-fit field-sizing-content`}):(0,Q.jsx)(`div`,{className:`text-white leading-5 truncate`,"data-testid":`conversation-name-title`,onDoubleClick:()=>{a(`edit`)},title:n.title||``,children:n.title}),i!==`edit`&&(0,Q.jsxs)(`div`,{ref:l,className:`relative flex items-center shrink-0`,children:[(0,Q.jsx)(St,{onClick:e=>{e.preventDefault(),e.stopPropagation(),s(!o)}}),o&&(0,Q.jsx)(Ui,{onClose:()=>s(!1),onRename:e=>{e.preventDefault(),e.stopPropagation(),a(`edit`),s(!1)},onDelete:u,onStop:ne?d:void 0,onDisplayCost:ie?p:void 0,onShowAgentTools:I?m:void 0,onShowSkills:L?h:void 0,onShowHooks:ae?g:void 0,onTogglePublic:_,onCopyShareLink:v,shareUrl:y,onDownloadConversation:re?f:void 0,position:`bottom`,anchorRef:l})]})]}),(0,Q.jsx)(ta,{isOpen:S,onOpenChange:C}),(0,Q.jsx)(nn,{isOpen:w,onClose:()=>D(!1),systemMessage:F||null}),k&&(0,Q.jsx)(Vt,{onClose:()=>A(!1)}),j&&(0,Q.jsx)(Gt,{onClose:()=>M(!1)}),ee&&(0,Q.jsx)(ct,{onConfirm:b,onCancel:()=>te(!1),conversationTitle:n?.title||``}),N&&(0,Q.jsx)(st,{onConfirm:x,onCancel:()=>P(!1)})]}):null}function ra({children:e,tooltip:t,ariaLabel:n}){return(0,Q.jsx)(ze,{content:t,placement:`bottom`,tooltipClassName:`bg-white text-black text-xs font-medium leading-5`,children:(0,Q.jsx)(`span`,{"data-aria-label":n,children:e})})}function ia({className:e}){let{t}=T(`openhands`),n=Dn(),r=on(),i=f(),{conversationId:a}=q(),{isRightPanelShown:o,setHasRightPanelToggled:s,setIsRightPanelShown:c,setSelectedTab:l}=W(),u=()=>{if(r)return;if(n){if(!a)return;s(!0),c(!0);let{selectedTab:e}=W.getState();e||l(`files`),i(`/conversations/${a}/panel`);return}let e=!o;if(s(e),e){let{selectedTab:e}=W.getState();e||l(`files`)}},d=t(r?E.CONVERSATION$UNAVAILABLE_FOR_ARCHIVES:n?E.COMMON$SHOW_PANEL:o?E.COMMON$HIDE_PANEL:E.COMMON$SHOW_PANEL),p=n?!1:o;return(0,Q.jsx)(ra,{tooltip:d,ariaLabel:d,children:(0,Q.jsx)(`button`,{type:`button`,onClick:u,disabled:r,className:U(ft,r&&`cursor-not-allowed opacity-50 hover:bg-transparent hover:text-[var(--oh-muted)]`,e),"aria-label":d,"aria-pressed":p,"aria-disabled":r,"data-testid":`right-panel-toggle`,children:(0,Q.jsx)(dt,{className:`w-5 h-5 -scale-x-100`})})})}function aa(){let{conversationId:e}=q(),{data:t}=J(),{curAgentState:n}=Y(),{isTask:r,taskStatus:i}=Ft(),{mutate:a}=We(),{mutate:o}=Fi(),{providers:s}=qe(),c=t?.execution_status??null,l=Ee({isPausing:!1,isTask:r,taskStatus:i,isStartingStatus:n===V.LOADING||n===V.INIT,isStopStatus:Oe(c),curAgentState:n});return(0,Q.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`group relative shrink-0`,children:[(0,Q.jsx)(mi,{className:`ml-[3.5px] w-6 h-6 cursor-pointer`,color:l}),(0,Q.jsx)(Bi,{onClose:()=>{},onStopServer:be(c)?t=>{t.preventDefault(),t.stopPropagation(),e&&a({conversationId:e})}:void 0,onStartServer:H(c)?t=>{t.preventDefault(),t.stopPropagation(),e&&o({conversationId:e,providers:s})}:void 0,executionStatus:c,position:`bottom`,className:`opacity-0 invisible pointer-events-none group-hover:opacity-100 group-hover:visible group-hover:pointer-events-auto bottom-full left-0 mt-0 min-h-fit`,isPausing:!1})]}),(0,Q.jsx)(na,{})]}),(0,Q.jsx)(ia,{className:`mr-2`})]})}var oa=e=>(0,Q.jsxs)(`svg`,{width:20,height:20,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,Q.jsx)(`path`,{d:`M3 10.5L6.5 14L14 6`,stroke:`currentColor`,strokeWidth:2.2,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,Q.jsx)(`path`,{d:`M7 10.5L10.5 14L18 6`,stroke:`currentColor`,strokeWidth:2.2,strokeLinecap:`round`,strokeLinejoin:`round`})]}),sa=160,ca={duration:.22,ease:[.4,0,.2,1]};function la({tabValue:e,icon:t,onClick:n,isActive:r,label:i,className:a,measureOnly:o,suppressLayoutAnimation:s=!1}){let c=P(),l=o||c||!1,u=!l&&!s,d=U(`flex items-center rounded-md cursor-pointer`,`pl-1.5 pr-2 py-1 lg:py-1.5`,`text-[var(--oh-muted)] bg-transparent`,r&&`bg-[var(--oh-interactive-active)] text-white`,r?`hover:text-white hover:bg-[var(--oh-interactive-hover)]`:`hover:text-white hover:bg-white/5`,r?`focus-within:text-white`:`focus-within:text-[var(--oh-muted)]`,a),f=(0,Q.jsx)(t,{className:U(`h-4 w-4 shrink-0 text-inherit`)}),p=i&&r?(0,Q.jsx)(`span`,{className:`whitespace-nowrap text-sm font-normal`,children:i}):null,m=i?(0,Q.jsx)(z.span,{initial:!1,animate:{maxWidth:r?sa:0,opacity:+!!r,marginLeft:r?8:0},transition:ca,className:`block overflow-hidden whitespace-nowrap text-sm font-normal`,"aria-hidden":!r,children:i}):null;return l?(0,Q.jsxs)(`button`,{type:`button`,onClick:n,...o?{}:{"data-testid":`conversation-tab-${e}`},"data-tab-measure":o?`true`:void 0,className:U(d,`gap-2`),children:[f,p]}):(0,Q.jsxs)(z.button,{layout:u?`position`:!1,type:`button`,onClick:n,...o?{}:{"data-testid":`conversation-tab-${e}`},"data-tab-measure":o?`true`:void 0,className:d,transition:u?{layout:ca}:void 0,children:[f,m]})}var ua=e=>(0,Q.jsx)(`svg`,{viewBox:`0 0 128 128`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,Q.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`,d:`M90.767 127.126a7.968 7.968 0 0 0 6.35-.244l26.353-12.681a8 8 0 0 0 4.53-7.209V21.009a8 8 0 0 0-4.53-7.21L97.117 1.12a7.97 7.97 0 0 0-9.093 1.548l-50.45 46.026L15.6 32.013a5.328 5.328 0 0 0-6.807.302l-7.048 6.411a5.335 5.335 0 0 0-.006 7.888L20.796 64 1.74 81.387a5.336 5.336 0 0 0 .006 7.887l7.048 6.411a5.327 5.327 0 0 0 6.807.303l21.974-16.68 50.45 46.025a7.96 7.96 0 0 0 2.743 1.793Zm5.252-92.183L57.74 64l38.28 29.058V34.943Z`})});function da(){let e=Ae().backend;if(e.kind!==`cloud`)throw Error(`Cloud sandboxes call requires a cloud backend.`);return e}async function fa(e){if(e.length===0)return[];let t=da(),n=new URLSearchParams;for(let t of e)n.append(`id`,t);return await Me({backend:t,method:`GET`,path:`/api/v1/sandboxes?${n.toString()}`})??[]}var pa=e=>{let t=A(),n=t.backend.kind===`cloud`;return C({queryKey:[`cloud`,`sandbox`,t.backend.id,t.orgId,e],queryFn:async()=>{if(!e)return null;let[t]=await fa([e]);return t??null},enabled:n&&!!e,staleTime:1e3*60*5,gcTime:1e3*60*15})},ma=`VSCODE`,ha=()=>{let{t:e}=T(`openhands`),{conversationId:t}=q(),n=Tn({allowAgentError:!0}),{data:r}=J(),i=A(),a=r?.conversation_url??null,o=r?.session_api_key??null,s=r?.sandbox_id??null,c=i.backend.kind===`cloud`,l=pa(c?s:null),u=C({queryKey:[`unified`,`vscode_url`,`local`,t,a,o],queryFn:async()=>{if(!t)throw Error(`No conversation ID`);return{url:ut((await it.getVSCodeUrl(t,a,o).catch(()=>yt.getVSCodeUrl(t))).vscode_url)}},enabled:!c&&n&&!!t,refetchOnMount:!0,retry:3}),d,f,p,m,h,g,_;if(c){let e=l.data?.exposed_urls?.find(e=>e.name===ma)?.url??null;d=l.isSuccess?{url:ut(e)}:void 0,f=l.isLoading,p=l.isError,m=l.isSuccess,h=l.status,g=l.error,_=async()=>{let e=await l.refetch(),t=e.data?.exposed_urls?.find(e=>e.name===ma)?.url??null;return{data:e.data?{url:ut(t)}:void 0}}}else d=u.data,f=u.isLoading,p=u.isError,m=u.isSuccess,h=u.status,g=u.error,_=async()=>({data:(await u.refetch()).data});let v=d&&!d.url?e(E.VSCODE$URL_NOT_AVAILABLE):null;return{data:d?{...d,error:v}:void 0,error:g,isLoading:f,isError:p,isSuccess:m,status:h,refetch:_}};function ga(){let{t:e}=T(`openhands`),{curAgentState:t}=Y(),{data:n,refetch:r,isLoading:i}=ha(),a=ye.includes(t);return(0,Q.jsxs)(`button`,{type:`button`,onClick:async()=>{let e=n?.url;e||=(await r()).data?.url??null,e&&window.open(e,`_blank`,`noopener,noreferrer`)},disabled:i||a,"aria-label":e(E.VSCODE$OPEN),title:e(E.VSCODE$OPEN),"data-testid":`drawer-vscode-link`,className:U(`inline-flex items-center gap-1.5 rounded-[7px] border border-[var(--oh-border)] bg-base-secondary px-2 py-1 text-xs`,`text-[var(--oh-muted)] transition-colors hover:enabled:bg-surface-raised hover:enabled:text-white`,`cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed`),children:[(0,Q.jsx)(ua,{className:`h-[15px] w-[15px] shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:e(E.FILES$VSCODE)}),(0,Q.jsx)(fe,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0,strokeWidth:2})]})}var _a=e=>(0,Q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,Q.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M7.13832 8.76476C8.25957 8.17949 9.52697 7.9727 10.7515 8.14436L14.9025 2.52826L21.4717 9.09737L15.8555 13.2484C16.0272 14.4729 15.8204 15.7403 15.2351 16.8616C15.1872 16.9535 15.1366 17.0444 15.0836 17.1343C14.8318 17.5605 14.5228 17.9624 14.1566 18.3286L10.4443 14.6163L4.75207 20.3085H3.69141V19.2478L9.38361 13.5556L5.6713 9.84332C6.03755 9.47708 6.43936 9.16808 6.86562 8.91632C6.95547 8.86326 7.04641 8.81274 7.13832 8.76476ZM15.0735 4.82054L19.1794 8.92641L14.2461 12.5727L14.3701 13.4567C14.492 14.3266 14.3596 15.2233 13.9758 16.0265L7.97338 10.0241C8.77665 9.64035 9.67335 9.50789 10.5432 9.62984L11.4272 9.75376L15.0735 4.82054Z`,fill:`currentColor`})}),va=e=>(0,Q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,Q.jsx)(`path`,{d:`M10.9706 10.1586C10.2819 10.0621 9.56905 10.1784 8.93842 10.5075C8.88672 10.5345 8.83557 10.5629 8.78504 10.5928C8.54529 10.7344 8.3193 10.9082 8.11331 11.1142L9.83702 12.8372L7.00054 15.75L7 17H8.25064L11.1628 14.1632L12.8857 15.8865C13.0917 15.6805 13.2655 15.4545 13.4071 15.2147C13.437 15.1642 13.4654 15.1131 13.4924 15.0614C13.8215 14.4308 13.9378 13.718 13.8413 13.0293L17 10.6946L13.3053 7L10.9706 10.1586Z`,fill:`currentColor`})});function ya({isOpen:e,onClose:t,ignoreOutsideClickRef:n,anchorRef:r}){let i=gt(t,n),[a,o]=(0,$.useState)();(0,$.useLayoutEffect)(()=>{if(!e||!r?.current){o(void 0);return}let t=()=>{let e=r.current?.getBoundingClientRect();e&&o({position:`fixed`,zIndex:9999,top:e.bottom+8,left:e.left})};return t(),window.addEventListener(`resize`,t),window.addEventListener(`scroll`,t,!0),()=>{window.removeEventListener(`resize`,t),window.removeEventListener(`scroll`,t,!0)}},[e,r]);let{t:s}=T(`openhands`),{conversationId:c}=q(),{state:l,setUnpinnedTabs:u,setSelectedTab:d}=Ze(c),{selectedTab:f,isRightPanelShown:p,setSelectedTab:m}=W(),{navigateToTab:h}=R(),{hasTaskList:g}=On(),{backend:_}=A(),v=on(),y=[{tab:`planner`,icon:B,i18nKey:E.COMMON$PLANNER},{tab:`files`,icon:kt,i18nKey:E.COMMON$FILES},{tab:`terminal`,icon:me,i18nKey:E.COMMON$TERMINAL},{tab:`browser`,icon:An,i18nKey:E.COMMON$BROWSER}];g&&y.unshift({tab:`tasklist`,icon:oa,i18nKey:E.COMMON$TASK_LIST});let b=y.filter(({tab:e})=>e!==`planner`||_.kind===`cloud`),x=e=>{v||(h(e),t())},S=(e,t)=>{if(v){t.preventDefault(),t.stopPropagation();return}if(t.preventDefault(),t.stopPropagation(),l.unpinnedTabs.includes(e))u(l.unpinnedTabs.filter(t=>t!==e));else{let t=[...l.unpinnedTabs,e];if(u(t),f===e&&p){let n=b.find(({tab:n})=>n!==e&&!t.includes(n));n&&(m(n.tab),d(n.tab))}}};if(!e)return null;let C=!!(r?.current&&a),w=(0,Q.jsx)(bt,{ref:i,theme:C?`popover`:`default`,position:C?`none`:`bottom`,alignment:C?`none`:`left`,spacing:C?`none`:`default`,className:U(`z-[9999] w-fit`,C?`mt-0`:`mt-2`),children:b.map(({tab:e,icon:t,i18nKey:n})=>{let r=!l.unpinnedTabs.includes(e);return(0,Q.jsx)(`li`,{className:`list-none`,children:(0,Q.jsx)(Ut,{isDisabled:v,children:(0,Q.jsxs)(`div`,{className:U(`group flex h-[30px] w-full min-w-0 items-stretch rounded`,!v&&`hover:bg-[var(--oh-interactive-hover)]`,v&&`opacity-50`),children:[(0,Q.jsxs)(`button`,{type:`button`,"data-testid":`conversation-tabs-menu-open-${e}`,disabled:v,className:U(`flex min-w-0 flex-1 items-center gap-2 rounded-l p-2 text-start text-white`,Be,v?`cursor-not-allowed`:`cursor-pointer`),onClick:()=>x(e),children:[(0,Q.jsx)(`span`,{className:Ve,"aria-hidden":!0,children:(0,Q.jsx)(t,{className:`h-4 w-4`})}),(0,Q.jsx)(`span`,{className:`text-sm`,children:s(n)})]}),(0,Q.jsx)(`button`,{type:`button`,"data-testid":`conversation-tabs-menu-pin-${e}`,disabled:v,className:U(`flex shrink-0 items-center justify-center rounded-r px-2 text-white`,Be,v?`cursor-not-allowed`:`cursor-pointer hover:bg-white/10`),"aria-pressed":r,"aria-label":s(r?E.CONVERSATION$UNPIN_TAB:E.CONVERSATION$PIN_TAB),onClick:t=>S(e,t),children:r?(0,Q.jsx)(`span`,{className:U(`-mr-[5px] ml-auto`,Ve),"aria-hidden":!0,children:(0,Q.jsx)(va,{className:`h-7 w-7`})}):(0,Q.jsx)(`span`,{className:U(`ml-auto`,Ve),"aria-hidden":!0,children:(0,Q.jsx)(_a,{className:`h-4.5 w-4.5`})})})]})})},e)})});return C&&a&&typeof document<`u`?Vi.createPortal((0,Q.jsx)(`div`,{style:a,children:w}),document.body):w}function ba({variant:e=`default`,isPanelResizing:t=!1}){let{conversationId:n}=q(),{setSelectedTab:r,planContent:i}=W(),[a,o]=(0,$.useState)(!1),{state:s}=Ze(n),{hasTaskList:c}=On(),{backend:l}=A(),{handleBuildPlanClick:u}=L(),{curAgentState:d}=Y(),{selectTab:f,isTabActive:p,onTabChange:m,selectedTab:h,isRightPanelShown:g}=R();(0,$.useEffect)(()=>{r(s.selectedTab)},[r,s.selectedTab]),(0,$.useEffect)(()=>{g&&(h||m(`files`))},[g,h,m]);let{t:_,i18n:v}=T(`openhands`),y=[{tabValue:`files`,isActive:p(`files`),icon:kt,onClick:()=>f(`files`),tooltipContent:_(E.COMMON$FILES),tooltipAriaLabel:_(E.COMMON$FILES),label:_(E.COMMON$FILES)},{tabValue:`planner`,isActive:p(`planner`),icon:B,onClick:()=>f(`planner`),tooltipContent:_(E.COMMON$PLANNER),tooltipAriaLabel:_(E.COMMON$PLANNER),label:_(E.COMMON$PLANNER)},{tabValue:`terminal`,isActive:p(`terminal`),icon:me,onClick:()=>f(`terminal`),tooltipContent:_(E.COMMON$TERMINAL),tooltipAriaLabel:_(E.COMMON$TERMINAL),label:_(E.COMMON$TERMINAL),className:`pl-2`},{tabValue:`browser`,isActive:p(`browser`),icon:An,onClick:()=>f(`browser`),tooltipContent:_(E.COMMON$BROWSER),tooltipAriaLabel:_(E.COMMON$BROWSER),label:_(E.COMMON$BROWSER)}];c&&y.splice(1,0,{tabValue:`tasklist`,isActive:p(`tasklist`),icon:oa,onClick:()=>f(`tasklist`),tooltipContent:_(E.COMMON$TASK_LIST),tooltipAriaLabel:_(E.COMMON$TASK_LIST),label:_(E.COMMON$TASK_LIST)});let b=y.filter(e=>e.tabValue===`planner`&&l.kind!==`cloud`?!1:s.unpinnedTabs.includes(e.tabValue)?h===e.tabValue:!0),x=s.unpinnedTabs.join(`,`),S=d===V.RUNNING||d===V.LOADING||!i,C=(0,$.useRef)(null),w=(0,$.useRef)(null),D=(0,$.useRef)(null),O=(0,$.useRef)(null),k=(0,$.useRef)(null),[j,M]=(0,$.useState)(b.length);(0,$.useLayoutEffect)(()=>{let e=C.current,t=w.current,n=D.current,r=O.current;if(!e||!t||!n||!r)return;let i=()=>{let i=t.querySelectorAll(`[data-tab-measure="true"]`),a=i.length,o=e.getBoundingClientRect().width;if(o===0){M(a);return}let s=Array.from(i).map(e=>e.getBoundingClientRect().width);if(s.length!==a||a===0){M(Math.max(0,a));return}let c=n.getBoundingClientRect().width,l=r.getBoundingClientRect().width,u=getComputedStyle(e).columnGap||getComputedStyle(e).gap,d=parseFloat(u)||6,f=0;for(let e=a;e>=0;--e){let t=c+l;for(let n=0;n<e;n+=1)t+=s[n]??0;if(e>0&&(t+=e*d),t<=o+.5){f=e;break}}M(e=>e===f?e:f)};if(i(),typeof ResizeObserver>`u`)return;let a=new ResizeObserver(i);return a.observe(e),()=>a.disconnect()},[x,b.length,c,l.kind,h,g,v.language]);let ee=Math.min(j,b.length);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:U(`relative w-full min-w-0`,e===`compact`?`flex h-full min-h-0 items-center py-0 pl-0 pr-1`:`min-h-10 p-1`),children:[(0,Q.jsx)(`div`,{ref:w,"aria-hidden":!0,className:`pointer-events-none absolute top-0 left-[-10000px] flex flex-nowrap items-center gap-1.5`,children:b.map(({tabValue:e,icon:t,isActive:n,tooltipContent:r,tooltipAriaLabel:i,label:a,className:o},s)=>(0,Q.jsx)(ra,{tooltip:r,ariaLabel:i,children:(0,Q.jsx)(la,{tabValue:e,icon:t,onClick:()=>{},isActive:n,label:a,className:U(o,`shrink-0`),measureOnly:!0})},`measure-${e}-${s}`))}),(0,Q.jsxs)(`div`,{ref:C,className:`flex w-full min-w-0 flex-nowrap items-center justify-start`,children:[(0,Q.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center justify-start overflow-hidden`,children:(0,Q.jsxs)(`div`,{className:`flex w-fit max-w-full min-w-0 items-center gap-1.5`,children:[(0,Q.jsx)(zn,{id:`conversation-drawer-tabs`,children:(0,Q.jsx)(`div`,{className:`flex w-fit max-w-full min-w-0 flex-nowrap items-center gap-1.5 overflow-x-hidden`,children:b.slice(0,ee).map(({tabValue:e,icon:n,onClick:r,isActive:i,tooltipContent:a,tooltipAriaLabel:o,label:s,className:c},l)=>(0,Q.jsx)(ra,{tooltip:a,ariaLabel:o,children:(0,Q.jsx)(la,{tabValue:e,icon:n,onClick:r,isActive:i,label:s,className:U(c,`shrink-0`),suppressLayoutAnimation:t})},`${e}-${l}`))})}),(0,Q.jsxs)(`div`,{ref:D,className:`relative shrink-0`,children:[(0,Q.jsx)(St,{ref:k,onClick:()=>o(!a),ariaLabel:_(E.COMMON$MORE_OPTIONS),iconClassName:e===`compact`?lt:void 0}),(0,Q.jsx)(ya,{isOpen:a,onClose:()=>o(!1),ignoreOutsideClickRef:k,anchorRef:k})]})]})}),(0,Q.jsx)(`div`,{ref:O,className:U(`ml-auto shrink-0`,l.kind===`cloud`&&`pr-1`),children:l.kind===`cloud`&&(0,Q.jsx)(ga,{})})]})]}),p(`planner`)&&(0,Q.jsx)(`div`,{className:U(`flex h-10 min-h-10 shrink-0 items-center border-t border-[var(--oh-border)] pl-[10px] pr-1`),children:(0,Q.jsx)(`button`,{type:`button`,onClick:u,disabled:S,className:U(`flex h-5 min-w-17 items-center justify-center rounded bg-white px-2 transition-opacity`,S?`cursor-not-allowed opacity-50`:`cursor-pointer hover:opacity-90`),"data-testid":`planner-tab-build-button`,children:(0,Q.jsxs)(Ot.Text,{className:`text-[11px] font-normal leading-5 text-black`,children:[_(E.COMMON$BUILD),` ⌘↩`]})})})]})}function xa({onMouseDown:e,className:t,isDragging:n=!1}){let[r,i]=(0,$.useState)(!1),a=n||r;return(0,Q.jsxs)(`div`,{className:U(`relative z-10 w-0 shrink-0 self-stretch`,t),"aria-hidden":!0,children:[(0,Q.jsx)(`div`,{className:`absolute inset-y-0 left-1/2 w-3 min-w-[12px] -translate-x-1/2 cursor-ew-resize`,onMouseDown:e,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1)}),(0,Q.jsx)(`div`,{className:U(`pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 transition-colors`,a?`bg-white`:`bg-transparent`),"aria-hidden":!0})]})}var Sa=200;function Ca({defaultLeftWidth:e=50,minLeftWidth:t=30,maxLeftWidth:n=80,storageKey:r=`desktop-layout-panel-width`}={}){let[i,a]=kn(r,e),o=(0,$.useCallback)(e=>Math.max(t,Math.min(n,e)),[t,n]),[s,c]=(0,$.useState)(()=>o(i)),[l,u]=(0,$.useState)(!1),d=(0,$.useRef)(null),f=(0,$.useCallback)(e=>{e.preventDefault(),u(!0)},[]),p=(0,$.useCallback)(e=>{if(!l||!d.current)return;let t=d.current.getBoundingClientRect();c(o((e.clientX-t.left)/t.width*100))},[l,o]),m=(0,$.useCallback)(()=>{l&&(u(!1),a(s))},[l,s,a]);return(0,$.useLayoutEffect)(()=>{if(!l)return;let e=document.createElement(`div`);return e.setAttribute(`aria-hidden`,`true`),e.dataset.panelDragShield=``,Object.assign(e.style,{position:`fixed`,inset:`0`,zIndex:String(Sa),cursor:`ew-resize`}),document.body.appendChild(e),document.addEventListener(`mousemove`,p),document.addEventListener(`mouseup`,m),document.body.style.cursor=`ew-resize`,document.body.style.userSelect=`none`,()=>{document.removeEventListener(`mousemove`,p),document.removeEventListener(`mouseup`,m),document.body.style.cursor=``,document.body.style.userSelect=``,e.remove()}},[l,p,m]),{leftWidth:s,rightWidth:100-s,isDragging:l,containerRef:d,handleMouseDown:f}}function wa(e){return e?`translate-x-0 opacity-100`:`w-0 translate-x-full opacity-0`}function Ta(){let e=Dn(),t=Dn(767),{isRightPanelShown:n}=W(),{leftWidth:r,rightWidth:i,isDragging:a,containerRef:o,handleMouseDown:s}=Ca({defaultLeftWidth:50,minLeftWidth:30,maxLeftWidth:80,storageKey:`desktop-layout-panel-width`});return(0,Q.jsx)(`div`,{className:U(e?`relative min-h-0 flex-1 flex flex-col`:`h-full flex flex-col overflow-hidden`),children:(0,Q.jsxs)(`div`,{ref:o,className:U(`flex flex-1 overflow-hidden`,e?`flex-col`:`transition-all duration-300 ease-in-out`),style:e?void 0:{transitionProperty:a?`none`:`all`},children:[(0,Q.jsxs)(`div`,{className:U(`flex flex-col bg-base overflow-hidden`,e?`flex-1`:`transition-all duration-300 ease-in-out`),style:e?void 0:{width:n?`${r}%`:`100%`,transitionProperty:a?`none`:`all`},children:[(0,Q.jsxs)(`div`,{"data-testid":`chat-pane-header`,className:U(`flex h-10 min-h-10 shrink-0 items-center`,t&&`gap-2 pl-2.5`),children:[t?(0,Q.jsx)(mt,{}):null,(0,Q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Q.jsx)(aa,{})})]}),(0,Q.jsx)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:(0,Q.jsx)(yi,{isRightPanelShown:!e&&n})})]}),!e&&n&&(0,Q.jsx)(xa,{onMouseDown:s,isDragging:a}),!e&&(0,Q.jsx)(`div`,{className:U(`transition-all duration-300 ease-in-out overflow-hidden`,wa(n)),style:{width:n?`${i}%`:`0%`,transitionProperty:a?`opacity, transform`:`all`},children:(0,Q.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col flex-1 min-h-0 bg-[var(--oh-surface)] border-l border-[var(--oh-border)] overflow-hidden`,children:[(0,Q.jsx)(`div`,{"data-testid":`tabs-pane-header`,className:`flex shrink-0 flex-col border-b border-[var(--oh-border)]`,children:(0,Q.jsx)(ba,{isPanelResizing:a})}),(0,Q.jsx)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:(0,Q.jsx)(Pi,{})})]})})})]})})}function Ea({onNavigateBack:e}){let{t}=T(`openhands`),{setIsRightPanelShown:n,setHasRightPanelToggled:r,setSelectedTab:i}=W();return $.useLayoutEffect(()=>(n(!0),r(!0),W.getState().selectedTab||i(`files`),()=>{n(!1),r(!1)}),[n,r,i]),(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-[var(--oh-surface)]`,children:[(0,Q.jsxs)(`div`,{"data-testid":`conversation-mobile-panel-top`,className:`flex h-10 min-h-10 shrink-0 items-center gap-1.5 border-b border-[var(--oh-border)] pl-2.5`,children:[(0,Q.jsx)(`button`,{type:`button`,"data-testid":`conversation-mobile-panel-back`,onClick:()=>{e()},"aria-label":t(E.COMMON$BACK),className:ft,children:(0,Q.jsx)(ue,{size:20,className:lt,"aria-hidden":!0,strokeWidth:2})}),(0,Q.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 items-center self-stretch`,children:(0,Q.jsx)(`div`,{"data-testid":`tabs-pane-header`,className:`flex h-full min-h-0 w-full min-w-0 flex-col justify-center`,children:(0,Q.jsx)(ba,{variant:`compact`})})})]}),(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-[var(--oh-surface)]`,children:(0,Q.jsx)(Pi,{})})]})}var Da=1e3*60*5,Oa=1e3*60*15,ka=e=>{let t=e||[],n=A();return C({queryKey:[`v1`,`sub-conversations`,t,n.backend.id,n.orgId],queryFn:async()=>t.length===0?[]:it.batchGetAppConversations(t),enabled:t.length>0,staleTime:Da,gcTime:Oa,retry:!1})};function Aa({children:e,conversationId:t}){let{data:n}=J(),{data:r}=ka(n?.sub_conversation_ids??[]),i=r?.filter(e=>e!==null);return(0,Q.jsx)(hn,{conversationId:t,conversationUrl:n?.sandbox_status===`PAUSED`?null:n?.conversation_url,sessionApiKey:n?.session_api_key,subConversationIds:n?.sub_conversation_ids,subConversations:i,children:e})}function ja(){let{t:e}=T(`openhands`),{conversationId:t}=q(),n=u(`/conversations/:conversationId/panel`),{isTask:r,taskStatus:i,taskDetail:a}=Ft(),o=A(),s=$.useRef(o.backend.id),c=$.useRef(o.orgId),l=s.current!==o.backend.id||c.current!==o.orgId,{data:d,isFetched:m}=J(),{data:h}=at(),{resetConversationState:g}=W(),_=f(),v=p(),y=wn(e=>e.clearTerminal),b=Et(e=>e.reset),x=Vn(e=>e.setCurrentAgentState),S=pn(e=>e.removeErrorMessage);$.useEffect(()=>{y(),g(),b(),x(V.LOADING),S()},[t,y,g,b,x,S]),$.useEffect(()=>{if(r&&i===`ERROR`){D(a||e(E.CONVERSATION$FAILED_TO_START_FROM_TASK));let t=v.state?.resumedFromConversationId;_(t?`/conversations/${t}`:`/conversations`,{replace:!0})}},[r,i,a,e,_,v.state]),$.useEffect(()=>{!m||!h||l||d||(qn(o.backend.id,o.orgId),D(e(E.CONVERSATION$NOT_EXIST_OR_NO_PERMISSION)),_(`/conversations`))},[d,m,h,_,e,l,o.backend.id,o.orgId]),$.useEffect(()=>{l||t&&(t.startsWith(`task-`)||Kn(o.backend.id,o.orgId,t))},[t,l,o.backend.id,o.orgId]);let C=$.useRef(null);return $.useEffect(()=>{!m||!d||o.backend.kind===`cloud`&&d.sandbox_status===`PAUSED`&&d.sandbox_id&&C.current!==d.id&&(C.current=d.id,rt(d.sandbox_id).catch(()=>{D(e(E.CONVERSATION$FAILED_TO_START_FROM_TASK))}))},[m,d?.id,d?.sandbox_status,d?.sandbox_id,o.backend.kind,e]),l?null:(0,Q.jsx)(Aa,{conversationId:t,children:(0,Q.jsx)($n,{children:(0,Q.jsx)(`div`,{"data-testid":`app-route`,className:`flex h-full flex-col`,children:n?(0,Q.jsx)(Ea,{onNavigateBack:()=>_(`/conversations/${t}`)}):(0,Q.jsx)(Ta,{})})})})}function Ma(){return(0,Q.jsx)(ja,{})}var Na=d(Ma);export{Na as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n,xt as r}from"./vendor-styling-CI0PQ3ab.js";import{n as i}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~i3v2mlbw-BrJQ3XZH.js";import{t as a}from"./useMutation-DCE9RcgK.js";import{t as o}from"./useQuery-CpjHYtZc.js";import{t as s}from"./useTranslation-Cgy4JA_g.js";import{t as c}from"./declaration-B9kpCaYl.js";import{b as l,y as u}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~ncdxw0bh-ClHnt5lR.js";import{A as ee,j as te,n as d}from"./active-backend-context-DRFevVIj.js";import{t as f}from"./utils-CE0lDWtb.js";import{c as p,t as m,u as h}from"./agent-server-client-options-DVLRd9sw.js";import{t as g}from"./proxy-CHmFkV16.js";import{r as _}from"./modal-classes-DPqxSyuP.js";import{f as v,l as y}from"./form-control-classes-9rkU4usZ.js";import{t as b}from"./brand-button-DKPMEKcW.js";import{r as x,u as S}from"./dropdown-classes-CgQ45JmQ.js";import{t as C}from"./settings-input-DYs7t3oK.js";import{t as w}from"./use-tracking-CqODdfO4.js";import{t as ne}from"./use-llm-profiles-BcLibtGb.js";import{n as T,t as re}from"./context-menu-list-item-DBFzplWW.js";import{t as E}from"./settings-dropdown-input-xzoZwgUe.js";import{t as D}from"./x-mark-Batp6gXa.js";import{t as O}from"./automation-BU8zu-FP.js";var k=`/api/automation`,A=l.create();A.interceptors.request.use(e=>{let t=h();if(!t)throw new m;e.baseURL||=t.host;let n=t.apiKey?.trim();return n&&e.headers.set(`X-Session-API-Key`,n),e});function j(e,t){let n=new URLSearchParams;return n.set(`limit`,String(e)),n.set(`offset`,String(t)),n.toString()}var M=class e{static async listAutomations(e={}){let{limit:t=50,offset:n=0}=e,r=p().backend;if(r.kind===`cloud`)return g({backend:r,method:`GET`,path:`${k}/v1?${j(t,n)}`});let{data:i}=await A.get(`${k}/v1`,{params:{limit:t,offset:n}});return i}static async getAutomations(t=50,n=0){return e.listAutomations({limit:t,offset:n})}static async getAutomation(e){let t=p().backend,n=`${k}/v1/${encodeURIComponent(e)}`;if(t.kind===`cloud`)return g({backend:t,method:`GET`,path:n});let{data:r}=await A.get(n);return r}static async updateAutomation(e,t){let n=p().backend,r=`${k}/v1/${encodeURIComponent(e)}`;if(n.kind===`cloud`)return g({backend:n,method:`PATCH`,path:r,body:t});let{data:i}=await A.patch(r,t);return i}static async deleteAutomation(e){let t=p().backend,n=`${k}/v1/${encodeURIComponent(e)}`;if(t.kind===`cloud`){await g({backend:t,method:`DELETE`,path:n});return}await A.delete(n)}static async dispatchAutomation(e){let t=p().backend,n=`${k}/v1/${encodeURIComponent(e)}/dispatch`;if(t.kind===`cloud`)return g({backend:t,method:`POST`,path:n});let{data:r}=await A.post(n);return r}static async listAutomationRuns(e,t={}){let{limit:n=50,offset:r=0}=t,i=p().backend,a=`${k}/v1/${encodeURIComponent(e)}/runs`;if(i.kind===`cloud`)return g({backend:i,method:`GET`,path:`${a}?${j(n,r)}`});let{data:o}=await A.get(a,{params:{limit:n,offset:r}});return o}static async getAutomationRuns(t,n=50,r=0){return e.listAutomationRuns(t,{limit:n,offset:r})}static async toggleAutomation(t,n){return e.updateAutomation(t,{enabled:n})}static async downloadTarball(e,t){let n=p().backend,r=`${k}/v1/${encodeURIComponent(e)}/tarball`,i;if(n.kind===`cloud`)i=await g({backend:n,method:`GET`,path:r,responseType:`blob`});else{let{data:e}=await A.get(r,{responseType:`blob`});i=e}let a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=`${t}.tar`,o.click(),URL.revokeObjectURL(a)}static async checkHealth(){let e=p().backend,t=`${k}/health`;try{if(e.kind===`cloud`)return await g({backend:e,method:`GET`,path:t,timeoutSeconds:5});let{data:n}=await A.get(t,{timeout:5e3});return n}catch{return{status:`error`}}}},N=e(t()),ie=e(r(),1),P=n(),F=[`automation-detail`],I=[`automation-runs`];function ae(e){let{id:t,enabled:n=!0}=e,r=d();return o({queryKey:[...F,t,r.backend.id,r.orgId],queryFn:()=>M.getAutomation(t),staleTime:300*1e3,enabled:!!t&&n})}function oe(e){let{id:t,limit:n=20,offset:r=0,enabled:i=!0}=e,a=d();return o({queryKey:[...I,t,{limit:n,offset:r},a.backend.id,a.orgId],queryFn:()=>M.getAutomationRuns(t,n,r),staleTime:60*1e3,enabled:!!t&&i,refetchInterval:e=>{let t=e.state.data;return t&&t.runs.some(e=>e.status===O.PENDING||e.status===O.RUNNING)?3e3:!1}})}var L=[`automations`];function R(e={}){let{limit:t=50,offset:n=0,enabled:r=!0}=e,i=d();return o({queryKey:[...L,{limit:t,offset:n},i.backend.id,i.orgId],queryFn:()=>M.getAutomations(t,n),staleTime:0,enabled:r})}function z(){let e=i(),t=d(),{trackAutomationDeactivated:n}=w();return a({mutationFn:({id:e,enabled:t})=>M.toggleAutomation(e,t),onSuccess:(r,i)=>{e.invalidateQueries({queryKey:L}),e.invalidateQueries({queryKey:F}),i.enabled||n({backendKind:t.backend.kind})}})}function B(){let e=i(),t=d(),{trackAutomationEdited:n}=w();return a({mutationFn:({id:e,body:t})=>M.updateAutomation(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:L}),e.invalidateQueries({queryKey:F}),n({backendKind:t.backend.kind})}})}function V(){let e=i(),t=d(),{trackAutomationDeleted:n}=w();return a({mutationFn:e=>M.deleteAutomation(e),onSuccess:()=>{e.invalidateQueries({queryKey:L}),n({backendKind:t.backend.kind})}})}function H(){let e=i(),t=d(),{trackAutomationExecuted:n}=w();return a({mutationFn:e=>M.dispatchAutomation(e),onSuccess:(r,i)=>{e.invalidateQueries({queryKey:L}),e.invalidateQueries({queryKey:F}),e.invalidateQueries({queryKey:[...I,i]}),n({backendKind:t.backend.kind})}})}var U=[`automation-health`];function W(){let e=d();return o({queryKey:[...U,e.backend.id,e.orgId],queryFn:()=>M.checkHealth(),staleTime:30*1e3,retry:!1})}var G=e=>(0,P.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`currentColor`,viewBox:`0 0 20 20`,...e,children:(0,P.jsx)(`path`,{d:`M10 6a2 2 0 110-4 2 2 0 010 4zm0 6a2 2 0 110-4 2 2 0 010 4zm0 6a2 2 0 110-4 2 2 0 010 4z`})}),K=f(`inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted hover:bg-interactive-hover hover:text-white focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-muted`,x),q=f(`inline-flex h-8 shrink-0 cursor-pointer items-center gap-1.5 rounded-md border-0 bg-transparent px-2 text-xs text-muted hover:bg-interactive-hover hover:text-white focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-muted`,x);function se({icon:e,label:t}){return(0,P.jsxs)(`span`,{className:`flex min-w-0 w-full items-center gap-2`,children:[(0,P.jsx)(`span`,{className:f(`[&_svg]:size-4`,S),"aria-hidden":!0,children:e}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t})]})}function ce({items:e}){let{t}=s(`openhands`),[n,r]=(0,N.useState)(!1),[i,a]=(0,N.useState)(),o=(0,N.useRef)(null),l=(0,N.useRef)(null);(0,N.useLayoutEffect)(()=>{if(!n||!o.current)return;let e=()=>{let e=o.current?.getBoundingClientRect();e&&a({position:`fixed`,zIndex:9999,top:e.bottom+4,right:window.innerWidth-e.right})};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[n]),(0,N.useEffect)(()=>{if(!n)return;let e=e=>{let t=e.target;o.current?.contains(t)||l.current?.contains(t)||r(!1)},t=e=>{e.key===`Escape`&&r(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[n]);let u=n&&i?(0,P.jsx)(T,{ref:l,theme:`popover`,className:`min-w-[10rem]`,children:e.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsx)(re,{onClick:t=>{t.stopPropagation(),e.onClick(),r(!1)},isDisabled:e.disabled,className:`group`,children:(0,P.jsx)(se,{icon:e.icon,label:e.label})})},e.label))}):null;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`button`,{ref:o,type:`button`,onClick:e=>{e.stopPropagation(),r(e=>!e)},className:K,"aria-label":t(c.AUTOMATIONS$ACTIONS_MENU),"aria-expanded":n,"aria-haspopup":`menu`,children:(0,P.jsx)(G,{className:`size-4`})}),n&&i&&typeof document<`u`?ie.createPortal((0,P.jsx)(`div`,{style:i,children:u}),document.body):null]})}function le(e){return!0}var ue=e=>(0,P.jsxs)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,P.jsx)(`g`,{clipPath:`url(#clip0_8467_30872)`,children:(0,P.jsx)(`path`,{d:`M6.26693 21.4874L6.25583 21.4951L6.24514 21.5033C5.95991 21.7227 5.5 21.5308 5.5 21.0996V2.89961C5.5 2.4684 5.95991 2.2765 6.24514 2.49592L6.25634 2.50452L6.26799 2.51249L19.518 11.5625L19.518 11.5625L19.5226 11.5656C19.8258 11.7677 19.8258 12.1815 19.5226 12.3836L19.5226 12.3835L19.5169 12.3874L6.26693 21.4874Z`,fill:`currentColor`,stroke:`currentColor`})}),(0,P.jsx)(`defs`,{children:(0,P.jsx)(`clipPath`,{id:`clip0_8467_30872`,children:(0,P.jsx)(`rect`,{width:24,height:24,fill:`white`})})})]}),de=e=>(0,P.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,P.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z`})}),fe=e=>(0,P.jsx)(`svg`,{viewBox:`0 0 18 18`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,P.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M2.4375 9C2.4375 5.37563 5.37563 2.4375 9 2.4375C12.6244 2.4375 15.5625 5.37563 15.5625 9C15.5625 12.6244 12.6244 15.5625 9 15.5625C5.37563 15.5625 2.4375 12.6244 2.4375 9ZM4.13812 6.5625C4.81317 5.21867 6.02897 4.19333 7.49996 3.77204C7.15155 4.17641 6.85182 4.65395 6.60713 5.17892C6.40828 5.60556 6.24263 6.06975 6.11494 6.5625H4.13812ZM3.72196 7.6875C3.61778 8.10783 3.5625 8.54746 3.5625 9C3.5625 9.45254 3.61778 9.89217 3.72196 10.3125H5.89738C5.84161 9.88758 5.8125 9.44852 5.8125 8.99998C5.8125 8.55142 5.84161 8.11239 5.89737 7.6875H3.72196ZM7.0333 7.6875C6.97087 8.10689 6.9375 8.54634 6.9375 8.99998C6.9375 9.45367 6.97087 9.89313 7.0333 10.3125H10.9667C11.0291 9.89311 11.0625 9.45367 11.0625 9.00002C11.0625 8.54637 11.0291 8.1069 10.9667 7.6875H7.0333ZM12.1026 7.6875C12.1584 8.1124 12.1875 8.55145 12.1875 9.00002C12.1875 9.44858 12.1584 9.88762 12.1026 10.3125H14.278C14.3822 9.89217 14.4375 9.45254 14.4375 9C14.4375 8.54746 14.3822 8.10783 14.278 7.6875H12.1026ZM13.8619 6.5625H11.885C11.7574 6.06976 11.5917 5.6056 11.3929 5.17897C11.1482 4.65397 10.8484 4.1764 10.5 3.77203C11.971 4.19331 13.1868 5.21866 13.8619 6.5625ZM10.7171 6.5625H7.28293C7.38007 6.23971 7.49559 5.93571 7.62681 5.65419C7.99835 4.85708 8.48101 4.26914 8.99997 3.92442C9.51895 4.26913 10.0016 4.8571 10.3732 5.65424C10.5044 5.93575 10.6199 6.23973 10.7171 6.5625ZM4.13812 11.4375H6.11496C6.24963 11.9572 6.42655 12.4452 6.64015 12.8909C6.87835 13.3879 7.16685 13.8413 7.50006 14.228C6.02902 13.8067 4.81318 12.7814 4.13812 11.4375ZM10.7171 11.4375H7.28295C7.3869 11.7829 7.51191 12.1068 7.65465 12.4047C8.02305 13.1733 8.49456 13.7398 9.00007 14.0756C9.51902 13.7308 10.0017 13.1429 10.3732 12.3458C10.5044 12.0643 10.6199 11.7603 10.7171 11.4375ZM11.3929 12.8211C11.5917 12.3944 11.7574 11.9303 11.8851 11.4375H13.8619C13.1868 12.7813 11.971 13.8067 10.5 14.228C10.8485 13.8236 11.1482 13.346 11.3929 12.8211Z`,fill:`currentColor`})}),pe=e=>(0,P.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,P.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.455 2.456L21.75 6l-1.036.259a3.375 3.375 0 00-2.455 2.456z`})}),me=/^(\d+)$/;function J(e,t,n){let r=e.match(me);if(!r)return null;let i=Number(r[1]);return Number.isNaN(i)||i<t||i>n?null:i}function he(e){let t=(e??``).trim();if(!t)return{kind:`custom`,raw:``};let n=t.split(/\s+/);if(n.length!==5)return{kind:`custom`,raw:t};let[r,i,a,o,s]=n,c=J(r,0,59),l=J(i,0,23);if(c===null||l===null)return{kind:`custom`,raw:t};if(a!==`*`||o!==`*`)return{kind:`custom`,raw:t,hour:l,minute:c};if(s===`*`||s===`0-6`)return{kind:`daily`,hour:l,minute:c};if(s===`1-5`)return{kind:`weekdays`,hour:l,minute:c};let u=J(s,0,6);return u===null?{kind:`custom`,raw:t,hour:l,minute:c}:{kind:`weekly`,hour:l,minute:c,weekday:u}}function ge(e){let{kind:t,hour:n,minute:r,weekday:i}=e;switch(t){case`daily`:return`${r} ${n} * * *`;case`weekdays`:return`${r} ${n} * * 1-5`;case`weekly`:return`${r} ${n} * * ${i??1}`;default:return t}}function Y(e,t){return`${String(e).padStart(2,`0`)}:${String(t).padStart(2,`0`)}`}function X(e){let t=e.match(/^(\d{1,2}):(\d{2})$/);if(!t)return null;let n=Number(t[1]),r=Number(t[2]);return Number.isNaN(n)||Number.isNaN(r)||n<0||n>23||r<0||r>59?null:{hour:n,minute:r}}function Z(e){return e?Array.isArray(e)?e.join(`, `):e:`—`}var _e=e=>(0,P.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,P.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5.636 5.636a9 9 0 1012.728 0M12 3v9`})}),ve=e=>(0,P.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,P.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16`})}),Q=e=>(0,P.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:1.5,...e,children:(0,P.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z`})});function ye({onRetry:e}){let{t}=s(`openhands`);return(0,P.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20`,children:[(0,P.jsx)(Q,{className:`size-12 text-danger`}),(0,P.jsx)(`p`,{className:`mt-4 text-sm text-muted`,children:t(c.AUTOMATIONS$ERROR_TITLE)}),(0,P.jsx)(`button`,{type:`button`,onClick:e,className:`mt-4 rounded-lg border border-[var(--oh-border)] px-4 py-2 text-sm text-white hover:bg-surface-raised`,children:t(c.AUTOMATIONS$ERROR_RETRY)})]})}function be({onRetry:e}){let{t}=s(`openhands`);return(0,P.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20 px-4`,children:[(0,P.jsx)(Q,{className:`size-12 text-[var(--oh-warning)]`}),(0,P.jsx)(`h2`,{className:`mt-4 text-lg font-medium text-content`,children:t(c.AUTOMATIONS$BACKEND_UNAVAILABLE_TITLE)}),(0,P.jsx)(`p`,{className:`mt-2 text-sm text-muted text-center max-w-md`,children:t(c.AUTOMATIONS$BACKEND_UNAVAILABLE_MESSAGE)}),(0,P.jsx)(b,{type:`button`,variant:`secondary`,className:`mt-6`,onClick:e,children:t(c.AUTOMATIONS$BACKEND_UNAVAILABLE_RETRY)})]})}function xe({automationName:e,isOpen:t,onConfirm:n,onCancel:r}){let{t:i}=s(`openhands`);return t?(0,P.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,P.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:r,onKeyDown:e=>{e.key===`Escape`&&r()},role:`presentation`}),(0,P.jsxs)(`div`,{className:`relative w-full max-w-sm rounded-xl border border-[var(--oh-border)] bg-[var(--oh-surface)] p-6`,children:[(0,P.jsx)(`button`,{type:`button`,onClick:r,className:`absolute right-4 top-4 text-muted hover:text-foreground`,"aria-label":i(c.BUTTON$CLOSE),children:(0,P.jsx)(D,{className:`size-5`})}),(0,P.jsx)(`h2`,{className:_,children:i(c.AUTOMATIONS$DELETE_CONFIRM_TITLE)}),(0,P.jsx)(`p`,{className:`mt-2 text-sm text-muted`,children:i(c.AUTOMATIONS$DELETE_CONFIRM_MESSAGE,{name:e})}),(0,P.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,P.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg border border-[var(--oh-border)] px-4 py-2 text-sm text-white hover:bg-surface-raised`,children:i(c.AUTOMATIONS$CANCEL)}),(0,P.jsx)(`button`,{type:`button`,onClick:n,className:`rounded-lg bg-danger px-4 py-2 text-sm text-white hover:bg-danger/80`,children:i(c.AUTOMATIONS$DELETE)})]})]})]}):null}var $=`__active__`,Se=[c.AUTOMATIONS$WEEKDAY_SUN,c.AUTOMATIONS$WEEKDAY_MON,c.AUTOMATIONS$WEEKDAY_TUE,c.AUTOMATIONS$WEEKDAY_WED,c.AUTOMATIONS$WEEKDAY_THU,c.AUTOMATIONS$WEEKDAY_FRI,c.AUTOMATIONS$WEEKDAY_SAT];function Ce(e){if(e.trigger.type===`event`)return{name:e.name,prompt:e.prompt??``,model:e.model??``,frequency:`custom`,weekday:1,timeOfDay:``,isCustomSchedule:!0,rawSchedule:``};let t=he(e.trigger.schedule);return t.kind===`custom`?{name:e.name,prompt:e.prompt??``,model:e.model??``,frequency:`custom`,weekday:1,timeOfDay:t.hour!==void 0&&t.minute!==void 0?Y(t.hour,t.minute):``,isCustomSchedule:!0,rawSchedule:t.raw}:{name:e.name,prompt:e.prompt??``,model:e.model??``,frequency:t.kind,weekday:t.kind===`weekly`?t.weekday??1:1,timeOfDay:Y(t.hour,t.minute),isCustomSchedule:!1,rawSchedule:e.trigger.schedule??``}}function we({automation:e,isOpen:t,onClose:n}){let{t:r}=s(`openhands`),i=B(),{data:a,isLoading:o}=ne(),l=a?.profiles??[],d=[{key:$,label:r(c.COMMON$ACTIVE_PROFILE)},...l.map(e=>({key:e.name,label:e.name}))],p=(0,N.useMemo)(()=>Ce(e),[e]),[m,h]=(0,N.useState)(p),[g,x]=(0,N.useState)(null);if((0,N.useEffect)(()=>{t&&(h(p),x(null))},[t,p]),!t)return null;let S=[{key:`daily`,label:r(c.AUTOMATIONS$FREQUENCY_DAILY)},{key:`weekdays`,label:r(c.AUTOMATIONS$FREQUENCY_WEEKDAYS)},{key:`weekly`,label:r(c.AUTOMATIONS$FREQUENCY_WEEKLY)},...m.isCustomSchedule?[{key:`custom`,label:r(c.AUTOMATIONS$FREQUENCY_CUSTOM)}]:[]],w=Se.map((e,t)=>({key:String(t),label:r(e)})),T=!m.isCustomSchedule||X(m.timeOfDay)!==null||m.timeOfDay===``;return(0,P.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,P.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:n,onKeyDown:e=>{e.key===`Escape`&&n()},role:`presentation`}),(0,P.jsxs)(`div`,{className:`relative w-full max-w-md rounded-xl border border-[var(--oh-border)] bg-[var(--oh-surface)] p-6`,children:[(0,P.jsx)(`button`,{type:`button`,onClick:n,className:`absolute right-4 top-4 text-muted hover:text-foreground`,"aria-label":r(c.AUTOMATIONS$CANCEL),children:(0,P.jsx)(D,{className:`size-5`})}),(0,P.jsx)(`h2`,{className:_,children:r(c.AUTOMATIONS$EDIT_TITLE)}),(0,P.jsxs)(`form`,{onSubmit:t=>{t.preventDefault();let a=m.name.trim();if(!a){x(r(c.AUTOMATIONS$NAME_REQUIRED));return}x(null);let o={};a!==e.name&&(o.name=a);let s=m.prompt.trim();s!==(e.prompt??``).trim()&&(o.prompt=s.length===0?null:s);let l=m.model.trim();if(l!==(e.model??``)&&(o.model=l===``?null:l),!m.isCustomSchedule&&m.frequency!==`custom`){let t=X(m.timeOfDay);if(t){let n=ge({kind:m.frequency,hour:t.hour,minute:t.minute,weekday:m.frequency===`weekly`?m.weekday:void 0});n!==e.trigger.schedule&&(o.trigger={...e.trigger,schedule:n})}}if(Object.keys(o).length===0){n();return}i.mutate({id:e.id,body:o},{onSuccess:()=>{te(r(c.AUTOMATIONS$EDIT_SUCCESS)),n()},onError:e=>{ee(u(e)?e.response?.data?.message||e.message||r(c.AUTOMATIONS$EDIT_ERROR):e.message||r(c.AUTOMATIONS$EDIT_ERROR))}})},className:`mt-4 flex flex-col gap-4`,"aria-label":r(c.AUTOMATIONS$EDIT_TITLE),children:[(0,P.jsx)(C,{testId:`edit-automation-name`,name:`name`,type:`text`,label:r(c.AUTOMATIONS$NAME),value:m.name,onChange:e=>h(t=>({...t,name:e})),error:g??void 0,showRequiredTag:!0}),(0,P.jsxs)(`label`,{className:`flex flex-col gap-2.5 w-full min-w-0`,children:[(0,P.jsx)(`span`,{className:`text-sm`,children:r(c.AUTOMATIONS$PROMPT)}),(0,P.jsx)(`textarea`,{"data-testid":`edit-automation-prompt`,name:`prompt`,value:m.prompt,onChange:e=>h(t=>({...t,prompt:e.target.value})),rows:4,className:f(y,`placeholder:italic`)}),(0,P.jsx)(`span`,{className:`text-xs text-muted`,children:r(c.AUTOMATIONS$EDIT_PROMPT_HINT)})]}),(o||l.length>0)&&(0,P.jsx)(E,{testId:`edit-automation-model`,name:`model`,label:r(c.AUTOMATIONS$DETAIL$MODEL),items:d,selectedKey:m.model||$,isLoading:o,placeholder:r(c.COMMON$ACTIVE_PROFILE),onSelectionChange:e=>h(t=>({...t,model:e&&e!==$?String(e):``}))}),e.trigger.type===`event`?(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg bg-[var(--oh-surface-raised)] p-3`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:r(c.AUTOMATIONS$DETAIL$TRIGGER)}),(0,P.jsx)(`span`,{className:`text-sm text-content`,children:r(c.AUTOMATIONS$DETAIL$TRIGGER_EVENT)})]}),e.trigger.source&&(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:r(c.AUTOMATIONS$DETAIL$EVENT_SOURCE)}),(0,P.jsx)(`span`,{className:`text-sm text-content`,children:e.trigger.source})]}),e.trigger.on&&(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:r(c.AUTOMATIONS$DETAIL$EVENT_TYPE)}),(0,P.jsx)(`code`,{className:`text-xs font-mono text-content`,children:Z(e.trigger.on)})]}),e.trigger.filter&&(0,P.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:r(c.AUTOMATIONS$DETAIL$EVENT_FILTER)}),(0,P.jsx)(`code`,{className:`text-xs font-mono text-content break-all`,children:e.trigger.filter})]})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(E,{testId:`edit-automation-frequency`,name:`frequency`,label:r(c.AUTOMATIONS$FREQUENCY),items:S,selectedKey:m.frequency,isDisabled:m.isCustomSchedule,onSelectionChange:e=>{!e||m.isCustomSchedule||h(t=>({...t,frequency:e}))}}),m.frequency===`weekly`&&!m.isCustomSchedule&&(0,P.jsx)(E,{testId:`edit-automation-weekday`,name:`weekday`,label:r(c.AUTOMATIONS$WEEKDAY),items:w,selectedKey:String(m.weekday),onSelectionChange:e=>{e!==null&&h(t=>({...t,weekday:Number(e)}))}}),(0,P.jsxs)(`label`,{className:`flex flex-col gap-2.5 w-full min-w-0`,children:[(0,P.jsx)(`span`,{className:`text-sm`,children:r(c.AUTOMATIONS$TIME_OF_DAY)}),(0,P.jsx)(`input`,{"data-testid":`edit-automation-time`,name:`timeOfDay`,type:`time`,value:m.timeOfDay,onChange:e=>h(t=>({...t,timeOfDay:e.target.value})),disabled:m.isCustomSchedule&&!T,className:f(v,`disabled:bg-[var(--oh-surface-raised)]`)}),e.timezone&&(0,P.jsxs)(`span`,{className:`text-xs text-muted`,children:[r(c.AUTOMATIONS$TIMEZONE),`: `,e.timezone]})]}),m.isCustomSchedule&&(0,P.jsxs)(`p`,{className:`text-xs text-muted`,"data-testid":`custom-schedule-hint`,children:[r(c.AUTOMATIONS$CUSTOM_SCHEDULE_HINT),m.rawSchedule&&(0,P.jsxs)(P.Fragment,{children:[` `,(0,P.jsx)(`code`,{className:`text-xs text-content`,children:m.rawSchedule})]})]})]}),(0,P.jsxs)(`div`,{className:`mt-2 flex justify-end gap-3`,children:[(0,P.jsx)(b,{testId:`edit-automation-cancel`,type:`button`,variant:`secondary`,onClick:n,isDisabled:i.isPending,children:r(c.AUTOMATIONS$CANCEL)}),(0,P.jsx)(b,{testId:`edit-automation-save`,type:`submit`,variant:`primary`,isDisabled:i.isPending,"aria-busy":i.isPending,children:i.isPending?r(c.AUTOMATIONS$SAVING):r(c.AUTOMATIONS$SAVE)})]})]})]})]})}export{oe as C,ae as S,W as _,Q as a,H as b,Z as c,de as d,ue as f,q as g,K as h,ye as i,pe as l,ce as m,xe as n,ve as o,le as p,be as r,_e as s,we as t,fe as u,R as v,M as w,z as x,V as y};
1
+ import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,bt as n,xt as r}from"./vendor-styling-CI0PQ3ab.js";import{n as i}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~i3v2mlbw-BrJQ3XZH.js";import{t as a}from"./useMutation-DCE9RcgK.js";import{t as o}from"./useQuery-CpjHYtZc.js";import{t as s}from"./useTranslation-Cgy4JA_g.js";import{t as c}from"./declaration-B9kpCaYl.js";import{b as l,y as u}from"./vendor~entry.client~root~root-layout~home~conversation-panel~conversation~launch~extensions~ncdxw0bh-ClHnt5lR.js";import{A as ee,j as te,n as d}from"./active-backend-context-u2tdYRgH.js";import{t as f}from"./utils-CE0lDWtb.js";import{c as p,t as m,u as h}from"./agent-server-client-options-DVLRd9sw.js";import{t as g}from"./proxy-CHmFkV16.js";import{r as _}from"./modal-classes-DPqxSyuP.js";import{f as v,l as y}from"./form-control-classes-9rkU4usZ.js";import{t as b}from"./brand-button-DKPMEKcW.js";import{r as x,u as S}from"./dropdown-classes-CgQ45JmQ.js";import{t as C}from"./settings-input-DYs7t3oK.js";import{t as w}from"./use-tracking-GtXCHmTv.js";import{t as ne}from"./use-llm-profiles-DjackuP1.js";import{n as T,t as re}from"./context-menu-list-item-DBFzplWW.js";import{t as E}from"./settings-dropdown-input-xzoZwgUe.js";import{t as D}from"./x-mark-Batp6gXa.js";import{t as O}from"./automation-BU8zu-FP.js";var k=`/api/automation`,A=l.create();A.interceptors.request.use(e=>{let t=h();if(!t)throw new m;e.baseURL||=t.host;let n=t.apiKey?.trim();return n&&e.headers.set(`X-Session-API-Key`,n),e});function j(e,t){let n=new URLSearchParams;return n.set(`limit`,String(e)),n.set(`offset`,String(t)),n.toString()}var M=class e{static async listAutomations(e={}){let{limit:t=50,offset:n=0}=e,r=p().backend;if(r.kind===`cloud`)return g({backend:r,method:`GET`,path:`${k}/v1?${j(t,n)}`});let{data:i}=await A.get(`${k}/v1`,{params:{limit:t,offset:n}});return i}static async getAutomations(t=50,n=0){return e.listAutomations({limit:t,offset:n})}static async getAutomation(e){let t=p().backend,n=`${k}/v1/${encodeURIComponent(e)}`;if(t.kind===`cloud`)return g({backend:t,method:`GET`,path:n});let{data:r}=await A.get(n);return r}static async updateAutomation(e,t){let n=p().backend,r=`${k}/v1/${encodeURIComponent(e)}`;if(n.kind===`cloud`)return g({backend:n,method:`PATCH`,path:r,body:t});let{data:i}=await A.patch(r,t);return i}static async deleteAutomation(e){let t=p().backend,n=`${k}/v1/${encodeURIComponent(e)}`;if(t.kind===`cloud`){await g({backend:t,method:`DELETE`,path:n});return}await A.delete(n)}static async dispatchAutomation(e){let t=p().backend,n=`${k}/v1/${encodeURIComponent(e)}/dispatch`;if(t.kind===`cloud`)return g({backend:t,method:`POST`,path:n});let{data:r}=await A.post(n);return r}static async listAutomationRuns(e,t={}){let{limit:n=50,offset:r=0}=t,i=p().backend,a=`${k}/v1/${encodeURIComponent(e)}/runs`;if(i.kind===`cloud`)return g({backend:i,method:`GET`,path:`${a}?${j(n,r)}`});let{data:o}=await A.get(a,{params:{limit:n,offset:r}});return o}static async getAutomationRuns(t,n=50,r=0){return e.listAutomationRuns(t,{limit:n,offset:r})}static async toggleAutomation(t,n){return e.updateAutomation(t,{enabled:n})}static async downloadTarball(e,t){let n=p().backend,r=`${k}/v1/${encodeURIComponent(e)}/tarball`,i;if(n.kind===`cloud`)i=await g({backend:n,method:`GET`,path:r,responseType:`blob`});else{let{data:e}=await A.get(r,{responseType:`blob`});i=e}let a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=`${t}.tar`,o.click(),URL.revokeObjectURL(a)}static async checkHealth(){let e=p().backend,t=`${k}/health`;try{if(e.kind===`cloud`)return await g({backend:e,method:`GET`,path:t,timeoutSeconds:5});let{data:n}=await A.get(t,{timeout:5e3});return n}catch{return{status:`error`}}}},N=e(t()),ie=e(r(),1),P=n(),F=[`automation-detail`],I=[`automation-runs`];function ae(e){let{id:t,enabled:n=!0}=e,r=d();return o({queryKey:[...F,t,r.backend.id,r.orgId],queryFn:()=>M.getAutomation(t),staleTime:300*1e3,enabled:!!t&&n})}function oe(e){let{id:t,limit:n=20,offset:r=0,enabled:i=!0}=e,a=d();return o({queryKey:[...I,t,{limit:n,offset:r},a.backend.id,a.orgId],queryFn:()=>M.getAutomationRuns(t,n,r),staleTime:60*1e3,enabled:!!t&&i,refetchInterval:e=>{let t=e.state.data;return t&&t.runs.some(e=>e.status===O.PENDING||e.status===O.RUNNING)?3e3:!1}})}var L=[`automations`];function R(e={}){let{limit:t=50,offset:n=0,enabled:r=!0}=e,i=d();return o({queryKey:[...L,{limit:t,offset:n},i.backend.id,i.orgId],queryFn:()=>M.getAutomations(t,n),staleTime:0,enabled:r})}function z(){let e=i(),t=d(),{trackAutomationDeactivated:n}=w();return a({mutationFn:({id:e,enabled:t})=>M.toggleAutomation(e,t),onSuccess:(r,i)=>{e.invalidateQueries({queryKey:L}),e.invalidateQueries({queryKey:F}),i.enabled||n({backendKind:t.backend.kind})}})}function B(){let e=i(),t=d(),{trackAutomationEdited:n}=w();return a({mutationFn:({id:e,body:t})=>M.updateAutomation(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:L}),e.invalidateQueries({queryKey:F}),n({backendKind:t.backend.kind})}})}function V(){let e=i(),t=d(),{trackAutomationDeleted:n}=w();return a({mutationFn:e=>M.deleteAutomation(e),onSuccess:()=>{e.invalidateQueries({queryKey:L}),n({backendKind:t.backend.kind})}})}function H(){let e=i(),t=d(),{trackAutomationExecuted:n}=w();return a({mutationFn:e=>M.dispatchAutomation(e),onSuccess:(r,i)=>{e.invalidateQueries({queryKey:L}),e.invalidateQueries({queryKey:F}),e.invalidateQueries({queryKey:[...I,i]}),n({backendKind:t.backend.kind})}})}var U=[`automation-health`];function W(){let e=d();return o({queryKey:[...U,e.backend.id,e.orgId],queryFn:()=>M.checkHealth(),staleTime:30*1e3,retry:!1})}var G=e=>(0,P.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`currentColor`,viewBox:`0 0 20 20`,...e,children:(0,P.jsx)(`path`,{d:`M10 6a2 2 0 110-4 2 2 0 010 4zm0 6a2 2 0 110-4 2 2 0 010 4zm0 6a2 2 0 110-4 2 2 0 010 4z`})}),K=f(`inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted hover:bg-interactive-hover hover:text-white focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-muted`,x),q=f(`inline-flex h-8 shrink-0 cursor-pointer items-center gap-1.5 rounded-md border-0 bg-transparent px-2 text-xs text-muted hover:bg-interactive-hover hover:text-white focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-muted`,x);function se({icon:e,label:t}){return(0,P.jsxs)(`span`,{className:`flex min-w-0 w-full items-center gap-2`,children:[(0,P.jsx)(`span`,{className:f(`[&_svg]:size-4`,S),"aria-hidden":!0,children:e}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t})]})}function ce({items:e}){let{t}=s(`openhands`),[n,r]=(0,N.useState)(!1),[i,a]=(0,N.useState)(),o=(0,N.useRef)(null),l=(0,N.useRef)(null);(0,N.useLayoutEffect)(()=>{if(!n||!o.current)return;let e=()=>{let e=o.current?.getBoundingClientRect();e&&a({position:`fixed`,zIndex:9999,top:e.bottom+4,right:window.innerWidth-e.right})};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[n]),(0,N.useEffect)(()=>{if(!n)return;let e=e=>{let t=e.target;o.current?.contains(t)||l.current?.contains(t)||r(!1)},t=e=>{e.key===`Escape`&&r(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[n]);let u=n&&i?(0,P.jsx)(T,{ref:l,theme:`popover`,className:`min-w-[10rem]`,children:e.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsx)(re,{onClick:t=>{t.stopPropagation(),e.onClick(),r(!1)},isDisabled:e.disabled,className:`group`,children:(0,P.jsx)(se,{icon:e.icon,label:e.label})})},e.label))}):null;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`button`,{ref:o,type:`button`,onClick:e=>{e.stopPropagation(),r(e=>!e)},className:K,"aria-label":t(c.AUTOMATIONS$ACTIONS_MENU),"aria-expanded":n,"aria-haspopup":`menu`,children:(0,P.jsx)(G,{className:`size-4`})}),n&&i&&typeof document<`u`?ie.createPortal((0,P.jsx)(`div`,{style:i,children:u}),document.body):null]})}function le(e){return!0}var ue=e=>(0,P.jsxs)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,P.jsx)(`g`,{clipPath:`url(#clip0_8467_30872)`,children:(0,P.jsx)(`path`,{d:`M6.26693 21.4874L6.25583 21.4951L6.24514 21.5033C5.95991 21.7227 5.5 21.5308 5.5 21.0996V2.89961C5.5 2.4684 5.95991 2.2765 6.24514 2.49592L6.25634 2.50452L6.26799 2.51249L19.518 11.5625L19.518 11.5625L19.5226 11.5656C19.8258 11.7677 19.8258 12.1815 19.5226 12.3836L19.5226 12.3835L19.5169 12.3874L6.26693 21.4874Z`,fill:`currentColor`,stroke:`currentColor`})}),(0,P.jsx)(`defs`,{children:(0,P.jsx)(`clipPath`,{id:`clip0_8467_30872`,children:(0,P.jsx)(`rect`,{width:24,height:24,fill:`white`})})})]}),de=e=>(0,P.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,P.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z`})}),fe=e=>(0,P.jsx)(`svg`,{viewBox:`0 0 18 18`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,P.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M2.4375 9C2.4375 5.37563 5.37563 2.4375 9 2.4375C12.6244 2.4375 15.5625 5.37563 15.5625 9C15.5625 12.6244 12.6244 15.5625 9 15.5625C5.37563 15.5625 2.4375 12.6244 2.4375 9ZM4.13812 6.5625C4.81317 5.21867 6.02897 4.19333 7.49996 3.77204C7.15155 4.17641 6.85182 4.65395 6.60713 5.17892C6.40828 5.60556 6.24263 6.06975 6.11494 6.5625H4.13812ZM3.72196 7.6875C3.61778 8.10783 3.5625 8.54746 3.5625 9C3.5625 9.45254 3.61778 9.89217 3.72196 10.3125H5.89738C5.84161 9.88758 5.8125 9.44852 5.8125 8.99998C5.8125 8.55142 5.84161 8.11239 5.89737 7.6875H3.72196ZM7.0333 7.6875C6.97087 8.10689 6.9375 8.54634 6.9375 8.99998C6.9375 9.45367 6.97087 9.89313 7.0333 10.3125H10.9667C11.0291 9.89311 11.0625 9.45367 11.0625 9.00002C11.0625 8.54637 11.0291 8.1069 10.9667 7.6875H7.0333ZM12.1026 7.6875C12.1584 8.1124 12.1875 8.55145 12.1875 9.00002C12.1875 9.44858 12.1584 9.88762 12.1026 10.3125H14.278C14.3822 9.89217 14.4375 9.45254 14.4375 9C14.4375 8.54746 14.3822 8.10783 14.278 7.6875H12.1026ZM13.8619 6.5625H11.885C11.7574 6.06976 11.5917 5.6056 11.3929 5.17897C11.1482 4.65397 10.8484 4.1764 10.5 3.77203C11.971 4.19331 13.1868 5.21866 13.8619 6.5625ZM10.7171 6.5625H7.28293C7.38007 6.23971 7.49559 5.93571 7.62681 5.65419C7.99835 4.85708 8.48101 4.26914 8.99997 3.92442C9.51895 4.26913 10.0016 4.8571 10.3732 5.65424C10.5044 5.93575 10.6199 6.23973 10.7171 6.5625ZM4.13812 11.4375H6.11496C6.24963 11.9572 6.42655 12.4452 6.64015 12.8909C6.87835 13.3879 7.16685 13.8413 7.50006 14.228C6.02902 13.8067 4.81318 12.7814 4.13812 11.4375ZM10.7171 11.4375H7.28295C7.3869 11.7829 7.51191 12.1068 7.65465 12.4047C8.02305 13.1733 8.49456 13.7398 9.00007 14.0756C9.51902 13.7308 10.0017 13.1429 10.3732 12.3458C10.5044 12.0643 10.6199 11.7603 10.7171 11.4375ZM11.3929 12.8211C11.5917 12.3944 11.7574 11.9303 11.8851 11.4375H13.8619C13.1868 12.7813 11.971 13.8067 10.5 14.228C10.8485 13.8236 11.1482 13.346 11.3929 12.8211Z`,fill:`currentColor`})}),pe=e=>(0,P.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,P.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.455 2.456L21.75 6l-1.036.259a3.375 3.375 0 00-2.455 2.456z`})}),me=/^(\d+)$/;function J(e,t,n){let r=e.match(me);if(!r)return null;let i=Number(r[1]);return Number.isNaN(i)||i<t||i>n?null:i}function he(e){let t=(e??``).trim();if(!t)return{kind:`custom`,raw:``};let n=t.split(/\s+/);if(n.length!==5)return{kind:`custom`,raw:t};let[r,i,a,o,s]=n,c=J(r,0,59),l=J(i,0,23);if(c===null||l===null)return{kind:`custom`,raw:t};if(a!==`*`||o!==`*`)return{kind:`custom`,raw:t,hour:l,minute:c};if(s===`*`||s===`0-6`)return{kind:`daily`,hour:l,minute:c};if(s===`1-5`)return{kind:`weekdays`,hour:l,minute:c};let u=J(s,0,6);return u===null?{kind:`custom`,raw:t,hour:l,minute:c}:{kind:`weekly`,hour:l,minute:c,weekday:u}}function ge(e){let{kind:t,hour:n,minute:r,weekday:i}=e;switch(t){case`daily`:return`${r} ${n} * * *`;case`weekdays`:return`${r} ${n} * * 1-5`;case`weekly`:return`${r} ${n} * * ${i??1}`;default:return t}}function Y(e,t){return`${String(e).padStart(2,`0`)}:${String(t).padStart(2,`0`)}`}function X(e){let t=e.match(/^(\d{1,2}):(\d{2})$/);if(!t)return null;let n=Number(t[1]),r=Number(t[2]);return Number.isNaN(n)||Number.isNaN(r)||n<0||n>23||r<0||r>59?null:{hour:n,minute:r}}function Z(e){return e?Array.isArray(e)?e.join(`, `):e:`—`}var _e=e=>(0,P.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,P.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5.636 5.636a9 9 0 1012.728 0M12 3v9`})}),ve=e=>(0,P.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,P.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16`})}),Q=e=>(0,P.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:1.5,...e,children:(0,P.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z`})});function ye({onRetry:e}){let{t}=s(`openhands`);return(0,P.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20`,children:[(0,P.jsx)(Q,{className:`size-12 text-danger`}),(0,P.jsx)(`p`,{className:`mt-4 text-sm text-muted`,children:t(c.AUTOMATIONS$ERROR_TITLE)}),(0,P.jsx)(`button`,{type:`button`,onClick:e,className:`mt-4 rounded-lg border border-[var(--oh-border)] px-4 py-2 text-sm text-white hover:bg-surface-raised`,children:t(c.AUTOMATIONS$ERROR_RETRY)})]})}function be({onRetry:e}){let{t}=s(`openhands`);return(0,P.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20 px-4`,children:[(0,P.jsx)(Q,{className:`size-12 text-[var(--oh-warning)]`}),(0,P.jsx)(`h2`,{className:`mt-4 text-lg font-medium text-content`,children:t(c.AUTOMATIONS$BACKEND_UNAVAILABLE_TITLE)}),(0,P.jsx)(`p`,{className:`mt-2 text-sm text-muted text-center max-w-md`,children:t(c.AUTOMATIONS$BACKEND_UNAVAILABLE_MESSAGE)}),(0,P.jsx)(b,{type:`button`,variant:`secondary`,className:`mt-6`,onClick:e,children:t(c.AUTOMATIONS$BACKEND_UNAVAILABLE_RETRY)})]})}function xe({automationName:e,isOpen:t,onConfirm:n,onCancel:r}){let{t:i}=s(`openhands`);return t?(0,P.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,P.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:r,onKeyDown:e=>{e.key===`Escape`&&r()},role:`presentation`}),(0,P.jsxs)(`div`,{className:`relative w-full max-w-sm rounded-xl border border-[var(--oh-border)] bg-[var(--oh-surface)] p-6`,children:[(0,P.jsx)(`button`,{type:`button`,onClick:r,className:`absolute right-4 top-4 text-muted hover:text-foreground`,"aria-label":i(c.BUTTON$CLOSE),children:(0,P.jsx)(D,{className:`size-5`})}),(0,P.jsx)(`h2`,{className:_,children:i(c.AUTOMATIONS$DELETE_CONFIRM_TITLE)}),(0,P.jsx)(`p`,{className:`mt-2 text-sm text-muted`,children:i(c.AUTOMATIONS$DELETE_CONFIRM_MESSAGE,{name:e})}),(0,P.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,P.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg border border-[var(--oh-border)] px-4 py-2 text-sm text-white hover:bg-surface-raised`,children:i(c.AUTOMATIONS$CANCEL)}),(0,P.jsx)(`button`,{type:`button`,onClick:n,className:`rounded-lg bg-danger px-4 py-2 text-sm text-white hover:bg-danger/80`,children:i(c.AUTOMATIONS$DELETE)})]})]})]}):null}var $=`__active__`,Se=[c.AUTOMATIONS$WEEKDAY_SUN,c.AUTOMATIONS$WEEKDAY_MON,c.AUTOMATIONS$WEEKDAY_TUE,c.AUTOMATIONS$WEEKDAY_WED,c.AUTOMATIONS$WEEKDAY_THU,c.AUTOMATIONS$WEEKDAY_FRI,c.AUTOMATIONS$WEEKDAY_SAT];function Ce(e){if(e.trigger.type===`event`)return{name:e.name,prompt:e.prompt??``,model:e.model??``,frequency:`custom`,weekday:1,timeOfDay:``,isCustomSchedule:!0,rawSchedule:``};let t=he(e.trigger.schedule);return t.kind===`custom`?{name:e.name,prompt:e.prompt??``,model:e.model??``,frequency:`custom`,weekday:1,timeOfDay:t.hour!==void 0&&t.minute!==void 0?Y(t.hour,t.minute):``,isCustomSchedule:!0,rawSchedule:t.raw}:{name:e.name,prompt:e.prompt??``,model:e.model??``,frequency:t.kind,weekday:t.kind===`weekly`?t.weekday??1:1,timeOfDay:Y(t.hour,t.minute),isCustomSchedule:!1,rawSchedule:e.trigger.schedule??``}}function we({automation:e,isOpen:t,onClose:n}){let{t:r}=s(`openhands`),i=B(),{data:a,isLoading:o}=ne(),l=a?.profiles??[],d=[{key:$,label:r(c.COMMON$ACTIVE_PROFILE)},...l.map(e=>({key:e.name,label:e.name}))],p=(0,N.useMemo)(()=>Ce(e),[e]),[m,h]=(0,N.useState)(p),[g,x]=(0,N.useState)(null);if((0,N.useEffect)(()=>{t&&(h(p),x(null))},[t,p]),!t)return null;let S=[{key:`daily`,label:r(c.AUTOMATIONS$FREQUENCY_DAILY)},{key:`weekdays`,label:r(c.AUTOMATIONS$FREQUENCY_WEEKDAYS)},{key:`weekly`,label:r(c.AUTOMATIONS$FREQUENCY_WEEKLY)},...m.isCustomSchedule?[{key:`custom`,label:r(c.AUTOMATIONS$FREQUENCY_CUSTOM)}]:[]],w=Se.map((e,t)=>({key:String(t),label:r(e)})),T=!m.isCustomSchedule||X(m.timeOfDay)!==null||m.timeOfDay===``;return(0,P.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,P.jsx)(`div`,{className:`absolute inset-0 bg-black/60`,onClick:n,onKeyDown:e=>{e.key===`Escape`&&n()},role:`presentation`}),(0,P.jsxs)(`div`,{className:`relative w-full max-w-md rounded-xl border border-[var(--oh-border)] bg-[var(--oh-surface)] p-6`,children:[(0,P.jsx)(`button`,{type:`button`,onClick:n,className:`absolute right-4 top-4 text-muted hover:text-foreground`,"aria-label":r(c.AUTOMATIONS$CANCEL),children:(0,P.jsx)(D,{className:`size-5`})}),(0,P.jsx)(`h2`,{className:_,children:r(c.AUTOMATIONS$EDIT_TITLE)}),(0,P.jsxs)(`form`,{onSubmit:t=>{t.preventDefault();let a=m.name.trim();if(!a){x(r(c.AUTOMATIONS$NAME_REQUIRED));return}x(null);let o={};a!==e.name&&(o.name=a);let s=m.prompt.trim();s!==(e.prompt??``).trim()&&(o.prompt=s.length===0?null:s);let l=m.model.trim();if(l!==(e.model??``)&&(o.model=l===``?null:l),!m.isCustomSchedule&&m.frequency!==`custom`){let t=X(m.timeOfDay);if(t){let n=ge({kind:m.frequency,hour:t.hour,minute:t.minute,weekday:m.frequency===`weekly`?m.weekday:void 0});n!==e.trigger.schedule&&(o.trigger={...e.trigger,schedule:n})}}if(Object.keys(o).length===0){n();return}i.mutate({id:e.id,body:o},{onSuccess:()=>{te(r(c.AUTOMATIONS$EDIT_SUCCESS)),n()},onError:e=>{ee(u(e)?e.response?.data?.message||e.message||r(c.AUTOMATIONS$EDIT_ERROR):e.message||r(c.AUTOMATIONS$EDIT_ERROR))}})},className:`mt-4 flex flex-col gap-4`,"aria-label":r(c.AUTOMATIONS$EDIT_TITLE),children:[(0,P.jsx)(C,{testId:`edit-automation-name`,name:`name`,type:`text`,label:r(c.AUTOMATIONS$NAME),value:m.name,onChange:e=>h(t=>({...t,name:e})),error:g??void 0,showRequiredTag:!0}),(0,P.jsxs)(`label`,{className:`flex flex-col gap-2.5 w-full min-w-0`,children:[(0,P.jsx)(`span`,{className:`text-sm`,children:r(c.AUTOMATIONS$PROMPT)}),(0,P.jsx)(`textarea`,{"data-testid":`edit-automation-prompt`,name:`prompt`,value:m.prompt,onChange:e=>h(t=>({...t,prompt:e.target.value})),rows:4,className:f(y,`placeholder:italic`)}),(0,P.jsx)(`span`,{className:`text-xs text-muted`,children:r(c.AUTOMATIONS$EDIT_PROMPT_HINT)})]}),(o||l.length>0)&&(0,P.jsx)(E,{testId:`edit-automation-model`,name:`model`,label:r(c.AUTOMATIONS$DETAIL$MODEL),items:d,selectedKey:m.model||$,isLoading:o,placeholder:r(c.COMMON$ACTIVE_PROFILE),onSelectionChange:e=>h(t=>({...t,model:e&&e!==$?String(e):``}))}),e.trigger.type===`event`?(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg bg-[var(--oh-surface-raised)] p-3`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:r(c.AUTOMATIONS$DETAIL$TRIGGER)}),(0,P.jsx)(`span`,{className:`text-sm text-content`,children:r(c.AUTOMATIONS$DETAIL$TRIGGER_EVENT)})]}),e.trigger.source&&(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:r(c.AUTOMATIONS$DETAIL$EVENT_SOURCE)}),(0,P.jsx)(`span`,{className:`text-sm text-content`,children:e.trigger.source})]}),e.trigger.on&&(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:r(c.AUTOMATIONS$DETAIL$EVENT_TYPE)}),(0,P.jsx)(`code`,{className:`text-xs font-mono text-content`,children:Z(e.trigger.on)})]}),e.trigger.filter&&(0,P.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:r(c.AUTOMATIONS$DETAIL$EVENT_FILTER)}),(0,P.jsx)(`code`,{className:`text-xs font-mono text-content break-all`,children:e.trigger.filter})]})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(E,{testId:`edit-automation-frequency`,name:`frequency`,label:r(c.AUTOMATIONS$FREQUENCY),items:S,selectedKey:m.frequency,isDisabled:m.isCustomSchedule,onSelectionChange:e=>{!e||m.isCustomSchedule||h(t=>({...t,frequency:e}))}}),m.frequency===`weekly`&&!m.isCustomSchedule&&(0,P.jsx)(E,{testId:`edit-automation-weekday`,name:`weekday`,label:r(c.AUTOMATIONS$WEEKDAY),items:w,selectedKey:String(m.weekday),onSelectionChange:e=>{e!==null&&h(t=>({...t,weekday:Number(e)}))}}),(0,P.jsxs)(`label`,{className:`flex flex-col gap-2.5 w-full min-w-0`,children:[(0,P.jsx)(`span`,{className:`text-sm`,children:r(c.AUTOMATIONS$TIME_OF_DAY)}),(0,P.jsx)(`input`,{"data-testid":`edit-automation-time`,name:`timeOfDay`,type:`time`,value:m.timeOfDay,onChange:e=>h(t=>({...t,timeOfDay:e.target.value})),disabled:m.isCustomSchedule&&!T,className:f(v,`disabled:bg-[var(--oh-surface-raised)]`)}),e.timezone&&(0,P.jsxs)(`span`,{className:`text-xs text-muted`,children:[r(c.AUTOMATIONS$TIMEZONE),`: `,e.timezone]})]}),m.isCustomSchedule&&(0,P.jsxs)(`p`,{className:`text-xs text-muted`,"data-testid":`custom-schedule-hint`,children:[r(c.AUTOMATIONS$CUSTOM_SCHEDULE_HINT),m.rawSchedule&&(0,P.jsxs)(P.Fragment,{children:[` `,(0,P.jsx)(`code`,{className:`text-xs text-content`,children:m.rawSchedule})]})]})]}),(0,P.jsxs)(`div`,{className:`mt-2 flex justify-end gap-3`,children:[(0,P.jsx)(b,{testId:`edit-automation-cancel`,type:`button`,variant:`secondary`,onClick:n,isDisabled:i.isPending,children:r(c.AUTOMATIONS$CANCEL)}),(0,P.jsx)(b,{testId:`edit-automation-save`,type:`submit`,variant:`primary`,isDisabled:i.isPending,"aria-busy":i.isPending,children:i.isPending?r(c.AUTOMATIONS$SAVING):r(c.AUTOMATIONS$SAVE)})]})]})]})]})}export{oe as C,ae as S,W as _,Q as a,H as b,Z as c,de as d,ue as f,q as g,K as h,ye as i,pe as l,ce as m,xe as n,ve as o,le as p,be as r,_e as s,we as t,fe as u,R as v,M as w,z as x,V as y};
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browser-B39N74jU.js","assets/vendor~browser-Cvg7jXCP.js","assets/vendor~browser-Dqd33JyP.js","assets/llm-subscription-DtsX5Lhg.js","assets/settings-mQUckT0g.js","assets/common-Dh7OqABE.js","assets/automation-BU8zu-FP.js"])))=>i.map(i=>d[i]);
2
- import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,St as n,bt as r}from"./vendor-styling-CI0PQ3ab.js";import{n as i}from"./vendor~entry.client-9tWQ_Ugw.js";import{t as a}from"./vendor~entry.client-D6BtSOtn.js";import{n as o,t as s}from"./providers-CPoq0VXm.js";import{W as c}from"./active-backend-context-DRFevVIj.js";var l=e(t(),1),u=a();function d({mockApi:e=void 0,hasWindow:t=typeof window<`u`}={}){return t&&e===`true`}var f=r();async function p(){if(await c(),d()){let{worker:e}=await n(async()=>{let{worker:e}=await import(`./browser-B39N74jU.js`);return{worker:e}},__vite__mapDeps([0,1,2,3,4,5,6]));await e.start({onUnhandledRequest:`bypass`})}}p().then(()=>(0,l.startTransition)(()=>{(0,u.hydrateRoot)(document,(0,f.jsx)(l.StrictMode,{children:(0,f.jsx)(s,{analytics:o,withStyleRoot:!1,children:(0,f.jsx)(i,{})})}))}));
2
+ import{a as e}from"./rolldown-runtime-BFRubm34.js";import{Ct as t,St as n,bt as r}from"./vendor-styling-CI0PQ3ab.js";import{n as i}from"./vendor~entry.client-9tWQ_Ugw.js";import{t as a}from"./vendor~entry.client-D6BtSOtn.js";import{n as o,t as s}from"./providers-vX9jk9Vy.js";import{W as c}from"./active-backend-context-u2tdYRgH.js";var l=e(t(),1),u=a();function d({mockApi:e=void 0,hasWindow:t=typeof window<`u`}={}){return t&&e===`true`}var f=r();async function p(){if(await c(),d()){let{worker:e}=await n(async()=>{let{worker:e}=await import(`./browser-B39N74jU.js`);return{worker:e}},__vite__mapDeps([0,1,2,3,4,5,6]));await e.start({onUnhandledRequest:`bypass`})}}p().then(()=>(0,l.startTransition)(()=>{(0,u.hydrateRoot)(document,(0,f.jsx)(l.StrictMode,{children:(0,f.jsx)(s,{analytics:o,withStyleRoot:!1,children:(0,f.jsx)(i,{})})}))}));
@@ -1 +1 @@
1
- import{bt as e}from"./vendor-styling-CI0PQ3ab.js";import{L as t,s as n}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{t as r}from"./useTranslation-Cgy4JA_g.js";import{t as i}from"./declaration-B9kpCaYl.js";import{t as a}from"./sidebar-nav-link-CIB3NBRW.js";import{r as o}from"./typography-YGPBGzOG.js";import{t as s}from"./use-breakpoint-B-O0lQ84.js";import{t as c}from"./backend-synced-settings-badge-6OCwIuLY.js";import{t as l}from"./extensions-navigation-BtV14oQL.js";var u=e();function d(){let{t:e}=r(`openhands`);return(0,u.jsxs)(`div`,{"data-testid":`extensions-mobile-hub`,className:`flex flex-col gap-4 px-4 py-2 md:hidden`,children:[(0,u.jsx)(o.H2,{children:e(i.NAV$CUSTOMIZE)}),(0,u.jsx)(`nav`,{className:`flex flex-col gap-0.5`,children:l.map(e=>(0,u.jsx)(a,{to:e.to,label:e.label,end:e.end,testId:`sidebar-extensions-${e.to}`,icon:e.icon,disabled:e.comingSoon},e.to))}),(0,u.jsx)(`div`,{className:`pt-1`,children:(0,u.jsx)(c,{})})]})}var f=t(function(){return s(768)?(0,u.jsx)(d,{}):(0,u.jsx)(n,{to:`/skills`,replace:!0})});export{f as default};
1
+ import{bt as e}from"./vendor-styling-CI0PQ3ab.js";import{L as t,s as n}from"./vendor~entry.client~root~root-layout~index-redirect~home~conversation-panel~conversation~la~byh8a1g4-XNPdpuO8.js";import{t as r}from"./useTranslation-Cgy4JA_g.js";import{t as i}from"./declaration-B9kpCaYl.js";import{t as a}from"./sidebar-nav-link-CIB3NBRW.js";import{r as o}from"./typography-YGPBGzOG.js";import{t as s}from"./use-breakpoint-B-O0lQ84.js";import{t as c}from"./backend-synced-settings-badge-Bs3FSXsS.js";import{t as l}from"./extensions-navigation-Di9rJ-b5.js";var u=e();function d(){let{t:e}=r(`openhands`);return(0,u.jsxs)(`div`,{"data-testid":`extensions-mobile-hub`,className:`flex flex-col gap-4 px-4 py-2 md:hidden`,children:[(0,u.jsx)(o.H2,{children:e(i.NAV$CUSTOMIZE)}),(0,u.jsx)(`nav`,{className:`flex flex-col gap-0.5`,children:l.map(e=>(0,u.jsx)(a,{to:e.to,label:e.label,end:e.end,testId:`sidebar-extensions-${e.to}`,icon:e.icon,disabled:e.comingSoon},e.to))}),(0,u.jsx)(`div`,{className:`pt-1`,children:(0,u.jsx)(c,{})})]})}var f=t(function(){return s(768)?(0,u.jsx)(d,{}):(0,u.jsx)(n,{to:`/skills`,replace:!0})});export{f as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime-BFRubm34.js";import{Ct as e,bt as t}from"./vendor-styling-CI0PQ3ab.js";import{t as n}from"./useTranslation-Cgy4JA_g.js";import{t as r}from"./declaration-B9kpCaYl.js";import{t as i}from"./utils-CE0lDWtb.js";import{t as a}from"./navigation-link-D8hfwvxI.js";import{f as o,o as s}from"./sidebar-layout-BtpUSN3j.js";import{t as c}from"./skills-9cDZONKh.js";import{t as l}from"./backend-synced-settings-badge-6OCwIuLY.js";e();var u=t(),d=[{to:`/skills`,label:`Skills`,icon:(0,u.jsx)(c,{width:16,height:16,"aria-hidden":`true`}),end:!0},{to:`/mcp`,label:`MCP Servers`,icon:(0,u.jsx)(e=>(0,u.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,u.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M2.25 3H21.75L22.5 3.75V13.5H21V9H3V19.5H13.5V21H2.25L1.5 20.25V3.75L2.25 3ZM3 7.5H21V4.5H3V7.5ZM10.5 18V16.359C10.2451 16.2664 10.0074 16.132 9.7965 15.9615L8.379 16.77L7.629 15.48L9.0345 14.6595C8.98649 14.3881 8.98649 14.1104 9.0345 13.839L7.629 13.02L8.379 11.73L9.7965 12.54C10.023 12.36 10.2585 12.2265 10.5 12.141V10.5H12V12.141C12.2568 12.2293 12.4953 12.3641 12.7035 12.5385L14.121 11.73L14.871 13.02L13.4655 13.8405C13.5133 14.1114 13.5133 14.3886 13.4655 14.6595L14.871 15.48L14.121 16.77L12.7035 15.96C12.4903 16.1274 12.2531 16.2619 12 16.359V18H10.5ZM10.125 14.25C10.125 14.562 10.2345 14.8275 10.4535 15.0465C10.5568 15.1528 10.6807 15.2367 10.8177 15.2932C10.9547 15.3497 11.1018 15.3776 11.25 15.375C11.3982 15.3776 11.5453 15.3497 11.6823 15.2932C11.8193 15.2367 11.9432 15.1528 12.0465 15.0465C12.1528 14.9432 12.2367 14.8193 12.2932 14.6823C12.3497 14.5453 12.3776 14.3982 12.375 14.25C12.3776 14.1018 12.3497 13.9547 12.2932 13.8177C12.2367 13.6807 12.1528 13.5568 12.0465 13.4535C11.9432 13.3472 11.8193 13.2633 11.6823 13.2068C11.5453 13.1503 11.3982 13.1224 11.25 13.125C11.1018 13.1224 10.9547 13.1503 10.8177 13.2068C10.6807 13.2633 10.5568 13.3472 10.4535 13.4535C10.3472 13.5568 10.2633 13.6807 10.2068 13.8177C10.1503 13.9547 10.1224 14.1018 10.125 14.25ZM18.126 22.5V20.859C17.8711 20.7663 17.6334 20.632 17.4225 20.4615L16.005 21.27L15.255 19.98L16.662 19.1595C16.614 18.8881 16.614 18.6104 16.662 18.339L15.255 17.52L16.005 16.23L17.4225 17.04C17.649 16.86 17.8845 16.7265 18.1275 16.641V15H19.6275V16.641C19.8837 16.7297 20.1216 16.8644 20.3295 17.0385L21.747 16.23L22.497 17.52L21.0915 18.3405C21.1396 18.6114 21.1396 18.8886 21.0915 19.1595L22.497 19.98L21.747 21.27L20.3295 20.46C20.1163 20.6275 19.8791 20.762 19.626 20.859V22.5H18.126ZM17.751 18.75C17.751 19.062 17.8605 19.3275 18.0795 19.5465C18.1828 19.6528 18.3067 19.7367 18.4437 19.7932C18.5807 19.8497 18.7278 19.8776 18.876 19.875C19.0242 19.8776 19.1713 19.8497 19.3083 19.7932C19.4453 19.7367 19.5692 19.6528 19.6725 19.5465C19.779 19.4434 19.8633 19.3195 19.9201 19.1825C19.9768 19.0455 20.0049 18.8983 20.0025 18.75C20.0049 18.6017 19.9768 18.4545 19.9201 18.3175C19.8633 18.1805 19.779 18.0566 19.6725 17.9535C19.5694 17.8474 19.4457 17.7636 19.309 17.7071C19.1722 17.6506 19.0254 17.6226 18.8775 17.625C18.7291 17.6222 18.5817 17.65 18.4444 17.7065C18.3072 17.763 18.183 17.847 18.0795 17.9535C17.9732 18.0568 17.8893 18.1807 17.8328 18.3177C17.7763 18.4547 17.7484 18.6018 17.751 18.75Z`,fill:`currentColor`})}),{width:16,height:16}),end:!0},{to:`/plugins`,label:`Plugins`,icon:(0,u.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,width:16,height:16,"aria-hidden":`true`,children:[(0,u.jsx)(`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`}),(0,u.jsx)(`path`,{d:`m3.3 7 8.7 5 8.7-5`}),(0,u.jsx)(`path`,{d:`M12 22V12`})]}),end:!0}];function f(){let{t:e}=n(`openhands`);return(0,u.jsxs)(`aside`,{"data-testid":`extensions-navbar-desktop`,className:`hidden md:flex md:w-[260px] md:shrink-0 md:flex-col md:gap-2 md:sticky md:top-8 md:self-start`,children:[(0,u.jsx)(`span`,{className:`px-2 text-sm font-normal text-white`,children:e(r.NAV$CUSTOMIZE)}),(0,u.jsx)(`div`,{className:`flex flex-col gap-0.5 pt-0.5`,children:d.map(t=>{let n=(0,u.jsx)(`span`,{className:`shrink-0 flex items-center justify-center`,children:t.icon}),c=(0,u.jsx)(`span`,{className:`truncate`,children:t.label}),l=t.comingSoon&&(0,u.jsx)(`span`,{className:`ml-auto shrink-0 rounded-full border border-white/20 bg-white/5 px-1.5 py-0.5 text-[10px] font-medium text-[var(--oh-text-dim)]`,children:e(r.NAV$COMING_SOON)});return(0,u.jsxs)(a,{to:t.to,end:t.end,"data-testid":`sidebar-extensions-${t.to}`,className:({isActive:e})=>i(o(),`truncate`,e?s.active:s.idle),children:[n,c,l]},t.to)})}),(0,u.jsx)(`div`,{className:`px-2 pt-3`,children:(0,u.jsx)(l,{})})]})}export{f as n,d as t};
1
+ import"./rolldown-runtime-BFRubm34.js";import{Ct as e,bt as t}from"./vendor-styling-CI0PQ3ab.js";import{t as n}from"./useTranslation-Cgy4JA_g.js";import{t as r}from"./declaration-B9kpCaYl.js";import{t as i}from"./utils-CE0lDWtb.js";import{t as a}from"./navigation-link-D8hfwvxI.js";import{f as o,o as s}from"./sidebar-layout-BtpUSN3j.js";import{t as c}from"./skills-9cDZONKh.js";import{t as l}from"./backend-synced-settings-badge-Bs3FSXsS.js";e();var u=t(),d=[{to:`/skills`,label:`Skills`,icon:(0,u.jsx)(c,{width:16,height:16,"aria-hidden":`true`}),end:!0},{to:`/mcp`,label:`MCP Servers`,icon:(0,u.jsx)(e=>(0,u.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,...e,children:(0,u.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M2.25 3H21.75L22.5 3.75V13.5H21V9H3V19.5H13.5V21H2.25L1.5 20.25V3.75L2.25 3ZM3 7.5H21V4.5H3V7.5ZM10.5 18V16.359C10.2451 16.2664 10.0074 16.132 9.7965 15.9615L8.379 16.77L7.629 15.48L9.0345 14.6595C8.98649 14.3881 8.98649 14.1104 9.0345 13.839L7.629 13.02L8.379 11.73L9.7965 12.54C10.023 12.36 10.2585 12.2265 10.5 12.141V10.5H12V12.141C12.2568 12.2293 12.4953 12.3641 12.7035 12.5385L14.121 11.73L14.871 13.02L13.4655 13.8405C13.5133 14.1114 13.5133 14.3886 13.4655 14.6595L14.871 15.48L14.121 16.77L12.7035 15.96C12.4903 16.1274 12.2531 16.2619 12 16.359V18H10.5ZM10.125 14.25C10.125 14.562 10.2345 14.8275 10.4535 15.0465C10.5568 15.1528 10.6807 15.2367 10.8177 15.2932C10.9547 15.3497 11.1018 15.3776 11.25 15.375C11.3982 15.3776 11.5453 15.3497 11.6823 15.2932C11.8193 15.2367 11.9432 15.1528 12.0465 15.0465C12.1528 14.9432 12.2367 14.8193 12.2932 14.6823C12.3497 14.5453 12.3776 14.3982 12.375 14.25C12.3776 14.1018 12.3497 13.9547 12.2932 13.8177C12.2367 13.6807 12.1528 13.5568 12.0465 13.4535C11.9432 13.3472 11.8193 13.2633 11.6823 13.2068C11.5453 13.1503 11.3982 13.1224 11.25 13.125C11.1018 13.1224 10.9547 13.1503 10.8177 13.2068C10.6807 13.2633 10.5568 13.3472 10.4535 13.4535C10.3472 13.5568 10.2633 13.6807 10.2068 13.8177C10.1503 13.9547 10.1224 14.1018 10.125 14.25ZM18.126 22.5V20.859C17.8711 20.7663 17.6334 20.632 17.4225 20.4615L16.005 21.27L15.255 19.98L16.662 19.1595C16.614 18.8881 16.614 18.6104 16.662 18.339L15.255 17.52L16.005 16.23L17.4225 17.04C17.649 16.86 17.8845 16.7265 18.1275 16.641V15H19.6275V16.641C19.8837 16.7297 20.1216 16.8644 20.3295 17.0385L21.747 16.23L22.497 17.52L21.0915 18.3405C21.1396 18.6114 21.1396 18.8886 21.0915 19.1595L22.497 19.98L21.747 21.27L20.3295 20.46C20.1163 20.6275 19.8791 20.762 19.626 20.859V22.5H18.126ZM17.751 18.75C17.751 19.062 17.8605 19.3275 18.0795 19.5465C18.1828 19.6528 18.3067 19.7367 18.4437 19.7932C18.5807 19.8497 18.7278 19.8776 18.876 19.875C19.0242 19.8776 19.1713 19.8497 19.3083 19.7932C19.4453 19.7367 19.5692 19.6528 19.6725 19.5465C19.779 19.4434 19.8633 19.3195 19.9201 19.1825C19.9768 19.0455 20.0049 18.8983 20.0025 18.75C20.0049 18.6017 19.9768 18.4545 19.9201 18.3175C19.8633 18.1805 19.779 18.0566 19.6725 17.9535C19.5694 17.8474 19.4457 17.7636 19.309 17.7071C19.1722 17.6506 19.0254 17.6226 18.8775 17.625C18.7291 17.6222 18.5817 17.65 18.4444 17.7065C18.3072 17.763 18.183 17.847 18.0795 17.9535C17.9732 18.0568 17.8893 18.1807 17.8328 18.3177C17.7763 18.4547 17.7484 18.6018 17.751 18.75Z`,fill:`currentColor`})}),{width:16,height:16}),end:!0},{to:`/plugins`,label:`Plugins`,icon:(0,u.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,width:16,height:16,"aria-hidden":`true`,children:[(0,u.jsx)(`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`}),(0,u.jsx)(`path`,{d:`m3.3 7 8.7 5 8.7-5`}),(0,u.jsx)(`path`,{d:`M12 22V12`})]}),end:!0}];function f(){let{t:e}=n(`openhands`);return(0,u.jsxs)(`aside`,{"data-testid":`extensions-navbar-desktop`,className:`hidden md:flex md:w-[260px] md:shrink-0 md:flex-col md:gap-2 md:sticky md:top-8 md:self-start`,children:[(0,u.jsx)(`span`,{className:`px-2 text-sm font-normal text-white`,children:e(r.NAV$CUSTOMIZE)}),(0,u.jsx)(`div`,{className:`flex flex-col gap-0.5 pt-0.5`,children:d.map(t=>{let n=(0,u.jsx)(`span`,{className:`shrink-0 flex items-center justify-center`,children:t.icon}),c=(0,u.jsx)(`span`,{className:`truncate`,children:t.label}),l=t.comingSoon&&(0,u.jsx)(`span`,{className:`ml-auto shrink-0 rounded-full border border-white/20 bg-white/5 px-1.5 py-0.5 text-[10px] font-medium text-[var(--oh-text-dim)]`,children:e(r.NAV$COMING_SOON)});return(0,u.jsxs)(a,{to:t.to,end:t.end,"data-testid":`sidebar-extensions-${t.to}`,className:({isActive:e})=>i(o(),`truncate`,e?s.active:s.idle),children:[n,c,l]},t.to)})}),(0,u.jsx)(`div`,{className:`px-2 pt-3`,children:(0,u.jsx)(l,{})})]})}export{f as n,d as t};