agent-tower 0.7.2-beta.6 → 0.7.2-beta.7

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 (195) hide show
  1. package/dist/web/assets/AgentDemoPage-CaR_Yk9_.js +1 -0
  2. package/dist/web/assets/{AgentEnvironmentSettingsPage-BnWVgvNe.js → AgentEnvironmentSettingsPage-SnxiaHvN.js} +1 -1
  3. package/dist/web/assets/BranchSelect-D-kqavDG.js +1 -0
  4. package/dist/web/assets/BrandLogo-CC1alVsd.js +1 -0
  5. package/dist/web/assets/ConversationPage-RWKLxe1j.js +3 -0
  6. package/dist/web/assets/CreateTaskInput-SHJ1YpRe.js +1 -0
  7. package/dist/web/assets/{DemoPage-BwX2SvcN.js → DemoPage-BHbnnZFF.js} +1 -1
  8. package/dist/web/assets/DesignSystemPage-ChCrzeKT.js +12 -0
  9. package/dist/web/assets/EditableTaskTitle-CGVeZUSt.js +70 -0
  10. package/dist/web/assets/{ExecutionPermissionSelector-DeeNd4Kh.js → ExecutionPermissionSelector-DcC4IBOF.js} +10 -10
  11. package/dist/web/assets/GeneralSettingsPage-C_tkwpmF.js +1 -0
  12. package/dist/web/assets/{LoadingPreviewPage-BxEFnEQh.js → LoadingPreviewPage-dE_jyl19.js} +1 -1
  13. package/dist/web/assets/McpSettingsPage-CIuQ4bvy.js +1 -0
  14. package/dist/web/assets/MemberAvatar-BG0VDZKf.js +1 -0
  15. package/dist/web/assets/MobileTaskDetail-DxE6ZDAS.js +5 -0
  16. package/dist/web/assets/NotificationSettingsPage-B-Ot2OMg.js +1 -0
  17. package/dist/web/assets/ProfileSettingsPage-Dn1lrjJr.js +3 -0
  18. package/dist/web/assets/ProjectKanbanPage-jcW8sA7x.js +12 -0
  19. package/dist/web/assets/ProjectSettingsPage-BFPty2eA.js +2 -0
  20. package/dist/web/assets/ProviderSettingsPage-DLq-GBxp.js +67 -0
  21. package/dist/web/assets/SettingsMasterDetail-UfyoKAum.js +1 -0
  22. package/dist/web/assets/TaskDetail-a1jalILy.js +3 -0
  23. package/dist/web/assets/TeamSettingsPage-BxGc4W7K.js +1 -0
  24. package/dist/web/assets/{arc-Bm_QIbJA.js → arc-dhk0OSs5.js} +1 -1
  25. package/dist/web/assets/{architectureDiagram-3BPJPVTR-B5EIiXuX.js → architectureDiagram-3BPJPVTR-BCNj6ZWE.js} +1 -1
  26. package/dist/web/assets/{at-sign-BE17rU5b.js → at-sign-C4VhWike.js} +1 -1
  27. package/dist/web/assets/{blockDiagram-GPEHLZMM-GFwnvSLM.js → blockDiagram-GPEHLZMM-D1kmB9gz.js} +1 -1
  28. package/dist/web/assets/{c4Diagram-AAUBKEIU-iJfLTxEa.js → c4Diagram-AAUBKEIU-DbWKTkSe.js} +1 -1
  29. package/dist/web/assets/channel-K0AG6Tl1.js +1 -0
  30. package/dist/web/assets/check-DYlb0A_N.js +1 -0
  31. package/dist/web/assets/{chevron-up-D0y6skqr.js → chevron-up-DOkDFvIc.js} +1 -1
  32. package/dist/web/assets/{chunk-2J33WTMH-CDxRPp-8.js → chunk-2J33WTMH-B3TA0-LD.js} +1 -1
  33. package/dist/web/assets/{chunk-4BX2VUAB-mzPbgyiz.js → chunk-4BX2VUAB-CvPTiBSV.js} +1 -1
  34. package/dist/web/assets/{chunk-55IACEB6-KNAJbQyw.js → chunk-55IACEB6-xGe9Fu9Z.js} +1 -1
  35. package/dist/web/assets/{chunk-727SXJPM-BqGfqkDK.js → chunk-727SXJPM-H8pz3amK.js} +1 -1
  36. package/dist/web/assets/{chunk-AQP2D5EJ-D27ue-H0.js → chunk-AQP2D5EJ-BmYYNxcL.js} +1 -1
  37. package/dist/web/assets/{chunk-FMBD7UC4-DRza-3q8.js → chunk-FMBD7UC4-BmOEsLTE.js} +1 -1
  38. package/dist/web/assets/{chunk-ND2GUHAM-CUgkviLu.js → chunk-ND2GUHAM-C5MfA0xc.js} +1 -1
  39. package/dist/web/assets/{chunk-QZHKN3VN-BAlOJwZb.js → chunk-QZHKN3VN-BcrGYZ7V.js} +1 -1
  40. package/dist/web/assets/classDiagram-4FO5ZUOK-BTJ44hwx.js +1 -0
  41. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-BTJ44hwx.js +1 -0
  42. package/dist/web/assets/code-block-OCS4YCEC-DLPrDBDy.js +2 -0
  43. package/dist/web/assets/confirm-dialog-BRkrtULz.js +1 -0
  44. package/dist/web/assets/content-DPCGELMz.js +2 -0
  45. package/dist/web/assets/{copy-DejkmIHZ.js → copy-CdzVE3kf.js} +1 -1
  46. package/dist/web/assets/{cose-bilkent-S5V4N54A-8TBY7BP_.js → cose-bilkent-S5V4N54A-CLQ-m71G.js} +1 -1
  47. package/dist/web/assets/cssMode-ChMyv9Nj.js +1 -0
  48. package/dist/web/assets/{dagre-BM42HDAG-CkMzDiim.js → dagre-BM42HDAG-CmDqxOfn.js} +1 -1
  49. package/dist/web/assets/{diagram-2AECGRRQ-CAOQJ2N1.js → diagram-2AECGRRQ-D-fSbEll.js} +1 -1
  50. package/dist/web/assets/{diagram-5GNKFQAL-DKhE0hiI.js → diagram-5GNKFQAL-HPywThAf.js} +1 -1
  51. package/dist/web/assets/{diagram-KO2AKTUF-DBdkXSpa.js → diagram-KO2AKTUF-DAzLhllz.js} +1 -1
  52. package/dist/web/assets/{diagram-LMA3HP47-DRi2t32c.js → diagram-LMA3HP47-DXYB9h8L.js} +1 -1
  53. package/dist/web/assets/{diagram-OG6HWLK6-DtP92tI1.js → diagram-OG6HWLK6-vv4kz4Zo.js} +1 -1
  54. package/dist/web/assets/dialog-B_vC5R4B.js +5 -0
  55. package/dist/web/assets/{erDiagram-TEJ5UH35-DWFKXtst.js → erDiagram-TEJ5UH35-Cu6aVKAa.js} +1 -1
  56. package/dist/web/assets/{flowDiagram-I6XJVG4X-LDE0h4ri.js → flowDiagram-I6XJVG4X-BKDe8WSQ.js} +1 -1
  57. package/dist/web/assets/{freemarker2-CLksOOZX.js → freemarker2-DI2giuAo.js} +2 -2
  58. package/dist/web/assets/{ganttDiagram-6RSMTGT7-DD2RfdyV.js → ganttDiagram-6RSMTGT7-DMVLzmAE.js} +1 -1
  59. package/dist/web/assets/{gitGraphDiagram-PVQCEYII-DkKrR8ex.js → gitGraphDiagram-PVQCEYII-vogzYdKn.js} +1 -1
  60. package/dist/web/assets/{globe-CD4g63c9.js → globe-Rnn-nKw-.js} +1 -1
  61. package/dist/web/assets/handlebars-B9tmKQPV.js +1 -0
  62. package/dist/web/assets/hooks-DK4m7-FN.js +1 -0
  63. package/dist/web/assets/html-B_E2U0g5.js +1 -0
  64. package/dist/web/assets/htmlMode-DRHM_Cwq.js +1 -0
  65. package/dist/web/assets/icon-button-CuSuXgr_.js +1 -0
  66. package/dist/web/assets/index-B6Lvy5Sr.js +1 -0
  67. package/dist/web/assets/{index-D_QVcsLn.js → index-B88xAivn.js} +4 -4
  68. package/dist/web/assets/index-BCV57B4O.js +41 -0
  69. package/dist/web/assets/index-CMjLMilU.js +1 -0
  70. package/dist/web/assets/index-CTG-4w90.js +1 -0
  71. package/dist/web/assets/index-Cz73HpYH.js +122 -0
  72. package/dist/web/assets/index-CzvAGoau.css +1 -0
  73. package/dist/web/assets/index-DENY_U7o.js +1 -0
  74. package/dist/web/assets/index-ZO2tqdha.js +1 -0
  75. package/dist/web/assets/{infoDiagram-5YYISTIA-BdPA9Xfi.js → infoDiagram-5YYISTIA-CEfSHkNq.js} +1 -1
  76. package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-220u4uiv.js → ishikawaDiagram-YF4QCWOH-BXKZuWtD.js} +1 -1
  77. package/dist/web/assets/javascript-ClWqjgn3.js +1 -0
  78. package/dist/web/assets/{journeyDiagram-JHISSGLW-BvE0Y3tZ.js → journeyDiagram-JHISSGLW-wsOUYlu7.js} +1 -1
  79. package/dist/web/assets/{jsonMode-Dz0hnnvg.js → jsonMode-DVAoDfae.js} +2 -2
  80. package/dist/web/assets/{kanban-definition-UN3LZRKU-Q0JH1P6D.js → kanban-definition-UN3LZRKU-DNsuvOrU.js} +1 -1
  81. package/dist/web/assets/kbd-B3m64lRd.js +1 -0
  82. package/dist/web/assets/{key-round-DZm1FLLr.js → key-round-DpYSyeDH.js} +1 -1
  83. package/dist/web/assets/{layers-Dda7MM7a.js → layers-CxqMQVmH.js} +1 -1
  84. package/dist/web/assets/{linear-Dr6SfnSn.js → linear-BmmCZdOQ.js} +1 -1
  85. package/dist/web/assets/{link-BUeSP3T7.js → link-DbSpzB1w.js} +1 -1
  86. package/dist/web/assets/liquid-CZf3xdoq.js +1 -0
  87. package/dist/web/assets/{lspLanguageFeatures-Bbp4PWlJ.js → lspLanguageFeatures-WhdC7zdf.js} +1 -1
  88. package/dist/web/assets/mdx-xzVEPP01.js +1 -0
  89. package/dist/web/assets/menu-0A0v_lRV.js +1 -0
  90. package/dist/web/assets/menu-styles-DWynpVVz.js +1 -0
  91. package/dist/web/assets/{mermaid-NOHMQCX5-C72362la.js → mermaid-NOHMQCX5-DmKVQY9m.js} +55 -55
  92. package/dist/web/assets/{message-square-CFriSt4D.js → message-square-CfNb-MTd.js} +1 -1
  93. package/dist/web/assets/{mindmap-definition-RKZ34NQL-bvDaNfKs.js → mindmap-definition-RKZ34NQL-0RzXjZ9G.js} +1 -1
  94. package/dist/web/assets/modal-Kpqn-nDO.js +1 -0
  95. package/dist/web/assets/{monaco-BuDK9Fat.js → monaco-I1fXAMIt.js} +3 -3
  96. package/dist/web/assets/{paperclip-BOSklTt7.js → paperclip-BBrzKZQC.js} +1 -1
  97. package/dist/web/assets/{pencil-BRQ9W_a-.js → pencil-pzVKblxj.js} +1 -1
  98. package/dist/web/assets/people-C6b3eeLq.js +1 -0
  99. package/dist/web/assets/{pieDiagram-4H26LBE5-BQCca9Cq.js → pieDiagram-4H26LBE5-Bcvzb8TW.js} +1 -1
  100. package/dist/web/assets/popover-BYz89aiY.js +1 -0
  101. package/dist/web/assets/python-DL05HvW4.js +1 -0
  102. package/dist/web/assets/{quadrantDiagram-W4KKPZXB-BEM2U7Cd.js → quadrantDiagram-W4KKPZXB-DwNhxMxj.js} +1 -1
  103. package/dist/web/assets/razor-BCZ3_uDf.js +1 -0
  104. package/dist/web/assets/{requirementDiagram-4Y6WPE33-CcmFIALZ.js → requirementDiagram-4Y6WPE33-D2wSGYn2.js} +1 -1
  105. package/dist/web/assets/{sankeyDiagram-5OEKKPKP-D9Nrfbqk.js → sankeyDiagram-5OEKKPKP-l3LLF--T.js} +1 -1
  106. package/dist/web/assets/search-field-B5czD2Pl.js +1 -0
  107. package/dist/web/assets/select-DGwKE4l0.js +1 -0
  108. package/dist/web/assets/select-yem-xN9Z.js +1 -0
  109. package/dist/web/assets/{sequenceDiagram-3UESZ5HK-5udQDi0x.js → sequenceDiagram-3UESZ5HK-BAGsbTS_.js} +1 -1
  110. package/dist/web/assets/{server-DJaSJ9m1.js → server-BIPZ9Ka-.js} +1 -1
  111. package/dist/web/assets/{stateDiagram-AJRCARHV-D-cF1NGV.js → stateDiagram-AJRCARHV-C0BHmXYX.js} +1 -1
  112. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-Be3UCkeQ.js +1 -0
  113. package/dist/web/assets/{textarea-Ft9KMoEI.js → textarea-Bnfq7adW.js} +1 -1
  114. package/dist/web/assets/{timeline-definition-PNZ67QCA-DXS236a-.js → timeline-definition-PNZ67QCA-Dt-DcRrG.js} +1 -1
  115. package/dist/web/assets/toggles-DxNDJZsN.js +1 -0
  116. package/dist/web/assets/tooltip-CHOgkFbE.js +1 -0
  117. package/dist/web/assets/track-B_K578io.js +1 -0
  118. package/dist/web/assets/{trash-2-Bc-URu8c.js → trash-2-ALAYDudv.js} +1 -1
  119. package/dist/web/assets/tsMode-kXxq-Lw7.js +11 -0
  120. package/dist/web/assets/typescript-E3_QcT_u.js +1 -0
  121. package/dist/web/assets/{upload-C9Z4jLtv.js → upload-D7hKT2VA.js} +1 -1
  122. package/dist/web/assets/use-attachments-CK7y5KsN.js +2 -0
  123. package/dist/web/assets/use-profiles-Ncqxdw7S.js +1 -0
  124. package/dist/web/assets/{use-projects-DI27nNwl.js → use-projects-Dwy9AfAG.js} +1 -1
  125. package/dist/web/assets/{use-providers-DB9ghBPq.js → use-providers-BRyZjuBG.js} +1 -1
  126. package/dist/web/assets/use-workspaces-BBbahdwU.js +1 -0
  127. package/dist/web/assets/useNormalizedLogs-CRHRedwp.js +1 -0
  128. package/dist/web/assets/useTokenUsage-YwiF0xnT.js +1 -0
  129. package/dist/web/assets/{vennDiagram-CIIHVFJN-BzyNrP06.js → vennDiagram-CIIHVFJN-Cr55FtiY.js} +1 -1
  130. package/dist/web/assets/{wardley-L42UT6IY-BQ4SyU9_.js → wardley-L42UT6IY-CtwMk9MJ.js} +1 -1
  131. package/dist/web/assets/{wardleyDiagram-YWT4CUSO-CcCqmB58.js → wardleyDiagram-YWT4CUSO-BeyHmTu3.js} +1 -1
  132. package/dist/web/assets/xml-DxKND8qX.js +1 -0
  133. package/dist/web/assets/{xychartDiagram-2RQKCTM6-RWm1MtQk.js → xychartDiagram-2RQKCTM6-9g34Lq8E.js} +1 -1
  134. package/dist/web/assets/yaml-BqpCqTY6.js +1 -0
  135. package/dist/web/index.html +2 -2
  136. package/package.json +1 -1
  137. package/dist/web/assets/AgentDemoPage-D0LQRcXm.js +0 -1
  138. package/dist/web/assets/AgentLogo-BDyW3ihb.js +0 -1
  139. package/dist/web/assets/BranchSelect-Dmp5hq0i.js +0 -1
  140. package/dist/web/assets/BrandLogo-YGT4Vlw5.js +0 -1
  141. package/dist/web/assets/ConversationPage-BhapUYGe.js +0 -3
  142. package/dist/web/assets/CreateTaskInput-GLF3Oyc1.js +0 -1
  143. package/dist/web/assets/DesignSystemPage-j-1-1JtQ.js +0 -16
  144. package/dist/web/assets/EditableTaskTitle-mHT39coo.js +0 -70
  145. package/dist/web/assets/GeneralSettingsPage-BBe3EXcj.js +0 -1
  146. package/dist/web/assets/McpSettingsPage-DDA8yUxu.js +0 -1
  147. package/dist/web/assets/MemberAvatar-CCRbS97s.js +0 -1
  148. package/dist/web/assets/MobileTaskDetail-BOIFPybn.js +0 -5
  149. package/dist/web/assets/NotificationSettingsPage-B2kUnE8w.js +0 -1
  150. package/dist/web/assets/ProfileSettingsPage-DPZpUoFd.js +0 -3
  151. package/dist/web/assets/ProjectKanbanPage-DQnwUBFg.js +0 -12
  152. package/dist/web/assets/ProjectSettingsPage-CcXAOYb7.js +0 -2
  153. package/dist/web/assets/ProviderSettingsPage-BAIRvcAS.js +0 -67
  154. package/dist/web/assets/SettingsMasterDetail-BuxwsR9R.js +0 -1
  155. package/dist/web/assets/TaskDetail-B3pOSx3f.js +0 -3
  156. package/dist/web/assets/TeamSettingsPage-DoWmzvKu.js +0 -1
  157. package/dist/web/assets/agent-meta-MzuGtqxl.js +0 -1
  158. package/dist/web/assets/arrow-down-BVePf1ZM.js +0 -1
  159. package/dist/web/assets/channel-CYYV7_Oi.js +0 -1
  160. package/dist/web/assets/check-qs0S_9rB.js +0 -1
  161. package/dist/web/assets/chevron-down-BaQEBzp3.js +0 -1
  162. package/dist/web/assets/circle-alert-Cbvy2cMo.js +0 -1
  163. package/dist/web/assets/classDiagram-4FO5ZUOK-Cl-3ikxt.js +0 -1
  164. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-Cl-3ikxt.js +0 -1
  165. package/dist/web/assets/code-block-OCS4YCEC-CO23R1Os.js +0 -2
  166. package/dist/web/assets/confirm-dialog-BrgNTypL.js +0 -1
  167. package/dist/web/assets/cssMode-hzDRnxMx.js +0 -1
  168. package/dist/web/assets/gauge-CPlvCZUV.js +0 -1
  169. package/dist/web/assets/handlebars-C1M9t0Lo.js +0 -1
  170. package/dist/web/assets/html-DKVKQovh.js +0 -1
  171. package/dist/web/assets/htmlMode-BSWjg5ir.js +0 -1
  172. package/dist/web/assets/index-BnqdwOEH.css +0 -1
  173. package/dist/web/assets/index-CMJV-mgF.js +0 -122
  174. package/dist/web/assets/javascript-WwrMY2Bg.js +0 -1
  175. package/dist/web/assets/liquid-CzGEh0ls.js +0 -1
  176. package/dist/web/assets/mdx-y6S3OMMk.js +0 -1
  177. package/dist/web/assets/modal-DeigO7aN.js +0 -1
  178. package/dist/web/assets/play-Mxkwq69n.js +0 -1
  179. package/dist/web/assets/python-CMnGKsU9.js +0 -1
  180. package/dist/web/assets/razor-mLurbGgY.js +0 -1
  181. package/dist/web/assets/select-DKS02St6.js +0 -1
  182. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-a4ugQnZs.js +0 -1
  183. package/dist/web/assets/status-styles-sQm4KLdp.js +0 -1
  184. package/dist/web/assets/switch-7LWQ_sEx.js +0 -1
  185. package/dist/web/assets/task-CDYaC_No.js +0 -42
  186. package/dist/web/assets/task-priority-acVgTiil.js +0 -1
  187. package/dist/web/assets/tsMode-Vr3bndW1.js +0 -11
  188. package/dist/web/assets/typescript-BfjoaUSn.js +0 -1
  189. package/dist/web/assets/use-attachments-EypT-7PI.js +0 -2
  190. package/dist/web/assets/use-profiles-nMPGwy3v.js +0 -1
  191. package/dist/web/assets/use-workspaces-d4n9m9cX.js +0 -1
  192. package/dist/web/assets/useNormalizedLogs-DRoPbP0w.js +0 -1
  193. package/dist/web/assets/useTokenUsage-4qTDa8SY.js +0 -1
  194. package/dist/web/assets/xml-BGVoPR0b.js +0 -1
  195. package/dist/web/assets/yaml-eFhNavrs.js +0 -1
@@ -0,0 +1,70 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-I1fXAMIt.js","assets/index-Cz73HpYH.js","assets/index-CzvAGoau.css","assets/monaco-Dvl_Svmm.css"])))=>i.map(i=>d[i]);
2
+ import{ce as rn,cf as qr,cg as sn,ch as nn,ci as on,c as he,u as se,r as A,j as t,n as Q,au as Wt,B as me,cj as Ps,ck as Ms,cl as Ds,aA as ht,at as an,X as Qe,av as ln,cc as Lr,ay as Ve,cm as cn,V as Tr,T as qt,cn as dn,am as Ie,aq as ze,F as hn,co as un,cp as fn,cq as mn,aa as Et,t as ye,G as Bs,ab as ct,ac as Oe,ad as Lt,v as de,a5 as ue,o as Te,q as ut,s as ge,S as pe,aI as ft,a7 as xt,D as _e,p as Os,br as pn,ag as Ge,ao as Kt,af as Xt,cr as yt,bj as gn,b5 as Is,w as vr,be as Fs,bu as vn,az as qe,ah as Ft,b8 as _n,ak as bn,Z as xn,E as Hs,a_ as Ws,bq as Sn}from"./index-Cz73HpYH.js";import{p as yn,d as wn,e as Cn,Q as kn,f as En,r as Tt,h as jn,i as Nn,j as Rn}from"./mermaid-NOHMQCX5-DmKVQY9m.js";import{u as An,A as Ln,a as Tn,T as Pn}from"./use-attachments-CK7y5KsN.js";import{u as Pr}from"./use-providers-BRyZjuBG.js";import{M as He}from"./MemberAvatar-BG0VDZKf.js";import{C as $e}from"./index-B6Lvy5Sr.js";import{C as zs}from"./chevron-up-DOkDFvIc.js";import{A as Kr}from"./at-sign-C4VhWike.js";import{P as Mn}from"./paperclip-BBrzKZQC.js";import{C as wt}from"./check-DYlb0A_N.js";import{F as Dn}from"./tooltip-CHOgkFbE.js";import{u as Bn,T as On}from"./useTokenUsage-YwiF0xnT.js";import{a as In}from"./BrandLogo-CC1alVsd.js";import{C as Fn}from"./confirm-dialog-BRkrtULz.js";import{M as jt}from"./modal-Kpqn-nDO.js";import{S as Ue}from"./select-DGwKE4l0.js";import{P as _t,T as Hn}from"./trash-2-ALAYDudv.js";import{L as _r}from"./layers-CxqMQVmH.js";import{M as Wn}from"./message-square-CfNb-MTd.js";import{T as zn}from"./textarea-Bnfq7adW.js";import{r as $n,P as Un,a as $s,h as qn,f as Us,k as Kn,H as zt,F as qs,l as Xn,C as Ks}from"./content-DPCGELMz.js";import{M as Xs,a as Ys,b as Vs,p as Yn,d as Vn,e as Gn}from"./menu-0A0v_lRV.js";import{Z as Zn,c as Qn,b as Jn,j as Xr,k as eo}from"./CreateTaskInput-SHJ1YpRe.js";import{S as br}from"./server-BIPZ9Ka-.js";import{F as Mr}from"./hooks-DK4m7-FN.js";import{I as Fe}from"./icon-button-CuSuXgr_.js";import{S as to}from"./search-field-B5czD2Pl.js";import{g as Gs,f as ro,h as so,b as io,i as Zs,j as Qs,u as Js,k as no,d as oo,c as ao}from"./use-workspaces-BBbahdwU.js";import{U as Dr}from"./upload-D7hKT2VA.js";import{I as lo}from"./popover-BYz89aiY.js";import{f as co,d as ho}from"./use-projects-Dwy9AfAG.js";import{G as ei}from"./globe-Rnn-nKw-.js";import{a as ot,l as uo}from"./ExecutionPermissionSelector-DcC4IBOF.js";import{S as fo}from"./select-yem-xN9Z.js";import{B as mo}from"./BranchSelect-D-kqavDG.js";import{P as po}from"./pencil-pzVKblxj.js";var go=class extends rn{constructor(e,n){super(e,n)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:qr()})}getOptimisticResult(e){return e.behavior=qr(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,n){const{state:i}=e,h=super.createResult(e,n),{isFetching:S,isRefetching:x,isError:w,isRefetchError:s}=h,a=i.fetchMeta?.fetchMore?.direction,u=w&&a==="forward",f=S&&a==="forward",d=w&&a==="backward",m=S&&a==="backward";return{...h,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:nn(n,i.data),hasPreviousPage:sn(n,i.data),isFetchNextPageError:u,isFetchingNextPage:f,isFetchPreviousPageError:d,isFetchingPreviousPage:m,isRefetchError:s&&!u&&!d,isRefetching:x&&!f&&!m}}};function ti(e,n){return on(e,go)}const vo=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],ri=he("arrow-right",vo);const _o=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],si=he("ban",_o);const bo=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],xo=he("chevron-left",bo);const So=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],yo=he("circle",So);const wo=[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]],Co=he("clipboard-paste",wo);const ko=[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ke=he("clock-3",ko);const Eo=[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Yr=he("copy-plus",Eo);const jo=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],No=he("earth",jo);const Ro=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],Uu=he("ellipsis-vertical",Ro);const Ao=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],xr=he("file-code-corner",Ao);const Lo=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],To=he("file-exclamation-point",Lo);const Po=[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v6",key:"158jrl"}],["circle",{cx:"5",cy:"18",r:"3",key:"104gr9"}],["path",{d:"M12 3v18",key:"108xh3"}],["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M16 15.7A9 9 0 0 0 19 9",key:"1e3vqb"}]],Br=he("git-graph",Po);const Mo=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],Do=he("maximize",Mo);const Bo=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],Oo=he("panel-left-close",Bo);const Io=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],Fo=he("panel-left-open",Io);const Ho=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],Wo=he("panel-right-close",Ho);const zo=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],Sr=he("panel-right-open",zo);const $o=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],Uo=he("pen-line",$o);const qo=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],ii=he("settings-2",qo);const Ko=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],Pt=he("user-plus",Ko);const Xo=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],Yo=he("zoom-in",Xo);const Vo=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],Go=he("zoom-out",Vo),Zo=10,Qo=24,ni=Zo*Qo,Jo=8;function ea(e,n=ni){return e>n+Jo}function ta(e,n){return e.includes(n)?e:[...e,n]}function ra(e,n){return e.filter(i=>i!==n)}function sa(e,n){const i=new Map(n.map(h=>[h.id,h]));return e.map(h=>i.get(h)).filter(h=>!!h).map(h=>({memberId:h.id,label:h.name}))}const Yt=new Set(["RUNNING","WAITING_ROOM_REPLY","QUEUED","SESSION_ENDED"]);function Vr(e){if(!e)return 0;const n=Date.parse(e);return Number.isNaN(n)?0:n}function ia(e,n=[],i=[]){const h=new Set(i.filter(x=>Yt.has(x.status)).map(x=>x.workRequestId));return[...e.map(x=>({kind:"message",key:`message:${x.id}`,sortTime:x.createdAt,order:0,message:x})),...n.filter(x=>x.status==="PENDING_APPROVAL").filter(x=>!h.has(x.id)).map(x=>({kind:"pendingApproval",key:`pending-approval:${x.id}`,sortTime:x.updatedAt??x.createdAt,order:1,request:x}))].sort((x,w)=>{const s=Vr(x.sortTime)-Vr(w.sortTime);return s!==0?s:x.order!==w.order?x.order-w.order:x.key.localeCompare(w.key)})}function na(e){switch(e){case"RUNNING":return"Working";case"QUEUED":return"Queued...";case"WAITING_ROOM_REPLY":return"Waiting reply...";case"SESSION_ENDED":return"Session ended";default:return e}}function oa(e){switch(e){case"FAILED":return"text-destructive-ink";case"RUNNING":case"WAITING_ROOM_REPLY":case"QUEUED":case"SESSION_ENDED":return"text-muted-foreground";default:return"text-muted-foreground"}}function aa(e,n){const i=e.reduce((S,x)=>(S[x.status]=(S[x.status]??0)+1,S),{});return[["RUNNING","running"],["QUEUED","queued"],["WAITING_ROOM_REPLY","waiting"],["SESSION_ENDED","ended"]].map(([S,x])=>{const w=i[S];return w?`${w} ${n(x)}`:null}).filter(S=>!!S).join(" · ")}function la(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(min-width: 768px)").matches}function ca({status:e}){const{t:n}=se();return e==="RUNNING"?t.jsxs(t.Fragment,{children:[n("Working"),t.jsxs("span",{className:"active-work-dots","aria-hidden":"true",children:[t.jsx("span",{children:"."}),t.jsx("span",{className:"active-work-dots__second",children:"."}),t.jsx("span",{className:"active-work-dots__third",children:"."})]})]}):t.jsx(t.Fragment,{children:n(na(e))})}function da({invocations:e,memberById:n,workRequestById:i,onViewInvocationSession:h,onStopMember:S,isStopPending:x,stoppingMemberId:w,stopPromptInvocationId:s,onToggleStopConfirm:a}){const{t:u}=se(),[f,d]=A.useState(la),m=A.useMemo(()=>e.filter(y=>Yt.has(y.status)).sort((y,b)=>Date.parse(b.updatedAt??b.createdAt??"")-Date.parse(y.updatedAt??y.createdAt??"")),[e]);if(m.length===0)return null;const g=aa(m,u);return t.jsxs("div",{className:"border-t border-border bg-muted/40",children:[t.jsxs("button",{type:"button",onClick:()=>d(y=>!y),"aria-expanded":f,className:"flex h-8 w-full items-center justify-between gap-3 px-3 text-left text-xs text-foreground/70 transition-colors hover:bg-accent",children:[t.jsxs("span",{className:"min-w-0 truncate",children:[t.jsx("span",{className:"font-medium text-foreground",children:u("Active work")}),t.jsx("span",{className:"mx-1.5 text-muted-foreground",children:"·"}),t.jsx("span",{children:g})]}),f?t.jsx($e,{size:15,className:"shrink-0 text-muted-foreground/70"}):t.jsx(zs,{size:15,className:"shrink-0 text-muted-foreground/70"})]}),f&&t.jsx("div",{className:"max-h-32 overflow-y-auto border-t border-border",children:m.map(y=>{const b=n.get(y.memberId),r=i.get(y.workRequestId),o=!!(y.sessionId&&h),l=!!b,c=s===y.id,p=x&&w===y.memberId,_=r?.instruction??y.workRequestId;return t.jsxs("div",{className:"border-t border-border/60 first:border-t-0",children:[t.jsxs("div",{title:_,className:Q("group flex h-8 items-center gap-2 px-3 text-xs text-foreground/80",o?"cursor-pointer hover:bg-background":"cursor-default"),role:o?"button":void 0,tabIndex:o?0:void 0,onClick:()=>y.sessionId&&h?.(y.sessionId),onKeyDown:C=>{!o||!y.sessionId||(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),h?.(y.sessionId))},children:[t.jsx(He,{name:b?.name??u("Agent"),avatar:b?.avatar??null,size:"xs",className:"size-4"}),t.jsxs("div",{className:"flex min-w-0 flex-1 items-baseline gap-1.5",children:[t.jsx("span",{className:"truncate font-medium text-foreground",children:b?.name??u("Agent")}),t.jsx("span",{className:Q("shrink-0",oa(y.status)),children:t.jsx(ca,{status:y.status})})]}),o&&t.jsx("button",{type:"button",onClick:C=>{C.stopPropagation(),y.sessionId&&h?.(y.sessionId)},onKeyDown:C=>C.stopPropagation(),className:"hidden shrink-0 rounded-md p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground/80 group-hover:inline-flex",title:u("View log"),"aria-label":`${u("View log")} ${b?.name??u("Agent")}`,children:t.jsx(Sr,{size:13})}),l&&t.jsx("button",{type:"button",onClick:C=>{C.stopPropagation(),a(y.id)},onKeyDown:C=>C.stopPropagation(),disabled:p,className:"shrink-0 rounded-md p-1 text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive-ink disabled:cursor-not-allowed disabled:opacity-50",title:u("Stop"),"aria-label":`${u("Stop")} ${b?.name??u("Agent")}`,children:t.jsx(Wt,{size:12})})]}),l&&c&&b&&t.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 border-t border-border/60 bg-background px-3 py-2",children:[t.jsx("span",{className:"mr-1 text-xs text-foreground/70",children:u("Stop running work?")}),t.jsxs(me,{type:"button",size:"xs",variant:"outline",disabled:p,onClick:()=>S(b.id,!1),children:[t.jsx(Wt,{size:11}),t.jsx("span",{children:u(p?"Stopping":"Stop only")})]}),t.jsxs(me,{type:"button",size:"xs",variant:"outline",disabled:p,className:"border-destructive/25 bg-destructive/10 text-destructive-ink hover:bg-destructive/15 hover:text-destructive-ink",onClick:()=>S(b.id,!0),children:[t.jsx(si,{size:11}),t.jsx("span",{children:u(p?"Stopping":"Stop + clear queue")})]})]})]},y.id)})})]})}const yr=Tr(),ha=240;let Gr=0;function ua(e,n){return Gr+=1,{id:`pending-room-message-${Date.now()}-${Gr}`,teamRunId:e,senderType:n.senderType??"user",senderId:n.senderId??null,senderInvocationId:n.senderInvocationId??null,kind:n.kind??((n.mentions?.length??0)>0?"work_request":"chat"),visibility:"PUBLIC",content:n.content,mentions:n.mentions??[],workRequestIds:[],artifactRefs:n.artifactRefs??[],attachmentIds:n.attachmentIds??[],createdAt:new Date().toISOString(),pendingStatus:"sending"}}function oi(e){return"pendingStatus"in e}function fa(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}function ma(e){return`${e.mimeType.startsWith("image/")?"!":""}[${e.originalName}](${e.storagePath})`}function wr(e,n){if(n.length===0)return e;const i=new Set(n.map(ma));return e.split(`
3
+ `).map(h=>{const S=h.match(/^\s*/)?.[0]??"",x=h.trimStart();for(const w of i){if(x===w)return null;if(x.startsWith(`${w} `)||x.startsWith(`${w} `))return`${S}${x.slice(w.length).trimStart()}`}return h}).filter(h=>h!=null).join(`
4
+ `).replace(/\n{3,}/g,`
5
+
6
+ `).trim()}function pa(e){if(!e)return"";const n=new Date(e);return Number.isNaN(n.getTime())?"":n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function Cr(e,n){return e instanceof Error?e.message:n}function ga(e,n=ha){const i=(e??"").replace(/\s+/g," ").trim();return i.length<=n?i:`${i.slice(0,n-3).trimEnd()}...`}function va(e,n){const h=e.slice(0,n).match(/(^|\s)@([^\s@]*)$/);return!h||h.index==null?null:{start:h.index+h[1].length,end:n,query:h[2]??""}}function _a(e,n){const i=n.trim().toLowerCase();return i?[e.name,e.providerId,...e.aliases??[]].some(S=>S.toLowerCase().includes(i)):!0}function Zr(e){return e.membershipStatus!=="REMOVED"}function ba(e,n){return e.label??n.get(e.memberId)?.name??e.memberId}function xa(e,n){return(e.recipientMemberIds??[]).map(i=>n.get(i)?.name??i)}function Sa(e,n){const i=e.mentions??[],h=e.contentPreview??e.content;if(i.length===0)return h;const S=i.map(w=>ba(w,n)).filter(w=>w&&!h.includes(`@${w}`));if(S.length===0)return h;const x=S.map(w=>`@${w}`).join(" ");return h.trimEnd()?`${h.trimEnd()} ${x}`:x}function ya(e,n,i){if(e.senderType!=="agent")return null;if(e.senderId&&n.has(e.senderId))return n.get(e.senderId)??null;if(e.senderInvocationId){const h=i.get(e.senderInvocationId);if(h?.memberId&&n.has(h.memberId))return n.get(h.memberId)??null}return null}function wa({content:e,workingDir:n,onOpenWorkspaceFile:i,onOpenPreviewUrl:h,onOpenVisualization:S,downloadSessionId:x}){const w=A.useMemo(()=>S||x?yn(e):e,[e,x,S]),s=wn(w),a=A.useMemo(()=>Cn({workingDir:n,onOpenWorkspaceFile:i,onOpenPreviewUrl:h,onOpenVisualization:S,downloadSessionId:x}),[x,h,S,i,n]);return t.jsx("div",{className:Q("team-room-message-markdown prose prose-sm max-w-none break-words [overflow-wrap:anywhere]","prose-p:my-2 prose-p:first:mt-0 prose-p:last:mb-0 prose-p:leading-6","prose-ul:my-2 prose-ol:my-2 prose-li:my-1 prose-li:pl-0 prose-li:leading-6 prose-li:marker:text-muted-foreground","prose-blockquote:my-2 prose-blockquote:border-l-2 prose-blockquote:border-border prose-blockquote:pl-3 prose-blockquote:text-foreground/70","prose-pre:my-3 prose-pre:max-w-full prose-pre:overflow-x-auto prose-pre:rounded-md prose-pre:border prose-pre:border-border/60 prose-pre:bg-foreground/[0.025] prose-pre:p-3 prose-pre:text-xs prose-pre:leading-relaxed","prose-code:break-words prose-code:rounded prose-code:bg-muted prose-code:px-1 prose-code:py-0.5 prose-code:text-[0.9em] prose-code:font-medium prose-code:text-foreground","prose-pre:prose-code:bg-transparent prose-pre:prose-code:p-0 prose-pre:prose-code:text-foreground","prose-headings:mb-2 prose-headings:mt-3 prose-headings:font-semibold prose-headings:leading-snug","prose-hr:my-3 prose-hr:border-border","text-foreground prose-strong:text-foreground"),children:t.jsx(kn,{components:a,plugins:s,controls:s?En:void 0,children:w})})}function Ca({hasAttachmentIds:e,attachments:n,isLoading:i,onOpenImage:h}){if(!e)return null;if(i&&n.length===0)return t.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"Loading attachments..."});if(n.length===0)return null;const S=n.filter(w=>w.mimeType.startsWith("image/")),x=new Map(S.map((w,s)=>[w.id,s]));return t.jsx("div",{className:"mt-3 flex flex-wrap gap-2 text-foreground/80",children:n.map(w=>{const s=`${yr}${w.url}`;if(w.mimeType.startsWith("image/")){const u=x.get(w.id)??0;return t.jsxs("button",{type:"button",onClick:()=>h(S,u),className:"group relative h-24 w-24 overflow-hidden rounded-lg border border-border bg-muted/50 shadow-raised transition-opacity hover:opacity-90",title:w.originalName,children:[t.jsx("img",{src:s,alt:w.originalName,className:"h-full w-full object-cover",loading:"lazy"}),t.jsx("span",{className:"absolute inset-x-0 bottom-0 truncate bg-inverse/60 px-1.5 py-1 text-left text-[11px] text-inverse-foreground",children:w.originalName})]},w.id)}return t.jsxs("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"flex max-w-[220px] items-center gap-2 rounded-lg border border-border bg-background px-3 py-2 text-xs text-foreground/80 shadow-raised hover:bg-accent",title:w.originalName,children:[t.jsx(Dn,{size:16,className:"shrink-0 text-muted-foreground/70","aria-hidden":!0}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block truncate font-medium",children:w.originalName}),t.jsx("span",{className:"text-muted-foreground",children:fa(w.sizeBytes)})]}),t.jsx(Lr,{size:13,className:"shrink-0 text-muted-foreground/70","aria-hidden":!0})]},w.id)})})}function ka({message:e,content:n,attachmentIds:i,isUser:h,tone:S,onOpenImage:x,workingDir:w,onOpenWorkspaceFile:s,onOpenPreviewUrl:a,onOpenVisualization:u,downloadSessionId:f}){const d=A.useMemo(()=>Array.from(new Set(i??[])),[i]),{data:m=[],isLoading:g}=Tn(d),y=m.length>0?wr(n,m):n;return t.jsxs(t.Fragment,{children:[y.trim()&&t.jsx(Na,{message:e,content:y,attachments:m,isUser:h,tone:S,workingDir:w,onOpenWorkspaceFile:s,onOpenPreviewUrl:a,onOpenVisualization:u,downloadSessionId:f}),t.jsx(Ca,{hasAttachmentIds:d.length>0,attachments:m,isLoading:g,onOpenImage:x})]})}function Ea({images:e,index:n,onClose:i,onSelect:h}){const S=e[n];if(!S)return null;const x=n>0,w=n<e.length-1;return t.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-inverse/90 p-4",role:"dialog","aria-modal":"true",children:[t.jsx("button",{type:"button",onClick:i,className:"absolute right-4 top-4 rounded-full bg-inverse-foreground/10 p-2 text-inverse-foreground transition-colors hover:bg-inverse-foreground/20","aria-label":"Close image preview",children:t.jsx(Qe,{size:20})}),x&&t.jsx("button",{type:"button",onClick:()=>h(n-1),className:"absolute left-4 top-1/2 flex h-10 w-10 -translate-y-1/2 items-center justify-center rounded-full bg-inverse-foreground/10 text-inverse-foreground transition-colors hover:bg-inverse-foreground/20","aria-label":"Previous image",children:t.jsx(xo,{size:24,"aria-hidden":!0})}),t.jsxs("div",{className:"flex max-h-full max-w-full flex-col items-center gap-3",children:[t.jsx("img",{src:`${yr}${S.url}`,alt:S.originalName,className:"max-h-[82vh] max-w-[92vw] rounded-lg object-contain"}),t.jsxs("div",{className:"flex items-center gap-3 text-sm text-inverse-foreground",children:[t.jsx("span",{className:"max-w-[70vw] truncate",children:S.originalName}),t.jsxs("a",{href:`${yr}${S.url}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 rounded-md bg-inverse-foreground/10 px-2 py-1 text-xs hover:bg-inverse-foreground/20",children:[t.jsx(Lr,{size:13,"aria-hidden":!0}),"Open"]})]})]}),w&&t.jsx("button",{type:"button",onClick:()=>h(n+1),className:"absolute right-4 top-1/2 flex h-10 w-10 -translate-y-1/2 items-center justify-center rounded-full bg-inverse-foreground/10 text-inverse-foreground transition-colors hover:bg-inverse-foreground/20","aria-label":"Next image",children:t.jsx(Ve,{size:24,"aria-hidden":!0})})]})}function ja({draft:e,attachmentMarkdown:n,attachmentIds:i,mentions:h}){const x=[e.trim(),n].filter(Boolean).join(`
7
+
8
+ `);return x?{content:x,mentions:h,senderType:"user",...i.length>0?{attachmentIds:i}:{}}:null}function Na({message:e,content:n,attachments:i,isUser:h,tone:S=h?"user":"agent",workingDir:x,onOpenWorkspaceFile:w,onOpenPreviewUrl:s,onOpenVisualization:a,downloadSessionId:u}){const{t:f}=se(),d=A.useId(),m=A.useRef(null),[g,y]=A.useState(null),[b,r]=A.useState(!1),[o,l]=A.useState(null),c=dn(e.teamRunId,e.id,!1),p=c.data?.content,_=p?wr(p,i):void 0,k=!!(_&&_!==n)?_:n,v=!!(e.isTruncated&&!oi(e)),E=g?.messageId===e.id&&g.content===k&&g.expanded,R=A.useCallback(()=>{const M=m.current;M&&r(ea(M.scrollHeight))},[]);A.useLayoutEffect(()=>{R();const M=m.current;if(!M)return;const F=window.requestAnimationFrame(R),U=typeof ResizeObserver>"u"?null:new ResizeObserver(R);return U?.observe(M),window.addEventListener("resize",R),()=>{window.cancelAnimationFrame(F),U?.disconnect(),window.removeEventListener("resize",R)}},[k,R]);const O=A.useCallback(async()=>{if(l(null),E){y({messageId:e.id,content:k,expanded:!1});return}if(v&&!p){const M=await c.refetch();if(M.error){l(Cr(M.error,f("Failed to load full message")));return}const F=M.data?.content?wr(M.data.content,i):k;y({messageId:e.id,content:F,expanded:!0});return}y({messageId:e.id,content:k,expanded:!0})},[i,v,p,c,E,e.id,k,f]),L=(b||v)&&!E,T=b||v,H=c.isFetching;return t.jsxs("div",{className:"relative",children:[t.jsxs("div",{id:d,ref:m,onLoadCapture:R,className:Q("relative transition-[max-height] duration-200 ease-out",L?"overflow-hidden":""),style:L?{maxHeight:ni}:void 0,children:[t.jsx(wa,{content:k,isUser:h,workingDir:x,onOpenWorkspaceFile:w,onOpenPreviewUrl:s,onOpenVisualization:a,downloadSessionId:u}),L&&t.jsx("div",{className:Q("pointer-events-none absolute inset-x-0 bottom-0 h-16 bg-gradient-to-b from-transparent",S==="system"?"to-[color-mix(in_oklab,var(--color-warning)_8%,var(--color-background))]":S==="user"?"to-[color-mix(in_oklab,var(--color-foreground)_8%,var(--color-background))]":"to-background")})]}),T&&t.jsxs("button",{type:"button","aria-expanded":E,"aria-controls":d,"aria-label":f(E?"Collapse message":"Expand full message"),disabled:H,onClick:()=>{O()},className:Q("mt-2 inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",S==="system"?"bg-warning/10 text-warning-ink hover:bg-warning/20":S==="user"?"bg-background/70 text-foreground/70 hover:bg-background hover:text-foreground":"bg-muted text-foreground/70 hover:bg-foreground/10 hover:text-foreground",H?"cursor-wait opacity-70":""),children:[E?t.jsx(zs,{size:13}):t.jsx($e,{size:13}),t.jsx("span",{children:f(H?"Loading":E?"Collapse message":"Expand full message")})]}),o&&t.jsx("div",{className:Q("mt-1 text-xs","text-destructive-ink"),children:o})]})}function ai({senderName:e,avatar:n,createdAt:i,isUser:h,isSystem:S,children:x,headerAddon:w,bubbleClassName:s,isPending:a}){return S?t.jsx("div",{className:"flex justify-center",children:t.jsx("div",{className:"max-w-[min(100%,42rem)] rounded-lg border border-warning/25 bg-warning/10 px-3 py-2 text-xs text-warning-ink shadow-raised",children:x})}):t.jsxs("div",{className:Q("group flex items-start gap-3",h?"justify-end pl-8 sm:pl-14":"justify-start pr-8 sm:pr-14"),children:[!h&&t.jsx(He,{name:e,avatar:n??null,className:"mt-0.5 h-8 w-8 text-[11px]"}),t.jsxs("div",{className:Q("flex min-w-0 max-w-[min(86%,46rem)] flex-col",h?"items-end":"items-start"),children:[t.jsxs("div",{className:Q("mb-1.5 flex max-w-full items-center gap-1.5 px-0.5 text-xs text-muted-foreground",h?"justify-end":"justify-start"),children:[t.jsx("span",{className:"truncate font-semibold text-foreground/80",children:e}),t.jsx("span",{className:"h-1 w-1 rounded-full bg-foreground/15","aria-hidden":!0}),t.jsx(Ke,{size:11,className:"text-muted-foreground/70"}),t.jsx("span",{className:"shrink-0",children:pa(i)}),w]}),t.jsx("div",{className:Q("max-w-full rounded-lg px-3.5 py-3 text-sm leading-6 transition-colors",h?"rounded-tr-[4px] bg-foreground/[0.08] text-foreground":"rounded-tl-[4px] border border-border/70 bg-background text-foreground",s,a?"opacity-70":""),children:x})]}),h&&t.jsx(He,{name:e,avatar:null,className:"mt-0.5 h-8 w-8 text-[11px]"})]})}function Ra({provider:e}){return t.jsxs("span",{className:"ml-0.5 inline-flex max-w-[10rem] shrink items-center gap-1 rounded-full bg-foreground/5 px-1.5 py-0.5 text-xs font-medium leading-none text-muted-foreground",children:[t.jsx(qt,{agentType:e.agentType,className:"size-2.5"}),t.jsx("span",{className:"truncate",children:e.name})]})}function Aa({message:e,senderName:n,senderMember:i,senderProvider:h,memberById:S,displayContent:x,onOpenImage:w,workingDir:s,onOpenWorkspaceFile:a,onOpenPreviewUrl:u,onOpenVisualization:f,previewWorkspaceId:d,previewSessionId:m}){const{t:g}=se(),y=e.senderType==="user",b=e.senderType==="system",r=oi(e)?e.pendingStatus:null,o=e.mentions??[],l=e.workRequestIds?.length??0,c=e.visibility==="PRIVATE",p=A.useCallback(v=>{u?.(v,d)},[u,d]),_=A.useCallback(v=>{m&&f?.(m,v,d)},[f,m,d]),C=c?xa(e,S):[],k=t.jsxs(t.Fragment,{children:[!y&&!b&&h&&t.jsx(Ra,{provider:h}),c&&t.jsxs("span",{className:"ml-0.5 inline-flex max-w-[18rem] shrink items-center gap-1 rounded-full bg-foreground/[0.06] px-1.5 py-0.5 text-xs font-medium leading-none text-foreground/70",title:C.join(", "),children:[t.jsx(cn,{size:10}),t.jsxs("span",{className:"truncate",children:[g("Private"),C.length>0?`: ${C.join(", ")}`:""]})]}),!b&&l>0&&o.length===0&&t.jsxs("span",{className:"ml-0.5 shrink-0 rounded-full bg-foreground/[0.08] px-1.5 py-0.5 text-xs font-medium leading-none text-foreground/70",children:[g("Work requests"),": ",l]}),r==="sending"&&t.jsx("span",{className:"ml-0.5 shrink-0 rounded-full bg-foreground/[0.08] px-1.5 py-0.5 text-xs font-medium leading-none text-muted-foreground",children:g("发送中...")}),r==="failed"&&t.jsx("span",{className:"ml-0.5 shrink-0 rounded-full bg-destructive/10 px-1.5 py-0.5 text-xs font-medium leading-none text-destructive-ink",children:g("发送失败")})]});return t.jsx(ai,{senderName:n,avatar:i?.avatar??null,createdAt:e.createdAt,isUser:y,isSystem:b,headerAddon:k,bubbleClassName:y&&r==="failed"?"border border-destructive/25 bg-destructive/10 text-destructive-ink":void 0,isPending:r==="sending",children:t.jsx(ka,{message:e,content:x,attachmentIds:e.attachmentIds,isUser:y&&r!=="failed",tone:b?"system":void 0,onOpenImage:w,workingDir:s,onOpenWorkspaceFile:a,onOpenPreviewUrl:u?p:void 0,onOpenVisualization:f&&m?_:void 0,downloadSessionId:m})})}function La({request:e,member:n,onApprove:i,onReject:h,isActionPending:S,isApprovePending:x,isRejectPending:w}){const{t:s}=se();return t.jsx(ai,{senderName:n?.name??s("Agent"),avatar:n?.avatar??null,createdAt:e.createdAt,bubbleClassName:"border border-warning/25 bg-warning/8",children:t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[t.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-warning/25 bg-warning/10 px-2 py-0.5 text-xs font-medium text-warning-ink",children:[t.jsx(Ke,{size:11}),s("Pending approval")]}),t.jsxs("span",{className:"text-xs text-muted-foreground",children:[s("Requester"),": ",s(e.requesterType==="user"?"User":e.requesterType==="system"?"System":"Agent")]})]}),t.jsx("div",{className:"text-sm leading-6 text-foreground [overflow-wrap:anywhere]",children:e.instructionPreview??ga(e.instruction)}),t.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[t.jsxs(me,{type:"button",size:"xs",variant:"outline",disabled:S,className:"border-success/25 bg-success/10 text-success-ink hover:bg-success/15 hover:text-success-ink",onClick:i,children:[t.jsx(wt,{size:12}),t.jsx("span",{children:s(x?"Approving":"Approve")})]}),t.jsxs(me,{type:"button",size:"xs",variant:"outline",disabled:S,onClick:h,children:[t.jsx(Qe,{size:12}),t.jsx("span",{children:s(w?"Rejecting":"Reject")})]})]})]})})}function qu({teamRun:e,messages:n,readOnly:i,readOnlyMessage:h,onSendMessage:S,onViewInvocationSession:x,changeSummaryBar:w,compactComposer:s,centered:a,workingDir:u,onOpenWorkspaceFile:f,onOpenPreviewUrl:d,onOpenVisualization:m}){const{t:g}=se(),y=Ps(e.id),b=Ms(e.id),r=Ds(e.id),[o,l]=A.useState(""),[c,p]=A.useState(!1),[_,C]=A.useState(null),[k,v]=A.useState(0),[E,R]=A.useState([]),[O,L]=A.useState(!1),[T,H]=A.useState(null),[M,F]=A.useState([]),[U,N]=A.useState(null),D=A.useRef(null),P=A.useRef(null),{files:B,addFiles:q,removeFile:K,clear:$,restoreFiles:W,buildMarkdownLinks:z,getDoneAttachments:j,isUploading:I}=An(),X=B.some(V=>V.status==="done"&&V.attachment),[Y,Z]=A.useState(null),{scrollRef:G,contentRef:te,isAtBottom:ae,scrollToBottom:J}=Bn({resize:"smooth",initial:"instant"}),ne=A.useRef(!1),re=A.useRef(null);A.useEffect(()=>{const V=G.current;if(!V)return;const ee=ie=>{if(ie.deltaY<0){ne.current=!0;return}ie.deltaY>0&&V.scrollHeight-V.scrollTop-V.clientHeight<=70&&(ne.current=!1)};return V.addEventListener("wheel",ee,{passive:!0}),()=>V.removeEventListener("wheel",ee)},[G]);const{data:we}=Pr(),mt=A.useMemo(()=>{const V=new Map;for(const ee of we??[])V.set(ee.provider.id,ee.provider);return V},[we]),Ae=A.useMemo(()=>new Map((e.members??[]).map(V=>[V.id,V])),[e.members]),Pe=A.useMemo(()=>(e.members??[]).filter(Zr),[e.members]),et=A.useMemo(()=>new Map((e.invocations??[]).map(V=>[V.id,V])),[e.invocations]),be=A.useMemo(()=>{const V=new Set(n.map(ie=>ie.id)),ee=M.filter(ie=>!V.has(ie.id));return[...n,...ee].sort((ie,fe)=>{const Se=Date.parse(ie.createdAt??""),De=Date.parse(fe.createdAt??"");return(Number.isNaN(Se)?0:Se)-(Number.isNaN(De)?0:De)})},[n,M]),tt=A.useMemo(()=>new Map((e.workRequests??[]).map(V=>[V.id,V])),[e.workRequests]),xe=A.useMemo(()=>ia(be,e.workRequests??[],e.invocations??[]),[be,e.invocations,e.workRequests]);A.useEffect(()=>{const V=xe.at(-1)?.key??null,ee=re.current;re.current=V,!(ee==null||V==null||V===ee||ne.current)&&requestAnimationFrame(()=>{J({animation:"smooth",ignoreEscapes:!0})})},[J,xe]);const rt=A.useMemo(()=>(e.invocations??[]).filter(V=>Yt.has(V.status)),[e.invocations]),Me=A.useMemo(()=>E.map(V=>Ae.get(V)).filter(V=>!!V).filter(Zr),[Ae,E]),ve=A.useMemo(()=>{const V=_?.query??"";return Pe.filter(ee=>_a(ee,V)).sort((ee,ie)=>{const fe=E.includes(ee.id),Se=E.includes(ie.id);return fe!==Se?fe?1:-1:ee.name.localeCompare(ie.name)})},[Pe,_?.query,E]),st=!i&&(c||!!_)&&ve.length>0,Ce=A.useCallback((V,ee)=>{if(ee==null){C(null);return}C(va(V,ee)),v(0)},[]),We=A.useCallback(V=>{R(De=>ta(De,V.id));const ee=`@${V.name} `;if(_){const De=`${o.slice(0,_.start)}${ee}${o.slice(_.end)}`,it=_.start+ee.length;l(De),C(null),p(!1),requestAnimationFrame(()=>{D.current?.focus(),D.current?.setSelectionRange(it,it)});return}const ie=o.length===0||/\s$/.test(o)?"":" ",fe=`${o}${ie}${ee}`,Se=fe.length;l(fe),p(!1),requestAnimationFrame(()=>{D.current?.focus(),D.current?.setSelectionRange(Se,Se)})},[o,_]),le=A.useCallback(V=>{R(ee=>ra(ee,V))},[]),Jt=A.useCallback(V=>{const ee=V.target.value;l(ee),H(null);const ie=V.target;ie.style.height="auto",ie.style.height=`${Math.max(s?40:72,Math.min(ie.scrollHeight,s?140:240))}px`,p(!1),Ce(ee,ie.selectionStart)},[s,Ce]),Gi=A.useCallback(V=>{const ee=V.target.files;ee&&ee.length>0&&(q(Array.from(ee)),H(null)),V.target.value=""},[q]),Zi=A.useCallback(V=>{const ee=[];for(const ie of V.clipboardData.items)if(ie.kind==="file"){const fe=ie.getAsFile();fe&&ee.push(fe)}ee.length>0&&(V.preventDefault(),q(ee),H(null))},[q]),er=A.useCallback(async()=>{if(i||O||I)return;const V=z(),ee=j().map(Ne=>Ne.id),ie=sa(E,Pe),fe=ja({draft:o,attachmentMarkdown:V,attachmentIds:ee,mentions:ie});if(!fe||!o.trim()&&!X)return;const Se=ua(e.id,fe),De=o,it=E,tr=B;F(Ne=>[...Ne,Se]),l(""),R([]),p(!1),C(null),$(),D.current&&(D.current.style.height=s?"40px":"72px"),requestAnimationFrame(()=>J()),L(!0),H(null);try{const Ne=await S(fe);F(ke=>ke.filter(Ee=>Ee.id!==Se.id)),Ne&&typeof Ne=="object"&&"id"in Ne&&requestAnimationFrame(()=>J())}catch(Ne){const ke=Ne instanceof Error?Ne.message:"Failed to send room message";F(Ee=>Ee.map(pt=>pt.id===Se.id?{...pt,pendingStatus:"failed",error:ke}:pt)),l(Ee=>Ee.length===0?De:Ee),R(Ee=>Ee.length===0?it:Ee),W(tr),H(ke),requestAnimationFrame(()=>J())}finally{L(!1)}},[Pe,B,z,$,s,o,j,X,O,I,S,i,W,J,E,e.id]),Qi=A.useCallback(V=>{const ee=V.nativeEvent.isComposing||V.nativeEvent.keyCode===229;if(st){if(V.key==="ArrowDown"){V.preventDefault(),v(ie=>(ie+1)%ve.length);return}if(V.key==="ArrowUp"){V.preventDefault(),v(ie=>(ie-1+ve.length)%ve.length);return}if(V.key==="Enter"&&!ee||V.key==="Tab"){V.preventDefault();const ie=ve[k]??ve[0];ie&&We(ie);return}if(V.key==="Escape"){V.preventDefault(),C(null),p(!1);return}}V.key==="Enter"&&!V.shiftKey&&!V.repeat&&!ee&&(V.preventDefault(),er())},[We,er,k,ve,st]);A.useEffect(()=>{l(""),R([]),p(!1),C(null),H(null),F([]),$(),ne.current=!1,re.current=null,N(null),D.current&&(D.current.style.height=s?"40px":"72px")},[$,s,e.id]);const Ur=y.isError?y.error:b.isError?b.error:null,Ji=y.isPending||b.isPending,en=A.useCallback((V,ee)=>{r.mutate({memberId:V,cancelQueued:ee},{onSuccess:()=>N(null)})},[r]);return t.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-background",children:[Y&&t.jsx(Ea,{images:Y.images,index:Y.index,onClose:()=>Z(null),onSelect:V=>Z(ee=>ee&&{...ee,index:V})}),t.jsxs("div",{className:"relative flex-1 min-h-0",children:[t.jsx("div",{ref:G,className:Q("h-full overflow-y-auto scrollbar-app-thin bg-background",s?"px-3 py-3":"px-4 py-4"),children:t.jsxs("div",{ref:te,className:Q(s?"space-y-2.5":"space-y-3",a&&"max-w-4xl mx-auto"),children:[xe.length===0?t.jsxs("div",{className:"flex min-h-[180px] flex-col items-center justify-center gap-2 rounded-lg border border-dashed border-border bg-background text-muted-foreground",children:[t.jsx(ht,{size:24,className:"text-muted-foreground/70"}),t.jsx("span",{className:"text-sm",children:g("No room messages yet")})]}):xe.map(V=>{if(V.kind==="pendingApproval"){const ke=V.request,Ee=Ae.get(ke.targetMemberId),pt=y.isPending&&y.variables===ke.id,tn=b.isPending&&b.variables===ke.id;return t.jsx(La,{request:ke,member:Ee,onApprove:()=>y.mutate(ke.id),onReject:()=>b.mutate(ke.id),isActionPending:Ji,isApprovePending:pt,isRejectPending:tn},V.key)}const ee=V.message,ie=ya(ee,Ae,et),fe=ee.senderType==="user"?g("你"):ee.senderType==="system"?g("System"):ie?.name??g("Agent"),Se=Sa(ee,Ae),De=ie?.providerId?mt.get(ie.providerId)??null:null,it=ee.senderInvocationId?et.get(ee.senderInvocationId):void 0,tr=it?.workspaceId??void 0,Ne=it?.sessionId??void 0;return t.jsx(Aa,{message:ee,senderName:fe,senderMember:ie,senderProvider:De,memberById:Ae,displayContent:Se,onOpenImage:(ke,Ee)=>Z({images:ke,index:Ee}),workingDir:u,onOpenWorkspaceFile:f,onOpenPreviewUrl:d,onOpenVisualization:m,previewWorkspaceId:tr,previewSessionId:Ne},V.key)}),Ur&&t.jsx("div",{className:"rounded-md border border-destructive/25 bg-destructive/10 px-3 py-2 text-xs text-destructive-ink",children:Cr(Ur,g("Failed to update work request"))}),r.isError&&t.jsx("div",{className:"rounded-md border border-destructive/25 bg-destructive/10 px-3 py-2 text-xs text-destructive-ink",children:Cr(r.error,g("Failed to stop member work"))})]})}),!ae&&t.jsxs("button",{type:"button",onClick:()=>J(),className:"absolute bottom-3 left-1/2 z-10 flex -translate-x-1/2 items-center gap-1.5 rounded-full border border-border bg-background/90 px-3 py-1.5 text-xs text-foreground/70 shadow-raised backdrop-blur-sm hover:bg-background hover:text-foreground transition-colors",children:[t.jsx(an,{size:14}),t.jsx("span",{children:g("Back to bottom")})]})]}),t.jsx("div",{className:Q("shrink-0 border-t border-transparent bg-background",s?"px-3 pb-2 pt-1.5":"px-6 pb-6 pt-2"),children:t.jsxs("div",{className:Q(a&&"max-w-4xl mx-auto"),children:[t.jsx(da,{invocations:rt,memberById:Ae,workRequestById:tt,onViewInvocationSession:x,onStopMember:en,isStopPending:r.isPending,stoppingMemberId:r.variables?.memberId??null,stopPromptInvocationId:U,onToggleStopConfirm:V=>N(ee=>ee===V?null:V)}),!i&&w,i?t.jsx("div",{className:"rounded-xl border border-border bg-muted/50 px-4 py-3 text-sm text-muted-foreground",children:h??g("This project is read-only")}):t.jsxs("div",{className:"relative rounded-xl border border-border bg-background shadow-raised transition-all duration-200 hover:shadow-raised focus-within:border-ring focus-within:shadow-raised",children:[st&&t.jsxs("div",{className:"absolute bottom-full left-3 z-20 mb-2 w-[min(24rem,calc(100vw-3rem))] overflow-hidden rounded-xl border border-border bg-background shadow-popover",children:[t.jsx("div",{className:"border-b border-border/60 px-3 py-2 text-xs font-medium text-muted-foreground",children:g(_?"Mention members":"Team members")}),t.jsx("div",{className:"max-h-64 overflow-y-auto p-1",children:ve.map((V,ee)=>{const ie=E.includes(V.id),fe=ee===k;return t.jsxs("button",{type:"button",onMouseEnter:()=>v(ee),onMouseDown:Se=>{Se.preventDefault(),We(V)},className:Q("flex w-full items-center gap-2 rounded-lg px-2 py-2 text-left transition-colors",fe?"bg-muted":"hover:bg-accent"),children:[t.jsx(He,{name:V.name,avatar:V.avatar,className:"h-8 w-8 text-[11px]"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:V.name}),ie&&t.jsx("span",{className:"rounded-full bg-primary px-1.5 py-0.5 text-xs font-medium text-primary-foreground",children:g("selected")})]}),t.jsx("div",{className:"truncate text-xs text-muted-foreground",children:[V.providerId,V.id.slice(0,8)].filter(Boolean).join(" · ")})]}),t.jsx(Kr,{size:15,className:"text-muted-foreground/70"})]},V.id)})})]}),Me.length>0&&t.jsx("div",{className:"flex flex-wrap items-center gap-1.5 border-b border-border/60 px-3 py-2",children:Me.map(V=>t.jsxs("span",{className:"inline-flex max-w-full items-center gap-1.5 rounded-full border border-border bg-muted/50 px-2 py-1 text-xs text-foreground/80",children:[t.jsxs("span",{className:"truncate font-medium",children:["@",V.name]}),t.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:V.id.slice(0,8)}),t.jsx("button",{type:"button",onClick:()=>le(V.id),className:"shrink-0 rounded-full p-0.5 text-muted-foreground transition-colors hover:bg-foreground/10 hover:text-foreground/80",title:g("Remove mention"),"aria-label":`${g("Remove mention")} ${V.name}`,children:t.jsx(Qe,{size:12})})]},V.id))}),t.jsx(Ln,{files:B,onRemove:K}),t.jsx("textarea",{ref:D,value:o,rows:s?1:void 0,onChange:Jt,onKeyDown:Qi,onPaste:Zi,onClick:V=>Ce(o,V.currentTarget.selectionStart),onSelect:V=>Ce(o,V.currentTarget.selectionStart),placeholder:g("Message the team room..."),className:Q("w-full resize-none border-none bg-transparent text-foreground placeholder:text-muted-foreground/70 focus:outline-none",s?"px-3 pb-1 pt-2.5 text-[15px] leading-5":"px-4 pb-2 pt-4 text-sm leading-relaxed"),style:s?{minHeight:40,maxHeight:140}:{minHeight:60,maxHeight:220}}),t.jsxs("div",{className:Q("flex items-center justify-between",s?"px-2 pb-1.5 pt-0.5":"px-2 pb-2 pt-1"),children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{ref:P,type:"file",multiple:!0,className:"hidden",onChange:Gi}),t.jsx("button",{type:"button",onClick:()=>P.current?.click(),title:g("Upload file"),"aria-label":g("Upload file"),className:"rounded-lg p-2 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground/70",children:t.jsx(Mn,{size:18})}),t.jsx("button",{type:"button",onClick:()=>{p(V=>!V),C(null),requestAnimationFrame(()=>D.current?.focus())},disabled:Me.length===0&&Pe.length===0,title:g("Mention members"),"aria-label":g("Mention members"),className:Q("rounded-lg transition-colors",s?"p-1.5":"p-2",c?"bg-muted text-foreground/80":"text-muted-foreground hover:bg-accent hover:text-foreground/70",Me.length===0&&Pe.length===0?"cursor-not-allowed opacity-50":""),children:t.jsx(Kr,{size:s?15:18})}),Me.length>0&&t.jsxs("span",{className:"text-xs text-muted-foreground",children:[Me.length," ",g("selected")]})]}),t.jsx("button",{type:"button",onClick:()=>{er()},disabled:i||O||I||!o.trim()&&!X,title:g(I?"Uploading...":O?"发送中...":"发送"),"aria-label":g(I?"Uploading...":O?"发送中...":"发送"),className:Q("rounded-lg transition-all duration-200",s?"p-1.5":"p-2",(o.trim()||X)&&!i&&!O&&!I?"bg-primary text-primary-foreground shadow-raised hover:bg-primary":"cursor-not-allowed bg-transparent text-muted-foreground",O||I?"opacity-70":""),children:t.jsx(ln,{size:s?15:18})})]}),T&&t.jsx("div",{className:"border-t border-border/60 px-3 py-2 text-xs text-destructive-ink",children:T})]})]})})]})}function Ta(e){return e?e.slice(0,8):""}function Qr(e){const n=e?Date.parse(e):0;return Number.isNaN(n)?0:n}function Or(e){return e?.workspaceKind===ze.MAIN_DIRECTORY}function Ct(e){return e?Or(e)?"Project directory":e.branchName:"—"}function Ku(e){return e?.workingDir||e?.worktreePath||void 0}function Ir(e,n){if(!e?.length)return[];const i=new Map((n?.members??[]).map(x=>[x.id,x])),h=new Map(e.map(x=>[x.id,x])),S=n?.mainWorkspaceId??null;return e.map(x=>{const w=x.parentWorkspaceId?h.get(x.parentWorkspaceId):void 0,s=x.ownerMemberId?i.get(x.ownerMemberId):void 0,a=!!(S&&x.id===S),u=a?"main":x.parentWorkspaceId?"child":"root",f=s?.name??(x.ownerMemberId?`Member ${Ta(x.ownerMemberId)}`:void 0),d=Or(x)?"Project directory":a?"Main workspace":u==="child"?f?`${f} workspace`:"Child workspace":n?"Root workspace":"Workspace";return{workspace:x,kind:u,roleLabel:a?"Main":u==="child"?"Child":"Root",displayName:d,ownerName:f,parentBranchName:w?Ct(w):void 0,isMain:a}}).sort((x,w)=>{const s=u=>u.kind==="main"?0:u.kind==="child"?1:2,a=s(x)-s(w);return a!==0?a:Qr(x.workspace.createdAt)-Qr(w.workspace.createdAt)})}function Xu(e,n,i){if(e?.length)return i&&e.some(h=>h.id===i)?i:n?.mainWorkspaceId&&e.some(h=>h.id===n.mainWorkspaceId)?n.mainWorkspaceId:e.find(h=>h.status===Ie.ACTIVE)?.id??e[0]?.id}function Yu(e,n){return!e||e.status!==Ie.ACTIVE||Or(e)?!1:!n||e.parentWorkspaceId?!0:!!(n.mainWorkspaceId&&e.id===n.mainWorkspaceId)}function Vu(e,n,i){return e?.parentWorkspaceId?n?.find(S=>S.id===e.parentWorkspaceId)?.branchName??e.baseBranch??i:e?.baseBranch||i}const Fr={readRoom:!1,postRoomMessage:!1,mentionMembers:!1,stopMemberWork:!1,markReadyForReview:!1,readFiles:!1,writeFiles:!1,runCommands:!1,readDiff:!1,mergeWorkspace:!1},Pa=[{key:"readRoom",label:"读房间"},{key:"postRoomMessage",label:"发房间消息"},{key:"mentionMembers",label:"提及成员"},{key:"stopMemberWork",label:"停止成员工作"},{key:"markReadyForReview",label:"标记可审查"},{key:"readFiles",label:"读文件"},{key:"writeFiles",label:"写文件"},{key:"runCommands",label:"运行命令"},{key:"readDiff",label:"读 diff"},{key:"mergeWorkspace",label:"合并工作区"}],li=[{value:"none",label:"无"},{value:"shared",label:"共享"},{value:"dedicated",label:"独占"}],Ma=[{value:"MENTION_ONLY",label:"仅提及"},{value:"USER_MESSAGES",label:"所有用户消息"}],ci=[{value:"new_per_request",label:"每次新会话"},{value:"resume_last",label:"复用上次会话"}],Da=[{value:"own_only",label:"仅自己队列"},{value:"team_pending",label:"全队列待处理"}];function gt(){return{name:"",aliasesText:"",providerId:"",rolePrompt:"",capabilities:{...Fr},workspacePolicy:"none",triggerPolicy:"MENTION_ONLY",sessionPolicy:"new_per_request",queueManagementPolicy:"own_only",avatar:""}}function at(e){return{name:e.name,aliasesText:(e.aliases??[]).join(", "),providerId:e.providerId,rolePrompt:e.rolePrompt,capabilities:{...Fr,...e.capabilities},workspacePolicy:e.workspacePolicy,triggerPolicy:e.triggerPolicy,sessionPolicy:e.sessionPolicy,queueManagementPolicy:e.queueManagementPolicy,avatar:e.avatar??""}}function rr(e){return{name:e.name,aliasesText:(e.aliases??[]).join(", "),providerId:e.providerId,rolePrompt:e.rolePrompt,capabilities:{...Fr,...e.capabilities},workspacePolicy:e.workspacePolicy,triggerPolicy:e.triggerPolicy,sessionPolicy:e.sessionPolicy,queueManagementPolicy:e.queueManagementPolicy,avatar:e.avatar??""}}function Ba(e){return Array.from(new Set(e.split(/[\n,]/).map(n=>n.trim()).filter(Boolean)))}function Oa(e){return{name:e.name.trim(),aliases:Ba(e.aliasesText),providerId:e.providerId.trim(),rolePrompt:e.rolePrompt.trim(),capabilities:{...e.capabilities},workspacePolicy:e.workspacePolicy,triggerPolicy:e.triggerPolicy,sessionPolicy:e.sessionPolicy,queueManagementPolicy:e.queueManagementPolicy,avatar:e.avatar.trim()||null}}function Jr(e,n){return e instanceof Error?e.message:n}function es(e){return e.membershipStatus!=="REMOVED"}function kr(e){return e.status==="RUNNING"||e.status==="WAITING_ROOM_REPLY"||e.status==="SESSION_ENDED"||e.status==="QUEUED"}function ts(e){return kr(e)?"bg-success":e.status==="FAILED"?"bg-destructive":"bg-foreground/15"}function rs(e){return li.find(n=>n.value===e)?.label??e}function Ia(e){return ci.find(n=>n.value===e)?.label??e}function Be({children:e}){return t.jsx("span",{className:"text-xs font-medium text-foreground/70",children:e})}function ss({icon:e,title:n,description:i,action:h}){return t.jsxs("div",{className:"flex min-h-[18rem] flex-col items-center justify-center rounded-lg border border-dashed border-border bg-background px-6 py-8 text-center",children:[t.jsx("div",{className:"mb-3 flex h-10 w-10 items-center justify-center rounded-full bg-muted text-muted-foreground",children:e}),t.jsx("div",{className:"text-sm font-medium text-foreground",children:n}),i?t.jsx("div",{className:"mt-1 max-w-sm text-xs leading-relaxed text-muted-foreground",children:i}):null,h?t.jsx("div",{className:"mt-4",children:h}):null]})}function Fa({isOpen:e,onClose:n,teamRun:i}){const{t:h}=se(),{data:S=[]}=hn(),{data:x=[]}=Pr(),w=un(i.id),s=fn(i.id),a=mn(i.id),u=A.useRef(!1),[f,d]=A.useState("edit"),[m,g]=A.useState(null),[y,b]=A.useState(""),[r,o]=A.useState(gt()),[l,c]=A.useState(null),[p,_]=A.useState(null),C=i.members??[],k=A.useMemo(()=>C.filter(es),[C]),v=A.useMemo(()=>p&&es(p)&&!k.some(z=>z.id===p.id)?[...k,p]:k,[p,k]),E=m?k.find(z=>z.id===m)??null:null,R=p?.id===m?p:E,O=y?S.find(z=>z.id===y)??null:null,L=w.isPending||s.isPending||a.isPending,T=v.filter(kr).length,H=A.useMemo(()=>{const z=x.map(({provider:j,availability:I})=>({value:j.id,label:j.name+(I.type==="NOT_FOUND"?h(" (不可用)"):""),icon:t.jsx(qt,{agentType:j.agentType,className:"size-4"}),disabled:I.type==="NOT_FOUND"}));return r.providerId&&!z.some(j=>j.value===r.providerId)&&z.unshift({value:r.providerId,label:`${r.providerId}${h(" (不可用)")}`,disabled:!0}),z},[r.providerId,x,h]);A.useEffect(()=>{if(!e){u.current=!1,_(null);return}if(u.current)return;u.current=!0;const z=v[0]??null;d(z?"edit":"add-preset"),g(z?.id??null),b(""),o(z?at(z):gt()),c(null)},[v,e]),A.useEffect(()=>{p&&k.some(z=>z.id===p.id)&&_(null)},[p,k]),A.useEffect(()=>{f==="add-preset"&&O&&o(rr(O))},[f,O]);const M=(z,j)=>{o(I=>({...I,[z]:j}))},F=(z,j)=>{o(I=>({...I,capabilities:{...I.capabilities,[z]:j}}))},U=z=>{d("edit"),g(z.id),b(""),o(at(z))},N=()=>{d("add-preset"),g(null);const z=O??S[0]??null;b(z?.id??""),o(z?rr(z):gt())},D=()=>{d("add-custom"),g(null),b(""),o(gt())},P=!!(r.name.trim()&&r.providerId.trim()&&r.rolePrompt.trim()),B=f==="add-preset"?!!y:f==="edit"?!!(R&&P):P,q=async()=>{try{if(f==="add-preset"){if(!y)return;const j=await w.mutateAsync({memberPresetId:y});ye.success(h("Member added")),_(j),d("edit"),g(j.id),b(""),o(at(j));return}const z=Oa(r);if(!z.name||!z.providerId||!z.rolePrompt){ye.error(h("Name, provider, and role prompt are required"));return}if(f==="add-custom"){const j=await w.mutateAsync({member:z});ye.success(h("Member added")),_(j),d("edit"),g(j.id),o(at(j));return}if(R){const j=await s.mutateAsync({memberId:R.id,data:z});ye.success(h("Member updated")),_(I=>I?.id===j.id?j:I),g(j.id),o(at(j))}}catch(z){ye.error(Jr(z,h("Failed to save member")))}},K=async()=>{if(l)try{if(await a.mutateAsync({memberId:l.id,stopActive:!0,cancelQueued:!0}),m===l.id){const z=v.find(j=>j.id!==l.id)??null;g(z?.id??null),d(z?"edit":"add-preset"),o(z?at(z):gt())}_(z=>z?.id===l.id?null:z),c(null),ye.success(h("Member removed"))}catch(z){ye.error(Jr(z,h("Failed to remove member")))}},$=()=>t.jsxs("div",{className:"flex min-h-0 flex-col lg:flex-1",children:[t.jsx("div",{className:"border-b border-border/60 px-5 py-4",children:t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[t.jsx(Pt,{size:15,className:"text-muted-foreground"}),t.jsx("span",{children:h("Add member from preset")})]}),t.jsx("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:h("Choose a saved preset to add a ready-to-run member snapshot.")})]}),t.jsxs(me,{type:"button",variant:"outline",size:"sm",onClick:D,disabled:L,children:[t.jsx(Yr,{size:13}),h("Custom member")]})]})}),t.jsx("div",{className:"p-5 lg:min-h-0 lg:flex-1 lg:overflow-y-auto",children:S.length===0?t.jsx(ss,{icon:t.jsx(Pt,{size:18}),title:h("No member presets"),description:h("Create a custom member for this TeamRun, or add presets from Team Collaboration Settings."),action:t.jsxs(me,{type:"button",variant:"outline",size:"sm",onClick:D,disabled:L,children:[t.jsx(_t,{size:13}),h("Custom member")]})}):t.jsx("div",{className:"grid grid-cols-1 gap-2 xl:grid-cols-2",children:S.map(z=>{const j=y===z.id;return t.jsxs("button",{type:"button",onClick:()=>{b(z.id),o(rr(z))},className:Q("flex min-h-[4.25rem] items-center gap-3 rounded-lg border px-3 py-2.5 text-left transition-colors",j?"border-foreground bg-muted/50 shadow-raised":"border-border bg-background hover:border-foreground/20 hover:bg-accent"),children:[t.jsx(He,{name:z.name,avatar:z.avatar,className:"h-8 w-8 text-[11px]"}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block truncate text-sm font-medium text-foreground",children:z.name}),t.jsx("span",{className:"mt-0.5 block truncate text-xs text-muted-foreground",children:z.providerId}),t.jsxs("span",{className:"mt-1 block truncate text-xs text-muted-foreground",children:[h(rs(z.workspacePolicy))," · ",h(Ia(z.sessionPolicy))]})]}),j?t.jsx(wt,{size:16,className:"shrink-0 text-foreground"}):null]},z.id)})})})]}),W=()=>{const z=f==="edit";return z&&!R?t.jsx("div",{className:"p-5",children:t.jsx(ss,{icon:t.jsx(ht,{size:18}),title:h("Select a member"),description:h("Choose a member on the left to edit its future TeamRun configuration."),action:t.jsxs(me,{type:"button",variant:"outline",size:"sm",onClick:N,disabled:L,children:[t.jsx(_t,{size:13}),h("Add member")]})})}):t.jsxs("div",{className:"flex min-h-0 flex-col lg:flex-1",children:[t.jsx("div",{className:"border-b border-border/60 px-5 py-4",children:t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[z?t.jsx(ii,{size:15,className:"text-muted-foreground"}):t.jsx(_t,{size:15,className:"text-muted-foreground"}),t.jsx("span",{children:h(z?"Edit member":"Custom member")})]}),t.jsx("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:h(z?"Provider, role, workspace, and session changes apply to future work only.":"Create a one-off member snapshot for this TeamRun.")})]}),z&&R?t.jsxs(me,{type:"button",variant:"outline",size:"sm",onClick:()=>c(R),disabled:L,className:"border-destructive/25 text-destructive-ink hover:bg-destructive/10 hover:text-destructive-ink",children:[t.jsx(Hn,{size:13}),h("Remove")]}):t.jsxs(me,{type:"button",variant:"outline",size:"sm",onClick:N,disabled:L,children:[t.jsx(Pt,{size:13}),h("Use preset")]})]})}),t.jsxs("div",{className:"p-5 lg:min-h-0 lg:flex-1 lg:overflow-y-auto",children:[z&&R?t.jsxs("div",{className:"mb-4 flex items-center gap-3 rounded-lg border border-border bg-muted/50 px-3 py-2.5",children:[t.jsx(He,{name:R.name,avatar:R.avatar,className:"h-9 w-9 text-xs"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:Q("h-2 w-2 shrink-0 rounded-full",ts(R))}),t.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:R.name})]}),t.jsxs("div",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:[R.providerId," · ",h(rs(R.workspacePolicy))]})]})]}):null,t.jsxs("div",{className:"space-y-5",children:[t.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[t.jsxs("label",{className:"space-y-1.5",children:[t.jsx(Be,{children:h("Name")}),t.jsx("input",{value:r.name,onChange:j=>M("name",j.target.value),className:"h-9 w-full rounded-lg border border-border px-3 text-sm outline-none transition-colors focus:border-ring"})]}),t.jsxs("label",{className:"space-y-1.5",children:[t.jsx(Be,{children:h("Aliases")}),t.jsx("input",{value:r.aliasesText,onChange:j=>M("aliasesText",j.target.value),placeholder:h("Comma separated"),className:"h-9 w-full rounded-lg border border-border px-3 text-sm outline-none transition-colors focus:border-ring"})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Be,{children:h("Provider")}),t.jsx(Ue,{value:r.providerId,onChange:j=>M("providerId",j),options:H})]}),t.jsxs("label",{className:"space-y-1.5",children:[t.jsx(Be,{children:h("Avatar")}),t.jsx("input",{value:r.avatar,onChange:j=>M("avatar",j.target.value),className:"h-9 w-full rounded-lg border border-border px-3 text-sm outline-none transition-colors focus:border-ring"})]})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[t.jsxs("label",{className:"space-y-1.5",children:[t.jsx(Be,{children:h("Workspace policy")}),t.jsx(Ue,{value:r.workspacePolicy,onChange:j=>M("workspacePolicy",j),options:li.map(j=>({value:j.value,label:h(j.label)}))})]}),t.jsxs("label",{className:"space-y-1.5",children:[t.jsx(Be,{children:h("Trigger policy")}),t.jsx(Ue,{value:r.triggerPolicy,onChange:j=>M("triggerPolicy",j),options:Ma.map(j=>({value:j.value,label:h(j.label)}))})]}),t.jsxs("label",{className:"space-y-1.5",children:[t.jsx(Be,{children:h("Session policy")}),t.jsx(Ue,{value:r.sessionPolicy,onChange:j=>M("sessionPolicy",j),options:ci.map(j=>({value:j.value,label:h(j.label)}))})]}),t.jsxs("label",{className:"space-y-1.5",children:[t.jsx(Be,{children:h("Queue policy")}),t.jsx(Ue,{value:r.queueManagementPolicy,onChange:j=>M("queueManagementPolicy",j),options:Da.map(j=>({value:j.value,label:h(j.label)}))})]})]}),t.jsxs("label",{className:"space-y-1.5",children:[t.jsx(Be,{children:h("Role prompt")}),t.jsx("textarea",{value:r.rolePrompt,onChange:j=>M("rolePrompt",j.target.value),rows:7,className:"w-full resize-y rounded-lg border border-border px-3 py-2 text-sm leading-relaxed outline-none transition-colors focus:border-ring"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Be,{children:h("Capabilities")}),t.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3",children:Pa.map(j=>t.jsxs("label",{className:"flex min-h-9 items-center gap-2 rounded-md border border-border bg-background px-2.5 py-2 text-xs text-foreground/80",children:[t.jsx("input",{type:"checkbox",checked:!!r.capabilities[j.key],onChange:I=>F(j.key,I.target.checked)}),t.jsx("span",{className:"min-w-0 truncate",children:h(j.label)})]},j.key))})]})]})]})]})};return t.jsxs(t.Fragment,{children:[t.jsx(jt,{isOpen:e,onClose:L?()=>{}:n,title:h("Manage Team Members"),className:"max-w-6xl",action:t.jsxs(t.Fragment,{children:[t.jsx(me,{type:"button",variant:"outline",onClick:n,disabled:L,children:h("Close")}),t.jsx(me,{type:"button",onClick:q,disabled:L||!B,children:h(L?"Processing...":f==="edit"?"Save member":"Add member")})]}),children:t.jsxs("div",{className:"grid min-h-0 grid-cols-1 overflow-visible rounded-lg border border-border bg-background lg:h-[min(42rem,calc(100vh-13rem))] lg:min-h-[34rem] lg:grid-cols-[20rem_minmax(0,1fr)] lg:overflow-hidden",children:[t.jsxs("aside",{className:"flex min-h-0 flex-col border-b border-border bg-muted/35 lg:border-b-0 lg:border-r",children:[t.jsx("div",{className:"border-b border-border px-4 py-4",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[t.jsx(ht,{size:15,className:"text-muted-foreground"}),t.jsx("span",{children:h("Members")})]}),t.jsxs("div",{className:"mt-1 text-xs text-muted-foreground",children:[v.length," ",h("active")," · ",T," ",h("working")]})]}),t.jsx(me,{type:"button",size:"icon-sm",variant:"outline",onClick:N,disabled:L,title:h("Add member"),children:t.jsx(_t,{size:14})})]})}),t.jsx("div",{className:"max-h-64 overflow-y-auto p-2 lg:min-h-0 lg:max-h-none lg:flex-1",children:v.length===0?t.jsx("div",{className:"rounded-lg border border-dashed border-border bg-background px-3 py-5 text-center text-xs text-muted-foreground",children:h("No active members")}):t.jsx("div",{className:"space-y-1",children:v.map(z=>{const j=f==="edit"&&m===z.id;return t.jsxs("button",{type:"button",onClick:()=>U(z),className:Q("group flex w-full items-center gap-2 rounded-lg border px-2.5 py-2 text-left transition-colors",j?"border-border bg-background shadow-raised":"border-transparent hover:border-border hover:bg-background"),children:[t.jsx(He,{name:z.name,avatar:z.avatar,className:"h-8 w-8 text-[11px]"}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:Q("h-1.5 w-1.5 shrink-0 rounded-full",ts(z))}),t.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:z.name})]}),t.jsx("span",{className:"mt-0.5 block truncate text-xs text-muted-foreground",children:z.providerId})]}),t.jsx(Uo,{size:13,className:Q("shrink-0 text-muted-foreground transition-opacity",j?"opacity-100":"opacity-0 group-hover:opacity-100")})]},z.id)})})}),t.jsx("div",{className:"border-t border-border p-2",children:t.jsx(In,{block:!0,"aria-label":h("Add member"),value:f,onValueChange:z=>z==="add-preset"?N():D(),options:[{value:"add-preset",label:h("Preset"),icon:t.jsx(Pt,{}),disabled:L},{value:"add-custom",label:h("Custom"),icon:t.jsx(Yr,{}),disabled:L}]})})]}),t.jsx("section",{className:"flex min-h-0 min-w-0 flex-col",children:f==="add-preset"?$():W()})]})}),t.jsx(Fn,{isOpen:!!l,onClose:()=>c(null),onConfirm:K,title:h("Remove member"),variant:"danger",isLoading:a.isPending,confirmText:h("Remove"),description:t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{children:l?h("Remove this member from future TeamRun work?"):""}),l&&kr(l)?t.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-destructive/25 bg-destructive/10 px-3 py-2 text-left text-destructive-ink",children:[t.jsx(Et,{size:15,className:"mt-0.5 shrink-0"}),t.jsx("span",{className:"text-sm font-medium",children:h("确认后会停止当前工作并取消队列")})]}):null]})})]})}const Ha=[],Wa=[],za=[],$a=240;function Ua(e){switch(e){case"RUNNING":return"running";case"WAITING":case"WAITING_ROOM_REPLY":return"waiting room reply";case"QUEUED":return"queued";case"SESSION_ENDED":return"session ended";case"PENDING_APPROVAL":return"pending approval";case"REMOVED":return"removed";default:return"idle"}}const is={running:0,"waiting room reply":1,queued:2,"session ended":3,"pending approval":4,idle:5,removed:6};function sr(e){if(!e)return"";const n=new Date(e);return Number.isNaN(n.getTime())?"":n.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function ns(e,n){return e instanceof Error?e.message:n}function qa(e,n=$a){const i=(e??"").replace(/\s+/g," ").trim();return i.length<=n?i:`${i.slice(0,n-3).trimEnd()}...`}function Mt(e){return e?e.instructionPreview??qa(e.instruction):""}function Ka(e){switch(e){case"running":return"Running";case"waiting room reply":return"Waiting room reply";case"queued":return"Queued";case"session ended":return"Session ended";case"pending approval":return"Pending approval";case"removed":return"Removed";case"idle":return"Idle"}}function Xa(e){switch(e){case"running":return"border-success/25 bg-success/10 text-success-ink";case"waiting room reply":return"border-warning/25 bg-warning/10 text-warning-ink";case"queued":case"session ended":return"border-info/25 bg-info/10 text-info-ink";case"pending approval":return"border-border bg-muted/50 text-foreground/70";case"removed":return"border-border bg-muted/50 text-muted-foreground";case"idle":return"border-border bg-background text-muted-foreground"}}function Ya(e){switch(e){case"running":return"bg-success";case"waiting room reply":return"bg-warning";case"queued":case"session ended":return"bg-info";case"pending approval":return"bg-muted-foreground/60";case"removed":return"bg-foreground/15";case"idle":return"bg-foreground/15"}}function Va(e){switch(e){case"user":return"User";case"agent":return"Agent";case"system":return"System"}}function Ga(e){switch(e){case"RUNNING":return"border-success/25 bg-success/10 text-success-ink";case"WAITING_ROOM_REPLY":return"border-warning/25 bg-warning/10 text-warning-ink";case"QUEUED":case"SESSION_ENDED":return"border-info/25 bg-info/10 text-info-ink";case"COMPLETED":return"border-border bg-muted/50 text-foreground/80";case"FAILED":return"border-destructive/25 bg-destructive/10 text-destructive-ink";case"CANCELLED":return"border-border bg-background text-muted-foreground"}}function Za(e){switch(e){case Ie.ACTIVE:return"border-success/25 bg-success/10 text-success-ink";case Ie.MERGED:return"border-info/25 bg-info/10 text-info-ink";case Ie.HIBERNATED:return"border-warning/25 bg-warning/10 text-warning-ink";case Ie.ABANDONED:return"border-border bg-muted/50 text-muted-foreground"}}function Qa(e){switch(e){case"Main":return"border-border bg-muted/50 text-foreground/80";case"Child":return"border-border bg-muted/50 text-foreground/80";default:return"border-border bg-muted/50 text-foreground/70"}}function Ja(e){return[...e].sort((n,i)=>Date.parse(i.updatedAt??i.createdAt??"")-Date.parse(n.updatedAt??n.createdAt??""))}function el(e,n){return n.find(i=>i.memberId===e.id&&Yt.has(i.status))}function Gu({teamRun:e,workspaces:n,selectedWorkspaceId:i,onSelectWorkspace:h,onViewInvocationSession:S}){const{t:x}=se(),w=Ps(e.id),s=Ms(e.id),a=Ds(e.id),[u,f]=A.useState(null),[d,m]=A.useState(null),[g,y]=A.useState(!1),[b,r]=A.useState(!1),o=e.members??Ha,l=A.useMemo(()=>o.filter(M=>M.membershipStatus!=="REMOVED"),[o]),c=e.workRequests??Wa,p=e.invocations??za,_=A.useMemo(()=>Ir(n,e),[e,n]),C=A.useMemo(()=>new Map(c.map(M=>[M.id,M])),[c]),k=A.useMemo(()=>[...c].filter(M=>M.status==="PENDING_APPROVAL").sort((M,F)=>Date.parse(F.updatedAt??F.createdAt??"")-Date.parse(M.updatedAt??M.createdAt??"")),[c]),v=A.useMemo(()=>[...c].filter(M=>M.status==="QUEUED").sort((M,F)=>Date.parse(F.updatedAt??F.createdAt??"")-Date.parse(M.updatedAt??M.createdAt??"")),[c]),E=A.useMemo(()=>[...o].map(M=>({member:M,status:Ua(M.status)})).sort((M,F)=>is[M.status]-is[F.status]),[o]),R=w.isError?w.error:s.isError?s.error:null,O=w.isPending||s.isPending,L=_.find(M=>M.workspace.id===i),T=e.messages??[],H=E.filter(({status:M})=>M==="running"||M==="waiting room reply").length;return t.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-background",children:[t.jsx(Fa,{isOpen:b,onClose:()=>r(!1),teamRun:e}),t.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border px-4 py-3 shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx(_r,{size:14,className:"text-muted-foreground shrink-0"}),t.jsx("span",{className:"text-xs font-semibold text-foreground",children:x("Team Status")})]}),t.jsxs("div",{className:"flex items-center gap-1.5 rounded-full border border-border bg-muted/50 px-2 py-0.5 text-xs font-medium text-muted-foreground",children:[t.jsx("span",{children:x("Team mode")}),t.jsx("span",{className:"text-foreground/80",children:e.mode})]})]}),t.jsxs("div",{className:"flex items-center gap-3 border-b border-border/60 px-4 py-1.5 shrink-0 text-xs text-muted-foreground",children:[t.jsxs("span",{className:"inline-flex items-center gap-1",title:x("Messages"),children:[t.jsx(Wn,{size:11,className:"text-muted-foreground/70"}),t.jsx("span",{className:"tabular-nums",children:T.length})]}),t.jsxs("span",{className:"inline-flex items-center gap-1",title:x("Members"),children:[t.jsx(ht,{size:11,className:"text-muted-foreground/70"}),t.jsx("span",{className:"tabular-nums",children:H>0?`${H}/${l.length}`:l.length}),H>0&&t.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-success"})]}),v.length>0&&t.jsxs("span",{className:"inline-flex items-center gap-1",title:x("Queue"),children:[t.jsx(Ke,{size:11,className:"text-muted-foreground/70"}),t.jsx("span",{className:"tabular-nums",children:v.length})]}),k.length>0&&t.jsxs("span",{className:"inline-flex items-center gap-1 text-warning-ink",title:x("Pending approval"),children:[t.jsx(Ke,{size:11}),t.jsx("span",{className:"tabular-nums",children:k.length})]})]}),t.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-app-thin px-4 py-3 space-y-3",children:[k.length>0&&t.jsxs("section",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-warning-ink",children:[t.jsx(Ke,{size:13}),t.jsx("span",{children:x("Pending approval")}),t.jsx("span",{className:"ml-auto rounded-full bg-warning/10 px-1.5 py-0.5 text-[11px] font-semibold text-warning-ink",children:k.length})]}),t.jsx("div",{className:"space-y-1.5",children:k.map(M=>{const F=o.find(D=>D.id===M.targetMemberId),U=w.isPending&&w.variables===M.id,N=s.isPending&&s.variables===M.id;return t.jsxs("div",{className:"rounded-md border border-warning/25 bg-warning/5 px-3 py-2",children:[t.jsx("div",{className:"flex items-start justify-between gap-2",children:t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(He,{name:F?.name??"Agent",avatar:F?.avatar??null,size:"xs",className:"size-4"}),t.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:F?.name??M.targetMemberId})]}),t.jsx("div",{className:"mt-1 text-xs leading-relaxed text-foreground/70 line-clamp-2",children:Mt(M)})]})}),t.jsxs("div",{className:"mt-1.5 flex items-center gap-x-2 text-xs text-muted-foreground",children:[t.jsx("span",{children:x(Va(M.requesterType))}),t.jsx("span",{children:sr(M.createdAt)})]}),t.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[t.jsxs("button",{type:"button",onClick:()=>w.mutate(M.id),disabled:O,className:"inline-flex h-6 min-w-0 items-center gap-1 rounded-md border border-success/25 bg-success/10 px-2 text-xs font-medium text-success-ink transition-colors hover:bg-success/15 disabled:cursor-not-allowed disabled:opacity-50",children:[t.jsx(wt,{size:11}),t.jsx("span",{className:"truncate",children:x(U?"Approving":"Approve")})]}),t.jsxs("button",{type:"button",onClick:()=>s.mutate(M.id),disabled:O,className:"inline-flex h-6 min-w-0 items-center gap-1 rounded-md border border-border bg-muted/50 px-2 text-xs font-medium text-foreground/80 transition-colors hover:bg-accent disabled:cursor-not-allowed disabled:opacity-50",children:[t.jsx(Qe,{size:11}),t.jsx("span",{className:"truncate",children:x(N?"Rejecting":"Reject")})]})]})]},M.id)})}),R&&t.jsx("div",{className:"rounded-md border border-destructive/25 bg-destructive/10 px-3 py-2 text-xs text-destructive-ink",children:ns(R,x("Failed to update work request"))})]}),t.jsxs("section",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[t.jsx(ht,{size:13}),t.jsx("span",{children:x("Members")}),t.jsx("span",{className:"ml-auto text-[11px] font-normal text-muted-foreground",children:l.length}),t.jsx("button",{type:"button",onClick:()=>r(!0),className:"rounded-md p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground/80",title:x("Manage Team Members"),"aria-label":x("Manage Team Members"),children:t.jsx(ii,{size:13})})]}),o.length===0?t.jsx("div",{className:"py-3 text-center text-xs text-muted-foreground",children:x("No members")}):t.jsx("div",{className:"space-y-px rounded-md border border-border overflow-hidden",children:E.map(({member:M,status:F})=>{const U=el(M,p),N=Ja(p.filter(W=>W.memberId===M.id)),D=U?C.get(U.workRequestId):void 0,P=d===M.id,B=F==="running"||F==="waiting room reply",q=B&&!!U,K=u===M.id,$=a.isPending&&a.variables?.memberId===M.id;return t.jsxs("div",{className:Q("bg-background",P&&"bg-muted/25"),children:[t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[t.jsx(He,{name:M.name,avatar:M.avatar,className:"h-6 w-6 text-[10px] shrink-0"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:Q("h-1.5 w-1.5 shrink-0 rounded-full",Ya(F))}),t.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:M.name}),t.jsx("span",{className:Q("shrink-0 rounded-full border px-1.5 py-px text-xs font-medium leading-tight",Xa(F)),children:x(Ka(F))})]}),B&&D?.instruction&&t.jsx("div",{className:"mt-0.5 truncate pl-3 text-xs text-muted-foreground",children:Mt(D)})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[q&&t.jsx("button",{type:"button",onClick:()=>f(K?null:M.id),disabled:a.isPending,className:"rounded-md p-1 text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive-ink disabled:cursor-not-allowed disabled:opacity-50",title:x("Stop"),"aria-label":x("Stop"),children:t.jsx(Wt,{size:12})}),U?.sessionId&&S&&t.jsx("button",{type:"button",onClick:()=>S(U.sessionId),className:"rounded-md p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground/80",title:x("View log"),"aria-label":x("View log"),children:t.jsx(Sr,{size:12})}),t.jsx("button",{type:"button",onClick:()=>m(P?null:M.id),className:"rounded-md p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground/70",title:x("Details"),"aria-label":x("Details"),"aria-expanded":P,children:P?t.jsx($e,{size:13}):t.jsx(Ve,{size:13})})]})]}),q&&K&&t.jsxs("div",{className:"mx-3 mb-2 rounded-md border border-border bg-muted/50 p-2",children:[t.jsx("div",{className:"mb-1.5 text-xs text-foreground/70",children:x("Stop running work?")}),t.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[t.jsxs("button",{type:"button",onClick:()=>{a.mutate({memberId:M.id,cancelQueued:!1},{onSuccess:()=>f(null)})},disabled:a.isPending,className:"inline-flex h-6 items-center gap-1 rounded-md border border-border bg-background px-2 text-xs font-medium text-foreground/80 transition-colors hover:bg-accent disabled:cursor-not-allowed disabled:opacity-50",children:[t.jsx(Wt,{size:10}),t.jsx("span",{children:$&&a.variables?.cancelQueued===!1?x("Stopping"):x("Stop only")})]}),t.jsxs("button",{type:"button",onClick:()=>{a.mutate({memberId:M.id,cancelQueued:!0},{onSuccess:()=>f(null)})},disabled:a.isPending,className:"inline-flex h-6 items-center gap-1 rounded-md border border-destructive/25 bg-destructive/10 px-2 text-xs font-medium text-destructive-ink transition-colors hover:bg-destructive/15 disabled:cursor-not-allowed disabled:opacity-50",children:[t.jsx(si,{size:10}),t.jsx("span",{children:$&&a.variables?.cancelQueued===!0?x("Stopping"):x("Stop + clear queue")})]})]})]}),P&&t.jsxs("div",{className:"border-t border-border/60 px-3 py-2",children:[t.jsxs("div",{className:"mb-1.5 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground",children:[t.jsx("span",{children:M.providerId}),t.jsx("span",{className:"h-0.5 w-0.5 rounded-full bg-foreground/15"}),t.jsx("span",{children:M.workspacePolicy}),t.jsx("span",{className:"h-0.5 w-0.5 rounded-full bg-foreground/15"}),t.jsx("span",{children:M.sessionPolicy==="resume_last"?x("Resume last session"):x("New session per request")})]}),t.jsxs("div",{className:"mb-1.5 flex items-center justify-between gap-2",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:x("Invocation history")}),t.jsx("span",{className:"text-[11px] text-muted-foreground",children:N.length})]}),N.length===0?t.jsx("div",{className:"py-2 text-center text-xs text-muted-foreground",children:x("No invocations yet")}):t.jsx("div",{className:"space-y-1",children:N.map(W=>{const z=C.get(W.workRequestId),j=!!(W.sessionId&&S);return t.jsx("div",{className:"rounded-md border border-border/60 bg-background px-2.5 py-1.5",children:t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[t.jsx("span",{className:Q("rounded-full border px-1.5 py-px text-[10px] font-medium leading-tight",Ga(W.status)),children:W.status}),t.jsx("span",{className:"text-[11px] text-muted-foreground",children:sr(W.updatedAt??W.createdAt)})]}),t.jsx("div",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:Mt(z)||W.workRequestId})]}),j&&t.jsxs("button",{type:"button",onClick:()=>W.sessionId&&S?.(W.sessionId),className:"inline-flex h-5 shrink-0 items-center gap-1 rounded border border-border bg-background px-1.5 text-xs font-medium text-foreground/70 transition-colors hover:bg-accent",title:x("View log"),"aria-label":x("View log"),children:[t.jsx(Sr,{size:10}),t.jsx("span",{children:x("Log")})]})]})},W.id)})})]}),E[E.length-1]?.member.id!==M.id&&!P&&t.jsx("div",{className:"mx-3 border-b border-border/60"})]},M.id)})}),a.isError&&t.jsx("div",{className:"rounded-md border border-destructive/25 bg-destructive/10 px-3 py-2 text-xs text-destructive-ink",children:ns(a.error,x("Failed to stop member work"))})]}),v.length>0&&t.jsxs("section",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[t.jsx(Ke,{size:13}),t.jsx("span",{children:x("Queue")}),t.jsx("span",{className:"ml-auto rounded-full bg-muted px-1.5 py-0.5 text-[11px] font-semibold text-foreground/70",children:v.length})]}),t.jsx("div",{className:"space-y-1",children:v.map(M=>{const F=o.find(U=>U.id===M.targetMemberId);return t.jsx("div",{className:"rounded-md border border-border bg-background px-3 py-2",children:t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(He,{name:F?.name??"Agent",avatar:F?.avatar??null,size:"xs",className:"size-4"}),t.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:F?.name??M.targetMemberId})]}),t.jsx("div",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:Mt(M)})]}),t.jsx("span",{className:"shrink-0 text-[11px] text-muted-foreground",children:sr(M.createdAt)})]})},M.id)})})]}),_.length>0&&t.jsxs("section",{className:"space-y-1.5",children:[t.jsxs("button",{type:"button",onClick:()=>y(M=>!M),className:"flex w-full items-center gap-2 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground/80","aria-expanded":g,"aria-label":x("Workspaces"),children:[t.jsx(_r,{size:13}),t.jsx("span",{children:x("Workspaces")}),t.jsxs("span",{className:"ml-auto flex items-center gap-1.5",children:[L&&t.jsx("span",{className:"max-w-[120px] truncate font-mono text-[11px] font-normal text-muted-foreground",children:Ct(L.workspace)}),t.jsx("span",{className:"rounded-full bg-muted px-1.5 py-0.5 text-[11px] font-semibold text-foreground/70",children:_.length}),g?t.jsx($e,{size:13,className:"text-muted-foreground/70"}):t.jsx(Ve,{size:13,className:"text-muted-foreground/70"})]})]}),g&&t.jsx("div",{className:"space-y-1.5",children:_.map(M=>{const F=i===M.workspace.id;return t.jsx("div",{className:Q("rounded-md border bg-background px-3 py-2",F?"border-foreground/25 shadow-raised":"border-border"),children:t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[t.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:x(M.displayName)}),t.jsx("span",{className:Q("shrink-0 rounded-full border px-1.5 py-px text-[11px] font-medium leading-tight",Qa(M.roleLabel)),children:x(M.roleLabel)}),t.jsx("span",{className:Q("shrink-0 rounded-full border px-1.5 py-px text-[11px] font-medium leading-tight",Za(M.workspace.status)),children:M.workspace.status})]}),t.jsx("div",{className:"mt-0.5 truncate font-mono text-[11px] text-muted-foreground",children:Ct(M.workspace)}),t.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground",children:[M.ownerName&&t.jsxs("span",{children:[x("Owner"),": ",M.ownerName]}),M.parentBranchName&&t.jsxs("span",{children:[x("Parent"),": ",M.parentBranchName]})]})]}),t.jsxs("button",{type:"button",onClick:()=>h?.(M.workspace.id),disabled:!h||F,className:"inline-flex h-6 shrink-0 items-center gap-1 rounded-md border border-border bg-muted/50 px-2 text-xs font-medium text-foreground/80 transition-colors hover:bg-accent disabled:cursor-not-allowed disabled:opacity-50",title:x("View workspace"),children:[F?t.jsx(wt,{size:11}):t.jsx(Bs,{size:11}),t.jsx("span",{children:x(F?"Selected":"Select")})]})]})},M.workspace.id)})})]}),k.length===0&&v.length===0&&E.every(({status:M})=>M==="idle")&&t.jsx("div",{className:"py-2 text-center text-xs text-muted-foreground",children:x("All members idle")})]})]})}var ir={exports:{}},os;function tl(){return os||(os=1,(function(e,n){(function(i,h){e.exports=h()})(self,(()=>(()=>{var i={4567:function(w,s,a){var u=this&&this.__decorate||function(c,p,_,C){var k,v=arguments.length,E=v<3?p:C===null?C=Object.getOwnPropertyDescriptor(p,_):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(c,p,_,C);else for(var R=c.length-1;R>=0;R--)(k=c[R])&&(E=(v<3?k(E):v>3?k(p,_,E):k(p,_))||E);return v>3&&E&&Object.defineProperty(p,_,E),E},f=this&&this.__param||function(c,p){return function(_,C){p(_,C,c)}};Object.defineProperty(s,"__esModule",{value:!0}),s.AccessibilityManager=void 0;const d=a(9042),m=a(6114),g=a(9924),y=a(844),b=a(5596),r=a(4725),o=a(3656);let l=s.AccessibilityManager=class extends y.Disposable{constructor(c,p){super(),this._terminal=c,this._renderService=p,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=document.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=document.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let _=0;_<this._terminal.rows;_++)this._rowElements[_]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[_]);if(this._topBoundaryFocusListener=_=>this._handleBoundaryFocus(_,0),this._bottomBoundaryFocusListener=_=>this._handleBoundaryFocus(_,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=document.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new g.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((_=>this._handleResize(_.rows)))),this.register(this._terminal.onRender((_=>this._refreshRows(_.start,_.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((_=>this._handleChar(_)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
9
+ `)))),this.register(this._terminal.onA11yTab((_=>this._handleTab(_)))),this.register(this._terminal.onKey((_=>this._handleKey(_.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this._screenDprMonitor=new b.ScreenDprMonitor(window),this.register(this._screenDprMonitor),this._screenDprMonitor.setListener((()=>this._refreshRowsDimensions())),this.register((0,o.addDisposableDomListener)(window,"resize",(()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,y.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(c){for(let p=0;p<c;p++)this._handleChar(" ")}_handleChar(c){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==c&&(this._charsToAnnounce+=c):this._charsToAnnounce+=c,c===`
10
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=d.tooMuchOutput)),m.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout((()=>{this._accessibilityContainer.appendChild(this._liveRegion)}),0))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0,m.isMac&&this._liveRegion.remove()}_handleKey(c){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(c)||this._charsToConsume.push(c)}_refreshRows(c,p){this._liveRegionDebouncer.refresh(c,p,this._terminal.rows)}_renderRows(c,p){const _=this._terminal.buffer,C=_.lines.length.toString();for(let k=c;k<=p;k++){const v=_.translateBufferLineToString(_.ydisp+k,!0),E=(_.ydisp+k+1).toString(),R=this._rowElements[k];R&&(v.length===0?R.innerText=" ":R.textContent=v,R.setAttribute("aria-posinset",E),R.setAttribute("aria-setsize",C))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(c,p){const _=c.target,C=this._rowElements[p===0?1:this._rowElements.length-2];if(_.getAttribute("aria-posinset")===(p===0?"1":`${this._terminal.buffer.lines.length}`)||c.relatedTarget!==C)return;let k,v;if(p===0?(k=_,v=this._rowElements.pop(),this._rowContainer.removeChild(v)):(k=this._rowElements.shift(),v=_,this._rowContainer.removeChild(k)),k.removeEventListener("focus",this._topBoundaryFocusListener),v.removeEventListener("focus",this._bottomBoundaryFocusListener),p===0){const E=this._createAccessibilityTreeNode();this._rowElements.unshift(E),this._rowContainer.insertAdjacentElement("afterbegin",E)}else{const E=this._createAccessibilityTreeNode();this._rowElements.push(E),this._rowContainer.appendChild(E)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(p===0?-1:1),this._rowElements[p===0?1:this._rowElements.length-2].focus(),c.preventDefault(),c.stopImmediatePropagation()}_handleResize(c){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let p=this._rowContainer.children.length;p<this._terminal.rows;p++)this._rowElements[p]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[p]);for(;this._rowElements.length>c;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const c=document.createElement("div");return c.setAttribute("role","listitem"),c.tabIndex=-1,this._refreshRowDimensions(c),c}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let c=0;c<this._terminal.rows;c++)this._refreshRowDimensions(this._rowElements[c])}}_refreshRowDimensions(c){c.style.height=`${this._renderService.dimensions.css.cell.height}px`}};s.AccessibilityManager=l=u([f(1,r.IRenderService)],l)},3614:(w,s)=>{function a(m){return m.replace(/\r?\n/g,"\r")}function u(m,g){return g?"\x1B[200~"+m+"\x1B[201~":m}function f(m,g,y,b){m=u(m=a(m),y.decPrivateModes.bracketedPasteMode&&b.rawOptions.ignoreBracketedPasteMode!==!0),y.triggerDataEvent(m,!0),g.value=""}function d(m,g,y){const b=y.getBoundingClientRect(),r=m.clientX-b.left-10,o=m.clientY-b.top-10;g.style.width="20px",g.style.height="20px",g.style.left=`${r}px`,g.style.top=`${o}px`,g.style.zIndex="1000",g.focus()}Object.defineProperty(s,"__esModule",{value:!0}),s.rightClickHandler=s.moveTextAreaUnderMouseCursor=s.paste=s.handlePasteEvent=s.copyHandler=s.bracketTextForPaste=s.prepareTextForTerminal=void 0,s.prepareTextForTerminal=a,s.bracketTextForPaste=u,s.copyHandler=function(m,g){m.clipboardData&&m.clipboardData.setData("text/plain",g.selectionText),m.preventDefault()},s.handlePasteEvent=function(m,g,y,b){m.stopPropagation(),m.clipboardData&&f(m.clipboardData.getData("text/plain"),g,y,b)},s.paste=f,s.moveTextAreaUnderMouseCursor=d,s.rightClickHandler=function(m,g,y,b,r){d(m,g,y),r&&b.rightClickSelect(m),g.value=b.selectionText,g.select()}},7239:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorContrastCache=void 0;const u=a(1505);s.ColorContrastCache=class{constructor(){this._color=new u.TwoKeyMap,this._css=new u.TwoKeyMap}setCss(f,d,m){this._css.set(f,d,m)}getCss(f,d){return this._css.get(f,d)}setColor(f,d,m){this._color.set(f,d,m)}getColor(f,d){return this._color.get(f,d)}clear(){this._color.clear(),this._css.clear()}}},3656:(w,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.addDisposableDomListener=void 0,s.addDisposableDomListener=function(a,u,f,d){a.addEventListener(u,f,d);let m=!1;return{dispose:()=>{m||(m=!0,a.removeEventListener(u,f,d))}}}},6465:function(w,s,a){var u=this&&this.__decorate||function(r,o,l,c){var p,_=arguments.length,C=_<3?o:c===null?c=Object.getOwnPropertyDescriptor(o,l):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(r,o,l,c);else for(var k=r.length-1;k>=0;k--)(p=r[k])&&(C=(_<3?p(C):_>3?p(o,l,C):p(o,l))||C);return _>3&&C&&Object.defineProperty(o,l,C),C},f=this&&this.__param||function(r,o){return function(l,c){o(l,c,r)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Linkifier2=void 0;const d=a(3656),m=a(8460),g=a(844),y=a(2585);let b=s.Linkifier2=class extends g.Disposable{get currentLink(){return this._currentLink}constructor(r){super(),this._bufferService=r,this._linkProviders=[],this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new m.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new m.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,g.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,g.toDisposable)((()=>{this._lastMouseEvent=void 0}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0})))}registerLinkProvider(r){return this._linkProviders.push(r),{dispose:()=>{const o=this._linkProviders.indexOf(r);o!==-1&&this._linkProviders.splice(o,1)}}}attachToDom(r,o,l){this._element=r,this._mouseService=o,this._renderService=l,this.register((0,d.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,d.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(r){if(this._lastMouseEvent=r,!this._element||!this._mouseService)return;const o=this._positionFromMouseEvent(r,this._element,this._mouseService);if(!o)return;this._isMouseOut=!1;const l=r.composedPath();for(let c=0;c<l.length;c++){const p=l[c];if(p.classList.contains("xterm"))break;if(p.classList.contains("xterm-hover"))return}this._lastBufferCell&&o.x===this._lastBufferCell.x&&o.y===this._lastBufferCell.y||(this._handleHover(o),this._lastBufferCell=o)}_handleHover(r){if(this._activeLine!==r.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(r,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,r)||(this._clearCurrentLink(),this._askForLink(r,!0))}_askForLink(r,o){var l,c;this._activeProviderReplies&&o||((l=this._activeProviderReplies)===null||l===void 0||l.forEach((_=>{_?.forEach((C=>{C.link.dispose&&C.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=r.y);let p=!1;for(const[_,C]of this._linkProviders.entries())o?!((c=this._activeProviderReplies)===null||c===void 0)&&c.get(_)&&(p=this._checkLinkProviderResult(_,r,p)):C.provideLinks(r.y,(k=>{var v,E;if(this._isMouseOut)return;const R=k?.map((O=>({link:O})));(v=this._activeProviderReplies)===null||v===void 0||v.set(_,R),p=this._checkLinkProviderResult(_,r,p),((E=this._activeProviderReplies)===null||E===void 0?void 0:E.size)===this._linkProviders.length&&this._removeIntersectingLinks(r.y,this._activeProviderReplies)}))}_removeIntersectingLinks(r,o){const l=new Set;for(let c=0;c<o.size;c++){const p=o.get(c);if(p)for(let _=0;_<p.length;_++){const C=p[_],k=C.link.range.start.y<r?0:C.link.range.start.x,v=C.link.range.end.y>r?this._bufferService.cols:C.link.range.end.x;for(let E=k;E<=v;E++){if(l.has(E)){p.splice(_--,1);break}l.add(E)}}}}_checkLinkProviderResult(r,o,l){var c;if(!this._activeProviderReplies)return l;const p=this._activeProviderReplies.get(r);let _=!1;for(let C=0;C<r;C++)this._activeProviderReplies.has(C)&&!this._activeProviderReplies.get(C)||(_=!0);if(!_&&p){const C=p.find((k=>this._linkAtPosition(k.link,o)));C&&(l=!0,this._handleNewLink(C))}if(this._activeProviderReplies.size===this._linkProviders.length&&!l)for(let C=0;C<this._activeProviderReplies.size;C++){const k=(c=this._activeProviderReplies.get(C))===null||c===void 0?void 0:c.find((v=>this._linkAtPosition(v.link,o)));if(k){l=!0,this._handleNewLink(k);break}}return l}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(r){if(!this._element||!this._mouseService||!this._currentLink)return;const o=this._positionFromMouseEvent(r,this._element,this._mouseService);o&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,o)&&this._currentLink.link.activate(r,this._currentLink.link.text)}_clearCurrentLink(r,o){this._element&&this._currentLink&&this._lastMouseEvent&&(!r||!o||this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=o)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,g.disposeArray)(this._linkCacheDisposables))}_handleNewLink(r){if(!this._element||!this._lastMouseEvent||!this._mouseService)return;const o=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);o&&this._linkAtPosition(r.link,o)&&(this._currentLink=r,this._currentLink.state={decorations:{underline:r.link.decorations===void 0||r.link.decorations.underline,pointerCursor:r.link.decorations===void 0||r.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,r.link,this._lastMouseEvent),r.link.decorations={},Object.defineProperties(r.link.decorations,{pointerCursor:{get:()=>{var l,c;return(c=(l=this._currentLink)===null||l===void 0?void 0:l.state)===null||c===void 0?void 0:c.decorations.pointerCursor},set:l=>{var c,p;!((c=this._currentLink)===null||c===void 0)&&c.state&&this._currentLink.state.decorations.pointerCursor!==l&&(this._currentLink.state.decorations.pointerCursor=l,this._currentLink.state.isHovered&&((p=this._element)===null||p===void 0||p.classList.toggle("xterm-cursor-pointer",l)))}},underline:{get:()=>{var l,c;return(c=(l=this._currentLink)===null||l===void 0?void 0:l.state)===null||c===void 0?void 0:c.decorations.underline},set:l=>{var c,p,_;!((c=this._currentLink)===null||c===void 0)&&c.state&&((_=(p=this._currentLink)===null||p===void 0?void 0:p.state)===null||_===void 0?void 0:_.decorations.underline)!==l&&(this._currentLink.state.decorations.underline=l,this._currentLink.state.isHovered&&this._fireUnderlineEvent(r.link,l))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((l=>{if(!this._currentLink)return;const c=l.start===0?0:l.start+1+this._bufferService.buffer.ydisp,p=this._bufferService.buffer.ydisp+1+l.end;if(this._currentLink.link.range.start.y>=c&&this._currentLink.link.range.end.y<=p&&(this._clearCurrentLink(c,p),this._lastMouseEvent&&this._element)){const _=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);_&&this._askForLink(_,!1)}}))))}_linkHover(r,o,l){var c;!((c=this._currentLink)===null||c===void 0)&&c.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(o,!0),this._currentLink.state.decorations.pointerCursor&&r.classList.add("xterm-cursor-pointer")),o.hover&&o.hover(l,o.text)}_fireUnderlineEvent(r,o){const l=r.range,c=this._bufferService.buffer.ydisp,p=this._createLinkUnderlineEvent(l.start.x-1,l.start.y-c-1,l.end.x,l.end.y-c-1,void 0);(o?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(p)}_linkLeave(r,o,l){var c;!((c=this._currentLink)===null||c===void 0)&&c.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(o,!1),this._currentLink.state.decorations.pointerCursor&&r.classList.remove("xterm-cursor-pointer")),o.leave&&o.leave(l,o.text)}_linkAtPosition(r,o){const l=r.range.start.y*this._bufferService.cols+r.range.start.x,c=r.range.end.y*this._bufferService.cols+r.range.end.x,p=o.y*this._bufferService.cols+o.x;return l<=p&&p<=c}_positionFromMouseEvent(r,o,l){const c=l.getCoords(r,o,this._bufferService.cols,this._bufferService.rows);if(c)return{x:c[0],y:c[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(r,o,l,c,p){return{x1:r,y1:o,x2:l,y2:c,cols:this._bufferService.cols,fg:p}}};s.Linkifier2=b=u([f(0,y.IBufferService)],b)},9042:(w,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.tooMuchOutput=s.promptLabel=void 0,s.promptLabel="Terminal input",s.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(w,s,a){var u=this&&this.__decorate||function(b,r,o,l){var c,p=arguments.length,_=p<3?r:l===null?l=Object.getOwnPropertyDescriptor(r,o):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(b,r,o,l);else for(var C=b.length-1;C>=0;C--)(c=b[C])&&(_=(p<3?c(_):p>3?c(r,o,_):c(r,o))||_);return p>3&&_&&Object.defineProperty(r,o,_),_},f=this&&this.__param||function(b,r){return function(o,l){r(o,l,b)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkProvider=void 0;const d=a(511),m=a(2585);let g=s.OscLinkProvider=class{constructor(b,r,o){this._bufferService=b,this._optionsService=r,this._oscLinkService=o}provideLinks(b,r){var o;const l=this._bufferService.buffer.lines.get(b-1);if(!l)return void r(void 0);const c=[],p=this._optionsService.rawOptions.linkHandler,_=new d.CellData,C=l.getTrimmedLength();let k=-1,v=-1,E=!1;for(let R=0;R<C;R++)if(v!==-1||l.hasContent(R)){if(l.loadCell(R,_),_.hasExtendedAttrs()&&_.extended.urlId){if(v===-1){v=R,k=_.extended.urlId;continue}E=_.extended.urlId!==k}else v!==-1&&(E=!0);if(E||v!==-1&&R===C-1){const O=(o=this._oscLinkService.getLinkData(k))===null||o===void 0?void 0:o.uri;if(O){const L={start:{x:v+1,y:b},end:{x:R+(E||R!==C-1?0:1),y:b}};let T=!1;if(!p?.allowNonHttpProtocols)try{const H=new URL(O);["http:","https:"].includes(H.protocol)||(T=!0)}catch{T=!0}T||c.push({text:O,range:L,activate:(H,M)=>p?p.activate(H,M,L):y(0,M),hover:(H,M)=>{var F;return(F=p?.hover)===null||F===void 0?void 0:F.call(p,H,M,L)},leave:(H,M)=>{var F;return(F=p?.leave)===null||F===void 0?void 0:F.call(p,H,M,L)}})}E=!1,_.hasExtendedAttrs()&&_.extended.urlId?(v=R,k=_.extended.urlId):(v=-1,k=-1)}}r(c)}};function y(b,r){if(confirm(`Do you want to navigate to ${r}?
11
+
12
+ WARNING: This link could potentially be dangerous`)){const o=window.open();if(o){try{o.opener=null}catch{}o.location.href=r}else console.warn("Opening link blocked as opener could not be cleared")}}s.OscLinkProvider=g=u([f(0,m.IBufferService),f(1,m.IOptionsService),f(2,m.IOscLinkService)],g)},6193:(w,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.RenderDebouncer=void 0,s.RenderDebouncer=class{constructor(a,u){this._parentWindow=a,this._renderCallback=u,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._parentWindow.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(a){return this._refreshCallbacks.push(a),this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(a,u,f){this._rowCount=f,a=a!==void 0?a:0,u=u!==void 0?u:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,u):u,this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const a=Math.max(this._rowStart,0),u=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,u),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const a of this._refreshCallbacks)a(0);this._refreshCallbacks=[]}}},5596:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ScreenDprMonitor=void 0;const u=a(844);class f extends u.Disposable{constructor(m){super(),this._parentWindow=m,this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this.register((0,u.toDisposable)((()=>{this.clearListener()})))}setListener(m){this._listener&&this.clearListener(),this._listener=m,this._outerListener=()=>{this._listener&&(this._listener(this._parentWindow.devicePixelRatio,this._currentDevicePixelRatio),this._updateDpr())},this._updateDpr()}_updateDpr(){var m;this._outerListener&&((m=this._resolutionMediaMatchList)===null||m===void 0||m.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)}}s.ScreenDprMonitor=f},3236:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Terminal=void 0;const u=a(3614),f=a(3656),d=a(6465),m=a(9042),g=a(3730),y=a(1680),b=a(3107),r=a(5744),o=a(2950),l=a(1296),c=a(428),p=a(4269),_=a(5114),C=a(8934),k=a(3230),v=a(9312),E=a(4725),R=a(6731),O=a(8055),L=a(8969),T=a(8460),H=a(844),M=a(6114),F=a(8437),U=a(2584),N=a(7399),D=a(5941),P=a(9074),B=a(2585),q=a(5435),K=a(4567),$=typeof window<"u"?window.document:null;class W extends L.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(j={}){super(j),this.browser=M,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new H.MutableDisposable),this._onCursorMove=this.register(new T.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new T.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new T.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new T.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new T.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new T.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new T.EventEmitter),this._onBlur=this.register(new T.EventEmitter),this._onA11yCharEmitter=this.register(new T.EventEmitter),this._onA11yTabEmitter=this.register(new T.EventEmitter),this._onWillOpen=this.register(new T.EventEmitter),this._setup(),this.linkifier2=this.register(this._instantiationService.createInstance(d.Linkifier2)),this.linkifier2.registerLinkProvider(this._instantiationService.createInstance(g.OscLinkProvider)),this._decorationService=this._instantiationService.createInstance(P.DecorationService),this._instantiationService.setService(B.IDecorationService,this._decorationService),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((I,X)=>this.refresh(I,X)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((I=>this._reportWindowsOptions(I)))),this.register(this._inputHandler.onColor((I=>this._handleColorEvent(I)))),this.register((0,T.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,T.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,T.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,T.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((I=>this._afterResize(I.cols,I.rows)))),this.register((0,H.toDisposable)((()=>{var I,X;this._customKeyEventHandler=void 0,(X=(I=this.element)===null||I===void 0?void 0:I.parentNode)===null||X===void 0||X.removeChild(this.element)})))}_handleColorEvent(j){if(this._themeService)for(const I of j){let X,Y="";switch(I.index){case 256:X="foreground",Y="10";break;case 257:X="background",Y="11";break;case 258:X="cursor",Y="12";break;default:X="ansi",Y="4;"+I.index}switch(I.type){case 0:const Z=O.color.toColorRGB(X==="ansi"?this._themeService.colors.ansi[I.index]:this._themeService.colors[X]);this.coreService.triggerDataEvent(`${U.C0.ESC}]${Y};${(0,D.toRgbString)(Z)}${U.C1_ESCAPED.ST}`);break;case 1:if(X==="ansi")this._themeService.modifyColors((G=>G.ansi[I.index]=O.rgba.toColor(...I.color)));else{const G=X;this._themeService.modifyColors((te=>te[G]=O.rgba.toColor(...I.color)))}break;case 2:this._themeService.restoreColor(I.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(j){j?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(K.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(j){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(U.C0.ESC+"[I"),this.updateCursorStyle(j),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var j;return(j=this.textarea)===null||j===void 0?void 0:j.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(U.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const j=this.buffer.ybase+this.buffer.y,I=this.buffer.lines.get(j);if(!I)return;const X=Math.min(this.buffer.x,this.cols-1),Y=this._renderService.dimensions.css.cell.height,Z=I.getWidth(X),G=this._renderService.dimensions.css.cell.width*Z,te=this.buffer.y*this._renderService.dimensions.css.cell.height,ae=X*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ae+"px",this.textarea.style.top=te+"px",this.textarea.style.width=G+"px",this.textarea.style.height=Y+"px",this.textarea.style.lineHeight=Y+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,f.addDisposableDomListener)(this.element,"copy",(I=>{this.hasSelection()&&(0,u.copyHandler)(I,this._selectionService)})));const j=I=>(0,u.handlePasteEvent)(I,this.textarea,this.coreService,this.optionsService);this.register((0,f.addDisposableDomListener)(this.textarea,"paste",j)),this.register((0,f.addDisposableDomListener)(this.element,"paste",j)),M.isFirefox?this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(I=>{I.button===2&&(0,u.rightClickHandler)(I,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,f.addDisposableDomListener)(this.element,"contextmenu",(I=>{(0,u.rightClickHandler)(I,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),M.isLinux&&this.register((0,f.addDisposableDomListener)(this.element,"auxclick",(I=>{I.button===1&&(0,u.moveTextAreaUnderMouseCursor)(I,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,f.addDisposableDomListener)(this.textarea,"keyup",(j=>this._keyUp(j)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keydown",(j=>this._keyDown(j)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keypress",(j=>this._keyPress(j)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionupdate",(j=>this._compositionHelper.compositionupdate(j)))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,f.addDisposableDomListener)(this.textarea,"input",(j=>this._inputEvent(j)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(j){var I;if(!j)throw new Error("Terminal requires a parent element.");j.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=j.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),j.appendChild(this.element);const X=$.createDocumentFragment();this._viewportElement=$.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),X.appendChild(this._viewportElement),this._viewportScrollArea=$.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=$.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=$.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),X.appendChild(this.screenElement),this.textarea=$.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",m.promptLabel),M.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this._instantiationService.createInstance(_.CoreBrowserService,this.textarea,(I=this._document.defaultView)!==null&&I!==void 0?I:window),this._instantiationService.setService(E.ICoreBrowserService,this._coreBrowserService),this.register((0,f.addDisposableDomListener)(this.textarea,"focus",(Y=>this._handleTextAreaFocus(Y)))),this.register((0,f.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(c.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(E.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(R.ThemeService),this._instantiationService.setService(E.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(p.CharacterJoinerService),this._instantiationService.setService(E.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(k.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(E.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((Y=>this._onRender.fire(Y)))),this.onResize((Y=>this._renderService.resize(Y.cols,Y.rows))),this._compositionView=$.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(o.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(X);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._mouseService=this._instantiationService.createInstance(C.MouseService),this._instantiationService.setService(E.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(y.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((Y=>this.scrollLines(Y.amount,Y.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(v.SelectionService,this.element,this.screenElement,this.linkifier2)),this._instantiationService.setService(E.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((Y=>this.scrollLines(Y.amount,Y.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((Y=>this._renderService.handleSelectionChanged(Y.start,Y.end,Y.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((Y=>{this.textarea.value=Y,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((Y=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.linkifier2.attachToDom(this.screenElement,this._mouseService,this._renderService),this.register(this._instantiationService.createInstance(b.BufferDecorationRenderer,this.screenElement)),this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(Y=>this._selectionService.handleMouseDown(Y)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(K.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(Y=>this._handleScreenReaderModeOptionChange(Y)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(r.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(Y=>{!this._overviewRulerRenderer&&Y&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(r.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(l.DomRenderer,this.element,this.screenElement,this._viewportElement,this.linkifier2)}bindMouse(){const j=this,I=this.element;function X(G){const te=j._mouseService.getMouseReportCoords(G,j.screenElement);if(!te)return!1;let ae,J;switch(G.overrideType||G.type){case"mousemove":J=32,G.buttons===void 0?(ae=3,G.button!==void 0&&(ae=G.button<3?G.button:3)):ae=1&G.buttons?0:4&G.buttons?1:2&G.buttons?2:3;break;case"mouseup":J=0,ae=G.button<3?G.button:3;break;case"mousedown":J=1,ae=G.button<3?G.button:3;break;case"wheel":if(j.viewport.getLinesScrolled(G)===0)return!1;J=G.deltaY<0?0:1,ae=4;break;default:return!1}return!(J===void 0||ae===void 0||ae>4)&&j.coreMouseService.triggerMouseEvent({col:te.col,row:te.row,x:te.x,y:te.y,button:ae,action:J,ctrl:G.ctrlKey,alt:G.altKey,shift:G.shiftKey})}const Y={mouseup:null,wheel:null,mousedrag:null,mousemove:null},Z={mouseup:G=>(X(G),G.buttons||(this._document.removeEventListener("mouseup",Y.mouseup),Y.mousedrag&&this._document.removeEventListener("mousemove",Y.mousedrag)),this.cancel(G)),wheel:G=>(X(G),this.cancel(G,!0)),mousedrag:G=>{G.buttons&&X(G)},mousemove:G=>{G.buttons||X(G)}};this.register(this.coreMouseService.onProtocolChange((G=>{G?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(G)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&G?Y.mousemove||(I.addEventListener("mousemove",Z.mousemove),Y.mousemove=Z.mousemove):(I.removeEventListener("mousemove",Y.mousemove),Y.mousemove=null),16&G?Y.wheel||(I.addEventListener("wheel",Z.wheel,{passive:!1}),Y.wheel=Z.wheel):(I.removeEventListener("wheel",Y.wheel),Y.wheel=null),2&G?Y.mouseup||(I.addEventListener("mouseup",Z.mouseup),Y.mouseup=Z.mouseup):(this._document.removeEventListener("mouseup",Y.mouseup),I.removeEventListener("mouseup",Y.mouseup),Y.mouseup=null),4&G?Y.mousedrag||(Y.mousedrag=Z.mousedrag):(this._document.removeEventListener("mousemove",Y.mousedrag),Y.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,f.addDisposableDomListener)(I,"mousedown",(G=>{if(G.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(G))return X(G),Y.mouseup&&this._document.addEventListener("mouseup",Y.mouseup),Y.mousedrag&&this._document.addEventListener("mousemove",Y.mousedrag),this.cancel(G)}))),this.register((0,f.addDisposableDomListener)(I,"wheel",(G=>{if(!Y.wheel){if(!this.buffer.hasScrollback){const te=this.viewport.getLinesScrolled(G);if(te===0)return;const ae=U.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(G.deltaY<0?"A":"B");let J="";for(let ne=0;ne<Math.abs(te);ne++)J+=ae;return this.coreService.triggerDataEvent(J,!0),this.cancel(G,!0)}return this.viewport.handleWheel(G)?this.cancel(G):void 0}}),{passive:!1})),this.register((0,f.addDisposableDomListener)(I,"touchstart",(G=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(G),this.cancel(G)}),{passive:!0})),this.register((0,f.addDisposableDomListener)(I,"touchmove",(G=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(G)?void 0:this.cancel(G)}),{passive:!1}))}refresh(j,I){var X;(X=this._renderService)===null||X===void 0||X.refreshRows(j,I)}updateCursorStyle(j){var I;!((I=this._selectionService)===null||I===void 0)&&I.shouldColumnSelect(j)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(j,I,X=0){var Y;X===1?(super.scrollLines(j,I,X),this.refresh(0,this.rows-1)):(Y=this.viewport)===null||Y===void 0||Y.scrollLines(j)}paste(j){(0,u.paste)(j,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(j){this._customKeyEventHandler=j}registerLinkProvider(j){return this.linkifier2.registerLinkProvider(j)}registerCharacterJoiner(j){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const I=this._characterJoinerService.register(j);return this.refresh(0,this.rows-1),I}deregisterCharacterJoiner(j){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(j)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(j){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+j)}registerDecoration(j){return this._decorationService.registerDecoration(j)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(j,I,X){this._selectionService.setSelection(j,I,X)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var j;(j=this._selectionService)===null||j===void 0||j.clearSelection()}selectAll(){var j;(j=this._selectionService)===null||j===void 0||j.selectAll()}selectLines(j,I){var X;(X=this._selectionService)===null||X===void 0||X.selectLines(j,I)}_keyDown(j){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(j)===!1)return!1;const I=this.browser.isMac&&this.options.macOptionIsMeta&&j.altKey;if(!I&&!this._compositionHelper.keydown(j))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;I||j.key!=="Dead"&&j.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const X=(0,N.evaluateKeyboardEvent)(j,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(j),X.type===3||X.type===2){const Y=this.rows-1;return this.scrollLines(X.type===2?-Y:Y),this.cancel(j,!0)}return X.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,j)||(X.cancel&&this.cancel(j,!0),!X.key||!!(j.key&&!j.ctrlKey&&!j.altKey&&!j.metaKey&&j.key.length===1&&j.key.charCodeAt(0)>=65&&j.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(X.key!==U.C0.ETX&&X.key!==U.C0.CR||(this.textarea.value=""),this._onKey.fire({key:X.key,domEvent:j}),this._showCursor(),this.coreService.triggerDataEvent(X.key,!0),!this.optionsService.rawOptions.screenReaderMode||j.altKey||j.ctrlKey?this.cancel(j,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(j,I){const X=j.isMac&&!this.options.macOptionIsMeta&&I.altKey&&!I.ctrlKey&&!I.metaKey||j.isWindows&&I.altKey&&I.ctrlKey&&!I.metaKey||j.isWindows&&I.getModifierState("AltGraph");return I.type==="keypress"?X:X&&(!I.keyCode||I.keyCode>47)}_keyUp(j){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(j)===!1||((function(I){return I.keyCode===16||I.keyCode===17||I.keyCode===18})(j)||this.focus(),this.updateCursorStyle(j),this._keyPressHandled=!1)}_keyPress(j){let I;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(j)===!1)return!1;if(this.cancel(j),j.charCode)I=j.charCode;else if(j.which===null||j.which===void 0)I=j.keyCode;else{if(j.which===0||j.charCode===0)return!1;I=j.which}return!(!I||(j.altKey||j.ctrlKey||j.metaKey)&&!this._isThirdLevelShift(this.browser,j)||(I=String.fromCharCode(I),this._onKey.fire({key:I,domEvent:j}),this._showCursor(),this.coreService.triggerDataEvent(I,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(j){if(j.data&&j.inputType==="insertText"&&(!j.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const I=j.data;return this.coreService.triggerDataEvent(I,!0),this.cancel(j),!0}return!1}resize(j,I){j!==this.cols||I!==this.rows?super.resize(j,I):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(j,I){var X,Y;(X=this._charSizeService)===null||X===void 0||X.measure(),(Y=this.viewport)===null||Y===void 0||Y.syncScrollArea(!0)}clear(){var j;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let I=1;I<this.rows;I++)this.buffer.lines.push(this.buffer.getBlankLine(F.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(j=this.viewport)===null||j===void 0||j.reset(),this.refresh(0,this.rows-1)}}reset(){var j,I;this.options.rows=this.rows,this.options.cols=this.cols;const X=this._customKeyEventHandler;this._setup(),super.reset(),(j=this._selectionService)===null||j===void 0||j.reset(),this._decorationService.reset(),(I=this.viewport)===null||I===void 0||I.reset(),this._customKeyEventHandler=X,this.refresh(0,this.rows-1)}clearTextureAtlas(){var j;(j=this._renderService)===null||j===void 0||j.clearTextureAtlas()}_reportFocus(){var j;!((j=this.element)===null||j===void 0)&&j.classList.contains("focus")?this.coreService.triggerDataEvent(U.C0.ESC+"[I"):this.coreService.triggerDataEvent(U.C0.ESC+"[O")}_reportWindowsOptions(j){if(this._renderService)switch(j){case q.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const I=this._renderService.dimensions.css.canvas.width.toFixed(0),X=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${U.C0.ESC}[4;${X};${I}t`);break;case q.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const Y=this._renderService.dimensions.css.cell.width.toFixed(0),Z=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${U.C0.ESC}[6;${Z};${Y}t`)}}cancel(j,I){if(this.options.cancelEvents||I)return j.preventDefault(),j.stopPropagation(),!1}}s.Terminal=W},9924:(w,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TimeBasedDebouncer=void 0,s.TimeBasedDebouncer=class{constructor(a,u=1e3){this._renderCallback=a,this._debounceThresholdMS=u,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(a,u,f){this._rowCount=f,a=a!==void 0?a:0,u=u!==void 0?u:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,u):u;const d=Date.now();if(d-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=d,this._innerRefresh();else if(!this._additionalRefreshRequested){const m=d-this._lastRefreshMs,g=this._debounceThresholdMS-m;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),g)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const a=Math.max(this._rowStart,0),u=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,u)}}},1680:function(w,s,a){var u=this&&this.__decorate||function(o,l,c,p){var _,C=arguments.length,k=C<3?l:p===null?p=Object.getOwnPropertyDescriptor(l,c):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(o,l,c,p);else for(var v=o.length-1;v>=0;v--)(_=o[v])&&(k=(C<3?_(k):C>3?_(l,c,k):_(l,c))||k);return C>3&&k&&Object.defineProperty(l,c,k),k},f=this&&this.__param||function(o,l){return function(c,p){l(c,p,o)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Viewport=void 0;const d=a(3656),m=a(4725),g=a(8460),y=a(844),b=a(2585);let r=s.Viewport=class extends y.Disposable{constructor(o,l,c,p,_,C,k,v){super(),this._viewportElement=o,this._scrollArea=l,this._bufferService=c,this._optionsService=p,this._charSizeService=_,this._renderService=C,this._coreBrowserService=k,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new g.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,d.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((E=>this._activeBuffer=E.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((E=>this._renderDimensions=E))),this._handleThemeChange(v.colors),this.register(v.onChangeColors((E=>this._handleThemeChange(E)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(o){this._viewportElement.style.backgroundColor=o.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(o){if(o)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderService.dimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderService.dimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const l=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.css.canvas.height);this._lastRecordedBufferHeight!==l&&(this._lastRecordedBufferHeight=l,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const o=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==o&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=o),this._refreshAnimationFrame=null}syncScrollArea(o=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(o);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(o)}_handleScroll(o){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const l=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:l,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const o=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(o*(this._smoothScrollState.target-this._smoothScrollState.origin)),o<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(o,l){const c=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(l<0&&this._viewportElement.scrollTop!==0||l>0&&c<this._lastRecordedBufferHeight)||(o.cancelable&&o.preventDefault(),!1)}handleWheel(o){const l=this._getPixelsScrolled(o);return l!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+l:this._smoothScrollState.target+=l,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=l,this._bubbleScroll(o,l))}scrollLines(o){if(o!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const l=o*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+l,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:o,suppressScrollEvent:!1})}_getPixelsScrolled(o){if(o.deltaY===0||o.shiftKey)return 0;let l=this._applyScrollModifier(o.deltaY,o);return o.deltaMode===WheelEvent.DOM_DELTA_LINE?l*=this._currentRowHeight:o.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(l*=this._currentRowHeight*this._bufferService.rows),l}getBufferElements(o,l){var c;let p,_="";const C=[],k=l??this._bufferService.buffer.lines.length,v=this._bufferService.buffer.lines;for(let E=o;E<k;E++){const R=v.get(E);if(!R)continue;const O=(c=v.get(E+1))===null||c===void 0?void 0:c.isWrapped;if(_+=R.translateToString(!O),!O||E===v.length-1){const L=document.createElement("div");L.textContent=_,C.push(L),_.length>0&&(p=L),_=""}}return{bufferElements:C,cursorElement:p}}getLinesScrolled(o){if(o.deltaY===0||o.shiftKey)return 0;let l=this._applyScrollModifier(o.deltaY,o);return o.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(l/=this._currentRowHeight+0,this._wheelPartialScroll+=l,l=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):o.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(l*=this._bufferService.rows),l}_applyScrollModifier(o,l){const c=this._optionsService.rawOptions.fastScrollModifier;return c==="alt"&&l.altKey||c==="ctrl"&&l.ctrlKey||c==="shift"&&l.shiftKey?o*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:o*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(o){this._lastTouchY=o.touches[0].pageY}handleTouchMove(o){const l=this._lastTouchY-o.touches[0].pageY;return this._lastTouchY=o.touches[0].pageY,l!==0&&(this._viewportElement.scrollTop+=l,this._bubbleScroll(o,l))}};s.Viewport=r=u([f(2,b.IBufferService),f(3,b.IOptionsService),f(4,m.ICharSizeService),f(5,m.IRenderService),f(6,m.ICoreBrowserService),f(7,m.IThemeService)],r)},3107:function(w,s,a){var u=this&&this.__decorate||function(r,o,l,c){var p,_=arguments.length,C=_<3?o:c===null?c=Object.getOwnPropertyDescriptor(o,l):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(r,o,l,c);else for(var k=r.length-1;k>=0;k--)(p=r[k])&&(C=(_<3?p(C):_>3?p(o,l,C):p(o,l))||C);return _>3&&C&&Object.defineProperty(o,l,C),C},f=this&&this.__param||function(r,o){return function(l,c){o(l,c,r)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferDecorationRenderer=void 0;const d=a(3656),m=a(4725),g=a(844),y=a(2585);let b=s.BufferDecorationRenderer=class extends g.Disposable{constructor(r,o,l,c){super(),this._screenElement=r,this._bufferService=o,this._decorationService=l,this._renderService=c,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register((0,d.addDisposableDomListener)(window,"resize",(()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((p=>this._removeDecoration(p)))),this.register((0,g.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const r of this._decorationService.decorations)this._renderDecoration(r);this._dimensionsChanged=!1}_renderDecoration(r){this._refreshStyle(r),this._dimensionsChanged&&this._refreshXPosition(r)}_createElement(r){var o,l;const c=document.createElement("div");c.classList.add("xterm-decoration"),c.classList.toggle("xterm-decoration-top-layer",((o=r?.options)===null||o===void 0?void 0:o.layer)==="top"),c.style.width=`${Math.round((r.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,c.style.height=(r.options.height||1)*this._renderService.dimensions.css.cell.height+"px",c.style.top=(r.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",c.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const p=(l=r.options.x)!==null&&l!==void 0?l:0;return p&&p>this._bufferService.cols&&(c.style.display="none"),this._refreshXPosition(r,c),c}_refreshStyle(r){const o=r.marker.line-this._bufferService.buffers.active.ydisp;if(o<0||o>=this._bufferService.rows)r.element&&(r.element.style.display="none",r.onRenderEmitter.fire(r.element));else{let l=this._decorationElements.get(r);l||(l=this._createElement(r),r.element=l,this._decorationElements.set(r,l),this._container.appendChild(l),r.onDispose((()=>{this._decorationElements.delete(r),l.remove()}))),l.style.top=o*this._renderService.dimensions.css.cell.height+"px",l.style.display=this._altBufferIsActive?"none":"block",r.onRenderEmitter.fire(l)}}_refreshXPosition(r,o=r.element){var l;if(!o)return;const c=(l=r.options.x)!==null&&l!==void 0?l:0;(r.options.anchor||"left")==="right"?o.style.right=c?c*this._renderService.dimensions.css.cell.width+"px":"":o.style.left=c?c*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(r){var o;(o=this._decorationElements.get(r))===null||o===void 0||o.remove(),this._decorationElements.delete(r),r.dispose()}};s.BufferDecorationRenderer=b=u([f(1,y.IBufferService),f(2,y.IDecorationService),f(3,m.IRenderService)],b)},5871:(w,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorZoneStore=void 0,s.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(a){if(a.options.overviewRulerOptions){for(const u of this._zones)if(u.color===a.options.overviewRulerOptions.color&&u.position===a.options.overviewRulerOptions.position){if(this._lineIntersectsZone(u,a.marker.line))return;if(this._lineAdjacentToZone(u,a.marker.line,a.options.overviewRulerOptions.position))return void this._addLineToZone(u,a.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=a.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=a.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=a.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=a.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:a.options.overviewRulerOptions.color,position:a.options.overviewRulerOptions.position,startBufferLine:a.marker.line,endBufferLine:a.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(a){this._linePadding=a}_lineIntersectsZone(a,u){return u>=a.startBufferLine&&u<=a.endBufferLine}_lineAdjacentToZone(a,u,f){return u>=a.startBufferLine-this._linePadding[f||"full"]&&u<=a.endBufferLine+this._linePadding[f||"full"]}_addLineToZone(a,u){a.startBufferLine=Math.min(a.startBufferLine,u),a.endBufferLine=Math.max(a.endBufferLine,u)}}},5744:function(w,s,a){var u=this&&this.__decorate||function(p,_,C,k){var v,E=arguments.length,R=E<3?_:k===null?k=Object.getOwnPropertyDescriptor(_,C):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(p,_,C,k);else for(var O=p.length-1;O>=0;O--)(v=p[O])&&(R=(E<3?v(R):E>3?v(_,C,R):v(_,C))||R);return E>3&&R&&Object.defineProperty(_,C,R),R},f=this&&this.__param||function(p,_){return function(C,k){_(C,k,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OverviewRulerRenderer=void 0;const d=a(5871),m=a(3656),g=a(4725),y=a(844),b=a(2585),r={full:0,left:0,center:0,right:0},o={full:0,left:0,center:0,right:0},l={full:0,left:0,center:0,right:0};let c=s.OverviewRulerRenderer=class extends y.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(p,_,C,k,v,E,R){var O;super(),this._viewportElement=p,this._screenElement=_,this._bufferService=C,this._decorationService=k,this._renderService=v,this._optionsService=E,this._coreBrowseService=R,this._colorZoneStore=new d.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(O=this._viewportElement.parentElement)===null||O===void 0||O.insertBefore(this._canvas,this._viewportElement);const L=this._canvas.getContext("2d");if(!L)throw new Error("Ctx cannot be null");this._ctx=L,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,y.toDisposable)((()=>{var T;(T=this._canvas)===null||T===void 0||T.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register((0,m.addDisposableDomListener)(this._coreBrowseService.window,"resize",(()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const p=Math.floor(this._canvas.width/3),_=Math.ceil(this._canvas.width/3);o.full=this._canvas.width,o.left=p,o.center=_,o.right=p,this._refreshDrawHeightConstants(),l.full=0,l.left=0,l.center=o.left,l.right=o.left+o.center}_refreshDrawHeightConstants(){r.full=Math.round(2*this._coreBrowseService.dpr);const p=this._canvas.height/this._bufferService.buffer.lines.length,_=Math.round(Math.max(Math.min(p,12),6)*this._coreBrowseService.dpr);r.left=_,r.center=_,r.right=_}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*r.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*r.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*r.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*r.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowseService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowseService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const _ of this._decorationService.decorations)this._colorZoneStore.addDecoration(_);this._ctx.lineWidth=1;const p=this._colorZoneStore.zones;for(const _ of p)_.position!=="full"&&this._renderColorZone(_);for(const _ of p)_.position==="full"&&this._renderColorZone(_);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(p){this._ctx.fillStyle=p.color,this._ctx.fillRect(l[p.position||"full"],Math.round((this._canvas.height-1)*(p.startBufferLine/this._bufferService.buffers.active.lines.length)-r[p.position||"full"]/2),o[p.position||"full"],Math.round((this._canvas.height-1)*((p.endBufferLine-p.startBufferLine)/this._bufferService.buffers.active.lines.length)+r[p.position||"full"]))}_queueRefresh(p,_){this._shouldUpdateDimensions=p||this._shouldUpdateDimensions,this._shouldUpdateAnchor=_||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowseService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};s.OverviewRulerRenderer=c=u([f(2,b.IBufferService),f(3,b.IDecorationService),f(4,g.IRenderService),f(5,b.IOptionsService),f(6,g.ICoreBrowserService)],c)},2950:function(w,s,a){var u=this&&this.__decorate||function(b,r,o,l){var c,p=arguments.length,_=p<3?r:l===null?l=Object.getOwnPropertyDescriptor(r,o):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(b,r,o,l);else for(var C=b.length-1;C>=0;C--)(c=b[C])&&(_=(p<3?c(_):p>3?c(r,o,_):c(r,o))||_);return p>3&&_&&Object.defineProperty(r,o,_),_},f=this&&this.__param||function(b,r){return function(o,l){r(o,l,b)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CompositionHelper=void 0;const d=a(4725),m=a(2585),g=a(2584);let y=s.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(b,r,o,l,c,p){this._textarea=b,this._compositionView=r,this._bufferService=o,this._optionsService=l,this._coreService=c,this._renderService=p,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(b){this._compositionView.textContent=b.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(b){if(this._isComposing||this._isSendingComposition){if(b.keyCode===229||b.keyCode===16||b.keyCode===17||b.keyCode===18)return!1;this._finalizeComposition(!1)}return b.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(b){if(this._compositionView.classList.remove("active"),this._isComposing=!1,b){const r={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let o;this._isSendingComposition=!1,r.start+=this._dataAlreadySent.length,o=this._isComposing?this._textarea.value.substring(r.start,r.end):this._textarea.value.substring(r.start),o.length>0&&this._coreService.triggerDataEvent(o,!0)}}),0)}else{this._isSendingComposition=!1;const r=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(r,!0)}}_handleAnyTextareaChanges(){const b=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const r=this._textarea.value,o=r.replace(b,"");this._dataAlreadySent=o,r.length>b.length?this._coreService.triggerDataEvent(o,!0):r.length<b.length?this._coreService.triggerDataEvent(`${g.C0.DEL}`,!0):r.length===b.length&&r!==b&&this._coreService.triggerDataEvent(r,!0)}}),0)}updateCompositionElements(b){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const r=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),o=this._renderService.dimensions.css.cell.height,l=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,c=r*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=c+"px",this._compositionView.style.top=l+"px",this._compositionView.style.height=o+"px",this._compositionView.style.lineHeight=o+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const p=this._compositionView.getBoundingClientRect();this._textarea.style.left=c+"px",this._textarea.style.top=l+"px",this._textarea.style.width=Math.max(p.width,1)+"px",this._textarea.style.height=Math.max(p.height,1)+"px",this._textarea.style.lineHeight=p.height+"px"}b||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};s.CompositionHelper=y=u([f(2,m.IBufferService),f(3,m.IOptionsService),f(4,m.ICoreService),f(5,d.IRenderService)],y)},9806:(w,s)=>{function a(u,f,d){const m=d.getBoundingClientRect(),g=u.getComputedStyle(d),y=parseInt(g.getPropertyValue("padding-left")),b=parseInt(g.getPropertyValue("padding-top"));return[f.clientX-m.left-y,f.clientY-m.top-b]}Object.defineProperty(s,"__esModule",{value:!0}),s.getCoords=s.getCoordsRelativeToElement=void 0,s.getCoordsRelativeToElement=a,s.getCoords=function(u,f,d,m,g,y,b,r,o){if(!y)return;const l=a(u,f,d);return l?(l[0]=Math.ceil((l[0]+(o?b/2:0))/b),l[1]=Math.ceil(l[1]/r),l[0]=Math.min(Math.max(l[0],1),m+(o?1:0)),l[1]=Math.min(Math.max(l[1],1),g),l):void 0}},9504:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.moveToCellSequence=void 0;const u=a(2584);function f(r,o,l,c){const p=r-d(r,l),_=o-d(o,l),C=Math.abs(p-_)-(function(k,v,E){let R=0;const O=k-d(k,E),L=v-d(v,E);for(let T=0;T<Math.abs(O-L);T++){const H=m(k,v)==="A"?-1:1,M=E.buffer.lines.get(O+H*T);M?.isWrapped&&R++}return R})(r,o,l);return b(C,y(m(r,o),c))}function d(r,o){let l=0,c=o.buffer.lines.get(r),p=c?.isWrapped;for(;p&&r>=0&&r<o.rows;)l++,c=o.buffer.lines.get(--r),p=c?.isWrapped;return l}function m(r,o){return r>o?"A":"B"}function g(r,o,l,c,p,_){let C=r,k=o,v="";for(;C!==l||k!==c;)C+=p?1:-1,p&&C>_.cols-1?(v+=_.buffer.translateBufferLineToString(k,!1,r,C),C=0,r=0,k++):!p&&C<0&&(v+=_.buffer.translateBufferLineToString(k,!1,0,r+1),C=_.cols-1,r=C,k--);return v+_.buffer.translateBufferLineToString(k,!1,r,C)}function y(r,o){const l=o?"O":"[";return u.C0.ESC+l+r}function b(r,o){r=Math.floor(r);let l="";for(let c=0;c<r;c++)l+=o;return l}s.moveToCellSequence=function(r,o,l,c){const p=l.buffer.x,_=l.buffer.y;if(!l.buffer.hasScrollback)return(function(v,E,R,O,L,T){return f(E,O,L,T).length===0?"":b(g(v,E,v,E-d(E,L),!1,L).length,y("D",T))})(p,_,0,o,l,c)+f(_,o,l,c)+(function(v,E,R,O,L,T){let H;H=f(E,O,L,T).length>0?O-d(O,L):E;const M=O,F=(function(U,N,D,P,B,q){let K;return K=f(D,P,B,q).length>0?P-d(P,B):N,U<D&&K<=P||U>=D&&K<P?"C":"D"})(v,E,R,O,L,T);return b(g(v,H,R,M,F==="C",L).length,y(F,T))})(p,_,r,o,l,c);let C;if(_===o)return C=p>r?"D":"C",b(Math.abs(p-r),y(C,c));C=_>o?"D":"C";const k=Math.abs(_-o);return b((function(v,E){return E.cols-v})(_>o?r:p,l)+(k-1)*l.cols+1+((_>o?p:r)-1),y(C,c))}},1296:function(w,s,a){var u=this&&this.__decorate||function(L,T,H,M){var F,U=arguments.length,N=U<3?T:M===null?M=Object.getOwnPropertyDescriptor(T,H):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(L,T,H,M);else for(var D=L.length-1;D>=0;D--)(F=L[D])&&(N=(U<3?F(N):U>3?F(T,H,N):F(T,H))||N);return U>3&&N&&Object.defineProperty(T,H,N),N},f=this&&this.__param||function(L,T){return function(H,M){T(H,M,L)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRenderer=void 0;const d=a(3787),m=a(2550),g=a(2223),y=a(6171),b=a(4725),r=a(8055),o=a(8460),l=a(844),c=a(2585),p="xterm-dom-renderer-owner-",_="xterm-rows",C="xterm-fg-",k="xterm-bg-",v="xterm-focus",E="xterm-selection";let R=1,O=s.DomRenderer=class extends l.Disposable{constructor(L,T,H,M,F,U,N,D,P,B){super(),this._element=L,this._screenElement=T,this._viewportElement=H,this._linkifier2=M,this._charSizeService=U,this._optionsService=N,this._bufferService=D,this._coreBrowserService=P,this._themeService=B,this._terminalClass=R++,this._rowElements=[],this.onRequestRedraw=this.register(new o.EventEmitter).event,this._rowContainer=document.createElement("div"),this._rowContainer.classList.add(_),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=document.createElement("div"),this._selectionContainer.classList.add(E),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,y.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((q=>this._injectCss(q)))),this._injectCss(this._themeService.colors),this._rowFactory=F.createInstance(d.DomRendererRowFactory,document),this._element.classList.add(p+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((q=>this._handleLinkHover(q)))),this.register(this._linkifier2.onHideLinkUnderline((q=>this._handleLinkLeave(q)))),this.register((0,l.toDisposable)((()=>{this._element.classList.remove(p+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new m.WidthCache(document),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const L=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*L,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*L),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/L),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/L),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const H of this._rowElements)H.style.width=`${this.dimensions.css.canvas.width}px`,H.style.height=`${this.dimensions.css.cell.height}px`,H.style.lineHeight=`${this.dimensions.css.cell.height}px`,H.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const T=`${this._terminalSelector} .${_} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=T,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(L){this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let T=`${this._terminalSelector} .${_} { color: ${L.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;T+=`${this._terminalSelector} .${_} .xterm-dim { color: ${r.color.multiplyOpacity(L.foreground,.5).css};}`,T+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`,T+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { border-bottom-style: hidden; }}",T+="@keyframes blink_block_"+this._terminalClass+` { 0% { background-color: ${L.cursor.css}; color: ${L.cursorAccent.css}; } 50% { background-color: inherit; color: ${L.cursor.css}; }}`,T+=`${this._terminalSelector} .${_}.${v} .xterm-cursor.xterm-cursor-blink:not(.xterm-cursor-block) { animation: blink_box_shadow_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${_}.${v} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: blink_block_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-block { background-color: ${L.cursor.css}; color: ${L.cursorAccent.css};}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${L.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${L.cursor.css} inset;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${L.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,T+=`${this._terminalSelector} .${E} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${E} div { position: absolute; background-color: ${L.selectionBackgroundOpaque.css};}${this._terminalSelector} .${E} div { position: absolute; background-color: ${L.selectionInactiveBackgroundOpaque.css};}`;for(const[H,M]of L.ansi.entries())T+=`${this._terminalSelector} .${C}${H} { color: ${M.css}; }${this._terminalSelector} .${C}${H}.xterm-dim { color: ${r.color.multiplyOpacity(M,.5).css}; }${this._terminalSelector} .${k}${H} { background-color: ${M.css}; }`;T+=`${this._terminalSelector} .${C}${g.INVERTED_DEFAULT_COLOR} { color: ${r.color.opaque(L.background).css}; }${this._terminalSelector} .${C}${g.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${r.color.multiplyOpacity(r.color.opaque(L.background),.5).css}; }${this._terminalSelector} .${k}${g.INVERTED_DEFAULT_COLOR} { background-color: ${L.foreground.css}; }`,this._themeStyleElement.textContent=T}_setDefaultSpacing(){const L=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${L}px`,this._rowFactory.defaultSpacing=L}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(L,T){for(let H=this._rowElements.length;H<=T;H++){const M=document.createElement("div");this._rowContainer.appendChild(M),this._rowElements.push(M)}for(;this._rowElements.length>T;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(L,T){this._refreshRowElements(L,T),this._updateDimensions()}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(v)}handleFocus(){this._rowContainer.classList.add(v),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(L,T,H){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(L,T,H),this.renderRows(0,this._bufferService.rows-1),!L||!T)return;const M=L[1]-this._bufferService.buffer.ydisp,F=T[1]-this._bufferService.buffer.ydisp,U=Math.max(M,0),N=Math.min(F,this._bufferService.rows-1);if(U>=this._bufferService.rows||N<0)return;const D=document.createDocumentFragment();if(H){const P=L[0]>T[0];D.appendChild(this._createSelectionElement(U,P?T[0]:L[0],P?L[0]:T[0],N-U+1))}else{const P=M===U?L[0]:0,B=U===F?T[0]:this._bufferService.cols;D.appendChild(this._createSelectionElement(U,P,B));const q=N-U-1;if(D.appendChild(this._createSelectionElement(U+1,0,this._bufferService.cols,q)),U!==N){const K=F===N?T[0]:this._bufferService.cols;D.appendChild(this._createSelectionElement(N,0,K))}}this._selectionContainer.appendChild(D)}_createSelectionElement(L,T,H,M=1){const F=document.createElement("div");return F.style.height=M*this.dimensions.css.cell.height+"px",F.style.top=L*this.dimensions.css.cell.height+"px",F.style.left=T*this.dimensions.css.cell.width+"px",F.style.width=this.dimensions.css.cell.width*(H-T)+"px",F}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const L of this._rowElements)L.replaceChildren()}renderRows(L,T){const H=this._bufferService.buffer,M=H.ybase+H.y,F=Math.min(H.x,this._bufferService.cols-1),U=this._optionsService.rawOptions.cursorBlink,N=this._optionsService.rawOptions.cursorStyle,D=this._optionsService.rawOptions.cursorInactiveStyle;for(let P=L;P<=T;P++){const B=P+H.ydisp,q=this._rowElements[P],K=H.lines.get(B);if(!q||!K)break;q.replaceChildren(...this._rowFactory.createRow(K,B,B===M,N,D,F,U,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${p}${this._terminalClass}`}_handleLinkHover(L){this._setCellUnderline(L.x1,L.x2,L.y1,L.y2,L.cols,!0)}_handleLinkLeave(L){this._setCellUnderline(L.x1,L.x2,L.y1,L.y2,L.cols,!1)}_setCellUnderline(L,T,H,M,F,U){H<0&&(L=0),M<0&&(T=0);const N=this._bufferService.rows-1;H=Math.max(Math.min(H,N),0),M=Math.max(Math.min(M,N),0),F=Math.min(F,this._bufferService.cols);const D=this._bufferService.buffer,P=D.ybase+D.y,B=Math.min(D.x,F-1),q=this._optionsService.rawOptions.cursorBlink,K=this._optionsService.rawOptions.cursorStyle,$=this._optionsService.rawOptions.cursorInactiveStyle;for(let W=H;W<=M;++W){const z=W+D.ydisp,j=this._rowElements[W],I=D.lines.get(z);if(!j||!I)break;j.replaceChildren(...this._rowFactory.createRow(I,z,z===P,K,$,B,q,this.dimensions.css.cell.width,this._widthCache,U?W===H?L:0:-1,U?(W===M?T:F)-1:-1))}}};s.DomRenderer=O=u([f(4,c.IInstantiationService),f(5,b.ICharSizeService),f(6,c.IOptionsService),f(7,c.IBufferService),f(8,b.ICoreBrowserService),f(9,b.IThemeService)],O)},3787:function(w,s,a){var u=this&&this.__decorate||function(C,k,v,E){var R,O=arguments.length,L=O<3?k:E===null?E=Object.getOwnPropertyDescriptor(k,v):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(C,k,v,E);else for(var T=C.length-1;T>=0;T--)(R=C[T])&&(L=(O<3?R(L):O>3?R(k,v,L):R(k,v))||L);return O>3&&L&&Object.defineProperty(k,v,L),L},f=this&&this.__param||function(C,k){return function(v,E){k(v,E,C)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRendererRowFactory=void 0;const d=a(2223),m=a(643),g=a(511),y=a(2585),b=a(8055),r=a(4725),o=a(4269),l=a(6171),c=a(3734);let p=s.DomRendererRowFactory=class{constructor(C,k,v,E,R,O,L){this._document=C,this._characterJoinerService=k,this._optionsService=v,this._coreBrowserService=E,this._coreService=R,this._decorationService=O,this._themeService=L,this._workCell=new g.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(C,k,v){this._selectionStart=C,this._selectionEnd=k,this._columnSelectMode=v}createRow(C,k,v,E,R,O,L,T,H,M,F){const U=[],N=this._characterJoinerService.getJoinedCharacters(k),D=this._themeService.colors;let P,B=C.getNoBgTrimmedLength();v&&B<O+1&&(B=O+1);let q=0,K="",$=0,W=0,z=0,j=!1,I=0,X=!1,Y=0;const Z=[],G=M!==-1&&F!==-1;for(let te=0;te<B;te++){C.loadCell(te,this._workCell);let ae=this._workCell.getWidth();if(ae===0)continue;let J=!1,ne=te,re=this._workCell;if(N.length>0&&te===N[0][0]){J=!0;const le=N.shift();re=new o.JoinedCellData(this._workCell,C.translateToString(!0,le[0],le[1]),le[1]-le[0]),ne=le[1]-1,ae=re.getWidth()}const we=this._isCellInSelection(te,k),mt=v&&te===O,Ae=G&&te>=M&&te<=F;let Pe=!1;this._decorationService.forEachDecorationAtCell(te,k,void 0,(le=>{Pe=!0}));let et=re.getChars()||m.WHITESPACE_CELL_CHAR;if(et===" "&&(re.isUnderline()||re.isOverline())&&(et=" "),Y=ae*T-H.get(et,re.isBold(),re.isItalic()),P){if(q&&(we&&X||!we&&!X&&re.bg===$)&&(we&&X&&D.selectionForeground||re.fg===W)&&re.extended.ext===z&&Ae===j&&Y===I&&!mt&&!J&&!Pe){K+=et,q++;continue}q&&(P.textContent=K),P=this._document.createElement("span"),q=0,K=""}else P=this._document.createElement("span");if($=re.bg,W=re.fg,z=re.extended.ext,j=Ae,I=Y,X=we,J&&O>=te&&O<=ne&&(O=te),!this._coreService.isCursorHidden&&mt){if(Z.push("xterm-cursor"),this._coreBrowserService.isFocused)L&&Z.push("xterm-cursor-blink"),Z.push(E==="bar"?"xterm-cursor-bar":E==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(R)switch(R){case"outline":Z.push("xterm-cursor-outline");break;case"block":Z.push("xterm-cursor-block");break;case"bar":Z.push("xterm-cursor-bar");break;case"underline":Z.push("xterm-cursor-underline")}}if(re.isBold()&&Z.push("xterm-bold"),re.isItalic()&&Z.push("xterm-italic"),re.isDim()&&Z.push("xterm-dim"),K=re.isInvisible()?m.WHITESPACE_CELL_CHAR:re.getChars()||m.WHITESPACE_CELL_CHAR,re.isUnderline()&&(Z.push(`xterm-underline-${re.extended.underlineStyle}`),K===" "&&(K=" "),!re.isUnderlineColorDefault()))if(re.isUnderlineColorRGB())P.style.textDecorationColor=`rgb(${c.AttributeData.toColorRGB(re.getUnderlineColor()).join(",")})`;else{let le=re.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&re.isBold()&&le<8&&(le+=8),P.style.textDecorationColor=D.ansi[le].css}re.isOverline()&&(Z.push("xterm-overline"),K===" "&&(K=" ")),re.isStrikethrough()&&Z.push("xterm-strikethrough"),Ae&&(P.style.textDecoration="underline");let be=re.getFgColor(),tt=re.getFgColorMode(),xe=re.getBgColor(),rt=re.getBgColorMode();const Me=!!re.isInverse();if(Me){const le=be;be=xe,xe=le;const Jt=tt;tt=rt,rt=Jt}let ve,st,Ce,We=!1;switch(this._decorationService.forEachDecorationAtCell(te,k,void 0,(le=>{le.options.layer!=="top"&&We||(le.backgroundColorRGB&&(rt=50331648,xe=le.backgroundColorRGB.rgba>>8&16777215,ve=le.backgroundColorRGB),le.foregroundColorRGB&&(tt=50331648,be=le.foregroundColorRGB.rgba>>8&16777215,st=le.foregroundColorRGB),We=le.options.layer==="top")})),!We&&we&&(ve=this._coreBrowserService.isFocused?D.selectionBackgroundOpaque:D.selectionInactiveBackgroundOpaque,xe=ve.rgba>>8&16777215,rt=50331648,We=!0,D.selectionForeground&&(tt=50331648,be=D.selectionForeground.rgba>>8&16777215,st=D.selectionForeground)),We&&Z.push("xterm-decoration-top"),rt){case 16777216:case 33554432:Ce=D.ansi[xe],Z.push(`xterm-bg-${xe}`);break;case 50331648:Ce=b.rgba.toColor(xe>>16,xe>>8&255,255&xe),this._addStyle(P,`background-color:#${_((xe>>>0).toString(16),"0",6)}`);break;default:Me?(Ce=D.foreground,Z.push(`xterm-bg-${d.INVERTED_DEFAULT_COLOR}`)):Ce=D.background}switch(ve||re.isDim()&&(ve=b.color.multiplyOpacity(Ce,.5)),tt){case 16777216:case 33554432:re.isBold()&&be<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(be+=8),this._applyMinimumContrast(P,Ce,D.ansi[be],re,ve,void 0)||Z.push(`xterm-fg-${be}`);break;case 50331648:const le=b.rgba.toColor(be>>16&255,be>>8&255,255&be);this._applyMinimumContrast(P,Ce,le,re,ve,st)||this._addStyle(P,`color:#${_(be.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(P,Ce,D.foreground,re,ve,void 0)||Me&&Z.push(`xterm-fg-${d.INVERTED_DEFAULT_COLOR}`)}Z.length&&(P.className=Z.join(" "),Z.length=0),mt||J||Pe?P.textContent=K:q++,Y!==this.defaultSpacing&&(P.style.letterSpacing=`${Y}px`),U.push(P),te=ne}return P&&q&&(P.textContent=K),U}_applyMinimumContrast(C,k,v,E,R,O){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,l.excludeFromContrastRatioDemands)(E.getCode()))return!1;const L=this._getContrastCache(E);let T;if(R||O||(T=L.getColor(k.rgba,v.rgba)),T===void 0){const H=this._optionsService.rawOptions.minimumContrastRatio/(E.isDim()?2:1);T=b.color.ensureContrastRatio(R||k,O||v,H),L.setColor((R||k).rgba,(O||v).rgba,T??null)}return!!T&&(this._addStyle(C,`color:${T.css}`),!0)}_getContrastCache(C){return C.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(C,k){C.setAttribute("style",`${C.getAttribute("style")||""}${k};`)}_isCellInSelection(C,k){const v=this._selectionStart,E=this._selectionEnd;return!(!v||!E)&&(this._columnSelectMode?v[0]<=E[0]?C>=v[0]&&k>=v[1]&&C<E[0]&&k<=E[1]:C<v[0]&&k>=v[1]&&C>=E[0]&&k<=E[1]:k>v[1]&&k<E[1]||v[1]===E[1]&&k===v[1]&&C>=v[0]&&C<E[0]||v[1]<E[1]&&k===E[1]&&C<E[0]||v[1]<E[1]&&k===v[1]&&C>=v[0])}};function _(C,k,v){for(;C.length<v;)C=k+C;return C}s.DomRendererRowFactory=p=u([f(1,r.ICharacterJoinerService),f(2,y.IOptionsService),f(3,r.ICoreBrowserService),f(4,y.ICoreService),f(5,y.IDecorationService),f(6,r.IThemeService)],p)},2550:(w,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WidthCache=void 0,s.WidthCache=class{constructor(a){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=a.createElement("div"),this._container.style.position="absolute",this._container.style.top="-50000px",this._container.style.width="50000px",this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const u=a.createElement("span"),f=a.createElement("span");f.style.fontWeight="bold";const d=a.createElement("span");d.style.fontStyle="italic";const m=a.createElement("span");m.style.fontWeight="bold",m.style.fontStyle="italic",this._measureElements=[u,f,d,m],this._container.appendChild(u),this._container.appendChild(f),this._container.appendChild(d),this._container.appendChild(m),a.body.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(a,u,f,d){a===this._font&&u===this._fontSize&&f===this._weight&&d===this._weightBold||(this._font=a,this._fontSize=u,this._weight=f,this._weightBold=d,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${f}`,this._measureElements[1].style.fontWeight=`${d}`,this._measureElements[2].style.fontWeight=`${f}`,this._measureElements[3].style.fontWeight=`${d}`,this.clear())}get(a,u,f){let d=0;if(!u&&!f&&a.length===1&&(d=a.charCodeAt(0))<256)return this._flat[d]!==-9999?this._flat[d]:this._flat[d]=this._measure(a,0);let m=a;u&&(m+="B"),f&&(m+="I");let g=this._holey.get(m);if(g===void 0){let y=0;u&&(y|=1),f&&(y|=2),g=this._measure(a,y),this._holey.set(m,g)}return g}_measure(a,u){const f=this._measureElements[u];return f.textContent=a.repeat(32),f.offsetWidth/32}}},2223:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TEXT_BASELINE=s.DIM_OPACITY=s.INVERTED_DEFAULT_COLOR=void 0;const u=a(6114);s.INVERTED_DEFAULT_COLOR=257,s.DIM_OPACITY=.5,s.TEXT_BASELINE=u.isFirefox||u.isLegacyEdge?"bottom":"ideographic"},6171:(w,s)=>{function a(u){return 57508<=u&&u<=57558}Object.defineProperty(s,"__esModule",{value:!0}),s.createRenderDimensions=s.excludeFromContrastRatioDemands=s.isRestrictedPowerlineGlyph=s.isPowerlineGlyph=s.throwIfFalsy=void 0,s.throwIfFalsy=function(u){if(!u)throw new Error("value must not be falsy");return u},s.isPowerlineGlyph=a,s.isRestrictedPowerlineGlyph=function(u){return 57520<=u&&u<=57527},s.excludeFromContrastRatioDemands=function(u){return a(u)||(function(f){return 9472<=f&&f<=9631})(u)},s.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}}},456:(w,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionModel=void 0,s.SelectionModel=class{constructor(a){this._bufferService=a,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?a%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)-1]:[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[a,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[Math.max(a,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const a=this.selectionStart,u=this.selectionEnd;return!(!a||!u)&&(a[1]>u[1]||a[1]===u[1]&&a[0]>u[0])}handleTrim(a){return this.selectionStart&&(this.selectionStart[1]-=a),this.selectionEnd&&(this.selectionEnd[1]-=a),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(w,s,a){var u=this&&this.__decorate||function(r,o,l,c){var p,_=arguments.length,C=_<3?o:c===null?c=Object.getOwnPropertyDescriptor(o,l):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(r,o,l,c);else for(var k=r.length-1;k>=0;k--)(p=r[k])&&(C=(_<3?p(C):_>3?p(o,l,C):p(o,l))||C);return _>3&&C&&Object.defineProperty(o,l,C),C},f=this&&this.__param||function(r,o){return function(l,c){o(l,c,r)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharSizeService=void 0;const d=a(2585),m=a(8460),g=a(844);let y=s.CharSizeService=class extends g.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(r,o,l){super(),this._optionsService=l,this.width=0,this.height=0,this._onCharSizeChange=this.register(new m.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event,this._measureStrategy=new b(r,o,this._optionsService),this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const r=this._measureStrategy.measure();r.width===this.width&&r.height===this.height||(this.width=r.width,this.height=r.height,this._onCharSizeChange.fire())}};s.CharSizeService=y=u([f(2,d.IOptionsService)],y);class b{constructor(o,l,c){this._document=o,this._parentElement=l,this._optionsService=c,this._result={width:0,height:0},this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`;const o={height:Number(this._measureElement.offsetHeight),width:Number(this._measureElement.offsetWidth)};return o.width!==0&&o.height!==0&&(this._result.width=o.width/32,this._result.height=Math.ceil(o.height)),this._result}}},4269:function(w,s,a){var u=this&&this.__decorate||function(o,l,c,p){var _,C=arguments.length,k=C<3?l:p===null?p=Object.getOwnPropertyDescriptor(l,c):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(o,l,c,p);else for(var v=o.length-1;v>=0;v--)(_=o[v])&&(k=(C<3?_(k):C>3?_(l,c,k):_(l,c))||k);return C>3&&k&&Object.defineProperty(l,c,k),k},f=this&&this.__param||function(o,l){return function(c,p){l(c,p,o)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharacterJoinerService=s.JoinedCellData=void 0;const d=a(3734),m=a(643),g=a(511),y=a(2585);class b extends d.AttributeData{constructor(l,c,p){super(),this.content=0,this.combinedData="",this.fg=l.fg,this.bg=l.bg,this.combinedData=c,this._width=p}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(l){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.JoinedCellData=b;let r=s.CharacterJoinerService=class di{constructor(l){this._bufferService=l,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new g.CellData}register(l){const c={id:this._nextCharacterJoinerId++,handler:l};return this._characterJoiners.push(c),c.id}deregister(l){for(let c=0;c<this._characterJoiners.length;c++)if(this._characterJoiners[c].id===l)return this._characterJoiners.splice(c,1),!0;return!1}getJoinedCharacters(l){if(this._characterJoiners.length===0)return[];const c=this._bufferService.buffer.lines.get(l);if(!c||c.length===0)return[];const p=[],_=c.translateToString(!0);let C=0,k=0,v=0,E=c.getFg(0),R=c.getBg(0);for(let O=0;O<c.getTrimmedLength();O++)if(c.loadCell(O,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==E||this._workCell.bg!==R){if(O-C>1){const L=this._getJoinedRanges(_,v,k,c,C);for(let T=0;T<L.length;T++)p.push(L[T])}C=O,v=k,E=this._workCell.fg,R=this._workCell.bg}k+=this._workCell.getChars().length||m.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-C>1){const O=this._getJoinedRanges(_,v,k,c,C);for(let L=0;L<O.length;L++)p.push(O[L])}return p}_getJoinedRanges(l,c,p,_,C){const k=l.substring(c,p);let v=[];try{v=this._characterJoiners[0].handler(k)}catch(E){console.error(E)}for(let E=1;E<this._characterJoiners.length;E++)try{const R=this._characterJoiners[E].handler(k);for(let O=0;O<R.length;O++)di._mergeRanges(v,R[O])}catch(R){console.error(R)}return this._stringRangesToCellRanges(v,_,C),v}_stringRangesToCellRanges(l,c,p){let _=0,C=!1,k=0,v=l[_];if(v){for(let E=p;E<this._bufferService.cols;E++){const R=c.getWidth(E),O=c.getString(E).length||m.WHITESPACE_CELL_CHAR.length;if(R!==0){if(!C&&v[0]<=k&&(v[0]=E,C=!0),v[1]<=k){if(v[1]=E,v=l[++_],!v)break;v[0]<=k?(v[0]=E,C=!0):C=!1}k+=O}}v&&(v[1]=this._bufferService.cols)}}static _mergeRanges(l,c){let p=!1;for(let _=0;_<l.length;_++){const C=l[_];if(p){if(c[1]<=C[0])return l[_-1][1]=c[1],l;if(c[1]<=C[1])return l[_-1][1]=Math.max(c[1],C[1]),l.splice(_,1),l;l.splice(_,1),_--}else{if(c[1]<=C[0])return l.splice(_,0,c),l;if(c[1]<=C[1])return C[0]=Math.min(c[0],C[0]),l;c[0]<C[1]&&(C[0]=Math.min(c[0],C[0]),p=!0)}}return p?l[l.length-1][1]=c[1]:l.push(c),l}};s.CharacterJoinerService=r=u([f(0,y.IBufferService)],r)},5114:(w,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreBrowserService=void 0,s.CoreBrowserService=class{constructor(a,u){this._textarea=a,this.window=u,this._isFocused=!1,this._cachedIsFocused=void 0,this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}},8934:function(w,s,a){var u=this&&this.__decorate||function(y,b,r,o){var l,c=arguments.length,p=c<3?b:o===null?o=Object.getOwnPropertyDescriptor(b,r):o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(y,b,r,o);else for(var _=y.length-1;_>=0;_--)(l=y[_])&&(p=(c<3?l(p):c>3?l(b,r,p):l(b,r))||p);return c>3&&p&&Object.defineProperty(b,r,p),p},f=this&&this.__param||function(y,b){return function(r,o){b(r,o,y)}};Object.defineProperty(s,"__esModule",{value:!0}),s.MouseService=void 0;const d=a(4725),m=a(9806);let g=s.MouseService=class{constructor(y,b){this._renderService=y,this._charSizeService=b}getCoords(y,b,r,o,l){return(0,m.getCoords)(window,y,b,r,o,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,l)}getMouseReportCoords(y,b){const r=(0,m.getCoordsRelativeToElement)(window,y,b);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};s.MouseService=g=u([f(0,d.IRenderService),f(1,d.ICharSizeService)],g)},3230:function(w,s,a){var u=this&&this.__decorate||function(p,_,C,k){var v,E=arguments.length,R=E<3?_:k===null?k=Object.getOwnPropertyDescriptor(_,C):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(p,_,C,k);else for(var O=p.length-1;O>=0;O--)(v=p[O])&&(R=(E<3?v(R):E>3?v(_,C,R):v(_,C))||R);return E>3&&R&&Object.defineProperty(_,C,R),R},f=this&&this.__param||function(p,_){return function(C,k){_(C,k,p)}};Object.defineProperty(s,"__esModule",{value:!0}),s.RenderService=void 0;const d=a(3656),m=a(6193),g=a(5596),y=a(4725),b=a(8460),r=a(844),o=a(7226),l=a(2585);let c=s.RenderService=class extends r.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(p,_,C,k,v,E,R,O){if(super(),this._rowCount=p,this._charSizeService=k,this._renderer=this.register(new r.MutableDisposable),this._pausedResizeTask=new o.DebouncedIdleTask,this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new b.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new b.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new b.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new b.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new m.RenderDebouncer(R.window,((L,T)=>this._renderRows(L,T))),this.register(this._renderDebouncer),this._screenDprMonitor=new g.ScreenDprMonitor(R.window),this._screenDprMonitor.setListener((()=>this.handleDevicePixelRatioChange())),this.register(this._screenDprMonitor),this.register(E.onResize((()=>this._fullRefresh()))),this.register(E.buffers.onBufferActivate((()=>{var L;return(L=this._renderer.value)===null||L===void 0?void 0:L.clear()}))),this.register(C.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(v.onDecorationRegistered((()=>this._fullRefresh()))),this.register(v.onDecorationRemoved((()=>this._fullRefresh()))),this.register(C.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio"],(()=>{this.clear(),this.handleResize(E.cols,E.rows),this._fullRefresh()}))),this.register(C.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(E.buffer.y,E.buffer.y,!0)))),this.register((0,d.addDisposableDomListener)(R.window,"resize",(()=>this.handleDevicePixelRatioChange()))),this.register(O.onChangeColors((()=>this._fullRefresh()))),"IntersectionObserver"in R.window){const L=new R.window.IntersectionObserver((T=>this._handleIntersectionChange(T[T.length-1])),{threshold:0});L.observe(_),this.register({dispose:()=>L.disconnect()})}}_handleIntersectionChange(p){this._isPaused=p.isIntersecting===void 0?p.intersectionRatio===0:!p.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(p,_,C=!1){this._isPaused?this._needsFullRefresh=!0:(C||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(p,_,this._rowCount))}_renderRows(p,_){this._renderer.value&&(p=Math.min(p,this._rowCount-1),_=Math.min(_,this._rowCount-1),this._renderer.value.renderRows(p,_),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:p,end:_}),this._onRender.fire({start:p,end:_}),this._isNextRenderRedrawOnly=!0)}resize(p,_){this._rowCount=_,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(p){this._renderer.value=p,this._renderer.value.onRequestRedraw((_=>this.refreshRows(_.start,_.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh()}addRefreshCallback(p){return this._renderDebouncer.addRefreshCallback(p)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var p,_;this._renderer.value&&((_=(p=this._renderer.value).clearTextureAtlas)===null||_===void 0||_.call(p),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(p,_){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value.handleResize(p,_))):this._renderer.value.handleResize(p,_),this._fullRefresh())}handleCharSizeChanged(){var p;(p=this._renderer.value)===null||p===void 0||p.handleCharSizeChanged()}handleBlur(){var p;(p=this._renderer.value)===null||p===void 0||p.handleBlur()}handleFocus(){var p;(p=this._renderer.value)===null||p===void 0||p.handleFocus()}handleSelectionChanged(p,_,C){var k;this._selectionState.start=p,this._selectionState.end=_,this._selectionState.columnSelectMode=C,(k=this._renderer.value)===null||k===void 0||k.handleSelectionChanged(p,_,C)}handleCursorMove(){var p;(p=this._renderer.value)===null||p===void 0||p.handleCursorMove()}clear(){var p;(p=this._renderer.value)===null||p===void 0||p.clear()}};s.RenderService=c=u([f(2,l.IOptionsService),f(3,y.ICharSizeService),f(4,l.IDecorationService),f(5,l.IBufferService),f(6,y.ICoreBrowserService),f(7,y.IThemeService)],c)},9312:function(w,s,a){var u=this&&this.__decorate||function(v,E,R,O){var L,T=arguments.length,H=T<3?E:O===null?O=Object.getOwnPropertyDescriptor(E,R):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")H=Reflect.decorate(v,E,R,O);else for(var M=v.length-1;M>=0;M--)(L=v[M])&&(H=(T<3?L(H):T>3?L(E,R,H):L(E,R))||H);return T>3&&H&&Object.defineProperty(E,R,H),H},f=this&&this.__param||function(v,E){return function(R,O){E(R,O,v)}};Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionService=void 0;const d=a(9806),m=a(9504),g=a(456),y=a(4725),b=a(8460),r=a(844),o=a(6114),l=a(4841),c=a(511),p=a(2585),_=" ",C=new RegExp(_,"g");let k=s.SelectionService=class extends r.Disposable{constructor(v,E,R,O,L,T,H,M,F){super(),this._element=v,this._screenElement=E,this._linkifier=R,this._bufferService=O,this._coreService=L,this._mouseService=T,this._optionsService=H,this._renderService=M,this._coreBrowserService=F,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new c.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new b.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new b.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new b.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new b.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=U=>this._handleMouseMove(U),this._mouseUpListener=U=>this._handleMouseUp(U),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((U=>this._handleTrim(U))),this.register(this._bufferService.buffers.onBufferActivate((U=>this._handleBufferActivate(U)))),this.enable(),this._model=new g.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,r.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const v=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!(!v||!E||v[0]===E[0]&&v[1]===E[1])}get selectionText(){const v=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;if(!v||!E)return"";const R=this._bufferService.buffer,O=[];if(this._activeSelectionMode===3){if(v[0]===E[0])return"";const L=v[0]<E[0]?v[0]:E[0],T=v[0]<E[0]?E[0]:v[0];for(let H=v[1];H<=E[1];H++){const M=R.translateBufferLineToString(H,!0,L,T);O.push(M)}}else{const L=v[1]===E[1]?E[0]:void 0;O.push(R.translateBufferLineToString(v[1],!0,v[0],L));for(let T=v[1]+1;T<=E[1]-1;T++){const H=R.lines.get(T),M=R.translateBufferLineToString(T,!0);H?.isWrapped?O[O.length-1]+=M:O.push(M)}if(v[1]!==E[1]){const T=R.lines.get(E[1]),H=R.translateBufferLineToString(E[1],!0,0,E[0]);T&&T.isWrapped?O[O.length-1]+=H:O.push(H)}}return O.map((L=>L.replace(C," "))).join(o.isWindows?`\r
13
+ `:`
14
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(v){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),o.isLinux&&v&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(v){const E=this._getMouseBufferCoords(v),R=this._model.finalSelectionStart,O=this._model.finalSelectionEnd;return!!(R&&O&&E)&&this._areCoordsInSelection(E,R,O)}isCellInSelection(v,E){const R=this._model.finalSelectionStart,O=this._model.finalSelectionEnd;return!(!R||!O)&&this._areCoordsInSelection([v,E],R,O)}_areCoordsInSelection(v,E,R){return v[1]>E[1]&&v[1]<R[1]||E[1]===R[1]&&v[1]===E[1]&&v[0]>=E[0]&&v[0]<R[0]||E[1]<R[1]&&v[1]===R[1]&&v[0]<R[0]||E[1]<R[1]&&v[1]===E[1]&&v[0]>=E[0]}_selectWordAtCursor(v,E){var R,O;const L=(O=(R=this._linkifier.currentLink)===null||R===void 0?void 0:R.link)===null||O===void 0?void 0:O.range;if(L)return this._model.selectionStart=[L.start.x-1,L.start.y-1],this._model.selectionStartLength=(0,l.getRangeLength)(L,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const T=this._getMouseBufferCoords(v);return!!T&&(this._selectWordAt(T,E),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(v,E){this._model.clearSelection(),v=Math.max(v,0),E=Math.min(E,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,v],this._model.selectionEnd=[this._bufferService.cols,E],this.refresh(),this._onSelectionChange.fire()}_handleTrim(v){this._model.handleTrim(v)&&this.refresh()}_getMouseBufferCoords(v){const E=this._mouseService.getCoords(v,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(E)return E[0]--,E[1]--,E[1]+=this._bufferService.buffer.ydisp,E}_getMouseEventScrollAmount(v){let E=(0,d.getCoordsRelativeToElement)(this._coreBrowserService.window,v,this._screenElement)[1];const R=this._renderService.dimensions.css.canvas.height;return E>=0&&E<=R?0:(E>R&&(E-=R),E=Math.min(Math.max(E,-50),50),E/=50,E/Math.abs(E)+Math.round(14*E))}shouldForceSelection(v){return o.isMac?v.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:v.shiftKey}handleMouseDown(v){if(this._mouseDownTimeStamp=v.timeStamp,(v.button!==2||!this.hasSelection)&&v.button===0){if(!this._enabled){if(!this.shouldForceSelection(v))return;v.stopPropagation()}v.preventDefault(),this._dragScrollAmount=0,this._enabled&&v.shiftKey?this._handleIncrementalClick(v):v.detail===1?this._handleSingleClick(v):v.detail===2?this._handleDoubleClick(v):v.detail===3&&this._handleTripleClick(v),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(v){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(v))}_handleSingleClick(v){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(v)?3:0,this._model.selectionStart=this._getMouseBufferCoords(v),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const E=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);E&&E.length!==this._model.selectionStart[0]&&E.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(v){this._selectWordAtCursor(v,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(v){const E=this._getMouseBufferCoords(v);E&&(this._activeSelectionMode=2,this._selectLineAt(E[1]))}shouldColumnSelect(v){return v.altKey&&!(o.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(v){if(v.stopImmediatePropagation(),!this._model.selectionStart)return;const E=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(v),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(v),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const R=this._bufferService.buffer;if(this._model.selectionEnd[1]<R.lines.length){const O=R.lines.get(this._model.selectionEnd[1]);O&&O.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]++}E&&E[0]===this._model.selectionEnd[0]&&E[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const v=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(v.ydisp+this._bufferService.rows,v.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=v.ydisp),this.refresh()}}_handleMouseUp(v){const E=v.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&E<500&&v.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const R=this._mouseService.getCoords(v,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(R&&R[0]!==void 0&&R[1]!==void 0){const O=(0,m.moveToCellSequence)(R[0]-1,R[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(O,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const v=this._model.finalSelectionStart,E=this._model.finalSelectionEnd,R=!(!v||!E||v[0]===E[0]&&v[1]===E[1]);R?v&&E&&(this._oldSelectionStart&&this._oldSelectionEnd&&v[0]===this._oldSelectionStart[0]&&v[1]===this._oldSelectionStart[1]&&E[0]===this._oldSelectionEnd[0]&&E[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(v,E,R)):this._oldHasSelection&&this._fireOnSelectionChange(v,E,R)}_fireOnSelectionChange(v,E,R){this._oldSelectionStart=v,this._oldSelectionEnd=E,this._oldHasSelection=R,this._onSelectionChange.fire()}_handleBufferActivate(v){this.clearSelection(),this._trimListener.dispose(),this._trimListener=v.activeBuffer.lines.onTrim((E=>this._handleTrim(E)))}_convertViewportColToCharacterIndex(v,E){let R=E;for(let O=0;E>=O;O++){const L=v.loadCell(O,this._workCell).getChars().length;this._workCell.getWidth()===0?R--:L>1&&E!==O&&(R+=L-1)}return R}setSelection(v,E,R){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[v,E],this._model.selectionStartLength=R,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(v){this._isClickInSelection(v)||(this._selectWordAtCursor(v,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(v,E,R=!0,O=!0){if(v[0]>=this._bufferService.cols)return;const L=this._bufferService.buffer,T=L.lines.get(v[1]);if(!T)return;const H=L.translateBufferLineToString(v[1],!1);let M=this._convertViewportColToCharacterIndex(T,v[0]),F=M;const U=v[0]-M;let N=0,D=0,P=0,B=0;if(H.charAt(M)===" "){for(;M>0&&H.charAt(M-1)===" ";)M--;for(;F<H.length&&H.charAt(F+1)===" ";)F++}else{let $=v[0],W=v[0];T.getWidth($)===0&&(N++,$--),T.getWidth(W)===2&&(D++,W++);const z=T.getString(W).length;for(z>1&&(B+=z-1,F+=z-1);$>0&&M>0&&!this._isCharWordSeparator(T.loadCell($-1,this._workCell));){T.loadCell($-1,this._workCell);const j=this._workCell.getChars().length;this._workCell.getWidth()===0?(N++,$--):j>1&&(P+=j-1,M-=j-1),M--,$--}for(;W<T.length&&F+1<H.length&&!this._isCharWordSeparator(T.loadCell(W+1,this._workCell));){T.loadCell(W+1,this._workCell);const j=this._workCell.getChars().length;this._workCell.getWidth()===2?(D++,W++):j>1&&(B+=j-1,F+=j-1),F++,W++}}F++;let q=M+U-N+P,K=Math.min(this._bufferService.cols,F-M+N+D-P-B);if(E||H.slice(M,F).trim()!==""){if(R&&q===0&&T.getCodePoint(0)!==32){const $=L.lines.get(v[1]-1);if($&&T.isWrapped&&$.getCodePoint(this._bufferService.cols-1)!==32){const W=this._getWordAt([this._bufferService.cols-1,v[1]-1],!1,!0,!1);if(W){const z=this._bufferService.cols-W.start;q-=z,K+=z}}}if(O&&q+K===this._bufferService.cols&&T.getCodePoint(this._bufferService.cols-1)!==32){const $=L.lines.get(v[1]+1);if($?.isWrapped&&$.getCodePoint(0)!==32){const W=this._getWordAt([0,v[1]+1],!1,!1,!0);W&&(K+=W.length)}}return{start:q,length:K}}}_selectWordAt(v,E){const R=this._getWordAt(v,E);if(R){for(;R.start<0;)R.start+=this._bufferService.cols,v[1]--;this._model.selectionStart=[R.start,v[1]],this._model.selectionStartLength=R.length}}_selectToWordAt(v){const E=this._getWordAt(v,!0);if(E){let R=v[1];for(;E.start<0;)E.start+=this._bufferService.cols,R--;if(!this._model.areSelectionValuesReversed())for(;E.start+E.length>this._bufferService.cols;)E.length-=this._bufferService.cols,R++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?E.start:E.start+E.length,R]}}_isCharWordSeparator(v){return v.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(v.getChars())>=0}_selectLineAt(v){const E=this._bufferService.buffer.getWrappedRangeForLine(v),R={start:{x:0,y:E.first},end:{x:this._bufferService.cols-1,y:E.last}};this._model.selectionStart=[0,E.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,l.getRangeLength)(R,this._bufferService.cols)}};s.SelectionService=k=u([f(3,p.IBufferService),f(4,p.ICoreService),f(5,y.IMouseService),f(6,p.IOptionsService),f(7,y.IRenderService),f(8,y.ICoreBrowserService)],k)},4725:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.IThemeService=s.ICharacterJoinerService=s.ISelectionService=s.IRenderService=s.IMouseService=s.ICoreBrowserService=s.ICharSizeService=void 0;const u=a(8343);s.ICharSizeService=(0,u.createDecorator)("CharSizeService"),s.ICoreBrowserService=(0,u.createDecorator)("CoreBrowserService"),s.IMouseService=(0,u.createDecorator)("MouseService"),s.IRenderService=(0,u.createDecorator)("RenderService"),s.ISelectionService=(0,u.createDecorator)("SelectionService"),s.ICharacterJoinerService=(0,u.createDecorator)("CharacterJoinerService"),s.IThemeService=(0,u.createDecorator)("ThemeService")},6731:function(w,s,a){var u=this&&this.__decorate||function(k,v,E,R){var O,L=arguments.length,T=L<3?v:R===null?R=Object.getOwnPropertyDescriptor(v,E):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(k,v,E,R);else for(var H=k.length-1;H>=0;H--)(O=k[H])&&(T=(L<3?O(T):L>3?O(v,E,T):O(v,E))||T);return L>3&&T&&Object.defineProperty(v,E,T),T},f=this&&this.__param||function(k,v){return function(E,R){v(E,R,k)}};Object.defineProperty(s,"__esModule",{value:!0}),s.ThemeService=s.DEFAULT_ANSI_COLORS=void 0;const d=a(7239),m=a(8055),g=a(8460),y=a(844),b=a(2585),r=m.css.toColor("#ffffff"),o=m.css.toColor("#000000"),l=m.css.toColor("#ffffff"),c=m.css.toColor("#000000"),p={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};s.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const k=[m.css.toColor("#2e3436"),m.css.toColor("#cc0000"),m.css.toColor("#4e9a06"),m.css.toColor("#c4a000"),m.css.toColor("#3465a4"),m.css.toColor("#75507b"),m.css.toColor("#06989a"),m.css.toColor("#d3d7cf"),m.css.toColor("#555753"),m.css.toColor("#ef2929"),m.css.toColor("#8ae234"),m.css.toColor("#fce94f"),m.css.toColor("#729fcf"),m.css.toColor("#ad7fa8"),m.css.toColor("#34e2e2"),m.css.toColor("#eeeeec")],v=[0,95,135,175,215,255];for(let E=0;E<216;E++){const R=v[E/36%6|0],O=v[E/6%6|0],L=v[E%6];k.push({css:m.channels.toCss(R,O,L),rgba:m.channels.toRgba(R,O,L)})}for(let E=0;E<24;E++){const R=8+10*E;k.push({css:m.channels.toCss(R,R,R),rgba:m.channels.toRgba(R,R,R)})}return k})());let _=s.ThemeService=class extends y.Disposable{get colors(){return this._colors}constructor(k){super(),this._optionsService=k,this._contrastCache=new d.ColorContrastCache,this._halfContrastCache=new d.ColorContrastCache,this._onChangeColors=this.register(new g.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:r,background:o,cursor:l,cursorAccent:c,selectionForeground:void 0,selectionBackgroundTransparent:p,selectionBackgroundOpaque:m.color.blend(o,p),selectionInactiveBackgroundTransparent:p,selectionInactiveBackgroundOpaque:m.color.blend(o,p),ansi:s.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(k={}){const v=this._colors;if(v.foreground=C(k.foreground,r),v.background=C(k.background,o),v.cursor=C(k.cursor,l),v.cursorAccent=C(k.cursorAccent,c),v.selectionBackgroundTransparent=C(k.selectionBackground,p),v.selectionBackgroundOpaque=m.color.blend(v.background,v.selectionBackgroundTransparent),v.selectionInactiveBackgroundTransparent=C(k.selectionInactiveBackground,v.selectionBackgroundTransparent),v.selectionInactiveBackgroundOpaque=m.color.blend(v.background,v.selectionInactiveBackgroundTransparent),v.selectionForeground=k.selectionForeground?C(k.selectionForeground,m.NULL_COLOR):void 0,v.selectionForeground===m.NULL_COLOR&&(v.selectionForeground=void 0),m.color.isOpaque(v.selectionBackgroundTransparent)&&(v.selectionBackgroundTransparent=m.color.opacity(v.selectionBackgroundTransparent,.3)),m.color.isOpaque(v.selectionInactiveBackgroundTransparent)&&(v.selectionInactiveBackgroundTransparent=m.color.opacity(v.selectionInactiveBackgroundTransparent,.3)),v.ansi=s.DEFAULT_ANSI_COLORS.slice(),v.ansi[0]=C(k.black,s.DEFAULT_ANSI_COLORS[0]),v.ansi[1]=C(k.red,s.DEFAULT_ANSI_COLORS[1]),v.ansi[2]=C(k.green,s.DEFAULT_ANSI_COLORS[2]),v.ansi[3]=C(k.yellow,s.DEFAULT_ANSI_COLORS[3]),v.ansi[4]=C(k.blue,s.DEFAULT_ANSI_COLORS[4]),v.ansi[5]=C(k.magenta,s.DEFAULT_ANSI_COLORS[5]),v.ansi[6]=C(k.cyan,s.DEFAULT_ANSI_COLORS[6]),v.ansi[7]=C(k.white,s.DEFAULT_ANSI_COLORS[7]),v.ansi[8]=C(k.brightBlack,s.DEFAULT_ANSI_COLORS[8]),v.ansi[9]=C(k.brightRed,s.DEFAULT_ANSI_COLORS[9]),v.ansi[10]=C(k.brightGreen,s.DEFAULT_ANSI_COLORS[10]),v.ansi[11]=C(k.brightYellow,s.DEFAULT_ANSI_COLORS[11]),v.ansi[12]=C(k.brightBlue,s.DEFAULT_ANSI_COLORS[12]),v.ansi[13]=C(k.brightMagenta,s.DEFAULT_ANSI_COLORS[13]),v.ansi[14]=C(k.brightCyan,s.DEFAULT_ANSI_COLORS[14]),v.ansi[15]=C(k.brightWhite,s.DEFAULT_ANSI_COLORS[15]),k.extendedAnsi){const E=Math.min(v.ansi.length-16,k.extendedAnsi.length);for(let R=0;R<E;R++)v.ansi[R+16]=C(k.extendedAnsi[R],s.DEFAULT_ANSI_COLORS[R+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(k){this._restoreColor(k),this._onChangeColors.fire(this.colors)}_restoreColor(k){if(k!==void 0)switch(k){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[k]=this._restoreColors.ansi[k]}else for(let v=0;v<this._restoreColors.ansi.length;++v)this._colors.ansi[v]=this._restoreColors.ansi[v]}modifyColors(k){k(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function C(k,v){if(k!==void 0)try{return m.css.toColor(k)}catch{}return v}s.ThemeService=_=u([f(0,b.IOptionsService)],_)},6349:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CircularList=void 0;const u=a(8460),f=a(844);class d extends f.Disposable{constructor(g){super(),this._maxLength=g,this.onDeleteEmitter=this.register(new u.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new u.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new u.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(g){if(this._maxLength===g)return;const y=new Array(g);for(let b=0;b<Math.min(g,this.length);b++)y[b]=this._array[this._getCyclicIndex(b)];this._array=y,this._maxLength=g,this._startIndex=0}get length(){return this._length}set length(g){if(g>this._length)for(let y=this._length;y<g;y++)this._array[y]=void 0;this._length=g}get(g){return this._array[this._getCyclicIndex(g)]}set(g,y){this._array[this._getCyclicIndex(g)]=y}push(g){this._array[this._getCyclicIndex(this._length)]=g,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(g,y,...b){if(y){for(let r=g;r<this._length-y;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+y)];this._length-=y,this.onDeleteEmitter.fire({index:g,amount:y})}for(let r=this._length-1;r>=g;r--)this._array[this._getCyclicIndex(r+b.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<b.length;r++)this._array[this._getCyclicIndex(g+r)]=b[r];if(b.length&&this.onInsertEmitter.fire({index:g,amount:b.length}),this._length+b.length>this._maxLength){const r=this._length+b.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=b.length}trimStart(g){g>this._length&&(g=this._length),this._startIndex+=g,this._length-=g,this.onTrimEmitter.fire(g)}shiftElements(g,y,b){if(!(y<=0)){if(g<0||g>=this._length)throw new Error("start argument out of range");if(g+b<0)throw new Error("Cannot shift elements in list beyond index 0");if(b>0){for(let o=y-1;o>=0;o--)this.set(g+o+b,this.get(g+o));const r=g+y+b-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<y;r++)this.set(g+r+b,this.get(g+r))}}_getCyclicIndex(g){return(this._startIndex+g)%this._maxLength}}s.CircularList=d},1439:(w,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.clone=void 0,s.clone=function a(u,f=5){if(typeof u!="object")return u;const d=Array.isArray(u)?[]:{};for(const m in u)d[m]=f<=1?u[m]:u[m]&&a(u[m],f-1);return d}},8055:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.contrastRatio=s.toPaddedHex=s.rgba=s.rgb=s.css=s.color=s.channels=s.NULL_COLOR=void 0;const u=a(6114);let f=0,d=0,m=0,g=0;var y,b,r,o,l;function c(_){const C=_.toString(16);return C.length<2?"0"+C:C}function p(_,C){return _<C?(C+.05)/(_+.05):(_+.05)/(C+.05)}s.NULL_COLOR={css:"#00000000",rgba:0},(function(_){_.toCss=function(C,k,v,E){return E!==void 0?`#${c(C)}${c(k)}${c(v)}${c(E)}`:`#${c(C)}${c(k)}${c(v)}`},_.toRgba=function(C,k,v,E=255){return(C<<24|k<<16|v<<8|E)>>>0}})(y||(s.channels=y={})),(function(_){function C(k,v){return g=Math.round(255*v),[f,d,m]=l.toChannels(k.rgba),{css:y.toCss(f,d,m,g),rgba:y.toRgba(f,d,m,g)}}_.blend=function(k,v){if(g=(255&v.rgba)/255,g===1)return{css:v.css,rgba:v.rgba};const E=v.rgba>>24&255,R=v.rgba>>16&255,O=v.rgba>>8&255,L=k.rgba>>24&255,T=k.rgba>>16&255,H=k.rgba>>8&255;return f=L+Math.round((E-L)*g),d=T+Math.round((R-T)*g),m=H+Math.round((O-H)*g),{css:y.toCss(f,d,m),rgba:y.toRgba(f,d,m)}},_.isOpaque=function(k){return(255&k.rgba)==255},_.ensureContrastRatio=function(k,v,E){const R=l.ensureContrastRatio(k.rgba,v.rgba,E);if(R)return l.toColor(R>>24&255,R>>16&255,R>>8&255)},_.opaque=function(k){const v=(255|k.rgba)>>>0;return[f,d,m]=l.toChannels(v),{css:y.toCss(f,d,m),rgba:v}},_.opacity=C,_.multiplyOpacity=function(k,v){return g=255&k.rgba,C(k,g*v/255)},_.toColorRGB=function(k){return[k.rgba>>24&255,k.rgba>>16&255,k.rgba>>8&255]}})(b||(s.color=b={})),(function(_){let C,k;if(!u.isNode){const v=document.createElement("canvas");v.width=1,v.height=1;const E=v.getContext("2d",{willReadFrequently:!0});E&&(C=E,C.globalCompositeOperation="copy",k=C.createLinearGradient(0,0,1,1))}_.toColor=function(v){if(v.match(/#[\da-f]{3,8}/i))switch(v.length){case 4:return f=parseInt(v.slice(1,2).repeat(2),16),d=parseInt(v.slice(2,3).repeat(2),16),m=parseInt(v.slice(3,4).repeat(2),16),l.toColor(f,d,m);case 5:return f=parseInt(v.slice(1,2).repeat(2),16),d=parseInt(v.slice(2,3).repeat(2),16),m=parseInt(v.slice(3,4).repeat(2),16),g=parseInt(v.slice(4,5).repeat(2),16),l.toColor(f,d,m,g);case 7:return{css:v,rgba:(parseInt(v.slice(1),16)<<8|255)>>>0};case 9:return{css:v,rgba:parseInt(v.slice(1),16)>>>0}}const E=v.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(E)return f=parseInt(E[1]),d=parseInt(E[2]),m=parseInt(E[3]),g=Math.round(255*(E[5]===void 0?1:parseFloat(E[5]))),l.toColor(f,d,m,g);if(!C||!k)throw new Error("css.toColor: Unsupported css format");if(C.fillStyle=k,C.fillStyle=v,typeof C.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(C.fillRect(0,0,1,1),[f,d,m,g]=C.getImageData(0,0,1,1).data,g!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:y.toRgba(f,d,m,g),css:v}}})(r||(s.css=r={})),(function(_){function C(k,v,E){const R=k/255,O=v/255,L=E/255;return .2126*(R<=.03928?R/12.92:Math.pow((R+.055)/1.055,2.4))+.7152*(O<=.03928?O/12.92:Math.pow((O+.055)/1.055,2.4))+.0722*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))}_.relativeLuminance=function(k){return C(k>>16&255,k>>8&255,255&k)},_.relativeLuminance2=C})(o||(s.rgb=o={})),(function(_){function C(v,E,R){const O=v>>24&255,L=v>>16&255,T=v>>8&255;let H=E>>24&255,M=E>>16&255,F=E>>8&255,U=p(o.relativeLuminance2(H,M,F),o.relativeLuminance2(O,L,T));for(;U<R&&(H>0||M>0||F>0);)H-=Math.max(0,Math.ceil(.1*H)),M-=Math.max(0,Math.ceil(.1*M)),F-=Math.max(0,Math.ceil(.1*F)),U=p(o.relativeLuminance2(H,M,F),o.relativeLuminance2(O,L,T));return(H<<24|M<<16|F<<8|255)>>>0}function k(v,E,R){const O=v>>24&255,L=v>>16&255,T=v>>8&255;let H=E>>24&255,M=E>>16&255,F=E>>8&255,U=p(o.relativeLuminance2(H,M,F),o.relativeLuminance2(O,L,T));for(;U<R&&(H<255||M<255||F<255);)H=Math.min(255,H+Math.ceil(.1*(255-H))),M=Math.min(255,M+Math.ceil(.1*(255-M))),F=Math.min(255,F+Math.ceil(.1*(255-F))),U=p(o.relativeLuminance2(H,M,F),o.relativeLuminance2(O,L,T));return(H<<24|M<<16|F<<8|255)>>>0}_.ensureContrastRatio=function(v,E,R){const O=o.relativeLuminance(v>>8),L=o.relativeLuminance(E>>8);if(p(O,L)<R){if(L<O){const M=C(v,E,R),F=p(O,o.relativeLuminance(M>>8));if(F<R){const U=k(v,E,R);return F>p(O,o.relativeLuminance(U>>8))?M:U}return M}const T=k(v,E,R),H=p(O,o.relativeLuminance(T>>8));if(H<R){const M=C(v,E,R);return H>p(O,o.relativeLuminance(M>>8))?T:M}return T}},_.reduceLuminance=C,_.increaseLuminance=k,_.toChannels=function(v){return[v>>24&255,v>>16&255,v>>8&255,255&v]},_.toColor=function(v,E,R,O){return{css:y.toCss(v,E,R,O),rgba:y.toRgba(v,E,R,O)}}})(l||(s.rgba=l={})),s.toPaddedHex=c,s.contrastRatio=p},8969:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreTerminal=void 0;const u=a(844),f=a(2585),d=a(4348),m=a(7866),g=a(744),y=a(7302),b=a(6975),r=a(8460),o=a(1753),l=a(1480),c=a(7994),p=a(9282),_=a(5435),C=a(5981),k=a(2660);let v=!1;class E extends u.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new r.EventEmitter),this._onScroll.event((O=>{var L;(L=this._onScrollApi)===null||L===void 0||L.fire(O.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(O){for(const L in O)this.optionsService.options[L]=O[L]}constructor(O){super(),this._windowsWrappingHeuristics=this.register(new u.MutableDisposable),this._onBinary=this.register(new r.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new r.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new r.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new r.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new r.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new r.EventEmitter),this._instantiationService=new d.InstantiationService,this.optionsService=this.register(new y.OptionsService(O)),this._instantiationService.setService(f.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(g.BufferService)),this._instantiationService.setService(f.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(m.LogService)),this._instantiationService.setService(f.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(b.CoreService)),this._instantiationService.setService(f.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(o.CoreMouseService)),this._instantiationService.setService(f.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(l.UnicodeService)),this._instantiationService.setService(f.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(c.CharsetService),this._instantiationService.setService(f.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(k.OscLinkService),this._instantiationService.setService(f.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new _.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,r.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,r.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,r.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,r.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((L=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((L=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new C.WriteBuffer(((L,T)=>this._inputHandler.parse(L,T)))),this.register((0,r.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(O,L){this._writeBuffer.write(O,L)}writeSync(O,L){this._logService.logLevel<=f.LogLevelEnum.WARN&&!v&&(this._logService.warn("writeSync is unreliable and will be removed soon."),v=!0),this._writeBuffer.writeSync(O,L)}resize(O,L){isNaN(O)||isNaN(L)||(O=Math.max(O,g.MINIMUM_COLS),L=Math.max(L,g.MINIMUM_ROWS),this._bufferService.resize(O,L))}scroll(O,L=!1){this._bufferService.scroll(O,L)}scrollLines(O,L,T){this._bufferService.scrollLines(O,L,T)}scrollPages(O){this.scrollLines(O*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(O){const L=O-this._bufferService.buffer.ydisp;L!==0&&this.scrollLines(L)}registerEscHandler(O,L){return this._inputHandler.registerEscHandler(O,L)}registerDcsHandler(O,L){return this._inputHandler.registerDcsHandler(O,L)}registerCsiHandler(O,L){return this._inputHandler.registerCsiHandler(O,L)}registerOscHandler(O,L){return this._inputHandler.registerOscHandler(O,L)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let O=!1;const L=this.optionsService.rawOptions.windowsPty;L&&L.buildNumber!==void 0&&L.buildNumber!==void 0?O=L.backend==="conpty"&&L.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(O=!0),O?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const O=[];O.push(this.onLineFeed(p.updateWindowsModeWrappedState.bind(null,this._bufferService))),O.push(this.registerCsiHandler({final:"H"},(()=>((0,p.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,u.toDisposable)((()=>{for(const L of O)L.dispose()}))}}}s.CoreTerminal=E},8460:(w,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.forwardEvent=s.EventEmitter=void 0,s.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let u=0;u<this._listeners.length;u++)if(this._listeners[u]===a)return void this._listeners.splice(u,1)}}})),this._event}fire(a,u){const f=[];for(let d=0;d<this._listeners.length;d++)f.push(this._listeners[d]);for(let d=0;d<f.length;d++)f[d].call(void 0,a,u)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},s.forwardEvent=function(a,u){return a((f=>u.fire(f)))}},5435:function(w,s,a){var u=this&&this.__decorate||function(U,N,D,P){var B,q=arguments.length,K=q<3?N:P===null?P=Object.getOwnPropertyDescriptor(N,D):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate(U,N,D,P);else for(var $=U.length-1;$>=0;$--)(B=U[$])&&(K=(q<3?B(K):q>3?B(N,D,K):B(N,D))||K);return q>3&&K&&Object.defineProperty(N,D,K),K},f=this&&this.__param||function(U,N){return function(D,P){N(D,P,U)}};Object.defineProperty(s,"__esModule",{value:!0}),s.InputHandler=s.WindowsOptionsReportType=void 0;const d=a(2584),m=a(7116),g=a(2015),y=a(844),b=a(482),r=a(8437),o=a(8460),l=a(643),c=a(511),p=a(3734),_=a(2585),C=a(6242),k=a(6351),v=a(5941),E={"(":0,")":1,"*":2,"+":3,"-":1,".":2},R=131072;function O(U,N){if(U>24)return N.setWinLines||!1;switch(U){case 1:return!!N.restoreWin;case 2:return!!N.minimizeWin;case 3:return!!N.setWinPosition;case 4:return!!N.setWinSizePixels;case 5:return!!N.raiseWin;case 6:return!!N.lowerWin;case 7:return!!N.refreshWin;case 8:return!!N.setWinSizeChars;case 9:return!!N.maximizeWin;case 10:return!!N.fullscreenWin;case 11:return!!N.getWinState;case 13:return!!N.getWinPosition;case 14:return!!N.getWinSizePixels;case 15:return!!N.getScreenSizePixels;case 16:return!!N.getCellSizePixels;case 18:return!!N.getWinSizeChars;case 19:return!!N.getScreenSizeChars;case 20:return!!N.getIconTitle;case 21:return!!N.getWinTitle;case 22:return!!N.pushTitle;case 23:return!!N.popTitle;case 24:return!!N.setWinLines}return!1}var L;(function(U){U[U.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",U[U.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(L||(s.WindowsOptionsReportType=L={}));let T=0;class H extends y.Disposable{getAttrData(){return this._curAttrData}constructor(N,D,P,B,q,K,$,W,z=new g.EscapeSequenceParser){super(),this._bufferService=N,this._charsetService=D,this._coreService=P,this._logService=B,this._optionsService=q,this._oscLinkService=K,this._coreMouseService=$,this._unicodeService=W,this._parser=z,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new b.StringToUtf32,this._utf8Decoder=new b.Utf8ToUtf32,this._workCell=new c.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=r.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=r.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new o.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new o.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new o.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new o.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new o.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new o.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new o.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new o.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new o.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new o.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new o.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new o.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new o.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new M(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((j=>this._activeBuffer=j.activeBuffer))),this._parser.setCsiHandlerFallback(((j,I)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(j),params:I.toArray()})})),this._parser.setEscHandlerFallback((j=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(j)})})),this._parser.setExecuteHandlerFallback((j=>{this._logService.debug("Unknown EXECUTE code: ",{code:j})})),this._parser.setOscHandlerFallback(((j,I,X)=>{this._logService.debug("Unknown OSC code: ",{identifier:j,action:I,data:X})})),this._parser.setDcsHandlerFallback(((j,I,X)=>{I==="HOOK"&&(X=X.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(j),action:I,payload:X})})),this._parser.setPrintHandler(((j,I,X)=>this.print(j,I,X))),this._parser.registerCsiHandler({final:"@"},(j=>this.insertChars(j))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(j=>this.scrollLeft(j))),this._parser.registerCsiHandler({final:"A"},(j=>this.cursorUp(j))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(j=>this.scrollRight(j))),this._parser.registerCsiHandler({final:"B"},(j=>this.cursorDown(j))),this._parser.registerCsiHandler({final:"C"},(j=>this.cursorForward(j))),this._parser.registerCsiHandler({final:"D"},(j=>this.cursorBackward(j))),this._parser.registerCsiHandler({final:"E"},(j=>this.cursorNextLine(j))),this._parser.registerCsiHandler({final:"F"},(j=>this.cursorPrecedingLine(j))),this._parser.registerCsiHandler({final:"G"},(j=>this.cursorCharAbsolute(j))),this._parser.registerCsiHandler({final:"H"},(j=>this.cursorPosition(j))),this._parser.registerCsiHandler({final:"I"},(j=>this.cursorForwardTab(j))),this._parser.registerCsiHandler({final:"J"},(j=>this.eraseInDisplay(j,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(j=>this.eraseInDisplay(j,!0))),this._parser.registerCsiHandler({final:"K"},(j=>this.eraseInLine(j,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(j=>this.eraseInLine(j,!0))),this._parser.registerCsiHandler({final:"L"},(j=>this.insertLines(j))),this._parser.registerCsiHandler({final:"M"},(j=>this.deleteLines(j))),this._parser.registerCsiHandler({final:"P"},(j=>this.deleteChars(j))),this._parser.registerCsiHandler({final:"S"},(j=>this.scrollUp(j))),this._parser.registerCsiHandler({final:"T"},(j=>this.scrollDown(j))),this._parser.registerCsiHandler({final:"X"},(j=>this.eraseChars(j))),this._parser.registerCsiHandler({final:"Z"},(j=>this.cursorBackwardTab(j))),this._parser.registerCsiHandler({final:"`"},(j=>this.charPosAbsolute(j))),this._parser.registerCsiHandler({final:"a"},(j=>this.hPositionRelative(j))),this._parser.registerCsiHandler({final:"b"},(j=>this.repeatPrecedingCharacter(j))),this._parser.registerCsiHandler({final:"c"},(j=>this.sendDeviceAttributesPrimary(j))),this._parser.registerCsiHandler({prefix:">",final:"c"},(j=>this.sendDeviceAttributesSecondary(j))),this._parser.registerCsiHandler({final:"d"},(j=>this.linePosAbsolute(j))),this._parser.registerCsiHandler({final:"e"},(j=>this.vPositionRelative(j))),this._parser.registerCsiHandler({final:"f"},(j=>this.hVPosition(j))),this._parser.registerCsiHandler({final:"g"},(j=>this.tabClear(j))),this._parser.registerCsiHandler({final:"h"},(j=>this.setMode(j))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(j=>this.setModePrivate(j))),this._parser.registerCsiHandler({final:"l"},(j=>this.resetMode(j))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(j=>this.resetModePrivate(j))),this._parser.registerCsiHandler({final:"m"},(j=>this.charAttributes(j))),this._parser.registerCsiHandler({final:"n"},(j=>this.deviceStatus(j))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(j=>this.deviceStatusPrivate(j))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(j=>this.softReset(j))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(j=>this.setCursorStyle(j))),this._parser.registerCsiHandler({final:"r"},(j=>this.setScrollRegion(j))),this._parser.registerCsiHandler({final:"s"},(j=>this.saveCursor(j))),this._parser.registerCsiHandler({final:"t"},(j=>this.windowOptions(j))),this._parser.registerCsiHandler({final:"u"},(j=>this.restoreCursor(j))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(j=>this.insertColumns(j))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(j=>this.deleteColumns(j))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(j=>this.selectProtected(j))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(j=>this.requestMode(j,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(j=>this.requestMode(j,!1))),this._parser.setExecuteHandler(d.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(d.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(d.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(d.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(d.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(d.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(d.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(d.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(d.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new C.OscHandler((j=>(this.setTitle(j),this.setIconName(j),!0)))),this._parser.registerOscHandler(1,new C.OscHandler((j=>this.setIconName(j)))),this._parser.registerOscHandler(2,new C.OscHandler((j=>this.setTitle(j)))),this._parser.registerOscHandler(4,new C.OscHandler((j=>this.setOrReportIndexedColor(j)))),this._parser.registerOscHandler(8,new C.OscHandler((j=>this.setHyperlink(j)))),this._parser.registerOscHandler(10,new C.OscHandler((j=>this.setOrReportFgColor(j)))),this._parser.registerOscHandler(11,new C.OscHandler((j=>this.setOrReportBgColor(j)))),this._parser.registerOscHandler(12,new C.OscHandler((j=>this.setOrReportCursorColor(j)))),this._parser.registerOscHandler(104,new C.OscHandler((j=>this.restoreIndexedColor(j)))),this._parser.registerOscHandler(110,new C.OscHandler((j=>this.restoreFgColor(j)))),this._parser.registerOscHandler(111,new C.OscHandler((j=>this.restoreBgColor(j)))),this._parser.registerOscHandler(112,new C.OscHandler((j=>this.restoreCursorColor(j)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const j in m.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:j},(()=>this.selectCharset("("+j))),this._parser.registerEscHandler({intermediates:")",final:j},(()=>this.selectCharset(")"+j))),this._parser.registerEscHandler({intermediates:"*",final:j},(()=>this.selectCharset("*"+j))),this._parser.registerEscHandler({intermediates:"+",final:j},(()=>this.selectCharset("+"+j))),this._parser.registerEscHandler({intermediates:"-",final:j},(()=>this.selectCharset("-"+j))),this._parser.registerEscHandler({intermediates:".",final:j},(()=>this.selectCharset("."+j))),this._parser.registerEscHandler({intermediates:"/",final:j},(()=>this.selectCharset("/"+j)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((j=>(this._logService.error("Parsing error: ",j),j))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new k.DcsHandler(((j,I)=>this.requestStatusString(j,I))))}_preserveStack(N,D,P,B){this._parseStack.paused=!0,this._parseStack.cursorStartX=N,this._parseStack.cursorStartY=D,this._parseStack.decodedLength=P,this._parseStack.position=B}_logSlowResolvingAsync(N){this._logService.logLevel<=_.LogLevelEnum.WARN&&Promise.race([N,new Promise(((D,P)=>setTimeout((()=>P("#SLOW_TIMEOUT")),5e3)))]).catch((D=>{if(D!=="#SLOW_TIMEOUT")throw D;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(N,D){let P,B=this._activeBuffer.x,q=this._activeBuffer.y,K=0;const $=this._parseStack.paused;if($){if(P=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,D))return this._logSlowResolvingAsync(P),P;B=this._parseStack.cursorStartX,q=this._parseStack.cursorStartY,this._parseStack.paused=!1,N.length>R&&(K=this._parseStack.position+R)}if(this._logService.logLevel<=_.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof N=="string"?` "${N}"`:` "${Array.prototype.map.call(N,(W=>String.fromCharCode(W))).join("")}"`),typeof N=="string"?N.split("").map((W=>W.charCodeAt(0))):N),this._parseBuffer.length<N.length&&this._parseBuffer.length<R&&(this._parseBuffer=new Uint32Array(Math.min(N.length,R))),$||this._dirtyRowTracker.clearRange(),N.length>R)for(let W=K;W<N.length;W+=R){const z=W+R<N.length?W+R:N.length,j=typeof N=="string"?this._stringDecoder.decode(N.substring(W,z),this._parseBuffer):this._utf8Decoder.decode(N.subarray(W,z),this._parseBuffer);if(P=this._parser.parse(this._parseBuffer,j))return this._preserveStack(B,q,j,W),this._logSlowResolvingAsync(P),P}else if(!$){const W=typeof N=="string"?this._stringDecoder.decode(N,this._parseBuffer):this._utf8Decoder.decode(N,this._parseBuffer);if(P=this._parser.parse(this._parseBuffer,W))return this._preserveStack(B,q,W,0),this._logSlowResolvingAsync(P),P}this._activeBuffer.x===B&&this._activeBuffer.y===q||this._onCursorMove.fire(),this._onRequestRefreshRows.fire(this._dirtyRowTracker.start,this._dirtyRowTracker.end)}print(N,D,P){let B,q;const K=this._charsetService.charset,$=this._optionsService.rawOptions.screenReaderMode,W=this._bufferService.cols,z=this._coreService.decPrivateModes.wraparound,j=this._coreService.modes.insertMode,I=this._curAttrData;let X=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&P-D>0&&X.getWidth(this._activeBuffer.x-1)===2&&X.setCellFromCodePoint(this._activeBuffer.x-1,0,1,I.fg,I.bg,I.extended);for(let Y=D;Y<P;++Y){if(B=N[Y],q=this._unicodeService.wcwidth(B),B<127&&K){const Z=K[String.fromCharCode(B)];Z&&(B=Z.charCodeAt(0))}if($&&this._onA11yChar.fire((0,b.stringFromCodePoint)(B)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),q||!this._activeBuffer.x){if(this._activeBuffer.x+q-1>=W){if(z){for(;this._activeBuffer.x<W;)X.setCellFromCodePoint(this._activeBuffer.x++,0,1,I.fg,I.bg,I.extended);this._activeBuffer.x=0,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),X=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)}else if(this._activeBuffer.x=W-1,q===2)continue}if(j&&(X.insertCells(this._activeBuffer.x,q,this._activeBuffer.getNullCell(I),I),X.getWidth(W-1)===2&&X.setCellFromCodePoint(W-1,l.NULL_CELL_CODE,l.NULL_CELL_WIDTH,I.fg,I.bg,I.extended)),X.setCellFromCodePoint(this._activeBuffer.x++,B,q,I.fg,I.bg,I.extended),q>0)for(;--q;)X.setCellFromCodePoint(this._activeBuffer.x++,0,0,I.fg,I.bg,I.extended)}else X.getWidth(this._activeBuffer.x-1)?X.addCodepointToCell(this._activeBuffer.x-1,B):X.addCodepointToCell(this._activeBuffer.x-2,B)}P-D>0&&(X.loadCell(this._activeBuffer.x-1,this._workCell),this._workCell.getWidth()===2||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),this._activeBuffer.x<W&&P-D>0&&X.getWidth(this._activeBuffer.x)===0&&!X.hasContent(this._activeBuffer.x)&&X.setCellFromCodePoint(this._activeBuffer.x,0,1,I.fg,I.bg,I.extended),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(N,D){return N.final!=="t"||N.prefix||N.intermediates?this._parser.registerCsiHandler(N,D):this._parser.registerCsiHandler(N,(P=>!O(P.params[0],this._optionsService.rawOptions.windowOptions)||D(P)))}registerDcsHandler(N,D){return this._parser.registerDcsHandler(N,new k.DcsHandler(D))}registerEscHandler(N,D){return this._parser.registerEscHandler(N,D)}registerOscHandler(N,D){return this._parser.registerOscHandler(N,new C.OscHandler(D))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var N;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&(!((N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))===null||N===void 0)&&N.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);D.hasWidth(this._activeBuffer.x)&&!D.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const N=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-N),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(N=this._bufferService.cols-1){this._activeBuffer.x=Math.min(N,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(N,D){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=N,this._activeBuffer.y=this._activeBuffer.scrollTop+D):(this._activeBuffer.x=N,this._activeBuffer.y=D),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(N,D){this._restrictCursor(),this._setCursor(this._activeBuffer.x+N,this._activeBuffer.y+D)}cursorUp(N){const D=this._activeBuffer.y-this._activeBuffer.scrollTop;return D>=0?this._moveCursor(0,-Math.min(D,N.params[0]||1)):this._moveCursor(0,-(N.params[0]||1)),!0}cursorDown(N){const D=this._activeBuffer.scrollBottom-this._activeBuffer.y;return D>=0?this._moveCursor(0,Math.min(D,N.params[0]||1)):this._moveCursor(0,N.params[0]||1),!0}cursorForward(N){return this._moveCursor(N.params[0]||1,0),!0}cursorBackward(N){return this._moveCursor(-(N.params[0]||1),0),!0}cursorNextLine(N){return this.cursorDown(N),this._activeBuffer.x=0,!0}cursorPrecedingLine(N){return this.cursorUp(N),this._activeBuffer.x=0,!0}cursorCharAbsolute(N){return this._setCursor((N.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(N){return this._setCursor(N.length>=2?(N.params[1]||1)-1:0,(N.params[0]||1)-1),!0}charPosAbsolute(N){return this._setCursor((N.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(N){return this._moveCursor(N.params[0]||1,0),!0}linePosAbsolute(N){return this._setCursor(this._activeBuffer.x,(N.params[0]||1)-1),!0}vPositionRelative(N){return this._moveCursor(0,N.params[0]||1),!0}hVPosition(N){return this.cursorPosition(N),!0}tabClear(N){const D=N.params[0];return D===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:D===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(N){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let D=N.params[0]||1;for(;D--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(N){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let D=N.params[0]||1;for(;D--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(N){const D=N.params[0];return D===1&&(this._curAttrData.bg|=536870912),D!==2&&D!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(N,D,P,B=!1,q=!1){const K=this._activeBuffer.lines.get(this._activeBuffer.ybase+N);K.replaceCells(D,P,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData(),q),B&&(K.isWrapped=!1)}_resetBufferLine(N,D=!1){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+N);P&&(P.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),D),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+N),P.isWrapped=!1)}eraseInDisplay(N,D=!1){let P;switch(this._restrictCursor(this._bufferService.cols),N.params[0]){case 0:for(P=this._activeBuffer.y,this._dirtyRowTracker.markDirty(P),this._eraseInBufferLine(P++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,D);P<this._bufferService.rows;P++)this._resetBufferLine(P,D);this._dirtyRowTracker.markDirty(P);break;case 1:for(P=this._activeBuffer.y,this._dirtyRowTracker.markDirty(P),this._eraseInBufferLine(P,0,this._activeBuffer.x+1,!0,D),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(P+1).isWrapped=!1);P--;)this._resetBufferLine(P,D);this._dirtyRowTracker.markDirty(0);break;case 2:for(P=this._bufferService.rows,this._dirtyRowTracker.markDirty(P-1);P--;)this._resetBufferLine(P,D);this._dirtyRowTracker.markDirty(0);break;case 3:const B=this._activeBuffer.lines.length-this._bufferService.rows;B>0&&(this._activeBuffer.lines.trimStart(B),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-B,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-B,0),this._onScroll.fire(0))}return!0}eraseInLine(N,D=!1){switch(this._restrictCursor(this._bufferService.cols),N.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,D);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,D);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,D)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(N){this._restrictCursor();let D=N.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=this._activeBuffer.ybase+this._activeBuffer.y,B=this._bufferService.rows-1-this._activeBuffer.scrollBottom,q=this._bufferService.rows-1+this._activeBuffer.ybase-B+1;for(;D--;)this._activeBuffer.lines.splice(q-1,1),this._activeBuffer.lines.splice(P,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(N){this._restrictCursor();let D=N.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=this._activeBuffer.ybase+this._activeBuffer.y;let B;for(B=this._bufferService.rows-1-this._activeBuffer.scrollBottom,B=this._bufferService.rows-1+this._activeBuffer.ybase-B;D--;)this._activeBuffer.lines.splice(P,1),this._activeBuffer.lines.splice(B,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(N){this._restrictCursor();const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return D&&(D.insertCells(this._activeBuffer.x,N.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(N){this._restrictCursor();const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return D&&(D.deleteCells(this._activeBuffer.x,N.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(N){let D=N.params[0]||1;for(;D--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(N){let D=N.params[0]||1;for(;D--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(r.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(N){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=N.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);B.deleteCells(0,D,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),B.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(N){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=N.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);B.insertCells(0,D,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),B.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(N){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=N.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);B.insertCells(this._activeBuffer.x,D,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),B.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(N){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=N.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);B.deleteCells(this._activeBuffer.x,D,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),B.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(N){this._restrictCursor();const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return D&&(D.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(N.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(N){if(!this._parser.precedingCodepoint)return!0;const D=N.params[0]||1,P=new Uint32Array(D);for(let B=0;B<D;++B)P[B]=this._parser.precedingCodepoint;return this.print(P,0,P.length),!0}sendDeviceAttributesPrimary(N){return N.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(d.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(d.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(N){return N.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(d.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(d.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(N.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(d.C0.ESC+"[>83;40003;0c")),!0}_is(N){return(this._optionsService.rawOptions.termName+"").indexOf(N)===0}setMode(N){for(let D=0;D<N.length;D++)switch(N.params[D]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(N){for(let D=0;D<N.length;D++)switch(N.params[D]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,m.DEFAULT_CHARSET),this._charsetService.setgCharset(1,m.DEFAULT_CHARSET),this._charsetService.setgCharset(2,m.DEFAULT_CHARSET),this._charsetService.setgCharset(3,m.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(N){for(let D=0;D<N.length;D++)switch(N.params[D]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(N){for(let D=0;D<N.length;D++)switch(N.params[D]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),N.params[D]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(N,D){const P=this._coreService.decPrivateModes,{activeProtocol:B,activeEncoding:q}=this._coreMouseService,K=this._coreService,{buffers:$,cols:W}=this._bufferService,{active:z,alt:j}=$,I=this._optionsService.rawOptions,X=te=>te?1:2,Y=N.params[0];return Z=Y,G=D?Y===2?4:Y===4?X(K.modes.insertMode):Y===12?3:Y===20?X(I.convertEol):0:Y===1?X(P.applicationCursorKeys):Y===3?I.windowOptions.setWinLines?W===80?2:W===132?1:0:0:Y===6?X(P.origin):Y===7?X(P.wraparound):Y===8?3:Y===9?X(B==="X10"):Y===12?X(I.cursorBlink):Y===25?X(!K.isCursorHidden):Y===45?X(P.reverseWraparound):Y===66?X(P.applicationKeypad):Y===67?4:Y===1e3?X(B==="VT200"):Y===1002?X(B==="DRAG"):Y===1003?X(B==="ANY"):Y===1004?X(P.sendFocus):Y===1005?4:Y===1006?X(q==="SGR"):Y===1015?4:Y===1016?X(q==="SGR_PIXELS"):Y===1048?1:Y===47||Y===1047||Y===1049?X(z===j):Y===2004?X(P.bracketedPasteMode):0,K.triggerDataEvent(`${d.C0.ESC}[${D?"":"?"}${Z};${G}$y`),!0;var Z,G}_updateAttrColor(N,D,P,B,q){return D===2?(N|=50331648,N&=-16777216,N|=p.AttributeData.fromColorRGB([P,B,q])):D===5&&(N&=-50331904,N|=33554432|255&P),N}_extractColor(N,D,P){const B=[0,0,-1,0,0,0];let q=0,K=0;do{if(B[K+q]=N.params[D+K],N.hasSubParams(D+K)){const $=N.getSubParams(D+K);let W=0;do B[1]===5&&(q=1),B[K+W+1+q]=$[W];while(++W<$.length&&W+K+1+q<B.length);break}if(B[1]===5&&K+q>=2||B[1]===2&&K+q>=5)break;B[1]&&(q=1)}while(++K+D<N.length&&K+q<B.length);for(let $=2;$<B.length;++$)B[$]===-1&&(B[$]=0);switch(B[0]){case 38:P.fg=this._updateAttrColor(P.fg,B[1],B[3],B[4],B[5]);break;case 48:P.bg=this._updateAttrColor(P.bg,B[1],B[3],B[4],B[5]);break;case 58:P.extended=P.extended.clone(),P.extended.underlineColor=this._updateAttrColor(P.extended.underlineColor,B[1],B[3],B[4],B[5])}return K}_processUnderline(N,D){D.extended=D.extended.clone(),(!~N||N>5)&&(N=1),D.extended.underlineStyle=N,D.fg|=268435456,N===0&&(D.fg&=-268435457),D.updateExtended()}_processSGR0(N){N.fg=r.DEFAULT_ATTR_DATA.fg,N.bg=r.DEFAULT_ATTR_DATA.bg,N.extended=N.extended.clone(),N.extended.underlineStyle=0,N.extended.underlineColor&=-67108864,N.updateExtended()}charAttributes(N){if(N.length===1&&N.params[0]===0)return this._processSGR0(this._curAttrData),!0;const D=N.length;let P;const B=this._curAttrData;for(let q=0;q<D;q++)P=N.params[q],P>=30&&P<=37?(B.fg&=-50331904,B.fg|=16777216|P-30):P>=40&&P<=47?(B.bg&=-50331904,B.bg|=16777216|P-40):P>=90&&P<=97?(B.fg&=-50331904,B.fg|=16777224|P-90):P>=100&&P<=107?(B.bg&=-50331904,B.bg|=16777224|P-100):P===0?this._processSGR0(B):P===1?B.fg|=134217728:P===3?B.bg|=67108864:P===4?(B.fg|=268435456,this._processUnderline(N.hasSubParams(q)?N.getSubParams(q)[0]:1,B)):P===5?B.fg|=536870912:P===7?B.fg|=67108864:P===8?B.fg|=1073741824:P===9?B.fg|=2147483648:P===2?B.bg|=134217728:P===21?this._processUnderline(2,B):P===22?(B.fg&=-134217729,B.bg&=-134217729):P===23?B.bg&=-67108865:P===24?(B.fg&=-268435457,this._processUnderline(0,B)):P===25?B.fg&=-536870913:P===27?B.fg&=-67108865:P===28?B.fg&=-1073741825:P===29?B.fg&=2147483647:P===39?(B.fg&=-67108864,B.fg|=16777215&r.DEFAULT_ATTR_DATA.fg):P===49?(B.bg&=-67108864,B.bg|=16777215&r.DEFAULT_ATTR_DATA.bg):P===38||P===48||P===58?q+=this._extractColor(N,q,B):P===53?B.bg|=1073741824:P===55?B.bg&=-1073741825:P===59?(B.extended=B.extended.clone(),B.extended.underlineColor=-1,B.updateExtended()):P===100?(B.fg&=-67108864,B.fg|=16777215&r.DEFAULT_ATTR_DATA.fg,B.bg&=-67108864,B.bg|=16777215&r.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",P);return!0}deviceStatus(N){switch(N.params[0]){case 5:this._coreService.triggerDataEvent(`${d.C0.ESC}[0n`);break;case 6:const D=this._activeBuffer.y+1,P=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[${D};${P}R`)}return!0}deviceStatusPrivate(N){if(N.params[0]===6){const D=this._activeBuffer.y+1,P=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[?${D};${P}R`)}return!0}softReset(N){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=r.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(N){const D=N.params[0]||1;switch(D){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const P=D%2==1;return this._optionsService.options.cursorBlink=P,!0}setScrollRegion(N){const D=N.params[0]||1;let P;return(N.length<2||(P=N.params[1])>this._bufferService.rows||P===0)&&(P=this._bufferService.rows),P>D&&(this._activeBuffer.scrollTop=D-1,this._activeBuffer.scrollBottom=P-1,this._setCursor(0,0)),!0}windowOptions(N){if(!O(N.params[0],this._optionsService.rawOptions.windowOptions))return!0;const D=N.length>1?N.params[1]:0;switch(N.params[0]){case 14:D!==2&&this._onRequestWindowsOptionsReport.fire(L.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(L.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${d.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:D!==0&&D!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),D!==0&&D!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:D!==0&&D!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),D!==0&&D!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(N){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(N){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(N){return this._windowTitle=N,this._onTitleChange.fire(N),!0}setIconName(N){return this._iconName=N,!0}setOrReportIndexedColor(N){const D=[],P=N.split(";");for(;P.length>1;){const B=P.shift(),q=P.shift();if(/^\d+$/.exec(B)){const K=parseInt(B);if(F(K))if(q==="?")D.push({type:0,index:K});else{const $=(0,v.parseColor)(q);$&&D.push({type:1,index:K,color:$})}}}return D.length&&this._onColor.fire(D),!0}setHyperlink(N){const D=N.split(";");return!(D.length<2)&&(D[1]?this._createHyperlink(D[0],D[1]):!D[0]&&this._finishHyperlink())}_createHyperlink(N,D){this._getCurrentLinkId()&&this._finishHyperlink();const P=N.split(":");let B;const q=P.findIndex((K=>K.startsWith("id=")));return q!==-1&&(B=P[q].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:B,uri:D}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(N,D){const P=N.split(";");for(let B=0;B<P.length&&!(D>=this._specialColors.length);++B,++D)if(P[B]==="?")this._onColor.fire([{type:0,index:this._specialColors[D]}]);else{const q=(0,v.parseColor)(P[B]);q&&this._onColor.fire([{type:1,index:this._specialColors[D],color:q}])}return!0}setOrReportFgColor(N){return this._setOrReportSpecialColor(N,0)}setOrReportBgColor(N){return this._setOrReportSpecialColor(N,1)}setOrReportCursorColor(N){return this._setOrReportSpecialColor(N,2)}restoreIndexedColor(N){if(!N)return this._onColor.fire([{type:2}]),!0;const D=[],P=N.split(";");for(let B=0;B<P.length;++B)if(/^\d+$/.exec(P[B])){const q=parseInt(P[B]);F(q)&&D.push({type:2,index:q})}return D.length&&this._onColor.fire(D),!0}restoreFgColor(N){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(N){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(N){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,m.DEFAULT_CHARSET),!0}selectCharset(N){return N.length!==2?(this.selectDefaultCharset(),!0):(N[0]==="/"||this._charsetService.setgCharset(E[N[0]],m.CHARSETS[N[1]]||m.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const N=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,N,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=r.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=r.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(N){return this._charsetService.setgLevel(N),!0}screenAlignmentPattern(){const N=new c.CellData;N.content=4194373,N.fg=this._curAttrData.fg,N.bg=this._curAttrData.bg,this._setCursor(0,0);for(let D=0;D<this._bufferService.rows;++D){const P=this._activeBuffer.ybase+this._activeBuffer.y+D,B=this._activeBuffer.lines.get(P);B&&(B.fill(N),B.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(N,D){const P=this._bufferService.buffer,B=this._optionsService.rawOptions;return(q=>(this._coreService.triggerDataEvent(`${d.C0.ESC}${q}${d.C0.ESC}\\`),!0))(N==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:N==='"p'?'P1$r61;1"p':N==="r"?`P1$r${P.scrollTop+1};${P.scrollBottom+1}r`:N==="m"?"P1$r0m":N===" q"?`P1$r${{block:2,underline:4,bar:6}[B.cursorStyle]-(B.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(N,D){this._dirtyRowTracker.markRangeDirty(N,D)}}s.InputHandler=H;let M=class{constructor(U){this._bufferService=U,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(U){U<this.start?this.start=U:U>this.end&&(this.end=U)}markRangeDirty(U,N){U>N&&(T=U,U=N,N=T),U<this.start&&(this.start=U),N>this.end&&(this.end=N)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function F(U){return 0<=U&&U<256}M=u([f(0,_.IBufferService)],M)},844:(w,s)=>{function a(u){for(const f of u)f.dispose();u.length=0}Object.defineProperty(s,"__esModule",{value:!0}),s.getDisposeArrayDisposable=s.disposeArray=s.toDisposable=s.MutableDisposable=s.Disposable=void 0,s.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const u of this._disposables)u.dispose();this._disposables.length=0}register(u){return this._disposables.push(u),u}unregister(u){const f=this._disposables.indexOf(u);f!==-1&&this._disposables.splice(f,1)}},s.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(u){var f;this._isDisposed||u===this._value||((f=this._value)===null||f===void 0||f.dispose(),this._value=u)}clear(){this.value=void 0}dispose(){var u;this._isDisposed=!0,(u=this._value)===null||u===void 0||u.dispose(),this._value=void 0}},s.toDisposable=function(u){return{dispose:u}},s.disposeArray=a,s.getDisposeArrayDisposable=function(u){return{dispose:()=>a(u)}}},1505:(w,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.FourKeyMap=s.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(f,d,m){this._data[f]||(this._data[f]={}),this._data[f][d]=m}get(f,d){return this._data[f]?this._data[f][d]:void 0}clear(){this._data={}}}s.TwoKeyMap=a,s.FourKeyMap=class{constructor(){this._data=new a}set(u,f,d,m,g){this._data.get(u,f)||this._data.set(u,f,new a),this._data.get(u,f).set(d,m,g)}get(u,f,d,m){var g;return(g=this._data.get(u,f))===null||g===void 0?void 0:g.get(d,m)}clear(){this._data.clear()}}},6114:(w,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.isChromeOS=s.isLinux=s.isWindows=s.isIphone=s.isIpad=s.isMac=s.getSafariVersion=s.isSafari=s.isLegacyEdge=s.isFirefox=s.isNode=void 0,s.isNode=typeof navigator>"u";const a=s.isNode?"node":navigator.userAgent,u=s.isNode?"node":navigator.platform;s.isFirefox=a.includes("Firefox"),s.isLegacyEdge=a.includes("Edge"),s.isSafari=/^((?!chrome|android).)*safari/i.test(a),s.getSafariVersion=function(){if(!s.isSafari)return 0;const f=a.match(/Version\/(\d+)/);return f===null||f.length<2?0:parseInt(f[1])},s.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(u),s.isIpad=u==="iPad",s.isIphone=u==="iPhone",s.isWindows=["Windows","Win16","Win32","WinCE"].includes(u),s.isLinux=u.indexOf("Linux")>=0,s.isChromeOS=/\bCrOS\b/.test(a)},6106:(w,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SortedList=void 0;let a=0;s.SortedList=class{constructor(u){this._getKey=u,this._array=[]}clear(){this._array.length=0}insert(u){this._array.length!==0?(a=this._search(this._getKey(u)),this._array.splice(a,0,u)):this._array.push(u)}delete(u){if(this._array.length===0)return!1;const f=this._getKey(u);if(f===void 0||(a=this._search(f),a===-1)||this._getKey(this._array[a])!==f)return!1;do if(this._array[a]===u)return this._array.splice(a,1),!0;while(++a<this._array.length&&this._getKey(this._array[a])===f);return!1}*getKeyIterator(u){if(this._array.length!==0&&(a=this._search(u),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===u))do yield this._array[a];while(++a<this._array.length&&this._getKey(this._array[a])===u)}forEachByKey(u,f){if(this._array.length!==0&&(a=this._search(u),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===u))do f(this._array[a]);while(++a<this._array.length&&this._getKey(this._array[a])===u)}values(){return[...this._array].values()}_search(u){let f=0,d=this._array.length-1;for(;d>=f;){let m=f+d>>1;const g=this._getKey(this._array[m]);if(g>u)d=m-1;else{if(!(g<u)){for(;m>0&&this._getKey(this._array[m-1])===u;)m--;return m}f=m+1}}return f}}},7226:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DebouncedIdleTask=s.IdleTaskQueue=s.PriorityTaskQueue=void 0;const u=a(6114);class f{constructor(){this._tasks=[],this._i=0}enqueue(g){this._tasks.push(g),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(g){this._idleCallback=void 0;let y=0,b=0,r=g.timeRemaining(),o=0;for(;this._i<this._tasks.length;){if(y=Date.now(),this._tasks[this._i]()||this._i++,y=Math.max(1,Date.now()-y),b=Math.max(y,b),o=g.timeRemaining(),1.5*b>o)return r-y<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-y))}ms`),void this._start();r=o}this.clear()}}class d extends f{_requestCallback(g){return setTimeout((()=>g(this._createDeadline(16))))}_cancelCallback(g){clearTimeout(g)}_createDeadline(g){const y=Date.now()+g;return{timeRemaining:()=>Math.max(0,y-Date.now())}}}s.PriorityTaskQueue=d,s.IdleTaskQueue=!u.isNode&&"requestIdleCallback"in window?class extends f{_requestCallback(m){return requestIdleCallback(m)}_cancelCallback(m){cancelIdleCallback(m)}}:d,s.DebouncedIdleTask=class{constructor(){this._queue=new s.IdleTaskQueue}set(m){this._queue.clear(),this._queue.enqueue(m)}flush(){this._queue.flush()}}},9282:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.updateWindowsModeWrappedState=void 0;const u=a(643);s.updateWindowsModeWrappedState=function(f){const d=f.buffer.lines.get(f.buffer.ybase+f.buffer.y-1),m=d?.get(f.cols-1),g=f.buffer.lines.get(f.buffer.ybase+f.buffer.y);g&&m&&(g.isWrapped=m[u.CHAR_DATA_CODE_INDEX]!==u.NULL_CELL_CODE&&m[u.CHAR_DATA_CODE_INDEX]!==u.WHITESPACE_CELL_CODE)}},3734:(w,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ExtendedAttrs=s.AttributeData=void 0;class a{constructor(){this.fg=0,this.bg=0,this.extended=new u}static toColorRGB(d){return[d>>>16&255,d>>>8&255,255&d]}static fromColorRGB(d){return(255&d[0])<<16|(255&d[1])<<8|255&d[2]}clone(){const d=new a;return d.fg=this.fg,d.bg=this.bg,d.extended=this.extended.clone(),d}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}}s.AttributeData=a;class u{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(d){this._ext=d}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(d){this._ext&=-469762049,this._ext|=d<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(d){this._ext&=-67108864,this._ext|=67108863&d}get urlId(){return this._urlId}set urlId(d){this._urlId=d}constructor(d=0,m=0){this._ext=0,this._urlId=0,this._ext=d,this._urlId=m}clone(){return new u(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}s.ExtendedAttrs=u},9092:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Buffer=s.MAX_BUFFER_SIZE=void 0;const u=a(6349),f=a(7226),d=a(3734),m=a(8437),g=a(4634),y=a(511),b=a(643),r=a(4863),o=a(7116);s.MAX_BUFFER_SIZE=4294967295,s.Buffer=class{constructor(l,c,p){this._hasScrollback=l,this._optionsService=c,this._bufferService=p,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=m.DEFAULT_ATTR_DATA.clone(),this.savedCharset=o.DEFAULT_CHARSET,this.markers=[],this._nullCell=y.CellData.fromCharData([0,b.NULL_CELL_CHAR,b.NULL_CELL_WIDTH,b.NULL_CELL_CODE]),this._whitespaceCell=y.CellData.fromCharData([0,b.WHITESPACE_CELL_CHAR,b.WHITESPACE_CELL_WIDTH,b.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new f.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new u.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(l){return l?(this._nullCell.fg=l.fg,this._nullCell.bg=l.bg,this._nullCell.extended=l.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new d.ExtendedAttrs),this._nullCell}getWhitespaceCell(l){return l?(this._whitespaceCell.fg=l.fg,this._whitespaceCell.bg=l.bg,this._whitespaceCell.extended=l.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new d.ExtendedAttrs),this._whitespaceCell}getBlankLine(l,c){return new m.BufferLine(this._bufferService.cols,this.getNullCell(l),c)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const l=this.ybase+this.y-this.ydisp;return l>=0&&l<this._rows}_getCorrectBufferLength(l){if(!this._hasScrollback)return l;const c=l+this._optionsService.rawOptions.scrollback;return c>s.MAX_BUFFER_SIZE?s.MAX_BUFFER_SIZE:c}fillViewportRows(l){if(this.lines.length===0){l===void 0&&(l=m.DEFAULT_ATTR_DATA);let c=this._rows;for(;c--;)this.lines.push(this.getBlankLine(l))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new u.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(l,c){const p=this.getNullCell(m.DEFAULT_ATTR_DATA);let _=0;const C=this._getCorrectBufferLength(c);if(C>this.lines.maxLength&&(this.lines.maxLength=C),this.lines.length>0){if(this._cols<l)for(let v=0;v<this.lines.length;v++)_+=+this.lines.get(v).resize(l,p);let k=0;if(this._rows<c)for(let v=this._rows;v<c;v++)this.lines.length<c+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new m.BufferLine(l,p)):this.ybase>0&&this.lines.length<=this.ybase+this.y+k+1?(this.ybase--,k++,this.ydisp>0&&this.ydisp--):this.lines.push(new m.BufferLine(l,p)));else for(let v=this._rows;v>c;v--)this.lines.length>c+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(C<this.lines.maxLength){const v=this.lines.length-C;v>0&&(this.lines.trimStart(v),this.ybase=Math.max(this.ybase-v,0),this.ydisp=Math.max(this.ydisp-v,0),this.savedY=Math.max(this.savedY-v,0)),this.lines.maxLength=C}this.x=Math.min(this.x,l-1),this.y=Math.min(this.y,c-1),k&&(this.y+=k),this.savedX=Math.min(this.savedX,l-1),this.scrollTop=0}if(this.scrollBottom=c-1,this._isReflowEnabled&&(this._reflow(l,c),this._cols>l))for(let k=0;k<this.lines.length;k++)_+=+this.lines.get(k).resize(l,p);this._cols=l,this._rows=c,this._memoryCleanupQueue.clear(),_>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let l=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,l=!1);let c=0;for(;this._memoryCleanupPosition<this.lines.length;)if(c+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),c>100)return!0;return l}get _isReflowEnabled(){const l=this._optionsService.rawOptions.windowsPty;return l&&l.buildNumber?this._hasScrollback&&l.backend==="conpty"&&l.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(l,c){this._cols!==l&&(l>this._cols?this._reflowLarger(l,c):this._reflowSmaller(l,c))}_reflowLarger(l,c){const p=(0,g.reflowLargerGetLinesToRemove)(this.lines,this._cols,l,this.ybase+this.y,this.getNullCell(m.DEFAULT_ATTR_DATA));if(p.length>0){const _=(0,g.reflowLargerCreateNewLayout)(this.lines,p);(0,g.reflowLargerApplyNewLayout)(this.lines,_.layout),this._reflowLargerAdjustViewport(l,c,_.countRemoved)}}_reflowLargerAdjustViewport(l,c,p){const _=this.getNullCell(m.DEFAULT_ATTR_DATA);let C=p;for(;C-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<c&&this.lines.push(new m.BufferLine(l,_))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-p,0)}_reflowSmaller(l,c){const p=this.getNullCell(m.DEFAULT_ATTR_DATA),_=[];let C=0;for(let k=this.lines.length-1;k>=0;k--){let v=this.lines.get(k);if(!v||!v.isWrapped&&v.getTrimmedLength()<=l)continue;const E=[v];for(;v.isWrapped&&k>0;)v=this.lines.get(--k),E.unshift(v);const R=this.ybase+this.y;if(R>=k&&R<k+E.length)continue;const O=E[E.length-1].getTrimmedLength(),L=(0,g.reflowSmallerGetNewLineLengths)(E,this._cols,l),T=L.length-E.length;let H;H=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+T):Math.max(0,this.lines.length-this.lines.maxLength+T);const M=[];for(let B=0;B<T;B++){const q=this.getBlankLine(m.DEFAULT_ATTR_DATA,!0);M.push(q)}M.length>0&&(_.push({start:k+E.length+C,newLines:M}),C+=M.length),E.push(...M);let F=L.length-1,U=L[F];U===0&&(F--,U=L[F]);let N=E.length-T-1,D=O;for(;N>=0;){const B=Math.min(D,U);if(E[F]===void 0)break;if(E[F].copyCellsFrom(E[N],D-B,U-B,B,!0),U-=B,U===0&&(F--,U=L[F]),D-=B,D===0){N--;const q=Math.max(N,0);D=(0,g.getWrappedLineTrimmedLength)(E,q,this._cols)}}for(let B=0;B<E.length;B++)L[B]<l&&E[B].setCell(L[B],p);let P=T-H;for(;P-- >0;)this.ybase===0?this.y<c-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+C)-c&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+T,this.ybase+c-1)}if(_.length>0){const k=[],v=[];for(let F=0;F<this.lines.length;F++)v.push(this.lines.get(F));const E=this.lines.length;let R=E-1,O=0,L=_[O];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+C);let T=0;for(let F=Math.min(this.lines.maxLength-1,E+C-1);F>=0;F--)if(L&&L.start>R+T){for(let U=L.newLines.length-1;U>=0;U--)this.lines.set(F--,L.newLines[U]);F++,k.push({index:R+1,amount:L.newLines.length}),T+=L.newLines.length,L=_[++O]}else this.lines.set(F,v[R--]);let H=0;for(let F=k.length-1;F>=0;F--)k[F].index+=H,this.lines.onInsertEmitter.fire(k[F]),H+=k[F].amount;const M=Math.max(0,E+C-this.lines.maxLength);M>0&&this.lines.onTrimEmitter.fire(M)}}translateBufferLineToString(l,c,p=0,_){const C=this.lines.get(l);return C?C.translateToString(c,p,_):""}getWrappedRangeForLine(l){let c=l,p=l;for(;c>0&&this.lines.get(c).isWrapped;)c--;for(;p+1<this.lines.length&&this.lines.get(p+1).isWrapped;)p++;return{first:c,last:p}}setupTabStops(l){for(l!=null?this.tabs[l]||(l=this.prevStop(l)):(this.tabs={},l=0);l<this._cols;l+=this._optionsService.rawOptions.tabStopWidth)this.tabs[l]=!0}prevStop(l){for(l==null&&(l=this.x);!this.tabs[--l]&&l>0;);return l>=this._cols?this._cols-1:l<0?0:l}nextStop(l){for(l==null&&(l=this.x);!this.tabs[++l]&&l<this._cols;);return l>=this._cols?this._cols-1:l<0?0:l}clearMarkers(l){this._isClearing=!0;for(let c=0;c<this.markers.length;c++)this.markers[c].line===l&&(this.markers[c].dispose(),this.markers.splice(c--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let l=0;l<this.markers.length;l++)this.markers[l].dispose(),this.markers.splice(l--,1);this._isClearing=!1}addMarker(l){const c=new r.Marker(l);return this.markers.push(c),c.register(this.lines.onTrim((p=>{c.line-=p,c.line<0&&c.dispose()}))),c.register(this.lines.onInsert((p=>{c.line>=p.index&&(c.line+=p.amount)}))),c.register(this.lines.onDelete((p=>{c.line>=p.index&&c.line<p.index+p.amount&&c.dispose(),c.line>p.index&&(c.line-=p.amount)}))),c.register(c.onDispose((()=>this._removeMarker(c)))),c}_removeMarker(l){this._isClearing||this.markers.splice(this.markers.indexOf(l),1)}}},8437:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLine=s.DEFAULT_ATTR_DATA=void 0;const u=a(3734),f=a(511),d=a(643),m=a(482);s.DEFAULT_ATTR_DATA=Object.freeze(new u.AttributeData);let g=0;class y{constructor(r,o,l=!1){this.isWrapped=l,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*r);const c=o||f.CellData.fromCharData([0,d.NULL_CELL_CHAR,d.NULL_CELL_WIDTH,d.NULL_CELL_CODE]);for(let p=0;p<r;++p)this.setCell(p,c);this.length=r}get(r){const o=this._data[3*r+0],l=2097151&o;return[this._data[3*r+1],2097152&o?this._combined[r]:l?(0,m.stringFromCodePoint)(l):"",o>>22,2097152&o?this._combined[r].charCodeAt(this._combined[r].length-1):l]}set(r,o){this._data[3*r+1]=o[d.CHAR_DATA_ATTR_INDEX],o[d.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[r]=o[1],this._data[3*r+0]=2097152|r|o[d.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*r+0]=o[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|o[d.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(r){return this._data[3*r+0]>>22}hasWidth(r){return 12582912&this._data[3*r+0]}getFg(r){return this._data[3*r+1]}getBg(r){return this._data[3*r+2]}hasContent(r){return 4194303&this._data[3*r+0]}getCodePoint(r){const o=this._data[3*r+0];return 2097152&o?this._combined[r].charCodeAt(this._combined[r].length-1):2097151&o}isCombined(r){return 2097152&this._data[3*r+0]}getString(r){const o=this._data[3*r+0];return 2097152&o?this._combined[r]:2097151&o?(0,m.stringFromCodePoint)(2097151&o):""}isProtected(r){return 536870912&this._data[3*r+2]}loadCell(r,o){return g=3*r,o.content=this._data[g+0],o.fg=this._data[g+1],o.bg=this._data[g+2],2097152&o.content&&(o.combinedData=this._combined[r]),268435456&o.bg&&(o.extended=this._extendedAttrs[r]),o}setCell(r,o){2097152&o.content&&(this._combined[r]=o.combinedData),268435456&o.bg&&(this._extendedAttrs[r]=o.extended),this._data[3*r+0]=o.content,this._data[3*r+1]=o.fg,this._data[3*r+2]=o.bg}setCellFromCodePoint(r,o,l,c,p,_){268435456&p&&(this._extendedAttrs[r]=_),this._data[3*r+0]=o|l<<22,this._data[3*r+1]=c,this._data[3*r+2]=p}addCodepointToCell(r,o){let l=this._data[3*r+0];2097152&l?this._combined[r]+=(0,m.stringFromCodePoint)(o):(2097151&l?(this._combined[r]=(0,m.stringFromCodePoint)(2097151&l)+(0,m.stringFromCodePoint)(o),l&=-2097152,l|=2097152):l=o|4194304,this._data[3*r+0]=l)}insertCells(r,o,l,c){if((r%=this.length)&&this.getWidth(r-1)===2&&this.setCellFromCodePoint(r-1,0,1,c?.fg||0,c?.bg||0,c?.extended||new u.ExtendedAttrs),o<this.length-r){const p=new f.CellData;for(let _=this.length-r-o-1;_>=0;--_)this.setCell(r+o+_,this.loadCell(r+_,p));for(let _=0;_<o;++_)this.setCell(r+_,l)}else for(let p=r;p<this.length;++p)this.setCell(p,l);this.getWidth(this.length-1)===2&&this.setCellFromCodePoint(this.length-1,0,1,c?.fg||0,c?.bg||0,c?.extended||new u.ExtendedAttrs)}deleteCells(r,o,l,c){if(r%=this.length,o<this.length-r){const p=new f.CellData;for(let _=0;_<this.length-r-o;++_)this.setCell(r+_,this.loadCell(r+o+_,p));for(let _=this.length-o;_<this.length;++_)this.setCell(_,l)}else for(let p=r;p<this.length;++p)this.setCell(p,l);r&&this.getWidth(r-1)===2&&this.setCellFromCodePoint(r-1,0,1,c?.fg||0,c?.bg||0,c?.extended||new u.ExtendedAttrs),this.getWidth(r)!==0||this.hasContent(r)||this.setCellFromCodePoint(r,0,1,c?.fg||0,c?.bg||0,c?.extended||new u.ExtendedAttrs)}replaceCells(r,o,l,c,p=!1){if(p)for(r&&this.getWidth(r-1)===2&&!this.isProtected(r-1)&&this.setCellFromCodePoint(r-1,0,1,c?.fg||0,c?.bg||0,c?.extended||new u.ExtendedAttrs),o<this.length&&this.getWidth(o-1)===2&&!this.isProtected(o)&&this.setCellFromCodePoint(o,0,1,c?.fg||0,c?.bg||0,c?.extended||new u.ExtendedAttrs);r<o&&r<this.length;)this.isProtected(r)||this.setCell(r,l),r++;else for(r&&this.getWidth(r-1)===2&&this.setCellFromCodePoint(r-1,0,1,c?.fg||0,c?.bg||0,c?.extended||new u.ExtendedAttrs),o<this.length&&this.getWidth(o-1)===2&&this.setCellFromCodePoint(o,0,1,c?.fg||0,c?.bg||0,c?.extended||new u.ExtendedAttrs);r<o&&r<this.length;)this.setCell(r++,l)}resize(r,o){if(r===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const l=3*r;if(r>this.length){if(this._data.buffer.byteLength>=4*l)this._data=new Uint32Array(this._data.buffer,0,l);else{const c=new Uint32Array(l);c.set(this._data),this._data=c}for(let c=this.length;c<r;++c)this.setCell(c,o)}else{this._data=this._data.subarray(0,l);const c=Object.keys(this._combined);for(let _=0;_<c.length;_++){const C=parseInt(c[_],10);C>=r&&delete this._combined[C]}const p=Object.keys(this._extendedAttrs);for(let _=0;_<p.length;_++){const C=parseInt(p[_],10);C>=r&&delete this._extendedAttrs[C]}}return this.length=r,4*l*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const r=new Uint32Array(this._data.length);return r.set(this._data),this._data=r,1}return 0}fill(r,o=!1){if(o)for(let l=0;l<this.length;++l)this.isProtected(l)||this.setCell(l,r);else{this._combined={},this._extendedAttrs={};for(let l=0;l<this.length;++l)this.setCell(l,r)}}copyFrom(r){this.length!==r.length?this._data=new Uint32Array(r._data):this._data.set(r._data),this.length=r.length,this._combined={};for(const o in r._combined)this._combined[o]=r._combined[o];this._extendedAttrs={};for(const o in r._extendedAttrs)this._extendedAttrs[o]=r._extendedAttrs[o];this.isWrapped=r.isWrapped}clone(){const r=new y(0);r._data=new Uint32Array(this._data),r.length=this.length;for(const o in this._combined)r._combined[o]=this._combined[o];for(const o in this._extendedAttrs)r._extendedAttrs[o]=this._extendedAttrs[o];return r.isWrapped=this.isWrapped,r}getTrimmedLength(){for(let r=this.length-1;r>=0;--r)if(4194303&this._data[3*r+0])return r+(this._data[3*r+0]>>22);return 0}getNoBgTrimmedLength(){for(let r=this.length-1;r>=0;--r)if(4194303&this._data[3*r+0]||50331648&this._data[3*r+2])return r+(this._data[3*r+0]>>22);return 0}copyCellsFrom(r,o,l,c,p){const _=r._data;if(p)for(let k=c-1;k>=0;k--){for(let v=0;v<3;v++)this._data[3*(l+k)+v]=_[3*(o+k)+v];268435456&_[3*(o+k)+2]&&(this._extendedAttrs[l+k]=r._extendedAttrs[o+k])}else for(let k=0;k<c;k++){for(let v=0;v<3;v++)this._data[3*(l+k)+v]=_[3*(o+k)+v];268435456&_[3*(o+k)+2]&&(this._extendedAttrs[l+k]=r._extendedAttrs[o+k])}const C=Object.keys(r._combined);for(let k=0;k<C.length;k++){const v=parseInt(C[k],10);v>=o&&(this._combined[v-o+l]=r._combined[v])}}translateToString(r=!1,o=0,l=this.length){r&&(l=Math.min(l,this.getTrimmedLength()));let c="";for(;o<l;){const p=this._data[3*o+0],_=2097151&p;c+=2097152&p?this._combined[o]:_?(0,m.stringFromCodePoint)(_):d.WHITESPACE_CELL_CHAR,o+=p>>22||1}return c}}s.BufferLine=y},4841:(w,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.getRangeLength=void 0,s.getRangeLength=function(a,u){if(a.start.y>a.end.y)throw new Error(`Buffer range end (${a.end.x}, ${a.end.y}) cannot be before start (${a.start.x}, ${a.start.y})`);return u*(a.end.y-a.start.y)+(a.end.x-a.start.x+1)}},4634:(w,s)=>{function a(u,f,d){if(f===u.length-1)return u[f].getTrimmedLength();const m=!u[f].hasContent(d-1)&&u[f].getWidth(d-1)===1,g=u[f+1].getWidth(0)===2;return m&&g?d-1:d}Object.defineProperty(s,"__esModule",{value:!0}),s.getWrappedLineTrimmedLength=s.reflowSmallerGetNewLineLengths=s.reflowLargerApplyNewLayout=s.reflowLargerCreateNewLayout=s.reflowLargerGetLinesToRemove=void 0,s.reflowLargerGetLinesToRemove=function(u,f,d,m,g){const y=[];for(let b=0;b<u.length-1;b++){let r=b,o=u.get(++r);if(!o.isWrapped)continue;const l=[u.get(b)];for(;r<u.length&&o.isWrapped;)l.push(o),o=u.get(++r);if(m>=b&&m<r){b+=l.length-1;continue}let c=0,p=a(l,c,f),_=1,C=0;for(;_<l.length;){const v=a(l,_,f),E=v-C,R=d-p,O=Math.min(E,R);l[c].copyCellsFrom(l[_],C,p,O,!1),p+=O,p===d&&(c++,p=0),C+=O,C===v&&(_++,C=0),p===0&&c!==0&&l[c-1].getWidth(d-1)===2&&(l[c].copyCellsFrom(l[c-1],d-1,p++,1,!1),l[c-1].setCell(d-1,g))}l[c].replaceCells(p,d,g);let k=0;for(let v=l.length-1;v>0&&(v>c||l[v].getTrimmedLength()===0);v--)k++;k>0&&(y.push(b+l.length-k),y.push(k)),b+=l.length-1}return y},s.reflowLargerCreateNewLayout=function(u,f){const d=[];let m=0,g=f[m],y=0;for(let b=0;b<u.length;b++)if(g===b){const r=f[++m];u.onDeleteEmitter.fire({index:b-y,amount:r}),b+=r-1,y+=r,g=f[++m]}else d.push(b);return{layout:d,countRemoved:y}},s.reflowLargerApplyNewLayout=function(u,f){const d=[];for(let m=0;m<f.length;m++)d.push(u.get(f[m]));for(let m=0;m<d.length;m++)u.set(m,d[m]);u.length=f.length},s.reflowSmallerGetNewLineLengths=function(u,f,d){const m=[],g=u.map(((o,l)=>a(u,l,f))).reduce(((o,l)=>o+l));let y=0,b=0,r=0;for(;r<g;){if(g-r<d){m.push(g-r);break}y+=d;const o=a(u,b,f);y>o&&(y-=o,b++);const l=u[b].getWidth(y-1)===2;l&&y--;const c=l?d-1:d;m.push(c),r+=c}return m},s.getWrappedLineTrimmedLength=a},5295:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferSet=void 0;const u=a(8460),f=a(844),d=a(9092);class m extends f.Disposable{constructor(y,b){super(),this._optionsService=y,this._bufferService=b,this._onBufferActivate=this.register(new u.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new d.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new d.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(y){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(y),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(y,b){this._normal.resize(y,b),this._alt.resize(y,b),this.setupTabStops(y)}setupTabStops(y){this._normal.setupTabStops(y),this._alt.setupTabStops(y)}}s.BufferSet=m},511:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CellData=void 0;const u=a(482),f=a(643),d=a(3734);class m extends d.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new d.ExtendedAttrs,this.combinedData=""}static fromCharData(y){const b=new m;return b.setFromCharData(y),b}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,u.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(y){this.fg=y[f.CHAR_DATA_ATTR_INDEX],this.bg=0;let b=!1;if(y[f.CHAR_DATA_CHAR_INDEX].length>2)b=!0;else if(y[f.CHAR_DATA_CHAR_INDEX].length===2){const r=y[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=r&&r<=56319){const o=y[f.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=o&&o<=57343?this.content=1024*(r-55296)+o-56320+65536|y[f.CHAR_DATA_WIDTH_INDEX]<<22:b=!0}else b=!0}else this.content=y[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[f.CHAR_DATA_WIDTH_INDEX]<<22;b&&(this.combinedData=y[f.CHAR_DATA_CHAR_INDEX],this.content=2097152|y[f.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.CellData=m},643:(w,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WHITESPACE_CELL_CODE=s.WHITESPACE_CELL_WIDTH=s.WHITESPACE_CELL_CHAR=s.NULL_CELL_CODE=s.NULL_CELL_WIDTH=s.NULL_CELL_CHAR=s.CHAR_DATA_CODE_INDEX=s.CHAR_DATA_WIDTH_INDEX=s.CHAR_DATA_CHAR_INDEX=s.CHAR_DATA_ATTR_INDEX=s.DEFAULT_EXT=s.DEFAULT_ATTR=s.DEFAULT_COLOR=void 0,s.DEFAULT_COLOR=0,s.DEFAULT_ATTR=256|s.DEFAULT_COLOR<<9,s.DEFAULT_EXT=0,s.CHAR_DATA_ATTR_INDEX=0,s.CHAR_DATA_CHAR_INDEX=1,s.CHAR_DATA_WIDTH_INDEX=2,s.CHAR_DATA_CODE_INDEX=3,s.NULL_CELL_CHAR="",s.NULL_CELL_WIDTH=1,s.NULL_CELL_CODE=0,s.WHITESPACE_CELL_CHAR=" ",s.WHITESPACE_CELL_WIDTH=1,s.WHITESPACE_CELL_CODE=32},4863:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Marker=void 0;const u=a(8460),f=a(844);class d{get id(){return this._id}constructor(g){this.line=g,this.isDisposed=!1,this._disposables=[],this._id=d._nextId++,this._onDispose=this.register(new u.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,f.disposeArray)(this._disposables),this._disposables.length=0)}register(g){return this._disposables.push(g),g}}s.Marker=d,d._nextId=1},7116:(w,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DEFAULT_CHARSET=s.CHARSETS=void 0,s.CHARSETS={},s.DEFAULT_CHARSET=s.CHARSETS.B,s.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},s.CHARSETS.A={"#":"£"},s.CHARSETS.B=void 0,s.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},s.CHARSETS.C=s.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},s.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},s.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},s.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},s.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},s.CHARSETS.E=s.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},s.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},s.CHARSETS.H=s.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},s.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(w,s)=>{var a,u,f;Object.defineProperty(s,"__esModule",{value:!0}),s.C1_ESCAPED=s.C1=s.C0=void 0,(function(d){d.NUL="\0",d.SOH="",d.STX="",d.ETX="",d.EOT="",d.ENQ="",d.ACK="",d.BEL="\x07",d.BS="\b",d.HT=" ",d.LF=`
15
+ `,d.VT="\v",d.FF="\f",d.CR="\r",d.SO="",d.SI="",d.DLE="",d.DC1="",d.DC2="",d.DC3="",d.DC4="",d.NAK="",d.SYN="",d.ETB="",d.CAN="",d.EM="",d.SUB="",d.ESC="\x1B",d.FS="",d.GS="",d.RS="",d.US="",d.SP=" ",d.DEL=""})(a||(s.C0=a={})),(function(d){d.PAD="€",d.HOP="",d.BPH="‚",d.NBH="ƒ",d.IND="„",d.NEL="…",d.SSA="†",d.ESA="‡",d.HTS="ˆ",d.HTJ="‰",d.VTS="Š",d.PLD="‹",d.PLU="Œ",d.RI="",d.SS2="Ž",d.SS3="",d.DCS="",d.PU1="‘",d.PU2="’",d.STS="“",d.CCH="”",d.MW="•",d.SPA="–",d.EPA="—",d.SOS="˜",d.SGCI="™",d.SCI="š",d.CSI="›",d.ST="œ",d.OSC="",d.PM="ž",d.APC="Ÿ"})(u||(s.C1=u={})),(function(d){d.ST=`${a.ESC}\\`})(f||(s.C1_ESCAPED=f={}))},7399:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.evaluateKeyboardEvent=void 0;const u=a(2584),f={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};s.evaluateKeyboardEvent=function(d,m,g,y){const b={type:0,cancel:!1,key:void 0},r=(d.shiftKey?1:0)|(d.altKey?2:0)|(d.ctrlKey?4:0)|(d.metaKey?8:0);switch(d.keyCode){case 0:d.key==="UIKeyInputUpArrow"?b.key=m?u.C0.ESC+"OA":u.C0.ESC+"[A":d.key==="UIKeyInputLeftArrow"?b.key=m?u.C0.ESC+"OD":u.C0.ESC+"[D":d.key==="UIKeyInputRightArrow"?b.key=m?u.C0.ESC+"OC":u.C0.ESC+"[C":d.key==="UIKeyInputDownArrow"&&(b.key=m?u.C0.ESC+"OB":u.C0.ESC+"[B");break;case 8:if(d.altKey){b.key=u.C0.ESC+u.C0.DEL;break}b.key=u.C0.DEL;break;case 9:if(d.shiftKey){b.key=u.C0.ESC+"[Z";break}b.key=u.C0.HT,b.cancel=!0;break;case 13:b.key=d.altKey?u.C0.ESC+u.C0.CR:u.C0.CR,b.cancel=!0;break;case 27:b.key=u.C0.ESC,d.altKey&&(b.key=u.C0.ESC+u.C0.ESC),b.cancel=!0;break;case 37:if(d.metaKey)break;r?(b.key=u.C0.ESC+"[1;"+(r+1)+"D",b.key===u.C0.ESC+"[1;3D"&&(b.key=u.C0.ESC+(g?"b":"[1;5D"))):b.key=m?u.C0.ESC+"OD":u.C0.ESC+"[D";break;case 39:if(d.metaKey)break;r?(b.key=u.C0.ESC+"[1;"+(r+1)+"C",b.key===u.C0.ESC+"[1;3C"&&(b.key=u.C0.ESC+(g?"f":"[1;5C"))):b.key=m?u.C0.ESC+"OC":u.C0.ESC+"[C";break;case 38:if(d.metaKey)break;r?(b.key=u.C0.ESC+"[1;"+(r+1)+"A",g||b.key!==u.C0.ESC+"[1;3A"||(b.key=u.C0.ESC+"[1;5A")):b.key=m?u.C0.ESC+"OA":u.C0.ESC+"[A";break;case 40:if(d.metaKey)break;r?(b.key=u.C0.ESC+"[1;"+(r+1)+"B",g||b.key!==u.C0.ESC+"[1;3B"||(b.key=u.C0.ESC+"[1;5B")):b.key=m?u.C0.ESC+"OB":u.C0.ESC+"[B";break;case 45:d.shiftKey||d.ctrlKey||(b.key=u.C0.ESC+"[2~");break;case 46:b.key=r?u.C0.ESC+"[3;"+(r+1)+"~":u.C0.ESC+"[3~";break;case 36:b.key=r?u.C0.ESC+"[1;"+(r+1)+"H":m?u.C0.ESC+"OH":u.C0.ESC+"[H";break;case 35:b.key=r?u.C0.ESC+"[1;"+(r+1)+"F":m?u.C0.ESC+"OF":u.C0.ESC+"[F";break;case 33:d.shiftKey?b.type=2:d.ctrlKey?b.key=u.C0.ESC+"[5;"+(r+1)+"~":b.key=u.C0.ESC+"[5~";break;case 34:d.shiftKey?b.type=3:d.ctrlKey?b.key=u.C0.ESC+"[6;"+(r+1)+"~":b.key=u.C0.ESC+"[6~";break;case 112:b.key=r?u.C0.ESC+"[1;"+(r+1)+"P":u.C0.ESC+"OP";break;case 113:b.key=r?u.C0.ESC+"[1;"+(r+1)+"Q":u.C0.ESC+"OQ";break;case 114:b.key=r?u.C0.ESC+"[1;"+(r+1)+"R":u.C0.ESC+"OR";break;case 115:b.key=r?u.C0.ESC+"[1;"+(r+1)+"S":u.C0.ESC+"OS";break;case 116:b.key=r?u.C0.ESC+"[15;"+(r+1)+"~":u.C0.ESC+"[15~";break;case 117:b.key=r?u.C0.ESC+"[17;"+(r+1)+"~":u.C0.ESC+"[17~";break;case 118:b.key=r?u.C0.ESC+"[18;"+(r+1)+"~":u.C0.ESC+"[18~";break;case 119:b.key=r?u.C0.ESC+"[19;"+(r+1)+"~":u.C0.ESC+"[19~";break;case 120:b.key=r?u.C0.ESC+"[20;"+(r+1)+"~":u.C0.ESC+"[20~";break;case 121:b.key=r?u.C0.ESC+"[21;"+(r+1)+"~":u.C0.ESC+"[21~";break;case 122:b.key=r?u.C0.ESC+"[23;"+(r+1)+"~":u.C0.ESC+"[23~";break;case 123:b.key=r?u.C0.ESC+"[24;"+(r+1)+"~":u.C0.ESC+"[24~";break;default:if(!d.ctrlKey||d.shiftKey||d.altKey||d.metaKey)if(g&&!y||!d.altKey||d.metaKey)!g||d.altKey||d.ctrlKey||d.shiftKey||!d.metaKey?d.key&&!d.ctrlKey&&!d.altKey&&!d.metaKey&&d.keyCode>=48&&d.key.length===1?b.key=d.key:d.key&&d.ctrlKey&&(d.key==="_"&&(b.key=u.C0.US),d.key==="@"&&(b.key=u.C0.NUL)):d.keyCode===65&&(b.type=1);else{const o=f[d.keyCode],l=o?.[d.shiftKey?1:0];if(l)b.key=u.C0.ESC+l;else if(d.keyCode>=65&&d.keyCode<=90){const c=d.ctrlKey?d.keyCode-64:d.keyCode+32;let p=String.fromCharCode(c);d.shiftKey&&(p=p.toUpperCase()),b.key=u.C0.ESC+p}else if(d.keyCode===32)b.key=u.C0.ESC+(d.ctrlKey?u.C0.NUL:" ");else if(d.key==="Dead"&&d.code.startsWith("Key")){let c=d.code.slice(3,4);d.shiftKey||(c=c.toLowerCase()),b.key=u.C0.ESC+c,b.cancel=!0}}else d.keyCode>=65&&d.keyCode<=90?b.key=String.fromCharCode(d.keyCode-64):d.keyCode===32?b.key=u.C0.NUL:d.keyCode>=51&&d.keyCode<=55?b.key=String.fromCharCode(d.keyCode-51+27):d.keyCode===56?b.key=u.C0.DEL:d.keyCode===219?b.key=u.C0.ESC:d.keyCode===220?b.key=u.C0.FS:d.keyCode===221&&(b.key=u.C0.GS)}return b}},482:(w,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Utf8ToUtf32=s.StringToUtf32=s.utf32ToString=s.stringFromCodePoint=void 0,s.stringFromCodePoint=function(a){return a>65535?(a-=65536,String.fromCharCode(55296+(a>>10))+String.fromCharCode(a%1024+56320)):String.fromCharCode(a)},s.utf32ToString=function(a,u=0,f=a.length){let d="";for(let m=u;m<f;++m){let g=a[m];g>65535?(g-=65536,d+=String.fromCharCode(55296+(g>>10))+String.fromCharCode(g%1024+56320)):d+=String.fromCharCode(g)}return d},s.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,u){const f=a.length;if(!f)return 0;let d=0,m=0;if(this._interim){const g=a.charCodeAt(m++);56320<=g&&g<=57343?u[d++]=1024*(this._interim-55296)+g-56320+65536:(u[d++]=this._interim,u[d++]=g),this._interim=0}for(let g=m;g<f;++g){const y=a.charCodeAt(g);if(55296<=y&&y<=56319){if(++g>=f)return this._interim=y,d;const b=a.charCodeAt(g);56320<=b&&b<=57343?u[d++]=1024*(y-55296)+b-56320+65536:(u[d++]=y,u[d++]=b)}else y!==65279&&(u[d++]=y)}return d}},s.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,u){const f=a.length;if(!f)return 0;let d,m,g,y,b=0,r=0,o=0;if(this.interim[0]){let p=!1,_=this.interim[0];_&=(224&_)==192?31:(240&_)==224?15:7;let C,k=0;for(;(C=63&this.interim[++k])&&k<4;)_<<=6,_|=C;const v=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,E=v-k;for(;o<E;){if(o>=f)return 0;if(C=a[o++],(192&C)!=128){o--,p=!0;break}this.interim[k++]=C,_<<=6,_|=63&C}p||(v===2?_<128?o--:u[b++]=_:v===3?_<2048||_>=55296&&_<=57343||_===65279||(u[b++]=_):_<65536||_>1114111||(u[b++]=_)),this.interim.fill(0)}const l=f-4;let c=o;for(;c<f;){for(;!(!(c<l)||128&(d=a[c])||128&(m=a[c+1])||128&(g=a[c+2])||128&(y=a[c+3]));)u[b++]=d,u[b++]=m,u[b++]=g,u[b++]=y,c+=4;if(d=a[c++],d<128)u[b++]=d;else if((224&d)==192){if(c>=f)return this.interim[0]=d,b;if(m=a[c++],(192&m)!=128){c--;continue}if(r=(31&d)<<6|63&m,r<128){c--;continue}u[b++]=r}else if((240&d)==224){if(c>=f)return this.interim[0]=d,b;if(m=a[c++],(192&m)!=128){c--;continue}if(c>=f)return this.interim[0]=d,this.interim[1]=m,b;if(g=a[c++],(192&g)!=128){c--;continue}if(r=(15&d)<<12|(63&m)<<6|63&g,r<2048||r>=55296&&r<=57343||r===65279)continue;u[b++]=r}else if((248&d)==240){if(c>=f)return this.interim[0]=d,b;if(m=a[c++],(192&m)!=128){c--;continue}if(c>=f)return this.interim[0]=d,this.interim[1]=m,b;if(g=a[c++],(192&g)!=128){c--;continue}if(c>=f)return this.interim[0]=d,this.interim[1]=m,this.interim[2]=g,b;if(y=a[c++],(192&y)!=128){c--;continue}if(r=(7&d)<<18|(63&m)<<12|(63&g)<<6|63&y,r<65536||r>1114111)continue;u[b++]=r}}return b}}},225:(w,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeV6=void 0;const a=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],u=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let f;s.UnicodeV6=class{constructor(){if(this.version="6",!f){f=new Uint8Array(65536),f.fill(1),f[0]=0,f.fill(0,1,32),f.fill(0,127,160),f.fill(2,4352,4448),f[9001]=2,f[9002]=2,f.fill(2,11904,42192),f[12351]=1,f.fill(2,44032,55204),f.fill(2,63744,64256),f.fill(2,65040,65050),f.fill(2,65072,65136),f.fill(2,65280,65377),f.fill(2,65504,65511);for(let d=0;d<a.length;++d)f.fill(0,a[d][0],a[d][1]+1)}}wcwidth(d){return d<32?0:d<127?1:d<65536?f[d]:(function(m,g){let y,b=0,r=g.length-1;if(m<g[0][0]||m>g[r][1])return!1;for(;r>=b;)if(y=b+r>>1,m>g[y][1])b=y+1;else{if(!(m<g[y][0]))return!0;r=y-1}return!1})(d,u)?0:d>=131072&&d<=196605||d>=196608&&d<=262141?2:1}}},5981:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WriteBuffer=void 0;const u=a(8460),f=a(844);class d extends f.Disposable{constructor(g){super(),this._action=g,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new u.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(g,y){if(y!==void 0&&this._syncCalls>y)return void(this._syncCalls=0);if(this._pendingData+=g.length,this._writeBuffer.push(g),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let b;for(this._isSyncWriting=!0;b=this._writeBuffer.shift();){this._action(b);const r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(g,y){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=g.length,this._writeBuffer.push(g),this._callbacks.push(y),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=g.length,this._writeBuffer.push(g),this._callbacks.push(y)}_innerWrite(g=0,y=!0){const b=g||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const r=this._writeBuffer[this._bufferOffset],o=this._action(r,y);if(o){const c=p=>Date.now()-b>=12?setTimeout((()=>this._innerWrite(0,p))):this._innerWrite(b,p);return void o.catch((p=>(queueMicrotask((()=>{throw p})),Promise.resolve(!1)))).then(c)}const l=this._callbacks[this._bufferOffset];if(l&&l(),this._bufferOffset++,this._pendingData-=r.length,Date.now()-b>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}s.WriteBuffer=d},5941:(w,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.toRgbString=s.parseColor=void 0;const a=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,u=/^[\da-f]+$/;function f(d,m){const g=d.toString(16),y=g.length<2?"0"+g:g;switch(m){case 4:return g[0];case 8:return y;case 12:return(y+y).slice(0,3);default:return y+y}}s.parseColor=function(d){if(!d)return;let m=d.toLowerCase();if(m.indexOf("rgb:")===0){m=m.slice(4);const g=a.exec(m);if(g){const y=g[1]?15:g[4]?255:g[7]?4095:65535;return[Math.round(parseInt(g[1]||g[4]||g[7]||g[10],16)/y*255),Math.round(parseInt(g[2]||g[5]||g[8]||g[11],16)/y*255),Math.round(parseInt(g[3]||g[6]||g[9]||g[12],16)/y*255)]}}else if(m.indexOf("#")===0&&(m=m.slice(1),u.exec(m)&&[3,6,9,12].includes(m.length))){const g=m.length/3,y=[0,0,0];for(let b=0;b<3;++b){const r=parseInt(m.slice(g*b,g*b+g),16);y[b]=g===1?r<<4:g===2?r:g===3?r>>4:r>>8}return y}},s.toRgbString=function(d,m=16){const[g,y,b]=d;return`rgb:${f(g,m)}/${f(y,m)}/${f(b,m)}`}},5770:(w,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.PAYLOAD_LIMIT=void 0,s.PAYLOAD_LIMIT=1e7},6351:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DcsHandler=s.DcsParser=void 0;const u=a(482),f=a(8742),d=a(5770),m=[];s.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=m,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=m}registerHandler(y,b){this._handlers[y]===void 0&&(this._handlers[y]=[]);const r=this._handlers[y];return r.push(b),{dispose:()=>{const o=r.indexOf(b);o!==-1&&r.splice(o,1)}}}clearHandler(y){this._handlers[y]&&delete this._handlers[y]}setHandlerFallback(y){this._handlerFb=y}reset(){if(this._active.length)for(let y=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;y>=0;--y)this._active[y].unhook(!1);this._stack.paused=!1,this._active=m,this._ident=0}hook(y,b){if(this.reset(),this._ident=y,this._active=this._handlers[y]||m,this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].hook(b);else this._handlerFb(this._ident,"HOOK",b)}put(y,b,r){if(this._active.length)for(let o=this._active.length-1;o>=0;o--)this._active[o].put(y,b,r);else this._handlerFb(this._ident,"PUT",(0,u.utf32ToString)(y,b,r))}unhook(y,b=!0){if(this._active.length){let r=!1,o=this._active.length-1,l=!1;if(this._stack.paused&&(o=this._stack.loopPosition-1,r=b,l=this._stack.fallThrough,this._stack.paused=!1),!l&&r===!1){for(;o>=0&&(r=this._active[o].unhook(y),r!==!0);o--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!1,r;o--}for(;o>=0;o--)if(r=this._active[o].unhook(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!0,r}else this._handlerFb(this._ident,"UNHOOK",y);this._active=m,this._ident=0}};const g=new f.Params;g.addParam(0),s.DcsHandler=class{constructor(y){this._handler=y,this._data="",this._params=g,this._hitLimit=!1}hook(y){this._params=y.length>1||y.params[0]?y.clone():g,this._data="",this._hitLimit=!1}put(y,b,r){this._hitLimit||(this._data+=(0,u.utf32ToString)(y,b,r),this._data.length>d.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(y){let b=!1;if(this._hitLimit)b=!1;else if(y&&(b=this._handler(this._data,this._params),b instanceof Promise))return b.then((r=>(this._params=g,this._data="",this._hitLimit=!1,r)));return this._params=g,this._data="",this._hitLimit=!1,b}}},2015:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.EscapeSequenceParser=s.VT500_TRANSITION_TABLE=s.TransitionTable=void 0;const u=a(844),f=a(8742),d=a(6242),m=a(6351);class g{constructor(o){this.table=new Uint8Array(o)}setDefault(o,l){this.table.fill(o<<4|l)}add(o,l,c,p){this.table[l<<8|o]=c<<4|p}addMany(o,l,c,p){for(let _=0;_<o.length;_++)this.table[l<<8|o[_]]=c<<4|p}}s.TransitionTable=g;const y=160;s.VT500_TRANSITION_TABLE=(function(){const r=new g(4095),o=Array.apply(null,Array(256)).map(((k,v)=>v)),l=(k,v)=>o.slice(k,v),c=l(32,127),p=l(0,24);p.push(25),p.push.apply(p,l(28,32));const _=l(0,14);let C;for(C in r.setDefault(1,0),r.addMany(c,0,2,0),_)r.addMany([24,26,153,154],C,3,0),r.addMany(l(128,144),C,3,0),r.addMany(l(144,152),C,3,0),r.add(156,C,0,0),r.add(27,C,11,1),r.add(157,C,4,8),r.addMany([152,158,159],C,0,7),r.add(155,C,11,3),r.add(144,C,11,9);return r.addMany(p,0,3,0),r.addMany(p,1,3,1),r.add(127,1,0,1),r.addMany(p,8,0,8),r.addMany(p,3,3,3),r.add(127,3,0,3),r.addMany(p,4,3,4),r.add(127,4,0,4),r.addMany(p,6,3,6),r.addMany(p,5,3,5),r.add(127,5,0,5),r.addMany(p,2,3,2),r.add(127,2,0,2),r.add(93,1,4,8),r.addMany(c,8,5,8),r.add(127,8,5,8),r.addMany([156,27,24,26,7],8,6,0),r.addMany(l(28,32),8,0,8),r.addMany([88,94,95],1,0,7),r.addMany(c,7,0,7),r.addMany(p,7,0,7),r.add(156,7,0,0),r.add(127,7,0,7),r.add(91,1,11,3),r.addMany(l(64,127),3,7,0),r.addMany(l(48,60),3,8,4),r.addMany([60,61,62,63],3,9,4),r.addMany(l(48,60),4,8,4),r.addMany(l(64,127),4,7,0),r.addMany([60,61,62,63],4,0,6),r.addMany(l(32,64),6,0,6),r.add(127,6,0,6),r.addMany(l(64,127),6,0,0),r.addMany(l(32,48),3,9,5),r.addMany(l(32,48),5,9,5),r.addMany(l(48,64),5,0,6),r.addMany(l(64,127),5,7,0),r.addMany(l(32,48),4,9,5),r.addMany(l(32,48),1,9,2),r.addMany(l(32,48),2,9,2),r.addMany(l(48,127),2,10,0),r.addMany(l(48,80),1,10,0),r.addMany(l(81,88),1,10,0),r.addMany([89,90,92],1,10,0),r.addMany(l(96,127),1,10,0),r.add(80,1,11,9),r.addMany(p,9,0,9),r.add(127,9,0,9),r.addMany(l(28,32),9,0,9),r.addMany(l(32,48),9,9,12),r.addMany(l(48,60),9,8,10),r.addMany([60,61,62,63],9,9,10),r.addMany(p,11,0,11),r.addMany(l(32,128),11,0,11),r.addMany(l(28,32),11,0,11),r.addMany(p,10,0,10),r.add(127,10,0,10),r.addMany(l(28,32),10,0,10),r.addMany(l(48,60),10,8,10),r.addMany([60,61,62,63],10,0,11),r.addMany(l(32,48),10,9,12),r.addMany(p,12,0,12),r.add(127,12,0,12),r.addMany(l(28,32),12,0,12),r.addMany(l(32,48),12,9,12),r.addMany(l(48,64),12,0,11),r.addMany(l(64,127),12,12,13),r.addMany(l(64,127),10,12,13),r.addMany(l(64,127),9,12,13),r.addMany(p,13,13,13),r.addMany(c,13,13,13),r.add(127,13,0,13),r.addMany([27,156,24,26],13,14,0),r.add(y,0,2,0),r.add(y,8,5,8),r.add(y,6,0,6),r.add(y,11,0,11),r.add(y,13,13,13),r})();class b extends u.Disposable{constructor(o=s.VT500_TRANSITION_TABLE){super(),this._transitions=o,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new f.Params,this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._printHandlerFb=(l,c,p)=>{},this._executeHandlerFb=l=>{},this._csiHandlerFb=(l,c)=>{},this._escHandlerFb=l=>{},this._errorHandlerFb=l=>l,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,u.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new d.OscParser),this._dcsParser=this.register(new m.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(o,l=[64,126]){let c=0;if(o.prefix){if(o.prefix.length>1)throw new Error("only one byte as prefix supported");if(c=o.prefix.charCodeAt(0),c&&60>c||c>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(o.intermediates){if(o.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let _=0;_<o.intermediates.length;++_){const C=o.intermediates.charCodeAt(_);if(32>C||C>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");c<<=8,c|=C}}if(o.final.length!==1)throw new Error("final must be a single byte");const p=o.final.charCodeAt(0);if(l[0]>p||p>l[1])throw new Error(`final must be in range ${l[0]} .. ${l[1]}`);return c<<=8,c|=p,c}identToString(o){const l=[];for(;o;)l.push(String.fromCharCode(255&o)),o>>=8;return l.reverse().join("")}setPrintHandler(o){this._printHandler=o}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(o,l){const c=this._identifier(o,[48,126]);this._escHandlers[c]===void 0&&(this._escHandlers[c]=[]);const p=this._escHandlers[c];return p.push(l),{dispose:()=>{const _=p.indexOf(l);_!==-1&&p.splice(_,1)}}}clearEscHandler(o){this._escHandlers[this._identifier(o,[48,126])]&&delete this._escHandlers[this._identifier(o,[48,126])]}setEscHandlerFallback(o){this._escHandlerFb=o}setExecuteHandler(o,l){this._executeHandlers[o.charCodeAt(0)]=l}clearExecuteHandler(o){this._executeHandlers[o.charCodeAt(0)]&&delete this._executeHandlers[o.charCodeAt(0)]}setExecuteHandlerFallback(o){this._executeHandlerFb=o}registerCsiHandler(o,l){const c=this._identifier(o);this._csiHandlers[c]===void 0&&(this._csiHandlers[c]=[]);const p=this._csiHandlers[c];return p.push(l),{dispose:()=>{const _=p.indexOf(l);_!==-1&&p.splice(_,1)}}}clearCsiHandler(o){this._csiHandlers[this._identifier(o)]&&delete this._csiHandlers[this._identifier(o)]}setCsiHandlerFallback(o){this._csiHandlerFb=o}registerDcsHandler(o,l){return this._dcsParser.registerHandler(this._identifier(o),l)}clearDcsHandler(o){this._dcsParser.clearHandler(this._identifier(o))}setDcsHandlerFallback(o){this._dcsParser.setHandlerFallback(o)}registerOscHandler(o,l){return this._oscParser.registerHandler(o,l)}clearOscHandler(o){this._oscParser.clearHandler(o)}setOscHandlerFallback(o){this._oscParser.setHandlerFallback(o)}setErrorHandler(o){this._errorHandler=o}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(o,l,c,p,_){this._parseStack.state=o,this._parseStack.handlers=l,this._parseStack.handlerPos=c,this._parseStack.transition=p,this._parseStack.chunkPos=_}parse(o,l,c){let p,_=0,C=0,k=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,k=this._parseStack.chunkPos+1;else{if(c===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const v=this._parseStack.handlers;let E=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(c===!1&&E>-1){for(;E>=0&&(p=v[E](this._params),p!==!0);E--)if(p instanceof Promise)return this._parseStack.handlerPos=E,p}this._parseStack.handlers=[];break;case 4:if(c===!1&&E>-1){for(;E>=0&&(p=v[E](),p!==!0);E--)if(p instanceof Promise)return this._parseStack.handlerPos=E,p}this._parseStack.handlers=[];break;case 6:if(_=o[this._parseStack.chunkPos],p=this._dcsParser.unhook(_!==24&&_!==26,c),p)return p;_===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(_=o[this._parseStack.chunkPos],p=this._oscParser.end(_!==24&&_!==26,c),p)return p;_===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,k=this._parseStack.chunkPos+1,this.precedingCodepoint=0,this.currentState=15&this._parseStack.transition}for(let v=k;v<l;++v){switch(_=o[v],C=this._transitions.table[this.currentState<<8|(_<160?_:y)],C>>4){case 2:for(let T=v+1;;++T){if(T>=l||(_=o[T])<32||_>126&&_<y){this._printHandler(o,v,T),v=T-1;break}if(++T>=l||(_=o[T])<32||_>126&&_<y){this._printHandler(o,v,T),v=T-1;break}if(++T>=l||(_=o[T])<32||_>126&&_<y){this._printHandler(o,v,T),v=T-1;break}if(++T>=l||(_=o[T])<32||_>126&&_<y){this._printHandler(o,v,T),v=T-1;break}}break;case 3:this._executeHandlers[_]?this._executeHandlers[_]():this._executeHandlerFb(_),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:v,code:_,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const E=this._csiHandlers[this._collect<<8|_];let R=E?E.length-1:-1;for(;R>=0&&(p=E[R](this._params),p!==!0);R--)if(p instanceof Promise)return this._preserveStack(3,E,R,C,v),p;R<0&&this._csiHandlerFb(this._collect<<8|_,this._params),this.precedingCodepoint=0;break;case 8:do switch(_){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(_-48)}while(++v<l&&(_=o[v])>47&&_<60);v--;break;case 9:this._collect<<=8,this._collect|=_;break;case 10:const O=this._escHandlers[this._collect<<8|_];let L=O?O.length-1:-1;for(;L>=0&&(p=O[L](),p!==!0);L--)if(p instanceof Promise)return this._preserveStack(4,O,L,C,v),p;L<0&&this._escHandlerFb(this._collect<<8|_),this.precedingCodepoint=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|_,this._params);break;case 13:for(let T=v+1;;++T)if(T>=l||(_=o[T])===24||_===26||_===27||_>127&&_<y){this._dcsParser.put(o,v,T),v=T-1;break}break;case 14:if(p=this._dcsParser.unhook(_!==24&&_!==26),p)return this._preserveStack(6,[],0,C,v),p;_===27&&(C|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0;break;case 4:this._oscParser.start();break;case 5:for(let T=v+1;;T++)if(T>=l||(_=o[T])<32||_>127&&_<y){this._oscParser.put(o,v,T),v=T-1;break}break;case 6:if(p=this._oscParser.end(_!==24&&_!==26),p)return this._preserveStack(5,[],0,C,v),p;_===27&&(C|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0}this.currentState=15&C}}}s.EscapeSequenceParser=b},6242:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OscHandler=s.OscParser=void 0;const u=a(5770),f=a(482),d=[];s.OscParser=class{constructor(){this._state=0,this._active=d,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(m,g){this._handlers[m]===void 0&&(this._handlers[m]=[]);const y=this._handlers[m];return y.push(g),{dispose:()=>{const b=y.indexOf(g);b!==-1&&y.splice(b,1)}}}clearHandler(m){this._handlers[m]&&delete this._handlers[m]}setHandlerFallback(m){this._handlerFb=m}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=d}reset(){if(this._state===2)for(let m=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;m>=0;--m)this._active[m].end(!1);this._stack.paused=!1,this._active=d,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||d,this._active.length)for(let m=this._active.length-1;m>=0;m--)this._active[m].start();else this._handlerFb(this._id,"START")}_put(m,g,y){if(this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].put(m,g,y);else this._handlerFb(this._id,"PUT",(0,f.utf32ToString)(m,g,y))}start(){this.reset(),this._state=1}put(m,g,y){if(this._state!==3){if(this._state===1)for(;g<y;){const b=m[g++];if(b===59){this._state=2,this._start();break}if(b<48||57<b)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+b-48}this._state===2&&y-g>0&&this._put(m,g,y)}}end(m,g=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let y=!1,b=this._active.length-1,r=!1;if(this._stack.paused&&(b=this._stack.loopPosition-1,y=g,r=this._stack.fallThrough,this._stack.paused=!1),!r&&y===!1){for(;b>=0&&(y=this._active[b].end(m),y!==!0);b--)if(y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!1,y;b--}for(;b>=0;b--)if(y=this._active[b].end(!1),y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!0,y}else this._handlerFb(this._id,"END",m);this._active=d,this._id=-1,this._state=0}}},s.OscHandler=class{constructor(m){this._handler=m,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(m,g,y){this._hitLimit||(this._data+=(0,f.utf32ToString)(m,g,y),this._data.length>u.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(m){let g=!1;if(this._hitLimit)g=!1;else if(m&&(g=this._handler(this._data),g instanceof Promise))return g.then((y=>(this._data="",this._hitLimit=!1,y)));return this._data="",this._hitLimit=!1,g}}},8742:(w,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Params=void 0;const a=2147483647;class u{static fromArray(d){const m=new u;if(!d.length)return m;for(let g=Array.isArray(d[0])?1:0;g<d.length;++g){const y=d[g];if(Array.isArray(y))for(let b=0;b<y.length;++b)m.addSubParam(y[b]);else m.addParam(y)}return m}constructor(d=32,m=32){if(this.maxLength=d,this.maxSubParamsLength=m,m>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(d),this.length=0,this._subParams=new Int32Array(m),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(d),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const d=new u(this.maxLength,this.maxSubParamsLength);return d.params.set(this.params),d.length=this.length,d._subParams.set(this._subParams),d._subParamsLength=this._subParamsLength,d._subParamsIdx.set(this._subParamsIdx),d._rejectDigits=this._rejectDigits,d._rejectSubDigits=this._rejectSubDigits,d._digitIsSub=this._digitIsSub,d}toArray(){const d=[];for(let m=0;m<this.length;++m){d.push(this.params[m]);const g=this._subParamsIdx[m]>>8,y=255&this._subParamsIdx[m];y-g>0&&d.push(Array.prototype.slice.call(this._subParams,g,y))}return d}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(d){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=d>a?a:d}}addSubParam(d){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=d>a?a:d,this._subParamsIdx[this.length-1]++}}hasSubParams(d){return(255&this._subParamsIdx[d])-(this._subParamsIdx[d]>>8)>0}getSubParams(d){const m=this._subParamsIdx[d]>>8,g=255&this._subParamsIdx[d];return g-m>0?this._subParams.subarray(m,g):null}getSubParamsAll(){const d={};for(let m=0;m<this.length;++m){const g=this._subParamsIdx[m]>>8,y=255&this._subParamsIdx[m];y-g>0&&(d[m]=this._subParams.slice(g,y))}return d}addDigit(d){let m;if(this._rejectDigits||!(m=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const g=this._digitIsSub?this._subParams:this.params,y=g[m-1];g[m-1]=~y?Math.min(10*y+d,a):d}}s.Params=u},5741:(w,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.AddonManager=void 0,s.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let a=this._addons.length-1;a>=0;a--)this._addons[a].instance.dispose()}loadAddon(a,u){const f={instance:u,dispose:u.dispose,isDisposed:!1};this._addons.push(f),u.dispose=()=>this._wrappedAddonDispose(f),u.activate(a)}_wrappedAddonDispose(a){if(a.isDisposed)return;let u=-1;for(let f=0;f<this._addons.length;f++)if(this._addons[f]===a){u=f;break}if(u===-1)throw new Error("Could not dispose an addon that has not been loaded");a.isDisposed=!0,a.dispose.apply(a.instance),this._addons.splice(u,1)}}},8771:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferApiView=void 0;const u=a(3785),f=a(511);s.BufferApiView=class{constructor(d,m){this._buffer=d,this.type=m}init(d){return this._buffer=d,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(d){const m=this._buffer.lines.get(d);if(m)return new u.BufferLineApiView(m)}getNullCell(){return new f.CellData}}},3785:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLineApiView=void 0;const u=a(511);s.BufferLineApiView=class{constructor(f){this._line=f}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(f,d){if(!(f<0||f>=this._line.length))return d?(this._line.loadCell(f,d),d):this._line.loadCell(f,new u.CellData)}translateToString(f,d,m){return this._line.translateToString(f,d,m)}}},8285:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferNamespaceApi=void 0;const u=a(8771),f=a(8460),d=a(844);class m extends d.Disposable{constructor(y){super(),this._core=y,this._onBufferChange=this.register(new f.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new u.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new u.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}s.BufferNamespaceApi=m},7975:(w,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ParserApi=void 0,s.ParserApi=class{constructor(a){this._core=a}registerCsiHandler(a,u){return this._core.registerCsiHandler(a,(f=>u(f.toArray())))}addCsiHandler(a,u){return this.registerCsiHandler(a,u)}registerDcsHandler(a,u){return this._core.registerDcsHandler(a,((f,d)=>u(f,d.toArray())))}addDcsHandler(a,u){return this.registerDcsHandler(a,u)}registerEscHandler(a,u){return this._core.registerEscHandler(a,u)}addEscHandler(a,u){return this.registerEscHandler(a,u)}registerOscHandler(a,u){return this._core.registerOscHandler(a,u)}addOscHandler(a,u){return this.registerOscHandler(a,u)}}},7090:(w,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeApi=void 0,s.UnicodeApi=class{constructor(a){this._core=a}register(a){this._core.unicodeService.register(a)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(a){this._core.unicodeService.activeVersion=a}}},744:function(w,s,a){var u=this&&this.__decorate||function(r,o,l,c){var p,_=arguments.length,C=_<3?o:c===null?c=Object.getOwnPropertyDescriptor(o,l):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(r,o,l,c);else for(var k=r.length-1;k>=0;k--)(p=r[k])&&(C=(_<3?p(C):_>3?p(o,l,C):p(o,l))||C);return _>3&&C&&Object.defineProperty(o,l,C),C},f=this&&this.__param||function(r,o){return function(l,c){o(l,c,r)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferService=s.MINIMUM_ROWS=s.MINIMUM_COLS=void 0;const d=a(8460),m=a(844),g=a(5295),y=a(2585);s.MINIMUM_COLS=2,s.MINIMUM_ROWS=1;let b=s.BufferService=class extends m.Disposable{get buffer(){return this.buffers.active}constructor(r){super(),this.isUserScrolling=!1,this._onResize=this.register(new d.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(r.rawOptions.cols||0,s.MINIMUM_COLS),this.rows=Math.max(r.rawOptions.rows||0,s.MINIMUM_ROWS),this.buffers=this.register(new g.BufferSet(r,this))}resize(r,o){this.cols=r,this.rows=o,this.buffers.resize(r,o),this._onResize.fire({cols:r,rows:o})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(r,o=!1){const l=this.buffer;let c;c=this._cachedBlankLine,c&&c.length===this.cols&&c.getFg(0)===r.fg&&c.getBg(0)===r.bg||(c=l.getBlankLine(r,o),this._cachedBlankLine=c),c.isWrapped=o;const p=l.ybase+l.scrollTop,_=l.ybase+l.scrollBottom;if(l.scrollTop===0){const C=l.lines.isFull;_===l.lines.length-1?C?l.lines.recycle().copyFrom(c):l.lines.push(c.clone()):l.lines.splice(_+1,0,c.clone()),C?this.isUserScrolling&&(l.ydisp=Math.max(l.ydisp-1,0)):(l.ybase++,this.isUserScrolling||l.ydisp++)}else{const C=_-p+1;l.lines.shiftElements(p+1,C-1,-1),l.lines.set(_,c.clone())}this.isUserScrolling||(l.ydisp=l.ybase),this._onScroll.fire(l.ydisp)}scrollLines(r,o,l){const c=this.buffer;if(r<0){if(c.ydisp===0)return;this.isUserScrolling=!0}else r+c.ydisp>=c.ybase&&(this.isUserScrolling=!1);const p=c.ydisp;c.ydisp=Math.max(Math.min(c.ydisp+r,c.ybase),0),p!==c.ydisp&&(o||this._onScroll.fire(c.ydisp))}};s.BufferService=b=u([f(0,y.IOptionsService)],b)},7994:(w,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CharsetService=void 0,s.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(a){this.glevel=a,this.charset=this._charsets[a]}setgCharset(a,u){this._charsets[a]=u,this.glevel===a&&(this.charset=u)}}},1753:function(w,s,a){var u=this&&this.__decorate||function(c,p,_,C){var k,v=arguments.length,E=v<3?p:C===null?C=Object.getOwnPropertyDescriptor(p,_):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(c,p,_,C);else for(var R=c.length-1;R>=0;R--)(k=c[R])&&(E=(v<3?k(E):v>3?k(p,_,E):k(p,_))||E);return v>3&&E&&Object.defineProperty(p,_,E),E},f=this&&this.__param||function(c,p){return function(_,C){p(_,C,c)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreMouseService=void 0;const d=a(2585),m=a(8460),g=a(844),y={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:c=>c.button!==4&&c.action===1&&(c.ctrl=!1,c.alt=!1,c.shift=!1,!0)},VT200:{events:19,restrict:c=>c.action!==32},DRAG:{events:23,restrict:c=>c.action!==32||c.button!==3},ANY:{events:31,restrict:c=>!0}};function b(c,p){let _=(c.ctrl?16:0)|(c.shift?4:0)|(c.alt?8:0);return c.button===4?(_|=64,_|=c.action):(_|=3&c.button,4&c.button&&(_|=64),8&c.button&&(_|=128),c.action===32?_|=32:c.action!==0||p||(_|=3)),_}const r=String.fromCharCode,o={DEFAULT:c=>{const p=[b(c,!1)+32,c.col+32,c.row+32];return p[0]>255||p[1]>255||p[2]>255?"":`\x1B[M${r(p[0])}${r(p[1])}${r(p[2])}`},SGR:c=>{const p=c.action===0&&c.button!==4?"m":"M";return`\x1B[<${b(c,!0)};${c.col};${c.row}${p}`},SGR_PIXELS:c=>{const p=c.action===0&&c.button!==4?"m":"M";return`\x1B[<${b(c,!0)};${c.x};${c.y}${p}`}};let l=s.CoreMouseService=class extends g.Disposable{constructor(c,p){super(),this._bufferService=c,this._coreService=p,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new m.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const _ of Object.keys(y))this.addProtocol(_,y[_]);for(const _ of Object.keys(o))this.addEncoding(_,o[_]);this.reset()}addProtocol(c,p){this._protocols[c]=p}addEncoding(c,p){this._encodings[c]=p}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(c){if(!this._protocols[c])throw new Error(`unknown protocol "${c}"`);this._activeProtocol=c,this._onProtocolChange.fire(this._protocols[c].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(c){if(!this._encodings[c])throw new Error(`unknown encoding "${c}"`);this._activeEncoding=c}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(c){if(c.col<0||c.col>=this._bufferService.cols||c.row<0||c.row>=this._bufferService.rows||c.button===4&&c.action===32||c.button===3&&c.action!==32||c.button!==4&&(c.action===2||c.action===3)||(c.col++,c.row++,c.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,c,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(c))return!1;const p=this._encodings[this._activeEncoding](c);return p&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(p):this._coreService.triggerDataEvent(p,!0)),this._lastEvent=c,!0}explainEvents(c){return{down:!!(1&c),up:!!(2&c),drag:!!(4&c),move:!!(8&c),wheel:!!(16&c)}}_equalEvents(c,p,_){if(_){if(c.x!==p.x||c.y!==p.y)return!1}else if(c.col!==p.col||c.row!==p.row)return!1;return c.button===p.button&&c.action===p.action&&c.ctrl===p.ctrl&&c.alt===p.alt&&c.shift===p.shift}};s.CoreMouseService=l=u([f(0,d.IBufferService),f(1,d.ICoreService)],l)},6975:function(w,s,a){var u=this&&this.__decorate||function(l,c,p,_){var C,k=arguments.length,v=k<3?c:_===null?_=Object.getOwnPropertyDescriptor(c,p):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(l,c,p,_);else for(var E=l.length-1;E>=0;E--)(C=l[E])&&(v=(k<3?C(v):k>3?C(c,p,v):C(c,p))||v);return k>3&&v&&Object.defineProperty(c,p,v),v},f=this&&this.__param||function(l,c){return function(p,_){c(p,_,l)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreService=void 0;const d=a(1439),m=a(8460),g=a(844),y=a(2585),b=Object.freeze({insertMode:!1}),r=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let o=s.CoreService=class extends g.Disposable{constructor(l,c,p){super(),this._bufferService=l,this._logService=c,this._optionsService=p,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new m.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new m.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new m.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new m.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,d.clone)(b),this.decPrivateModes=(0,d.clone)(r)}reset(){this.modes=(0,d.clone)(b),this.decPrivateModes=(0,d.clone)(r)}triggerDataEvent(l,c=!1){if(this._optionsService.rawOptions.disableStdin)return;const p=this._bufferService.buffer;c&&this._optionsService.rawOptions.scrollOnUserInput&&p.ybase!==p.ydisp&&this._onRequestScrollToBottom.fire(),c&&this._onUserInput.fire(),this._logService.debug(`sending data "${l}"`,(()=>l.split("").map((_=>_.charCodeAt(0))))),this._onData.fire(l)}triggerBinaryEvent(l){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${l}"`,(()=>l.split("").map((c=>c.charCodeAt(0))))),this._onBinary.fire(l))}};s.CoreService=o=u([f(0,y.IBufferService),f(1,y.ILogService),f(2,y.IOptionsService)],o)},9074:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DecorationService=void 0;const u=a(8055),f=a(8460),d=a(844),m=a(6106);let g=0,y=0;class b extends d.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new m.SortedList((l=>l?.marker.line)),this._onDecorationRegistered=this.register(new f.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new f.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,d.toDisposable)((()=>this.reset())))}registerDecoration(l){if(l.marker.isDisposed)return;const c=new r(l);if(c){const p=c.marker.onDispose((()=>c.dispose()));c.onDispose((()=>{c&&(this._decorations.delete(c)&&this._onDecorationRemoved.fire(c),p.dispose())})),this._decorations.insert(c),this._onDecorationRegistered.fire(c)}return c}reset(){for(const l of this._decorations.values())l.dispose();this._decorations.clear()}*getDecorationsAtCell(l,c,p){var _,C,k;let v=0,E=0;for(const R of this._decorations.getKeyIterator(c))v=(_=R.options.x)!==null&&_!==void 0?_:0,E=v+((C=R.options.width)!==null&&C!==void 0?C:1),l>=v&&l<E&&(!p||((k=R.options.layer)!==null&&k!==void 0?k:"bottom")===p)&&(yield R)}forEachDecorationAtCell(l,c,p,_){this._decorations.forEachByKey(c,(C=>{var k,v,E;g=(k=C.options.x)!==null&&k!==void 0?k:0,y=g+((v=C.options.width)!==null&&v!==void 0?v:1),l>=g&&l<y&&(!p||((E=C.options.layer)!==null&&E!==void 0?E:"bottom")===p)&&_(C)}))}}s.DecorationService=b;class r extends d.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=u.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=u.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(l){super(),this.options=l,this.onRenderEmitter=this.register(new f.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=l.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.InstantiationService=s.ServiceCollection=void 0;const u=a(2585),f=a(8343);class d{constructor(...g){this._entries=new Map;for(const[y,b]of g)this.set(y,b)}set(g,y){const b=this._entries.get(g);return this._entries.set(g,y),b}forEach(g){for(const[y,b]of this._entries.entries())g(y,b)}has(g){return this._entries.has(g)}get(g){return this._entries.get(g)}}s.ServiceCollection=d,s.InstantiationService=class{constructor(){this._services=new d,this._services.set(u.IInstantiationService,this)}setService(m,g){this._services.set(m,g)}getService(m){return this._services.get(m)}createInstance(m,...g){const y=(0,f.getServiceDependencies)(m).sort(((o,l)=>o.index-l.index)),b=[];for(const o of y){const l=this._services.get(o.id);if(!l)throw new Error(`[createInstance] ${m.name} depends on UNKNOWN service ${o.id}.`);b.push(l)}const r=y.length>0?y[0].index:g.length;if(g.length!==r)throw new Error(`[createInstance] First service dependency of ${m.name} at position ${r+1} conflicts with ${g.length} static arguments`);return new m(...g,...b)}}},7866:function(w,s,a){var u=this&&this.__decorate||function(r,o,l,c){var p,_=arguments.length,C=_<3?o:c===null?c=Object.getOwnPropertyDescriptor(o,l):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(r,o,l,c);else for(var k=r.length-1;k>=0;k--)(p=r[k])&&(C=(_<3?p(C):_>3?p(o,l,C):p(o,l))||C);return _>3&&C&&Object.defineProperty(o,l,C),C},f=this&&this.__param||function(r,o){return function(l,c){o(l,c,r)}};Object.defineProperty(s,"__esModule",{value:!0}),s.traceCall=s.setTraceLogger=s.LogService=void 0;const d=a(844),m=a(2585),g={trace:m.LogLevelEnum.TRACE,debug:m.LogLevelEnum.DEBUG,info:m.LogLevelEnum.INFO,warn:m.LogLevelEnum.WARN,error:m.LogLevelEnum.ERROR,off:m.LogLevelEnum.OFF};let y,b=s.LogService=class extends d.Disposable{get logLevel(){return this._logLevel}constructor(r){super(),this._optionsService=r,this._logLevel=m.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),y=this}_updateLogLevel(){this._logLevel=g[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(r){for(let o=0;o<r.length;o++)typeof r[o]=="function"&&(r[o]=r[o]())}_log(r,o,l){this._evalLazyOptionalParams(l),r.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+o,...l)}trace(r,...o){var l,c;this._logLevel<=m.LogLevelEnum.TRACE&&this._log((c=(l=this._optionsService.options.logger)===null||l===void 0?void 0:l.trace.bind(this._optionsService.options.logger))!==null&&c!==void 0?c:console.log,r,o)}debug(r,...o){var l,c;this._logLevel<=m.LogLevelEnum.DEBUG&&this._log((c=(l=this._optionsService.options.logger)===null||l===void 0?void 0:l.debug.bind(this._optionsService.options.logger))!==null&&c!==void 0?c:console.log,r,o)}info(r,...o){var l,c;this._logLevel<=m.LogLevelEnum.INFO&&this._log((c=(l=this._optionsService.options.logger)===null||l===void 0?void 0:l.info.bind(this._optionsService.options.logger))!==null&&c!==void 0?c:console.info,r,o)}warn(r,...o){var l,c;this._logLevel<=m.LogLevelEnum.WARN&&this._log((c=(l=this._optionsService.options.logger)===null||l===void 0?void 0:l.warn.bind(this._optionsService.options.logger))!==null&&c!==void 0?c:console.warn,r,o)}error(r,...o){var l,c;this._logLevel<=m.LogLevelEnum.ERROR&&this._log((c=(l=this._optionsService.options.logger)===null||l===void 0?void 0:l.error.bind(this._optionsService.options.logger))!==null&&c!==void 0?c:console.error,r,o)}};s.LogService=b=u([f(0,m.IOptionsService)],b),s.setTraceLogger=function(r){y=r},s.traceCall=function(r,o,l){if(typeof l.value!="function")throw new Error("not supported");const c=l.value;l.value=function(...p){if(y.logLevel!==m.LogLevelEnum.TRACE)return c.apply(this,p);y.trace(`GlyphRenderer#${c.name}(${p.map((C=>JSON.stringify(C))).join(", ")})`);const _=c.apply(this,p);return y.trace(`GlyphRenderer#${c.name} return`,_),_}}},7302:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OptionsService=s.DEFAULT_OPTIONS=void 0;const u=a(8460),f=a(844),d=a(6114);s.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:d.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const m=["normal","bold","100","200","300","400","500","600","700","800","900"];class g extends f.Disposable{constructor(b){super(),this._onOptionChange=this.register(new u.EventEmitter),this.onOptionChange=this._onOptionChange.event;const r=Object.assign({},s.DEFAULT_OPTIONS);for(const o in b)if(o in r)try{const l=b[o];r[o]=this._sanitizeAndValidateOption(o,l)}catch(l){console.error(l)}this.rawOptions=r,this.options=Object.assign({},r),this._setupOptions()}onSpecificOptionChange(b,r){return this.onOptionChange((o=>{o===b&&r(this.rawOptions[b])}))}onMultipleOptionChange(b,r){return this.onOptionChange((o=>{b.indexOf(o)!==-1&&r()}))}_setupOptions(){const b=o=>{if(!(o in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${o}"`);return this.rawOptions[o]},r=(o,l)=>{if(!(o in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${o}"`);l=this._sanitizeAndValidateOption(o,l),this.rawOptions[o]!==l&&(this.rawOptions[o]=l,this._onOptionChange.fire(o))};for(const o in this.rawOptions){const l={get:b.bind(this,o),set:r.bind(this,o)};Object.defineProperty(this.options,o,l)}}_sanitizeAndValidateOption(b,r){switch(b){case"cursorStyle":if(r||(r=s.DEFAULT_OPTIONS[b]),!(function(o){return o==="block"||o==="underline"||o==="bar"})(r))throw new Error(`"${r}" is not a valid value for ${b}`);break;case"wordSeparator":r||(r=s.DEFAULT_OPTIONS[b]);break;case"fontWeight":case"fontWeightBold":if(typeof r=="number"&&1<=r&&r<=1e3)break;r=m.includes(r)?r:s.DEFAULT_OPTIONS[b];break;case"cursorWidth":r=Math.floor(r);case"lineHeight":case"tabStopWidth":if(r<1)throw new Error(`${b} cannot be less than 1, value: ${r}`);break;case"minimumContrastRatio":r=Math.max(1,Math.min(21,Math.round(10*r)/10));break;case"scrollback":if((r=Math.min(r,4294967295))<0)throw new Error(`${b} cannot be less than 0, value: ${r}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(r<=0)throw new Error(`${b} cannot be less than or equal to 0, value: ${r}`);break;case"rows":case"cols":if(!r&&r!==0)throw new Error(`${b} must be numeric, value: ${r}`);break;case"windowsPty":r=r??{}}return r}}s.OptionsService=g},2660:function(w,s,a){var u=this&&this.__decorate||function(g,y,b,r){var o,l=arguments.length,c=l<3?y:r===null?r=Object.getOwnPropertyDescriptor(y,b):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(g,y,b,r);else for(var p=g.length-1;p>=0;p--)(o=g[p])&&(c=(l<3?o(c):l>3?o(y,b,c):o(y,b))||c);return l>3&&c&&Object.defineProperty(y,b,c),c},f=this&&this.__param||function(g,y){return function(b,r){y(b,r,g)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkService=void 0;const d=a(2585);let m=s.OscLinkService=class{constructor(g){this._bufferService=g,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(g){const y=this._bufferService.buffer;if(g.id===void 0){const p=y.addMarker(y.ybase+y.y),_={data:g,id:this._nextId++,lines:[p]};return p.onDispose((()=>this._removeMarkerFromLink(_,p))),this._dataByLinkId.set(_.id,_),_.id}const b=g,r=this._getEntryIdKey(b),o=this._entriesWithId.get(r);if(o)return this.addLineToLink(o.id,y.ybase+y.y),o.id;const l=y.addMarker(y.ybase+y.y),c={id:this._nextId++,key:this._getEntryIdKey(b),data:b,lines:[l]};return l.onDispose((()=>this._removeMarkerFromLink(c,l))),this._entriesWithId.set(c.key,c),this._dataByLinkId.set(c.id,c),c.id}addLineToLink(g,y){const b=this._dataByLinkId.get(g);if(b&&b.lines.every((r=>r.line!==y))){const r=this._bufferService.buffer.addMarker(y);b.lines.push(r),r.onDispose((()=>this._removeMarkerFromLink(b,r)))}}getLinkData(g){var y;return(y=this._dataByLinkId.get(g))===null||y===void 0?void 0:y.data}_getEntryIdKey(g){return`${g.id};;${g.uri}`}_removeMarkerFromLink(g,y){const b=g.lines.indexOf(y);b!==-1&&(g.lines.splice(b,1),g.lines.length===0&&(g.data.id!==void 0&&this._entriesWithId.delete(g.key),this._dataByLinkId.delete(g.id)))}};s.OscLinkService=m=u([f(0,d.IBufferService)],m)},8343:(w,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createDecorator=s.getServiceDependencies=s.serviceRegistry=void 0;const a="di$target",u="di$dependencies";s.serviceRegistry=new Map,s.getServiceDependencies=function(f){return f[u]||[]},s.createDecorator=function(f){if(s.serviceRegistry.has(f))return s.serviceRegistry.get(f);const d=function(m,g,y){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(b,r,o){r[a]===r?r[u].push({id:b,index:o}):(r[u]=[{id:b,index:o}],r[a]=r)})(d,m,y)};return d.toString=()=>f,s.serviceRegistry.set(f,d),d}},2585:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.IDecorationService=s.IUnicodeService=s.IOscLinkService=s.IOptionsService=s.ILogService=s.LogLevelEnum=s.IInstantiationService=s.ICharsetService=s.ICoreService=s.ICoreMouseService=s.IBufferService=void 0;const u=a(8343);var f;s.IBufferService=(0,u.createDecorator)("BufferService"),s.ICoreMouseService=(0,u.createDecorator)("CoreMouseService"),s.ICoreService=(0,u.createDecorator)("CoreService"),s.ICharsetService=(0,u.createDecorator)("CharsetService"),s.IInstantiationService=(0,u.createDecorator)("InstantiationService"),(function(d){d[d.TRACE=0]="TRACE",d[d.DEBUG=1]="DEBUG",d[d.INFO=2]="INFO",d[d.WARN=3]="WARN",d[d.ERROR=4]="ERROR",d[d.OFF=5]="OFF"})(f||(s.LogLevelEnum=f={})),s.ILogService=(0,u.createDecorator)("LogService"),s.IOptionsService=(0,u.createDecorator)("OptionsService"),s.IOscLinkService=(0,u.createDecorator)("OscLinkService"),s.IUnicodeService=(0,u.createDecorator)("UnicodeService"),s.IDecorationService=(0,u.createDecorator)("DecorationService")},1480:(w,s,a)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeService=void 0;const u=a(8460),f=a(225);s.UnicodeService=class{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new u.EventEmitter,this.onChange=this._onChange.event;const d=new f.UnicodeV6;this.register(d),this._active=d.version,this._activeProvider=d}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(d){if(!this._providers[d])throw new Error(`unknown Unicode version "${d}"`);this._active=d,this._activeProvider=this._providers[d],this._onChange.fire(d)}register(d){this._providers[d.version]=d}wcwidth(d){return this._activeProvider.wcwidth(d)}getStringCellWidth(d){let m=0;const g=d.length;for(let y=0;y<g;++y){let b=d.charCodeAt(y);if(55296<=b&&b<=56319){if(++y>=g)return m+this.wcwidth(b);const r=d.charCodeAt(y);56320<=r&&r<=57343?b=1024*(b-55296)+r-56320+65536:m+=this.wcwidth(r)}m+=this.wcwidth(b)}return m}}}},h={};function S(w){var s=h[w];if(s!==void 0)return s.exports;var a=h[w]={exports:{}};return i[w].call(a.exports,a,a.exports,S),a.exports}var x={};return(()=>{var w=x;Object.defineProperty(w,"__esModule",{value:!0}),w.Terminal=void 0;const s=S(9042),a=S(3236),u=S(844),f=S(5741),d=S(8285),m=S(7975),g=S(7090),y=["cols","rows"];class b extends u.Disposable{constructor(o){super(),this._core=this.register(new a.Terminal(o)),this._addonManager=this.register(new f.AddonManager),this._publicOptions=Object.assign({},this._core.options);const l=p=>this._core.options[p],c=(p,_)=>{this._checkReadonlyOptions(p),this._core.options[p]=_};for(const p in this._core.options){const _={get:l.bind(this,p),set:c.bind(this,p)};Object.defineProperty(this._publicOptions,p,_)}}_checkReadonlyOptions(o){if(y.includes(o))throw new Error(`Option "${o}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new m.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new g.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new d.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const o=this._core.coreService.decPrivateModes;let l="none";switch(this._core.coreMouseService.activeProtocol){case"X10":l="x10";break;case"VT200":l="vt200";break;case"DRAG":l="drag";break;case"ANY":l="any"}return{applicationCursorKeysMode:o.applicationCursorKeys,applicationKeypadMode:o.applicationKeypad,bracketedPasteMode:o.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:l,originMode:o.origin,reverseWraparoundMode:o.reverseWraparound,sendFocusMode:o.sendFocus,wraparoundMode:o.wraparound}}get options(){return this._publicOptions}set options(o){for(const l in o)this._publicOptions[l]=o[l]}blur(){this._core.blur()}focus(){this._core.focus()}resize(o,l){this._verifyIntegers(o,l),this._core.resize(o,l)}open(o){this._core.open(o)}attachCustomKeyEventHandler(o){this._core.attachCustomKeyEventHandler(o)}registerLinkProvider(o){return this._core.registerLinkProvider(o)}registerCharacterJoiner(o){return this._checkProposedApi(),this._core.registerCharacterJoiner(o)}deregisterCharacterJoiner(o){this._checkProposedApi(),this._core.deregisterCharacterJoiner(o)}registerMarker(o=0){return this._verifyIntegers(o),this._core.registerMarker(o)}registerDecoration(o){var l,c,p;return this._checkProposedApi(),this._verifyPositiveIntegers((l=o.x)!==null&&l!==void 0?l:0,(c=o.width)!==null&&c!==void 0?c:0,(p=o.height)!==null&&p!==void 0?p:0),this._core.registerDecoration(o)}hasSelection(){return this._core.hasSelection()}select(o,l,c){this._verifyIntegers(o,l,c),this._core.select(o,l,c)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(o,l){this._verifyIntegers(o,l),this._core.selectLines(o,l)}dispose(){super.dispose()}scrollLines(o){this._verifyIntegers(o),this._core.scrollLines(o)}scrollPages(o){this._verifyIntegers(o),this._core.scrollPages(o)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(o){this._verifyIntegers(o),this._core.scrollToLine(o)}clear(){this._core.clear()}write(o,l){this._core.write(o,l)}writeln(o,l){this._core.write(o),this._core.write(`\r
16
+ `,l)}paste(o){this._core.paste(o)}refresh(o,l){this._verifyIntegers(o,l),this._core.refresh(o,l)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(o){this._addonManager.loadAddon(this,o)}static get strings(){return s}_verifyIntegers(...o){for(const l of o)if(l===1/0||isNaN(l)||l%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...o){for(const l of o)if(l&&(l===1/0||isNaN(l)||l%1!=0||l<0))throw new Error("This API only accepts positive integers")}}w.Terminal=b})(),x})()))})(ir)),ir.exports}var rl=tl();var sl=2,il=1,nl=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let n=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(n._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let n=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,i=window.getComputedStyle(this._terminal.element.parentElement),h=parseInt(i.getPropertyValue("height")),S=Math.max(0,parseInt(i.getPropertyValue("width"))),x=window.getComputedStyle(this._terminal.element),w={top:parseInt(x.getPropertyValue("padding-top")),bottom:parseInt(x.getPropertyValue("padding-bottom")),right:parseInt(x.getPropertyValue("padding-right")),left:parseInt(x.getPropertyValue("padding-left"))},s=w.top+w.bottom,a=w.right+w.left,u=h-s,f=S-a-n;return{cols:Math.max(sl,Math.floor(f/e.css.cell.width)),rows:Math.max(il,Math.floor(u/e.css.cell.height))}}};function ol(e={}){const{cwd:n,cols:i,rows:h,onOutput:S,onExit:x}=e,[w,s]=A.useState(null),[a,u]=A.useState(()=>ct.isConnected()),[f,d]=A.useState(!1),[m,g]=A.useState(!1),[y,b]=A.useState(!1),r=A.useRef({onOutput:S,onExit:x});r.current={onOutput:S,onExit:x};const o=A.useRef(null);o.current=w,A.useEffect(()=>{if(!w)return;const C=ct.getSocket(),k=()=>{u(!0),d(!1),s(null),b(!0)},v=()=>{u(!1),d(!1)},E=T=>{T.terminalId===w&&r.current.onOutput?.(T.data)},R=T=>{T.terminalId===w&&(d(!1),r.current.onExit?.(T.exitCode),s(null))},O=T=>{T.terminalId===w&&d(!0)},L=T=>{T.terminalId===w&&d(!1)};return C.on("connect",k),C.on("disconnect",v),C.on(Oe.TERMINAL_STDOUT,E),C.on(Oe.TERMINAL_EXIT,R),C.on(Oe.TERMINAL_SUBSCRIBED,O),C.on(Oe.TERMINAL_UNSUBSCRIBED,L),u(C.connected),C.connected&&C.emit(Lt.SUBSCRIBE,{topic:"terminal",id:w},T=>{T.success&&d(!0)}),()=>{C.off("connect",k),C.off("disconnect",v),C.off(Oe.TERMINAL_STDOUT,E),C.off(Oe.TERMINAL_EXIT,R),C.off(Oe.TERMINAL_SUBSCRIBED,O),C.off(Oe.TERMINAL_UNSUBSCRIBED,L),C.emit(Lt.UNSUBSCRIBE,{topic:"terminal",id:w})}},[w]);const l=A.useCallback(async()=>{const C=ct.getSocket();if(!C.connected)return null;g(!0);try{const k=await de.post("/terminals",{socketId:C.id,cwd:n,cols:i,rows:h});return s(k.terminalId),b(!1),k.terminalId}catch(k){return console.error("[useStandaloneTerminal] Failed to create terminal:",k),null}finally{g(!1)}},[n,i,h]),c=A.useCallback(async()=>{const C=o.current;if(C){try{await de.delete(`/terminals/${C}`)}catch(k){console.error("[useStandaloneTerminal] Failed to destroy terminal:",k)}s(null),d(!1)}},[]),p=A.useCallback(C=>{const k=o.current;if(!k)return;ct.getSocket().emit(Lt.TERMINAL_INPUT,{terminalId:k,data:C})},[]),_=A.useCallback((C,k)=>{const v=o.current;if(!v)return;ct.getSocket().emit(Lt.TERMINAL_RESIZE,{terminalId:v,cols:C,rows:k})},[]);return A.useEffect(()=>()=>{const C=o.current;C&&de.delete(`/terminals/${C}`).catch(()=>{})},[]),{terminalId:w,isConnected:a,isAttached:f,isCreating:m,needsRecreate:y,create:l,destroy:c,sendInput:p,resize:_}}function al({terminalRef:e,xtermRef:n,fitAddonRef:i,isVisible:h=!0,onResize:S}){const x=A.useRef(null),w=A.useRef(null),s=A.useRef(0),a=A.useCallback(()=>{x.current!=null&&(window.clearTimeout(x.current),x.current=null),w.current!=null&&(window.cancelAnimationFrame(w.current),w.current=null)},[]),u=A.useCallback(()=>{const m=i.current,g=n.current,y=e.current;if(!m||!g||!y||y.clientWidth<=0||y.clientHeight<=0)return!1;try{return m.fit(),g.cols>0&&g.rows>0&&S(g.cols,g.rows),!0}catch{return!1}},[i,S,e,n]),f=A.useCallback((m=6)=>{a();const g=s.current+1;s.current=g;let y=0;const b=()=>{s.current===g&&(w.current=window.requestAnimationFrame(()=>{if(w.current=null,s.current!==g)return;const r=u(),o=y<2;y<m&&(!r||o)&&(y+=1,x.current=window.setTimeout(b,50))}))};b()},[a,u]),d=A.useCallback(()=>{s.current+=1,a()},[a]);return A.useEffect(()=>d,[d]),A.useEffect(()=>{h&&f(8)},[h,f]),A.useEffect(()=>{const m=e.current;if(!m)return;if(typeof ResizeObserver>"u"){f(8);return}const g=new ResizeObserver(()=>{f(4)});return g.observe(m),m.parentElement&&g.observe(m.parentElement),f(8),()=>{g.disconnect()}},[f,e]),{fitNow:u,scheduleFit:f}}const ll=ue.memo(function({cwd:n,isVisible:i=!0,onExit:h,onReady:S}){const x=A.useRef(null),w=A.useRef(null),s=A.useRef(null),a=A.useRef(!1),{terminalId:u,isAttached:f,needsRecreate:d,create:m,sendInput:g,resize:y}=ol({cwd:n,onOutput:A.useCallback(o=>{w.current?.write(o)},[]),onExit:A.useCallback(o=>{w.current?.writeln(`\r
17
+ \x1B[90m[Process exited with code ${o}]\x1B[0m`),h?.(o)},[h])}),{scheduleFit:b}=al({terminalRef:x,xtermRef:w,fitAddonRef:s,isVisible:i,onResize:y}),r=A.useCallback(o=>{w.current?.paste(o)},[]);return A.useEffect(()=>{i||w.current?.blur()},[i]),A.useEffect(()=>{if(!d)return;const o=w.current;o&&o.writeln(`\r
18
+ \x1B[33m[Terminal disconnected — reconnecting...]\x1B[0m`),m()},[d,m]),A.useLayoutEffect(()=>{if(!x.current)return;const o=new rl.Terminal({cursorBlink:!0,fontSize:13,fontFamily:"'JetBrains Mono', 'Fira Code', 'Cascadia Code', Menlo, Monaco, 'Courier New', monospace",lineHeight:1.4,theme:$n(),scrollback:5e3,convertEol:!0}),l=new nl;return o.loadAddon(l),o.open(x.current),w.current=o,s.current=l,b(8),()=>{o.dispose(),w.current=null,s.current=null}},[b]),A.useEffect(()=>{a.current||(a.current=!0,m())},[m]),A.useEffect(()=>{const o=w.current;if(!o||!f)return;const l=o.onData(c=>{g(c)});return()=>l.dispose()},[g,f]),A.useEffect(()=>{f&&(b(4),S?.({sendInput:g,paste:r}))},[f,S,r,b,g]),t.jsxs("div",{className:"relative flex h-full w-full min-h-0 min-w-0 flex-col overflow-hidden bg-terminal",children:[!u&&t.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-terminal-muted-foreground text-xs z-10 bg-terminal",children:"Starting terminal..."}),t.jsx("div",{ref:x,className:"terminal-xterm-host flex-1 min-h-0 min-w-0 w-full overflow-hidden"})]})}),cl=ue.memo(function({commands:n,onSelect:i}){const{t:h}=se();return n.length===0?null:t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"w-px h-4 bg-terminal-border mx-1 shrink-0"}),t.jsxs(Xs,{children:[t.jsxs(Ys,{className:"group mx-1 flex shrink-0 items-center gap-1.5 rounded px-2.5 py-1 text-xs font-medium text-terminal-muted-foreground transition-colors hover:bg-terminal-accent hover:text-terminal-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-terminal-muted-foreground data-[state=open]:bg-terminal-accent data-[state=open]:text-terminal-foreground",children:[t.jsx(Zn,{size:12}),t.jsx("span",{children:h("快捷命令")}),t.jsx($e,{size:10,className:"transition-transform group-data-[state=open]:rotate-180"})]}),t.jsx(Vs,{align:"end",className:"w-72",children:t.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:n.map((S,x)=>t.jsxs(Yn,{icon:t.jsx(Un,{className:"mt-0.5"}),onSelect:()=>i(S.command),className:"items-start",children:[t.jsx("span",{className:"block truncate font-medium text-foreground",children:S.name}),t.jsx("span",{className:"block truncate font-mono text-xs text-muted-foreground",children:S.command})]},x))})})]})]})}),hi="\x1B",dl="\x07",hl="œ";function ul(e){const n=e.charCodeAt(0);return n>=64&&n<=126}function as(e,n){let i=n;for(;i<e.length;){if(e[i]===dl||e[i]===hl)return i+1;if(e[i]===hi&&e[i+1]==="\\")return i+2;i+=1}return i}function ls(e,n){let i=n;for(;i<e.length&&!ul(e[i]);)i+=1;return i<e.length?i+1:i}function fl(e){let n="";for(let i=0;i<e.length;){if(e[i]==="›"){i=ls(e,i+1);continue}if(e[i]===""){i=as(e,i+1);continue}if(e[i]!==hi){n+=e[i],i+=1;continue}const h=e[i+1];if(h==="["){i=ls(e,i+2);continue}if(h==="]"||h==="P"||h==="X"||h==="^"||h==="_"){i=as(e,i+2);continue}for(i+=1;i<e.length;){const S=e.charCodeAt(i);if(S<32||S>47)break;i+=1}i<e.length&&(i+=1)}return n}const ml=200,pl=1e3,gl=512*1024;function vl(e){let n=e.reduce((h,S)=>h+S.data.length,0),i=0;for(;e.length-i>pl||n>gl&&e.length-i>1;)n-=e[i].data.length,i+=1;return{entries:i>0?e.slice(i):e,trimmed:i>0}}function _l(e,n){const i=!!e&&e.runtimeInstanceId!==n.runtimeInstanceId,h=i||n.reset,S=h?[]:e?.entries??[],x=new Set(S.map(a=>a.seq)),w=[...S,...n.entries.filter(a=>!x.has(a.seq))].sort((a,u)=>a.seq-u.seq),s=vl(w);return{...n,entries:s.entries,reset:n.reset||i||!h&&(e?.reset??!1),truncated:n.truncated||!h&&(e?.truncated??!1)||s.trimmed}}function Hr(e,n=!0){return Te({queryKey:ge.workspaceServices.list(e),queryFn:async()=>(await de.get(`/workspaces/${encodeURIComponent(e)}/services`)).services,enabled:n&&!!e,refetchInterval:n&&e?3e3:!1,refetchIntervalInBackground:!1,refetchOnWindowFocus:"always",refetchOnReconnect:"always"})}function bl(e,n,i,h=!0){const S=ut(),x=ge.workspaceServices.logs(e,n);return Te({queryKey:x,queryFn:async()=>{const w=S.getQueryData(x),s=w?Math.max(0,w.nextSeq-1):0,a=w===void 0?i:w.runtimeInstanceId,u=new URLSearchParams({limit:String(ml)});a!==null&&u.set("runtimeInstanceId",a),u.set("afterSeq",String(s));const f=await de.get(`/workspaces/${encodeURIComponent(e)}/services/${encodeURIComponent(n)}/logs?${u}`);return _l(w,f)},enabled:h&&!!e&&!!n,refetchInterval:w=>w.state.data?.hasMore?250:1e3,refetchIntervalInBackground:!1,refetchOnWindowFocus:"always",refetchOnReconnect:"always"})}const xl=[];function nr(e){return JSON.stringify([e.command,...e.args])}function cs(e,n,i){if(!e)return i;const h=new Date(e);return Number.isNaN(h.getTime())?i:new Intl.DateTimeFormat(n,{dateStyle:"medium",timeStyle:"medium"}).format(h)}function Sl(e){switch(e){case"RUNNING":return{label:"Running",dotClassName:"bg-terminal-green"};case"STARTING":return{label:"Starting",dotClassName:"bg-terminal-yellow"};case"STOPPING":return{label:"Stopping",dotClassName:"bg-terminal-yellow"};case"FAILED":return{label:"Failed",dotClassName:"bg-terminal-red"};case"EXITED":return{label:"Exited",dotClassName:"bg-terminal-muted-foreground"};default:return{label:"Stopped",dotClassName:"bg-terminal-bright-black"}}}function ds({state:e}){const{t:n}=se(),i=Sl(e);return t.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1.5 text-xs text-terminal-foreground",children:[t.jsx("span",{className:Q("h-1.5 w-1.5 rounded-full",i.dotClassName),"aria-hidden":"true"}),n(i.label)]})}function yl({message:e,onRetry:n}){const{t:i}=se();return t.jsxs("div",{className:"flex min-h-24 items-center justify-center gap-2 px-4 text-xs text-terminal-foreground",role:"alert",children:[t.jsx(Et,{size:14,className:"shrink-0 text-terminal-red","aria-hidden":"true"}),t.jsx("span",{children:e}),t.jsx("button",{type:"button",onClick:n,className:"flex h-7 w-7 shrink-0 items-center justify-center rounded text-terminal-muted-foreground transition-colors hover:bg-terminal-accent hover:text-terminal-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-terminal-muted-foreground",title:i("Retry"),"aria-label":i("Retry"),children:t.jsx(ft,{size:13})})]})}function wl({workspaceId:e,enabled:n=!0}){const{locale:i,t:h}=se(),S=Hr(e,n),x=S.data??xl,[w,s]=A.useState(null),a=x.find(g=>g.name===w)??x[0]??null,u=bl(e,a?.name??"",a?.runtimeInstanceId??null,n&&!!a),f=A.useMemo(()=>fl(u.data?.entries.map(g=>g.data).join("")??""),[u.data?.entries]),d=A.useRef(null),m=A.useRef(!0);return A.useEffect(()=>{m.current=!0},[a?.id,a?.runtimeInstanceId]),A.useEffect(()=>{const g=d.current;g&&m.current&&(g.scrollTop=g.scrollHeight)},[f]),t.jsxs("div",{className:"flex h-full min-h-0 w-full min-w-0 flex-col bg-terminal text-terminal-foreground md:flex-row",children:[t.jsxs("aside",{className:"flex max-h-[44%] min-h-32 shrink-0 flex-col border-b border-terminal-border bg-terminal-chrome md:max-h-none md:min-h-0 md:w-72 md:border-b-0 md:border-r",children:[t.jsxs("div",{className:"flex h-10 shrink-0 items-center justify-between border-b border-terminal-border px-3",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.jsx(br,{size:13,className:"shrink-0 text-terminal-muted-foreground","aria-hidden":"true"}),t.jsx("h2",{className:"truncate text-xs font-medium",children:h("Background services")})]}),!S.isLoading&&!S.isError&&t.jsx("span",{className:"text-[11px] tabular-nums text-terminal-muted-foreground",children:x.length})]}),t.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto scrollbar-app-thin",children:S.isLoading?t.jsxs("div",{className:"flex min-h-24 items-center justify-center gap-2 text-xs text-terminal-muted-foreground",children:[t.jsx(pe,{size:"sm"}),h("Loading background services...")]}):S.isError?t.jsx(yl,{message:h("Failed to load background services."),onRetry:()=>{S.refetch()}}):x.length===0?t.jsxs("div",{className:"flex min-h-24 flex-col items-center justify-center gap-2 px-4 text-center text-xs text-terminal-muted-foreground",children:[t.jsx(br,{size:22,"aria-hidden":"true"}),t.jsx("span",{children:h("No background services")})]}):x.map(g=>{const y=g.name===a?.name;return t.jsxs("button",{type:"button",onClick:()=>s(g.name),"aria-pressed":y,className:Q("block w-full border-b border-terminal-border px-3 py-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-terminal-muted-foreground",y?"bg-terminal":"hover:bg-terminal-accent"),children:[t.jsxs("span",{className:"flex min-w-0 items-center justify-between gap-2",children:[t.jsx("span",{className:"truncate text-xs font-medium text-terminal-foreground",children:g.name}),t.jsx(ds,{state:g.runtimeState})]}),t.jsx("span",{className:"mt-1 block truncate font-mono text-[11px] text-terminal-muted-foreground",title:nr(g),children:nr(g)}),t.jsxs("span",{className:"mt-1 flex min-w-0 items-center gap-1 text-[11px] text-terminal-muted-foreground",children:[t.jsx(Mr,{size:10,className:"shrink-0","aria-hidden":"true"}),t.jsx("span",{className:"truncate",children:g.relativeCwd||"."})]}),t.jsxs("span",{className:`mt-1 flex min-w-0 items-center gap-1 ${g.startedAt?"text-[11px]":"text-xs"} text-terminal-muted-foreground`,children:[t.jsx(Ke,{size:10,className:"shrink-0","aria-hidden":"true"}),t.jsx("span",{className:"truncate",children:cs(g.startedAt,i,h("Not started"))})]})]},g.id)})})]}),t.jsx("section",{className:"flex min-h-0 min-w-0 flex-1 flex-col bg-terminal","aria-label":h("Background service logs"),children:a?t.jsxs(t.Fragment,{children:[t.jsxs("header",{className:"shrink-0 border-b border-terminal-border bg-terminal-chrome",children:[t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 px-3 pt-2",children:[t.jsx("span",{className:"min-w-0 truncate text-xs font-semibold text-terminal-foreground",children:a.name}),t.jsx(ds,{state:a.runtimeState})]}),t.jsxs("div",{className:"max-h-32 overflow-y-auto overscroll-y-contain px-3 pb-2 scrollbar-app-thin focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-terminal-muted-foreground",tabIndex:0,"aria-label":`${a.name} ${h("Details")}`,children:[t.jsxs("dl",{className:"mt-1.5 grid min-w-0 gap-x-4 gap-y-1 text-xs text-terminal-muted-foreground sm:grid-cols-2",children:[t.jsxs("div",{className:"flex min-w-0 gap-1.5",children:[t.jsxs("dt",{className:"shrink-0",children:[h("Command"),":"]}),t.jsx("dd",{className:"min-w-0 break-all font-mono text-terminal-foreground",children:nr(a)})]}),t.jsxs("div",{className:"flex min-w-0 gap-1.5",children:[t.jsxs("dt",{className:"shrink-0",children:[h("Working directory"),":"]}),t.jsx("dd",{className:"min-w-0 break-all font-mono text-terminal-foreground",children:a.relativeCwd||"."})]}),t.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 sm:col-span-2",children:[t.jsx(Ke,{size:10,className:"shrink-0","aria-hidden":"true"}),t.jsxs("dt",{className:"shrink-0",children:[h("Started"),":"]}),t.jsx("dd",{className:"truncate text-terminal-foreground",children:cs(a.startedAt,i,h("Not started"))})]})]}),a.lastError&&t.jsxs("p",{className:"mt-1.5 flex min-w-0 items-start gap-1.5 break-words text-xs text-terminal-foreground",role:"alert",children:[t.jsx(Et,{size:12,className:"mt-0.5 shrink-0 text-terminal-red","aria-hidden":"true"}),t.jsx("span",{className:"min-w-0",children:a.lastError})]})]})]}),(u.data?.truncated||u.data?.reset)&&t.jsx("div",{className:"shrink-0 border-b border-terminal-yellow/20 bg-terminal-yellow/10 px-3 py-1.5 text-xs text-terminal-foreground",children:h("Earlier log output is unavailable.")}),u.isError&&t.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-terminal-red/20 bg-terminal-red/10 px-3 py-1.5 text-xs text-terminal-foreground",role:"alert",children:[t.jsx("span",{children:h("Failed to refresh service logs.")}),t.jsx("button",{type:"button",onClick:()=>{u.refetch()},className:"flex h-6 w-6 items-center justify-center rounded text-terminal-foreground transition-colors hover:bg-terminal-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-terminal-muted-foreground",title:h("Retry"),"aria-label":h("Retry"),children:t.jsx(ft,{size:11})})]}),t.jsx("div",{ref:d,onScroll:g=>{const y=g.currentTarget;m.current=y.scrollHeight-y.scrollTop-y.clientHeight<32},className:"min-h-0 flex-1 overflow-auto p-3 scrollbar-app-thin",role:"log","aria-live":"off",tabIndex:0,children:u.isLoading&&!u.data?t.jsxs("div",{className:"flex h-full items-center justify-center gap-2 text-xs text-terminal-muted-foreground",children:[t.jsx(pe,{size:"sm"}),h("Loading service logs...")]}):f?t.jsx("pre",{className:"m-0 whitespace-pre-wrap break-words font-mono text-xs leading-5 text-terminal-foreground",children:f}):t.jsx("div",{className:"flex h-full items-center justify-center text-xs text-terminal-muted-foreground",children:h("No logs yet")})})]}):t.jsx("div",{className:"flex h-full items-center justify-center px-4 text-center text-xs text-terminal-muted-foreground",children:S.isLoading?h("Loading background services..."):h("Select a background service")})})]})}let or=0;function hs(){return or+=1,{id:`shell-${or}`,order:or}}const Cl=ue.memo(function({cwd:n,isVisible:i=!0,workspaceId:h,quickCommands:S=[]}){const{t:x}=se(),[w,s]=A.useState(()=>[hs()]),[a,u]=A.useState(()=>w[0].id),[f,d]=A.useState(()=>new Set),[m,g]=A.useState(!1),[y,b]=A.useState(!1),[r,o]=A.useState(""),[l,c]=A.useState(null),[p,_]=A.useState("terminals"),C=A.useRef(new Map),k=h?p:"terminals",v=A.useCallback(P=>{C.current.delete(P),d(B=>{if(!B.has(P))return B;const q=new Set(B);return q.delete(P),q})},[]),E=A.useCallback(()=>{const P=hs();s(B=>[...B,P]),u(P.id)},[]),R=A.useCallback((P,B)=>{B.stopPropagation(),v(P),s(q=>{const K=q.filter($=>$.id!==P);return P===a&&K.length>0&&u(K[K.length-1].id),K})},[a,v]),O=A.useCallback(P=>{v(P),s(B=>{const q=B.filter(K=>K.id!==P);return P===a&&q.length>0&&u(q[q.length-1].id),q})},[a,v]),L=A.useCallback((P,B)=>{C.current.set(P,B),d(q=>{if(q.has(P))return q;const K=new Set(q);return K.add(P),K})},[]),T=A.useCallback(P=>{const B=C.current.get(a);B&&B.sendInput(P+"\r")},[a]),H=A.useCallback((P,B="")=>{c(P),o(B),b(!0)},[]),M=A.useCallback((P,B)=>{const q=C.current.get(P);return q?(q.paste(B),ye.success(x("Pasted into terminal")),!0):(ye.error(x("Terminal is not ready")),!1)},[x]),F=A.useCallback(async()=>{if(!C.current.has(a)){ye.error(x("Terminal is not ready"));return}const P=navigator.clipboard;if(!P?.readText){H(a);return}g(!0);try{const B=await P.readText();if(!B||B.includes(`
19
+ `)||B.includes("\r")){H(a,B);return}M(a,B)}catch{H(a)}finally{g(!1)}},[a,H,M,x]),U=A.useCallback(()=>{!r||!l||!M(l,r)||(b(!1),o(""),c(null))},[r,M,l]),N=A.useCallback(()=>{b(!1),o(""),c(null)},[]),D=f.has(a);return t.jsxs("div",{className:"flex h-full w-full min-h-0 min-w-0 flex-col overflow-hidden bg-terminal",children:[h&&t.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1 border-b border-terminal-border bg-terminal-chrome px-2 select-none",children:[t.jsxs("button",{type:"button",onClick:()=>_("terminals"),"aria-pressed":k==="terminals",className:Q("flex h-7 items-center gap-1.5 rounded px-2.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-terminal-muted-foreground",k==="terminals"?"bg-terminal text-terminal-foreground":"text-terminal-muted-foreground hover:bg-terminal-accent hover:text-terminal-foreground"),children:[t.jsx(xt,{size:12,"aria-hidden":"true"}),x("Interactive terminals")]}),t.jsxs("button",{type:"button",onClick:()=>_("services"),"aria-pressed":k==="services",className:Q("flex h-7 items-center gap-1.5 rounded px-2.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-terminal-muted-foreground",k==="services"?"bg-terminal text-terminal-foreground":"text-terminal-muted-foreground hover:bg-terminal-accent hover:text-terminal-foreground"),children:[t.jsx(br,{size:12,"aria-hidden":"true"}),x("Background services")]})]}),t.jsxs("div",{"aria-hidden":k!=="terminals",className:Q("min-h-0 flex-1 flex-col",k==="terminals"?"flex":"hidden"),children:[t.jsxs("div",{className:"flex items-center bg-terminal-chrome border-b border-terminal-border shrink-0 select-none",children:[t.jsx("div",{className:"flex items-center overflow-x-auto scrollbar-app-thin flex-1 min-w-0",children:w.map(P=>t.jsxs("button",{onClick:()=>u(P.id),className:Q("flex items-center gap-1.5 px-3 py-1.5 text-xs border-r border-terminal-border whitespace-nowrap group transition-colors",P.id===a?"bg-terminal text-terminal-foreground":"text-terminal-muted-foreground hover:bg-terminal-accent hover:text-terminal-foreground"),children:[t.jsx(xt,{size:11,className:"shrink-0"}),t.jsx("span",{children:x("Shell {count}",{count:P.order})}),w.length>1&&t.jsx("span",{onClick:B=>R(P.id,B),className:"ml-1 p-0.5 rounded hover:bg-terminal-accent opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:t.jsx(Qe,{size:10})})]},P.id))}),w.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"mx-0.5 block h-5 w-px shrink-0 bg-terminal-border md:hidden","aria-hidden":"true"}),t.jsx("button",{type:"button",onClick:F,disabled:!D||m,className:"flex h-11 w-11 shrink-0 items-center justify-center text-terminal-muted-foreground transition-colors hover:bg-terminal-accent hover:text-terminal-foreground active:bg-terminal-accent disabled:cursor-not-allowed disabled:opacity-40 md:hidden",title:x("Paste into terminal"),"aria-label":x("Paste into terminal"),children:m?t.jsx(pe,{size:"lg",className:"size-[18px]"}):t.jsx(Co,{size:18})})]}),t.jsx("button",{type:"button",onClick:E,className:"flex h-11 w-11 shrink-0 items-center justify-center text-terminal-muted-foreground transition-colors hover:bg-terminal-accent hover:text-terminal-foreground active:bg-terminal-accent md:h-auto md:w-auto md:px-2 md:py-1.5",title:x("New Terminal"),"aria-label":x("New Terminal"),children:t.jsx(_t,{size:14})}),S.length>0&&t.jsx(cl,{commands:S,onSelect:T})]}),t.jsx("div",{className:"flex-1 min-h-0 min-w-0 overflow-hidden relative",children:w.length===0?t.jsx("div",{className:"flex-1 flex items-center justify-center h-full text-terminal-muted-foreground",children:t.jsxs("div",{className:"flex flex-col items-center gap-2",children:[t.jsx(xt,{size:28}),t.jsx("span",{className:"text-xs",children:x("No terminals open")}),t.jsx("button",{onClick:E,className:"mt-1 rounded bg-terminal-chrome px-3 py-1 text-xs text-terminal-foreground ring-1 ring-inset ring-terminal-border transition-colors hover:bg-terminal-accent",children:x("New Terminal")})]})}):w.map(P=>t.jsx("div",{"aria-hidden":P.id!==a,className:Q("absolute inset-0 h-full w-full min-h-0 min-w-0 overflow-hidden",P.id===a?"visible pointer-events-auto":"invisible pointer-events-none"),children:t.jsx(ll,{cwd:n,isVisible:i&&k==="terminals"&&P.id===a,onExit:()=>O(P.id),onReady:B=>L(P.id,B)})},P.id))})]}),h&&k==="services"&&t.jsx("div",{className:"min-h-0 flex-1",children:t.jsx(wl,{workspaceId:h,enabled:i})}),t.jsx(jt,{isOpen:y,onClose:N,title:x("Paste into terminal"),className:"max-sm:inset-x-0 max-sm:top-auto max-sm:bottom-0 max-sm:max-h-[70dvh] max-sm:w-full max-sm:max-w-none max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none max-sm:rounded-t-lg max-sm:border-x-0 max-sm:border-b-0",action:t.jsxs(t.Fragment,{children:[t.jsx(_e,{variant:"ghost",size:"lg",onClick:N,className:"max-sm:h-11",children:x("Cancel")}),t.jsx(_e,{variant:"primary",size:"lg",onClick:U,disabled:!r,className:"max-sm:h-11",children:x("Paste")})]}),children:t.jsx(zn,{autoFocus:!0,value:r,onChange:P=>o(P.target.value),placeholder:x("Paste terminal input here"),"aria-label":x("Terminal paste content"),className:"min-h-32 resize-none bg-background font-mono"})})]})});function us(e,n){(n==null||n>e.length)&&(n=e.length);for(var i=0,h=Array(n);i<n;i++)h[i]=e[i];return h}function kl(e){if(Array.isArray(e))return e}function El(e,n,i){return(n=Pl(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function jl(e,n){var i=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(i!=null){var h,S,x,w,s=[],a=!0,u=!1;try{if(x=(i=i.call(e)).next,n!==0)for(;!(a=(h=x.call(i)).done)&&(s.push(h.value),s.length!==n);a=!0);}catch(f){u=!0,S=f}finally{try{if(!a&&i.return!=null&&(w=i.return(),Object(w)!==w))return}finally{if(u)throw S}}return s}}function Nl(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
20
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fs(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(e);n&&(h=h.filter(function(S){return Object.getOwnPropertyDescriptor(e,S).enumerable})),i.push.apply(i,h)}return i}function ms(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?fs(Object(i),!0).forEach(function(h){El(e,h,i[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):fs(Object(i)).forEach(function(h){Object.defineProperty(e,h,Object.getOwnPropertyDescriptor(i,h))})}return e}function Rl(e,n){if(e==null)return{};var i,h,S=Al(e,n);if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(e);for(h=0;h<x.length;h++)i=x[h],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(S[i]=e[i])}return S}function Al(e,n){if(e==null)return{};var i={};for(var h in e)if({}.hasOwnProperty.call(e,h)){if(n.indexOf(h)!==-1)continue;i[h]=e[h]}return i}function Ll(e,n){return kl(e)||jl(e,n)||Ml(e,n)||Nl()}function Tl(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var h=i.call(e,n);if(typeof h!="object")return h;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function Pl(e){var n=Tl(e,"string");return typeof n=="symbol"?n:n+""}function Ml(e,n){if(e){if(typeof e=="string")return us(e,n);var i={}.toString.call(e).slice(8,-1);return i==="Object"&&e.constructor&&(i=e.constructor.name),i==="Map"||i==="Set"?Array.from(e):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?us(e,n):void 0}}function Dl(e,n,i){return n in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function ps(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(e);n&&(h=h.filter(function(S){return Object.getOwnPropertyDescriptor(e,S).enumerable})),i.push.apply(i,h)}return i}function gs(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?ps(Object(i),!0).forEach(function(h){Dl(e,h,i[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ps(Object(i)).forEach(function(h){Object.defineProperty(e,h,Object.getOwnPropertyDescriptor(i,h))})}return e}function Bl(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];return function(h){return n.reduceRight(function(S,x){return x(S)},h)}}function bt(e){return function n(){for(var i=this,h=arguments.length,S=new Array(h),x=0;x<h;x++)S[x]=arguments[x];return S.length>=e.length?e.apply(this,S):function(){for(var w=arguments.length,s=new Array(w),a=0;a<w;a++)s[a]=arguments[a];return n.apply(i,[].concat(S,s))}}}function $t(e){return{}.toString.call(e).includes("Object")}function Ol(e){return!Object.keys(e).length}function kt(e){return typeof e=="function"}function Il(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function Fl(e,n){return $t(n)||Xe("changeType"),Object.keys(n).some(function(i){return!Il(e,i)})&&Xe("changeField"),n}function Hl(e){kt(e)||Xe("selectorType")}function Wl(e){kt(e)||$t(e)||Xe("handlerType"),$t(e)&&Object.values(e).some(function(n){return!kt(n)})&&Xe("handlersType")}function zl(e){e||Xe("initialIsRequired"),$t(e)||Xe("initialType"),Ol(e)&&Xe("initialContent")}function $l(e,n){throw new Error(e[n]||e.default)}var Ul={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},Xe=bt($l)(Ul),Dt={changes:Fl,selector:Hl,handler:Wl,initial:zl};function ql(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Dt.initial(e),Dt.handler(n);var i={current:e},h=bt(Yl)(i,n),S=bt(Xl)(i),x=bt(Dt.changes)(e),w=bt(Kl)(i);function s(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(f){return f};return Dt.selector(u),u(i.current)}function a(u){Bl(h,S,x,w)(u)}return[s,a]}function Kl(e,n){return kt(n)?n(e.current):n}function Xl(e,n){return e.current=gs(gs({},e.current),n),n}function Yl(e,n,i){return kt(n)?n(e.current):Object.keys(i).forEach(function(h){var S;return(S=n[h])===null||S===void 0?void 0:S.call(n,e.current[h])}),i}var Vl={create:ql},Gl={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function Zl(e){return function n(){for(var i=this,h=arguments.length,S=new Array(h),x=0;x<h;x++)S[x]=arguments[x];return S.length>=e.length?e.apply(this,S):function(){for(var w=arguments.length,s=new Array(w),a=0;a<w;a++)s[a]=arguments[a];return n.apply(i,[].concat(S,s))}}}function Ql(e){return{}.toString.call(e).includes("Object")}function Jl(e){return e||vs("configIsRequired"),Ql(e)||vs("configType"),e.urls?(ec(),{paths:{vs:e.urls.monacoBase}}):e}function ec(){console.warn(ui.deprecation)}function tc(e,n){throw new Error(e[n]||e.default)}var ui={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
21
+ You are using deprecated way of configuration.
22
+
23
+ Instead of using
24
+ monaco.config({ urls: { monacoBase: '...' } })
25
+ use
26
+ monaco.config({ paths: { vs: '...' } })
27
+
28
+ For more please check the link https://github.com/suren-atoyan/monaco-loader#config
29
+ `},vs=Zl(tc)(ui),rc={config:Jl},sc=function(){for(var n=arguments.length,i=new Array(n),h=0;h<n;h++)i[h]=arguments[h];return function(S){return i.reduceRight(function(x,w){return w(x)},S)}};function fi(e,n){return Object.keys(n).forEach(function(i){n[i]instanceof Object&&e[i]&&Object.assign(n[i],fi(e[i],n[i]))}),ms(ms({},e),n)}var ic={type:"cancelation",msg:"operation is manually canceled"};function ar(e){var n=!1,i=new Promise(function(h,S){e.then(function(x){return n?S(ic):h(x)}),e.catch(S)});return i.cancel=function(){return n=!0},i}var nc=["monaco"],oc=Vl.create({config:Gl,isInitialized:!1,resolve:null,reject:null,monaco:null}),mi=Ll(oc,2),Nt=mi[0],Vt=mi[1];function ac(e){var n=rc.config(e),i=n.monaco,h=Rl(n,nc);Vt(function(S){return{config:fi(S.config,h),monaco:i}})}function lc(){var e=Nt(function(n){var i=n.monaco,h=n.isInitialized,S=n.resolve;return{monaco:i,isInitialized:h,resolve:S}});if(!e.isInitialized){if(Vt({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),ar(lr);if(window.monaco&&window.monaco.editor)return pi(window.monaco),e.resolve(window.monaco),ar(lr);sc(cc,hc)(uc)}return ar(lr)}function cc(e){return document.body.appendChild(e)}function dc(e){var n=document.createElement("script");return e&&(n.src=e),n}function hc(e){var n=Nt(function(h){var S=h.config,x=h.reject;return{config:S,reject:x}}),i=dc("".concat(n.config.paths.vs,"/loader.js"));return i.onload=function(){return e()},i.onerror=n.reject,i}function uc(){var e=Nt(function(i){var h=i.config,S=i.resolve,x=i.reject;return{config:h,resolve:S,reject:x}}),n=window.require;n.config(e.config),n(["vs/editor/editor.main"],function(i){var h=i.m||i;pi(h),e.resolve(h)},function(i){e.reject(i)})}function pi(e){Nt().monaco||Vt({monaco:e})}function fc(){return Nt(function(e){var n=e.monaco;return n})}var lr=new Promise(function(e,n){return Vt({resolve:e,reject:n})}),gi={config:ac,init:lc,__getMonacoInstance:fc},mc={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},cr=mc,pc={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},gc=pc;function vc({children:e}){return ue.createElement("div",{style:gc.container},e)}var _c=vc,bc=_c;function xc({width:e,height:n,isEditorReady:i,loading:h,_ref:S,className:x,wrapperProps:w}){return ue.createElement("section",{style:{...cr.wrapper,width:e,height:n},...w},!i&&ue.createElement(bc,null,h),ue.createElement("div",{ref:S,style:{...cr.fullWidth,...!i&&cr.hide},className:x}))}var Sc=xc,vi=A.memo(Sc);function yc(e){A.useEffect(e,[])}var _i=yc;function wc(e,n,i=!0){let h=A.useRef(!0);A.useEffect(h.current||!i?()=>{h.current=!1}:e,n)}var je=wc;function St(){}function dt(e,n,i,h){return Cc(e,h)||kc(e,n,i,h)}function Cc(e,n){return e.editor.getModel(bi(e,n))}function kc(e,n,i,h){return e.editor.createModel(n,i,h?bi(e,h):void 0)}function bi(e,n){return e.Uri.parse(n)}function Ec({original:e,modified:n,language:i,originalLanguage:h,modifiedLanguage:S,originalModelPath:x,modifiedModelPath:w,keepCurrentOriginalModel:s=!1,keepCurrentModifiedModel:a=!1,theme:u="light",loading:f="Loading...",options:d={},height:m="100%",width:g="100%",className:y,wrapperProps:b={},beforeMount:r=St,onMount:o=St}){let[l,c]=A.useState(!1),[p,_]=A.useState(!0),C=A.useRef(null),k=A.useRef(null),v=A.useRef(null),E=A.useRef(o),R=A.useRef(r),O=A.useRef(!1);_i(()=>{let M=gi.init();return M.then(F=>(k.current=F)&&_(!1)).catch(F=>F?.type!=="cancelation"&&console.error("Monaco initialization: error:",F)),()=>C.current?H():M.cancel()}),je(()=>{if(C.current&&k.current){let M=C.current.getOriginalEditor(),F=dt(k.current,e||"",h||i||"text",x||"");F!==M.getModel()&&M.setModel(F)}},[x],l),je(()=>{if(C.current&&k.current){let M=C.current.getModifiedEditor(),F=dt(k.current,n||"",S||i||"text",w||"");F!==M.getModel()&&M.setModel(F)}},[w],l),je(()=>{let M=C.current.getModifiedEditor();M.getOption(k.current.editor.EditorOption.readOnly)?M.setValue(n||""):n!==M.getValue()&&(M.executeEdits("",[{range:M.getModel().getFullModelRange(),text:n||"",forceMoveMarkers:!0}]),M.pushUndoStop())},[n],l),je(()=>{C.current?.getModel()?.original.setValue(e||"")},[e],l),je(()=>{let{original:M,modified:F}=C.current.getModel();k.current.editor.setModelLanguage(M,h||i||"text"),k.current.editor.setModelLanguage(F,S||i||"text")},[i,h,S],l),je(()=>{k.current?.editor.setTheme(u)},[u],l),je(()=>{C.current?.updateOptions(d)},[d],l);let L=A.useCallback(()=>{if(!k.current)return;R.current(k.current);let M=dt(k.current,e||"",h||i||"text",x||""),F=dt(k.current,n||"",S||i||"text",w||"");C.current?.setModel({original:M,modified:F})},[i,n,S,e,h,x,w]),T=A.useCallback(()=>{!O.current&&v.current&&(C.current=k.current.editor.createDiffEditor(v.current,{automaticLayout:!0,...d}),L(),k.current?.editor.setTheme(u),c(!0),O.current=!0)},[d,u,L]);A.useEffect(()=>{l&&E.current(C.current,k.current)},[l]),A.useEffect(()=>{!p&&!l&&T()},[p,l,T]);function H(){let M=C.current?.getModel();s||M?.original?.dispose(),a||M?.modified?.dispose(),C.current?.dispose()}return ue.createElement(vi,{width:g,height:m,isEditorReady:l,loading:f,_ref:v,className:y,wrapperProps:b})}var jc=Ec;A.memo(jc);function Nc(e){let n=A.useRef();return A.useEffect(()=>{n.current=e},[e]),n.current}var Rc=Nc,Bt=new Map;function Ac({defaultValue:e,defaultLanguage:n,defaultPath:i,value:h,language:S,path:x,theme:w="light",line:s,loading:a="Loading...",options:u={},overrideServices:f={},saveViewState:d=!0,keepCurrentModel:m=!1,width:g="100%",height:y="100%",className:b,wrapperProps:r={},beforeMount:o=St,onMount:l=St,onChange:c,onValidate:p=St}){let[_,C]=A.useState(!1),[k,v]=A.useState(!0),E=A.useRef(null),R=A.useRef(null),O=A.useRef(null),L=A.useRef(l),T=A.useRef(o),H=A.useRef(),M=A.useRef(h),F=Rc(x),U=A.useRef(!1),N=A.useRef(!1);_i(()=>{let B=gi.init();return B.then(q=>(E.current=q)&&v(!1)).catch(q=>q?.type!=="cancelation"&&console.error("Monaco initialization: error:",q)),()=>R.current?P():B.cancel()}),je(()=>{let B=dt(E.current,e||h||"",n||S||"",x||i||"");B!==R.current?.getModel()&&(d&&Bt.set(F,R.current?.saveViewState()),R.current?.setModel(B),d&&R.current?.restoreViewState(Bt.get(x)))},[x],_),je(()=>{R.current?.updateOptions(u)},[u],_),je(()=>{!R.current||h===void 0||(R.current.getOption(E.current.editor.EditorOption.readOnly)?R.current.setValue(h):h!==R.current.getValue()&&(N.current=!0,R.current.executeEdits("",[{range:R.current.getModel().getFullModelRange(),text:h,forceMoveMarkers:!0}]),R.current.pushUndoStop(),N.current=!1))},[h],_),je(()=>{let B=R.current?.getModel();B&&S&&E.current?.editor.setModelLanguage(B,S)},[S],_),je(()=>{s!==void 0&&R.current?.revealLine(s)},[s],_),je(()=>{E.current?.editor.setTheme(w)},[w],_);let D=A.useCallback(()=>{if(!(!O.current||!E.current)&&!U.current){T.current(E.current);let B=x||i,q=dt(E.current,h||e||"",n||S||"",B||"");R.current=E.current?.editor.create(O.current,{model:q,automaticLayout:!0,...u},f),d&&R.current.restoreViewState(Bt.get(B)),E.current.editor.setTheme(w),s!==void 0&&R.current.revealLine(s),C(!0),U.current=!0}},[e,n,i,h,S,x,u,f,d,w,s]);A.useEffect(()=>{_&&L.current(R.current,E.current)},[_]),A.useEffect(()=>{!k&&!_&&D()},[k,_,D]),M.current=h,A.useEffect(()=>{_&&c&&(H.current?.dispose(),H.current=R.current?.onDidChangeModelContent(B=>{N.current||c(R.current.getValue(),B)}))},[_,c]),A.useEffect(()=>{if(_){let B=E.current.editor.onDidChangeMarkers(q=>{let K=R.current.getModel()?.uri;if(K&&q.find($=>$.path===K.path)){let $=E.current.editor.getModelMarkers({resource:K});p?.($)}});return()=>{B?.dispose()}}return()=>{}},[_,p]);function P(){H.current?.dispose(),m?d&&Bt.set(x,R.current.saveViewState()):R.current.getModel()?.dispose(),R.current.dispose()}return ue.createElement(vi,{width:g,height:y,isEditorReady:_,loading:a,_ref:O,className:b,wrapperProps:r})}var Lc=Ac,Tc=A.memo(Lc),Pc=Tc,Re=function(e,n){return Number(e.toFixed(n))},Mc=function(e,n){return typeof e=="number"?e:n},ce=function(e,n,i){i&&typeof i=="function"&&i(e,n)},Dc=function(e){return-Math.cos(e*Math.PI)/2+.5},Bc=function(e){return e},Oc=function(e){return e*e},Ic=function(e){return e*(2-e)},Fc=function(e){return e<.5?2*e*e:-1+(4-2*e)*e},Hc=function(e){return e*e*e},Wc=function(e){return--e*e*e+1},zc=function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},$c=function(e){return e*e*e*e},Uc=function(e){return 1- --e*e*e*e},qc=function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},Kc=function(e){return e*e*e*e*e},Xc=function(e){return 1+--e*e*e*e*e},Yc=function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e},xi={easeOut:Dc,linear:Bc,easeInQuad:Oc,easeOutQuad:Ic,easeInOutQuad:Fc,easeInCubic:Hc,easeOutCubic:Wc,easeInOutCubic:zc,easeInQuart:$c,easeOutQuart:Uc,easeInOutQuart:qc,easeInQuint:Kc,easeOutQuint:Xc,easeInOutQuint:Yc},Si=function(e){typeof e=="number"&&cancelAnimationFrame(e)},Le=function(e){e.mounted&&(Si(e.animation),e.animate=!1,e.animation=null,e.velocity=null)};function yi(e,n,i,h){if(e.mounted){var S=new Date().getTime(),x=1;Le(e),e.animation=function(){if(!e.mounted)return Si(e.animation);var w=new Date().getTime()-S,s=w/i,a=xi[n],u=a(s);w>=i?(h(x),e.animation=null):e.animation&&(h(u),requestAnimationFrame(e.animation))},requestAnimationFrame(e.animation)}}function Vc(e){var n=e.scale,i=e.positionX,h=e.positionY;return!(Number.isNaN(n)||Number.isNaN(i)||Number.isNaN(h))}function Je(e,n,i,h){var S=Vc(n);if(!(!e.mounted||!S)){var x=e.setTransformState,w=e.transformState,s=w.scale,a=w.positionX,u=w.positionY,f=n.scale-s,d=n.positionX-a,m=n.positionY-u;i===0?x(n.scale,n.positionX,n.positionY):yi(e,h,i,function(g){var y=s+f*g,b=a+d*g,r=u+m*g;x(y,b,r)})}}function Gc(e,n,i){var h=e.offsetWidth,S=e.offsetHeight,x=n.offsetWidth,w=n.offsetHeight,s=x*i,a=w*i,u=h-s,f=S-a;return{wrapperWidth:h,wrapperHeight:S,newContentWidth:s,newDiffWidth:u,newContentHeight:a,newDiffHeight:f}}var Zc=function(e,n,i,h,S,x,w){var s=e>n?i*(w?1:.5):0,a=h>S?x*(w?1:.5):0,u=e-n-s,f=s,d=h-S-a,m=a;return{minPositionX:u,maxPositionX:f,minPositionY:d,maxPositionY:m}},Wr=function(e,n){var i=e.wrapperComponent,h=e.contentComponent,S=e.setup.centerZoomedOut;if(!i||!h)throw new Error("Components are not mounted");var x=Gc(i,h,n),w=x.wrapperWidth,s=x.wrapperHeight,a=x.newContentWidth,u=x.newDiffWidth,f=x.newContentHeight,d=x.newDiffHeight,m=Zc(w,a,u,s,f,d,!!S);return m},Er=function(e,n,i,h){return h?e<n?Re(n,2):e>i?Re(i,2):Re(e,2):Re(e,2)},nt=function(e,n){var i=Wr(e,n);return e.bounds=i,i};function Rt(e,n,i,h,S,x,w){var s=i.minPositionX,a=i.minPositionY,u=i.maxPositionX,f=i.maxPositionY,d=0,m=0;w&&(d=S,m=x);var g=Er(e,s-d,u+d,h),y=Er(n,a-m,f+m,h);return{x:g,y}}function Gt(e,n,i,h,S,x){var w=e.transformState,s=w.scale,a=w.positionX,u=w.positionY,f=h-s;if(typeof n!="number"||typeof i!="number")return console.error("Mouse X and Y position were not provided!"),{x:a,y:u};var d=a-n*f,m=u-i*f,g=Rt(d,m,S,x,0,0,null);return g}function At(e,n,i,h,S){var x=S?h:0,w=n-x;return!Number.isNaN(i)&&e>=i?i:!Number.isNaN(n)&&e<=w?w:e}var _s=function(e,n){var i=e.setup.panning.excluded,h=e.isInitialized,S=e.wrapperComponent,x=n.target,w="shadowRoot"in x&&"composedPath"in n,s=w?n.composedPath().some(function(f){return f instanceof Element?S?.contains(f):!1}):S?.contains(x),a=h&&x&&s;if(!a)return!1;var u=Zt(x,i);return!u},bs=function(e){var n=e.isInitialized,i=e.isPanning,h=e.setup,S=h.panning.disabled,x=n&&i&&!S;return!!x},Qc=function(e,n){var i=e.transformState,h=i.positionX,S=i.positionY;e.isPanning=!0;var x=n.clientX,w=n.clientY;e.startCoords={x:x-h,y:w-S}},Jc=function(e,n){var i=n.touches,h=e.transformState,S=h.positionX,x=h.positionY;e.isPanning=!0;var w=i.length===1;if(w){var s=i[0].clientX,a=i[0].clientY;e.startCoords={x:s-S,y:a-x}}};function ed(e){var n=e.transformState,i=n.positionX,h=n.positionY,S=n.scale,x=e.setup,w=x.disabled,s=x.limitToBounds,a=x.centerZoomedOut,u=e.wrapperComponent;if(!(w||!u||!e.bounds)){var f=e.bounds,d=f.maxPositionX,m=f.minPositionX,g=f.maxPositionY,y=f.minPositionY,b=i>d||i<m,r=h>g||h<y,o=i>d?u.offsetWidth:e.setup.minPositionX||0,l=h>g?u.offsetHeight:e.setup.minPositionY||0,c=Gt(e,o,l,S,e.bounds,s||a),p=c.x,_=c.y;return{scale:S,positionX:b?p:i,positionY:r?_:h}}}function wi(e,n,i,h,S){var x=e.setup.limitToBounds,w=e.wrapperComponent,s=e.bounds,a=e.transformState,u=a.scale,f=a.positionX,d=a.positionY;if(!(w===null||s===null||n===f&&i===d)){var m=Rt(n,i,s,x,h,S,w),g=m.x,y=m.y;e.setTransformState(u,g,y)}}var td=function(e,n,i){var h=e.startCoords,S=e.transformState,x=e.setup.panning,w=x.lockAxisX,s=x.lockAxisY,a=S.positionX,u=S.positionY;if(!h)return{x:a,y:u};var f=n-h.x,d=i-h.y,m=w?a:f,g=s?u:d;return{x:m,y:g}},Ze=function(e,n){var i=e.setup,h=e.transformState,S=h.scale,x=i.minScale,w=i.disablePadding;return n>0&&S>=x&&!w?n:0},rd=function(e){var n=e.mounted,i=e.setup,h=i.disabled,S=i.velocityAnimation,x=e.transformState.scale,w=S.disabled,s=!w||x>1||!h||n;return!!s},sd=function(e){var n=e.mounted,i=e.velocity,h=e.bounds,S=e.setup,x=S.disabled,w=S.velocityAnimation,s=e.transformState.scale,a=w.disabled,u=!a||s>1||!x||n;return!(!u||!i||!h)};function id(e,n){var i=e.setup.velocityAnimation,h=i.equalToMove,S=i.animationTime,x=i.sensitivity;return h?S*n*x:S}function xs(e,n,i,h,S,x,w,s,a,u){if(S){if(n>w&&i>w){var f=w+(e-w)*u;return f>a?a:f<w?w:f}if(n<x&&i<x){var f=x+(e-x)*u;return f<s?s:f>x?x:f}}return h?n:Er(e,x,w,S)}function nd(e,n){var i=1;return n?Math.min(i,e.offsetWidth/window.innerWidth):i}function od(e,n){var i=rd(e);if(i){var h=e.lastMousePosition,S=e.velocityTime,x=e.setup,w=e.wrapperComponent,s=x.velocityAnimation.equalToMove,a=Date.now();if(h&&S&&w){var u=nd(w,s),f=n.x-h.x,d=n.y-h.y,m=f/u,g=d/u,y=a-S,b=f*f+d*d,r=Math.sqrt(b)/y;e.velocity={velocityX:m,velocityY:g,total:r}}e.lastMousePosition=n,e.velocityTime=a}}function ad(e){var n=e.velocity,i=e.bounds,h=e.setup,S=e.wrapperComponent,x=sd(e);if(!(!x||!n||!i||!S)){var w=n.velocityX,s=n.velocityY,a=n.total,u=i.maxPositionX,f=i.minPositionX,d=i.maxPositionY,m=i.minPositionY,g=h.limitToBounds,y=h.alignmentAnimation,b=h.zoomAnimation,r=h.panning,o=r.lockAxisY,l=r.lockAxisX,c=b.animationType,p=y.sizeX,_=y.sizeY,C=y.velocityAlignmentTime,k=C,v=id(e,a),E=Math.max(v,k),R=Ze(e,p),O=Ze(e,_),L=R*S.offsetWidth/100,T=O*S.offsetHeight/100,H=u+L,M=f-L,F=d+T,U=m-T,N=e.transformState,D=new Date().getTime();yi(e,c,E,function(P){var B=e.transformState,q=B.scale,K=B.positionX,$=B.positionY,W=new Date().getTime()-D,z=W/k,j=xi[y.animationType],I=1-j(Math.min(1,z)),X=1-P,Y=K+w*X,Z=$+s*X,G=xs(Y,N.positionX,K,l,g,f,u,M,H,I),te=xs(Z,N.positionY,$,o,g,m,d,U,F,I);(K!==Y||$!==Z)&&e.setTransformState(q,G,te)})}}function Ss(e,n){var i=e.transformState.scale;Le(e),nt(e,i),window.TouchEvent!==void 0&&n instanceof TouchEvent?Jc(e,n):Qc(e,n)}function zr(e,n){var i=e.transformState.scale,h=e.setup,S=h.minScale,x=h.alignmentAnimation,w=x.disabled,s=x.sizeX,a=x.sizeY,u=x.animationTime,f=x.animationType,d=w||i<S||!s&&!a;if(!d){var m=ed(e);m&&Je(e,m,n??u,f)}}function ys(e,n,i){var h=e.startCoords,S=e.setup,x=S.alignmentAnimation,w=x.sizeX,s=x.sizeY;if(h){var a=td(e,n,i),u=a.x,f=a.y,d=Ze(e,w),m=Ze(e,s);od(e,{x:u,y:f}),wi(e,u,f,d,m)}}function ld(e){if(e.isPanning){var n=e.setup.panning.velocityDisabled,i=e.velocity,h=e.wrapperComponent,S=e.contentComponent;e.isPanning=!1,e.animate=!1,e.animation=null;var x=h?.getBoundingClientRect(),w=S?.getBoundingClientRect(),s=x?.width||0,a=x?.height||0,u=w?.width||0,f=w?.height||0,d=s<u||a<f,m=!n&&i&&i?.total>.1&&d;m?ad(e):zr(e)}}function $r(e,n,i,h){var S=e.setup,x=S.minScale,w=S.maxScale,s=S.limitToBounds,a=At(Re(n,2),x,w,0,!1),u=nt(e,a),f=Gt(e,i,h,a,u,s),d=f.x,m=f.y;return{scale:a,positionX:d,positionY:m}}function Ci(e,n,i){var h=e.transformState.scale,S=e.wrapperComponent,x=e.setup,w=x.minScale,s=x.limitToBounds,a=x.zoomAnimation,u=a.disabled,f=a.animationTime,d=a.animationType,m=u||h>=w;if((h>=1||s)&&zr(e),!(m||!S||!e.mounted)){var g=n||S.offsetWidth/2,y=i||S.offsetHeight/2,b=$r(e,w,g,y);b&&Je(e,b,f,d)}}var Ye=function(){return Ye=Object.assign||function(n){for(var i,h=1,S=arguments.length;h<S;h++){i=arguments[h];for(var x in i)Object.prototype.hasOwnProperty.call(i,x)&&(n[x]=i[x])}return n},Ye.apply(this,arguments)};function ws(e,n,i){for(var h=0,S=n.length,x;h<S;h++)(x||!(h in n))&&(x||(x=Array.prototype.slice.call(n,0,h)),x[h]=n[h]);return e.concat(x||Array.prototype.slice.call(n))}var Ot={scale:1,positionX:0,positionY:0},vt={disabled:!1,minPositionX:null,maxPositionX:null,minPositionY:null,maxPositionY:null,minScale:1,maxScale:8,limitToBounds:!0,centerZoomedOut:!1,centerOnInit:!1,disablePadding:!1,smooth:!0,wheel:{step:.2,disabled:!1,smoothStep:.001,wheelDisabled:!1,touchPadDisabled:!1,activationKeys:[],excluded:[]},panning:{disabled:!1,velocityDisabled:!1,lockAxisX:!1,lockAxisY:!1,allowLeftClickPan:!0,allowMiddleClickPan:!0,allowRightClickPan:!0,wheelPanning:!1,activationKeys:[],excluded:[]},pinch:{step:5,disabled:!1,excluded:[]},doubleClick:{disabled:!1,step:.7,mode:"zoomIn",animationType:"easeOut",animationTime:200,excluded:[]},zoomAnimation:{disabled:!1,size:.4,animationTime:200,animationType:"easeOut"},alignmentAnimation:{disabled:!1,sizeX:100,sizeY:100,animationTime:200,velocityAlignmentTime:400,animationType:"easeOut"},velocityAnimation:{disabled:!1,sensitivity:1,animationTime:400,animationType:"easeOut",equalToMove:!0}},jr={wrapperClass:"react-transform-wrapper",contentClass:"react-transform-component"},ki=function(e){var n,i,h,S;return{previousScale:(n=e.initialScale)!==null&&n!==void 0?n:Ot.scale,scale:(i=e.initialScale)!==null&&i!==void 0?i:Ot.scale,positionX:(h=e.initialPositionX)!==null&&h!==void 0?h:Ot.positionX,positionY:(S=e.initialPositionY)!==null&&S!==void 0?S:Ot.positionY}},Cs=function(e){var n=Ye({},vt);return Object.keys(e).forEach(function(i){var h=typeof e[i]<"u",S=typeof vt[i]<"u";if(S&&h){var x=Object.prototype.toString.call(vt[i]),w=x==="[object Object]",s=x==="[object Array]";w?n[i]=Ye(Ye({},vt[i]),e[i]):s?n[i]=ws(ws([],vt[i],!0),e[i]):n[i]=e[i]}}),n},Ei=function(e,n,i){var h=e.transformState.scale,S=e.wrapperComponent,x=e.setup,w=x.maxScale,s=x.minScale,a=x.zoomAnimation,u=x.smooth,f=a.size;if(!S)throw new Error("Wrapper is not mounted");var d=u?h*Math.exp(n*i):h+n*i,m=At(Re(d,3),s,w,f,!1);return m};function ji(e,n,i,h,S){var x=e.wrapperComponent,w=e.transformState,s=w.scale,a=w.positionX,u=w.positionY;if(!x)return console.error("No WrapperComponent found");var f=x.offsetWidth,d=x.offsetHeight,m=(f/2-a)/s,g=(d/2-u)/s,y=Ei(e,n,i),b=$r(e,y,m,g);if(!b)return console.error("Error during zoom event. New transformation state was not calculated.");Je(e,b,h,S)}function Ni(e,n,i,h){var S=e.setup,x=e.wrapperComponent,w=S.limitToBounds,s=ki(e.props),a=e.transformState,u=a.scale,f=a.positionX,d=a.positionY;if(x){var m=Wr(e,s.scale),g=Rt(s.positionX,s.positionY,m,w,0,0,x),y={scale:s.scale,positionX:g.x,positionY:g.y};u===s.scale&&f===s.positionX&&d===s.positionY||(h?.(),Je(e,y,n,i))}}function cd(e,n,i,h){var S=e.getBoundingClientRect(),x=n.getBoundingClientRect(),w=i.getBoundingClientRect(),s=x.x*h.scale,a=x.y*h.scale;return{x:(S.x-w.x+s)/h.scale,y:(S.y-w.y+a)/h.scale}}function dd(e,n,i){var h=e.wrapperComponent,S=e.contentComponent,x=e.transformState,w=e.setup,s=w.limitToBounds,a=w.minScale,u=w.maxScale;if(!h||!S)return x;var f=h.getBoundingClientRect(),d=n.getBoundingClientRect(),m=cd(n,h,S,x),g=m.x,y=m.y,b=d.width/x.scale,r=d.height/x.scale,o=h.offsetWidth/b,l=h.offsetHeight/r,c=At(i||Math.min(o,l),a,u,0,!1),p=(f.width-b*c)/2,_=(f.height-r*c)/2,C=(f.left-g)*c+p,k=(f.top-y)*c+_,v=Wr(e,c),E=Rt(C,k,v,s,0,0,h),R=E.x,O=E.y;return{positionX:R,positionY:O,scale:c}}var hd=function(e){return function(n,i,h){n===void 0&&(n=.5),i===void 0&&(i=300),h===void 0&&(h="easeOut"),ji(e,1,n,i,h)}},ud=function(e){return function(n,i,h){n===void 0&&(n=.5),i===void 0&&(i=300),h===void 0&&(h="easeOut"),ji(e,-1,n,i,h)}},fd=function(e){return function(n,i,h,S,x){S===void 0&&(S=300),x===void 0&&(x="easeOut");var w=e.transformState,s=w.positionX,a=w.positionY,u=w.scale,f=e.wrapperComponent,d=e.contentComponent,m=e.setup.disabled;if(!(m||!f||!d)){var g={positionX:Number.isNaN(n)?s:n,positionY:Number.isNaN(i)?a:i,scale:Number.isNaN(h)?u:h};Je(e,g,S,x)}}},md=function(e){return function(n,i){n===void 0&&(n=200),i===void 0&&(i="easeOut"),Ni(e,n,i)}},pd=function(e){return function(n,i,h){i===void 0&&(i=200),h===void 0&&(h="easeOut");var S=e.transformState,x=e.wrapperComponent,w=e.contentComponent;if(x&&w){var s=Ri(n||S.scale,x,w);Je(e,s,i,h)}}},gd=function(e){return function(n,i,h,S){h===void 0&&(h=600),S===void 0&&(S="easeOut"),Le(e);var x=e.wrapperComponent,w=typeof n=="string"?document.getElementById(n):n;if(x&&w&&x.contains(w)){var s=dd(e,w,i);Je(e,s,h,S)}}},Ut=function(e){return{instance:e,zoomIn:hd(e),zoomOut:ud(e),setTransform:fd(e),resetTransform:md(e),centerView:pd(e),zoomToElement:gd(e)}},Nr=function(e){return{instance:e,state:e.transformState}},oe=function(e){var n={};return Object.assign(n,Nr(e)),Object.assign(n,Ut(e)),n},dr=!1;function hr(){try{var e={get passive(){return dr=!0,!1}};return e}catch{return dr=!1,dr}}var It=".".concat(jr.wrapperClass),Zt=function(e,n){return n.some(function(i){return e.matches("".concat(It," ").concat(i,", ").concat(It," .").concat(i,", ").concat(It," ").concat(i," *, ").concat(It," .").concat(i," *"))})},Rr=function(e){e&&clearTimeout(e)},vd=function(e,n,i){return"translate(".concat(e,"px, ").concat(n,"px) scale(").concat(i,")")},Ri=function(e,n,i){var h=i.offsetWidth*e,S=i.offsetHeight*e,x=(n.offsetWidth-h)/2,w=(n.offsetHeight-S)/2;return{scale:e,positionX:x,positionY:w}};function _d(e){return function(n){e.forEach(function(i){typeof i=="function"?i(n):i!=null&&(i.current=n)})}}var bd=function(e,n){var i=e.setup.wheel,h=i.disabled,S=i.wheelDisabled,x=i.touchPadDisabled,w=i.excluded,s=e.isInitialized,a=e.isPanning,u=n.target,f=s&&!a&&!h&&u;if(!f||S&&!n.ctrlKey||x&&n.ctrlKey)return!1;var d=Zt(u,w);return!d},xd=function(e){return e?e.deltaY<0?1:-1:0};function Sd(e,n){var i=xd(e),h=Mc(n,i);return h}function Ai(e,n,i){var h=n.getBoundingClientRect(),S=0,x=0;if("clientX"in e)S=(e.clientX-h.left)/i,x=(e.clientY-h.top)/i;else{var w=e.touches[0];S=(w.clientX-h.left)/i,x=(w.clientY-h.top)/i}return(Number.isNaN(S)||Number.isNaN(x))&&console.error("No mouse or touch offset found"),{x:S,y:x}}var yd=function(e,n,i,h,S){var x=e.transformState.scale,w=e.wrapperComponent,s=e.setup,a=s.maxScale,u=s.minScale,f=s.zoomAnimation,d=s.disablePadding,m=f.size,g=f.disabled;if(!w)throw new Error("Wrapper is not mounted");var y=x+n*i,b=h?!1:!g,r=At(Re(y,3),u,a,m,b&&!d);return r},wd=function(e,n){var i=e.previousWheelEvent,h=e.transformState.scale,S=e.setup,x=S.maxScale,w=S.minScale;return i?h<x||h>w||Math.sign(i.deltaY)!==Math.sign(n.deltaY)||i.deltaY>0&&i.deltaY<n.deltaY||i.deltaY<0&&i.deltaY>n.deltaY||Math.sign(i.deltaY)!==Math.sign(n.deltaY):!1},Cd=function(e,n){var i=e.setup.pinch,h=i.disabled,S=i.excluded,x=e.isInitialized,w=n.target,s=x&&!h&&w;if(!s)return!1;var a=Zt(w,S);return!a},kd=function(e){var n=e.setup.pinch.disabled,i=e.isInitialized,h=e.pinchStartDistance,S=i&&!n&&h;return!!S},Ed=function(e,n,i){var h=i.getBoundingClientRect(),S=e.touches,x=Re(S[0].clientX-h.left,5),w=Re(S[0].clientY-h.top,5),s=Re(S[1].clientX-h.left,5),a=Re(S[1].clientY-h.top,5);return{x:(x+s)/2/n,y:(w+a)/2/n}},Li=function(e){return Math.sqrt(Math.pow(e.touches[0].pageX-e.touches[1].pageX,2)+Math.pow(e.touches[0].pageY-e.touches[1].pageY,2))},jd=function(e,n){var i=e.pinchStartScale,h=e.pinchStartDistance,S=e.setup,x=S.maxScale,w=S.minScale,s=S.zoomAnimation,a=S.disablePadding,u=s.size,f=s.disabled;if(!i||h===null||!n)throw new Error("Pinch touches distance was not provided");if(n<0)return e.transformState.scale;var d=n/h,m=d*i;return At(Re(m,2),w,x,u,!f&&!a)},Nd=160,Rd=100,Ad=function(e,n){var i=e.props,h=i.onWheelStart,S=i.onZoomStart;e.wheelStopEventTimer||(Le(e),ce(oe(e),n,h),ce(oe(e),n,S))},Ld=function(e,n){var i=e.props,h=i.onWheel,S=i.onZoom,x=e.contentComponent,w=e.setup,s=e.transformState,a=s.scale,u=w.limitToBounds,f=w.centerZoomedOut,d=w.zoomAnimation,m=w.wheel,g=w.disablePadding,y=w.smooth,b=d.size,r=d.disabled,o=m.step,l=m.smoothStep;if(!x)throw new Error("Component not mounted");n.preventDefault(),n.stopPropagation();var c=Sd(n,null),p=y?l*Math.abs(n.deltaY):o,_=yd(e,c,p,!n.ctrlKey);if(a!==_){var C=nt(e,_),k=Ai(n,x,a),v=r||b===0||f||g,E=u&&v,R=Gt(e,k.x,k.y,_,C,E),O=R.x,L=R.y;e.previousWheelEvent=n,e.setTransformState(_,O,L),ce(oe(e),n,h),ce(oe(e),n,S)}},Td=function(e,n){var i=e.props,h=i.onWheelStop,S=i.onZoomStop;Rr(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout(function(){e.mounted&&(Ci(e,n.x,n.y),e.wheelAnimationTimer=null)},Rd);var x=wd(e,n);x&&(Rr(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout(function(){e.mounted&&(e.wheelStopEventTimer=null,ce(oe(e),n,h),ce(oe(e),n,S))},Nd))},Ti=function(e){for(var n=0,i=0,h=0;h<2;h+=1)n+=e.touches[h].clientX,i+=e.touches[h].clientY;var S=n/2,x=i/2;return{x:S,y:x}},Pd=function(e,n){var i=Li(n);e.pinchStartDistance=i,e.lastDistance=i,e.pinchStartScale=e.transformState.scale,e.isPanning=!1;var h=Ti(n);e.pinchLastCenterX=h.x,e.pinchLastCenterY=h.y,Le(e)},Md=function(e,n){var i=e.contentComponent,h=e.pinchStartDistance,S=e.wrapperComponent,x=e.transformState.scale,w=e.setup,s=w.limitToBounds,a=w.centerZoomedOut,u=w.zoomAnimation,f=w.alignmentAnimation,d=u.disabled,m=u.size;if(!(h===null||!i)){var g=Ed(n,x,i);if(!(!Number.isFinite(g.x)||!Number.isFinite(g.y))){var y=Li(n),b=jd(e,y),r=Ti(n),o=r.x-(e.pinchLastCenterX||0),l=r.y-(e.pinchLastCenterY||0);if(!(b===x&&o===0&&l===0)){e.pinchLastCenterX=r.x,e.pinchLastCenterY=r.y;var c=nt(e,b),p=d||m===0||a,_=s&&p,C=Gt(e,g.x,g.y,b,c,_),k=C.x,v=C.y;e.pinchMidpoint=g,e.lastDistance=y;var E=f.sizeX,R=f.sizeY,O=Ze(e,E),L=Ze(e,R),T=k+o,H=v+l,M=Rt(T,H,c,s,O,L,S),F=M.x,U=M.y;e.setTransformState(b,F,U)}}}},Dd=function(e){var n=e.pinchMidpoint;e.velocity=null,e.lastDistance=null,e.pinchMidpoint=null,e.pinchStartScale=null,e.pinchStartDistance=null,Ci(e,n?.x,n?.y)},Pi=function(e,n){var i=e.props.onZoomStop,h=e.setup.doubleClick.animationTime;Rr(e.doubleClickStopEventTimer),e.doubleClickStopEventTimer=setTimeout(function(){e.doubleClickStopEventTimer=null,ce(oe(e),n,i)},h)},Bd=function(e,n){var i=e.props,h=i.onZoomStart,S=i.onZoom,x=e.setup.doubleClick,w=x.animationTime,s=x.animationType;ce(oe(e),n,h),Ni(e,w,s,function(){return ce(oe(e),n,S)}),Pi(e,n)};function Od(e,n){return e==="toggle"?n===1?1:-1:e==="zoomOut"?-1:1}function Id(e,n){var i=e.setup,h=e.doubleClickStopEventTimer,S=e.transformState,x=e.contentComponent,w=S.scale,s=e.props,a=s.onZoomStart,u=s.onZoom,f=i.doubleClick,d=f.disabled,m=f.mode,g=f.step,y=f.animationTime,b=f.animationType;if(!d&&!h){if(m==="reset")return Bd(e,n);if(!x)return console.error("No ContentComponent found");var r=Od(m,e.transformState.scale),o=Ei(e,r,g);if(w!==o){ce(oe(e),n,a);var l=Ai(n,x,w),c=$r(e,o,l.x,l.y);if(!c)return console.error("Error during zoom event. New transformation state was not calculated.");ce(oe(e),n,u),Je(e,c,y,b),Pi(e,n)}}}var Fd=function(e,n){var i=e.isInitialized,h=e.setup,S=e.wrapperComponent,x=h.doubleClick,w=x.disabled,s=x.excluded,a=n.target,u=S?.contains(a),f=i&&a&&u&&!w;if(!f)return!1;var d=Zt(a,s);return!d},Hd=(function(){function e(n){var i=this;this.mounted=!0,this.pinchLastCenterX=null,this.pinchLastCenterY=null,this.onChangeCallbacks=new Set,this.onInitCallbacks=new Set,this.wrapperComponent=null,this.contentComponent=null,this.isInitialized=!1,this.bounds=null,this.previousWheelEvent=null,this.wheelStopEventTimer=null,this.wheelAnimationTimer=null,this.isPanning=!1,this.isWheelPanning=!1,this.startCoords=null,this.lastTouch=null,this.distance=null,this.lastDistance=null,this.pinchStartDistance=null,this.pinchStartScale=null,this.pinchMidpoint=null,this.doubleClickStopEventTimer=null,this.velocity=null,this.velocityTime=null,this.lastMousePosition=null,this.animate=!1,this.animation=null,this.maxBounds=null,this.pressedKeys={},this.mount=function(){i.initializeWindowEvents()},this.unmount=function(){i.cleanupWindowEvents()},this.update=function(h){i.props=h,nt(i,i.transformState.scale),i.setup=Cs(h)},this.initializeWindowEvents=function(){var h,S,x=hr(),w=(h=i.wrapperComponent)===null||h===void 0?void 0:h.ownerDocument,s=w?.defaultView;(S=i.wrapperComponent)===null||S===void 0||S.addEventListener("wheel",i.onWheelPanning,x),s?.addEventListener("mousedown",i.onPanningStart,x),s?.addEventListener("mousemove",i.onPanning,x),s?.addEventListener("mouseup",i.onPanningStop,x),w?.addEventListener("mouseleave",i.clearPanning,x),s?.addEventListener("keyup",i.setKeyUnPressed,x),s?.addEventListener("keydown",i.setKeyPressed,x)},this.cleanupWindowEvents=function(){var h,S,x=hr(),w=(h=i.wrapperComponent)===null||h===void 0?void 0:h.ownerDocument,s=w?.defaultView;s?.removeEventListener("mousedown",i.onPanningStart,x),s?.removeEventListener("mousemove",i.onPanning,x),s?.removeEventListener("mouseup",i.onPanningStop,x),w?.removeEventListener("mouseleave",i.clearPanning,x),s?.removeEventListener("keyup",i.setKeyUnPressed,x),s?.removeEventListener("keydown",i.setKeyPressed,x),document.removeEventListener("mouseleave",i.clearPanning,x),Le(i),(S=i.observer)===null||S===void 0||S.disconnect()},this.handleInitializeWrapperEvents=function(h){var S=hr();h.addEventListener("wheel",i.onWheelZoom,S),h.addEventListener("dblclick",i.onDoubleClick,S),h.addEventListener("touchstart",i.onTouchPanningStart,S),h.addEventListener("touchmove",i.onTouchPanning,S),h.addEventListener("touchend",i.onTouchPanningStop,S)},this.handleInitialize=function(h,S){var x=!1,w=i.setup.centerOnInit,s=function(a,u){for(var f=0,d=a;f<d.length;f++){var m=d[f];if(m.target===u)return!0}return!1};i.applyTransformation(),i.onInitCallbacks.forEach(function(a){a(oe(i))}),i.observer=new ResizeObserver(function(a){if(s(a,h)||s(a,S))if(w&&!x){var u=S.offsetWidth,f=S.offsetHeight;(u>0||f>0)&&(x=!0,i.setCenter())}else Le(i),nt(i,i.transformState.scale),zr(i,0)}),i.observer.observe(h),i.observer.observe(S)},this.onWheelZoom=function(h){var S=i.setup.disabled;if(!S){var x=bd(i,h);if(x){var w=i.isPressingKeys(i.setup.wheel.activationKeys);w&&(Ad(i,h),Ld(i,h),Td(i,h))}}},this.onWheelPanning=function(h){var S=i.setup,x=S.disabled,w=S.wheel,s=S.panning;if(!(!i.wrapperComponent||!i.contentComponent||x||!w.wheelDisabled||s.disabled||!s.wheelPanning||h.ctrlKey)){h.preventDefault(),h.stopPropagation();var a=i.transformState,u=a.positionX,f=a.positionY,d=u-h.deltaX,m=f-h.deltaY,g=s.lockAxisX?u:d,y=s.lockAxisY?f:m,b=i.setup.alignmentAnimation,r=b.sizeX,o=b.sizeY,l=Ze(i,r),c=Ze(i,o);g===u&&y===f||wi(i,g,y,l,c)}},this.onPanningStart=function(h){var S=i.setup.disabled,x=i.props.onPanningStart;if(!S){var w=_s(i,h);if(w){var s=i.isPressingKeys(i.setup.panning.activationKeys);s&&(h.button===0&&!i.setup.panning.allowLeftClickPan||h.button===1&&!i.setup.panning.allowMiddleClickPan||h.button===2&&!i.setup.panning.allowRightClickPan||(h.preventDefault(),h.stopPropagation(),Le(i),Ss(i,h),ce(oe(i),h,x)))}}},this.onPanning=function(h){var S=i.setup.disabled,x=i.props.onPanning;if(!S){var w=bs(i);if(w){var s=i.isPressingKeys(i.setup.panning.activationKeys);s&&(h.preventDefault(),h.stopPropagation(),ys(i,h.clientX,h.clientY),ce(oe(i),h,x))}}},this.onPanningStop=function(h){var S=i.props.onPanningStop;i.isPanning&&(ld(i),ce(oe(i),h,S))},this.onPinchStart=function(h){var S=i.setup.disabled,x=i.props,w=x.onPinchingStart,s=x.onZoomStart;if(!S){var a=Cd(i,h);a&&(Pd(i,h),Le(i),ce(oe(i),h,w),ce(oe(i),h,s))}},this.onPinch=function(h){var S=i.setup.disabled,x=i.props,w=x.onPinching,s=x.onZoom;if(!S){var a=kd(i);a&&(h.preventDefault(),h.stopPropagation(),Md(i,h),ce(oe(i),h,w),ce(oe(i),h,s))}},this.onPinchStop=function(h){var S=i.props,x=S.onPinchingStop,w=S.onZoomStop;i.pinchStartScale&&(Dd(i),ce(oe(i),h,x),ce(oe(i),h,w))},this.onTouchPanningStart=function(h){var S=i.setup.disabled,x=i.props.onPanningStart;if(!S){var w=_s(i,h);if(w){var s=i.lastTouch&&+new Date-i.lastTouch<200&&h.touches.length===1;if(!s){i.lastTouch=+new Date,Le(i);var a=h.touches,u=a.length===1,f=a.length===2;u&&(Le(i),Ss(i,h),ce(oe(i),h,x)),f&&i.onPinchStart(h)}}}},this.onTouchPanning=function(h){var S=i.setup.disabled,x=i.props.onPanning;if(i.isPanning&&h.touches.length===1){if(S)return;var w=bs(i);if(!w)return;h.preventDefault(),h.stopPropagation();var s=h.touches[0];ys(i,s.clientX,s.clientY),ce(oe(i),h,x)}else h.touches.length>1&&i.onPinch(h)},this.onTouchPanningStop=function(h){i.onPanningStop(h),i.onPinchStop(h)},this.onDoubleClick=function(h){var S=i.setup.disabled;if(!S){var x=Fd(i,h);x&&Id(i,h)}},this.clearPanning=function(h){i.isPanning&&i.onPanningStop(h)},this.setKeyPressed=function(h){i.pressedKeys[h.key]=!0},this.setKeyUnPressed=function(h){i.pressedKeys[h.key]=!1},this.isPressingKeys=function(h){return h.length?!!h.find(function(S){return i.pressedKeys[S]}):!0},this.setTransformState=function(h,S,x){var w=i.props.onTransformed;if(!Number.isNaN(h)&&!Number.isNaN(S)&&!Number.isNaN(x)){h!==i.transformState.scale&&(i.transformState.previousScale=i.transformState.scale,i.transformState.scale=h),i.transformState.positionX=S,i.transformState.positionY=x,i.applyTransformation();var s=oe(i);i.onChangeCallbacks.forEach(function(a){return a(s)}),ce(s,{scale:h,positionX:S,positionY:x},w)}else console.error("Detected NaN set state values")},this.setCenter=function(){if(i.wrapperComponent&&i.contentComponent){var h=Ri(i.transformState.scale,i.wrapperComponent,i.contentComponent);i.setTransformState(h.scale,h.positionX,h.positionY)}},this.handleTransformStyles=function(h,S,x){return i.props.customTransform?i.props.customTransform(h,S,x):vd(h,S,x)},this.applyTransformation=function(){if(!(!i.mounted||!i.contentComponent)){var h=i.transformState,S=h.scale,x=h.positionX,w=h.positionY,s=i.handleTransformStyles(x,w,S);i.contentComponent.style.transform=s}},this.getContext=function(){return oe(i)},this.onChange=function(h){return i.onChangeCallbacks.has(h)||i.onChangeCallbacks.add(h),function(){i.onChangeCallbacks.delete(h)}},this.onInit=function(h){return i.onInitCallbacks.has(h)||i.onInitCallbacks.add(h),function(){i.onInitCallbacks.delete(h)}},this.init=function(h,S){i.cleanupWindowEvents(),i.wrapperComponent=h,i.contentComponent=S,nt(i,i.transformState.scale),i.handleInitializeWrapperEvents(h),i.handleInitialize(h,S),i.initializeWindowEvents(),i.isInitialized=!0;var x=oe(i);ce(x,void 0,i.props.onInit)},this.props=n,this.setup=Cs(this.props),this.transformState=ki(this.props)}return e})(),Qt=ue.createContext(null),Wd=function(e,n){return typeof e=="function"?e(n):e},zd=ue.forwardRef(function(e,n){var i=A.useRef(new Hd(e)).current,h=Wd(e.children,Ut(i));return A.useImperativeHandle(n,function(){return Ut(i)},[i]),A.useEffect(function(){i.update(e)},[i,e]),ue.createElement(Qt.Provider,{value:i},h)});ue.forwardRef(function(e,n){var i=A.useRef(null),h=A.useContext(Qt);return A.useEffect(function(){return h.onChange(function(S){if(i.current){var x=0,w=0;i.current.style.transform=h.handleTransformStyles(x,w,1/S.instance.transformState.scale)}})},[h]),ue.createElement("div",Ye({},e,{ref:_d([i,n])}))});function $d(e,n){n===void 0&&(n={});var i=n.insertAt;if(!(typeof document>"u")){var h=document.head||document.getElementsByTagName("head")[0],S=document.createElement("style");S.type="text/css",i==="top"&&h.firstChild?h.insertBefore(S,h.firstChild):h.appendChild(S),S.styleSheet?S.styleSheet.cssText=e:S.appendChild(document.createTextNode(e))}}var Ud=`.transform-component-module_wrapper__SPB86 {
30
+ position: relative;
31
+ width: -moz-fit-content;
32
+ width: fit-content;
33
+ height: -moz-fit-content;
34
+ height: fit-content;
35
+ overflow: hidden;
36
+ -webkit-touch-callout: none; /* iOS Safari */
37
+ -webkit-user-select: none; /* Safari */
38
+ -khtml-user-select: none; /* Konqueror HTML */
39
+ -moz-user-select: none; /* Firefox */
40
+ -ms-user-select: none; /* Internet Explorer/Edge */
41
+ user-select: none;
42
+ margin: 0;
43
+ padding: 0;
44
+ transform: translate3d(0, 0, 0);
45
+ }
46
+ .transform-component-module_content__FBWxo {
47
+ display: flex;
48
+ flex-wrap: wrap;
49
+ width: -moz-fit-content;
50
+ width: fit-content;
51
+ height: -moz-fit-content;
52
+ height: fit-content;
53
+ margin: 0;
54
+ padding: 0;
55
+ transform-origin: 0% 0%;
56
+ }
57
+ .transform-component-module_content__FBWxo img {
58
+ pointer-events: none;
59
+ }
60
+ `,ks={wrapper:"transform-component-module_wrapper__SPB86",content:"transform-component-module_content__FBWxo"};$d(Ud);var qd=function(e){var n=e.children,i=e.wrapperClass,h=i===void 0?"":i,S=e.contentClass,x=S===void 0?"":S,w=e.wrapperStyle,s=e.contentStyle,a=e.wrapperProps,u=a===void 0?{}:a,f=e.contentProps,d=f===void 0?{}:f,m=A.useContext(Qt),g=m.init,y=m.cleanupWindowEvents,b=A.useRef(null),r=A.useRef(null);return A.useEffect(function(){var o=b.current,l=r.current;return o!==null&&l!==null&&g&&g?.(o,l),function(){y?.()}},[]),ue.createElement("div",Ye({},u,{ref:b,className:"".concat(jr.wrapperClass," ").concat(ks.wrapper," ").concat(h),style:w}),ue.createElement("div",Ye({},d,{ref:r,className:"".concat(jr.contentClass," ").concat(ks.content," ").concat(x),style:s}),n))},Mi=function(){var e=A.useContext(Qt);if(!e)throw new Error("Transform context must be placed inside TransformWrapper");return e},Kd=function(){var e=Mi();return Ut(e)};function Xd(e){var n=Mi(),i=A.useState(e(Nr(n))),h=i[0],S=i[1];return A.useEffect(function(){var x=!0,w=n.onChange(function(s){x&&S(e(Nr(s.instance)))});return function(){w(),x=!1}},[e,n]),h}function Yd(e){switch(e.split(".").pop()?.toLowerCase()){case"ts":case"tsx":return"typescript";case"js":case"jsx":case"mjs":case"cjs":return"javascript";case"json":return"json";case"md":case"mdx":return"markdown";case"css":return"css";case"scss":return"scss";case"html":return"html";case"yml":case"yaml":return"yaml";case"sh":return"shell";case"py":return"python";case"go":return"go";case"rs":return"rust";default:return"plaintext"}}function Vd(e,n){return Te({queryKey:ge.files.tree(e||"",n),queryFn:()=>de.get("/files/tree",{params:{workingDir:e||"",path:n}}),enabled:!!e})}function Gd(e,n){return Te({queryKey:ge.files.content(e||"",n||""),queryFn:()=>de.get("/files/read",{params:{workingDir:e||"",path:n||""}}),enabled:!!e&&!!n})}function Zd(e){const n=ut();return A.useCallback(()=>{e&&n.invalidateQueries({queryKey:["files","tree",e]})},[n,e])}function Qd(){const e=ut();return Os({mutationFn:n=>de.post("/files/write",n),onSuccess:(n,i)=>{const h=ge.files.content(i.workingDir,i.path),S=e.getQueryData(h);e.setQueryData(h,{content:i.content,language:S?.language||Yd(i.path)})}})}function Jd(e,n){return e==="/"?`/${n}`:`${e}/${n}`}function eh(e,n){return e==="/"?n:`${e.slice(1)}/${n}`}const Es=({depth:e,active:n,onClick:i,leftIcon:h,rightIcon:S,label:x})=>t.jsxs("button",{type:"button",onClick:i,"aria-current":n||void 0,className:Q("w-full flex items-center gap-2 rounded-md px-2 py-1 text-left text-xs transition-colors outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/60",n?"bg-foreground/[0.06] font-medium text-foreground":"text-foreground/90 hover:bg-accent"),style:{paddingLeft:8+e*14},children:[t.jsx("span",{className:"shrink-0",children:S}),t.jsx("span",{className:"shrink-0 text-muted-foreground",children:h}),t.jsx("span",{className:"truncate",children:x})]}),Di=({workingDir:e,path:n,depth:i,expanded:h,toggleDir:S,onFileSelect:x,selectedFilePath:w})=>{const{t:s}=se(),{data:a,isLoading:u,isError:f}=Vd(e,n),d=A.useMemo(()=>a?.items??[],[a?.items]);return u?t.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1",style:{paddingLeft:8+i*14},children:s("Loading...")}):f?t.jsx("div",{className:"text-xs text-destructive-ink px-2 py-1",style:{paddingLeft:8+i*14},children:s("Failed to load")}):t.jsx("div",{className:"space-y-0.5",children:d.map(m=>{if(m.type==="directory"){const b=Jd(n,m.name),r=h.has(b);return t.jsxs("div",{children:[t.jsx(Es,{depth:i,onClick:()=>S(b),rightIcon:r?t.jsx($e,{size:14,className:"text-muted-foreground/70"}):t.jsx(Ve,{size:14,className:"text-muted-foreground/70"}),leftIcon:r?t.jsx($s,{size:14}):t.jsx(Mr,{size:14}),label:m.name}),r&&t.jsx(Di,{workingDir:e,path:b,depth:i+1,expanded:h,toggleDir:S,onFileSelect:x,selectedFilePath:w})]},b)}const g=eh(n,m.name),y=w===g;return t.jsx(Es,{depth:i,active:y,onClick:()=>x(g),rightIcon:t.jsx("span",{className:"inline-block w-[14px]"}),leftIcon:t.jsx(qn,{name:m.name}),label:m.name},g)})})},th=({workingDir:e,className:n,onFileSelect:i,selectedFilePath:h,onCollapse:S})=>{const{t:x}=se(),[w,s]=A.useState(()=>new Set),a=Zd(e),u=A.useCallback(f=>{s(d=>{const m=new Set(d);return m.has(f)?m.delete(f):m.add(f),m})},[]);return t.jsxs("div",{className:Q("h-full flex flex-col",n),children:[t.jsxs("div",{className:"px-3 py-2 border-b border-border bg-muted/40 flex items-center justify-between",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:x("Files")}),e?t.jsx("div",{title:e,className:"truncate font-mono text-[11px] text-muted-foreground",children:e}):t.jsx("div",{className:"truncate text-xs text-muted-foreground",children:x("No working directory")})]}),t.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[e&&t.jsx(Fe,{size:"xs",label:x("Refresh file tree"),onClick:a,children:t.jsx(ft,{})}),S&&t.jsx(Fe,{size:"xs",label:x("Collapse file tree"),onClick:S,children:t.jsx(Oo,{})})]})]}),t.jsx("div",{className:"flex-1 overflow-auto scrollbar-app-thin p-2",children:e?t.jsx(Di,{workingDir:e,path:"/",depth:0,expanded:w,toggleDir:u,onFileSelect:i,selectedFilePath:h}):t.jsx("div",{className:"text-xs text-muted-foreground px-2 py-2",children:x("No workspace selected.")})})]})},rh=new Set(["png","jpg","jpeg","gif","bmp","webp","svg","ico","avif"]);function sh(e){const n=e.split(".").pop()?.toLowerCase();return n?rh.has(n):!1}function ih(e,n){const i=Tr(),h=new URLSearchParams({workingDir:e,path:n});return`${i}/files/image?${h.toString()}`}const nh=({filePath:e})=>{const{t:n}=se(),{zoomIn:i,zoomOut:h,centerView:S}=Kd(),x=Xd(s=>s.state.scale),w=Math.round(x*100);return t.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 border-b border-border bg-muted/40 shrink-0",children:[t.jsx(Fe,{size:"xs",label:n("Zoom out"),onClick:()=>h(.5),children:t.jsx(Go,{})}),t.jsxs(_e,{variant:"ghost",size:"xs",className:"min-w-10 tabular-nums",onClick:()=>S(1),title:n("Reset zoom"),children:[w,"%"]}),t.jsx(Fe,{size:"xs",label:n("Zoom in"),onClick:()=>i(.5),children:t.jsx(Yo,{})}),t.jsx(Fe,{size:"xs",label:n("Fit to view"),className:"ml-1",onClick:()=>S(1),children:t.jsx(Do,{})}),t.jsx("span",{title:e,className:"ml-2 truncate font-mono text-[11px] text-muted-foreground",children:e})]})},oh=({workingDir:e,filePath:n})=>{const{t:i}=se(),[h,S]=A.useState(!1),x=ih(e,n);return h?t.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground text-sm",children:i("Failed to load image.")}):t.jsx(zd,{initialScale:1,minScale:.1,maxScale:10,centerOnInit:!0,doubleClick:{mode:"toggle"},children:t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsx(nh,{filePath:n}),t.jsx("div",{className:"flex-1 min-h-0 overflow-hidden bg-[repeating-conic-gradient(#f3f3f3_0%_25%,#fff_0%_50%)] bg-[length:16px_16px]",children:t.jsx(qd,{wrapperStyle:{width:"100%",height:"100%"},contentStyle:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:t.jsx("img",{src:x,alt:n,className:"max-w-full max-h-full object-contain rounded shadow-raised",draggable:!1,onError:()=>S(!0)})})})]})})};function ah(e){const n=e.split("/");return n[n.length-1]||e}function lh(e){switch(e.split(".").pop()?.toLowerCase()){case"ts":case"tsx":return"typescript";case"js":case"jsx":case"mjs":case"cjs":return"javascript";case"json":return"json";case"md":case"mdx":return"markdown";case"css":return"css";case"scss":return"scss";case"html":return"html";case"yml":case"yaml":return"yaml";case"sh":return"shell";case"py":return"python";case"go":return"go";case"rs":return"rust";default:return"plaintext"}}const ch=({active:e,name:n,isDirty:i,onClick:h,onClose:S})=>{const{t:x}=se();return t.jsxs("button",{type:"button",onClick:h,className:Q("group flex items-center gap-2 px-3 py-2 rounded-t-md border-t border-x -mb-px min-w-[120px] max-w-[240px] outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/60",e?"bg-background border-border text-foreground":"bg-foreground/[0.03] border-transparent text-muted-foreground hover:text-foreground hover:bg-foreground/[0.05]"),children:[t.jsx("span",{className:Q("w-2 h-2 rounded-full",i?"bg-warning":"bg-transparent")}),t.jsx("span",{className:"truncate flex-1 text-left text-xs",children:n}),t.jsx("span",{onClick:S,className:"opacity-0 group-hover:opacity-100 group-focus-visible:opacity-100 pointer-coarse:opacity-100 p-0.5 hover:bg-foreground/[0.08] rounded transition-all shrink-0","aria-label":x("Close tab"),title:x("Close"),children:t.jsx(Qe,{size:12})})]})},dh=ue.forwardRef(function({workingDir:n,className:i,readOnly:h=!1},S){const{t:x}=se(),[w,s]=A.useState([]),[a,u]=A.useState(null),[f,d]=A.useState(!1),[m,g]=A.useState(!1),[y,b]=A.useState(0),[r,o]=A.useState(null),l=A.useRef(null),c=Qd();A.useEffect(()=>{let $=!1;return pn(async()=>{const{preloadMonaco:W}=await import("./monaco-I1fXAMIt.js").then(z=>z.m);return{preloadMonaco:W}},__vite__mapDeps([0,1,2,3])).then(({preloadMonaco:W})=>W()).then(()=>{$||d(!0)}).catch(()=>{$||g(!0)}),()=>{$=!0}},[]);const[p,_]=A.useState(280),[C,k]=A.useState(!1),[v,E]=A.useState(!1),R=A.useRef(280),O=A.useCallback(()=>{k($=>($?_(R.current):R.current=p,!$))},[p]),L=A.useCallback($=>{$.preventDefault(),E(!0);const W=$.clientX,z=p,j=X=>{const Y=X.clientX-W,Z=Math.min(480,Math.max(160,z+Y));_(Z)},I=()=>{E(!1),document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",I)};document.addEventListener("mousemove",j),document.addEventListener("mouseup",I)},[p]);A.useEffect(()=>{s([]),u(null),o(null)},[n]);const T=A.useMemo(()=>w.find($=>$.path===a)||null,[w,a]),{data:H,isFetching:M,isError:F,error:U}=Gd(n,T?.isImage?null:a);A.useEffect(()=>{!a||!H||s($=>$.map(W=>W.path!==a||W.isDirty||W.loaded?W:{...W,language:H.language||W.language,content:H.content,savedContent:H.content,isDirty:!1,loaded:!0}))},[a,H]);const N=A.useCallback(($,W,z)=>{s(j=>{if(j.find(Y=>Y.path===$))return j;const X=sh($);return[...j,{path:$,name:ah($),language:lh($),content:"",savedContent:"",isDirty:!1,loaded:X,isImage:X}]}),u($),o(W?{path:$,line:W,column:z}:null)},[]);ue.useImperativeHandle(S,()=>({openFile:N}),[N]);const D=A.useCallback($=>{s(W=>{const z=W.filter(j=>j.path!==$);return u(j=>j!==$?j:z.length?z[z.length-1].path:null),z})},[]),P=A.useCallback($=>{s(W=>W.map(z=>{if(z.path!==a)return z;const j=$!==z.savedContent;return{...z,content:$,isDirty:j}}))},[a]),B=A.useCallback(async()=>{h||!n||!T||(await c.mutateAsync({workingDir:n,path:T.path,content:T.content}),s($=>$.map(W=>W.path===T.path?{...W,savedContent:W.content,isDirty:!1,loaded:!0}:W)))},[T,h,c,n]),q=A.useRef(()=>{});A.useEffect(()=>{q.current=()=>{B().catch(()=>{})}},[B]),A.useEffect(()=>{const $=W=>{h||(W.metaKey||W.ctrlKey)&&W.key.toLowerCase()==="s"&&(W.preventDefault(),q.current())};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[h]);const K=A.useCallback(($,W)=>{l.current=$,b(z=>z+1),$.addCommand(W.KeyMod.CtrlCmd|W.KeyCode.KeyS,()=>{q.current()})},[]);return A.useEffect(()=>{if(!r||r.path!==a||!T?.loaded)return;const $=l.current,W=$?.getModel();if(!$||!W)return;const z=Math.min(r.line,W.getLineCount()),j=Math.min(r.column??1,W.getLineMaxColumn(z)),I={lineNumber:z,column:j};$.setPosition(I),$.revealPositionInCenter(I),$.focus(),o(null)},[a,T?.loaded,y,r]),t.jsxs("div",{className:Q("flex h-full overflow-hidden bg-background",i),style:v?{userSelect:"none",cursor:"col-resize"}:void 0,children:[t.jsx("div",{className:"border-r border-border bg-background shrink-0 overflow-hidden relative",style:{width:C?36:p,transition:v?"none":"width 0.15s ease"},children:C?t.jsx("div",{className:"h-full flex items-start pt-2 justify-center",children:t.jsx(Fe,{size:"sm",label:x("Expand file tree"),onClick:O,children:t.jsx(Fo,{className:"size-4"})})}):t.jsx(t.Fragment,{children:t.jsx(th,{workingDir:n,onFileSelect:N,selectedFilePath:T?.path||null,onCollapse:O},n||"no-working-dir")})}),!C&&t.jsx("div",{onMouseDown:L,className:Q("w-1 shrink-0 cursor-col-resize transition-colors",v?"bg-ring/40":"bg-transparent hover:bg-border")}),t.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1 px-2 pt-2 border-b border-border bg-muted overflow-x-auto shrink-0",children:[w.length===0?t.jsx("div",{className:"px-2 pb-2 text-xs text-muted-foreground",children:x("No open files")}):w.map($=>t.jsx(ch,{active:$.path===a,name:$.name,isDirty:$.isDirty,onClick:()=>u($.path),onClose:W=>{W.stopPropagation(),D($.path)}},$.path)),t.jsxs("div",{className:"ml-auto flex items-center gap-2 pb-2 pr-1",children:[h&&t.jsx("span",{className:"text-xs text-muted-foreground",children:x("Read-only")}),c.isPending&&t.jsxs("span",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t.jsx(pe,{}),x("Saving")]}),T?.isDirty&&!c.isPending&&t.jsx("span",{className:"text-xs text-warning-ink",children:x("Unsaved")})]})]}),t.jsx("div",{className:"flex-1 min-h-0 relative",children:n?T?T.isImage?t.jsx(oh,{workingDir:n,filePath:T.path}):m?t.jsx("div",{className:"h-full flex items-center justify-center text-destructive-ink text-sm",children:x("Failed to load editor.")}):f?t.jsxs(t.Fragment,{children:[t.jsx(Pc,{path:T.path,value:T.content,language:T.language,theme:"vs-light",height:"100%",onChange:h?void 0:$=>P($??""),onMount:K,options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"off",automaticLayout:!0,readOnly:h}}),M&&!T.loaded&&t.jsx("div",{className:"absolute inset-0 bg-background/60 flex items-center justify-center",children:t.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t.jsx(pe,{}),x("Loading file...")]})}),F&&t.jsx("div",{className:"absolute bottom-2 left-2 right-2 rounded-md bg-background shadow-raised",children:t.jsxs(Ge,{tone:"danger",size:"sm",children:[x("Failed to load file"),U instanceof Error?`: ${U.message}`:""]})})]}):t.jsxs("div",{className:"h-full flex items-center justify-center text-muted-foreground text-sm",children:[t.jsx(pe,{className:"mr-2"}),x("Loading editor...")]}):t.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground text-sm",children:x("Select a file from the tree to open.")}):t.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground text-sm",children:x("No workspace selected.")})})]})]})});function hh(e,n={}){const i=Kt(S=>S.visibleContext),h=Gs(e,i);return Te({queryKey:ge.git.changes(e||""),queryFn:()=>de.get("/git/changes",{params:{workingDir:e||""}}),enabled:!!e&&(n.enabled??!0),refetchInterval:h,refetchIntervalInBackground:!1,refetchOnWindowFocus:h?"always":!1,refetchOnReconnect:h?"always":!1})}function uh(e,n,i){const h=Kt(x=>x.visibleContext),S=Gs(e,h);return Te({queryKey:ge.git.diff(e||"",n||"",i),queryFn:()=>de.get("/git/diff",{params:{workingDir:e||"",path:n||"",type:i}}),enabled:!!e&&!!n,refetchInterval:S,refetchIntervalInBackground:!1,refetchOnWindowFocus:S?"always":!1,refetchOnReconnect:S?"always":!1})}function Bi(e,n){return Te({queryKey:ge.git.commitFiles(e||"",n||""),queryFn:()=>de.get("/git/commit-files",{params:{workingDir:e||"",hash:n||""}}),enabled:!!e&&!!n})}function Oi(e,n,i){return Te({queryKey:ge.git.commitDiff(e||"",n||"",i||""),queryFn:()=>de.get("/git/commit-diff",{params:{workingDir:e||"",hash:n||"",path:i||""}}),enabled:!!e&&!!n&&!!i})}const fh=new Set(["STARTING","RUNNING","STOPPING"]);function Ii(e){return fh.has(e.runtimeState)||e.runtimeInstanceId!==null}function Fi(e){return e instanceof Xt&&e.status===409&&e.details.code==="WORKSPACE_HAS_ACTIVE_SERVICE"}const js="h-6 min-w-0 truncate rounded-md bg-foreground/[0.05] px-2 font-mono text-xs leading-6 text-foreground/85";function mh({from:e,to:n}){return t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.jsx("span",{title:e,className:js,children:e}),t.jsx(ri,{size:14,className:"shrink-0 text-muted-foreground/70"}),t.jsx("span",{title:n,className:js,children:n})]})}function ph({services:e,isLoading:n,isError:i}){const{t:h}=se();return n?t.jsx(pe,{size:"xs",label:h("正在检查后台服务..."),className:"text-xs"}):e.length>0?t.jsxs(Ge,{tone:"warning",title:h("合并前将停止 {count} 个后台服务",{count:e.length}),children:[t.jsx("p",{className:"break-all font-mono text-xs",children:e.map(S=>S.name).join(", ")}),t.jsx("p",{className:"mt-1",children:h("停止后不会自动恢复。")})]}):i?t.jsx("p",{className:"text-xs text-warning-ink",role:"status",children:h("无法检查后台服务状态,提交时会再次确认。")}):null}const gh={INVALID_BASE_BRANCH:"Choose an existing local branch different from the workspace branch.",BASE_BRANCH_UNRELATED:"The selected branch has no shared commit history with this workspace.",WORKSPACE_BASE_BRANCH_BUSY:"Wait for the Agent to finish or stop it before changing the base branch.",WORKSPACE_GIT_OPERATION_IN_PROGRESS:"Finish or abort the current Git operation before changing the base branch.",WORKSPACE_BASE_BRANCH_CHANGED:"The workspace changed. Refresh and select the base branch again.",INVALID_WORKSPACE_STATE:"Only active workspaces can change base branch. Refresh the list.",WORKSPACE_BASE_BRANCH_MANAGED:"TeamRun member base branches are managed by their parent workspace."};function Hi(e){return e.isOpen?t.jsx(vh,{...e},e.workspaceId):null}function vh({isOpen:e,onClose:n,onBaseBranchSaved:i,projectId:h,workspaceId:S,branchName:x,targetBranch:w,commitMessage:s,isPending:a,canMerge:u,activeServices:f,isCheckingServices:d,serviceCheckFailed:m,error:g,onConfirm:y}){const{t:b}=se(),r=A.useId(),o=ro(h),l=so(),c=o.data?.workspaces.find(N=>N.id===S),p=c?.baseBranch||o.data?.mainBranch||w,[_,C]=A.useState(null),k=_??p,v=o.data?.branches.filter(N=>N!==x)??[],E=!!c&&k!==p,R=a||l.isPending,O=o.isPending||o.isFetching||o.isError,L=l.error instanceof Xt?String(l.error.details.code):"",[T,H]=A.useState(null),M=T??s??"",F=()=>{R||n()},U=async()=>{if(!(!c||!E))try{await l.mutateAsync({id:S,baseBranch:k,expectedBaseBranch:c.baseBranch}),ye.success(b("Workspace base branch saved. Review the changes before merging.")),n(),i?.()}catch{}};return t.jsx(jt,{isOpen:e,onClose:F,title:b("提交变更"),className:"max-w-md",action:t.jsxs(t.Fragment,{children:[t.jsx(_e,{variant:"ghost",onClick:F,disabled:R,children:b("取消")}),t.jsx(_e,{variant:"primary",onClick:()=>y(M.trim()||void 0,f.length>0),disabled:R||d||O||E||!u,loading:a||d,children:a||d?d?b("正在检查后台服务..."):f.length>0?b("正在停止服务并提交..."):b("正在提交..."):t.jsxs(t.Fragment,{children:[t.jsx(Dr,{}),f.length>0?b("停止服务并提交"):b("确认提交")]})})]}),children:t.jsxs("div",{className:"space-y-4",children:[t.jsx(mh,{from:x,to:c?p:w}),o.isPending?t.jsx("p",{className:"text-xs text-muted-foreground",children:b("Loading...")}):o.isError?t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{role:"alert",className:"text-xs text-destructive-ink",children:b("Could not load branches. Refresh to try again.")}),t.jsx(_e,{size:"sm",onClick:()=>{o.refetch()},children:b("Refresh")})]}):c&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{htmlFor:r,className:"block text-[13px] font-medium text-foreground",children:b("Base branch for this workspace")}),t.jsx(mo,{id:r,label:b("Base branch for this workspace"),value:k,branches:v,disabled:R,isRefreshing:o.isFetching,onOpen:()=>{o.refetch()},onChange:N=>{C(N),l.reset()}}),t.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:b("Changing this base branch updates the comparison, update and merge target for this workspace only. Save and review the changes before merging.")}),E&&t.jsx(_e,{variant:"primary",size:"sm",onClick:()=>{U()},disabled:R||O||!v.includes(k),children:l.isPending?b("Saving"):b("Save base branch and review changes")}),l.isError&&t.jsx("p",{role:"alert",className:"text-xs text-destructive-ink",children:b(gh[L]??"Could not save the base branch. Refresh and try again.")})]}),!u&&t.jsx("p",{className:"text-xs text-muted-foreground",children:b("Review the changes and sync the base branch before submitting.")}),t.jsx(Us,{label:b("提交消息"),description:t.jsxs(t.Fragment,{children:[b("建议以 feat、fix、docs、refactor、chore 开头,保持提交记录清晰。feat 新增功能,fix 修复问题,docs 文档更新,refactor 代码重构,chore 日常维护。"),!M.trim()&&t.jsx("span",{className:"mt-1 block",children:b("留空将使用默认消息")})]}),children:t.jsx(Kn,{value:M,onChange:N=>H(N.target.value),placeholder:b("请描述本次修改的内容"),minRows:4,className:"font-mono"})}),t.jsx(ph,{services:f,isLoading:d,isError:m}),g&&t.jsx(Ge,{tone:"danger",children:g})]})})}function lt(e,n){const i=e[n];return typeof i=="string"&&i.length>0?i:void 0}function Wi(e){if(!(e instanceof Xt)||e.status!==409)return;const n=e.details;if(n.code!=="MERGE_CONFLICT"||n.conflictOp!==yt.REBASE&&n.conflictOp!==yt.MERGE||!Array.isArray(n.conflictedFiles)||!n.conflictedFiles.every(h=>typeof h=="string"))return;const i=n.mergeStrategy==="squash"||n.mergeStrategy==="no_ff"?n.mergeStrategy:void 0;return{conflictOp:n.conflictOp,conflictedFiles:n.conflictedFiles,mergeAborted:typeof n.mergeAborted=="boolean"?n.mergeAborted:void 0,mergeStrategy:i,sourceBranch:lt(n,"sourceBranch"),targetBranch:lt(n,"targetBranch"),sourceWorktreePath:lt(n,"sourceWorktreePath"),targetWorktreePath:lt(n,"targetWorktreePath"),sourceWorkspaceId:lt(n,"sourceWorkspaceId"),targetWorkspaceId:lt(n,"targetWorkspaceId")}}function Ns(e,n,i,h){const S=Wi(e);if(S){i(S);return}h(e instanceof Error?e.message:n)}function _h({projectId:e,workspaceId:n,branchName:i,targetBranch:h,commitMessage:S,committedFileCount:x,onRefreshCommitMessage:w,onConflict:s,onResolveConflicts:a}){const{t:u}=se(),{data:f,isLoading:d}=io(n),m=Zs(),g=Qs(),y=Js(),[b,r]=A.useState(!1),[o,l]=A.useState(null),c=Hr(n,b),p=(c.data??[]).filter(Ii);if(A.useEffect(()=>{b&&w?.()},[b,w]),d||!f)return t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 text-muted-foreground border-b border-border/60",children:[t.jsx(pe,{}),t.jsx("span",{className:"text-xs",children:u("正在检查工作区状态...")})]});const _=f.conflictedFiles.length>0,C=f.operation!=="idle",k=f.hasUncommittedChanges||f.untrackedCount>0,v=f.uncommittedCount+f.untrackedCount,E=!_&&!C&&!k,R=!k,O=f.operation==="idle"&&f.ahead===0&&f.behind===0&&!k&&!_,L=()=>{l(null),m.mutate(n,{onError:F=>{Ns(F,u("更新失败,请稍后重试"),U=>s(U),l)}})},T=()=>{l(null),r(!0)},H=(F,U)=>{l(null),g.mutate({id:n,commitMessage:F,stopActiveServices:U},{onSuccess:()=>r(!1),onError:N=>{if(Fi(N)){l(u("后台服务仍在运行,请确认停止服务后再提交。"));return}Ns(N,u("提交失败,请稍后重试"),D=>{r(!1),s(D)},l)}})},M=()=>{g.isPending||(r(!1),l(null))};return O?t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 text-muted-foreground border-b border-border/60",children:[t.jsx(gn,{size:13,className:"shrink-0 text-muted-foreground/70"}),t.jsx("span",{className:"text-xs",children:u("当前分支还没有任何变更")})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"border-b border-border bg-background",children:t.jsxs("div",{className:"px-3 py-2",children:[o&&t.jsx(Ge,{tone:"danger",size:"sm",className:"mb-2",children:o}),k&&t.jsx(Ge,{tone:"warning",size:"sm",icon:t.jsx(To,{}),className:"mb-2",children:u("{count} 个本地改动未处理,需要先整理后再继续",{count:v})}),_&&t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-foreground",children:[t.jsx(Et,{size:13,className:"shrink-0 text-warning"}),t.jsx("span",{children:u("{count} 个文件存在冲突,需要处理后继续",{count:f.conflictedFiles.length})})]}),t.jsxs("div",{className:"flex items-center gap-1.5 ml-auto",children:[t.jsx(_e,{variant:"primary",size:"sm",onClick:a,children:u("处理冲突")}),t.jsx(_e,{variant:"secondary",size:"sm",onClick:()=>y.mutate(n),loading:y.isPending,children:y.isPending?u("正在撤销..."):u("撤销操作")})]})]}),C&&!_&&t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-foreground",children:[t.jsx(pe,{size:"xs",className:"text-info"}),t.jsx("span",{children:f.operation==="rebase"?u("正在同步源分支更新..."):u("正在提交变更...")})]}),t.jsxs(_e,{variant:"secondary",size:"sm",className:"ml-auto",onClick:()=>y.mutate(n),loading:y.isPending,children:[!y.isPending&&t.jsx(Is,{}),y.isPending?u("正在撤销..."):u("撤销操作")]})]}),!_&&!C&&(f.behind>0||f.ahead>0)&&t.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[f.behind>0&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:u("源分支 {branch} 有 {count} 个更新",{branch:h,count:f.behind})}),t.jsxs(_e,{variant:"primary",size:"sm",onClick:L,disabled:!E,loading:m.isPending,children:[!m.isPending&&t.jsx(ft,{}),m.isPending?u("正在同步..."):u("同步更新")]})]}),f.ahead>0&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:u("{count} 个文件变更,可以安全提交",{count:x??f.ahead})}),t.jsx("span",{title:R?void 0:u("需要先处理本地改动"),className:Q("inline-flex",!R&&"cursor-not-allowed"),children:t.jsxs(_e,{variant:"primary",size:"sm",onClick:T,disabled:!R||g.isPending,children:[t.jsx(Dr,{}),u("提交变更")]})})]})]})]})}),t.jsx(Hi,{projectId:e,workspaceId:n,canMerge:E&&f.ahead>0&&f.behind===0,isOpen:b,onClose:M,branchName:i,targetBranch:h,commitMessage:S,isPending:g.isPending,activeServices:p,isCheckingServices:c.isLoading,serviceCheckFailed:c.isError,error:o,onConfirm:H})]})}const zi=({line:e,lineNum:n})=>{let i="",h="text-foreground/90";return e.startsWith("+")&&!e.startsWith("+++")?i="bg-success/10":e.startsWith("-")&&!e.startsWith("---")?i="bg-destructive/10":e.startsWith("@@")?(i="bg-info/5",h="text-info-ink"):(e.startsWith("diff ")||e.startsWith("index "))&&(h="text-muted-foreground"),t.jsxs("div",{className:Q("flex",i),children:[t.jsx("span",{"aria-hidden":"true",className:"w-10 shrink-0 select-none border-r border-border/60 pr-2 text-right text-muted-foreground/50",children:n}),t.jsx("span",{className:Q("whitespace-pre pl-2",h),children:e})]})},ur=50,fr=400;function $i(e){const n=e.split("/");return n[n.length-1]||e}function bh(e){const n=e.lastIndexOf("/");return n>0?e.slice(0,n):""}function xh(e){const i=Math.floor(Date.now()/1e3)-e;return i<60?qe("{count}s ago",{count:i}):i<3600?qe("{count}m ago",{count:Math.floor(i/60)}):i<86400?qe("{count}h ago",{count:Math.floor(i/3600)}):i<604800?qe("{count}d ago",{count:Math.floor(i/86400)}):new Date(e*1e3).toLocaleDateString()}function Ht(e,n){return e.kind==="working"?`${e.diffType}:${n}`:`${e.hash}:${n}`}const Ar=({additions:e,deletions:n,className:i})=>e===void 0&&n===void 0?null:t.jsx(Fs,{additions:e,deletions:n,className:i}),Ui=({diff:e})=>{const{t:n}=se(),[i,h]=A.useState(!1),S=A.useMemo(()=>e.split(`
61
+ `),[e]);if(!e.trim())return t.jsx("div",{className:"py-6 text-center text-muted-foreground text-xs",children:n("没有可显示的差异内容")});const x=!i&&S.length>fr,w=x?S.slice(0,fr):S;return t.jsxs("div",{className:"overflow-x-auto scrollbar-app-thin font-mono text-xs leading-5",children:[w.map((s,a)=>t.jsx(zi,{line:s,lineNum:a+1},a)),x&&t.jsx("button",{type:"button",onClick:()=>h(!0),className:"w-full py-2 text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:n("还有 {count} 行变更被折叠,点击展开全部",{count:S.length-fr})})]})},Sh=({workingDir:e,path:n,diffType:i,enabled:h})=>{const{t:S}=se(),{data:x,isLoading:w,isError:s}=uh(e,h?n:null,i);return!h||w?t.jsxs("div",{className:"flex items-center justify-center gap-2 py-8 text-muted-foreground",children:[t.jsx(pe,{size:"sm"}),t.jsx("span",{className:"text-xs",children:S("正在加载差异...")})]}):s?t.jsx("div",{className:"py-6 text-center text-destructive-ink text-xs",children:S("差异加载失败")}):t.jsx(Ui,{diff:x?.diff||""})},yh=({workingDir:e,hash:n,path:i,enabled:h})=>{const{t:S}=se(),{data:x,isLoading:w,isError:s}=Oi(e,h?n:null,h?i:null);return!h||w?t.jsxs("div",{className:"flex items-center justify-center gap-2 py-8 text-muted-foreground",children:[t.jsx(pe,{size:"sm"}),t.jsx("span",{className:"text-xs",children:S("正在加载差异...")})]}):s?t.jsx("div",{className:"py-6 text-center text-destructive-ink text-xs",children:S("差异加载失败")}):t.jsx(Ui,{diff:x?.diff||""})},mr=({entry:e,source:n,workingDir:i,flash:h,registerNode:S})=>{const[x,w]=A.useState(!1),[s,a]=A.useState(!1),u=A.useRef(null),f=Ht(n,e.path);A.useEffect(()=>(S(f,u.current),()=>S(f,null)),[f,S]),A.useEffect(()=>{const m=u.current;if(!m||s)return;const g=new IntersectionObserver(y=>{y.some(b=>b.isIntersecting)&&(a(!0),g.disconnect())},{rootMargin:"300px 0px"});return g.observe(m),()=>g.disconnect()},[s]);const d=bh(e.path);return t.jsxs("div",{ref:u,"data-card-key":f,className:Q("rounded-md border border-border bg-background overflow-hidden transition-shadow",h&&"ring-2 ring-info/40"),children:[t.jsxs("button",{type:"button",onClick:()=>w(m=>!m),className:"w-full flex items-center gap-2 px-3 py-2 bg-muted/40 hover:bg-muted/70 transition-colors text-left",children:[x?t.jsx(Ve,{size:13,className:"text-muted-foreground/70 shrink-0"}):t.jsx($e,{size:13,className:"text-muted-foreground/70 shrink-0"}),t.jsx(qs,{status:e.status}),t.jsx("span",{className:"text-xs font-medium text-foreground truncate",children:$i(e.path)}),d&&t.jsx("span",{className:"font-mono text-[11px] text-muted-foreground truncate",children:d}),t.jsx("span",{className:"ml-auto"}),t.jsx(Ar,{additions:e.additions,deletions:e.deletions})]}),!x&&t.jsx("div",{className:"border-t border-border/60",children:n.kind==="working"?t.jsx(Sh,{workingDir:i,path:e.path,diffType:n.diffType,enabled:s}):t.jsx(yh,{workingDir:i,hash:n.hash,path:e.path,enabled:s})})]})};function wh(e){const n={name:"",path:"",dirs:new Map,files:[]};for(const i of e){const h=i.path.split("/");let S=n;for(let x=0;x<h.length-1;x++){const w=h[x];S.dirs.has(w)||S.dirs.set(w,{name:w,path:S.path?`${S.path}/${w}`:w,dirs:new Map,files:[]}),S=S.dirs.get(w)}S.files.push(i)}return qi(n)}function qi(e){const n=new Map;for(const i of e.dirs.values()){let h=qi(i);for(;h.dirs.size===1&&h.files.length===0;){const S=[...h.dirs.values()][0];h={...S,name:`${h.name}/${S.name}`}}n.set(h.name,h)}return{...e,dirs:n}}const Ch=({dir:e,depth:n,activeKey:i,onSelect:h})=>{const[S,x]=A.useState(!0);return t.jsxs("div",{children:[t.jsxs("button",{type:"button",onClick:()=>x(w=>!w),className:"flex items-center gap-1.5 w-full px-2 py-1 rounded-sm hover:bg-muted/60 text-left",style:{paddingLeft:8+n*12},children:[S?t.jsx($s,{size:12,className:"text-muted-foreground/70 shrink-0"}):t.jsx(Mr,{size:12,className:"text-muted-foreground/70 shrink-0"}),t.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:e.name})]}),S&&t.jsx(Ki,{node:e,depth:n+1,activeKey:i,onSelect:h})]})},Ki=({node:e,depth:n,activeKey:i,onSelect:h})=>t.jsxs(t.Fragment,{children:[[...e.dirs.values()].sort((S,x)=>S.name.localeCompare(x.name)).map(S=>t.jsx(Ch,{dir:S,depth:n,activeKey:i,onSelect:h},S.path)),e.files.slice().sort((S,x)=>S.path.localeCompare(x.path)).map(S=>{const x=i===S.cardKey;return t.jsxs("button",{type:"button",onClick:()=>h(S),className:Q("flex items-center gap-1.5 w-full px-2 py-1 rounded-sm text-left",x?"bg-muted":"hover:bg-muted/60"),style:{paddingLeft:8+n*12},title:S.path,children:[t.jsx("span",{className:Q("w-1.5 h-1.5 rounded-full shrink-0",vn[Xn(S.status)])}),t.jsx("span",{className:Q("text-xs truncate",x?"text-foreground font-medium":"text-foreground/90"),children:$i(S.path)})]},S.cardKey)})]}),kh=({workingDir:e,selectedHash:n,onSelectCommit:i})=>{const{t:h}=se(),{data:S,isLoading:x,fetchNextPage:w,hasNextPage:s,isFetchingNextPage:a}=ti({queryKey:ge.git.log(e),queryFn:({pageParam:f=0})=>de.get("/git/log",{params:{workingDir:e,limit:String(ur),skip:String(f)}}),initialPageParam:0,getNextPageParam:(f,d)=>f.commits.length<ur?void 0:d.length*ur}),u=S?.pages.flatMap(f=>f.commits)||[];return x?t.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2 text-muted-foreground text-xs",children:[t.jsx(pe,{size:"xs"}),t.jsx("span",{children:h("正在加载提交记录...")})]}):u.length===0?t.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:h("暂无提交记录")}):t.jsxs("div",{className:"space-y-px px-1.5 pb-1.5",children:[u.map(f=>{const d=n===f.hash;return t.jsxs("button",{type:"button",onClick:()=>i(f),className:Q("flex items-start gap-1.5 w-full px-1.5 py-1 rounded-sm text-left group",d?"bg-muted":"hover:bg-muted/60"),title:f.message,children:[t.jsx("span",{className:Q("w-1.5 h-1.5 rounded-full mt-1.5 shrink-0 transition-colors",d?"bg-primary":"bg-border group-hover:bg-muted-foreground/60")}),t.jsxs("span",{className:"flex-1 min-w-0",children:[t.jsx("span",{className:Q("block text-xs truncate",d?"text-foreground font-medium":"text-foreground/90"),children:f.message}),t.jsxs("span",{className:"block text-[11px] text-muted-foreground truncate",children:[t.jsx("span",{className:"font-mono",children:f.shortHash})," · ",f.author," · ",xh(f.timestamp)]})]})]},f.hash)}),s&&t.jsx("button",{type:"button",onClick:()=>w(),disabled:a,className:"w-full py-1.5 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/60 rounded-sm transition-colors flex items-center justify-center gap-1.5",children:a?t.jsxs(t.Fragment,{children:[t.jsx(pe,{size:"xs"})," ",h("正在加载...")]}):h("加载更多提交")})]})},Eh=({projectId:e,workingDir:n,workspaceId:i,branchName:h,targetBranch:S,commitMessage:x,canRunGitOperations:w,onRefreshCommitMessage:s,onConflict:a,onResolveConflicts:u})=>{const{t:f}=se(),[d,m]=A.useState({kind:"overview"}),[g,y]=A.useState(""),[b,r]=A.useState(null),[o,l]=A.useState(null),{data:c,isLoading:p,isError:_}=hh(n),C=d.kind==="commit"?d.commit.hash:null,{data:k,isLoading:v}=Bi(n,C),E=A.useRef(new Map),R=A.useRef(null),O=A.useRef(null),L=A.useCallback((W,z)=>{z?E.current.set(W,z):E.current.delete(W)},[]),{uncommitted:T,committed:H,commitFiles:M}=A.useMemo(()=>{const W=I=>!g.trim()||I.path.toLowerCase().includes(g.trim().toLowerCase());if(d.kind==="commit"){const I={kind:"commit",hash:d.commit.hash},X=(k?.files||[]).filter(W).map(Y=>({...Y,cardKey:Ht(I,Y.path)}));return{uncommitted:[],committed:[],commitFiles:X}}const z=(c?.uncommitted||[]).filter(W).map(I=>({...I,cardKey:Ht({kind:"working",diffType:"uncommitted"},I.path)})),j=(c?.committed||[]).filter(W).map(I=>({...I,cardKey:Ht({kind:"working",diffType:"committed"},I.path)}));return{uncommitted:z,committed:j,commitFiles:[]}},[d,c,k,g]),F=d.kind==="commit"?M:[...T,...H],U=A.useMemo(()=>wh(F),[F]),N=A.useMemo(()=>{let W=0,z=0;for(const j of F)W+=j.additions??0,z+=j.deletions??0;return{additions:W,deletions:z,files:F.length}},[F]),D=A.useCallback(()=>{const W=R.current;if(!W)return;const z=W.getBoundingClientRect().top;let j=null,I=Number.NEGATIVE_INFINITY;for(const[X,Y]of E.current){const Z=Y.getBoundingClientRect().top-z;Z<=48&&Z>I&&(I=Z,j=X)}if(!j){let X=null,Y=Number.POSITIVE_INFINITY;for(const[Z,G]of E.current){const te=G.getBoundingClientRect().top-z;te<Y&&(Y=te,X=Z)}j=X}r(j)},[]);A.useEffect(()=>{const W=R.current;if(!W)return;let z=0;const j=()=>{cancelAnimationFrame(z),z=requestAnimationFrame(D)};return W.addEventListener("scroll",j,{passive:!0}),()=>{W.removeEventListener("scroll",j),cancelAnimationFrame(z)}},[D]);const P=A.useCallback(W=>{const z=E.current.get(W.cardKey);z&&(z.scrollIntoView({behavior:"smooth",block:"start"}),r(W.cardKey),l(W.cardKey),O.current&&clearTimeout(O.current),O.current=setTimeout(()=>l(null),1200))},[]),B=A.useCallback(W=>{m(z=>z.kind==="commit"&&z.commit.hash===W.hash?{kind:"overview"}:{kind:"commit",commit:W}),y(""),r(null),R.current?.scrollTo({top:0})},[]),q=A.useCallback(()=>{m({kind:"overview"}),y(""),r(null),R.current?.scrollTo({top:0})},[]);if(!n)return t.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground text-sm bg-background h-full",children:f("未选择工作区")});const K=w&&e&&i&&h&&S,$=d.kind==="commit"?v:p;return t.jsxs("div",{className:"flex h-full w-full min-w-0 flex-col bg-background",children:[K&&a&&u&&t.jsx(_h,{projectId:e,workspaceId:i,branchName:h,targetBranch:S,commitMessage:x,committedFileCount:c?.committed?.length,onRefreshCommitMessage:s,onConflict:a,onResolveConflicts:u}),t.jsx("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border/60 shrink-0 min-h-[37px]",children:d.kind==="overview"?t.jsxs(t.Fragment,{children:[t.jsx(Br,{size:14,className:"text-muted-foreground shrink-0"}),t.jsx("span",{className:"text-xs font-semibold text-foreground",children:f("代码审查")}),t.jsx("span",{className:"text-xs text-muted-foreground",children:f("{count} 个文件",{count:N.files})}),t.jsx(Ar,{additions:N.additions,deletions:N.deletions}),h&&S&&t.jsxs("span",{className:"ml-auto flex items-center gap-1 text-[11px] text-muted-foreground font-mono truncate",children:[t.jsx("span",{className:"truncate",children:h}),t.jsx(vr,{size:10,className:"rotate-180 shrink-0"}),t.jsx("span",{className:"truncate",children:S})]})]}):t.jsxs(t.Fragment,{children:[t.jsxs("button",{type:"button",onClick:q,className:"flex items-center gap-1 px-1.5 py-0.5 -ml-1.5 rounded-sm text-xs text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors shrink-0",children:[t.jsx(vr,{size:12}),f("全部变更")]}),t.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground/50 text-xs",children:"/"}),t.jsx("span",{className:"text-[11px] font-mono text-muted-foreground shrink-0",children:d.commit.shortHash}),t.jsx("span",{className:"text-xs text-foreground truncate",children:d.commit.message}),t.jsx(Ar,{className:"ml-auto",additions:N.additions,deletions:N.deletions})]})}),t.jsxs("div",{className:"flex flex-1 min-h-0",children:[t.jsx("div",{ref:R,className:"flex-1 min-w-0 overflow-y-auto scrollbar-app-thin",children:$?t.jsx("div",{className:"p-3 space-y-3",children:[0,1].map(W=>t.jsxs("div",{className:"rounded-md border border-border overflow-hidden",children:[t.jsx("div",{className:"h-8 bg-muted/60 animate-pulse motion-reduce:animate-none"}),t.jsxs("div",{className:"p-3 space-y-2",children:[t.jsx("div",{className:"h-3 w-2/3 bg-muted animate-pulse motion-reduce:animate-none rounded-sm"}),t.jsx("div",{className:"h-3 w-1/2 bg-muted animate-pulse motion-reduce:animate-none rounded-sm"}),t.jsx("div",{className:"h-3 w-3/4 bg-muted animate-pulse motion-reduce:animate-none rounded-sm"})]})]},W))}):_&&d.kind==="overview"?t.jsx("div",{className:"flex-1 flex items-center justify-center py-16 text-destructive-ink text-sm",children:f("变更加载失败")}):F.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-muted-foreground",children:[t.jsx(xr,{size:28,className:"mb-2 text-muted-foreground/70"}),t.jsx("span",{className:"text-xs",children:g.trim()?f("没有匹配筛选条件的文件"):d.kind==="commit"?f("该提交没有文件变更"):f("没有待审查的变更")})]}):d.kind==="commit"?t.jsx("div",{className:"p-3 space-y-3",children:M.map(W=>t.jsx(mr,{entry:W,source:{kind:"commit",hash:d.commit.hash},workingDir:n,flash:o===W.cardKey,registerNode:L},W.cardKey))}):t.jsxs("div",{className:"p-3 space-y-4",children:[T.length>0&&t.jsxs("section",{children:[t.jsxs("div",{className:"sticky top-0 z-10 -mx-3 px-5 py-1.5 bg-background/95 backdrop-blur-sm",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:f("未提交")}),t.jsx("span",{className:"ml-2 text-[11px] tabular-nums text-muted-foreground",children:T.length})]}),t.jsx("div",{className:"space-y-3 mt-1",children:T.map(W=>t.jsx(mr,{entry:W,source:{kind:"working",diffType:"uncommitted"},workingDir:n,flash:o===W.cardKey,registerNode:L},W.cardKey))})]}),H.length>0&&t.jsxs("section",{children:[t.jsxs("div",{className:"sticky top-0 z-10 -mx-3 px-5 py-1.5 bg-background/95 backdrop-blur-sm",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:f("已提交")}),t.jsx("span",{className:"ml-2 text-[11px] tabular-nums text-muted-foreground",children:H.length})]}),t.jsx("div",{className:"space-y-3 mt-1",children:H.map(W=>t.jsx(mr,{entry:W,source:{kind:"working",diffType:"committed"},workingDir:n,flash:o===W.cardKey,registerNode:L},W.cardKey))})]})]})}),t.jsxs("aside",{className:"shrink-0 border-l border-border flex flex-col min-h-0",style:{width:"clamp(15rem, 24%, 22rem)"},children:[t.jsx("div",{className:"p-2 shrink-0",children:t.jsx(to,{size:"sm",value:g,onValueChange:y,placeholder:f("筛选文件...")})}),t.jsx("div",{className:"flex-1 overflow-y-auto scrollbar-app-thin px-1.5 pb-1.5 min-h-0",children:F.length===0?t.jsx("div",{className:"px-2 py-3 text-xs text-muted-foreground",children:g.trim()?f("无匹配文件"):f("暂无变更文件")}):t.jsx(Ki,{node:U,depth:0,activeKey:b,onSelect:P})}),t.jsxs("div",{className:"shrink-0 border-t border-border/60 max-h-[40%] flex flex-col min-h-0",children:[t.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2 shrink-0",children:[t.jsx(zt,{size:12,className:"text-muted-foreground"}),t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:f("提交记录")})]}),t.jsx("div",{className:"flex-1 overflow-y-auto scrollbar-app-thin min-h-0",children:t.jsx(kh,{workingDir:n,selectedHash:C,onSelectCommit:B})})]})]})]})]})},pr=50;function jh(e){const i=Math.floor(Date.now()/1e3)-e;return i<60?qe("{count}s ago",{count:i}):i<3600?qe("{count}m ago",{count:Math.floor(i/60)}):i<86400?qe("{count}h ago",{count:Math.floor(i/3600)}):i<604800?qe("{count}d ago",{count:Math.floor(i/86400)}):new Date(e*1e3).toLocaleDateString()}function Nh(e){const n=e.split("/");return n[n.length-1]||e}function Rh(e){const n=e.lastIndexOf("/");return n>0?e.slice(0,n):""}const Ah=({workingDir:e,hash:n,filePath:i})=>{const{t:h}=se(),{data:S,isLoading:x,isError:w}=Oi(e,n,i);if(x)return t.jsxs("div",{className:"flex-1 flex items-center justify-center gap-2 text-muted-foreground",children:[t.jsx(pe,{size:"md"}),t.jsx("span",{className:"text-xs",children:h("Loading diff...")})]});if(w)return t.jsx("div",{className:"flex-1 flex items-center justify-center text-destructive-ink text-xs",children:h("Failed to load diff.")});const s=S?.diff||"";if(!s.trim())return t.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground text-xs",children:h("No diff content available.")});const a=s.split(`
62
+ `);return t.jsx("div",{className:"flex-1 overflow-auto scrollbar-app-thin font-mono text-xs leading-5",children:a.map((u,f)=>t.jsx(zi,{line:u,lineNum:f+1},f))})},Lh=({workingDir:e,hash:n,selectedPath:i,onSelectFile:h})=>{const{t:S}=se(),{data:x,isLoading:w}=Bi(e,n);if(w)return t.jsxs("div",{className:"pl-7 py-1 text-xs text-muted-foreground flex items-center gap-1",children:[t.jsx(pe,{size:"xs"}),t.jsx("span",{children:S("Loading...")})]});const s=x?.files||[];return s.length===0?t.jsx("div",{className:"pl-7 py-1 text-xs text-muted-foreground",children:S("No files changed")}):t.jsx("div",{className:"pl-7 pb-1 space-y-0.5",children:s.map(a=>{const u=Rh(a.path);return t.jsxs("button",{type:"button",onClick:f=>{f.stopPropagation(),h(a.path)},className:Q("flex items-center gap-2 px-1.5 py-1 rounded-sm cursor-pointer w-full text-left",i===a.path?"bg-muted":"hover:bg-muted/60"),children:[t.jsx(qs,{status:a.status}),t.jsx("span",{className:"min-w-0 text-xs text-foreground truncate",children:Nh(a.path)}),u&&t.jsx("span",{className:"min-w-0 flex-1 truncate text-right font-mono text-[11px] text-muted-foreground [direction:rtl]",children:t.jsx("span",{dir:"ltr",children:u})})]},a.path)})})},Th=({workingDir:e})=>{const{t:n}=se(),i=Kt(k=>k.visibleContext),h=no(e,i),{data:S,isLoading:x,isError:w,fetchNextPage:s,hasNextPage:a,isFetchingNextPage:u}=ti({queryKey:ge.git.log(e||""),queryFn:({pageParam:k=0})=>de.get("/git/log",{params:{workingDir:e||"",limit:String(pr),skip:String(k)}}),initialPageParam:0,getNextPageParam:(k,v)=>k.commits.length<pr?void 0:v.length*pr,enabled:!!e,refetchInterval:h,refetchIntervalInBackground:!1,refetchOnWindowFocus:h?"always":!1,refetchOnReconnect:h?"always":!1}),f=S?.pages.flatMap(k=>k.commits)||[],[d,m]=A.useState(null),[g,y]=A.useState(null),[b,r]=A.useState(280),[o,l]=A.useState(!1),c=A.useCallback(k=>{k.preventDefault(),l(!0);const v=k.clientX,E=b,R=L=>{const T=Math.min(480,Math.max(180,E+(L.clientX-v)));r(T)},O=()=>{l(!1),document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",O)};document.addEventListener("mousemove",R),document.addEventListener("mouseup",O)},[b]),p=k=>{d===k?(m(null),y(null)):(m(k),y(null))},_=A.useRef(null);if(!e)return t.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground text-sm bg-background h-full",children:n("No workspace selected.")});if(x)return t.jsxs("div",{className:"flex-1 flex items-center justify-center gap-2 text-muted-foreground bg-background h-full",children:[t.jsx(pe,{size:"md"}),t.jsx("span",{className:"text-sm",children:n("Loading history...")})]});if(w)return t.jsx("div",{className:"flex-1 flex items-center justify-center text-destructive-ink text-sm bg-background h-full",children:n("Failed to load history.")});if(f.length===0)return t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center py-12 text-muted-foreground bg-background h-full",children:[t.jsx(zt,{size:28,className:"mb-2 text-muted-foreground/70"}),t.jsx("span",{className:"text-xs",children:n("No commit history")})]});const C=f.find(k=>k.hash===d);return t.jsxs("div",{className:"flex h-full bg-background",style:o?{userSelect:"none",cursor:"col-resize"}:void 0,children:[t.jsxs("div",{className:"border-r border-border flex flex-col shrink-0",style:{width:b},children:[t.jsx("div",{className:"px-3 py-2.5 border-b border-border/60 shrink-0",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(zt,{size:14,className:"text-muted-foreground"}),t.jsx("span",{className:"text-xs font-semibold text-foreground",children:n("History")}),t.jsx("span",{className:"text-[11px] tabular-nums bg-muted px-1.5 py-0.5 rounded-full text-muted-foreground",children:f.length})]})}),t.jsxs("div",{ref:_,className:"flex-1 overflow-auto scrollbar-app-thin p-1.5",children:[f.map(k=>{const v=d===k.hash;return t.jsxs("div",{children:[t.jsxs("button",{type:"button",onClick:()=>p(k.hash),className:Q("flex items-start gap-2 px-2 py-1.5 rounded-sm cursor-pointer w-full text-left group",v?"bg-muted":"hover:bg-muted/60"),children:[t.jsx("div",{className:"flex flex-col items-center shrink-0 pt-1",children:t.jsx("div",{className:Q("w-2 h-2 rounded-full shrink-0 transition-colors",v?"bg-primary":"bg-border group-hover:bg-muted-foreground/60")})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"text-[11px] font-mono text-muted-foreground shrink-0",children:k.shortHash}),t.jsx("span",{className:"text-xs text-foreground truncate flex-1",children:k.message}),t.jsx(Ve,{size:12,className:Q("shrink-0 text-muted-foreground/70 transition-transform",v&&"rotate-90")})]}),t.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[t.jsx("span",{className:"text-xs text-muted-foreground truncate",children:k.author}),t.jsx("span",{className:"text-[11px] text-muted-foreground",children:jh(k.timestamp)})]})]})]}),v&&t.jsxs(t.Fragment,{children:[k.body&&t.jsx("div",{className:"pl-7 pr-2 py-1.5 text-xs text-muted-foreground whitespace-pre-wrap leading-5 border-l-2 border-border ml-3",children:k.body}),t.jsx(Lh,{workingDir:e,hash:k.hash,selectedPath:g,onSelectFile:y})]})]},k.hash)}),a&&t.jsx("button",{type:"button",onClick:()=>s(),disabled:u,className:"w-full py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/60 rounded-sm transition-colors flex items-center justify-center gap-1.5",children:u?t.jsxs(t.Fragment,{children:[t.jsx(pe,{size:"xs"})," ",n("Loading...")]}):n("Load more")})]})]}),t.jsx("div",{onMouseDown:c,className:Q("w-1 shrink-0 cursor-col-resize transition-colors",o?"bg-ring/40":"bg-transparent hover:bg-border")}),t.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:g&&d?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"px-3 py-2 border-b border-border/60 flex items-center gap-2 shrink-0",children:[t.jsx(xr,{size:14,className:"text-muted-foreground"}),t.jsx("span",{className:"text-xs font-medium text-foreground truncate",children:g}),t.jsxs("span",{className:"font-mono text-[11px] text-muted-foreground",children:["(",C?.shortHash,")"]})]}),t.jsx(Ah,{workingDir:e,hash:d,filePath:g})]}):t.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:t.jsxs("div",{className:"flex flex-col items-center gap-2",children:[t.jsx(xr,{size:28,className:"text-muted-foreground/70"}),t.jsx("span",{className:"text-xs",children:n(d?"Select a file to view diff":"Select a commit to view changes")})]})})})]})},Rs=Tr();function Ph(e){if(!Rs)return e;try{const n=new URL(Rs);return new URL(e,n.origin).toString()}catch{return e}}function Xi(e){return{...e,viewUrl:e.viewUrl?Ph(e.viewUrl):null}}function Mh(e,n=!0){return Te({queryKey:ge.previews.status(e??""),queryFn:async()=>{const i=await de.get(`/previews/${e}/status`);return Xi(i)},enabled:!!e&&n,refetchOnWindowFocus:!1})}function Dh(e){const n=ut();return Os({mutationFn:async i=>{const h=await de.put(`/previews/${e}/config`,{target:i});return Xi(h)},onSuccess:i=>{e&&(n.setQueryData(ge.previews.status(e),i),n.invalidateQueries({queryKey:ge.workspaces.all}))}})}function Bh(){return window.location.protocol==="https:"?"remote":"local"}function Oh(e,n,i=!0){const[h,S]=A.useState(null),[x,w]=A.useState(!1),[s,a]=A.useState(null),[u,f]=A.useState(0);return A.useEffect(()=>{if(!i||!e||!n?.ready||!n.target){S(null),w(!1),a(null);return}let d=!1,m=null,g=null;S(null);const y=r=>{de.delete(`/previews/${e}/sessions/${r}`).catch(()=>{})};return(async()=>{w(!0),a(null);try{const r={mode:Bh(),localHostname:window.location.hostname},o=await de.post(`/previews/${e}/sessions`,r);if(d){y(o.id);return}m=o.id,S(o),g=window.setInterval(async()=>{if(m)try{const l=await de.post(`/previews/${e}/sessions/${m}/heartbeat`);d||(S(l),a(null))}catch(l){!d&&l instanceof Xt&&l.status===404?f(c=>c+1):d||a(l instanceof Error?l:new Error("Preview session heartbeat failed"))}},3e4)}catch(r){d||(S(null),a(r instanceof Error?r:new Error("Failed to open preview session")))}finally{d||w(!1)}})(),()=>{d=!0,g!==null&&window.clearInterval(g),m&&y(m)}},[i,u,n?.ready,n?.target,e]),{session:h,isOpening:x,error:s,retry:()=>f(d=>d+1)}}const Ih="agent-tower-preview",Fh="agent-tower-preview-host";function Hh(){return"3000, localhost:3000, http://127.0.0.1:5173"}function Wh(e){if(!e)return null;try{return new URL(e).origin}catch{return null}}function zh(e){return t.jsx($h,{...e},e.workspaceId??"no-workspace")}function $h({workspaceId:e,readOnly:n,navigationRequest:i,onNavigationRequestHandled:h}){const{t:S}=se(),[x,w]=A.useState(null),a=!(i?.source.kind==="visualization")&&!x,{data:u,isLoading:f,refetch:d,isFetching:m}=Mh(e,a),g=Dh(e),{session:y,isOpening:b,error:r,retry:o}=Oh(e,u,a),l=A.useRef(null),c=A.useRef(null),p=A.useRef(null),_=A.useRef(null),C=A.useRef(null),k=A.useRef(null),[v,E]=A.useState(0),[R,O]=A.useState({target:null,address:"",iframeSrc:null,isFrameLoading:!1}),L=Wh(y?.viewUrl),T=u&&R.target!==u.target?{target:u.target,address:u.target??"",iframeSrc:null,isFrameLoading:!1}:u&&!u.ready&&R.iframeSrc?{...R,iframeSrc:null,isFrameLoading:!1}:R,H=A.useCallback(K=>{O($=>({...u&&$.target!==u.target?{target:u.target,address:u.target??"",iframeSrc:null,isFrameLoading:!1}:$,...K}))},[u]);A.useEffect(()=>{if(!y||y.target!==u?.target)return;const K=C.current!==L;C.current=L,O($=>{const W=i?.source.kind==="web"&&k.current!==i.id?Tt(i.source.url,y.target,y.viewUrl):null;if(!K&&$.iframeSrc&&$.target===y.target&&W?.kind!=="proxy")return $;let z=$.iframeSrc;if(W?.kind==="proxy")z=W.url;else if(!z||$.target!==y.target||K){const I=p.current;if(I)z=jn(y.viewUrl,I);else{const X=Tt($.address||y.target,y.target,y.viewUrl);z=X?.kind==="proxy"?X.url:y.viewUrl}}p.current=null;const j=_.current;return j&&!j.closed&&z&&j.location.replace(z),_.current=null,{target:y.target,address:W?.kind==="proxy"?i?.source.kind==="web"?i.source.url:$.address:$.address||y.target,iframeSrc:z,isFrameLoading:!!z}})},[i,y,L,u?.target]),A.useEffect(()=>()=>{_.current?.close()},[]);const M=A.useCallback(async(K,$=!1)=>{const W=Tt(K,u?.target??null,y?.viewUrl??null);if(!W||!e)return;if(w(null),W.kind==="proxy"){if($){window.open(W.url,"_blank","noopener,noreferrer");return}O({target:u?.target??null,address:K,iframeSrc:W.url,isFrameLoading:!0});return}if(n)return;const z=$?window.open("about:blank","_blank"):null;z&&(z.opener=null);try{p.current=W.path,_.current=z;const j=await g.mutateAsync(W.target);O({target:j.target,address:K.trim(),iframeSrc:null,isFrameLoading:!!j.ready}),E(I=>I+1),ye.success(S("Preview target saved")),j.ready||(_.current?.close(),_.current=null)}catch(j){_.current?.close(),_.current=null,p.current=null;const I=j instanceof Error?j.message:S("Failed to save preview target");ye.error(I)}},[y?.viewUrl,n,u?.target,S,g,e]);A.useEffect(()=>{if(!i||k.current===i.id||i.source.kind==="web"&&f)return;const K=window.setTimeout(()=>{k.current=i.id,h?.(i.id),i.source.kind==="visualization"?(w({source:i.source,iframeSrc:Nn(i.source.sessionId,i.source.file),isFrameLoading:!0}),E($=>$+1)):(w(null),M(i.source.url))},0);return()=>window.clearTimeout(K)},[f,M,i,h]),A.useEffect(()=>{if(x)return;const K=$=>{if($.source!==l.current?.contentWindow)return;const W=$.data;if(!(!W||W.source!==Ih)){if(W.type==="location"&&typeof W.href=="string"){const z=Rn(u?.target??null,y?.viewUrl??null,W.href,window.location.href);z&&document.activeElement!==c.current&&H({target:u?.target??T.target,address:z,isFrameLoading:!1});return}W.type==="navigate-loopback"&&typeof W.href=="string"&&M(W.href,W.newTab===!0)}};return window.addEventListener("message",K),()=>window.removeEventListener("message",K)},[T.target,M,H,y?.viewUrl,u?.target,x]);const F=K=>{l.current?.contentWindow?.postMessage({source:Fh,action:K},"*")},U=K=>{K.preventDefault(),M(T.address)},N=async()=>{if(x){w($=>$&&{...$,isFrameLoading:!0}),E($=>$+1);return}const K=await d();if(!K.data?.ready){H({target:K.data?.target??T.target,iframeSrc:null,isFrameLoading:!1});return}if(!y||!T.iframeSrc){o();return}H({isFrameLoading:!0}),F("reload")},D=()=>{if(x){window.open(x.iframeSrc,"_blank","noopener,noreferrer");return}if(!y?.viewUrl)return;const K=Tt(T.address||y.target,y.target,y.viewUrl),$=K?.kind==="proxy"?K.url:y.viewUrl;window.open($,"_blank","noopener,noreferrer")};if(!e)return t.jsx("div",{className:"h-full flex items-center justify-center bg-background text-sm text-muted-foreground",children:S("No active workspace.")});const P=x?.iframeSrc??T.iframeSrc,B=!!x,q=!B&&(f||m||g.isPending||b);return t.jsxs("div",{className:"h-full flex flex-col bg-background",children:[t.jsxs("div",{className:"shrink-0 border-b border-border bg-muted/40 px-2 py-2",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(Fe,{label:S("Back"),onClick:()=>{B?w(null):F("back")},disabled:!B&&!T.iframeSrc,children:t.jsx(vr,{})}),t.jsx(Fe,{label:S("Forward"),onClick:()=>F("forward"),disabled:B||!T.iframeSrc,children:t.jsx(ri,{})}),t.jsx(Fe,{label:!B&&T.isFrameLoading?S("Stop loading"):S("Refresh preview"),onClick:!B&&T.isFrameLoading?()=>{F("stop"),H({isFrameLoading:!1})}:N,disabled:!B&&!T.isFrameLoading&&m,children:!B&&T.isFrameLoading?t.jsx(Qe,{}):m?t.jsx(pe,{}):t.jsx(ft,{})}),t.jsx("form",{className:"min-w-0 flex-1",onSubmit:U,children:t.jsx(lo,{ref:c,size:"sm",prefix:t.jsx(No,{}),value:x?.source.file??T.address,onChange:K=>H({address:K.target.value}),onKeyDown:K=>{K.key==="Enter"&&K.nativeEvent.isComposing&&K.preventDefault()},disabled:B||n||g.isPending,placeholder:Hh(),"aria-label":S("Preview address")})}),t.jsx(Fe,{label:S("Open preview in new tab"),onClick:D,disabled:!P,children:t.jsx(Lr,{})})]}),t.jsxs("div",{className:"mt-1 flex min-h-4 items-center justify-between gap-2 px-1 text-xs leading-4",children:[t.jsx("span",{className:"truncate text-muted-foreground",children:B?S("Viewing agent visualization"):q?S("Checking preview target..."):r?r.message:u?.ready?`${S("Proxying")} ${u.target}`:u?.configured?`${S("Preview target is not reachable")}${u.error?`: ${u.error}`:""}`:S("Enter a local preview URL on the Agent Tower machine.")}),t.jsx("span",{className:"shrink-0 text-muted-foreground",children:S(B?"Session file":"Loopback only")})]})]}),t.jsx("div",{className:"relative flex-1 min-h-0 bg-background",children:P?t.jsx("iframe",{ref:l,src:P,title:S("Preview"),className:"absolute inset-0 h-full w-full border-0 bg-white",sandbox:B?"allow-modals allow-pointer-lock allow-presentation allow-scripts":"allow-downloads allow-forms allow-modals allow-pointer-lock allow-popups allow-popups-to-escape-sandbox allow-presentation allow-same-origin allow-scripts",allow:"clipboard-read; clipboard-write; fullscreen",onLoad:()=>{B?w(K=>K&&{...K,isFrameLoading:!1}):H({isFrameLoading:!1})}},v):t.jsx("div",{className:"absolute inset-0 flex items-center justify-center px-4 text-center text-sm text-muted-foreground",children:u?.configured?u.ready&&b?S("Checking preview target..."):S("Start the preview server, then refresh."):S("Configure a local preview target to display it here.")})})]})}const Uh={[Ie.ACTIVE]:"success",[Ie.MERGED]:"info",[Ie.HIBERNATED]:"warning",[Ie.ABANDONED]:"neutral"};function qh(e){return e.length<=34?e:`...${e.slice(-31)}`}function Kh({workspaces:e,teamRun:n,selectedWorkspaceId:i,onSelectWorkspace:h,disabled:S,className:x,buttonClassName:w}){const{t:s}=se(),a=A.useMemo(()=>Ir(e,n),[e,n]),u=a.find(f=>f.workspace.id===i)??a[0];return a.length<=1?null:t.jsx("div",{className:Q("relative",x),children:t.jsxs(Xs,{children:[t.jsxs(Ys,{disabled:S,className:Q("group inline-flex h-8 max-w-[340px] items-center gap-2 rounded-md border border-border bg-background px-2.5 text-left text-xs text-foreground/80 outline-none transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring/60 disabled:cursor-not-allowed disabled:opacity-40 data-[state=open]:bg-accent",w),title:s("Workspace"),children:[t.jsx(_r,{size:14,className:"shrink-0 text-muted-foreground"}),t.jsx(Ft,{size:"sm",shape:"tag",children:s(u.roleLabel)}),t.jsx("span",{className:"min-w-0 truncate font-medium text-foreground",children:s(u.displayName)}),t.jsx("span",{className:"min-w-0 truncate font-mono text-[11px] text-muted-foreground",children:qh(Ct(u.workspace))}),t.jsx($e,{size:13,className:"shrink-0 text-muted-foreground/70 transition-transform group-data-[state=open]:rotate-180"})]}),t.jsx(Vs,{className:"w-[420px] max-w-[calc(100vw-2rem)]",children:t.jsx(Vn,{value:u.workspace.id,onValueChange:h,children:a.map(f=>t.jsxs(Gn,{value:f.workspace.id,icon:t.jsx(Bs,{className:"mt-0.5 size-3.5"}),className:"items-start",children:[t.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[t.jsx("span",{className:"truncate",children:s(f.displayName)}),t.jsx(Ft,{size:"sm",shape:"tag",children:s(f.roleLabel)}),t.jsx(Ft,{size:"sm",tone:Uh[f.workspace.status],children:f.workspace.status})]}),t.jsx("span",{className:"mt-0.5 block truncate font-mono text-[11px] font-normal text-muted-foreground",children:Ct(f.workspace)}),t.jsxs("span",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs font-normal text-muted-foreground",children:[f.ownerName&&t.jsxs("span",{children:[s("Owner"),": ",f.ownerName]}),f.parentBranchName&&t.jsxs("span",{children:[s("Parent"),": ",f.parentBranchName]}),t.jsx("span",{className:"font-mono text-[11px]",children:f.workspace.id.slice(0,8)})]})]},f.workspace.id))})})]})})}const Xh=[{key:"review",label:"Changes",icon:t.jsx(Br,{size:14})},{key:"editor",label:"Editor",icon:t.jsx(Ks,{size:14})},{key:"terminal",label:"Terminal",icon:t.jsx(xt,{size:14})},{key:"preview",label:"Preview",icon:t.jsx(ei,{size:14})}],Yh=[{key:"history",label:"History",icon:t.jsx(zt,{size:14})},{key:"editor",label:"Editor",icon:t.jsx(Ks,{size:14})},{key:"terminal",label:"Terminal",icon:t.jsx(xt,{size:14})},{key:"preview",label:"Preview",icon:t.jsx(ei,{size:14})}],Vh=({active:e,onClick:n,icon:i,label:h})=>t.jsxs("button",{type:"button",onClick:n,className:Q("flex shrink-0 items-center gap-2 px-4 py-2 text-xs font-medium transition-all rounded-t-md border-t border-x -mb-px whitespace-nowrap outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/60",e?"bg-background border-border text-foreground z-10":"bg-transparent border-transparent text-muted-foreground hover:text-foreground hover:bg-foreground/[0.05]"),children:[i,t.jsx("span",{children:h})]}),Gh=({active:e,onClick:n,icon:i,label:h})=>t.jsx("button",{type:"button",onClick:n,title:h,"aria-label":h,"aria-pressed":e,className:Q("flex h-9 w-9 items-center justify-center rounded-lg transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",e?"bg-background text-foreground shadow-raised ring-1 ring-border/80":"text-muted-foreground hover:bg-foreground/[0.05] hover:text-foreground"),children:i}),Zu=ue.memo(function({className:n,sessionId:i,workspaceId:h,workingDir:S,projectId:x,hideChanges:w,gitAvailable:s=!0,readOnly:a,repoDeleted:u,teamRun:f,teamStatus:d,gitProps:m,workspaces:g,selectedWorkspaceId:y,onSelectWorkspace:b,variant:r="tabs",expanded:o,onExpandedChange:l,minContentWidth:c=520,tabRef:p,previewRequest:_,onPreviewRequestHandled:C}){const{t:k}=se(),v=Kt(J=>J.setVisibleContext),E=r==="rail",[R,O]=A.useState(!1),L=E?o??R:!0,T=A.useCallback(J=>{o===void 0&&O(J),l?.(J)},[o,l]),H=A.useMemo(()=>{const J=w?Yh:Xh,ne=s?J:J.filter(we=>we.key!=="review"&&we.key!=="history"),re=a?ne.filter(we=>we.key!=="terminal"):ne;return f?[{key:"team-status",label:"Team Status",icon:t.jsx(ht,{size:14})},...re]:re},[s,w,a,f]),[M,F]=A.useState(()=>_?"preview":s?w?"history":"review":"editor"),U=A.useRef(null),N=A.useRef(0),[D,P]=A.useState(),B=A.useCallback(J=>{F(J),E&&T(!0)},[E,T]);A.useImperativeHandle(p,()=>({setTab:J=>B(J),openFile:(J,ne,re)=>{B("editor"),requestAnimationFrame(()=>U.current?.openFile(J,ne,re))},openPreview:(J,ne)=>{N.current+=1,P({id:N.current,source:J,workspaceId:ne}),B("preview")}}),[B]);const q=_??D,K=q?.workspaceId&&q.workspaceId!==h?void 0:q,$=A.useCallback(J=>{P(ne=>ne?.id===J?void 0:ne),C?.(J)},[C]),{data:W}=co(x??""),z=A.useMemo(()=>{if(!W?.quickCommands)return[];try{return JSON.parse(W.quickCommands)}catch{return[]}},[W?.quickCommands]),[j,I]=A.useState([]),X=A.useRef(void 0);A.useEffect(()=>{S&&S!==X.current&&(X.current=S,I(J=>J.includes(S)?J:[...J,S]))},[S]),A.useEffect(()=>{H.some(J=>J.key===M)||F(H[0]?.key??"editor")},[M,H]),A.useEffect(()=>{if(E&&!L)return;const J=M==="review"?"changes":M==="history"?"history":null;if(!h||!S||!J){v(null);return}return v({workspaceId:h,workingDir:S,tab:J}),()=>{v(null)}},[M,L,E,v,S,h]);const Y=!!b&&Ir(g,f).length>1,Z=H.find(J=>J.key===M)??H[0],G=Z?k(Z.label):"",te=a?t.jsx(Ge,{size:"sm",className:"mx-2 mt-2",children:k(u?"项目已删除且本地仓库文件已清理。这里只保留历史视图。":"项目已删除。Workspace 以只读模式展示历史内容。")}):null,ae=t.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[Y&&t.jsx("div",{className:"shrink-0 px-3 py-1.5 border-b border-border/60 bg-muted/40",children:t.jsx(Kh,{workspaces:g,teamRun:f,selectedWorkspaceId:y,onSelectWorkspace:b,buttonClassName:"h-7"})}),t.jsxs("div",{className:"relative flex-1 min-h-0 overflow-hidden",children:[M==="team-status"&&f&&d,M==="editor"&&t.jsx(dh,{ref:U,workingDir:S,readOnly:a}),j.map(J=>{const ne=M==="terminal"&&S===J;return t.jsx("div",{"aria-hidden":!ne,className:"absolute inset-0 h-full w-full min-h-0 min-w-0 overflow-hidden",style:{display:ne?"block":"none"},children:t.jsx(Cl,{cwd:J,workspaceId:ne?h:void 0,isVisible:ne,quickCommands:z})},J)}),M==="preview"&&t.jsx(zh,{workspaceId:h,readOnly:a,navigationRequest:K,onNavigationRequestHandled:$}),M==="review"&&t.jsx(Eh,{projectId:x,workingDir:S,workspaceId:h,branchName:m?.branchName,targetBranch:m?.targetBranch,commitMessage:m?.commitMessage,canRunGitOperations:m?.canRunGitOperations,onRefreshCommitMessage:m?.onRefreshCommitMessage,onConflict:m?.onConflict,onResolveConflicts:m?.onResolveConflicts}),M==="history"&&t.jsx(Th,{workingDir:S})]})]});return E?t.jsxs("div",{className:Q("flex h-full w-full min-w-0 bg-background",n),children:[t.jsx("div",{className:"flex h-full w-12 shrink-0 flex-col items-center gap-1 border-l border-border bg-muted/35 px-1.5 py-2",children:H.map(J=>t.jsx(Gh,{active:L&&M===J.key,onClick:()=>B(J.key),icon:J.icon,label:k(J.label)},J.key))}),L&&t.jsxs("div",{className:"flex h-full min-w-0 flex-1 flex-col border-l border-border bg-background",style:{minWidth:c},children:[te,t.jsxs("div",{className:"flex h-10 shrink-0 items-center justify-between gap-3 border-b border-border bg-background px-3",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-sm font-semibold text-foreground",children:[t.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border border-border bg-muted/35 text-muted-foreground",children:Z?.icon}),t.jsx("span",{className:"truncate",children:G})]}),t.jsx("button",{type:"button",onClick:()=>T(!1),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",title:k("收起"),"aria-label":k("收起"),children:t.jsx(Wo,{size:15})})]}),ae]})]}):t.jsxs("div",{className:Q("flex h-full w-full min-w-0 flex-col bg-background",n),children:[a&&te,t.jsx("div",{className:"flex items-center overflow-x-auto scrollbar-app-thin px-2 pt-2 border-b border-border bg-muted shrink-0 gap-1 select-none",children:H.map(J=>t.jsx(Vh,{active:M===J.key,onClick:()=>B(J.key),icon:J.icon,label:k(J.label)},J.key))}),ae]})}),Zh=3e3;function As(e,n){const i=new Map(e.map(h=>[h.workspaceId,h]));for(const h of n){const S=i.get(h.workspaceId);(!S||h.updatedAt>=S.updatedAt)&&i.set(h.workspaceId,h)}return[...i.values()]}function Qu(e){const n=ut(),i=A.useRef({version:0,values:new Map}),[h,S]=A.useState(0),{data:x=[]}=Te({queryKey:ge.workspaces.setupProgress(e??""),enabled:!!e,refetchOnMount:"always",refetchInterval:u=>u.state.data?.some(f=>f.status==="running")?3e3:!1,queryFn:async({signal:u})=>{const f=i.current.version,d=await de.get(`/tasks/${e}/setup-progress`,{signal:u}),m=[...i.current.values.values()].filter(g=>g.version>f&&g.progress.taskId===e).map(g=>g.progress);return As(d,m)}});A.useEffect(()=>{if(!e)return;const u=ct.connect(),f=ge.workspaces.setupProgress(e),d=g=>{if(g.taskId!==e)return;const y=i.current.values.get(g.workspaceId);y&&y.progress.updatedAt>g.updatedAt||(i.current.values.set(g.workspaceId,{version:++i.current.version,progress:g}),n.setQueryData(f,b=>As(b??[],[g])))},m=()=>{n.invalidateQueries({queryKey:f})};return u.on(Oe.WORKSPACE_SETUP_PROGRESS,d),u.on("connect",m),()=>{u.off(Oe.WORKSPACE_SETUP_PROGRESS,d),u.off("connect",m)}},[e,n]);const w=[...x].sort((u,f)=>f.updatedAt-u.updatedAt),s=w.find(u=>u.status==="running")??w.find(u=>u.status!=="running"&&u.updatedAt>h),a=s?.status!=="running"?s?.updatedAt??null:null;return A.useEffect(()=>{if(a===null)return;const u=setTimeout(()=>S(a),Zh);return()=>clearTimeout(u)},[a]),s??null}function Ju({isOpen:e,onClose:n,onStarted:i,taskId:h,projectId:S,taskTitle:x,taskDescription:w,taskPrompt:s,projectIsGitRepo:a=!0,projectWorktreeReady:u=!0,projectGitReason:f}){const{t:d}=se(),[m,g]=A.useState(""),[y,b]=A.useState(""),[r,o]=A.useState(ze.WORKTREE),[l,c]=A.useState(null),[p,_]=A.useState("idle"),[C,k]=A.useState(null),v=ut(),E=oo(h),R=Qn(),O=ho(),{data:L,isLoading:T}=Pr(),H=l?.isGitRepo??a,M=l?.worktreeReady??u,F=l?.reason??f,U=H!==!1&&M!==!1;A.useEffect(()=>{if(!e||!L)return;const Z=L.find(G=>!ot(G));g(G=>G&&L.some(te=>te.provider.id===G)?G:Z?.provider.id??"")},[e,L]),A.useEffect(()=>{if(e){const Z=[x];w&&Z.push(w),b(s?.trim()||Z.join(`
63
+
64
+ `)),c(null),o(a!==!1&&u!==!1?ze.WORKTREE:ze.MAIN_DIRECTORY),_("idle"),k(null)}},[e,a,u,h,x,w,s]),A.useEffect(()=>{U||o(ze.MAIN_DIRECTORY)},[U]);const N=async()=>{if(!S||O.isPending)return;const Z=await O.mutateAsync({id:S});c(Z),Z.worktreeReady&&o(ze.WORKTREE)},D=p!=="idle",P=async()=>{if(!m||!y.trim())return;const Z=L?.find(G=>G.provider.id===m);if(!(!Z||ot(Z))){k(null);try{_("creating-workspace");const G=await E.mutateAsync({workspaceKind:U?r:ze.MAIN_DIRECTORY});_("creating-session");const te=await de.post(`/workspaces/${G.id}/sessions`,{providerId:m,prompt:y.trim()});_("starting-session"),await R.mutateAsync(te.id),await v.invalidateQueries({queryKey:ge.workspaces.list(h)}),_("idle"),i?.(),n()}catch(G){_("idle"),k(G instanceof Error?G.message:d("启动失败,请重试"))}}},B={idle:d("启动"),"creating-workspace":d("创建工作空间..."),"creating-session":d("创建会话..."),"starting-session":d("启动 Agent...")},q=(L??[]).map(Z=>{const G=Z.provider,te=ot(Z),ae=!te,J=G.executionPermission?d("Required permission: {mode}",{mode:d(uo[G.executionPermission])}):void 0;return{value:G.id,label:ae?G.name:`${G.name}${d(" (不可用)")}`,description:[J,te&&d(te)].filter(Boolean).join(" · "),icon:t.jsx(qt,{agentType:G.agentType,className:"size-4"}),disabled:!ae}}),K=L?.find(Z=>Z.provider.id===m),$=K?ot(K):void 0,W=!!L?.length&&L.every(Z=>!!ot(Z)),z=!T&&!L?.length,j=d("工作树隔离改动,支持 TeamRun、Merge、Rebase 和冲突解决。"),I=d("本地模式会直接修改项目主目录,不会自动提交,也不能使用 Merge、Rebase 或冲突解决。"),X=d(F==="NO_HEAD"?"已检测到 Git,但需要先提交一次才能使用工作树模式。":"非 Git 项目只能使用本地模式。"),Y=[{value:ze.WORKTREE,label:d("工作树模式"),description:j,disabled:!U},{value:ze.MAIN_DIRECTORY,label:d("本地模式"),description:I}];return t.jsx(jt,{isOpen:e,onClose:D?()=>{}:n,title:d("启动 Agent"),action:t.jsxs(t.Fragment,{children:[t.jsx(me,{variant:"outline",onClick:n,disabled:D,children:d("取消")}),t.jsx(me,{onClick:P,disabled:D||!K||!y.trim()||!!$,children:B[p]})]}),children:t.jsxs("div",{className:"space-y-5",children:[t.jsx("div",{children:t.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground/80 mb-2",children:d("Agent")}),t.jsx(Ue,{value:m,onChange:g,options:q,placeholder:d(T?"加载中...":"选择 Agent"),disabled:D||T}),$?t.jsx("p",{role:"alert",className:"mt-2 break-words text-xs leading-snug text-destructive-ink",children:d($)}):null,W&&!K?t.jsxs("div",{role:"alert",className:"mt-2 space-y-1 break-words text-xs leading-snug text-destructive-ink",children:[t.jsx("p",{children:d("No available Provider for this session.")}),t.jsx("ul",{className:"space-y-1",children:L.map(Z=>t.jsxs("li",{children:[Z.provider.name,": ",d(ot(Z))]},Z.provider.id))})]}):null,z?t.jsx("p",{role:"alert",className:"mt-2 text-xs text-destructive-ink",children:d("No available Provider for this session.")}):null]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground/80 mb-2",children:d("模式")}),U?t.jsx(Ue,{value:r,onChange:Z=>o(Z),options:Y,disabled:D}):t.jsx(Pn,{side:"bottom",className:"w-full",content:X,children:t.jsxs("div",{tabIndex:0,"aria-label":X,className:"rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",children:[t.jsx(Ue,{value:r,onChange:Z=>o(Z),options:Y,disabled:!0}),t.jsx("button",{type:"button",onClick:N,disabled:D||O.isPending,className:"mt-2 text-xs text-muted-foreground transition-colors hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",children:O.isPending?d("检测中..."):d("重新检测 Git 状态")})]})})]})]})}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground/80 mb-2",children:d("任务描述")}),t.jsx("textarea",{value:y,onChange:Z=>b(Z.target.value),rows:5,disabled:D,placeholder:d("描述你想让 Agent 完成的任务..."),className:"w-full px-3 py-2 border border-border rounded-lg text-sm text-foreground placeholder:text-muted-foreground/70 focus:outline-none focus:ring-1 focus:ring-ring/60 focus:border-ring resize-none disabled:opacity-50 disabled:bg-muted/50"})]}),C&&t.jsx("div",{className:"text-sm text-destructive-ink bg-destructive/10 border border-destructive/25 rounded-lg px-3 py-2",children:C})]})})}function ef(e){const n=e?.tokenUsage;if(!(!n||typeof n.totalTokens!="number"))return n}function Qh(e,n,i){const h=e?.providerId??i?.providerId??null,S=h?n?.find(a=>a.provider.id===h)?.provider:null,x=S?.name??h??e?.agentType??i?.agentType??null;if(!x)return null;const w=e?.agentType??S?.agentType??i?.agentType??null,s=h&&S?.name&&h!==S.name?`${S.name} (${h})`:x;return{label:x,title:s,agentType:w}}function tf({session:e,providers:n,usage:i,compact:h=!1,providerIdFallback:S,agentTypeFallback:x,tokenTooltipSide:w="top"}){const{t:s}=se(),a=Qh(e,n,{providerId:S,agentType:x});return!a&&!i?null:t.jsxs("div",{className:`flex shrink-0 items-center ${h?"gap-1":"gap-2"}`,children:[a&&t.jsxs("div",{className:`flex shrink-0 items-center rounded-lg text-muted-foreground ${h?"max-w-[130px] min-w-[82px] gap-1 px-1.5 py-1 text-xs":"max-w-[220px] min-w-[110px] gap-1.5 px-2 py-1.5 text-xs"}`,title:`${s("Provider")}: ${a.title}`,children:[t.jsx(qt,{agentType:a.agentType,className:h?"size-3":"size-3.5"}),t.jsx("span",{className:"min-w-0 truncate",children:_n(a.label,h?12:18)})]}),t.jsx(On,{usage:i,tooltipSide:w})]})}function Yi(e){return e.length>0?e.map(n=>`- ${n}`).join(`
65
+ `):"- 未获取到冲突文件列表"}function Vi(e){if(!e)return[];const n=[];return e.workspaceId&&n.push(`- Workspace: \`${e.workspaceId}\``),e.worktreePath&&n.push(`- Worktree: \`${e.worktreePath}\``),e.sourceWorkspaceId&&n.push(`- Source workspace: \`${e.sourceWorkspaceId}\``),e.targetWorkspaceId&&n.push(`- Target workspace: \`${e.targetWorkspaceId}\``),e.sourceWorktreePath&&n.push(`- Source worktree: \`${e.sourceWorktreePath}\``),e.targetWorktreePath&&n.push(`- Target worktree: \`${e.targetWorktreePath}\``),e.operation&&e.operation!=="idle"&&n.push(`- Git 状态: \`${e.operation}\``),e.mergeStrategy&&n.push(`- Merge strategy: \`${e.mergeStrategy}\``),e.mergeAborted&&n.push("- Merge state: conflict detected and already aborted by Agent Tower"),n}function Jh(e,n){if(!n?.mergeAborted)return["1. 打开上述冲突文件,解决所有冲突标记(`<<<<<<<`、`=======`、`>>>>>>>`)","2. 对每个已解决的文件执行 `git add <file>`","3. 执行 `git commit` 完成合并"];const i=n.mergeStrategy==="squash"?`git merge --squash --no-commit ${e}`:`git merge --no-ff ${e}`,h=n.mergeStrategy==="squash"?"`git commit`":"`git merge --continue` 或 `git commit`";return["1. 注意:Agent Tower 检测到 merge 冲突后已经执行 abort,当前不要假设存在冲突标记或 `MERGE_HEAD`","2. 切换到 Target worktree / Target branch 上下文,确认工作区干净",`3. 重新执行 \`${i}\` 复现冲突`,"4. 打开上述冲突文件,解决所有冲突标记(`<<<<<<<`、`=======`、`>>>>>>>`)","5. 对每个已解决的文件执行 `git add <file>`",`6. 执行 ${h} 完成合并`]}function eu(e){if(!e.mergeAborted)return"请确认当前 Git 状态,解决所有冲突标记,完成必要的 `git add` 与后续 merge 提交,然后说明处理结果。";const n=e.targetWorktreePath?`目标 worktree \`${e.targetWorktreePath}\``:`目标分支 \`${e.targetBranch}\``,i=e.mergeStrategy==="squash"?`git merge --squash --no-commit ${e.sourceBranch}`:`git merge --no-ff ${e.sourceBranch}`;return`Agent Tower 已在检测到冲突后 abort 了 merge;请在${n}中确认工作区干净,重新执行 \`${i}\` 复现冲突,解决后完成提交并汇报验证结果。`}function tu(e,n,i,h,S){const x=Yi(i),w=Vi(S);return h===yt.REBASE?["## Rebase 冲突解决","",`在将分支 \`${e}\` rebase 到 \`${n}\` 时发生了冲突。`,...w.length>0?["","### 上下文",...w]:[],"","### 冲突文件",x,"","### 解决步骤","1. 打开上述冲突文件,解决所有冲突标记(`<<<<<<<`、`=======`、`>>>>>>>`)","2. 对每个已解决的文件执行 `git add <file>`","3. 执行 `git rebase --continue` 继续 rebase 流程"].join(`
66
+ `):["## Merge 冲突解决","",`在将分支 \`${e}\` 合并到 \`${n}\` 时发生了冲突。`,...w.length>0?["","### 上下文",...w]:[],"","### 冲突文件",x,"","### 解决步骤",...Jh(e,S)].join(`
67
+ `)}function ru(e){const n=e.conflictOp===yt.REBASE?"Rebase":"Merge",i=Yi(e.conflictedFiles),h=[...Vi(e),`- Source branch: \`${e.sourceBranch}\``,`- Target branch: \`${e.targetBranch}\``,`- Conflict type: \`${e.conflictOp}\``];return[`## 请求处理 ${n} 冲突`,"",`用户点击了“AI 辅助解决”,请在对应 workspace 中处理当前 ${n} 冲突,并在 Team Room 汇报处理结果和验证情况。`,"","### 上下文",...h,"","### 冲突文件",i,"","### 用户意图",e.conflictOp===yt.REBASE?"请确认当前 Git 状态,解决所有冲突标记,完成必要的 `git add` 与后续 `git rebase --continue`,然后说明处理结果。":eu(e)].join(`
68
+ `)}function su(e){if(e.teamRunId)return{type:"team_room",message:ru(e)};const n=e.currentSessionId||e.selectedSessionId;return n?{type:"session",sessionId:n,message:tu(e.sourceBranch,e.targetBranch,e.conflictedFiles,e.conflictOp,e)}:{type:"none"}}function rf({open:e,onOpenChange:n,workspaceId:i,conflictOp:h,conflictedFiles:S,sourceBranch:x,targetBranch:w,operation:s,worktreePath:a,mergeAborted:u,mergeStrategy:f,sourceWorkspaceId:d,targetWorkspaceId:m,sourceWorktreePath:g,targetWorktreePath:y,sessions:b,currentSessionId:r,teamRunId:o}){const{t:l}=se(),[c,p]=A.useState(""),_=Jn(),C=bn(o??""),k=ao(),v=!!o,E=r||c,R=v?C.isPending:_.isPending,O=()=>{const F=su({workspaceId:i,worktreePath:a,operation:s,mergeAborted:u,mergeStrategy:f,sourceWorkspaceId:d,targetWorkspaceId:m,sourceWorktreePath:g,targetWorktreePath:y,sourceBranch:x,targetBranch:w,conflictedFiles:S,conflictOp:h,teamRunId:o,currentSessionId:r,selectedSessionId:c});if(F.type==="team_room"){C.mutate({content:F.message,kind:"chat"},{onSuccess:()=>{ye.success(l("已发送到 Team Room")),n(!1)}});return}F.type==="session"&&_.mutate({id:F.sessionId,message:F.message},{onSuccess:()=>n(!1)})},L=()=>{k.mutate({workspaceId:i},{onSuccess:()=>n(!1)})},T=h==="REBASE"?"Rebase":"Merge",H=!v&&!r&&b.length>0,M=v||!!E;return t.jsx(jt,{isOpen:e,onClose:()=>n(!1),title:l("解决 {opLabel} 冲突",{opLabel:T}),action:t.jsxs(t.Fragment,{children:[t.jsx(_e,{variant:"secondary",onClick:L,children:l("在 IDE 中打开")}),t.jsx(_e,{variant:"primary",onClick:O,disabled:!M,loading:R,children:l(R?"发送中...":"AI 辅助解决")})]}),children:t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("h4",{className:"text-[13px] font-medium text-foreground mb-1.5",children:l("冲突文件({count})",{count:S.length})}),t.jsx("div",{className:"max-h-40 overflow-y-auto rounded-lg border border-border/60 bg-foreground/[0.025]",children:S.map(F=>t.jsx("div",{className:"px-3 py-1.5 text-xs font-mono break-all text-foreground/85 border-b border-border/60 last:border-b-0",children:F},F))})]}),v&&t.jsx(Ge,{tone:"info",children:l("TeamRun 模式下会把处理冲突请求发送到 Team Room,由团队调度处理。")}),H&&t.jsx(Us,{label:l("选择 Session(AI 辅助解决)"),children:t.jsx(fo,{value:c,onValueChange:p,placeholder:l("选择一个 Session..."),options:b.map(F=>({value:F.id,label:`${F.agentType} — ${F.status}`}))})}),!v&&!E&&b.length===0&&t.jsx("p",{className:"text-sm text-muted-foreground",children:l("没有可用的 Session,请在 IDE 中手动解决冲突。")})]})})}function iu(e){return[...e?.uncommitted??[],...e?.committed??[]].reduce((i,h)=>({files:i.files+1,additions:i.additions+(h.additions??0),deletions:i.deletions+(h.deletions??0)}),{files:0,additions:0,deletions:0})}function Ls(e,n,i,h){const S=Wi(e);if(S){i(S);return}h(e instanceof Error?e.message:n)}function sf({projectId:e,workspaceId:n,branchName:i,targetBranch:h,commitMessage:S,changes:x,gitStatus:w,isGitStatusLoading:s,canRunGitOperations:a,onOpenChanges:u,onRefreshCommitMessage:f,onConflict:d,className:m}){const{t:g}=se(),y=Zs(),b=Qs(),r=Js(),[o,l]=A.useState(!1),[c,p]=A.useState(null),_=Hr(n,o),C=(_.data??[]).filter(Ii),k=A.useMemo(()=>iu(x),[x]),v=k.additions+k.deletions,E=k.files>0&&v>0,R=(w?.conflictedFiles.length??0)>0,O=!!(w&&w.operation!=="idle"),L=!!(w&&(w.hasUncommittedChanges||w.untrackedCount>0)),T=(w?.uncommittedCount??0)+(w?.untrackedCount??0),H=(w?.behind??0)>0,M=(w?.ahead??0)>0,F=s||!w&&a,U=!!(a&&n&&w&&H&&!R&&!O&&!L),N=!!(a&&n&&w&&M&&!H&&!R&&!O&&!L),D=!!(a&&n&&w&&!R&&!O&&!L);if(A.useEffect(()=>{o&&f?.()},[o,f]),!E)return null;const P=R?g("冲突"):w?.operation==="rebase"?g("变基中"):w?.operation==="merge"?g("合并中"):T>0?g("{count} 未提交",{count:T}):H?g("落后 {count}",{count:w?.behind??0}):g(M?"可合并":"已是最新"),B=g("{files} 个文件 · {lines} 行",{files:k.files,lines:v}),q=()=>{U&&(p(null),y.mutate(n,{onError:z=>{Ls(z,g("更新失败,请稍后重试"),j=>d(j),p)}}))},K=()=>{D&&(p(null),l(!0))},$=(z,j)=>{p(null),b.mutate({id:n,commitMessage:z,stopActiveServices:j},{onSuccess:()=>l(!1),onError:I=>{if(Fi(I)){p(g("后台服务仍在运行,请确认停止服务后再提交。"));return}Ls(I,g("提交失败,请稍后重试"),X=>{l(!1),d(X)},p)}})},W=()=>{b.isPending||(l(!1),p(null))};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:Q("space-y-1",m),children:[t.jsxs("div",{className:"flex items-center gap-1.5 rounded-lg bg-muted/25 px-2 py-1.5",children:[t.jsxs("button",{type:"button",onClick:u,className:"flex min-w-0 flex-1 items-center gap-1.5 rounded-md px-1.5 py-0.5 text-left transition-colors hover:bg-muted/55 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40","aria-label":g("查看变更详情"),children:[t.jsx("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-background/70 text-muted-foreground",children:t.jsx(Br,{size:13})}),t.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[t.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:B}),t.jsx(Fs,{additions:k.additions,deletions:k.deletions,className:"hidden sm:inline-flex"}),R&&t.jsx(Et,{size:13,className:"shrink-0 text-warning"}),t.jsxs("span",{className:"hidden min-w-0 basis-0 grow max-w-fit items-center gap-1 text-[11px] text-muted-foreground md:flex",children:[t.jsx("span",{className:"truncate font-mono",children:i}),t.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground/70",children:"→"}),t.jsx("span",{className:"truncate font-mono",children:h})]}),t.jsx(Ft,{className:"bg-background/75",children:P})]}),t.jsx(Ve,{size:15,className:"shrink-0 text-muted-foreground/70"})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[O&&t.jsx(_e,{variant:"secondary",size:"sm",className:"hidden sm:inline-flex",onClick:()=>r.mutate(n),loading:r.isPending,children:r.isPending?g("正在撤销..."):g("撤销操作")}),t.jsx("span",{title:g(H?"同步更新":"已是最新"),className:Q("inline-flex",(!U||F)&&"cursor-not-allowed"),children:t.jsxs(_e,{variant:"secondary",size:"sm",onClick:q,disabled:!U||F,loading:y.isPending,children:[!y.isPending&&t.jsx(ft,{}),y.isPending?g("正在同步..."):g("更新")]})}),t.jsx("span",{title:N?g("合并到 {target}",{target:h}):g("提交变更"),className:Q("inline-flex",(!D||F)&&"cursor-not-allowed"),children:t.jsxs(_e,{variant:"primary",size:"sm",onClick:K,disabled:!D||F,loading:b.isPending,children:[!b.isPending&&t.jsx(Dr,{}),b.isPending?g("正在提交..."):g("合并")]})})]})]}),c&&t.jsx(Ge,{tone:"danger",size:"sm",children:c})]}),t.jsx(Hi,{projectId:e,workspaceId:n,canMerge:N,isOpen:o,onClose:W,onBaseBranchSaved:u,branchName:i,targetBranch:h,commitMessage:S,isPending:b.isPending,activeServices:C,isCheckingServices:_.isLoading,serviceCheckFailed:_.isError,error:c,onConfirm:$})]})}const Ts=["creating-workspace","creating-session","starting-session"];function nf({state:e,setupProgress:n,sessionStarted:i=!1,onRetry:h,compact:S=!1}){const{t:x}=se(),[w,s]=A.useState(!1),a=e?.status==="failed",u=n?.status==="failed",f=a||u,d=e?Ts.indexOf(e.status):Ts.length,m=[x("Preparing workspace"),x("Creating session"),x("Starting agent")],g=(e?.setupScript??"").split(`
69
+ `).map(r=>r.trim()).filter(Boolean),y=e||i?m.map((r,o)=>({label:r,status:a?"pending":o<d?"completed":o===d?"active":"pending"})):[];(n||g.length>0)&&y.push({label:n?.status==="running"?x("Running setup ({current}/{total})",{current:n.currentIndex??0,total:n.totalCommands}):n?.status==="completed"?x("Setup complete"):n?.status==="failed"?x("Setup failed"):x("Run setup script"),status:n?.status==="running"?"active":n?.status??"pending",description:n?.currentCommand||g.join(`
70
+ `)});const b=!!n?.output?.trim();return!e&&!n?null:t.jsxs("div",{className:`${S?"my-2 mb-4":"my-3 mb-6"} mx-auto w-full max-w-2xl rounded-xl border ${f?"border-destructive/30 bg-destructive/[0.03]":"border-border/70 bg-background"} px-4 py-3 text-left shadow-raised`,role:f?"alert":"status","aria-live":f?"assertive":"polite",children:[f&&(e?.error||n?.error||a)?t.jsx("p",{className:"mb-2 break-words text-xs text-destructive-ink",children:e?.error||n?.error||x("Agent start failed")}):null,t.jsx("div",{className:"space-y-2",children:y.map(({label:r,status:o,description:l})=>{const c=o==="completed",p=o==="active";return t.jsxs("div",{className:`flex items-start gap-2 text-sm ${o==="failed"?"text-destructive-ink":c||p?"text-info-ink":"text-muted-foreground"}`,children:[c?t.jsx(xn,{className:"h-4 w-4 shrink-0"}):p?t.jsx(Hs,{className:"h-4 w-4 shrink-0 animate-spin motion-reduce:animate-none"}):o==="failed"?t.jsx(Is,{className:"h-4 w-4 shrink-0"}):t.jsx(yo,{className:"h-4 w-4 shrink-0"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("span",{children:r}),l&&t.jsx("code",{className:"mt-1 block whitespace-pre-wrap break-all rounded-md bg-muted/35 px-2.5 py-2 text-xs leading-relaxed text-muted-foreground",children:l})]})]},r)})}),(b||a)&&t.jsxs("div",{className:"mt-3 flex items-center justify-between gap-3 border-t border-border/50 pt-2",children:[b?t.jsxs("button",{type:"button",onClick:()=>s(r=>!r),className:"inline-flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground","aria-expanded":w,"aria-controls":"task-start-progress-details",children:[w?t.jsx($e,{className:"h-3.5 w-3.5"}):t.jsx(Ve,{className:"h-3.5 w-3.5"}),x(w?"Hide setup output":"View setup output")]}):t.jsx("span",{}),a&&h?t.jsx(me,{size:"sm",variant:"outline",onClick:h,children:x("Retry start")}):null]}),w&&t.jsx("div",{id:"task-start-progress-details",className:"mt-2 rounded-md bg-muted/35 px-2.5 py-2 text-xs leading-relaxed text-muted-foreground",children:t.jsx("pre",{className:"whitespace-pre-wrap break-words font-mono",children:n?.output??""})})]})}function nu({agentType:e,workingDir:n}){return Te({queryKey:ge.system.skillCatalog(e,n),queryFn:async()=>(await de.get("/system/skill-catalog",{params:{agentType:String(e),...n?{workingDir:n}:{}}})).commands,enabled:e===Ws.CODEX,staleTime:3e4})}function ou(e){const n=e.key==="Enter"&&!e.shiftKey&&!e.repeat&&!e.nativeEvent.isComposing&&e.nativeEvent.keyCode!==229,i=e.key==="Tab"&&!e.shiftKey;return n||i}function of({agentType:e,workingDir:n,input:i,setInput:h,textareaRef:S,minHeight:x,maxHeight:w}){const[s,a]=A.useState(0),{data:u=[]}=nu({agentType:e,workingDir:n}),d=A.useMemo(()=>e===Ws.CODEX?Xr(i):null,[e,i])?.query??null,m=A.useMemo(()=>d===null?[]:eo(u,d),[d,u]),g=A.useCallback(()=>{const r=S.current;r&&(r.style.height="auto",r.style.height=`${Math.max(x,Math.min(r.scrollHeight,w))}px`)},[w,x,S]);A.useEffect(()=>{a(0)},[e,d]),A.useEffect(()=>{s<m.length||a(0)},[m.length,s]);const y=A.useCallback(r=>{const o=Xr(i);if(!o)return;const l=`${i.slice(0,o.replaceStart)}${r.command} `;h(l),requestAnimationFrame(()=>{const c=S.current;c&&(g(),c.focus(),c.setSelectionRange(l.length,l.length))})},[i,g,h,S]),b=A.useCallback(r=>d===null||m.length===0?!1:r.key==="ArrowDown"?(r.preventDefault(),a(o=>(o+1)%m.length),!0):r.key==="ArrowUp"?(r.preventDefault(),a(o=>(o-1+m.length)%m.length),!0):ou(r)?(r.preventDefault(),y(m[s]??m[0]),!0):!1,[y,m,d,s]);return{allSkills:u,query:d,filteredSkills:m,selectedIndex:s,setSelectedIndex:a,applySkill:y,handleKeyDown:b}}const gr=200,au=180;function af({taskId:e,title:n,readOnly:i=!1,onTitleChange:h,className:S,titleClassName:x,compact:w=!1}){const{t:s}=se(),[a,u]=A.useState(!1),[f,d]=A.useState(n),[m,g]=A.useState(!1),y=A.useRef(null),b=A.useRef(null),r=Sn();A.useEffect(()=>{a||d(n)},[n,a]),A.useEffect(()=>{a&&y.current&&(y.current.focus(),y.current.select())},[a]),A.useEffect(()=>{if(!a)return;const E=R=>{b.current&&!b.current.contains(R.target)&&c()};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[a,f]);const o=A.useCallback(()=>{i||(u(!0),d(n))},[i,n]),l=A.useCallback(()=>{u(!1),d(n)},[n]),c=A.useCallback(async()=>{const E=f.trim();if(!E){d(n),u(!1);return}if(E===n){u(!1);return}try{await r.mutateAsync({id:e,title:E}),h?.(E),u(!1)}catch(R){console.error("Failed to update task title:",R),d(n)}},[f,n,e,r,h]),p=A.useCallback(E=>{E.key==="Enter"&&!E.shiftKey?(E.preventDefault(),c()):E.key==="Escape"&&(E.preventDefault(),l())},[c,l]),_=A.useCallback(E=>{const R=E.target.value;R.length<=gr&&d(R)},[]),C=f.length,k=C>=au,v=C>=gr;return a?t.jsxs("div",{ref:b,className:Q("flex flex-col gap-2",S),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{ref:y,type:"text",value:f,onChange:_,onKeyDown:p,disabled:r.isPending,className:Q("flex-1 min-w-0 px-2 py-1 text-[15px] font-semibold bg-background border border-input rounded-md","focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent","disabled:opacity-50 disabled:cursor-not-allowed",w&&"text-base py-0.5",x),placeholder:s("输入任务标题")}),t.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[t.jsx(me,{size:w?"sm":"default",variant:"ghost",onClick:c,disabled:r.isPending||!f.trim(),className:"h-8 w-8 p-0",children:r.isPending?t.jsx(Hs,{size:16,className:"animate-spin motion-reduce:[animation-duration:2.4s]"}):t.jsx(wt,{size:16})}),t.jsx(me,{size:w?"sm":"default",variant:"ghost",onClick:l,disabled:r.isPending,className:"h-8 w-8 p-0",children:t.jsx(Qe,{size:16})})]})]}),k&&t.jsxs("div",{className:Q("text-xs",v?"text-destructive-ink":"text-muted-foreground"),children:[C," / ",gr," ",s("字符")]})]}):t.jsxs("div",{ref:b,className:Q("group flex items-center gap-2 min-w-0",S),onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),children:[t.jsx("h2",{onClick:o,className:Q("flex-1 min-w-0 text-[15px] font-semibold text-foreground break-words line-clamp-2",!i&&"cursor-text hover:text-foreground/80 transition-colors",w&&"text-base",x),children:n}),!i&&m&&t.jsx(me,{size:"sm",variant:"ghost",onClick:o,className:"h-7 w-7 p-0 shrink-0 opacity-60 hover:opacity-100",title:s("编辑标题"),children:t.jsx(po,{size:14})})]})}export{zi as D,af as E,Br as G,qu as R,tf as S,nf as T,sf as W,of as a,hh as b,Yu as c,Ct as d,Vu as e,ef as f,Ku as g,Uu as h,Zu as i,Gu as j,Ju as k,rf as l,uh as m,ti as n,Bi as o,Oi as p,Kh as q,Xu as r,_h as s,gi as t,Qu as u};