decocms 4.365.0 → 4.365.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (488) hide show
  1. package/dist/client/assets/{AlertCircle-bl0yU7gy.js → AlertCircle-BPZWT1gc.js} +1 -1
  2. package/dist/client/assets/{AreaChart-CHPDNuDf.js → AreaChart-CxCPUfZu.js} +3 -3
  3. package/dist/client/assets/{ArrowLeft-CpbUCYpB.js → ArrowLeft-c3HIgil5.js} +1 -1
  4. package/dist/client/assets/{ArrowRight-CkVUmxaa.js → ArrowRight-BHzAyFwu.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-BQQdFypM.js → ArrowUp-DywwLYcR.js} +1 -1
  6. package/dist/client/assets/{Check-BJaMheL7.js → Check-PyGET9iL.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-BNNyBNMK.js → CheckCircle-4Be5K85Z.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-2Ti1evDh.js → ChevronRight-vY_5m8VB.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-Cp-tcsrs.js → ChevronUp-B9QGJbr0.js} +1 -1
  10. package/dist/client/assets/{Copy01-BrL9ZrVF.js → Copy01-BbtQlTnV.js} +1 -1
  11. package/dist/client/assets/{CreditCard01-_mwanoIZ.js → CreditCard01-2jrzrshR.js} +1 -1
  12. package/dist/client/assets/{Database01-Dm_V08L3.js → Database01-B8rfUUUF.js} +1 -1
  13. package/dist/client/assets/{DotsVertical-B8slOnrw.js → DotsVertical-zFAA_as9.js} +1 -1
  14. package/dist/client/assets/{Download01-Bl2-HJHJ.js → Download01-CSiLQIib.js} +1 -1
  15. package/dist/client/assets/{ErrorBarContext-nVgseQIz.js → ErrorBarContext-D7xML5iT.js} +1 -1
  16. package/dist/client/assets/{Eye-B_BMkWWc.js → Eye-BRXlESxS.js} +1 -1
  17. package/dist/client/assets/{File02-3fotvfyl.js → File02-D4JZqTxD.js} +1 -1
  18. package/dist/client/assets/{GitBranch01-Dr0NRbj6.js → GitBranch01-95kZh6WB.js} +1 -1
  19. package/dist/client/assets/{Globe01-DMnQmvOn.js → Globe01-Dej65_H6.js} +1 -1
  20. package/dist/client/assets/{HardDrive-CxNWrsuq.js → HardDrive-DCLQ4vdy.js} +1 -1
  21. package/dist/client/assets/{Image01-DMAKgzzX.js → Image01-Dd-Rx_B5.js} +1 -1
  22. package/dist/client/assets/{Key01-CVfJV98q.js → Key01-CQFO2R8H.js} +1 -1
  23. package/dist/client/assets/{Link01-CKw3sRrv.js → Link01-pGxgI9VT.js} +1 -1
  24. package/dist/client/assets/{LinkExternal01-OjBTsG9L.js → LinkExternal01-Jetqi62I.js} +1 -1
  25. package/dist/client/assets/MessageCircle01-D2dDPrBD.js +1 -0
  26. package/dist/client/assets/{Monitor01-Bc6Zvq9B.js → Monitor01-Bw-h-DKp.js} +1 -1
  27. package/dist/client/assets/{Package-DTeqx5ul.js → Package-CF-S4NRB.js} +1 -1
  28. package/dist/client/assets/{Palette-CiXH5EXK.js → Palette-DuCZiZH-.js} +1 -1
  29. package/dist/client/assets/{Play-BPdpqeiE.js → Play-BTJRmkRf.js} +1 -1
  30. package/dist/client/assets/{Plus-kQ9d0PiA.js → Plus-BUGmioCX.js} +1 -1
  31. package/dist/client/assets/Printer-B2Ij2s1c.js +1 -0
  32. package/dist/client/assets/{SearchLg-Cecpe6x9.js → SearchLg-De3yWxzK.js} +1 -1
  33. package/dist/client/assets/{SearchMd-hBr_biLL.js → SearchMd-DanltqT5.js} +1 -1
  34. package/dist/client/assets/{Sector-B0yBxg4a.js → Sector-DqvqR1iU.js} +2 -2
  35. package/dist/client/assets/{Settings02-BqKUeA5H.js → Settings02-C-HNbNsn.js} +1 -1
  36. package/dist/client/assets/{Share07-D8xQrAsX.js → Share07-C4Gw_nzw.js} +1 -1
  37. package/dist/client/assets/{Shield01-Dav77ssu.js → Shield01-7bhnSYVs.js} +1 -1
  38. package/dist/client/assets/{Stars01-DWjpdjKn.js → Stars01-BmtGexbk.js} +1 -1
  39. package/dist/client/assets/{Sun-wxsl7cI_.js → Sun-D5AClOdh.js} +1 -1
  40. package/dist/client/assets/{SwitchHorizontal01-CCraiYIJ.js → SwitchHorizontal01-CCmSX-Ww.js} +1 -1
  41. package/dist/client/assets/{Tool01-E6Rv0Nbs.js → Tool01-C1VYYGhf.js} +1 -1
  42. package/dist/client/assets/{Tool02-Darwb8nP.js → Tool02-A5gv-OOO.js} +1 -1
  43. package/dist/client/assets/{Trash01-BB2ymX9J.js → Trash01-DkwdEhkp.js} +1 -1
  44. package/dist/client/assets/{TrendUp01-PJuAXI74.js → TrendUp01-CQWL_vX5.js} +1 -1
  45. package/dist/client/assets/{Upload01-BtBtAyal.js → Upload01-BlEOH700.js} +1 -1
  46. package/dist/client/assets/{User01-CtDIPHIF.js → User01-C2ILPAHc.js} +1 -1
  47. package/dist/client/assets/{UserSquare-BflxhZ_l.js → UserSquare-DY1wI6ZR.js} +1 -1
  48. package/dist/client/assets/{Users01-9HTYv5bx.js → Users01-bydaoxbh.js} +1 -1
  49. package/dist/client/assets/{Users03-D8RoJqiC.js → Users03-3yW32m45.js} +1 -1
  50. package/dist/client/assets/X-DejWyAyX.js +1 -0
  51. package/dist/client/assets/{XCircle-Dvf0BUKb.js → XCircle-SVZraRfE.js} +1 -1
  52. package/dist/client/assets/{XClose-DPfGLo7I.js → XClose-wkdnmhrB.js} +1 -1
  53. package/dist/client/assets/{Zap-ChgjHdxL.js → Zap-0km1-ru7.js} +1 -1
  54. package/dist/client/assets/{ZoomOut-BAhVAzy1.js → ZoomOut-BA2ZiotX.js} +1 -1
  55. package/dist/client/assets/access-gate-DpZqBld0.js +1 -0
  56. package/dist/client/assets/add-connection-dialog-DB5JJjad.js +1 -0
  57. package/dist/client/assets/agent-analytics-CAHUVirD.js +2 -0
  58. package/dist/client/assets/agent-app-BeMC8z8k.js +1 -0
  59. package/dist/client/assets/agent-assets-DsMv2xEg.js +1 -0
  60. package/dist/client/assets/agent-automation-BY5j9rqa.js +20 -0
  61. package/dist/client/assets/agent-automations-1_XWI0cB.js +1 -0
  62. package/dist/client/assets/agent-connect-sources-CGYs_l_4.js +1 -0
  63. package/dist/client/assets/agent-deck-BqKNWwGC.js +1 -0
  64. package/dist/client/assets/agent-e2e-DSg6pAM6.js +1 -0
  65. package/dist/client/assets/agent-file-QzuIvb2U.js +1 -0
  66. package/dist/client/assets/agent-git-B5SGdxwk.js +3 -0
  67. package/dist/client/assets/agent-hosting-CWM0TAgK.js +1 -0
  68. package/dist/client/assets/agent-icon-BjknPEfN.js +1 -0
  69. package/dist/client/assets/agent-library-file-DOj4Pso1.js +1 -0
  70. package/dist/client/assets/agent-monitor-D0SLtbEO.js +1 -0
  71. package/dist/client/assets/agent-overview-4MzJb6Tv.js +1 -0
  72. package/dist/client/assets/agent-settings-D4SL-PIa.js +1 -0
  73. package/dist/client/assets/agent-site-editor-BDP-vSUl.js +24 -0
  74. package/dist/client/assets/agent-site-editor-code-C2z-Az-Y.js +2 -0
  75. package/dist/client/assets/agent-site-editor-content-JPYekiK_.js +2 -0
  76. package/dist/client/assets/agent-site-editor-preview-CFLjaarK.js +504 -0
  77. package/dist/client/assets/agent-view-Bp9ooHxf.js +1 -0
  78. package/dist/client/assets/agent-view-guard-B7qYW-b3.js +1 -0
  79. package/dist/client/assets/agents-list-h96XaSKk.js +1 -0
  80. package/dist/client/assets/ai-providers-COWdzwzu.js +1 -0
  81. package/dist/client/assets/{alert-DkgzGFz6.js → alert-CvK2RkF3.js} +1 -1
  82. package/dist/client/assets/{alert-dialog-BdwUra4d.js → alert-dialog-CDARhUOh.js} +2 -2
  83. package/dist/client/assets/{api-keys-Bl99t7Nm.js → api-keys-Ba-S9F5Y.js} +1 -1
  84. package/dist/client/assets/api-keys-DeCwNgs3.js +1 -0
  85. package/dist/client/assets/app-editor-CsOLGnt4.js +1 -0
  86. package/dist/client/assets/asset-utils-DQpbxjwd.js +1 -0
  87. package/dist/client/assets/{auth-vfqjjrgv.js → auth-Cyjh0UQp.js} +1 -1
  88. package/dist/client/assets/{auth-catchall-CZ_cFv3z.js → auth-catchall-BbOJ2FpE.js} +1 -1
  89. package/dist/client/assets/{auth-entry-Cp4v6AT2.js → auth-entry-CIc1-YG9.js} +1 -1
  90. package/dist/client/assets/{auth-split-layout-BB-yAg-2.js → auth-split-layout-WGnYlU-M.js} +1 -1
  91. package/dist/client/assets/{authenticate-and-persist-oauth-CpB-R1LO.js → authenticate-and-persist-oauth-Dgc5b4Jr.js} +1 -1
  92. package/dist/client/assets/{automation-list-row-DKusfCau.js → automation-list-row-Dyqat6cE.js} +1 -1
  93. package/dist/client/assets/automation-runs-DkHp_jZr.js +1 -0
  94. package/dist/client/assets/automations-BSGRkynt.js +1 -0
  95. package/dist/client/assets/{autosend-u-W4xgi7.js → autosend-BBoss6Ia.js} +1 -1
  96. package/dist/client/assets/{avatar-BpU54ct-.js → avatar-CO3n6wLC.js} +1 -1
  97. package/dist/client/assets/backoff-8mStPHYB.js +1 -0
  98. package/dist/client/assets/{badge-DJ5ezE5-.js → badge-DUpgRwQu.js} +1 -1
  99. package/dist/client/assets/{block-document-7Ngv587f.js → block-document-CVyeCLBq.js} +3 -3
  100. package/dist/client/assets/blocks-preview-workspace-context-CLQbGv9t.js +1 -0
  101. package/dist/client/assets/{breadcrumb-Dlcs3jWo.js → breadcrumb-FJ1G6kmP.js} +1 -1
  102. package/dist/client/assets/buckets-BTZUX3pR.js +1 -0
  103. package/dist/client/assets/build-improve-prompt-doc-CcAYvBOj.js +2 -0
  104. package/dist/client/assets/bulk-category-panel-9cEfFq4L.js +1 -0
  105. package/dist/client/assets/{calendar-B8BrEMls.js → calendar-Bb8OUNd8.js} +1 -1
  106. package/dist/client/assets/{capability-load-error-CdMFNpdR.js → capability-load-error-Ctg9pY-k.js} +1 -1
  107. package/dist/client/assets/{cards-BfP1wflC.js → cards-CbRL3hJc.js} +1 -1
  108. package/dist/client/assets/category-editor-DLB1OCyq.js +1 -0
  109. package/dist/client/assets/{chart-zbtN9_7R.js → chart-DqNrc8dZ.js} +1 -1
  110. package/dist/client/assets/{chat-context-CD1rWX64.js → chat-context-B40ngn3f.js} +9 -9
  111. package/dist/client/assets/{checkbox-DwVdLA7e.js → checkbox-STVvKX8k.js} +1 -1
  112. package/dist/client/assets/choose-editor-DVdbAy2O.js +1 -0
  113. package/dist/client/assets/claim-phase-copy-0btUuJoC.js +1 -0
  114. package/dist/client/assets/{cli-auth-success-BtBj1xJE.js → cli-auth-success-DmTxFaq5.js} +1 -1
  115. package/dist/client/assets/{client-icons-BcSFyY79.js → client-icons-CR99ZCoE.js} +1 -1
  116. package/dist/client/assets/collapsible-Cf4ZreOo.js +1 -0
  117. package/dist/client/assets/collection-detail-oWaNi-hD.js +1 -0
  118. package/dist/client/assets/collection-display-button-CkKXuKd-.js +1 -0
  119. package/dist/client/assets/{collection-search-Bi-DttH4.js → collection-search-CDaDEv2c.js} +1 -1
  120. package/dist/client/assets/{collection-table-wrapper-DfAhVjGn.js → collection-table-wrapper-B036tBOl.js} +1 -1
  121. package/dist/client/assets/{collection-tabs-BZkkvpP_.js → collection-tabs-CkeFxbT3.js} +1 -1
  122. package/dist/client/assets/{command-cJVGaRa3.js → command-D7YFT70c.js} +1 -1
  123. package/dist/client/assets/{command-palette-store-BNo0UXiS.js → command-palette-store-BcwFt5eE.js} +1 -1
  124. package/dist/client/assets/commerce-onboarding-BcoYZTQG.js +1 -0
  125. package/dist/client/assets/{companion-mcps-section-smAU7jYC.js → companion-mcps-section-CS9qQ8v0.js} +1 -1
  126. package/dist/client/assets/{connect-Bn7h46Ea.js → connect-BM6ZfhOz.js} +2 -2
  127. package/dist/client/assets/connect-layout-De5w9TxQ.js +1 -0
  128. package/dist/client/assets/{connection-card-DCMUv-0w.js → connection-card-kANJRcvf.js} +1 -1
  129. package/dist/client/assets/connection-detail-Ckkh02Py.js +1 -0
  130. package/dist/client/assets/{connection-D6f54N4w.js → connection-di4Fldx3.js} +1 -1
  131. package/dist/client/assets/{connection-form-helpers-BiJdmlDA.js → connection-form-helpers-fWne-kOd.js} +1 -1
  132. package/dist/client/assets/connections-BKm7IMTt.js +1 -0
  133. package/dist/client/assets/{create-organization-dialog-IR2z5bIs.js → create-organization-dialog-BmgLNeEx.js} +1 -1
  134. package/dist/client/assets/decofile-api-BhjpITFN.js +1 -0
  135. package/dist/client/assets/{decopilot-CK3rN_ad.js → decopilot-ClO0uusm.js} +2 -2
  136. package/dist/client/assets/dialog-Dxe0Jgna.js +1 -0
  137. package/dist/client/assets/discover-BdugM7FR.js +1 -0
  138. package/dist/client/assets/domain-settings-Dp-mWih8.js +1 -0
  139. package/dist/client/assets/{download-app-dialog-CNd8ka-x.js → download-app-dialog-lwMMuYsF.js} +1 -1
  140. package/dist/client/assets/{drawer-DsG6Si3V.js → drawer-1GzYkddr.js} +1 -1
  141. package/dist/client/assets/{dropdown-menu-4cRHTbic.js → dropdown-menu-Bws_0K_q.js} +1 -1
  142. package/dist/client/assets/{editor-NTP5Xcj9.js → editor-U5ucetu-.js} +1 -1
  143. package/dist/client/assets/{empty-state-DmTochCH.js → empty-state-BjMIbq91.js} +1 -1
  144. package/dist/client/assets/{empty-state-D86Jkx4H.js → empty-state-C3Z_6q55.js} +1 -1
  145. package/dist/client/assets/{extract-connection-data-B3hIAjiC.js → extract-connection-data-BAjOM4U5.js} +1 -1
  146. package/dist/client/assets/file-explorer-LFC3Ac60.js +2 -0
  147. package/dist/client/assets/{file-preview-BbFH5cdB.js → file-preview-n35lcg8c.js} +1 -1
  148. package/dist/client/assets/{file-share-button-ChoXQdlr.js → file-share-button-D04rfik7.js} +2 -2
  149. package/dist/client/assets/{file-type-icon-DJQFeBpV.js → file-type-icon-C4dI9q_n.js} +1 -1
  150. package/dist/client/assets/{folder-icon-BRLOuEpt.js → folder-icon-pWHmymOf.js} +1 -1
  151. package/dist/client/assets/{form-DhUF_Mtg.js → form-CRSWplOb.js} +1 -1
  152. package/dist/client/assets/{gateway-client-Cb37izH_.js → gateway-client-D45uHvIc.js} +1 -1
  153. package/dist/client/assets/general-C7RGB0Oj.js +1 -0
  154. package/dist/client/assets/{github-icon-cJDFDEm7.js → github-icon-CsH29e4W.js} +1 -1
  155. package/dist/client/assets/{github-repo-C0igpkr9.js → github-repo-BknN0SVI.js} +1 -1
  156. package/dist/client/assets/home-CpLcM3nB.js +1 -0
  157. package/dist/client/assets/hooks-CE7d6Dy1.js +15 -0
  158. package/dist/client/assets/{hooks-BrcP19Uo.js → hooks-CxBYuMc8.js} +2 -2
  159. package/dist/client/assets/{index-epfDD3H5.js → index-4fsCOuPz.js} +2 -2
  160. package/dist/client/assets/index-B53DWiGz.js +1 -0
  161. package/dist/client/assets/{index-BQzHGsvt.js → index-BJDZS0O4.js} +11 -11
  162. package/dist/client/assets/index-BQwroePl.js +1 -0
  163. package/dist/client/assets/{index-Df6f9kP3.js → index-BRigOSQu.js} +1 -1
  164. package/dist/client/assets/{index-CoYeuRng.js → index-CBcq1VSB.js} +1 -1
  165. package/dist/client/assets/index-CFUteTrc.js +1 -0
  166. package/dist/client/assets/{index-gctAQu2T.js → index-CVJEcf37.js} +74 -74
  167. package/dist/client/assets/{index-DQ6uuKpF.js → index-CblYf_yB.js} +8 -8
  168. package/dist/client/assets/{index-BywxOh2e.js → index-CcEd_wWL.js} +1 -1
  169. package/dist/client/assets/index-Clbrhj--.js +1 -0
  170. package/dist/client/assets/{index-CImKKZ20.js → index-CxOPSFx9.js} +1 -1
  171. package/dist/client/assets/index-CyYEAXEU.js +1 -0
  172. package/dist/client/assets/{index-eVyHwFa9.js → index-DAN6A7hZ.js} +1 -1
  173. package/dist/client/assets/{index-DJADaZ4J.css → index-DUflXgSu.css} +1 -1
  174. package/dist/client/assets/index-Dio39w6e.js +26 -0
  175. package/dist/client/assets/index-DsI9yqDT.js +1 -0
  176. package/dist/client/assets/{index-redirect-DxBD4sTo.js → index-redirect-Bw20Ba6Y.js} +1 -1
  177. package/dist/client/assets/{infiniteQueryObserver-Da0v0sXC.js → infiniteQueryObserver-BSmIgXE3.js} +1 -1
  178. package/dist/client/assets/infra-billing-DFEuQtvU.js +1 -0
  179. package/dist/client/assets/{input-eBmoU-9D.js → input-C8MQoDCb.js} +1 -1
  180. package/dist/client/assets/{input-DlvEXkej.js → input-CQyA0V5b.js} +1 -1
  181. package/dist/client/assets/{input-C9QH7mMV.js → input-DD_DI_Km.js} +2 -2
  182. package/dist/client/assets/{integration-icon-YYg8l_RW.js → integration-icon-BV7Q9XOu.js} +1 -1
  183. package/dist/client/assets/{label-DGkzLfNU.js → label-Cfl8uGDP.js} +1 -1
  184. package/dist/client/assets/last-preview-page-B_KVLuYW.js +1 -0
  185. package/dist/client/assets/layout-Dm4T-Vne.js +1 -0
  186. package/dist/client/assets/legacy-agents-deep-Dd57JUEI.js +1 -0
  187. package/dist/client/assets/legacy-main-redirect-CWvMqmhB.js +1 -0
  188. package/dist/client/assets/{library-CKrgioQu.js → library-3DHQWojm.js} +4 -4
  189. package/dist/client/assets/login-CupMnybl.js +1 -0
  190. package/dist/client/assets/{markdown-BV0XgGTq.js → markdown-BvSl7QX1.js} +3 -3
  191. package/dist/client/assets/{mcp-app-renderer-Bv46PiO3.js → mcp-app-renderer-DJ7Ve9Yy.js} +2 -2
  192. package/dist/client/assets/{mcp-oauth-i7PCjbNf.js → mcp-oauth-OvlzbMCP.js} +1 -1
  193. package/dist/client/assets/members-Cuiahh5G.js +1 -0
  194. package/dist/client/assets/message-templates-wocfrCJF.js +1 -0
  195. package/dist/client/assets/{mini-report-page-k88VT2C2.js → mini-report-page-4Bd0cMlr.js} +1 -1
  196. package/dist/client/assets/{monaco-editor-kRD7y0Pc.js → monaco-editor-B2KCfh7a.js} +1 -1
  197. package/dist/client/assets/{monitoring-stats-row-CuCuR7PQ.js → monitoring-stats-row-CufhVlNy.js} +1 -1
  198. package/dist/client/assets/{multi-select-CltjjMwX.js → multi-select-BHFunwbq.js} +1 -1
  199. package/dist/client/assets/{mustache-Db7x-4gI.js → mustache-DyjElMuJ.js} +1 -1
  200. package/dist/client/assets/{oauth-callback-CT29B8-5.js → oauth-callback-4BOm__rV.js} +1 -1
  201. package/dist/client/assets/{oauth-callback-ai-provider-3CPoYshC.js → oauth-callback-ai-provider-Czk5gVgf.js} +1 -1
  202. package/dist/client/assets/{onboarding-DEm51GnF.js → onboarding-D2PsWH4h.js} +1 -1
  203. package/dist/client/assets/{optimistic-project-sidebar-views-Drtbh9Ui.js → optimistic-project-sidebar-views-B3vU1qR8.js} +1 -1
  204. package/dist/client/assets/{organization-choice-BdqJqB_v.js → organization-choice-C-PRPVPc.js} +1 -1
  205. package/dist/client/assets/orgs-DpmY6dw4.js +1 -0
  206. package/dist/client/assets/{page-seo-form-BXvLQ5tk.js → page-seo-form-gUB5sB3u.js} +1 -1
  207. package/dist/client/assets/{pair-BIPkH5eA.js → pair-98UY-0wm.js} +8 -8
  208. package/dist/client/assets/{popover-BfKN_4aI.js → popover-DAJR0ej2.js} +1 -1
  209. package/dist/client/assets/post-calendar-4XiTJrif.js +1 -0
  210. package/dist/client/assets/post-editor-CXRn_RK8.js +1 -0
  211. package/dist/client/assets/preview-content-Tw_jYCgT.js +1 -0
  212. package/dist/client/assets/{preview-dialog-CYbL8r4H.js → preview-dialog-Bg_Wo7YI.js} +1 -1
  213. package/dist/client/assets/{primitives-BXcg67BS.js → primitives-BfIYsPoI.js} +1 -1
  214. package/dist/client/assets/profile-CDs1X-Le.js +1 -0
  215. package/dist/client/assets/project-app-view-BPLB01Cj.js +1 -0
  216. package/dist/client/assets/project-feed-CeGbFvMT.js +1 -0
  217. package/dist/client/assets/{project-icon-Dk1HaDIZ.js → project-icon-D1x6NEST.js} +1 -1
  218. package/dist/client/assets/project-reports-fH8-r6df.js +1 -0
  219. package/dist/client/assets/project-tasks-tas6EPem.js +1 -0
  220. package/dist/client/assets/prompts-B-VqD1p-.js +1 -0
  221. package/dist/client/assets/record-editor-LOQZDk0V.js +1 -0
  222. package/dist/client/assets/redirect-editor-CgXt_KHn.js +1 -0
  223. package/dist/client/assets/registry-YMo7WLlx.js +2 -0
  224. package/dist/client/assets/{registry-layout-CRM-FBei.js → registry-layout-SseogjtO.js} +3 -3
  225. package/dist/client/assets/reports-DC8tSFj3.js +1 -0
  226. package/dist/client/assets/{reports-B1FmmHPo.js → reports-Q6oueood.js} +2 -2
  227. package/dist/client/assets/reports-tab-DE-TYPly.js +2 -0
  228. package/dist/client/assets/repositories-BoiOgwFm.js +1 -0
  229. package/dist/client/assets/repository-import-picker-DyEfEliR.js +1 -0
  230. package/dist/client/assets/repository-picker-DWJtJkZW.js +1 -0
  231. package/dist/client/assets/require-capability-DljrHpsM.js +1 -0
  232. package/dist/client/assets/{required-auth-layout-CraNNSBi.js → required-auth-layout-TTElzhIM.js} +1 -1
  233. package/dist/client/assets/{reset-password-DcO8_P05.js → reset-password-B1ylDKoe.js} +1 -1
  234. package/dist/client/assets/resizable-DOW_fL7z.js +1 -0
  235. package/dist/client/assets/retry-i8LvYSZg.js +1 -0
  236. package/dist/client/assets/{review-settings-CANg_Nan.js → review-settings-DHvMG4G0.js} +1 -1
  237. package/dist/client/assets/{rich-text-link-control-CCig2s9-.js → rich-text-link-control-HLhFAha7.js} +1 -1
  238. package/dist/client/assets/roles-BWbTlJZc.js +1 -0
  239. package/dist/client/assets/route-D26IsMv1.js +1 -0
  240. package/dist/client/assets/route-D_kbg4iH.js +1 -0
  241. package/dist/client/assets/route-jdsFbZW7.js +1 -0
  242. package/dist/client/assets/runnable-block-editor-Bi0Cv7yD.js +16 -0
  243. package/dist/client/assets/sandbox-git-api-CMdpE2TE.js +1 -0
  244. package/dist/client/assets/{sandbox-lifecycle-context-Beua1bNX.js → sandbox-lifecycle-context-BbTDNpeS.js} +2 -2
  245. package/dist/client/assets/save-changes-debug-nBi-n9eV.js +1 -0
  246. package/dist/client/assets/{schema-BzgrQmAY.js → schema-BegvnGCM.js} +1 -1
  247. package/dist/client/assets/{scroll-area-tBZq-ZvJ.js → scroll-area-CxxMejtk.js} +1 -1
  248. package/dist/client/assets/{search-input-CYERWjWv.js → search-input-axkgbTZ7.js} +1 -1
  249. package/dist/client/assets/secrets-kzqIbFmd.js +1 -0
  250. package/dist/client/assets/section-preview-url-Csj0_ZDg.js +1 -0
  251. package/dist/client/assets/sections-editor-B_t9OrnC.js +2 -0
  252. package/dist/client/assets/select-B2GRzoG3.js +1 -0
  253. package/dist/client/assets/select-model-BRHN792B.js +1 -0
  254. package/dist/client/assets/seo-editor-DvngP1ti.js +1 -0
  255. package/dist/client/assets/settings-tab-DFjZ-Fkn.js +5 -0
  256. package/dist/client/assets/sheet-BePDARR0.js +1 -0
  257. package/dist/client/assets/shell-layout-D2wS-FNX.js +1 -0
  258. package/dist/client/assets/sidebar-IspuJbto.js +1 -0
  259. package/dist/client/assets/skill-preview-BdtuUFgV.js +1 -0
  260. package/dist/client/assets/skills-QJ3mhNvI.js +1 -0
  261. package/dist/client/assets/sso-DKhL-ARh.js +1 -0
  262. package/dist/client/assets/{store-CjL9y_7d.js → store-B9Az6md3.js} +1 -1
  263. package/dist/client/assets/store-registry-hcgHbNGW.js +2 -0
  264. package/dist/client/assets/switch-DJ4Dr2_V.js +1 -0
  265. package/dist/client/assets/synced-repos-flbNGs20.js +1 -0
  266. package/dist/client/assets/{table-aIDGrvqv.js → table-CrJ9LOSc.js} +1 -1
  267. package/dist/client/assets/{tabs-Sr-wlkg3.js → tabs-DVMaAAMA.js} +1 -1
  268. package/dist/client/assets/{task-board-CazuPR-U.js → task-board-SlBuwhrX.js} +1 -1
  269. package/dist/client/assets/task-route-B4hPzw6u.js +1 -0
  270. package/dist/client/assets/{task-status-Cj8IGjJC.js → task-status-DhZZzZ6G.js} +1 -1
  271. package/dist/client/assets/{tasks-DzatESzy.js → tasks-B_rqCvr1.js} +4 -4
  272. package/dist/client/assets/tasks-CViGtGHm.js +1 -0
  273. package/dist/client/assets/{textarea-6VvdKhvF.js → textarea-BDMLJ5G-.js} +1 -1
  274. package/dist/client/assets/{thread-intent-DPwCeeGE.js → thread-intent-C7DpKTRQ.js} +1 -1
  275. package/dist/client/assets/thread-route-Bc63tvFc.js +1 -0
  276. package/dist/client/assets/{thread-route-BsrvgyVU.js → thread-route-BzWllNYG.js} +1 -1
  277. package/dist/client/assets/thread-sheet-body-CiausLhX.js +1 -0
  278. package/dist/client/assets/toggle-group-BW8cP6lf.js +1 -0
  279. package/dist/client/assets/{toolbar-icon-button-CSTgB2Je.js → toolbar-icon-button-A2ebiBUr.js} +1 -1
  280. package/dist/client/assets/tooltip-B7VLfO9w.js +1 -0
  281. package/dist/client/assets/{track-CDfY4FZL.js → track-BGU8HJCB.js} +1 -1
  282. package/dist/client/assets/{types-8hWP_tsZ.js → types-CrAbOCy3.js} +6 -6
  283. package/dist/client/assets/usage-stats-Bf1Ukas_.js +1 -0
  284. package/dist/client/assets/use-ai-providers-R1Jac-4Q.js +1 -0
  285. package/dist/client/assets/use-automations-BzLd_Cf7.js +1 -0
  286. package/dist/client/assets/{use-autosave-DRlRuq5e.js → use-autosave-BezKrA6F.js} +1 -1
  287. package/dist/client/assets/use-commerce-diagnostic-DTGIqIpu.js +1 -0
  288. package/dist/client/assets/use-connect-companion-CgerJAPe.js +1 -0
  289. package/dist/client/assets/{use-connection-tOIuuLKJ.js → use-connection-B4t4VJEN.js} +1 -1
  290. package/dist/client/assets/{use-copy-B4PUMZjo.js → use-copy-DQwrjGi4.js} +1 -1
  291. package/dist/client/assets/{use-create-virtual-mcp-x2IPUAAO.js → use-create-virtual-mcp-CHEKOqdh.js} +1 -1
  292. package/dist/client/assets/{use-date-fns-locale-use6rm0l.js → use-date-fns-locale-m0Q-8AAg.js} +1 -1
  293. package/dist/client/assets/{use-debounced-autosave-CWLgAozd.js → use-debounced-autosave-C82NqRut.js} +1 -1
  294. package/dist/client/assets/{use-debounced-value-BHZw1Wtv.js → use-debounced-value-SjJ8k_tD.js} +1 -1
  295. package/dist/client/assets/use-deco-credits-CIfhJ3OU.js +1 -0
  296. package/dist/client/assets/use-decopilot-events-DDnHJjGY.js +1 -0
  297. package/dist/client/assets/use-delete-connection-BWW3Qwe4.js +1 -0
  298. package/dist/client/assets/{use-deployment-admin-PTBGIrMl.js → use-deployment-admin-D4Et99Id.js} +1 -1
  299. package/dist/client/assets/use-fast-preview-draft-url-B8C-G0p2.js +1 -0
  300. package/dist/client/assets/use-file-configs-CKcyFOK-.js +1 -0
  301. package/dist/client/assets/{use-infinite-scroll-DnRzNQQc.js → use-infinite-scroll-C88xvDJq.js} +1 -1
  302. package/dist/client/assets/use-join-requests-CtMSd2H7.js +1 -0
  303. package/dist/client/assets/use-main-panel-tabs-BLf-yD79.js +1 -0
  304. package/dist/client/assets/use-mcp-auth-status-CF5e5Swp.js +1 -0
  305. package/dist/client/assets/{use-mcp-client-CzGi1Gun.js → use-mcp-client-DmOwsV3f.js} +6 -6
  306. package/dist/client/assets/{use-mcp-prompts-BJsq63pG.js → use-mcp-prompts-BKFfTbQi.js} +1 -1
  307. package/dist/client/assets/{use-mcp-tools-I4ahUYGD.js → use-mcp-tools-eOThR6gd.js} +1 -1
  308. package/dist/client/assets/{use-members-xjztJVBn.js → use-members-mw1URW2v.js} +1 -1
  309. package/dist/client/assets/use-mobile-WPuOYoIV.js +1 -0
  310. package/dist/client/assets/{use-navigate-to-agent-CBQsYRLL.js → use-navigate-to-agent-zGc1-u-z.js} +1 -1
  311. package/dist/client/assets/use-open-billing-url-BYWSUicc.js +1 -0
  312. package/dist/client/assets/use-org-auth-client-mMTl8cKp.js +1 -0
  313. package/dist/client/assets/{use-org-fs-Cm8FYvYP.js → use-org-fs-Ck9VysIz.js} +1 -1
  314. package/dist/client/assets/use-org-notice-Cb7z4nA0.js +1 -0
  315. package/dist/client/assets/{use-org-sso-CP_t4LLU.js → use-org-sso-CvkPQsKr.js} +1 -1
  316. package/dist/client/assets/{use-organization-roles-Cnixvt9H.js → use-organization-roles-wnmrYWSM.js} +1 -1
  317. package/dist/client/assets/use-organization-settings-CRw6qdb3.js +1 -0
  318. package/dist/client/assets/use-panel-navigate-ez3OqVq8.js +1 -0
  319. package/dist/client/assets/{use-project-native-view-presence-CJ7vLSBz.js → use-project-native-view-presence-DFjsPIlC.js} +1 -1
  320. package/dist/client/assets/use-project-scope-D9t-w7F3.js +1 -0
  321. package/dist/client/assets/use-registry-connections-BC1Pt8V1.js +1 -0
  322. package/dist/client/assets/use-releases-B_ioEYcb.js +1 -0
  323. package/dist/client/assets/use-route-default-main-B8Ci266p.js +1 -0
  324. package/dist/client/assets/use-secrets-BZEH47Ed.js +1 -0
  325. package/dist/client/assets/use-section-preview-base-D8ddLJeY.js +1 -0
  326. package/dist/client/assets/{use-session-runtime-Cs4eGT9k.js → use-session-runtime-CKDTMwlz.js} +1 -1
  327. package/dist/client/assets/use-tags-BnnveSvi.js +1 -0
  328. package/dist/client/assets/use-task-metadata-DQ-jzCVZ.js +1 -0
  329. package/dist/client/assets/{use-thread-outputs-DtpQGqCf.js → use-thread-outputs-ChimPCUk.js} +1 -1
  330. package/dist/client/assets/use-view-mode-CpyVGfy9.js +1 -0
  331. package/dist/client/assets/use-virtual-mcp-DvSX4N6q.js +1 -0
  332. package/dist/client/assets/useInfiniteQuery-CuoCKqDV.js +1 -0
  333. package/dist/client/assets/{useQueries-CnHkVL7d.js → useQueries-CCVXh4wK.js} +1 -1
  334. package/dist/client/assets/useSuspenseInfiniteQuery-BGyZ2Zcs.js +1 -0
  335. package/dist/client/assets/{users-CWHZPvdU.js → users-DgkJfwRz.js} +1 -1
  336. package/dist/client/assets/{utils-CdxSjBly.js → utils-D06E4WDv.js} +2 -2
  337. package/dist/client/assets/variant-calendar-B2YQFxru.js +1 -0
  338. package/dist/client/assets/{variant-matcher-override-BLTbL0Nb.js → variant-matcher-override-POFwaaTG.js} +1 -1
  339. package/dist/client/assets/view-mode-toggle-B09x-ETl.js +1 -0
  340. package/dist/client/assets/{virtual-mcp-CIE6gIFV.js → virtual-mcp-D-br_N6s.js} +1 -1
  341. package/dist/client/index.html +2 -2
  342. package/dist/server/cli.js +1 -1
  343. package/dist/server/server.js +1 -1
  344. package/package.json +1 -1
  345. package/dist/client/assets/Printer-Nban-oJk.js +0 -1
  346. package/dist/client/assets/access-gate-aVhmxNUP.js +0 -1
  347. package/dist/client/assets/add-connection-dialog-C2-znERG.js +0 -1
  348. package/dist/client/assets/agent-analytics-CLObAM6S.js +0 -2
  349. package/dist/client/assets/agent-app-DtLxy7iB.js +0 -1
  350. package/dist/client/assets/agent-assets-5J9H4wgC.js +0 -1
  351. package/dist/client/assets/agent-automation-DTYBStDc.js +0 -20
  352. package/dist/client/assets/agent-automations-DYZPALXC.js +0 -1
  353. package/dist/client/assets/agent-connect-sources-DJFWziK9.js +0 -1
  354. package/dist/client/assets/agent-deck-De0Y6qk5.js +0 -1
  355. package/dist/client/assets/agent-e2e-MVQ6vmAy.js +0 -1
  356. package/dist/client/assets/agent-file-IBnKf7Fw.js +0 -1
  357. package/dist/client/assets/agent-git-DjVoKiR8.js +0 -3
  358. package/dist/client/assets/agent-hosting-DbC8wvCr.js +0 -1
  359. package/dist/client/assets/agent-icon-DsGBCBNv.js +0 -1
  360. package/dist/client/assets/agent-library-file-CySHm683.js +0 -1
  361. package/dist/client/assets/agent-monitor-Duc2QTVQ.js +0 -1
  362. package/dist/client/assets/agent-overview-DAVTPrgq.js +0 -1
  363. package/dist/client/assets/agent-settings-DBEnACPy.js +0 -1
  364. package/dist/client/assets/agent-site-editor-CJ_722sF.js +0 -1
  365. package/dist/client/assets/agent-site-editor-code-CBPV2yNN.js +0 -2
  366. package/dist/client/assets/agent-site-editor-content-C-fwwsI7.js +0 -2
  367. package/dist/client/assets/agent-site-editor-preview-Be-uG2hV.js +0 -504
  368. package/dist/client/assets/agent-view-B3DdbJTr.js +0 -1
  369. package/dist/client/assets/agent-view-guard-DTG6Ut5n.js +0 -1
  370. package/dist/client/assets/agents-list-DNaOFYAO.js +0 -1
  371. package/dist/client/assets/ai-providers-BPcl_qgT.js +0 -1
  372. package/dist/client/assets/api-keys-CYMMtT0P.js +0 -1
  373. package/dist/client/assets/app-editor-_27_2g82.js +0 -1
  374. package/dist/client/assets/asset-utils-DTfzHa9m.js +0 -1
  375. package/dist/client/assets/automation-runs-Dt50JHCo.js +0 -1
  376. package/dist/client/assets/automations-DDydXmIK.js +0 -1
  377. package/dist/client/assets/backoff-CrEUbyZT.js +0 -1
  378. package/dist/client/assets/buckets-Wx6DtJNT.js +0 -1
  379. package/dist/client/assets/build-improve-prompt-doc-4aKzyTWA.js +0 -2
  380. package/dist/client/assets/bulk-category-panel-CclTC40F.js +0 -1
  381. package/dist/client/assets/category-editor-CuGxUDVJ.js +0 -1
  382. package/dist/client/assets/choose-editor-CE7aKrQp.js +0 -1
  383. package/dist/client/assets/collapsible-BDifv-q9.js +0 -1
  384. package/dist/client/assets/collection-detail-ec9sW8Ey.js +0 -1
  385. package/dist/client/assets/collection-display-button-C3CfuUhX.js +0 -1
  386. package/dist/client/assets/commerce-onboarding-Dxc7EEsL.js +0 -1
  387. package/dist/client/assets/connect-layout-Bby2uYqZ.js +0 -1
  388. package/dist/client/assets/connection-detail-C-Fe9wui.js +0 -1
  389. package/dist/client/assets/connections-CxSK9S4W.js +0 -1
  390. package/dist/client/assets/decode-html-entities-B4Qel6ov.js +0 -1
  391. package/dist/client/assets/decopilot-sse-pool-czpSFI9L.js +0 -1
  392. package/dist/client/assets/delay-CnY5UFtP.js +0 -1
  393. package/dist/client/assets/dialog--Jkwvpx1.js +0 -1
  394. package/dist/client/assets/discover-C7-JIKhR.js +0 -1
  395. package/dist/client/assets/domain-settings-Dh029s1M.js +0 -1
  396. package/dist/client/assets/file-explorer-B4d-xz4q.js +0 -2
  397. package/dist/client/assets/general-BY1zbaWS.js +0 -1
  398. package/dist/client/assets/home-CeJo7q7K.js +0 -1
  399. package/dist/client/assets/hooks-CxPd9b6i.js +0 -15
  400. package/dist/client/assets/index-1yGxjvng.js +0 -24
  401. package/dist/client/assets/index-C7tZKQ5s.js +0 -1
  402. package/dist/client/assets/index-CklK0EA_.js +0 -1
  403. package/dist/client/assets/index-D5CXQ9x9.js +0 -1
  404. package/dist/client/assets/index-Og5m3t85.js +0 -26
  405. package/dist/client/assets/index-Y6pd1REu.js +0 -1
  406. package/dist/client/assets/infra-billing-ChvPe0pr.js +0 -1
  407. package/dist/client/assets/invite-member-dialog-CeSVAfZq.js +0 -1
  408. package/dist/client/assets/layout-BIIr_imR.js +0 -1
  409. package/dist/client/assets/legacy-agents-deep-CdZo4h4A.js +0 -1
  410. package/dist/client/assets/legacy-main-redirect-CWWHewM6.js +0 -1
  411. package/dist/client/assets/login-svGY2sKo.js +0 -1
  412. package/dist/client/assets/members-BOTXfNHf.js +0 -1
  413. package/dist/client/assets/org-layout-BiRvLqL-.js +0 -1
  414. package/dist/client/assets/orgs-CMf-H7HH.js +0 -1
  415. package/dist/client/assets/post-calendar-BAQtpQvh.js +0 -1
  416. package/dist/client/assets/post-editor-DBJMHXYe.js +0 -1
  417. package/dist/client/assets/preview-content-CICx8Frq.js +0 -1
  418. package/dist/client/assets/profile-CUkJFM3_.js +0 -1
  419. package/dist/client/assets/project-app-view-BSYHmGj3.js +0 -1
  420. package/dist/client/assets/project-feed-BEGVLizK.js +0 -1
  421. package/dist/client/assets/project-reports-BozhFElP.js +0 -1
  422. package/dist/client/assets/project-tasks-DVexwc9x.js +0 -1
  423. package/dist/client/assets/prompts-Df-P8Zuz.js +0 -1
  424. package/dist/client/assets/record-editor-9YdHcAWO.js +0 -1
  425. package/dist/client/assets/redirect-editor-BohyWJXT.js +0 -1
  426. package/dist/client/assets/registry-BbkHDIpk.js +0 -2
  427. package/dist/client/assets/reports-SeFGRJSZ.js +0 -1
  428. package/dist/client/assets/reports-tab-D5rlmWEp.js +0 -2
  429. package/dist/client/assets/repositories-BXEjUV3F.js +0 -1
  430. package/dist/client/assets/repository-import-picker-Bc_O4k0-.js +0 -1
  431. package/dist/client/assets/repository-picker-DC97O6OK.js +0 -1
  432. package/dist/client/assets/require-capability-CoB1D-Ih.js +0 -1
  433. package/dist/client/assets/retry-CErkP7V6.js +0 -1
  434. package/dist/client/assets/roles-DEMri9Kk.js +0 -1
  435. package/dist/client/assets/runnable-block-editor-BD-IThSC.js +0 -16
  436. package/dist/client/assets/secrets-7Z0pTBUq.js +0 -1
  437. package/dist/client/assets/sections-editor-DoMH-fks.js +0 -2
  438. package/dist/client/assets/select-C9ZnmbzX.js +0 -1
  439. package/dist/client/assets/select-model-FK_tmltz.js +0 -1
  440. package/dist/client/assets/seo-editor-DNovpojV.js +0 -1
  441. package/dist/client/assets/settings-layout-Cd8jASua.js +0 -1
  442. package/dist/client/assets/settings-sidebar-DP80M_GR.js +0 -1
  443. package/dist/client/assets/settings-tab-DE3XUo7h.js +0 -5
  444. package/dist/client/assets/shell-controls-CnE-Tn5l.js +0 -1
  445. package/dist/client/assets/shell-layout-DMp5UdGb.js +0 -1
  446. package/dist/client/assets/skill-preview-D2lK4hU9.js +0 -1
  447. package/dist/client/assets/skills-xXfBybxi.js +0 -1
  448. package/dist/client/assets/source-system-tabs-CnEGUb4r.js +0 -1
  449. package/dist/client/assets/sso-DdBxRFrm.js +0 -1
  450. package/dist/client/assets/store-registry-BFRxGHgD.js +0 -2
  451. package/dist/client/assets/switch-DADMizS1.js +0 -1
  452. package/dist/client/assets/synced-repos-Cp7R03Jp.js +0 -1
  453. package/dist/client/assets/task-route-_NgFGVoT.js +0 -1
  454. package/dist/client/assets/tasks-BvZdYZ5R.js +0 -1
  455. package/dist/client/assets/thread-sheet-body-S2AS0IdJ.js +0 -1
  456. package/dist/client/assets/toggle-group-CHZjV-1n.js +0 -1
  457. package/dist/client/assets/toolbar-DAhC4RMM.js +0 -1
  458. package/dist/client/assets/usage-stats-B38oXMbk.js +0 -1
  459. package/dist/client/assets/use-ai-providers-DYf552qv.js +0 -1
  460. package/dist/client/assets/use-automations-DSRSDlyo.js +0 -1
  461. package/dist/client/assets/use-commerce-diagnostic-pXwQBZmy.js +0 -1
  462. package/dist/client/assets/use-connect-companion-Bt171l5d.js +0 -1
  463. package/dist/client/assets/use-deco-credits-Coxc4dyp.js +0 -1
  464. package/dist/client/assets/use-decopilot-events-V4xtyk7c.js +0 -1
  465. package/dist/client/assets/use-delete-connection-geT4L5Ed.js +0 -1
  466. package/dist/client/assets/use-file-configs-BLWnBKpa.js +0 -1
  467. package/dist/client/assets/use-join-requests-DL4guRSR.js +0 -1
  468. package/dist/client/assets/use-main-panel-tabs-BtAksZ1f.js +0 -1
  469. package/dist/client/assets/use-mcp-auth-status-CpecQqEX.js +0 -1
  470. package/dist/client/assets/use-open-billing-url-DaC9_MxZ.js +0 -1
  471. package/dist/client/assets/use-org-auth-client-DuxSmx0x.js +0 -1
  472. package/dist/client/assets/use-org-notice-lWz1PPs-.js +0 -1
  473. package/dist/client/assets/use-organization-settings-C-LQvPpq.js +0 -1
  474. package/dist/client/assets/use-panel-navigate-D2RT2tc_.js +0 -1
  475. package/dist/client/assets/use-project-scope-Ch_4TfMQ.js +0 -1
  476. package/dist/client/assets/use-registry-connections-CuDWC28C.js +0 -1
  477. package/dist/client/assets/use-secrets-BJDccjnS.js +0 -1
  478. package/dist/client/assets/use-section-preview-base-SCqBiLMF.js +0 -1
  479. package/dist/client/assets/use-status-sounds-BG-lkYEo.js +0 -1
  480. package/dist/client/assets/use-tags-DhkHJc7C.js +0 -1
  481. package/dist/client/assets/use-task-metadata-COSUQhUk.js +0 -1
  482. package/dist/client/assets/use-view-mode-CUARubnx.js +0 -1
  483. package/dist/client/assets/use-virtual-mcp-BMRFgR9g.js +0 -1
  484. package/dist/client/assets/useInfiniteQuery-DOeboQGx.js +0 -1
  485. package/dist/client/assets/useSuspenseInfiniteQuery-B5UzTlHS.js +0 -1
  486. package/dist/client/assets/variant-calendar-f9XxiGiP.js +0 -1
  487. package/dist/client/assets/view-mode-toggle-D31fXZcw.js +0 -1
  488. /package/dist/client/assets/{index-DDGTF8rc.css → agent-site-editor-DDGTF8rc.css} +0 -0
@@ -1,24 +0,0 @@
1
- import{K as ks,c as H,m as es,b as be,r as O,l as _e,j as h,h as gt,I as ut,au as Bi,$ as ls,E as Li,d as ji,u as Ii,f as ri,a as hs,n as Lc,M as Do,U as Ju,O as jc,a6 as Je,B as Pe,ap as Zu,aq as Ei,a7 as Ze,a9 as Qe,t as Xe,av as Qu,o as Cs,aw as ef,ax as tf,a8 as Oi,ay as No,az as sf,z as rf,v as nf,F as Ic,e as Pn,x as of,ac as Mo,aA as af,aB as lf,ar as cf,y as Ia,k as hf,aC as df,aD as uf,R as Oc,aE as ff,N as pf}from"./index-gctAQu2T.js";import{C as ht,w as _f,u as zc}from"./use-main-panel-tabs-BtAksZ1f.js";import{a as mf,u as gf}from"./use-organization-settings-C-LQvPpq.js";import{b as ds,u as Bo,a as zi,c as $c,d as vf,e as bf,s as Sf}from"./chat-context-CD1rWX64.js";import{u as ni}from"./use-session-runtime-Cs4eGT9k.js";import{u as yf}from"./use-ai-providers-DYf552qv.js";import{i as Lo}from"./AlertCircle-bl0yU7gy.js";import{i as jo}from"./CheckCircle-BNNyBNMK.js";import{W as En,A as Ri,T as xf,o as Fc,Z as jr,_ as Hc,$ as Io,G as wf,a0 as Wc,a1 as Cf,a2 as kf,a3 as Pf,a4 as Ef,k as Rf,a5 as Tf,n as Af}from"./agent-icon-DsGBCBNv.js";import{i as Df}from"./XCircle-Dvf0BUKb.js";import{s as Oa}from"./XClose-DPfGLo7I.js";import{a as us,b as Nf,u as Uc}from"./use-virtual-mcp-BMRFgR9g.js";import{I as Kc}from"./integration-icon-YYg8l_RW.js";import{c as Mf}from"./usage-stats-B38oXMbk.js";import{t as $s,n as Bf}from"./ChevronUp-Cp-tcsrs.js";import{O as Lf,u as jf}from"./pair-BIPkH5eA.js";import{u as If,a as Of}from"./use-thread-outputs-DtpQGqCf.js";import{u as zf}from"./use-deco-credits-Coxc4dyp.js";import{i as $f}from"./command-palette-store-BNo0UXiS.js";import{b as Rn,f as Ff,c as Hf}from"./use-project-scope-Ch_4TfMQ.js";import{d as Oo,a as Wf,c as Uf}from"./thread-intent-DPwCeeGE.js";import{u as zo,a as Ir,b as Kf,c as $o}from"./hooks-CxPd9b6i.js";import{p as qf,a as qc,b as Vf,c as Vc,d as Gf,e as Fo,f as Yf,g as Xf}from"./use-navigate-to-agent-CBQsYRLL.js";import{u as Or,c as Gc,a as Yc,d as Jf,e as Zf,o as Qf,s as ep,f as tp,g as sp,h as ip}from"./sandbox-lifecycle-context-Beua1bNX.js";import{u as rp}from"./use-status-sounds-BG-lkYEo.js";import{E as Xc}from"./empty-state-DmTochCH.js";import{b as np,c as $i,a as Jc,u as Zc,r as op,d as ap}from"./thread-route-BsrvgyVU.js";import{a as lp,u as Ho,b as Qc,c as eh}from"./use-panel-navigate-D2RT2tc_.js";import{r as th,a as Ut,h as sh,b as ih,g as Wo}from"./github-repo-C0igpkr9.js";import{r as cp}from"./serial-task-queue-CGOeQgpr.js";import{T as hp}from"./toolbar-DAhC4RMM.js";import{i as dp}from"./Share07-D8xQrAsX.js";import{b as up,c as rh,S as fp,d as pp}from"./select-C9ZnmbzX.js";import{i as nh,s as _p}from"./source-system-tabs-CnEGUb4r.js";import{a as mp}from"./Package-DTeqx5ul.js";import{L as Uo,a as gp}from"./legacy-main-redirect-CWWHewM6.js";import{L as vp}from"./preview-dialog-CYbL8r4H.js";import{O as bp}from"./markdown-BV0XgGTq.js";import{u as oh}from"./use-is-desktop-app-BNujXJc_.js";import{p as Sp}from"./virtual-mcp-CIE6gIFV.js";import{b as za}from"./sandbox-url-D3mC8qhT.js";import{i as Sr}from"./Play-BPdpqeiE.js";import{c as Ko,D as qo,b as Vo,a as yr}from"./dropdown-menu-4cRHTbic.js";import{a as zr,b as Fi,P as Hi,c as yp}from"./popover-BfKN_4aI.js";import{s as ah}from"./Plus-kQ9d0PiA.js";import{i as xp,a as wp}from"./UserSquare-BflxhZ_l.js";import{p as lh,I as ch,T as xr}from"./toolbar-icon-button-CSTgB2Je.js";import{L as hh}from"./anchors-yqDzZN4K.js";import{G as dh}from"./github-icon-cJDFDEm7.js";import{D as Go,b as Yo,d as Cp,h as kp,c as Pp}from"./dialog--Jkwvpx1.js";import{T as uh}from"./textarea-6VvdKhvF.js";import{s as Xo}from"./Eye-B_BMkWWc.js";import{i as fh}from"./Globe01-DMnQmvOn.js";import{a as ph}from"./format-time-BtXRrtv4.js";import{i as Jo}from"./ChevronRight-2Ti1evDh.js";import{i as Ep}from"./Printer-Nban-oJk.js";import{s as _h}from"./Trash01-BB2ymX9J.js";import{i as mh,G as gh,f as wi,p as Rp,r as vh,d as Tn,a as bh,b as cr,c as Tp,e as Ap,g as Sh,n as Dp,h as Np,j as Mp,k as Bp,l as Zo,m as Lp,o as yh,s as xh,q as jp,t as Ip,u as Op,v as zp,w as $a,x as $p,y as Fp,z as Zr,A as Hp,B as Wp,C as Up,D as Kp,E as qp,F as Vp,H as Gp,I as Fa}from"./decode-html-entities-B4Qel6ov.js";import{b as Yp}from"./utils-CdxSjBly.js";import{u as $r,f as Xp}from"./shell-layout-DMp5UdGb.js";import{u as Jp}from"./use-mcp-client-CzGi1Gun.js";import{I as Zp}from"./input-eBmoU-9D.js";import{c as wh,a as Ch,T as wr,b as Ha}from"./tabs-Sr-wlkg3.js";import{i as Qp}from"./ArrowRight-CkVUmxaa.js";import{i as An}from"./GitBranch01-Dr0NRbj6.js";import{t as e_}from"./Stars01-DWjpdjKn.js";import{c as kh,d as Ph,b as Eh,f as Rh,g as Th,e as Ah,a as Dh,A as Nh}from"./alert-dialog-BdwUra4d.js";import{e as Dn,C as Nn,a as Mn,c as Mh,d as Bh,b as Lh}from"./command-cJVGaRa3.js";import{i as t_}from"./DotsVertical-B8slOnrw.js";import{i as s_}from"./Tool01-E6Rv0Nbs.js";import{u as i_}from"./use-debounced-value-BHZw1Wtv.js";import{u as r_}from"./useInfiniteQuery-DOeboQGx.js";import{i as n_}from"./Tool02-Darwb8nP.js";import{a as o_,T as a_}from"./toggle-group-CHZjV-1n.js";import{i as jh}from"./Zap-ChgjHdxL.js";import{g as l_,S as c_}from"./task-status-Cj8IGjJC.js";function Qo(t){return`${t.orgSlug}/${t.virtualMcpId}/${t.branch}`}function h_(t,e,s){return["decofile-write",t,e,s]}function ea(t){return`/api/${t.orgSlug}/decofile/${encodeURIComponent(t.virtualMcpId)}/${encodeURIComponent(t.branch)}`}async function Ih(t,e){const s=await t.json().catch(()=>({}));throw new Error(s.error??`${e} failed (${t.status})`)}function d_(t,e,s){t.setQueryData(ks.decofileDraft(Qo(e)),s)}function u_(t){const e=H.c(4);let s;e[0]!==t?(s=ks.decofileDraft(t?Qo(t):""),e[0]=t,e[1]=s):s=e[1];let i;e[2]!==s?(i={queryKey:s,enabled:!1,queryFn:f_,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},e[2]=s,e[3]=i):i=e[3];const{data:r}=es(i);return r??null}async function f_(){throw new Error("decofileDraft is populated by reads/writes, not fetched")}async function Lw(t,e){const s=await fetch(ea(e),{cache:"no-store"});if(!s.ok){const r=new Error(`Failed to fetch decofile: ${s.status}`);throw r.status=s.status,r}const i=await s.json();return i.token&&d_(t,e,{version:i.version,token:i.token,apiHost:i.apiHost??window.location.host}),i.decofile}const p_=2880*60*1e3;function __(t,e,s=p_){if(!t)return!1;const i=new Date(t).getTime();return Number.isNaN(i)?!1:e-i>s}async function m_(t){const e=await fetch(`${ea(t)}/status`,{cache:"no-store"});return e.ok?await e.json():Ih(e,"Status")}function g_(t){return{queryKey:ks.decofileStatus(Qo(t)),queryFn:()=>m_(t),staleTime:3e4}}async function jw(t,e){const s=await fetch(ea(t),{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)});if(!s.ok)return Ih(s,"Save");const i=await s.json();return{...i,apiHost:i.apiHost??window.location.host}}function v_({isThreadLocked:t,hasCloudProviderKeys:e}){return t?!1:!e}function b_(){const t=H.c(3),e=yf(),i=ds()?.isThreadLocked??!1,r=e.length>0;let n;return t[0]!==i||t[1]!==r?(n=v_({isThreadLocked:i,hasCloudProviderKeys:r}),t[0]=i,t[1]=r,t[2]=n):n=t[2],n}function li(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function Qr(t){if(!t)return"—";const e=typeof t=="string"?new Date(t):t;return isNaN(e.getTime())?"—":e.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function S_(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function y_(t){const e=H.c(4),{items:s}=t;let i;e[0]!==s?(i=s.map(x_),e[0]=s,e[1]=i):i=e[1];let r;return e[2]!==i?(r=h.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-6",children:i}),e[2]=i,e[3]=r):r=e[3],r}function x_(t){return h.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[h.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t.label}),h.jsx("span",{className:"text-sm text-foreground tabular-nums truncate",children:t.value})]},t.label)}function w_(t){const e=H.c(33),{userTokens:s,assistantTokens:i,otherTokens:r}=t,n=be(),o=s+i+r,a=o>0?s/o*100:0,c=o>0?i/o*100:0,l=o>0?r/o*100:0;let u;e[0]!==a?(u=a>0&&h.jsx("div",{className:"h-full bg-chart-1",style:{width:`${a}%`}}),e[0]=a,e[1]=u):u=e[1];let d;e[2]!==c?(d=c>0&&h.jsx("div",{className:"h-full bg-chart-2",style:{width:`${c}%`}}),e[2]=c,e[3]=d):d=e[3];let f;e[4]!==l?(f=l>0&&h.jsx("div",{className:"h-full bg-muted-foreground/30",style:{width:`${l}%`}}),e[4]=l,e[5]=f):f=e[5];let p;e[6]!==u||e[7]!==d||e[8]!==f?(p=h.jsxs("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:[u,d,f]}),e[6]=u,e[7]=d,e[8]=f,e[9]=p):p=e[9];let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=h.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-1 shrink-0"}),e[10]=_):_=e[10];let g;e[11]!==n||e[12]!==a?(g=n("chat.contextPanel.userPercent",{pct:a.toFixed(1)}),e[11]=n,e[12]=a,e[13]=g):g=e[13];let v;e[14]!==g?(v=h.jsxs("div",{className:"flex items-center gap-1.5",children:[_,h.jsx("span",{className:"text-xs text-muted-foreground",children:g})]}),e[14]=g,e[15]=v):v=e[15];let b;e[16]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-2 shrink-0"}),e[16]=b):b=e[16];let k;e[17]!==c||e[18]!==n?(k=n("chat.contextPanel.assistantPercent",{pct:c.toFixed(1)}),e[17]=c,e[18]=n,e[19]=k):k=e[19];let w;e[20]!==k?(w=h.jsxs("div",{className:"flex items-center gap-1.5",children:[b,h.jsx("span",{className:"text-xs text-muted-foreground",children:k})]}),e[20]=k,e[21]=w):w=e[21];let S;e[22]!==l||e[23]!==r||e[24]!==n?(S=r>0&&h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-muted-foreground/30 shrink-0"}),h.jsx("span",{className:"text-xs text-muted-foreground",children:n("chat.contextPanel.otherPercent",{pct:l.toFixed(1)})})]}),e[22]=l,e[23]=r,e[24]=n,e[25]=S):S=e[25];let m;e[26]!==w||e[27]!==S||e[28]!==v?(m=h.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[v,w,S]}),e[26]=w,e[27]=S,e[28]=v,e[29]=m):m=e[29];let x;return e[30]!==m||e[31]!==p?(x=h.jsxs("div",{className:"flex flex-col gap-2",children:[p,m]}),e[30]=m,e[31]=p,e[32]=x):x=e[32],x}function C_(t){const e=H.c(14),{agentId:s,isError:i}=t,r=us(s),n=be();let o;e[0]!==r?.title||e[1]!==n?(o=r?.title??n("chat.subtask.subtaskNoun"),e[0]=r?.title,e[1]=n,e[2]=o):o=e[2];const a=o,c=r?.icon??null;let l;e[3]!==c||e[4]!==a?(l=h.jsx(Kc,{icon:c,name:a,size:"xs",className:"size-6 rounded-md shrink-0"}),e[3]=c,e[4]=a,e[5]=l):l=e[5];const u=i?"text-destructive":"text-foreground";let d;e[6]!==u?(d=_e("shrink-0 font-medium",u),e[6]=u,e[7]=d):d=e[7];let f;e[8]!==a||e[9]!==d?(f=h.jsx("span",{className:d,children:a}),e[8]=a,e[9]=d,e[10]=f):f=e[10];let p;return e[11]!==l||e[12]!==f?(p=h.jsxs(h.Fragment,{children:[l,f]}),e[11]=l,e[12]=f,e[13]=p):p=e[13],p}function k_(t){const e=H.c(12),{isError:s}=t,i=be();let r;e[0]!==i?(r=i("chat.contextPanel.subtask"),e[0]=i,e[1]=r):r=e[1];const n=r;let o;e[2]!==n?(o=h.jsx(Kc,{icon:null,name:n,size:"xs",className:"size-6 rounded-md shrink-0"}),e[2]=n,e[3]=o):o=e[3];const a=s?"text-destructive":"text-foreground";let c;e[4]!==a?(c=_e("shrink-0 font-medium",a),e[4]=a,e[5]=c):c=e[5];let l;e[6]!==n||e[7]!==c?(l=h.jsx("span",{className:c,children:n}),e[6]=n,e[7]=c,e[8]=l):l=e[8];let u;return e[9]!==o||e[10]!==l?(u=h.jsxs(h.Fragment,{children:[o,l]}),e[9]=o,e[10]=l,e[11]=u):u=e[11],u}function P_(t){const e=H.c(18),{part:s}=t,i=s.input?.agent_id,r=s.state==="input-streaming"||s.state==="input-available"||s.state==="output-available"&&s.preliminary===!0,n=s.state==="output-error",o=s.state==="approval-requested";let a;e[0]!==n?(a=h.jsx(k_,{isError:n}),e[0]=n,e[1]=a):a=e[1];let c;e[2]!==i||e[3]!==n?(c=h.jsx(C_,{agentId:i,isError:n}),e[2]=i,e[3]=n,e[4]=c):c=e[4];let l;e[5]!==a||e[6]!==c?(l=h.jsx(O.Suspense,{fallback:a,children:c}),e[5]=a,e[6]=c,e[7]=l):l=e[7];let u;e[8]!==s.input?(u=s.input?.prompt&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground/50",children:"·"}),h.jsx("span",{className:"truncate text-muted-foreground",children:s.input.prompt})]}),e[8]=s.input,e[9]=u):u=e[9];let d;e[10]!==o||e[11]!==n||e[12]!==r?(d=h.jsx("span",{className:"ml-auto shrink-0",children:r?h.jsx(gt,{className:"size-3 text-muted-foreground"}):n?h.jsx(Df,{size:12,className:"text-destructive"}):o?h.jsx(Lo,{size:12,className:"text-warning"}):h.jsx(jo,{size:12,className:"text-success"})}),e[10]=o,e[11]=n,e[12]=r,e[13]=d):d=e[13];let f;return e[14]!==l||e[15]!==u||e[16]!==d?(f=h.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[l,u,d]}),e[14]=l,e[15]=u,e[16]=d,e[17]=f):f=e[17],f}function E_(t){const e=H.c(78),{onClose:s,back:i,className:r}=t,n=be(),[o,a]=O.useState(null),{messages:c}=Bo(),{activeTask:l}=zi(),{selectedModel:u,selectedVirtualMcp:d}=$c();let f,p,_,g,v,b,k,w;if(e[0]!==l||e[1]!==i||e[2]!==r||e[3]!==c||e[4]!==s||e[5]!==o?.id||e[6]!==u||e[7]!==d?.title||e[8]!==n){w=Symbol.for("react.early_return_sentinel");e:{const x=Mf(c),y=[...c].reverse().find(O_),C=y?.metadata?.usage,N=y?.metadata?.modelLimits?.contextWindow??u?.limits?.contextWindow??null,T=C?.contextTokens??0,R=N&&N>0?(T/N*100).toFixed(1):null,E=c;let P;e[17]!==E?(P=E.filter(I_).reduce(j_,0),e[17]=E,e[18]=P):P=e[18];const A=P,M=c;let L;e[19]!==M?(L=M.filter(L_).reduce(B_,0),e[19]=M,e[20]=L):L=e[20];const B=L,D=Math.max(0,x.totalTokens-A-B),j=c[0],K=c.at(-1),z=j?.metadata?.created_at??l?.created_at,G=K?.metadata?.created_at??l?.updated_at,I=c.filter(M_),V=c.flatMap(D_),$=u?.modelId?S_(u.modelId):"—",ee=d?.title??"Super Agent",se=[{label:n("chat.contextPanel.sessionLabel"),value:l?.title??n("chat.contextPanel.newChat")},{label:n("chat.contextPanel.messagesLabel"),value:I.length},{label:n("chat.contextPanel.agentLabel"),value:ee},{label:n("chat.contextPanel.modelLabel"),value:$},{label:n("chat.contextPanel.contextLimitLabel"),value:N?li(N):"—"},{label:n("chat.contextPanel.sessionTokensLabel"),value:x.totalTokens>0?li(x.totalTokens):"0"},{label:n("chat.contextPanel.usageLabel"),value:R!==null?`${R}%`:"—"},{label:n("chat.contextPanel.inputTokensLabel"),value:x.inputTokens>0?li(x.inputTokens):"0"},{label:n("chat.contextPanel.outputTokensLabel"),value:x.outputTokens>0?li(x.outputTokens):"0"},{label:n("chat.contextPanel.reasoningTokensLabel"),value:x.reasoningTokens>0?li(x.reasoningTokens):"0"},{label:n("chat.contextPanel.costLabel"),value:x.cost>0?`$${x.cost<.001?x.cost.toFixed(6):x.cost.toFixed(4)}`:"$0.00"},{label:n("chat.contextPanel.sessionCreatedLabel"),value:Qr(z)},{label:n("chat.contextPanel.lastActivityLabel"),value:Qr(G)}];if(!l&&I.length===0){let q;e[21]!==r?(q=_e("flex flex-col h-full w-full border-l border-border bg-background",r),e[21]=r,e[22]=q):q=e[22];let F;e[23]!==n?(F=n("chat.contextPanel.title"),e[23]=n,e[24]=F):F=e[24];let Q;e[25]!==F?(Q=h.jsx("span",{className:"text-sm font-medium text-foreground",children:F}),e[25]=F,e[26]=Q):Q=e[26];let he;e[27]!==i?(he=i?h.jsx(En,{size:14,className:"text-muted-foreground"}):h.jsx(Oa,{size:14,className:"text-muted-foreground"}),e[27]=i,e[28]=he):he=e[28];let ue;e[29]!==s||e[30]!==he?(ue=h.jsx("button",{type:"button",onClick:s,className:"flex size-6 items-center justify-center rounded hover:bg-accent transition-colors",children:he}),e[29]=s,e[30]=he,e[31]=ue):ue=e[31];let fe;e[32]!==Q||e[33]!==ue?(fe=h.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[Q,ue]}),e[32]=Q,e[33]=ue,e[34]=fe):fe=e[34];let ne;e[35]!==n?(ne=n("chat.contextPanel.emptyState"),e[35]=n,e[36]=ne):ne=e[36];let ce;e[37]!==ne?(ce=h.jsx("div",{className:"flex-1 flex items-center justify-center px-4 text-center",children:h.jsx("p",{className:"text-xs text-muted-foreground",children:ne})}),e[37]=ne,e[38]=ce):ce=e[38];let de;e[39]!==q||e[40]!==fe||e[41]!==ce?(de=h.jsxs("div",{className:q,children:[fe,ce]}),e[39]=q,e[40]=fe,e[41]=ce,e[42]=de):de=e[42],w=de;break e}e[43]!==r?(b=_e("flex flex-col h-full w-full border-l border-border bg-background overflow-y-auto",r),e[43]=r,e[44]=b):b=e[44];let ie;e[45]!==n?(ie=n("chat.contextPanel.title"),e[45]=n,e[46]=ie):ie=e[46];let Y;e[47]!==ie?(Y=h.jsx("span",{className:"text-sm font-medium text-foreground",children:ie}),e[47]=ie,e[48]=Y):Y=e[48];let Z;e[49]!==i?(Z=i?h.jsx(En,{size:14}):h.jsx(Oa,{size:14}),e[49]=i,e[50]=Z):Z=e[50];let X;e[51]!==s||e[52]!==Z?(X=h.jsx("button",{type:"button",onClick:s,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:Z}),e[51]=s,e[52]=Z,e[53]=X):X=e[53],e[54]!==Y||e[55]!==X?(k=h.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[Y,X]}),e[54]=Y,e[55]=X,e[56]=k):k=e[56],f="flex flex-col gap-8 p-6",p=V.length>0&&h.jsxs("div",{className:"flex flex-col gap-3",children:[h.jsx("span",{className:"text-xs text-muted-foreground",children:n("chat.contextPanel.subtasksSection")}),h.jsx("div",{className:"flex flex-col gap-1",children:V.map(A_)})]}),_=h.jsx(y_,{items:se});let U;e[57]!==n?(U=n("chat.contextPanel.contextBreakdownSection"),e[57]=n,e[58]=U):U=e[58];let J;e[59]!==U?(J=h.jsx("span",{className:"text-xs text-muted-foreground",children:U}),e[59]=U,e[60]=J):J=e[60];let ae;e[61]!==B||e[62]!==D||e[63]!==A?(ae=h.jsx(w_,{userTokens:A,assistantTokens:B,otherTokens:D}),e[61]=B,e[62]=D,e[63]=A,e[64]=ae):ae=e[64],e[65]!==J||e[66]!==ae?(g=h.jsxs("div",{className:"flex flex-col gap-3",children:[J,ae]}),e[65]=J,e[66]=ae,e[67]=g):g=e[67],v=I.length>0&&h.jsxs("div",{className:"flex flex-col gap-3",children:[h.jsx("span",{className:"text-xs text-muted-foreground",children:n("chat.contextPanel.rawMessagesSection")}),h.jsx("div",{className:"flex flex-col gap-1",children:I.map(q=>{const F=q.metadata?.created_at,Q=o?.id===q.id;return h.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[h.jsxs("button",{type:"button",onClick:()=>a(Q?null:q),className:"flex items-center justify-between gap-2 px-3 py-2 text-xs hover:bg-accent/50 w-full text-left cursor-pointer",children:[h.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[h.jsx("span",{className:_e("shrink-0 font-medium",q.role==="user"?"text-chart-1":"text-chart-2"),children:q.role}),h.jsx("span",{className:"text-muted-foreground",children:"•"}),h.jsx("span",{className:"truncate text-muted-foreground font-mono",children:q.id})]}),F&&h.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:Qr(F)})]}),Q&&h.jsxs(h.Fragment,{children:[q.role==="assistant"&&(()=>{const he=q.metadata?._request;if(!he)return null;const ue=he.systemSections??[],fe=Math.max(1,...ue.map(T_)),ne=ue.reduce(R_,0);return h.jsxs("div",{className:"border-t border-border/50 px-3 py-2.5 text-xs space-y-2.5",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"font-medium text-foreground",children:n("chat.contextPanel.requestLabel")}),h.jsxs("span",{className:"text-muted-foreground tabular-nums",children:[he.activeTools??0," / ",he.tools??0," ",n("chat.contextPanel.toolsActive")]})]}),ue.length>0&&h.jsxs("div",{className:"space-y-1.5",children:[h.jsxs("div",{className:"text-muted-foreground",children:[n("chat.contextPanel.systemPromptLabel")," ",h.jsxs("span",{className:"tabular-nums",children:["~",Math.round(ne/4).toLocaleString()," ",n("chat.contextPanel.tokAbbrev")]})]}),ue.map((ce,de)=>{const le=ce.preview.match(/^<([a-z-]+)/i)?.[1]??`section ${de}`,re=ce.chars/fe*100,ge=Math.round(ce.chars/4);return h.jsxs("div",{className:"space-y-0.5",children:[h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsx("span",{className:"font-mono text-foreground truncate",children:le}),h.jsxs("span",{className:"text-muted-foreground tabular-nums shrink-0",children:["~",ge.toLocaleString()," ",n("chat.contextPanel.tokAbbrev")]})]}),h.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:h.jsx("div",{className:"h-full rounded-full bg-chart-3",style:{width:`${re}%`}})})]},de)})]})]})})(),h.jsx("pre",{className:"text-xs font-mono bg-muted px-3 py-2 overflow-auto whitespace-pre-wrap break-all border-t border-border/50 max-h-64",children:JSON.stringify(q,null,2)})]})]},q.id)})})]})}e[0]=l,e[1]=i,e[2]=r,e[3]=c,e[4]=s,e[5]=o?.id,e[6]=u,e[7]=d?.title,e[8]=n,e[9]=f,e[10]=p,e[11]=_,e[12]=g,e[13]=v,e[14]=b,e[15]=k,e[16]=w}else f=e[9],p=e[10],_=e[11],g=e[12],v=e[13],b=e[14],k=e[15],w=e[16];if(w!==Symbol.for("react.early_return_sentinel"))return w;let S;e[68]!==f||e[69]!==p||e[70]!==_||e[71]!==g||e[72]!==v?(S=h.jsxs("div",{className:f,children:[p,_,g,v]}),e[68]=f,e[69]=p,e[70]=_,e[71]=g,e[72]=v,e[73]=S):S=e[73];let m;return e[74]!==b||e[75]!==k||e[76]!==S?(m=h.jsxs("div",{className:b,children:[k,S]}),e[74]=b,e[75]=k,e[76]=S,e[77]=m):m=e[77],m}function R_(t,e){return t+e.chars}function T_(t){return t.chars}function A_(t,e){return h.jsx(P_,{part:t},e)}function D_(t){return(t.parts??[]).filter(N_)}function N_(t){return t.type==="tool-subtask"}function M_(t){return t.role!=="system"}function B_(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function L_(t){return t.role==="assistant"}function j_(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function I_(t){return t.role==="user"}function O_(t){return t.role==="assistant"&&t.metadata?.usage}function z_(t){const e=H.c(21),{onOpenContextPanel:s}=t,{org:i}=ut(),{selectedVirtualMcp:r}=$c();let n;e[0]!==i.id?(n=Bi(i.id),e[0]=i.id,e[1]=n):n=e[1];const a=r??n,l=us(a.id)??a,u=l.title??"Super Agent",d=l.icon??null,f=l.description??null;let p;e[2]!==d||e[3]!==u?(p=h.jsx(Ri,{icon:d,name:u,size:"lg"}),e[2]=d,e[3]=u,e[4]=p):p=e[4];let _;e[5]!==u?(_=h.jsx("h2",{className:"text-2xl font-semibold tracking-tight text-foreground",children:u}),e[5]=u,e[6]=_):_=e[6];let g;e[7]!==f?(g=f?h.jsx("p",{className:"text-sm text-muted-foreground max-w-md text-balance",children:f}):null,e[7]=f,e[8]=g):g=e[8];let v;e[9]!==_||e[10]!==g?(v=h.jsxs("div",{className:"space-y-1.5",children:[_,g]}),e[9]=_,e[10]=g,e[11]=v):v=e[11];let b;e[12]!==p||e[13]!==v?(b=h.jsxs("div",{className:"flex-1 min-h-0 flex flex-col items-center justify-center gap-4 px-6 text-center overflow-hidden",children:[p,v]}),e[12]=p,e[13]=v,e[14]=b):b=e[14];let k;e[15]===Symbol.for("react.memo_cache_sentinel")?(k=h.jsx(ht.IceBreakers,{className:"pb-3"}),e[15]=k):k=e[15];let w;e[16]!==s?(w=h.jsxs(ht.Footer,{children:[k,h.jsx(ht.Input,{onOpenContextPanel:s})]}),e[16]=s,e[17]=w):w=e[17];let S;return e[18]!==b||e[19]!==w?(S=h.jsxs(h.Fragment,{children:[b,w]}),e[18]=b,e[19]=w,e[20]=S):S=e[20],S}function Wa(t){const e=H.c(17),{outputs:s,collapsed:i,onToggle:r,variant:n}=t,o=n==="card"?"rounded-xl border border-border bg-muted/95 shadow-sm backdrop-blur-sm":"border-b border-border bg-background";let a;e[0]!==o?(a=_e(o),e[0]=o,e[1]=a):a=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx("span",{className:"text-sm font-medium text-foreground",children:"Files in this task"}),e[2]=c):c=e[2];const l=i&&"-rotate-90";let u;e[3]!==l?(u=_e("size-4 text-muted-foreground transition-transform",l),e[3]=l,e[4]=u):u=e[4];let d;e[5]!==u?(d=h.jsx($s,{className:u}),e[5]=u,e[6]=d):d=e[6];let f;e[7]!==r||e[8]!==d?(f=h.jsxs("button",{type:"button",onClick:r,className:"flex w-full items-center justify-between px-3 py-2.5 text-left",children:[c,d]}),e[7]=r,e[8]=d,e[9]=f):f=e[9];let p;e[10]!==i||e[11]!==s?(p=!i&&h.jsx("div",{className:"flex max-h-72 flex-col gap-1.5 overflow-y-auto px-2 pb-2",children:s.map($_)}),e[10]=i,e[11]=s,e[12]=p):p=e[12];let _;return e[13]!==a||e[14]!==f||e[15]!==p?(_=h.jsxs("div",{className:a,children:[f,p]}),e[13]=a,e[14]=f,e[15]=p,e[16]=_):_=e[16],_}function $_(t){return h.jsx(Lf,{file:t},t.key)}function F_(){const t=H.c(13),e=ds()?.taskId??null,s=If();let i;t[0]!==s?(i={enabled:s},t[0]=s,t[1]=i):i=t[1];const{data:r}=Of(e,i),[n,o]=O.useState(!1),[a,c]=O.useState(!0);if(!e||!r||r.length===0)return null;let l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=()=>o(W_),t[2]=l):l=t[2];let u;t[3]!==n||t[4]!==r?(u=h.jsx("div",{className:"absolute top-2 right-2 z-10 hidden w-72 @[1280px]:block",children:h.jsx(Wa,{variant:"card",outputs:r,collapsed:n,onToggle:l})}),t[3]=n,t[4]=r,t[5]=u):u=t[5];let d;t[6]===Symbol.for("react.memo_cache_sentinel")?(d=()=>c(H_),t[6]=d):d=t[6];let f;t[7]!==a||t[8]!==r?(f=h.jsx("div",{className:"shrink-0 @[1280px]:hidden",children:h.jsx(Wa,{variant:"bar",outputs:r,collapsed:a,onToggle:d})}),t[7]=a,t[8]=r,t[9]=f):f=t[9];let p;return t[10]!==u||t[11]!==f?(p=h.jsxs(h.Fragment,{children:[u,f]}),t[10]=u,t[11]=f,t[12]=p):p=t[12],p}function H_(t){return!t}function W_(t){return!t}function U_(){const t=H.c(31),{org:e}=ut(),s=ds(),{isChatEmpty:i}=Bo(),[r,n]=O.useState("chat"),o=zf(),a=b_(),{runtime:c}=ni(s?.virtualMcpId);if(a&&c!=="cms"){let T;return t[0]===Symbol.for("react.memo_cache_sentinel")?(T=h.jsx(ht,{className:"animate-in fade-in-0 duration-200",children:h.jsx(ht.Main,{className:"flex flex-col items-center",children:h.jsx(ht.EmptyState,{children:h.jsx(ht.NoAiProviderEmptyState,{})})})}),t[0]=T):T=t[0],T}let u;t[1]!==o.hasDecoKey||t[2]!==o.hasOnlyDecoProvider||t[3]!==o.isLoading||t[4]!==o.isZeroBalance||t[5]!==i||t[6]!==e?(u=o.hasDecoKey&&o.isZeroBalance&&o.hasOnlyDecoProvider&&!o.isLoading&&i&&!_f(e.id),t[1]=o.hasDecoKey,t[2]=o.hasOnlyDecoProvider,t[3]=o.isLoading,t[4]=o.isZeroBalance,t[5]=i,t[6]=e,t[7]=u):u=t[7];const d=u;let f;t[8]!==d?(f=d&&h.jsx(ht.CreditsEmptyState,{}),t[8]=d,t[9]=f):f=t[9];const p=r!=="chat"?!0:void 0,_=r!=="chat",g=r!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let v;t[10]!==g?(v=_e("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",g),t[10]=g,t[11]=v):v=t[11];let b;t[12]!==i||t[13]!==c?(b=i&&c!=="cms"?h.jsx(z_,{onOpenContextPanel:()=>n("context")}):h.jsxs(h.Fragment,{children:[h.jsxs(ht.Main,{className:"relative flex flex-col overflow-hidden @container",children:[h.jsx(F_,{}),h.jsx("div",{className:"min-h-0 flex-1",children:h.jsx(ht.Messages,{})})]}),h.jsx(ht.Footer,{children:h.jsx(ht.Input,{onOpenContextPanel:()=>n("context")})})]}),t[12]=i,t[13]=c,t[14]=b):b=t[14];let k;t[15]!==p||t[16]!==_||t[17]!==v||t[18]!==b?(k=h.jsx("div",{inert:p,"aria-hidden":_,className:v,children:b}),t[15]=p,t[16]=_,t[17]=v,t[18]=b,t[19]=k):k=t[19];const w=r!=="context"?!0:void 0,S=r!=="context",m=r==="context"?"opacity-100":"opacity-0 pointer-events-none";let x;t[20]!==m?(x=_e("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",m),t[20]=m,t[21]=x):x=t[21];let y;t[22]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(E_,{back:!0,onClose:()=>n("chat")}),t[22]=y):y=t[22];let C;t[23]!==x||t[24]!==w||t[25]!==S?(C=h.jsx("div",{inert:w,"aria-hidden":S,className:x,children:y}),t[23]=x,t[24]=w,t[25]=S,t[26]=C):C=t[26];let N;return t[27]!==f||t[28]!==C||t[29]!==k?(N=h.jsxs(ht,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[f,k,C]}),t[27]=f,t[28]=C,t[29]=k,t[30]=N):N=t[30],N}function Oh(){const t=H.c(7),e=be();let s;t[0]!==e?(s=e("agentShellLayout.agentShellLayout.chatLoadingError"),t[0]=e,t[1]=s):s=t[1];let i;t[2]!==s?(i=h.jsx("div",{role:"alert",className:"flex h-full flex-1 items-center justify-center text-sm text-muted-foreground",children:s}),t[2]=s,t[3]=i):i=t[3];let r;t[4]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(ls,{children:h.jsx(U_,{})}),t[4]=r):r=t[4];let n;return t[5]!==i?(n=h.jsx(Li,{fallback:i,children:r}),t[5]=i,t[6]=n):n=t[6],n}function K_(t){return(t??"").normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"user"}function ta(t){return t?.name||t?.email?.split("@")[0]||void 0}function ti(t){const e=K_(t),s=Date.now().toString(36).split("").reverse().join("");return`${e}-${s}`}function zh(t){return!!t.harness_id||!!t.title&&t.title!=="New chat"}function q_(t){return{threadId:t.routeThreadId,providerKey:t.routeThreadId??t.fallbackKey}}function V_(t){return t.sidePanelOpen||t.mainOpen?t:{...t,sidePanelOpen:!0}}function G_(t){const e=t.entityMetadata?.defaultMainView??null,s=e==null||e.type==="chat",i=t.mainPanelParam??(t.panelNamed||!!t.routeDefaultMain||!s),r=t.routeDefaultMain?!1:s||t.entityMetadata?.chatDefaultOpen===!0||t.threadHasMessages===!0,n=t.sidePanelParamPresent?t.sidePanelParamValue===!0:r;return V_({sidePanelOpen:n,mainOpen:i})}function Ua(t,e){switch(t.type){case"toggleSidePanel":return e.sidePanelOpen?e.mainOpen?{sidepanel:!1}:null:{sidepanel:!0};case"toggleMain":return e.mainOpen?{mainpanel:!1,sidepanel:!0}:{mainpanel:!0};case"openSidePanel":return e.sidePanelOpen?null:{sidepanel:!0}}}function Y_(t){return t.sidePanelOpen&&t.mainOpen?{side:33,main:67}:t.sidePanelOpen?{side:100,main:0}:t.mainOpen?{side:0,main:100}:{side:0,main:0}}function X_(t){const{sidePanelOpen:e,mainOpen:s}=t.visibility;return e&&(t.sidePanelParamPresent||!s)?"chat":s?"main":"chat"}function J_(t){return t==="main"?{sidepanel:!1,mainpanel:!0}:{sidepanel:!0,mainpanel:!1}}function Z_(t,e){const s=ji(),i=np(),r=Ii({strict:!1}),n=ri({strict:!1}),{create:o}=zo(),{threads:a}=Ir(),{virtualMcpId:c,isAgentRoute:l}=e,u=lp(),d=Ho(),f=$i(),p=O.useRef(crypto.randomUUID()),{threadId:_,providerKey:g}=q_({routeThreadId:f,fallbackKey:p.current}),v=_!=null?a.find(N=>N.id===_):void 0,{sidePanelOpen:b,mainOpen:k}=G_({entityMetadata:t,mainPanelParam:r.mainpanel,panelNamed:d!==void 0,sidePanelParamPresent:r.sidepanel!==void 0,sidePanelParamValue:r.sidepanel,routeDefaultMain:u,threadHasMessages:v?zh(v):!1}),w={sidePanelOpen:b,mainOpen:k},S=l&&n.taskId!==void 0?{virtualmcpid:c}:{},m=(N,T)=>{s({to:".",search:R=>({...R,...N}),replace:T?.replace??!1})},x=()=>{const N=Ua({type:"toggleMain"},w);N&&m(N,{replace:!0})},y=()=>{const N=Ua({type:"toggleSidePanel"},w);N&&m(N,{replace:!0})},C=async()=>{const N=crypto.randomUUID(),T=a.find(R=>R.id===_)?.branch??null;try{await o({id:N,virtual_mcp_id:c,...T?{branch:T}:{}})}catch{}i(N,()=>({...S}))};return{threadId:_,providerKey:g,sidePanelOpen:b,mainOpen:k,sidePanelParamPresent:r.sidepanel!==void 0,toggleMain:x,toggleSidePanel:y,createNewTask:C}}function Q_(t){const e=H.c(10),{org:s}=ut(),i=Kf(),{data:r}=hs.useSession(),n=r?.user?.id,o=t?.id??null,a=!!t&&!!n&&!!t.created_by&&t.created_by!==n;let c;e[0]!==s.id||e[1]!==o?(c=ks.viewedThreadMetadataRefresh(s.id,o??""),e[0]=s.id,e[1]=o,e[2]=c):c=e[2];const l=!!i&&!!o&&a;let u;e[3]!==i||e[4]!==o?(u=async()=>(await i?.refreshThreadMetadata(o??""),!0),e[3]=i,e[4]=o,e[5]=u):u=e[5];let d;e[6]!==c||e[7]!==l||e[8]!==u?(d={queryKey:c,enabled:l,staleTime:Number.POSITIVE_INFINITY,queryFn:u},e[6]=c,e[7]=l,e[8]=u,e[9]=d):d=e[9],es(d)}function em(t,e){return t.some(s=>s.branch===e.branch)?t:[...t,e]}function tm(t,e){return t.filter(s=>s.branch!==e)}function sm(t,e,s){return t.map(i=>i.branch===e?{...i,name:s}:i)}const Ka=["orange","violet","blue","pink","amber","teal"];function hr(t){return Ka[t%Ka.length]}function Bn(t,e){const s=`${e} `,i=t.reduce((r,n)=>{if(!n.name.startsWith(s))return r;const o=Number(n.name.slice(s.length));return Number.isInteger(o)&&o>r?o:r},0);return`${e} ${i+1}`}const im={orange:"bg-orange-500",violet:"bg-violet-500",blue:"bg-blue-500",pink:"bg-pink-500",amber:"bg-amber-500",teal:"bg-teal-500"};function en(t){return t&&im[t]||"bg-muted-foreground"}function Fr(t){const e=H.c(26),s=us(t),i=Nf(),{org:r}=ut(),n=Lc();let o;e[0]!==s?.metadata?.releases?(o=s?.metadata?.releases??[],e[0]=s?.metadata?.releases,e[1]=o):o=e[1];const a=o;let c;e[2]!==r||e[3]!==t?(c=m=>m[1]===r.id&&m[3]==="collection"&&m[4]==="VIRTUAL_MCP"&&m[5]===t,e[2]=r,e[3]=t,e[4]=c):c=e[4];const l=c;let u;e[5]!==l||e[6]!==n||e[7]!==a?(u=()=>{for(const[,m]of n.getQueriesData({predicate:x=>l(x.queryKey)}))if(m?.item)return m.item.metadata?.releases??[];return a},e[5]=l,e[6]=n,e[7]=a,e[8]=u):u=e[8];const d=u;let f;e[9]!==i||e[10]!==l||e[11]!==n||e[12]!==d||e[13]!==t?(f=m=>cp(`vm-releases:${t}`,async()=>{const x=d(),y=m(x);if(y!==x){n.setQueriesData({predicate:C=>l(C.queryKey)},C=>C?.item?{item:{...C.item,metadata:{...C.item.metadata,releases:y}}}:C);try{await i.update.mutateAsync({id:t,data:{metadata:{releases:y}}})}catch(C){const N=C;throw n.invalidateQueries({predicate:T=>l(T.queryKey)}),N}}}),e[9]=i,e[10]=l,e[11]=n,e[12]=d,e[13]=t,e[14]=f):f=e[14];const p=f;let _;e[15]!==p?(_=m=>p(x=>em(x,m)),e[15]=p,e[16]=_):_=e[16];const g=_;let v;e[17]!==p?(v=(m,x)=>p(y=>sm(y,m,x)),e[17]=p,e[18]=v):v=e[18];const b=v;let k;e[19]!==p?(k=m=>p(x=>tm(x,m)),e[19]=p,e[20]=k):k=e[20];const w=k;let S;return e[21]!==g||e[22]!==w||e[23]!==a||e[24]!==b?(S={releases:a,createRelease:g,renameRelease:b,deleteRelease:w},e[21]=g,e[22]=w,e[23]=a,e[24]=b,e[25]=S):S=e[25],S}function rm(t,e){const s=getComputedStyle(t),i=parseFloat(s.fontSize);return e*i}function nm(t,e){const s=getComputedStyle(t.ownerDocument.documentElement),i=parseFloat(s.fontSize);return e*i}function om(t){return t/100*window.innerHeight}function am(t){return t/100*window.innerWidth}function lm(t){switch(typeof t){case"number":return[t,"px"];case"string":{const e=parseFloat(t);return t.endsWith("%")?[e,"%"]:t.endsWith("px")?[e,"px"]:t.endsWith("rem")?[e,"rem"]:t.endsWith("em")?[e,"em"]:t.endsWith("vh")?[e,"vh"]:t.endsWith("vw")?[e,"vw"]:[e,"%"]}}}function mi({groupSize:t,panelElement:e,styleProp:s}){let i;const[r,n]=lm(s);switch(n){case"%":{i=r/100*t;break}case"px":{i=r;break}case"rem":{i=nm(e,r);break}case"em":{i=rm(e,r);break}case"vh":{i=om(r);break}case"vw":{i=am(r);break}}return i}function vt(t){return parseFloat(t.toFixed(3))}function si({group:t}){const{orientation:e,panels:s}=t;return s.reduce((i,r)=>(i+=e==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,i),0)}function Ln(t){const{panels:e}=t,s=si({group:t});return s===0?e.map(i=>({groupResizeBehavior:i.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:i.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:i.panelConstraints.disabled,minSize:0,maxSize:100,panelId:i.id})):e.map(i=>{const{element:r,panelConstraints:n}=i;let o=0;if(n.collapsedSize!==void 0){const u=mi({groupSize:s,panelElement:r,styleProp:n.collapsedSize});o=vt(u/s*100)}let a;if(n.defaultSize!==void 0){const u=mi({groupSize:s,panelElement:r,styleProp:n.defaultSize});a=vt(u/s*100)}let c=0;if(n.minSize!==void 0){const u=mi({groupSize:s,panelElement:r,styleProp:n.minSize});c=vt(u/s*100)}let l=100;if(n.maxSize!==void 0){const u=mi({groupSize:s,panelElement:r,styleProp:n.maxSize});l=vt(u/s*100)}return{groupResizeBehavior:n.groupResizeBehavior,collapsedSize:o,collapsible:n.collapsible===!0,defaultSize:a,disabled:n.disabled,minSize:c,maxSize:l,panelId:i.id}})}function De(t,e="Assertion error"){if(!t)throw Error(e)}function jn(t,e){return Array.from(e).sort(t==="horizontal"?cm:hm)}function cm(t,e){const s=t.element.offsetLeft-e.element.offsetLeft;return s!==0?s:t.element.offsetWidth-e.element.offsetWidth}function hm(t,e){const s=t.element.offsetTop-e.element.offsetTop;return s!==0?s:t.element.offsetHeight-e.element.offsetHeight}function $h(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.ELEMENT_NODE}function Fh(t,e){return{x:t.x>=e.left&&t.x<=e.right?0:Math.min(Math.abs(t.x-e.left),Math.abs(t.x-e.right)),y:t.y>=e.top&&t.y<=e.bottom?0:Math.min(Math.abs(t.y-e.top),Math.abs(t.y-e.bottom))}}function dm({orientation:t,rects:e,targetRect:s}){const i={x:s.x+s.width/2,y:s.y+s.height/2};let r,n=Number.MAX_VALUE;for(const o of e){const{x:a,y:c}=Fh(i,o),l=t==="horizontal"?a:c;l<n&&(n=l,r=o)}return De(r,"No rect found"),r}let Zi;function um(){return Zi===void 0&&(typeof matchMedia=="function"?Zi=!!matchMedia("(pointer:coarse)").matches:Zi=!1),Zi}function Hh(t){const{element:e,orientation:s,panels:i,separators:r}=t,n=jn(s,Array.from(e.children).filter($h).map(_=>({element:_}))).map(({element:_})=>_),o=[];let a=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let _=-1;for(const g of n)g.hasAttribute("data-panel")&&(_++,g.hasAttribute("data-disabled")||(d++,l===-1&&(l=_),u=_))}if(d>1){let _=-1;for(const g of n)if(g.hasAttribute("data-panel")){_++;const v=i.find(b=>b.element===g);if(v){if(f){const b=f.element.getBoundingClientRect(),k=g.getBoundingClientRect();let w;if(c){const S=s==="horizontal"?new DOMRect(b.right,b.top,0,b.height):new DOMRect(b.left,b.bottom,b.width,0),m=s==="horizontal"?new DOMRect(k.left,k.top,0,k.height):new DOMRect(k.left,k.top,k.width,0);switch(p.length){case 0:{w=[S,m];break}case 1:{const x=p[0],y=dm({orientation:s,rects:[b,k],targetRect:x.element.getBoundingClientRect()});w=[x,y===b?m:S];break}default:{w=p;break}}}else p.length?w=p:w=[s==="horizontal"?new DOMRect(b.right,k.top,k.left-b.right,k.height):new DOMRect(k.left,b.bottom,k.width,k.top-b.bottom)];for(const S of w){let m="width"in S?S:S.element.getBoundingClientRect();const x=um()?t.resizeTargetMinimumSize.coarse:t.resizeTargetMinimumSize.fine;if(m.width<x){const C=x-m.width;m=new DOMRect(m.x-C/2,m.y,m.width+C,m.height)}if(m.height<x){const C=x-m.height;m=new DOMRect(m.x,m.y-C/2,m.width,m.height+C)}const y=_<=l||_>u;!a&&!y&&o.push({group:t,groupSize:si({group:t}),panels:[f,v],separator:"width"in S?void 0:S,rect:m}),a=!1}}c=!1,f=v,p=[]}}else if(g.hasAttribute("data-separator")){g.ariaDisabled!==null&&(a=!0);const v=r.find(b=>b.element===g);v?p.push(v):(f=void 0,p=[])}else c=!0}return o}class Wh{#e={};addListener(e,s){const i=this.#e[e];return i===void 0?this.#e[e]=[s]:i.includes(s)||i.push(s),()=>{this.removeListener(e,s)}}emit(e,s){const i=this.#e[e];if(i!==void 0)if(i.length===1)i[0].call(null,s);else{let r=!1,n=null;const o=Array.from(i);for(let a=0;a<o.length;a++){const c=o[a];try{c.call(null,s)}catch(l){n===null&&(r=!0,n=l)}}if(r)throw n}}removeAllListeners(){this.#e={}}removeListener(e,s){const i=this.#e[e];if(i!==void 0){const r=i.indexOf(s);r>=0&&i.splice(r,1)}}}let Zs={cursorFlags:0,state:"inactive"};const sa=new Wh;function Ls(){return Zs}function fm(t){return sa.addListener("change",t)}function pm(t){const e=Zs,s={...Zs};s.cursorFlags=t,Zs=s,sa.emit("change",{prev:e,next:s})}function Qs(t){const e=Zs;Zs=t,sa.emit("change",{prev:e,next:t})}const _m=t=>t,tn=()=>{},Uh=1,Kh=2,qh=4,Vh=8,qa=3,Va=12;let Qi;function Ga(){return Qi===void 0&&(Qi=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Qi=!0)),Qi}function mm({cursorFlags:t,groups:e,state:s}){let i=0,r=0;switch(s){case"active":case"hover":e.forEach(n=>{if(!n.mutableState.disableCursor)switch(n.orientation){case"horizontal":{i++;break}case"vertical":{r++;break}}})}if(!(i===0&&r===0)){switch(s){case"active":{if(t&&Ga()){const n=(t&Uh)!==0,o=(t&Kh)!==0,a=(t&qh)!==0,c=(t&Vh)!==0;if(n)return a?"se-resize":c?"ne-resize":"e-resize";if(o)return a?"sw-resize":c?"nw-resize":"w-resize";if(a)return"s-resize";if(c)return"n-resize"}break}}return Ga()?i>0&&r>0?"move":i>0?"ew-resize":"ns-resize":i>0&&r>0?"grab":i>0?"col-resize":"row-resize"}}const Ya=new WeakMap;function ia(t){if(t.defaultView===null||t.defaultView===void 0)return;let{prevStyle:e,styleSheet:s}=Ya.get(t)??{};s===void 0&&(s=new t.defaultView.CSSStyleSheet,t.adoptedStyleSheets&&(Object.isExtensible(t.adoptedStyleSheets)?t.adoptedStyleSheets.push(s):t.adoptedStyleSheets=[...t.adoptedStyleSheets,s]));const i=Ls();switch(i.state){case"active":case"hover":{const r=mm({cursorFlags:i.cursorFlags,groups:i.hitRegions.map(o=>o.group),state:i.state}),n=`*, *:hover {cursor: ${r} !important; }`;if(e===n)return;e=n,r?s.cssRules.length===0?s.insertRule(n):s.replaceSync(n):s.cssRules.length===1&&s.deleteRule(0);break}case"inactive":{e=void 0,s.cssRules.length===1&&s.deleteRule(0);break}}Ya.set(t,{prevStyle:e,styleSheet:s})}let Xt=new Map;const Gh=new Wh;function gm(t){Xt=new Map(Xt),Xt.delete(t)}function Xa(t,e){for(const[s]of Xt)if(s.id===t)return s}function xs(t,e){for(const[s,i]of Xt)if(s.id===t)return i;if(e)throw Error(`Could not find data for Group with id ${t}`)}function Fs(){return Xt}function ra(t,e){return Gh.addListener("groupChange",s=>{s.group.id===t&&e(s)})}function cs(t,e,s){const i=Xt.get(t);Xt=new Map(Xt),Xt.set(t,e),Gh.emit("groupChange",{group:t,isUserInteraction:s?.isUserInteraction===!0,prev:i,next:e})}function Yh(t){const e=Ls();let s=!1;return e.state==="active"&&(Qs({cursorFlags:0,state:"inactive"}),e.hitRegions.length>0&&(ia(t),s=!0,e.hitRegions.forEach(i=>{const r=xs(i.group.id,!0);cs(i.group,r,{isUserInteraction:!0})}))),s}function Ja(t){t.defaultPrevented||Yh(t.currentTarget)}function vm(t,e,s){let i,r={x:1/0,y:1/0};for(const n of e){const o=Fh(s,n.rect);switch(t){case"horizontal":{o.x<=r.x&&(i=n,r=o);break}case"vertical":{o.y<=r.y&&(i=n,r=o);break}}}return i?{distance:r,hitRegion:i}:void 0}function bm(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Sm(t,e){if(t===e)throw new Error("Cannot compare node with itself");const s={a:el(t),b:el(e)};let i;for(;s.a.at(-1)===s.b.at(-1);)i=s.a.pop(),s.b.pop();De(i,"Stacking order can only be calculated for elements with a common ancestor");const r={a:Qa(Za(s.a)),b:Qa(Za(s.b))};if(r.a===r.b){const n=i.childNodes,o={a:s.a.at(-1),b:s.b.at(-1)};let a=n.length;for(;a--;){const c=n[a];if(c===o.a)return 1;if(c===o.b)return-1}}return Math.sign(r.a-r.b)}const ym=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function xm(t){const e=getComputedStyle(Xh(t)??t).display;return e==="flex"||e==="inline-flex"}function wm(t){const e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||xm(t))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||ym.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function Za(t){let e=t.length;for(;e--;){const s=t[e];if(De(s,"Missing node"),wm(s))return s}return null}function Qa(t){return t&&Number(getComputedStyle(t).zIndex)||0}function el(t){const e=[];for(;t;)e.push(t),t=Xh(t);return e}function Xh(t){const{parentNode:e}=t;return bm(e)?e.host:e}function Cm(t,e){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y}function km({groupElement:t,hitRegion:e,pointerEventTarget:s}){if(!$h(s)||s.contains(t)||t.contains(s))return!0;if(Sm(s,t)>0){let i=s;for(;i;){if(i.contains(t))return!0;if(Cm(i.getBoundingClientRect(),e))return!1;i=i.parentElement}}return!0}function na(t,e){const s=[];return e.forEach((i,r)=>{if(r.disabled)return;const n=Hh(r),o=vm(r.orientation,n,{x:t.clientX,y:t.clientY});o&&o.distance.x<=0&&o.distance.y<=0&&km({groupElement:r.element,hitRegion:o.hitRegion.rect,pointerEventTarget:t.target})&&s.push(o.hitRegion)}),s}function Pm(t,e){if(t.length!==e.length)return!1;for(let s=0;s<t.length;s++)if(t[s]!=e[s])return!1;return!0}function pt(t,e,s=0){return Math.abs(vt(t)-vt(e))<=s}function Yt(t,e){return pt(t,e)?0:t>e?1:-1}function Xs({overrideDisabledPanels:t,panelConstraints:e,prevSize:s,size:i}){const{collapsedSize:r=0,collapsible:n,disabled:o,maxSize:a=100,minSize:c=0}=e;if(o&&!t)return s;if(Yt(i,c)<0)if(n){const l=(r+c)/2;Yt(i,l)<0?i=r:i=c}else i=c;return i=Math.min(a,i),i=vt(i),i}function Ti({delta:t,initialLayout:e,panelConstraints:s,pivotIndices:i,prevLayout:r,trigger:n}){if(pt(t,0))return e;const o=n==="imperative-api",a=Object.values(e),c=Object.values(r),l=[...a],[u,d]=i;De(u!=null,"Invalid first pivot index"),De(d!=null,"Invalid second pivot index");let f=0;switch(n){case"keyboard":{{const g=t<0?d:u,v=s[g];De(v,`Panel constraints not found for index ${g}`);const{collapsedSize:b=0,collapsible:k,minSize:w=0}=v;if(k){const S=a[g];if(De(S!=null,`Previous layout not found for panel index ${g}`),pt(S,b)){const m=w-S;Yt(m,Math.abs(t))>0&&(t=t<0?0-m:m)}}}{const g=t<0?u:d,v=s[g];De(v,`No panel constraints found for index ${g}`);const{collapsedSize:b=0,collapsible:k,minSize:w=0}=v;if(k){const S=a[g];if(De(S!=null,`Previous layout not found for panel index ${g}`),pt(S,w)){const m=S-b;Yt(m,Math.abs(t))>0&&(t=t<0?0-m:m)}}}break}default:{const g=t<0?d:u,v=s[g];De(v,`Panel constraints not found for index ${g}`);const b=a[g],{collapsible:k,collapsedSize:w,minSize:S}=v;if(k&&Yt(b,S)<0)if(t>0){const m=S-w,x=m/2,y=b+t;Yt(y,S)<0&&(t=Yt(t,x)<=0?0:m)}else{const m=S-w,x=100-m/2,y=b-t;Yt(y,S)<0&&(t=Yt(100+t,x)>0?0:-m)}break}}{const g=t<0?1:-1;let v=t<0?d:u,b=0;for(;;){const w=a[v];De(w!=null,`Previous layout not found for panel index ${v}`);const S=Xs({overrideDisabledPanels:o,panelConstraints:s[v],prevSize:w,size:100})-w;if(b+=S,v+=g,v<0||v>=s.length)break}const k=Math.min(Math.abs(t),Math.abs(b));t=t<0?0-k:k}{let g=t<0?u:d;for(;g>=0&&g<s.length;){const v=Math.abs(t)-Math.abs(f),b=a[g];De(b!=null,`Previous layout not found for panel index ${g}`);const k=b-v,w=Xs({overrideDisabledPanels:o,panelConstraints:s[g],prevSize:b,size:k});if(!pt(b,w)&&(f+=b-w,l[g]=w,f.toFixed(3).localeCompare(Math.abs(t).toFixed(3),void 0,{numeric:!0})>=0))break;t<0?g--:g++}}if(Pm(c,l))return r;{const g=t<0?d:u,v=a[g];De(v!=null,`Previous layout not found for panel index ${g}`);const b=v+f,k=Xs({overrideDisabledPanels:o,panelConstraints:s[g],prevSize:v,size:b});if(l[g]=k,!pt(k,b)){let w=b-k,S=t<0?d:u;for(;S>=0&&S<s.length;){const m=l[S];De(m!=null,`Previous layout not found for panel index ${S}`);const x=m+w,y=Xs({overrideDisabledPanels:o,panelConstraints:s[S],prevSize:m,size:x});if(pt(m,y)||(w-=y-m,l[S]=y),pt(w,0))break;t>0?S--:S++}}}const p=Object.values(l).reduce((g,v)=>v+g,0);if(!pt(p,100,.1))return r;const _=Object.keys(r);return l.reduce((g,v,b)=>(g[_[b]]=v,g),{})}function js(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(e[s]===void 0||Yt(t[s],e[s])!==0)return!1;return!0}function Is({layout:t,panelConstraints:e}){const s=Object.values(t),i=[...s],r=i.reduce((a,c)=>a+c,0);if(i.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${i.map(a=>`${a}%`).join(", ")}`);if(!pt(r,100)&&i.length>0)for(let a=0;a<e.length;a++){const c=i[a];De(c!=null,`No layout data found for index ${a}`);const l=100/r*c;i[a]=l}let n=0;for(let a=0;a<e.length;a++){const c=s[a];De(c!=null,`No layout data found for index ${a}`);const l=i[a];De(l!=null,`No layout data found for index ${a}`);const u=Xs({overrideDisabledPanels:!0,panelConstraints:e[a],prevSize:c,size:l});l!=u&&(n+=l-u,i[a]=u)}if(!pt(n,0))for(let a=0;a<e.length;a++){const c=i[a];De(c!=null,`No layout data found for index ${a}`);const l=c+n,u=Xs({overrideDisabledPanels:!0,panelConstraints:e[a],prevSize:c,size:l});if(c!==u&&(n-=u-c,i[a]=u,pt(n,0)))break}const o=Object.keys(t);return i.reduce((a,c,l)=>(a[o[l]]=c,a),{})}function Jh({groupId:t,panelId:e}){const s=()=>{const c=Fs();for(const[l,{defaultLayoutDeferred:u,derivedPanelConstraints:d,layout:f,groupSize:p,separatorToPanels:_}]of c)if(l.id===t)return{defaultLayoutDeferred:u,derivedPanelConstraints:d,group:l,groupSize:p,layout:f,separatorToPanels:_};throw Error(`Group ${t} not found`)},i=()=>{const c=s().derivedPanelConstraints.find(l=>l.panelId===e);if(c!==void 0)return c;throw Error(`Panel constraints not found for Panel ${e}`)},r=()=>{const c=s().group.panels.find(l=>l.id===e);if(c!==void 0)return c;throw Error(`Layout not found for Panel ${e}`)},n=()=>{const c=s().layout[e];if(c!==void 0)return c;throw Error(`Layout not found for Panel ${e}`)},o=({nextSize:c,panels:l,prevLayout:u,derivedPanelConstraints:d})=>{const f=n(),p=l.findIndex(v=>v.id===e),_=p===0,g=p===l.length-1;if(g&&c<f&&(_||l.slice(0,p).every((v,b)=>{const k=d[b];return k?.collapsible&&pt(k.collapsedSize,u[k.panelId])}))){const v=l.slice(0,p).reduce((b,k)=>b+u[k.id],0);return{...u,[e]:vt(100-v)}}return Ti({delta:g?f-c:c-f,initialLayout:u,panelConstraints:d,pivotIndices:g?[p-1,p]:[p,p+1],prevLayout:u,trigger:"imperative-api"})},a=c=>{const l=n();if(c===l)return;const{defaultLayoutDeferred:u,derivedPanelConstraints:d,group:f,groupSize:p,layout:_,separatorToPanels:g}=s(),v=o({nextSize:c,panels:f.panels,prevLayout:_,derivedPanelConstraints:d}),b=Is({layout:v,panelConstraints:d});js(_,b)||cs(f,{defaultLayoutDeferred:u,derivedPanelConstraints:d,groupSize:p,layout:b,separatorToPanels:g})};return{collapse:()=>{const{collapsible:c,collapsedSize:l}=i(),{mutableValues:u}=r(),d=n();c&&d!==l&&(u.expandToSize=d,a(l))},expand:()=>{const{collapsible:c,collapsedSize:l,minSize:u}=i(),{mutableValues:d}=r(),f=n();if(c&&f===l){let p=d.expandToSize??u;p===0&&(p=1),a(p)}},getSize:()=>{const{group:c}=s(),l=n(),{element:u}=r(),d=c.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:l,inPixels:d}},isCollapsed:()=>{const{collapsible:c,collapsedSize:l}=i(),u=n();return c&&pt(l,u)},resize:c=>{const{group:l}=s(),{element:u}=r(),d=si({group:l}),f=mi({groupSize:d,panelElement:u,styleProp:c}),p=vt(f/d*100);a(p)}}}function tl(t){if(t.defaultPrevented)return;const e=Fs();na(t,e).forEach(s=>{if(s.separator&&!s.separator.disableDoubleClick){const i=s.panels.find(r=>r.panelConstraints.defaultSize!==void 0);if(i){const r=i.panelConstraints.defaultSize,n=Jh({groupId:s.group.id,panelId:i.id});n&&r!==void 0&&(n.resize(r),t.preventDefault())}}})}function dr(t){const e=Fs();for(const[s]of e)if(s.separators.some(i=>i.element===t))return s;throw Error("Could not find parent Group for separator element")}function Zh({groupId:t}){const e=()=>{const s=Fs();for(const[i,r]of s)if(i.id===t)return{group:i,...r};throw Error(`Could not find Group with id "${t}"`)};return{getLayout(){const{defaultLayoutDeferred:s,layout:i}=e();return s?{}:i},setLayout(s){const{defaultLayoutDeferred:i,derivedPanelConstraints:r,group:n,groupSize:o,layout:a,separatorToPanels:c}=e(),l=Is({layout:s,panelConstraints:r});return i?a:(js(a,l)||cs(n,{defaultLayoutDeferred:i,derivedPanelConstraints:r,groupSize:o,layout:l,separatorToPanels:c}),l)}}}function Rs(t,e){const s=dr(t),i=xs(s.id,!0),r=s.separators.find(u=>u.element===t);De(r,"Matching separator not found");const n=i.separatorToPanels.get(r);De(n,"Matching panels not found");const o=n.map(u=>s.panels.indexOf(u)),a=Zh({groupId:s.id}).getLayout(),c=Ti({delta:e,initialLayout:a,panelConstraints:i.derivedPanelConstraints,pivotIndices:o,prevLayout:a,trigger:"keyboard"}),l=Is({layout:c,panelConstraints:i.derivedPanelConstraints});js(a,l)||cs(s,{defaultLayoutDeferred:i.defaultLayoutDeferred,derivedPanelConstraints:i.derivedPanelConstraints,groupSize:i.groupSize,layout:l,separatorToPanels:i.separatorToPanels},{isUserInteraction:!0})}function sl(t){if(t.defaultPrevented)return;const e=t.currentTarget,s=dr(e);if(!s.disabled)switch(t.key){case"ArrowDown":{t.preventDefault(),s.orientation==="vertical"&&Rs(e,5);break}case"ArrowLeft":{t.preventDefault(),s.orientation==="horizontal"&&Rs(e,-5);break}case"ArrowRight":{t.preventDefault(),s.orientation==="horizontal"&&Rs(e,5);break}case"ArrowUp":{t.preventDefault(),s.orientation==="vertical"&&Rs(e,-5);break}case"End":{t.preventDefault(),Rs(e,100);break}case"Enter":{t.preventDefault();const i=dr(e),r=xs(i.id,!0),{derivedPanelConstraints:n,layout:o,separatorToPanels:a}=r,c=i.separators.find(f=>f.element===e);De(c,"Matching separator not found");const l=a.get(c);De(l,"Matching panels not found");const u=l[0],d=n.find(f=>f.panelId===u.id);if(De(d,"Panel metadata not found"),d.collapsible){const f=o[u.id],p=d.collapsedSize===f?i.mutableState.expandedPanelSizes[u.id]??d.minSize:d.collapsedSize;Rs(e,p-f)}break}case"F6":{t.preventDefault();const i=dr(e).separators.map(o=>o.element),r=Array.from(i).findIndex(o=>o===t.currentTarget);De(r!==null,"Index not found");const n=t.shiftKey?r>0?r-1:i.length-1:r+1<i.length?r+1:0;i[n].focus({preventScroll:!0});break}case"Home":{t.preventDefault(),Rs(e,-100);break}}}function il(t){if(t.defaultPrevented||t.pointerType==="mouse"&&t.button>0)return;const e=Fs(),s=na(t,e),i=new Map;let r=!1;s.forEach(n=>{n.separator&&(r||(r=!0,n.separator.element.focus({focusVisible:!1,preventScroll:!0})));const o=e.get(n.group);o&&i.set(n.group,o.layout)}),Qs({cursorFlags:0,hitRegions:s,initialLayoutMap:i,pointerDownAtPoint:{x:t.clientX,y:t.clientY},state:"active"}),s.length&&t.preventDefault()}function Qh({document:t,event:e,hitRegions:s,initialLayoutMap:i,mountedGroups:r,pointerDownAtPoint:n,prevCursorFlags:o}){let a=0;s.forEach(l=>{const{group:u,groupSize:d}=l,{orientation:f,panels:p}=u,{disableCursor:_}=u.mutableState;let g=0;n?f==="horizontal"?g=(e.clientX-n.x)/d*100:g=(e.clientY-n.y)/d*100:f==="horizontal"?g=e.clientX<0?-100:100:g=e.clientY<0?-100:100;const v=i.get(u),b=r.get(u);if(!v||!b)return;const{defaultLayoutDeferred:k,derivedPanelConstraints:w,groupSize:S,layout:m,separatorToPanels:x}=b;if(w&&m&&x){const y=Ti({delta:g,initialLayout:v,panelConstraints:w,pivotIndices:l.panels.map(C=>p.indexOf(C)),prevLayout:m,trigger:"mouse-or-touch"});if(js(y,m)){if(g!==0&&!_)switch(f){case"horizontal":{a|=g<0?Uh:Kh;break}case"vertical":{a|=g<0?qh:Vh;break}}}else cs(l.group,{defaultLayoutDeferred:k,derivedPanelConstraints:w,groupSize:S,layout:y,separatorToPanels:x})}});let c=0;e.movementX===0?c|=o&qa:c|=a&qa,e.movementY===0?c|=o&Va:c|=a&Va,pm(c),ia(t)}function rl(t){const e=Fs(),s=Ls();s.state==="active"&&Qh({document:t.currentTarget,event:t,hitRegions:s.hitRegions,initialLayoutMap:s.initialLayoutMap,mountedGroups:e,prevCursorFlags:s.cursorFlags})}function nl(t){if(t.defaultPrevented)return;const e=Ls(),s=Fs();switch(e.state){case"active":{if(t.buttons===0){Qs({cursorFlags:0,state:"inactive"}),e.hitRegions.forEach(i=>{const r=xs(i.group.id,!0);cs(i.group,r,{isUserInteraction:!0})});return}for(const i of e.hitRegions)if(i.separator){const{element:r}=i.separator;r.hasPointerCapture?.(t.pointerId)||r.setPointerCapture?.(t.pointerId)}Qh({document:t.currentTarget,event:t,hitRegions:e.hitRegions,initialLayoutMap:e.initialLayoutMap,mountedGroups:s,pointerDownAtPoint:e.pointerDownAtPoint,prevCursorFlags:e.cursorFlags});break}default:{const i=na(t,s);i.length===0?e.state!=="inactive"&&Qs({cursorFlags:0,state:"inactive"}):Qs({cursorFlags:0,hitRegions:i,state:"hover"}),ia(t.currentTarget);break}}}function ol(t){t.relatedTarget instanceof HTMLIFrameElement&&Ls().state==="hover"&&Qs({cursorFlags:0,state:"inactive"})}function al(t){t.defaultPrevented||t.pointerType==="mouse"&&t.button>0||Yh(t.currentTarget)&&t.preventDefault()}function ll(t){let e=0,s=0;const i={};for(const n of t)if(n.defaultSize!==void 0){e++;const o=vt(n.defaultSize);s+=o,i[n.panelId]=o}else i[n.panelId]=void 0;const r=t.length-e;if(r!==0){const n=vt((100-s)/r);for(const o of t)o.defaultSize===void 0&&(i[o.panelId]=n)}return i}function Em(t,e,s){if(!s[0])return;const i=t.panels.find(c=>c.element===e);if(!i||!i.onResize)return;const r=si({group:t}),n=t.orientation==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,o=i.mutableValues.prevSize,a={asPercentage:vt(n/r*100),inPixels:n};i.mutableValues.prevSize=a,i.onResize(a,i.id,o)}function Rm(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(t[s]!==e[s])return!1;return!0}function Tm({group:t,nextGroupSize:e,prevGroupSize:s,prevLayout:i}){if(s<=0||e<=0||s===e)return i;let r=0,n=0,o=!1;const a=new Map,c=[];for(const d of t.panels){const f=i[d.id]??0;if(d.panelConstraints.groupResizeBehavior==="preserve-pixel-size"){o=!0;const p=f/100*s,_=vt(p/e*100);a.set(d.id,_),r+=_}else c.push(d.id),n+=f}if(!o||c.length===0)return i;const l=100-r,u={...i};if(a.forEach((d,f)=>{u[f]=d}),n>0)for(const d of c){const f=i[d]??0;u[d]=vt(f/n*l)}else{const d=vt(l/c.length);for(const f of c)u[f]=d}return u}function Am(t,e){const s=t.map(r=>r.id),i=Object.keys(e);if(s.length!==i.length)return!1;for(const r of s)if(!i.includes(r))return!1;return!0}const Ks=new Map;function Dm(t){let e=!0;De(t.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const s=t.element.ownerDocument.defaultView.ResizeObserver,i=new Set,r=new Set,n=new s(_=>{for(const g of _){const{borderBoxSize:v,target:b}=g;if(b===t.element){if(e){const k=si({group:t});if(k===0)return;const w=xs(t.id);if(!w)return;const S=Ln(t),m=w.defaultLayoutDeferred?ll(S):w.layout,x=Tm({group:t,nextGroupSize:k,prevGroupSize:w.groupSize,prevLayout:m}),y=Is({layout:x,panelConstraints:S});if(!w.defaultLayoutDeferred&&js(w.layout,y)&&Rm(w.derivedPanelConstraints,S)&&w.groupSize===k)return;cs(t,{defaultLayoutDeferred:!1,derivedPanelConstraints:S,groupSize:k,layout:y,separatorToPanels:w.separatorToPanels})}}else Em(t,b,v)}});n.observe(t.element),t.panels.forEach(_=>{De(!i.has(_.id),`Panel ids must be unique; id "${_.id}" was used more than once`),i.add(_.id),_.onResize&&n.observe(_.element)});const o=si({group:t}),a=Ln(t),c=t.panels.map(({id:_})=>_).join(",");let l=t.mutableState.defaultLayout;l&&(Am(t.panels,l)||(l=void 0));const u=t.mutableState.layouts[c]??l??ll(a),d=Is({layout:u,panelConstraints:a}),f=t.element.ownerDocument;Ks.set(f,(Ks.get(f)??0)+1);const p=new Map;return Hh(t).forEach(_=>{_.separator&&p.set(_.separator,_.panels)}),cs(t,{defaultLayoutDeferred:o===0,derivedPanelConstraints:a,groupSize:o,layout:d,separatorToPanels:p}),t.separators.forEach(_=>{De(!r.has(_.id),`Separator ids must be unique; id "${_.id}" was used more than once`),r.add(_.id),_.element.addEventListener("keydown",sl)}),Ks.get(f)===1&&(f.addEventListener("contextmenu",Ja,!0),f.addEventListener("dblclick",tl,!0),f.addEventListener("pointerdown",il,!0),f.addEventListener("pointerleave",rl),f.addEventListener("pointermove",nl),f.addEventListener("pointerout",ol),f.addEventListener("pointerup",al,!0)),function(){e=!1,Ks.set(f,Math.max(0,(Ks.get(f)??0)-1)),gm(t),t.separators.forEach(_=>{_.element.removeEventListener("keydown",sl)}),Ks.get(f)||(f.removeEventListener("contextmenu",Ja,!0),f.removeEventListener("dblclick",tl,!0),f.removeEventListener("pointerdown",il,!0),f.removeEventListener("pointerleave",rl),f.removeEventListener("pointermove",nl),f.removeEventListener("pointerout",ol),f.removeEventListener("pointerup",al,!0)),n.disconnect()}}function Nm(){const[t,e]=O.useState({}),s=O.useCallback(()=>e({}),[]);return[t,s]}function oa(t){const e=O.useId();return`${t??e}`}const Hs=typeof window<"u"?O.useLayoutEffect:O.useEffect;function Ci(t){const e=O.useRef(t);return Hs(()=>{e.current=t},[t]),O.useCallback((...s)=>e.current?.(...s),[e])}function aa(...t){return Ci(e=>{t.forEach(s=>{if(s)switch(typeof s){case"function":{s(e);break}case"object":{s.current=e;break}}})})}function la(t){const e=O.useRef({...t});return Hs(()=>{for(const s in t)e.current[s]=t[s]},[t]),e.current}const ed=O.createContext(null);function Mm(t,e){const s=O.useRef({getLayout:()=>({}),setLayout:_m});O.useImperativeHandle(e,()=>s.current,[]),Hs(()=>{Object.assign(s.current,Zh({groupId:t}))})}function td({children:t,className:e,defaultLayout:s,disableCursor:i,disabled:r,elementRef:n,groupRef:o,id:a,onLayoutChange:c,onLayoutChanged:l,orientation:u="horizontal",resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){const _=O.useRef({onLayoutChange:{},onLayoutChanged:{}}),g=Ci(R=>{js(_.current.onLayoutChange,R)||(_.current.onLayoutChange=R,c?.(R))}),v=Ci((R,E)=>{js(_.current.onLayoutChanged,R)||(_.current.onLayoutChanged=R,l?.(R,{isUserInteraction:E}))}),b=oa(a),k=O.useRef(null),[w,S]=Nm(),m=O.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),x=aa(k,n);Mm(b,o);const y=Ci((R,E)=>{const P=Ls(),A=Xa(R),M=xs(R);if(M){let L=!1;return P.state==="active"&&(L=P.hitRegions.some(B=>B.group===A)),{flexGrow:M.layout[E]??1,pointerEvents:L?"none":void 0}}if(s?.[E])return{flexGrow:s?.[E]}}),C=la({defaultLayout:s,disableCursor:i}),N=O.useMemo(()=>({get disableCursor(){return!!C.disableCursor},getPanelStyles:y,id:b,orientation:u,registerPanel:R=>{const E=m.current;return E.panels=jn(u,[...E.panels,R]),S(),()=>{E.panels=E.panels.filter(P=>P!==R),S()}},registerSeparator:R=>{const E=m.current;return E.separators=jn(u,[...E.separators,R]),S(),()=>{E.separators=E.separators.filter(P=>P!==R),S()}},updatePanelProps:(R,{disabled:E})=>{const P=m.current.panels.find(L=>L.id===R);P&&(P.panelConstraints.disabled=E);const A=Xa(b),M=xs(b);A&&M&&cs(A,{...M,derivedPanelConstraints:Ln(A)})},updateSeparatorProps:(R,{disabled:E,disableDoubleClick:P})=>{const A=m.current.separators.find(M=>M.id===R);A&&(A.disabled=E,A.disableDoubleClick=P)}}),[y,b,S,u,C]),T=O.useRef(null);return Hs(()=>{const R=k.current;if(R===null)return;const E=m.current;let P;if(C.defaultLayout!==void 0&&Object.keys(C.defaultLayout).length===E.panels.length){P={};for(const K of E.panels){const z=C.defaultLayout[K.id];z!==void 0&&(P[K.id]=z)}}const A={disabled:!!r,element:R,id:b,mutableState:{defaultLayout:P,disableCursor:!!C.disableCursor,expandedPanelSizes:m.current.lastExpandedPanelSizes,layouts:m.current.layouts},orientation:u,panels:E.panels,resizeTargetMinimumSize:E.resizeTargetMinimumSize,separators:E.separators};T.current=A;const M=Dm(A),{defaultLayoutDeferred:L,derivedPanelConstraints:B,layout:D}=xs(A.id,!0);!L&&B.length>0&&(g(D),v(D,!1));const j=ra(b,K=>{const{defaultLayoutDeferred:z,derivedPanelConstraints:G,layout:I}=K.next;if(z||G.length===0)return;const V=A.panels.map(({id:ee})=>ee).join(",");A.mutableState.layouts[V]=I,G.forEach(ee=>{if(ee.collapsible){const{layout:se}=K.prev??{};if(se){const ie=pt(ee.collapsedSize,I[ee.panelId]),Y=pt(ee.collapsedSize,se[ee.panelId]);ie&&!Y&&(A.mutableState.expandedPanelSizes[ee.panelId]=se[ee.panelId])}}});const $=Ls().state!=="active";g(I),$&&v(I,K.isUserInteraction)});return()=>{T.current=null,M(),j()}},[r,b,v,g,u,w,C]),O.useEffect(()=>{const R=T.current;R&&(R.mutableState.defaultLayout=s,R.mutableState.disableCursor=!!i)}),h.jsx(ed.Provider,{value:N,children:h.jsx("div",{...p,className:e,"data-group":!0,"data-testid":b,id:b,ref:x,style:{height:"100%",width:"100%",overflow:"hidden",...f,display:"flex",flexDirection:u==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:u==="horizontal"?"pan-y":"pan-x"},children:t})})}td.displayName="Group";function ca(){const t=O.useContext(ed);return De(t,"Group Context not found; did you render a Panel or Separator outside of a Group?"),t}function Bm(t,e){const{id:s}=ca(),i=O.useRef({collapse:tn,expand:tn,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:tn});O.useImperativeHandle(e,()=>i.current,[]),Hs(()=>{Object.assign(i.current,Jh({groupId:s,panelId:t}))})}function sd({children:t,className:e,collapsedSize:s="0%",collapsible:i=!1,defaultSize:r,disabled:n,elementRef:o,groupResizeBehavior:a="preserve-relative-size",id:c,maxSize:l="100%",minSize:u="0%",onResize:d,panelRef:f,style:p,..._}){const g=!!c,v=oa(c),b=la({disabled:n}),k=O.useRef(null),w=aa(k,o),{getPanelStyles:S,id:m,orientation:x,registerPanel:y,updatePanelProps:C}=ca(),N=d!==null,T=Ci((A,M,L)=>{d?.(A,c,L)});Hs(()=>{const A=k.current;if(A!==null){const M={element:A,id:v,idIsStable:g,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:N?T:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:s,collapsible:i,defaultSize:r,disabled:b.disabled,maxSize:l,minSize:u}};return y(M)}},[a,s,i,r,N,v,g,l,u,T,y,b]),O.useEffect(()=>{C(v,{disabled:n})},[n,v,C]),Bm(v,f);const R=()=>{const A=S(m,v);if(A)return JSON.stringify(A)},E=O.useSyncExternalStore(A=>ra(m,A),R,R);let P;return E?P=JSON.parse(E):r!==void 0?P={flexGrow:void 0,flexShrink:void 0,flexBasis:r}:P={flexGrow:1},h.jsx("div",{..._,"data-disabled":n||void 0,"data-panel":!0,"data-testid":v,id:v,ref:w,style:{...Lm,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...P},children:h.jsx("div",{className:e,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...p,touchAction:x==="horizontal"?"pan-y":"pan-x"},children:t})})}sd.displayName="Panel";const Lm={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function jm({layout:t,panelConstraints:e,panelId:s,panelIndex:i}){let r,n;const o=t[s],a=e.find(c=>c.panelId===s);if(a){const c=a.maxSize,l=a.collapsible?a.collapsedSize:a.minSize,u=[i,i+1];n=Is({layout:Ti({delta:l-o,initialLayout:t,panelConstraints:e,pivotIndices:u,prevLayout:t}),panelConstraints:e})[s],r=Is({layout:Ti({delta:c-o,initialLayout:t,panelConstraints:e,pivotIndices:u,prevLayout:t}),panelConstraints:e})[s]}return{valueControls:s,valueMax:r,valueMin:n,valueNow:o}}function id({children:t,className:e,disabled:s,disableDoubleClick:i,elementRef:r,id:n,style:o,...a}){const c=oa(n),l=la({disabled:s,disableDoubleClick:i}),[u,d]=O.useState({}),[f,p]=O.useState("inactive"),[_,g]=O.useState(!1),v=O.useRef(null),b=aa(v,r),{disableCursor:k,id:w,orientation:S,registerSeparator:m,updateSeparatorProps:x}=ca(),y=S==="horizontal"?"vertical":"horizontal";Hs(()=>{const T=v.current;if(T!==null){const R={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:T,id:c},E=m(R),P=fm(M=>{p(M.next.state!=="inactive"&&M.next.hitRegions.some(L=>L.separator===R)?M.next.state:"inactive")}),A=ra(w,M=>{const{derivedPanelConstraints:L,layout:B,separatorToPanels:D}=M.next,j=D.get(R);if(j){const K=j[0],z=j.indexOf(K);d(jm({layout:B,panelConstraints:L,panelId:K.id,panelIndex:z}))}});return()=>{P(),A(),E()}}},[w,c,m,l]),O.useEffect(()=>{x(c,{disabled:s,disableDoubleClick:i})},[s,i,c,x]);let C;s&&!k&&(C="not-allowed");let N;return s?N="disabled":f==="active"?N="active":_?N="focus":N=f,h.jsx("div",{...a,"aria-controls":u.valueControls,"aria-disabled":s||void 0,"aria-orientation":y,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:t,className:e,"data-separator":N,"data-testid":c,id:c,onBlur:()=>g(!1),onFocus:()=>g(!0),ref:b,role:"separator",style:{flexBasis:"auto",cursor:C,...o,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:s?void 0:0})}id.displayName="Separator";function Im(t){const e=H.c(10);let s,i,r;e[0]!==t?({className:s,ref:r,...i}=t,e[0]=t,e[1]=s,e[2]=i,e[3]=r):(s=e[1],i=e[2],r=e[3]);let n;e[4]!==s?(n=_e("flex h-full w-full",s),e[4]=s,e[5]=n):n=e[5];let o;return e[6]!==i||e[7]!==r||e[8]!==n?(o=h.jsx(td,{groupRef:r,"data-slot":"resizable-panel-group",className:n,...i}),e[6]=i,e[7]=r,e[8]=n,e[9]=o):o=e[9],o}function cl(t){const e=H.c(10);let s,i,r;e[0]!==t?({ref:i,style:r,...s}=t,e[0]=t,e[1]=s,e[2]=i,e[3]=r):(s=e[1],i=e[2],r=e[3]);let n;e[4]!==r?(n={overflow:"hidden",...r},e[4]=r,e[5]=n):n=e[5];let o;return e[6]!==s||e[7]!==i||e[8]!==n?(o=h.jsx(sd,{panelRef:i,"data-slot":"resizable-panel",style:n,...s}),e[6]=s,e[7]=i,e[8]=n,e[9]=o):o=e[9],o}function Om(t){const e=H.c(12);let s,i,r;e[0]!==t?({withHandle:r,className:s,...i}=t,e[0]=t,e[1]=s,e[2]=i,e[3]=r):(s=e[1],i=e[2],r=e[3]);let n;e[4]!==s?(n=_e("bg-border focus-visible:ring-ring relative flex w-[0.5px] items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:-translate-y-1/2 aria-[orientation=horizontal]:after:translate-x-0 [&[aria-orientation=horizontal]>div]:rotate-90",s),e[4]=s,e[5]=n):n=e[5];let o;e[6]!==r?(o=r&&h.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:h.jsx(xf,{className:"size-2.5"})}),e[6]=r,e[7]=o):o=e[7];let a;return e[8]!==i||e[9]!==n||e[10]!==o?(a=h.jsx(id,{"data-slot":"resizable-handle",className:n,...i,children:o}),e[8]=i,e[9]=n,e[10]=o,e[11]=a):a=e[11],a}function hl(t,e){const s=typeof t=="number"?t:Number(t);return!Number.isFinite(s)||s<=0||s>=100?e:s}function zm(t,e){const s=H.c(8);let i;s[0]!==e?(i=c=>hl(c,e),s[0]=e,s[1]=i):i=s[1];const[r,n]=Do(t,i);let o;s[2]!==e||s[3]!==r?(o=hl(r,e),s[2]=e,s[3]=r,s[4]=o):o=s[4];let a;return s[5]!==n||s[6]!==o?(a=[o,n],s[5]=n,s[6]=o,s[7]=a):a=s[7],a}const $m=33;function Fm(){const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=Ju.sidePanelWidth(),t[0]=e):e=t[0],zm(e,$m)}function Hm(t){const e=H.c(1),{activeTab:s}=t;let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx(jc,{}),e[0]=i):i=e[0],i}function Wm(){const t=H.c(5),e=Ho()??"overview";let s;t[0]!==e?(s=h.jsx(ls,{children:h.jsx(Hm,{activeTab:e})}),t[0]=e,t[1]=s):s=t[1];let i;return t[2]!==e||t[3]!==s?(i=h.jsx(Li,{children:s},e),t[2]=e,t[3]=s,t[4]=i):i=t[4],i}const Um=new Set(["site-editor","content"]);function Km(t){return t.hasClonableSource&&!t.fastPreviewActive&&t.mainTab!==null&&Um.has(t.mainTab)}const dl=/[\r\n<>]/,qm=/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;function Hr(t){const e=t?.userName?.trim();if(!e||dl.test(e))return null;const s=t?.userEmail?.trim();return!s||dl.test(s)?{userName:e}:qm.test(s)?{userName:e,userEmail:s}:{userName:e}}function Vm(t){return t.split(`
2
- `).filter(e=>!/^Co-authored-by:\s/i.test(e)).join(`
3
- `).trimEnd()}function Gm(t){const e=t.userName.trim(),s=t.userEmail?.trim();return s?`Co-authored-by: ${e} <${s}>`:`Co-authored-by: ${e}`}function rd(t,e){const s=Hr(e);if(!s)return t;const i=Vm(t),r=Gm(s);if(i.includes(r))return i;const n=i.trimEnd();return n.length>0?`${n}
4
-
5
- ${r}`:r}function Ym(t,e){const s=t?.trim();return s?rd(s,e):s||void 0}const Xm=["dev","start"],Ms="setup";function Jm(t){const e=H.c(57),s=be();let i;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let S;e[3]!==t.scriptTabs?(S=m=>!t.scriptTabs.includes(m),e[3]=t.scriptTabs,e[4]=S):S=e[4],i=t.scripts.filter(S),e[0]=t.scriptTabs,e[1]=t.scripts,e[2]=i}else i=e[2];const r=i;let n;e[5]!==t?(n=()=>{t.active===Ms?t.onToggle():t.onSelectTab(Ms)},e[5]=t,e[6]=n):n=e[6];const o=n;let a;e[7]!==t.open||e[8]!==s?(a=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[7]=t.open,e[8]=s,e[9]=a):a=e[9];let c;e[10]!==t.open?(c=t.open?h.jsx($s,{className:"size-4"}):h.jsx(Bf,{className:"size-4"}),e[10]=t.open,e[11]=c):c=e[11];let l;e[12]!==t.onToggle||e[13]!==t.open||e[14]!==a||e[15]!==c?(l=h.jsx(Je,{asChild:!0,children:h.jsx(Pe,{variant:"ghost",size:"icon-sm",onClick:t.onToggle,"aria-label":a,"aria-expanded":t.open,className:"size-6 shrink-0",children:c})}),e[12]=t.onToggle,e[13]=t.open,e[14]=a,e[15]=c,e[16]=l):l=e[16];let u;e[17]!==t.open||e[18]!==s?(u=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[17]=t.open,e[18]=s,e[19]=u):u=e[19];let d;e[20]!==u?(d=h.jsx(Ze,{children:u}),e[20]=u,e[21]=d):d=e[21];let f;e[22]!==l||e[23]!==d?(f=h.jsxs(Qe,{children:[l,d]}),e[22]=l,e[23]=d,e[24]=f):f=e[24];const p=t.active===Ms;let _;e[25]!==o||e[26]!==t.open||e[27]!==s||e[28]!==p?(_=h.jsx(Zm,{active:p,open:t.open,onClick:o,t:s}),e[25]=o,e[26]=t.open,e[27]=s,e[28]=p,e[29]=_):_=e[29];let g;e[30]!==t||e[31]!==s?(g=t.scriptTabs.map(S=>h.jsx(eg,{active:t.active===S,onClick:()=>{t.active===S?t.onToggle():t.onSelectTab(S)},onClose:()=>t.onCloseScript(S),t:s,children:S},S)),e[30]=t,e[31]=s,e[32]=g):g=e[32];let v;e[33]!==r||e[34]!==t.onAddScript?(v=h.jsx(tg,{scripts:r,onRun:t.onAddScript}),e[33]=r,e[34]=t.onAddScript,e[35]=v):v=e[35];let b;e[36]!==g||e[37]!==v||e[38]!==_?(b=h.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:[_,g,v]}),e[36]=g,e[37]=v,e[38]=_,e[39]=b):b=e[39];let k;e[40]!==t.onRestart||e[41]!==t.onResume||e[42]!==t.onRetry||e[43]!==t.onRunActiveScript||e[44]!==t.onStart||e[45]!==t.onStop||e[46]!==t.onStopActiveScript||e[47]!==t.scriptIsKilling||e[48]!==t.scriptIsRunning||e[49]!==t.showScriptControls||e[50]!==t.status||e[51]!==s?(k=t.showScriptControls?h.jsx(sg,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript,t:s}):h.jsx(Qm,{status:t.status,onStart:t.onStart,onStop:t.onStop,onRestart:t.onRestart,onResume:t.onResume,onRetry:t.onRetry,t:s}),e[40]=t.onRestart,e[41]=t.onResume,e[42]=t.onRetry,e[43]=t.onRunActiveScript,e[44]=t.onStart,e[45]=t.onStop,e[46]=t.onStopActiveScript,e[47]=t.scriptIsKilling,e[48]=t.scriptIsRunning,e[49]=t.showScriptControls,e[50]=t.status,e[51]=s,e[52]=k):k=e[52];let w;return e[53]!==b||e[54]!==k||e[55]!==f?(w=h.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1 border-t border-b border-border bg-muted/60 px-2",children:[f,b,k]}),e[53]=b,e[54]=k,e[55]=f,e[56]=w):w=e[56],w}function Zm(t){const e=H.c(11),{active:s,open:i,onClick:r,t:n}=t,o=s&&i,a=s&&i,c=s?"border-border bg-background font-medium text-foreground shadow-sm":"border-transparent text-muted-foreground hover:bg-background/50 hover:text-foreground";let l;e[0]!==c?(l=_e("flex h-6 items-center gap-1.5 rounded-md border px-2 text-xs",c),e[0]=c,e[1]=l):l=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=h.jsx(xp,{className:"size-4"}),e[2]=u):u=e[2];let d;e[3]!==n?(d=n("sandbox.toolbar.setupTab"),e[3]=n,e[4]=d):d=e[4];let f;return e[5]!==r||e[6]!==o||e[7]!==a||e[8]!==l||e[9]!==d?(f=h.jsxs("button",{type:"button","aria-pressed":o,"aria-expanded":a,onClick:r,className:l,children:[u,d]}),e[5]=r,e[6]=o,e[7]=a,e[8]=l,e[9]=d,e[10]=f):f=e[10],f}function Qm(t){const e=H.c(40),{status:s,onStart:i,onStop:r,onRestart:n,onResume:o,onRetry:a,t:c}=t;if(s==="idle"&&i){let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(Sr,{className:"size-3.5"}),e[0]=l):l=e[0];let u;e[1]!==c?(u=c("sandbox.toolbar.start"),e[1]=c,e[2]=u):u=e[2];let d;return e[3]!==i||e[4]!==u?(d=h.jsxs(Pe,{variant:"outline",size:"xs",onClick:i,children:[l," ",u]}),e[3]=i,e[4]=u,e[5]=d):d=e[5],d}if(s==="suspended"&&o){let l;e[6]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(Sr,{className:"size-3.5"}),e[6]=l):l=e[6];let u;e[7]!==c?(u=c("sandbox.toolbar.resume"),e[7]=c,e[8]=u):u=e[8];let d;return e[9]!==o||e[10]!==u?(d=h.jsxs(Pe,{variant:"outline",size:"xs",onClick:o,children:[l," ",u]}),e[9]=o,e[10]=u,e[11]=d):d=e[11],d}if(s==="errored"&&a){let l;e[12]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(Ei,{className:"size-3.5"}),e[12]=l):l=e[12];let u;e[13]!==c?(u=c("sandbox.toolbar.retry"),e[13]=c,e[14]=u):u=e[14];let d;return e[15]!==a||e[16]!==u?(d=h.jsxs(Pe,{variant:"outline",size:"xs",onClick:a,children:[l," ",u]}),e[15]=a,e[16]=u,e[17]=d):d=e[17],d}if(s==="starting"||s==="running"){const l=s==="running"&&!!n,u=l?"rounded-r-none border-r-0":void 0;let d;e[18]!==u?(d=_e(u),e[18]=u,e[19]=d):d=e[19];let f;e[20]!==c?(f=c("sandbox.toolbar.stop"),e[20]=c,e[21]=f):f=e[21];let p;e[22]!==r||e[23]!==d||e[24]!==f?(p=h.jsx(Je,{asChild:!0,children:h.jsx(Pe,{variant:"outline",size:"xs",onClick:r,className:d,children:f})}),e[22]=r,e[23]=d,e[24]=f,e[25]=p):p=e[25];let _;e[26]!==c?(_=c("sandbox.toolbar.stopSandboxTooltip"),e[26]=c,e[27]=_):_=e[27];let g;e[28]!==_?(g=h.jsx(Ze,{children:_}),e[28]=_,e[29]=g):g=e[29];let v;e[30]!==p||e[31]!==g?(v=h.jsxs(Qe,{children:[p,g]}),e[30]=p,e[31]=g,e[32]=v):v=e[32];let b;e[33]!==n||e[34]!==l||e[35]!==c?(b=l&&h.jsxs(Ko,{children:[h.jsx(qo,{asChild:!0,children:h.jsx(Pe,{variant:"outline",size:"xs",className:"rounded-l-none px-1","aria-label":c("sandbox.toolbar.moreActions"),children:h.jsx($s,{className:"size-3"})})}),h.jsx(Vo,{align:"end",children:h.jsxs(yr,{onClick:n,children:[h.jsx(Ei,{className:"size-3.5"})," ",c("sandbox.toolbar.restart")]})})]}),e[33]=n,e[34]=l,e[35]=c,e[36]=b):b=e[36];let k;return e[37]!==v||e[38]!==b?(k=h.jsxs("div",{className:"flex items-center",children:[v,b]}),e[37]=v,e[38]=b,e[39]=k):k=e[39],k}return null}function eg(t){const e=H.c(17),{active:s,onClick:i,onClose:r,children:n,t:o}=t,a=s?"border-border bg-background shadow-sm":"border-transparent hover:bg-background/50";let c;e[0]!==a?(c=_e("flex h-6 items-center rounded-md border text-xs",a),e[0]=a,e[1]=c):c=e[1];const l=r?"pl-2 pr-1":"px-2",u=s?"font-medium text-foreground":"text-muted-foreground hover:text-foreground";let d;e[2]!==l||e[3]!==u?(d=_e("flex h-full items-center",l,u),e[2]=l,e[3]=u,e[4]=d):d=e[4];let f;e[5]!==n||e[6]!==i||e[7]!==d?(f=h.jsx("button",{type:"button",onClick:i,className:d,children:n}),e[5]=n,e[6]=i,e[7]=d,e[8]=f):f=e[8];let p;e[9]!==n||e[10]!==r||e[11]!==o?(p=r&&h.jsx("button",{type:"button","aria-label":o("sandbox.toolbar.closeTab",{tab:String(n)}),onClick:r,className:"pr-1.5 text-muted-foreground hover:text-foreground",children:h.jsx(Zu,{className:"size-3.5"})}),e[9]=n,e[10]=r,e[11]=o,e[12]=p):p=e[12];let _;return e[13]!==c||e[14]!==f||e[15]!==p?(_=h.jsxs("div",{className:c,children:[f,p]}),e[13]=c,e[14]=f,e[15]=p,e[16]=_):_=e[16],_}function tg(t){const e=H.c(27),{scripts:s,onRun:i}=t,r=be(),[n,o]=O.useState(!1);let a;e[0]!==r?(a=r("sandbox.toolbar.runScript"),e[0]=r,e[1]=a):a=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(ah,{className:"size-4"}),e[2]=c):c=e[2];let l;e[3]!==a?(l=h.jsx(Je,{asChild:!0,children:h.jsx(zr,{asChild:!0,children:h.jsx(Pe,{variant:"ghost",size:"xs","aria-label":a,children:c})})}),e[3]=a,e[4]=l):l=e[4];let u;e[5]!==r?(u=r("sandbox.toolbar.runScript"),e[5]=r,e[6]=u):u=e[6];let d;e[7]!==u?(d=h.jsx(Ze,{children:u}),e[7]=u,e[8]=d):d=e[8];let f;e[9]!==l||e[10]!==d?(f=h.jsxs(Qe,{children:[l,d]}),e[9]=l,e[10]=d,e[11]=f):f=e[11];let p;e[12]!==r?(p=r("sandbox.toolbar.runAScript"),e[12]=r,e[13]=p):p=e[13];let _;e[14]!==p?(_=h.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:p}),e[14]=p,e[15]=_):_=e[15];let g;e[16]!==i||e[17]!==s||e[18]!==r?(g=s.length===0?h.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:r("sandbox.toolbar.noScriptsFound")}):s.map(k=>h.jsxs("button",{type:"button",onClick:()=>{o(!1),i(k)},className:"w-full rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent",children:["▸ ",k]},k)),e[16]=i,e[17]=s,e[18]=r,e[19]=g):g=e[19];let v;e[20]!==_||e[21]!==g?(v=h.jsxs(Fi,{align:"start",className:"p-1 w-56",children:[_,g]}),e[20]=_,e[21]=g,e[22]=v):v=e[22];let b;return e[23]!==n||e[24]!==v||e[25]!==f?(b=h.jsxs(Hi,{open:n,onOpenChange:o,children:[f,v]}),e[23]=n,e[24]=v,e[25]=f,e[26]=b):b=e[26],b}function sg(t){const e=H.c(30),{isRunning:s,isKilling:i,onRun:r,onStop:n,t:o}=t;if(i){let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=h.jsx(gt,{className:"size-3.5"}),e[0]=f):f=e[0];let p;e[1]!==o?(p=o("sandbox.toolbar.stopping"),e[1]=o,e[2]=p):p=e[2];let _;return e[3]!==p?(_=h.jsxs(Pe,{variant:"outline",size:"xs",disabled:!0,children:[f," ",p]}),e[3]=p,e[4]=_):_=e[4],_}if(!s){let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=h.jsx(Sr,{className:"size-3.5"}),e[5]=f):f=e[5];let p;e[6]!==o?(p=o("sandbox.toolbar.run"),e[6]=o,e[7]=p):p=e[7];let _;e[8]!==r||e[9]!==p?(_=h.jsx(Je,{asChild:!0,children:h.jsxs(Pe,{variant:"outline",size:"xs",onClick:r,children:[f," ",p]})}),e[8]=r,e[9]=p,e[10]=_):_=e[10];let g;e[11]!==o?(g=o("sandbox.toolbar.startProcess"),e[11]=o,e[12]=g):g=e[12];let v;e[13]!==g?(v=h.jsx(Ze,{children:g}),e[13]=g,e[14]=v):v=e[14];let b;return e[15]!==_||e[16]!==v?(b=h.jsxs(Qe,{children:[_,v]}),e[15]=_,e[16]=v,e[17]=b):b=e[17],b}let a;e[18]!==o?(a=o("sandbox.toolbar.stop"),e[18]=o,e[19]=a):a=e[19];let c;e[20]!==n||e[21]!==a?(c=h.jsx(Je,{asChild:!0,children:h.jsx(Pe,{variant:"outline",size:"xs",onClick:n,children:a})}),e[20]=n,e[21]=a,e[22]=c):c=e[22];let l;e[23]!==o?(l=o("sandbox.toolbar.stopProcess"),e[23]=o,e[24]=l):l=e[24];let u;e[25]!==l?(u=h.jsx(Ze,{children:l}),e[25]=l,e[26]=u):u=e[26];let d;return e[27]!==c||e[28]!==u?(d=h.jsxs(Qe,{children:[c,u]}),e[27]=c,e[28]=u,e[29]=d):d=e[29],d}var nd=Object.defineProperty,ig=Object.getOwnPropertyDescriptor,rg=(t,e)=>{for(var s in e)nd(t,s,{get:e[s],enumerable:!0})},He=(t,e,s,i)=>{for(var r=i>1?void 0:i?ig(e,s):e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(r=(i?o(e,s,r):o(r))||r);return i&&r&&nd(e,s,r),r},oe=(t,e)=>(s,i)=>e(s,i,t),ul="Terminal input",In={get:()=>ul,set:t=>ul=t},fl="Too much output to announce, navigate to rows manually to read",On={get:()=>fl,set:t=>fl=t};function ng(t){return t.replace(/\r?\n/g,"\r")}function og(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function ag(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function lg(t,e,s,i){if(t.stopPropagation(),t.clipboardData){let r=t.clipboardData.getData("text/plain");od(r,e,s,i)}}function od(t,e,s,i){t=ng(t),t=og(t,s.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(t,!0),e.value=""}function ad(t,e,s){let i=s.getBoundingClientRect(),r=t.clientX-i.left-10,n=t.clientY-i.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${r}px`,e.style.top=`${n}px`,e.style.zIndex="1000",e.focus()}function pl(t,e,s,i,r){ad(t,e,s),r&&i.rightClickSelect(t),e.value=i.selectionText,e.select()}function Ss(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function Wr(t,e=0,s=t.length){let i="";for(let r=e;r<s;++r){let n=t[r];n>65535?(n-=65536,i+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):i+=String.fromCharCode(n)}return i}var cg=class{constructor(){this._interim=0}clear(){this._interim=0}decode(t,e){let s=t.length;if(!s)return 0;let i=0,r=0;if(this._interim){let n=t.charCodeAt(r++);56320<=n&&n<=57343?e[i++]=(this._interim-55296)*1024+n-56320+65536:(e[i++]=this._interim,e[i++]=n),this._interim=0}for(let n=r;n<s;++n){let o=t.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=s)return this._interim=o,i;let a=t.charCodeAt(n);56320<=a&&a<=57343?e[i++]=(o-55296)*1024+a-56320+65536:(e[i++]=o,e[i++]=a);continue}o!==65279&&(e[i++]=o)}return i}},hg=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(t,e){let s=t.length;if(!s)return 0;let i=0,r,n,o,a,c=0,l=0;if(this.interim[0]){let f=!1,p=this.interim[0];p&=(p&224)===192?31:(p&240)===224?15:7;let _=0,g;for(;(g=this.interim[++_]&63)&&_<4;)p<<=6,p|=g;let v=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,b=v-_;for(;l<b;){if(l>=s)return 0;if(g=t[l++],(g&192)!==128){l--,f=!0;break}else this.interim[_++]=g,p<<=6,p|=g&63}f||(v===2?p<128?l--:e[i++]=p:v===3?p<2048||p>=55296&&p<=57343||p===65279||(e[i++]=p):p<65536||p>1114111||(e[i++]=p)),this.interim.fill(0)}let u=s-4,d=l;for(;d<s;){for(;d<u&&!((r=t[d])&128)&&!((n=t[d+1])&128)&&!((o=t[d+2])&128)&&!((a=t[d+3])&128);)e[i++]=r,e[i++]=n,e[i++]=o,e[i++]=a,d+=4;if(r=t[d++],r<128)e[i++]=r;else if((r&224)===192){if(d>=s)return this.interim[0]=r,i;if(n=t[d++],(n&192)!==128){d--;continue}if(c=(r&31)<<6|n&63,c<128){d--;continue}e[i++]=c}else if((r&240)===224){if(d>=s)return this.interim[0]=r,i;if(n=t[d++],(n&192)!==128){d--;continue}if(d>=s)return this.interim[0]=r,this.interim[1]=n,i;if(o=t[d++],(o&192)!==128){d--;continue}if(c=(r&15)<<12|(n&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;e[i++]=c}else if((r&248)===240){if(d>=s)return this.interim[0]=r,i;if(n=t[d++],(n&192)!==128){d--;continue}if(d>=s)return this.interim[0]=r,this.interim[1]=n,i;if(o=t[d++],(o&192)!==128){d--;continue}if(d>=s)return this.interim[0]=r,this.interim[1]=n,this.interim[2]=o,i;if(a=t[d++],(a&192)!==128){d--;continue}if(c=(r&7)<<18|(n&63)<<12|(o&63)<<6|a&63,c<65536||c>1114111)continue;e[i++]=c}}return i}},ld="",ys=" ",Wi=class cd{constructor(){this.fg=0,this.bg=0,this.extended=new Cr}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new cd;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Cr=class hd{constructor(e=0,s=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=s}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new hd(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},It=class dd extends Wi{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Cr,this.combinedData=""}static fromCharData(e){let s=new dd;return s.setFromCharData(e),s}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Ss(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let s=!1;if(e[1].length>2)s=!0;else if(e[1].length===2){let i=e[1].charCodeAt(0);if(55296<=i&&i<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(i-55296)*1024+r-56320+65536|e[2]<<22:s=!0}else s=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;s&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},_l="di$target",zn="di$dependencies",sn=new Map;function dg(t){return t[zn]||[]}function ct(t){if(sn.has(t))return sn.get(t);let e=function(s,i,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");ug(e,s,r)};return e._id=t,sn.set(t,e),e}function ug(t,e,s){e[_l]===e?e[zn].push({id:t,index:s}):(e[zn]=[{id:t,index:s}],e[_l]=e)}var bt=ct("BufferService"),ud=ct("CoreMouseService"),Ws=ct("CoreService"),fg=ct("CharsetService"),ha=ct("InstantiationService"),fd=ct("LogService"),St=ct("OptionsService"),pd=ct("OscLinkService"),pg=ct("UnicodeService"),Ui=ct("DecorationService"),$n=class{constructor(t,e,s){this._bufferService=t,this._optionsService=e,this._oscLinkService=s}provideLinks(t,e){let s=this._bufferService.buffer.lines.get(t-1);if(!s){e(void 0);return}let i=[],r=this._optionsService.rawOptions.linkHandler,n=new It,o=s.getTrimmedLength(),a=-1,c=-1,l=!1;for(let u=0;u<o;u++)if(!(c===-1&&!s.hasContent(u))){if(s.loadCell(u,n),n.hasExtendedAttrs()&&n.extended.urlId)if(c===-1){c=u,a=n.extended.urlId;continue}else l=n.extended.urlId!==a;else c!==-1&&(l=!0);if(l||c!==-1&&u===o-1){let d=this._oscLinkService.getLinkData(a)?.uri;if(d){let f={start:{x:c+1,y:t},end:{x:u+(!l&&u===o-1?1:0),y:t}},p=!1;if(!r?.allowNonHttpProtocols)try{let _=new URL(d);["http:","https:"].includes(_.protocol)||(p=!0)}catch{p=!0}p||i.push({text:d,range:f,activate:(_,g)=>r?r.activate(_,g,f):_g(_,g),hover:(_,g)=>r?.hover?.(_,g,f),leave:(_,g)=>r?.leave?.(_,g,f)})}l=!1,n.hasExtendedAttrs()&&n.extended.urlId?(c=u,a=n.extended.urlId):(c=-1,a=-1)}}e(i)}};$n=He([oe(0,bt),oe(1,St),oe(2,pd)],$n);function _g(t,e){if(confirm(`Do you want to navigate to ${e}?
6
-
7
- WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}var Ur=ct("CharSizeService"),fs=ct("CoreBrowserService"),da=ct("MouseService"),ps=ct("RenderService"),mg=ct("SelectionService"),_d=ct("CharacterJoinerService"),oi=ct("ThemeService"),md=ct("LinkProviderService"),gg=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?ml.isErrorNoTelemetry(t)?new ml(t.message+`
8
-
9
- `+t.stack):new Error(t.message+`
10
-
11
- `+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(e=>{e(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},vg=new gg;function ur(t){bg(t)||vg.onUnexpectedError(t)}var Fn="Canceled";function bg(t){return t instanceof Sg?!0:t instanceof Error&&t.name===Fn&&t.message===Fn}var Sg=class extends Error{constructor(){super(Fn),this.name=this.message}};function yg(t){return new Error(`Illegal argument: ${t}`)}var ml=class Hn extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof Hn)return e;let s=new Hn;return s.message=e.message,s.stack=e.stack,s}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},Wn=class gd extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,gd.prototype)}};function Dt(t,e=0){return t[t.length-(1+e)]}var xg;(t=>{function e(n){return n<0}t.isLessThan=e;function s(n){return n<=0}t.isLessThanOrEqual=s;function i(n){return n>0}t.isGreaterThan=i;function r(n){return n===0}t.isNeitherLessOrGreaterThan=r,t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(xg||={});function wg(t,e){let s=this,i=!1,r;return function(){return i||(i=!0,e||(r=t.apply(s,arguments))),r}}var vd;(t=>{function e(S){return S&&typeof S=="object"&&typeof S[Symbol.iterator]=="function"}t.is=e;let s=Object.freeze([]);function i(){return s}t.empty=i;function*r(S){yield S}t.single=r;function n(S){return e(S)?S:r(S)}t.wrap=n;function o(S){return S||s}t.from=o;function*a(S){for(let m=S.length-1;m>=0;m--)yield S[m]}t.reverse=a;function c(S){return!S||S[Symbol.iterator]().next().done===!0}t.isEmpty=c;function l(S){return S[Symbol.iterator]().next().value}t.first=l;function u(S,m){let x=0;for(let y of S)if(m(y,x++))return!0;return!1}t.some=u;function d(S,m){for(let x of S)if(m(x))return x}t.find=d;function*f(S,m){for(let x of S)m(x)&&(yield x)}t.filter=f;function*p(S,m){let x=0;for(let y of S)yield m(y,x++)}t.map=p;function*_(S,m){let x=0;for(let y of S)yield*m(y,x++)}t.flatMap=_;function*g(...S){for(let m of S)yield*m}t.concat=g;function v(S,m,x){let y=x;for(let C of S)y=m(y,C);return y}t.reduce=v;function*b(S,m,x=S.length){for(m<0&&(m+=S.length),x<0?x+=S.length:x>S.length&&(x=S.length);m<x;m++)yield S[m]}t.slice=b;function k(S,m=Number.POSITIVE_INFINITY){let x=[];if(m===0)return[x,S];let y=S[Symbol.iterator]();for(let C=0;C<m;C++){let N=y.next();if(N.done)return[x,t.empty()];x.push(N.value)}return[x,{[Symbol.iterator](){return y}}]}t.consume=k;async function w(S){let m=[];for await(let x of S)m.push(x);return Promise.resolve(m)}t.asyncToArray=w})(vd||={});function Os(t){if(vd.is(t)){let e=[];for(let s of t)if(s)try{s.dispose()}catch(i){e.push(i)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function Cg(...t){return Le(()=>Os(t))}function Le(t){return{dispose:wg(()=>{t()})}}var bd=class Sd{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Os(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?Sd.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};bd.DISABLE_DISPOSED_WARNING=!1;var ws=bd,ye=class{constructor(){this._store=new ws,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};ye.None=Object.freeze({dispose(){}});var ii=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},os=typeof window=="object"?window:globalThis,Un=class Kn{constructor(e){this.element=e,this.next=Kn.Undefined,this.prev=Kn.Undefined}};Un.Undefined=new Un(void 0);var je=Un,gl=class{constructor(){this._first=je.Undefined,this._last=je.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===je.Undefined}clear(){let t=this._first;for(;t!==je.Undefined;){let e=t.next;t.prev=je.Undefined,t.next=je.Undefined,t=e}this._first=je.Undefined,this._last=je.Undefined,this._size=0}unshift(t){return this._insert(t,!1)}push(t){return this._insert(t,!0)}_insert(t,e){let s=new je(t);if(this._first===je.Undefined)this._first=s,this._last=s;else if(e){let r=this._last;this._last=s,s.prev=r,r.next=s}else{let r=this._first;this._first=s,s.next=r,r.prev=s}this._size+=1;let i=!1;return()=>{i||(i=!0,this._remove(s))}}shift(){if(this._first!==je.Undefined){let t=this._first.element;return this._remove(this._first),t}}pop(){if(this._last!==je.Undefined){let t=this._last.element;return this._remove(this._last),t}}_remove(t){if(t.prev!==je.Undefined&&t.next!==je.Undefined){let e=t.prev;e.next=t.next,t.next.prev=e}else t.prev===je.Undefined&&t.next===je.Undefined?(this._first=je.Undefined,this._last=je.Undefined):t.next===je.Undefined?(this._last=this._last.prev,this._last.next=je.Undefined):t.prev===je.Undefined&&(this._first=this._first.next,this._first.prev=je.Undefined);this._size-=1}*[Symbol.iterator](){let t=this._first;for(;t!==je.Undefined;)yield t.element,t=t.next}},kg=globalThis.performance&&typeof globalThis.performance.now=="function",Pg=class yd{static create(e){return new yd(e)}constructor(e){this._now=kg&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},dt;(t=>{t.None=()=>ye.None;function e(E,P){return d(E,()=>{},0,void 0,!0,void 0,P)}t.defer=e;function s(E){return(P,A=null,M)=>{let L=!1,B;return B=E(D=>{if(!L)return B?B.dispose():L=!0,P.call(A,D)},null,M),L&&B.dispose(),B}}t.once=s;function i(E,P,A){return l((M,L=null,B)=>E(D=>M.call(L,P(D)),null,B),A)}t.map=i;function r(E,P,A){return l((M,L=null,B)=>E(D=>{P(D),M.call(L,D)},null,B),A)}t.forEach=r;function n(E,P,A){return l((M,L=null,B)=>E(D=>P(D)&&M.call(L,D),null,B),A)}t.filter=n;function o(E){return E}t.signal=o;function a(...E){return(P,A=null,M)=>{let L=Cg(...E.map(B=>B(D=>P.call(A,D))));return u(L,M)}}t.any=a;function c(E,P,A,M){let L=A;return i(E,B=>(L=P(L,B),L),M)}t.reduce=c;function l(E,P){let A,M={onWillAddFirstListener(){A=E(L.fire,L)},onDidRemoveLastListener(){A?.dispose()}},L=new te(M);return P?.add(L),L.event}function u(E,P){return P instanceof Array?P.push(E):P&&P.add(E),E}function d(E,P,A=100,M=!1,L=!1,B,D){let j,K,z,G=0,I,V={leakWarningThreshold:B,onWillAddFirstListener(){j=E(ee=>{G++,K=P(K,ee),M&&!z&&($.fire(K),K=void 0),I=()=>{let se=K;K=void 0,z=void 0,(!M||G>1)&&$.fire(se),G=0},typeof A=="number"?(clearTimeout(z),z=setTimeout(I,A)):z===void 0&&(z=0,queueMicrotask(I))})},onWillRemoveListener(){L&&G>0&&I?.()},onDidRemoveLastListener(){I=void 0,j.dispose()}},$=new te(V);return D?.add($),$.event}t.debounce=d;function f(E,P=0,A){return t.debounce(E,(M,L)=>M?(M.push(L),M):[L],P,void 0,!0,void 0,A)}t.accumulate=f;function p(E,P=(M,L)=>M===L,A){let M=!0,L;return n(E,B=>{let D=M||!P(B,L);return M=!1,L=B,D},A)}t.latch=p;function _(E,P,A){return[t.filter(E,P,A),t.filter(E,M=>!P(M),A)]}t.split=_;function g(E,P=!1,A=[],M){let L=A.slice(),B=E(K=>{L?L.push(K):j.fire(K)});M&&M.add(B);let D=()=>{L?.forEach(K=>j.fire(K)),L=null},j=new te({onWillAddFirstListener(){B||(B=E(K=>j.fire(K)),M&&M.add(B))},onDidAddFirstListener(){L&&(P?setTimeout(D):D())},onDidRemoveLastListener(){B&&B.dispose(),B=null}});return M&&M.add(j),j.event}t.buffer=g;function v(E,P){return(A,M,L)=>{let B=P(new k);return E(function(D){let j=B.evaluate(D);j!==b&&A.call(M,j)},void 0,L)}}t.chain=v;let b=Symbol("HaltChainable");class k{constructor(){this.steps=[]}map(P){return this.steps.push(P),this}forEach(P){return this.steps.push(A=>(P(A),A)),this}filter(P){return this.steps.push(A=>P(A)?A:b),this}reduce(P,A){let M=A;return this.steps.push(L=>(M=P(M,L),M)),this}latch(P=(A,M)=>A===M){let A=!0,M;return this.steps.push(L=>{let B=A||!P(L,M);return A=!1,M=L,B?L:b}),this}evaluate(P){for(let A of this.steps)if(P=A(P),P===b)break;return P}}function w(E,P,A=M=>M){let M=(...j)=>D.fire(A(...j)),L=()=>E.on(P,M),B=()=>E.removeListener(P,M),D=new te({onWillAddFirstListener:L,onDidRemoveLastListener:B});return D.event}t.fromNodeEventEmitter=w;function S(E,P,A=M=>M){let M=(...j)=>D.fire(A(...j)),L=()=>E.addEventListener(P,M),B=()=>E.removeEventListener(P,M),D=new te({onWillAddFirstListener:L,onDidRemoveLastListener:B});return D.event}t.fromDOMEventEmitter=S;function m(E){return new Promise(P=>s(E)(P))}t.toPromise=m;function x(E){let P=new te;return E.then(A=>{P.fire(A)},()=>{P.fire(void 0)}).finally(()=>{P.dispose()}),P.event}t.fromPromise=x;function y(E,P){return E(A=>P.fire(A))}t.forward=y;function C(E,P,A){return P(A),E(M=>P(M))}t.runAndSubscribe=C;class N{constructor(P,A){this._observable=P,this._counter=0,this._hasChanged=!1;let M={onWillAddFirstListener:()=>{P.addObserver(this)},onDidRemoveLastListener:()=>{P.removeObserver(this)}};this.emitter=new te(M),A&&A.add(this.emitter)}beginUpdate(P){this._counter++}handlePossibleChange(P){}handleChange(P,A){this._hasChanged=!0}endUpdate(P){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function T(E,P){return new N(E,P).emitter.event}t.fromObservable=T;function R(E){return(P,A,M)=>{let L=0,B=!1,D={beginUpdate(){L++},endUpdate(){L--,L===0&&(E.reportChanges(),B&&(B=!1,P.call(A)))},handlePossibleChange(){},handleChange(){B=!0}};E.addObserver(D),E.reportChanges();let j={dispose(){E.removeObserver(D)}};return M instanceof ws?M.add(j):Array.isArray(M)&&M.push(j),j}}t.fromObservableLight=R})(dt||={});var qn=class Vn{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${Vn._idPool++}`,Vn.all.add(this)}start(e){this._stopWatch=new Pg,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};qn.all=new Set,qn._idPool=0;var Eg=qn,Rg=-1,xd=class wd{constructor(e,s,i=(wd._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=s,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,s){let i=this.threshold;if(i<=0||s<i)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[n,o]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${s} listeners already. MOST frequent listener (${o}):`;console.warn(a),console.warn(n);let c=new Dg(a,n);this._errorHandler(c)}return()=>{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,s=0;for(let[i,r]of this._stacks)(!e||s<r)&&(e=[i,r],s=r);return e}};xd._idPool=1;var Tg=xd,Ag=class Cd{constructor(e){this.value=e}static create(){let e=new Error;return new Cd(e.stack??"")}print(){console.warn(this.value.split(`
12
- `).slice(2).join(`
13
- `))}},Dg=class extends Error{constructor(t,e){super(t),this.name="ListenerLeakError",this.stack=e}},Ng=class extends Error{constructor(t,e){super(t),this.name="ListenerRefusalError",this.stack=e}},Mg=0,rn=class{constructor(t){this.value=t,this.id=Mg++}},Bg=2,Lg,te=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new Tg(t?.onListenerError??ur,this._options?.leakWarningThreshold??Rg):void 0,this._perfMon=this._options?._profName?new Eg(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(t,e,s)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let o=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(o);let a=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],c=new Ng(`${o}. HINT: Stack shows most frequent listener (${a[1]}-times)`,a[0]);return(this._options?.onListenerError||ur)(c),ye.None}if(this._disposed)return ye.None;e&&(t=t.bind(e));let i=new rn(t),r;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=Ag.create(),r=this._leakageMon.check(i.stack,this._size+1)),this._listeners?this._listeners instanceof rn?(this._deliveryQueue??=new jg,this._listeners=[this._listeners,i]):this._listeners.push(i):(this._options?.onWillAddFirstListener?.(this),this._listeners=i,this._options?.onDidAddFirstListener?.(this)),this._size++;let n=Le(()=>{r?.(),this._removeListener(i)});return s instanceof ws?s.add(n):Array.isArray(s)&&s.push(n),n},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let e=this._listeners,s=e.indexOf(t);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,e[s]=void 0;let i=this._deliveryQueue.current===this;if(this._size*Bg<=e.length){let r=0;for(let n=0;n<e.length;n++)e[n]?e[r++]=e[n]:i&&(this._deliveryQueue.end--,r<this._deliveryQueue.i&&this._deliveryQueue.i--);e.length=r}}_deliver(t,e){if(!t)return;let s=this._options?.onListenerError||ur;if(!s){t.value(e);return}try{t.value(e)}catch(i){s(i)}}_deliverQueue(t){let e=t.current._listeners;for(;t.i<t.end;)this._deliver(e[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof rn)this._deliver(this._listeners,t);else{let e=this._deliveryQueue;e.enqueue(this,t,this._listeners.length),this._deliverQueue(e)}this._perfMon?.stop()}hasListeners(){return this._size>0}},jg=class{constructor(){this.i=-1,this.end=0}enqueue(t,e,s){this.i=0,this.end=s,this.current=t,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Gn=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new te,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new te,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,s){if(this.getZoomLevel(s)===e)return;let i=this.getWindowId(s);this.mapWindowIdToZoomLevel.set(i,e),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,s){this.mapWindowIdToZoomFactor.set(this.getWindowId(s),e)}setFullscreen(e,s){if(this.isFullscreen(s)===e)return;let i=this.getWindowId(s);this.mapWindowIdToFullScreen.set(i,e),this._onDidChangeFullscreen.fire(i)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Gn.INSTANCE=new Gn;var ua=Gn;function Ig(t,e,s){typeof e=="string"&&(e=t.matchMedia(e)),e.addEventListener("change",s)}ua.INSTANCE.onDidChangeZoomLevel;function Og(t){return ua.INSTANCE.getZoomFactor(t)}ua.INSTANCE.onDidChangeFullscreen;var ai=typeof navigator=="object"?navigator.userAgent:"",Yn=ai.indexOf("Firefox")>=0,zg=ai.indexOf("AppleWebKit")>=0,fa=ai.indexOf("Chrome")>=0,$g=!fa&&ai.indexOf("Safari")>=0;ai.indexOf("Electron/")>=0;ai.indexOf("Android")>=0;var nn=!1;if(typeof os.matchMedia=="function"){let t=os.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=os.matchMedia("(display-mode: fullscreen)");nn=t.matches,Ig(os,t,({matches:s})=>{nn&&e.matches||(nn=s)})}var Js="en",Xn=!1,Jn=!1,fr=!1,kd=!1,er,pr=Js,vl=Js,Fg,ns,Bs=globalThis,Mt;typeof Bs.vscode<"u"&&typeof Bs.vscode.process<"u"?Mt=Bs.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Mt=process);var Hg=typeof Mt?.versions?.electron=="string",Wg=Hg&&Mt?.type==="renderer";if(typeof Mt=="object"){Xn=Mt.platform==="win32",Jn=Mt.platform==="darwin",fr=Mt.platform==="linux",fr&&Mt.env.SNAP&&Mt.env.SNAP_REVISION,Mt.env.CI||Mt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,er=Js,pr=Js;let t=Mt.env.VSCODE_NLS_CONFIG;if(t)try{let e=JSON.parse(t);er=e.userLocale,vl=e.osLocale,pr=e.resolvedLanguage||Js,Fg=e.languagePack?.translationsConfigFile}catch{}kd=!0}else typeof navigator=="object"&&!Wg?(ns=navigator.userAgent,Xn=ns.indexOf("Windows")>=0,Jn=ns.indexOf("Macintosh")>=0,(ns.indexOf("Macintosh")>=0||ns.indexOf("iPad")>=0||ns.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,fr=ns.indexOf("Linux")>=0,ns?.indexOf("Mobi")>=0,pr=globalThis._VSCODE_NLS_LANGUAGE||Js,er=navigator.language.toLowerCase(),vl=er):console.error("Unable to resolve platform.");var Pd=Xn,Zt=Jn,Ug=fr,bl=kd,Qt=ns,gs=pr,Kg;(t=>{function e(){return gs}t.value=e;function s(){return gs.length===2?gs==="en":gs.length>=3?gs[0]==="e"&&gs[1]==="n"&&gs[2]==="-":!1}t.isDefaultVariant=s;function i(){return gs==="en"}t.isDefault=i})(Kg||={});var qg=typeof Bs.postMessage=="function"&&!Bs.importScripts;(()=>{if(qg){let t=[];Bs.addEventListener("message",s=>{if(s.data&&s.data.vscodeScheduleAsyncWork)for(let i=0,r=t.length;i<r;i++){let n=t[i];if(n.id===s.data.vscodeScheduleAsyncWork){t.splice(i,1),n.callback();return}}});let e=0;return s=>{let i=++e;t.push({id:i,callback:s}),Bs.postMessage({vscodeScheduleAsyncWork:i},"*")}}return t=>setTimeout(t)})();var Vg=!!(Qt&&Qt.indexOf("Chrome")>=0);Qt&&Qt.indexOf("Firefox")>=0;!Vg&&Qt&&Qt.indexOf("Safari")>=0;Qt&&Qt.indexOf("Edg/")>=0;Qt&&Qt.indexOf("Android")>=0;var qs=typeof navigator=="object"?navigator:{};bl||document.queryCommandSupported&&document.queryCommandSupported("copy")||qs&&qs.clipboard&&qs.clipboard.writeText,bl||qs&&qs.clipboard&&qs.clipboard.readText;var pa=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(t,e){this._keyCodeToStr[t]=e,this._strToKeyCode[e.toLowerCase()]=t}keyCodeToStr(t){return this._keyCodeToStr[t]}strToKeyCode(t){return this._strToKeyCode[t.toLowerCase()]||0}},on=new pa,Sl=new pa,yl=new pa,Gg=new Array(230),Ed;(t=>{function e(a){return on.keyCodeToStr(a)}t.toString=e;function s(a){return on.strToKeyCode(a)}t.fromString=s;function i(a){return Sl.keyCodeToStr(a)}t.toUserSettingsUS=i;function r(a){return yl.keyCodeToStr(a)}t.toUserSettingsGeneral=r;function n(a){return Sl.strToKeyCode(a)||yl.strToKeyCode(a)}t.fromUserSettings=n;function o(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return on.keyCodeToStr(a)}t.toElectronAccelerator=o})(Ed||={});var Yg=class Rd{constructor(e,s,i,r,n){this.ctrlKey=e,this.shiftKey=s,this.altKey=i,this.metaKey=r,this.keyCode=n}equals(e){return e instanceof Rd&&this.ctrlKey===e.ctrlKey&&this.shiftKey===e.shiftKey&&this.altKey===e.altKey&&this.metaKey===e.metaKey&&this.keyCode===e.keyCode}getHashCode(){let e=this.ctrlKey?"1":"0",s=this.shiftKey?"1":"0",i=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${e}${s}${i}${r}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new Xg([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},Xg=class{constructor(t){if(t.length===0)throw yg("chords");this.chords=t}getHashCode(){let t="";for(let e=0,s=this.chords.length;e<s;e++)e!==0&&(t+=";"),t+=this.chords[e].getHashCode();return t}equals(t){if(t===null||this.chords.length!==t.chords.length)return!1;for(let e=0;e<this.chords.length;e++)if(!this.chords[e].equals(t.chords[e]))return!1;return!0}};function Jg(t){if(t.charCode){let s=String.fromCharCode(t.charCode).toUpperCase();return Ed.fromString(s)}let e=t.keyCode;if(e===3)return 7;if(Yn)switch(e){case 59:return 85;case 60:if(Ug)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Zt)return 57;break}else if(zg&&(Zt&&e===93||!Zt&&e===92))return 57;return Gg[e]||0}var Zg=Zt?256:2048,Qg=512,ev=1024,tv=Zt?2048:256,xl=class{constructor(t){this._standardKeyboardEventBrand=!0;let e=t;this.browserEvent=e,this.target=e.target,this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey,this.altGraphKey=e.getModifierState?.("AltGraph"),this.keyCode=Jg(e),this.code=e.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(t){return this._asKeybinding===t}_computeKeybinding(){let t=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(t=this.keyCode);let e=0;return this.ctrlKey&&(e|=Zg),this.altKey&&(e|=Qg),this.shiftKey&&(e|=ev),this.metaKey&&(e|=tv),e|=t,e}_computeKeyCodeChord(){let t=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(t=this.keyCode),new Yg(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,t)}},wl=new WeakMap;function sv(t){if(!t.parent||t.parent===t)return null;try{let e=t.location,s=t.parent.location;if(e.origin!=="null"&&s.origin!=="null"&&e.origin!==s.origin)return null}catch{return null}return t.parent}var iv=class{static getSameOriginWindowChain(t){let e=wl.get(t);if(!e){e=[],wl.set(t,e);let s=t,i;do i=sv(s),i?e.push({window:new WeakRef(s),iframeElement:s.frameElement||null}):e.push({window:new WeakRef(s),iframeElement:null}),s=i;while(s)}return e.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(t,e){if(!e||t===e)return{top:0,left:0};let s=0,i=0,r=this.getSameOriginWindowChain(t);for(let n of r){let o=n.window.deref();if(s+=o?.scrollY??0,i+=o?.scrollX??0,o===e||!n.iframeElement)break;let a=n.iframeElement.getBoundingClientRect();s+=a.top,i+=a.left}return{top:s,left:i}}},tr=class{constructor(t,e){this.timestamp=Date.now(),this.browserEvent=e,this.leftButton=e.button===0,this.middleButton=e.button===1,this.rightButton=e.button===2,this.buttons=e.buttons,this.target=e.target,this.detail=e.detail||1,e.type==="dblclick"&&(this.detail=2),this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey,typeof e.pageX=="number"?(this.posx=e.pageX,this.posy=e.pageY):(this.posx=e.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=e.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let s=iv.getPositionOfChildWindowRelativeToAncestorWindow(t,e.view);this.posx-=s.left,this.posy-=s.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Cl=class{constructor(t,e=0,s=0){this.browserEvent=t||null,this.target=t?t.target||t.targetNode||t.srcElement:null,this.deltaY=s,this.deltaX=e;let i=!1;if(fa){let r=navigator.userAgent.match(/Chrome\/(\d+)/);i=(r?parseInt(r[1]):123)<=122}if(t){let r=t,n=t,o=t.view?.devicePixelRatio||1;if(typeof r.wheelDeltaY<"u")i?this.deltaY=r.wheelDeltaY/(120*o):this.deltaY=r.wheelDeltaY/120;else if(typeof n.VERTICAL_AXIS<"u"&&n.axis===n.VERTICAL_AXIS)this.deltaY=-n.detail/3;else if(t.type==="wheel"){let a=t;a.deltaMode===a.DOM_DELTA_LINE?Yn&&!Zt?this.deltaY=-t.deltaY/3:this.deltaY=-t.deltaY:this.deltaY=-t.deltaY/40}if(typeof r.wheelDeltaX<"u")$g&&Pd?this.deltaX=-(r.wheelDeltaX/120):i?this.deltaX=r.wheelDeltaX/(120*o):this.deltaX=r.wheelDeltaX/120;else if(typeof n.HORIZONTAL_AXIS<"u"&&n.axis===n.HORIZONTAL_AXIS)this.deltaX=-t.detail/3;else if(t.type==="wheel"){let a=t;a.deltaMode===a.DOM_DELTA_LINE?Yn&&!Zt?this.deltaX=-t.deltaX/3:this.deltaX=-t.deltaX:this.deltaX=-t.deltaX/40}this.deltaY===0&&this.deltaX===0&&t.wheelDelta&&(i?this.deltaY=t.wheelDelta/(120*o):this.deltaY=t.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},Td=Object.freeze(function(t,e){let s=setTimeout(t.bind(e),0);return{dispose(){clearTimeout(s)}}}),rv;(t=>{function e(s){return s===t.None||s===t.Cancelled||s instanceof nv?!0:!s||typeof s!="object"?!1:typeof s.isCancellationRequested=="boolean"&&typeof s.onCancellationRequested=="function"}t.isCancellationToken=e,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:dt.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Td})})(rv||={});var nv=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Td:(this._emitter||(this._emitter=new te),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},_a=class{constructor(t,e){this._isDisposed=!1,this._token=-1,typeof t=="function"&&typeof e=="number"&&this.setIfNotSet(t,e)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(t,e){if(this._isDisposed)throw new Wn("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,t()},e)}setIfNotSet(t,e){if(this._isDisposed)throw new Wn("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,t()},e))}},ov=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(t,e,s=globalThis){if(this.isDisposed)throw new Wn("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let i=s.setInterval(()=>{t()},e);this.disposable=Le(()=>{s.clearInterval(i),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},av;(t=>{async function e(i){let r,n=await Promise.all(i.map(o=>o.then(a=>a,a=>{r||(r=a)})));if(typeof r<"u")throw r;return n}t.settled=e;function s(i){return new Promise(async(r,n)=>{try{await i(r,n)}catch(o){n(o)}})}t.withAsyncBody=s})(av||={});var kl=class Lt{static fromArray(e){return new Lt(s=>{s.emitMany(e)})}static fromPromise(e){return new Lt(async s=>{s.emitMany(await e)})}static fromPromises(e){return new Lt(async s=>{await Promise.all(e.map(async i=>s.emitOne(await i)))})}static merge(e){return new Lt(async s=>{await Promise.all(e.map(async i=>{for await(let r of i)s.emitOne(r)}))})}constructor(e,s){this._state=0,this._results=[],this._error=null,this._onReturn=s,this._onStateChanged=new te,queueMicrotask(async()=>{let i={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(e(i)),this.resolve()}catch(r){this.reject(r)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await dt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(e,s){return new Lt(async i=>{for await(let r of e)i.emitOne(s(r))})}map(e){return Lt.map(this,e)}static filter(e,s){return new Lt(async i=>{for await(let r of e)s(r)&&i.emitOne(r)})}filter(e){return Lt.filter(this,e)}static coalesce(e){return Lt.filter(e,s=>!!s)}coalesce(){return Lt.coalesce(this)}static async toPromise(e){let s=[];for await(let i of e)s.push(i);return s}toPromise(){return Lt.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};kl.EMPTY=kl.fromArray([]);var{getWindow:Jt,getWindowId:lv,onDidRegisterWindow:cv}=(function(){let t=new Map,e={window:os,disposables:new ws};t.set(os.vscodeWindowId,e);let s=new te,i=new te,r=new te;function n(o,a){return(typeof o=="number"?t.get(o):void 0)??(a?e:void 0)}return{onDidRegisterWindow:s.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:i.event,registerWindow(o){if(t.has(o.vscodeWindowId))return ye.None;let a=new ws,c={window:o,disposables:a.add(new ws)};return t.set(o.vscodeWindowId,c),a.add(Le(()=>{t.delete(o.vscodeWindowId),i.fire(o)})),a.add(me(o,nt.BEFORE_UNLOAD,()=>{r.fire(o)})),s.fire(c),a},getWindows(){return t.values()},getWindowsCount(){return t.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return t.has(o)},getWindowById:n,getWindow(o){let a=o;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;let c=o;return c?.view?c.view.window:os},getDocument(o){return Jt(o).document}}})(),hv=class{constructor(t,e,s,i){this._node=t,this._type=e,this._handler=s,this._options=i||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function me(t,e,s,i){return new hv(t,e,s,i)}var Pl=function(t,e,s,i){return me(t,e,s,i)},ma,dv=class extends ov{constructor(t){super(),this.defaultTarget=t&&Jt(t)}cancelAndSet(t,e,s){return super.cancelAndSet(t,e,s??this.defaultTarget)}},El=class{constructor(t,e=0){this._runner=t,this.priority=e,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(t){ur(t)}}static sort(t,e){return e.priority-t.priority}};(function(){let t=new Map,e=new Map,s=new Map,i=new Map,r=n=>{s.set(n,!1);let o=t.get(n)??[];for(e.set(n,o),t.set(n,[]),i.set(n,!0);o.length>0;)o.sort(El.sort),o.shift().execute();i.set(n,!1)};ma=(n,o,a=0)=>{let c=lv(n),l=new El(o,a),u=t.get(c);return u||(u=[],t.set(c,u)),u.push(l),s.get(c)||(s.set(c,!0),n.requestAnimationFrame(()=>r(c))),l}})();function uv(t){let e=t.getBoundingClientRect(),s=Jt(t);return{left:e.left+s.scrollX,top:e.top+s.scrollY,width:e.width,height:e.height}}var nt={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},fv=class{constructor(t){this.domNode=t,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(t){let e=yt(t);this._maxWidth!==e&&(this._maxWidth=e,this.domNode.style.maxWidth=this._maxWidth)}setWidth(t){let e=yt(t);this._width!==e&&(this._width=e,this.domNode.style.width=this._width)}setHeight(t){let e=yt(t);this._height!==e&&(this._height=e,this.domNode.style.height=this._height)}setTop(t){let e=yt(t);this._top!==e&&(this._top=e,this.domNode.style.top=this._top)}setLeft(t){let e=yt(t);this._left!==e&&(this._left=e,this.domNode.style.left=this._left)}setBottom(t){let e=yt(t);this._bottom!==e&&(this._bottom=e,this.domNode.style.bottom=this._bottom)}setRight(t){let e=yt(t);this._right!==e&&(this._right=e,this.domNode.style.right=this._right)}setPaddingTop(t){let e=yt(t);this._paddingTop!==e&&(this._paddingTop=e,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(t){let e=yt(t);this._paddingLeft!==e&&(this._paddingLeft=e,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(t){let e=yt(t);this._paddingBottom!==e&&(this._paddingBottom=e,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(t){let e=yt(t);this._paddingRight!==e&&(this._paddingRight=e,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(t){this._fontFamily!==t&&(this._fontFamily=t,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(t){let e=yt(t);this._fontSize!==e&&(this._fontSize=e,this.domNode.style.fontSize=this._fontSize)}setFontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(t){this._fontFeatureSettings!==t&&(this._fontFeatureSettings=t,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(t){this._fontVariationSettings!==t&&(this._fontVariationSettings=t,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(t){this._textDecoration!==t&&(this._textDecoration=t,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(t){let e=yt(t);this._lineHeight!==e&&(this._lineHeight=e,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(t){let e=yt(t);this._letterSpacing!==e&&(this._letterSpacing=e,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(t){this._className!==t&&(this._className=t,this.domNode.className=this._className)}toggleClassName(t,e){this.domNode.classList.toggle(t,e),this._className=this.domNode.className}setDisplay(t){this._display!==t&&(this._display=t,this.domNode.style.display=this._display)}setPosition(t){this._position!==t&&(this._position=t,this.domNode.style.position=this._position)}setVisibility(t){this._visibility!==t&&(this._visibility=t,this.domNode.style.visibility=this._visibility)}setColor(t){this._color!==t&&(this._color=t,this.domNode.style.color=this._color)}setBackgroundColor(t){this._backgroundColor!==t&&(this._backgroundColor=t,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(t){this._layerHint!==t&&(this._layerHint=t,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(t){this._boxShadow!==t&&(this._boxShadow=t,this.domNode.style.boxShadow=t)}setContain(t){this._contain!==t&&(this._contain=t,this.domNode.style.contain=this._contain)}setAttribute(t,e){this.domNode.setAttribute(t,e)}removeAttribute(t){this.domNode.removeAttribute(t)}appendChild(t){this.domNode.appendChild(t.domNode)}removeChild(t){this.domNode.removeChild(t.domNode)}};function yt(t){return typeof t=="number"?`${t}px`:t}function ki(t){return new fv(t)}var Ad=class{constructor(){this._hooks=new ws,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(t,e){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let s=this._onStopCallback;this._onStopCallback=null,t&&s&&s(e)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(t,e,s,i,r){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=i,this._onStopCallback=r;let n=t;try{t.setPointerCapture(e),this._hooks.add(Le(()=>{try{t.releasePointerCapture(e)}catch{}}))}catch{n=Jt(t)}this._hooks.add(me(n,nt.POINTER_MOVE,o=>{if(o.buttons!==s){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(me(n,nt.POINTER_UP,o=>this.stopMonitoring(!0)))}};function pv(t,e,s){let i=null,r=null;if(typeof s.value=="function"?(i="value",r=s.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof s.get=="function"&&(i="get",r=s.get),!r)throw new Error("not supported");let n=`$memoize$${e}`;s[i]=function(...o){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,o)}),this[n]}}var Gt;(t=>(t.Tap="-xterm-gesturetap",t.Change="-xterm-gesturechange",t.Start="-xterm-gesturestart",t.End="-xterm-gesturesend",t.Contextmenu="-xterm-gesturecontextmenu"))(Gt||={});var gi=class ft extends ye{constructor(){super(),this.dispatched=!1,this.targets=new gl,this.ignoreTargets=new gl,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(dt.runAndSubscribe(cv,({window:e,disposables:s})=>{s.add(me(e.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),s.add(me(e.document,"touchend",i=>this.onTouchEnd(e,i))),s.add(me(e.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:os,disposables:this._store}))}static addTarget(e){if(!ft.isTouchDevice())return ye.None;ft.INSTANCE||(ft.INSTANCE=new ft);let s=ft.INSTANCE.targets.push(e);return Le(s)}static ignoreTarget(e){if(!ft.isTouchDevice())return ye.None;ft.INSTANCE||(ft.INSTANCE=new ft);let s=ft.INSTANCE.ignoreTargets.push(e);return Le(s)}static isTouchDevice(){return"ontouchstart"in os||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let s=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,r=e.targetTouches.length;i<r;i++){let n=e.targetTouches.item(i);this.activeTouches[n.identifier]={id:n.identifier,initialTarget:n.target,initialTimeStamp:s,initialPageX:n.pageX,initialPageY:n.pageY,rollingTimestamps:[s],rollingPageX:[n.pageX],rollingPageY:[n.pageY]};let o=this.newGestureEvent(Gt.Start,n.target);o.pageX=n.pageX,o.pageY=n.pageY,this.dispatchEvent(o)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}onTouchEnd(e,s){let i=Date.now(),r=Object.keys(this.activeTouches).length;for(let n=0,o=s.changedTouches.length;n<o;n++){let a=s.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("move of an UNKNOWN touch",a);continue}let c=this.activeTouches[a.identifier],l=Date.now()-c.initialTimeStamp;if(l<ft.HOLD_DELAY&&Math.abs(c.initialPageX-Dt(c.rollingPageX))<30&&Math.abs(c.initialPageY-Dt(c.rollingPageY))<30){let u=this.newGestureEvent(Gt.Tap,c.initialTarget);u.pageX=Dt(c.rollingPageX),u.pageY=Dt(c.rollingPageY),this.dispatchEvent(u)}else if(l>=ft.HOLD_DELAY&&Math.abs(c.initialPageX-Dt(c.rollingPageX))<30&&Math.abs(c.initialPageY-Dt(c.rollingPageY))<30){let u=this.newGestureEvent(Gt.Contextmenu,c.initialTarget);u.pageX=Dt(c.rollingPageX),u.pageY=Dt(c.rollingPageY),this.dispatchEvent(u)}else if(r===1){let u=Dt(c.rollingPageX),d=Dt(c.rollingPageY),f=Dt(c.rollingTimestamps)-c.rollingTimestamps[0],p=u-c.rollingPageX[0],_=d-c.rollingPageY[0],g=[...this.targets].filter(v=>c.initialTarget instanceof Node&&v.contains(c.initialTarget));this.inertia(e,g,i,Math.abs(p)/f,p>0?1:-1,u,Math.abs(_)/f,_>0?1:-1,d)}this.dispatchEvent(this.newGestureEvent(Gt.End,c.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(s.preventDefault(),s.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,s){let i=document.createEvent("CustomEvent");return i.initEvent(e,!1,!0),i.initialTarget=s,i.tapCount=0,i}dispatchEvent(e){if(e.type===Gt.Tap){let s=new Date().getTime(),i=0;s-this._lastSetTapCountTime>ft.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=s,e.tapCount=i}else(e.type===Gt.Change||e.type===Gt.Contextmenu)&&(this._lastSetTapCountTime=0);if(e.initialTarget instanceof Node){for(let i of this.ignoreTargets)if(i.contains(e.initialTarget))return;let s=[];for(let i of this.targets)if(i.contains(e.initialTarget)){let r=0,n=e.initialTarget;for(;n&&n!==i;)r++,n=n.parentElement;s.push([r,i])}s.sort((i,r)=>i[0]-r[0]);for(let[i,r]of s)r.dispatchEvent(e),this.dispatched=!0}}inertia(e,s,i,r,n,o,a,c,l){this.handle=ma(e,()=>{let u=Date.now(),d=u-i,f=0,p=0,_=!0;r+=ft.SCROLL_FRICTION*d,a+=ft.SCROLL_FRICTION*d,r>0&&(_=!1,f=n*r*d),a>0&&(_=!1,p=c*a*d);let g=this.newGestureEvent(Gt.Change);g.translationX=f,g.translationY=p,s.forEach(v=>v.dispatchEvent(g)),_||this.inertia(e,s,u,r,n,o+f,a,c,l+p)})}onTouchMove(e){let s=Date.now();for(let i=0,r=e.changedTouches.length;i<r;i++){let n=e.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(n.identifier))){console.warn("end of an UNKNOWN touch",n);continue}let o=this.activeTouches[n.identifier],a=this.newGestureEvent(Gt.Change,o.initialTarget);a.translationX=n.pageX-Dt(o.rollingPageX),a.translationY=n.pageY-Dt(o.rollingPageY),a.pageX=n.pageX,a.pageY=n.pageY,this.dispatchEvent(a),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(n.pageX),o.rollingPageY.push(n.pageY),o.rollingTimestamps.push(s)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};gi.SCROLL_FRICTION=-.005,gi.HOLD_DELAY=700,gi.CLEAR_TAP_COUNT_TIME=400,He([pv],gi,"isTouchDevice",1);var _v=gi,ga=class extends ye{onclick(t,e){this._register(me(t,nt.CLICK,s=>e(new tr(Jt(t),s))))}onmousedown(t,e){this._register(me(t,nt.MOUSE_DOWN,s=>e(new tr(Jt(t),s))))}onmouseover(t,e){this._register(me(t,nt.MOUSE_OVER,s=>e(new tr(Jt(t),s))))}onmouseleave(t,e){this._register(me(t,nt.MOUSE_LEAVE,s=>e(new tr(Jt(t),s))))}onkeydown(t,e){this._register(me(t,nt.KEY_DOWN,s=>e(new xl(s))))}onkeyup(t,e){this._register(me(t,nt.KEY_UP,s=>e(new xl(s))))}oninput(t,e){this._register(me(t,nt.INPUT,e))}onblur(t,e){this._register(me(t,nt.BLUR,e))}onfocus(t,e){this._register(me(t,nt.FOCUS,e))}onchange(t,e){this._register(me(t,nt.CHANGE,e))}ignoreGesture(t){return _v.ignoreTarget(t)}},Rl=11,mv=class extends ga{constructor(t){super(),this._onActivate=t.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=t.bgWidth+"px",this.bgDomNode.style.height=t.bgHeight+"px",typeof t.top<"u"&&(this.bgDomNode.style.top="0px"),typeof t.left<"u"&&(this.bgDomNode.style.left="0px"),typeof t.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof t.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=t.className,this.domNode.style.position="absolute",this.domNode.style.width=Rl+"px",this.domNode.style.height=Rl+"px",typeof t.top<"u"&&(this.domNode.style.top=t.top+"px"),typeof t.left<"u"&&(this.domNode.style.left=t.left+"px"),typeof t.bottom<"u"&&(this.domNode.style.bottom=t.bottom+"px"),typeof t.right<"u"&&(this.domNode.style.right=t.right+"px"),this._pointerMoveMonitor=this._register(new Ad),this._register(Pl(this.bgDomNode,nt.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(Pl(this.domNode,nt.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new dv),this._pointerdownScheduleRepeatTimer=this._register(new _a)}_arrowPointerDown(t){if(!t.target||!(t.target instanceof Element))return;let e=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Jt(t))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(e,200),this._pointerMoveMonitor.startMonitoring(t.target,t.pointerId,t.buttons,s=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),t.preventDefault()}},gv=class Zn{constructor(e,s,i,r,n,o,a){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(s=s|0,i=i|0,r=r|0,n=n|0,o=o|0,a=a|0),this.rawScrollLeft=r,this.rawScrollTop=a,s<0&&(s=0),r+s>i&&(r=i-s),r<0&&(r=0),n<0&&(n=0),a+n>o&&(a=o-n),a<0&&(a=0),this.width=s,this.scrollWidth=i,this.scrollLeft=r,this.height=n,this.scrollHeight=o,this.scrollTop=a}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(e,s){return new Zn(this._forceIntegerValues,typeof e.width<"u"?e.width:this.width,typeof e.scrollWidth<"u"?e.scrollWidth:this.scrollWidth,s?this.rawScrollLeft:this.scrollLeft,typeof e.height<"u"?e.height:this.height,typeof e.scrollHeight<"u"?e.scrollHeight:this.scrollHeight,s?this.rawScrollTop:this.scrollTop)}withScrollPosition(e){return new Zn(this._forceIntegerValues,this.width,this.scrollWidth,typeof e.scrollLeft<"u"?e.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof e.scrollTop<"u"?e.scrollTop:this.rawScrollTop)}createScrollEvent(e,s){let i=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,n=this.scrollLeft!==e.scrollLeft,o=this.height!==e.height,a=this.scrollHeight!==e.scrollHeight,c=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:s,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:r,scrollLeftChanged:n,heightChanged:o,scrollHeightChanged:a,scrollTopChanged:c}}},vv=class extends ye{constructor(t){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new te),this.onScroll=this._onScroll.event,this._smoothScrollDuration=t.smoothScrollDuration,this._scheduleAtNextAnimationFrame=t.scheduleAtNextAnimationFrame,this._state=new gv(t.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(t){this._smoothScrollDuration=t}validateScrollPosition(t){return this._state.withScrollPosition(t)}getScrollDimensions(){return this._state}setScrollDimensions(t,e){let s=this._state.withScrollDimensions(t,e);this._setState(s,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(t){let e=this._state.withScrollPosition(t);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(e,!1)}setScrollPositionSmooth(t,e){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(t);if(this._smoothScrolling){t={scrollLeft:typeof t.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:t.scrollLeft,scrollTop:typeof t.scrollTop>"u"?this._smoothScrolling.to.scrollTop:t.scrollTop};let s=this._state.withScrollPosition(t);if(this._smoothScrolling.to.scrollLeft===s.scrollLeft&&this._smoothScrolling.to.scrollTop===s.scrollTop)return;let i;e?i=new Al(this._smoothScrolling.from,s,this._smoothScrolling.startTime,this._smoothScrolling.duration):i=this._smoothScrolling.combine(this._state,s,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=i}else{let s=this._state.withScrollPosition(t);this._smoothScrolling=Al.start(this._state,s,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let t=this._smoothScrolling.tick(),e=this._state.withScrollPosition(t);if(this._setState(e,!0),!!this._smoothScrolling){if(t.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(t,e){let s=this._state;s.equals(t)||(this._state=t,this._onScroll.fire(this._state.createScrollEvent(s,e)))}},Tl=class{constructor(t,e,s){this.scrollLeft=t,this.scrollTop=e,this.isDone=s}};function an(t,e){let s=e-t;return function(i){return t+s*yv(i)}}function bv(t,e,s){return function(i){return i<s?t(i/s):e((i-s)/(1-s))}}var Al=class Qn{constructor(e,s,i,r){this.from=e,this.to=s,this.duration=r,this.startTime=i,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,s,i){if(Math.abs(e-s)>2.5*i){let r,n;return e<s?(r=e+.75*i,n=s-.75*i):(r=e-.75*i,n=s+.75*i),bv(an(e,r),an(n,s),.33)}return an(e,s)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let s=(e-this.startTime)/this.duration;if(s<1){let i=this.scrollLeft(s),r=this.scrollTop(s);return new Tl(i,r,!1)}return new Tl(this.to.scrollLeft,this.to.scrollTop,!0)}combine(e,s,i){return Qn.start(e,s,i)}static start(e,s,i){i=i+10;let r=Date.now()-10;return new Qn(e,s,r,i)}};function Sv(t){return Math.pow(t,3)}function yv(t){return 1-Sv(1-t)}var xv=class extends ye{constructor(t,e,s){super(),this._visibility=t,this._visibleClassName=e,this._invisibleClassName=s,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new _a)}setVisibility(t){this._visibility!==t&&(this._visibility=t,this._updateShouldBeVisible())}setShouldBeVisible(t){this._rawShouldBeVisible=t,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let t=this._applyVisibilitySetting();this._shouldBeVisible!==t&&(this._shouldBeVisible=t,this.ensureVisibility())}setIsNeeded(t){this._isNeeded!==t&&(this._isNeeded=t,this.ensureVisibility())}setDomNode(t){this._domNode=t,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(t){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(t?" fade":"")))}},wv=140,Dd=class extends ga{constructor(t){super(),this._lazyRender=t.lazyRender,this._host=t.host,this._scrollable=t.scrollable,this._scrollByPage=t.scrollByPage,this._scrollbarState=t.scrollbarState,this._visibilityController=this._register(new xv(t.visibility,"visible scrollbar "+t.extraScrollbarClassName,"invisible scrollbar "+t.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Ad),this._shouldRender=!0,this.domNode=ki(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(me(this.domNode.domNode,nt.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(t){let e=this._register(new mv(t));this.domNode.domNode.appendChild(e.bgDomNode),this.domNode.domNode.appendChild(e.domNode)}_createSlider(t,e,s,i){this.slider=ki(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(t),this.slider.setLeft(e),typeof s=="number"&&this.slider.setWidth(s),typeof i=="number"&&this.slider.setHeight(i),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(me(this.slider.domNode,nt.POINTER_DOWN,r=>{r.button===0&&(r.preventDefault(),this._sliderPointerDown(r))})),this.onclick(this.slider.domNode,r=>{r.leftButton&&r.stopPropagation()})}_onElementSize(t){return this._scrollbarState.setVisibleSize(t)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(t){return this._scrollbarState.setScrollSize(t)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(t){return this._scrollbarState.setScrollPosition(t)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(t){t.target===this.domNode.domNode&&this._onPointerDown(t)}delegatePointerDown(t){let e=this.domNode.domNode.getClientRects()[0].top,s=e+this._scrollbarState.getSliderPosition(),i=e+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),r=this._sliderPointerPosition(t);s<=r&&r<=i?t.button===0&&(t.preventDefault(),this._sliderPointerDown(t)):this._onPointerDown(t)}_onPointerDown(t){let e,s;if(t.target===this.domNode.domNode&&typeof t.offsetX=="number"&&typeof t.offsetY=="number")e=t.offsetX,s=t.offsetY;else{let r=uv(this.domNode.domNode);e=t.pageX-r.left,s=t.pageY-r.top}let i=this._pointerDownRelativePosition(e,s);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(i):this._scrollbarState.getDesiredScrollPositionFromOffset(i)),t.button===0&&(t.preventDefault(),this._sliderPointerDown(t))}_sliderPointerDown(t){if(!t.target||!(t.target instanceof Element))return;let e=this._sliderPointerPosition(t),s=this._sliderOrthogonalPointerPosition(t),i=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(t.target,t.pointerId,t.buttons,r=>{let n=this._sliderOrthogonalPointerPosition(r),o=Math.abs(n-s);if(Pd&&o>wv){this._setDesiredScrollPositionNow(i.getScrollPosition());return}let a=this._sliderPointerPosition(r)-e;this._setDesiredScrollPositionNow(i.getDesiredScrollPositionFromDelta(a))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(t){let e={};this.writeScrollPosition(e,t),this._scrollable.setScrollPositionNow(e)}updateScrollbarSize(t){this._updateScrollbarSize(t),this._scrollbarState.setScrollbarSize(t),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},Nd=class eo{constructor(e,s,i,r,n,o){this._scrollbarSize=Math.round(s),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=n,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new eo(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let s=Math.round(e);return this._visibleSize!==s?(this._visibleSize=s,this._refreshComputedValues(),!0):!1}setScrollSize(e){let s=Math.round(e);return this._scrollSize!==s?(this._scrollSize=s,this._refreshComputedValues(),!0):!1}setScrollPosition(e){let s=Math.round(e);return this._scrollPosition!==s?(this._scrollPosition=s,this._refreshComputedValues(),!0):!1}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,s,i,r,n){let o=Math.max(0,i-e),a=Math.max(0,o-2*s),c=r>0&&r>i;if(!c)return{computedAvailableSize:Math.round(o),computedIsNeeded:c,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};let l=Math.round(Math.max(20,Math.floor(i*a/r))),u=(a-l)/(r-i),d=n*u;return{computedAvailableSize:Math.round(o),computedIsNeeded:c,computedSliderSize:Math.round(l),computedSliderRatio:u,computedSliderPosition:Math.round(d)}}_refreshComputedValues(){let e=eo._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=e.computedAvailableSize,this._computedIsNeeded=e.computedIsNeeded,this._computedSliderSize=e.computedSliderSize,this._computedSliderRatio=e.computedSliderRatio,this._computedSliderPosition=e.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let s=e-this._arrowSize-this._computedSliderSize/2;return Math.round(s/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let s=e-this._arrowSize,i=this._scrollPosition;return s<this._computedSliderPosition?i-=this._visibleSize:i+=this._visibleSize,i}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let s=this._computedSliderPosition+e;return Math.round(s/this._computedSliderRatio)}},Cv=class extends Dd{constructor(t,e,s){let i=t.getScrollDimensions(),r=t.getCurrentScrollPosition();if(super({lazyRender:e.lazyRender,host:s,scrollbarState:new Nd(e.horizontalHasArrows?e.arrowSize:0,e.horizontal===2?0:e.horizontalScrollbarSize,e.vertical===2?0:e.verticalScrollbarSize,i.width,i.scrollWidth,r.scrollLeft),visibility:e.horizontal,extraScrollbarClassName:"horizontal",scrollable:t,scrollByPage:e.scrollByPage}),e.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((e.horizontalScrollbarSize-e.horizontalSliderSize)/2),0,void 0,e.horizontalSliderSize)}_updateSlider(t,e){this.slider.setWidth(t),this.slider.setLeft(e)}_renderDomNode(t,e){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(t){return this._shouldRender=this._onElementScrollSize(t.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(t.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(t.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(t,e){return t}_sliderPointerPosition(t){return t.pageX}_sliderOrthogonalPointerPosition(t){return t.pageY}_updateScrollbarSize(t){this.slider.setHeight(t)}writeScrollPosition(t,e){t.scrollLeft=e}updateOptions(t){this.updateScrollbarSize(t.horizontal===2?0:t.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(t.vertical===2?0:t.verticalScrollbarSize),this._visibilityController.setVisibility(t.horizontal),this._scrollByPage=t.scrollByPage}},kv=class extends Dd{constructor(t,e,s){let i=t.getScrollDimensions(),r=t.getCurrentScrollPosition();if(super({lazyRender:e.lazyRender,host:s,scrollbarState:new Nd(e.verticalHasArrows?e.arrowSize:0,e.vertical===2?0:e.verticalScrollbarSize,0,i.height,i.scrollHeight,r.scrollTop),visibility:e.vertical,extraScrollbarClassName:"vertical",scrollable:t,scrollByPage:e.scrollByPage}),e.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((e.verticalScrollbarSize-e.verticalSliderSize)/2),e.verticalSliderSize,void 0)}_updateSlider(t,e){this.slider.setHeight(t),this.slider.setTop(e)}_renderDomNode(t,e){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(t){return this._shouldRender=this._onElementScrollSize(t.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(t.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(t.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(t,e){return e}_sliderPointerPosition(t){return t.pageY}_sliderOrthogonalPointerPosition(t){return t.pageX}_updateScrollbarSize(t){this.slider.setWidth(t)}writeScrollPosition(t,e){t.scrollTop=e}updateOptions(t){this.updateScrollbarSize(t.vertical===2?0:t.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(t.vertical),this._scrollByPage=t.scrollByPage}},Pv=500,Dl=50,Ev=class{constructor(t,e,s){this.timestamp=t,this.deltaX=e,this.deltaY=s,this.score=0}},to=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,s=0,i=1,r=this._rear;do{let n=r===this._front?e:Math.pow(2,-i);if(e-=n,s+=this._memory[r].score*n,r===this._front)break;r=(this._capacity+r-1)%this._capacity,i++}while(!0);return s<=.5}acceptStandardWheelEvent(e){if(fa){let s=Jt(e.browserEvent),i=Og(s);this.accept(Date.now(),e.deltaX*i,e.deltaY*i)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,s,i){let r=null,n=new Ev(e,s,i);this._front===-1&&this._rear===-1?(this._memory[0]=n,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=n),n.score=this._computeScore(n,r)}_computeScore(e,s){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(i+=.25),s){let r=Math.abs(e.deltaX),n=Math.abs(e.deltaY),o=Math.abs(s.deltaX),a=Math.abs(s.deltaY),c=Math.max(Math.min(r,o),1),l=Math.max(Math.min(n,a),1),u=Math.max(r,o),d=Math.max(n,a);u%c===0&&d%l===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};to.INSTANCE=new to;var Rv=to,Tv=class extends ga{constructor(t,e,s){super(),this._onScroll=this._register(new te),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new te),this.onWillScroll=this._onWillScroll.event,this._options=Dv(e),this._scrollable=s,this._register(this._scrollable.onScroll(r=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let i={onMouseWheel:r=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new kv(this._scrollable,this._options,i)),this._horizontalScrollbar=this._register(new Cv(this._scrollable,this._options,i)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(t),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=ki(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=ki(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=ki(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,r=>this._onMouseOver(r)),this.onmouseleave(this._listenOnDomNode,r=>this._onMouseLeave(r)),this._hideTimeout=this._register(new _a),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Os(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(t){this._verticalScrollbar.delegatePointerDown(t)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(t){this._scrollable.setScrollDimensions(t,!1)}updateClassName(t){this._options.className=t,Zt&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(t){typeof t.handleMouseWheel<"u"&&(this._options.handleMouseWheel=t.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof t.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=t.mouseWheelScrollSensitivity),typeof t.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=t.fastScrollSensitivity),typeof t.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=t.scrollPredominantAxis),typeof t.horizontal<"u"&&(this._options.horizontal=t.horizontal),typeof t.vertical<"u"&&(this._options.vertical=t.vertical),typeof t.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=t.horizontalScrollbarSize),typeof t.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=t.verticalScrollbarSize),typeof t.scrollByPage<"u"&&(this._options.scrollByPage=t.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(t){this._revealOnScroll=t}delegateScrollFromMouseWheelEvent(t){this._onMouseWheel(new Cl(t))}_setListeningToMouseWheel(t){if(this._mouseWheelToDispose.length>0!==t&&(this._mouseWheelToDispose=Os(this._mouseWheelToDispose),t)){let e=s=>{this._onMouseWheel(new Cl(s))};this._mouseWheelToDispose.push(me(this._listenOnDomNode,nt.MOUSE_WHEEL,e,{passive:!1}))}}_onMouseWheel(t){if(t.browserEvent?.defaultPrevented)return;let e=Rv.INSTANCE;e.acceptStandardWheelEvent(t);let s=!1;if(t.deltaY||t.deltaX){let r=t.deltaY*this._options.mouseWheelScrollSensitivity,n=t.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&n+r===0?n=r=0:Math.abs(r)>=Math.abs(n)?n=0:r=0),this._options.flipAxes&&([r,n]=[n,r]);let o=!Zt&&t.browserEvent&&t.browserEvent.shiftKey;(this._options.scrollYToX||o)&&!n&&(n=r,r=0),t.browserEvent&&t.browserEvent.altKey&&(n=n*this._options.fastScrollSensitivity,r=r*this._options.fastScrollSensitivity);let a=this._scrollable.getFutureScrollPosition(),c={};if(r){let l=Dl*r,u=a.scrollTop-(l<0?Math.floor(l):Math.ceil(l));this._verticalScrollbar.writeScrollPosition(c,u)}if(n){let l=Dl*n,u=a.scrollLeft-(l<0?Math.floor(l):Math.ceil(l));this._horizontalScrollbar.writeScrollPosition(c,u)}c=this._scrollable.validateScrollPosition(c),(a.scrollLeft!==c.scrollLeft||a.scrollTop!==c.scrollTop)&&(this._options.mouseWheelSmoothScroll&&e.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(c):this._scrollable.setScrollPositionNow(c),s=!0)}let i=s;!i&&this._options.alwaysConsumeMouseWheel&&(i=!0),!i&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(i=!0),i&&(t.preventDefault(),t.stopPropagation())}_onDidScroll(t){this._shouldRender=this._horizontalScrollbar.onDidScroll(t)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(t)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let t=this._scrollable.getCurrentScrollPosition(),e=t.scrollTop>0,s=t.scrollLeft>0,i=s?" left":"",r=e?" top":"",n=s||e?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${i}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${n}${r}${i}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(t){this._mouseIsOver=!1,this._hide()}_onMouseOver(t){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),Pv)}},Av=class extends Tv{constructor(t,e,s){super(t,e,s)}setScrollPosition(t){t.reuseAnimation?this._scrollable.setScrollPositionSmooth(t,t.reuseAnimation):this._scrollable.setScrollPositionNow(t)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Dv(t){let e={lazyRender:typeof t.lazyRender<"u"?t.lazyRender:!1,className:typeof t.className<"u"?t.className:"",useShadows:typeof t.useShadows<"u"?t.useShadows:!0,handleMouseWheel:typeof t.handleMouseWheel<"u"?t.handleMouseWheel:!0,flipAxes:typeof t.flipAxes<"u"?t.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof t.consumeMouseWheelIfScrollbarIsNeeded<"u"?t.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof t.alwaysConsumeMouseWheel<"u"?t.alwaysConsumeMouseWheel:!1,scrollYToX:typeof t.scrollYToX<"u"?t.scrollYToX:!1,mouseWheelScrollSensitivity:typeof t.mouseWheelScrollSensitivity<"u"?t.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof t.fastScrollSensitivity<"u"?t.fastScrollSensitivity:5,scrollPredominantAxis:typeof t.scrollPredominantAxis<"u"?t.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof t.mouseWheelSmoothScroll<"u"?t.mouseWheelSmoothScroll:!0,arrowSize:typeof t.arrowSize<"u"?t.arrowSize:11,listenOnDomNode:typeof t.listenOnDomNode<"u"?t.listenOnDomNode:null,horizontal:typeof t.horizontal<"u"?t.horizontal:1,horizontalScrollbarSize:typeof t.horizontalScrollbarSize<"u"?t.horizontalScrollbarSize:10,horizontalSliderSize:typeof t.horizontalSliderSize<"u"?t.horizontalSliderSize:0,horizontalHasArrows:typeof t.horizontalHasArrows<"u"?t.horizontalHasArrows:!1,vertical:typeof t.vertical<"u"?t.vertical:1,verticalScrollbarSize:typeof t.verticalScrollbarSize<"u"?t.verticalScrollbarSize:10,verticalHasArrows:typeof t.verticalHasArrows<"u"?t.verticalHasArrows:!1,verticalSliderSize:typeof t.verticalSliderSize<"u"?t.verticalSliderSize:0,scrollByPage:typeof t.scrollByPage<"u"?t.scrollByPage:!1};return e.horizontalSliderSize=typeof t.horizontalSliderSize<"u"?t.horizontalSliderSize:e.horizontalScrollbarSize,e.verticalSliderSize=typeof t.verticalSliderSize<"u"?t.verticalSliderSize:e.verticalScrollbarSize,Zt&&(e.className+=" mac"),e}var so=class extends ye{constructor(t,e,s,i,r,n,o,a){super(),this._bufferService=s,this._optionsService=o,this._renderService=a,this._onRequestScrollLines=this._register(new te),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new vv({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:l=>ma(i.window,l)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Av(e,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(r.onProtocolChange(l=>{this._scrollableElement.updateOptions({handleMouseWheel:!(l&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(dt.runAndSubscribe(n.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=n.colors.background.css})),t.appendChild(this._scrollableElement.getDomNode()),this._register(Le(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=i.mainDocument.createElement("style"),e.appendChild(this._styleElement),this._register(Le(()=>this._styleElement.remove())),this._register(dt.runAndSubscribe(n.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${n.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${n.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${n.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
14
- `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(l=>this._handleScroll(l)))}scrollLines(t){let e=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:e.scrollTop+t*this._renderService.dimensions.css.cell.height})}scrollToLine(t,e){e&&(this._latestYDisp=t),this._scrollableElement.setScrollPosition({reuseAnimation:!e,scrollTop:t*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(t){t!==void 0&&(this._latestYDisp=t),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(t=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,t!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:t*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(t){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let e=Math.round(t.scrollTop/this._renderService.dimensions.css.cell.height),s=e-this._bufferService.buffer.ydisp;s!==0&&(this._latestYDisp=e,this._onRequestScrollLines.fire(s)),this._isHandlingScroll=!1}};so=He([oe(2,bt),oe(3,fs),oe(4,ud),oe(5,oi),oe(6,St),oe(7,ps)],so);var io=class extends ye{constructor(t,e,s,i,r){super(),this._screenElement=t,this._bufferService=e,this._coreBrowserService=s,this._decorationService=i,this._renderService=r,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(this._coreBrowserService.onDprChange(()=>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(n=>this._removeDecoration(n))),this._register(Le(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let t of this._decorationService.decorations)this._renderDecoration(t);this._dimensionsChanged=!1}_renderDecoration(t){this._refreshStyle(t),this._dimensionsChanged&&this._refreshXPosition(t)}_createElement(t){let e=this._coreBrowserService.mainDocument.createElement("div");e.classList.add("xterm-decoration"),e.classList.toggle("xterm-decoration-top-layer",t?.options?.layer==="top"),e.style.width=`${Math.round((t.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,e.style.height=`${(t.options.height||1)*this._renderService.dimensions.css.cell.height}px`,e.style.top=`${(t.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,e.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let s=t.options.x??0;return s&&s>this._bufferService.cols&&(e.style.display="none"),this._refreshXPosition(t,e),e}_refreshStyle(t){let e=t.marker.line-this._bufferService.buffers.active.ydisp;if(e<0||e>=this._bufferService.rows)t.element&&(t.element.style.display="none",t.onRenderEmitter.fire(t.element));else{let s=this._decorationElements.get(t);s||(s=this._createElement(t),t.element=s,this._decorationElements.set(t,s),this._container.appendChild(s),t.onDispose(()=>{this._decorationElements.delete(t),s.remove()})),s.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(s.style.width=`${Math.round((t.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,s.style.height=`${(t.options.height||1)*this._renderService.dimensions.css.cell.height}px`,s.style.top=`${e*this._renderService.dimensions.css.cell.height}px`,s.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),t.onRenderEmitter.fire(s)}}_refreshXPosition(t,e=t.element){if(!e)return;let s=t.options.x??0;(t.options.anchor||"left")==="right"?e.style.right=s?`${s*this._renderService.dimensions.css.cell.width}px`:"":e.style.left=s?`${s*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(t){this._decorationElements.get(t)?.remove(),this._decorationElements.delete(t),t.dispose()}};io=He([oe(1,bt),oe(2,fs),oe(3,Ui),oe(4,ps)],io);var Nv=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(t){if(t.options.overviewRulerOptions){for(let e of this._zones)if(e.color===t.options.overviewRulerOptions.color&&e.position===t.options.overviewRulerOptions.position){if(this._lineIntersectsZone(e,t.marker.line))return;if(this._lineAdjacentToZone(e,t.marker.line,t.options.overviewRulerOptions.position)){this._addLineToZone(e,t.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=t.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=t.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=t.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=t.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:t.options.overviewRulerOptions.color,position:t.options.overviewRulerOptions.position,startBufferLine:t.marker.line,endBufferLine:t.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(t){this._linePadding=t}_lineIntersectsZone(t,e){return e>=t.startBufferLine&&e<=t.endBufferLine}_lineAdjacentToZone(t,e,s){return e>=t.startBufferLine-this._linePadding[s||"full"]&&e<=t.endBufferLine+this._linePadding[s||"full"]}_addLineToZone(t,e){t.startBufferLine=Math.min(t.startBufferLine,e),t.endBufferLine=Math.max(t.endBufferLine,e)}},qt={full:0,left:0,center:0,right:0},vs={full:0,left:0,center:0,right:0},ci={full:0,left:0,center:0,right:0},kr=class extends ye{constructor(t,e,s,i,r,n,o,a){super(),this._viewportElement=t,this._screenElement=e,this._bufferService=s,this._decorationService=i,this._renderService=r,this._optionsService=n,this._themeService=o,this._coreBrowserService=a,this._colorZoneStore=new Nv,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(Le(()=>this._canvas?.remove()));let c=this._canvas.getContext("2d");if(c)this._ctx=c;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),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())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let t=Math.floor((this._canvas.width-1)/3),e=Math.ceil((this._canvas.width-1)/3);vs.full=this._canvas.width,vs.left=t,vs.center=e,vs.right=t,this._refreshDrawHeightConstants(),ci.full=1,ci.left=1,ci.center=1+vs.left,ci.right=1+vs.left+vs.center}_refreshDrawHeightConstants(){qt.full=Math.round(2*this._coreBrowserService.dpr);let t=this._canvas.height/this._bufferService.buffer.lines.length,e=Math.round(Math.max(Math.min(t,12),6)*this._coreBrowserService.dpr);qt.left=e,qt.center=e,qt.right=e}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*qt.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*qt.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*qt.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*qt.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._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.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(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let t=this._colorZoneStore.zones;for(let e of t)e.position!=="full"&&this._renderColorZone(e);for(let e of t)e.position==="full"&&this._renderColorZone(e);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(t){this._ctx.fillStyle=t.color,this._ctx.fillRect(ci[t.position||"full"],Math.round((this._canvas.height-1)*(t.startBufferLine/this._bufferService.buffers.active.lines.length)-qt[t.position||"full"]/2),vs[t.position||"full"],Math.round((this._canvas.height-1)*((t.endBufferLine-t.startBufferLine)/this._bufferService.buffers.active.lines.length)+qt[t.position||"full"]))}_queueRefresh(t,e){this._shouldUpdateDimensions=t||this._shouldUpdateDimensions,this._shouldUpdateAnchor=e||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};kr=He([oe(2,bt),oe(3,Ui),oe(4,ps),oe(5,St),oe(6,oi),oe(7,fs)],kr);var W;(t=>(t.NUL="\0",t.SOH="",t.STX="",t.ETX="",t.EOT="",t.ENQ="",t.ACK="",t.BEL="\x07",t.BS="\b",t.HT=" ",t.LF=`
15
- `,t.VT="\v",t.FF="\f",t.CR="\r",t.SO="",t.SI="",t.DLE="",t.DC1="",t.DC2="",t.DC3="",t.DC4="",t.NAK="",t.SYN="",t.ETB="",t.CAN="",t.EM="",t.SUB="",t.ESC="\x1B",t.FS="",t.GS="",t.RS="",t.US="",t.SP=" ",t.DEL=""))(W||={});var _r;(t=>(t.PAD="€",t.HOP="",t.BPH="‚",t.NBH="ƒ",t.IND="„",t.NEL="…",t.SSA="†",t.ESA="‡",t.HTS="ˆ",t.HTJ="‰",t.VTS="Š",t.PLD="‹",t.PLU="Œ",t.RI="",t.SS2="Ž",t.SS3="",t.DCS="",t.PU1="‘",t.PU2="’",t.STS="“",t.CCH="”",t.MW="•",t.SPA="–",t.EPA="—",t.SOS="˜",t.SGCI="™",t.SCI="š",t.CSI="›",t.ST="œ",t.OSC="",t.PM="ž",t.APC="Ÿ"))(_r||={});var Md;(t=>t.ST=`${W.ESC}\\`)(Md||={});var ro=class{constructor(t,e,s,i,r,n){this._textarea=t,this._compositionView=e,this._bufferService=s,this._optionsService=i,this._coreService=r,this._renderService=n,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(t){this._compositionView.textContent=t.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(t){if(this._isComposing||this._isSendingComposition){if(t.keyCode===20||t.keyCode===229||t.keyCode===16||t.keyCode===17||t.keyCode===18)return!1;this._finalizeComposition(!1)}return t.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(t){if(this._compositionView.classList.remove("active"),this._isComposing=!1,t){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let s;e.start+=this._dataAlreadySent.length,this._isComposing?s=this._textarea.value.substring(e.start,this._compositionPosition.start):s=this._textarea.value.substring(e.start),s.length>0&&this._coreService.triggerDataEvent(s,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let t=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let e=this._textarea.value,s=e.replace(t,"");this._dataAlreadySent=s,e.length>t.length?this._coreService.triggerDataEvent(s,!0):e.length<t.length?this._coreService.triggerDataEvent(`${W.DEL}`,!0):e.length===t.length&&e!==t&&this._coreService.triggerDataEvent(e,!0)}},0)}updateCompositionElements(t){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),s=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=s+"px",this._compositionView.style.lineHeight=s+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let n=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(n.width,1)+"px",this._textarea.style.height=Math.max(n.height,1)+"px",this._textarea.style.lineHeight=n.height+"px"}t||setTimeout(()=>this.updateCompositionElements(!0),0)}}};ro=He([oe(2,bt),oe(3,St),oe(4,Ws),oe(5,ps)],ro);var ot=0,at=0,lt=0,Fe=0,Nl={css:"#00000000",rgba:0},Ye;(t=>{function e(r,n,o,a){return a!==void 0?`#${Ts(r)}${Ts(n)}${Ts(o)}${Ts(a)}`:`#${Ts(r)}${Ts(n)}${Ts(o)}`}t.toCss=e;function s(r,n,o,a=255){return(r<<24|n<<16|o<<8|a)>>>0}t.toRgba=s;function i(r,n,o,a){return{css:t.toCss(r,n,o,a),rgba:t.toRgba(r,n,o,a)}}t.toColor=i})(Ye||={});var Be;(t=>{function e(c,l){if(Fe=(l.rgba&255)/255,Fe===1)return{css:l.css,rgba:l.rgba};let u=l.rgba>>24&255,d=l.rgba>>16&255,f=l.rgba>>8&255,p=c.rgba>>24&255,_=c.rgba>>16&255,g=c.rgba>>8&255;ot=p+Math.round((u-p)*Fe),at=_+Math.round((d-_)*Fe),lt=g+Math.round((f-g)*Fe);let v=Ye.toCss(ot,at,lt),b=Ye.toRgba(ot,at,lt);return{css:v,rgba:b}}t.blend=e;function s(c){return(c.rgba&255)===255}t.isOpaque=s;function i(c,l,u){let d=mr.ensureContrastRatio(c.rgba,l.rgba,u);if(d)return Ye.toColor(d>>24&255,d>>16&255,d>>8&255)}t.ensureContrastRatio=i;function r(c){let l=(c.rgba|255)>>>0;return[ot,at,lt]=mr.toChannels(l),{css:Ye.toCss(ot,at,lt),rgba:l}}t.opaque=r;function n(c,l){return Fe=Math.round(l*255),[ot,at,lt]=mr.toChannels(c.rgba),{css:Ye.toCss(ot,at,lt,Fe),rgba:Ye.toRgba(ot,at,lt,Fe)}}t.opacity=n;function o(c,l){return Fe=c.rgba&255,n(c,Fe*l/255)}t.multiplyOpacity=o;function a(c){return[c.rgba>>24&255,c.rgba>>16&255,c.rgba>>8&255]}t.toColorRGB=a})(Be||={});var Ie;(t=>{let e,s;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:!0});n&&(e=n,e.globalCompositeOperation="copy",s=e.createLinearGradient(0,0,1,1))}catch{}function i(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return ot=parseInt(r.slice(1,2).repeat(2),16),at=parseInt(r.slice(2,3).repeat(2),16),lt=parseInt(r.slice(3,4).repeat(2),16),Ye.toColor(ot,at,lt);case 5:return ot=parseInt(r.slice(1,2).repeat(2),16),at=parseInt(r.slice(2,3).repeat(2),16),lt=parseInt(r.slice(3,4).repeat(2),16),Fe=parseInt(r.slice(4,5).repeat(2),16),Ye.toColor(ot,at,lt,Fe);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let n=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return ot=parseInt(n[1]),at=parseInt(n[2]),lt=parseInt(n[3]),Fe=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Ye.toColor(ot,at,lt,Fe);if(!e||!s)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=s,e.fillStyle=r,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[ot,at,lt,Fe]=e.getImageData(0,0,1,1).data,Fe!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ye.toRgba(ot,at,lt,Fe),css:r}}t.toColor=i})(Ie||={});var mt;(t=>{function e(i){return s(i>>16&255,i>>8&255,i&255)}t.relativeLuminance=e;function s(i,r,n){let o=i/255,a=r/255,c=n/255,l=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),u=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),d=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4);return l*.2126+u*.7152+d*.0722}t.relativeLuminance2=s})(mt||={});var mr;(t=>{function e(o,a){if(Fe=(a&255)/255,Fe===1)return a;let c=a>>24&255,l=a>>16&255,u=a>>8&255,d=o>>24&255,f=o>>16&255,p=o>>8&255;return ot=d+Math.round((c-d)*Fe),at=f+Math.round((l-f)*Fe),lt=p+Math.round((u-p)*Fe),Ye.toRgba(ot,at,lt)}t.blend=e;function s(o,a,c){let l=mt.relativeLuminance(o>>8),u=mt.relativeLuminance(a>>8);if(is(l,u)<c){if(u<l){let p=i(o,a,c),_=is(l,mt.relativeLuminance(p>>8));if(_<c){let g=r(o,a,c),v=is(l,mt.relativeLuminance(g>>8));return _>v?p:g}return p}let d=r(o,a,c),f=is(l,mt.relativeLuminance(d>>8));if(f<c){let p=i(o,a,c),_=is(l,mt.relativeLuminance(p>>8));return f>_?d:p}return d}}t.ensureContrastRatio=s;function i(o,a,c){let l=o>>24&255,u=o>>16&255,d=o>>8&255,f=a>>24&255,p=a>>16&255,_=a>>8&255,g=is(mt.relativeLuminance2(f,p,_),mt.relativeLuminance2(l,u,d));for(;g<c&&(f>0||p>0||_>0);)f-=Math.max(0,Math.ceil(f*.1)),p-=Math.max(0,Math.ceil(p*.1)),_-=Math.max(0,Math.ceil(_*.1)),g=is(mt.relativeLuminance2(f,p,_),mt.relativeLuminance2(l,u,d));return(f<<24|p<<16|_<<8|255)>>>0}t.reduceLuminance=i;function r(o,a,c){let l=o>>24&255,u=o>>16&255,d=o>>8&255,f=a>>24&255,p=a>>16&255,_=a>>8&255,g=is(mt.relativeLuminance2(f,p,_),mt.relativeLuminance2(l,u,d));for(;g<c&&(f<255||p<255||_<255);)f=Math.min(255,f+Math.ceil((255-f)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),_=Math.min(255,_+Math.ceil((255-_)*.1)),g=is(mt.relativeLuminance2(f,p,_),mt.relativeLuminance2(l,u,d));return(f<<24|p<<16|_<<8|255)>>>0}t.increaseLuminance=r;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}t.toChannels=n})(mr||={});function Ts(t){let e=t.toString(16);return e.length<2?"0"+e:e}function is(t,e){return t<e?(e+.05)/(t+.05):(t+.05)/(e+.05)}var Mv=class extends Wi{constructor(t,e,s){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=e,this._width=s}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Pr=class{constructor(t){this._bufferService=t,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new It}register(t){let e={id:this._nextCharacterJoinerId++,handler:t};return this._characterJoiners.push(e),e.id}deregister(t){for(let e=0;e<this._characterJoiners.length;e++)if(this._characterJoiners[e].id===t)return this._characterJoiners.splice(e,1),!0;return!1}getJoinedCharacters(t){if(this._characterJoiners.length===0)return[];let e=this._bufferService.buffer.lines.get(t);if(!e||e.length===0)return[];let s=[],i=e.translateToString(!0),r=0,n=0,o=0,a=e.getFg(0),c=e.getBg(0);for(let l=0;l<e.getTrimmedLength();l++)if(e.loadCell(l,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==a||this._workCell.bg!==c){if(l-r>1){let u=this._getJoinedRanges(i,o,n,e,r);for(let d=0;d<u.length;d++)s.push(u[d])}r=l,o=n,a=this._workCell.fg,c=this._workCell.bg}n+=this._workCell.getChars().length||ys.length}if(this._bufferService.cols-r>1){let l=this._getJoinedRanges(i,o,n,e,r);for(let u=0;u<l.length;u++)s.push(l[u])}return s}_getJoinedRanges(t,e,s,i,r){let n=t.substring(e,s),o=[];try{o=this._characterJoiners[0].handler(n)}catch(a){console.error(a)}for(let a=1;a<this._characterJoiners.length;a++)try{let c=this._characterJoiners[a].handler(n);for(let l=0;l<c.length;l++)Pr._mergeRanges(o,c[l])}catch(c){console.error(c)}return this._stringRangesToCellRanges(o,i,r),o}_stringRangesToCellRanges(t,e,s){let i=0,r=!1,n=0,o=t[i];if(o){for(let a=s;a<this._bufferService.cols;a++){let c=e.getWidth(a),l=e.getString(a).length||ys.length;if(c!==0){if(!r&&o[0]<=n&&(o[0]=a,r=!0),o[1]<=n){if(o[1]=a,o=t[++i],!o)break;o[0]<=n?(o[0]=a,r=!0):r=!1}n+=l}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(t,e){let s=!1;for(let i=0;i<t.length;i++){let r=t[i];if(s){if(e[1]<=r[0])return t[i-1][1]=e[1],t;if(e[1]<=r[1])return t[i-1][1]=Math.max(e[1],r[1]),t.splice(i,1),t;t.splice(i,1),i--}else{if(e[1]<=r[0])return t.splice(i,0,e),t;if(e[1]<=r[1])return r[0]=Math.min(e[0],r[0]),t;e[0]<r[1]&&(r[0]=Math.min(e[0],r[0]),s=!0);continue}}return s?t[t.length-1][1]=e[1]:t.push(e),t}};Pr=He([oe(0,bt)],Pr);function Bv(t){return 57508<=t&&t<=57558}function Lv(t){return 9472<=t&&t<=9631}function jv(t){return Bv(t)||Lv(t)}function Iv(){return{css:{canvas:sr(),cell:sr()},device:{canvas:sr(),cell:sr(),char:{width:0,height:0,left:0,top:0}}}}function sr(){return{width:0,height:0}}var no=class{constructor(t,e,s,i,r,n,o){this._document=t,this._characterJoinerService=e,this._optionsService=s,this._coreBrowserService=i,this._coreService=r,this._decorationService=n,this._themeService=o,this._workCell=new It,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(t,e,s){this._selectionStart=t,this._selectionEnd=e,this._columnSelectMode=s}createRow(t,e,s,i,r,n,o,a,c,l,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(e),p=this._themeService.colors,_=t.getNoBgTrimmedLength();s&&_<n+1&&(_=n+1);let g,v=0,b="",k=0,w=0,S=0,m=0,x=!1,y=0,C=!1,N=0,T=0,R=[],E=l!==-1&&u!==-1;for(let P=0;P<_;P++){t.loadCell(P,this._workCell);let A=this._workCell.getWidth();if(A===0)continue;let M=!1,L=P>=T,B=P,D=this._workCell;if(f.length>0&&P===f[0][0]&&L){let J=f.shift(),ae=this._isCellInSelection(J[0],e);for(k=J[0]+1;k<J[1];k++)L&&=ae===this._isCellInSelection(k,e);L&&=!s||n<J[0]||n>=J[1],L?(M=!0,D=new Mv(this._workCell,t.translateToString(!0,J[0],J[1]),J[1]-J[0]),B=J[1]-1,A=D.getWidth()):T=J[1]}let j=this._isCellInSelection(P,e),K=s&&P===n,z=E&&P>=l&&P<=u,G=!1;this._decorationService.forEachDecorationAtCell(P,e,void 0,J=>{G=!0});let I=D.getChars()||ys;if(I===" "&&(D.isUnderline()||D.isOverline())&&(I=" "),N=A*a-c.get(I,D.isBold(),D.isItalic()),!g)g=this._document.createElement("span");else if(v&&(j&&C||!j&&!C&&D.bg===w)&&(j&&C&&p.selectionForeground||D.fg===S)&&D.extended.ext===m&&z===x&&N===y&&!K&&!M&&!G&&L){D.isInvisible()?b+=ys:b+=I,v++;continue}else v&&(g.textContent=b),g=this._document.createElement("span"),v=0,b="";if(w=D.bg,S=D.fg,m=D.extended.ext,x=z,y=N,C=j,M&&n>=P&&n<=B&&(n=P),!this._coreService.isCursorHidden&&K&&this._coreService.isCursorInitialized){if(R.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&R.push("xterm-cursor-blink"),R.push(i==="bar"?"xterm-cursor-bar":i==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){case"outline":R.push("xterm-cursor-outline");break;case"block":R.push("xterm-cursor-block");break;case"bar":R.push("xterm-cursor-bar");break;case"underline":R.push("xterm-cursor-underline");break}}if(D.isBold()&&R.push("xterm-bold"),D.isItalic()&&R.push("xterm-italic"),D.isDim()&&R.push("xterm-dim"),D.isInvisible()?b=ys:b=D.getChars()||ys,D.isUnderline()&&(R.push(`xterm-underline-${D.extended.underlineStyle}`),b===" "&&(b=" "),!D.isUnderlineColorDefault()))if(D.isUnderlineColorRGB())g.style.textDecorationColor=`rgb(${Wi.toColorRGB(D.getUnderlineColor()).join(",")})`;else{let J=D.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&D.isBold()&&J<8&&(J+=8),g.style.textDecorationColor=p.ansi[J].css}D.isOverline()&&(R.push("xterm-overline"),b===" "&&(b=" ")),D.isStrikethrough()&&R.push("xterm-strikethrough"),z&&(g.style.textDecoration="underline");let V=D.getFgColor(),$=D.getFgColorMode(),ee=D.getBgColor(),se=D.getBgColorMode(),ie=!!D.isInverse();if(ie){let J=V;V=ee,ee=J;let ae=$;$=se,se=ae}let Y,Z,X=!1;this._decorationService.forEachDecorationAtCell(P,e,void 0,J=>{J.options.layer!=="top"&&X||(J.backgroundColorRGB&&(se=50331648,ee=J.backgroundColorRGB.rgba>>8&16777215,Y=J.backgroundColorRGB),J.foregroundColorRGB&&($=50331648,V=J.foregroundColorRGB.rgba>>8&16777215,Z=J.foregroundColorRGB),X=J.options.layer==="top")}),!X&&j&&(Y=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,ee=Y.rgba>>8&16777215,se=50331648,X=!0,p.selectionForeground&&($=50331648,V=p.selectionForeground.rgba>>8&16777215,Z=p.selectionForeground)),X&&R.push("xterm-decoration-top");let U;switch(se){case 16777216:case 33554432:U=p.ansi[ee],R.push(`xterm-bg-${ee}`);break;case 50331648:U=Ye.toColor(ee>>16,ee>>8&255,ee&255),this._addStyle(g,`background-color:#${Ml((ee>>>0).toString(16),"0",6)}`);break;default:ie?(U=p.foreground,R.push("xterm-bg-257")):U=p.background}switch(Y||D.isDim()&&(Y=Be.multiplyOpacity(U,.5)),$){case 16777216:case 33554432:D.isBold()&&V<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(V+=8),this._applyMinimumContrast(g,U,p.ansi[V],D,Y,void 0)||R.push(`xterm-fg-${V}`);break;case 50331648:let J=Ye.toColor(V>>16&255,V>>8&255,V&255);this._applyMinimumContrast(g,U,J,D,Y,Z)||this._addStyle(g,`color:#${Ml(V.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(g,U,p.foreground,D,Y,Z)||ie&&R.push("xterm-fg-257")}R.length&&(g.className=R.join(" "),R.length=0),!K&&!M&&!G&&L?v++:g.textContent=b,N!==this.defaultSpacing&&(g.style.letterSpacing=`${N}px`),d.push(g),P=B}return g&&v&&(g.textContent=b),d}_applyMinimumContrast(t,e,s,i,r,n){if(this._optionsService.rawOptions.minimumContrastRatio===1||jv(i.getCode()))return!1;let o=this._getContrastCache(i),a;if(!r&&!n&&(a=o.getColor(e.rgba,s.rgba)),a===void 0){let c=this._optionsService.rawOptions.minimumContrastRatio/(i.isDim()?2:1);a=Be.ensureContrastRatio(r||e,n||s,c),o.setColor((r||e).rgba,(n||s).rgba,a??null)}return a?(this._addStyle(t,`color:${a.css}`),!0):!1}_getContrastCache(t){return t.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(t,e){t.setAttribute("style",`${t.getAttribute("style")||""}${e};`)}_isCellInSelection(t,e){let s=this._selectionStart,i=this._selectionEnd;return!s||!i?!1:this._columnSelectMode?s[0]<=i[0]?t>=s[0]&&e>=s[1]&&t<i[0]&&e<=i[1]:t<s[0]&&e>=s[1]&&t>=i[0]&&e<=i[1]:e>s[1]&&e<i[1]||s[1]===i[1]&&e===s[1]&&t>=s[0]&&t<i[0]||s[1]<i[1]&&e===i[1]&&t<i[0]||s[1]<i[1]&&e===s[1]&&t>=s[0]}};no=He([oe(1,_d),oe(2,St),oe(3,fs),oe(4,Ws),oe(5,Ui),oe(6,oi)],no);function Ml(t,e,s){for(;t.length<s;)t=e+t;return t}var Ov=class{constructor(t,e){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=t.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let s=t.createElement("span");s.classList.add("xterm-char-measure-element");let i=t.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontWeight="bold";let r=t.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontStyle="italic";let n=t.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold",n.style.fontStyle="italic",this._measureElements=[s,i,r,n],this._container.appendChild(s),this._container.appendChild(i),this._container.appendChild(r),this._container.appendChild(n),e.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(t,e,s,i){t===this._font&&e===this._fontSize&&s===this._weight&&i===this._weightBold||(this._font=t,this._fontSize=e,this._weight=s,this._weightBold=i,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${s}`,this._measureElements[1].style.fontWeight=`${i}`,this._measureElements[2].style.fontWeight=`${s}`,this._measureElements[3].style.fontWeight=`${i}`,this.clear())}get(t,e,s){let i=0;if(!e&&!s&&t.length===1&&(i=t.charCodeAt(0))<256){if(this._flat[i]!==-9999)return this._flat[i];let o=this._measure(t,0);return o>0&&(this._flat[i]=o),o}let r=t;e&&(r+="B"),s&&(r+="I");let n=this._holey.get(r);if(n===void 0){let o=0;e&&(o|=1),s&&(o|=2),n=this._measure(t,o),n>0&&this._holey.set(r,n)}return n}_measure(t,e){let s=this._measureElements[e];return s.textContent=t.repeat(32),s.offsetWidth/32}},zv=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(t,e,s,i=!1){if(this.selectionStart=e,this.selectionEnd=s,!e||!s||e[0]===s[0]&&e[1]===s[1]){this.clear();return}let r=t.buffers.active.ydisp,n=e[1]-r,o=s[1]-r,a=Math.max(n,0),c=Math.min(o,t.rows-1);if(a>=t.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=c,this.startCol=e[0],this.endCol=s[0]}isCellSelected(t,e,s){return this.hasSelection?(s-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?e>=this.startCol&&s>=this.viewportCappedStartRow&&e<this.endCol&&s<=this.viewportCappedEndRow:e<this.startCol&&s>=this.viewportCappedStartRow&&e>=this.endCol&&s<=this.viewportCappedEndRow:s>this.viewportStartRow&&s<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&s===this.viewportStartRow&&e>=this.startCol&&e<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportEndRow&&e<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportStartRow&&e>=this.startCol):!1}};function $v(){return new zv}var ln="xterm-dom-renderer-owner-",Bt="xterm-rows",ir="xterm-fg-",Bl="xterm-bg-",hi="xterm-focus",rr="xterm-selection",Fv=1,oo=class extends ye{constructor(t,e,s,i,r,n,o,a,c,l,u,d,f,p){super(),this._terminal=t,this._document=e,this._element=s,this._screenElement=i,this._viewportElement=r,this._helperContainer=n,this._linkifier2=o,this._charSizeService=c,this._optionsService=l,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=Fv++,this._rowElements=[],this._selectionRenderModel=$v(),this.onRequestRedraw=this._register(new te).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Bt),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(rr),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=Iv(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(_=>this._injectCss(_))),this._injectCss(this._themeService.colors),this._rowFactory=a.createInstance(no,document),this._element.classList.add(ln+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(_=>this._handleLinkHover(_))),this._register(this._linkifier2.onHideLinkUnderline(_=>this._handleLinkLeave(_))),this._register(Le(()=>{this._element.classList.remove(ln+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Ov(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let t=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*t,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*t),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/t),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/t),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(let s of this._rowElements)s.style.width=`${this.dimensions.css.canvas.width}px`,s.style.height=`${this.dimensions.css.cell.height}px`,s.style.lineHeight=`${this.dimensions.css.cell.height}px`,s.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let e=`${this._terminalSelector} .${Bt} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=e,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(t){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let e=`${this._terminalSelector} .${Bt} { pointer-events: none; color: ${t.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;e+=`${this._terminalSelector} .${Bt} .xterm-dim { color: ${Be.multiplyOpacity(t.foreground,.5).css};}`,e+=`${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;}`;let s=`blink_underline_${this._terminalClass}`,i=`blink_bar_${this._terminalClass}`,r=`blink_block_${this._terminalClass}`;e+=`@keyframes ${s} { 50% { border-bottom-style: hidden; }}`,e+=`@keyframes ${i} { 50% { box-shadow: none; }}`,e+=`@keyframes ${r} { 0% { background-color: ${t.cursor.css}; color: ${t.cursorAccent.css}; } 50% { background-color: inherit; color: ${t.cursor.css}; }}`,e+=`${this._terminalSelector} .${Bt}.${hi} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Bt}.${hi} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Bt}.${hi} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Bt} .xterm-cursor.xterm-cursor-block { background-color: ${t.cursor.css}; color: ${t.cursorAccent.css};}${this._terminalSelector} .${Bt} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${t.cursor.css} !important; color: ${t.cursorAccent.css} !important;}${this._terminalSelector} .${Bt} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${t.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Bt} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${t.cursor.css} inset;}${this._terminalSelector} .${Bt} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${t.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,e+=`${this._terminalSelector} .${rr} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${rr} div { position: absolute; background-color: ${t.selectionBackgroundOpaque.css};}${this._terminalSelector} .${rr} div { position: absolute; background-color: ${t.selectionInactiveBackgroundOpaque.css};}`;for(let[n,o]of t.ansi.entries())e+=`${this._terminalSelector} .${ir}${n} { color: ${o.css}; }${this._terminalSelector} .${ir}${n}.xterm-dim { color: ${Be.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${Bl}${n} { background-color: ${o.css}; }`;e+=`${this._terminalSelector} .${ir}257 { color: ${Be.opaque(t.background).css}; }${this._terminalSelector} .${ir}257.xterm-dim { color: ${Be.multiplyOpacity(Be.opaque(t.background),.5).css}; }${this._terminalSelector} .${Bl}257 { background-color: ${t.foreground.css}; }`,this._themeStyleElement.textContent=e}_setDefaultSpacing(){let t=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${t}px`,this._rowFactory.defaultSpacing=t}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(t,e){for(let s=this._rowElements.length;s<=e;s++){let i=this._document.createElement("div");this._rowContainer.appendChild(i),this._rowElements.push(i)}for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(t,e){this._refreshRowElements(t,e),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(hi),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(hi),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(t,e,s){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(t,e,s),this.renderRows(0,this._bufferService.rows-1),!t||!e||(this._selectionRenderModel.update(this._terminal,t,e,s),!this._selectionRenderModel.hasSelection))return;let i=this._selectionRenderModel.viewportStartRow,r=this._selectionRenderModel.viewportEndRow,n=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,a=this._document.createDocumentFragment();if(s){let c=t[0]>e[0];a.appendChild(this._createSelectionElement(n,c?e[0]:t[0],c?t[0]:e[0],o-n+1))}else{let c=i===n?t[0]:0,l=n===r?e[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(n,c,l));let u=o-n-1;if(a.appendChild(this._createSelectionElement(n+1,0,this._bufferService.cols,u)),n!==o){let d=r===o?e[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,0,d))}}this._selectionContainer.appendChild(a)}_createSelectionElement(t,e,s,i=1){let r=this._document.createElement("div"),n=e*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(s-e);return n+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-n),r.style.height=`${i*this.dimensions.css.cell.height}px`,r.style.top=`${t*this.dimensions.css.cell.height}px`,r.style.left=`${n}px`,r.style.width=`${o}px`,r}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(let t of this._rowElements)t.replaceChildren()}renderRows(t,e){let s=this._bufferService.buffer,i=s.ybase+s.y,r=Math.min(s.x,this._bufferService.cols-1),n=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,a=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=t;c<=e;c++){let l=c+s.ydisp,u=this._rowElements[c],d=s.lines.get(l);if(!u||!d)break;u.replaceChildren(...this._rowFactory.createRow(d,l,l===i,o,a,r,n,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${ln}${this._terminalClass}`}_handleLinkHover(t){this._setCellUnderline(t.x1,t.x2,t.y1,t.y2,t.cols,!0)}_handleLinkLeave(t){this._setCellUnderline(t.x1,t.x2,t.y1,t.y2,t.cols,!1)}_setCellUnderline(t,e,s,i,r,n){s<0&&(t=0),i<0&&(e=0);let o=this._bufferService.rows-1;s=Math.max(Math.min(s,o),0),i=Math.max(Math.min(i,o),0),r=Math.min(r,this._bufferService.cols);let a=this._bufferService.buffer,c=a.ybase+a.y,l=Math.min(a.x,r-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=s;p<=i;++p){let _=p+a.ydisp,g=this._rowElements[p],v=a.lines.get(_);if(!g||!v)break;g.replaceChildren(...this._rowFactory.createRow(v,_,_===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,n?p===s?t:0:-1,n?(p===i?e:r)-1:-1))}}};oo=He([oe(7,ha),oe(8,Ur),oe(9,St),oe(10,bt),oe(11,Ws),oe(12,fs),oe(13,oi)],oo);var ao=class extends ye{constructor(t,e,s){super(),this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=this._register(new te),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Wv(this._optionsService))}catch{this._measureStrategy=this._register(new Hv(t,e,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let t=this._measureStrategy.measure();(t.width!==this.width||t.height!==this.height)&&(this.width=t.width,this.height=t.height,this._onCharSizeChange.fire())}};ao=He([oe(2,St)],ao);var Bd=class extends ye{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(t,e){t!==void 0&&t>0&&e!==void 0&&e>0&&(this._result.width=t,this._result.height=e)}},Hv=class extends Bd{constructor(t,e,s){super(),this._document=t,this._parentElement=e,this._optionsService=s,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(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},Wv=class extends Bd{constructor(t){super(),this._optionsService=t,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let e=this._ctx.measureText("W");if(!("width"in e&&"fontBoundingBoxAscent"in e&&"fontBoundingBoxDescent"in e))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let t=this._ctx.measureText("W");return this._validateAndSet(t.width,t.fontBoundingBoxAscent+t.fontBoundingBoxDescent),this._result}},Uv=class extends ye{constructor(t,e,s){super(),this._textarea=t,this._window=e,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Kv(this._window)),this._onDprChange=this._register(new te),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new te),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this._register(dt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(me(this._textarea,"focus",()=>this._isFocused=!0)),this._register(me(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(t){this._window!==t&&(this._window=t,this._onWindowChange.fire(this._window))}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}},Kv=class extends ye{constructor(t){super(),this._parentWindow=t,this._windowResizeListener=this._register(new ii),this._onDprChange=this._register(new te),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Le(()=>this.clearListener()))}setWindow(t){this._parentWindow=t,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=me(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.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._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},qv=class extends ye{constructor(){super(),this.linkProviders=[],this._register(Le(()=>this.linkProviders.length=0))}registerLinkProvider(t){return this.linkProviders.push(t),{dispose:()=>{let e=this.linkProviders.indexOf(t);e!==-1&&this.linkProviders.splice(e,1)}}}};function va(t,e,s){let i=s.getBoundingClientRect(),r=t.getComputedStyle(s),n=parseInt(r.getPropertyValue("padding-left")),o=parseInt(r.getPropertyValue("padding-top"));return[e.clientX-i.left-n,e.clientY-i.top-o]}function Vv(t,e,s,i,r,n,o,a,c){if(!n)return;let l=va(t,e,s);if(l)return l[0]=Math.ceil((l[0]+(c?o/2:0))/o),l[1]=Math.ceil(l[1]/a),l[0]=Math.min(Math.max(l[0],1),i+(c?1:0)),l[1]=Math.min(Math.max(l[1],1),r),l}var lo=class{constructor(t,e){this._renderService=t,this._charSizeService=e}getCoords(t,e,s,i,r){return Vv(window,t,e,s,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(t,e){let s=va(window,t,e);if(this._charSizeService.hasValidSize)return s[0]=Math.min(Math.max(s[0],0),this._renderService.dimensions.css.canvas.width-1),s[1]=Math.min(Math.max(s[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(s[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(s[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(s[0]),y:Math.floor(s[1])}}};lo=He([oe(0,ps),oe(1,Ur)],lo);var Gv=class{constructor(t,e){this._renderCallback=t,this._coreBrowserService=e,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(t){return this._refreshCallbacks.push(t),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(t,e,s){this._rowCount=s,t=t!==void 0?t:0,e=e!==void 0?e:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,t):t,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,e):e,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let t=Math.max(this._rowStart,0),e=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(t,e),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let t of this._refreshCallbacks)t(0);this._refreshCallbacks=[]}},Ld={};rg(Ld,{getSafariVersion:()=>Xv,isChromeOS:()=>zd,isFirefox:()=>jd,isIpad:()=>Jv,isIphone:()=>Zv,isLegacyEdge:()=>Yv,isLinux:()=>ba,isMac:()=>Er,isNode:()=>Kr,isSafari:()=>Id,isWindows:()=>Od});var Kr=typeof process<"u"&&"title"in process,Ki=Kr?"node":navigator.userAgent,qi=Kr?"node":navigator.platform,jd=Ki.includes("Firefox"),Yv=Ki.includes("Edge"),Id=/^((?!chrome|android).)*safari/i.test(Ki);function Xv(){if(!Id)return 0;let t=Ki.match(/Version\/(\d+)/);return t===null||t.length<2?0:parseInt(t[1])}var Er=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(qi),Jv=qi==="iPad",Zv=qi==="iPhone",Od=["Windows","Win16","Win32","WinCE"].includes(qi),ba=qi.indexOf("Linux")>=0,zd=/\bCrOS\b/.test(Ki),$d=class{constructor(){this._tasks=[],this._i=0}enqueue(t){this._tasks.push(t),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(t){this._idleCallback=void 0;let e=0,s=0,i=t.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(e=performance.now(),this._tasks[this._i]()||this._i++,e=Math.max(1,performance.now()-e),s=Math.max(e,s),r=t.timeRemaining(),s*1.5>r){i-e<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-e))}ms`),this._start();return}i=r}this.clear()}},Qv=class extends $d{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let e=performance.now()+t;return{timeRemaining:()=>Math.max(0,e-performance.now())}}},e1=class extends $d{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},Rr=!Kr&&"requestIdleCallback"in window?e1:Qv,t1=class{constructor(){this._queue=new Rr}set(t){this._queue.clear(),this._queue.enqueue(t)}flush(){this._queue.flush()}},co=class extends ye{constructor(t,e,s,i,r,n,o,a,c){super(),this._rowCount=t,this._optionsService=s,this._charSizeService=i,this._coreService=r,this._coreBrowserService=a,this._renderer=this._register(new ii),this._pausedResizeTask=new t1,this._observerDisposable=this._register(new ii),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 te),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new te),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new te),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new te),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Gv((l,u)=>this._renderRows(l,u),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new s1(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Le(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(n.onDecorationRegistered(()=>this._fullRefresh())),this._register(n.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,e),this._register(this._coreBrowserService.onWindowChange(l=>this._registerIntersectionObserver(l,e)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(t,e){if("IntersectionObserver"in t){let s=new t.IntersectionObserver(i=>this._handleIntersectionChange(i[i.length-1]),{threshold:0});s.observe(e),this._observerDisposable.value=Le(()=>s.disconnect())}}_handleIntersectionChange(t){this._isPaused=t.isIntersecting===void 0?t.intersectionRatio===0:!t.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(t,e,s=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(t,e);return}let i=this._syncOutputHandler.flush();i&&(t=Math.min(t,i.start),e=Math.max(e,i.end)),s||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(t,e,this._rowCount)}_renderRows(t,e){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(t,e);return}t=Math.min(t,this._rowCount-1),e=Math.min(e,this._rowCount-1),this._renderer.value.renderRows(t,e),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:t,end:e}),this._onRender.fire({start:t,end:e}),this._isNextRenderRedrawOnly=!0}}resize(t,e){this._rowCount=e,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(t){this._renderer.value=t,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(t){return this._renderDebouncer.addRefreshCallback(t)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(t,e){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(t,e)):this._renderer.value.handleResize(t,e),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(t,e,s){this._selectionState.start=t,this._selectionState.end=e,this._selectionState.columnSelectMode=s,this._renderer.value?.handleSelectionChanged(t,e,s)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};co=He([oe(2,St),oe(3,Ur),oe(4,Ws),oe(5,Ui),oe(6,bt),oe(7,fs),oe(8,oi)],co);var s1=class{constructor(t,e,s){this._coreBrowserService=t,this._coreService=e,this._onTimeout=s,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(t,e){this._isBuffering?(this._start=Math.min(this._start,t),this._end=Math.max(this._end,e)):(this._start=t,this._end=e,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let t={start:this._start,end:this._end};return this._isBuffering=!1,t}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function i1(t,e,s,i){let r=s.buffer.x,n=s.buffer.y;if(!s.buffer.hasScrollback)return o1(r,n,t,e,s,i)+qr(n,e,s,i)+a1(r,n,t,e,s,i);let o;if(n===e)return o=r>t?"D":"C",Di(Math.abs(r-t),Ai(o,i));o=n>e?"D":"C";let a=Math.abs(n-e),c=n1(n>e?t:r,s)+(a-1)*s.cols+1+r1(n>e?r:t);return Di(c,Ai(o,i))}function r1(t,e){return t-1}function n1(t,e){return e.cols-t}function o1(t,e,s,i,r,n){return qr(e,i,r,n).length===0?"":Di(Hd(t,e,t,e-zs(e,r),!1,r).length,Ai("D",n))}function qr(t,e,s,i){let r=t-zs(t,s),n=e-zs(e,s),o=Math.abs(r-n)-l1(t,e,s);return Di(o,Ai(Fd(t,e),i))}function a1(t,e,s,i,r,n){let o;qr(e,i,r,n).length>0?o=i-zs(i,r):o=e;let a=i,c=c1(t,e,s,i,r,n);return Di(Hd(t,o,s,a,c==="C",r).length,Ai(c,n))}function l1(t,e,s){let i=0,r=t-zs(t,s),n=e-zs(e,s);for(let o=0;o<Math.abs(r-n);o++){let a=Fd(t,e)==="A"?-1:1;s.buffer.lines.get(r+a*o)?.isWrapped&&i++}return i}function zs(t,e){let s=0,i=e.buffer.lines.get(t),r=i?.isWrapped;for(;r&&t>=0&&t<e.rows;)s++,i=e.buffer.lines.get(--t),r=i?.isWrapped;return s}function c1(t,e,s,i,r,n){let o;return qr(s,i,r,n).length>0?o=i-zs(i,r):o=e,t<s&&o<=i||t>=s&&o<i?"C":"D"}function Fd(t,e){return t>e?"A":"B"}function Hd(t,e,s,i,r,n){let o=t,a=e,c="";for(;(o!==s||a!==i)&&a>=0&&a<n.buffer.lines.length;)o+=r?1:-1,r&&o>n.cols-1?(c+=n.buffer.translateBufferLineToString(a,!1,t,o),o=0,t=0,a++):!r&&o<0&&(c+=n.buffer.translateBufferLineToString(a,!1,0,t+1),o=n.cols-1,t=o,a--);return c+n.buffer.translateBufferLineToString(a,!1,t,o)}function Ai(t,e){let s=e?"O":"[";return W.ESC+s+t}function Di(t,e){t=Math.floor(t);let s="";for(let i=0;i<t;i++)s+=e;return s}var h1=class{constructor(t){this._bufferService=t,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.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()){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?t%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)-1]:[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[t,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[Math.max(t,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let t=this.selectionStart,e=this.selectionEnd;return!t||!e?!1:t[1]>e[1]||t[1]===e[1]&&t[0]>e[0]}handleTrim(t){return this.selectionStart&&(this.selectionStart[1]-=t),this.selectionEnd&&(this.selectionEnd[1]-=t),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function Ll(t,e){if(t.start.y>t.end.y)throw new Error(`Buffer range end (${t.end.x}, ${t.end.y}) cannot be before start (${t.start.x}, ${t.start.y})`);return e*(t.end.y-t.start.y)+(t.end.x-t.start.x+1)}var cn=50,d1=15,u1=50,f1=500,p1=" ",_1=new RegExp(p1,"g"),ho=class extends ye{constructor(t,e,s,i,r,n,o,a,c){super(),this._element=t,this._screenElement=e,this._linkifier=s,this._bufferService=i,this._coreService=r,this._mouseService=n,this._optionsService=o,this._renderService=a,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new It,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new te),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new te),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new te),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new te),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=l=>this._handleMouseMove(l),this._mouseUpListener=l=>this._handleMouseUp(l),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(l=>this._handleTrim(l)),this._register(this._bufferService.buffers.onBufferActivate(l=>this._handleBufferActivate(l))),this.enable(),this._model=new h1(this._bufferService),this._activeSelectionMode=0,this._register(Le(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(l=>{l.rowsChanged&&this.clearSelection()}))}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(){let t=this._model.finalSelectionStart,e=this._model.finalSelectionEnd;return!t||!e?!1:t[0]!==e[0]||t[1]!==e[1]}get selectionText(){let t=this._model.finalSelectionStart,e=this._model.finalSelectionEnd;if(!t||!e)return"";let s=this._bufferService.buffer,i=[];if(this._activeSelectionMode===3){if(t[0]===e[0])return"";let r=t[0]<e[0]?t[0]:e[0],n=t[0]<e[0]?e[0]:t[0];for(let o=t[1];o<=e[1];o++){let a=s.translateBufferLineToString(o,!0,r,n);i.push(a)}}else{let r=t[1]===e[1]?e[0]:void 0;i.push(s.translateBufferLineToString(t[1],!0,t[0],r));for(let n=t[1]+1;n<=e[1]-1;n++){let o=s.lines.get(n),a=s.translateBufferLineToString(n,!0);o?.isWrapped?i[i.length-1]+=a:i.push(a)}if(t[1]!==e[1]){let n=s.lines.get(e[1]),o=s.translateBufferLineToString(e[1],!0,0,e[0]);n&&n.isWrapped?i[i.length-1]+=o:i.push(o)}}return i.map(r=>r.replace(_1," ")).join(Od?`\r
16
- `:`
17
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(t){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),ba&&t&&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(t){let e=this._getMouseBufferCoords(t),s=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!s||!i||!e?!1:this._areCoordsInSelection(e,s,i)}isCellInSelection(t,e){let s=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!s||!i?!1:this._areCoordsInSelection([t,e],s,i)}_areCoordsInSelection(t,e,s){return t[1]>e[1]&&t[1]<s[1]||e[1]===s[1]&&t[1]===e[1]&&t[0]>=e[0]&&t[0]<s[0]||e[1]<s[1]&&t[1]===s[1]&&t[0]<s[0]||e[1]<s[1]&&t[1]===e[1]&&t[0]>=e[0]}_selectWordAtCursor(t,e){let s=this._linkifier.currentLink?.link?.range;if(s)return this._model.selectionStart=[s.start.x-1,s.start.y-1],this._model.selectionStartLength=Ll(s,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let i=this._getMouseBufferCoords(t);return i?(this._selectWordAt(i,e),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(t,e){this._model.clearSelection(),t=Math.max(t,0),e=Math.min(e,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,t],this._model.selectionEnd=[this._bufferService.cols,e],this.refresh(),this._onSelectionChange.fire()}_handleTrim(t){this._model.handleTrim(t)&&this.refresh()}_getMouseBufferCoords(t){let e=this._mouseService.getCoords(t,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(e)return e[0]--,e[1]--,e[1]+=this._bufferService.buffer.ydisp,e}_getMouseEventScrollAmount(t){let e=va(this._coreBrowserService.window,t,this._screenElement)[1],s=this._renderService.dimensions.css.canvas.height;return e>=0&&e<=s?0:(e>s&&(e-=s),e=Math.min(Math.max(e,-cn),cn),e/=cn,e/Math.abs(e)+Math.round(e*(d1-1)))}shouldForceSelection(t){return Er?t.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:t.shiftKey}handleMouseDown(t){if(this._mouseDownTimeStamp=t.timeStamp,!(t.button===2&&this.hasSelection)&&t.button===0){if(!this._enabled){if(!this.shouldForceSelection(t))return;t.stopPropagation()}t.preventDefault(),this._dragScrollAmount=0,this._enabled&&t.shiftKey?this._handleIncrementalClick(t):t.detail===1?this._handleSingleClick(t):t.detail===2?this._handleDoubleClick(t):t.detail===3&&this._handleTripleClick(t),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(),u1)}_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(t){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(t))}_handleSingleClick(t){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(t)?3:0,this._model.selectionStart=this._getMouseBufferCoords(t),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let 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(t){this._selectWordAtCursor(t,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(t){let e=this._getMouseBufferCoords(t);e&&(this._activeSelectionMode=2,this._selectLineAt(e[1]))}shouldColumnSelect(t){return t.altKey&&!(Er&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(t){if(t.stopImmediatePropagation(),!this._model.selectionStart)return;let e=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(t),!this._model.selectionEnd){this.refresh(!0);return}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(t),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let s=this._bufferService.buffer;if(this._model.selectionEnd[1]<s.lines.length){let i=s.lines.get(this._model.selectionEnd[1]);i&&i.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&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});let t=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(t.ydisp+this._bufferService.rows,t.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=t.ydisp),this.refresh()}}_handleMouseUp(t){let e=t.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&e<f1&&t.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let s=this._mouseService.getCoords(t,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(s&&s[0]!==void 0&&s[1]!==void 0){let i=i1(s[0]-1,s[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(i,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let t=this._model.finalSelectionStart,e=this._model.finalSelectionEnd,s=!!t&&!!e&&(t[0]!==e[0]||t[1]!==e[1]);if(!s){this._oldHasSelection&&this._fireOnSelectionChange(t,e,s);return}!t||!e||(!this._oldSelectionStart||!this._oldSelectionEnd||t[0]!==this._oldSelectionStart[0]||t[1]!==this._oldSelectionStart[1]||e[0]!==this._oldSelectionEnd[0]||e[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(t,e,s)}_fireOnSelectionChange(t,e,s){this._oldSelectionStart=t,this._oldSelectionEnd=e,this._oldHasSelection=s,this._onSelectionChange.fire()}_handleBufferActivate(t){this.clearSelection(),this._trimListener.dispose(),this._trimListener=t.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(t,e){let s=e;for(let i=0;e>=i;i++){let r=t.loadCell(i,this._workCell).getChars().length;this._workCell.getWidth()===0?s--:r>1&&e!==i&&(s+=r-1)}return s}setSelection(t,e,s){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[t,e],this._model.selectionStartLength=s,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(t){this._isClickInSelection(t)||(this._selectWordAtCursor(t,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(t,e,s=!0,i=!0){if(t[0]>=this._bufferService.cols)return;let r=this._bufferService.buffer,n=r.lines.get(t[1]);if(!n)return;let o=r.translateBufferLineToString(t[1],!1),a=this._convertViewportColToCharacterIndex(n,t[0]),c=a,l=t[0]-a,u=0,d=0,f=0,p=0;if(o.charAt(a)===" "){for(;a>0&&o.charAt(a-1)===" ";)a--;for(;c<o.length&&o.charAt(c+1)===" ";)c++}else{let v=t[0],b=t[0];n.getWidth(v)===0&&(u++,v--),n.getWidth(b)===2&&(d++,b++);let k=n.getString(b).length;for(k>1&&(p+=k-1,c+=k-1);v>0&&a>0&&!this._isCharWordSeparator(n.loadCell(v-1,this._workCell));){n.loadCell(v-1,this._workCell);let w=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,v--):w>1&&(f+=w-1,a-=w-1),a--,v--}for(;b<n.length&&c+1<o.length&&!this._isCharWordSeparator(n.loadCell(b+1,this._workCell));){n.loadCell(b+1,this._workCell);let w=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,b++):w>1&&(p+=w-1,c+=w-1),c++,b++}}c++;let _=a+l-u+f,g=Math.min(this._bufferService.cols,c-a+u+d-f-p);if(!(!e&&o.slice(a,c).trim()==="")){if(s&&_===0&&n.getCodePoint(0)!==32){let v=r.lines.get(t[1]-1);if(v&&n.isWrapped&&v.getCodePoint(this._bufferService.cols-1)!==32){let b=this._getWordAt([this._bufferService.cols-1,t[1]-1],!1,!0,!1);if(b){let k=this._bufferService.cols-b.start;_-=k,g+=k}}}if(i&&_+g===this._bufferService.cols&&n.getCodePoint(this._bufferService.cols-1)!==32){let v=r.lines.get(t[1]+1);if(v?.isWrapped&&v.getCodePoint(0)!==32){let b=this._getWordAt([0,t[1]+1],!1,!1,!0);b&&(g+=b.length)}}return{start:_,length:g}}}_selectWordAt(t,e){let s=this._getWordAt(t,e);if(s){for(;s.start<0;)s.start+=this._bufferService.cols,t[1]--;this._model.selectionStart=[s.start,t[1]],this._model.selectionStartLength=s.length}}_selectToWordAt(t){let e=this._getWordAt(t,!0);if(e){let s=t[1];for(;e.start<0;)e.start+=this._bufferService.cols,s--;if(!this._model.areSelectionValuesReversed())for(;e.start+e.length>this._bufferService.cols;)e.length-=this._bufferService.cols,s++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?e.start:e.start+e.length,s]}}_isCharWordSeparator(t){return t.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(t.getChars())>=0}_selectLineAt(t){let e=this._bufferService.buffer.getWrappedRangeForLine(t),s={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=Ll(s,this._bufferService.cols)}};ho=He([oe(3,bt),oe(4,Ws),oe(5,da),oe(6,St),oe(7,ps),oe(8,fs)],ho);var jl=class{constructor(){this._data={}}set(t,e,s){this._data[t]||(this._data[t]={}),this._data[t][e]=s}get(t,e){return this._data[t]?this._data[t][e]:void 0}clear(){this._data={}}},Il=class{constructor(){this._color=new jl,this._css=new jl}setCss(t,e,s){this._css.set(t,e,s)}getCss(t,e){return this._css.get(t,e)}setColor(t,e,s){this._color.set(t,e,s)}getColor(t,e){return this._color.get(t,e)}clear(){this._color.clear(),this._css.clear()}},st=Object.freeze((()=>{let t=[Ie.toColor("#2e3436"),Ie.toColor("#cc0000"),Ie.toColor("#4e9a06"),Ie.toColor("#c4a000"),Ie.toColor("#3465a4"),Ie.toColor("#75507b"),Ie.toColor("#06989a"),Ie.toColor("#d3d7cf"),Ie.toColor("#555753"),Ie.toColor("#ef2929"),Ie.toColor("#8ae234"),Ie.toColor("#fce94f"),Ie.toColor("#729fcf"),Ie.toColor("#ad7fa8"),Ie.toColor("#34e2e2"),Ie.toColor("#eeeeec")],e=[0,95,135,175,215,255];for(let s=0;s<216;s++){let i=e[s/36%6|0],r=e[s/6%6|0],n=e[s%6];t.push({css:Ye.toCss(i,r,n),rgba:Ye.toRgba(i,r,n)})}for(let s=0;s<24;s++){let i=8+s*10;t.push({css:Ye.toCss(i,i,i),rgba:Ye.toRgba(i,i,i)})}return t})()),As=Ie.toColor("#ffffff"),vi=Ie.toColor("#000000"),Ol=Ie.toColor("#ffffff"),zl=vi,di={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},m1=As,uo=class extends ye{constructor(t){super(),this._optionsService=t,this._contrastCache=new Il,this._halfContrastCache=new Il,this._onChangeColors=this._register(new te),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:As,background:vi,cursor:Ol,cursorAccent:zl,selectionForeground:void 0,selectionBackgroundTransparent:di,selectionBackgroundOpaque:Be.blend(vi,di),selectionInactiveBackgroundTransparent:di,selectionInactiveBackgroundOpaque:Be.blend(vi,di),scrollbarSliderBackground:Be.opacity(As,.2),scrollbarSliderHoverBackground:Be.opacity(As,.4),scrollbarSliderActiveBackground:Be.opacity(As,.5),overviewRulerBorder:As,ansi:st.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)))}get colors(){return this._colors}_setTheme(t={}){let e=this._colors;if(e.foreground=Ae(t.foreground,As),e.background=Ae(t.background,vi),e.cursor=Be.blend(e.background,Ae(t.cursor,Ol)),e.cursorAccent=Be.blend(e.background,Ae(t.cursorAccent,zl)),e.selectionBackgroundTransparent=Ae(t.selectionBackground,di),e.selectionBackgroundOpaque=Be.blend(e.background,e.selectionBackgroundTransparent),e.selectionInactiveBackgroundTransparent=Ae(t.selectionInactiveBackground,e.selectionBackgroundTransparent),e.selectionInactiveBackgroundOpaque=Be.blend(e.background,e.selectionInactiveBackgroundTransparent),e.selectionForeground=t.selectionForeground?Ae(t.selectionForeground,Nl):void 0,e.selectionForeground===Nl&&(e.selectionForeground=void 0),Be.isOpaque(e.selectionBackgroundTransparent)&&(e.selectionBackgroundTransparent=Be.opacity(e.selectionBackgroundTransparent,.3)),Be.isOpaque(e.selectionInactiveBackgroundTransparent)&&(e.selectionInactiveBackgroundTransparent=Be.opacity(e.selectionInactiveBackgroundTransparent,.3)),e.scrollbarSliderBackground=Ae(t.scrollbarSliderBackground,Be.opacity(e.foreground,.2)),e.scrollbarSliderHoverBackground=Ae(t.scrollbarSliderHoverBackground,Be.opacity(e.foreground,.4)),e.scrollbarSliderActiveBackground=Ae(t.scrollbarSliderActiveBackground,Be.opacity(e.foreground,.5)),e.overviewRulerBorder=Ae(t.overviewRulerBorder,m1),e.ansi=st.slice(),e.ansi[0]=Ae(t.black,st[0]),e.ansi[1]=Ae(t.red,st[1]),e.ansi[2]=Ae(t.green,st[2]),e.ansi[3]=Ae(t.yellow,st[3]),e.ansi[4]=Ae(t.blue,st[4]),e.ansi[5]=Ae(t.magenta,st[5]),e.ansi[6]=Ae(t.cyan,st[6]),e.ansi[7]=Ae(t.white,st[7]),e.ansi[8]=Ae(t.brightBlack,st[8]),e.ansi[9]=Ae(t.brightRed,st[9]),e.ansi[10]=Ae(t.brightGreen,st[10]),e.ansi[11]=Ae(t.brightYellow,st[11]),e.ansi[12]=Ae(t.brightBlue,st[12]),e.ansi[13]=Ae(t.brightMagenta,st[13]),e.ansi[14]=Ae(t.brightCyan,st[14]),e.ansi[15]=Ae(t.brightWhite,st[15]),t.extendedAnsi){let s=Math.min(e.ansi.length-16,t.extendedAnsi.length);for(let i=0;i<s;i++)e.ansi[i+16]=Ae(t.extendedAnsi[i],st[i+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(t){this._restoreColor(t),this._onChangeColors.fire(this.colors)}_restoreColor(t){if(t===void 0){for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];return}switch(t){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[t]=this._restoreColors.ansi[t]}}modifyColors(t){t(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()}}};uo=He([oe(0,St)],uo);function Ae(t,e){if(t!==void 0)try{return Ie.toColor(t)}catch{}return e}var g1=class{constructor(...t){this._entries=new Map;for(let[e,s]of t)this.set(e,s)}set(t,e){let s=this._entries.get(t);return this._entries.set(t,e),s}forEach(t){for(let[e,s]of this._entries.entries())t(e,s)}has(t){return this._entries.has(t)}get(t){return this._entries.get(t)}},v1=class{constructor(){this._services=new g1,this._services.set(ha,this)}setService(t,e){this._services.set(t,e)}getService(t){return this._services.get(t)}createInstance(t,...e){let s=dg(t).sort((n,o)=>n.index-o.index),i=[];for(let n of s){let o=this._services.get(n.id);if(!o)throw new Error(`[createInstance] ${t.name} depends on UNKNOWN service ${n.id._id}.`);i.push(o)}let r=s.length>0?s[0].index:e.length;if(e.length!==r)throw new Error(`[createInstance] First service dependency of ${t.name} at position ${r+1} conflicts with ${e.length} static arguments`);return new t(...e,...i)}},b1={trace:0,debug:1,info:2,warn:3,error:4,off:5},S1="xterm.js: ",fo=class extends ye{constructor(t){super(),this._optionsService=t,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=b1[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let e=0;e<t.length;e++)typeof t[e]=="function"&&(t[e]=t[e]())}_log(t,e,s){this._evalLazyOptionalParams(s),t.call(console,(this._optionsService.options.logger?"":S1)+e,...s)}trace(t,...e){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,t,e)}debug(t,...e){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,t,e)}info(t,...e){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,t,e)}warn(t,...e){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,t,e)}error(t,...e){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,t,e)}};fo=He([oe(0,St)],fo);var $l=class extends ye{constructor(t){super(),this._maxLength=t,this.onDeleteEmitter=this._register(new te),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new te),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new te),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(t){if(this._maxLength===t)return;let e=new Array(t);for(let s=0;s<Math.min(t,this.length);s++)e[s]=this._array[this._getCyclicIndex(s)];this._array=e,this._maxLength=t,this._startIndex=0}get length(){return this._length}set length(t){if(t>this._length)for(let e=this._length;e<t;e++)this._array[e]=void 0;this._length=t}get(t){return this._array[this._getCyclicIndex(t)]}set(t,e){this._array[this._getCyclicIndex(t)]=e}push(t){this._array[this._getCyclicIndex(this._length)]=t,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(t,e,...s){if(e){for(let i=t;i<this._length-e;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+e)];this._length-=e,this.onDeleteEmitter.fire({index:t,amount:e})}for(let i=this._length-1;i>=t;i--)this._array[this._getCyclicIndex(i+s.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<s.length;i++)this._array[this._getCyclicIndex(t+i)]=s[i];if(s.length&&this.onInsertEmitter.fire({index:t,amount:s.length}),this._length+s.length>this._maxLength){let i=this._length+s.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=s.length}trimStart(t){t>this._length&&(t=this._length),this._startIndex+=t,this._length-=t,this.onTrimEmitter.fire(t)}shiftElements(t,e,s){if(!(e<=0)){if(t<0||t>=this._length)throw new Error("start argument out of range");if(t+s<0)throw new Error("Cannot shift elements in list beyond index 0");if(s>0){for(let r=e-1;r>=0;r--)this.set(t+r+s,this.get(t+r));let i=t+e+s-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<e;i++)this.set(t+i+s,this.get(t+i))}}_getCyclicIndex(t){return(this._startIndex+t)%this._maxLength}},Se=3,Ge=Object.freeze(new Wi),nr=0,hn=2,bi=class Wd{constructor(e,s,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*Se);let r=s||It.fromCharData([0,ld,1,0]);for(let n=0;n<e;++n)this.setCell(n,r);this.length=e}get(e){let s=this._data[e*Se+0],i=s&2097151;return[this._data[e*Se+1],s&2097152?this._combined[e]:i?Ss(i):"",s>>22,s&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):i]}set(e,s){this._data[e*Se+1]=s[0],s[1].length>1?(this._combined[e]=s[1],this._data[e*Se+0]=e|2097152|s[2]<<22):this._data[e*Se+0]=s[1].charCodeAt(0)|s[2]<<22}getWidth(e){return this._data[e*Se+0]>>22}hasWidth(e){return this._data[e*Se+0]&12582912}getFg(e){return this._data[e*Se+1]}getBg(e){return this._data[e*Se+2]}hasContent(e){return this._data[e*Se+0]&4194303}getCodePoint(e){let s=this._data[e*Se+0];return s&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):s&2097151}isCombined(e){return this._data[e*Se+0]&2097152}getString(e){let s=this._data[e*Se+0];return s&2097152?this._combined[e]:s&2097151?Ss(s&2097151):""}isProtected(e){return this._data[e*Se+2]&536870912}loadCell(e,s){return nr=e*Se,s.content=this._data[nr+0],s.fg=this._data[nr+1],s.bg=this._data[nr+2],s.content&2097152&&(s.combinedData=this._combined[e]),s.bg&268435456&&(s.extended=this._extendedAttrs[e]),s}setCell(e,s){s.content&2097152&&(this._combined[e]=s.combinedData),s.bg&268435456&&(this._extendedAttrs[e]=s.extended),this._data[e*Se+0]=s.content,this._data[e*Se+1]=s.fg,this._data[e*Se+2]=s.bg}setCellFromCodepoint(e,s,i,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*Se+0]=s|i<<22,this._data[e*Se+1]=r.fg,this._data[e*Se+2]=r.bg}addCodepointToCell(e,s,i){let r=this._data[e*Se+0];r&2097152?this._combined[e]+=Ss(s):r&2097151?(this._combined[e]=Ss(r&2097151)+Ss(s),r&=-2097152,r|=2097152):r=s|1<<22,i&&(r&=-12582913,r|=i<<22),this._data[e*Se+0]=r}insertCells(e,s,i){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),s<this.length-e){let r=new It;for(let n=this.length-e-s-1;n>=0;--n)this.setCell(e+s+n,this.loadCell(e+n,r));for(let n=0;n<s;++n)this.setCell(e+n,i)}else for(let r=e;r<this.length;++r)this.setCell(r,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(e,s,i){if(e%=this.length,s<this.length-e){let r=new It;for(let n=0;n<this.length-e-s;++n)this.setCell(e+n,this.loadCell(e+s+n,r));for(let n=this.length-s;n<this.length;++n)this.setCell(n,i)}else for(let r=e;r<this.length;++r)this.setCell(r,i);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,i)}replaceCells(e,s,i,r=!1){if(r){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),s<this.length&&this.getWidth(s-1)===2&&!this.isProtected(s)&&this.setCellFromCodepoint(s,0,1,i);e<s&&e<this.length;)this.isProtected(e)||this.setCell(e,i),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),s<this.length&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s,0,1,i);e<s&&e<this.length;)this.setCell(e++,i)}resize(e,s){if(e===this.length)return this._data.length*4*hn<this._data.buffer.byteLength;let i=e*Se;if(e>this.length){if(this._data.buffer.byteLength>=i*4)this._data=new Uint32Array(this._data.buffer,0,i);else{let r=new Uint32Array(i);r.set(this._data),this._data=r}for(let r=this.length;r<e;++r)this.setCell(r,s)}else{this._data=this._data.subarray(0,i);let r=Object.keys(this._combined);for(let o=0;o<r.length;o++){let a=parseInt(r[o],10);a>=e&&delete this._combined[a]}let n=Object.keys(this._extendedAttrs);for(let o=0;o<n.length;o++){let a=parseInt(n[o],10);a>=e&&delete this._extendedAttrs[a]}}return this.length=e,i*4*hn<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*hn<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,s=!1){if(s){for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,e);return}this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,e)}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(let s in e._combined)this._combined[s]=e._combined[s];this._extendedAttrs={};for(let s in e._extendedAttrs)this._extendedAttrs[s]=e._extendedAttrs[s];this.isWrapped=e.isWrapped}clone(){let e=new Wd(0);e._data=new Uint32Array(this._data),e.length=this.length;for(let s in this._combined)e._combined[s]=this._combined[s];for(let s in this._extendedAttrs)e._extendedAttrs[s]=this._extendedAttrs[s];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*Se+0]&4194303)return e+(this._data[e*Se+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*Se+0]&4194303||this._data[e*Se+2]&50331648)return e+(this._data[e*Se+0]>>22);return 0}copyCellsFrom(e,s,i,r,n){let o=e._data;if(n)for(let c=r-1;c>=0;c--){for(let l=0;l<Se;l++)this._data[(i+c)*Se+l]=o[(s+c)*Se+l];o[(s+c)*Se+2]&268435456&&(this._extendedAttrs[i+c]=e._extendedAttrs[s+c])}else for(let c=0;c<r;c++){for(let l=0;l<Se;l++)this._data[(i+c)*Se+l]=o[(s+c)*Se+l];o[(s+c)*Se+2]&268435456&&(this._extendedAttrs[i+c]=e._extendedAttrs[s+c])}let a=Object.keys(e._combined);for(let c=0;c<a.length;c++){let l=parseInt(a[c],10);l>=s&&(this._combined[l-s+i]=e._combined[l])}}translateToString(e,s,i,r){s=s??0,i=i??this.length,e&&(i=Math.min(i,this.getTrimmedLength())),r&&(r.length=0);let n="";for(;s<i;){let o=this._data[s*Se+0],a=o&2097151,c=o&2097152?this._combined[s]:a?Ss(a):ys;if(n+=c,r)for(let l=0;l<c.length;++l)r.push(s);s+=o>>22||1}return r&&r.push(s),n}};function y1(t,e,s,i,r,n){let o=[];for(let a=0;a<t.length-1;a++){let c=a,l=t.get(++c);if(!l.isWrapped)continue;let u=[t.get(a)];for(;c<t.length&&l.isWrapped;)u.push(l),l=t.get(++c);if(!n&&i>=a&&i<c){a+=u.length-1;continue}let d=0,f=Ni(u,d,e),p=1,_=0;for(;p<u.length;){let v=Ni(u,p,e),b=v-_,k=s-f,w=Math.min(b,k);u[d].copyCellsFrom(u[p],_,f,w,!1),f+=w,f===s&&(d++,f=0),_+=w,_===v&&(p++,_=0),f===0&&d!==0&&u[d-1].getWidth(s-1)===2&&(u[d].copyCellsFrom(u[d-1],s-1,f++,1,!1),u[d-1].setCell(s-1,r))}u[d].replaceCells(f,s,r);let g=0;for(let v=u.length-1;v>0&&(v>d||u[v].getTrimmedLength()===0);v--)g++;g>0&&(o.push(a+u.length-g),o.push(g)),a+=u.length-1}return o}function x1(t,e){let s=[],i=0,r=e[i],n=0;for(let o=0;o<t.length;o++)if(r===o){let a=e[++i];t.onDeleteEmitter.fire({index:o-n,amount:a}),o+=a-1,n+=a,r=e[++i]}else s.push(o);return{layout:s,countRemoved:n}}function w1(t,e){let s=[];for(let i=0;i<e.length;i++)s.push(t.get(e[i]));for(let i=0;i<s.length;i++)t.set(i,s[i]);t.length=e.length}function C1(t,e,s){let i=[],r=t.map((c,l)=>Ni(t,l,e)).reduce((c,l)=>c+l),n=0,o=0,a=0;for(;a<r;){if(r-a<s){i.push(r-a);break}n+=s;let c=Ni(t,o,e);n>c&&(n-=c,o++);let l=t[o].getWidth(n-1)===2;l&&n--;let u=l?s-1:s;i.push(u),a+=u}return i}function Ni(t,e,s){if(e===t.length-1)return t[e].getTrimmedLength();let i=!t[e].hasContent(s-1)&&t[e].getWidth(s-1)===1,r=t[e+1].getWidth(0)===2;return i&&r?s-1:s}var Ud=class Kd{constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=Kd._nextId++,this._onDispose=this.register(new te),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Os(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};Ud._nextId=1;var k1=Ud,rt={},Ds=rt.B;rt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};rt.A={"#":"£"};rt.B=void 0;rt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};rt.C=rt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};rt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};rt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};rt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};rt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};rt.E=rt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};rt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};rt.H=rt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};rt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Fl=4294967295,Hl=class{constructor(t,e,s){this._hasScrollback=t,this._optionsService=e,this._bufferService=s,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Ge.clone(),this.savedCharset=Ds,this.markers=[],this._nullCell=It.fromCharData([0,ld,1,0]),this._whitespaceCell=It.fromCharData([0,ys,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Rr,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new $l(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(t){return t?(this._nullCell.fg=t.fg,this._nullCell.bg=t.bg,this._nullCell.extended=t.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new Cr),this._nullCell}getWhitespaceCell(t){return t?(this._whitespaceCell.fg=t.fg,this._whitespaceCell.bg=t.bg,this._whitespaceCell.extended=t.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new Cr),this._whitespaceCell}getBlankLine(t,e){return new bi(this._bufferService.cols,this.getNullCell(t),e)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let t=this.ybase+this.y-this.ydisp;return t>=0&&t<this._rows}_getCorrectBufferLength(t){if(!this._hasScrollback)return t;let e=t+this._optionsService.rawOptions.scrollback;return e>Fl?Fl:e}fillViewportRows(t){if(this.lines.length===0){t===void 0&&(t=Ge);let e=this._rows;for(;e--;)this.lines.push(this.getBlankLine(t))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new $l(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(t,e){let s=this.getNullCell(Ge),i=0,r=this._getCorrectBufferLength(e);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<t)for(let o=0;o<this.lines.length;o++)i+=+this.lines.get(o).resize(t,s);let n=0;if(this._rows<e)for(let o=this._rows;o<e;o++)this.lines.length<e+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new bi(t,s)):this.ybase>0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new bi(t,s)));else for(let o=this._rows;o>e;o--)this.lines.length>e+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r<this.lines.maxLength){let o=this.lines.length-r;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=r}this.x=Math.min(this.x,t-1),this.y=Math.min(this.y,e-1),n&&(this.y+=n),this.savedX=Math.min(this.savedX,t-1),this.scrollTop=0}if(this.scrollBottom=e-1,this._isReflowEnabled&&(this._reflow(t,e),this._cols>t))for(let n=0;n<this.lines.length;n++)i+=+this.lines.get(n).resize(t,s);this._cols=t,this._rows=e,this._memoryCleanupQueue.clear(),i>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let t=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,t=!1);let e=0;for(;this._memoryCleanupPosition<this.lines.length;)if(e+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),e>100)return!0;return t}get _isReflowEnabled(){let t=this._optionsService.rawOptions.windowsPty;return t&&t.buildNumber?this._hasScrollback&&t.backend==="conpty"&&t.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(t,e){this._cols!==t&&(t>this._cols?this._reflowLarger(t,e):this._reflowSmaller(t,e))}_reflowLarger(t,e){let s=this._optionsService.rawOptions.reflowCursorLine,i=y1(this.lines,this._cols,t,this.ybase+this.y,this.getNullCell(Ge),s);if(i.length>0){let r=x1(this.lines,i);w1(this.lines,r.layout),this._reflowLargerAdjustViewport(t,e,r.countRemoved)}}_reflowLargerAdjustViewport(t,e,s){let i=this.getNullCell(Ge),r=s;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<e&&this.lines.push(new bi(t,i))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-s,0)}_reflowSmaller(t,e){let s=this._optionsService.rawOptions.reflowCursorLine,i=this.getNullCell(Ge),r=[],n=0;for(let o=this.lines.length-1;o>=0;o--){let a=this.lines.get(o);if(!a||!a.isWrapped&&a.getTrimmedLength()<=t)continue;let c=[a];for(;a.isWrapped&&o>0;)a=this.lines.get(--o),c.unshift(a);if(!s){let w=this.ybase+this.y;if(w>=o&&w<o+c.length)continue}let l=c[c.length-1].getTrimmedLength(),u=C1(c,this._cols,t),d=u.length-c.length,f;this.ybase===0&&this.y!==this.lines.length-1?f=Math.max(0,this.y-this.lines.maxLength+d):f=Math.max(0,this.lines.length-this.lines.maxLength+d);let p=[];for(let w=0;w<d;w++){let S=this.getBlankLine(Ge,!0);p.push(S)}p.length>0&&(r.push({start:o+c.length+n,newLines:p}),n+=p.length),c.push(...p);let _=u.length-1,g=u[_];g===0&&(_--,g=u[_]);let v=c.length-d-1,b=l;for(;v>=0;){let w=Math.min(b,g);if(c[_]===void 0)break;if(c[_].copyCellsFrom(c[v],b-w,g-w,w,!0),g-=w,g===0&&(_--,g=u[_]),b-=w,b===0){v--;let S=Math.max(v,0);b=Ni(c,S,this._cols)}}for(let w=0;w<c.length;w++)u[w]<t&&c[w].setCell(u[w],i);let k=d-f;for(;k-- >0;)this.ybase===0?this.y<e-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+n)-e&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+e-1)}if(r.length>0){let o=[],a=[];for(let g=0;g<this.lines.length;g++)a.push(this.lines.get(g));let c=this.lines.length,l=c-1,u=0,d=r[u];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+n);let f=0;for(let g=Math.min(this.lines.maxLength-1,c+n-1);g>=0;g--)if(d&&d.start>l+f){for(let v=d.newLines.length-1;v>=0;v--)this.lines.set(g--,d.newLines[v]);g++,o.push({index:l+1,amount:d.newLines.length}),f+=d.newLines.length,d=r[++u]}else this.lines.set(g,a[l--]);let p=0;for(let g=o.length-1;g>=0;g--)o[g].index+=p,this.lines.onInsertEmitter.fire(o[g]),p+=o[g].amount;let _=Math.max(0,c+n-this.lines.maxLength);_>0&&this.lines.onTrimEmitter.fire(_)}}translateBufferLineToString(t,e,s=0,i){let r=this.lines.get(t);return r?r.translateToString(e,s,i):""}getWrappedRangeForLine(t){let e=t,s=t;for(;e>0&&this.lines.get(e).isWrapped;)e--;for(;s+1<this.lines.length&&this.lines.get(s+1).isWrapped;)s++;return{first:e,last:s}}setupTabStops(t){for(t!=null?this.tabs[t]||(t=this.prevStop(t)):(this.tabs={},t=0);t<this._cols;t+=this._optionsService.rawOptions.tabStopWidth)this.tabs[t]=!0}prevStop(t){for(t==null&&(t=this.x);!this.tabs[--t]&&t>0;);return t>=this._cols?this._cols-1:t<0?0:t}nextStop(t){for(t==null&&(t=this.x);!this.tabs[++t]&&t<this._cols;);return t>=this._cols?this._cols-1:t<0?0:t}clearMarkers(t){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].line===t&&(this.markers[e].dispose(),this.markers.splice(e--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].dispose();this.markers.length=0,this._isClearing=!1}addMarker(t){let e=new k1(t);return this.markers.push(e),e.register(this.lines.onTrim(s=>{e.line-=s,e.line<0&&e.dispose()})),e.register(this.lines.onInsert(s=>{e.line>=s.index&&(e.line+=s.amount)})),e.register(this.lines.onDelete(s=>{e.line>=s.index&&e.line<s.index+s.amount&&e.dispose(),e.line>s.index&&(e.line-=s.amount)})),e.register(e.onDispose(()=>this._removeMarker(e))),e}_removeMarker(t){this._isClearing||this.markers.splice(this.markers.indexOf(t),1)}},P1=class extends ye{constructor(t,e){super(),this._optionsService=t,this._bufferService=e,this._onBufferActivate=this._register(new te),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 Hl(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Hl(!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(t){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(t),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(t,e){this._normal.resize(t,e),this._alt.resize(t,e),this.setupTabStops(t)}setupTabStops(t){this._normal.setupTabStops(t),this._alt.setupTabStops(t)}},qd=2,Vd=1,po=class extends ye{constructor(t){super(),this.isUserScrolling=!1,this._onResize=this._register(new te),this.onResize=this._onResize.event,this._onScroll=this._register(new te),this.onScroll=this._onScroll.event,this.cols=Math.max(t.rawOptions.cols||0,qd),this.rows=Math.max(t.rawOptions.rows||0,Vd),this.buffers=this._register(new P1(t,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(t,e){let s=this.cols!==t,i=this.rows!==e;this.cols=t,this.rows=e,this.buffers.resize(t,e),this._onResize.fire({cols:t,rows:e,colsChanged:s,rowsChanged:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(t,e=!1){let s=this.buffer,i;i=this._cachedBlankLine,(!i||i.length!==this.cols||i.getFg(0)!==t.fg||i.getBg(0)!==t.bg)&&(i=s.getBlankLine(t,e),this._cachedBlankLine=i),i.isWrapped=e;let r=s.ybase+s.scrollTop,n=s.ybase+s.scrollBottom;if(s.scrollTop===0){let o=s.lines.isFull;n===s.lines.length-1?o?s.lines.recycle().copyFrom(i):s.lines.push(i.clone()):s.lines.splice(n+1,0,i.clone()),o?this.isUserScrolling&&(s.ydisp=Math.max(s.ydisp-1,0)):(s.ybase++,this.isUserScrolling||s.ydisp++)}else{let o=n-r+1;s.lines.shiftElements(r+1,o-1,-1),s.lines.set(n,i.clone())}this.isUserScrolling||(s.ydisp=s.ybase),this._onScroll.fire(s.ydisp)}scrollLines(t,e){let s=this.buffer;if(t<0){if(s.ydisp===0)return;this.isUserScrolling=!0}else t+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);let i=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+t,s.ybase),0),i!==s.ydisp&&(e||this._onScroll.fire(s.ydisp))}};po=He([oe(0,St)],po);var Vs={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Er,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},E1=["normal","bold","100","200","300","400","500","600","700","800","900"],R1=class extends ye{constructor(t){super(),this._onOptionChange=this._register(new te),this.onOptionChange=this._onOptionChange.event;let e={...Vs};for(let s in t)if(s in e)try{let i=t[s];e[s]=this._sanitizeAndValidateOption(s,i)}catch(i){console.error(i)}this.rawOptions=e,this.options={...e},this._setupOptions(),this._register(Le(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(t,e){return this.onOptionChange(s=>{s===t&&e(this.rawOptions[t])})}onMultipleOptionChange(t,e){return this.onOptionChange(s=>{t.indexOf(s)!==-1&&e()})}_setupOptions(){let t=s=>{if(!(s in Vs))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},e=(s,i)=>{if(!(s in Vs))throw new Error(`No option with key "${s}"`);i=this._sanitizeAndValidateOption(s,i),this.rawOptions[s]!==i&&(this.rawOptions[s]=i,this._onOptionChange.fire(s))};for(let s in this.rawOptions){let i={get:t.bind(this,s),set:e.bind(this,s)};Object.defineProperty(this.options,s,i)}}_sanitizeAndValidateOption(t,e){switch(t){case"cursorStyle":if(e||(e=Vs[t]),!T1(e))throw new Error(`"${e}" is not a valid value for ${t}`);break;case"wordSeparator":e||(e=Vs[t]);break;case"fontWeight":case"fontWeightBold":if(typeof e=="number"&&1<=e&&e<=1e3)break;e=E1.includes(e)?e:Vs[t];break;case"cursorWidth":e=Math.floor(e);case"lineHeight":case"tabStopWidth":if(e<1)throw new Error(`${t} cannot be less than 1, value: ${e}`);break;case"minimumContrastRatio":e=Math.max(1,Math.min(21,Math.round(e*10)/10));break;case"scrollback":if(e=Math.min(e,4294967295),e<0)throw new Error(`${t} cannot be less than 0, value: ${e}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(e<=0)throw new Error(`${t} cannot be less than or equal to 0, value: ${e}`);break;case"rows":case"cols":if(!e&&e!==0)throw new Error(`${t} must be numeric, value: ${e}`);break;case"windowsPty":e=e??{};break}return e}};function T1(t){return t==="block"||t==="underline"||t==="bar"}function Si(t,e=5){if(typeof t!="object")return t;let s=Array.isArray(t)?[]:{};for(let i in t)s[i]=e<=1?t[i]:t[i]&&Si(t[i],e-1);return s}var Wl=Object.freeze({insertMode:!1}),Ul=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),_o=class extends ye{constructor(t,e,s){super(),this._bufferService=t,this._logService=e,this._optionsService=s,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new te),this.onData=this._onData.event,this._onUserInput=this._register(new te),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new te),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new te),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Si(Wl),this.decPrivateModes=Si(Ul)}reset(){this.modes=Si(Wl),this.decPrivateModes=Si(Ul)}triggerDataEvent(t,e=!1){if(this._optionsService.rawOptions.disableStdin)return;let s=this._bufferService.buffer;e&&this._optionsService.rawOptions.scrollOnUserInput&&s.ybase!==s.ydisp&&this._onRequestScrollToBottom.fire(),e&&this._onUserInput.fire(),this._logService.debug(`sending data "${t}"`),this._logService.trace("sending data (codes)",()=>t.split("").map(i=>i.charCodeAt(0))),this._onData.fire(t)}triggerBinaryEvent(t){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${t}"`),this._logService.trace("sending binary (codes)",()=>t.split("").map(e=>e.charCodeAt(0))),this._onBinary.fire(t))}};_o=He([oe(0,bt),oe(1,fd),oe(2,St)],_o);var Kl={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:t=>t.button===4||t.action!==1?!1:(t.ctrl=!1,t.alt=!1,t.shift=!1,!0)},VT200:{events:19,restrict:t=>t.action!==32},DRAG:{events:23,restrict:t=>!(t.action===32&&t.button===3)},ANY:{events:31,restrict:t=>!0}};function dn(t,e){let s=(t.ctrl?16:0)|(t.shift?4:0)|(t.alt?8:0);return t.button===4?(s|=64,s|=t.action):(s|=t.button&3,t.button&4&&(s|=64),t.button&8&&(s|=128),t.action===32?s|=32:t.action===0&&!e&&(s|=3)),s}var un=String.fromCharCode,ql={DEFAULT:t=>{let e=[dn(t,!1)+32,t.col+32,t.row+32];return e[0]>255||e[1]>255||e[2]>255?"":`\x1B[M${un(e[0])}${un(e[1])}${un(e[2])}`},SGR:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${dn(t,!0)};${t.col};${t.row}${e}`},SGR_PIXELS:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${dn(t,!0)};${t.x};${t.y}${e}`}},mo=class extends ye{constructor(t,e,s){super(),this._bufferService=t,this._coreService=e,this._optionsService=s,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new te),this.onProtocolChange=this._onProtocolChange.event;for(let i of Object.keys(Kl))this.addProtocol(i,Kl[i]);for(let i of Object.keys(ql))this.addEncoding(i,ql[i]);this.reset()}addProtocol(t,e){this._protocols[t]=e}addEncoding(t,e){this._encodings[t]=e}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(t){if(!this._protocols[t])throw new Error(`unknown protocol "${t}"`);this._activeProtocol=t,this._onProtocolChange.fire(this._protocols[t].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(t){if(!this._encodings[t])throw new Error(`unknown encoding "${t}"`);this._activeEncoding=t}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(t,e,s){if(t.deltaY===0||t.shiftKey||e===void 0||s===void 0)return 0;let i=e/s,r=this._applyScrollModifier(t.deltaY,t);return t.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=i+0,Math.abs(t.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_applyScrollModifier(t,e){return e.altKey||e.ctrlKey||e.shiftKey?t*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:t*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(t){if(t.col<0||t.col>=this._bufferService.cols||t.row<0||t.row>=this._bufferService.rows||t.button===4&&t.action===32||t.button===3&&t.action!==32||t.button!==4&&(t.action===2||t.action===3)||(t.col++,t.row++,t.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,t,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(t))return!1;let e=this._encodings[this._activeEncoding](t);return e&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(e):this._coreService.triggerDataEvent(e,!0)),this._lastEvent=t,!0}explainEvents(t){return{down:!!(t&1),up:!!(t&2),drag:!!(t&4),move:!!(t&8),wheel:!!(t&16)}}_equalEvents(t,e,s){if(s){if(t.x!==e.x||t.y!==e.y)return!1}else if(t.col!==e.col||t.row!==e.row)return!1;return!(t.button!==e.button||t.action!==e.action||t.ctrl!==e.ctrl||t.alt!==e.alt||t.shift!==e.shift)}};mo=He([oe(0,bt),oe(1,Ws),oe(2,St)],mo);var fn=[[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]],A1=[[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]],it;function D1(t,e){let s=0,i=e.length-1,r;if(t<e[0][0]||t>e[i][1])return!1;for(;i>=s;)if(r=s+i>>1,t>e[r][1])s=r+1;else if(t<e[r][0])i=r-1;else return!0;return!1}var N1=class{constructor(){if(this.version="6",!it){it=new Uint8Array(65536),it.fill(1),it[0]=0,it.fill(0,1,32),it.fill(0,127,160),it.fill(2,4352,4448),it[9001]=2,it[9002]=2,it.fill(2,11904,42192),it[12351]=1,it.fill(2,44032,55204),it.fill(2,63744,64256),it.fill(2,65040,65050),it.fill(2,65072,65136),it.fill(2,65280,65377),it.fill(2,65504,65511);for(let t=0;t<fn.length;++t)it.fill(0,fn[t][0],fn[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?it[t]:D1(t,A1)?0:t>=131072&&t<=196605||t>=196608&&t<=262141?2:1}charProperties(t,e){let s=this.wcwidth(t),i=s===0&&e!==0;if(i){let r=Ns.extractWidth(e);r===0?i=!1:r>s&&(s=r)}return Ns.createPropertyValue(0,s,i)}},Ns=class gr{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new te,this.onChange=this._onChange.event;let e=new N1;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!==0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,s,i=!1){return(e&16777215)<<3|(s&3)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let s=0,i=0,r=e.length;for(let n=0;n<r;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=r)return s+this.wcwidth(o);let l=e.charCodeAt(n);56320<=l&&l<=57343?o=(o-55296)*1024+l-56320+65536:s+=this.wcwidth(l)}let a=this.charProperties(o,i),c=gr.extractWidth(a);gr.extractShouldJoin(a)&&(c-=gr.extractWidth(i)),s+=c,i=a}return s}charProperties(e,s){return this._activeProvider.charProperties(e,s)}},M1=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(t){this.glevel=t,this.charset=this._charsets[t]}setgCharset(t,e){this._charsets[t]=e,this.glevel===t&&(this.charset=e)}};function Vl(t){let e=t.buffer.lines.get(t.buffer.ybase+t.buffer.y-1)?.get(t.cols-1),s=t.buffer.lines.get(t.buffer.ybase+t.buffer.y);s&&e&&(s.isWrapped=e[3]!==0&&e[3]!==32)}var ui=2147483647,B1=256,Gd=class go{constructor(e=32,s=32){if(this.maxLength=e,this.maxSubParamsLength=s,s>B1)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(s),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(e){let s=new go;if(!e.length)return s;for(let i=Array.isArray(e[0])?1:0;i<e.length;++i){let r=e[i];if(Array.isArray(r))for(let n=0;n<r.length;++n)s.addSubParam(r[n]);else s.addParam(r)}return s}clone(){let e=new go(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){let e=[];for(let s=0;s<this.length;++s){e.push(this.params[s]);let i=this._subParamsIdx[s]>>8,r=this._subParamsIdx[s]&255;r-i>0&&e.push(Array.prototype.slice.call(this._subParams,i,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>ui?ui:e}addSubParam(e){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>ui?ui:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let s=this._subParamsIdx[e]>>8,i=this._subParamsIdx[e]&255;return i-s>0?this._subParams.subarray(s,i):null}getSubParamsAll(){let e={};for(let s=0;s<this.length;++s){let i=this._subParamsIdx[s]>>8,r=this._subParamsIdx[s]&255;r-i>0&&(e[s]=this._subParams.slice(i,r))}return e}addDigit(e){let s;if(this._rejectDigits||!(s=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let i=this._digitIsSub?this._subParams:this.params,r=i[s-1];i[s-1]=~r?Math.min(r*10+e,ui):e}},fi=[],L1=class{constructor(){this._state=0,this._active=fi,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(t,e){this._handlers[t]===void 0&&(this._handlers[t]=[]);let s=this._handlers[t];return s.push(e),{dispose:()=>{let i=s.indexOf(e);i!==-1&&s.splice(i,1)}}}clearHandler(t){this._handlers[t]&&delete this._handlers[t]}setHandlerFallback(t){this._handlerFb=t}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=fi}reset(){if(this._state===2)for(let t=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;t>=0;--t)this._active[t].end(!1);this._stack.paused=!1,this._active=fi,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||fi,!this._active.length)this._handlerFb(this._id,"START");else for(let t=this._active.length-1;t>=0;t--)this._active[t].start()}_put(t,e,s){if(!this._active.length)this._handlerFb(this._id,"PUT",Wr(t,e,s));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(t,e,s)}start(){this.reset(),this._state=1}put(t,e,s){if(this._state!==3){if(this._state===1)for(;e<s;){let i=t[e++];if(i===59){this._state=2,this._start();break}if(i<48||57<i){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+i-48}this._state===2&&s-e>0&&this._put(t,e,s)}}end(t,e=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",t);else{let s=!1,i=this._active.length-1,r=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,s=e,r=this._stack.fallThrough,this._stack.paused=!1),!r&&s===!1){for(;i>=0&&(s=this._active[i].end(t),s!==!0);i--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,s;i--}for(;i>=0;i--)if(s=this._active[i].end(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,s}this._active=fi,this._id=-1,this._state=0}}},Nt=class{constructor(t){this._handler=t,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(t,e,s){this._hitLimit||(this._data+=Wr(t,e,s),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(t){let e=!1;if(this._hitLimit)e=!1;else if(t&&(e=this._handler(this._data),e instanceof Promise))return e.then(s=>(this._data="",this._hitLimit=!1,s));return this._data="",this._hitLimit=!1,e}},pi=[],j1=class{constructor(){this._handlers=Object.create(null),this._active=pi,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=pi}registerHandler(t,e){this._handlers[t]===void 0&&(this._handlers[t]=[]);let s=this._handlers[t];return s.push(e),{dispose:()=>{let i=s.indexOf(e);i!==-1&&s.splice(i,1)}}}clearHandler(t){this._handlers[t]&&delete this._handlers[t]}setHandlerFallback(t){this._handlerFb=t}reset(){if(this._active.length)for(let t=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;t>=0;--t)this._active[t].unhook(!1);this._stack.paused=!1,this._active=pi,this._ident=0}hook(t,e){if(this.reset(),this._ident=t,this._active=this._handlers[t]||pi,!this._active.length)this._handlerFb(this._ident,"HOOK",e);else for(let s=this._active.length-1;s>=0;s--)this._active[s].hook(e)}put(t,e,s){if(!this._active.length)this._handlerFb(this._ident,"PUT",Wr(t,e,s));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(t,e,s)}unhook(t,e=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",t);else{let s=!1,i=this._active.length-1,r=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,s=e,r=this._stack.fallThrough,this._stack.paused=!1),!r&&s===!1){for(;i>=0&&(s=this._active[i].unhook(t),s!==!0);i--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,s;i--}for(;i>=0;i--)if(s=this._active[i].unhook(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,s}this._active=pi,this._ident=0}},yi=new Gd;yi.addParam(0);var Gl=class{constructor(t){this._handler=t,this._data="",this._params=yi,this._hitLimit=!1}hook(t){this._params=t.length>1||t.params[0]?t.clone():yi,this._data="",this._hitLimit=!1}put(t,e,s){this._hitLimit||(this._data+=Wr(t,e,s),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(t){let e=!1;if(this._hitLimit)e=!1;else if(t&&(e=this._handler(this._data,this._params),e instanceof Promise))return e.then(s=>(this._params=yi,this._data="",this._hitLimit=!1,s));return this._params=yi,this._data="",this._hitLimit=!1,e}},I1=class{constructor(t){this.table=new Uint8Array(t)}setDefault(t,e){this.table.fill(t<<4|e)}add(t,e,s,i){this.table[e<<8|t]=s<<4|i}addMany(t,e,s,i){for(let r=0;r<t.length;r++)this.table[e<<8|t[r]]=s<<4|i}},jt=160,O1=(function(){let t=new I1(4095),e=Array.apply(null,Array(256)).map((a,c)=>c),s=(a,c)=>e.slice(a,c),i=s(32,127),r=s(0,24);r.push(25),r.push.apply(r,s(28,32));let n=s(0,14),o;t.setDefault(1,0),t.addMany(i,0,2,0);for(o in n)t.addMany([24,26,153,154],o,3,0),t.addMany(s(128,144),o,3,0),t.addMany(s(144,152),o,3,0),t.add(156,o,0,0),t.add(27,o,11,1),t.add(157,o,4,8),t.addMany([152,158,159],o,0,7),t.add(155,o,11,3),t.add(144,o,11,9);return t.addMany(r,0,3,0),t.addMany(r,1,3,1),t.add(127,1,0,1),t.addMany(r,8,0,8),t.addMany(r,3,3,3),t.add(127,3,0,3),t.addMany(r,4,3,4),t.add(127,4,0,4),t.addMany(r,6,3,6),t.addMany(r,5,3,5),t.add(127,5,0,5),t.addMany(r,2,3,2),t.add(127,2,0,2),t.add(93,1,4,8),t.addMany(i,8,5,8),t.add(127,8,5,8),t.addMany([156,27,24,26,7],8,6,0),t.addMany(s(28,32),8,0,8),t.addMany([88,94,95],1,0,7),t.addMany(i,7,0,7),t.addMany(r,7,0,7),t.add(156,7,0,0),t.add(127,7,0,7),t.add(91,1,11,3),t.addMany(s(64,127),3,7,0),t.addMany(s(48,60),3,8,4),t.addMany([60,61,62,63],3,9,4),t.addMany(s(48,60),4,8,4),t.addMany(s(64,127),4,7,0),t.addMany([60,61,62,63],4,0,6),t.addMany(s(32,64),6,0,6),t.add(127,6,0,6),t.addMany(s(64,127),6,0,0),t.addMany(s(32,48),3,9,5),t.addMany(s(32,48),5,9,5),t.addMany(s(48,64),5,0,6),t.addMany(s(64,127),5,7,0),t.addMany(s(32,48),4,9,5),t.addMany(s(32,48),1,9,2),t.addMany(s(32,48),2,9,2),t.addMany(s(48,127),2,10,0),t.addMany(s(48,80),1,10,0),t.addMany(s(81,88),1,10,0),t.addMany([89,90,92],1,10,0),t.addMany(s(96,127),1,10,0),t.add(80,1,11,9),t.addMany(r,9,0,9),t.add(127,9,0,9),t.addMany(s(28,32),9,0,9),t.addMany(s(32,48),9,9,12),t.addMany(s(48,60),9,8,10),t.addMany([60,61,62,63],9,9,10),t.addMany(r,11,0,11),t.addMany(s(32,128),11,0,11),t.addMany(s(28,32),11,0,11),t.addMany(r,10,0,10),t.add(127,10,0,10),t.addMany(s(28,32),10,0,10),t.addMany(s(48,60),10,8,10),t.addMany([60,61,62,63],10,0,11),t.addMany(s(32,48),10,9,12),t.addMany(r,12,0,12),t.add(127,12,0,12),t.addMany(s(28,32),12,0,12),t.addMany(s(32,48),12,9,12),t.addMany(s(48,64),12,0,11),t.addMany(s(64,127),12,12,13),t.addMany(s(64,127),10,12,13),t.addMany(s(64,127),9,12,13),t.addMany(r,13,13,13),t.addMany(i,13,13,13),t.add(127,13,0,13),t.addMany([27,156,24,26],13,14,0),t.add(jt,0,2,0),t.add(jt,8,5,8),t.add(jt,6,0,6),t.add(jt,11,0,11),t.add(jt,13,13,13),t})(),z1=class extends ye{constructor(t=O1){super(),this._transitions=t,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new Gd,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,s,i)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,s)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(Le(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new L1),this._dcsParser=this._register(new j1),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(t,e=[64,126]){let s=0;if(t.prefix){if(t.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=t.prefix.charCodeAt(0),s&&60>s||s>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(t.intermediates){if(t.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let r=0;r<t.intermediates.length;++r){let n=t.intermediates.charCodeAt(r);if(32>n||n>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=n}}if(t.final.length!==1)throw new Error("final must be a single byte");let i=t.final.charCodeAt(0);if(e[0]>i||i>e[1])throw new Error(`final must be in range ${e[0]} .. ${e[1]}`);return s<<=8,s|=i,s}identToString(t){let e=[];for(;t;)e.push(String.fromCharCode(t&255)),t>>=8;return e.reverse().join("")}setPrintHandler(t){this._printHandler=t}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(t,e){let s=this._identifier(t,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);let i=this._escHandlers[s];return i.push(e),{dispose:()=>{let r=i.indexOf(e);r!==-1&&i.splice(r,1)}}}clearEscHandler(t){this._escHandlers[this._identifier(t,[48,126])]&&delete this._escHandlers[this._identifier(t,[48,126])]}setEscHandlerFallback(t){this._escHandlerFb=t}setExecuteHandler(t,e){this._executeHandlers[t.charCodeAt(0)]=e}clearExecuteHandler(t){this._executeHandlers[t.charCodeAt(0)]&&delete this._executeHandlers[t.charCodeAt(0)]}setExecuteHandlerFallback(t){this._executeHandlerFb=t}registerCsiHandler(t,e){let s=this._identifier(t);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);let i=this._csiHandlers[s];return i.push(e),{dispose:()=>{let r=i.indexOf(e);r!==-1&&i.splice(r,1)}}}clearCsiHandler(t){this._csiHandlers[this._identifier(t)]&&delete this._csiHandlers[this._identifier(t)]}setCsiHandlerFallback(t){this._csiHandlerFb=t}registerDcsHandler(t,e){return this._dcsParser.registerHandler(this._identifier(t),e)}clearDcsHandler(t){this._dcsParser.clearHandler(this._identifier(t))}setDcsHandlerFallback(t){this._dcsParser.setHandlerFallback(t)}registerOscHandler(t,e){return this._oscParser.registerHandler(t,e)}clearOscHandler(t){this._oscParser.clearHandler(t)}setOscHandlerFallback(t){this._oscParser.setHandlerFallback(t)}setErrorHandler(t){this._errorHandler=t}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.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(t,e,s,i,r){this._parseStack.state=t,this._parseStack.handlers=e,this._parseStack.handlerPos=s,this._parseStack.transition=i,this._parseStack.chunkPos=r}parse(t,e,s){let i=0,r=0,n=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,n=this._parseStack.chunkPos+1;else{if(s===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let a=this._parseStack.handlers,c=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&c>-1){for(;c>=0&&(o=a[c](this._params),o!==!0);c--)if(o instanceof Promise)return this._parseStack.handlerPos=c,o}this._parseStack.handlers=[];break;case 4:if(s===!1&&c>-1){for(;c>=0&&(o=a[c](),o!==!0);c--)if(o instanceof Promise)return this._parseStack.handlerPos=c,o}this._parseStack.handlers=[];break;case 6:if(i=t[this._parseStack.chunkPos],o=this._dcsParser.unhook(i!==24&&i!==26,s),o)return o;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=t[this._parseStack.chunkPos],o=this._oscParser.end(i!==24&&i!==26,s),o)return o;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,n=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let a=n;a<e;++a){switch(i=t[a],r=this._transitions.table[this.currentState<<8|(i<160?i:jt)],r>>4){case 2:for(let f=a+1;;++f){if(f>=e||(i=t[f])<32||i>126&&i<jt){this._printHandler(t,a,f),a=f-1;break}if(++f>=e||(i=t[f])<32||i>126&&i<jt){this._printHandler(t,a,f),a=f-1;break}if(++f>=e||(i=t[f])<32||i>126&&i<jt){this._printHandler(t,a,f),a=f-1;break}if(++f>=e||(i=t[f])<32||i>126&&i<jt){this._printHandler(t,a,f),a=f-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:a,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let c=this._csiHandlers[this._collect<<8|i],l=c?c.length-1:-1;for(;l>=0&&(o=c[l](this._params),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(3,c,l,r,a),o;l<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++a<e&&(i=t[a])>47&&i<60);a--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let u=this._escHandlers[this._collect<<8|i],d=u?u.length-1:-1;for(;d>=0&&(o=u[d](),o!==!0);d--)if(o instanceof Promise)return this._preserveStack(4,u,d,r,a),o;d<0&&this._escHandlerFb(this._collect<<8|i),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|i,this._params);break;case 13:for(let f=a+1;;++f)if(f>=e||(i=t[f])===24||i===26||i===27||i>127&&i<jt){this._dcsParser.put(t,a,f),a=f-1;break}break;case 14:if(o=this._dcsParser.unhook(i!==24&&i!==26),o)return this._preserveStack(6,[],0,r,a),o;i===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let f=a+1;;f++)if(f>=e||(i=t[f])<32||i>127&&i<jt){this._oscParser.put(t,a,f),a=f-1;break}break;case 6:if(o=this._oscParser.end(i!==24&&i!==26),o)return this._preserveStack(5,[],0,r,a),o;i===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=r&15}}},$1=/^([\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})$/,F1=/^[\da-f]+$/;function Yl(t){if(!t)return;let e=t.toLowerCase();if(e.indexOf("rgb:")===0){e=e.slice(4);let s=$1.exec(e);if(s){let i=s[1]?15:s[4]?255:s[7]?4095:65535;return[Math.round(parseInt(s[1]||s[4]||s[7]||s[10],16)/i*255),Math.round(parseInt(s[2]||s[5]||s[8]||s[11],16)/i*255),Math.round(parseInt(s[3]||s[6]||s[9]||s[12],16)/i*255)]}}else if(e.indexOf("#")===0&&(e=e.slice(1),F1.exec(e)&&[3,6,9,12].includes(e.length))){let s=e.length/3,i=[0,0,0];for(let r=0;r<3;++r){let n=parseInt(e.slice(s*r,s*r+s),16);i[r]=s===1?n<<4:s===2?n:s===3?n>>4:n>>8}return i}}function pn(t,e){let s=t.toString(16),i=s.length<2?"0"+s:s;switch(e){case 4:return s[0];case 8:return i;case 12:return(i+i).slice(0,3);default:return i+i}}function H1(t,e=16){let[s,i,r]=t;return`rgb:${pn(s,e)}/${pn(i,e)}/${pn(r,e)}`}var W1={"(":0,")":1,"*":2,"+":3,"-":1,".":2},bs=131072,Xl=10;function Jl(t,e){if(t>24)return e.setWinLines||!1;switch(t){case 1:return!!e.restoreWin;case 2:return!!e.minimizeWin;case 3:return!!e.setWinPosition;case 4:return!!e.setWinSizePixels;case 5:return!!e.raiseWin;case 6:return!!e.lowerWin;case 7:return!!e.refreshWin;case 8:return!!e.setWinSizeChars;case 9:return!!e.maximizeWin;case 10:return!!e.fullscreenWin;case 11:return!!e.getWinState;case 13:return!!e.getWinPosition;case 14:return!!e.getWinSizePixels;case 15:return!!e.getScreenSizePixels;case 16:return!!e.getCellSizePixels;case 18:return!!e.getWinSizeChars;case 19:return!!e.getScreenSizeChars;case 20:return!!e.getIconTitle;case 21:return!!e.getWinTitle;case 22:return!!e.pushTitle;case 23:return!!e.popTitle;case 24:return!!e.setWinLines}return!1}var Zl=5e3,Ql=0,U1=class extends ye{constructor(t,e,s,i,r,n,o,a,c=new z1){super(),this._bufferService=t,this._charsetService=e,this._coreService=s,this._logService=i,this._optionsService=r,this._oscLinkService=n,this._coreMouseService=o,this._unicodeService=a,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new cg,this._utf8Decoder=new hg,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Ge.clone(),this._eraseAttrDataInternal=Ge.clone(),this._onRequestBell=this._register(new te),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new te),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new te),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new te),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new te),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new te),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new te),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new te),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new te),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new te),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new te),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new te),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new te),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 vo(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(l=>this._activeBuffer=l.activeBuffer)),this._parser.setCsiHandlerFallback((l,u)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(l),params:u.toArray()})}),this._parser.setEscHandlerFallback(l=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(l)})}),this._parser.setExecuteHandlerFallback(l=>{this._logService.debug("Unknown EXECUTE code: ",{code:l})}),this._parser.setOscHandlerFallback((l,u,d)=>{this._logService.debug("Unknown OSC code: ",{identifier:l,action:u,data:d})}),this._parser.setDcsHandlerFallback((l,u,d)=>{u==="HOOK"&&(d=d.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(l),action:u,payload:d})}),this._parser.setPrintHandler((l,u,d)=>this.print(l,u,d)),this._parser.registerCsiHandler({final:"@"},l=>this.insertChars(l)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},l=>this.scrollLeft(l)),this._parser.registerCsiHandler({final:"A"},l=>this.cursorUp(l)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},l=>this.scrollRight(l)),this._parser.registerCsiHandler({final:"B"},l=>this.cursorDown(l)),this._parser.registerCsiHandler({final:"C"},l=>this.cursorForward(l)),this._parser.registerCsiHandler({final:"D"},l=>this.cursorBackward(l)),this._parser.registerCsiHandler({final:"E"},l=>this.cursorNextLine(l)),this._parser.registerCsiHandler({final:"F"},l=>this.cursorPrecedingLine(l)),this._parser.registerCsiHandler({final:"G"},l=>this.cursorCharAbsolute(l)),this._parser.registerCsiHandler({final:"H"},l=>this.cursorPosition(l)),this._parser.registerCsiHandler({final:"I"},l=>this.cursorForwardTab(l)),this._parser.registerCsiHandler({final:"J"},l=>this.eraseInDisplay(l,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},l=>this.eraseInDisplay(l,!0)),this._parser.registerCsiHandler({final:"K"},l=>this.eraseInLine(l,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},l=>this.eraseInLine(l,!0)),this._parser.registerCsiHandler({final:"L"},l=>this.insertLines(l)),this._parser.registerCsiHandler({final:"M"},l=>this.deleteLines(l)),this._parser.registerCsiHandler({final:"P"},l=>this.deleteChars(l)),this._parser.registerCsiHandler({final:"S"},l=>this.scrollUp(l)),this._parser.registerCsiHandler({final:"T"},l=>this.scrollDown(l)),this._parser.registerCsiHandler({final:"X"},l=>this.eraseChars(l)),this._parser.registerCsiHandler({final:"Z"},l=>this.cursorBackwardTab(l)),this._parser.registerCsiHandler({final:"`"},l=>this.charPosAbsolute(l)),this._parser.registerCsiHandler({final:"a"},l=>this.hPositionRelative(l)),this._parser.registerCsiHandler({final:"b"},l=>this.repeatPrecedingCharacter(l)),this._parser.registerCsiHandler({final:"c"},l=>this.sendDeviceAttributesPrimary(l)),this._parser.registerCsiHandler({prefix:">",final:"c"},l=>this.sendDeviceAttributesSecondary(l)),this._parser.registerCsiHandler({final:"d"},l=>this.linePosAbsolute(l)),this._parser.registerCsiHandler({final:"e"},l=>this.vPositionRelative(l)),this._parser.registerCsiHandler({final:"f"},l=>this.hVPosition(l)),this._parser.registerCsiHandler({final:"g"},l=>this.tabClear(l)),this._parser.registerCsiHandler({final:"h"},l=>this.setMode(l)),this._parser.registerCsiHandler({prefix:"?",final:"h"},l=>this.setModePrivate(l)),this._parser.registerCsiHandler({final:"l"},l=>this.resetMode(l)),this._parser.registerCsiHandler({prefix:"?",final:"l"},l=>this.resetModePrivate(l)),this._parser.registerCsiHandler({final:"m"},l=>this.charAttributes(l)),this._parser.registerCsiHandler({final:"n"},l=>this.deviceStatus(l)),this._parser.registerCsiHandler({prefix:"?",final:"n"},l=>this.deviceStatusPrivate(l)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},l=>this.softReset(l)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},l=>this.setCursorStyle(l)),this._parser.registerCsiHandler({final:"r"},l=>this.setScrollRegion(l)),this._parser.registerCsiHandler({final:"s"},l=>this.saveCursor(l)),this._parser.registerCsiHandler({final:"t"},l=>this.windowOptions(l)),this._parser.registerCsiHandler({final:"u"},l=>this.restoreCursor(l)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},l=>this.insertColumns(l)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},l=>this.deleteColumns(l)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},l=>this.selectProtected(l)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},l=>this.requestMode(l,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},l=>this.requestMode(l,!1)),this._parser.setExecuteHandler(W.BEL,()=>this.bell()),this._parser.setExecuteHandler(W.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(W.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(W.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(W.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(W.BS,()=>this.backspace()),this._parser.setExecuteHandler(W.HT,()=>this.tab()),this._parser.setExecuteHandler(W.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(W.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(_r.IND,()=>this.index()),this._parser.setExecuteHandler(_r.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(_r.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Nt(l=>(this.setTitle(l),this.setIconName(l),!0))),this._parser.registerOscHandler(1,new Nt(l=>this.setIconName(l))),this._parser.registerOscHandler(2,new Nt(l=>this.setTitle(l))),this._parser.registerOscHandler(4,new Nt(l=>this.setOrReportIndexedColor(l))),this._parser.registerOscHandler(8,new Nt(l=>this.setHyperlink(l))),this._parser.registerOscHandler(10,new Nt(l=>this.setOrReportFgColor(l))),this._parser.registerOscHandler(11,new Nt(l=>this.setOrReportBgColor(l))),this._parser.registerOscHandler(12,new Nt(l=>this.setOrReportCursorColor(l))),this._parser.registerOscHandler(104,new Nt(l=>this.restoreIndexedColor(l))),this._parser.registerOscHandler(110,new Nt(l=>this.restoreFgColor(l))),this._parser.registerOscHandler(111,new Nt(l=>this.restoreBgColor(l))),this._parser.registerOscHandler(112,new Nt(l=>this.restoreCursorColor(l))),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(let l in rt)this._parser.registerEscHandler({intermediates:"(",final:l},()=>this.selectCharset("("+l)),this._parser.registerEscHandler({intermediates:")",final:l},()=>this.selectCharset(")"+l)),this._parser.registerEscHandler({intermediates:"*",final:l},()=>this.selectCharset("*"+l)),this._parser.registerEscHandler({intermediates:"+",final:l},()=>this.selectCharset("+"+l)),this._parser.registerEscHandler({intermediates:"-",final:l},()=>this.selectCharset("-"+l)),this._parser.registerEscHandler({intermediates:".",final:l},()=>this.selectCharset("."+l)),this._parser.registerEscHandler({intermediates:"/",final:l},()=>this.selectCharset("/"+l));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(l=>(this._logService.error("Parsing error: ",l),l)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Gl((l,u)=>this.requestStatusString(l,u)))}getAttrData(){return this._curAttrData}_preserveStack(t,e,s,i){this._parseStack.paused=!0,this._parseStack.cursorStartX=t,this._parseStack.cursorStartY=e,this._parseStack.decodedLength=s,this._parseStack.position=i}_logSlowResolvingAsync(t){this._logService.logLevel<=3&&Promise.race([t,new Promise((e,s)=>setTimeout(()=>s("#SLOW_TIMEOUT"),Zl))]).catch(e=>{if(e!=="#SLOW_TIMEOUT")throw e;console.warn(`async parser handler taking longer than ${Zl} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(t,e){let s,i=this._activeBuffer.x,r=this._activeBuffer.y,n=0,o=this._parseStack.paused;if(o){if(s=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,e))return this._logSlowResolvingAsync(s),s;i=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,t.length>bs&&(n=this._parseStack.position+bs)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof t=="string"?` "${t}"`:` "${Array.prototype.map.call(t,l=>String.fromCharCode(l)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof t=="string"?t.split("").map(l=>l.charCodeAt(0)):t),this._parseBuffer.length<t.length&&this._parseBuffer.length<bs&&(this._parseBuffer=new Uint32Array(Math.min(t.length,bs))),o||this._dirtyRowTracker.clearRange(),t.length>bs)for(let l=n;l<t.length;l+=bs){let u=l+bs<t.length?l+bs:t.length,d=typeof t=="string"?this._stringDecoder.decode(t.substring(l,u),this._parseBuffer):this._utf8Decoder.decode(t.subarray(l,u),this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,d))return this._preserveStack(i,r,d,l),this._logSlowResolvingAsync(s),s}else if(!o){let l=typeof t=="string"?this._stringDecoder.decode(t,this._parseBuffer):this._utf8Decoder.decode(t,this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,l))return this._preserveStack(i,r,l,0),this._logSlowResolvingAsync(s),s}(this._activeBuffer.x!==i||this._activeBuffer.y!==r)&&this._onCursorMove.fire();let a=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(a,this._bufferService.rows-1)})}print(t,e,s){let i,r,n=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,u=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&s-e>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=e;p<s;++p){if(i=t[p],i<127&&n){let b=n[String.fromCharCode(i)];b&&(i=b.charCodeAt(0))}let _=this._unicodeService.charProperties(i,f);r=Ns.extractWidth(_);let g=Ns.extractShouldJoin(_),v=g?Ns.extractWidth(f):0;if(f=_,o&&this._onA11yChar.fire(Ss(i)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-v>a){if(c){let b=d,k=this._activeBuffer.x-v;for(this._activeBuffer.x=v,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),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),v>0&&d instanceof bi&&d.copyCellsFrom(b,k,0,v,!1);k<a;)b.setCellFromCodepoint(k++,0,1,u)}else if(this._activeBuffer.x=a-1,r===2)continue}if(g&&this._activeBuffer.x){let b=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-b,i,r);for(let k=r-v;--k>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(l&&(d.insertCells(this._activeBuffer.x,r-v,this._activeBuffer.getNullCell(u)),d.getWidth(a-1)===2&&d.setCellFromCodepoint(a-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,i,r,u),r>0)for(;--r;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<a&&s-e>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(t,e){return t.final==="t"&&!t.prefix&&!t.intermediates?this._parser.registerCsiHandler(t,s=>Jl(s.params[0],this._optionsService.rawOptions.windowOptions)?e(s):!0):this._parser.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._parser.registerDcsHandler(t,new Gl(e))}registerEscHandler(t,e){return this._parser.registerEscHandler(t,e)}registerOscHandler(t,e){return this._parser.registerOscHandler(t,new Nt(e))}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(){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&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-t),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(t=this._bufferService.cols-1){this._activeBuffer.x=Math.min(t,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(t,e){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=t,this._activeBuffer.y=this._activeBuffer.scrollTop+e):(this._activeBuffer.x=t,this._activeBuffer.y=e),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(t,e){this._restrictCursor(),this._setCursor(this._activeBuffer.x+t,this._activeBuffer.y+e)}cursorUp(t){let e=this._activeBuffer.y-this._activeBuffer.scrollTop;return e>=0?this._moveCursor(0,-Math.min(e,t.params[0]||1)):this._moveCursor(0,-(t.params[0]||1)),!0}cursorDown(t){let e=this._activeBuffer.scrollBottom-this._activeBuffer.y;return e>=0?this._moveCursor(0,Math.min(e,t.params[0]||1)):this._moveCursor(0,t.params[0]||1),!0}cursorForward(t){return this._moveCursor(t.params[0]||1,0),!0}cursorBackward(t){return this._moveCursor(-(t.params[0]||1),0),!0}cursorNextLine(t){return this.cursorDown(t),this._activeBuffer.x=0,!0}cursorPrecedingLine(t){return this.cursorUp(t),this._activeBuffer.x=0,!0}cursorCharAbsolute(t){return this._setCursor((t.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(t){return this._setCursor(t.length>=2?(t.params[1]||1)-1:0,(t.params[0]||1)-1),!0}charPosAbsolute(t){return this._setCursor((t.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(t){return this._moveCursor(t.params[0]||1,0),!0}linePosAbsolute(t){return this._setCursor(this._activeBuffer.x,(t.params[0]||1)-1),!0}vPositionRelative(t){return this._moveCursor(0,t.params[0]||1),!0}hVPosition(t){return this.cursorPosition(t),!0}tabClear(t){let e=t.params[0];return e===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:e===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(t){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=t.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(t){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=t.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(t){let e=t.params[0];return e===1&&(this._curAttrData.bg|=536870912),(e===2||e===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(t,e,s,i=!1,r=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);n.replaceCells(e,s,this._activeBuffer.getNullCell(this._eraseAttrData()),r),i&&(n.isWrapped=!1)}_resetBufferLine(t,e=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);s&&(s.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),e),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+t),s.isWrapped=!1)}eraseInDisplay(t,e=!1){this._restrictCursor(this._bufferService.cols);let s;switch(t.params[0]){case 0:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);s<this._bufferService.rows;s++)this._resetBufferLine(s,e);this._dirtyRowTracker.markDirty(s);break;case 1:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s,0,this._activeBuffer.x+1,!0,e),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(s+1).isWrapped=!1);s--;)this._resetBufferLine(s,e);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(s=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,s-1);s--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+s)?.getTrimmedLength(););for(;s>=0;s--)this._bufferService.scroll(this._eraseAttrData())}else{for(s=this._bufferService.rows,this._dirtyRowTracker.markDirty(s-1);s--;)this._resetBufferLine(s,e);this._dirtyRowTracker.markDirty(0)}break;case 3:let i=this._activeBuffer.lines.length-this._bufferService.rows;i>0&&(this._activeBuffer.lines.trimStart(i),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-i,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-i,0),this._onScroll.fire(0));break}return!0}eraseInLine(t,e=!1){switch(this._restrictCursor(this._bufferService.cols),t.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,e);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,e);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(t){this._restrictCursor();let e=t.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let s=this._activeBuffer.ybase+this._activeBuffer.y,i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-i+1;for(;e--;)this._activeBuffer.lines.splice(r-1,1),this._activeBuffer.lines.splice(s,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(t){this._restrictCursor();let e=t.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let s=this._activeBuffer.ybase+this._activeBuffer.y,i;for(i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-i;e--;)this._activeBuffer.lines.splice(s,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.insertCells(this._activeBuffer.x,t.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.deleteCells(this._activeBuffer.x,t.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(t){let e=t.params[0]||1;for(;e--;)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(t){let e=t.params[0]||1;for(;e--;)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(Ge));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);i.deleteCells(0,e,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);i.insertCells(0,e,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);i.insertCells(this._activeBuffer.x,e,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);i.deleteCells(this._activeBuffer.x,e,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(t.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(t){let e=this._parser.precedingJoinState;if(!e)return!0;let s=t.params[0]||1,i=Ns.extractWidth(e),r=this._activeBuffer.x-i,n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),o=new Uint32Array(n.length*s),a=0;for(let l=0;l<n.length;){let u=n.codePointAt(l)||0;o[a++]=u,l+=u>65535?2:1}let c=a;for(let l=1;l<s;++l)o.copyWithin(c,0,a),c+=a;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(t){return t.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(W.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(W.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(t){return t.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(W.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(W.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(t.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(W.ESC+"[>83;40003;0c")),!0}_is(t){return(this._optionsService.rawOptions.termName+"").indexOf(t)===0}setMode(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Ds),this._charsetService.setgCharset(1,Ds),this._charsetService.setgCharset(2,Ds),this._charsetService.setgCharset(3,Ds);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(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(t){for(let e=0;e<t.length;e++)switch(t.params[e]){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:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),t.params[e]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(t,e){let s;(g=>(g[g.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",g[g.SET=1]="SET",g[g.RESET=2]="RESET",g[g.PERMANENTLY_SET=3]="PERMANENTLY_SET",g[g.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(s||={});let i=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:n}=this._coreMouseService,o=this._coreService,{buffers:a,cols:c}=this._bufferService,{active:l,alt:u}=a,d=this._optionsService.rawOptions,f=(g,v)=>(o.triggerDataEvent(`${W.ESC}[${e?"":"?"}${g};${v}$y`),!0),p=g=>g?1:2,_=t.params[0];return e?_===2?f(_,4):_===4?f(_,p(o.modes.insertMode)):_===12?f(_,3):_===20?f(_,p(d.convertEol)):f(_,0):_===1?f(_,p(i.applicationCursorKeys)):_===3?f(_,d.windowOptions.setWinLines?c===80?2:c===132?1:0:0):_===6?f(_,p(i.origin)):_===7?f(_,p(i.wraparound)):_===8?f(_,3):_===9?f(_,p(r==="X10")):_===12?f(_,p(d.cursorBlink)):_===25?f(_,p(!o.isCursorHidden)):_===45?f(_,p(i.reverseWraparound)):_===66?f(_,p(i.applicationKeypad)):_===67?f(_,4):_===1e3?f(_,p(r==="VT200")):_===1002?f(_,p(r==="DRAG")):_===1003?f(_,p(r==="ANY")):_===1004?f(_,p(i.sendFocus)):_===1005?f(_,4):_===1006?f(_,p(n==="SGR")):_===1015?f(_,4):_===1016?f(_,p(n==="SGR_PIXELS")):_===1048?f(_,1):_===47||_===1047||_===1049?f(_,p(l===u)):_===2004?f(_,p(i.bracketedPasteMode)):_===2026?f(_,p(i.synchronizedOutput)):f(_,0)}_updateAttrColor(t,e,s,i,r){return e===2?(t|=50331648,t&=-16777216,t|=Wi.fromColorRGB([s,i,r])):e===5&&(t&=-50331904,t|=33554432|s&255),t}_extractColor(t,e,s){let i=[0,0,-1,0,0,0],r=0,n=0;do{if(i[n+r]=t.params[e+n],t.hasSubParams(e+n)){let o=t.getSubParams(e+n),a=0;do i[1]===5&&(r=1),i[n+a+1+r]=o[a];while(++a<o.length&&a+n+1+r<i.length);break}if(i[1]===5&&n+r>=2||i[1]===2&&n+r>=5)break;i[1]&&(r=1)}while(++n+e<t.length&&n+r<i.length);for(let o=2;o<i.length;++o)i[o]===-1&&(i[o]=0);switch(i[0]){case 38:s.fg=this._updateAttrColor(s.fg,i[1],i[3],i[4],i[5]);break;case 48:s.bg=this._updateAttrColor(s.bg,i[1],i[3],i[4],i[5]);break;case 58:s.extended=s.extended.clone(),s.extended.underlineColor=this._updateAttrColor(s.extended.underlineColor,i[1],i[3],i[4],i[5])}return n}_processUnderline(t,e){e.extended=e.extended.clone(),(!~t||t>5)&&(t=1),e.extended.underlineStyle=t,e.fg|=268435456,t===0&&(e.fg&=-268435457),e.updateExtended()}_processSGR0(t){t.fg=Ge.fg,t.bg=Ge.bg,t.extended=t.extended.clone(),t.extended.underlineStyle=0,t.extended.underlineColor&=-67108864,t.updateExtended()}charAttributes(t){if(t.length===1&&t.params[0]===0)return this._processSGR0(this._curAttrData),!0;let e=t.length,s,i=this._curAttrData;for(let r=0;r<e;r++)s=t.params[r],s>=30&&s<=37?(i.fg&=-50331904,i.fg|=16777216|s-30):s>=40&&s<=47?(i.bg&=-50331904,i.bg|=16777216|s-40):s>=90&&s<=97?(i.fg&=-50331904,i.fg|=16777216|s-90|8):s>=100&&s<=107?(i.bg&=-50331904,i.bg|=16777216|s-100|8):s===0?this._processSGR0(i):s===1?i.fg|=134217728:s===3?i.bg|=67108864:s===4?(i.fg|=268435456,this._processUnderline(t.hasSubParams(r)?t.getSubParams(r)[0]:1,i)):s===5?i.fg|=536870912:s===7?i.fg|=67108864:s===8?i.fg|=1073741824:s===9?i.fg|=2147483648:s===2?i.bg|=134217728:s===21?this._processUnderline(2,i):s===22?(i.fg&=-134217729,i.bg&=-134217729):s===23?i.bg&=-67108865:s===24?(i.fg&=-268435457,this._processUnderline(0,i)):s===25?i.fg&=-536870913:s===27?i.fg&=-67108865:s===28?i.fg&=-1073741825:s===29?i.fg&=2147483647:s===39?(i.fg&=-67108864,i.fg|=Ge.fg&16777215):s===49?(i.bg&=-67108864,i.bg|=Ge.bg&16777215):s===38||s===48||s===58?r+=this._extractColor(t,r,i):s===53?i.bg|=1073741824:s===55?i.bg&=-1073741825:s===59?(i.extended=i.extended.clone(),i.extended.underlineColor=-1,i.updateExtended()):s===100?(i.fg&=-67108864,i.fg|=Ge.fg&16777215,i.bg&=-67108864,i.bg|=Ge.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",s);return!0}deviceStatus(t){switch(t.params[0]){case 5:this._coreService.triggerDataEvent(`${W.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${W.ESC}[${e};${s}R`);break}return!0}deviceStatusPrivate(t){if(t.params[0]===6){let e=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${W.ESC}[?${e};${s}R`)}return!0}softReset(t){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Ge.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(t){let e=t.length===0?1:t.params[0];if(e===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(e){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let s=e%2===1;this._coreService.decPrivateModes.cursorBlink=s}return!0}setScrollRegion(t){let e=t.params[0]||1,s;return(t.length<2||(s=t.params[1])>this._bufferService.rows||s===0)&&(s=this._bufferService.rows),s>e&&(this._activeBuffer.scrollTop=e-1,this._activeBuffer.scrollBottom=s-1,this._setCursor(0,0)),!0}windowOptions(t){if(!Jl(t.params[0],this._optionsService.rawOptions.windowOptions))return!0;let e=t.length>1?t.params[1]:0;switch(t.params[0]){case 14:e!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${W.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(e===0||e===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Xl&&this._windowTitleStack.shift()),(e===0||e===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Xl&&this._iconNameStack.shift());break;case 23:(e===0||e===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(e===0||e===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(t){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(t){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(t){return this._windowTitle=t,this._onTitleChange.fire(t),!0}setIconName(t){return this._iconName=t,!0}setOrReportIndexedColor(t){let e=[],s=t.split(";");for(;s.length>1;){let i=s.shift(),r=s.shift();if(/^\d+$/.exec(i)){let n=parseInt(i);if(ec(n))if(r==="?")e.push({type:0,index:n});else{let o=Yl(r);o&&e.push({type:1,index:n,color:o})}}}return e.length&&this._onColor.fire(e),!0}setHyperlink(t){let e=t.indexOf(";");if(e===-1)return!0;let s=t.slice(0,e).trim(),i=t.slice(e+1);return i?this._createHyperlink(s,i):s.trim()?!1:this._finishHyperlink()}_createHyperlink(t,e){this._getCurrentLinkId()&&this._finishHyperlink();let s=t.split(":"),i,r=s.findIndex(n=>n.startsWith("id="));return r!==-1&&(i=s[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:i,uri:e}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(t,e){let s=t.split(";");for(let i=0;i<s.length&&!(e>=this._specialColors.length);++i,++e)if(s[i]==="?")this._onColor.fire([{type:0,index:this._specialColors[e]}]);else{let r=Yl(s[i]);r&&this._onColor.fire([{type:1,index:this._specialColors[e],color:r}])}return!0}setOrReportFgColor(t){return this._setOrReportSpecialColor(t,0)}setOrReportBgColor(t){return this._setOrReportSpecialColor(t,1)}setOrReportCursorColor(t){return this._setOrReportSpecialColor(t,2)}restoreIndexedColor(t){if(!t)return this._onColor.fire([{type:2}]),!0;let e=[],s=t.split(";");for(let i=0;i<s.length;++i)if(/^\d+$/.exec(s[i])){let r=parseInt(s[i]);ec(r)&&e.push({type:2,index:r})}return e.length&&this._onColor.fire(e),!0}restoreFgColor(t){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(t){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(t){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,Ds),!0}selectCharset(t){return t.length!==2?(this.selectDefaultCharset(),!0):(t[0]==="/"||this._charsetService.setgCharset(W1[t[0]],rt[t[1]]||Ds),!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){let t=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,t,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=Ge.clone(),this._eraseAttrDataInternal=Ge.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(t){return this._charsetService.setgLevel(t),!0}screenAlignmentPattern(){let t=new It;t.content=1<<22|69,t.fg=this._curAttrData.fg,t.bg=this._curAttrData.bg,this._setCursor(0,0);for(let e=0;e<this._bufferService.rows;++e){let s=this._activeBuffer.ybase+this._activeBuffer.y+e,i=this._activeBuffer.lines.get(s);i&&(i.fill(t),i.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(t,e){let s=o=>(this._coreService.triggerDataEvent(`${W.ESC}${o}${W.ESC}\\`),!0),i=this._bufferService.buffer,r=this._optionsService.rawOptions;return s(t==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:t==='"p'?'P1$r61;1"p':t==="r"?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:t==="m"?"P1$r0m":t===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(t,e){this._dirtyRowTracker.markRangeDirty(t,e)}},vo=class{constructor(t){this._bufferService=t,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(t){t<this.start?this.start=t:t>this.end&&(this.end=t)}markRangeDirty(t,e){t>e&&(Ql=t,t=e,e=Ql),t<this.start&&(this.start=t),e>this.end&&(this.end=e)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};vo=He([oe(0,bt)],vo);function ec(t){return 0<=t&&t<256}var K1=5e7,tc=12,q1=50,V1=class extends ye{constructor(t){super(),this._action=t,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new te),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(t,e){if(e!==void 0&&this._syncCalls>e){this._syncCalls=0;return}if(this._pendingData+=t.length,this._writeBuffer.push(t),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let s;for(;s=this._writeBuffer.shift();){this._action(s);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(t,e){if(this._pendingData>K1)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=t.length,this._writeBuffer.push(t),this._callbacks.push(e),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=t.length,this._writeBuffer.push(t),this._callbacks.push(e)}_innerWrite(t=0,e=!0){let s=t||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],r=this._action(i,e);if(r){let o=a=>performance.now()-s>=tc?setTimeout(()=>this._innerWrite(0,a)):this._innerWrite(s,a);r.catch(a=>(queueMicrotask(()=>{throw a}),Promise.resolve(!1))).then(o);return}let n=this._callbacks[this._bufferOffset];if(n&&n(),this._bufferOffset++,this._pendingData-=i.length,performance.now()-s>=tc)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>q1&&(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()}},bo=class{constructor(t){this._bufferService=t,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(t){let e=this._bufferService.buffer;if(t.id===void 0){let a=e.addMarker(e.ybase+e.y),c={data:t,id:this._nextId++,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(c,a)),this._dataByLinkId.set(c.id,c),c.id}let s=t,i=this._getEntryIdKey(s),r=this._entriesWithId.get(i);if(r)return this.addLineToLink(r.id,e.ybase+e.y),r.id;let n=e.addMarker(e.ybase+e.y),o={id:this._nextId++,key:this._getEntryIdKey(s),data:s,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(o,n)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(t,e){let s=this._dataByLinkId.get(t);if(s&&s.lines.every(i=>i.line!==e)){let i=this._bufferService.buffer.addMarker(e);s.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(s,i))}}getLinkData(t){return this._dataByLinkId.get(t)?.data}_getEntryIdKey(t){return`${t.id};;${t.uri}`}_removeMarkerFromLink(t,e){let s=t.lines.indexOf(e);s!==-1&&(t.lines.splice(s,1),t.lines.length===0&&(t.data.id!==void 0&&this._entriesWithId.delete(t.key),this._dataByLinkId.delete(t.id)))}};bo=He([oe(0,bt)],bo);var sc=!1,G1=class extends ye{constructor(t){super(),this._windowsWrappingHeuristics=this._register(new ii),this._onBinary=this._register(new te),this.onBinary=this._onBinary.event,this._onData=this._register(new te),this.onData=this._onData.event,this._onLineFeed=this._register(new te),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new te),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new te),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new te),this._instantiationService=new v1,this.optionsService=this._register(new R1(t)),this._instantiationService.setService(St,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(po)),this._instantiationService.setService(bt,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(fo)),this._instantiationService.setService(fd,this._logService),this.coreService=this._register(this._instantiationService.createInstance(_o)),this._instantiationService.setService(Ws,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(mo)),this._instantiationService.setService(ud,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Ns)),this._instantiationService.setService(pg,this.unicodeService),this._charsetService=this._instantiationService.createInstance(M1),this._instantiationService.setService(fg,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(bo),this._instantiationService.setService(pd,this._oscLinkService),this._inputHandler=this._register(new U1(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(dt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(dt.forward(this._bufferService.onResize,this._onResize)),this._register(dt.forward(this.coreService.onData,this._onData)),this._register(dt.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new V1((e,s)=>this._inputHandler.parse(e,s))),this._register(dt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new te),this._onScroll.event(t=>{this._onScrollApi?.fire(t.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(t){for(let e in t)this.optionsService.options[e]=t[e]}write(t,e){this._writeBuffer.write(t,e)}writeSync(t,e){this._logService.logLevel<=3&&!sc&&(this._logService.warn("writeSync is unreliable and will be removed soon."),sc=!0),this._writeBuffer.writeSync(t,e)}input(t,e=!0){this.coreService.triggerDataEvent(t,e)}resize(t,e){isNaN(t)||isNaN(e)||(t=Math.max(t,qd),e=Math.max(e,Vd),this._bufferService.resize(t,e))}scroll(t,e=!1){this._bufferService.scroll(t,e)}scrollLines(t,e){this._bufferService.scrollLines(t,e)}scrollPages(t){this.scrollLines(t*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(t){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(t){let e=t-this._bufferService.buffer.ydisp;e!==0&&this.scrollLines(e)}registerEscHandler(t,e){return this._inputHandler.registerEscHandler(t,e)}registerDcsHandler(t,e){return this._inputHandler.registerDcsHandler(t,e)}registerCsiHandler(t,e){return this._inputHandler.registerCsiHandler(t,e)}registerOscHandler(t,e){return this._inputHandler.registerOscHandler(t,e)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let t=!1,e=this.optionsService.rawOptions.windowsPty;e&&e.buildNumber!==void 0&&e.buildNumber!==void 0?t=e.backend==="conpty"&&e.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(t=!0),t?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let t=[];t.push(this.onLineFeed(Vl.bind(null,this._bufferService))),t.push(this.registerCsiHandler({final:"H"},()=>(Vl(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Le(()=>{for(let e of t)e.dispose()})}}},Y1={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:["'",'"']};function X1(t,e,s,i){let r={type:0,cancel:!1,key:void 0},n=(t.shiftKey?1:0)|(t.altKey?2:0)|(t.ctrlKey?4:0)|(t.metaKey?8:0);switch(t.keyCode){case 0:t.key==="UIKeyInputUpArrow"?e?r.key=W.ESC+"OA":r.key=W.ESC+"[A":t.key==="UIKeyInputLeftArrow"?e?r.key=W.ESC+"OD":r.key=W.ESC+"[D":t.key==="UIKeyInputRightArrow"?e?r.key=W.ESC+"OC":r.key=W.ESC+"[C":t.key==="UIKeyInputDownArrow"&&(e?r.key=W.ESC+"OB":r.key=W.ESC+"[B");break;case 8:r.key=t.ctrlKey?"\b":W.DEL,t.altKey&&(r.key=W.ESC+r.key);break;case 9:if(t.shiftKey){r.key=W.ESC+"[Z";break}r.key=W.HT,r.cancel=!0;break;case 13:r.key=t.altKey?W.ESC+W.CR:W.CR,r.cancel=!0;break;case 27:r.key=W.ESC,t.altKey&&(r.key=W.ESC+W.ESC),r.cancel=!0;break;case 37:if(t.metaKey)break;n?r.key=W.ESC+"[1;"+(n+1)+"D":e?r.key=W.ESC+"OD":r.key=W.ESC+"[D";break;case 39:if(t.metaKey)break;n?r.key=W.ESC+"[1;"+(n+1)+"C":e?r.key=W.ESC+"OC":r.key=W.ESC+"[C";break;case 38:if(t.metaKey)break;n?r.key=W.ESC+"[1;"+(n+1)+"A":e?r.key=W.ESC+"OA":r.key=W.ESC+"[A";break;case 40:if(t.metaKey)break;n?r.key=W.ESC+"[1;"+(n+1)+"B":e?r.key=W.ESC+"OB":r.key=W.ESC+"[B";break;case 45:!t.shiftKey&&!t.ctrlKey&&(r.key=W.ESC+"[2~");break;case 46:n?r.key=W.ESC+"[3;"+(n+1)+"~":r.key=W.ESC+"[3~";break;case 36:n?r.key=W.ESC+"[1;"+(n+1)+"H":e?r.key=W.ESC+"OH":r.key=W.ESC+"[H";break;case 35:n?r.key=W.ESC+"[1;"+(n+1)+"F":e?r.key=W.ESC+"OF":r.key=W.ESC+"[F";break;case 33:t.shiftKey?r.type=2:t.ctrlKey?r.key=W.ESC+"[5;"+(n+1)+"~":r.key=W.ESC+"[5~";break;case 34:t.shiftKey?r.type=3:t.ctrlKey?r.key=W.ESC+"[6;"+(n+1)+"~":r.key=W.ESC+"[6~";break;case 112:n?r.key=W.ESC+"[1;"+(n+1)+"P":r.key=W.ESC+"OP";break;case 113:n?r.key=W.ESC+"[1;"+(n+1)+"Q":r.key=W.ESC+"OQ";break;case 114:n?r.key=W.ESC+"[1;"+(n+1)+"R":r.key=W.ESC+"OR";break;case 115:n?r.key=W.ESC+"[1;"+(n+1)+"S":r.key=W.ESC+"OS";break;case 116:n?r.key=W.ESC+"[15;"+(n+1)+"~":r.key=W.ESC+"[15~";break;case 117:n?r.key=W.ESC+"[17;"+(n+1)+"~":r.key=W.ESC+"[17~";break;case 118:n?r.key=W.ESC+"[18;"+(n+1)+"~":r.key=W.ESC+"[18~";break;case 119:n?r.key=W.ESC+"[19;"+(n+1)+"~":r.key=W.ESC+"[19~";break;case 120:n?r.key=W.ESC+"[20;"+(n+1)+"~":r.key=W.ESC+"[20~";break;case 121:n?r.key=W.ESC+"[21;"+(n+1)+"~":r.key=W.ESC+"[21~";break;case 122:n?r.key=W.ESC+"[23;"+(n+1)+"~":r.key=W.ESC+"[23~";break;case 123:n?r.key=W.ESC+"[24;"+(n+1)+"~":r.key=W.ESC+"[24~";break;default:if(t.ctrlKey&&!t.shiftKey&&!t.altKey&&!t.metaKey)t.keyCode>=65&&t.keyCode<=90?r.key=String.fromCharCode(t.keyCode-64):t.keyCode===32?r.key=W.NUL:t.keyCode>=51&&t.keyCode<=55?r.key=String.fromCharCode(t.keyCode-51+27):t.keyCode===56?r.key=W.DEL:t.keyCode===219?r.key=W.ESC:t.keyCode===220?r.key=W.FS:t.keyCode===221&&(r.key=W.GS);else if((!s||i)&&t.altKey&&!t.metaKey){let o=Y1[t.keyCode]?.[t.shiftKey?1:0];if(o)r.key=W.ESC+o;else if(t.keyCode>=65&&t.keyCode<=90){let a=t.ctrlKey?t.keyCode-64:t.keyCode+32,c=String.fromCharCode(a);t.shiftKey&&(c=c.toUpperCase()),r.key=W.ESC+c}else if(t.keyCode===32)r.key=W.ESC+(t.ctrlKey?W.NUL:" ");else if(t.key==="Dead"&&t.code.startsWith("Key")){let a=t.code.slice(3,4);t.shiftKey||(a=a.toLowerCase()),r.key=W.ESC+a,r.cancel=!0}}else s&&!t.altKey&&!t.ctrlKey&&!t.shiftKey&&t.metaKey?t.keyCode===65&&(r.type=1):t.key&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&t.keyCode>=48&&t.key.length===1?r.key=t.key:t.key&&t.ctrlKey&&(t.key==="_"&&(r.key=W.US),t.key==="@"&&(r.key=W.NUL));break}return r}var We=0,J1=class{constructor(t){this._getKey=t,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Rr,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Rr,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(t){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(t)}_flushInserted(){let t=this._insertedValues.sort((r,n)=>this._getKey(r)-this._getKey(n)),e=0,s=0,i=new Array(this._array.length+this._insertedValues.length);for(let r=0;r<i.length;r++)s>=this._array.length||this._getKey(t[e])<=this._getKey(this._array[s])?(i[r]=t[e],e++):i[r]=this._array[s++];this._array=i,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(t){if(this._flushCleanupInserted(),this._array.length===0)return!1;let e=this._getKey(t);if(e===void 0||(We=this._search(e),We===-1)||this._getKey(this._array[We])!==e)return!1;do if(this._array[We]===t)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(We),!0;while(++We<this._array.length&&this._getKey(this._array[We])===e);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let t=this._deletedIndices.sort((r,n)=>r-n),e=0,s=new Array(this._array.length-t.length),i=0;for(let r=0;r<this._array.length;r++)t[e]===r?e++:s[i++]=this._array[r];this._array=s,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(We=this._search(t),!(We<0||We>=this._array.length)&&this._getKey(this._array[We])===t))do yield this._array[We];while(++We<this._array.length&&this._getKey(this._array[We])===t)}forEachByKey(t,e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(We=this._search(t),!(We<0||We>=this._array.length)&&this._getKey(this._array[We])===t))do e(this._array[We]);while(++We<this._array.length&&this._getKey(this._array[We])===t)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(t){let e=0,s=this._array.length-1;for(;s>=e;){let i=e+s>>1,r=this._getKey(this._array[i]);if(r>t)s=i-1;else if(r<t)e=i+1;else{for(;i>0&&this._getKey(this._array[i-1])===t;)i--;return i}}return e}},_n=0,ic=0,Z1=class extends ye{constructor(){super(),this._decorations=new J1(t=>t?.marker.line),this._onDecorationRegistered=this._register(new te),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new te),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Le(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(t){if(t.marker.isDisposed)return;let e=new Q1(t);if(e){let s=e.marker.onDispose(()=>e.dispose()),i=e.onDispose(()=>{i.dispose(),e&&(this._decorations.delete(e)&&this._onDecorationRemoved.fire(e),s.dispose())});this._decorations.insert(e),this._onDecorationRegistered.fire(e)}return e}reset(){for(let t of this._decorations.values())t.dispose();this._decorations.clear()}*getDecorationsAtCell(t,e,s){let i=0,r=0;for(let n of this._decorations.getKeyIterator(e))i=n.options.x??0,r=i+(n.options.width??1),t>=i&&t<r&&(!s||(n.options.layer??"bottom")===s)&&(yield n)}forEachDecorationAtCell(t,e,s,i){this._decorations.forEachByKey(e,r=>{_n=r.options.x??0,ic=_n+(r.options.width??1),t>=_n&&t<ic&&(!s||(r.options.layer??"bottom")===s)&&i(r)})}},Q1=class extends ws{constructor(t){super(),this.options=t,this.onRenderEmitter=this.add(new te),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new te),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=t.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Ie.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Ie.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},eb=1e3,tb=class{constructor(t,e=eb){this._renderCallback=t,this._debounceThresholdMS=e,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(t,e,s){this._rowCount=s,t=t!==void 0?t:0,e=e!==void 0?e:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,t):t,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,e):e;let i=performance.now();if(i-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=i,this._innerRefresh();else if(!this._additionalRefreshRequested){let r=i-this._lastRefreshMs,n=this._debounceThresholdMS-r;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},n)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let t=Math.max(this._rowStart,0),e=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(t,e)}},rc=20,Tr=class extends ye{constructor(t,e,s,i){super(),this._terminal=t,this._coreBrowserService=s,this._renderService=i,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let n=0;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);if(this._topBoundaryFocusListener=n=>this._handleBoundaryFocus(n,0),this._bottomBoundaryFocusListener=n=>this._handleBoundaryFocus(n,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new tb(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(n=>this._handleResize(n.rows))),this._register(this._terminal.onRender(n=>this._refreshRows(n.start,n.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(n=>this._handleChar(n))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
18
- `))),this._register(this._terminal.onA11yTab(n=>this._handleTab(n))),this._register(this._terminal.onKey(n=>this._handleKey(n.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(me(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Le(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(t){for(let e=0;e<t;e++)this._handleChar(" ")}_handleChar(t){this._liveRegionLineCount<rc+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==t&&(this._charsToAnnounce+=t):this._charsToAnnounce+=t,t===`
19
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===rc+1&&(this._liveRegion.textContent+=On.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(t){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(t)||this._charsToConsume.push(t)}_refreshRows(t,e){this._liveRegionDebouncer.refresh(t,e,this._terminal.rows)}_renderRows(t,e){let s=this._terminal.buffer,i=s.lines.length.toString();for(let r=t;r<=e;r++){let n=s.lines.get(s.ydisp+r),o=[],a=n?.translateToString(!0,void 0,void 0,o)||"",c=(s.ydisp+r+1).toString(),l=this._rowElements[r];l&&(a.length===0?(l.textContent=" ",this._rowColumns.set(l,[0,1])):(l.textContent=a,this._rowColumns.set(l,o)),l.setAttribute("aria-posinset",c),l.setAttribute("aria-setsize",i),this._alignRowWidth(l))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(t,e){let s=t.target,i=this._rowElements[e===0?1:this._rowElements.length-2],r=s.getAttribute("aria-posinset"),n=e===0?"1":`${this._terminal.buffer.lines.length}`;if(r===n||t.relatedTarget!==i)return;let o,a;if(e===0?(o=s,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(o=this._rowElements.shift(),a=s,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),a.removeEventListener("focus",this._bottomBoundaryFocusListener),e===0){let c=this._createAccessibilityTreeNode();this._rowElements.unshift(c),this._rowContainer.insertAdjacentElement("afterbegin",c)}else{let c=this._createAccessibilityTreeNode();this._rowElements.push(c),this._rowContainer.appendChild(c)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(e===0?-1:1),this._rowElements[e===0?1:this._rowElements.length-2].focus(),t.preventDefault(),t.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let t=this._coreBrowserService.mainDocument.getSelection();if(!t)return;if(t.isCollapsed){this._rowContainer.contains(t.anchorNode)&&this._terminal.clearSelection();return}if(!t.anchorNode||!t.focusNode){console.error("anchorNode and/or focusNode are null");return}let e={node:t.anchorNode,offset:t.anchorOffset},s={node:t.focusNode,offset:t.focusOffset};if((e.node.compareDocumentPosition(s.node)&Node.DOCUMENT_POSITION_PRECEDING||e.node===s.node&&e.offset>s.offset)&&([e,s]=[s,e]),e.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(e={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(e.node))return;let i=this._rowElements.slice(-1)[0];if(s.node.compareDocumentPosition(i)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(s={node:i,offset:i.textContent?.length??0}),!this._rowContainer.contains(s.node))return;let r=({node:a,offset:c})=>{let l=a instanceof Text?a.parentNode:a,u=parseInt(l?.getAttribute("aria-posinset"),10)-1;if(isNaN(u))return console.warn("row is invalid. Race condition?"),null;let d=this._rowColumns.get(l);if(!d)return console.warn("columns is null. Race condition?"),null;let f=c<d.length?d[c]:d.slice(-1)[0]+1;return f>=this._terminal.cols&&(++u,f=0),{row:u,column:f}},n=r(e),o=r(s);if(!(!n||!o)){if(n.row>o.row||n.row===o.row&&n.column>=o.column)throw new Error("invalid range");this._terminal.select(n.column,n.row,(o.row-n.row)*this._terminal.cols-n.column+o.column)}}_handleResize(t){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let t=this._coreBrowserService.mainDocument.createElement("div");return t.setAttribute("role","listitem"),t.tabIndex=-1,this._refreshRowDimensions(t),t}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let t=0;t<this._terminal.rows;t++)this._refreshRowDimensions(this._rowElements[t]),this._alignRowWidth(this._rowElements[t])}}_refreshRowDimensions(t){t.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(t){t.style.transform="";let e=t.getBoundingClientRect().width,s=this._rowColumns.get(t)?.slice(-1)?.[0];if(!s)return;let i=s*this._renderService.dimensions.css.cell.width;t.style.transform=`scaleX(${i/e})`}};Tr=He([oe(1,ha),oe(2,fs),oe(3,ps)],Tr);var So=class extends ye{constructor(t,e,s,i,r){super(),this._element=t,this._mouseService=e,this._renderService=s,this._bufferService=i,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new te),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new te),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Le(()=>{Os(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(me(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(me(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(me(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(me(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(t){this._lastMouseEvent=t;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;let s=t.composedPath();for(let i=0;i<s.length;i++){let r=s[i];if(r.classList.contains("xterm"))break;if(r.classList.contains("xterm-hover"))return}(!this._lastBufferCell||e.x!==this._lastBufferCell.x||e.y!==this._lastBufferCell.y)&&(this._handleHover(e),this._lastBufferCell=e)}_handleHover(t){if(this._activeLine!==t.y||this._wasResized){this._clearCurrentLink(),this._askForLink(t,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,t)||(this._clearCurrentLink(),this._askForLink(t,!0))}_askForLink(t,e){(!this._activeProviderReplies||!e)&&(this._activeProviderReplies?.forEach(i=>{i?.forEach(r=>{r.link.dispose&&r.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=t.y);let s=!1;for(let[i,r]of this._linkProviderService.linkProviders.entries())e?this._activeProviderReplies?.get(i)&&(s=this._checkLinkProviderResult(i,t,s)):r.provideLinks(t.y,n=>{if(this._isMouseOut)return;let o=n?.map(a=>({link:a}));this._activeProviderReplies?.set(i,o),s=this._checkLinkProviderResult(i,t,s),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(t.y,this._activeProviderReplies)})}_removeIntersectingLinks(t,e){let s=new Set;for(let i=0;i<e.size;i++){let r=e.get(i);if(r)for(let n=0;n<r.length;n++){let o=r[n],a=o.link.range.start.y<t?0:o.link.range.start.x,c=o.link.range.end.y>t?this._bufferService.cols:o.link.range.end.x;for(let l=a;l<=c;l++){if(s.has(l)){r.splice(n--,1);break}s.add(l)}}}}_checkLinkProviderResult(t,e,s){if(!this._activeProviderReplies)return s;let i=this._activeProviderReplies.get(t),r=!1;for(let n=0;n<t;n++)(!this._activeProviderReplies.has(n)||this._activeProviderReplies.get(n))&&(r=!0);if(!r&&i){let n=i.find(o=>this._linkAtPosition(o.link,e));n&&(s=!0,this._handleNewLink(n))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let n=0;n<this._activeProviderReplies.size;n++){let o=this._activeProviderReplies.get(n)?.find(a=>this._linkAtPosition(a.link,e));if(o){s=!0,this._handleNewLink(o);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(t){if(!this._currentLink)return;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);e&&this._mouseDownLink&&sb(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(t,this._currentLink.link.text)}_clearCurrentLink(t,e){!this._currentLink||!this._lastMouseEvent||(!t||!e||this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Os(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(t){if(!this._lastMouseEvent)return;let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(t.link,e)&&(this._currentLink=t,this._currentLink.state={decorations:{underline:t.link.decorations===void 0?!0:t.link.decorations.underline,pointerCursor:t.link.decorations===void 0?!0:t.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,t.link,this._lastMouseEvent),t.link.decorations={},Object.defineProperties(t.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:s=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==s&&(this._currentLink.state.decorations.pointerCursor=s,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",s))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:s=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==s&&(this._currentLink.state.decorations.underline=s,this._currentLink.state.isHovered&&this._fireUnderlineEvent(t.link,s))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(s=>{if(!this._currentLink)return;let i=s.start===0?0:s.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+s.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(i,r),this._lastMouseEvent)){let n=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);n&&this._askForLink(n,!1)}})))}_linkHover(t,e,s){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&t.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(s,e.text)}_fireUnderlineEvent(t,e){let s=t.range,i=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-i-1,s.end.x,s.end.y-i-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(t,e,s){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&t.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(s,e.text)}_linkAtPosition(t,e){let s=t.range.start.y*this._bufferService.cols+t.range.start.x,i=t.range.end.y*this._bufferService.cols+t.range.end.x,r=e.y*this._bufferService.cols+e.x;return s<=r&&r<=i}_positionFromMouseEvent(t,e,s){let i=s.getCoords(t,e,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(t,e,s,i,r){return{x1:t,y1:e,x2:s,y2:i,cols:this._bufferService.cols,fg:r}}};So=He([oe(1,da),oe(2,ps),oe(3,bt),oe(4,md)],So);function sb(t,e){return t.text===e.text&&t.range.start.x===e.range.start.x&&t.range.start.y===e.range.start.y&&t.range.end.x===e.range.end.x&&t.range.end.y===e.range.end.y}var ib=class extends G1{constructor(t={}){super(t),this._linkifier=this._register(new ii),this.browser=Ld,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new ii),this._onCursorMove=this._register(new te),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new te),this.onKey=this._onKey.event,this._onRender=this._register(new te),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new te),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new te),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new te),this.onBell=this._onBell.event,this._onFocus=this._register(new te),this._onBlur=this._register(new te),this._onA11yCharEmitter=this._register(new te),this._onA11yTabEmitter=this._register(new te),this._onWillOpen=this._register(new te),this._setup(),this._decorationService=this._instantiationService.createInstance(Z1),this._instantiationService.setService(Ui,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(qv),this._instantiationService.setService(md,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance($n)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(dt.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(dt.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(dt.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(dt.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(Le(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}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}_handleColorEvent(t){if(this._themeService)for(let e of t){let s,i="";switch(e.index){case 256:s="foreground",i="10";break;case 257:s="background",i="11";break;case 258:s="cursor",i="12";break;default:s="ansi",i="4;"+e.index}switch(e.type){case 0:let r=Be.toColorRGB(s==="ansi"?this._themeService.colors.ansi[e.index]:this._themeService.colors[s]);this.coreService.triggerDataEvent(`${W.ESC}]${i};${H1(r)}${Md.ST}`);break;case 1:if(s==="ansi")this._themeService.modifyColors(n=>n.ansi[e.index]=Ye.toColor(...e.color));else{let n=s;this._themeService.modifyColors(o=>o[n]=Ye.toColor(...e.color))}break;case 2:this._themeService.restoreColor(e.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(t){t?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Tr,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(t){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(W.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(W.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let t=this.buffer.ybase+this.buffer.y,e=this.buffer.lines.get(t);if(!e)return;let s=Math.min(this.buffer.x,this.cols-1),i=this._renderService.dimensions.css.cell.height,r=e.getWidth(s),n=this._renderService.dimensions.css.cell.width*r,o=this.buffer.y*this._renderService.dimensions.css.cell.height,a=s*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=o+"px",this.textarea.style.width=n+"px",this.textarea.style.height=i+"px",this.textarea.style.lineHeight=i+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(me(this.element,"copy",e=>{this.hasSelection()&&ag(e,this._selectionService)}));let t=e=>lg(e,this.textarea,this.coreService,this.optionsService);this._register(me(this.textarea,"paste",t)),this._register(me(this.element,"paste",t)),jd?this._register(me(this.element,"mousedown",e=>{e.button===2&&pl(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(me(this.element,"contextmenu",e=>{pl(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),ba&&this._register(me(this.element,"auxclick",e=>{e.button===1&&ad(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(me(this.textarea,"keyup",t=>this._keyUp(t),!0)),this._register(me(this.textarea,"keydown",t=>this._keyDown(t),!0)),this._register(me(this.textarea,"keypress",t=>this._keyPress(t),!0)),this._register(me(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(me(this.textarea,"compositionupdate",t=>this._compositionHelper.compositionupdate(t))),this._register(me(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(me(this.textarea,"input",t=>this._inputEvent(t),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(t){if(!t)throw new Error("Terminal requires a parent element.");if(t.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=t.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),t.appendChild(this.element);let e=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),e.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(me(this.screenElement,"mousemove",r=>this.updateCursorStyle(r))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),e.appendChild(this.screenElement);let s=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",In.get()),zd||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._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>s.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Uv,this.textarea,t.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(fs,this._coreBrowserService),this._register(me(this.textarea,"focus",r=>this._handleTextAreaFocus(r))),this._register(me(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(ao,this._document,this._helperContainer),this._instantiationService.setService(Ur,this._charSizeService),this._themeService=this._instantiationService.createInstance(uo),this._instantiationService.setService(oi,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Pr),this._instantiationService.setService(_d,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(co,this.rows,this.screenElement)),this._instantiationService.setService(ps,this._renderService),this._register(this._renderService.onRenderedViewportChange(r=>this._onRender.fire(r))),this.onResize(r=>this._renderService.resize(r.cols,r.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(ro,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(lo),this._instantiationService.setService(da,this._mouseService);let i=this._linkifier.value=this._register(this._instantiationService.createInstance(So,this.screenElement));this.element.appendChild(e);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),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._viewport=this._register(this._instantiationService.createInstance(so,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(r=>{super.scrollLines(r,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(ho,this.element,this.screenElement,i)),this._instantiationService.setService(mg,this._selectionService),this._register(this._selectionService.onRequestScrollLines(r=>this.scrollLines(r.amount,r.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(r=>this._renderService.handleSelectionChanged(r.start,r.end,r.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(r=>{this.textarea.value=r,this.textarea.focus(),this.textarea.select()})),this._register(dt.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(io,this.screenElement)),this._register(me(this.element,"mousedown",r=>this._selectionService.handleMouseDown(r))),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(Tr,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",r=>this._handleScreenReaderModeOptionChange(r))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(kr,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",r=>{!this._overviewRulerRenderer&&r&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(kr,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(oo,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let t=this,e=this.element;function s(n){let o=t._mouseService.getMouseReportCoords(n,t.screenElement);if(!o)return!1;let a,c;switch(n.overrideType||n.type){case"mousemove":c=32,n.buttons===void 0?(a=3,n.button!==void 0&&(a=n.button<3?n.button:3)):a=n.buttons&1?0:n.buttons&4?1:n.buttons&2?2:3;break;case"mouseup":c=0,a=n.button<3?n.button:3;break;case"mousedown":c=1,a=n.button<3?n.button:3;break;case"wheel":if(t._customWheelEventHandler&&t._customWheelEventHandler(n)===!1)return!1;let l=n.deltaY;if(l===0||t.coreMouseService.consumeWheelEvent(n,t._renderService?.dimensions?.device?.cell?.height,t._coreBrowserService?.dpr)===0)return!1;c=l<0?0:1,a=4;break;default:return!1}return c===void 0||a===void 0||a>4?!1:t.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:a,action:c,ctrl:n.ctrlKey,alt:n.altKey,shift:n.shiftKey})}let i={mouseup:null,wheel:null,mousedrag:null,mousemove:null},r={mouseup:n=>(s(n),n.buttons||(this._document.removeEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.removeEventListener("mousemove",i.mousedrag)),this.cancel(n)),wheel:n=>(s(n),this.cancel(n,!0)),mousedrag:n=>{n.buttons&&s(n)},mousemove:n=>{n.buttons||s(n)}};this._register(this.coreMouseService.onProtocolChange(n=>{n?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(n)),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()),n&8?i.mousemove||(e.addEventListener("mousemove",r.mousemove),i.mousemove=r.mousemove):(e.removeEventListener("mousemove",i.mousemove),i.mousemove=null),n&16?i.wheel||(e.addEventListener("wheel",r.wheel,{passive:!1}),i.wheel=r.wheel):(e.removeEventListener("wheel",i.wheel),i.wheel=null),n&2?i.mouseup||(i.mouseup=r.mouseup):(this._document.removeEventListener("mouseup",i.mouseup),i.mouseup=null),n&4?i.mousedrag||(i.mousedrag=r.mousedrag):(this._document.removeEventListener("mousemove",i.mousedrag),i.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(me(e,"mousedown",n=>{if(n.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(n)))return s(n),i.mouseup&&this._document.addEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.addEventListener("mousemove",i.mousedrag),this.cancel(n)})),this._register(me(e,"wheel",n=>{if(!i.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(n)===!1)return!1;if(!this.buffer.hasScrollback){if(n.deltaY===0)return!1;if(t.coreMouseService.consumeWheelEvent(n,t._renderService?.dimensions?.device?.cell?.height,t._coreBrowserService?.dpr)===0)return this.cancel(n,!0);let o=W.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(n.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(o,!0),this.cancel(n,!0)}}},{passive:!1}))}refresh(t,e){this._renderService?.refreshRows(t,e)}updateCursorStyle(t){this._selectionService?.shouldColumnSelect(t)?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(t,e){this._viewport?this._viewport.scrollLines(t):super.scrollLines(t,e),this.refresh(0,this.rows-1)}scrollPages(t){this.scrollLines(t*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(t){t&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(t){let e=t-this._bufferService.buffer.ydisp;e!==0&&this.scrollLines(e)}paste(t){od(t,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(t){this._customKeyEventHandler=t}attachCustomWheelEventHandler(t){this._customWheelEventHandler=t}registerLinkProvider(t){return this._linkProviderService.registerLinkProvider(t)}registerCharacterJoiner(t){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let e=this._characterJoinerService.register(t);return this.refresh(0,this.rows-1),e}deregisterCharacterJoiner(t){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(t)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(t){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+t)}registerDecoration(t){return this._decorationService.registerDecoration(t)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(t,e,s){this._selectionService.setSelection(t,e,s)}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(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(t,e){this._selectionService?.selectLines(t,e)}_keyDown(t){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(t)===!1)return!1;let e=this.browser.isMac&&this.options.macOptionIsMeta&&t.altKey;if(!e&&!this._compositionHelper.keydown(t))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!e&&(t.key==="Dead"||t.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let s=X1(t,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(t),s.type===3||s.type===2){let i=this.rows-1;return this.scrollLines(s.type===2?-i:i),this.cancel(t,!0)}if(s.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,t)||(s.cancel&&this.cancel(t,!0),!s.key)||t.key&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&t.key.length===1&&t.key.charCodeAt(0)>=65&&t.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((s.key===W.ETX||s.key===W.CR)&&(this.textarea.value=""),this._onKey.fire({key:s.key,domEvent:t}),this._showCursor(),this.coreService.triggerDataEvent(s.key,!0),!this.optionsService.rawOptions.screenReaderMode||t.altKey||t.ctrlKey)return this.cancel(t,!0);this._keyDownHandled=!0}_isThirdLevelShift(t,e){let s=t.isMac&&!this.options.macOptionIsMeta&&e.altKey&&!e.ctrlKey&&!e.metaKey||t.isWindows&&e.altKey&&e.ctrlKey&&!e.metaKey||t.isWindows&&e.getModifierState("AltGraph");return e.type==="keypress"?s:s&&(!e.keyCode||e.keyCode>47)}_keyUp(t){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(t)===!1)&&(rb(t)||this.focus(),this.updateCursorStyle(t),this._keyPressHandled=!1)}_keyPress(t){let e;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(t)===!1)return!1;if(this.cancel(t),t.charCode)e=t.charCode;else if(t.which===null||t.which===void 0)e=t.keyCode;else if(t.which!==0&&t.charCode!==0)e=t.which;else return!1;return!e||(t.altKey||t.ctrlKey||t.metaKey)&&!this._isThirdLevelShift(this.browser,t)?!1:(e=String.fromCharCode(e),this._onKey.fire({key:e,domEvent:t}),this._showCursor(),this.coreService.triggerDataEvent(e,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(t){if(t.data&&t.inputType==="insertText"&&(!t.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let e=t.data;return this.coreService.triggerDataEvent(e,!0),this.cancel(t),!0}return!1}resize(t,e){if(t===this.cols&&e===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(t,e)}_afterResize(t,e){this._charSizeService?.measure()}clear(){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 t=1;t<this.rows;t++)this.buffer.lines.push(this.buffer.getBlankLine(Ge));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let t=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=t,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(W.ESC+"[I"):this.coreService.triggerDataEvent(W.ESC+"[O")}_reportWindowsOptions(t){if(this._renderService)switch(t){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),s=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${W.ESC}[4;${s};${e}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${W.ESC}[6;${r};${i}t`);break}}cancel(t,e){if(!(!this.options.cancelEvents&&!e))return t.preventDefault(),t.stopPropagation(),!1}};function rb(t){return t.keyCode===16||t.keyCode===17||t.keyCode===18}var nb=class{constructor(){this._addons=[]}dispose(){for(let t=this._addons.length-1;t>=0;t--)this._addons[t].instance.dispose()}loadAddon(t,e){let s={instance:e,dispose:e.dispose,isDisposed:!1};this._addons.push(s),e.dispose=()=>this._wrappedAddonDispose(s),e.activate(t)}_wrappedAddonDispose(t){if(t.isDisposed)return;let e=-1;for(let s=0;s<this._addons.length;s++)if(this._addons[s]===t){e=s;break}if(e===-1)throw new Error("Could not dispose an addon that has not been loaded");t.isDisposed=!0,t.dispose.apply(t.instance),this._addons.splice(e,1)}},ob=class{constructor(t){this._line=t}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(t,e){if(!(t<0||t>=this._line.length))return e?(this._line.loadCell(t,e),e):this._line.loadCell(t,new It)}translateToString(t,e,s){return this._line.translateToString(t,e,s)}},nc=class{constructor(t,e){this._buffer=t,this.type=e}init(t){return this._buffer=t,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(t){let e=this._buffer.lines.get(t);if(e)return new ob(e)}getNullCell(){return new It}},ab=class extends ye{constructor(t){super(),this._core=t,this._onBufferChange=this._register(new te),this.onBufferChange=this._onBufferChange.event,this._normal=new nc(this._core.buffers.normal,"normal"),this._alternate=new nc(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)}},lb=class{constructor(t){this._core=t}registerCsiHandler(t,e){return this._core.registerCsiHandler(t,s=>e(s.toArray()))}addCsiHandler(t,e){return this.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._core.registerDcsHandler(t,(s,i)=>e(s,i.toArray()))}addDcsHandler(t,e){return this.registerDcsHandler(t,e)}registerEscHandler(t,e){return this._core.registerEscHandler(t,e)}addEscHandler(t,e){return this.registerEscHandler(t,e)}registerOscHandler(t,e){return this._core.registerOscHandler(t,e)}addOscHandler(t,e){return this.registerOscHandler(t,e)}},cb=class{constructor(t){this._core=t}register(t){this._core.unicodeService.register(t)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(t){this._core.unicodeService.activeVersion=t}},hb=["cols","rows"],Vt=0,db=class extends ye{constructor(t){super(),this._core=this._register(new ib(t)),this._addonManager=this._register(new nb),this._publicOptions={...this._core.options};let e=i=>this._core.options[i],s=(i,r)=>{this._checkReadonlyOptions(i),this._core.options[i]=r};for(let i in this._core.options){let r={get:e.bind(this,i),set:s.bind(this,i)};Object.defineProperty(this._publicOptions,i,r)}}_checkReadonlyOptions(t){if(hb.includes(t))throw new Error(`Option "${t}" 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 lb(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new cb(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 ab(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let t=this._core.coreService.decPrivateModes,e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any";break}return{applicationCursorKeysMode:t.applicationCursorKeys,applicationKeypadMode:t.applicationKeypad,bracketedPasteMode:t.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:t.origin,reverseWraparoundMode:t.reverseWraparound,sendFocusMode:t.sendFocus,synchronizedOutputMode:t.synchronizedOutput,wraparoundMode:t.wraparound}}get options(){return this._publicOptions}set options(t){for(let e in t)this._publicOptions[e]=t[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(t,e=!0){this._core.input(t,e)}resize(t,e){this._verifyIntegers(t,e),this._core.resize(t,e)}open(t){this._core.open(t)}attachCustomKeyEventHandler(t){this._core.attachCustomKeyEventHandler(t)}attachCustomWheelEventHandler(t){this._core.attachCustomWheelEventHandler(t)}registerLinkProvider(t){return this._core.registerLinkProvider(t)}registerCharacterJoiner(t){return this._checkProposedApi(),this._core.registerCharacterJoiner(t)}deregisterCharacterJoiner(t){this._checkProposedApi(),this._core.deregisterCharacterJoiner(t)}registerMarker(t=0){return this._verifyIntegers(t),this._core.registerMarker(t)}registerDecoration(t){return this._checkProposedApi(),this._verifyPositiveIntegers(t.x??0,t.width??0,t.height??0),this._core.registerDecoration(t)}hasSelection(){return this._core.hasSelection()}select(t,e,s){this._verifyIntegers(t,e,s),this._core.select(t,e,s)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(t,e){this._verifyIntegers(t,e),this._core.selectLines(t,e)}dispose(){super.dispose()}scrollLines(t){this._verifyIntegers(t),this._core.scrollLines(t)}scrollPages(t){this._verifyIntegers(t),this._core.scrollPages(t)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(t){this._verifyIntegers(t),this._core.scrollToLine(t)}clear(){this._core.clear()}write(t,e){this._core.write(t,e)}writeln(t,e){this._core.write(t),this._core.write(`\r
20
- `,e)}paste(t){this._core.paste(t)}refresh(t,e){this._verifyIntegers(t,e),this._core.refresh(t,e)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(t){this._addonManager.loadAddon(this,t)}static get strings(){return{get promptLabel(){return In.get()},set promptLabel(t){In.set(t)},get tooMuchOutput(){return On.get()},set tooMuchOutput(t){On.set(t)}}}_verifyIntegers(...t){for(Vt of t)if(Vt===1/0||isNaN(Vt)||Vt%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...t){for(Vt of t)if(Vt&&(Vt===1/0||isNaN(Vt)||Vt%1!==0||Vt<0))throw new Error("This API only accepts positive integers")}};var ub=2,fb=1,pb=class{activate(t){this._terminal=t}dispose(){}fit(){let t=this.proposeDimensions();if(!t||!this._terminal||isNaN(t.cols)||isNaN(t.rows))return;let e=this._terminal._core;(this._terminal.rows!==t.rows||this._terminal.cols!==t.cols)&&(e._renderService.clear(),this._terminal.resize(t.cols,t.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let t=this._terminal._core._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let e=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,s=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(s.getPropertyValue("height")),r=Math.max(0,parseInt(s.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),o={top:parseInt(n.getPropertyValue("padding-top")),bottom:parseInt(n.getPropertyValue("padding-bottom")),right:parseInt(n.getPropertyValue("padding-right")),left:parseInt(n.getPropertyValue("padding-left"))},a=o.top+o.bottom,c=o.right+o.left,l=i-a,u=r-c-e;return{cols:Math.max(ub,Math.floor(u/t.css.cell.width)),rows:Math.max(fb,Math.floor(l/t.css.cell.height))}}};function _b({source:t,onReady:e,onSelectionChange:s,className:i}){const r=O.useRef(null),n=O.useRef(null),o=O.useRef(s);o.current=s;const a=Or(),c=O.useRef(t);return c.current=t,Gc((l,u)=>{l===c.current&&n.current?.write(u)}),O.useEffect(()=>{const l=r.current;if(!l)return;const u=getComputedStyle(document.documentElement),d=b=>u.getPropertyValue(b).trim()||void 0,f=new db({allowTransparency:!1,fontFamily:d("--font-mono")||"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontSize:12.5,lineHeight:1.5,scrollback:5e3,cursorBlink:!1,disableStdin:!0,theme:{background:d("--sidebar")||d("--card")||d("--background")||"#1e1e1e",cursor:"transparent",foreground:d("--foreground")||"#d4d4d4",selectionBackground:d("--accent"),selectionForeground:d("--accent-foreground"),black:d("--muted"),red:d("--destructive"),green:d("--success"),yellow:d("--warning"),blue:d("--chart-1"),magenta:d("--chart-3"),cyan:d("--chart-5"),white:d("--foreground"),brightBlack:d("--muted-foreground"),brightRed:d("--destructive"),brightGreen:d("--success"),brightYellow:d("--warning"),brightBlue:d("--chart-1"),brightMagenta:d("--chart-3"),brightCyan:d("--chart-5"),brightWhite:d("--foreground")}}),p=new pb;f.loadAddon(p),f.open(l),p.fit();const _=a.getBuffer(t);_&&f.write(_),n.current=f,e?.(f);const g=f.onSelectionChange(()=>{const b=!!f.getSelection();o.current?.(b,()=>f.getSelection())}),v=new ResizeObserver(()=>{p.fit()});return v.observe(l),()=>{g.dispose(),v.disconnect(),n.current=null,f.dispose()}},[]),h.jsx("div",{className:_e("h-full bg-sidebar p-3",i),children:h.jsx("div",{ref:r,className:"h-full"})})}const yo=120,Yd=160;function mb(t,e,s=Yd){const i=Math.max(yo,e-s);return Math.min(Math.max(t,yo),i)}function gb(t){const e=be(),s=Or(),[i,r]=O.useState(Ms),[n,o]=O.useState([]),[a,c]=O.useState(new Set),l=O.useRef(!1);if(!l.current&&s.scripts.length>0){const T=Xm.find(R=>s.scripts.includes(R));T&&(l.current=!0,o(R=>R.includes(T)?R:[...R,T]),r(T))}if(a.size>0){let T=!1;const R=new Set(a);for(const E of a)s.activeProcesses.includes(E)||(R.delete(E),T=!0);T&&c(R)}const u=()=>t.onOpenChange(!t.open),d=T=>{r(T),t.open||t.onOpenChange(!0)},f=ds()?.taskId??null,p={orgSlug:t.orgSlug,virtualMcpId:t.virtualMcpId??"",branch:t.branch??"",threadId:f??null},_=T=>!t.virtualMcpId||!t.branch?Promise.resolve(null):fetch(za(p,`exec/${encodeURIComponent(T)}`),{method:"POST"}),g=T=>!t.virtualMcpId||!t.branch?Promise.resolve(null):fetch(za(p,`exec/${encodeURIComponent(T)}/kill`),{method:"POST"}),v=async(T,R)=>{try{const E=await _(T);if(E===null)return;if(!E.ok)throw new Error(`Exec failed: ${E.statusText}`)}catch{Xe.error(R)}},b=async T=>{o(R=>R.includes(T)?R:[...R,T]),r(T),t.onOpenChange(!0),await v(T,e("sandbox.drawer.failedToRun",{name:T}))},k=async T=>{await g(T),o(R=>R.filter(E=>E!==T)),i===T&&r(Ms)},w=async()=>{const R=s.activeProcesses.includes(i)?e("sandbox.drawer.failedToRestart",{name:i}):e("sandbox.drawer.failedToRun",{name:i});await v(i,R)},S=async()=>{if(!a.has(i)){c(T=>new Set(T).add(i));try{const T=await g(i);if(T===null){c(R=>{const E=new Set(R);return E.delete(i),E});return}if(!T.ok)throw new Error(`Kill failed: ${T.statusText}`)}catch{c(T=>{const R=new Set(T);return R.delete(i),R}),Xe.error(e("sandbox.drawer.failedToStop",{name:i}))}}},m=i!==Ms&&n.includes(i),x=m&&s.activeProcesses.includes(i),y=m&&a.has(i),C=O.useRef(null),N=T=>{if(!t.open)return;const R=C.current,E=R?.parentElement;if(!R||!E)return;T.preventDefault();const P=T.currentTarget,{pointerId:A}=T;P.setPointerCapture(A);const M=T.clientY,L=R.getBoundingClientRect().height,B=E.getBoundingClientRect().height;let D=L;const j=z=>{z.pointerId===A&&(D=mb(L+(M-z.clientY),B),R.style.height=`${D}px`)},K=z=>{z.pointerId===A&&(P.removeEventListener("pointermove",j),P.removeEventListener("pointerup",K),P.removeEventListener("pointercancel",K),document.body.style.userSelect="",document.body.style.cursor="",t.onHeightChange(D))};document.body.style.userSelect="none",document.body.style.cursor="row-resize",P.addEventListener("pointermove",j),P.addEventListener("pointerup",K),P.addEventListener("pointercancel",K)};return h.jsxs("div",{ref:C,className:"flex shrink-0 flex-col",style:{height:t.open?t.height??"50%":"auto",maxHeight:t.open?`max(${yo}px, calc(100% - ${Yd}px))`:void 0},children:[t.open&&h.jsx(bb,{onPointerDown:N,label:e("sandbox.preview.resizeTerminal")}),h.jsx(Jm,{status:t.status,open:t.open,onToggle:u,onStart:t.status==="idle"?t.onStart:void 0,onStop:t.status==="running"||t.status==="starting"?t.onStop:void 0,onRestart:t.status==="running"?t.onRestart:void 0,onResume:t.status==="suspended"?t.onResume:void 0,onRetry:t.status==="errored"?t.onRetry:void 0,scripts:t.scripts,active:i,scriptTabs:n,onSelectTab:d,onAddScript:b,onCloseScript:k,showScriptControls:m,scriptIsRunning:x,scriptIsKilling:y,onRunActiveScript:w,onStopActiveScript:S}),t.open&&h.jsx("div",{className:"flex-1 overflow-hidden",children:h.jsx(vb,{vmId:t.vmId,active:i,hasData:s.hasData(i),onRunActive:w})})]})}function vb(t){const e=H.c(16),{vmId:s,active:i,hasData:r,onRunActive:n}=t,o=be();if(!s)return null;if(i===Ms||r){let p;return e[0]!==i?(p=h.jsx(_b,{source:i,className:"h-full"},i),e[0]=i,e[1]=p):p=e[1],p}let a;e[2]!==i||e[3]!==o?(a=o("sandbox.drawer.scriptNotRunning",{name:i}),e[2]=i,e[3]=o,e[4]=a):a=e[4];let c;e[5]!==a?(c=h.jsx("p",{children:a}),e[5]=a,e[6]=c):c=e[6];let l;e[7]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx(Sr,{className:"size-3.5"}),e[7]=l):l=e[7];let u;e[8]!==o?(u=o("sandbox.drawer.run"),e[8]=o,e[9]=u):u=e[9];let d;e[10]!==n||e[11]!==u?(d=h.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-xs text-foreground hover:bg-accent",children:[l," ",u]}),e[10]=n,e[11]=u,e[12]=d):d=e[12];let f;return e[13]!==c||e[14]!==d?(f=h.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 text-sm text-muted-foreground",children:[c,d]}),e[13]=c,e[14]=d,e[15]=f):f=e[15],f}function bb(t){const e=H.c(4),{onPointerDown:s,label:i}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx("div",{className:"absolute inset-x-0 bottom-0 h-px bg-transparent transition-colors group-hover:bg-primary"}),e[0]=r):r=e[0];let n;return e[1]!==i||e[2]!==s?(n=h.jsx("div",{role:"separator","aria-orientation":"horizontal","aria-label":i,onPointerDown:s,className:"group relative -mb-px h-1.5 shrink-0 cursor-row-resize",children:r}),e[1]=i,e[2]=s,e[3]=n):n=e[3],n}function Sb(t){if(!t)return{open:!1,height:null};try{const e=JSON.parse(t);return{open:!!e.open,height:typeof e.height=="number"?e.height:null}}catch{return{open:!1,height:null}}}const Xd=t=>`preview-drawer:${t}`,yb=/Authentication failed for|Invalid username or token|Password authentication is not supported/i;function xb(t){try{return Sb(localStorage.getItem(Xd(t)))}catch{return{open:!1,height:null}}}function oc(t,e){try{localStorage.setItem(Xd(t),JSON.stringify(e))}catch{}}function wb(){const t=H.c(27),e=ja(),{org:s}=ut(),i=e?.virtualMcpId??null,r=Yc(),n=Or(),o=O.useRef(null);let a;t[0]!==n||t[1]!==r||t[2]!==i?(a=x=>{x!=="setup"||!i||o.current!==i&&yb.test(n.getBuffer("setup"))&&(o.current=i,r.restart())},t[0]=n,t[1]=r,t[2]=i,t[3]=a):a=t[3],Gc(a);const c=i??"__no-vmcp__",[l,u]=O.useState(null),[d,f]=O.useState(null),p=O.useRef(null);if(p.current!==c){p.current=c;const x=xb(c);u(x.open),f(x.height)}const _=l??!1;let g;t[4]!==d||t[5]!==c?(g=x=>{u(x),oc(c,{open:x,height:d})},t[4]=d,t[5]=c,t[6]=g):g=t[6];const v=g;let b;t[7]!==_||t[8]!==c?(b=x=>{f(x),oc(c,{open:_,height:x})},t[7]=_,t[8]=c,t[9]=b):b=t[9];const k=b,w=r.vmEntry?.sandboxHandle??"no-vm",S=r.vmEntry?.sandboxHandle??null;let m;return t[10]!==d||t[11]!==n.scripts||t[12]!==k||t[13]!==v||t[14]!==r.branch||t[15]!==r.restart||t[16]!==r.resume||t[17]!==r.retry||t[18]!==r.start||t[19]!==r.status||t[20]!==r.stop||t[21]!==_||t[22]!==s.slug||t[23]!==w||t[24]!==S||t[25]!==i?(m=h.jsx(gb,{vmId:S,orgSlug:s.slug,virtualMcpId:i,branch:r.branch,status:r.status,scripts:n.scripts,open:_,onOpenChange:v,height:d,onHeightChange:k,onStart:r.start,onStop:r.stop,onRestart:r.restart,onResume:r.resume,onRetry:r.retry},w),t[10]=d,t[11]=n.scripts,t[12]=k,t[13]=v,t[14]=r.branch,t[15]=r.restart,t[16]=r.resume,t[17]=r.retry,t[18]=r.start,t[19]=r.status,t[20]=r.stop,t[21]=_,t[22]=s.slug,t[23]=w,t[24]=S,t[25]=i,t[26]=m):m=t[26],m}function Jd(t){const e=H.c(5),{virtualMcpId:s}=t,i=ja(),{activeTask:r}=zi(),n=Ho(),o=Rn(i?.entity?.metadata)||Rn(r?.metadata),a=ni(i?.entity?.id).runtime,c=i?.entity?.id===s&&a==="cms",l=Km({hasClonableSource:o,fastPreviewActive:c,mainTab:n??null});let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=h.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:h.jsx(Wm,{})}),e[0]=u):u=e[0];let d;e[1]!==l?(d=l&&h.jsx(wb,{}),e[1]=l,e[2]=d):d=e[2];let f;return e[3]!==d?(f=h.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[u,d]}),e[3]=d,e[4]=f):f=e[4],f}function Ar(t){const e=H.c(10),{icon:s,className:i}=t,r=i===void 0?"size-4":i;if(s.kind==="component"){const{Component:o}=s;let a;return e[0]!==o||e[1]!==r?(a=h.jsx(o,{className:r}),e[0]=o,e[1]=r,e[2]=a):a=e[2],a}if(s.kind==="url"){const o=s.src;let a;e[3]!==r?(a=_e(r,"rounded-sm object-cover"),e[3]=r,e[4]=a):a=e[4];let c;return e[5]!==s.src||e[6]!==a?(c=h.jsx("img",{src:o,alt:"",className:a}),e[5]=s.src,e[6]=a,e[7]=c):c=e[7],c}let n;return e[8]!==r?(n=h.jsx(mp,{className:r}),e[8]=r,e[9]=n):n=e[9],n}const Cb={sooner:"@max-3xl/panel-header:hidden",later:"@max-xl/panel-header:hidden"};function kb(t){const e=H.c(28),{title:s,icon:i,active:r,onClick:n,disabled:o,locked:a,className:c,testId:l,tooltip:u,labelCollapse:d}=t,f=o===void 0?!1:o,p=a===void 0?!1:a,_=d===void 0?"later":d,g=p||void 0;let v;e[0]!==r||e[1]!==c||e[2]!==p?(v=_e("shrink-0 flex items-center gap-1.5 h-7 rounded-md px-2",lh(r),"disabled:opacity-40 disabled:pointer-events-none",p&&"pointer-events-none",c),e[0]=r,e[1]=c,e[2]=p,e[3]=v):v=e[3];let b;e[4]!==i?(b=h.jsx("span",{className:"flex size-5 items-center justify-center shrink-0",children:h.jsx(Ar,{icon:i})}),e[4]=i,e[5]=b):b=e[5];const k=Cb[_];let w;e[6]!==k?(w=_e(k,"whitespace-nowrap text-sm font-medium leading-none"),e[6]=k,e[7]=w):w=e[7];let S;e[8]!==w||e[9]!==s?(S=h.jsx("span",{className:w,children:s}),e[8]=w,e[9]=s,e[10]=S):S=e[10];let m;e[11]!==r||e[12]!==f||e[13]!==n||e[14]!==g||e[15]!==v||e[16]!==b||e[17]!==S||e[18]!==l||e[19]!==s?(m=h.jsxs("button",{type:"button",onClick:n,disabled:f,"data-testid":l,"aria-pressed":r,"aria-disabled":g,"aria-label":s,className:v,children:[b,S]}),e[11]=r,e[12]=f,e[13]=n,e[14]=g,e[15]=v,e[16]=b,e[17]=S,e[18]=l,e[19]=s,e[20]=m):m=e[20];const x=m;let y;e[21]!==x?(y=h.jsx(Je,{asChild:!0,children:x}),e[21]=x,e[22]=y):y=e[22];const C=u??s;let N;e[23]!==C?(N=h.jsx(Ze,{side:"bottom",children:C}),e[23]=C,e[24]=N):N=e[24];let T;return e[25]!==y||e[26]!==N?(T=h.jsxs(Qe,{children:[y,N]}),e[25]=y,e[26]=N,e[27]=T):T=e[27],T}function Pb(t){const e=H.c(18),{virtualMcpId:s,taskId:i,disableActiveMainToggle:r}=t,n=r===void 0?!1:r,{openPanel:o,closePanel:a}=Qc();let c;e[0]!==i||e[1]!==s?(c={virtualMcpId:s,taskId:i},e[0]=i,e[1]=s,e[2]=c):c=e[2];const{tabs:l,activeTab:u,mainOpen:d,setActiveTab:f}=zc(c);let p,_,g;if(e[3]!==u||e[4]!==a||e[5]!==n||e[6]!==d||e[7]!==o||e[8]!==f||e[9]!==l||e[10]!==s){const b=Qu({activeTab:u,mainOpen:d}),k=m=>m.id==="automations"?b:d&&m.id===u,w=m=>{const x=l.find(C=>C.id===m);if(n&&x&&k(x))return;const y=d&&u===m;if(Cs("main_panel_tab_clicked",{virtual_mcp_id:s,tab_id:m,tab_kind:x?.kind??null,was_active:y}),m==="automations"){const C=ef({activeTab:u,mainOpen:d});"close"in C?a():o(C.tabId);return}f(m)},S=l.map(m=>({id:m.id,title:m.title,icon:m.icon,active:k(m),locked:n&&k(m),onSelect:()=>w(m.id),labelCollapse:m.kind==="system"?"sooner":"later"}));p="flex items-center min-w-0 gap-0.5 overflow-x-auto no-scrollbar",_=hh.surfaceTabs,g=S.map(Eb),e[3]=u,e[4]=a,e[5]=n,e[6]=d,e[7]=o,e[8]=f,e[9]=l,e[10]=s,e[11]=p,e[12]=_,e[13]=g}else p=e[11],_=e[12],g=e[13];let v;return e[14]!==p||e[15]!==_||e[16]!==g?(v=h.jsx("div",{className:p,"data-tour":_,children:g}),e[14]=p,e[15]=_,e[16]=g,e[17]=v):v=e[17],v}function Eb(t){return h.jsx(kb,{title:t.title,icon:t.icon,active:t.active,locked:t.locked,onClick:t.onSelect,labelCollapse:t.labelCollapse},t.id)}const Rb=tf("flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2",{variants:{orientation:{horizontal:"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",vertical:"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"}},defaultVariants:{orientation:"horizontal"}});function Tb(t){const e=H.c(11);let s,i,r;e[0]!==t?({className:s,orientation:i,...r}=t,e[0]=t,e[1]=s,e[2]=i,e[3]=r):(s=e[1],i=e[2],r=e[3]);let n;e[4]!==s||e[5]!==i?(n=_e(Rb({orientation:i}),s),e[4]=s,e[5]=i,e[6]=n):n=e[6];let o;return e[7]!==i||e[8]!==r||e[9]!==n?(o=h.jsx("div",{role:"group","data-slot":"button-group","data-orientation":i,className:n,...r}),e[7]=i,e[8]=r,e[9]=n,e[10]=o):o=e[10],o}function Ab(t){const e=H.c(14),{item:s}=t;let i;e[0]!==s?(i=()=>{s.onSelect()},e[0]=s,e[1]=i):i=e[1];let r;e[2]!==s.disabled||e[3]!==s.icon||e[4]!==s.label||e[5]!==i?(r=h.jsxs(yr,{disabled:s.disabled,onSelect:i,children:[s.icon,s.label]}),e[2]=s.disabled,e[3]=s.icon,e[4]=s.label,e[5]=i,e[6]=r):r=e[6];const n=r;if(!s.tooltip)return n;let o;e[7]!==n?(o=h.jsx(Je,{asChild:!0,children:n}),e[7]=n,e[8]=o):o=e[8];let a;e[9]!==s.tooltip?(a=h.jsx(Ze,{side:"right",children:s.tooltip}),e[9]=s.tooltip,e[10]=a):a=e[10];let c;return e[11]!==o||e[12]!==a?(c=h.jsxs(Qe,{children:[o,a]}),e[11]=o,e[12]=a,e[13]=c):c=e[13],c}function Zd(t){const e=H.c(20),{label:s,onClick:i,variant:r,size:n,disabled:o,loading:a,pulse:c,tooltip:l,icon:u,items:d,menuAriaLabel:f,className:p}=t,_=r===void 0?"default":r,g=n===void 0?"default":n,v=o===void 0?!1:o,b=a===void 0?!1:a,k=c===void 0?!1:c,w=(d?.length??0)>0;let S;if(e[0]!==p||e[1]!==v||e[2]!==w||e[3]!==u||e[4]!==d||e[5]!==s||e[6]!==b||e[7]!==f||e[8]!==i||e[9]!==k||e[10]!==g||e[11]!==l||e[12]!==_){const m=_e(ch,_==="default"&&"focus-visible:inset-ring-current");let x;e[14]!==u||e[15]!==b?(x=b?h.jsx(gt,{size:"xs"}):u,e[14]=u,e[15]=b,e[16]=x):x=e[16];const y=h.jsxs(Pe,{type:"button",variant:_,size:g,disabled:v,"aria-busy":b||void 0,onClick:b?void 0:i,className:_e(m,w&&"rounded-r-none border-r border-current/20"),children:[x,s]}),C=k&&"animate-pulse-brightness motion-reduce:animate-none motion-reduce:opacity-80";let N;e[17]!==p||e[18]!==C?(N=_e(C,p),e[17]=p,e[18]=C,e[19]=N):N=e[19],S=h.jsxs(Tb,{className:N,children:[l?h.jsxs(Qe,{children:[h.jsx(Je,{asChild:!0,children:h.jsx("span",{className:_e("inline-flex rounded-lg outline-none",m,v&&"cursor-not-allowed"),tabIndex:v?0:void 0,role:v?"button":void 0,"aria-disabled":v||void 0,children:y})}),h.jsx(Ze,{children:l})]}):y,w?h.jsxs(Ko,{children:[h.jsx(qo,{asChild:!0,children:h.jsx(Pe,{type:"button",variant:_,size:g,"aria-label":f,className:_e("has-[>svg]:px-2",m),children:h.jsx($s,{className:"size-3.5"})})}),h.jsx(Vo,{align:"end",children:d?.map(Db)})]}):null]}),e[0]=p,e[1]=v,e[2]=w,e[3]=u,e[4]=d,e[5]=s,e[6]=b,e[7]=f,e[8]=i,e[9]=k,e[10]=g,e[11]=l,e[12]=_,e[13]=S}else S=e[13];return S}function Db(t){return h.jsx(Ab,{item:t},t.key)}function Nb(t,e,s){return t===null?0:Math.max(0,s-Math.max(0,e-t))}function Mb(t,e){const[s,i]=O.useState(t),r=O.useRef(t?Date.now():null);return O.useEffect(()=>{if(t){r.current??=Date.now(),i(!0);return}if(!s)return;const n=()=>{r.current=null,i(!1)},o=Nb(r.current,Date.now(),e);if(o===0){n();return}const a=setTimeout(n,o);return()=>clearTimeout(a)},[t,s,e]),s}const Bb=500;function Qd(t,e,s){const i=H.c(6);let r;i[0]!==s||i[1]!==t||i[2]!==e?(r=h_(t,e,s),i[0]=s,i[1]=t,i[2]=e,i[3]=r):r=i[3];let n;i[4]!==r?(n={mutationKey:r},i[4]=r,i[5]=n):n=i[5];const o=Jf(n)>0;return Mb(o,Bb)}function eu(t){return btoa(encodeURIComponent(t))}function zw(t,e,s){const i=new URL(t).origin,r=new URL(`/live/previews/${encodeURIComponent(e)}`,i);return r.searchParams.set("path","/"),r.searchParams.set("pathTemplate","/"),r.searchParams.set("props",eu(JSON.stringify({path:"/",sections:[{__resolveType:s}]}))),r.searchParams.set("__cb",crypto.randomUUID()),r.toString()}const Lb="__draft";function jb(t){return`${`${t.apiHost}/api/${t.orgSlug}/decofile/${encodeURIComponent(t.virtualMcpId)}/${encodeURIComponent(t.branch)}?token=${t.token}`}@${t.version}`}const $w="off";function Ib(t,e){if(!e)return t;const s=new URL(t);return s.searchParams.set(Lb,e),s.toString()}function Fw(t){const e=t.pageBlock.__resolveType;if(typeof e!="string"||!e)return null;const s=new URL(t.previewBaseUrl).origin,i=new URL(`/live/previews/${encodeURIComponent(e)}`,s);i.searchParams.set("__decoFBT","0"),i.searchParams.set("__d",""),i.searchParams.set("path",t.path),i.searchParams.set("pathTemplate",t.pathTemplate);const{__resolveType:r,...n}=t.pageBlock,o=JSON.stringify({__props:n,__decofile:t.decofile});return{src:i.toString(),body:o}}function Hw(t,e,s,i){const r=new URL(t).origin,n=new URL(`/live/previews/${encodeURIComponent(e)}`,r);n.searchParams.set("__d","");const o=[{__resolveType:"preview",block:s}];return i&&o.push(i),n.searchParams.set("props",eu(JSON.stringify({sections:o}))),n.toString()}function Ww(t){return t.fastPreviewActive&&t.previewServerUrl?t.previewServerUrl:t.sandboxUrl??null}function Ob(t){const e=H.c(4),s=ni(t?.virtualMcpId).runtime==="cms",i=u_(t);let r;return e[0]!==i||e[1]!==s||e[2]!==t?(r=t&&i&&s?jb({...t,...i}):null,e[0]=i,e[1]=s,e[2]=t,e[3]=r):r=e[3],r}function zb(t){const e=H.c(11);let s;e[0]!==t?(s=t?{orgSlug:t.orgSlug,virtualMcpId:t.virtualMcpId,branch:t.branch}:null,e[0]=t,e[1]=s):s=e[1];const i=Ob(s),r=t?.previewServerUrl??null;let n=null;if(r)try{let l;e[2]!==r?(l=new URL(r),e[2]=r,e[3]=l):l=e[3],n=l.host}catch{n=null}let o;e[4]!==i||e[5]!==t||e[6]!==r?(o=t&&r&&i?Ib(new URL(t.path,r).toString(),i):null,e[4]=i,e[5]=t,e[6]=r,e[7]=o):o=e[7];const a=o;let c;return e[8]!==n||e[9]!==a?(c={url:a,host:n},e[8]=n,e[9]=a,e[10]=c):c=e[10],c}function $b(t){return t.replace(/\/+$/,"")||"/"}function Uw(t){return t.trim().replace(/^\/+|\/+$/g,"")}function Fb(t){const e=t.trim();return!(!e.startsWith("/")||e.startsWith("//")||e.includes("..")||e.includes("\\"))}function Kw(t){const e=t.trim();return e?Fb(e)?null:"Path must start with / and must not contain .. or //.":"Path is required."}const Sa=/:([A-Za-z0-9_-]+)|\*/g;function qw(t){const e=[];for(const s of t.matchAll(Sa)){const i=s[1]??"*";e.includes(i)||e.push(i)}return e}function tu(t){return t.replace(/\{([^{}]*)\}\?/g,"$1")}function Vw(t){t=tu(t);const e=[];let s=0;for(const i of t.matchAll(Sa))i.index>s&&e.push({type:"text",text:t.slice(s,i.index)}),e.push({type:"param",name:i[1]??"*"}),s=i.index+i[0].length;return s<t.length&&e.push({type:"text",text:t.slice(s)}),e}function Hb(t,e){return tu(t).replace(Sa,(s,i)=>{const r=e[i??"*"]?.trim();return r?i!==void 0?encodeURIComponent(r):r.split("/").filter(Boolean).map(encodeURIComponent).join("/")||s:s})}function Wb(t,e,s){return`deco:preview:last-page:${t}:${e}:${s}`}function Ub(t){if(!t)return null;try{const e=JSON.parse(t);if(!e||typeof e!="object"||Array.isArray(e)||typeof e.path!="string"||!e.path.startsWith("/"))return null;const s=typeof e.pageKey=="string"?e.pageKey:null,i={};if(e.params&&typeof e.params=="object")for(const[r,n]of Object.entries(e.params))typeof n=="string"&&(i[r]=n);return{path:e.path,pageKey:s,params:i}}catch{return null}}function Kb(t){try{return Ub(localStorage.getItem(t))}catch{return null}}function Gw(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch{}}function ya(t){return Hr({userName:t?.name,userEmail:t?.email})??void 0}function xa(t){const e=H.c(18),{state:s,header:i,body:r,note:n,gate:o,footer:a}=t,c=s!=="ready";let l;e[0]!==i?(l=h.jsx("div",{className:"space-y-0.5 px-4 py-3",children:i}),e[0]=i,e[1]=l):l=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=h.jsx("div",{className:"border-t"}),e[2]=u):u=e[2];let d;e[3]!==n?(d=n?h.jsx("div",{className:"space-y-1.5 border-t px-4 py-3",children:n}):null,e[3]=n,e[4]=d):d=e[4];let f;e[5]!==r||e[6]!==d?(f=h.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[r,d]}),e[5]=r,e[6]=d,e[7]=f):f=e[7];let p;e[8]===Symbol.for("react.memo_cache_sentinel")?(p=h.jsx("div",{className:"border-t"}),e[8]=p):p=e[8];let _;e[9]!==a?(_=h.jsx("div",{className:"space-y-2 px-4 py-3",children:a}),e[9]=a,e[10]=_):_=e[10];let g;return e[11]!==o||e[12]!==s||e[13]!==c||e[14]!==l||e[15]!==f||e[16]!==_?(g=h.jsxs("div",{className:"flex min-h-0 flex-1 flex-col","data-publish-state":s,"aria-busy":c,children:[l,u,f,o,p,_]}),e[11]=o,e[12]=s,e[13]=c,e[14]=l,e[15]=f,e[16]=_,e[17]=g):g=e[17],g}function xo(t){const e=H.c(2),{children:s}=t;let i;return e[0]!==s?(i=h.jsx("div",{className:"scroll-fade min-h-0 flex-1 space-y-3 overflow-y-auto overscroll-contain px-4 pt-3 pb-2 [scrollbar-width:thin]",children:s}),e[0]=s,e[1]=i):i=e[1],i}function su(t){const e=H.c(10);let s,i,r;e[0]!==t?({className:i,children:s,...r}=t,e[0]=t,e[1]=s,e[2]=i,e[3]=r):(s=e[1],i=e[2],r=e[3]);let n;e[4]!==i?(n=_e("rounded-lg border bg-card px-3 py-2.5",i),e[4]=i,e[5]=n):n=e[5];let o;return e[6]!==s||e[7]!==r||e[8]!==n?(o=h.jsx("div",{className:n,...r,children:s}),e[6]=s,e[7]=r,e[8]=n,e[9]=o):o=e[9],o}function as(t){const e=H.c(4),{className:s}=t;let i;e[0]!==s?(i=_e("animate-pulse rounded bg-muted motion-reduce:animate-none",s),e[0]=s,e[1]=i):i=e[1];let r;return e[2]!==i?(r=h.jsx("div",{className:i}),e[2]=i,e[3]=r):r=e[3],r}function Pi(){const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=h.jsx(su,{children:h.jsxs("div",{className:"flex items-center gap-2.5",children:[h.jsx(as,{className:"size-4 rounded-md"}),h.jsx(as,{className:"h-3 w-24"}),h.jsx(as,{className:"h-2.5 w-16"}),h.jsx(as,{className:"ml-auto size-6 rounded"})]})}),t[0]=e):e=t[0],e}function ac(t){if(!t.startsWith("#")||!t.includes("@"))return null;const e=t.indexOf("@");return{moduleResolveType:t.slice(1,e),blockId:t.slice(e+1)}}function Yw(t){return t.includes("@")}function lc(t){const e=t.lastIndexOf("@");return e<0||e===t.length-1?null:t.slice(e+1)}function Xw(t,e){if(t===e)return!0;const s=lc(t);return s?e===s||lc(e)===s:!1}function wa(t,e){const s=t.manifest?.blocks??{};for(const[i,r]of Object.entries(s))if(e in r)return i;return null}function Ca(t,e){const s=wa(t,e);return s!==null&&s.includes("sections")}function qb(t,e){const s=wa(t,e);return s!==null&&s.includes("apps")}function Jw(t,e){const s=wa(t,e);return s!==null&&s.includes("matchers")}function iu(t){return!(!t||/\.\w+$/.test(t)||t==="__proto__"||t==="constructor")}function ru(t){try{return decodeURIComponent(t).startsWith("Preview ")}catch{return t.startsWith("Preview ")}}const Zw="oklch(0.7278 0.151 289)",Vb="website/matchers/always.ts",Qw="website/matchers/never.ts",Gb="website/flags/multivariate.ts",nu="website/flags/multivariate/section.ts";function e2(){return{__resolveType:Vb}}function ei(t){const e=t.split("/");return(e[e.length-1]??t).replace(/\.(tsx?|jsx?)$/,"").replace(/[-_]/g," ").replace(/\b\w/g,i=>i.toUpperCase())||t}const Yb=12,Xb=8,mn=32,Jb=40,Zb="__SECTION_REF__";function gn(t){const e=t.type;return e==="array"||Array.isArray(e)&&e.includes("array")}function cc(t,e){let s=t.items;if(!s)return!1;if(typeof s.$ref=="string"&&(s=e(s.$ref)),Array.isArray(s.anyOf)||Array.isArray(s.oneOf))return!0;const r=s.properties?.__resolveType?.enum;return Array.isArray(r)&&typeof r[0]=="string"}const Qb="VideoWidget";function Gs(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):[]}function ou(t){return typeof btoa=="function"?btoa(t):Buffer.from(t).toString("base64")}function ka(t){const e=t.match(/^site\/apps\/([^/]+)\/([^/.]+)\.tsx?$/);return e?{vendor:e[1],app:e[2]}:null}function Pa(t){const e=t.match(/^([^/]+)\/apps\/([^/.]+)\.tsx?$/);return e?{vendor:e[1],app:e[2]}:null}function au(t,e){return[`site/apps/${t}/${e}.ts`,`site/apps/${t}/${e}.tsx`,`${t}/apps/${e}.ts`,`${t}/apps/${e}.tsx`]}function Ea(t,e){const s=e.manifest?.blocks??{};for(const a of Object.values(s))if(a[t])return a[t];const i=ka(t)??Pa(t);if(i){for(const a of au(i.vendor,i.app))for(const c of Object.values(s))if(c[a])return c[a]}const r=ou(t);for(const a of Object.values(s))if(a[r])return a[r];const n=e.schema??{};return(n.$defs??n.definitions??{})[r]?{$ref:`#/definitions/${r}`}:{}}function lu(t,e){if(qb(t,e))return!0;const s=ka(e)??Pa(e);if(!s)return!1;const i=t.manifest?.blocks?.apps??{};if(au(s.vendor,s.app).some(o=>o in i))return!0;const r=ou(e),n=t.schema?.$defs??t.schema?.definitions??{};return r in n}function e0(t){return t==="site/apps/site.ts"?!1:ka(t)!==null||Pa(t)!==null}function t0(t,e){const s=e.schema??{},i=Ea(t,e),r=s.$defs??s.definitions??{},n=s.root??{},o=m=>{if(m.startsWith("#/root/")){const C=m.slice(7);return n[C]??{}}const x=m.split("/").pop()??"",y=r[x];return y||(x===Zb?n.sections??{}:{})};let a;typeof i.$ref=="string"?a=o(i.$ref):Object.keys(i).length>0?a=i:a=s;const c=m=>typeof m.$ref=="string"?o(m.$ref):m,l=m=>{const y=c(m).properties?.type;if(y){if(typeof y.const=="string")return y.const;if(typeof y.default=="string")return y.default;if(Array.isArray(y.enum)&&typeof y.enum[0]=="string")return y.enum[0]}},u=(m,x)=>{const y=c(m);return typeof y.title=="string"&&!y.title.startsWith("#")?y.title:x},d=(m,x=new Set)=>{if(typeof m.$ref!="string"||m.properties||m.anyOf||m.allOf||m.oneOf||m.type)return m;const y=m.$ref.split("/").pop()??"";return!y||x.has(y)?m:d(o(m.$ref),new Set([...x,y]))},f=m=>{const x=m.hide;return x===!0||x==="true"},p=m=>typeof m=="string"&&(m.includes("://")||!/\s/.test(m)&&(m.includes("|")||m.includes("&")||m.includes("@"))),_=(m,x=new Set,y=0)=>{if(y>Yb)return{};if(typeof m.$ref=="string"){const N=m.$ref.split("/").pop()??"";return x.has(N)?{}:_(o(m.$ref),new Set([...x,N]),y+1)}let C={};m.properties&&typeof m.properties=="object"&&(C={...C,...m.properties}),Array.isArray(m.required)&&(C.__required=[...Gs(C.__required),...Gs(m.required)]);for(const N of["allOf","anyOf","oneOf"]){const T=m[N];if(Array.isArray(T))for(const R of T){const E=Gs(C.__required),P=_(R,x,y+1);C={...C,...P};const A=N==="allOf"?[...E,...Gs(P.__required)]:E;A.length>0?C.__required=A:delete C.__required}}return C},g=(m,x=0,y=new Set)=>{let C=m,N;if(typeof m.$ref=="string"){C=o(m.$ref);const G=m.$ref.split("/").pop()??"";N=G,G===Qb&&!C.format&&(C={...C,format:"video-uri"})}C=d(C);const T=N!==void 0&&y.has(N),R=N!==void 0?new Set([...y,N]):y,E=(G,I,V,$=!0)=>!T&&(!$||V<=Jb)&&I<Xb?g(G,I,R):void 0;let P;{const G=C.anyOf??C.oneOf;if(Array.isArray(G)){const I=G.filter($=>!($.type==="null"||$.type===null)),V=$=>{if(typeof $.const=="string"||typeof $.const=="number")return $.const;if(Array.isArray($.enum)&&$.enum.length===1&&(typeof $.enum[0]=="string"||typeof $.enum[0]=="number"))return $.enum[0]};I.length>0&&I.every($=>V($)!==void 0)&&(P=I.map($=>V($)))}}let A,M,L=!1;if(C.type)A=Array.isArray(C.type)?String(C.type.find(G=>G!=="null")??C.type[0]):String(C.type);else if(C.anyOf||C.oneOf){const I=(C.anyOf??C.oneOf).filter(V=>!(V.type==="null"||V.type===null));if(I.length===0)A="null";else if(I.length===1){const V=I[0];M=V,A=V.type?Array.isArray(V.type)?String(V.type[0]):String(V.type):typeof V.$ref=="string"?"object":"string"}else{if(P){const q=F=>typeof m[F]=="string"?m[F]:typeof C[F]=="string"?C[F]:void 0;return{type:"string",title:typeof C.title=="string"?C.title:void 0,description:typeof C.description=="string"?C.description:void 0,enum:P,format:q("format"),options:q("options")}}const V=I.filter(q=>{const F=q.properties?.__resolveType?.enum;return Array.isArray(F)&&typeof F[0]=="string"}),$=I.map(q=>d(q)).find(gn),ee=I.filter(q=>!gn(d(q))).every(q=>typeof q.$ref=="string"||V.includes(q)),se=V.some(q=>{const F=q.properties?.__resolveType?.enum;return Array.isArray(F)&&F[0]===Gb});if($){if(!cc($,o)&&I.length>1&&ee){const F=g($,x+1,R);return{...F,type:"array",title:typeof C.title=="string"?C.title:F.title,description:typeof C.description=="string"?C.description:F.description}}if(se){const F=g($,x+1,R);return{...F,type:"array",title:typeof C.title=="string"?C.title:F.title,description:typeof C.description=="string"?C.description:F.description}}}if(V.length>0){const q=V.map(ne=>{const de=ne.properties?.__resolveType?.enum??[],le=String(de[0]);return{resolveType:le,title:typeof ne.title=="string"?ne.title:ei(le),description:typeof ne.description=="string"?ne.description:void 0,schema:E(ne,x+1,I.length)}}),F=[];for(const ne of I){if(V.includes(ne)||typeof ne.$ref!="string")continue;const ce=o(ne.$ref);let de;const le=ce.properties?.__resolveType;if(Array.isArray(le?.enum)&&typeof le.enum[0]=="string"&&(de=le.enum[0]),!de&&Array.isArray(ce.allOf))for(const re of ce.allOf){const ge=re.properties?.__resolveType?.enum;if(Array.isArray(ge)&&typeof ge[0]=="string"){de=ge[0];break}}de&&F.push({resolveType:de,title:typeof ce.title=="string"&&!ce.title.startsWith("#")?ce.title:ei(de),description:typeof ce.description=="string"?ce.description:void 0,schema:E(ce,x+1,I.length)})}const Q=new Set(q.map(ne=>ne.resolveType)),he=[...q,...F.filter(ne=>!Q.has(ne.resolveType))],ue=I.filter(ne=>!V.includes(ne)),fe=ue.length===1&&!T?g(ue[0],x+1,R):void 0;return{type:"block-ref",title:typeof C.title=="string"?C.title:void 0,description:typeof C.description=="string"?C.description:void 0,anyOfRefs:he,plainSchema:fe,hidden:f(C)||f(m)?!0:void 0}}const ie=q=>{const F=c(q);if(typeof F.title=="string"&&ac(F.title))return!0;const Q=F.properties?.__resolveType?.enum;if(Array.isArray(Q)&&typeof Q[0]=="string")return!0;if(Array.isArray(F.allOf))for(const he of F.allOf){const ue=he.properties?.__resolveType?.enum;if(Array.isArray(ue)&&typeof ue[0]=="string")return!0}return!1},Y=I.map(q=>l(q));if(I.length>1&&Y.every(q=>typeof q=="string")&&!I.some(ie)){const q=I.map((F,Q)=>{const he=c(F),ue=Y[Q];return{resolveType:ue,title:u(F,ue),description:typeof he.description=="string"?he.description:void 0,discriminatorValue:ue,schema:E(he,x+1,I.length,!1)}});return{type:"block-ref",title:typeof m.title=="string"?m.title:typeof C.title=="string"?C.title:void 0,description:typeof m.description=="string"?m.description:typeof C.description=="string"?C.description:void 0,discriminatorKey:"type",anyOfRefs:q,hidden:f(C)||f(m)?!0:void 0}}const X=q=>{if(ie(q))return!1;const F=c(q);return F.type==="object"||!!F.properties},U=q=>{const F=d(q);return gn(F)?!cc(F,o):!1},J=x<mn&&I.every(q=>X(q)||U(q))&&I.some(X);if(I.every(q=>typeof q.$ref=="string")&&!J){const q=[];for(const F of I){const Q=o(F.$ref);let he,ue;if(typeof Q.title=="string"){const ne=ac(Q.title);ne&&(he=ne.blockId,ue=ne.blockId)}if(!he&&Array.isArray(Q.allOf))for(const ne of Q.allOf){const le=((ne.properties??{}).__resolveType??{}).enum;if(Array.isArray(le)&&typeof le[0]=="string"){he=le[0];break}}if(!he){const ce=Q.properties?.__resolveType?.enum;Array.isArray(ce)&&typeof ce[0]=="string"&&(he=ce[0])}he||(he=F.$ref.split("/").pop()??"");const fe=he.includes("/")?void 0:l(F);!fe&&!he.includes("/")||q.push({resolveType:fe??he,title:ue??(typeof Q.title=="string"&&!Q.title.startsWith("#")?Q.title:ei(he)),description:typeof Q.description=="string"?Q.description:void 0,discriminatorValue:fe,schema:E(Q,x+1,I.length)})}return{type:"block-ref",title:typeof C.title=="string"?C.title:void 0,description:typeof C.description=="string"?C.description:void 0,anyOfRefs:q,hidden:f(C)||f(m)?!0:void 0}}if(J){const q=Q=>{if(typeof Q.const=="string"||typeof Q.const=="number"||typeof Q.const=="boolean")return Q.const;if(Array.isArray(Q.enum)&&Q.enum.length===1&&(typeof Q.enum[0]=="string"||typeof Q.enum[0]=="number"||typeof Q.enum[0]=="boolean"))return Q.enum[0]},F=I.map((Q,he)=>{const ue=c(Q).properties??{},fe={};for(const[ne,ce]of Object.entries(ue)){const de=q(ce);de!==void 0&&(fe[ne]=de)}return{title:u(Q,`Option ${he+1}`),schema:g(Q,x+1),discriminators:Object.keys(fe).length?fe:void 0}});return{type:"inline-union",title:typeof m.title=="string"?m.title:typeof C.title=="string"?C.title:void 0,description:typeof C.description=="string"?C.description:void 0,inlineUnionBranches:F,hidden:f(C)||f(m)?!0:void 0}}A="object"}}else C.allOf?(A="object",L=p(C.title)):typeof m.$ref=="string"&&(A="object");let B,D;if(x<mn){const G=_(C),I=Gs(G.__required);I.length>0&&(D=I);const V=Object.entries(G).filter(([$])=>!$.startsWith("__")&&$!=="@type");if(V.length>0){B={};for(const[$,ee]of V)B[$]=g(ee,x+1,R)}}let j;if((A==="array"||C.type==="array")&&x<mn){let G=C.items;G&&(typeof G.$ref=="string"&&(G=o(G.$ref)),j=g(G,x+1,R),typeof G.title=="string"&&G.title.includes("{{")&&(j.titleBy=G.title))}const K=G=>{const I=M?.[G];return typeof I=="string"?I:void 0},z=()=>{if("default"in m)return m.default;if("default"in C)return C.default;if(M&&"default"in M)return M.default};return{type:A??"string",title:typeof m.title=="string"?m.title:!L&&typeof C.title=="string"?C.title:K("title"),description:typeof m.description=="string"?m.description:typeof C.description=="string"?C.description:K("description"),default:z(),enum:Array.isArray(C.enum)?C.enum:P??void 0,format:typeof m.format=="string"?m.format:typeof C.format=="string"?C.format:K("format"),properties:B,required:D,items:j,hidden:f(C)||f(m)?!0:void 0,titleBy:typeof C.titleBy=="string"?C.titleBy:K("titleBy"),image:typeof C.image=="string"?C.image:K("image"),options:typeof m.options=="string"?m.options:typeof C.options=="string"?C.options:K("options")}},v=a.properties??{},b=Object.keys(v).every(m=>m.startsWith("__"));if(Array.isArray(a.allOf)&&a.allOf.length===1&&b){const m=v.__resolveType,x=Array.isArray(m?.enum)&&typeof m.enum[0]=="string"?m.enum[0]:typeof m?.const=="string"?m.const:typeof m?.default=="string"?m.default:void 0;for(const y of a.allOf){const C=d(y);if(!(Array.isArray(C.anyOf)||Array.isArray(C.oneOf))||C.properties)continue;const T=g(C,0);if(T.type==="inline-union"&&T.inlineUnionBranches){const R=p(T.title);return{...T,title:R?void 0:T.title,inlineUnionBranches:x?T.inlineUnionBranches.map(E=>({...E,discriminators:{...E.discriminators??{},__resolveType:x}})):T.inlineUnionBranches}}}}const k=_(a),w={};for(const[m,x]of Object.entries(k))m.startsWith("__")||m==="@type"||(w[m]=g(x,0));if(Object.keys(w).length===0)return null;const S=Gs(k.__required);return{type:"object",title:typeof a.title=="string"?a.title:void 0,properties:w,required:S.length>0?S:void 0}}function t2(t,e){const s=e.schema??{},i=Ea(t,e),r=s.$defs??s.definitions??{},n=typeof i.$ref=="string"?r[i.$ref.split("/").pop()??""]??{}:i,o=n.properties??{};if(Object.keys(o).some(l=>!l.startsWith("__")))return!1;if(n.additionalProperties===!0)return!0;const c=o.__resolveType;return!!c&&Array.isArray(c.enum)&&c.enum[0]===t}function s2(t){const e=i=>{switch(typeof i){case"number":return{type:"number"};case"boolean":return{type:"boolean"};case"object":{if(i===null)return{type:"string"};if(Array.isArray(i))return{type:"array",items:e(i[0])};const r={};for(const[n,o]of Object.entries(i))n.startsWith("__")||(r[n]=e(o));return{type:"object",properties:r}}default:return{type:"string"}}},s={};for(const[i,r]of Object.entries(t))i.startsWith("__")||(s[i]=e(r));return Object.keys(s).length===0?null:{type:"object",properties:s}}function Ra(t,e){const s=e.schema??{},i=Ea(t,e),r=s.$defs??s.definitions??{},n=typeof i.$ref=="string"?r[i.$ref.split("/").pop()??""]??{}:Object.keys(i).length>0?i:{...s,...i},o=n.icon,a=n.logo,c=n,l=d=>d===!0||d==="true",u=l(c.hide)||l(c.ignore)||l(c.unlisted);return{title:typeof n.title=="string"?n.title:void 0,description:typeof n.description=="string"?n.description:void 0,icon:typeof o=="string"?o:void 0,logo:typeof a=="string"?a:void 0,hidden:u||void 0}}const s0=["website/sections/Rendering/Lazy.tsx","website/sections/Rendering/SingleDeferred.tsx"],i2="website/sections/Rendering/Lazy.tsx";function cu(t){return s0.some(e=>t.endsWith(e))}const hu=["website/pages/Page.tsx","$live/pages/LivePage.tsx"],du=new Set(hu),i0=new Set(["site/sections/Theme/Theme.tsx"]);function Vr(t){return!!(i0.has(t)||cu(t)||t.toLowerCase().includes("preview"))}function r0(t){const e=t.manifest?.blocks??{};for(const s of Object.values(e))for(const i of Object.keys(s))if(du.has(i))return i;return hu[0]}function wo(t){if(!t)return[];if(t.anyOfRefs?.length)return t.anyOfRefs;if(t.items)return wo(t.items);if(t.properties){const e=[];for(const s of Object.values(t.properties))e.push(...wo(s));return e}return[]}function n0(t){const e=t.manifest?.blocks??{},s=[];for(const[i,r]of Object.entries(e))if(i.includes("sections"))for(const n of Object.keys(r)){if(Vr(n))continue;const o=Ra(n,t);s.push({resolveType:n,title:o.title??ei(n),description:o.description,previewBlock:n,isSavedBlock:!1})}return s}function r2(t){const e=t.manifest?.blocks??{},s=new Map;for(const[i,r]of Object.entries(e))if(i.includes("sections"))for(const n of Object.keys(r))Vr(n)||s.has(n)||s.set(n,{resolveType:n,title:ei(n)});return[...s.values()].sort((i,r)=>i.title.localeCompare(r.title))}function uu(t,e){const s=e.__resolveType;if(typeof s!="string")return"";if(s!==nu)return s;const i=e.variants;if(!Array.isArray(i))return s;for(const r of i){const n=r?.value;if(!n)continue;let o=n.__resolveType;if(typeof o=="string"&&cu(o)&&(o=n.section?.__resolveType??o),typeof o=="string"&&Ca(t,o))return o}return s}function o0(t,e){return uu(t,e)!==e.__resolveType}function fu(t,e){const s=[];for(const[i,r]of Object.entries(e)){if(i.includes("/")||ru(i)||!r||typeof r!="object"||Array.isArray(r))continue;const n=r,o=n.__resolveType;typeof o!="string"||du.has(o)||typeof n.path=="string"||Vr(o)||!(Ca(t,o)||o===nu&&o0(t,n))||s.push({resolveType:i,title:i,description:typeof n.name=="string"?n.name:void 0,previewBlock:i,isSavedBlock:!0})}return s}function a0(t,e){const s=iu(e.resolveType),i=s?{}:Ra(e.resolveType,t);return{resolveType:e.resolveType,title:e.title||i.title||ei(e.resolveType),description:e.description??i.description,previewBlock:e.resolveType,isSavedBlock:s}}function n2(t,e){const s=r0(t),i=t0(s,t),r=wo(i?.properties?.sections),n=new Map,o=a=>{if(!Vr(a.resolveType)){if(iu(a.resolveType)){ru(a.resolveType)||n.set(a.resolveType,a);return}Ca(t,a.resolveType)&&(n.has(a.resolveType)||n.set(a.resolveType,a))}};for(const a of n0(t))o(a);for(const a of r)o(a0(t,a));for(const a of fu(t,e))o(a);return[...n.values()].sort((a,c)=>a.title.localeCompare(c.title))}function o2(t){const e=t.site;if(!e||typeof e!="object"||Array.isArray(e))return;const s=e.theme;if(!(!s||typeof s!="object"||Array.isArray(s)))return s}const Ta="website/loaders/redirect.ts",a2=new Set([Ta,"website/loaders/redirects.ts"]),l2={temporary:307,permanent:301},hc=t=>typeof t=="string"?t:"",l0=t=>t==="permanent"?"permanent":"temporary";function pu(t){const e=t&&typeof t.redirect=="object"&&t.redirect!==null&&!Array.isArray(t.redirect)?t.redirect:{};return{from:hc(e.from),to:hc(e.to),type:l0(e.type),discardQueryParameters:e.discardQueryParameters===!0}}function c0(t){const e=[];for(const[s,i]of Object.entries(t)){if(!i||typeof i!="object"||Array.isArray(i))continue;const r=i;if(r.__resolveType!==Ta)continue;const{from:n,to:o,type:a,discardQueryParameters:c}=pu(r);e.push({key:s,from:n,to:o,type:a,discardQueryParameters:c})}return e}function c2(t){return pu(t)}function h2(t){const e={from:t.from,to:t.to,type:t.type};return t.discardQueryParameters&&(e.discardQueryParameters=!0),{redirect:e,__resolveType:Ta}}function h0(t){return(t.split(/[?#]/)[0]??"").replace(/^\/+/,"").replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32)||"redirect"}const d0=1e3;function d2(t,e){const s=h0(e);for(let i=0;i<d0;i++){const r=`redirects-${s}-${crypto.randomUUID()}`;if(!Object.hasOwn(t,r))return r}throw new Error("Could not generate a unique redirect block key")}function _u(t){let e=t;e.startsWith("pages-")&&(e=e.slice(6)),e=e.replace(/-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,""),e=e.replace(/-[0-9a-f]{8,}$/i,"");try{return decodeURIComponent(e)}catch{return e}}function u2(t,e){const{pageId:s,path:i,pathTemplate:r}=e;if(s){const n=t.find(a=>a.key===s);if(n)return n;const o=t.find(a=>a.key.endsWith(`-${s}`));if(o)return o}if(r){const n=dc(t,r);if(n)return n}if(i){const n=dc(t,i);if(n)return n}return null}function dc(t,e,s){const i=$b;if(s){const n=t.find(o=>o.key===s);if(n)return n}const r=t.filter(n=>i(n.path)===i(e));return r.length===0?null:r.length===1?r[0]??null:[...r].sort((n,o)=>n.key.localeCompare(o.key))[0]??null}const mu=new Set(["website/pages/Page.tsx","$live/pages/LivePage.tsx"]),xi="site",gu="site/apps/site.ts";function Mi(t,e){return t===xi?!0:e.__resolveType===gu}function f2(t,e){return t?u0(t).length>0||c0(t).length>0?!0:e?_0(t,e).length>0||f0(t,e)?!0:p0(t,e).length>0:!1:!1}function Dr(t,e){if(!e||typeof e!="object"||Array.isArray(e))return null;const s=e;return typeof s.__resolveType!="string"||!mu.has(s.__resolveType)||typeof s.path!="string"?null:{key:t,name:typeof s.name=="string"?s.name:_u(t),path:s.path}}function u0(t){const e=[];for(const[s,i]of Object.entries(t)){const r=Dr(s,i);r&&e.push(r)}return e}function Nr(t,e){if(typeof e.name=="string"){const s=e.name.trim();if(s)return s}return t.replace(/[-_]/g," ").replace(/\b\w/g,s=>s.toUpperCase())}function Co(t,e,s){const i=typeof e.__resolveType=="string"?e.__resolveType:"",r=i?Ra(i,s):{};if(r.title)return r.title;if(typeof e.name=="string"){const n=e.name.trim();if(n)return n}return t.replace(/[-_]/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function f0(t,e){const s=t[xi];if(s&&typeof s=="object"&&!Array.isArray(s)){const i=s,r=i.__resolveType;if(typeof r=="string"&&(Mi(xi,i)||lu(e,r)))return{key:xi,name:Co(xi,i,e),resolveType:r}}for(const[i,r]of Object.entries(t)){if(i.includes("/")||!r||typeof r!="object"||Array.isArray(r))continue;const n=r;if(!Mi(i,n))continue;const o=typeof n.__resolveType=="string"?n.__resolveType:gu;return{key:i,name:Co(i,n,e),resolveType:o}}return null}function p0(t,e){const s=[];for(const[i,r]of Object.entries(t)){if(i.includes("/")||!r||typeof r!="object"||Array.isArray(r))continue;const n=r,o=n.__resolveType;typeof o=="string"&&(mu.has(o)||typeof n.path!="string"&&(Mi(i,n)||!lu(e,o)&&!e0(o)||s.push({key:i,name:Co(i,n,e),resolveType:o})))}return s.sort((i,r)=>i.name.localeCompare(r.name))}function _0(t,e){return fu(e,t).map(s=>{const i=t[s.resolveType],r=uu(e,i);return{key:s.resolveType,name:s.description??Nr(s.resolveType,i),resolveType:r}}).sort((s,i)=>s.name.localeCompare(i.name))}const m0=/(?:^|\/)\.deco\/blocks\/([^/]+)\.json$/;function vu(t){const e=m0.exec(t)?.[1];return e?Yp(e):null}function Mr(t){if(!t)return null;try{const e=JSON.parse(t);if(e&&typeof e=="object"&&!Array.isArray(e))return e}catch{}return null}function g0(t,e){return t===null?"new":e===null?"removed":"edited"}function bu(t){const e=t.replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").trim();return e?(e.charAt(0).toUpperCase()+e.slice(1)).replace(/\s+[A-Z](?=[a-z])/g,s=>s.toLowerCase()):t}function vn(t,e){if(t&&typeof t=="object"&&!Array.isArray(t)){const s=t.__resolveType;if(typeof s=="string"&&s.trim()){const r=(s.split("/").pop()??s).replace(/\.[jt]sx?$/,"");return bu(r)||r}}return`Section ${e+1}`}function ko(t){const e=t.sections;if(Array.isArray(e))return e.flatMap((s,i)=>s&&typeof s=="object"&&!Array.isArray(s)?[{section:s,basePath:["sections",i]}]:[]);if(e&&typeof e=="object"){const s=e.variants;if(Array.isArray(s))return s.flatMap((i,r)=>{const n=i&&typeof i=="object"&&!Array.isArray(i)?i.value:null;return Array.isArray(n)?n.flatMap((o,a)=>o&&typeof o=="object"&&!Array.isArray(o)?[{section:o,basePath:["sections","variants",r,"value",a]}]:[]):[]})}return[]}function uc(t){return JSON.stringify(t,(e,s)=>{if(s&&typeof s=="object"&&!Array.isArray(s)){const i=s;return Object.keys(i).sort().reduce((r,n)=>(r[n]=i[n],r),{})}return s})}function Su(t,e){return t===void 0&&e===void 0?!0:uc(t)===uc(e)}function Br(t,e,s,i=new Set){const r=new Set([...Object.keys(t??{}),...Object.keys(e??{})]),n=[];for(const o of r){if(o.startsWith("__")||i.has(o))continue;const a=t?t[o]:void 0,c=e?e[o]:void 0;Su(a,c)||n.push({label:bu(o),path:[...s,o],from:a,to:c})}return n}const v0=new Set(["sections"]);function yu(t,e){const s=t?ko(t):[],i=e?ko(e):[],r=[],n=Math.max(s.length,i.length);for(let a=0;a<n;a++){const c=s[a],l=i[a];if(c&&l){if(Su(c.section,l.section))continue;r.push({name:vn(l.section,a),kind:"section",status:"edited",fields:Br(c.section,l.section,l.basePath)})}else l?r.push({name:vn(l.section,a),kind:"section",status:"new",fields:[]}):c&&r.push({name:vn(c.section,a),kind:"section",status:"removed",fields:[]})}const o=Br(t,e,[],v0);return o.length>0&&r.push({name:"Page settings",kind:"settings",status:"edited",fields:o}),r}function Po(t,e){return{kind:"other",blockKey:null,name:t.split("/").pop()??t,pagePath:null,isSiteApp:!1,status:e,filepaths:[t],sections:[],fromJson:null,toJson:null}}function b0(t){const e=[],s=[],i=[],r=[];for(const[n,o]of Object.entries(t?.diffs??{})){if(mh(n)){r.push(n);continue}const a=g0(o.from,o.to),c=vu(n);if(!c){i.push(Po(n,a));continue}const l=Mr(o.from),u=Mr(o.to),d=u??l;if(!d){i.push(Po(n,a));continue}const f=Dr(c,d);if(f){e.push({kind:"page",blockKey:c,name:f.name,pagePath:f.path,isSiteApp:!1,status:a,filepaths:[n],sections:a==="edited"?yu(l,u):[],fromJson:l,toJson:u});continue}const p=Mi(c,d);s.push({kind:"block",blockKey:c,name:Nr(c,d),pagePath:null,isSiteApp:p,status:a,filepaths:[n],sections:a==="edited"?[{name:Nr(c,d),kind:"section",status:"edited",fields:Br(l,u,[])}].filter(_=>_.fields.length>0):[],fromJson:l,toJson:u})}return xu({pages:e,blocks:s,other:i,generated:r})}function bn(t,e){return(t.filepaths[0]??"").localeCompare(e.filepaths[0]??"")}function xu(t){const{pages:e,blocks:s,other:i,generated:r}=t;return e.sort(bn),s.sort(bn),i.sort(bn),{pages:e,blocks:s,other:i,generated:r,count:e.length+s.length+i.length}}function S0(t){return t==="added"?"new":t==="removed"?"removed":"edited"}function y0(t){return t.startsWith("pages-")}function wu(t){const{files:e,lookup:s,diff:i}=t,r=[],n=[],o=[],a=[];for(const c of e){const l=c.path;if(mh(l)){a.push(l);continue}const u=S0(c.status),d=vu(l);if(!d){o.push(Po(l,u));continue}const f=i?.diffs[l],p=Mr(f?.from??null),_=Mr(f?.to??null),g=x0(s,d),v=g??_??p;if((g?Dr(d,g):null)??(!g&&y0(d))){const w=v?Dr(d,v):null;r.push({kind:"page",blockKey:d,name:w?.name??_u(d),pagePath:w?.path??null,isSiteApp:!1,status:u,filepaths:[l],sections:u==="edited"?yu(p,_):[],fromJson:p,toJson:_??(u==="new"?g:null)});continue}const k=Nr(d,v??{});n.push({kind:"block",blockKey:d,name:k,pagePath:null,isSiteApp:Mi(d,g??{}),status:u,filepaths:[l],sections:u==="edited"?[{name:k,kind:"section",status:"edited",fields:Br(p,_,[])}].filter(w=>w.fields.length>0):[],fromJson:p,toJson:_})}return xu({pages:r,blocks:n,other:o,generated:a})}function x0(t,e){const s=t?.[e];return s&&typeof s=="object"&&!Array.isArray(s)?s:null}function w0(t,e){return t??e}function _i(t){return t.length<=1?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function C0(t){const e=t.sections.filter(s=>s.kind==="section").map(s=>s.name).slice(0,3);return e.length>0?`${t.name} (${e.join(", ")})`:t.name}function k0(t){const e=[],s=t.pages.filter(a=>a.status==="edited"),i=t.pages.filter(a=>a.status==="new"),r=t.pages.filter(a=>a.status==="removed");if(s.length>0&&e.push(`updated ${_i(s.map(C0))}`),i.length>0){const a=i.length===1?"page":"pages";e.push(`added the ${_i(i.map(c=>c.name))} ${a}`)}if(r.length>0){const a=r.length===1?"page":"pages";e.push(`removed the ${_i(r.map(c=>c.name))} ${a}`)}const n=t.blocks.map(a=>a.name);if(n.length>0&&e.push(`changed ${_i(n)}`),t.other.length>0){const a=t.other.length===1?"file":"files";e.push(`changed ${t.other.length} ${a}`)}if(e.length===0)return"";const o=_i(e);return o.charAt(0).toUpperCase()+o.slice(1)}function P0(t){return t?ko(t).length:0}function E0(t){const e={newPageSections:t.kind==="page"&&t.status==="new"?P0(t.toJson):null,sections:0,settings:!1,fields:0};if(e.newPageSections!==null)return e;for(const s of t.sections){if(s.kind==="settings"){e.settings=!0;continue}t.kind==="page"?e.sections+=1:e.fields+=s.fields.length}return e}function Cu(t){return t.filepaths[0]??t.blockKey??t.name}function R0(t,e){return e(t==="new"?"thread.publishPopover.chipNew":t==="removed"?"thread.publishPopover.chipRemoved":"thread.publishPopover.chipEdited")}function T0(t,e){const s=t.kind==="block"?Fc:Ep;return h.jsx("span",{title:R0(t.status,e),className:"flex shrink-0",children:h.jsx(s,{className:_e("size-4",t.status==="new"&&"text-brand",t.status==="edited"&&"text-warning",t.status==="removed"&&"text-destructive")})})}function A0(t,e){return t.kind==="page"?t.pagePath:t.kind!=="block"?null:t.isSiteApp?e("thread.publishPopover.siteConfiguration"):e("thread.publishPopover.globalSection")}function D0(t,e){const s=E0(t);if(s.newPageSections!==null)return[s.newPageSections===1?e("thread.publishPopover.newPageSectionOne"):e("thread.publishPopover.newPageSections",{count:s.newPageSections})];const i=[];return s.sections===1?i.push(e("thread.publishPopover.sectionChangedOne")):s.sections>1&&i.push(e("thread.publishPopover.sectionsChanged",{count:s.sections})),s.fields===1?i.push(e("thread.publishPopover.fieldChangedOne")):s.fields>1&&i.push(e("thread.publishPopover.fieldsChanged",{count:s.fields})),s.settings&&i.push(e("thread.publishPopover.pageSettingsChanged")),i}function N0(t){const e=H.c(80),{change:s,diff:i,bodyPending:r,expanded:n,onToggleExpanded:o,confirming:a,onConfirmingChange:c,onDiscard:l,isPublishing:u,isDiscarding:d}=t,f=r===void 0?!1:r,p=be();let _;e[0]!==s||e[1]!==p?(_=A0(s,p),e[0]=s,e[1]=p,e[2]=_):_=e[2];const g=_;let v,b,k,w,S,m,x,y;if(e[3]!==f||e[4]!==s||e[5]!==a||e[6]!==g||e[7]!==i?.diffs||e[8]!==n||e[9]!==d||e[10]!==u||e[11]!==c||e[12]!==l||e[13]!==o||e[14]!==p){const T=D0(s,p);let R;if(e[23]!==s.filepaths||e[24]!==i?.diffs){let se;e[26]!==i?.diffs?(se=ie=>{const Y=i?.diffs[ie];return Y?[[ie,Y]]:[]},e[26]=i?.diffs,e[27]=se):se=e[27],R={diffs:Object.fromEntries(s.filepaths.flatMap(se))},e[23]=s.filepaths,e[24]=i?.diffs,e[25]=R}else R=e[25];k=R;let E;e[28]!==k.diffs?(E=Object.keys(k.diffs),e[28]=k.diffs,e[29]=E):E=e[29],b=E.length>0;const P=f||b,A=f&&T.length===0&&s.status==="edited";v=su;const M=P&&!n&&"cursor-pointer";e[30]!==M?(w=_e(M),e[30]=M,e[31]=w):w=e[31],e[32]!==s?(S=Cu(s),e[32]=s,e[33]=S):S=e[33],m=P&&!n?o:void 0;const L=P&&"cursor-pointer";let B;e[34]!==L?(B=_e("flex items-center gap-2.5",L),e[34]=L,e[35]=B):B=e[35];let D;e[36]!==P||e[37]!==o?(D=P?se=>{se.stopPropagation(),o()}:void 0,e[36]=P,e[37]=o,e[38]=D):D=e[38];let j;e[39]!==s||e[40]!==p?(j=T0(s,p),e[39]=s,e[40]=p,e[41]=j):j=e[41];const K=!P,z=P?n:void 0;let G;e[42]!==s.name?(G=h.jsx("span",{className:"truncate text-sm font-medium",children:s.name}),e[42]=s.name,e[43]=G):G=e[43];let I;e[44]!==g?(I=g?h.jsx("span",{className:"truncate text-xs text-muted-foreground",children:g}):null,e[44]=g,e[45]=I):I=e[45];let V;e[46]!==K||e[47]!==z||e[48]!==G||e[49]!==I?(V=h.jsxs("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-2 text-left",disabled:K,"aria-expanded":z,children:[G,I]}),e[46]=K,e[47]=z,e[48]=G,e[49]=I,e[50]=V):V=e[50];let $;e[51]!==a||e[52]!==d||e[53]!==u||e[54]!==c||e[55]!==l||e[56]!==p?($=a?h.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[h.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground",onClick:se=>{se.stopPropagation(),c(!1)},children:p("thread.publishDialog.cancel")}),h.jsx("button",{type:"button",className:"text-xs font-medium text-destructive disabled:opacity-50",onClick:se=>{se.stopPropagation(),c(!1),l()},disabled:d,children:p("thread.publishPopover.discard")})]}):h.jsx(Oi,{children:h.jsxs(Qe,{children:[h.jsx(Je,{asChild:!0,children:h.jsx("button",{type:"button","aria-label":p("thread.publishPopover.discard"),className:"flex size-6 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-destructive disabled:opacity-50",onClick:se=>{se.stopPropagation(),c(!0)},disabled:u||d,children:h.jsx(_h,{className:"size-3.5"})})}),h.jsx(Ze,{children:p("thread.publishPopover.discard")})]})}),e[51]=a,e[52]=d,e[53]=u,e[54]=c,e[55]=l,e[56]=p,e[57]=$):$=e[57];let ee;e[58]!==P||e[59]!==n?(ee=P?h.jsx(Jo,{className:_e("size-3.5 shrink-0 text-muted-foreground transition-transform",n&&"rotate-90")}):null,e[58]=P,e[59]=n,e[60]=ee):ee=e[60],e[61]!==B||e[62]!==D||e[63]!==j||e[64]!==V||e[65]!==$||e[66]!==ee?(x=h.jsxs("div",{className:B,onClick:D,children:[j,V,$,ee]}),e[61]=B,e[62]=D,e[63]=j,e[64]=V,e[65]=$,e[66]=ee,e[67]=x):x=e[67],y=!n&&T.length>0?h.jsx("div",{className:"mt-1 space-y-0.5 pl-[26px] text-xs text-muted-foreground",children:T.map(M0)}):!n&&A?h.jsx("div",{className:"mt-1 space-y-0.5 pl-[26px]",children:h.jsx(as,{className:"h-4 w-2/3"})}):null,e[3]=f,e[4]=s,e[5]=a,e[6]=g,e[7]=i?.diffs,e[8]=n,e[9]=d,e[10]=u,e[11]=c,e[12]=l,e[13]=o,e[14]=p,e[15]=v,e[16]=b,e[17]=k,e[18]=w,e[19]=S,e[20]=m,e[21]=x,e[22]=y}else v=e[15],b=e[16],k=e[17],w=e[18],S=e[19],m=e[20],x=e[21],y=e[22];let C;e[68]!==n||e[69]!==b||e[70]!==k?(C=n?h.jsx("div",{className:"-mx-3 mt-2 border-t pt-1",children:h.jsx("div",{className:"scroll-fade max-h-72 overflow-y-auto overscroll-contain [scrollbar-width:thin]",children:b?h.jsx(gh,{diff:k,hideFileRows:!0,editorHeight:"220px"}):h.jsx(as,{className:"mx-3 my-2 h-40 rounded"})})}):null,e[68]=n,e[69]=b,e[70]=k,e[71]=C):C=e[71];let N;return e[72]!==v||e[73]!==w||e[74]!==S||e[75]!==m||e[76]!==x||e[77]!==y||e[78]!==C?(N=h.jsxs(v,{className:w,"data-change-id":S,onClick:m,children:[x,y,C]}),e[72]=v,e[73]=w,e[74]=S,e[75]=m,e[76]=x,e[77]=y,e[78]=C,e[79]=N):N=e[79],N}function M0(t,e){return h.jsx("div",{className:"truncate",children:t},`${e}-${t}`)}const B0=/^Co-authored-by:\s*([^<\r\n]+?)(?:\s*<[^>\r\n]*>)?\s*$/im;function L0(t){if(!t)return null;const e=B0.exec(t)?.[1]?.trim();return e||null}function j0(t){return/\[bot\]$/i.test(t)||/-bot$/i.test(t)}function I0(t){const e=L0(t.body);if(e)return e;const s=t.author.trim();return!s||j0(s)?null:s}async function O0(t,e,s){const i=Hr(s.coAuthor),{changeRequest:r}=await No(t,"CHANGE_REQUEST_OPEN",{...e,head:s.branch,base:s.base,title:s.title,body:Ym(s.body,i)||void 0});return{number:r.number,htmlUrl:r.url}}class ku extends Error{reason;detail;constructor(e,s){super(s||`Merge refused: ${e}`),this.name="ChangeRequestMergeRefused",this.reason=e,this.detail=s}}async function Pu(t,e,s){const i=Hr(s.coAuthor),r=i?rd(s.commitMessage?.trim()??"",i):s.commitMessage?.trim()||void 0,n=await No(t,"CHANGE_REQUEST_MERGE",{...e,number:s.number,strategy:"squash",commitTitle:s.commitTitle,commitMessage:r});if(!n.merged)throw new ku(n.reason??"error",n.detail)}function z0(t,e){switch(t){case"conflict":return e("thread.mergeRefused.conflict");case"blocked":return e("thread.mergeRefused.blocked");case"rate_limited":return e("thread.mergeRefused.rateLimited");case"not_found":return e("thread.mergeRefused.notFound");default:return e("thread.mergeRefused.error")}}class Eu extends Error{constructor(e,s){super("The branch changed since these changes were shown"),this.expectedHeadSha=e,this.actualHeadSha=s,this.name="PublishHeadMovedError"}expectedHeadSha;actualHeadSha}class Aa extends Error{constructor(e,s,i){super(e),this.step=s,this.pr=i,this.name="PublishStepError"}step;pr}function Ru(t){const e=t.title.trim(),s=t.body.trim(),i=e||t.fallbackTitle;return{title:i,body:s||void 0,message:[e,s].filter(Boolean).join(`
21
-
22
- `)||i}}function $0(t,e){const s=t.trim().split(`
23
- `);return Ru({title:s[0]??"",body:s.slice(1).join(`
24
- `),fallbackTitle:e})}function Da(t){return{orgSlug:t.orgSlug,virtualMcpId:t.virtualMcpId,branch:t.branch,threadId:t.threadId}}function Na(t){return t.fastPreview?{fastPreview:!0}:void 0}async function Sn(t,e,s){try{return await s()}catch(i){throw new Aa(i instanceof Error?i.message:e,t)}}async function Tu(t){const e=t.expectedHeadSha;if(!e)return;const i=(await wi(Da(t),Na(t)).catch(()=>null))?.headSha;if(i&&i!==e)throw new Eu(e,i)}function Au(t,e){return Rp(Da(t),e,Na(t))}function Du(t,e){return O0(t.orgSlug,t.target,{branch:t.headBranch,title:e.title,body:e.body,base:t.baseBranch,coAuthor:t.coAuthor})}async function Nu(t,e,s){await Tu(t),await Sn("push",s("thread.publishDialog.failedPushChanges"),()=>Au(t,e.message)),await Sn("sync",s("thread.publishDialog.failedRebase"),()=>vh(Da(t),t.baseBranch,Na(t)));const i=await Sn("open-pr",s("thread.publishDialog.failedOpenPullRequest"),()=>Du(t,e));try{await Pu(t.orgSlug,t.target,{number:i.number,commitTitle:e.title,commitMessage:e.body,coAuthor:t.coAuthor})}catch(r){throw new Aa(r instanceof Error?r.message:s("thread.publishDialog.failedMergePullRequest"),"merge",i)}return i}async function Mu(t,e){return await Tu(t),await Au(t,e.message),Du(t,e)}function F0(t,e){return t instanceof Eu?{message:e("thread.publishPopover.branchMoved"),pullRequest:null,headMoved:!0}:t instanceof Aa&&t.step==="merge"&&t.pr?{message:e("thread.publishDialog.mergeFailed",{prNumber:t.pr.number,message:t.message}),pullRequest:t.pr,headMoved:!1}:{message:t instanceof Error?t.message:e("thread.publishDialog.failedPublish"),pullRequest:null,headMoved:!1}}function Eo(t,e){const s=F0(t,e),i=s.pullRequest;return i&&Xe.error(s.message,{action:{label:e("thread.publishDialog.viewPr"),onClick:()=>window.open(i.htmlUrl,"_blank","noopener,noreferrer")}}),{message:s.message,pullRequestOpened:i!==null,headMoved:s.headMoved}}function Bu(t,e){Xe.success(e("thread.publishDialog.submittedForReview",{prNumber:t.number}),{action:{label:e("thread.publishDialog.viewOnGithub"),onClick:()=>window.open(t.htmlUrl,"_blank","noopener,noreferrer")}})}function H0(t){const{mode:e,target:s,note:i,allPaths:r,destinationHost:n,publishLockRef:o,onOpenChange:a,refresh:c,onPullRequestChanged:l,onPublished:u}=t,d=be(),[f,p]=O.useState(!1),[_,g]=O.useState(!1),[v,b]=O.useState(),k=()=>$0(i,d("thread.publishDialog.changesFrom",{branch:s.headBranch})),w=async()=>{o.current=!0,p(!0),b(void 0);try{await Nu(s,k(),d),Xe.success(n?d("thread.publishPopover.publishedTo",{host:n}):d("thread.publishDialog.publishedTo",{baseBranch:s.baseBranch})),a(!1),await Promise.all([l?.(),u?.()])}catch(x){const y=Eo(x,d);b(y.message),y.pullRequestOpened&&await l?.(),y.headMoved&&await c()}finally{o.current=!1,p(!1)}},S=async()=>{o.current=!0,p(!0),b(void 0);try{const x=await Mu(s,k());Bu(x,d),a(!1),await l?.()}catch(x){const y=Eo(x,d);b(y.message||d("thread.publishDialog.failedSubmitForReview")),y.headMoved&&await c()}finally{o.current=!1,p(!1)}},m=async(x,y)=>{g(!0);try{await Tn({orgSlug:s.orgSlug,virtualMcpId:s.virtualMcpId,branch:s.branch,threadId:s.threadId},x,{fastPreview:!0}),Xe.success(y),await c()}catch(C){Xe.error(C instanceof Error?C.message:d("thread.publishPopover.failedDiscard"))}finally{g(!1)}};return{isPublishing:f,isDiscarding:_,publishError:v,submit:e==="review"?S:w,discardChange:x=>m(x.filepaths,d("thread.publishPopover.discarded",{name:x.name})),discardAll:async()=>{r.length!==0&&await m(r,d("thread.publishDialog.allChangesDiscarded"))}}}function W0(t,e,s,i,r){return["cms-publish-bodies",t,e,s,i,r]}const U0=6e4;function K0(t,e,s){const i=H.c(6);let r;i[0]!==s||i[1]!==t||i[2]!==e?(r=ks.decofile(`${t}/${e}/${s}`),i[0]=s,i[1]=t,i[2]=e,i[3]=r):r=i[3];let n;i[4]!==r?(n={queryKey:r,queryFn:sf},i[4]=r,i[5]=n):n=i[5];const{data:o}=es(n);return o}function q0(t){const e=H.c(43),{orgSlug:s,virtualMcpId:i,branch:r,threadId:n,baseBranch:o}=t;let a,c,l,u;e[0]!==r||e[1]!==s||e[2]!==n||e[3]!==i?(c={orgSlug:s,virtualMcpId:i,branch:r,threadId:n},a={fastPreview:!0},l=rf,u=bh(c,a),e[0]=r,e[1]=s,e[2]=n,e[3]=i,e[4]=a,e[5]=c,e[6]=l,e[7]=u):(a=e[4],c=e[5],l=e[6],u=e[7]);const d=l(u),f=d.data,p=f.changedFiles??null,_=f.headSha??null,g=p?p.length>0:(f.aheadOfBase??0)>0;let v;e[8]!==o||e[9]!==r||e[10]!==_||e[11]!==s||e[12]!==i?(v=W0(s,i,r,o,_),e[8]=o,e[9]=r,e[10]=_,e[11]=s,e[12]=i,e[13]=v):v=e[13];let b;e[14]!==o||e[15]!==a||e[16]!==c?(b=()=>cr(c,{base:o},a),e[14]=o,e[15]=a,e[16]=c,e[17]=b):b=e[17];let k;e[18]!==v||e[19]!==b||e[20]!==g?(k={queryKey:v,queryFn:b,enabled:g,staleTime:U0},e[18]=v,e[19]=b,e[20]=g,e[21]=k):k=e[21];const w=es(k),S=K0(s,i,r),m=w.data??null;let x;e[22]!==S||e[23]!==m||e[24]!==p?(x=p?wu({files:p,lookup:S,diff:m}):b0(m),e[22]=S,e[23]=m,e[24]=p,e[25]=x):x=e[25];const y=x;let C;e[26]!==m?.diffs||e[27]!==p?(C=p?p.map(V0):Object.keys(m?.diffs??{}),e[26]=m?.diffs,e[27]=p,e[28]=C):C=e[28];const N=f.changedFilesTotal??y.count,T=f.changedFilesTruncated??!1,R=g&&w.isPending,E=!p&&g&&w.isPending;let P;e[29]!==d?(P=()=>d.refetch(),e[29]=d,e[30]=P):P=e[30];let A;return e[31]!==w.isError||e[32]!==m||e[33]!==_||e[34]!==f||e[35]!==y||e[36]!==E||e[37]!==P||e[38]!==C||e[39]!==N||e[40]!==T||e[41]!==R?(A={status:f,summary:y,allPaths:C,changedFilesTotal:N,changedFilesTruncated:T,headSha:_,diff:m,bodiesPending:R,bodiesFailed:w.isError,cardsPending:E,refresh:P},e[31]=w.isError,e[32]=m,e[33]=_,e[34]=f,e[35]=y,e[36]=E,e[37]=P,e[38]=C,e[39]=N,e[40]=T,e[41]=R,e[42]=A):A=e[42],A}function V0(t){return t.path}function G0(t){return["smart-review-verdict",t.orgSlug,t.virtualMcpId,t.branch,t.threadId,t.fastPreview?"fast-preview-upstream":"sandbox",t.signature,t.language]}function Y0(t){const e=H.c(28),{orgSlug:s,virtualMcpId:i,branch:r,threadId:n,fastPreview:o,status:a,diff:c,enabled:l}=t,[u]=nf(),{language:d}=u;let f,p,_;if(e[0]!==r||e[1]!==c||e[2]!==l||e[3]!==o||e[4]!==d||e[5]!==s||e[6]!==a||e[7]!==n||e[8]!==i){const m=c?Tp(c):"";f=l&&!!r&&!!a&&!!c&&m!=="",_=es,p=G0({orgSlug:s,virtualMcpId:i,branch:r,threadId:n,fastPreview:o,signature:m,language:d}),e[0]=r,e[1]=c,e[2]=l,e[3]=o,e[4]=d,e[5]=s,e[6]=a,e[7]=n,e[8]=i,e[9]=f,e[10]=p,e[11]=_}else f=e[9],p=e[10],_=e[11];let g;e[12]!==r||e[13]!==c||e[14]!==o||e[15]!==d||e[16]!==s||e[17]!==a||e[18]!==n||e[19]!==i?(g=()=>Ap({orgSlug:s,virtualMcpId:i,branch:r,threadId:n},{status:a,diff:c,language:d},o?{fastPreview:!0}:void 0),e[12]=r,e[13]=c,e[14]=o,e[15]=d,e[16]=s,e[17]=a,e[18]=n,e[19]=i,e[20]=g):g=e[20];let v;e[21]!==f||e[22]!==p||e[23]!==g?(v={queryKey:p,queryFn:g,enabled:f,staleTime:1/0,gcTime:6e5,retry:X0},e[21]=f,e[22]=p,e[23]=g,e[24]=v):v=e[24];const b=_(v),k=b.data??null,w=f&&b.isFetching&&!b.data;let S;return e[25]!==k||e[26]!==w?(S={verdict:k,loading:w},e[25]=k,e[26]=w,e[27]=S):S=e[27],S}function X0(t,e){return!Sh(e)&&t<1}function Lu(t){const e=H.c(30),{orgSlug:s,virtualMcpId:i,branch:r,threadId:n,fastPreview:o,status:a,diff:c,policy:l,judgeEnabled:u,paths:d}=t,f=u===void 0?!0:u,p=d===void 0?null:d;let _;e[0]!==c||e[1]!==f||e[2]!==l?(_=f&&Dp(c,l),e[0]=c,e[1]=f,e[2]=l,e[3]=_):_=e[3];const g=_;let v;e[4]!==r||e[5]!==c||e[6]!==o||e[7]!==g||e[8]!==s||e[9]!==a||e[10]!==n||e[11]!==i?(v={orgSlug:s,virtualMcpId:i,branch:r,threadId:n,fastPreview:o,status:a,diff:c,enabled:g},e[4]=r,e[5]=c,e[6]=o,e[7]=g,e[8]=s,e[9]=a,e[10]=n,e[11]=i,e[12]=v):v=e[12];const{verdict:b,loading:k}=Y0(v);if(!c&&p){let x;e[13]!==p||e[14]!==l?(x=Np(p,l),e[13]=p,e[14]=l,e[15]=x):x=e[15];let y;return e[16]!==x?(y={gate:x,ready:!1},e[16]=x,e[17]=y):y=e[17],y}if(!c){let x;return e[18]===Symbol.for("react.memo_cache_sentinel")?(x={gate:{allowed:!0,reason:null},ready:!1},e[18]=x):x=e[18],x}if(!g){let x;e[19]!==c||e[20]!==l?(x=Mp(c,l),e[19]=c,e[20]=l,e[21]=x):x=e[21];let y;return e[22]!==x?(y={gate:x,ready:!0},e[22]=x,e[23]=y):y=e[23],y}let w;e[24]!==k||e[25]!==b?(w=Bp(b,k),e[24]=k,e[25]=b,e[26]=w):w=e[26];const S=!k;let m;return e[27]!==w||e[28]!==S?(m={gate:w,ready:S},e[27]=w,e[28]=S,e[29]=m):m=e[29],m}const ju="(max-width: 479px)";function J0(t){const e=globalThis.matchMedia(ju);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}function Z0(){return O.useSyncExternalStore(J0,eS,Q0)}function Q0(){return!1}function eS(){return globalThis.matchMedia(ju).matches}function tS(t){const e=H.c(22),s=Z0(),i=O.useRef(!1);let r;e[0]!==t?(r=l=>{!l&&i.current||t.onOpenChange(l)},e[0]=t,e[1]=r):r=e[1];const n=r;if(s){let l;e[2]!==t?(l=t.open?h.jsx(fc,{...t,publishLockRef:i}):null,e[2]=t,e[3]=l):l=e[3];let u;e[4]!==l?(u=h.jsx(Yo,{className:"flex max-h-[85vh] w-[92vw] max-w-[420px] flex-col gap-0 overflow-hidden p-0",children:l}),e[4]=l,e[5]=u):u=e[5];let d;e[6]!==n||e[7]!==t.open||e[8]!==u?(d=h.jsx(Go,{open:t.open,onOpenChange:n,children:u}),e[6]=n,e[7]=t.open,e[8]=u,e[9]=d):d=e[9];let f;return e[10]!==t.children||e[11]!==d?(f=h.jsxs(h.Fragment,{children:[t.children,d]}),e[10]=t.children,e[11]=d,e[12]=f):f=e[12],f}let o;e[13]!==t.children?(o=h.jsx(yp,{asChild:!0,children:h.jsx("span",{className:"inline-flex",children:t.children})}),e[13]=t.children,e[14]=o):o=e[14];let a;e[15]!==t?(a=h.jsx(Fi,{align:"end",sideOffset:8,collisionPadding:12,onFocusOutside:sS,className:"flex max-h-[min(720px,85vh)] w-[420px] flex-col gap-0 overflow-hidden p-0",children:h.jsx(fc,{...t,publishLockRef:i})}),e[15]=t,e[16]=a):a=e[16];let c;return e[17]!==n||e[18]!==t.open||e[19]!==o||e[20]!==a?(c=h.jsxs(Hi,{open:t.open,onOpenChange:n,children:[o,a]}),e[17]=n,e[18]=t.open,e[19]=o,e[20]=a,e[21]=c):c=e[21],c}function sS(t){return t.preventDefault()}function Ma(t){const e=H.c(11),{mode:s,title:i,subLine:r,trailing:n}=t,o=s==="review"?jr:fh;let a;e[0]!==o?(a=h.jsx(o,{className:"size-4 shrink-0 text-muted-foreground"}),e[0]=o,e[1]=a):a=e[1];let c;e[2]!==a||e[3]!==i||e[4]!==n?(c=h.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[a,i,n]}),e[2]=a,e[3]=i,e[4]=n,e[5]=c):c=e[5];let l;e[6]!==r?(l=r?h.jsx("div",{className:"pl-6 text-xs text-muted-foreground",children:r}):null,e[6]=r,e[7]=l):l=e[7];let u;return e[8]!==c||e[9]!==l?(u=h.jsxs(h.Fragment,{children:[c,l]}),e[8]=c,e[9]=l,e[10]=u):u=e[10],u}function Ba(t){const e=H.c(9),{draftPreviewUrl:s,t:i}=t;let r;e[0]!==s?(r=()=>{s&&window.open(s,"_blank","noopener,noreferrer")},e[0]=s,e[1]=r):r=e[1];const n=!s;let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx(Xo,{className:"size-4"}),e[2]=o):o=e[2];let a;e[3]!==i?(a=i("thread.publishPopover.preview"),e[3]=i,e[4]=a):a=e[4];let c;return e[5]!==r||e[6]!==n||e[7]!==a?(c=h.jsxs(Pe,{type:"button",variant:"outline",onClick:r,disabled:n,children:[o,a]}),e[5]=r,e[6]=n,e[7]=a,e[8]=c):c=e[8],c}function iS(t){const e=H.c(20),{mode:s,draftPreviewUrl:i}=t,r=be();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=h.jsx(as,{className:"h-3.5 w-48"}),e[0]=n):n=e[0];let o;e[1]!==s?(o=h.jsx(Ma,{mode:s,title:n}),e[1]=s,e[2]=o):o=e[2];let a,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(xo,{children:h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(Pi,{}),h.jsx(Pi,{}),h.jsx(Pi,{})]})}),c=h.jsxs(h.Fragment,{children:[h.jsx(as,{className:"h-3 w-20"}),h.jsx(as,{className:"h-14 w-full rounded-lg"})]}),e[3]=a,e[4]=c):(a=e[3],c=e[4]);let l;e[5]!==i||e[6]!==r?(l=h.jsx(Ba,{draftPreviewUrl:i,t:r}),e[5]=i,e[6]=r,e[7]=l):l=e[7];const u=s==="review"?"default":"brand";let d;e[8]!==s||e[9]!==r?(d=r(s==="review"?"thread.publishPopover.submitForReview":"thread.publishPopover.publish"),e[8]=s,e[9]=r,e[10]=d):d=e[10];let f;e[11]!==u||e[12]!==d?(f=h.jsx(Pe,{type:"button",variant:u,className:"flex-1",disabled:!0,children:d}),e[11]=u,e[12]=d,e[13]=f):f=e[13];let p;e[14]!==l||e[15]!==f?(p=h.jsxs("div",{className:"flex gap-2",children:[l,f]}),e[14]=l,e[15]=f,e[16]=p):p=e[16];let _;return e[17]!==o||e[18]!==p?(_=h.jsx(xa,{state:"loading",header:o,body:a,note:c,footer:p}),e[17]=o,e[18]=p,e[19]=_):_=e[19],_}function rS(t){const e=H.c(25),{mode:s,draftPreviewUrl:i,message:r,onRetry:n}=t,o=be();let a;e[0]!==o?(a=o("thread.publishPopover.loadFailed"),e[0]=o,e[1]=a):a=e[1];let c;e[2]!==a?(c=h.jsx("span",{className:"truncate",children:a}),e[2]=a,e[3]=c):c=e[3];let l;e[4]!==s||e[5]!==c?(l=h.jsx(Ma,{mode:s,title:c}),e[4]=s,e[5]=c,e[6]=l):l=e[6];let u;e[7]!==r?(u=h.jsx("p",{className:"px-4 py-6 text-xs text-destructive",children:r}),e[7]=r,e[8]=u):u=e[8];let d;e[9]!==i||e[10]!==o?(d=h.jsx(Ba,{draftPreviewUrl:i,t:o}),e[9]=i,e[10]=o,e[11]=d):d=e[11];let f;e[12]===Symbol.for("react.memo_cache_sentinel")?(f=h.jsx(Ei,{className:"size-4"}),e[12]=f):f=e[12];let p;e[13]!==o?(p=o("thread.publishPopover.retry"),e[13]=o,e[14]=p):p=e[14];let _;e[15]!==n||e[16]!==p?(_=h.jsxs(Pe,{type:"button",variant:"outline",className:"flex-1",onClick:n,children:[f,p]}),e[15]=n,e[16]=p,e[17]=_):_=e[17];let g;e[18]!==d||e[19]!==_?(g=h.jsxs("div",{className:"flex gap-2",children:[d,_]}),e[18]=d,e[19]=_,e[20]=g):g=e[20];let v;return e[21]!==l||e[22]!==u||e[23]!==g?(v=h.jsx(xa,{state:"ready",header:l,body:u,footer:g}),e[21]=l,e[22]=u,e[23]=g,e[24]=v):v=e[24],v}function fc(t){const e=H.c(14),s=t.mode??"publish";let i;e[0]!==s||e[1]!==t.draftPreviewUrl?(i=c=>{const{error:l,resetError:u}=c;return h.jsx(rS,{mode:s,draftPreviewUrl:t.draftPreviewUrl,message:l?.message??"",onRetry:u})},e[0]=s,e[1]=t.draftPreviewUrl,e[2]=i):i=e[2];let r;e[3]!==s||e[4]!==t.draftPreviewUrl?(r=h.jsx(iS,{mode:s,draftPreviewUrl:t.draftPreviewUrl}),e[3]=s,e[4]=t.draftPreviewUrl,e[5]=r):r=e[5];let n;e[6]!==t?(n=h.jsx(nS,{...t}),e[6]=t,e[7]=n):n=e[7];let o;e[8]!==r||e[9]!==n?(o=h.jsx(O.Suspense,{fallback:r,children:n}),e[8]=r,e[9]=n,e[10]=o):o=e[10];let a;return e[11]!==i||e[12]!==o?(a=h.jsx(Li,{fallback:i,children:o}),e[11]=i,e[12]=o,e[13]=a):a=e[13],a}function nS(t){const e=H.c(160),{publishLockRef:s,onOpenChange:i,mode:r,orgSlug:n,virtualMcpId:o,branch:a,baseBranch:c,repoTarget:l,owner:u,repo:d,publishPolicy:f,draftPreviewUrl:p,destinationHost:_,lastPublishedPr:g,onRequestApproval:v,openPullRequest:b,onPullRequestChanged:k,onPublished:w}=t,S=r===void 0?"publish":r,m=g===void 0?null:g,x=b===void 0?null:b,y=be(),C=ds()?.taskId??null,{data:N}=hs.useSession();let T;e[0]!==c||e[1]!==a||e[2]!==n||e[3]!==C||e[4]!==o?(T={orgSlug:n,virtualMcpId:o,branch:a,threadId:C,baseBranch:c},e[0]=c,e[1]=a,e[2]=n,e[3]=C,e[4]=o,e[5]=T):T=e[5];const{status:R,summary:E,allPaths:P,changedFilesTotal:A,changedFilesTruncated:M,headSha:L,diff:B,bodiesPending:D,bodiesFailed:j,cardsPending:K,refresh:z}=q0(T),[G,I]=O.useState(null),[V,$]=O.useState(!1),[ee,se]=O.useState(null),[ie,Y]=O.useState(null);let Z;e[6]!==G||e[7]!==E?(Z=w0(G,k0(E)),e[6]=G,e[7]=E,e[8]=Z):Z=e[8];const X=Z,U=S==="review",J=K?"loading":D?"manifest":"ready",ae=!U;let q;e[9]!==P||e[10]!==a||e[11]!==B||e[12]!==R||e[13]!==n||e[14]!==f||e[15]!==ae||e[16]!==C||e[17]!==o?(q={orgSlug:n,virtualMcpId:o,branch:a,threadId:C,fastPreview:!0,status:R,diff:B,paths:P,policy:f,judgeEnabled:ae},e[9]=P,e[10]=a,e[11]=B,e[12]=R,e[13]=n,e[14]=f,e[15]=ae,e[16]=C,e[17]=o,e[18]=q):q=e[18];const{gate:F}=Lu(q),Q=x?.state==="open";let he;e[19]!==a||e[20]!==R?(he=Zo(R)??a,e[19]=a,e[20]=R,e[21]=he):he=e[21];const ue=N?.user;let fe;e[22]!==ue?(fe=ya(ue),e[22]=ue,e[23]=fe):fe=e[23];const ne=L??void 0;let ce;e[24]!==c||e[25]!==a||e[26]!==n||e[27]!==u||e[28]!==d||e[29]!==l||e[30]!==fe||e[31]!==ne||e[32]!==he||e[33]!==C||e[34]!==o?(ce={orgSlug:n,virtualMcpId:o,branch:a,threadId:C,fastPreview:!0,baseBranch:c,target:l,owner:u,repo:d,headBranch:he,coAuthor:fe,expectedHeadSha:ne},e[24]=c,e[25]=a,e[26]=n,e[27]=u,e[28]=d,e[29]=l,e[30]=fe,e[31]=ne,e[32]=he,e[33]=C,e[34]=o,e[35]=ce):ce=e[35];const de=ce;let le;e[36]!==P||e[37]!==_||e[38]!==S||e[39]!==X||e[40]!==i||e[41]!==w||e[42]!==k||e[43]!==s||e[44]!==z||e[45]!==de?(le={mode:S,target:de,note:X,allPaths:P,destinationHost:_,publishLockRef:s,onOpenChange:i,refresh:z,onPullRequestChanged:k,onPublished:w},e[36]=P,e[37]=_,e[38]=S,e[39]=X,e[40]=i,e[41]=w,e[42]=k,e[43]=s,e[44]=z,e[45]=de,e[46]=le):le=e[46];const{isPublishing:re,isDiscarding:ge,publishError:Ce,submit:we,discardChange:Oe,discardAll:Ue}=H0(le),Ke=!re&&E.count>0&&(U||F.allowed);let qe;e[47]!==U||e[48]!==E.count||e[49]!==y?(qe=U?E.count===0?y("thread.publishPopover.submitForReview"):E.count===1?y("thread.publishPopover.submitOneForReview"):y("thread.publishPopover.submitCountForReview",{count:E.count}):E.count===0?y("thread.publishPopover.publish"):E.count===1?y("thread.publishPopover.publishOneInProduction"):y("thread.publishPopover.publishCountInProduction",{count:E.count}),e[47]=U,e[48]=E.count,e[49]=y,e[50]=qe):qe=e[50];const ve=qe;let Ee;e:{if(U&&Q){let Te;e[51]!==x.number||e[52]!==y?(Te=y("thread.publishPopover.updatesPullRequest",{number:x.number}),e[51]=x.number,e[52]=y,e[53]=Te):Te=e[53],Ee=Te;break e}const Ne=m;if(!Ne?.mergedAt){Ee=null;break e}let Me;if(e[54]!==Ne||e[55]!==y){const Te=ph(new Date(Ne.mergedAt)),xe=I0(Ne);Me=xe?y("thread.publishPopover.lastPublishedBy",{when:Te,name:xe}):y("thread.publishPopover.lastPublished",{when:Te}),e[54]=Ne,e[55]=y,e[56]=Me}else Me=e[56];Ee=Me}const et=Ee;let Ve;e[57]!==U||e[58]!==E.count||e[59]!==y?(Ve=U?y("thread.publishPopover.submitForReview"):E.count===1?y("thread.publishPopover.publishOne"):E.count>1?y("thread.publishPopover.publishCount",{count:E.count}):y("thread.publishPopover.publish"),e[57]=U,e[58]=E.count,e[59]=y,e[60]=Ve):Ve=e[60];const pe=Ve;let Re;e[61]!==D||e[62]!==ie||e[63]!==Oe||e[64]!==ee||e[65]!==B||e[66]!==ge||e[67]!==re?(Re=(Ne,Me)=>Me.length===0?null:h.jsxs("div",{className:"space-y-1.5",children:[h.jsx("div",{className:"px-0.5 text-[11px] font-medium tracking-wider text-muted-foreground uppercase",children:Ne}),Me.map(Te=>{const xe=Cu(Te);return h.jsx(N0,{change:Te,diff:B,bodyPending:D,expanded:ee===xe,onToggleExpanded:()=>se(ee===xe?null:xe),confirming:ie===xe,onConfirmingChange:tt=>Y(tt?xe:null),onDiscard:()=>{Oe(Te)},isPublishing:re,isDiscarding:ge},xe)})]}),e[61]=D,e[62]=ie,e[63]=Oe,e[64]=ee,e[65]=B,e[66]=ge,e[67]=re,e[68]=Re):Re=e[68];const ze=Re;let _t;e:{if(U||E.count===0){_t=null;break e}if(F.pending){let xe;e[69]===Symbol.for("react.memo_cache_sentinel")?(xe=h.jsx(gt,{className:"size-3.5 motion-reduce:animate-none"}),e[69]=xe):xe=e[69];let tt;e[70]!==y?(tt=y("thread.publishPopover.reviewing"),e[70]=y,e[71]=tt):tt=e[71];let At;e[72]!==tt?(At=h.jsxs("div",{className:"flex items-center gap-2 border-t px-4 py-2.5 text-xs text-muted-foreground",children:[xe,tt]}),e[72]=tt,e[73]=At):At=e[73],_t=At;break e}if(F.allowed){_t=null;break e}let Ne;e[74]===Symbol.for("react.memo_cache_sentinel")?(Ne=h.jsx(Ic,{className:"mt-0.5 size-3.5 shrink-0"}),e[74]=Ne):Ne=e[74];let Me;e[75]!==F.reason||e[76]!==y?(Me=F.reason??y("thread.publishPopover.needsReviewGeneric"),e[75]=F.reason,e[76]=y,e[77]=Me):Me=e[77];let Te;e[78]!==Me?(Te=h.jsxs("div",{className:"flex items-start gap-2 border-t px-4 py-2.5 text-xs text-warning",children:[Ne,h.jsx("span",{children:Me})]}),e[78]=Me,e[79]=Te):Te=e[79],_t=Te}const _s=_t;let ms;e:{if(E.count<=1||M){ms=null;break e}if(V){let tt;e[80]!==y?(tt=y("thread.publishPopover.discardAllConfirm"),e[80]=y,e[81]=tt):tt=e[81];let At;e[82]!==tt?(At=h.jsx("span",{className:"text-destructive",children:tt}),e[82]=tt,e[83]=At):At=e[83];let Us;e[84]===Symbol.for("react.memo_cache_sentinel")?(Us=()=>$(!1),e[84]=Us):Us=e[84];let zt;e[85]!==y?(zt=y("thread.publishDialog.cancel"),e[85]=y,e[86]=zt):zt=e[86];let $t;e[87]!==zt?($t=h.jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground",onClick:Us,children:zt}),e[87]=zt,e[88]=$t):$t=e[88];let $e;e[89]!==Ue?($e=()=>{$(!1),Ue()},e[89]=Ue,e[90]=$e):$e=e[90];let Ft;e[91]!==y?(Ft=y("thread.publishPopover.discard"),e[91]=y,e[92]=Ft):Ft=e[92];let Ht;e[93]!==ge||e[94]!==$e||e[95]!==Ft?(Ht=h.jsx("button",{type:"button",className:"font-medium text-destructive disabled:opacity-50",onClick:$e,disabled:ge,children:Ft}),e[93]=ge,e[94]=$e,e[95]=Ft,e[96]=Ht):Ht=e[96];let ss;e[97]!==At||e[98]!==$t||e[99]!==Ht?(ss=h.jsxs("span",{className:"ml-auto flex shrink-0 items-center gap-1.5 text-[11px]",children:[At,$t,Ht]}),e[97]=At,e[98]=$t,e[99]=Ht,e[100]=ss):ss=e[100],ms=ss;break e}let Ne;e[101]===Symbol.for("react.memo_cache_sentinel")?(Ne=()=>$(!0),e[101]=Ne):Ne=e[101];const Me=re||ge;let Te;e[102]!==y?(Te=y("thread.publishPopover.discardAll"),e[102]=y,e[103]=Te):Te=e[103];let xe;e[104]!==Me||e[105]!==Te?(xe=h.jsx("button",{type:"button",className:"ml-auto shrink-0 text-[11px] text-muted-foreground transition-colors hover:text-destructive disabled:opacity-50",onClick:Ne,disabled:Me,children:Te}),e[104]=Me,e[105]=Te,e[106]=xe):xe=e[106],ms=xe}const Ps=ms;let ts;e[107]!==j||e[108]!==K||e[109]!==A||e[110]!==M||e[111]!==U||e[112]!==ze||e[113]!==E.blocks||e[114]!==E.count||e[115]!==E.other||e[116]!==E.pages||e[117]!==y?(ts=K?h.jsx(xo,{children:h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(Pi,{}),h.jsx(Pi,{})]})}):E.count===0?h.jsxs("div",{className:"flex flex-col items-center gap-1 py-10 text-center",children:[h.jsx(jo,{className:"mb-1 size-5 text-success"}),h.jsx("p",{className:"text-sm font-medium",children:y(U?"thread.publishPopover.nothingToSubmit":"thread.publishPopover.everythingLive")}),h.jsx("p",{className:"text-xs text-muted-foreground",children:y(U?"thread.publishPopover.submitEmptyHint":"thread.publishPopover.emptyHint")})]}):h.jsxs(xo,{children:[M?h.jsx("p",{className:"text-[11px] text-muted-foreground",children:y("thread.publishPopover.showingFirst",{shown:E.count,total:A})}):null,ze(y("thread.publishPopover.pagesGroup"),E.pages),ze(y("thread.publishPopover.blocksGroup"),E.blocks),ze(y("thread.publishPopover.otherGroup"),E.other),j?h.jsx("p",{className:"text-[11px] text-muted-foreground",children:y("thread.publishPopover.detailsUnavailable")}):null]}),e[107]=j,e[108]=K,e[109]=A,e[110]=M,e[111]=U,e[112]=ze,e[113]=E.blocks,e[114]=E.count,e[115]=E.other,e[116]=E.pages,e[117]=y,e[118]=ts):ts=e[118];const Kt=ts;let xt;e[119]!==ve?(xt=h.jsx("span",{className:"truncate",children:ve}),e[119]=ve,e[120]=xt):xt=e[120];let wt;e[121]!==Ps||e[122]!==S||e[123]!==et||e[124]!==xt?(wt=h.jsx(Ma,{mode:S,title:xt,subLine:et,trailing:Ps}),e[121]=Ps,e[122]=S,e[123]=et,e[124]=xt,e[125]=wt):wt=e[125];let Ct;e[126]!==re||e[127]!==U||e[128]!==X||e[129]!==E.count||e[130]!==y?(Ct=E.count===0?null:h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-[13px] font-medium",children:y(U?"thread.publishPopover.reviewNote":"thread.publishPopover.versionNote")}),h.jsx(uh,{value:X,onChange:Ne=>I(Ne.target.value),placeholder:y(U?"thread.publishPopover.reviewNotePlaceholder":"thread.publishPopover.versionNotePlaceholder"),rows:2,className:"resize-none text-[13px]",disabled:re})]}),e[126]=re,e[127]=U,e[128]=X,e[129]=E.count,e[130]=y,e[131]=Ct):Ct=e[131];let kt;e[132]!==p||e[133]!==y?(kt=h.jsx(Ba,{draftPreviewUrl:p,t:y}),e[132]=p,e[133]=y,e[134]=kt):kt=e[134];let Pt;e[135]!==Ke||e[136]!==F||e[137]!==re||e[138]!==U||e[139]!==v||e[140]!==pe||e[141]!==we||e[142]!==E.count||e[143]!==y?(Pt=!U&&E.count>0&&!F.allowed&&!F.pending?h.jsx(Pe,{type:"button",className:"flex-1",onClick:v,disabled:re,children:y("thread.publishPopover.requestApproval")}):h.jsxs(Pe,{type:"button",variant:U?"default":"brand",className:"flex-1",onClick:()=>{we()},disabled:!Ke,children:[re?h.jsx(gt,{className:"size-4 motion-reduce:animate-none"}):null,re?y(U?"thread.publishPopover.submitting":"thread.publishPopover.publishing"):pe]}),e[135]=Ke,e[136]=F,e[137]=re,e[138]=U,e[139]=v,e[140]=pe,e[141]=we,e[142]=E.count,e[143]=y,e[144]=Pt):Pt=e[144];let Et;e[145]!==kt||e[146]!==Pt?(Et=h.jsxs("div",{className:"flex gap-2",children:[kt,Pt]}),e[145]=kt,e[146]=Pt,e[147]=Et):Et=e[147];let Rt;e[148]!==Ce?(Rt=Ce?h.jsx("p",{className:"text-xs text-destructive",children:Ce}):null,e[148]=Ce,e[149]=Rt):Rt=e[149];let Tt;e[150]!==Et||e[151]!==Rt?(Tt=h.jsxs(h.Fragment,{children:[Et,Rt]}),e[150]=Et,e[151]=Rt,e[152]=Tt):Tt=e[152];let Ot;return e[153]!==Kt||e[154]!==_s||e[155]!==J||e[156]!==wt||e[157]!==Ct||e[158]!==Tt?(Ot=h.jsx(xa,{state:J,header:wt,body:Kt,note:Ct,gate:_s,footer:Tt}),e[153]=Kt,e[154]=_s,e[155]=J,e[156]=wt,e[157]=Ct,e[158]=Tt,e[159]=Ot):Ot=e[159],Ot}const oS={claiming:{long:"Reserving sandbox",short:"Reserving sandbox"},"waiting-for-capacity":{long:"Waiting for cluster capacity",short:"Waiting for capacity"},"pulling-image":{long:"Downloading sandbox image",short:"Downloading image"},"starting-container":{long:"Starting your sandbox",short:"Starting container"},"warming-daemon":{long:"Connecting to your sandbox",short:"Connecting to sandbox"}};function aS(){return!1}function Iu(t,e){aS()&&console.log(`[github-header] ${t}`,e??"")}function lS(t){if(!(t==="claiming"||t==="ready"||t==="failed"))return oS[t].short}const cS=new Set(["failure","timed_out","cancelled","action_required"]);function Ou(t){return t.status==="completed"&&cS.has(t.conclusion)}function La(t){return t.status==="queued"||t.status==="in_progress"}function vr(t){return t.isPending&&t.fetchStatus!=="idle"}function hS(t){return{key:"view-on-github",label:t("thread.cmsActions.viewOnGithub"),action:"open-pr-page"}}function rs(t,e,s){return e?[...t,hS(s)]:t}function Wt(t,e,s){return e.kind!=="ready"||e.behindBase<=0?t:[...t,{key:"get-latest",label:s("thread.cmsActions.getLatest"),action:"sync",tooltip:s("thread.cmsActions.getLatestTooltip")}]}function pc(t){return{key:"submit-for-review",label:t("thread.headerActions.submitForReview"),action:"create-pr"}}function or(t,e,s){if(e.filter(La).length===0)return t;const r=e.filter(n=>n.status==="completed").length;return{...t,tooltip:s("thread.cmsActions.checksRunning",{done:r,total:e.length})}}function dS(t){const{lifecycle:e,branch:s,pr:i,checks:r,reviews:n,loading:o,t:a}=t;if(o)return{label:a("thread.headerActions.loading"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.loadingBranchTooltip"),menu:[]};switch(e.phase){case"idle":return{label:t.claimPhase&&lS(t.claimPhase.kind)||a("thread.headerActions.startingSandbox"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.waitingForDaemonTooltip"),menu:[]};case"cloning":return{label:a("thread.headerActions.cloningRepo"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.cloningRepoTooltip"),menu:[]};case"clone-failed":return{label:a("thread.headerActions.cloneFailed"),disabled:!0,variant:"outline",tooltip:e.error||a("thread.headerActions.cloneFailedDefaultTooltip"),menu:[]};case"checking-out":return{label:a("thread.headerActions.switchingTo",{branch:e.to}),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.checkingOutTooltip",{branch:e.to}),menu:[]};case"installing":return{label:a("thread.headerActions.installingPackages"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.installingPackagesTooltip"),menu:[]};case"starting":{if(!(s.kind==="ready"&&(s.workingTreeDirty||s.aheadOfBase>0||s.unpushed>0))&&!t.noReviewableDiff)return{label:a("thread.headerActions.startingApp"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.startingAppTooltip"),menu:[]};break}}if(s.kind!=="ready")return{label:a("thread.headerActions.loadingBranch"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.waitingForBranchTooltip"),menu:[]};const c=s,l=c.unpushed>0&&!(i&&c.headSha&&i.headSha&&c.headSha===i.headSha);if(t.noReviewableDiff&&!i)return{label:a("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:a("thread.headerActions.branchInSyncTooltip",{base:c.base}),menu:Wt([],c,a)};if(c.workingTreeDirty||l)return{label:a("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:Wt(rs([pc(a)],i,a),c,a)};if(Iu("no local work — checking PR/sync state",{workingTreeDirty:c.workingTreeDirty,unpushed:c.unpushed,aheadOfBase:c.aheadOfBase,behindBase:c.behindBase,branch:c.branch,base:c.base,prMerged:i?.merged??null,prState:i?.state??null}),i?.merged)return!!c.headSha&&!!i.headSha&&c.headSha!==i.headSha?{label:a("thread.headerActions.continue"),action:"create-pr",variant:"special",tooltip:a("thread.headerActions.openNewPrTooltip"),menu:Wt(rs([],i,a),c,a)}:{label:a("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:a("thread.headerActions.prMergedTooltip",{prNumber:String(i.number),base:i.base}),menu:Wt(rs([],i,a),c,a)};if(c.aheadOfBase>0){if(i&&i.state==="closed"&&!i.merged)return{label:a("thread.headerActions.reopenPr"),action:"reopen",variant:"default",tooltip:a("thread.headerActions.reopenPrTooltip",{prNumber:String(i.number)}),menu:Wt(rs([],i,a),c,a)};if(!i)return{label:a("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:Wt([pc(a)],c,a)};if((n?.mergeableState??"unknown")==="dirty")return{label:a("thread.cmsActions.getLatest"),action:"rebase",variant:"default",tooltip:a("thread.cmsActions.getLatestTooltip"),menu:[{key:"resolve-on-github",label:a("thread.cmsActions.resolveOnGithub"),action:"open-pr-page"}]};const d=r.filter(La).length,f=r.filter(Ou).map(_=>_.name);if(d===0&&f.length>0)return{label:a("thread.headerActions.fixChecks"),action:"fix-checks",variant:"default",tooltip:a("thread.headerActions.failingChecksTooltip",{checks:f.join(", ")}),meta:{failingChecks:f},menu:Wt(rs([{key:"publish-anyway",label:a("thread.headerActions.publishAnyway"),action:"merge",tooltip:a("thread.headerActions.squashMergeTooltip",{prNumber:String(i.number),base:i.base})}],i,a),c,a)};if(n?.draft)return or({label:a("thread.headerActions.markReady"),action:"mark-ready",variant:"default",tooltip:a("thread.headerActions.markDraftReadyTooltip"),menu:Wt(rs([],i,a),c,a)},r,a);const p=n?.unresolvedConversations??0;return p>0?or({label:a("thread.headerActions.addressFeedback"),action:"resolve-comments",variant:"default",tooltip:a("thread.headerActions.unresolvedConversationsTooltip",{count:String(p)}),menu:Wt(rs([],i,a),c,a)},r,a):n?.missingRequiredApprovals?or({label:a("thread.cmsActions.waitingForReview"),action:"open-pr-page",variant:"outline",tooltip:a("thread.headerActions.waitingForApprovalsTooltip"),menu:Wt(rs([],i,a),c,a)},r,a):or({label:a("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",meta:{publishPolicyOverride:"open"},menu:Wt(rs([{key:"review",label:a("thread.headerActions.review"),action:"review"}],i,a),c,a)},r,a)}return c.behindBase>0?{label:a("thread.cmsActions.getLatest"),action:"sync",variant:"default",tooltip:a("thread.cmsActions.getLatestTooltip"),menu:[]}:{label:a("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:a("thread.headerActions.branchInSyncTooltip",{base:c.base}),menu:[]}}function _c(t){return{key:"view-on-github",label:t("thread.cmsActions.viewOnGithub"),action:"open-pr"}}function ar(t,e,s){return e.kind!=="ready"||e.behindBase<=0?t:[...t,{key:"get-latest",label:s("thread.cmsActions.getLatest"),action:"get-latest",tooltip:s("thread.cmsActions.getLatestTooltip")}]}function mc(t,e,s,i){const r=e.length;if(r===0)return t;if(e.filter(La).length>0){const a=e.filter(l=>l.status==="completed").length,c=i("thread.cmsActions.checksRunning",{done:a,total:r});return s==="loading"?{...t,loading:!0,tooltip:c}:{...t,tooltip:c}}const o=e.filter(Ou).length;return o>0?{...t,variant:"warning",tooltip:i("thread.cmsActions.checksFailing",{failed:o,total:r})}:t}function uS(t,e){return!!(t?.merged&&t.headSha&&e.kind==="ready"&&!e.workingTreeDirty&&e.headSha===t.headSha)}function fS(t){return vr(t.prQuery)?!0:t.pr?.state!=="open"||t.pr.merged?!1:vr(t.checksQuery)||vr(t.reviewsQuery)}function pS(t,e){return t.workingTreeDirty?!0:e!==null?e>0:t.aheadOfBase>0}function _S(t){const{branch:e,pr:s,checks:i,reviews:r,publishing:n,saving:o,loading:a,publishableChangeCount:c,t:l}=t;if(e.kind!=="ready"&&t.statusError)return{label:l("thread.cmsActions.retry"),action:"retry-status",variant:"outline",disabled:t.statusRetrying,loading:t.statusRetrying,tooltip:t.statusError,menu:[]};if(a||e.kind!=="ready")return{label:l("thread.headerActions.loading"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(n)return{label:l("thread.cmsActions.publishing"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(t.syncing)return{label:l("thread.cmsActions.gettingLatest"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(o)return{label:l("thread.headerActions.saving"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(s&&s.state==="open"&&!s.merged?s:null){const d=r?.mergeableState??"unknown";return d==="dirty"?{label:l("thread.cmsActions.getLatest"),action:"get-latest",variant:"default",tooltip:l("thread.cmsActions.getLatestTooltip"),menu:[{key:"resolve-on-github",label:l("thread.cmsActions.resolveOnGithub"),action:"open-pr"}]}:d==="blocked"||r?.draft?mc({label:l("thread.cmsActions.waitingForReview"),action:"open-pr",variant:"outline",menu:ar([_c(l)],e,l)},i,"loading",l):mc({label:l("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:ar([_c(l)],e,l)},i,"none",l)}return uS(s,e)?{label:l("thread.headerActions.upToDate"),variant:"outline",disabled:!0,menu:ar([],e,l)}:pS(e,c)?{label:l("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:ar([{key:"request-approval",label:l("thread.headerActions.submitForReview"),action:"request-approval"}],e,l)}:e.behindBase>0?{label:l("thread.cmsActions.getLatest"),action:"get-latest",variant:"default",tooltip:l("thread.cmsActions.getLatestTooltip"),menu:[]}:{label:l("thread.headerActions.upToDate"),variant:"outline",disabled:!0,menu:[]}}function mS(t){return t.conflicting===!0?"dirty":t.conflicting===null?"unknown":t.reviewBlocked||t.unresolvedConversations>0?"blocked":"clean"}function zu(t){const e=H.c(4);let s;e[0]!==t?(s=qf(t),e[0]=t,e[1]=s):s=e[1];let i;return e[2]!==s?(i={...s,select:gS},e[2]=s,e[3]=i):i=e[3],es(i)}function gS(t){const e=t.changeRequest;return e?{draft:e.draft,mergeableState:mS(e),unresolvedConversations:e.unresolvedConversations,missingRequiredApprovals:e.reviewBlocked}:null}function gc(t,e){return t==="open-pr"||e==="resolve-on-github"?h.jsx(dh,{size:16}):t==="publish"?h.jsx(Hc,{className:"size-4"}):t==="get-latest"||t==="retry-status"?h.jsx(Ei,{className:"size-4"}):h.jsx(jr,{className:"size-4"})}function vS(t){const e=H.c(62),{virtualMcpId:s}=t,i=be(),{org:r}=ut(),n=Lc(),o=us(s),{data:a}=hs.useSession(),{deleteRelease:c}=Fr(s),{currentBranch:l,setCurrentTaskBranch:u,taskId:d,createTask:f}=zi();let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={open:!1,mode:"publish"},e[0]=p):p=e[0];const[_,g]=O.useState(p);let v;e[1]===Symbol.for("react.memo_cache_sentinel")?(v=re=>g({open:!0,mode:re}),e[1]=v):v=e[1];const b=v,k=th(o),w=k.status==="attached"||k.status==="public-clone"?k.repo:null,{previewServerUrl:S}=ni(s);let m;if(e[2]!==l||e[3]!==r.slug||e[4]!==s){const re=l?Kb(Wb(r.slug,s,l)):null;m=re?Hb(re.path,re.params):"/",e[2]=l,e[3]=r.slug,e[4]=s,e[5]=m}else m=e[5];const x=m;let y;e[6]!==l||e[7]!==x||e[8]!==r.slug||e[9]!==S||e[10]!==s?(y=l?{orgSlug:r.slug,virtualMcpId:s,branch:l,previewServerUrl:S,path:x}:null,e[6]=l,e[7]=x,e[8]=r.slug,e[9]=S,e[10]=s,e[11]=y):y=e[11];const C=zb(y);let N;e[12]!==l||e[13]!==r.slug||e[14]!==d||e[15]!==s?(N=bh({orgSlug:r.slug,virtualMcpId:s,branch:l??"",threadId:d??null},{fastPreview:!0}),e[12]=l,e[13]=r.slug,e[14]=d,e[15]=s,e[16]=N):N=e[16];const T=!!l;let R;e[17]!==N||e[18]!==T?(R={...N,enabled:T},e[17]=N,e[18]=T,e[19]=R):R=e[19];const E=es(R),P=E.data??null,A=P?{kind:"ready",branch:Zo(P)??l??"",base:P.base??"main",workingTreeDirty:Lp(P),unpushed:P.unpushed??0,aheadOfBase:P.aheadOfBase??0,behindBase:P.behindBase??0,headSha:P.headSha??""}:{kind:"unknown"},M=P?.changedFiles?wu({files:P.changedFiles}).count:null,L=(A.kind==="ready"?A.branch:null)??l??null,B=A.kind==="ready"?A.base:"main",D=qc({orgId:r.id,orgSlug:r.slug,target:Ut(w),owner:w?.owner??"",repo:w?.name??"",branch:L}),j=D.data??null,K=Vf({orgId:r.id,orgSlug:r.slug,target:Ut(w),owner:w?.owner??"",repo:w?.name??"",base:B}),z=Vc({orgId:r.id,orgSlug:r.slug,target:Ut(w),owner:w?.owner??"",repo:w?.name??"",branch:L}),G=zu({orgId:r.id,orgSlug:r.slug,target:Ut(w),owner:w?.owner??"",repo:w?.name??"",branch:L});let I;e[20]!==z||e[21]!==j||e[22]!==D||e[23]!==G?(I=fS({pr:j,prQuery:D,checksQuery:z,reviewsQuery:G}),e[20]=z,e[21]=j,e[22]=D,e[23]=G,e[24]=I):I=e[24];const V=I;let $;e[25]!==D?($=async()=>{await D.refetch()},e[25]=D,e[26]=$):$=e[26];const ee=$,se=Pn({mutationFn:async()=>{const re=l;await u(ti(ta(a?.user))),re&&re!==B&&await c(re)},onError:yS});let ie;e[27]!==r.slug||e[28]!==d||e[29]!==s?(ie=async re=>(await vh({orgSlug:r.slug,virtualMcpId:s,branch:re.branch,threadId:d??null},re.base,{fastPreview:!0}),re),e[27]=r.slug,e[28]=d,e[29]=s,e[30]=ie):ie=e[30];let Y;e[31]!==l||e[32]!==r.slug||e[33]!==n||e[34]!==i||e[35]!==d||e[36]!==s?(Y=async re=>{Xe.success(i("thread.headerActions.syncedWithBase",{base:re.base})),await Promise.all([n.invalidateQueries({queryKey:xh({orgSlug:r.slug,virtualMcpId:s,branch:l??re.branch,threadId:d??null})}),n.invalidateQueries({queryKey:ks.decofile(`${r.slug}/${s}/${re.branch}`)})])},e[31]=l,e[32]=r.slug,e[33]=n,e[34]=i,e[35]=d,e[36]=s,e[37]=Y):Y=e[37];let Z;e[38]!==ie||e[39]!==Y?(Z={mutationFn:ie,onSuccess:Y,onError:SS},e[38]=ie,e[39]=Y,e[40]=Z):Z=e[40];const X=Pn(Z),U=Qd(r.slug,s,l??"");if(k.status==="detached"){let re;e[41]!==i?(re=i("thread.headerActions.reconnectGithub"),e[41]=i,e[42]=re):re=e[42];let ge;e[43]!==re?(ge=h.jsx(Je,{asChild:!0,children:h.jsx("span",{children:h.jsx(Pe,{size:"sm",variant:"outline",disabled:!0,children:re})})}),e[43]=re,e[44]=ge):ge=e[44];let Ce;e[45]!==i?(Ce=i("thread.headerActions.githubConnectionRemoved"),e[45]=i,e[46]=Ce):Ce=e[46];let we;e[47]!==Ce?(we=h.jsx(Ze,{children:Ce}),e[47]=Ce,e[48]=we):we=e[48];let Oe;return e[49]!==ge||e[50]!==we?(Oe=h.jsx(Oi,{children:h.jsxs(Qe,{children:[ge,we]})}),e[49]=ge,e[50]=we,e[51]=Oe):Oe=e[51],Oe}if(!o)return null;if(!w||!S){const re=w?"noPreviewServer":"noRepo";let ge;e[52]!==l||e[53]!==f?(ge=l?()=>{const we=f?.({runtime:"sandbox",branch:l});we&&Cs("coding_session_started",{thread_id:we})}:void 0,e[52]=l,e[53]=f,e[54]=ge):ge=e[54];let Ce;return e[55]!==re||e[56]!==ge?(Ce=h.jsx(xS,{reason:re,onStartCodingSession:ge}),e[55]=re,e[56]=ge,e[57]=Ce):Ce=e[57],Ce}if(!l)return null;const J=se.isPending,ae=_S({branch:A,pr:j,checks:z.data??[],reviews:G.data??null,publishing:J,saving:U,syncing:X.isPending,statusRetrying:E.isFetching&&!!E.error,statusError:E.error instanceof Error?E.error.message:E.error?String(E.error):null,loading:!!V,publishableChangeCount:M,t:i}),q=re=>{switch(re){case"publish":{b("publish");return}case"request-approval":{b("review");return}case"get-latest":{if(!L||X.isPending)return;X.mutate({branch:L,base:B});return}case"retry-status":{E.refetch();return}case"open-pr":{j?.htmlUrl&&window.open(j.htmlUrl,"_blank","noopener,noreferrer");return}}},F=ae.menu.map(re=>({key:re.key,label:re.label,icon:gc(re.action,re.key),...re.tooltip?{tooltip:re.tooltip}:{},onSelect:()=>q(re.action)})),Q=ae.action,he=ae.label,ue=ae.variant,fe=!!ae.loading;let ne;e[58]!==i?(ne=i("thread.cmsActions.moreActionsAriaLabel"),e[58]=i,e[59]=ne):ne=e[59];const ce=h.jsx(Zd,{size:"sm",label:he,variant:ue,disabled:!!ae.disabled||!Q,loading:fe,...Q&&!ae.loading?{icon:gc(Q)}:{},...ae.tooltip?{tooltip:ae.tooltip}:{},items:F,menuAriaLabel:ne,onClick:Q?()=>q(Q):void 0}),de=l?h.jsx(tS,{open:_.open,mode:_.mode,onOpenChange:re=>{re||g(bS)},orgSlug:r.slug,orgId:r.id,virtualMcpId:s,branch:l,baseBranch:B,repoTarget:Ut(w),owner:w.owner,repo:w.name,publishPolicy:yh(o?.metadata?.publishPolicy),draftPreviewUrl:C.url,destinationHost:C.host,lastPublishedPr:K.data??null,onRequestApproval:()=>b("review"),openPullRequest:j?.state==="open"?j:null,onPullRequestChanged:ee,onPublished:()=>se.mutateAsync(),children:ce}):ce;let le;return e[60]!==de?(le=h.jsx(h.Fragment,{children:de}),e[60]=de,e[61]=le):le=e[61],le}function bS(t){return{...t,open:!1}}function SS(t){Xe.error(t instanceof Error?t.message:String(t))}function yS(t){Xe.error(t instanceof Error?t.message:String(t))}function xS(t){const e=H.c(14),{reason:s,onStartCodingSession:i}=t,r=be(),n=!i;let o;e[0]!==r?(o=r("sandbox.cmsUnavailable.startCodingSession"),e[0]=r,e[1]=o):o=e[1];let a;e[2]!==i||e[3]!==n||e[4]!==o?(a=h.jsx(Je,{asChild:!0,children:h.jsx("span",{children:h.jsx(Pe,{size:"sm",variant:"outline",disabled:n,onClick:i,children:o})})}),e[2]=i,e[3]=n,e[4]=o,e[5]=a):a=e[5];let c;e[6]!==s||e[7]!==r?(c=r(s==="noPreviewServer"?"sandbox.cmsUnavailable.noPreviewServer":"sandbox.cmsUnavailable.noRepo"),e[6]=s,e[7]=r,e[8]=c):c=e[8];let l;e[9]!==c?(l=h.jsx(Ze,{children:c}),e[9]=c,e[10]=l):l=e[10];let u;return e[11]!==a||e[12]!==l?(u=h.jsx(Oi,{children:h.jsxs(Qe,{children:[a,l]})}),e[11]=a,e[12]=l,e[13]=u):u=e[13],u}const wS=new Set(["main","master"]);function CS(t,e){return wS.has(t.trim().toLowerCase())?e("thread.headerActions.publishToProduction"):e("thread.headerActions.publish")}function kS(t){const e=H.c(10),[s,i]=O.useState(0);let r;e[0]!==t?(r=c=>{c&&i(PS),t.onOpenChange(c)},e[0]=t,e[1]=r):r=e[1];const n=r;let o;e[2]!==n||e[3]!==t||e[4]!==s?(o=t.open?h.jsx(ES,{...t,onOpenChange:n},s):null,e[2]=n,e[3]=t,e[4]=s,e[5]=o):o=e[5];let a;return e[6]!==n||e[7]!==t.open||e[8]!==o?(a=h.jsx(Go,{open:t.open,onOpenChange:n,children:o}),e[6]=n,e[7]=t.open,e[8]=o,e[9]=a):a=e[9],a}function PS(t){return t+1}function ES({onOpenChange:t,orgSlug:e,orgId:s,virtualMcpId:i,branch:r,baseBranch:n,repoTarget:o,owner:a,repo:c,previewUrl:l,publishPolicy:u,dialogIntent:d="open-pr",headSha:f=null,openPullRequest:p=null,onPullRequestChanged:_,onPublished:g}){const v=be(),b=Jp({connectionId:of,orgId:s,orgSlug:e}),{data:k}=hs.useSession(),w=Zf(b),S={orgSlug:e,virtualMcpId:i,branch:r,threadId:ds()?.taskId??null},m=ya(k?.user),x=p?.state==="open",y=d==="open-pr"&&!x,C=d==="publish-only",[N,T]=O.useState(null),[R,E]=O.useState(null),[P,A]=O.useState(!0),[M,L]=O.useState(!1),[B,D]=O.useState(""),[j,K]=O.useState(""),[z,G]=O.useState(),[I,V]=O.useState(!1),[$,ee]=O.useState(),[se,ie]=O.useState(!1),[Y,Z]=O.useState(!1),[X,U]=O.useState(!1),J=O.useRef(!1),ae=O.useRef(!1),q={base:n,...f?{headSha:f}:{}},F=async pe=>{const Re=(pe.aheadOfBase??0)>0?await cr(S,q):null,ze=$p(pe)?await cr(S):null;return Fp(Re,ze)},Q=async()=>{const pe=await wi(S),Re=C?await F(pe):await cr(S,zp(pe,{openPrFromCommits:y,commitToOpenPr:x})?q:void 0);T(pe),E(Re),D(v("thread.publishDialog.changesFrom",{branch:pe.current??r})),U(!0),$a(S,{status:pe,diff:Re}).then(ze=>{D(ze.title),K(ze.body)}).catch(()=>{}).finally(()=>U(!1))};J.current||(J.current=!0,(async()=>{A(!0),G(void 0),E(null),D(""),K(""),ee(void 0);try{await Q()}catch(pe){if(Sh(pe)&&!ae.current){ae.current=!0;try{await w.mutateAsync({virtualMcpId:i,branch:r}),await Q();return}catch(Re){G(Re instanceof Error?Re.message:v("thread.publishDialog.failedLoadAfterReprovision"));return}}G(pe instanceof Error?pe.message:v("thread.publishDialog.failedLoad"))}finally{A(!1)}})());const he=Zo(N)??r,ue=CS(n,v),fe=()=>{!N||!R||(U(!0),$a(S,{status:N,diff:R}).then(pe=>{D(pe.title),K(pe.body)}).catch(()=>{}).finally(()=>U(!1)))},ne=jp(N),ce=R?Object.keys(R.diffs).length:ne,{gate:de}=Lu({orgSlug:e,virtualMcpId:i,branch:r,threadId:S.threadId,status:N,diff:R,policy:u,judgeEnabled:C}),le=y?Ip(N):Op(N,R),re=!P&&(le||y),ge=re&&de.allowed,Ce=!re||de.allowed?null:de.pending?v("thread.publishDialog.reviewingChanges"):de.reason??v("thread.publishDialog.publishNeedsReview"),we=y||!x&&(N?.aheadOfBase??0)>0,Oe=!P&&(we||le)&&(ce>0||le),Ue={orgSlug:e,virtualMcpId:i,branch:r,threadId:S.threadId,baseBranch:n,target:o,owner:a,repo:c,headBranch:he,coAuthor:m,expectedHeadSha:f??void 0},Ke=()=>Ru({title:B,body:j,fallbackTitle:v("thread.publishDialog.changesFrom",{branch:he})}),qe=pe=>{M||I||t(pe)},ve=async()=>{L(!0),G(void 0);try{await Nu(Ue,Ke(),v),Xe.success(v("thread.publishDialog.publishedTo",{baseBranch:n})),qe(!1),E(null),D(""),K(""),await _?.(),await g?.()}catch(pe){const Re=Eo(pe,v);G(Re.message),Re.pullRequestOpened&&await _?.()}finally{L(!1)}},Ee=async pe=>{try{await Tn(S,[pe]),Xe.success(v("thread.publishDialog.discardedChanges",{filepath:pe})),E(ze=>{if(!ze)return ze;const _t={...ze,diffs:{...ze.diffs}};return delete _t.diffs[pe],_t});const Re=await wi(S);T(Re)}catch(Re){Xe.error(Re instanceof Error?Re.message:v("thread.publishDialog.failedDiscardChanges"))}},et=async()=>{if(R){ie(!1),Z(!0);try{const pe=Object.keys(R.diffs);if(pe.length===0)return;await Tn(S,pe),Xe.success(v("thread.publishDialog.allChangesDiscarded")),E(null);const Re=await wi(S);T(Re),qe(!1)}catch(pe){Xe.error(pe instanceof Error?pe.message:v("thread.publishDialog.failedDiscardChanges"))}finally{Z(!1)}}},Ve=async()=>{V(!0),ee(void 0);try{const pe=await Mu(Ue,Ke());Bu(pe,v),qe(!1),await _?.()}catch(pe){ee(pe instanceof Error?pe.message:v("thread.publishDialog.failedSubmitForReview"))}finally{V(!1)}};return h.jsx(Yo,{className:"top-14 left-auto right-4 flex h-[90%] max-h-[85vh] w-[90vw] max-w-[600px] translate-x-0 translate-y-0 flex-col gap-0 overflow-hidden p-0",children:h.jsxs(wh,{defaultValue:"description",className:"flex h-full flex-col gap-0",children:[h.jsxs("div",{className:"shrink-0 space-y-3 px-6 pt-5 pb-4",children:[h.jsxs("div",{className:"space-y-1",children:[h.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:y?v("thread.publishDialog.submitForReview"):ue}),h.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[h.jsx("span",{className:"inline-block h-2.5 w-2.5 shrink-0 rounded-full bg-success"}),ce," ",v(ce===1?"thread.publishDialog.change":"thread.publishDialog.changes")," ",v(y?"thread.publishDialog.inThisPr":"thread.publishDialog.toPublish")]})]}),se?h.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md bg-destructive/5 px-3 py-2",children:[h.jsx("span",{className:"text-xs text-destructive",children:v("thread.publishDialog.discardConfirmMessage")}),h.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[h.jsx(Pe,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>ie(!1),children:v("thread.publishDialog.cancel")}),h.jsxs(Pe,{type:"button",size:"sm",className:"h-7 bg-destructive px-2 text-xs text-destructive-foreground hover:bg-destructive/90",onClick:et,disabled:Y,children:[Y?h.jsx(gt,{className:"h-3 w-3"}):null,v("thread.publishDialog.discardAll")]})]})]}):h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs(Ch,{className:"h-8 w-auto",variant:"pill",children:[h.jsx(wr,{value:"description",className:"px-3 text-xs",children:v("thread.publishDialog.description")}),h.jsx(wr,{value:"changes",className:"px-3 text-xs",children:v("thread.publishDialog.changesTab")})]}),ce>0&&!y&&h.jsx("button",{type:"button",className:"text-xs text-muted-foreground transition-colors hover:text-destructive disabled:opacity-50",onClick:()=>ie(!0),disabled:M||Y,children:v("thread.publishDialog.discardAll")})]})]}),h.jsx("div",{className:"border-t"}),h.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:P?h.jsxs("div",{className:"flex items-center justify-center gap-2 py-16 text-muted-foreground",children:[h.jsx(gt,{className:"h-4 w-4"}),h.jsx("span",{className:"text-sm",children:v("thread.publishDialog.loadingChanges")})]}):h.jsxs(h.Fragment,{children:[h.jsx(Ha,{value:"description",className:"mt-0 px-6 py-5",children:h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("p",{className:"text-sm font-medium",children:v(y?"thread.publishDialog.pullRequest":"thread.publishDialog.commitMessage")}),h.jsxs("button",{type:"button",className:"flex items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50",disabled:X||M||I,onClick:fe,children:[X?h.jsx(gt,{className:"h-3 w-3"}):h.jsx(e_,{className:"h-3 w-3"}),v(X?"thread.publishDialog.generating":"thread.publishDialog.regenerate")]})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsx("label",{htmlFor:"publish-title",className:"text-xs font-medium text-muted-foreground",children:v("thread.publishDialog.title")}),h.jsx(Zp,{id:"publish-title",value:B,onChange:pe=>D(pe.target.value),placeholder:v(X?"thread.publishDialog.generating":"thread.publishDialog.commitTitlePlaceholder"),disabled:M||I||X,className:"text-sm"})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsx("label",{htmlFor:"publish-body",className:"text-xs font-medium text-muted-foreground",children:v("thread.publishDialog.descriptionLabel")}),h.jsx(uh,{id:"publish-body",value:j,onChange:pe=>K(pe.target.value),placeholder:v(X?"thread.publishDialog.generating":"thread.publishDialog.descriptionPlaceholder"),disabled:M||I||X,rows:5,className:"resize-none text-sm"})]}),h.jsxs("p",{className:"text-xs text-muted-foreground",children:[v("thread.publishDialog.branchLabel")," ",h.jsx("span",{className:"font-mono",children:r})," → ",h.jsx("span",{className:"font-mono",children:n})," · ",h.jsx("span",{className:"text-foreground/80",children:C?v("thread.publishDialog.squashMergesInto",{publishLabel:ue,baseBranch:n}):v("thread.publishDialog.opensPullRequestInto",{baseBranch:n})})]})]})}),h.jsx(Ha,{value:"changes",className:"mt-0",children:h.jsx(gh,{diff:R,onDiscardFile:Ee})})]})}),h.jsx("div",{className:"shrink-0 border-t",children:h.jsxs("button",{type:"button",className:"flex w-full items-center justify-between px-6 py-3.5 text-sm transition-colors hover:bg-muted/50 disabled:opacity-50",onClick:()=>{l&&window.open(l,"_blank","noopener,noreferrer")},disabled:!l,children:[h.jsxs("span",{className:"flex items-center gap-3",children:[h.jsx(Xo,{className:"h-4 w-4 text-muted-foreground"}),v("thread.publishDialog.visitPreview")]}),h.jsx(Qp,{className:"h-4 w-4 text-muted-foreground"})]})}),h.jsx("div",{className:"shrink-0 border-t px-6 py-3",children:C?h.jsxs(h.Fragment,{children:[h.jsx(RS,{label:ue,canPublish:ge,disabledReason:Ce,isPublishing:M,onPublish:ve}),z&&h.jsx("p",{className:"mt-2 text-xs text-destructive",children:z}),!ge&&!de.pending&&Oe&&h.jsxs(h.Fragment,{children:[h.jsxs(Pe,{type:"button",variant:"outline",className:"mt-2 w-full",onClick:Ve,disabled:I,children:[I?h.jsx(gt,{className:"h-4 w-4"}):h.jsx(An,{className:"h-4 w-4"}),v("thread.publishDialog.submitForReviewButton")]}),$&&h.jsx("p",{className:"mt-2 text-xs text-destructive",children:$})]})]}):h.jsxs(h.Fragment,{children:[h.jsxs(Pe,{type:"button",className:"w-full",onClick:Ve,disabled:!Oe||I,children:[I?h.jsx(gt,{className:"h-4 w-4"}):h.jsx(An,{className:"h-4 w-4"}),v("thread.publishDialog.submitForReviewButton")]}),$&&h.jsx("p",{className:"mt-2 text-xs text-destructive",children:$})]})})]})})}function RS(t){const e=H.c(14),{label:s,canPublish:i,disabledReason:r,isPublishing:n,onPublish:o}=t,a=!i||n;let c;e[0]!==n?(c=n?h.jsx(gt,{className:"h-4 w-4"}):null,e[0]=n,e[1]=c):c=e[1];let l;e[2]!==s||e[3]!==o||e[4]!==a||e[5]!==c?(l=h.jsxs(Pe,{type:"button",variant:"brand",className:"w-full",onClick:o,disabled:a,children:[c,s]}),e[2]=s,e[3]=o,e[4]=a,e[5]=c,e[6]=l):l=e[6];const u=l;if(!r)return u;let d;e[7]!==u?(d=h.jsx(Je,{asChild:!0,children:h.jsx("span",{className:"flex w-full",children:u})}),e[7]=u,e[8]=d):d=e[8];let f;e[9]!==r?(f=h.jsx(Ze,{children:r}),e[9]=r,e[10]=f):f=e[10];let p;return e[11]!==d||e[12]!==f?(p=h.jsx(Oi,{children:h.jsxs(Qe,{children:[d,f]})}),e[11]=d,e[12]=f,e[13]=p):p=e[13],p}function vc(t){switch(t){case"publish":return h.jsx(Hc,{className:"size-4"});case"create-pr":case"reopen":return h.jsx(jr,{className:"size-4"});case"rebase":case"sync":return h.jsx(Ei,{className:"size-4"});case"fix-checks":return h.jsx(Ic,{className:"size-4"});case"mark-ready":return h.jsx(jo,{className:"size-4"});case"resolve-comments":return h.jsx(Io,{className:"size-4"});case"merge":return h.jsx(wp,{className:"size-4"});case"review":return h.jsx(Xo,{className:"size-4"});case"open-pr-page":return h.jsx(dh,{size:16})}}const bc=new Set(["reopen","rebase","fix-checks","mark-ready","resolve-comments","review","sync"]),Sc=new Set(["publish","create-pr"]);function TS(t){return{label:t("thread.headerActions.loadingBranch"),disabled:!0,loading:!0,variant:"outline",tooltip:t("thread.headerActions.waitingForSandboxBranchTooltip"),menu:[]}}function AS({virtualMcpId:t}){const e=be(),{org:s}=ut(),{data:i}=hs.useSession(),r=us(t),{deleteRelease:n}=Fr(t),{currentBranch:o,setCurrentTaskBranch:a,taskId:c}=zi(),l=Bo(),{openSidePanel:u}=$r(),[d,f]=O.useState(!1),[p,_]=O.useState("open-pr"),[g,v]=O.useState(null),[b,k]=O.useState(!1),w=O.useRef(""),S=th(r),m=S.status==="attached"||S.status==="public-clone"?S.repo:null,{lifecycle:x,branch:y,phase:C}=Or(),N={orgSlug:s.slug,virtualMcpId:t,branch:o??"",threadId:c??null},R=es({queryKey:xh(N),queryFn:()=>wi(N),enabled:!!o,staleTime:15e3,refetchInterval:F=>Zr(F.state.data)?5e3:!1}).data??null,E=y,P=x,A=E.kind==="ready"?E.branch:null,M=o??A??void 0,L=(E.kind==="ready"?E.branch:null)??M??null,B=qc({orgId:s.id,orgSlug:s.slug,target:Ut(m),owner:m?.owner??"",repo:m?.name??"",branch:L}),D=B.data??null,j=Vc({orgId:s.id,orgSlug:s.slug,target:Ut(m),owner:m?.owner??"",repo:m?.name??"",branch:L}),K=zu({orgId:s.id,orgSlug:s.slug,target:Ut(m),owner:m?.owner??"",repo:m?.name??"",branch:L}),z=E,G=yh(r?.metadata?.publishPolicy),I=Qd(s.slug,t,o??M??""),{previewUrl:V}=Yc();if(S.status==="detached")return h.jsx(NS,{label:e("thread.headerActions.githubConnectionRemoved"),children:h.jsx(Pe,{size:"sm",variant:"outline",disabled:!0,children:e("thread.headerActions.reconnectGithub")})});if(!m)return null;const $=L?dS({lifecycle:P,branch:z,claimPhase:C,pr:D,checks:j.data??[],reviews:K.data??null,noReviewableDiff:Zr(R),loading:vr(B),t:e}):TS(e),ee=JSON.stringify({label:$.label,branchKind:z.kind,workingTreeDirty:z.kind==="ready"?z.workingTreeDirty:null,unpushed:z.kind==="ready"?z.unpushed:null,aheadOfBase:z.kind==="ready"?z.aheadOfBase:null,lifecycle:P.phase,githubHeadBranch:L,noReviewableDiff:Zr(R)});w.current!==ee&&(w.current=ee,Iu("header button",{label:$.label,tooltip:$.tooltip,action:$.action,chatBranch:o,sandboxBranch:A,sandboxRouteBranch:M,githubHeadBranch:L,branchMeta:E,effectiveBranchMeta:z,lifecyclePhase:P.phase,prNumber:D?.number??null,prState:D?.state??null}));const se=F=>(u(),l.sendMessage({parts:[{type:"text",text:F}]})),ie=l.isStreaming,Y=z.kind==="ready"?z.base:"main",Z=async()=>{await B.refetch()},X=async()=>{const F=o,Q=ti(ta(i?.user));await a(Q),F&&F!==Y&&await n(F)},U=async F=>{if(!(!m||b)){k(!0);try{const Q=ya(i?.user);await Pu(s.slug,Ut(m),{number:F,coAuthor:Q}),Xe.success(e("thread.headerActions.publishedPr",{prNumber:String(F)})),await Z(),await X()}catch(Q){Xe.error(Q instanceof ku?Q.detail??z0(Q.reason,e):Q instanceof Error?Q.message:e("thread.headerActions.failedToMergePullRequest"))}finally{k(!1)}}},J=(F,Q)=>{_(F),v(Q),f(!0)},ae=F=>{if(L)switch(F){case"publish":J("publish-only",$.meta?.publishPolicyOverride??null);return;case"create-pr":J("open-pr",null);return;case"merge":D&&U(D.number);return;case"sync":if(ie)return;se(Gp({branch:L,base:Y}));return;case"open-pr-page":D?.htmlUrl&&window.open(D.htmlUrl,"_blank","noopener,noreferrer");return;case"review":if(ie)return;D&&se(qp({prNumber:D.number}));return;case"reopen":if(ie)return;D&&se(Kp({prNumber:D.number}));return;case"rebase":if(ie)return;se(Vp({branch:L}));return;case"fix-checks":if(ie)return;D&&se(Up({prNumber:D.number,failingChecks:$.meta?.failingChecks??[]}));return;case"mark-ready":if(ie)return;D&&se(Wp({prNumber:D.number}));return;case"resolve-comments":if(ie)return;D&&se(Hp({prNumber:D.number}));return}},q=b||ie;return h.jsxs(h.Fragment,{children:[h.jsx(DS,{t:e,button:$,actionBusy:q,githubActionPending:b,savePending:I,onAction:ae}),M&&h.jsx(kS,{open:d,onOpenChange:f,orgSlug:s.slug,orgId:s.id,virtualMcpId:t,branch:M,baseBranch:Y,repoTarget:Ut(m),owner:m.owner,repo:m.name,previewUrl:V,publishPolicy:g??G,dialogIntent:p,headSha:z.kind==="ready"?z.headSha:null,openPullRequest:D?.state==="open"?D:null,onPullRequestChanged:Z,onPublished:X})]})}function DS(t){const e=H.c(44),{t:s,button:i,actionBusy:r,githubActionPending:n,savePending:o,onAction:a}=t,c=i.action;let l;e[0]!==c||e[1]!==r?(l=r&&c!==void 0&&bc.has(c),e[0]=c,e[1]=r,e[2]=l):l=e[2];const u=l,d=n&&c==="merge";let f;e[3]!==c||e[4]!==o?(f=o&&c!==void 0&&Sc.has(c),e[3]=c,e[4]=o,e[5]=f):f=e[5];const p=f,_=!!i.disabled||u||d||p||!c,g=!!i.loading||d;let v;e[6]!==i.tooltip||e[7]!==u||e[8]!==p||e[9]!==s?(v=u?s("thread.headerActions.chatIsRunning"):p?s("thread.headerActions.saving"):i.tooltip,e[6]=i.tooltip,e[7]=u,e[8]=p,e[9]=s,e[10]=v):v=e[10];const b=v;let k;if(e[11]!==r||e[12]!==i.menu||e[13]!==n||e[14]!==a||e[15]!==o||e[16]!==s){let R;e[18]!==r||e[19]!==n||e[20]!==a||e[21]!==o||e[22]!==s?(R=E=>{const P=r&&bc.has(E.action),A=o&&Sc.has(E.action),M=E.action==="merge"&&n,L=A?s("thread.headerActions.saving"):P?s("thread.headerActions.chatIsRunning"):E.tooltip;return{key:E.key,label:E.label,icon:vc(E.action),disabled:!!(P||A||M),...L?{tooltip:L}:{},onSelect:()=>a(E.action)}},e[18]=r,e[19]=n,e[20]=a,e[21]=o,e[22]=s,e[23]=R):R=e[23],k=i.menu.map(R),e[11]=r,e[12]=i.menu,e[13]=n,e[14]=a,e[15]=o,e[16]=s,e[17]=k}else k=e[17];const w=k,S=i.label,m=i.variant;let x;e[24]!==c||e[25]!==g?(x=c&&!g?{icon:vc(c)}:{},e[24]=c,e[25]=g,e[26]=x):x=e[26];let y;e[27]!==b?(y=b?{tooltip:b}:{},e[27]=b,e[28]=y):y=e[28];let C;e[29]!==s?(C=s("thread.headerActions.moreActionsAriaLabel"),e[29]=s,e[30]=C):C=e[30];let N;e[31]!==c||e[32]!==a?(N=c?()=>a(c):void 0,e[31]=c,e[32]=a,e[33]=N):N=e[33];let T;return e[34]!==i.label||e[35]!==i.variant||e[36]!==_||e[37]!==w||e[38]!==g||e[39]!==x||e[40]!==y||e[41]!==C||e[42]!==N?(T=h.jsx(Zd,{size:"sm",label:S,variant:m,disabled:_,loading:g,...x,...y,items:w,menuAriaLabel:C,onClick:N}),e[34]=i.label,e[35]=i.variant,e[36]=_,e[37]=w,e[38]=g,e[39]=x,e[40]=y,e[41]=C,e[42]=N,e[43]=T):T=e[43],T}function NS(t){const e=H.c(9),{label:s,children:i}=t;if(!s){let a;return e[0]!==i?(a=h.jsx(h.Fragment,{children:i}),e[0]=i,e[1]=a):a=e[1],a}let r;e[2]!==i?(r=h.jsx(Je,{asChild:!0,children:h.jsx("span",{children:i})}),e[2]=i,e[3]=r):r=e[3];let n;e[4]!==s?(n=h.jsx(Ze,{children:s}),e[4]=s,e[5]=n):n=e[5];let o;return e[6]!==r||e[7]!==n?(o=h.jsx(Oi,{children:h.jsxs(Qe,{children:[r,n]})}),e[6]=r,e[7]=n,e[8]=o):o=e[8],o}function MS(t){const e=H.c(14),{virtualMcp:s}=t,i=be(),r=Uc(),{navigateToTask:n}=vf(),{create:o}=zo();let a,c;if(e[0]!==r||e[1]!==o||e[2]!==n||e[3]!==i||e[4]!==s){c=Symbol.for("react.early_return_sentinel");e:{const l=Ff(s,r);if(!l){c=null;break e}const u=l.mode==="dev";let d;e[7]!==o||e[8]!==n?(d=async b=>{const k=crypto.randomUUID();try{await o({id:k,virtual_mcp_id:b})}catch{}n(k,{virtualMcpId:b})},e[7]=o,e[8]=n,e[9]=d):d=e[9];const f=d,p=(b,k,w)=>h.jsxs("button",{type:"button","aria-pressed":k,"aria-label":b,title:b,onClick:()=>{k||f(l.targetId)},className:_e("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md transition-colors",k?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[h.jsx(w,{className:"size-3.5 shrink-0"}),h.jsx("span",{className:"@max-3xl/panel-header:hidden",children:b})]});let _;e[10]!==i?(_=i("devAgent.devAgentControl.develop"),e[10]=i,e[11]=_):_=e[11];const g=p(_,u,wf);let v;e[12]!==i?(v=i("devAgent.devAgentControl.live"),e[12]=i,e[13]=v):v=e[13],a=h.jsxs("div",{className:"inline-flex items-center rounded-lg border border-border bg-muted p-0.5 text-xs font-medium",children:[g,p(v,!u,fh)]})}e[0]=r,e[1]=o,e[2]=n,e[3]=i,e[4]=s,e[5]=a,e[6]=c}else a=e[5],c=e[6];return c!==Symbol.for("react.early_return_sentinel")?c:a}function BS(t){const e=H.c(11),{virtualMcp:s}=t,i=ni(s.id).runtime==="cms",r=eh(s.metadata?.ui?.layout??null);let n;e[0]!==r?(n=nh(r),e[0]=r,e[1]=n):n=e[1];const o=n;let a;e[2]!==s?(a=h.jsx(MS,{virtualMcp:s}),e[2]=s,e[3]=a):a=e[3];let c;e[4]!==i||e[5]!==o||e[6]!==s?(c=o&&Hf(s)?i?h.jsx(vS,{virtualMcpId:s.id}):h.jsx(AS,{virtualMcpId:s.id}):null,e[4]=i,e[5]=o,e[6]=s,e[7]=c):c=e[7];let l;return e[8]!==a||e[9]!==c?(l=h.jsxs("div",{className:"flex items-center gap-2",children:[a,c]}),e[8]=a,e[9]=c,e[10]=l):l=e[10],l}const LS=10080*60*1e3;function jS({sandboxMap:t,userId:e,rawBranches:s,now:i}){const r=new Map;for(const[d,f]of Object.entries(t??{}))for(const[p,_]of Object.entries(f??{})){let g=r.get(p);g||(g={userIds:new Set,lastActiveAt:0},r.set(p,g)),g.userIds.add(d);for(const v of Object.values(_??{})){const b=v?.createdAt??0;b>g.lastActiveAt&&(g.lastActiveAt=b)}}const n=i-LS,o=[...r.entries()].filter(([,d])=>d.lastActiveAt>=n).sort((d,f)=>f[1].lastActiveAt-d[1].lastActiveAt).map(([d,f])=>({name:d,source:"recent",contributors:[...f.userIds],lastActiveAt:f.lastActiveAt})),a=new Set(o.map(d=>d.name)),c=new Set(Object.keys(t?.[e]??{})),l=[...c].filter(d=>!a.has(d)).sort().map(d=>({name:d,source:"yours"})),u=s.filter(d=>!c.has(d.name)&&!a.has(d.name)).map(d=>({name:d.name,source:"other",author:d.author??null}));return{recent:o,yours:l,others:u}}const IS=100,OS=50,zS=300;function Ro(t,e){const s=e.trim().toLowerCase();return s?t.toLowerCase().includes(s):!0}function $S(t){const e=H.c(46),{orgId:s,orgSlug:i,userId:r,target:n,sandboxMap:o,owner:a,repo:c,search:l,enabled:u}=t,d=l===void 0?"":l,f=u===void 0?!0:u;let p;e[0]!==d?(p=d.trim(),e[0]=d,e[1]=p):p=e[1];const _=p,g=i_(_,zS);let v;e[2]!==n?(v=sh(n),e[2]=n,e[3]=v):v=e[3];const b=v,k=_.length>0;let w;e[4]!==g||e[5]!==s||e[6]!==i||e[7]!==a||e[8]!==c||e[9]!==n?(w=ks.githubBranchSearch(s,i,ih(n),a,c,g),e[4]=g,e[5]=s,e[6]=i,e[7]=a,e[8]=c,e[9]=n,e[10]=w):w=e[10];const S=f&&b;let m;e[11]!==g||e[12]!==i||e[13]!==n?(m=ee=>{const{pageParam:se}=ee;return No(i,"REPOSITORY_SEARCH_BRANCHES",{...n,query:g,limit:g?OS:IS,cursor:se})},e[11]=g,e[12]=i,e[13]=n,e[14]=m):m=e[14];let x;e[15]!==g?(x=ee=>g?void 0:ee.nextCursor??void 0,e[15]=g,e[16]=x):x=e[16];let y;e[17]!==w||e[18]!==S||e[19]!==m||e[20]!==x?(y={queryKey:w,enabled:S,staleTime:3e4,retry:!1,initialPageParam:null,queryFn:m,getNextPageParam:x},e[17]=w,e[18]=S,e[19]=m,e[20]=x,e[21]=y):y=e[21];const{data:C,isLoading:N,isError:T,isFetching:R,hasNextPage:E,isFetchingNextPage:P,fetchNextPage:A}=r_(y),M=k&&(g!==_||R);let L,B,D;if(e[22]!==C?.pages||e[23]!==o||e[24]!==_||e[25]!==r){const ee=(C?.pages??[]).flatMap(FS);L=jS({sandboxMap:o,userId:r,rawBranches:ee,now:Date.now()});let se;e[29]!==_?(se=Y=>Ro(Y.name,_),e[29]=_,e[30]=se):se=e[30],B=L.recent.filter(se);let ie;e[31]!==_?(ie=Y=>Ro(Y.name,_),e[31]=_,e[32]=ie):ie=e[32],D=L.yours.filter(ie),e[22]=C?.pages,e[23]=o,e[24]=_,e[25]=r,e[26]=L,e[27]=B,e[28]=D}else L=e[26],B=e[27],D=e[28];const j=D,K=L.others,z=C?.pages[0],G=k&&z&&!M?Math.max(0,z.totalCount-z.branches.length):0,I=!k&&E;let V;e[33]!==A?(V=()=>{A()},e[33]=A,e[34]=V):V=e[34];let $;return e[35]!==G||e[36]!==T||e[37]!==P||e[38]!==N||e[39]!==M||e[40]!==K||e[41]!==B||e[42]!==I||e[43]!==V||e[44]!==j?($={recent:B,yours:j,others:K,isLoading:N,isError:T,isSearching:M,hiddenMatchCount:G,hasMore:I,isFetchingMore:P,fetchMore:V},e[35]=G,e[36]=T,e[37]=P,e[38]=N,e[39]=M,e[40]=K,e[41]=B,e[42]=I,e[43]=V,e[44]=j,e[45]=$):$=e[45],$}function FS(t){return t.branches}function HS(t){const e=H.c(190),{virtualMcpId:s,userLabel:i,value:r,baseBranch:n,orgId:o,orgSlug:a,userId:c,target:l,owner:u,repo:d,sandboxMap:f,onChange:p,onCreateBranch:_,disabled:g,spawnsNewChat:v,placement:b}=t,k=g===void 0?!1:g,w=v===void 0?!1:v,S=b===void 0?"chat":b,m=be(),x=S==="header",[y,C]=O.useState(!1),[N,T]=O.useState(!1),[R,E]=O.useState(null),[P,A]=O.useState(""),[M,L]=O.useState(null),{releases:B,createRelease:D,renameRelease:j,deleteRelease:K}=Fr(s),z=!!r&&r===n;let G,I,V,$,ee,se,ie,Y,Z,X,U,J,ae,q,F,Q,he,ue,fe,ne,ce,de,le,re,ge,Ce,we;if(e[0]!==n||e[1]!==D||e[2]!==K||e[3]!==k||e[4]!==P||e[5]!==z||e[6]!==x||e[7]!==p||e[8]!==_||e[9]!==y||e[10]!==M||e[11]!==B||e[12]!==j||e[13]!==m||e[14]!==i||e[15]!==r){let xe;e[43]!==r?(xe=ke=>ke.branch===r,e[43]=r,e[44]=xe):xe=e[44];const tt=B.find(xe);we=!z&&!tt&&!!r;const At=z?m("thread.branchPicker.live"):tt?.name??m("thread.branchPicker.defaultVersionName");X=r?At:m("thread.branchPicker.selectVersion");const Us=z?"bg-success":en(tt?.color??"orange");let zt;e[45]!==p?(zt=ke=>{p(ke),C(!1)},e[45]=p,e[46]=zt):zt=e[46],U=zt;let $t;e[47]!==m?($t=ke=>{Xe.error(ke instanceof Error?ke.message:m("thread.branchPicker.saveError"))},e[47]=m,e[48]=$t):$t=e[48];const $e=$t;let Ft;e[49]!==D||e[50]!==p||e[51]!==B||e[52]!==$e?(Ft=(ke,Es)=>{B.some(Jr=>Jr.branch===ke)||D({branch:ke,name:Es.trim()||ke,color:hr(B.length),createdAt:new Date().toISOString()}).catch($e),p(ke),T(!1),C(!1)},e[49]=D,e[50]=p,e[51]=B,e[52]=$e,e[53]=Ft):Ft=e[53],se=Ft;let Ht;e[54]!==D||e[55]!==p||e[56]!==_||e[57]!==B||e[58]!==$e||e[59]!==m||e[60]!==i?(Ht=()=>{const ke=ti(i);D({branch:ke,name:Bn(B,m("thread.branchPicker.defaultVersionName")),color:hr(B.length),createdAt:new Date().toISOString()}).catch($e),(_??p)(ke),C(!1)},e[54]=D,e[55]=p,e[56]=_,e[57]=B,e[58]=$e,e[59]=m,e[60]=i,e[61]=Ht):Ht=e[61],Z=Ht;let ss;e[62]===Symbol.for("react.memo_cache_sentinel")?(ss=()=>{E(null),A(""),T(!1)},e[62]=ss):ss=e[62];const Xu=ss;let Vi;e[63]===Symbol.for("react.memo_cache_sentinel")?(Vi=ke=>{E(ke.branch),A(ke.name)},e[63]=Vi):Vi=e[63],q=Vi;let Gi;e[64]!==P||e[65]!==j||e[66]!==$e?(Gi=ke=>{const Es=P.trim();Es&&j(ke,Es).catch($e),E(null),A("")},e[64]=P,e[65]=j,e[66]=$e,e[67]=Gi):Gi=e[67],J=Gi;let Yi;e[68]!==D||e[69]!==P||e[70]!==B.length||e[71]!==$e||e[72]!==r?(Yi=()=>{const ke=P.trim();ke&&r&&D({branch:r,name:ke,color:hr(B.length),createdAt:new Date().toISOString()}).catch($e),E(null),A("")},e[68]=D,e[69]=P,e[70]=B.length,e[71]=$e,e[72]=r,e[73]=Yi):Yi=e[73],ae=Yi;let Xi;e[74]===Symbol.for("react.memo_cache_sentinel")?(Xi=()=>{E(null),A("")},e[74]=Xi):Xi=e[74],ie=Xi;let Ji;e[75]!==n||e[76]!==K||e[77]!==M||e[78]!==U||e[79]!==B||e[80]!==$e||e[81]!==r?(Ji=()=>{const ke=M;if(L(null),!!ke){if(ke.branch===r){const Es=B.find(Jr=>Jr.branch!==ke.branch);Es?U(Es.branch):n?U(n):C(!1)}else C(!1);K(ke.branch).catch($e)}},e[75]=n,e[76]=K,e[77]=M,e[78]=U,e[79]=B,e[80]=$e,e[81]=r,e[82]=Ji):Ji=e[82],Y=Ji,ee=Hi,fe=y,e[83]!==k?(ne=k?void 0:ke=>{ke||Xu(),C(ke)},e[83]=k,e[84]=ne):ne=e[84],$=Qe,V=Je,ue=!0,he="inline-flex min-w-0 shrink",I=zr,Q=!0,G=Pe,de=hh.branchPicker,le=x?"outline":"ghost",re=x?"sm":"default",ge=X,Ce=k;const Xr=x?"text-xs":"text-xs text-muted-foreground hover:text-foreground";e[85]!==Xr?(F=_e("shrink min-w-0 max-w-[220px] gap-2",Xr,ch),e[85]=Xr,e[86]=F):F=e[86],ce=_e("h-2 w-2 shrink-0 rounded-full",r?Us:"bg-muted-foreground"),e[0]=n,e[1]=D,e[2]=K,e[3]=k,e[4]=P,e[5]=z,e[6]=x,e[7]=p,e[8]=_,e[9]=y,e[10]=M,e[11]=B,e[12]=j,e[13]=m,e[14]=i,e[15]=r,e[16]=G,e[17]=I,e[18]=V,e[19]=$,e[20]=ee,e[21]=se,e[22]=ie,e[23]=Y,e[24]=Z,e[25]=X,e[26]=U,e[27]=J,e[28]=ae,e[29]=q,e[30]=F,e[31]=Q,e[32]=he,e[33]=ue,e[34]=fe,e[35]=ne,e[36]=ce,e[37]=de,e[38]=le,e[39]=re,e[40]=ge,e[41]=Ce,e[42]=we}else G=e[16],I=e[17],V=e[18],$=e[19],ee=e[20],se=e[21],ie=e[22],Y=e[23],Z=e[24],X=e[25],U=e[26],J=e[27],ae=e[28],q=e[29],F=e[30],Q=e[31],he=e[32],ue=e[33],fe=e[34],ne=e[35],ce=e[36],de=e[37],le=e[38],re=e[39],ge=e[40],Ce=e[41],we=e[42];let Oe;e[87]!==ce?(Oe=h.jsx("span",{className:ce}),e[87]=ce,e[88]=Oe):Oe=e[88];let Ue;e[89]!==X?(Ue=h.jsx("span",{className:"min-w-0 truncate @max-3xl/panel-header:hidden",children:X}),e[89]=X,e[90]=Ue):Ue=e[90];let Ke;e[91]!==k?(Ke=!k&&h.jsx($s,{size:12,className:"opacity-60 shrink-0"}),e[91]=k,e[92]=Ke):Ke=e[92];let qe;e[93]!==G||e[94]!==F||e[95]!==Oe||e[96]!==Ue||e[97]!==Ke||e[98]!==de||e[99]!==le||e[100]!==re||e[101]!==ge||e[102]!==Ce?(qe=h.jsxs(G,{"data-tour":de,variant:le,size:re,"aria-label":ge,disabled:Ce,className:F,children:[Oe,Ue,Ke]}),e[93]=G,e[94]=F,e[95]=Oe,e[96]=Ue,e[97]=Ke,e[98]=de,e[99]=le,e[100]=re,e[101]=ge,e[102]=Ce,e[103]=qe):qe=e[103];let ve;e[104]!==I||e[105]!==Q||e[106]!==qe?(ve=h.jsx(I,{asChild:Q,children:qe}),e[104]=I,e[105]=Q,e[106]=qe,e[107]=ve):ve=e[107];let Ee;e[108]!==he||e[109]!==ve?(Ee=h.jsx("span",{className:he,children:ve}),e[108]=he,e[109]=ve,e[110]=Ee):Ee=e[110];let et;e[111]!==V||e[112]!==ue||e[113]!==Ee?(et=h.jsx(V,{asChild:ue,children:Ee}),e[111]=V,e[112]=ue,e[113]=Ee,e[114]=et):et=e[114];let Ve;e[115]!==X?(Ve=h.jsx(Ze,{children:X}),e[115]=X,e[116]=Ve):Ve=e[116];let pe;e[117]!==$||e[118]!==et||e[119]!==Ve?(pe=h.jsxs($,{children:[et,Ve]}),e[117]=$,e[118]=et,e[119]=Ve,e[120]=pe):pe=e[120];let Re;e[121]!==w||e[122]!==m?(Re=w&&h.jsx("p",{className:"px-2 pb-1.5 pt-1 text-xs text-muted-foreground",children:m("thread.branchPicker.newChatHint")}),e[121]=w,e[122]=m,e[123]=Re):Re=e[123];let ze;e[124]!==se||e[125]!==N||e[126]!==ie||e[127]!==Z||e[128]!==P||e[129]!==R||e[130]!==y||e[131]!==o||e[132]!==a||e[133]!==u||e[134]!==U||e[135]!==B||e[136]!==d||e[137]!==f||e[138]!==J||e[139]!==ae||e[140]!==q||e[141]!==m||e[142]!==l||e[143]!==we||e[144]!==c||e[145]!==r?(ze=N?h.jsx(US,{orgId:o,orgSlug:a,userId:c,target:l,owner:u,repo:d,sandboxMap:f,enabled:y,onBack:()=>T(!1),onAdopt:se}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex max-h-[min(50vh,20rem)] flex-col overflow-y-auto",children:[we&&r&&(R===r?h.jsx(yc,{value:P,onChange:A,onSave:ae,onCancel:ie}):h.jsx(xc,{dot:en("orange"),label:m("thread.branchPicker.defaultVersionName"),branch:r,selected:!0,onSelect:()=>U(r),onRename:()=>{E(r),A(Bn(B,m("thread.branchPicker.defaultVersionName")))}})),B.map(xe=>R===xe.branch?h.jsx(yc,{value:P,onChange:A,onSave:()=>J(xe.branch),onCancel:ie},xe.branch):h.jsx(xc,{dot:en(xe.color),label:xe.name,branch:xe.branch,selected:xe.branch===r,onSelect:()=>U(xe.branch),onRename:()=>q(xe),onDelete:()=>L(xe)},xe.branch))]}),(we||B.length>0)&&h.jsx("div",{className:"my-1 border-t"}),h.jsxs("button",{type:"button",onClick:()=>{Z()},className:"flex w-full items-center gap-2 rounded-md px-2 py-2 text-left text-sm text-muted-foreground hover:bg-accent hover:text-foreground",children:[h.jsx(ah,{className:"h-4 w-4 shrink-0"}),m("thread.branchPicker.newVersion")]}),h.jsxs("button",{type:"button",onClick:()=>T(!0),className:"flex w-full items-center justify-between gap-2 rounded-md px-2 py-2 text-left text-xs text-muted-foreground hover:bg-accent hover:text-foreground",children:[m("thread.branchPicker.advanced"),h.jsx(Jo,{className:"h-4 w-4 shrink-0"})]})]}),e[124]=se,e[125]=N,e[126]=ie,e[127]=Z,e[128]=P,e[129]=R,e[130]=y,e[131]=o,e[132]=a,e[133]=u,e[134]=U,e[135]=B,e[136]=d,e[137]=f,e[138]=J,e[139]=ae,e[140]=q,e[141]=m,e[142]=l,e[143]=we,e[144]=c,e[145]=r,e[146]=ze):ze=e[146];let _t;e[147]!==Re||e[148]!==ze?(_t=h.jsxs(Fi,{className:"w-[min(300px,calc(100vw-2rem))] p-1.5",align:"start",onOpenAutoFocus:WS,children:[Re,ze]}),e[147]=Re,e[148]=ze,e[149]=_t):_t=e[149];let _s;e[150]!==ee||e[151]!==fe||e[152]!==ne||e[153]!==pe||e[154]!==_t?(_s=h.jsxs(ee,{open:fe,onOpenChange:ne,children:[pe,_t]}),e[150]=ee,e[151]=fe,e[152]=ne,e[153]=pe,e[154]=_t,e[155]=_s):_s=e[155];const ms=_s,Ps=M!==null;let ts;e[156]===Symbol.for("react.memo_cache_sentinel")?(ts=xe=>{xe||L(null)},e[156]=ts):ts=e[156];let Kt;e[157]!==m?(Kt=m("thread.branchPicker.deleteTitle"),e[157]=m,e[158]=Kt):Kt=e[158];let xt;e[159]!==Kt?(xt=h.jsx(kh,{children:Kt}),e[159]=Kt,e[160]=xt):xt=e[160];let wt;e[161]!==M||e[162]!==m?(wt=M&&m("thread.branchPicker.deleteConfirm",{name:M.name}),e[161]=M,e[162]=m,e[163]=wt):wt=e[163];let Ct;e[164]!==wt?(Ct=h.jsx(Ph,{children:wt}),e[164]=wt,e[165]=Ct):Ct=e[165];let kt;e[166]!==xt||e[167]!==Ct?(kt=h.jsxs(Eh,{children:[xt,Ct]}),e[166]=xt,e[167]=Ct,e[168]=kt):kt=e[168];let Pt;e[169]!==m?(Pt=m("thread.branchPicker.cancel"),e[169]=m,e[170]=Pt):Pt=e[170];let Et;e[171]!==Pt?(Et=h.jsx(Rh,{children:Pt}),e[171]=Pt,e[172]=Et):Et=e[172];let Rt;e[173]!==m?(Rt=m("thread.branchPicker.delete"),e[173]=m,e[174]=Rt):Rt=e[174];let Tt;e[175]!==Y||e[176]!==Rt?(Tt=h.jsx(Th,{onClick:Y,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Rt}),e[175]=Y,e[176]=Rt,e[177]=Tt):Tt=e[177];let Ot;e[178]!==Et||e[179]!==Tt?(Ot=h.jsxs(Ah,{children:[Et,Tt]}),e[178]=Et,e[179]=Tt,e[180]=Ot):Ot=e[180];let Ne;e[181]!==kt||e[182]!==Ot?(Ne=h.jsxs(Dh,{children:[kt,Ot]}),e[181]=kt,e[182]=Ot,e[183]=Ne):Ne=e[183];let Me;e[184]!==Ps||e[185]!==Ne?(Me=h.jsx(Nh,{open:Ps,onOpenChange:ts,children:Ne}),e[184]=Ps,e[185]=Ne,e[186]=Me):Me=e[186];let Te;return e[187]!==ms||e[188]!==Me?(Te=h.jsxs(h.Fragment,{children:[ms,Me]}),e[187]=ms,e[188]=Me,e[189]=Te):Te=e[189],Te}function WS(t){return t.preventDefault()}function yc(t){const e=H.c(20),{value:s,onChange:i,onSave:r,onCancel:n}=t,o=be();let a;e[0]!==o?(a=o("thread.branchPicker.rename"),e[0]=o,e[1]=a):a=e[1];let c;e[2]!==i?(c=_=>i(_.target.value),e[2]=i,e[3]=c):c=e[3];let l;e[4]!==n||e[5]!==r?(l=_=>{_.key==="Enter"&&r(),_.key==="Escape"&&(_.preventDefault(),_.stopPropagation(),n())},e[4]=n,e[5]=r,e[6]=l):l=e[6];let u;e[7]!==a||e[8]!==c||e[9]!==l||e[10]!==s?(u=h.jsx("input",{autoFocus:!0,"aria-label":a,value:s,onChange:c,onKeyDown:l,className:"h-8 flex-1 rounded-md border bg-transparent px-2 text-sm outline-none focus:ring-1 focus:ring-ring"}),e[7]=a,e[8]=c,e[9]=l,e[10]=s,e[11]=u):u=e[11];let d;e[12]!==o?(d=o("thread.branchPicker.save"),e[12]=o,e[13]=d):d=e[13];let f;e[14]!==r||e[15]!==d?(f=h.jsx(Pe,{size:"sm",onClick:r,children:d}),e[14]=r,e[15]=d,e[16]=f):f=e[16];let p;return e[17]!==u||e[18]!==f?(p=h.jsxs("div",{className:"flex items-center gap-1.5 p-1",children:[u,f]}),e[17]=u,e[18]=f,e[19]=p):p=e[19],p}function xc(t){const e=H.c(45),{dot:s,label:i,branch:r,selected:n,onSelect:o,onRename:a,onDelete:c}=t,l=be(),u=n?"bg-accent":"hover:bg-accent/60";let d;e[0]!==u?(d=_e("group flex items-center rounded-md",u),e[0]=u,e[1]=d):d=e[1];let f;e[2]!==s?(f=_e("h-2 w-2 shrink-0 rounded-full",s),e[2]=s,e[3]=f):f=e[3];let p;e[4]!==f?(p=h.jsx("span",{className:f}),e[4]=f,e[5]=p):p=e[5];let _;e[6]!==i?(_=h.jsx("span",{className:"flex-1 truncate",children:i}),e[6]=i,e[7]=_):_=e[7];let g;e[8]!==o||e[9]!==n||e[10]!==p||e[11]!==_?(g=h.jsx(Je,{asChild:!0,children:h.jsxs("button",{type:"button","aria-pressed":n,onClick:o,className:"flex min-w-0 flex-1 items-center gap-2.5 px-2 py-2 text-left text-sm",children:[p,_]})}),e[8]=o,e[9]=n,e[10]=p,e[11]=_,e[12]=g):g=e[12];let v;e[13]!==r||e[14]!==l?(v=l("thread.branchPicker.branchTooltip",{branch:r}),e[13]=r,e[14]=l,e[15]=v):v=e[15];let b;e[16]!==v?(b=h.jsx(Ze,{side:"bottom",className:"font-mono text-xs",children:v}),e[16]=v,e[17]=b):b=e[17];let k;e[18]!==g||e[19]!==b?(k=h.jsxs(Qe,{children:[g,b]}),e[18]=g,e[19]=b,e[20]=k):k=e[20];let w;e[21]!==l?(w=l("thread.branchPicker.moreActions"),e[21]=l,e[22]=w):w=e[22];let S;e[23]===Symbol.for("react.memo_cache_sentinel")?(S=h.jsx(t_,{className:"h-4 w-4"}),e[23]=S):S=e[23];let m;e[24]!==w?(m=h.jsx(qo,{asChild:!0,children:h.jsx(Pe,{variant:"ghost",size:"icon","aria-label":w,className:"mr-1 h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100",children:S})}),e[24]=w,e[25]=m):m=e[25];let x;e[26]===Symbol.for("react.memo_cache_sentinel")?(x=h.jsx(s_,{className:"h-4 w-4"}),e[26]=x):x=e[26];let y;e[27]!==l?(y=l("thread.branchPicker.rename"),e[27]=l,e[28]=y):y=e[28];let C;e[29]!==a||e[30]!==y?(C=h.jsxs(yr,{onSelect:a,children:[x,y]}),e[29]=a,e[30]=y,e[31]=C):C=e[31];let N;e[32]!==c||e[33]!==l?(N=c&&h.jsxs(yr,{onSelect:c,className:"text-destructive focus:text-destructive",children:[h.jsx(_h,{className:"h-4 w-4"}),l("thread.branchPicker.delete")]}),e[32]=c,e[33]=l,e[34]=N):N=e[34];let T;e[35]!==C||e[36]!==N?(T=h.jsxs(Vo,{align:"end",children:[C,N]}),e[35]=C,e[36]=N,e[37]=T):T=e[37];let R;e[38]!==m||e[39]!==T?(R=h.jsxs(Ko,{children:[m,T]}),e[38]=m,e[39]=T,e[40]=R):R=e[40];let E;return e[41]!==R||e[42]!==d||e[43]!==k?(E=h.jsxs("div",{className:d,children:[k,R]}),e[41]=R,e[42]=d,e[43]=k,e[44]=E):E=e[44],E}function US(t){const e=H.c(94),{orgId:s,orgSlug:i,userId:r,target:n,owner:o,repo:a,sandboxMap:c,enabled:l,onBack:u,onAdopt:d}=t,f=be(),[p,_]=O.useState("branches"),[g,v]=O.useState(""),b=p==="branches"?g:"",k=l&&p==="branches";let w;e[0]!==s||e[1]!==i||e[2]!==o||e[3]!==a||e[4]!==c||e[5]!==b||e[6]!==k||e[7]!==n||e[8]!==r?(w={orgId:s,orgSlug:i,userId:r,target:n,sandboxMap:c,owner:o,repo:a,search:b,enabled:k},e[0]=s,e[1]=i,e[2]=o,e[3]=a,e[4]=c,e[5]=b,e[6]=k,e[7]=n,e[8]=r,e[9]=w):w=e[9];const{recent:S,yours:m,others:x,isLoading:y,hasMore:C,isFetchingMore:N,fetchMore:T}=$S(w),R=l&&p==="prs";let E;e[10]!==s||e[11]!==i||e[12]!==o||e[13]!==a||e[14]!==R||e[15]!==n?(E={orgId:s,orgSlug:i,target:n,owner:o,repo:a,enabled:R},e[10]=s,e[11]=i,e[12]=o,e[13]=a,e[14]=R,e[15]=n,e[16]=E):E=e[16];const{data:P,isLoading:A}=Gf(E);let M,L,B,D,j,K,z,G,I;if(e[17]!==T||e[18]!==C||e[19]!==N||e[20]!==y||e[21]!==d||e[22]!==u||e[23]!==x||e[24]!==o||e[25]!==A||e[26]!==S||e[27]!==a||e[28]!==g||e[29]!==f||e[30]!==P||e[31]!==p||e[32]!==m){const se=P===void 0?[]:P,ie=`${o}/${a}`;let Y;e[42]!==ie?(Y=ie.toLowerCase(),e[42]=ie,e[43]=Y):Y=e[43];const Z=Y;let X;e[44]!==Z?(X=le=>le.headRepoFullName?.toLowerCase()===Z,e[44]=Z,e[45]=X):X=e[45];const U=se.filter(X);let J;if(e[46]!==x||e[47]!==S||e[48]!==m){const le=new Set;J=[...S,...m,...x].filter(re=>le.has(re.name)?!1:(le.add(re.name),!0)),e[46]=x,e[47]=S,e[48]=m,e[49]=J}else J=e[49];const ae=J;j="flex flex-col";let q;e[50]===Symbol.for("react.memo_cache_sentinel")?(q=h.jsx(En,{className:"h-4 w-4 shrink-0"}),e[50]=q):q=e[50];let F;e[51]!==f?(F=f("thread.branchPicker.advancedBack"),e[51]=f,e[52]=F):F=e[52],e[53]!==u||e[54]!==F?(K=h.jsxs("button",{type:"button",onClick:u,className:"flex items-center gap-1.5 px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground",children:[q,F]}),e[53]=u,e[54]=F,e[55]=K):K=e[55],L=Mh,I=p==="branches"?KS:void 0;let Q;e[56]!==f||e[57]!==p?(Q=f(p==="branches"?"thread.branchPicker.searchBranches":"thread.branchPicker.searchPullRequests"),e[56]=f,e[57]=p,e[58]=Q):Q=e[58],e[59]!==g||e[60]!==Q?(B=h.jsx(Bh,{placeholder:Q,value:g,onValueChange:v}),e[59]=g,e[60]=Q,e[61]=B):B=e[61];let he;e[62]===Symbol.for("react.memo_cache_sentinel")?(he=le=>{_(le),v("")},e[62]=he):he=e[62];let ue;e[63]!==f?(ue=f("thread.branchPicker.branchesTab"),e[63]=f,e[64]=ue):ue=e[64];let fe;e[65]!==ue?(fe=h.jsx(wr,{value:"branches",className:"h-6 px-2.5 text-xs",children:ue}),e[65]=ue,e[66]=fe):fe=e[66];let ne;e[67]!==f?(ne=f("thread.branchPicker.prsTab"),e[67]=f,e[68]=ne):ne=e[68];let ce;e[69]!==ne?(ce=h.jsx(wr,{value:"prs",className:"h-6 px-2.5 text-xs",children:ne}),e[69]=ne,e[70]=ce):ce=e[70];let de;e[71]!==fe||e[72]!==ce?(de=h.jsxs(Ch,{className:"h-auto w-fit justify-start gap-1 bg-accent p-1",variant:"pill",children:[fe,ce]}),e[71]=fe,e[72]=ce,e[73]=de):de=e[73],e[74]!==de||e[75]!==p?(D=h.jsx(wh,{className:"px-2 pt-2 pb-1",value:p,onValueChange:he,children:de}),e[74]=de,e[75]=p,e[76]=D):D=e[76],M=Lh,e[77]!==T||e[78]!==p?(z=le=>{const re=le.currentTarget;p==="branches"&&re.scrollHeight-re.scrollTop-re.clientHeight<48&&T()},e[77]=T,e[78]=p,e[79]=z):z=e[79],G=p==="branches"?h.jsxs(h.Fragment,{children:[y&&h.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:f("thread.branchPicker.loadingMore")}),!y&&ae.length===0&&h.jsx(Dn,{children:f("thread.branchPicker.noBranchesFound")}),ae.length>0&&h.jsx(Nn,{children:ae.map(le=>h.jsxs(Mn,{value:le.name,className:"cursor-pointer",onSelect:()=>d(le.name,le.name),children:[h.jsx(An,{className:"mr-2 h-4 w-4 shrink-0"}),h.jsx("span",{className:"flex-1 truncate",children:le.name})]},le.name))}),C&&h.jsx("div",{className:"p-2",children:h.jsx(Pe,{variant:"ghost",size:"sm",className:"h-7 w-full text-xs",disabled:N,onClick:T,children:f(N?"thread.branchPicker.loadingMore":"thread.branchPicker.loadMoreBranches")})})]}):h.jsxs(h.Fragment,{children:[A&&h.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:f("thread.branchPicker.loadingPullRequests")}),!A&&U.length===0&&h.jsx(Dn,{children:f("thread.branchPicker.noOpenPullRequests")}),U.length>0&&h.jsx(Nn,{children:U.map(le=>h.jsxs(Mn,{value:`#${le.number} ${le.title} ${le.head}`,className:"cursor-pointer",onSelect:()=>d(le.head,Fa(le.title)),children:[h.jsx(jr,{className:"mr-2 h-4 w-4 shrink-0 text-muted-foreground"}),h.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[h.jsx("span",{className:"truncate",children:Fa(le.title)}),h.jsxs("span",{className:"truncate text-xs text-muted-foreground",children:["#",le.number," · ",le.head]})]})]},le.number))})]}),e[17]=T,e[18]=C,e[19]=N,e[20]=y,e[21]=d,e[22]=u,e[23]=x,e[24]=o,e[25]=A,e[26]=S,e[27]=a,e[28]=g,e[29]=f,e[30]=P,e[31]=p,e[32]=m,e[33]=M,e[34]=L,e[35]=B,e[36]=D,e[37]=j,e[38]=K,e[39]=z,e[40]=G,e[41]=I}else M=e[33],L=e[34],B=e[35],D=e[36],j=e[37],K=e[38],z=e[39],G=e[40],I=e[41];let V;e[80]!==M||e[81]!==z||e[82]!==G?(V=h.jsx(M,{onScroll:z,children:G}),e[80]=M,e[81]=z,e[82]=G,e[83]=V):V=e[83];let $;e[84]!==L||e[85]!==B||e[86]!==D||e[87]!==V||e[88]!==I?($=h.jsxs(L,{filter:I,children:[B,D,V]}),e[84]=L,e[85]=B,e[86]=D,e[87]=V,e[88]=I,e[89]=$):$=e[89];let ee;return e[90]!==j||e[91]!==K||e[92]!==$?(ee=h.jsxs("div",{className:j,children:[K,$]}),e[90]=j,e[91]=K,e[92]=$,e[93]=ee):ee=e[93],ee}function KS(t,e){return Ro(t,e)?1:0}function qS(t){const e=H.c(16),{locked:s,placement:i,value:r,virtualMcpId:n,userLabel:o,baseBranch:a,onChange:c,onCreateBranch:l,orgId:u,orgSlug:d,userId:f,target:p,owner:_,repo:g,sandboxMap:v}=t;let b;return e[0]!==a||e[1]!==s||e[2]!==c||e[3]!==l||e[4]!==u||e[5]!==d||e[6]!==_||e[7]!==i||e[8]!==g||e[9]!==v||e[10]!==p||e[11]!==f||e[12]!==o||e[13]!==r||e[14]!==n?(b=h.jsx(HS,{virtualMcpId:n,userLabel:o,value:r,baseBranch:a,orgId:u,orgSlug:d,userId:f,target:p,owner:_,repo:g,sandboxMap:v,onChange:c,onCreateBranch:l,spawnsNewChat:s,placement:i}),e[0]=a,e[1]=s,e[2]=c,e[3]=l,e[4]=u,e[5]=d,e[6]=_,e[7]=i,e[8]=g,e[9]=v,e[10]=p,e[11]=f,e[12]=o,e[13]=r,e[14]=n,e[15]=b):b=e[15],b}function VS(t){const e=H.c(2),{branchPill:s}=t;if(!s)return null;let i;return e[0]!==s?(i=h.jsx(h.Fragment,{children:s}),e[0]=s,e[1]=i):i=e[1],i}function GS(t){const e=H.c(19),{virtualMcp:s,currentBranch:i}=t,r=bf(),n=ds();let o;e[0]!==r?.messages||e[1]!==n?.isThreadLocked?(o=(r?.messages??[]).length>0||(n?.isThreadLocked??!1),e[0]=r?.messages,e[1]=n?.isThreadLocked,e[2]=o):o=e[2];const a=o,c=n?.setCurrentTaskBranch,l=n?.createTask;let u;e[3]!==n?.activeTask?.metadata||e[4]!==s?.metadata?(u=Oo(s?.metadata)==="cms"&&Wf(n?.activeTask?.metadata,s?.metadata)==="sandbox",e[3]=n?.activeTask?.metadata,e[4]=s?.metadata,e[5]=u):u=e[5];const d=u,f=Wo(s),p=Ut(f),{data:_}=hs.useSession(),g=_?.user;let v;e[6]!==g?(v=ta(g),e[6]=g,e[7]=v):v=e[7];const b=v,k=_?.user?.id??"",{org:w}=ut(),S=Fo(s,i);let m;e[8]!==l||e[9]!==a||e[10]!==c?(m=R=>{a&&l?l({branch:R}):c&&c(R)},e[8]=l,e[9]=a,e[10]=c,e[11]=m):m=e[11];const x=m;let y;e[12]!==d||e[13]!==l||e[14]!==a||e[15]!==c?(y=R=>{(a||d)&&l?l({branch:R}):c&&c(R)},e[12]=d,e[13]=l,e[14]=a,e[15]=c,e[16]=y):y=e[16];const C=y,N=f&&sh(p)?h.jsx(qS,{userLabel:b,virtualMcpId:s?.id??"",value:i,baseBranch:S,orgId:w.id,orgSlug:w.slug,userId:k,target:p,owner:f.owner,repo:f.name,sandboxMap:s?.metadata?.sandboxMap,onChange:x,onCreateBranch:C,locked:a,placement:"chat"},`${ih(p)}:${f.owner}/${f.name}`):null;let T;return e[17]!==N?(T=h.jsx(VS,{branchPill:N}),e[17]=N,e[18]=T):T=e[18],T}function YS(){const t=H.c(20),e=be(),{threads:s}=Ir(),{createNewTask:i}=$r(),r=Jc(),n=$i();let o;t[0]!==n||t[1]!==s?(o=s.find(v=>v.id===n)?.branch??null,t[0]=n,t[1]=s,t[2]=o):o=t[2];const a=o;let c;t[3]!==r||t[4]!==i||t[5]!==a?(c=()=>{i(r,a)},t[3]=r,t[4]=i,t[5]=a,t[6]=c):c=t[6];const l=c;let u;t[7]!==e?(u=e("sidebar.taskGroupsList.newChat"),t[7]=e,t[8]=u):u=t[8];let d;t[9]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx(Wc,{size:16}),t[9]=d):d=t[9];let f;t[10]!==l||t[11]!==u?(f=h.jsx(Je,{asChild:!0,children:h.jsx("button",{type:"button",onClick:l,"aria-label":u,className:"flex shrink-0 items-center rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:d})}),t[10]=l,t[11]=u,t[12]=f):f=t[12];let p;t[13]!==e?(p=e("sidebar.taskGroupsList.newChat"),t[13]=e,t[14]=p):p=t[14];let _;t[15]!==p?(_=h.jsx(Ze,{side:"bottom",children:p}),t[15]=p,t[16]=_):_=t[16];let g;return t[17]!==f||t[18]!==_?(g=h.jsxs(Qe,{children:[f,_]}),t[17]=f,t[18]=_,t[19]=g):g=t[19],g}function yn(t){const e=H.c(13),{label:s,value:i,onChange:r,options:n}=t;let o;e[0]!==s?(o=h.jsx("span",{className:"text-sm text-muted-foreground",children:s}),e[0]=s,e[1]=o):o=e[1];let a;e[2]!==r?(a=d=>d&&r(d),e[2]=r,e[3]=a):a=e[3];let c;e[4]!==n?(c=n.map(XS),e[4]=n,e[5]=c):c=e[5];let l;e[6]!==a||e[7]!==c||e[8]!==i?(l=h.jsx(a_,{type:"single",size:"sm",value:i,onValueChange:a,className:"gap-0.5 rounded-lg border border-border bg-muted/50 p-0.5",children:c}),e[6]=a,e[7]=c,e[8]=i,e[9]=l):l=e[9];let u;return e[10]!==o||e[11]!==l?(u=h.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o,l]}),e[10]=o,e[11]=l,e[12]=u):u=e[12],u}function XS(t){return h.jsxs(o_,{value:t.value,className:"h-6 gap-1.5 rounded-md border border-transparent px-2 text-xs font-medium text-muted-foreground hover:bg-transparent data-[state=on]:border-border data-[state=on]:bg-background data-[state=on]:text-foreground data-[state=on]:shadow-sm",children:[t.icon,t.label]},t.value)}function JS(t){const e=H.c(91),{panel:s,className:i}=t,r=i===void 0?"md:size-[34px] rounded-lg":i,n=be();let o;e[0]!==n?(o=n("sidebar.taskGroupsList.filterChats"),e[0]=n,e[1]=o):o=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(n_,{size:16}),e[2]=a):a=e[2];let c;e[3]!==s.filtersActive?(c=s.filtersActive&&h.jsx("span",{className:"absolute right-1 top-1 size-1.5 rounded-full bg-primary ring-2 ring-sidebar"}),e[3]=s.filtersActive,e[4]=c):c=e[4];let l;e[5]!==r||e[6]!==s.filtersActive||e[7]!==o||e[8]!==c?(l=h.jsx(Je,{asChild:!0,children:h.jsx(zr,{asChild:!0,children:h.jsxs(xr,{"aria-label":o,active:s.filtersActive,className:r,children:[a,c]})})}),e[5]=r,e[6]=s.filtersActive,e[7]=o,e[8]=c,e[9]=l):l=e[9];let u;e[10]!==n?(u=n("sidebar.taskGroupsList.filterChats"),e[10]=n,e[11]=u):u=e[11];let d;e[12]!==u?(d=h.jsx(Ze,{side:"bottom",children:u}),e[12]=u,e[13]=d):d=e[13];let f;e[14]!==l||e[15]!==d?(f=h.jsxs(Qe,{children:[l,d]}),e[14]=l,e[15]=d,e[16]=f):f=e[16];let p;e[17]!==n?(p=n("sidebar.taskGroupsList.filterView"),e[17]=n,e[18]=p):p=e[18];const _=s.groupBy;let g;e[19]!==s?(g=Z=>{Cs("tasks_panel_group_by_changed",{to_value:Z}),s.setGroupBy(Z)},e[19]=s,e[20]=g):g=e[20];let v;e[21]!==n?(v=n("sidebar.taskGroupsList.viewList"),e[21]=n,e[22]=v):v=e[22];let b;e[23]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx(Cf,{size:13}),e[23]=b):b=e[23];let k;e[24]!==v?(k={value:"flat",label:v,icon:b},e[24]=v,e[25]=k):k=e[25];let w;e[26]!==n?(w=n("sidebar.taskGroupsList.viewStatus"),e[26]=n,e[27]=w):w=e[27];let S;e[28]===Symbol.for("react.memo_cache_sentinel")?(S=h.jsx(kf,{size:13}),e[28]=S):S=e[28];let m;e[29]!==w?(m={value:"status",label:w,icon:S},e[29]=w,e[30]=m):m=e[30];let x;e[31]!==k||e[32]!==m?(x=[k,m],e[31]=k,e[32]=m,e[33]=x):x=e[33];let y;e[34]!==s.groupBy||e[35]!==g||e[36]!==x||e[37]!==p?(y=h.jsx(yn,{label:p,value:_,onChange:g,options:x}),e[34]=s.groupBy,e[35]=g,e[36]=x,e[37]=p,e[38]=y):y=e[38];let C;e[39]!==n?(C=n("sidebar.taskGroupsList.filterType"),e[39]=n,e[40]=C):C=e[40];const N=s.typeFilter;let T;e[41]!==s?(T=Z=>{Cs("tasks_panel_filter_changed",{to_value:Z}),s.setTypeFilter(Z)},e[41]=s,e[42]=T):T=e[42];let R;e[43]!==n?(R=n("sidebar.taskGroupsList.typeAll"),e[43]=n,e[44]=R):R=e[44];let E;e[45]!==R?(E={value:"all",label:R},e[45]=R,e[46]=E):E=e[46];let P;e[47]!==n?(P=n("sidebar.taskGroupsList.typeChats"),e[47]=n,e[48]=P):P=e[48];let A;e[49]!==P?(A={value:"manual",label:P},e[49]=P,e[50]=A):A=e[50];let M;e[51]!==n?(M=n("sidebar.taskGroupsList.typeAuto"),e[51]=n,e[52]=M):M=e[52];let L;e[53]!==M?(L={value:"automation",label:M},e[53]=M,e[54]=L):L=e[54];let B;e[55]!==E||e[56]!==A||e[57]!==L?(B=[E,A,L],e[55]=E,e[56]=A,e[57]=L,e[58]=B):B=e[58];let D;e[59]!==s.typeFilter||e[60]!==C||e[61]!==T||e[62]!==B?(D=h.jsx(yn,{label:C,value:N,onChange:T,options:B}),e[59]=s.typeFilter,e[60]=C,e[61]=T,e[62]=B,e[63]=D):D=e[63];let j;e[64]!==n?(j=n("sidebar.taskGroupsList.filterScope"),e[64]=n,e[65]=j):j=e[65];const K=s.showAll?"team":"mine";let z;e[66]!==s?(z=Z=>s.setShowAll(Z==="team"),e[66]=s,e[67]=z):z=e[67];let G;e[68]!==n?(G=n("sidebar.taskGroupsList.scopeMine"),e[68]=n,e[69]=G):G=e[69];let I;e[70]!==G?(I={value:"mine",label:G},e[70]=G,e[71]=I):I=e[71];let V;e[72]!==n?(V=n("sidebar.taskGroupsList.scopeTeam"),e[72]=n,e[73]=V):V=e[73];let $;e[74]!==V?($={value:"team",label:V},e[74]=V,e[75]=$):$=e[75];let ee;e[76]!==I||e[77]!==$?(ee=[I,$],e[76]=I,e[77]=$,e[78]=ee):ee=e[78];let se;e[79]!==j||e[80]!==K||e[81]!==z||e[82]!==ee?(se=h.jsx(yn,{label:j,value:K,onChange:z,options:ee}),e[79]=j,e[80]=K,e[81]=z,e[82]=ee,e[83]=se):se=e[83];let ie;e[84]!==y||e[85]!==D||e[86]!==se?(ie=h.jsxs(Fi,{align:"start",className:"w-64 flex flex-col gap-3 p-3",children:[y,D,se]}),e[84]=y,e[85]=D,e[86]=se,e[87]=ie):ie=e[87];let Y;return e[88]!==ie||e[89]!==f?(Y=h.jsxs(Hi,{children:[f,ie]}),e[88]=ie,e[89]=f,e[90]=Y):Y=e[90],Y}function ZS(t,e){return t.filter(s=>s.id===e||!!s.trigger_id||zh(s))}function QS(){const t=H.c(2),e=Uc()??[];let s;return t[0]!==e?(s=i=>{if(!i)return;const r=e.find(n=>n.id===i);return r?Oo(r.metadata):void 0},t[0]=e,t[1]=s):s=t[1],s}function ey(t){const e=H.c(9),{virtualMcpId:s,size:i,showAutomationBadge:r}=t,n=i===void 0?"sm":i,o=be();let a;e[0]!==n||e[1]!==s?(a=s?h.jsx(ty,{virtualMcpId:s,size:n}):h.jsx(Ri,{icon:null,name:"?",size:n}),e[0]=n,e[1]=s,e[2]=a):a=e[2];let c;e[3]!==r||e[4]!==o?(c=r&&h.jsx("span",{"aria-label":o("tasksPanel.mcpAvatar.automationTriggered"),className:"absolute -bottom-0.5 -right-0.5 flex size-4 items-center justify-center rounded-full bg-blue-500 border border-blue-600 text-white",children:h.jsx(jh,{size:10,className:"text-white"})}),e[3]=r,e[4]=o,e[5]=c):c=e[5];let l;return e[6]!==a||e[7]!==c?(l=h.jsxs("div",{className:"relative shrink-0",children:[a,c]}),e[6]=a,e[7]=c,e[8]=l):l=e[8],l}function ty(t){const e=H.c(6),{virtualMcpId:s,size:i}=t,r=us(s);if(!r){let a;return e[0]!==i?(a=h.jsx(Ri,{icon:null,name:"?",size:i}),e[0]=i,e[1]=a):a=e[1],a}const n=r.icon??null;let o;return e[2]!==r.title||e[3]!==i||e[4]!==n?(o=h.jsx(Ri,{icon:n,name:r.title,size:i}),e[2]=r.title,e[3]=i,e[4]=n,e[5]=o):o=e[5],o}const wc=["thread"];function sy(t){const e=H.c(53),{open:s,onOpenChange:i}=t,[r,n]=O.useState(""),{org:o}=ut(),{setTaskId:a}=$r(),c=Mo(),l=be();let u,d,f,p;e[0]!==o.id||e[1]!==r?(p=r.trim(),u=p?20:10,f=es,d=ks.globalSearch(o.id,p,u,wc),e[0]=o.id,e[1]=r,e[2]=u,e[3]=d,e[4]=f,e[5]=p):(u=e[2],d=e[3],f=e[4],p=e[5]);let _;e[6]!==u||e[7]!==c||e[8]!==p?(_=async()=>{const j=await c.call("GLOBAL_SEARCH",{query:p,limit:u,types:[...wc]});return{...j,items:j.items.filter(iy)}},e[6]=u,e[7]=c,e[8]=p,e[9]=_):_=e[9];let g;e[10]!==s||e[11]!==d||e[12]!==_?(g={queryKey:d,enabled:s,queryFn:_,staleTime:1e4},e[10]=s,e[11]=d,e[12]=_,e[13]=g):g=e[13];const{data:v,isFetching:b}=f(g);let k;e[14]!==v?.items?(k=v?.items??[],e[14]=v?.items,e[15]=k):k=e[15];const w=k;let S;e[16]!==i?(S=j=>{j||n(""),i(j)},e[16]=i,e[17]=S):S=e[17];const m=S;let x;e[18]!==m||e[19]!==a?(x=j=>{m(!1),a(j.id,j.virtual_mcp_id??void 0)},e[18]=m,e[19]=a,e[20]=x):x=e[20];const y=x;let C;e[21]!==l?(C=l("tasksPanel.globalSearchDialog.title"),e[21]=l,e[22]=C):C=e[22];let N;e[23]!==C?(N=h.jsx(Cp,{children:C}),e[23]=C,e[24]=N):N=e[24];let T;e[25]!==l?(T=l("tasksPanel.globalSearchDialog.description"),e[25]=l,e[26]=T):T=e[26];let R;e[27]!==T?(R=h.jsx(kp,{children:T}),e[27]=T,e[28]=R):R=e[28];let E;e[29]!==R||e[30]!==N?(E=h.jsxs(Pp,{className:"sr-only",children:[N,R]}),e[29]=R,e[30]=N,e[31]=E):E=e[31];let P;e[32]!==l?(P=l("tasksPanel.globalSearchDialog.placeholder"),e[32]=l,e[33]=P):P=e[33];let A;e[34]!==r||e[35]!==P?(A=h.jsx(Bh,{value:r,onValueChange:n,placeholder:P}),e[34]=r,e[35]=P,e[36]=A):A=e[36];let M;e[37]!==y||e[38]!==b||e[39]!==w||e[40]!==l||e[41]!==p?(M=h.jsx(Lh,{children:b&&w.length===0?h.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:l("tasksPanel.globalSearchDialog.searching")}):w.length===0?h.jsx(Dn,{children:l("tasksPanel.globalSearchDialog.noResults")}):h.jsx(Nn,{heading:p?void 0:l("tasksPanel.globalSearchDialog.recent"),children:w.map(j=>j.type==="thread"?h.jsxs(Mn,{value:`thread:${j.id}:${j.title}`,onSelect:()=>y(j),className:"gap-2.5",children:[h.jsx(ey,{virtualMcpId:j.virtual_mcp_id,size:"xs"}),h.jsx("div",{className:"flex-1 min-w-0",children:h.jsx("div",{className:"text-sm text-foreground truncate",children:j.title||l("tasksPanel.globalSearchDialog.untitledChat")})}),h.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:new Date(j.updated_at).toLocaleDateString("en-US",{month:"short",day:"numeric"})})]},`thread:${j.id}`):null)})}),e[37]=y,e[38]=b,e[39]=w,e[40]=l,e[41]=p,e[42]=M):M=e[42];let L;e[43]!==A||e[44]!==M?(L=h.jsxs(Mh,{shouldFilter:!1,className:"[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:[A,M]}),e[43]=A,e[44]=M,e[45]=L):L=e[45];let B;e[46]!==E||e[47]!==L?(B=h.jsxs(Yo,{className:"overflow-hidden p-0",closeButtonClassName:"hidden",children:[E,L]}),e[46]=E,e[47]=L,e[48]=B):B=e[48];let D;return e[49]!==m||e[50]!==s||e[51]!==B?(D=h.jsx(Go,{open:s,onOpenChange:m,children:B}),e[49]=m,e[50]=s,e[51]=B,e[52]=D):D=e[52],D}function iy(t){return t.type==="thread"}function ry(t){const e=H.c(43),{branch:s,onOutcome:i}=t,r=be();let n;e[0]!==i?(n=y=>{y||i("cancel")},e[0]=i,e[1]=n):n=e[1];let o;e[2]!==r?(o=r("sidebar.archiveWorktreeDialog.title"),e[2]=r,e[3]=o):o=e[3];let a;e[4]!==o?(a=h.jsx(kh,{children:o}),e[4]=o,e[5]=a):a=e[5];let c;e[6]!==r?(c=r("sidebar.archiveWorktreeDialog.stopsAndDeletesBefore"),e[6]=r,e[7]=c):c=e[7];let l;e[8]!==s?(l=h.jsx("span",{className:"font-mono",children:s}),e[8]=s,e[9]=l):l=e[9];let u;e[10]!==r?(u=r("sidebar.archiveWorktreeDialog.stopsAndDeletesAfter"),e[10]=r,e[11]=u):u=e[11];let d;e[12]!==c||e[13]!==l||e[14]!==u?(d=h.jsxs(Ph,{children:[c," ",l," ",u]}),e[12]=c,e[13]=l,e[14]=u,e[15]=d):d=e[15];let f;e[16]!==a||e[17]!==d?(f=h.jsxs(Eh,{children:[a,d]}),e[16]=a,e[17]=d,e[18]=f):f=e[18];let p;e[19]!==i?(p=()=>i("cancel"),e[19]=i,e[20]=p):p=e[20];let _;e[21]!==r?(_=r("sidebar.archiveWorktreeDialog.cancel"),e[21]=r,e[22]=_):_=e[22];let g;e[23]!==_||e[24]!==p?(g=h.jsx(Rh,{onClick:p,children:_}),e[23]=_,e[24]=p,e[25]=g):g=e[25];let v;e[26]===Symbol.for("react.memo_cache_sentinel")?(v=_e(af({variant:"destructive"})),e[26]=v):v=e[26];let b;e[27]!==i?(b=()=>i("confirm"),e[27]=i,e[28]=b):b=e[28];let k;e[29]!==r?(k=r("sidebar.archiveWorktreeDialog.confirm"),e[29]=r,e[30]=k):k=e[30];let w;e[31]!==b||e[32]!==k?(w=h.jsx(Th,{className:v,onClick:b,children:k}),e[31]=b,e[32]=k,e[33]=w):w=e[33];let S;e[34]!==g||e[35]!==w?(S=h.jsxs(Ah,{children:[g,w]}),e[34]=g,e[35]=w,e[36]=S):S=e[36];let m;e[37]!==S||e[38]!==f?(m=h.jsxs(Dh,{children:[f,S]}),e[37]=S,e[38]=f,e[39]=m):m=e[39];let x;return e[40]!==n||e[41]!==m?(x=h.jsx(Nh,{open:!0,onOpenChange:n,children:m}),e[40]=n,e[41]=m,e[42]=x):x=e[42],x}function ny(t,e,s){if(!s)return;const i=t.findIndex(r=>r.id===e);if(i!==-1){for(let r=i+1;r<t.length;r++){const n=t[r];if(n?.created_by===s)return n}for(let r=i-1;r>=0;r--){const n=t[r];if(n?.created_by===s)return n}}}function oy(t){return t==="ephemeral"||t.startsWith("thread:")}function $u(t){const e=H.c(45),{task:s,isActive:i,onClick:r,onArchive:n,showAutomationBadge:o,showAgentIcon:a,hideStatusIdle:c,indented:l}=t,u=be(),d=l_(s.status),f=d.icon,p=s.metadata?.kind==="tool_call_run",_=us(p?void 0:s.virtual_mcp_id);let g;e[0]!==_?(g=Wo(_),e[0]=_,e[1]=g):g=e[1];const v=g;jf(6e4);const b=o||!!s.trigger_id,k=s.id,w="button",S=0;let m;e[2]!==r?(m=z=>{z.target===z.currentTarget&&(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),r())},e[2]=r,e[3]=m):m=e[3];const x=l?"-ml-4 pl-6":"pl-[9px]",y=i?"bg-accent text-accent-foreground":"hover:bg-accent/60";let C;e[4]!==x||e[5]!==y?(C=_e("group/row flex items-center gap-2 py-1.5 rounded-md cursor-pointer transition-colors",x,"focus-visible:outline-none focus-visible:inset-ring-2 focus-visible:inset-ring-ring/50",y),e[4]=x,e[5]=y,e[6]=C):C=e[6];let N;e[7]!==p||e[8]!==a||e[9]!==_?.icon||e[10]!==_?.title?(N=a&&!p&&h.jsx(Ri,{icon:_?.icon??null,name:_?.title??"?",size:"2xs"}),e[7]=p,e[8]=a,e[9]=_?.icon,e[10]=_?.title,e[11]=N):N=e[11];let T;e[12]!==b||e[13]!==u?(T=b&&h.jsx(jh,{size:12,"aria-label":u("tasksPanel.taskRow.automationTriggered"),className:"shrink-0 text-blue-500"}),e[12]=b,e[13]=u,e[14]=T):T=e[14];let R;e[15]!==u||e[16]!==s.title?(R=s.title||u("tasksPanel.taskRow.untitledTask"),e[15]=u,e[16]=s.title,e[17]=R):R=e[17];let E;e[18]!==R?(E=h.jsx("div",{className:"text-sm text-foreground truncate",children:R}),e[18]=R,e[19]=E):E=e[19];let P;e[20]!==T||e[21]!==E?(P=h.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[T,E]}),e[20]=T,e[21]=E,e[22]=P):P=e[22];let A;e[23]!==v||e[24]!==i||e[25]!==s.branch||e[26]!==s.updated_at?(A=s.updated_at&&h.jsxs("div",{className:_e("flex items-center gap-1 text-[11px] min-w-0",i?"text-accent-foreground/70":"text-muted-foreground/60"),children:[s.branch&&!oy(s.branch)?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"truncate font-mono",children:s.branch}),h.jsx("span",{className:"shrink-0",children:"·"})]}):v?h.jsxs(h.Fragment,{children:[h.jsxs("span",{className:"truncate",children:[v.owner,"/",v.name]}),h.jsx("span",{className:"shrink-0",children:"·"})]}):null,h.jsx("span",{className:"shrink-0",children:ph(new Date(s.updated_at))})]}),e[23]=v,e[24]=i,e[25]=s.branch,e[26]=s.updated_at,e[27]=A):A=e[27];let M;e[28]!==P||e[29]!==A?(M=h.jsxs("div",{className:"flex-1 min-w-0",children:[P,A]}),e[28]=P,e[29]=A,e[30]=M):M=e[30];const L="shrink-0 grid [grid-template-areas:'slot'] items-center justify-items-center",B=!c&&h.jsx("span",{className:_e("[grid-area:slot] flex size-8 items-center justify-center pointer-events-none transition-opacity",n&&"group-hover/row:opacity-0"),"aria-label":u("tasksPanel.taskRow.statusLabel",{status:u(d.labelKey)}),children:s.status==="in_progress"?h.jsx(gt,{className:_e("size-3.5",d.iconClassName)}):h.jsx(f,{size:14,className:d.iconClassName})});let D;e[31]!==n||e[32]!==u?(D=n&&h.jsxs(Qe,{children:[h.jsx(Je,{asChild:!0,children:h.jsx("button",{type:"button","aria-label":u("tasksPanel.taskRow.archiveTask"),onClick:z=>{z.stopPropagation(),n()},className:"[grid-area:slot] opacity-0 pointer-events-none group-hover/row:opacity-100 group-hover/row:pointer-events-auto focus-visible:opacity-100 focus-visible:pointer-events-auto transition-opacity flex size-8 items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:h.jsx(lf,{size:14})})}),h.jsx(Ze,{side:"right",children:u("tasksPanel.taskRow.archive")})]}),e[31]=n,e[32]=u,e[33]=D):D=e[33];let j;e[34]!==B||e[35]!==D?(j=h.jsxs("div",{className:L,children:[B,D]}),e[34]=B,e[35]=D,e[36]=j):j=e[36];let K;return e[37]!==r||e[38]!==M||e[39]!==j||e[40]!==m||e[41]!==C||e[42]!==N||e[43]!==s.id?(K=h.jsxs("div",{"data-task-id":k,role:w,tabIndex:S,onClick:r,onKeyDown:m,className:C,children:[N,M,j]}),e[37]=r,e[38]=M,e[39]=j,e[40]=m,e[41]=C,e[42]=N,e[43]=s.id,e[44]=K):K=e[44],K}const Cc=["requires_action","in_progress","failed","expired","completed"];function ay(t){const e=new Map(Cc.map(s=>[s,[]]));for(const s of t){const i=s.status??"completed";(e.get(i)??e.get("completed")).push(s)}return Cc.map(s=>({status:s,threads:e.get(s)}))}const ly="sidebar.group.expanded.";function cy(t,e){const s=H.c(3),[i,r]=Do(`${ly}${t}`,e);let n;return s[0]!==i||s[1]!==r?(n=[i,r],s[0]=i,s[1]=r,s[2]=n):n=s[2],n}function Fu(t){const e=H.c(18),{onClick:s,isFetching:i,indented:r}=t,n=be();let o;e[0]!==n?(o=n("sidebar.showMoreButton.ariaLabel"),e[0]=n,e[1]=o):o=e[1];const a=r?"-ml-4 pl-6 pr-2":"px-2";let c;e[2]!==a?(c=_e("flex items-center gap-2 py-1.5 rounded-md text-sm text-muted-foreground",a,"hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50","transition-colors disabled:cursor-progress disabled:opacity-60"),e[2]=a,e[3]=c):c=e[3];let l;e[4]!==i?(l=i&&h.jsx(gt,{className:"size-3.5"}),e[4]=i,e[5]=l):l=e[5];let u;e[6]!==i||e[7]!==n?(u=n(i?"sidebar.showMoreButton.loading":"sidebar.showMoreButton.showMore"),e[6]=i,e[7]=n,e[8]=u):u=e[8];let d;e[9]!==u?(d=h.jsx("span",{children:u}),e[9]=u,e[10]=d):d=e[10];let f;return e[11]!==i||e[12]!==s||e[13]!==o||e[14]!==c||e[15]!==l||e[16]!==d?(f=h.jsxs("button",{type:"button","aria-label":o,onClick:s,disabled:i,className:c,children:[l,d]}),e[11]=i,e[12]=s,e[13]=o,e[14]=c,e[15]=l,e[16]=d,e[17]=f):f=e[17],f}function hy(t,e,s,i){return[t,e,s,i.type,i.member,i.currentUserId??""].join("|")}function dy(t){return t.member==="mine"&&!t.currentUserId}const Hu=4;let br=0;const To=[];function uy(){for(;br<Hu&&To.length>0;){const t=To.shift();t&&t()}}function Wu(t){return new Promise((e,s)=>{const i=()=>{br++,t().then(e,s).finally(()=>{br--,uy()})};br<Hu?i():To.push(i)})}const Gr=10;function kc(t,e,s,i,r){const n={hidden:!1};i.member==="mine"&&i.currentUserId&&(n.created_by=i.currentUserId),i.type==="automation"&&(n.has_trigger=!0),i.type==="manual"&&(n.has_trigger=!1);const o={where:n,limit:r,offset:s,orderBy:[{field:["updated_at"],direction:"desc"}]};return o.status=e,o}function fy(t,e,s,i){let r=0;for(const n of t)Uu(n,e,s,i)&&r++;return r}function xn(t,e,s,i){return fy(t,e,s,i)}function py(t,e){return!!(t>=Gr||t===0&&e)}function Pc(t,e){return t<e}function _y(t,e){return e===!1?!1:e===!0?!0:t}function Uu(t,e,s,i){return!(t.hidden||(t.status??"completed")!==s||i.member==="mine"&&i.currentUserId&&t.created_by!==i.currentUserId||i.type==="automation"&&!t.trigger_id||i.type==="manual"&&t.trigger_id)}const Lr=new Map,lr=new Map;function my(t,e){return e?t>=Gr?!0:null:!1}function Ec(t){return Lr.get(t)}function gy(t,e){Lr.set(t,e)}function vy(t,e,s){const i=Lr.get(t);if(i!==void 0){s(i);return}let r=lr.get(t);r||(r=Wu(e).then(n=>(Lr.set(t,n),lr.delete(t),n)).catch(()=>(lr.delete(t),Promise.reject(new Error("group probe failed")))),lr.set(t,r)),r.then(s,()=>s(!1))}function Rc(t){const e=t,s=Array.isArray(e.items)?e.items:[];return{items:s,hasMore:e.hasMore??s.length===Gr,totalCount:typeof e.totalCount=="number"?e.totalCount:void 0}}function by(t,e,s,i,r){let n=0;for(const o of t)e.has(o.id)||Uu(o,s,i,r)&&n++;return n}function Sy(t,e,s,i){const r=H.c(8),{org:n}=ut(),o=hy(n.id,t,e,s);let a;r[0]!==s?(a=dy(s),r[0]=s,r[1]=a):a=r[1];const c=a,[l,u]=O.useState({isFetching:!1,isProbing:!1,identity:o,probeSubscribedIdentity:null,serverHasMore:null});l.identity!==o&&u({isFetching:!1,isProbing:!1,identity:o,probeSubscribedIdentity:null,serverHasMore:null});const d=$o(),{threads:f,hasMore:p}=Ir(),_=xn(f,t,e,s),g=py(_,p),v=my(_,p),b=Mo();if(l.identity===o&&l.serverHasMore===null){const y=v??Ec(o);y!==void 0&&u({isFetching:!1,isProbing:!1,identity:o,probeSubscribedIdentity:l.probeSubscribedIdentity,serverHasMore:y})}!c&&l.identity===o&&l.serverHasMore===null&&v===null&&Ec(o)===void 0&&l.probeSubscribedIdentity!==o&&(u(y=>y.identity===o?{...y,isProbing:!0,probeSubscribedIdentity:o}:y),vy(o,async()=>{const y=kc(t,e,0,s,1),C=await b.call("COLLECTION_THREADS_LIST",y),{totalCount:N}=Rc(C),T=xn(d.threads.get(),t,e,s);return N===void 0?!1:Pc(T,N)},y=>{u(C=>C.identity!==o?C:{...C,isProbing:!1,serverHasMore:y})}));const w=async function(){if(l.isFetching||l.isProbing||c)return;const C=o;u(N=>N.identity===C?{...N,isFetching:!0}:N);try{const N=xn(f,t,e,s),T=kc(t,e,N,s,Gr),R=await Wu(()=>b.call("COLLECTION_THREADS_LIST",T)),{items:E,hasMore:P,totalCount:A}=Rc(R),M=new Set(f.map(yy)),L=by(E,M,t,e,s),B=N;d.mergeThreads(E),u(D=>{if(D.identity!==C)return D;let j;return A!==void 0?j=Pc(B+L,A):j=E.length===0||L===0?!1:P,gy(C,j),{...D,isFetching:!1,serverHasMore:j}})}catch(N){const T=N,R=T instanceof Error?T.message:String(T);Xe.error(`Could not load more tasks: ${R}`),u(E=>E.identity===C?{...E,isFetching:!1}:E)}},S=l.isFetching||l.isProbing,m=!c&&!S&&_y(g,l.serverHasMore);let x;return r[2]!==S||r[3]!==w||r[4]!==m||r[5]!==l.isProbing||r[6]!==l.serverHasMore?(x={hasMore:m,isFetching:S,isProbing:l.isProbing,serverHasMore:l.serverHasMore,loadMore:w},r[2]=S,r[3]=w,r[4]=m,r[5]=l.isProbing,r[6]=l.serverHasMore,r[7]=x):x=r[7],x}function yy(t){return t.id}function xy(t){const e=H.c(20),{status:s,threads:i,activeTaskId:r,onSelectTask:n,onArchiveTask:o,canArchive:a,filters:c}=t,{isFetching:l,isProbing:u,loadMore:d,hasMore:f,serverHasMore:p}=Sy("status",s,c),[_,g]=O.useState(!1);!_&&i.length===0&&p===!0&&!l&&!u&&(g(!0),queueMicrotask(()=>{d()}));let v;if(e[0]!==r||e[1]!==a||e[2]!==c||e[3]!==o||e[4]!==n||e[5]!==i){let w;e[7]!==r||e[8]!==a||e[9]!==c||e[10]!==o||e[11]!==n?(w=S=>h.jsx($u,{task:S,isActive:r===S.id,onClick:()=>n(S),onArchive:a&&S.created_by===c.currentUserId?()=>o(S):void 0,showAutomationBadge:!!S.trigger_id,showAgentIcon:!0,hideStatusIdle:!0,indented:!0},S.id),e[7]=r,e[8]=a,e[9]=c,e[10]=o,e[11]=n,e[12]=w):w=e[12],v=i.map(w),e[0]=r,e[1]=a,e[2]=c,e[3]=o,e[4]=n,e[5]=i,e[6]=v}else v=e[6];let b;e[13]!==f||e[14]!==l||e[15]!==d?(b=(f||l)&&h.jsx(Fu,{onClick:()=>{d()},isFetching:l,indented:!0}),e[13]=f,e[14]=l,e[15]=d,e[16]=b):b=e[16];let k;return e[17]!==v||e[18]!==b?(k=h.jsxs(h.Fragment,{children:[v,b]}),e[17]=v,e[18]=b,e[19]=k):k=e[19],k}function wy(t){const e=H.c(39),{status:s,threads:i,activeTaskId:r,onSelectTask:n,onArchiveTask:o,canArchive:a,filters:c}=t,l=be(),u=c_[s],d=u.icon,[f,p]=cy(`status-${s}`,!1);let _;e[0]!==f||e[1]!==p?(_=function(){p(!f)},e[0]=f,e[1]=p,e[2]=_):_=e[2];const g=_;let v;e[3]!==g?(v=T=>{T.target===T.currentTarget&&(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),g())},e[3]=g,e[4]=v):v=e[4];let b;e[5]!==d||e[6]!==u.iconClassName?(b=h.jsx("span",{className:"absolute inset-0 flex items-center justify-center transition-opacity group-hover/group:opacity-0",children:h.jsx(d,{size:12,className:u.iconClassName})}),e[5]=d,e[6]=u.iconClassName,e[7]=b):b=e[7];let k;e[8]!==f?(k=h.jsx("span",{className:"absolute inset-0 flex items-center justify-center text-muted-foreground opacity-0 transition-opacity group-hover/group:opacity-100",children:f?h.jsx($s,{size:14}):h.jsx(Jo,{size:14})}),e[8]=f,e[9]=k):k=e[9];let w;e[10]!==b||e[11]!==k?(w=h.jsxs("div",{className:"relative size-5 shrink-0 flex items-center justify-center",children:[b,k]}),e[10]=b,e[11]=k,e[12]=w):w=e[12];let S;e[13]!==u.labelKey||e[14]!==l?(S=l(u.labelKey),e[13]=u.labelKey,e[14]=l,e[15]=S):S=e[15];let m;e[16]!==S?(m=h.jsx("span",{className:"flex-1 truncate",children:S}),e[16]=S,e[17]=m):m=e[17];let x;e[18]!==i.length?(x=h.jsx("div",{className:"size-5 shrink-0 flex items-center justify-center",children:h.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:i.length})}),e[18]=i.length,e[19]=x):x=e[19];let y;e[20]!==f||e[21]!==g||e[22]!==v||e[23]!==w||e[24]!==m||e[25]!==x?(y=h.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":f,onClick:g,onKeyDown:v,className:"group/group flex items-center gap-2 px-2 py-1.5 rounded-md text-sm font-medium text-foreground cursor-pointer hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 transition-colors",children:[w,m,x]}),e[20]=f,e[21]=g,e[22]=v,e[23]=w,e[24]=m,e[25]=x,e[26]=y):y=e[26];let C;e[27]!==r||e[28]!==a||e[29]!==f||e[30]!==c||e[31]!==o||e[32]!==n||e[33]!==s||e[34]!==i?(C=f&&h.jsx("div",{className:"flex flex-col gap-0.5 pb-1 pl-4",children:h.jsx(xy,{status:s,threads:i,activeTaskId:r,onSelectTask:n,onArchiveTask:o,canArchive:a,filters:c})}),e[27]=r,e[28]=a,e[29]=f,e[30]=c,e[31]=o,e[32]=n,e[33]=s,e[34]=i,e[35]=C):C=e[35];let N;return e[36]!==C||e[37]!==y?(N=h.jsxs("div",{className:"flex flex-col gap-0.5",children:[y,C]}),e[36]=C,e[37]=y,e[38]=N):N=e[38],N}function Cy(t){const e=H.c(38),{threads:s,groupBy:i,activeTaskId:r,onSelectTask:n,onArchiveTask:o,filters:a,hasMore:c,isFetchingMore:l,onLoadMore:u,filtersActive:d}=t;if(s.length===0&&!c&&!l){let v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v=h.jsx(Pf,{className:"size-6 opacity-60"}),e[0]=v):v=e[0];const b=d?"No chats match your filters":"No chats yet";let k;return e[1]!==b?(k=h.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 px-4 py-12 text-center text-muted-foreground",children:[v,h.jsx("p",{className:"text-sm",children:b})]}),e[1]=b,e[2]=k):k=e[2],k}const f=s.length>1||c;if(i==="status"){let v;if(e[3]!==r||e[4]!==f||e[5]!==a||e[6]!==o||e[7]!==n||e[8]!==s){let k;e[10]!==r||e[11]!==f||e[12]!==a||e[13]!==o||e[14]!==n?(k=w=>h.jsx(wy,{status:w.status,threads:w.threads,activeTaskId:r,onSelectTask:n,onArchiveTask:o,canArchive:f,filters:a},w.status),e[10]=r,e[11]=f,e[12]=a,e[13]=o,e[14]=n,e[15]=k):k=e[15],v=ay(s).map(k),e[3]=r,e[4]=f,e[5]=a,e[6]=o,e[7]=n,e[8]=s,e[9]=v}else v=e[9];let b;return e[16]!==v?(b=h.jsx(h.Fragment,{children:v}),e[16]=v,e[17]=b):b=e[17],b}let p;if(e[18]!==r||e[19]!==f||e[20]!==a||e[21]!==o||e[22]!==n||e[23]!==s){let v;e[25]!==r||e[26]!==f||e[27]!==a||e[28]!==o||e[29]!==n?(v=b=>h.jsx($u,{task:b,isActive:r===b.id,onClick:()=>n(b),onArchive:f&&b.created_by===a.currentUserId?()=>o(b):void 0,showAutomationBadge:!!b.trigger_id,showAgentIcon:!0},b.id),e[25]=r,e[26]=f,e[27]=a,e[28]=o,e[29]=n,e[30]=v):v=e[30],p=s.map(v),e[18]=r,e[19]=f,e[20]=a,e[21]=o,e[22]=n,e[23]=s,e[24]=p}else p=e[24];let _;e[31]!==c||e[32]!==l||e[33]!==u?(_=(c||l)&&h.jsx(Fu,{onClick:u,isFetching:l}),e[31]=c,e[32]=l,e[33]=u,e[34]=_):_=e[34];let g;return e[35]!==p||e[36]!==_?(g=h.jsxs(h.Fragment,{children:[p,_]}),e[35]=p,e[36]=_,e[37]=g):g=e[37],g}function ky(t,e){return null}function Py(t,e){return t.some(s=>s.id!==e.taskId&&!s.hidden&&s.branch===e.branch&&s.virtual_mcp_id===e.virtualMcpId)}const Ey=["archive","reclaim-worktree"],Ry=[];function Ty(t){return t==="confirm"?Ey:Ry}function Ay(t){const e=H.c(11),{panel:s}=t;let i;return e[0]!==s.activeTaskId||e[1]!==s.archiveTask||e[2]!==s.filters||e[3]!==s.filtersActive||e[4]!==s.groupBy||e[5]!==s.hasMore||e[6]!==s.isFetchingMore||e[7]!==s.loadMore||e[8]!==s.selectTask||e[9]!==s.threads?(i=h.jsx(Cy,{threads:s.threads,groupBy:s.groupBy,activeTaskId:s.activeTaskId,onSelectTask:s.selectTask,onArchiveTask:s.archiveTask,filters:s.filters,hasMore:s.hasMore,isFetchingMore:s.isFetchingMore,onLoadMore:s.loadMore,filtersActive:s.filtersActive}),e[0]=s.activeTaskId,e[1]=s.archiveTask,e[2]=s.filters,e[3]=s.filtersActive,e[4]=s.groupBy,e[5]=s.hasMore,e[6]=s.isFetchingMore,e[7]=s.loadMore,e[8]=s.selectTask,e[9]=s.threads,e[10]=i):i=e[10],i}function Dy(t){const e=H.c(83);let s;e[0]!==t?(s=t===void 0?{}:t,e[0]=t,e[1]=s):s=e[1];const{onNavigate:i}=s,r=be(),{data:n}=hs.useSession(),o=n?.user?.id,{org:a}=ut();let c;e[2]!==a.id?(c=Bi(a.id),e[2]=a.id,e[3]=c):c=e[3];const l=c.id,u=QS(),{threads:d,hasMore:f,isFetchingMore:p,fetchNextPage:_}=Ir(),g=d.filter(Ly),{hide:v,setScope:b}=zo(),k=ji(),w=Mo(),{setTaskId:S,createNewTask:m}=$r(),x=Zc(),y=$i();let C;e[4]!==y||e[5]!==d||e[6]!==x?(C=op({routeAgentId:x,threadVirtualMcpId:d.find(ve=>ve.id===y)?.virtual_mcp_id}),e[4]=y,e[5]=d,e[6]=x,e[7]=C):C=e[7];const N=C;let T;e[8]!==i?(T=()=>{i?.()},e[8]=i,e[9]=T):T=e[9];const R=T,E=[...g].sort(By),[P,A]=O.useState("all"),[M,L]=O.useState("flat"),[B,D]=Do("sidebar-threads-scope-all",!1),[j,K]=O.useState(!1),[z,G]=O.useState(!1);let I;e[10]!==K?(I=()=>{Cs("tasks_panel_search_opened"),G(!0),K(!0)},e[10]=K,e[11]=I):I=e[11];const V=I,[$,ee]=O.useState(null),se=o??null;let ie;e[12]!==se||e[13]!==P?(ie={type:P,member:"mine",currentUserId:se},e[12]=se,e[13]=P,e[14]=ie):ie=e[14];const Y=ie,Z={};B||(Z.created_by="me"),b(Z);let X;e[15]!==o?(X=ve=>o?ve.filter(Ee=>Ee.created_by===o):[],e[15]=o,e[16]=X):X=e[16];const U=X;let J;e[17]!==P?(J=ve=>P==="automation"?ve.filter(My):P==="manual"?ve.filter(Ny):ve,e[17]=P,e[18]=J):J=e[18];const ae=J,q=ZS(ae(B?E:U(E)),y);let F;e[19]!==y||e[20]!==R||e[21]!==o||e[22]!==v||e[23]!==k||e[24]!==a.slug||e[25]!==S||e[26]!==q?(F=ve=>{const Ee=ve.id===y,et=v(ve.id);if(Xp(ve.id),!Ee)return et;const Ve=ny(q,ve.id,o);return R(),Ve?S(Ve.id,Ve.virtual_mcp_id):k({to:"/$org",params:{org:a.slug}}),et},e[19]=y,e[20]=R,e[21]=o,e[22]=v,e[23]=k,e[24]=a.slug,e[25]=S,e[26]=q,e[27]=F):F=e[27];const Q=F;let he;e[28]!==w||e[29]!==r?(he=async ve=>{try{await w.call("SANDBOX_DELETE",{virtualMcpId:ve.virtualMcpId,branch:ve.branch,removeWorktree:!0})}catch{Xe.error(r("sidebar.archiveWorktreeDialog.reclaimFailed",{branch:ve.branch}))}},e[28]=w,e[29]=r,e[30]=he):he=e[30];const ue=he;let fe;e[31]!==d||e[32]!==Q||e[33]!==o||e[34]!==ee?(fe=ve=>{if(o&&ve.created_by&&ve.created_by!==o)return;const Ee=ky();if(!Ee||Py(d,Ee)){Q(ve);return}ee({task:ve,target:Ee})},e[31]=d,e[32]=Q,e[33]=o,e[34]=ee,e[35]=fe):fe=e[35];const ne=fe;let ce;e[36]!==Q||e[37]!==$||e[38]!==ue||e[39]!==ee?(ce=ve=>{const Ee=$;Ee&&(ee(null),(async()=>{for(const et of Ty(ve))if(et==="archive")try{await Q(Ee.task)}catch{return}else await ue(Ee.target)})())},e[36]=Q,e[37]=$,e[38]=ue,e[39]=ee,e[40]=ce):ce=e[40];const de=ce;let le;e[41]!==R||e[42]!==S?(le=ve=>{R(),S(ve.id,ve.virtual_mcp_id)},e[41]=R,e[42]=S,e[43]=le):le=e[43];const re=le;let ge;e[44]!==N||e[45]!==y||e[46]!==d||e[47]!==R||e[48]!==m||e[49]!==o||e[50]!==l||e[51]!==u||e[52]!==S?(ge=()=>{const ve=N??l;Cs("sidebar_new_thread_clicked",{virtual_mcp_id:ve}),R();const Ee=Yf(d,ve,o,u(ve));if(Ee){S(Ee.id,Ee.virtual_mcp_id);return}const et=d.find(Ve=>Ve.id===y)?.branch??null;m(ve,et)},e[44]=N,e[45]=y,e[46]=d,e[47]=R,e[48]=m,e[49]=o,e[50]=l,e[51]=u,e[52]=S,e[53]=ge):ge=e[53];const Ce=ge;let we;e[54]!==_?(we=()=>{_()},e[54]=_,e[55]=we):we=e[55];const Oe=M!=="flat"||P!=="all"||B;let Ue;e[56]!==de||e[57]!==$?(Ue=$?h.jsx(ry,{branch:$.target.branch,onOutcome:de}):null,e[56]=de,e[57]=$,e[58]=Ue):Ue=e[58];let Ke;e[59]!==z||e[60]!==j||e[61]!==K?(Ke=z?h.jsx(sy,{open:j,onOpenChange:K}):null,e[59]=z,e[60]=j,e[61]=K,e[62]=Ke):Ke=e[62];let qe;return e[63]!==y||e[64]!==ne||e[65]!==Y||e[66]!==M||e[67]!==f||e[68]!==p||e[69]!==Ce||e[70]!==V||e[71]!==re||e[72]!==L||e[73]!==D||e[74]!==A||e[75]!==B||e[76]!==we||e[77]!==Oe||e[78]!==Ue||e[79]!==Ke||e[80]!==P||e[81]!==q?(qe={threads:q,activeTaskId:y,filters:Y,hasMore:f,isFetchingMore:p,loadMore:we,groupBy:M,setGroupBy:L,typeFilter:P,setTypeFilter:A,showAll:B,setShowAll:D,filtersActive:Oe,selectTask:re,archiveTask:ne,newThread:Ce,openSearch:V,reclaimDialog:Ue,searchDialog:Ke},e[63]=y,e[64]=ne,e[65]=Y,e[66]=M,e[67]=f,e[68]=p,e[69]=Ce,e[70]=V,e[71]=re,e[72]=L,e[73]=D,e[74]=A,e[75]=B,e[76]=we,e[77]=Oe,e[78]=Ue,e[79]=Ke,e[80]=P,e[81]=q,e[82]=qe):qe=e[82],qe}function Ny(t){return!t.trigger_id}function My(t){return!!t.trigger_id}function By(t,e){return(e.updated_at??"").localeCompare(t.updated_at??"")}function Ly(t){return!t.hidden}function jy(){const t=H.c(60),e=be(),[s,i]=O.useState(!1);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={onNavigate:()=>i(!1)},t[0]=r):r=t[0];const n=Dy(r),o=ds()?.activeTask;let a;t[1]!==o?.title||t[2]!==n.activeTaskId||t[3]!==n.threads||t[4]!==e?(a=o?.title||n.threads.find(D=>D.id===n.activeTaskId)?.title||e("tasksPanel.taskRow.untitledTask"),t[1]=o?.title,t[2]=n.activeTaskId,t[3]=n.threads,t[4]=e,t[5]=a):a=t[5];const c=a;let l;t[6]!==n?(l=()=>{i(!1),n.openSearch()},t[6]=n,t[7]=l):l=t[7];const u=l;let d;t[8]!==e?(d=e("chat.threadsMenu.chats"),t[8]=e,t[9]=d):d=t[9];const f=s&&"bg-sidebar-accent";let p;t[10]!==f?(p=_e("flex h-[34px] min-w-0 shrink items-center gap-1.5 rounded-lg px-2 text-sm text-foreground transition-colors hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",f),t[10]=f,t[11]=p):p=t[11];let _;t[12]===Symbol.for("react.memo_cache_sentinel")?(_=h.jsx(Ef,{size:16,className:"shrink-0"}),t[12]=_):_=t[12];let g;t[13]!==c?(g=h.jsx("span",{className:"truncate max-w-[10rem] font-medium",children:c}),t[13]=c,t[14]=g):g=t[14];let v;t[15]===Symbol.for("react.memo_cache_sentinel")?(v=h.jsx($s,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),t[15]=v):v=t[15];let b;t[16]!==d||t[17]!==p||t[18]!==g?(b=h.jsx(Je,{asChild:!0,children:h.jsx(zr,{asChild:!0,children:h.jsxs("button",{type:"button","aria-label":d,className:p,children:[_,g,v]})})}),t[16]=d,t[17]=p,t[18]=g,t[19]=b):b=t[19];let k;t[20]!==e?(k=e("chat.threadsMenu.chats"),t[20]=e,t[21]=k):k=t[21];let w;t[22]!==k?(w=h.jsx(Ze,{side:"bottom",children:k}),t[22]=k,t[23]=w):w=t[23];let S;t[24]!==w||t[25]!==b?(S=h.jsxs(Qe,{children:[b,w]}),t[24]=w,t[25]=b,t[26]=S):S=t[26];let m;t[27]!==n?(m=h.jsx(JS,{panel:n,className:"size-8 rounded-lg"}),t[27]=n,t[28]=m):m=t[28];let x;t[29]!==e?(x=e("sidebar.taskGroupsList.searchChats"),t[29]=e,t[30]=x):x=t[30];let y;t[31]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(Rf,{size:16}),t[31]=y):y=t[31];let C;t[32]!==u||t[33]!==x?(C=h.jsx(xr,{"aria-label":x,onClick:u,className:"size-8 rounded-lg",children:y}),t[32]=u,t[33]=x,t[34]=C):C=t[34];let N;t[35]!==e?(N=e("sidebar.taskGroupsList.newChat"),t[35]=e,t[36]=N):N=t[36];let T;t[37]===Symbol.for("react.memo_cache_sentinel")?(T=h.jsx(Wc,{size:16}),t[37]=T):T=t[37];let R;t[38]!==n.newThread||t[39]!==N?(R=h.jsx(xr,{"aria-label":N,onClick:n.newThread,className:"size-8 rounded-lg",children:T}),t[38]=n.newThread,t[39]=N,t[40]=R):R=t[40];let E;t[41]!==C||t[42]!==R?(E=h.jsxs("div",{className:"flex items-center gap-0.5",children:[C,R]}),t[41]=C,t[42]=R,t[43]=E):E=t[43];let P;t[44]!==m||t[45]!==E?(P=h.jsxs("div",{className:"flex shrink-0 items-center justify-between",children:[m,E]}),t[44]=m,t[45]=E,t[46]=P):P=t[46];let A;t[47]!==n?(A=h.jsx("div",{className:"flex max-h-[60vh] min-h-0 flex-col gap-0.5 overflow-y-auto overscroll-contain",children:h.jsx(Ay,{panel:n})}),t[47]=n,t[48]=A):A=t[48];let M;t[49]!==P||t[50]!==A?(M=h.jsxs(Fi,{align:"start",side:"bottom",onOpenAutoFocus:Iy,className:"flex w-80 flex-col gap-2 p-2",children:[P,A]}),t[49]=P,t[50]=A,t[51]=M):M=t[51];let L;t[52]!==s||t[53]!==S||t[54]!==M?(L=h.jsxs(Hi,{open:s,onOpenChange:i,children:[S,M]}),t[52]=s,t[53]=S,t[54]=M,t[55]=L):L=t[55];let B;return t[56]!==n.reclaimDialog||t[57]!==n.searchDialog||t[58]!==L?(B=h.jsxs(h.Fragment,{children:[L,n.searchDialog,n.reclaimDialog]}),t[56]=n.reclaimDialog,t[57]=n.searchDialog,t[58]=L,t[59]=B):B=t[59],B}function Iy(t){return t.preventDefault()}function Ku(t){const e=H.c(4),{chatContent:s}=t;let i;e[0]!==s?(i=s??h.jsx(Oh,{}),e[0]=s,e[1]=i):i=e[1];let r;return e[2]!==i?(r=h.jsx("div",{"data-testid":"chat-panel",className:"h-full min-h-0",children:i}),e[2]=i,e[3]=r):r=e[3],r}function wn(t){const e=H.c(25),{side:s,open:i,disabled:r,onToggle:n}=t,o=be();let a;e[0]!==i||e[1]!==s||e[2]!==o?(a=o(i?s==="left"?"agentShellLayout.toggleButtons.hideChat":"agentShellLayout.toggleButtons.hidePanel":s==="left"?"agentShellLayout.toggleButtons.showChat":"agentShellLayout.toggleButtons.showPanel"),e[0]=i,e[1]=s,e[2]=o,e[3]=a):a=e[3];const c=a;let l;e[4]!==n||e[5]!==i||e[6]!==s?(l=()=>{Cs("agent_toolbar_toggled",{button:s==="left"?"chat":"main",next_state:i?"closed":"open"}),n()},e[4]=n,e[5]=i,e[6]=s,e[7]=l):l=e[7];const u=l;if(s==="left"){let g,v;e[8]===Symbol.for("react.memo_cache_sentinel")?(g=_e("flex h-10 md:h-7 shrink-0 items-center gap-1.5 rounded-md px-2 text-sm disabled:opacity-40",lh()),v=h.jsx(Io,{size:16}),e[8]=g,e[9]=v):(g=e[8],v=e[9]);let b;return e[10]!==r||e[11]!==c||e[12]!==u||e[13]!==g?(b=h.jsxs("button",{type:"button",disabled:r,onClick:u,className:g,children:[v,c]}),e[10]=r,e[11]=c,e[12]=u,e[13]=g,e[14]=b):b=e[14],b}let d;e[15]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx(Tf,{size:16}),e[15]=d):d=e[15];let f;e[16]!==r||e[17]!==c||e[18]!==u?(f=h.jsx(Je,{asChild:!0,children:h.jsx(xr,{"aria-label":c,disabled:r,onClick:u,className:"size-7 rounded-md disabled:opacity-40",children:d})}),e[16]=r,e[17]=c,e[18]=u,e[19]=f):f=e[19];let p;e[20]!==c?(p=h.jsx(Ze,{side:"bottom",children:c}),e[20]=c,e[21]=p):p=e[21];let _;return e[22]!==f||e[23]!==p?(_=h.jsxs(Qe,{children:[f,p]}),e[22]=f,e[23]=p,e[24]=_):_=e[24],_}function Tc(t){const e=H.c(10);let s,i,r;e[0]!==t?({children:s,className:i,...r}=t,e[0]=t,e[1]=s,e[2]=i,e[3]=r):(s=e[1],i=e[2],r=e[3]);let n;e[4]!==i?(n=_e("@container/panel-header flex h-12 shrink-0 items-center gap-1 px-1.5",i),e[4]=i,e[5]=n):n=e[5];let o;return e[6]!==s||e[7]!==r||e[8]!==n?(o=h.jsx("div",{className:n,...r,children:s}),e[6]=s,e[7]=r,e[8]=n,e[9]=o):o=e[9],o}const Yr=O.createContext(null);function Oy(t){const e=H.c(5),{children:s}=t,[i,r]=O.useState(null);let n;e[0]!==i?(n={slotEl:i,setSlotEl:r},e[0]=i,e[1]=n):n=e[1];let o;return e[2]!==s||e[3]!==n?(o=h.jsx(Yr,{value:n,children:s}),e[2]=s,e[3]=n,e[4]=o):o=e[4],o}function zy(t){const e=H.c(5),{className:s}=t,r=O.use(Yr)?.setSlotEl;let n;e[0]!==s?(n=_e("flex min-w-0 items-center",s),e[0]=s,e[1]=n):n=e[1];let o;return e[2]!==r||e[3]!==n?(o=h.jsx("div",{ref:r,className:n}),e[2]=r,e[3]=n,e[4]=o):o=e[4],o}function p2({children:t}){const e=O.use(Yr);return e?.slotEl?cf.createPortal(t,e.slotEl):null}function _2(){return O.use(Yr)?.slotEl??null}const Cn="workspace-side-panel",Ac="workspace-main-panel";function Dc(t){const e=H.c(7),{children:s,header:i,testId:r}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=_e("min-h-0 flex-1 overflow-hidden rounded-[0.75rem] bg-background card-shadow [transform:translateZ(0)]","flex flex-col"),e[0]=n):n=e[0];let o;e[1]!==s?(o=h.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:s}),e[1]=s,e[2]=o):o=e[2];let a;return e[3]!==i||e[4]!==o||e[5]!==r?(a=h.jsx("div",{className:"flex h-full min-h-0 flex-col p-0.5",children:h.jsxs("div",{"data-testid":r,className:n,children:[i,o]})}),e[3]=i,e[4]=o,e[5]=r,e[6]=a):a=e[6],a}function $y(t){const e=H.c(4),{virtualMcpId:s,taskId:i,disableActiveMainToggle:r}=t;let n;return e[0]!==r||e[1]!==i||e[2]!==s?(n=h.jsx(Pb,{virtualMcpId:s,taskId:i,disableActiveMainToggle:r}),e[0]=r,e[1]=i,e[2]=s,e[3]=n):n=e[3],n}function Fy(t){const e=H.c(76),{virtualMcpId:s,taskId:i,entity:r,sidePanelOpen:n,mainOpen:o,toggleSidePanel:a,toggleMain:c,chatContent:l}=t,[u,d]=Fm(),f=O.useRef(null);let p;e[0]!==o||e[1]!==n?(p=Y_({sidePanelOpen:n,mainOpen:o}),e[0]=o,e[1]=n,e[2]=p):p=e[2];const _=p,g=n&&o?u:_.side,v=100-g;let b;e[3]===Symbol.for("react.memo_cache_sentinel")?(b=h.jsx(YS,{}),e[3]=b):b=e[3];const k=b;let w;e[4]===Symbol.for("react.memo_cache_sentinel")?(w=h.jsx(jy,{}),e[4]=w):w=e[4];const S=w;let m;e[5]!==r?(m=h.jsx(BS,{virtualMcp:r}),e[5]=r,e[6]=m):m=e[6];const x=m,y=ds()?.currentBranch??null,C=eh(r.metadata?.ui?.layout??null);let N;e[7]!==C||e[8]!==y||e[9]!==r?(N=nh(C)?h.jsx(GS,{virtualMcp:r,currentBranch:y}):null,e[7]=C,e[8]=y,e[9]=r,e[10]=N):N=e[10];const T=N;let R,E;e[11]!==v||e[12]!==g?(R=()=>{f.current?.setLayout({[Cn]:g,[Ac]:v})},E=[g,v],e[11]=v,e[12]=g,e[13]=R,e[14]=E):(R=e[13],E=e[14]),O.useEffect(R,E);let P;e[15]!==o||e[16]!==c?(P=!o&&h.jsx(wn,{side:"right",open:o,onToggle:c}),e[15]=o,e[16]=c,e[17]=P):P=e[17];let A;e[18]!==P?(A=h.jsxs(Tc,{children:[S,h.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[k,P]})]}),e[18]=P,e[19]=A):A=e[19];const M=A,L=!o;let B;e[20]!==n||e[21]!==L||e[22]!==a?(B=h.jsx(wn,{side:"left",open:n,disabled:L,onToggle:a}),e[20]=n,e[21]=L,e[22]=a,e[23]=B):B=e[23];let D;e[24]!==i||e[25]!==s?(D=h.jsx($y,{virtualMcpId:s,taskId:i,disableActiveMainToggle:!1}),e[24]=i,e[25]=s,e[26]=D):D=e[26];let j;e[27]!==B||e[28]!==D?(j=h.jsxs("div",{className:"flex min-w-0 shrink items-center gap-0.5 overflow-hidden",children:[B,D]}),e[27]=B,e[28]=D,e[29]=j):j=e[29];let K;e[30]===Symbol.for("react.memo_cache_sentinel")?(K=h.jsx("div",{className:"flex min-w-0 flex-1 items-center justify-center",children:h.jsx(zy,{className:"@max-sm/panel-header:hidden"})}),e[30]=K):K=e[30];let z;e[31]!==T?(z=h.jsx("div",{className:"flex min-w-0 shrink items-center justify-end",children:T}),e[31]=T,e[32]=z):z=e[32];let G;e[33]!==o||e[34]!==c?(G=h.jsx(wn,{side:"right",open:o,onToggle:c}),e[33]=o,e[34]=c,e[35]=G):G=e[35];let I;e[36]!==x||e[37]!==G?(I=h.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-1",children:[x,G]}),e[36]=x,e[37]=G,e[38]=I):I=e[38];let V;e[39]!==z||e[40]!==I?(V=h.jsxs("div",{className:"flex min-w-0 shrink items-center justify-end gap-1",children:[z,I]}),e[39]=z,e[40]=I,e[41]=V):V=e[41];let $;e[42]!==j||e[43]!==V?($=h.jsxs(Tc,{className:"justify-between gap-2",children:[j,K,V]}),e[42]=j,e[43]=V,e[44]=$):$=e[44];const ee=$,se=`${s}-${i}`;let ie,Y;e[45]===Symbol.for("react.memo_cache_sentinel")?(ie=_e("flex-1 min-h-0 pt-1 pb-1 pr-1 pl-0 [&>[data-workspace-panel-open]]:!min-w-[320px]"),Y={overflow:"visible"},e[45]=ie,e[46]=Y):(ie=e[45],Y=e[46]);let Z;e[47]!==o||e[48]!==d||e[49]!==n?(Z=(re,ge)=>{const{isUserInteraction:Ce}=ge,we=re[Cn];Ce&&n&&o&&typeof we=="number"&&we>0&&we<100&&d(we)},e[47]=o,e[48]=d,e[49]=n,e[50]=Z):Z=e[50];const X=`${_.side}%`,U=n?"":void 0,J=n?M:null;let ae;e[51]!==l||e[52]!==n?(ae=n&&h.jsx(Ku,{chatContent:l}),e[51]=l,e[52]=n,e[53]=ae):ae=e[53];let q;e[54]!==J||e[55]!==ae?(q=h.jsx(Dc,{testId:"side-panel",header:J,children:ae}),e[54]=J,e[55]=ae,e[56]=q):q=e[56];let F;e[57]!==X||e[58]!==U||e[59]!==q?(F=h.jsx(cl,{id:Cn,defaultSize:X,minSize:"20%",collapsible:!0,collapsedSize:"0%","data-workspace-panel-open":U,className:"min-w-0 overflow-hidden bg-sidebar",children:q}),e[57]=X,e[58]=U,e[59]=q,e[60]=F):F=e[60];let Q;e[61]===Symbol.for("react.memo_cache_sentinel")?(Q=h.jsx(Om,{className:"bg-sidebar"}),e[61]=Q):Q=e[61];const he=`${_.main}%`,ue=o?"":void 0,fe=o?ee:null;let ne;e[62]!==s?(ne=h.jsx(Jd,{virtualMcpId:s}),e[62]=s,e[63]=ne):ne=e[63];let ce;e[64]!==fe||e[65]!==ne?(ce=h.jsx(Dc,{testId:"main-panel",header:fe,children:ne}),e[64]=fe,e[65]=ne,e[66]=ce):ce=e[66];let de;e[67]!==he||e[68]!==ue||e[69]!==ce?(de=h.jsx(cl,{id:Ac,defaultSize:he,minSize:"20%",collapsible:!0,collapsedSize:"0%","data-workspace-panel-open":ue,className:"min-w-0 overflow-hidden bg-sidebar",children:ce}),e[67]=he,e[68]=ue,e[69]=ce,e[70]=de):de=e[70];let le;return e[71]!==se||e[72]!==Z||e[73]!==F||e[74]!==de?(le=h.jsx(Oy,{children:h.jsxs(Im,{ref:f,orientation:"horizontal",className:ie,style:Y,onLayoutChanged:Z,children:[F,Q,de]},se)}),e[71]=se,e[72]=Z,e[73]=F,e[74]=de,e[75]=le):le=e[75],le}const kn="__mobile-main-panel-tab-select__",Ao="main";function Hy({tabs:t,activeTab:e,mainOpen:s,t:i}){const r=t.find(o=>o.id===e),n=i("mainPanelTabs.mobileMainPanelTabSelect.mainView");return s?r?.title??n:r?.title??t[0]?.title??n}const Wy={kind:"component",Component:Io},Uy={kind:"component",Component:Af},Ky={kind:"component",Component:dp},qy={kind:"component",Component:Fc};function Vy({tabs:t,overlayEnabled:e,t:s}){return[{value:"chat",title:s("mainPanelTabs.mobileMainPanelTabSelect.chat"),icon:Wy},...t.length>0?t.map(i=>({value:i.id,title:i.title,icon:i.icon})):[{value:Ao,title:s("mainPanelTabs.mobileMainPanelTabSelect.mainView"),icon:qy}],...e?[{value:"board",title:s("mainPanelTabs.mobileMainPanelTabSelect.tasks"),icon:Uy},{value:"files",title:s("mainPanelTabs.mobileMainPanelTabSelect.library"),icon:Ky}]:[]]}function Gy(t){const e=H.c(53),{virtualMcpId:s,taskId:i}=t,r=be(),n=ji(),{openPanel:o}=Qc();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},e[0]=a):a=e[0];const c=ri(a);let l;e[1]!==i||e[2]!==s?(l={virtualMcpId:s,taskId:i},e[1]=i,e[2]=s,e[3]=l):l=e[3];const{tabs:u,activeTab:d,mainOpen:f}=zc(l),{org:p}=ut(),_=mf();let g;e[4]!==p.id?(g=Ia(p.id),e[4]=p.id,e[5]=g):g=e[5];const v=s===g;let b,k,w,S,m,x,y,C,N,T;if(e[6]!==d||e[7]!==f||e[8]!==n||e[9]!==v||e[10]!==o||e[11]!==p.id||e[12]!==c.org||e[13]!==c.taskId||e[14]!==_||e[15]!==r||e[16]!==u||e[17]!==s){S=Symbol.for("react.early_return_sentinel");e:{const P=Vy({tabs:u,overlayEnabled:!!(c.org&&c.taskId),t:r}),A=f?P.find(I=>I.value===d)?.value??Ao:"chat",M=P.find(I=>I.value===A),L=M?.title??Hy({tabs:u,activeTab:d,mainOpen:f,t:r});let B;e[28]!==n?(B=I=>{n({to:".",search:V=>({...V,...J_(I)}),replace:!0})},e[28]=n,e[29]=B):B=e[29];const D=B;let j;e[30]!==v||e[31]!==o||e[32]!==p.id||e[33]!==_||e[34]!==D||e[35]!==s?(j=I=>{if(I!==kn){if(Cs("main_panel_tab_clicked",{virtual_mcp_id:s,tab_id:I,source:"mobile_select"}),_p({reportsOnly:_,onReportAgent:v,tabId:I})){o(I,{virtualmcpid:Ia(p.id),search:Jy});return}if(I==="chat"||I===Ao){D(I==="chat"?"chat":"main");return}o(I,{search:Xy})}},e[30]=v,e[31]=o,e[32]=p.id,e[33]=_,e[34]=D,e[35]=s,e[36]=j):j=e[36];const K=j,z=P.find(I=>I.value!==A);if(P.length===2&&z){S=h.jsxs("button",{type:"button",onClick:()=>K(z.value),"aria-label":r("mainPanelTabs.mobileMainPanelTabSelect.switchTo",{name:z.title}),className:"flex h-10 min-w-0 max-w-[7.5rem] items-center gap-1.5 rounded-md px-1.5 text-xs text-foreground transition-colors hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:[h.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center",children:h.jsx(Ar,{icon:z.icon,className:"size-5"})}),h.jsx("span",{className:"min-w-0 truncate",children:z.title})]});break e}k=fp,N=kn,T=K;let G;e[37]!==r?(G=r("mainPanelTabs.mobileMainPanelTabSelect.view"),e[37]=r,e[38]=G):G=e[38],w=h.jsx(up,{"aria-label":G,className:"h-10! w-full min-w-0 max-w-[7.5rem] rounded-md border-0 bg-transparent px-1.5 text-xs shadow-none [--card-shadow:none]",children:h.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[M&&h.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center",children:h.jsx(Ar,{icon:M.icon,className:"size-5"})}),h.jsx("span",{className:"min-w-0 truncate",children:L})]})}),b=pp,m="end",x="w-56",e[39]!==L?(y=h.jsx(rh,{value:kn,disabled:!0,hideCheck:!0,className:"hidden",children:L}),e[39]=L,e[40]=y):y=e[40],C=P.map(Yy)}e[6]=d,e[7]=f,e[8]=n,e[9]=v,e[10]=o,e[11]=p.id,e[12]=c.org,e[13]=c.taskId,e[14]=_,e[15]=r,e[16]=u,e[17]=s,e[18]=b,e[19]=k,e[20]=w,e[21]=S,e[22]=m,e[23]=x,e[24]=y,e[25]=C,e[26]=N,e[27]=T}else b=e[18],k=e[19],w=e[20],S=e[21],m=e[22],x=e[23],y=e[24],C=e[25],N=e[26],T=e[27];if(S!==Symbol.for("react.early_return_sentinel"))return S;let R;e[41]!==b||e[42]!==m||e[43]!==x||e[44]!==y||e[45]!==C?(R=h.jsxs(b,{align:m,className:x,children:[y,C]}),e[41]=b,e[42]=m,e[43]=x,e[44]=y,e[45]=C,e[46]=R):R=e[46];let E;return e[47]!==k||e[48]!==w||e[49]!==R||e[50]!==N||e[51]!==T?(E=h.jsxs(k,{value:N,onValueChange:T,children:[w,R]}),e[47]=k,e[48]=w,e[49]=R,e[50]=N,e[51]=T,e[52]=E):E=e[52],E}function Yy(t){return h.jsx(rh,{value:t.value,children:h.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[h.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center",children:h.jsx(Ar,{icon:t.icon})}),h.jsx("span",{className:"min-w-0 truncate",children:t.title})]})},t.value)}function Xy(t){return{...t,sidepanel:!1}}function Jy(t){return{...t,thread:void 0,sidepanel:!1}}function Zy(t,e,s){const i=H.c(36),r=$o(),{locator:n}=ut(),o=O.useSyncExternalStore(r.threads.subscribe,r.threads.get),a=O.useSyncExternalStore(r.threadsStatus.subscribe,r.threadsStatus.get);let c;i[0]!==t||i[1]!==o?(c=t===null?null:o.find(m=>m.id===t&&!m.partial)??null,i[0]=t,i[1]=o,i[2]=c):c=i[2];const l=c,[u,d]=O.useState(void 0);let f;i[3]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{d(void 0)},i[3]=f):f=i[3];let p;i[4]!==t?(p=[t],i[4]=t,i[5]=p):p=i[5],O.useEffect(f,p);let _,g;i[6]!==u||i[7]!==t||i[8]!==l||i[9]!==r||i[10]!==a.kind?(_=()=>{t!==null&&(l||a.kind!=="loading"&&u===void 0&&(d("pending"),r.fetchThreadIntoSlot(t).then(m=>{d(m)})))},g=[t,l,a.kind,u,r],i[6]=u,i[7]=t,i[8]=l,i[9]=r,i[10]=a.kind,i[11]=_,i[12]=g):(_=i[11],g=i[12]),O.useEffect(_,g);let v;i[13]!==s||i[14]!==n||i[15]!==r||i[16]!==e?(v={mutationFn:async m=>r.create({id:m,virtual_mcp_id:e,...s?{branch:s}:{},...Uf(sessionStorage,n,m)})},i[13]=s,i[14]=n,i[15]=r,i[16]=e,i[17]=v):v=i[17];const b=Pn(v);let k,w;if(i[18]!==b||i[19]!==u||i[20]!==t||i[21]!==l||i[22]!==a.kind?(k=()=>{t!==null&&(l||u===null&&a.kind!=="loading"&&(b.isPending||b.variables!==t&&b.mutate(t)))},w=[t,l,u,a.kind,b],i[18]=b,i[19]=u,i[20]=t,i[21]=l,i[22]=a.kind,i[23]=k,i[24]=w):(k=i[23],w=i[24]),O.useEffect(k,w),t===null){let m;return i[25]===Symbol.for("react.memo_cache_sentinel")?(m={status:"ready",task:null},i[25]=m):m=i[25],m}if(l){let m;return i[26]!==l?(m={status:"ready",task:l},i[26]=l,i[27]=m):m=i[27],m}if(u&&typeof u=="object"){let m;return i[28]!==u?(m={status:"ready",task:u},i[28]=u,i[29]=m):m=i[29],m}if(b.data){let m;return i[30]!==b.data?(m={status:"ready",task:b.data},i[30]=b.data,i[31]=m):m=i[31],m}if(b.isError){let m;return i[32]!==b.error?(m={status:"error",error:b.error},i[32]=b.error,i[33]=m):m=i[33],m}if(b.isPending||a.kind!=="loading"){let m;return i[34]===Symbol.for("react.memo_cache_sentinel")?(m={status:"creating"},i[34]=m):m=i[34],m}let S;return i[35]===Symbol.for("react.memo_cache_sentinel")?(S={status:"loading"},i[35]=S):S=i[35],S}function Qy(t){const e=H.c(13),{children:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},e[0]=i):i=e[0];const r=ri(i);let n;e[1]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},e[1]=n):n=e[1];const o=Ii(n);let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a={select:ex},e[2]=a):a=e[2];const c=hf(a),{org:l}=ut();let u;e[3]!==l||e[4]!==r.agentId||e[5]!==r.legacyView||e[6]!==r.org||e[7]!==c||e[8]!==o?(u=r.org?df({pathname:c,org:r.org,pathAgentId:r.agentId,pathLegacyView:r.legacyView,fallbackAgentId:Bi(l.id).id,search:o}):null,e[3]=l,e[4]=r.agentId,e[5]=r.legacyView,e[6]=r.org,e[7]=c,e[8]=o,e[9]=u):u=e[9];const d=u;let f;return e[10]!==s||e[11]!==d?(f=d?h.jsx(Uo,{target:d}):s,e[10]=s,e[11]=d,e[12]=f):f=e[12],f}function ex(t){return t.matches.at(-1)?.pathname??t.location.pathname}function tx(){const t=H.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={strict:!1},t[0]=e):e=t[0];const s=ri(e);let i;t[1]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},t[1]=i):i=t[1];const r=Ii(i),{org:n}=ut(),{org:o,taskId:a}=s;if(!o||a===void 0)return null;let c;return t[2]!==o||t[3]!==n.id||t[4]!==r||t[5]!==a?(c=uf({org:o,taskId:a,fallbackAgentId:Bi(n.id).id,search:r}),t[2]=o,t[3]=n.id,t[4]=r,t[5]=a,t[6]=c):c=t[6],c}function sx(){const t=H.c(2),e=tx();let s;return t[0]!==e?(s=e?h.jsx(Uo,{target:e}):null,t[0]=e,t[1]=s):s=t[1],s}function ix(){const t=H.c(6),e=Oc(),s=ji();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},t[0]=i):i=t[0];const{preview:r}=Ii(i);if(!e||!r)return null;let n;t[1]!==s?(n=()=>s({to:".",search:rx}),t[1]=s,t[2]=n):n=t[2];let o;return t[3]!==r||t[4]!==n?(o=h.jsx(vp,{previewPath:r,onClose:n,showSeeInLibrary:!0}),t[3]=r,t[4]=n,t[5]=o):o=t[5],o}function rx(t){const{preview:e,...s}=t;return s}const nx={target:null,editSeoPageKey:null,variantOverride:null};function ox(t,e){switch(e.type){case"select":return{...t,target:e.target,variantOverride:null,editSeoPageKey:null};case"edit-seo":return{...t,target:e.target,editSeoPageKey:e.target.key,variantOverride:null};case"consume-edit-seo":return{...t,editSeoPageKey:null};case"variant-override":return{...t,variantOverride:e.params}}}const qu=O.createContext(null);function Nc(t){const e=H.c(9),{children:s}=t,[i,r]=O.useReducer(ox,nx);let n,o,a,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=d=>r({type:"select",target:d}),o=d=>r({type:"edit-seo",target:d}),a=()=>r({type:"consume-edit-seo"}),c=d=>r({type:"variant-override",params:d}),e[0]=n,e[1]=o,e[2]=a,e[3]=c):(n=e[0],o=e[1],a=e[2],c=e[3]);let l;e[4]!==i?(l={state:i,selectTarget:n,editSeo:o,consumeEditSeo:a,setVariantOverride:c},e[4]=i,e[5]=l):l=e[5];let u;return e[6]!==s||e[7]!==l?(u=h.jsx(qu,{value:l,children:s}),e[6]=s,e[7]=l,e[8]=u):u=e[8],u}function m2(){const t=O.use(qu);if(!t)throw new Error("useBlocksPreviewWorkspace must be used inside BlocksPreviewWorkspaceProvider");return t}const ax=O.createContext(null);function Vu(){return O.useContext(ax)}const Ys=O.createContext(null);function ja(){return O.use(Ys)}function Gu(t){const e=H.c(13),{children:s}=t,i=be(),r=oh(),n=Vu(),o=$i()!==null;let a;e[0]!==o||e[1]!==r||e[2]!==n?(a=h.jsx(Oh,{}),e[0]=o,e[1]=r,e[2]=n,e[3]=a):a=e[3];const c=a;let l;e[4]!==i?(l=i("agentShellLayout.agentShellLayout.chatLoadingError"),e[4]=i,e[5]=l):l=e[5];let u;e[6]!==l?(u=h.jsx("div",{role:"alert",className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:l}),e[6]=l,e[7]=u):u=e[7];const d=s??c;let f;e[8]!==d?(f=h.jsx(ls,{children:d}),e[8]=d,e[9]=f):f=e[9];let p;return e[10]!==u||e[11]!==f?(p=h.jsx(Li,{fallback:u,children:f}),e[10]=u,e[11]=f,e[12]=p):p=e[12],p}function Mc(t){const e=H.c(13),{threadId:s,children:i}=t;if(be(),Vu(),s===null){let n;return e[0]!==i?(n=h.jsx(ht.ThreadlessProvider,{children:i}),e[0]=i,e[1]=n):n=e[1],n}let r;return e[10]!==i||e[11]!==s?(r=h.jsx(ht.ActiveTaskProvider,{taskId:s,children:i}),e[10]=i,e[11]=s,e[12]=r):r=e[12],r}function Yu(t){const e=H.c(3),{onNewTaskRef:s,createNewTask:i}=t;let r;return e[0]!==i||e[1]!==s?(r=()=>(s.current=i,()=>{s.current=null}),e[0]=i,e[1]=s,e[2]=r):r=e[2],O.useLayoutEffect(r),null}function Bc({virtualMcpId:t,hasActiveGithubRepo:e,sandboxMap:s,children:i}){const r=be(),{currentBranch:n,activeTask:o,setCurrentTaskBranch:a}=zi(),c=oh(),l="agent-sandbox",{data:u}=hs.useSession(),d=u?.user?.id,f=!Sf({isDesktopApp:c,harnessId:o?.harness_id}),p=Qf({agentSandboxMap:s,threadSandboxMap:o?.metadata?.sandboxMap,userId:d,ownerId:o?.created_by,branch:n}),_=e||Rn(o?.metadata),g=O.useRef(null),v=f&&ep({threadLoaded:!!o,isOwner:!!d&&o?.created_by===d,hasActiveGithubRepo:_,branch:n??null,attempted:g.current===(o?.id??null)});O.useEffect(()=>{!v||!o||(g.current=o.id,a(ti(u?.user?.name||u?.user?.email?.split("@")[0])))},[v,o,u,a]);const{org:b}=ut(),k=gf("cms_auto_fresh_branch"),w=ni(t),S=O.useRef(null),m=k&&w.resolved&&w.runtime==="cms"&&!!b?.slug&&!!n&&S.current!==(o?.id??null),y=es({...g_({orgSlug:b?.slug??"",virtualMcpId:t,branch:n??""}),enabled:m}).data?.lastCommitAt??null;O.useEffect(()=>{!m||!o||__(y,Date.now())&&(S.current=o.id,a(ti(u?.user?.name||u?.user?.email?.split("@")[0])))},[m,y,o,u,a]);const C=us(t),N=Fo(C,n),{releases:T,createRelease:R}=Fr(t),P=!!d&&o?.created_by===d&&!!n&&n!==N&&!T.some(z=>z.branch===n),A=O.useRef(null);O.useEffect(()=>{!P||!n||A.current!==n&&(A.current=n,R({branch:n,name:Bn(T,r("thread.branchPicker.defaultVersionName")),color:hr(T.length),createdAt:new Date().toISOString()}).catch(()=>{}))},[P,n,T,R,r]);const M=w.resolved?w.runtime:null,L=tp(t,n??void 0),D=(d&&n?Sp(p?.[d]?.[n]):{})[l]??null,j=D?.previewUrl??null,K=f&&M!=="cms"&&(!!D||L);return f?M==="cms"?h.jsx(Nc,{children:i},`${t}:${n??"no-branch"}:${o?.id??""}`):h.jsx(sp,{virtualMcpId:t,branch:n??null,previewUrl:j,enabled:K,children:h.jsx(ip,{executionEnabled:f,virtualMcpId:t,branch:n??null,userId:d??null,hasActiveGithubRepo:_,vmEntry:D,threadId:o?.id??null,children:h.jsx(Nc,{children:i},`${t}:${n??"no-branch"}:${o?.id??""}`)})},o?.id??"no-thread"):h.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:h.jsx("div",{className:"flex h-full rounded-[0.75rem] bg-background card-shadow",children:h.jsx(Xc,{image:h.jsx(Lo,{size:48,className:"text-muted-foreground"}),title:r("agentShellLayout.agentShellLayout.runtimeUnavailableOnWeb"),description:r("agentShellLayout.agentShellLayout.runtimeUnavailableOnWebDescription")})})})}function lx(t){const e=H.c(15),{entity:s,virtualMcpId:i,layout:r,onNewTaskRef:n}=t;let o;e[0]!==r.createNewTask||e[1]!==n?(o=h.jsx(Yu,{onNewTaskRef:n,createNewTask:r.createNewTask}),e[0]=r.createNewTask,e[1]=n,e[2]=o):o=e[2];let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx(Gu,{}),e[3]=a):a=e[3];let c;e[4]!==s||e[5]!==r.mainOpen||e[6]!==r.sidePanelOpen||e[7]!==r.threadId||e[8]!==r.toggleMain||e[9]!==r.toggleSidePanel||e[10]!==i?(c=h.jsx(ls,{children:h.jsx(Fy,{virtualMcpId:i,taskId:r.threadId,entity:s,sidePanelOpen:r.sidePanelOpen,mainOpen:r.mainOpen,toggleSidePanel:r.toggleSidePanel,toggleMain:r.toggleMain,chatContent:a})}),e[4]=s,e[5]=r.mainOpen,e[6]=r.sidePanelOpen,e[7]=r.threadId,e[8]=r.toggleMain,e[9]=r.toggleSidePanel,e[10]=i,e[11]=c):c=e[11];let l;return e[12]!==o||e[13]!==c?(l=h.jsxs(h.Fragment,{children:[o,c]}),e[12]=o,e[13]=c,e[14]=l):l=e[14],l}function cx(t){const e=H.c(18),{virtualMcpId:s,layout:i,onNewTaskRef:r}=t,n=be();let o;e[0]!==i.mainOpen||e[1]!==i.sidePanelOpen||e[2]!==i.sidePanelParamPresent?(o=X_({visibility:{sidePanelOpen:i.sidePanelOpen,mainOpen:i.mainOpen},sidePanelParamPresent:i.sidePanelParamPresent}),e[0]=i.mainOpen,e[1]=i.sidePanelOpen,e[2]=i.sidePanelParamPresent,e[3]=o):o=e[3];const a=o;let c;e[4]!==i.threadId||e[5]!==s?(c=h.jsx(hp.Tabs,{children:h.jsx(Gy,{virtualMcpId:s,taskId:i.threadId})}),e[4]=i.threadId,e[5]=s,e[6]=c):c=e[6];let l;e[7]!==i.createNewTask||e[8]!==r?(l=h.jsx(Yu,{onNewTaskRef:r,createNewTask:i.createNewTask}),e[7]=i.createNewTask,e[8]=r,e[9]=l):l=e[9];let u;e[10]!==a||e[11]!==n||e[12]!==s?(u=h.jsx(ls,{children:h.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:a==="main"?h.jsx(Li,{fallback:h.jsx("div",{role:"alert",className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:n("agentShellLayout.agentShellLayout.somethingWentWrong")}),children:h.jsx(ls,{children:h.jsx("div",{"data-testid":"main-panel",className:"h-full",children:h.jsx(Jd,{virtualMcpId:s})})})}):h.jsx(Ku,{chatContent:h.jsx(Gu,{})})})}),e[10]=a,e[11]=n,e[12]=s,e[13]=u):u=e[13];let d;return e[14]!==c||e[15]!==l||e[16]!==u?(d=h.jsxs(h.Fragment,{children:[c,l,u]}),e[14]=c,e[15]=l,e[16]=u,e[17]=d):d=e[17],d}function hx(){const t=H.c(122),e=be(),s=Oc(),i=ji(),{org:r}=ut();rp(r.slug);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[0]=n):n=t[0];const a=ri(n).org??"";let c;t[1]===Symbol.for("react.memo_cache_sentinel")?(c={strict:!1},t[1]=c):c=t[1];const l=Ii(c),u=$i(),d=Jc(),f=Zc(),[p]=O.useState(dx),{data:_}=hs.useSession();let g;t[2]!==_?.user?.email||t[3]!==_?.user?.name?(g=()=>ti(_?.user?.name||_?.user?.email?.split("@")[0]),t[2]=_?.user?.email,t[3]=_?.user?.name,t[4]=g):g=t[4];const[v]=O.useState(g),b=$o(),k=O.useSyncExternalStore(b.threads.subscribe,b.threads.get),w=O.useSyncExternalStore(b.threadsStatus.subscribe,b.threadsStatus.get),S=us(d);let m;t[5]!==S?(m=S&&Wo(S),t[5]=S,t[6]=m):m=t[6];const x=!!m,y=Fo(S,null),C=Zy(u,d,v);Q_(C.status==="ready"?C.task:null);const N=S?.metadata?.ui?.layout??null;let T;t[7]!==N?(T=N?{defaultMainView:N.defaultMainView??null,chatDefaultOpen:N.chatDefaultOpen??null}:null,t[7]=N,t[8]=T):T=t[8];const R=T;let E;t[9]!==d?(E={virtualMcpId:d,isAgentRoute:!0},t[9]=d,t[10]=E):E=t[10];const P=Z_(R,E),A=O.useRef(null);let M,L;t[11]===Symbol.for("react.memo_cache_sentinel")?(M=()=>{const Y=Z=>{$f(Z)&&Z.shiftKey&&Z.code==="KeyS"&&!Z.repeat&&(Z.preventDefault(),A.current?.())};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},L=[],t[11]=M,t[12]=L):(M=t[11],L=t[12]),O.useEffect(M,L);const B=C.status==="ready"?C.task:null,D=B?.virtual_mcp_id;if(B&&D&&!ap({routeAgentId:d,threadAgentId:D})){let Y;t[13]!==D||t[14]!==r.id||t[15]!==a?(Y=ff({org:a,agentId:D,superAgentId:Bi(r.id).id}),t[13]=D,t[14]=r.id,t[15]=a,t[16]=Y):Y=t[16];const Z=Y;let X;t[17]!==B.id||t[18]!==l.autosend||t[19]!==l.mainpanel||t[20]!==l.sidepanel?(X={thread:B.id,sidepanel:l.sidepanel,mainpanel:l.mainpanel,autosend:l.autosend},t[17]=B.id,t[18]=l.autosend,t[19]=l.mainpanel,t[20]=l.sidepanel,t[21]=X):X=t[21];let U;return t[22]!==Z||t[23]!==X?(U=h.jsx(Uo,{target:{route:Z,search:X}}),t[22]=Z,t[23]=X,t[24]=U):U=t[24],U}if(u===null&&f&&S){if(w.kind==="loading"){let U;t[25]===Symbol.for("react.memo_cache_sentinel")?(U=h.jsx(gt,{className:"size-4 mr-2"}),t[25]=U):U=t[25];let J;t[26]!==e?(J=e("agentShellLayout.agentShellLayout.creatingTask"),t[26]=e,t[27]=J):J=t[27];let ae;return t[28]!==J?(ae=h.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:h.jsxs("div",{role:"status","aria-live":"polite",className:"flex h-full items-center justify-center bg-background card-shadow rounded-[0.75rem] text-sm text-muted-foreground",children:[U,J]})}),t[28]=J,t[29]=ae):ae=t[29],ae}let Y;t[30]!==y||t[31]!==S.metadata||t[32]!==x||t[33]!==_?.user?.id||t[34]!==k||t[35]!==d?(Y=Xf(k,d,_?.user?.id,Oo(S.metadata),x,{baseBranch:y}),t[30]=y,t[31]=S.metadata,t[32]=x,t[33]=_?.user?.id,t[34]=k,t[35]=d,t[36]=Y):Y=t[36];const X=Y?.id??(x?p:null);if(X){let U;return t[37]!==X?(U=h.jsx(pf,{to:".",replace:!0,search:J=>({...J,thread:X})}),t[37]=X,t[38]=U):U=t[38],U}}const j=d;let K;t[39]!==S||t[40]!==d?(K={virtualMcpId:d,entity:S},t[39]=S,t[40]=d,t[41]=K):K=t[41];const z=K;if(C.status==="creating"||C.status==="loading"){let Y;t[42]===Symbol.for("react.memo_cache_sentinel")?(Y=h.jsx(gt,{className:"size-4 mr-2"}),t[42]=Y):Y=t[42];let Z;t[43]!==e?(Z=e("agentShellLayout.agentShellLayout.creatingTask"),t[43]=e,t[44]=Z):Z=t[44];let X;t[45]!==Z?(X=h.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:h.jsxs("div",{role:"status","aria-live":"polite",className:"flex h-full items-center justify-center bg-background card-shadow rounded-[0.75rem] text-sm text-muted-foreground",children:[Y,Z]})}),t[45]=Z,t[46]=X):X=t[46];let U;return t[47]!==z||t[48]!==X?(U=h.jsx(Ys,{value:z,children:X}),t[47]=z,t[48]=X,t[49]=U):U=t[49],U}if(C.status==="error"){let Y;t[50]!==e?(Y=e("agentShellLayout.agentShellLayout.taskUnavailable"),t[50]=e,t[51]=Y):Y=t[51];let Z;t[52]!==Y?(Z=h.jsx("div",{className:"font-medium",children:Y}),t[52]=Y,t[53]=Z):Z=t[53];let X;t[54]!==C.error.message?(X=h.jsx("div",{className:"text-muted-foreground",children:C.error.message}),t[54]=C.error.message,t[55]=X):X=t[55];let U;t[56]!==Z||t[57]!==X?(U=h.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:h.jsxs("div",{role:"alert",className:"flex flex-col h-full items-center justify-center gap-2 bg-background card-shadow rounded-[0.75rem] p-8 text-sm",children:[Z,X]})}),t[56]=Z,t[57]=X,t[58]=U):U=t[58];let J;return t[59]!==z||t[60]!==U?(J=h.jsx(Ys,{value:z,children:U}),t[59]=z,t[60]=U,t[61]=J):J=t[61],J}if(!S){let Y;t[62]===Symbol.for("react.memo_cache_sentinel")?(Y=h.jsx(Lo,{size:48,className:"text-muted-foreground"}),t[62]=Y):Y=t[62];let Z;t[63]!==e?(Z=e("agentShellLayout.agentShellLayout.agentNotFound"),t[63]=e,t[64]=Z):Z=t[64];let X;t[65]!==e||t[66]!==d?(X=e("agentShellLayout.agentShellLayout.agentNotFoundDescription",{virtualMcpId:d}),t[65]=e,t[66]=d,t[67]=X):X=t[67];let U;t[68]!==i||t[69]!==a?(U=()=>i({to:"/$org",params:{org:a}}),t[68]=i,t[69]=a,t[70]=U):U=t[70];let J;t[71]!==e?(J=e("agentShellLayout.agentShellLayout.goToOrgHome"),t[71]=e,t[72]=J):J=t[72];let ae;t[73]!==U||t[74]!==J?(ae=h.jsx(Pe,{variant:"outline",onClick:U,children:J}),t[73]=U,t[74]=J,t[75]=ae):ae=t[75];let q;t[76]!==Z||t[77]!==X||t[78]!==ae?(q=h.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:h.jsx("div",{className:"flex flex-col h-full bg-background overflow-hidden card-shadow rounded-[0.75rem]",children:h.jsx(Xc,{image:Y,title:Z,description:X,actions:ae})})}),t[76]=Z,t[77]=X,t[78]=ae,t[79]=q):q=t[79];let F;return t[80]!==z||t[81]!==q?(F=h.jsx(Ys,{value:z,children:q}),t[80]=z,t[81]=q,t[82]=F):F=t[82],F}if(s){const Y=C.status==="ready"?C.task:null,Z=S?.metadata?.sandboxMap;let X;t[83]!==j||t[84]!==P?(X=h.jsx(ls,{children:h.jsx(cx,{virtualMcpId:j,layout:P,onNewTaskRef:A})}),t[83]=j,t[84]=P,t[85]=X):X=t[85];let U;t[86]!==P.providerKey||t[87]!==P.threadId||t[88]!==X?(U=h.jsx(Mc,{threadId:P.threadId,children:X},P.providerKey),t[86]=P.providerKey,t[87]=P.threadId,t[88]=X,t[89]=U):U=t[89];let J;t[90]!==x||t[91]!==Z||t[92]!==U||t[93]!==d?(J=h.jsx(Bc,{virtualMcpId:d,hasActiveGithubRepo:x,sandboxMap:Z,children:U}),t[90]=x,t[91]=Z,t[92]=U,t[93]=d,t[94]=J):J=t[94];let ae;t[95]!==j||t[96]!==J||t[97]!==Y?(ae=h.jsx("div",{className:"flex flex-col flex-1 min-w-0 bg-background min-h-0",children:h.jsx(ht.Provider,{virtualMcpId:j,task:Y,children:J},j)}),t[95]=j,t[96]=J,t[97]=Y,t[98]=ae):ae=t[98];let q;return t[99]!==z||t[100]!==ae?(q=h.jsx(Ys,{value:z,children:ae}),t[99]=z,t[100]=ae,t[101]=q):q=t[101],q}const G=C.status==="ready"?C.task:null,I=S?.metadata?.sandboxMap;let V;t[102]!==S||t[103]!==P||t[104]!==d?(V=h.jsx(ls,{children:h.jsx(lx,{entity:S,virtualMcpId:d,layout:P,onNewTaskRef:A})}),t[102]=S,t[103]=P,t[104]=d,t[105]=V):V=t[105];let $;t[106]!==P.providerKey||t[107]!==P.threadId||t[108]!==V?($=h.jsx(Mc,{threadId:P.threadId,children:V},P.providerKey),t[106]=P.providerKey,t[107]=P.threadId,t[108]=V,t[109]=$):$=t[109];let ee;t[110]!==x||t[111]!==I||t[112]!==$||t[113]!==d?(ee=h.jsx(Bc,{virtualMcpId:d,hasActiveGithubRepo:x,sandboxMap:I,children:$}),t[110]=x,t[111]=I,t[112]=$,t[113]=d,t[114]=ee):ee=t[114];let se;t[115]!==j||t[116]!==ee||t[117]!==G?(se=h.jsx(ht.Provider,{virtualMcpId:j,task:G,children:ee},j),t[115]=j,t[116]=ee,t[117]=G,t[118]=se):se=t[118];let ie;return t[119]!==z||t[120]!==se?(ie=h.jsx("div",{className:"flex-1 min-w-0 flex flex-col",children:h.jsx(Ys,{value:z,children:se})}),t[119]=z,t[120]=se,t[121]=ie):ie=t[121],ie}function dx(){return crypto.randomUUID()}function ux(){const t=H.c(4);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={strict:!1},t[0]=e):e=t[0];const s=ri(e);if(s.taskId!==void 0){let r;return t[1]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(sx,{}),t[1]=r):r=t[1],r}if(s._splat!==void 0){let r;return t[2]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(jc,{}),t[2]=r):r=t[2],r}let i;return t[3]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx(ls,{children:h.jsx(Qy,{children:h.jsx(gp,{children:h.jsxs(bp,{children:[h.jsx(hx,{}),h.jsx(ix,{})]})})})}),t[3]=i):i=t[3],i}const g2=Object.freeze(Object.defineProperty({__proto__:null,default:ux,useInsetContext:ja},Symbol.toStringTag,{value:"Module"}));export{oS as $,Ra as A,Mi as B,e0 as C,$w as D,Co as E,l2 as F,Zw as G,Nr as H,u2 as I,c0 as J,r2 as K,f0 as L,p2 as M,Qw as N,d2 as O,h2 as P,Lw as Q,Im as R,gu as S,iu as T,ru as U,Jw as V,Gb as W,nu as X,ei as Y,i2 as Z,e2 as _,Uw as a,jw as a0,d_ as a1,Ih as a2,h_ as a3,a2 as a4,Xw as a5,ac as a6,lc as a7,Vb as a8,Yw as a9,wo as aa,t2 as ab,s2 as ac,n2 as ad,o2 as ae,Hw as af,Ob as ag,qw as ah,c2 as ai,Iu as aj,g2 as ak,_2 as b,ja as c,Ww as d,u0 as e,Hb as f,_0 as g,f2 as h,cu as i,dc as j,Qd as k,Wb as l,zb as m,$b as n,r0 as o,zw as p,cl as q,Kb as r,Vw as s,Om as t,m2 as u,Kw as v,Ib as w,Gw as x,Fw as y,t0 as z};