@shepai/cli 1.182.1 → 1.183.0

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 (519) hide show
  1. package/apis/json-schema/Application.yaml +7 -0
  2. package/dist/packages/core/src/application/ports/output/repositories/application-repository.interface.d.ts +1 -1
  3. package/dist/packages/core/src/application/ports/output/repositories/application-repository.interface.d.ts.map +1 -1
  4. package/dist/packages/core/src/application/use-cases/applications/create-application.use-case.d.ts +3 -3
  5. package/dist/packages/core/src/application/use-cases/applications/create-application.use-case.d.ts.map +1 -1
  6. package/dist/packages/core/src/application/use-cases/applications/create-application.use-case.js +13 -21
  7. package/dist/packages/core/src/application/use-cases/applications/list-applications.use-case.d.ts +19 -3
  8. package/dist/packages/core/src/application/use-cases/applications/list-applications.use-case.d.ts.map +1 -1
  9. package/dist/packages/core/src/application/use-cases/applications/list-applications.use-case.js +37 -4
  10. package/dist/packages/core/src/application/use-cases/applications/resume-application-workflow.use-case.d.ts +30 -0
  11. package/dist/packages/core/src/application/use-cases/applications/resume-application-workflow.use-case.d.ts.map +1 -0
  12. package/dist/packages/core/src/application/use-cases/applications/resume-application-workflow.use-case.js +122 -0
  13. package/dist/packages/core/src/domain/generated/output.d.ts +8 -0
  14. package/dist/packages/core/src/domain/generated/output.d.ts.map +1 -1
  15. package/dist/packages/core/src/infrastructure/di/container.d.ts.map +1 -1
  16. package/dist/packages/core/src/infrastructure/di/container.js +5 -0
  17. package/dist/packages/core/src/infrastructure/persistence/sqlite/mappers/application.mapper.d.ts +2 -0
  18. package/dist/packages/core/src/infrastructure/persistence/sqlite/mappers/application.mapper.d.ts.map +1 -1
  19. package/dist/packages/core/src/infrastructure/persistence/sqlite/mappers/application.mapper.js +4 -0
  20. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/058-add-setup-complete-to-applications.d.ts +5 -0
  21. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/058-add-setup-complete-to-applications.d.ts.map +1 -0
  22. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/058-add-setup-complete-to-applications.js +10 -0
  23. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/059-add-agent-session-id-to-applications.d.ts +5 -0
  24. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/059-add-agent-session-id-to-applications.d.ts.map +1 -0
  25. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/059-add-agent-session-id-to-applications.js +10 -0
  26. package/dist/packages/core/src/infrastructure/repositories/sqlite-application.repository.d.ts +1 -1
  27. package/dist/packages/core/src/infrastructure/repositories/sqlite-application.repository.d.ts.map +1 -1
  28. package/dist/packages/core/src/infrastructure/repositories/sqlite-application.repository.js +10 -2
  29. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/node-helpers.d.ts.map +1 -1
  30. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/node-helpers.js +4 -1
  31. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/fast-implement.prompt.d.ts.map +1 -1
  32. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/fast-implement.prompt.js +4 -1
  33. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/implement.prompt.d.ts.map +1 -1
  34. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/implement.prompt.js +4 -1
  35. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/merge-prompts.d.ts.map +1 -1
  36. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/merge-prompts.js +11 -6
  37. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/pr-branding.d.ts +2 -2
  38. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/pr-branding.d.ts.map +1 -1
  39. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/prompts/pr-branding.js +2 -2
  40. package/dist/packages/core/src/infrastructure/services/git/git-pr.service.d.ts.map +1 -1
  41. package/dist/packages/core/src/infrastructure/services/git/git-pr.service.js +3 -2
  42. package/dist/packages/core/src/infrastructure/services/git/pr-branding.d.ts +16 -5
  43. package/dist/packages/core/src/infrastructure/services/git/pr-branding.d.ts.map +1 -1
  44. package/dist/packages/core/src/infrastructure/services/git/pr-branding.js +38 -7
  45. package/dist/src/presentation/web/app/api/applications/[id]/resume/route.d.ts +20 -0
  46. package/dist/src/presentation/web/app/api/applications/[id]/resume/route.d.ts.map +1 -0
  47. package/dist/src/presentation/web/app/api/applications/[id]/resume/route.js +25 -0
  48. package/dist/src/presentation/web/app/api/applications/[id]/route.d.ts +19 -0
  49. package/dist/src/presentation/web/app/api/applications/[id]/route.d.ts.map +1 -0
  50. package/dist/src/presentation/web/app/api/applications/[id]/route.js +46 -0
  51. package/dist/src/presentation/web/app/api/applications/route.d.ts +9 -0
  52. package/dist/src/presentation/web/app/api/applications/route.d.ts.map +1 -0
  53. package/dist/src/presentation/web/app/api/applications/route.js +20 -0
  54. package/dist/src/presentation/web/app/application/[id]/page.d.ts +4 -4
  55. package/dist/src/presentation/web/app/application/[id]/page.d.ts.map +1 -1
  56. package/dist/src/presentation/web/app/application/[id]/page.js +2 -61
  57. package/dist/src/presentation/web/app/applications/page.d.ts +2 -0
  58. package/dist/src/presentation/web/app/applications/page.d.ts.map +1 -0
  59. package/dist/src/presentation/web/app/applications/page.js +5 -0
  60. package/dist/src/presentation/web/components/assistant-ui/thread.js +2 -2
  61. package/dist/src/presentation/web/components/common/application-node/application-node.d.ts.map +1 -1
  62. package/dist/src/presentation/web/components/common/application-node/application-node.js +3 -37
  63. package/dist/src/presentation/web/components/features/application-page/application-page-loader.d.ts +4 -0
  64. package/dist/src/presentation/web/components/features/application-page/application-page-loader.d.ts.map +1 -0
  65. package/dist/src/presentation/web/components/features/application-page/application-page-loader.js +47 -0
  66. package/dist/src/presentation/web/components/features/application-page/application-page.d.ts.map +1 -1
  67. package/dist/src/presentation/web/components/features/application-page/application-page.js +75 -54
  68. package/dist/src/presentation/web/components/features/application-page/application-page.stories.d.ts.map +1 -1
  69. package/dist/src/presentation/web/components/features/application-page/application-page.stories.js +1 -0
  70. package/dist/src/presentation/web/components/features/application-page/run-dev-button.d.ts +3 -1
  71. package/dist/src/presentation/web/components/features/application-page/run-dev-button.d.ts.map +1 -1
  72. package/dist/src/presentation/web/components/features/application-page/run-dev-button.js +6 -2
  73. package/dist/src/presentation/web/components/features/applications/application-card.d.ts +7 -0
  74. package/dist/src/presentation/web/components/features/applications/application-card.d.ts.map +1 -0
  75. package/dist/src/presentation/web/components/features/applications/application-card.js +82 -0
  76. package/dist/src/presentation/web/components/features/applications/application-card.stories.d.ts +13 -0
  77. package/dist/src/presentation/web/components/features/applications/application-card.stories.d.ts.map +1 -0
  78. package/dist/src/presentation/web/components/features/applications/application-card.stories.js +69 -0
  79. package/dist/src/presentation/web/components/features/applications/applications-page-client.d.ts +5 -0
  80. package/dist/src/presentation/web/components/features/applications/applications-page-client.d.ts.map +1 -0
  81. package/dist/src/presentation/web/components/features/applications/applications-page-client.js +28 -0
  82. package/dist/src/presentation/web/components/features/applications/applications-page-client.stories.d.ts +10 -0
  83. package/dist/src/presentation/web/components/features/applications/applications-page-client.stories.d.ts.map +1 -0
  84. package/dist/src/presentation/web/components/features/applications/applications-page-client.stories.js +93 -0
  85. package/dist/src/presentation/web/components/features/chat/ChatComposer.d.ts +3 -1
  86. package/dist/src/presentation/web/components/features/chat/ChatComposer.d.ts.map +1 -1
  87. package/dist/src/presentation/web/components/features/chat/ChatComposer.js +2 -2
  88. package/dist/src/presentation/web/components/features/chat/ChatTab.d.ts +3 -1
  89. package/dist/src/presentation/web/components/features/chat/ChatTab.d.ts.map +1 -1
  90. package/dist/src/presentation/web/components/features/chat/ChatTab.js +4 -3
  91. package/dist/src/presentation/web/components/features/chat/StepTracker.d.ts +6 -1
  92. package/dist/src/presentation/web/components/features/chat/StepTracker.d.ts.map +1 -1
  93. package/dist/src/presentation/web/components/features/chat/StepTracker.js +23 -20
  94. package/dist/src/presentation/web/components/features/control-center/control-center-inner.d.ts.map +1 -1
  95. package/dist/src/presentation/web/components/features/control-center/control-center-inner.js +3 -2
  96. package/dist/src/presentation/web/components/features/features-canvas/features-canvas.d.ts +3 -1
  97. package/dist/src/presentation/web/components/features/features-canvas/features-canvas.d.ts.map +1 -1
  98. package/dist/src/presentation/web/components/features/features-canvas/features-canvas.js +2 -2
  99. package/dist/src/presentation/web/components/features/settings/language-settings-section.d.ts.map +1 -1
  100. package/dist/src/presentation/web/components/features/settings/language-settings-section.js +1 -0
  101. package/dist/src/presentation/web/components/features/settings/language-settings-section.stories.d.ts +1 -0
  102. package/dist/src/presentation/web/components/features/settings/language-settings-section.stories.d.ts.map +1 -1
  103. package/dist/src/presentation/web/components/features/settings/language-settings-section.stories.js +5 -0
  104. package/dist/src/presentation/web/components/features/settings/settings-page-client.d.ts.map +1 -1
  105. package/dist/src/presentation/web/components/features/settings/settings-page-client.js +23 -3
  106. package/dist/src/presentation/web/components/layouts/app-sidebar/app-sidebar.d.ts.map +1 -1
  107. package/dist/src/presentation/web/components/layouts/app-sidebar/app-sidebar.js +2 -2
  108. package/dist/src/presentation/web/lib/derive-app-status.d.ts +23 -0
  109. package/dist/src/presentation/web/lib/derive-app-status.d.ts.map +1 -0
  110. package/dist/src/presentation/web/lib/derive-app-status.js +89 -0
  111. package/dist/src/presentation/web/lib/i18n.d.ts.map +1 -1
  112. package/dist/src/presentation/web/lib/i18n.js +3 -0
  113. package/dist/translations/ar/web.json +2 -1
  114. package/dist/translations/de/web.json +2 -1
  115. package/dist/translations/en/web.json +2 -1
  116. package/dist/translations/es/web.json +2 -1
  117. package/dist/translations/fr/web.json +2 -1
  118. package/dist/translations/he/web.json +2 -1
  119. package/dist/translations/pt/web.json +2 -1
  120. package/dist/translations/ru/web.json +2 -1
  121. package/dist/translations/uk/web.json +2 -1
  122. package/dist/tsconfig.build.tsbuildinfo +1 -1
  123. package/package.json +1 -1
  124. package/web/.next/BUILD_ID +1 -1
  125. package/web/.next/app-path-routes-manifest.json +4 -0
  126. package/web/.next/build-manifest.json +2 -2
  127. package/web/.next/fallback-build-manifest.json +2 -2
  128. package/web/.next/prerender-manifest.json +3 -3
  129. package/web/.next/required-server-files.js +2 -2
  130. package/web/.next/required-server-files.json +2 -2
  131. package/web/.next/routes-manifest.json +28 -0
  132. package/web/.next/server/app/(dashboard)/@drawer/adopt/page/server-reference-manifest.json +32 -32
  133. package/web/.next/server/app/(dashboard)/@drawer/adopt/page.js +5 -5
  134. package/web/.next/server/app/(dashboard)/@drawer/adopt/page.js.nft.json +1 -1
  135. package/web/.next/server/app/(dashboard)/@drawer/adopt/page_client-reference-manifest.js +1 -1
  136. package/web/.next/server/app/(dashboard)/@drawer/chat/page/server-reference-manifest.json +30 -30
  137. package/web/.next/server/app/(dashboard)/@drawer/chat/page.js +5 -5
  138. package/web/.next/server/app/(dashboard)/@drawer/chat/page.js.nft.json +1 -1
  139. package/web/.next/server/app/(dashboard)/@drawer/chat/page_client-reference-manifest.js +1 -1
  140. package/web/.next/server/app/(dashboard)/@drawer/create/page/server-reference-manifest.json +33 -33
  141. package/web/.next/server/app/(dashboard)/@drawer/create/page.js +5 -5
  142. package/web/.next/server/app/(dashboard)/@drawer/create/page.js.nft.json +1 -1
  143. package/web/.next/server/app/(dashboard)/@drawer/create/page_client-reference-manifest.js +1 -1
  144. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page/server-reference-manifest.json +41 -41
  145. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js +5 -5
  146. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js.nft.json +1 -1
  147. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
  148. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/server-reference-manifest.json +41 -41
  149. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js +5 -5
  150. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js.nft.json +1 -1
  151. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page_client-reference-manifest.js +1 -1
  152. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page/server-reference-manifest.json +31 -31
  153. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page.js +5 -5
  154. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page.js.nft.json +1 -1
  155. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page_client-reference-manifest.js +1 -1
  156. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/server-reference-manifest.json +31 -31
  157. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js +5 -5
  158. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js.nft.json +1 -1
  159. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  160. package/web/.next/server/app/(dashboard)/chat/page/server-reference-manifest.json +30 -30
  161. package/web/.next/server/app/(dashboard)/chat/page.js +5 -5
  162. package/web/.next/server/app/(dashboard)/chat/page.js.nft.json +1 -1
  163. package/web/.next/server/app/(dashboard)/chat/page_client-reference-manifest.js +1 -1
  164. package/web/.next/server/app/(dashboard)/create/page/server-reference-manifest.json +33 -33
  165. package/web/.next/server/app/(dashboard)/create/page.js +5 -5
  166. package/web/.next/server/app/(dashboard)/create/page.js.nft.json +1 -1
  167. package/web/.next/server/app/(dashboard)/create/page_client-reference-manifest.js +1 -1
  168. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page/server-reference-manifest.json +41 -41
  169. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js +5 -5
  170. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js.nft.json +1 -1
  171. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
  172. package/web/.next/server/app/(dashboard)/feature/[featureId]/page/server-reference-manifest.json +41 -41
  173. package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js +5 -5
  174. package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js.nft.json +1 -1
  175. package/web/.next/server/app/(dashboard)/feature/[featureId]/page_client-reference-manifest.js +1 -1
  176. package/web/.next/server/app/(dashboard)/page/server-reference-manifest.json +30 -30
  177. package/web/.next/server/app/(dashboard)/page.js +5 -5
  178. package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
  179. package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
  180. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page/server-reference-manifest.json +31 -31
  181. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page.js +5 -5
  182. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page.js.nft.json +1 -1
  183. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page_client-reference-manifest.js +1 -1
  184. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/server-reference-manifest.json +31 -31
  185. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js +5 -5
  186. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js.nft.json +1 -1
  187. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  188. package/web/.next/server/app/_global-error/page.js +1 -1
  189. package/web/.next/server/app/_global-error/page.js.nft.json +1 -1
  190. package/web/.next/server/app/_global-error.html +2 -2
  191. package/web/.next/server/app/_global-error.rsc +1 -1
  192. package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  193. package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  194. package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  195. package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  196. package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  197. package/web/.next/server/app/_not-found/page/server-reference-manifest.json +7 -7
  198. package/web/.next/server/app/_not-found/page.js +1 -1
  199. package/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  200. package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  201. package/web/.next/server/app/api/applications/[id]/resume/route/app-paths-manifest.json +3 -0
  202. package/web/.next/server/app/api/applications/[id]/resume/route/build-manifest.json +11 -0
  203. package/web/.next/server/app/api/applications/[id]/resume/route/server-reference-manifest.json +4 -0
  204. package/web/.next/server/app/api/applications/[id]/resume/route.js +7 -0
  205. package/web/.next/server/app/api/applications/[id]/resume/route.js.map +5 -0
  206. package/web/.next/server/app/api/applications/[id]/resume/route.js.nft.json +1 -0
  207. package/web/.next/server/app/api/applications/[id]/resume/route_client-reference-manifest.js +2 -0
  208. package/web/.next/server/app/api/applications/[id]/route/app-paths-manifest.json +3 -0
  209. package/web/.next/server/app/api/applications/[id]/route/build-manifest.json +11 -0
  210. package/web/.next/server/app/api/applications/[id]/route/server-reference-manifest.json +4 -0
  211. package/web/.next/server/app/api/applications/[id]/route.js +7 -0
  212. package/web/.next/server/app/api/applications/[id]/route.js.map +5 -0
  213. package/web/.next/server/app/api/applications/[id]/route.js.nft.json +1 -0
  214. package/web/.next/server/app/api/applications/[id]/route_client-reference-manifest.js +2 -0
  215. package/web/.next/server/app/api/applications/route/app-paths-manifest.json +3 -0
  216. package/web/.next/server/app/api/applications/route/build-manifest.json +11 -0
  217. package/web/.next/server/app/api/applications/route/server-reference-manifest.json +4 -0
  218. package/web/.next/server/app/api/applications/route.js +7 -0
  219. package/web/.next/server/app/api/applications/route.js.map +5 -0
  220. package/web/.next/server/app/api/applications/route.js.nft.json +1 -0
  221. package/web/.next/server/app/api/applications/route_client-reference-manifest.js +2 -0
  222. package/web/.next/server/app/api/attachments/preview/route.js.nft.json +1 -1
  223. package/web/.next/server/app/api/evidence/route.js.nft.json +1 -1
  224. package/web/.next/server/app/api/graph-data/route.js.nft.json +1 -1
  225. package/web/.next/server/app/api/interactive/chat/[featureId]/messages/route.js.nft.json +1 -1
  226. package/web/.next/server/app/application/[id]/page/server-reference-manifest.json +45 -30
  227. package/web/.next/server/app/application/[id]/page.js +3 -3
  228. package/web/.next/server/app/application/[id]/page.js.nft.json +1 -1
  229. package/web/.next/server/app/application/[id]/page_client-reference-manifest.js +1 -1
  230. package/web/.next/server/app/applications/page/app-paths-manifest.json +3 -0
  231. package/web/.next/server/app/applications/page/build-manifest.json +18 -0
  232. package/web/.next/server/app/applications/page/next-font-manifest.json +6 -0
  233. package/web/.next/server/app/applications/page/react-loadable-manifest.json +1 -0
  234. package/web/.next/server/app/applications/page/server-reference-manifest.json +230 -0
  235. package/web/.next/server/app/applications/page.js +19 -0
  236. package/web/.next/server/app/applications/page.js.map +5 -0
  237. package/web/.next/server/app/applications/page.js.nft.json +1 -0
  238. package/web/.next/server/app/applications/page_client-reference-manifest.js +2 -0
  239. package/web/.next/server/app/features/page/server-reference-manifest.json +7 -7
  240. package/web/.next/server/app/features/page.js +1 -1
  241. package/web/.next/server/app/features/page.js.nft.json +1 -1
  242. package/web/.next/server/app/features/page_client-reference-manifest.js +1 -1
  243. package/web/.next/server/app/settings/page/server-reference-manifest.json +10 -10
  244. package/web/.next/server/app/settings/page.js +1 -1
  245. package/web/.next/server/app/settings/page.js.nft.json +1 -1
  246. package/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  247. package/web/.next/server/app/skills/page/server-reference-manifest.json +15 -15
  248. package/web/.next/server/app/skills/page.js +1 -1
  249. package/web/.next/server/app/skills/page.js.nft.json +1 -1
  250. package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
  251. package/web/.next/server/app/tools/page/server-reference-manifest.json +13 -13
  252. package/web/.next/server/app/tools/page.js +1 -1
  253. package/web/.next/server/app/tools/page.js.nft.json +1 -1
  254. package/web/.next/server/app/tools/page_client-reference-manifest.js +1 -1
  255. package/web/.next/server/app/version/page/server-reference-manifest.json +7 -7
  256. package/web/.next/server/app/version/page.js +1 -1
  257. package/web/.next/server/app/version/page.js.nft.json +1 -1
  258. package/web/.next/server/app/version/page_client-reference-manifest.js +1 -1
  259. package/web/.next/server/app-paths-manifest.json +4 -0
  260. package/web/.next/server/chunks/744ca_web__next-internal_server_app_api_applications_[id]_route_actions_e31b426d.js +3 -0
  261. package/web/.next/server/chunks/744ca_web__next-internal_server_app_api_applications_[id]_route_actions_e31b426d.js.map +1 -0
  262. package/web/.next/server/chunks/744ca_web__next-internal_server_app_api_applications_route_actions_2b7d20d0.js +3 -0
  263. package/web/.next/server/chunks/744ca_web__next-internal_server_app_api_applications_route_actions_2b7d20d0.js.map +1 -0
  264. package/web/.next/server/chunks/[root-of-the-server]__3bb635e8._.js +3 -0
  265. package/web/.next/server/chunks/[root-of-the-server]__3bb635e8._.js.map +1 -0
  266. package/web/.next/server/chunks/[root-of-the-server]__a402b567._.js +1 -1
  267. package/web/.next/server/chunks/[root-of-the-server]__ac0027b4._.js +3 -0
  268. package/web/.next/server/chunks/[root-of-the-server]__ac0027b4._.js.map +1 -0
  269. package/web/.next/server/chunks/[root-of-the-server]__b2a4bfcc._.js.map +1 -1
  270. package/web/.next/server/chunks/[root-of-the-server]__c8f90b29._.js +1 -1
  271. package/web/.next/server/chunks/[root-of-the-server]__cd67a84c._.js.map +1 -1
  272. package/web/.next/server/chunks/[root-of-the-server]__ce82df38._.js +3 -0
  273. package/web/.next/server/chunks/[root-of-the-server]__ce82df38._.js.map +1 -0
  274. package/web/.next/server/chunks/f3a1f__next-internal_server_app_api_applications_[id]_resume_route_actions_3a66d646.js +3 -0
  275. package/web/.next/server/chunks/f3a1f__next-internal_server_app_api_applications_[id]_resume_route_actions_3a66d646.js.map +1 -0
  276. package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_(dashboard)_@drawer_adopt_page_actions_4f9eef62.js +3 -0
  277. package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_(dashboard)_@drawer_adopt_page_actions_4f9eef62.js.map +1 -0
  278. package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_(dashboard)_@drawer_chat_page_actions_ffa16a22.js +3 -0
  279. package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_(dashboard)_@drawer_chat_page_actions_ffa16a22.js.map +1 -0
  280. package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_(dashboard)_chat_page_actions_a1a998f9.js +3 -0
  281. package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_(dashboard)_chat_page_actions_a1a998f9.js.map +1 -0
  282. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js +1 -1
  283. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js.map +1 -1
  284. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_feature-drawer-client_tsx_e9755fc8._.js +2 -2
  285. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_feature-drawer-client_tsx_e9755fc8._.js.map +1 -1
  286. package/web/.next/server/chunks/ssr/744ca_web_components_features_applications_applications-page-client_tsx_d0db9938._.js +3 -0
  287. package/web/.next/server/chunks/ssr/744ca_web_components_features_applications_applications-page-client_tsx_d0db9938._.js.map +1 -0
  288. package/web/.next/server/chunks/ssr/[root-of-the-server]__04f4895b._.js +3 -0
  289. package/web/.next/server/chunks/ssr/[root-of-the-server]__04f4895b._.js.map +1 -0
  290. package/web/.next/server/chunks/ssr/[root-of-the-server]__17dadd08._.js +1 -1
  291. package/web/.next/server/chunks/ssr/[root-of-the-server]__17dadd08._.js.map +1 -1
  292. package/web/.next/server/chunks/ssr/[root-of-the-server]__1925bef0._.js +1 -1
  293. package/web/.next/server/chunks/ssr/[root-of-the-server]__1a9687c4._.js +1 -1
  294. package/web/.next/server/chunks/ssr/[root-of-the-server]__1a9687c4._.js.map +1 -1
  295. package/web/.next/server/chunks/ssr/[root-of-the-server]__347fd0f6._.js +3 -0
  296. package/web/.next/server/chunks/ssr/[root-of-the-server]__347fd0f6._.js.map +1 -0
  297. package/web/.next/server/chunks/ssr/[root-of-the-server]__46dd2baf._.js +3 -0
  298. package/web/.next/server/chunks/ssr/[root-of-the-server]__46dd2baf._.js.map +1 -0
  299. package/web/.next/server/chunks/ssr/[root-of-the-server]__4ee8be85._.js +1 -1
  300. package/web/.next/server/chunks/ssr/[root-of-the-server]__73cb4ff6._.js +3 -0
  301. package/web/.next/server/chunks/ssr/[root-of-the-server]__73cb4ff6._.js.map +1 -0
  302. package/web/.next/server/chunks/ssr/{[root-of-the-server]__87bc4dac._.js → [root-of-the-server]__86ff0bc5._.js} +3 -3
  303. package/web/.next/server/chunks/ssr/[root-of-the-server]__86ff0bc5._.js.map +1 -0
  304. package/web/.next/server/chunks/ssr/[root-of-the-server]__91c50abe._.js +3 -0
  305. package/web/.next/server/chunks/ssr/[root-of-the-server]__91c50abe._.js.map +1 -0
  306. package/web/.next/server/chunks/ssr/[root-of-the-server]__a48af49f._.js +3 -0
  307. package/web/.next/server/chunks/ssr/[root-of-the-server]__a48af49f._.js.map +1 -0
  308. package/web/.next/server/chunks/ssr/[root-of-the-server]__bb391c45._.js +1 -1
  309. package/web/.next/server/chunks/ssr/[root-of-the-server]__bb391c45._.js.map +1 -1
  310. package/web/.next/server/chunks/ssr/[root-of-the-server]__d5e22d1a._.js +3 -0
  311. package/web/.next/server/chunks/ssr/{[root-of-the-server]__7aa484f5._.js.map → [root-of-the-server]__d5e22d1a._.js.map} +1 -1
  312. package/web/.next/server/chunks/ssr/[root-of-the-server]__dd3e834e._.js +1 -1
  313. package/web/.next/server/chunks/ssr/[root-of-the-server]__dd3e834e._.js.map +1 -1
  314. package/web/.next/server/chunks/ssr/[root-of-the-server]__e0aa2bcb._.js +3 -0
  315. package/web/.next/server/chunks/ssr/[root-of-the-server]__e0aa2bcb._.js.map +1 -0
  316. package/web/.next/server/chunks/ssr/[root-of-the-server]__e265da61._.js +1 -1
  317. package/web/.next/server/chunks/ssr/[root-of-the-server]__ef0b8905._.js +12 -0
  318. package/web/.next/server/chunks/ssr/[root-of-the-server]__ef0b8905._.js.map +1 -0
  319. package/web/.next/server/chunks/ssr/[root-of-the-server]__f5614810._.js +3 -0
  320. package/web/.next/server/chunks/ssr/{[root-of-the-server]__090f24cb._.js.map → [root-of-the-server]__f5614810._.js.map} +1 -1
  321. package/web/.next/server/chunks/ssr/[root-of-the-server]__fe5db6b2._.js +3 -0
  322. package/web/.next/server/chunks/ssr/[root-of-the-server]__fe5db6b2._.js.map +1 -0
  323. package/web/.next/server/chunks/ssr/_037e85c7._.js +3 -0
  324. package/web/.next/server/chunks/ssr/_037e85c7._.js.map +1 -0
  325. package/web/.next/server/chunks/ssr/{_774cbf7d._.js → _133ae3de._.js} +2 -2
  326. package/web/.next/server/chunks/ssr/{_774cbf7d._.js.map → _133ae3de._.js.map} +1 -1
  327. package/web/.next/server/chunks/ssr/_1879404a._.js +1 -1
  328. package/web/.next/server/chunks/ssr/_1879404a._.js.map +1 -1
  329. package/web/.next/server/chunks/ssr/_295fffde._.js.map +1 -1
  330. package/web/.next/server/chunks/ssr/_29b8ed64._.js +3 -0
  331. package/web/.next/server/chunks/ssr/_29b8ed64._.js.map +1 -0
  332. package/web/.next/server/chunks/ssr/_2bc302d1._.js +3 -0
  333. package/web/.next/server/chunks/ssr/_2bc302d1._.js.map +1 -0
  334. package/web/.next/server/chunks/ssr/_35294e79._.js +3 -0
  335. package/web/.next/server/chunks/ssr/_35294e79._.js.map +1 -0
  336. package/web/.next/server/chunks/ssr/_3683083e._.js +3 -0
  337. package/web/.next/server/chunks/ssr/_3683083e._.js.map +1 -0
  338. package/web/.next/server/chunks/ssr/_45496654._.js.map +1 -1
  339. package/web/.next/server/chunks/ssr/_4b57bcc3._.js +9 -0
  340. package/web/.next/server/chunks/ssr/_4b57bcc3._.js.map +1 -0
  341. package/web/.next/server/chunks/ssr/_519d77a9._.js +3 -0
  342. package/web/.next/server/chunks/ssr/_519d77a9._.js.map +1 -0
  343. package/web/.next/server/chunks/ssr/_56b9d60f._.js +1 -1
  344. package/web/.next/server/chunks/ssr/_56b9d60f._.js.map +1 -1
  345. package/web/.next/server/chunks/ssr/_82db03fd._.js +3 -0
  346. package/web/.next/server/chunks/ssr/_82db03fd._.js.map +1 -0
  347. package/web/.next/server/chunks/ssr/_8c3086bf._.js +3 -0
  348. package/web/.next/server/chunks/ssr/_8c3086bf._.js.map +1 -0
  349. package/web/.next/server/chunks/ssr/_9173e475._.js +21 -0
  350. package/web/.next/server/chunks/ssr/_9173e475._.js.map +1 -0
  351. package/web/.next/server/chunks/ssr/_946a7fc6._.js +1 -1
  352. package/web/.next/server/chunks/ssr/_946a7fc6._.js.map +1 -1
  353. package/web/.next/server/chunks/ssr/{_81e7a131._.js → _a08047ef._.js} +2 -2
  354. package/web/.next/server/chunks/ssr/_a08047ef._.js.map +1 -0
  355. package/web/.next/server/chunks/ssr/_bc03ac82._.js +4 -0
  356. package/web/.next/server/chunks/ssr/_bc03ac82._.js.map +1 -0
  357. package/web/.next/server/chunks/ssr/_d4c0792b._.js +3 -0
  358. package/web/.next/server/chunks/ssr/_d4c0792b._.js.map +1 -0
  359. package/web/.next/server/chunks/ssr/_e61d032d._.js +3 -0
  360. package/web/.next/server/chunks/ssr/_e61d032d._.js.map +1 -0
  361. package/web/.next/server/chunks/ssr/_e65abbd1._.js +3 -0
  362. package/web/.next/server/chunks/ssr/_e65abbd1._.js.map +1 -0
  363. package/web/.next/server/chunks/ssr/_f86fc1bf._.js +1 -1
  364. package/web/.next/server/chunks/ssr/_f86fc1bf._.js.map +1 -1
  365. package/web/.next/server/chunks/ssr/_f8c55130._.js +1 -1
  366. package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js +1 -1
  367. package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js.map +1 -1
  368. package/web/.next/server/chunks/ssr/f3a1f_components_common_control-center-drawer_repository-drawer-client_tsx_39a00c03._.js +1 -1
  369. package/web/.next/server/chunks/ssr/node_modules__pnpm_28a53b5d._.js +3 -0
  370. package/web/.next/server/chunks/ssr/node_modules__pnpm_28a53b5d._.js.map +1 -0
  371. package/web/.next/server/chunks/ssr/src_presentation_web_47181610._.js +3 -0
  372. package/web/.next/server/chunks/ssr/src_presentation_web_47181610._.js.map +1 -0
  373. package/web/.next/server/chunks/ssr/src_presentation_web_5d3f4199._.js +3 -0
  374. package/web/.next/server/chunks/ssr/src_presentation_web_5d3f4199._.js.map +1 -0
  375. package/web/.next/server/chunks/ssr/src_presentation_web_6159fef8._.js +1 -1
  376. package/web/.next/server/chunks/ssr/src_presentation_web_6159fef8._.js.map +1 -1
  377. package/web/.next/server/chunks/ssr/src_presentation_web_61d96ba8._.js +3 -0
  378. package/web/.next/server/chunks/ssr/src_presentation_web_61d96ba8._.js.map +1 -0
  379. package/web/.next/server/chunks/ssr/src_presentation_web_6994959a._.js +3 -0
  380. package/web/.next/server/chunks/ssr/src_presentation_web_6994959a._.js.map +1 -0
  381. package/web/.next/server/chunks/ssr/src_presentation_web_77dadf68._.js +32 -0
  382. package/web/.next/server/chunks/ssr/src_presentation_web_77dadf68._.js.map +1 -0
  383. package/web/.next/server/chunks/ssr/src_presentation_web_9a543843._.js +3 -0
  384. package/web/.next/server/chunks/ssr/src_presentation_web_9a543843._.js.map +1 -0
  385. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_c3f6f57e.js +3 -0
  386. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_c3f6f57e.js.map +1 -0
  387. package/web/.next/server/chunks/ssr/src_presentation_web_ad42cc73._.js +1 -1
  388. package/web/.next/server/chunks/ssr/src_presentation_web_ad42cc73._.js.map +1 -1
  389. package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_8514dfcd._.js +32 -0
  390. package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_8514dfcd._.js.map +1 -0
  391. package/web/.next/server/chunks/ssr/src_presentation_web_b95ed206._.js +3 -0
  392. package/web/.next/server/chunks/ssr/src_presentation_web_b95ed206._.js.map +1 -0
  393. package/web/.next/server/chunks/ssr/src_presentation_web_bade80bd._.js +3 -0
  394. package/web/.next/server/chunks/ssr/src_presentation_web_bade80bd._.js.map +1 -0
  395. package/web/.next/server/chunks/ssr/src_presentation_web_c543cf3e._.js +3 -0
  396. package/web/.next/server/chunks/ssr/src_presentation_web_c543cf3e._.js.map +1 -0
  397. package/web/.next/server/chunks/ssr/src_presentation_web_components_895e5bfa._.js +1 -1
  398. package/web/.next/server/chunks/ssr/src_presentation_web_components_895e5bfa._.js.map +1 -1
  399. package/web/.next/server/chunks/ssr/src_presentation_web_components_common_base-drawer_base-drawer_tsx_97dfbbc8._.js +1 -1
  400. package/web/.next/server/chunks/ssr/src_presentation_web_components_common_base-drawer_base-drawer_tsx_97dfbbc8._.js.map +1 -1
  401. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_skills_8a174cac._.js +1 -1
  402. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_skills_8a174cac._.js.map +1 -1
  403. package/web/.next/server/chunks/ssr/src_presentation_web_components_ui_dropdown-menu_tsx_229332e3._.js +3 -0
  404. package/web/.next/server/chunks/ssr/src_presentation_web_components_ui_dropdown-menu_tsx_229332e3._.js.map +1 -0
  405. package/web/.next/server/chunks/ssr/translations_1562ae1a._.js +3 -0
  406. package/web/.next/server/chunks/ssr/translations_1562ae1a._.js.map +1 -0
  407. package/web/.next/server/pages/500.html +2 -2
  408. package/web/.next/server/server-reference-manifest.js +1 -1
  409. package/web/.next/server/server-reference-manifest.json +184 -72
  410. package/web/.next/static/chunks/019e71634c720ede.js +1 -0
  411. package/web/.next/static/chunks/040c5ff84a8ae1a3.js +7 -0
  412. package/web/.next/static/chunks/092ac28f5a4422a0.js +19 -0
  413. package/web/.next/static/chunks/0bd78b0cf1c1421f.js +1 -0
  414. package/web/.next/static/chunks/{996e4ea45364bf3c.js → 18c21c4f9f58b69a.js} +3 -3
  415. package/web/.next/static/chunks/2b5aea3575387b3a.js +1 -0
  416. package/web/.next/static/chunks/2cbe80f8e84d59a8.js +1 -0
  417. package/web/.next/static/chunks/{503d2e86f83285f9.js → 3219b06f6a34e573.js} +1 -1
  418. package/web/.next/static/chunks/37e434e579ecfa02.js +1 -0
  419. package/web/.next/static/chunks/4a7cf3b09e0495a4.js +1 -0
  420. package/web/.next/static/chunks/{83fc7ea32e18c9a5.js → 4ea617a22e21fb04.js} +1 -1
  421. package/web/.next/static/chunks/54d1d5a646a12d76.js +1 -0
  422. package/web/.next/static/chunks/{9e9b60f127270dfd.js → 553be530f22710a7.js} +1 -1
  423. package/web/.next/static/chunks/5795b9f399523c9e.js +1 -0
  424. package/web/.next/static/chunks/{d488e6b5cbbc6833.js → 6a88df64eaeb6322.js} +1 -1
  425. package/web/.next/static/chunks/{2fe20598e1b4793a.js → 6b2859ea368e7df3.js} +3 -3
  426. package/web/.next/static/chunks/6d8cae68371a845d.js +1 -0
  427. package/web/.next/static/chunks/{a2601dbbcb657c7d.js → 78607d521d916531.js} +1 -1
  428. package/web/.next/static/chunks/{7bf6ed16395220c4.js → 7d5a7551d452463d.js} +2 -2
  429. package/web/.next/static/chunks/80e778136b2f4c92.js +1 -0
  430. package/web/.next/static/chunks/a62fb058d660bea3.js +3 -0
  431. package/web/.next/static/chunks/adf16efe8bac05e9.css +1 -0
  432. package/web/.next/static/chunks/b0474319e5a50043.js +1 -0
  433. package/web/.next/static/chunks/b85532fb1545927c.js +5 -0
  434. package/web/.next/static/chunks/e0ae4dbd97b7af4c.js +1 -0
  435. package/web/.next/static/chunks/{2af89379fde6831d.js → f70998ac93012aef.js} +1 -1
  436. package/web/.next/server/chunks/ssr/[root-of-the-server]__013a0318._.js +0 -3
  437. package/web/.next/server/chunks/ssr/[root-of-the-server]__013a0318._.js.map +0 -1
  438. package/web/.next/server/chunks/ssr/[root-of-the-server]__090f24cb._.js +0 -3
  439. package/web/.next/server/chunks/ssr/[root-of-the-server]__24756fa9._.js +0 -12
  440. package/web/.next/server/chunks/ssr/[root-of-the-server]__24756fa9._.js.map +0 -1
  441. package/web/.next/server/chunks/ssr/[root-of-the-server]__70986695._.js +0 -3
  442. package/web/.next/server/chunks/ssr/[root-of-the-server]__70986695._.js.map +0 -1
  443. package/web/.next/server/chunks/ssr/[root-of-the-server]__7aa484f5._.js +0 -3
  444. package/web/.next/server/chunks/ssr/[root-of-the-server]__87bc4dac._.js.map +0 -1
  445. package/web/.next/server/chunks/ssr/[root-of-the-server]__a3a4ddef._.js +0 -3
  446. package/web/.next/server/chunks/ssr/[root-of-the-server]__a3a4ddef._.js.map +0 -1
  447. package/web/.next/server/chunks/ssr/[root-of-the-server]__a4222b95._.js +0 -3
  448. package/web/.next/server/chunks/ssr/[root-of-the-server]__a4222b95._.js.map +0 -1
  449. package/web/.next/server/chunks/ssr/[root-of-the-server]__a5ea76a6._.js +0 -3
  450. package/web/.next/server/chunks/ssr/[root-of-the-server]__a5ea76a6._.js.map +0 -1
  451. package/web/.next/server/chunks/ssr/[root-of-the-server]__a6f2b763._.js +0 -3
  452. package/web/.next/server/chunks/ssr/[root-of-the-server]__a6f2b763._.js.map +0 -1
  453. package/web/.next/server/chunks/ssr/[root-of-the-server]__f3ca7bea._.js +0 -3
  454. package/web/.next/server/chunks/ssr/[root-of-the-server]__f3ca7bea._.js.map +0 -1
  455. package/web/.next/server/chunks/ssr/_0277d3b5._.js +0 -21
  456. package/web/.next/server/chunks/ssr/_0277d3b5._.js.map +0 -1
  457. package/web/.next/server/chunks/ssr/_44531b76._.js +0 -9
  458. package/web/.next/server/chunks/ssr/_44531b76._.js.map +0 -1
  459. package/web/.next/server/chunks/ssr/_5dec4047._.js +0 -3
  460. package/web/.next/server/chunks/ssr/_5dec4047._.js.map +0 -1
  461. package/web/.next/server/chunks/ssr/_73aa3b20._.js +0 -3
  462. package/web/.next/server/chunks/ssr/_73aa3b20._.js.map +0 -1
  463. package/web/.next/server/chunks/ssr/_81e7a131._.js.map +0 -1
  464. package/web/.next/server/chunks/ssr/_869a3a15._.js +0 -3
  465. package/web/.next/server/chunks/ssr/_869a3a15._.js.map +0 -1
  466. package/web/.next/server/chunks/ssr/_b227ff50._.js +0 -3
  467. package/web/.next/server/chunks/ssr/_b227ff50._.js.map +0 -1
  468. package/web/.next/server/chunks/ssr/_d75dcb43._.js +0 -3
  469. package/web/.next/server/chunks/ssr/_d75dcb43._.js.map +0 -1
  470. package/web/.next/server/chunks/ssr/_e071ba48._.js +0 -3
  471. package/web/.next/server/chunks/ssr/_e071ba48._.js.map +0 -1
  472. package/web/.next/server/chunks/ssr/_eff1b518._.js +0 -3
  473. package/web/.next/server/chunks/ssr/_eff1b518._.js.map +0 -1
  474. package/web/.next/server/chunks/ssr/_f227429a._.js +0 -3
  475. package/web/.next/server/chunks/ssr/_f227429a._.js.map +0 -1
  476. package/web/.next/server/chunks/ssr/src_presentation_web_36f2bc45._.js +0 -3
  477. package/web/.next/server/chunks/ssr/src_presentation_web_36f2bc45._.js.map +0 -1
  478. package/web/.next/server/chunks/ssr/src_presentation_web_486908de._.js +0 -3
  479. package/web/.next/server/chunks/ssr/src_presentation_web_486908de._.js.map +0 -1
  480. package/web/.next/server/chunks/ssr/src_presentation_web_5c3596bc._.js +0 -3
  481. package/web/.next/server/chunks/ssr/src_presentation_web_5c3596bc._.js.map +0 -1
  482. package/web/.next/server/chunks/ssr/src_presentation_web_6326f81e._.js +0 -3
  483. package/web/.next/server/chunks/ssr/src_presentation_web_6326f81e._.js.map +0 -1
  484. package/web/.next/server/chunks/ssr/src_presentation_web_6b2fdcd8._.js +0 -3
  485. package/web/.next/server/chunks/ssr/src_presentation_web_6b2fdcd8._.js.map +0 -1
  486. package/web/.next/server/chunks/ssr/src_presentation_web_74703c9f._.js +0 -3
  487. package/web/.next/server/chunks/ssr/src_presentation_web_74703c9f._.js.map +0 -1
  488. package/web/.next/server/chunks/ssr/src_presentation_web_a8056dac._.js +0 -3
  489. package/web/.next/server/chunks/ssr/src_presentation_web_a8056dac._.js.map +0 -1
  490. package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_open-ide_ts_baaca5d5._.js +0 -32
  491. package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_open-ide_ts_baaca5d5._.js.map +0 -1
  492. package/web/.next/server/chunks/ssr/src_presentation_web_b00bfb08._.js +0 -3
  493. package/web/.next/server/chunks/ssr/src_presentation_web_b00bfb08._.js.map +0 -1
  494. package/web/.next/server/chunks/ssr/src_presentation_web_ca99d62d._.js +0 -3
  495. package/web/.next/server/chunks/ssr/src_presentation_web_ca99d62d._.js.map +0 -1
  496. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js +0 -3
  497. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js.map +0 -1
  498. package/web/.next/server/chunks/ssr/src_presentation_web_f1edcf5e._.js +0 -3
  499. package/web/.next/server/chunks/ssr/src_presentation_web_f1edcf5e._.js.map +0 -1
  500. package/web/.next/server/chunks/ssr/src_presentation_web_f9436804._.js +0 -3
  501. package/web/.next/server/chunks/ssr/src_presentation_web_f9436804._.js.map +0 -1
  502. package/web/.next/server/chunks/ssr/translations_23dd5e7e._.js +0 -3
  503. package/web/.next/server/chunks/ssr/translations_23dd5e7e._.js.map +0 -1
  504. package/web/.next/static/chunks/06b9d6dbf635c370.css +0 -1
  505. package/web/.next/static/chunks/1ae0cf5be30ef398.js +0 -1
  506. package/web/.next/static/chunks/3a71cab38909921e.js +0 -1
  507. package/web/.next/static/chunks/4e53adb5d07b7e3d.js +0 -1
  508. package/web/.next/static/chunks/5e7ac3508bef115f.js +0 -1
  509. package/web/.next/static/chunks/761a7c542b358739.js +0 -1
  510. package/web/.next/static/chunks/927442d2628f6e22.js +0 -1
  511. package/web/.next/static/chunks/a31f2264cedb23e9.js +0 -1
  512. package/web/.next/static/chunks/abf7d1b66555b758.js +0 -7
  513. package/web/.next/static/chunks/b99506a6f7bc2fa8.js +0 -1
  514. package/web/.next/static/chunks/d984d1d8d506291c.js +0 -7
  515. package/web/.next/static/chunks/e843a0d8e8c645c4.js +0 -1
  516. package/web/.next/static/chunks/f5ed0232d50b1ec8.js +0 -19
  517. /package/web/.next/static/{6GBQ7MHEYpZbJzqULwvXh → t-O8eMjJCUhhtd6CgtTXI}/_buildManifest.js +0 -0
  518. /package/web/.next/static/{6GBQ7MHEYpZbJzqULwvXh → t-O8eMjJCUhhtd6CgtTXI}/_clientMiddlewareManifest.json +0 -0
  519. /package/web/.next/static/{6GBQ7MHEYpZbJzqULwvXh → t-O8eMjJCUhhtd6CgtTXI}/_ssgManifest.js +0 -0
@@ -1,19 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,65932,(e,i,r)=>{"use strict";i.exports=function e(i,r){if(i===r)return!0;if(i&&r&&"object"==typeof i&&"object"==typeof r){if(i.constructor!==r.constructor)return!1;if(Array.isArray(i)){if((s=i.length)!=r.length)return!1;for(n=s;0!=n--;)if(!e(i[n],r[n]))return!1;return!0}if(i.constructor===RegExp)return i.source===r.source&&i.flags===r.flags;if(i.valueOf!==Object.prototype.valueOf)return i.valueOf()===r.valueOf();if(i.toString!==Object.prototype.toString)return i.toString()===r.toString();if((s=(o=Object.keys(i)).length)!==Object.keys(r).length)return!1;for(n=s;0!=n--;)if(!Object.prototype.hasOwnProperty.call(r,o[n]))return!1;for(n=s;0!=n--;){var s,n,o,a=o[n];if(!e(i[a],r[a]))return!1}return!0}return i!=i&&r!=r}},83241,(e,i,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"BailoutToCSR",{enumerable:!0,get:function(){return n}});let s=e.r(9328);function n({reason:e,children:i}){if("u"<typeof window)throw Object.defineProperty(new s.BailoutToCSRError(e),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return i}},90891,(e,i,r)=>{"use strict";function s(e){return e.split("/").map(e=>encodeURIComponent(e)).join("/")}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"encodeURIPath",{enumerable:!0,get:function(){return s}})},31218,(e,i,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"PreloadChunks",{enumerable:!0,get:function(){return h}});let s=e.r(20314),n=e.r(26036),o=e.r(58988),a=e.r(90891),l=e.r(22193);function h({moduleIds:e}){if("u">typeof window)return null;let i=o.workAsyncStorage.getStore();if(void 0===i)return null;let r=[];if(i.reactLoadableManifest&&e){let s=i.reactLoadableManifest;for(let i of e){if(!s[i])continue;let e=s[i].files;r.push(...e)}}if(0===r.length)return null;let h=(0,l.getDeploymentIdQueryOrEmptyString)();return(0,s.jsx)(s.Fragment,{children:r.map(e=>{let r=`${i.assetPrefix}/_next/${(0,a.encodeURIPath)(e)}${h}`;return e.endsWith(".css")?(0,s.jsx)("link",{precedence:"dynamic",href:r,rel:"stylesheet",as:"style",nonce:i.nonce},e):((0,n.preload)(r,{as:"script",fetchPriority:"low",nonce:i.nonce}),null)})})}},84929,(e,i,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return c}});let s=e.r(20314),n=e.r(79054),o=e.r(83241),a=e.r(31218);function l(e){return{default:e&&"default"in e?e.default:e}}let h={loader:()=>Promise.resolve(l(()=>null)),loading:null,ssr:!0},c=function(e){let i={...h,...e},r=(0,n.lazy)(()=>i.loader().then(l)),c=i.loading;function d(e){let l=c?(0,s.jsx)(c,{isLoading:!0,pastDelay:!0,error:null}):null,h=!i.ssr||!!i.loading,d=h?n.Suspense:n.Fragment,u=i.ssr?(0,s.jsxs)(s.Fragment,{children:["u"<typeof window?(0,s.jsx)(a.PreloadChunks,{moduleIds:i.modules}):null,(0,s.jsx)(r,{...e})]}):(0,s.jsx)(o.BailoutToCSR,{reason:"next/dynamic",children:(0,s.jsx)(r,{...e})});return(0,s.jsx)(d,{...h?{fallback:l}:{},children:u})}return d.displayName="LoadableComponent",d}},47901,(e,i,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return n}});let s=e.r(81258)._(e.r(84929));function n(e,i){let r={};"function"==typeof e&&(r.loader=e);let n={...r,...i};return(0,s.default)({...n,modules:n.loadableGenerated?.modules})}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),i.exports=r.default)},97687,e=>{"use strict";let i,r,s,n,o,a,l,h,c,d,u,f;var p,_,g,v,m,S,y,b,w,C,x,k,E,D,O,T,P,I=e.i(20314),R=e.i(79054),M=e.i(31406),N=e.i(62885),L=e.i(60112),B=e.i(3645);let A=(0,B.default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);var j=e.i(42049),H=e.i(49228),W=e.i(33548),z=e.i(19933),F=e.i(41698),$=e.i(18532),K=e.i(12919),U=e.i(91909),U=U,Y=e.i(17406),q=e.i(31777),X=e.i(35364),V=e.i(28112);let G=[{stepKey:"scaffold",title:"Setting up your project",description:"Creating the foundation files"},{stepKey:"deps",title:"Installing design tools",description:"Adding Tailwind and essentials"},{stepKey:"components",title:"Building the pieces",description:"Designing and creating reusable parts"},{stepKey:"wire",title:"Connecting everything",description:"Wiring navigation and forms"},{stepKey:"style",title:"Polishing the look",description:"Applying colors, spacing, and motion"},{stepKey:"verify",title:"Double-checking",description:"Making sure it runs cleanly"},{stepKey:"commit",title:"Saving a snapshot",description:"Committing the initial build"},{stepKey:"report",title:"Your app is ready",description:"Summary of what was built"}];var Z=e.i(44172),J=Object.defineProperty,Q=Object.getOwnPropertyDescriptor,ee=(e,i,r,s)=>{for(var n,o=s>1?void 0:s?Q(i,r):i,a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s?n(i,r,o):n(o))||o);return s&&o&&J(i,r,o),o},et=(e,i)=>(r,s)=>i(r,s,e),ei="Terminal input",er="Too much output to announce, navigate to rows manually to read";function es(e,i,r,s){var n;n=e=e.replace(/\r?\n/g,"\r"),e=r.decPrivateModes.bracketedPasteMode&&!0!==s.rawOptions.ignoreBracketedPasteMode?"\x1b[200~"+n+"\x1b[201~":n,r.triggerDataEvent(e,!0),i.value=""}function en(e,i,r){let s=r.getBoundingClientRect(),n=e.clientX-s.left-10,o=e.clientY-s.top-10;i.style.width="20px",i.style.height="20px",i.style.left=`${n}px`,i.style.top=`${o}px`,i.style.zIndex="1000",i.focus()}function eo(e,i,r,s,n){en(e,i,r),n&&s.rightClickSelect(e),i.value=s.selectionText,i.select()}function ea(e){return e>65535?String.fromCharCode(((e-=65536)>>10)+55296)+String.fromCharCode(e%1024+56320):String.fromCharCode(e)}function el(e,i=0,r=e.length){let s="";for(let n=i;n<r;++n){let i=e[n];i>65535?(i-=65536,s+=String.fromCharCode((i>>10)+55296)+String.fromCharCode(i%1024+56320)):s+=String.fromCharCode(i)}return s}var eh=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,i){let r=e.length;if(!r)return 0;let s=0,n=0;if(this._interim){let r=e.charCodeAt(n++);56320<=r&&r<=57343?i[s++]=(this._interim-55296)*1024+r-56320+65536:(i[s++]=this._interim,i[s++]=r),this._interim=0}for(let o=n;o<r;++o){let n=e.charCodeAt(o);if(55296<=n&&n<=56319){if(++o>=r)return this._interim=n,s;let a=e.charCodeAt(o);56320<=a&&a<=57343?i[s++]=(n-55296)*1024+a-56320+65536:(i[s++]=n,i[s++]=a);continue}65279!==n&&(i[s++]=n)}return s}},ec=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,i){let r=e.length;if(!r)return 0;let s=0,n,o,a,l,h=0,c=0;if(this.interim[0]){let n=!1,o=this.interim[0];o&=(224&o)==192?31:(240&o)==224?15:7;let a=0,l;for(;(l=63&this.interim[++a])&&a<4;)o<<=6,o|=l;let h=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,d=h-a;for(;c<d;){if(c>=r)return 0;if((192&(l=e[c++]))!=128){c--,n=!0;break}this.interim[a++]=l,o<<=6,o|=63&l}n||(2===h?o<128?c--:i[s++]=o:3===h?o<2048||o>=55296&&o<=57343||65279===o||(i[s++]=o):o<65536||o>1114111||(i[s++]=o)),this.interim.fill(0)}let d=r-4,u=c;for(;u<r;){for(;u<d&&!(128&(n=e[u]))&&!(128&(o=e[u+1]))&&!(128&(a=e[u+2]))&&!(128&(l=e[u+3]));)i[s++]=n,i[s++]=o,i[s++]=a,i[s++]=l,u+=4;if((n=e[u++])<128)i[s++]=n;else if((224&n)==192){if(u>=r)return this.interim[0]=n,s;if((192&(o=e[u++]))!=128||(h=(31&n)<<6|63&o)<128){u--;continue}i[s++]=h}else if((240&n)==224){if(u>=r)return this.interim[0]=n,s;if((192&(o=e[u++]))!=128){u--;continue}if(u>=r)return this.interim[0]=n,this.interim[1]=o,s;if((192&(a=e[u++]))!=128){u--;continue}if((h=(15&n)<<12|(63&o)<<6|63&a)<2048||h>=55296&&h<=57343||65279===h)continue;i[s++]=h}else if((248&n)==240){if(u>=r)return this.interim[0]=n,s;if((192&(o=e[u++]))!=128){u--;continue}if(u>=r)return this.interim[0]=n,this.interim[1]=o,s;if((192&(a=e[u++]))!=128){u--;continue}if(u>=r)return this.interim[0]=n,this.interim[1]=o,this.interim[2]=a,s;if((192&(l=e[u++]))!=128){u--;continue}if((h=(7&n)<<18|(63&o)<<12|(63&a)<<6|63&l)<65536||h>1114111)continue;i[s++]=h}}return s}},ed=class e{constructor(){this.fg=0,this.bg=0,this.extended=new eu}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let i=new e;return i.fg=this.fg,i.bg=this.bg,i.extended=this.extended.clone(),i}isInverse(){return 0x4000000&this.fg}isBold(){return 0x8000000&this.fg}isUnderline(){return this.hasExtendedAttrs()&&0!==this.extended.underlineStyle?1:0x10000000&this.fg}isBlink(){return 0x20000000&this.fg}isInvisible(){return 0x40000000&this.fg}isItalic(){return 0x4000000&this.bg}isDim(){return 0x8000000&this.bg}isStrikethrough(){return 0x80000000&this.fg}isProtected(){return 0x20000000&this.bg}isOverline(){return 0x40000000&this.bg}getFgColorMode(){return 0x3000000&this.fg}getBgColorMode(){return 0x3000000&this.bg}isFgRGB(){return(0x3000000&this.fg)==0x3000000}isBgRGB(){return(0x3000000&this.bg)==0x3000000}isFgPalette(){return(0x3000000&this.fg)==0x1000000||(0x3000000&this.fg)==0x2000000}isBgPalette(){return(0x3000000&this.bg)==0x1000000||(0x3000000&this.bg)==0x2000000}isFgDefault(){return(0x3000000&this.fg)==0}isBgDefault(){return(0x3000000&this.bg)==0}isAttributeDefault(){return 0===this.fg&&0===this.bg}getFgColor(){switch(0x3000000&this.fg){case 0x1000000:case 0x2000000:return 255&this.fg;case 0x3000000:return 0xffffff&this.fg;default:return -1}}getBgColor(){switch(0x3000000&this.bg){case 0x1000000:case 0x2000000:return 255&this.bg;case 0x3000000:return 0xffffff&this.bg;default:return -1}}hasExtendedAttrs(){return 0x10000000&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-0x10000001:this.bg|=0x10000000}getUnderlineColor(){if(0x10000000&this.bg&&~this.extended.underlineColor)switch(0x3000000&this.extended.underlineColor){case 0x1000000:case 0x2000000:return 255&this.extended.underlineColor;case 0x3000000:return 0xffffff&this.extended.underlineColor}return this.getFgColor()}getUnderlineColorMode(){return 0x10000000&this.bg&&~this.extended.underlineColor?0x3000000&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 0x10000000&this.bg&&~this.extended.underlineColor?(0x3000000&this.extended.underlineColor)==0x3000000:this.isFgRGB()}isUnderlineColorPalette(){return 0x10000000&this.bg&&~this.extended.underlineColor?(0x3000000&this.extended.underlineColor)==0x1000000||(0x3000000&this.extended.underlineColor)==0x2000000:this.isFgPalette()}isUnderlineColorDefault(){return 0x10000000&this.bg&&~this.extended.underlineColor?(0x3000000&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 0x10000000&this.fg?0x10000000&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},eu=class e{constructor(e=0,i=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=i}get ext(){return this._urlId?-0x1c000001&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(0x1c000000&this._ext)>>26}set underlineStyle(e){this._ext&=-0x1c000001,this._ext|=e<<26&0x1c000000}get underlineColor(){return 0x3ffffff&this._ext}set underlineColor(e){this._ext&=-0x4000000,this._ext|=0x3ffffff&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(0xe0000000&this._ext)>>29;return e<0?0xfffffff8^e:e}set underlineVariantOffset(e){this._ext&=0x1fffffff,this._ext|=e<<29&0xe0000000}clone(){return new e(this._ext,this._urlId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId}},ef=class e extends ed{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new eu,this.combinedData=""}static fromCharData(i){let r=new e;return r.setFromCharData(i),r}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?ea(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[0],this.bg=0;let i=!1;if(e[1].length>2)i=!0;else if(2===e[1].length){let r=e[1].charCodeAt(0);if(55296<=r&&r<=56319){let s=e[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(r-55296)*1024+s-56320+65536|e[2]<<22:i=!0}else i=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;i&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ep="di$target",e_="di$dependencies",eg=new Map;function ev(e){if(eg.has(e))return eg.get(e);let i=function(e,r,s){var n,o,a;if(3!=arguments.length)throw Error("@IServiceName-decorator can only be used to decorate a parameter");n=i,o=e,a=s,o[ep]===o?o[e_].push({id:n,index:a}):(o[e_]=[{id:n,index:a}],o[ep]=o)};return i._id=e,eg.set(e,i),i}var em=ev("BufferService"),eS=ev("CoreMouseService"),ey=ev("CoreService"),eb=ev("CharsetService"),ew=ev("InstantiationService"),eC=ev("LogService"),ex=ev("OptionsService"),ek=ev("OscLinkService"),eE=ev("UnicodeService"),eD=ev("DecorationService"),eO=class{constructor(e,i,r){this._bufferService=e,this._optionsService=i,this._oscLinkService=r}provideLinks(e,i){let r=this._bufferService.buffer.lines.get(e-1);if(!r)return void i(void 0);let s=[],n=this._optionsService.rawOptions.linkHandler,o=new ef,a=r.getTrimmedLength(),l=-1,h=-1,c=!1;for(let i=0;i<a;i++)if(!(-1===h&&!r.hasContent(i))){if(r.loadCell(i,o),o.hasExtendedAttrs()&&o.extended.urlId)if(-1===h){h=i,l=o.extended.urlId;continue}else c=o.extended.urlId!==l;else -1!==h&&(c=!0);if(c||-1!==h&&i===a-1){let r=this._oscLinkService.getLinkData(l)?.uri;if(r){let o={start:{x:h+1,y:e},end:{x:i+ +(!c&&i===a-1),y:e}},l=!1;if(!n?.allowNonHttpProtocols)try{let e=new URL(r);["http:","https:"].includes(e.protocol)||(l=!0)}catch{l=!0}l||s.push({text:r,range:o,activate:(e,i)=>n?n.activate(e,i,o):function(e,i){if(confirm(`Do you want to navigate to ${i}?
2
-
3
- WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}}(0,i),hover:(e,i)=>n?.hover?.(e,i,o),leave:(e,i)=>n?.leave?.(e,i,o)})}c=!1,o.hasExtendedAttrs()&&o.extended.urlId?(h=i,l=o.extended.urlId):(h=-1,l=-1)}}i(s)}};eO=ee([et(0,em),et(1,ex),et(2,ek)],eO);var eT=ev("CharSizeService"),eP=ev("CoreBrowserService"),eI=ev("MouseService"),eR=ev("RenderService"),eM=ev("SelectionService"),eN=ev("CharacterJoinerService"),eL=ev("ThemeService"),eB=ev("LinkProviderService"),eA=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?ez.isErrorNoTelemetry(e)?new ez(e.message+`
4
-
5
- `+e.stack):Error(e.message+`
6
-
7
- `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(i=>{i(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function ej(e){var i;(i=e)instanceof eW||i instanceof Error&&i.name===eH&&i.message===eH||eA.onUnexpectedError(e)}var eH="Canceled",eW=class extends Error{constructor(){super(eH),this.name=this.message}},ez=class e extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(i){if(i instanceof e)return i;let r=new e;return r.message=i.message,r.stack=i.stack,r}static isErrorNoTelemetry(e){return"CodeExpectedError"===e.name}},eF=class e extends Error{constructor(i){super(i||"An unexpected bug occurred."),Object.setPrototypeOf(this,e.prototype)}};function e$(e,i=0){return e[e.length-(1+i)]}(e4=e8||={}).isLessThan=function(e){return e<0},e4.isLessThanOrEqual=function(e){return e<=0},e4.isGreaterThan=function(e){return e>0},e4.isNeitherLessOrGreaterThan=function(e){return 0===e},e4.greaterThan=1,e4.lessThan=-1,e4.neitherLessOrGreaterThan=0;var eK=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(i=>(e(i),!0))}toArray(){let e=[];return this.iterate(i=>(e.push(i),!0)),e}filter(i){return new e(e=>this.iterate(r=>!i(r)||e(r)))}map(i){return new e(e=>this.iterate(r=>e(i(r))))}some(e){let i=!1;return this.iterate(r=>!(i=e(r))),i}findFirst(e){let i;return this.iterate(r=>!e(r)||(i=r,!1)),i}findLast(e){let i;return this.iterate(r=>(e(r)&&(i=r),!0)),i}findLastMaxBy(e){let i,r=!0;return this.iterate(s=>((r||e8.isGreaterThan(e(s,i)))&&(r=!1,i=s),!0)),i}};eK.empty=new eK(e=>{});function eU(e){}function eY(e,i){}function eq(e){if(e7.is(e)){let i=[];for(let r of e)if(r)try{r.dispose()}catch(e){i.push(e)}if(1===i.length)throw i[0];if(i.length>1)throw AggregateError(i,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function eX(e){let i={dispose:function(e,i){let r=this,s=!1,n;return function(){if(s)return n;if(s=!0,i)try{n=e.apply(r,arguments)}finally{i()}else n=e.apply(r,arguments);return n}}(()=>{eU(i),e()})};return i}(e=>{function i(e){return e&&"object"==typeof e&&"function"==typeof e[Symbol.iterator]}e.is=i;let r=Object.freeze([]);function*s(e){yield e}e.empty=function(){return r},e.single=s,e.wrap=function(e){return i(e)?e:s(e)},e.from=function(e){return e||r},e.reverse=function*(e){for(let i=e.length-1;i>=0;i--)yield e[i]},e.isEmpty=function(e){return!e||!0===e[Symbol.iterator]().next().done},e.first=function(e){return e[Symbol.iterator]().next().value},e.some=function(e,i){let r=0;for(let s of e)if(i(s,r++))return!0;return!1},e.find=function(e,i){for(let r of e)if(i(r))return r},e.filter=function*(e,i){for(let r of e)i(r)&&(yield r)},e.map=function*(e,i){let r=0;for(let s of e)yield i(s,r++)},e.flatMap=function*(e,i){let r=0;for(let s of e)yield*i(s,r++)},e.concat=function*(...e){for(let i of e)yield*i},e.reduce=function(e,i,r){let s=r;for(let r of e)s=i(s,r);return s},e.slice=function*(e,i,r=e.length){for(i<0&&(i+=e.length),r<0?r+=e.length:r>e.length&&(r=e.length);i<r;i++)yield e[i]},e.consume=function(i,r=1/0){let s=[];if(0===r)return[s,i];let n=i[Symbol.iterator]();for(let i=0;i<r;i++){let i=n.next();if(i.done)return[s,e.empty()];s.push(i.value)}return[s,{[Symbol.iterator]:()=>n}]},e.asyncToArray=async function(e){let i=[];for await(let r of e)i.push(r);return Promise.resolve(i)}})(e7||={});var eV=class e{constructor(){var e;this._toDispose=new Set,this._isDisposed=!1,e=this}dispose(){this._isDisposed||(eU(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(0!==this._toDispose.size)try{eq(this._toDispose)}finally{this._toDispose.clear()}}add(i){if(!i)return i;if(i===this)throw Error("Cannot register a disposable on itself!");return eY(i,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(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(i),i}delete(e){if(e){if(e===this)throw Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),eY(e,null))}};eV.DISABLE_DISPOSED_WARNING=!1;var eG=eV,eZ=class{constructor(){var e;this._store=new eG,e=this,eY(this._store,this)}dispose(){eU(this),this._store.dispose()}_register(e){if(e===this)throw Error("Cannot register a disposable on itself!");return this._store.add(e)}};eZ.None=Object.freeze({dispose(){}});var eJ=class{constructor(){var e;this._isDisposed=!1,e=this}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&eY(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,eU(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&eY(e,null),e}},eQ="object"==typeof window?window:globalThis,e0=class e{constructor(i){this.element=i,this.next=e.Undefined,this.prev=e.Undefined}};e0.Undefined=new e0(void 0);var e1=class{constructor(){this._first=e0.Undefined,this._last=e0.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===e0.Undefined}clear(){let e=this._first;for(;e!==e0.Undefined;){let i=e.next;e.prev=e0.Undefined,e.next=e0.Undefined,e=i}this._first=e0.Undefined,this._last=e0.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,i){let r=new e0(e);if(this._first===e0.Undefined)this._first=r,this._last=r;else if(i){let e=this._last;this._last=r,r.prev=e,e.next=r}else{let e=this._first;this._first=r,r.next=e,e.prev=r}this._size+=1;let s=!1;return()=>{s||(s=!0,this._remove(r))}}shift(){if(this._first!==e0.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==e0.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==e0.Undefined&&e.next!==e0.Undefined){let i=e.prev;i.next=e.next,e.next.prev=i}else e.prev===e0.Undefined&&e.next===e0.Undefined?(this._first=e0.Undefined,this._last=e0.Undefined):e.next===e0.Undefined?(this._last=this._last.prev,this._last.next=e0.Undefined):e.prev===e0.Undefined&&(this._first=this._first.next,this._first.prev=e0.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==e0.Undefined;)yield e.element,e=e.next}},e2=globalThis.performance&&"function"==typeof globalThis.performance.now,e5=class e{static create(i){return new e(i)}constructor(e){this._now=e2&&!1===e?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 -1!==this._stopTime?this._stopTime-this._startTime:this._now()-this._startTime}};(e=>{function i(e){}function r(e){return(i,r=null,s)=>{let n=!1,o;return o=e(e=>{if(!n)return o?o.dispose():n=!0,i.call(r,e)},null,s),n&&o.dispose(),o}}function s(e,i,r){return o((r,s=null,n)=>e(e=>r.call(s,i(e)),null,n),r)}function n(e,i,r){return o((r,s=null,n)=>e(e=>i(e)&&r.call(s,e),null,n),r)}function o(e,r){let s,n={onWillAddFirstListener(){s=e(o.fire,o)},onDidRemoveLastListener(){s?.dispose()}};r||i(n);let o=new to(n);return r?.add(o),o.event}function a(e,r,s=100,n=!1,o=!1,l,h){let c,d,u,f=0,p,_={leakWarningThreshold:l,onWillAddFirstListener(){c=e(e=>{f++,d=r(d,e),n&&!u&&(g.fire(d),d=void 0),p=()=>{let e=d;d=void 0,u=void 0,(!n||f>1)&&g.fire(e),f=0},"number"==typeof s?(clearTimeout(u),u=setTimeout(p,s)):void 0===u&&(u=0,queueMicrotask(p))})},onWillRemoveListener(){o&&f>0&&p?.()},onDidRemoveLastListener(){p=void 0,c.dispose()}};h||i(_);let g=new to(_);return h?.add(g),g.event}e.None=()=>eZ.None,e.defer=function(e,i){return a(e,()=>{},0,void 0,!0,void 0,i)},e.once=r,e.map=s,e.forEach=function(e,i,r){return o((r,s=null,n)=>e(e=>{i(e),r.call(s,e)},null,n),r)},e.filter=n,e.signal=function(e){return e},e.any=function(...e){return(i,r=null,s)=>{var n,o;return n=function(...e){var i,r;let s=eX(()=>eq(e));return i=0,r=0,s}(...e.map(e=>e(e=>i.call(r,e)))),(o=s)instanceof Array?o.push(n):o&&o.add(n),n}},e.reduce=function(e,i,r,n){let o=r;return s(e,e=>o=i(o,e),n)},e.debounce=a,e.accumulate=function(i,r=0,s){return e.debounce(i,(e,i)=>e?(e.push(i),e):[i],r,void 0,!0,void 0,s)},e.latch=function(e,i=(e,i)=>e===i,r){let s=!0,o;return n(e,e=>{let r=s||!i(e,o);return s=!1,o=e,r},r)},e.split=function(i,r,s){return[e.filter(i,r,s),e.filter(i,e=>!r(e),s)]},e.buffer=function(e,i=!1,r=[],s){let n=r.slice(),o=e(e=>{n?n.push(e):l.fire(e)});s&&s.add(o);let a=()=>{n?.forEach(e=>l.fire(e)),n=null},l=new to({onWillAddFirstListener(){o||(o=e(e=>l.fire(e)),s&&s.add(o))},onDidAddFirstListener(){n&&(i?setTimeout(a):a())},onDidRemoveLastListener(){o&&o.dispose(),o=null}});return s&&s.add(l),l.event},e.chain=function(e,i){return(r,s,n)=>{let o=i(new h);return e(function(e){let i=o.evaluate(e);i!==l&&r.call(s,i)},void 0,n)}};let l=Symbol("HaltChainable");class h{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(i=>(e(i),i)),this}filter(e){return this.steps.push(i=>e(i)?i:l),this}reduce(e,i){let r=i;return this.steps.push(i=>r=e(r,i)),this}latch(e=(e,i)=>e===i){let i=!0,r;return this.steps.push(s=>{let n=i||!e(s,r);return i=!1,r=s,n?s:l}),this}evaluate(e){for(let i of this.steps)if((e=i(e))===l)break;return e}}e.fromNodeEventEmitter=function(e,i,r=e=>e){let s=(...e)=>n.fire(r(...e)),n=new to({onWillAddFirstListener:()=>e.on(i,s),onDidRemoveLastListener:()=>e.removeListener(i,s)});return n.event},e.fromDOMEventEmitter=function(e,i,r=e=>e){let s=(...e)=>n.fire(r(...e)),n=new to({onWillAddFirstListener:()=>e.addEventListener(i,s),onDidRemoveLastListener:()=>e.removeEventListener(i,s)});return n.event},e.toPromise=function(e){return new Promise(i=>r(e)(i))},e.fromPromise=function(e){let i=new to;return e.then(e=>{i.fire(e)},()=>{i.fire(void 0)}).finally(()=>{i.dispose()}),i.event},e.forward=function(e,i){return e(e=>i.fire(e))},e.runAndSubscribe=function(e,i,r){return i(r),e(e=>i(e))};class c{constructor(e,r){this._observable=e,this._counter=0,this._hasChanged=!1;let s={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};r||i(s),this.emitter=new to(s),r&&r.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,i){this._hasChanged=!0}endUpdate(e){this._counter--,0===this._counter&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}e.fromObservable=function(e,i){return new c(e,i).emitter.event},e.fromObservableLight=function(e){return(i,r,s)=>{let n=0,o=!1,a={beginUpdate(){n++},endUpdate(){0==--n&&(e.reportChanges(),o&&(o=!1,i.call(r)))},handlePossibleChange(){},handleChange(){o=!0}};e.addObserver(a),e.reportChanges();let l={dispose(){e.removeObserver(a)}};return s instanceof eG?s.add(l):Array.isArray(s)&&s.push(l),l}}})(e9||={});var e3=class e{constructor(i){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${i}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new e5,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}}};e3.all=new Set,e3._idPool=0;var e6=class e{constructor(i,r,s=(e._idPool++).toString(16).padStart(3,"0")){this._errorHandler=i,this.threshold=r,this.name=s,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,i){let r=this.threshold;if(r<=0||i<r)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=.5*r;let[e,s]=this.getMostFrequentStack(),n=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${s}):`;console.warn(n),console.warn(e);let o=new ti(n,e);this._errorHandler(o)}return()=>{let i=this._stacks.get(e.value)||0;this._stacks.set(e.value,i-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[r,s]of this._stacks)(!e||i<s)&&(e=[r,s],i=s);return e}};e6._idPool=1;var e4,e8,e7,e9,te,tt=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??"")}print(){console.warn(this.value.split(`
8
- `).slice(2).join(`
9
- `))}},ti=class extends Error{constructor(e,i){super(e),this.name="ListenerLeakError",this.stack=i}},tr=class extends Error{constructor(e,i){super(e),this.name="ListenerRefusalError",this.stack=i}},ts=0,tn=class{constructor(e){this.value=e,this.id=ts++}},to=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new e6(e?.onListenerError??ej,this._options?.leakWarningThreshold??-1):void 0,this._perfMon=this._options?._profName?new e3(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??=(e,i,r)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let i=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],r=new tr(`${e}. HINT: Stack shows most frequent listener (${i[1]}-times)`,i[0]);return(this._options?.onListenerError||ej)(r),eZ.None}if(this._disposed)return eZ.None;i&&(e=e.bind(i));let s=new tn(e),n;this._leakageMon&&this._size>=Math.ceil(.2*this._leakageMon.threshold)&&(s.stack=tt.create(),n=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof tn?(this._deliveryQueue??=new ta,this._listeners=[this._listeners,s]):this._listeners.push(s):(this._options?.onWillAddFirstListener?.(this),this._listeners=s,this._options?.onDidAddFirstListener?.(this)),this._size++;let o=eX(()=>{te?.unregister(o),n?.(),this._removeListener(s)});if(r instanceof eG?r.add(o):Array.isArray(r)&&r.push(o),te){let e=Error().stack.split(`
10
- `).slice(2,3).join(`
11
- `).trim(),i=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);te.register(o,i?.[2]??e,o)}return o},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(1===this._size){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let i=this._listeners,r=i.indexOf(e);if(-1===r)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),Error("Attempted to dispose unknown listener");this._size--,i[r]=void 0;let s=this._deliveryQueue.current===this;if(2*this._size<=i.length){let e=0;for(let r=0;r<i.length;r++)i[r]?i[e++]=i[r]:s&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);i.length=e}}_deliver(e,i){if(!e)return;let r=this._options?.onListenerError||ej;try{e.value(i)}catch(e){r(e)}}_deliverQueue(e){let i=e.current._listeners;for(;e.i<e.end;)this._deliver(i[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof tn)this._deliver(this._listeners,e);else{let i=this._deliveryQueue;i.enqueue(this,e,this._listeners.length),this._deliverQueue(i)}this._perfMon?.stop()}hasListeners(){return this._size>0}},ta=class{constructor(){this.i=-1,this.end=0}enqueue(e,i,r){this.i=0,this.end=r,this.current=e,this.value=i}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},tl=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new to,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new to,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,i){if(this.getZoomLevel(i)===e)return;let r=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(r,e),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),e)}setFullscreen(e,i){if(this.isFullscreen(i)===e)return;let r=this.getWindowId(i);this.mapWindowIdToFullScreen.set(r,e),this._onDidChangeFullscreen.fire(r)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};tl.INSTANCE=new tl,tl.INSTANCE.onDidChangeZoomLevel,tl.INSTANCE.onDidChangeFullscreen;var th="object"==typeof navigator?navigator.userAgent:"",tc=th.indexOf("Firefox")>=0,td=th.indexOf("AppleWebKit")>=0,tu=th.indexOf("Chrome")>=0,tf=!tu&&th.indexOf("Safari")>=0;th.indexOf("Electron/"),th.indexOf("Android");var tp=!1;if("function"==typeof eQ.matchMedia){let e=eQ.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),i=eQ.matchMedia("(display-mode: fullscreen)");tp=e.matches,t_=e,"string"==typeof t_&&(t_=eQ.matchMedia(t_)),t_.addEventListener("change",({matches:e})=>{tp&&i.matches||(tp=e)})}var t_,tg,tv,tm=!1,tS=!1,ty=!1,tb=!1,tw=!1,tC="en",tx=globalThis;"u">typeof tx.vscode&&"u">typeof tx.vscode.process?tv=tx.vscode.process:"u">typeof Z.default&&"string"==typeof Z.default?.versions?.node&&(tv=Z.default);var tk="string"==typeof tv?.versions?.electron&&tv?.type==="renderer";if("object"==typeof tv){tm="win32"===tv.platform,tS="darwin"===tv.platform,(ty="linux"===tv.platform)&&tv.env.SNAP&&tv.env.SNAP_REVISION,tv.env.CI||tv.env.BUILD_ARTIFACTSTAGINGDIRECTORY,tC="en";let e=tv.env.VSCODE_NLS_CONFIG;if(e)try{let i=JSON.parse(e);i.userLocale,i.osLocale,tC=i.resolvedLanguage||"en",i.languagePack?.translationsConfigFile}catch{}tb=!0}else"object"!=typeof navigator||tk?console.error("Unable to resolve platform."):(tm=(tg=navigator.userAgent).indexOf("Windows")>=0,tS=tg.indexOf("Macintosh")>=0,(tg.indexOf("Macintosh")>=0||tg.indexOf("iPad")>=0||tg.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,ty=tg.indexOf("Linux")>=0,tg?.indexOf("Mobi"),tw=!0,tC=globalThis._VSCODE_NLS_LANGUAGE||"en",navigator.language.toLowerCase());var tE=tm,tD=tS,tO=ty,tT=tb;tw&&"function"==typeof tx.importScripts&&tx.origin;var tP,tI=tg,tR=tC;(tF=tP||={}).value=function(){return tR},tF.isDefaultVariant=function(){return 2===tR.length?"en"===tR:tR.length>=3&&"e"===tR[0]&&"n"===tR[1]&&"-"===tR[2]},tF.isDefault=function(){return"en"===tR};var tM="function"==typeof tx.postMessage&&!tx.importScripts,tN=(()=>{if(tM){let e=[];tx.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let r=0,s=e.length;r<s;r++){let s=e[r];if(s.id===i.data.vscodeScheduleAsyncWork){e.splice(r,1),s.callback();return}}});let i=0;return r=>{let s=++i;e.push({id:s,callback:r}),tx.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})(),tL=!!(tI&&tI.indexOf("Chrome")>=0);tI&&tI.indexOf("Firefox"),!tL&&tI&&tI.indexOf("Safari"),tI&&tI.indexOf("Edg/"),tI&&tI.indexOf("Android");var tB="object"==typeof navigator?navigator:{};tT||document.queryCommandSupported&&document.queryCommandSupported("copy")||tB&&tB.clipboard&&tB.clipboard.writeText,tT||tB&&tB.clipboard&&tB.clipboard.readText,tT||tp||tB.keyboard,"ontouchstart"in eQ||tB.maxTouchPoints,eQ.PointerEvent&&("ontouchstart"in eQ||navigator.maxTouchPoints);var tA=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,i){this._keyCodeToStr[e]=i,this._strToKeyCode[i.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},tj=new tA,tH=new tA,tW=new tA,tz=Array(230);(t$=tK||={}).toString=function(e){return tj.keyCodeToStr(e)},t$.fromString=function(e){return tj.strToKeyCode(e)},t$.toUserSettingsUS=function(e){return tH.keyCodeToStr(e)},t$.toUserSettingsGeneral=function(e){return tW.keyCodeToStr(e)},t$.fromUserSettings=function(e){return tH.strToKeyCode(e)||tW.strToKeyCode(e)},t$.toElectronAccelerator=function(e){if(e>=98&&e<=113)return null;switch(e){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return tj.keyCodeToStr(e)};var tF,t$,tK,tU,tY=class e{constructor(e,i,r,s,n){this.ctrlKey=e,this.shiftKey=i,this.altKey=r,this.metaKey=s,this.keyCode=n}equals(i){return i instanceof e&&this.ctrlKey===i.ctrlKey&&this.shiftKey===i.shiftKey&&this.altKey===i.altKey&&this.metaKey===i.metaKey&&this.keyCode===i.keyCode}getHashCode(){let e=this.ctrlKey?"1":"0",i=this.shiftKey?"1":"0",r=this.altKey?"1":"0",s=this.metaKey?"1":"0";return`K${e}${i}${r}${s}${this.keyCode}`}isModifierKey(){return 0===this.keyCode||5===this.keyCode||57===this.keyCode||6===this.keyCode||4===this.keyCode}toKeybinding(){return new tq([this])}isDuplicateModifierCase(){return this.ctrlKey&&5===this.keyCode||this.shiftKey&&4===this.keyCode||this.altKey&&6===this.keyCode||this.metaKey&&57===this.keyCode}},tq=class{constructor(e){if(0===e.length)throw function(e){return e?Error(`Illegal argument: ${e}`):Error("Illegal argument")}("chords");this.chords=e}getHashCode(){let e="";for(let i=0,r=this.chords.length;i<r;i++)0!==i&&(e+=";"),e+=this.chords[i].getHashCode();return e}equals(e){if(null===e||this.chords.length!==e.chords.length)return!1;for(let i=0;i<this.chords.length;i++)if(!this.chords[i].equals(e.chords[i]))return!1;return!0}},tX=tD?256:2048,tV=tD?2048:256,tG=class{constructor(e){this._standardKeyboardEventBrand=!0,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=function(e){if(e.charCode){let i=String.fromCharCode(e.charCode).toUpperCase();return tK.fromString(i)}let i=e.keyCode;if(3===i)return 7;if(tc)switch(i){case 59:return 85;case 60:if(tO)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(tD)return 57}else if(td&&(tD&&93===i||!tD&&92===i))return 57;return tz[i]||0}(e),this.code=e.code,this.ctrlKey=this.ctrlKey||5===this.keyCode,this.altKey=this.altKey||6===this.keyCode,this.shiftKey=this.shiftKey||4===this.keyCode,this.metaKey=this.metaKey||57===this.keyCode,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(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;5!==this.keyCode&&4!==this.keyCode&&6!==this.keyCode&&57!==this.keyCode&&(e=this.keyCode);let i=0;return this.ctrlKey&&(i|=tX),this.altKey&&(i|=512),this.shiftKey&&(i|=1024),this.metaKey&&(i|=tV),i|=e}_computeKeyCodeChord(){let e=0;return 5!==this.keyCode&&4!==this.keyCode&&6!==this.keyCode&&57!==this.keyCode&&(e=this.keyCode),new tY(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},tZ=new WeakMap,tJ=class{static getSameOriginWindowChain(e){let i=tZ.get(e);if(!i){i=[],tZ.set(e,i);let r=e,s;do(s=function(e){if(!e.parent||e.parent===e)return null;try{let i=e.location,r=e.parent.location;if("null"!==i.origin&&"null"!==r.origin&&i.origin!==r.origin)return null}catch{return null}return e.parent}(r))?i.push({window:new WeakRef(r),iframeElement:r.frameElement||null}):i.push({window:new WeakRef(r),iframeElement:null}),r=s;while(r)}return i.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,i){if(!i||e===i)return{top:0,left:0};let r=0,s=0;for(let n of this.getSameOriginWindowChain(e)){let e=n.window.deref();if(r+=e?.scrollY??0,s+=e?.scrollX??0,e===i||!n.iframeElement)break;let o=n.iframeElement.getBoundingClientRect();r+=o.top,s+=o.left}return{top:r,left:s}}},tQ=class{constructor(e,i){this.timestamp=Date.now(),this.browserEvent=i,this.leftButton=0===i.button,this.middleButton=1===i.button,this.rightButton=2===i.button,this.buttons=i.buttons,this.target=i.target,this.detail=i.detail||1,"dblclick"===i.type&&(this.detail=2),this.ctrlKey=i.ctrlKey,this.shiftKey=i.shiftKey,this.altKey=i.altKey,this.metaKey=i.metaKey,"number"==typeof i.pageX?(this.posx=i.pageX,this.posy=i.pageY):(this.posx=i.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=i.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let r=tJ.getPositionOfChildWindowRelativeToAncestorWindow(e,i.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},t0=class{constructor(e,i=0,r=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=r,this.deltaX=i;let s=!1;if(tu){let e=navigator.userAgent.match(/Chrome\/(\d+)/);s=(e?parseInt(e[1]):123)<=122}if(e){let i=e.view?.devicePixelRatio||1;"u">typeof e.wheelDeltaY?s?this.deltaY=e.wheelDeltaY/(120*i):this.deltaY=e.wheelDeltaY/120:"u">typeof e.VERTICAL_AXIS&&e.axis===e.VERTICAL_AXIS?this.deltaY=-e.detail/3:"wheel"===e.type&&(e.deltaMode===e.DOM_DELTA_LINE?tc&&!tD?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40),"u">typeof e.wheelDeltaX?tf&&tE?this.deltaX=-(e.wheelDeltaX/120):s?this.deltaX=e.wheelDeltaX/(120*i):this.deltaX=e.wheelDeltaX/120:"u">typeof e.HORIZONTAL_AXIS&&e.axis===e.HORIZONTAL_AXIS?this.deltaX=-e.detail/3:"wheel"===e.type&&(e.deltaMode===e.DOM_DELTA_LINE?tc&&!tD?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40),0===this.deltaY&&0===this.deltaX&&e.wheelDelta&&(s?this.deltaY=e.wheelDelta/(120*i):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},t1=Object.freeze(function(e,i){let r=setTimeout(e.bind(i),0);return{dispose(){clearTimeout(r)}}});(iq=tU||={}).isCancellationToken=function(e){return e===iq.None||e===iq.Cancelled||e instanceof t2||!!e&&"object"==typeof e&&"boolean"==typeof e.isCancellationRequested&&"function"==typeof e.onCancellationRequested},iq.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:e9.None}),iq.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:t1});var t2=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?t1:(this._emitter||(this._emitter=new to),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};Symbol("MicrotaskDelay");var t5=class{constructor(e,i){this._isDisposed=!1,this._token=-1,"function"==typeof e&&"number"==typeof i&&this.setIfNotSet(e,i)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){-1!==this._token&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,i){if(this._isDisposed)throw new eF("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},i)}setIfNotSet(e,i){if(this._isDisposed)throw new eF("Calling 'setIfNotSet' on a disposed TimeoutTimer");-1===this._token&&(this._token=setTimeout(()=>{this._token=-1,e()},i))}},t3=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,i,r=globalThis){if(this.isDisposed)throw new eF("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let s=r.setInterval(()=>{e()},i);this.disposable=eX(()=>{r.clearInterval(s),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(iX=iV||={}).settled=async function(e){let i,r=await Promise.all(e.map(e=>e.then(e=>e,e=>{i||(i=e)})));if("u">typeof i)throw i;return r},iX.withAsyncBody=function(e){return new Promise(async(i,r)=>{try{await e(i,r)}catch(e){r(e)}})};var t6=class e{static fromArray(i){return new e(e=>{e.emitMany(i)})}static fromPromise(i){return new e(async e=>{e.emitMany(await i)})}static fromPromises(i){return new e(async e=>{await Promise.all(i.map(async i=>e.emitOne(await i)))})}static merge(i){return new e(async e=>{await Promise.all(i.map(async i=>{for await(let r of i)e.emitOne(r)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new to,queueMicrotask(async()=>{let i={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(i)),this.resolve()}catch(e){this.reject(e)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{for(;;){if(2===this._state)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(1===this._state)return{done:!0,value:void 0};await e9.toPromise(this._onStateChanged.event)}},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(i,r){return new e(async e=>{for await(let s of i)e.emitOne(r(s))})}map(i){return e.map(this,i)}static filter(i,r){return new e(async e=>{for await(let s of i)r(s)&&e.emitOne(s)})}filter(i){return e.filter(this,i)}static coalesce(i){return e.filter(i,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let i=[];for await(let r of e)i.push(r);return i}toPromise(){return e.toPromise(this)}emitOne(e){0===this._state&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){0===this._state&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){0===this._state&&(this._state=1,this._onStateChanged.fire())}reject(e){0===this._state&&(this._state=2,this._error=e,this._onStateChanged.fire())}};t6.EMPTY=t6.fromArray([]);function t4(e,i){return(i<<5)-i+e|0}function t8(e,i){i=t4(149417,i);for(let r=0,s=e.length;r<s;r++)i=t4(e.charCodeAt(r),i);return i}new DataView(new ArrayBuffer(320));var{registerWindow:t7,getWindow:t9,getDocument:ie,getWindows:it,getWindowsCount:ii,getWindowId:ir,getWindowById:is,hasWindow:io,onDidRegisterWindow:ia,onWillUnregisterWindow:il,onDidUnregisterWindow:ih}=(i=new Map,r={window:eQ,disposables:new eG},i.set(eQ.vscodeWindowId,r),s=new to,n=new to,o=new to,{onDidRegisterWindow:s.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:n.event,registerWindow(e){if(i.has(e.vscodeWindowId))return eZ.None;let r=new eG,a={window:e,disposables:r.add(new eG)};return i.set(e.vscodeWindowId,a),r.add(eX(()=>{i.delete(e.vscodeWindowId),n.fire(e)})),r.add(id(e,iv.BEFORE_UNLOAD,()=>{o.fire(e)})),s.fire(a),r},getWindows:()=>i.values(),getWindowsCount:()=>i.size,getWindowId:e=>e.vscodeWindowId,hasWindow:e=>i.has(e),getWindowById:function(e,s){return("number"==typeof e?i.get(e):void 0)??(s?r:void 0)},getWindow:e=>e?.ownerDocument?.defaultView?e.ownerDocument.defaultView.window:e?.view?e.view.window:eQ,getDocument:e=>t9(e).document}),ic=class{constructor(e,i,r,s){this._node=e,this._type=i,this._handler=r,this._options=s||!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 id(e,i,r,s){return new ic(e,i,r,s)}var iu=function(e,i,r,s){var n;let o=r;return"click"===i||"mousedown"===i||"contextmenu"===i?(n=t9(e),o=function(e){return r(new tQ(n,e))}):("keydown"===i||"keypress"===i||"keyup"===i)&&(o=function(e){return r(new tG(e))}),id(e,i,o,s)},ip=class extends t3{constructor(e){super(),this.defaultTarget=e&&t9(e)}cancelAndSet(e,i,r){return super.cancelAndSet(e,i,r??this.defaultTarget)}},i_=class{constructor(e,i=0){this._runner=e,this.priority=i,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){ej(e)}}static sort(e,i){return i.priority-e.priority}};a=new Map,l=new Map,h=new Map,c=new Map,iG=(e,i,r=0)=>{let s=ir(e),n=new i_(i,r),o=a.get(s);return o||(o=[],a.set(s,o)),o.push(n),h.get(s)||(h.set(s,!0),e.requestAnimationFrame(()=>(e=>{h.set(e,!1);let i=a.get(e)??[];for(l.set(e,i),a.set(e,[]),c.set(e,!0);i.length>0;)i.sort(i_.sort),i.shift().execute();c.set(e,!1)})(s))),n};var ig=class e{constructor(e,i){this.width=e,this.height=i}with(i=this.width,r=this.height){return i!==this.width||r!==this.height?new e(i,r):this}static is(e){return"object"==typeof e&&"number"==typeof e.height&&"number"==typeof e.width}static lift(i){return i instanceof e?i:new e(i.width,i.height)}static equals(e,i){return e===i||!!e&&!!i&&e.width===i.width&&e.height===i.height}};ig.None=new ig(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,i,r){let s=this.mutationObservers.get(e);s||(s=new Map,this.mutationObservers.set(e,s));let n=function e(i,r){switch(typeof i){case"object":var s,n,o,a;return null===i?t4(349,r):Array.isArray(i)?(s=i,n=t4(104579,n=r),s.reduce((i,r)=>e(r,i),n)):(o=i,a=t4(181387,a=r),Object.keys(o).sort().reduce((i,r)=>(i=t8(r,i),e(o[r],i)),a));case"string":return t8(i,r);case"boolean":return t4(i?433:863,r);case"number":return t4(i,r);case"undefined":return t4(937,r);default:return t4(617,r)}}(r,0),o=s.get(n);if(o)o.users+=1;else{let a=new to,l=new MutationObserver(e=>a.fire(e));l.observe(e,r);let h=o={users:1,observer:l,onDidMutate:a.event};i.add(eX(()=>{h.users-=1,0===h.users&&(a.dispose(),l.disconnect(),s?.delete(n),s?.size===0&&this.mutationObservers.delete(e))})),s.set(n,o)}return o.onDidMutate}};var iv={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"},im=class{constructor(e){this.domNode=e,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(e){let i=iS(e);this._maxWidth!==i&&(this._maxWidth=i,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let i=iS(e);this._width!==i&&(this._width=i,this.domNode.style.width=this._width)}setHeight(e){let i=iS(e);this._height!==i&&(this._height=i,this.domNode.style.height=this._height)}setTop(e){let i=iS(e);this._top!==i&&(this._top=i,this.domNode.style.top=this._top)}setLeft(e){let i=iS(e);this._left!==i&&(this._left=i,this.domNode.style.left=this._left)}setBottom(e){let i=iS(e);this._bottom!==i&&(this._bottom=i,this.domNode.style.bottom=this._bottom)}setRight(e){let i=iS(e);this._right!==i&&(this._right=i,this.domNode.style.right=this._right)}setPaddingTop(e){let i=iS(e);this._paddingTop!==i&&(this._paddingTop=i,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let i=iS(e);this._paddingLeft!==i&&(this._paddingLeft=i,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let i=iS(e);this._paddingBottom!==i&&(this._paddingBottom=i,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let i=iS(e);this._paddingRight!==i&&(this._paddingRight=i,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let i=iS(e);this._fontSize!==i&&(this._fontSize=i,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let i=iS(e);this._lineHeight!==i&&(this._lineHeight=i,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let i=iS(e);this._letterSpacing!==i&&(this._letterSpacing=i,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,i){this.domNode.classList.toggle(e,i),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,i){this.domNode.setAttribute(e,i)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function iS(e){return"number"==typeof e?`${e}px`:e}function iy(e){return new im(e)}var ib=class{constructor(){this._hooks=new eG,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,i){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let r=this._onStopCallback;this._onStopCallback=null,e&&r&&r(i)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,i,r,s,n){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=s,this._onStopCallback=n;let o=e;try{e.setPointerCapture(i),this._hooks.add(eX(()=>{try{e.releasePointerCapture(i)}catch{}}))}catch{o=t9(e)}this._hooks.add(id(o,iv.POINTER_MOVE,e=>{e.buttons!==r?this.stopMonitoring(!0):(e.preventDefault(),this._pointerMoveCallback(e))})),this._hooks.add(id(o,iv.POINTER_UP,e=>this.stopMonitoring(!0)))}};(d=iZ||={}).Tap="-xterm-gesturetap",d.Change="-xterm-gesturechange",d.Start="-xterm-gesturestart",d.End="-xterm-gesturesend",d.Contextmenu="-xterm-gesturecontextmenu";var iw=class e extends eZ{constructor(){super(),this.dispatched=!1,this.targets=new e1,this.ignoreTargets=new e1,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(e9.runAndSubscribe(ia,({window:e,disposables:i})=>{i.add(id(e.document,"touchstart",e=>this.onTouchStart(e),{passive:!1})),i.add(id(e.document,"touchend",i=>this.onTouchEnd(e,i))),i.add(id(e.document,"touchmove",e=>this.onTouchMove(e),{passive:!1}))},{window:eQ,disposables:this._store}))}static addTarget(i){return e.isTouchDevice()?(e.INSTANCE||(e.INSTANCE=new e),eX(e.INSTANCE.targets.push(i))):eZ.None}static ignoreTarget(i){return e.isTouchDevice()?(e.INSTANCE||(e.INSTANCE=new e),eX(e.INSTANCE.ignoreTargets.push(i))):eZ.None}static isTouchDevice(){return"ontouchstart"in eQ||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,s=e.targetTouches.length;r<s;r++){let s=e.targetTouches.item(r);this.activeTouches[s.identifier]={id:s.identifier,initialTarget:s.target,initialTimeStamp:i,initialPageX:s.pageX,initialPageY:s.pageY,rollingTimestamps:[i],rollingPageX:[s.pageX],rollingPageY:[s.pageY]};let n=this.newGestureEvent(iZ.Start,s.target);n.pageX=s.pageX,n.pageY=s.pageY,this.dispatchEvent(n)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}onTouchEnd(i,r){let s=Date.now(),n=Object.keys(this.activeTouches).length;for(let o=0,a=r.changedTouches.length;o<a;o++){let a=r.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("move of an UNKNOWN touch",a);continue}let l=this.activeTouches[a.identifier],h=Date.now()-l.initialTimeStamp;if(h<e.HOLD_DELAY&&30>Math.abs(l.initialPageX-e$(l.rollingPageX))&&30>Math.abs(l.initialPageY-e$(l.rollingPageY))){let e=this.newGestureEvent(iZ.Tap,l.initialTarget);e.pageX=e$(l.rollingPageX),e.pageY=e$(l.rollingPageY),this.dispatchEvent(e)}else if(h>=e.HOLD_DELAY&&30>Math.abs(l.initialPageX-e$(l.rollingPageX))&&30>Math.abs(l.initialPageY-e$(l.rollingPageY))){let e=this.newGestureEvent(iZ.Contextmenu,l.initialTarget);e.pageX=e$(l.rollingPageX),e.pageY=e$(l.rollingPageY),this.dispatchEvent(e)}else if(1===n){let e=e$(l.rollingPageX),r=e$(l.rollingPageY),n=e$(l.rollingTimestamps)-l.rollingTimestamps[0],o=e-l.rollingPageX[0],a=r-l.rollingPageY[0],h=[...this.targets].filter(e=>l.initialTarget instanceof Node&&e.contains(l.initialTarget));this.inertia(i,h,s,Math.abs(o)/n,o>0?1:-1,e,Math.abs(a)/n,a>0?1:-1,r)}this.dispatchEvent(this.newGestureEvent(iZ.End,l.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(r.preventDefault(),r.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,i){let r=document.createEvent("CustomEvent");return r.initEvent(e,!1,!0),r.initialTarget=i,r.tapCount=0,r}dispatchEvent(i){if(i.type===iZ.Tap){let r=new Date().getTime(),s=0;s=r-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=r,i.tapCount=s}else(i.type===iZ.Change||i.type===iZ.Contextmenu)&&(this._lastSetTapCountTime=0);if(i.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(i.initialTarget))return;let e=[];for(let r of this.targets)if(r.contains(i.initialTarget)){let s=0,n=i.initialTarget;for(;n&&n!==r;)s++,n=n.parentElement;e.push([s,r])}for(let[r,s]of(e.sort((e,i)=>e[0]-i[0]),e))s.dispatchEvent(i),this.dispatched=!0}}inertia(i,r,s,n,o,a,l,h,c){this.handle=iG(i,()=>{let d=Date.now(),u=d-s,f=0,p=0,_=!0;n+=e.SCROLL_FRICTION*u,l+=e.SCROLL_FRICTION*u,n>0&&(_=!1,f=o*n*u),l>0&&(_=!1,p=h*l*u);let g=this.newGestureEvent(iZ.Change);g.translationX=f,g.translationY=p,r.forEach(e=>e.dispatchEvent(g)),_||this.inertia(i,r,d,n,o,a+f,l,h,c+p)})}onTouchMove(e){let i=Date.now();for(let r=0,s=e.changedTouches.length;r<s;r++){let s=e.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(s.identifier))){console.warn("end of an UNKNOWN touch",s);continue}let n=this.activeTouches[s.identifier],o=this.newGestureEvent(iZ.Change,n.initialTarget);o.translationX=s.pageX-e$(n.rollingPageX),o.translationY=s.pageY-e$(n.rollingPageY),o.pageX=s.pageX,o.pageY=s.pageY,this.dispatchEvent(o),n.rollingPageX.length>3&&(n.rollingPageX.shift(),n.rollingPageY.shift(),n.rollingTimestamps.shift()),n.rollingPageX.push(s.pageX),n.rollingPageY.push(s.pageY),n.rollingTimestamps.push(i)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};iw.SCROLL_FRICTION=-.005,iw.HOLD_DELAY=700,iw.CLEAR_TAP_COUNT_TIME=400,ee([function(e,i,r){let s=null,n=null;if("function"==typeof r.value?(s="value",0!==(n=r.value).length&&console.warn("Memoize should only be used in functions with zero parameters")):"function"==typeof r.get&&(s="get",n=r.get),!n)throw Error("not supported");let o=`$memoize$${i}`;r[s]=function(...e){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:n.apply(this,e)}),this[o]}}],iw,"isTouchDevice",1);var iC=class extends eZ{onclick(e,i){this._register(id(e,iv.CLICK,r=>i(new tQ(t9(e),r))))}onmousedown(e,i){this._register(id(e,iv.MOUSE_DOWN,r=>i(new tQ(t9(e),r))))}onmouseover(e,i){this._register(id(e,iv.MOUSE_OVER,r=>i(new tQ(t9(e),r))))}onmouseleave(e,i){this._register(id(e,iv.MOUSE_LEAVE,r=>i(new tQ(t9(e),r))))}onkeydown(e,i){this._register(id(e,iv.KEY_DOWN,e=>i(new tG(e))))}onkeyup(e,i){this._register(id(e,iv.KEY_UP,e=>i(new tG(e))))}oninput(e,i){this._register(id(e,iv.INPUT,i))}onblur(e,i){this._register(id(e,iv.BLUR,i))}onfocus(e,i){this._register(id(e,iv.FOCUS,i))}onchange(e,i){this._register(id(e,iv.CHANGE,i))}ignoreGesture(e){return iw.ignoreTarget(e)}},ix=class extends iC{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px","u">typeof e.top&&(this.bgDomNode.style.top="0px"),"u">typeof e.left&&(this.bgDomNode.style.left="0px"),"u">typeof e.bottom&&(this.bgDomNode.style.bottom="0px"),"u">typeof e.right&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width="11px",this.domNode.style.height="11px","u">typeof e.top&&(this.domNode.style.top=e.top+"px"),"u">typeof e.left&&(this.domNode.style.left=e.left+"px"),"u">typeof e.bottom&&(this.domNode.style.bottom=e.bottom+"px"),"u">typeof e.right&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new ib),this._register(iu(this.bgDomNode,iv.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(iu(this.domNode,iv.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new ip),this._pointerdownScheduleRepeatTimer=this._register(new t5)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let i=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,t9(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(i,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},ik=class e{constructor(e,i,r,s,n,o,a){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i|=0,r|=0,s|=0,n|=0,o|=0,a|=0),this.rawScrollLeft=s,this.rawScrollTop=a,i<0&&(i=0),s+i>r&&(s=r-i),s<0&&(s=0),n<0&&(n=0),a+n>o&&(a=o-n),a<0&&(a=0),this.width=i,this.scrollWidth=r,this.scrollLeft=s,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(i,r){return new e(this._forceIntegerValues,"u">typeof i.width?i.width:this.width,"u">typeof i.scrollWidth?i.scrollWidth:this.scrollWidth,r?this.rawScrollLeft:this.scrollLeft,"u">typeof i.height?i.height:this.height,"u">typeof i.scrollHeight?i.scrollHeight:this.scrollHeight,r?this.rawScrollTop:this.scrollTop)}withScrollPosition(i){return new e(this._forceIntegerValues,this.width,this.scrollWidth,"u">typeof i.scrollLeft?i.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,"u">typeof i.scrollTop?i.scrollTop:this.rawScrollTop)}createScrollEvent(e,i){let r=this.width!==e.width,s=this.scrollWidth!==e.scrollWidth,n=this.scrollLeft!==e.scrollLeft,o=this.height!==e.height,a=this.scrollHeight!==e.scrollHeight,l=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:i,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:r,scrollWidthChanged:s,scrollLeftChanged:n,heightChanged:o,scrollHeightChanged:a,scrollTopChanged:l}}},iE=class extends eZ{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new to),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new ik(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,i){let r=this._state.withScrollDimensions(e,i);this._setState(r,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let i=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(i,!1)}setScrollPositionSmooth(e,i){if(0===this._smoothScrollDuration)return this.setScrollPositionNow(e);if(this._smoothScrolling){let r;e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let s=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===s.scrollLeft&&this._smoothScrolling.to.scrollTop===s.scrollTop)return;r=i?new iT(this._smoothScrolling.from,s,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,s,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let i=this._state.withScrollPosition(e);this._smoothScrolling=iT.start(this._state,i,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 e=this._smoothScrolling.tick(),i=this._state.withScrollPosition(e);if(this._setState(i,!0),this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,i){let r=this._state;r.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(r,i)))}},iD=class{constructor(e,i,r){this.scrollLeft=e,this.scrollTop=i,this.isDone=r}};function iO(e,i){let r=i-e;return function(i){return e+r*(1-Math.pow(1-i,3))}}var iT=class e{constructor(e,i,r,s){this.from=e,this.to=i,this.duration=s,this.startTime=r,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,i,r){if(Math.abs(e-i)>2.5*r){var s,n;let o,a;return e<i?(o=e+.75*r,a=i-.75*r):(o=e-.75*r,a=i+.75*r),s=iO(e,o),n=iO(a,i),function(e){return e<.33?s(e/.33):n((e-.33)/(1-.33))}}return iO(e,i)}dispose(){null!==this.animationFrameDisposable&&(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 i=(e-this.startTime)/this.duration;return i<1?new iD(this.scrollLeft(i),this.scrollTop(i),!1):new iD(this.to.scrollLeft,this.to.scrollTop,!0)}combine(i,r,s){return e.start(i,r,s)}static start(i,r,s){return s+=10,new e(i,r,Date.now()-10,s)}},iP=class extends eZ{constructor(e,i,r){super(),this._visibility=e,this._visibleClassName=i,this._invisibleClassName=r,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new t5)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return 2!==this._visibility&&(3===this._visibility||this._rawShouldBeVisible)}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){this._isNeeded?this._shouldBeVisible?this._reveal():this._hide(!0):this._hide(!1)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},iI=class extends iC{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new iP(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new ib),this._shouldRender=!0,this.domNode=iy(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(id(this.domNode.domNode,iv.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let i=this._register(new ix(e));this.domNode.domNode.appendChild(i.bgDomNode),this.domNode.domNode.appendChild(i.domNode)}_createSlider(e,i,r,s){this.slider=iy(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(i),"number"==typeof r&&this.slider.setWidth(r),"number"==typeof s&&this.slider.setHeight(s),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(id(this.slider.domNode,iv.POINTER_DOWN,e=>{0===e.button&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(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(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let i=this.domNode.domNode.getClientRects()[0].top,r=i+this._scrollbarState.getSliderPosition(),s=i+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),n=this._sliderPointerPosition(e);r<=n&&n<=s?0===e.button&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let i,r;if(e.target===this.domNode.domNode&&"number"==typeof e.offsetX&&"number"==typeof e.offsetY)i=e.offsetX,r=e.offsetY;else{var s;let n,o,a=(n=(s=this.domNode.domNode).getBoundingClientRect(),o=t9(s),{left:n.left+o.scrollX,top:n.top+o.scrollY,width:n.width,height:n.height});i=e.pageX-a.left,r=e.pageY-a.top}let n=this._pointerDownRelativePosition(i,r);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(n):this._scrollbarState.getDesiredScrollPositionFromOffset(n)),0===e.button&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let i=this._sliderPointerPosition(e),r=this._sliderOrthogonalPointerPosition(e),s=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let n=Math.abs(this._sliderOrthogonalPointerPosition(e)-r);if(tE&&n>140)return void this._setDesiredScrollPositionNow(s.getScrollPosition());let o=this._sliderPointerPosition(e)-i;this._setDesiredScrollPositionNow(s.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let i={};this.writeScrollPosition(i,e),this._scrollable.setScrollPositionNow(i)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},iR=class e{constructor(e,i,r,s,n,o){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(e),this._visibleSize=s,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 e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let i=Math.round(e);return this._visibleSize!==i&&(this._visibleSize=i,this._refreshComputedValues(),!0)}setScrollSize(e){let i=Math.round(e);return this._scrollSize!==i&&(this._scrollSize=i,this._refreshComputedValues(),!0)}setScrollPosition(e){let i=Math.round(e);return this._scrollPosition!==i&&(this._scrollPosition=i,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,i,r,s,n){let o=Math.max(0,r-e),a=Math.max(0,o-2*i),l=s>0&&s>r;if(!l)return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};let h=Math.round(Math.max(20,Math.floor(r*a/s))),c=(a-h)/(s-r);return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(h),computedSliderRatio:c,computedSliderPosition:Math.round(n*c)}}_refreshComputedValues(){let i=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=i.computedAvailableSize,this._computedIsNeeded=i.computedIsNeeded,this._computedSliderSize=i.computedSliderSize,this._computedSliderRatio=i.computedSliderRatio,this._computedSliderPosition=i.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){return this._computedIsNeeded?Math.round((e-this._arrowSize-this._computedSliderSize/2)/this._computedSliderRatio):0}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let i=e-this._arrowSize,r=this._scrollPosition;return i<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(e){return this._computedIsNeeded?Math.round((this._computedSliderPosition+e)/this._computedSliderRatio):0}},iM=class extends iI{constructor(e,i,r){let s=e.getScrollDimensions(),n=e.getCurrentScrollPosition();if(super({lazyRender:i.lazyRender,host:r,scrollbarState:new iR(i.horizontalHasArrows?i.arrowSize:0,2===i.horizontal?0:i.horizontalScrollbarSize,2===i.vertical?0:i.verticalScrollbarSize,s.width,s.scrollWidth,n.scrollLeft),visibility:i.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:i.scrollByPage}),i.horizontalHasArrows)throw Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((i.horizontalScrollbarSize-i.horizontalSliderSize)/2),0,void 0,i.horizontalSliderSize)}_updateSlider(e,i){this.slider.setWidth(e),this.slider.setLeft(i)}_renderDomNode(e,i){this.domNode.setWidth(e),this.domNode.setHeight(i),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,i){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,i){e.scrollLeft=i}updateOptions(e){this.updateScrollbarSize(2===e.horizontal?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(2===e.vertical?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},iN=class extends iI{constructor(e,i,r){let s=e.getScrollDimensions(),n=e.getCurrentScrollPosition();if(super({lazyRender:i.lazyRender,host:r,scrollbarState:new iR(i.verticalHasArrows?i.arrowSize:0,2===i.vertical?0:i.verticalScrollbarSize,0,s.height,s.scrollHeight,n.scrollTop),visibility:i.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:i.scrollByPage}),i.verticalHasArrows)throw Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((i.verticalScrollbarSize-i.verticalSliderSize)/2),i.verticalSliderSize,void 0)}_updateSlider(e,i){this.slider.setHeight(e),this.slider.setTop(i)}_renderDomNode(e,i){this.domNode.setWidth(i),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,i){return i}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,i){e.scrollTop=i}updateOptions(e){this.updateScrollbarSize(2===e.vertical?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},iL=class{constructor(e,i,r){this.timestamp=e,this.deltaX=i,this.deltaY=r,this.score=0}},iB=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(-1===this._front&&-1===this._rear)return!1;let e=1,i=0,r=1,s=this._rear;for(;;){let n=s===this._front?e:Math.pow(2,-r);if(e-=n,i+=this._memory[s].score*n,s===this._front)break;s=(this._capacity+s-1)%this._capacity,r++}return i<=.5}acceptStandardWheelEvent(e){if(tu){var i;let r=(i=t9(e.browserEvent),tl.INSTANCE.getZoomFactor(i));this.accept(Date.now(),e.deltaX*r,e.deltaY*r)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,i,r){let s=null,n=new iL(e,i,r);-1===this._front&&-1===this._rear?(this._memory[0]=n,this._front=0,this._rear=0):(s=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,s)}_computeScore(e,i){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let r=.5;if(this._isAlmostInt(e.deltaX)&&this._isAlmostInt(e.deltaY)||(r+=.25),i){let s=Math.abs(e.deltaX),n=Math.abs(e.deltaY),o=Math.abs(i.deltaX),a=Math.abs(i.deltaY),l=Math.max(Math.min(s,o),1),h=Math.max(Math.min(n,a),1),c=Math.max(n,a);Math.max(s,o)%l==0&&c%h==0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(e){return .01>Math.abs(Math.round(e)-e)}};iB.INSTANCE=new iB;var iA=class extends iC{constructor(e,i,r){super(),this._onScroll=this._register(new to),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new to),this.onWillScroll=this._onWillScroll.event,this._options=function(e){let i={lazyRender:"u">typeof e.lazyRender&&e.lazyRender,className:"u">typeof e.className?e.className:"",useShadows:!("u">typeof e.useShadows)||e.useShadows,handleMouseWheel:!("u">typeof e.handleMouseWheel)||e.handleMouseWheel,flipAxes:"u">typeof e.flipAxes&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:"u">typeof e.consumeMouseWheelIfScrollbarIsNeeded&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:"u">typeof e.alwaysConsumeMouseWheel&&e.alwaysConsumeMouseWheel,scrollYToX:"u">typeof e.scrollYToX&&e.scrollYToX,mouseWheelScrollSensitivity:"u">typeof e.mouseWheelScrollSensitivity?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:"u">typeof e.fastScrollSensitivity?e.fastScrollSensitivity:5,scrollPredominantAxis:!("u">typeof e.scrollPredominantAxis)||e.scrollPredominantAxis,mouseWheelSmoothScroll:!("u">typeof e.mouseWheelSmoothScroll)||e.mouseWheelSmoothScroll,arrowSize:"u">typeof e.arrowSize?e.arrowSize:11,listenOnDomNode:"u">typeof e.listenOnDomNode?e.listenOnDomNode:null,horizontal:"u">typeof e.horizontal?e.horizontal:1,horizontalScrollbarSize:"u">typeof e.horizontalScrollbarSize?e.horizontalScrollbarSize:10,horizontalSliderSize:"u">typeof e.horizontalSliderSize?e.horizontalSliderSize:0,horizontalHasArrows:"u">typeof e.horizontalHasArrows&&e.horizontalHasArrows,vertical:"u">typeof e.vertical?e.vertical:1,verticalScrollbarSize:"u">typeof e.verticalScrollbarSize?e.verticalScrollbarSize:10,verticalHasArrows:"u">typeof e.verticalHasArrows&&e.verticalHasArrows,verticalSliderSize:"u">typeof e.verticalSliderSize?e.verticalSliderSize:0,scrollByPage:"u">typeof e.scrollByPage&&e.scrollByPage};return i.horizontalSliderSize="u">typeof e.horizontalSliderSize?e.horizontalSliderSize:i.horizontalScrollbarSize,i.verticalSliderSize="u">typeof e.verticalSliderSize?e.verticalSliderSize:i.verticalScrollbarSize,tD&&(i.className+=" mac"),i}(i),this._scrollable=r,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let s={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new iN(this._scrollable,this._options,s)),this._horizontalScrollbar=this._register(new iM(this._scrollable,this._options,s)),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(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=iy(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=iy(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=iy(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,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new t5),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=eq(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,tD&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){"u">typeof e.handleMouseWheel&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),"u">typeof e.mouseWheelScrollSensitivity&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),"u">typeof e.fastScrollSensitivity&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),"u">typeof e.scrollPredominantAxis&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),"u">typeof e.horizontal&&(this._options.horizontal=e.horizontal),"u">typeof e.vertical&&(this._options.vertical=e.vertical),"u">typeof e.horizontalScrollbarSize&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),"u">typeof e.verticalScrollbarSize&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),"u">typeof e.scrollByPage&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new t0(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=eq(this._mouseWheelToDispose),e)){let e=e=>{this._onMouseWheel(new t0(e))};this._mouseWheelToDispose.push(id(this._listenOnDomNode,iv.MOUSE_WHEEL,e,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let i=iB.INSTANCE;i.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let s=e.deltaY*this._options.mouseWheelScrollSensitivity,n=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&n+s===0?n=s=0:Math.abs(s)>=Math.abs(n)?n=0:s=0),this._options.flipAxes&&([s,n]=[n,s]);let o=!tD&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||o)&&!n&&(n=s,s=0),e.browserEvent&&e.browserEvent.altKey&&(n*=this._options.fastScrollSensitivity,s*=this._options.fastScrollSensitivity);let a=this._scrollable.getFutureScrollPosition(),l={};if(s){let e=50*s,i=a.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(l,i)}if(n){let e=50*n,i=a.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(l,i)}l=this._scrollable.validateScrollPosition(l),(a.scrollLeft!==l.scrollLeft||a.scrollTop!==l.scrollTop)&&(this._options.mouseWheelSmoothScroll&&i.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(l):this._scrollable.setScrollPositionNow(l),r=!0)}let s=r;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw 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 e=this._scrollable.getCurrentScrollPosition(),i=e.scrollTop>0,r=e.scrollLeft>0,s=r?" left":"",n=i?" top":"";this._leftShadowDomNode.setClassName(`shadow${s}`),this._topShadowDomNode.setClassName(`shadow${n}`),this._topLeftShadowDomNode.setClassName(`shadow${r||i?" top-left-corner":""}${n}${s}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){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(),500)}},ij=class extends iA{constructor(e,i,r){super(e,i,r)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}},iH=class extends eZ{constructor(e,i,r,s,n,o,a,l){super(),this._bufferService=r,this._optionsService=a,this._renderService=l,this._onRequestScrollLines=this._register(new to),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let h=this._register(new iE({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>iG(s.window,e)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{h.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new ij(i,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},h)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(n.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(16&e)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(e9.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(eX(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),i.appendChild(this._styleElement),this._register(eX(()=>this._styleElement.remove())),this._register(e9.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
12
- `)})),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(e=>this._handleScroll(e)))}scrollLines(e){let i=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:i.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,i){i&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!i,scrollTop:e*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(e){void 0!==e&&(this._latestYDisp=e),void 0===this._queuedAnimationFrame&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=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,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let i=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),r=i-this._bufferService.buffer.ydisp;0!==r&&(this._latestYDisp=i,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};iH=ee([et(2,em),et(3,eP),et(4,eS),et(5,eL),et(6,ex),et(7,eR)],iH);var iW=class extends eZ{constructor(e,i,r,s,n){super(),this._screenElement=e,this._bufferService=i,this._coreBrowserService=r,this._decorationService=s,this._renderService=n,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(e=>this._removeDecoration(e))),this._register(eX(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){void 0===this._animationFrame&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(e,i),i}_refreshStyle(e){let i=e.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${i*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,i=e.element){if(!i)return;let r=e.options.x??0;"right"===(e.options.anchor||"left")?i.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":i.style.left=r?`${r*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};iW=ee([et(1,em),et(2,eP),et(3,eD),et(4,eR)],iW);var iz=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(e){if(e.options.overviewRulerOptions){for(let i of this._zones)if(i.color===e.options.overviewRulerOptions.color&&i.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(i,e.marker.line))return;if(this._lineAdjacentToZone(i,e.marker.line,e.options.overviewRulerOptions.position))return void this._addLineToZone(i,e.marker.line)}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,i){return i>=e.startBufferLine&&i<=e.endBufferLine}_lineAdjacentToZone(e,i,r){return i>=e.startBufferLine-this._linePadding[r||"full"]&&i<=e.endBufferLine+this._linePadding[r||"full"]}_addLineToZone(e,i){e.startBufferLine=Math.min(e.startBufferLine,i),e.endBufferLine=Math.max(e.endBufferLine,i)}},iF={full:0,left:0,center:0,right:0},i$={full:0,left:0,center:0,right:0},iK={full:0,left:0,center:0,right:0},iU=class extends eZ{constructor(e,i,r,s,n,o,a,l){super(),this._viewportElement=e,this._screenElement=i,this._bufferService=r,this._decorationService=s,this._renderService=n,this._optionsService=o,this._themeService=a,this._coreBrowserService=l,this._colorZoneStore=new iz,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(eX(()=>this._canvas?.remove()));let h=this._canvas.getContext("2d");if(h)this._ctx=h;else throw 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 e=Math.floor((this._canvas.width-1)/3),i=Math.ceil((this._canvas.width-1)/3);i$.full=this._canvas.width,i$.left=e,i$.center=i,i$.right=e,this._refreshDrawHeightConstants(),iK.full=1,iK.left=1,iK.center=1+i$.left,iK.right=1+i$.left+i$.center}_refreshDrawHeightConstants(){iF.full=Math.round(2*this._coreBrowserService.dpr);let e=Math.round(Math.max(Math.min(this._canvas.height/this._bufferService.buffer.lines.length,12),6)*this._coreBrowserService.dpr);iF.left=e,iF.center=e,iF.right=e}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*iF.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*iF.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*iF.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*iF.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(){for(let e of(this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear(),this._decorationService.decorations))this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let i of e)"full"!==i.position&&this._renderColorZone(i);for(let i of e)"full"===i.position&&this._renderColorZone(i);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(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(iK[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-iF[e.position||"full"]/2),i$[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+iF[e.position||"full"]))}_queueRefresh(e,i){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=i||this._shouldUpdateAnchor,void 0===this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};iU=ee([et(2,em),et(3,eD),et(4,eR),et(5,ex),et(6,eL),et(7,eP)],iU),(u=iJ||={}).NUL="\0",u.SOH="\x01",u.STX="\x02",u.ETX="\x03",u.EOT="\x04",u.ENQ="\x05",u.ACK="\x06",u.BEL="\x07",u.BS="\b",u.HT=" ",u.LF=`
13
- `,u.VT="\v",u.FF="\f",u.CR="\r",u.SO="\x0e",u.SI="\x0f",u.DLE="\x10",u.DC1="\x11",u.DC2="\x12",u.DC3="\x13",u.DC4="\x14",u.NAK="\x15",u.SYN="\x16",u.ETB="\x17",u.CAN="\x18",u.EM="\x19",u.SUB="\x1a",u.ESC="\x1b",u.FS="\x1c",u.GS="\x1d",u.RS="\x1e",u.US="\x1f",u.SP=" ",u.DEL="",(f=iQ||={}).PAD="€",f.HOP="",f.BPH="‚",f.NBH="ƒ",f.IND="„",f.NEL="…",f.SSA="†",f.ESA="‡",f.HTS="ˆ",f.HTJ="‰",f.VTS="Š",f.PLD="‹",f.PLU="Œ",f.RI="",f.SS2="Ž",f.SS3="",f.DCS="",f.PU1="‘",f.PU2="’",f.STS="“",f.CCH="”",f.MW="•",f.SPA="–",f.EPA="—",f.SOS="˜",f.SGCI="™",f.SCI="š",f.CSI="›",f.ST="œ",f.OSC="",f.PM="ž",f.APC="Ÿ",(i0||={}).ST=`${iJ.ESC}\\`;var iY=class{constructor(e,i,r,s,n,o){this._textarea=e,this._compositionView=i,this._bufferService=r,this._optionsService=s,this._coreService=n,this._renderService=o,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(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(20===e.keyCode||229===e.keyCode||16===e.keyCode||17===e.keyCode||18===e.keyCode)return!1;this._finalizeComposition(!1)}return 229!==e.keyCode||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let i;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,(i=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start)).length>0&&this._coreService.triggerDataEvent(i,!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 e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let i=this._textarea.value,r=i.replace(e,"");this._dataAlreadySent=r,i.length>e.length?this._coreService.triggerDataEvent(r,!0):i.length<e.length?this._coreService.triggerDataEvent(`${iJ.DEL}`,!0):i.length===e.length&&i!==e&&this._coreService.triggerDataEvent(i,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),i=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"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=s+"px",this._textarea.style.top=r+"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"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};iY=ee([et(2,em),et(3,ex),et(4,ey),et(5,eR)],iY);var iq,iX,iV,iG,iZ,iJ,iQ,i0,i1,i2=0,i5=0,i3=0,i6=0,i4={css:"#00000000",rgba:0};(sL=i1||={}).toCss=function(e,i,r,s){return void 0!==s?`#${rs(e)}${rs(i)}${rs(r)}${rs(s)}`:`#${rs(e)}${rs(i)}${rs(r)}`},sL.toRgba=function(e,i,r,s=255){return(e<<24|i<<16|r<<8|s)>>>0},sL.toColor=function(e,i,r,s){return{css:sL.toCss(e,i,r,s),rgba:sL.toRgba(e,i,r,s)}};var i8=sB||={};function i7(e,i){return i6=Math.round(255*i),[i2,i5,i3]=sH.toChannels(e.rgba),{css:i1.toCss(i2,i5,i3,i6),rgba:i1.toRgba(i2,i5,i3,i6)}}i8.blend=function(e,i){if(1==(i6=(255&i.rgba)/255))return{css:i.css,rgba:i.rgba};let r=i.rgba>>24&255,s=i.rgba>>16&255,n=i.rgba>>8&255,o=e.rgba>>24&255,a=e.rgba>>16&255,l=e.rgba>>8&255;return i2=o+Math.round((r-o)*i6),i5=a+Math.round((s-a)*i6),i3=l+Math.round((n-l)*i6),{css:i1.toCss(i2,i5,i3),rgba:i1.toRgba(i2,i5,i3)}},i8.isOpaque=function(e){return(255&e.rgba)==255},i8.ensureContrastRatio=function(e,i,r){let s=sH.ensureContrastRatio(e.rgba,i.rgba,r);if(s)return i1.toColor(s>>24&255,s>>16&255,s>>8&255)},i8.opaque=function(e){let i=(255|e.rgba)>>>0;return[i2,i5,i3]=sH.toChannels(i),{css:i1.toCss(i2,i5,i3),rgba:i}},i8.opacity=i7,i8.multiplyOpacity=function(e,i){return i6=255&e.rgba,i7(e,i6*i/255)},i8.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]},(e=>{let i,r;try{let e=document.createElement("canvas");e.width=1,e.height=1;let s=e.getContext("2d",{willReadFrequently:!0});s&&((i=s).globalCompositeOperation="copy",r=i.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return i2=parseInt(e.slice(1,2).repeat(2),16),i5=parseInt(e.slice(2,3).repeat(2),16),i3=parseInt(e.slice(3,4).repeat(2),16),i1.toColor(i2,i5,i3);case 5:return i2=parseInt(e.slice(1,2).repeat(2),16),i5=parseInt(e.slice(2,3).repeat(2),16),i3=parseInt(e.slice(3,4).repeat(2),16),i6=parseInt(e.slice(4,5).repeat(2),16),i1.toColor(i2,i5,i3,i6);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let s=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(s)return i2=parseInt(s[1]),i5=parseInt(s[2]),i3=parseInt(s[3]),i6=Math.round((void 0===s[5]?1:parseFloat(s[5]))*255),i1.toColor(i2,i5,i3,i6);if(!i||!r||(i.fillStyle=r,i.fillStyle=e,"string"!=typeof i.fillStyle)||(i.fillRect(0,0,1,1),[i2,i5,i3,i6]=i.getImageData(0,0,1,1).data,255!==i6))throw Error("css.toColor: Unsupported css format");return{rgba:i1.toRgba(i2,i5,i3,i6),css:e}}})(sA||={});var i9=sj||={};function re(e,i,r){let s=e/255,n=i/255,o=r/255;return .2126*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))+.7152*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))+.0722*(o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4))}i9.relativeLuminance=function(e){return re(e>>16&255,e>>8&255,255&e)},i9.relativeLuminance2=re;var rt=sH||={};function ri(e,i,r){let s=e>>24&255,n=e>>16&255,o=e>>8&255,a=i>>24&255,l=i>>16&255,h=i>>8&255,c=rn(sj.relativeLuminance2(a,l,h),sj.relativeLuminance2(s,n,o));for(;c<r&&(a>0||l>0||h>0);)a-=Math.max(0,Math.ceil(.1*a)),l-=Math.max(0,Math.ceil(.1*l)),h-=Math.max(0,Math.ceil(.1*h)),c=rn(sj.relativeLuminance2(a,l,h),sj.relativeLuminance2(s,n,o));return(a<<24|l<<16|h<<8|255)>>>0}function rr(e,i,r){let s=e>>24&255,n=e>>16&255,o=e>>8&255,a=i>>24&255,l=i>>16&255,h=i>>8&255,c=rn(sj.relativeLuminance2(a,l,h),sj.relativeLuminance2(s,n,o));for(;c<r&&(a<255||l<255||h<255);)a=Math.min(255,a+Math.ceil((255-a)*.1)),l=Math.min(255,l+Math.ceil((255-l)*.1)),h=Math.min(255,h+Math.ceil((255-h)*.1)),c=rn(sj.relativeLuminance2(a,l,h),sj.relativeLuminance2(s,n,o));return(a<<24|l<<16|h<<8|255)>>>0}function rs(e){let i=e.toString(16);return i.length<2?"0"+i:i}function rn(e,i){return e<i?(i+.05)/(e+.05):(e+.05)/(i+.05)}rt.blend=function(e,i){if(1==(i6=(255&i)/255))return i;let r=e>>24&255,s=e>>16&255,n=e>>8&255;return i2=r+Math.round(((i>>24&255)-r)*i6),i5=s+Math.round(((i>>16&255)-s)*i6),i3=n+Math.round(((i>>8&255)-n)*i6),i1.toRgba(i2,i5,i3)},rt.ensureContrastRatio=function(e,i,r){let s=sj.relativeLuminance(e>>8),n=sj.relativeLuminance(i>>8);if(rn(s,n)<r){if(n<s){let n=ri(e,i,r),o=rn(s,sj.relativeLuminance(n>>8));if(o<r){let a=rr(e,i,r);return o>rn(s,sj.relativeLuminance(a>>8))?n:a}return n}let o=rr(e,i,r),a=rn(s,sj.relativeLuminance(o>>8));if(a<r){let n=ri(e,i,r);return a>rn(s,sj.relativeLuminance(n>>8))?o:n}return o}},rt.reduceLuminance=ri,rt.increaseLuminance=rr,rt.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]};var ro=class extends ed{constructor(e,i,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=i,this._width=r}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ra=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new ef}register(e){let i={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(i),i.id}deregister(e){for(let i=0;i<this._characterJoiners.length;i++)if(this._characterJoiners[i].id===e)return this._characterJoiners.splice(i,1),!0;return!1}getJoinedCharacters(e){if(0===this._characterJoiners.length)return[];let i=this._bufferService.buffer.lines.get(e);if(!i||0===i.length)return[];let r=[],s=i.translateToString(!0),n=0,o=0,a=0,l=i.getFg(0),h=i.getBg(0);for(let e=0;e<i.getTrimmedLength();e++)if(i.loadCell(e,this._workCell),0!==this._workCell.getWidth()){if(this._workCell.fg!==l||this._workCell.bg!==h){if(e-n>1){let e=this._getJoinedRanges(s,a,o,i,n);for(let i=0;i<e.length;i++)r.push(e[i])}n=e,a=o,l=this._workCell.fg,h=this._workCell.bg}o+=this._workCell.getChars().length||1}if(this._bufferService.cols-n>1){let e=this._getJoinedRanges(s,a,o,i,n);for(let i=0;i<e.length;i++)r.push(e[i])}return r}_getJoinedRanges(e,i,r,s,n){let o=e.substring(i,r),a=[];try{a=this._characterJoiners[0].handler(o)}catch(e){console.error(e)}for(let e=1;e<this._characterJoiners.length;e++)try{let i=this._characterJoiners[e].handler(o);for(let e=0;e<i.length;e++)ra._mergeRanges(a,i[e])}catch(e){console.error(e)}return this._stringRangesToCellRanges(a,s,n),a}_stringRangesToCellRanges(e,i,r){let s=0,n=!1,o=0,a=e[0];if(a){for(let l=r;l<this._bufferService.cols;l++){let r=i.getWidth(l),h=i.getString(l).length||1;if(0!==r){if(!n&&a[0]<=o&&(a[0]=l,n=!0),a[1]<=o){if(a[1]=l,!(a=e[++s]))break;a[0]<=o?(a[0]=l,n=!0):n=!1}o+=h}}a&&(a[1]=this._bufferService.cols)}}static _mergeRanges(e,i){let r=!1;for(let s=0;s<e.length;s++){let n=e[s];if(r){if(i[1]<=n[0])return e[s-1][1]=i[1],e;if(i[1]<=n[1])return e[s-1][1]=Math.max(i[1],n[1]),e.splice(s,1),e;e.splice(s,1),s--}else{if(i[1]<=n[0])return e.splice(s,0,i),e;if(i[1]<=n[1])return n[0]=Math.min(i[0],n[0]),e;i[0]<n[1]&&(n[0]=Math.min(i[0],n[0]),r=!0);continue}}return r?e[e.length-1][1]=i[1]:e.push(i),e}};function rl(){return{width:0,height:0}}ra=ee([et(0,em)],ra);var rh=class{constructor(e,i,r,s,n,o,a){this._document=e,this._characterJoinerService=i,this._optionsService=r,this._coreBrowserService=s,this._coreService=n,this._decorationService=o,this._themeService=a,this._workCell=new ef,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,i,r){this._selectionStart=e,this._selectionEnd=i,this._columnSelectMode=r}createRow(e,i,r,s,n,o,a,l,h,c,d){let u=[],f=this._characterJoinerService.getJoinedCharacters(i),p=this._themeService.colors,_=e.getNoBgTrimmedLength();r&&_<o+1&&(_=o+1);let g,v=0,m="",S=0,y=0,b=0,w=0,C=!1,x=0,k=!1,E=0,D=0,O=[],T=-1!==c&&-1!==d;for(let P=0;P<_;P++){let _;e.loadCell(P,this._workCell);let I=this._workCell.getWidth();if(0===I)continue;let R=!1,M=P>=D,N=P,L=this._workCell;if(f.length>0&&P===f[0][0]&&M){let s=f.shift(),n=this._isCellInSelection(s[0],i);for(S=s[0]+1;S<s[1];S++)M&&=n===this._isCellInSelection(S,i);(M&&=!r||o<s[0]||o>=s[1])?(R=!0,L=new ro(this._workCell,e.translateToString(!0,s[0],s[1]),s[1]-s[0]),N=s[1]-1,I=L.getWidth()):D=s[1]}let B=this._isCellInSelection(P,i),A=r&&P===o,j=T&&P>=c&&P<=d,H=!1;this._decorationService.forEachDecorationAtCell(P,i,void 0,e=>{H=!0});let W=L.getChars()||" ";if(" "===W&&(L.isUnderline()||L.isOverline())&&(W=" "),E=I*l-h.get(W,L.isBold(),L.isItalic()),g)if(v&&(B&&k||!B&&!k&&L.bg===y)&&(B&&k&&p.selectionForeground||L.fg===b)&&L.extended.ext===w&&j===C&&E===x&&!A&&!R&&!H&&M){L.isInvisible()?m+=" ":m+=W,v++;continue}else v&&(g.textContent=m),g=this._document.createElement("span"),v=0,m="";else g=this._document.createElement("span");if(y=L.bg,b=L.fg,w=L.extended.ext,C=j,x=E,k=B,R&&o>=P&&o<=N&&(o=P),!this._coreService.isCursorHidden&&A&&this._coreService.isCursorInitialized){if(O.push("xterm-cursor"),this._coreBrowserService.isFocused)a&&O.push("xterm-cursor-blink"),O.push("bar"===s?"xterm-cursor-bar":"underline"===s?"xterm-cursor-underline":"xterm-cursor-block");else if(n)switch(n){case"outline":O.push("xterm-cursor-outline");break;case"block":O.push("xterm-cursor-block");break;case"bar":O.push("xterm-cursor-bar");break;case"underline":O.push("xterm-cursor-underline")}}if(L.isBold()&&O.push("xterm-bold"),L.isItalic()&&O.push("xterm-italic"),L.isDim()&&O.push("xterm-dim"),m=L.isInvisible()?" ":L.getChars()||" ",L.isUnderline()&&(O.push(`xterm-underline-${L.extended.underlineStyle}`)," "===m&&(m=" "),!L.isUnderlineColorDefault()))if(L.isUnderlineColorRGB())g.style.textDecorationColor=`rgb(${ed.toColorRGB(L.getUnderlineColor()).join(",")})`;else{let e=L.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&L.isBold()&&e<8&&(e+=8),g.style.textDecorationColor=p.ansi[e].css}L.isOverline()&&(O.push("xterm-overline")," "===m&&(m=" ")),L.isStrikethrough()&&O.push("xterm-strikethrough"),j&&(g.style.textDecoration="underline");let z=L.getFgColor(),F=L.getFgColorMode(),$=L.getBgColor(),K=L.getBgColorMode(),U=!!L.isInverse();if(U){let e=z;z=$,$=e;let i=F;F=K,K=i}let Y,q,X=!1;switch(this._decorationService.forEachDecorationAtCell(P,i,void 0,e=>{"top"!==e.options.layer&&X||(e.backgroundColorRGB&&(K=0x3000000,$=e.backgroundColorRGB.rgba>>8&0xffffff,Y=e.backgroundColorRGB),e.foregroundColorRGB&&(F=0x3000000,z=e.foregroundColorRGB.rgba>>8&0xffffff,q=e.foregroundColorRGB),X="top"===e.options.layer)}),!X&&B&&($=(Y=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque).rgba>>8&0xffffff,K=0x3000000,X=!0,p.selectionForeground&&(F=0x3000000,z=p.selectionForeground.rgba>>8&0xffffff,q=p.selectionForeground)),X&&O.push("xterm-decoration-top"),K){case 0x1000000:case 0x2000000:_=p.ansi[$],O.push(`xterm-bg-${$}`);break;case 0x3000000:_=i1.toColor($>>16,$>>8&255,255&$),this._addStyle(g,`background-color:#${rc(($>>>0).toString(16),"0",6)}`);break;default:U?(_=p.foreground,O.push("xterm-bg-257")):_=p.background}switch(Y||L.isDim()&&(Y=sB.multiplyOpacity(_,.5)),F){case 0x1000000:case 0x2000000:L.isBold()&&z<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(z+=8),this._applyMinimumContrast(g,_,p.ansi[z],L,Y,void 0)||O.push(`xterm-fg-${z}`);break;case 0x3000000:let V=i1.toColor(z>>16&255,z>>8&255,255&z);this._applyMinimumContrast(g,_,V,L,Y,q)||this._addStyle(g,`color:#${rc(z.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(g,_,p.foreground,L,Y,q)||U&&O.push("xterm-fg-257")}O.length&&(g.className=O.join(" "),O.length=0),A||R||H||!M?g.textContent=m:v++,E!==this.defaultSpacing&&(g.style.letterSpacing=`${E}px`),u.push(g),P=N}return g&&v&&(g.textContent=m),u}_applyMinimumContrast(e,i,r,s,n,o){var a,l,h;if(1===this._optionsService.rawOptions.minimumContrastRatio||57508<=(l=a=s.getCode())&&l<=57558||9472<=(h=a)&&h<=9631)return!1;let c=this._getContrastCache(s),d;if(n||o||(d=c.getColor(i.rgba,r.rgba)),void 0===d){let e=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);d=sB.ensureContrastRatio(n||i,o||r,e),c.setColor((n||i).rgba,(o||r).rgba,d??null)}return!!d&&(this._addStyle(e,`color:${d.css}`),!0)}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,i){e.setAttribute("style",`${e.getAttribute("style")||""}${i};`)}_isCellInSelection(e,i){let r=this._selectionStart,s=this._selectionEnd;return!!r&&!!s&&(this._columnSelectMode?r[0]<=s[0]?e>=r[0]&&i>=r[1]&&e<s[0]&&i<=s[1]:e<r[0]&&i>=r[1]&&e>=s[0]&&i<=s[1]:i>r[1]&&i<s[1]||r[1]===s[1]&&i===r[1]&&e>=r[0]&&e<s[0]||r[1]<s[1]&&i===s[1]&&e<s[0]||r[1]<s[1]&&i===r[1]&&e>=r[0])}};function rc(e,i,r){for(;e.length<r;)e=i+e;return e}rh=ee([et(1,eN),et(2,ex),et(3,eP),et(4,ey),et(5,eD),et(6,eL)],rh);var rd=class{constructor(e,i){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.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 r=e.createElement("span");r.classList.add("xterm-char-measure-element");let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[r,s,n,o],this._container.appendChild(r),this._container.appendChild(s),this._container.appendChild(n),this._container.appendChild(o),i.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(e,i,r,s){e===this._font&&i===this._fontSize&&r===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=i,this._weight=r,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${r}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${r}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(e,i,r){let s=0;if(!i&&!r&&1===e.length&&(s=e.charCodeAt(0))<256){if(-9999!==this._flat[s])return this._flat[s];let i=this._measure(e,0);return i>0&&(this._flat[s]=i),i}let n=e;i&&(n+="B"),r&&(n+="I");let o=this._holey.get(n);if(void 0===o){let s=0;i&&(s|=1),r&&(s|=2),(o=this._measure(e,s))>0&&this._holey.set(n,o)}return o}_measure(e,i){let r=this._measureElements[i];return r.textContent=e.repeat(32),r.offsetWidth/32}},ru=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(e,i,r,s=!1){if(this.selectionStart=i,this.selectionEnd=r,!i||!r||i[0]===r[0]&&i[1]===r[1])return void this.clear();let n=e.buffers.active.ydisp,o=i[1]-n,a=r[1]-n,l=Math.max(o,0),h=Math.min(a,e.rows-1);l>=e.rows||h<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=o,this.viewportEndRow=a,this.viewportCappedStartRow=l,this.viewportCappedEndRow=h,this.startCol=i[0],this.endCol=r[0])}isCellSelected(e,i,r){return!!this.hasSelection&&(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?i>=this.startCol&&r>=this.viewportCappedStartRow&&i<this.endCol&&r<=this.viewportCappedEndRow:i<this.startCol&&r>=this.viewportCappedStartRow&&i>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&i>=this.startCol&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&i>=this.startCol)}},rf="xterm-dom-renderer-owner-",rp="xterm-rows",r_="xterm-fg-",rg="xterm-bg-",rv="xterm-focus",rm="xterm-selection",rS=1,ry=class extends eZ{constructor(e,i,r,s,n,o,a,l,h,c,d,u,f,p){super(),this._terminal=e,this._document=i,this._element=r,this._screenElement=s,this._viewportElement=n,this._helperContainer=o,this._linkifier2=a,this._charSizeService=h,this._optionsService=c,this._bufferService=d,this._coreService=u,this._coreBrowserService=f,this._themeService=p,this._terminalClass=rS++,this._rowElements=[],this._selectionRenderModel=new ru,this.onRequestRedraw=this._register(new to).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(rp),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(rm),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions={css:{canvas:rl(),cell:rl()},device:{canvas:rl(),cell:rl(),char:{width:0,height:0,left:0,top:0}}},this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=l.createInstance(rh,document),this._element.classList.add(rf+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register(eX(()=>{this._element.classList.remove(rf+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new rd(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 e=this._coreBrowserService.dpr;for(let i of(this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),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/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),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,this._rowElements))i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let i=`${this._terminalSelector} .${rp} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=i,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(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let i=`${this._terminalSelector} .${rp} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;i+=`${this._terminalSelector} .${rp} .xterm-dim { color: ${sB.multiplyOpacity(e.foreground,.5).css};}${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 r=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,n=`blink_block_${this._terminalClass}`;for(let[o,a]of(i+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}@keyframes ${s} { 50% { box-shadow: none; }}@keyframes ${n} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}${this._terminalSelector} .${rp}.${rv} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${rp}.${rv} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${rp}.${rv} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${rp} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${rp} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${rp} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${rp} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${rp} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}${this._terminalSelector} .${rm} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${rm} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${rm} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`,e.ansi.entries()))i+=`${this._terminalSelector} .${r_}${o} { color: ${a.css}; }${this._terminalSelector} .${r_}${o}.xterm-dim { color: ${sB.multiplyOpacity(a,.5).css}; }${this._terminalSelector} .${rg}${o} { background-color: ${a.css}; }`;i+=`${this._terminalSelector} .${r_}257 { color: ${sB.opaque(e.background).css}; }${this._terminalSelector} .${r_}257.xterm-dim { color: ${sB.multiplyOpacity(sB.opaque(e.background),.5).css}; }${this._terminalSelector} .${rg}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=i}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,i){for(let e=this._rowElements.length;e<=i;e++){let e=this._document.createElement("div");this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,i){this._refreshRowElements(e,i),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(rv),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(rv),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,i,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,i,r),this.renderRows(0,this._bufferService.rows-1),!e||!i||(this._selectionRenderModel.update(this._terminal,e,i,r),!this._selectionRenderModel.hasSelection))return;let s=this._selectionRenderModel.viewportStartRow,n=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,a=this._selectionRenderModel.viewportCappedEndRow,l=this._document.createDocumentFragment();if(r){let r=e[0]>i[0];l.appendChild(this._createSelectionElement(o,r?i[0]:e[0],r?e[0]:i[0],a-o+1))}else{let r=s===o?e[0]:0,h=o===n?i[0]:this._bufferService.cols;if(l.appendChild(this._createSelectionElement(o,r,h)),l.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,a-o-1)),o!==a){let e=n===a?i[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(a,0,e))}}this._selectionContainer.appendChild(l)}_createSelectionElement(e,i,r,s=1){let n=this._document.createElement("div"),o=i*this.dimensions.css.cell.width,a=this.dimensions.css.cell.width*(r-i);return o+a>this.dimensions.css.canvas.width&&(a=this.dimensions.css.canvas.width-o),n.style.height=`${s*this.dimensions.css.cell.height}px`,n.style.top=`${e*this.dimensions.css.cell.height}px`,n.style.left=`${o}px`,n.style.width=`${a}px`,n}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 e of this._rowElements)e.replaceChildren()}renderRows(e,i){let r=this._bufferService.buffer,s=r.ybase+r.y,n=Math.min(r.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,a=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,l=this._optionsService.rawOptions.cursorInactiveStyle;for(let h=e;h<=i;h++){let e=h+r.ydisp,i=this._rowElements[h],c=r.lines.get(e);if(!i||!c)break;i.replaceChildren(...this._rowFactory.createRow(c,e,e===s,a,l,n,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${rf}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,i,r,s,n,o){r<0&&(e=0),s<0&&(i=0);let a=this._bufferService.rows-1;r=Math.max(Math.min(r,a),0),s=Math.max(Math.min(s,a),0),n=Math.min(n,this._bufferService.cols);let l=this._bufferService.buffer,h=l.ybase+l.y,c=Math.min(l.x,n-1),d=this._optionsService.rawOptions.cursorBlink,u=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let a=r;a<=s;++a){let p=a+l.ydisp,_=this._rowElements[a],g=l.lines.get(p);if(!_||!g)break;_.replaceChildren(...this._rowFactory.createRow(g,p,p===h,u,f,c,d,this.dimensions.css.cell.width,this._widthCache,o?a===r?e:0:-1,o?(a===s?i:n)-1:-1))}}};ry=ee([et(7,ew),et(8,eT),et(9,ex),et(10,em),et(11,ey),et(12,eP),et(13,eL)],ry);var rb=class extends eZ{constructor(e,i,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new to),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new rx(this._optionsService))}catch{this._measureStrategy=this._register(new rC(e,i,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};rb=ee([et(2,ex)],rb);var rw=class extends eZ{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,i){void 0!==e&&e>0&&void 0!==i&&i>0&&(this._result.width=e,this._result.height=i)}},rC=class extends rw{constructor(e,i,r){super(),this._document=e,this._parentElement=i,this._optionsService=r,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}},rx=class extends rw{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let i=this._ctx.measureText("W");if(!("width"in i&&"fontBoundingBoxAscent"in i&&"fontBoundingBoxDescent"in i))throw Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},rk=class extends eZ{constructor(e,i,r){super(),this._textarea=e,this._window=i,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new rE(this._window)),this._onDprChange=this._register(new to),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new to),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(e9.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(id(this._textarea,"focus",()=>this._isFocused=!0)),this._register(id(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return void 0===this._cachedIsFocused&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},rE=class extends eZ{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new eJ),this._onDprChange=this._register(new to),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(eX(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=id(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)}},rD=class extends eZ{constructor(){super(),this.linkProviders=[],this._register(eX(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let i=this.linkProviders.indexOf(e);-1!==i&&this.linkProviders.splice(i,1)}}}};function rO(e,i,r){let s=r.getBoundingClientRect(),n=e.getComputedStyle(r),o=parseInt(n.getPropertyValue("padding-left")),a=parseInt(n.getPropertyValue("padding-top"));return[i.clientX-s.left-o,i.clientY-s.top-a]}var rT=class{constructor(e,i){this._renderService=e,this._charSizeService=i}getCoords(e,i,r,s,n){return function(e,i,r,s,n,o,a,l,h){if(!o)return;let c=rO(e,i,r);return c[0]=Math.ceil((c[0]+(h?a/2:0))/a),c[1]=Math.ceil(c[1]/l),c[0]=Math.min(Math.max(c[0],1),s+ +!!h),c[1]=Math.min(Math.max(c[1],1),n),c}(window,e,i,r,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,n)}getMouseReportCoords(e,i){let r=rO(window,e,i);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};rT=ee([et(0,eR),et(1,eT)],rT);var rP=class{constructor(e,i){this._renderCallback=e,this._coreBrowserService=i,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,i,r){this._rowCount=r,e=void 0!==e?e:0,i=void 0!==i?i:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,i):i,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return void this._runRefreshCallbacks();let e=Math.max(this._rowStart,0),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},rI={},rR={getSafariVersion:()=>rW,isChromeOS:()=>rY,isFirefox:()=>rA,isIpad:()=>rF,isIphone:()=>r$,isLegacyEdge:()=>rj,isLinux:()=>rU,isMac:()=>rz,isNode:()=>rN,isSafari:()=>rH,isWindows:()=>rK};for(var rM in rR)J(rI,rM,{get:rR[rM],enumerable:!0});var rN="u">typeof Z.default&&"title"in Z.default,rL=rN?"node":navigator.userAgent,rB=rN?"node":navigator.platform,rA=rL.includes("Firefox"),rj=rL.includes("Edge"),rH=/^((?!chrome|android).)*safari/i.test(rL);function rW(){if(!rH)return 0;let e=rL.match(/Version\/(\d+)/);return null===e||e.length<2?0:parseInt(e[1])}var rz=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(rB),rF="iPad"===rB,r$="iPhone"===rB,rK=["Windows","Win16","Win32","WinCE"].includes(rB),rU=rB.indexOf("Linux")>=0,rY=/\bCrOS\b/.test(rL),rq=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),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(e){this._idleCallback=void 0;let i=0,r=0,s=e.timeRemaining(),n=0;for(;this._i<this._tasks.length;){if(i=performance.now(),this._tasks[this._i]()||this._i++,1.5*(r=Math.max(i=Math.max(1,performance.now()-i),r))>(n=e.timeRemaining())){s-i<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-i))}ms`),this._start();return}s=n}this.clear()}},rX=class extends rq{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let i=performance.now()+e;return{timeRemaining:()=>Math.max(0,i-performance.now())}}},rV=class extends rq{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},rG=!rN&&"requestIdleCallback"in window?rV:rX,rZ=class{constructor(){this._queue=new rG}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},rJ=class extends eZ{constructor(e,i,r,s,n,o,a,l,h){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=s,this._coreService=n,this._coreBrowserService=l,this._renderer=this._register(new eJ),this._pausedResizeTask=new rZ,this._observerDisposable=this._register(new eJ),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 to),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new to),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new to),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new to),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new rP((e,i)=>this._renderRows(e,i),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new rQ(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(eX(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(a.onResize(()=>this._fullRefresh())),this._register(a.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(a.cols,a.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(a.buffer.y,a.buffer.y,!0))),this._register(h.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,i),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,i)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,i){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});r.observe(i),this._observerDisposable.value=eX(()=>r.disconnect())}}_handleIntersectionChange(e){this._isPaused=void 0===e.isIntersecting?0===e.intersectionRatio:!e.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(e,i,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput)return void this._syncOutputHandler.bufferRows(e,i);let s=this._syncOutputHandler.flush();s&&(e=Math.min(e,s.start),i=Math.max(i,s.end)),r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,i,this._rowCount)}_renderRows(e,i){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput)return void this._syncOutputHandler.bufferRows(e,i);e=Math.min(e,this._rowCount-1),i=Math.min(i,this._rowCount-1),this._renderer.value.renderRows(e,i),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:i}),this._onRender.fire({start:e,end:i}),this._isNextRenderRedrawOnly=!0}}resize(e,i){this._rowCount=i,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(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_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(e,i){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,i)):this._renderer.value.handleResize(e,i),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,i,r){this._selectionState.start=e,this._selectionState.end=i,this._selectionState.columnSelectMode=r,this._renderer.value?.handleSelectionChanged(e,i,r)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};rJ=ee([et(2,ex),et(3,eT),et(4,ey),et(5,eD),et(6,em),et(7,eP),et(8,eL)],rJ);var rQ=class{constructor(e,i,r){this._coreBrowserService=e,this._coreService=i,this._onTimeout=r,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,i){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,i)):(this._start=e,this._end=i,this._isBuffering=!0),void 0===this._timeout&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(void 0!==this._timeout&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){void 0!==this._timeout&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function r0(e,i,r,s){return r3(Math.abs(e-r1(e,r)-(i-r1(i,r)))-function(e,i,r){let s=0,n=e-r1(e,r),o=i-r1(i,r);for(let a=0;a<Math.abs(n-o);a++){let o="A"===function(e,i){return e>i?"A":"B"}(e,i)?-1:1;r.buffer.lines.get(n+o*a)?.isWrapped&&s++}return s}(e,i,r),r5(e>i?"A":"B",s))}function r1(e,i){let r=0,s=i.buffer.lines.get(e),n=s?.isWrapped;for(;n&&e>=0&&e<i.rows;)r++,s=i.buffer.lines.get(--e),n=s?.isWrapped;return r}function r2(e,i,r,s,n,o){let a=e,l=i,h="";for(;(a!==r||l!==s)&&l>=0&&l<o.buffer.lines.length;)a+=n?1:-1,n&&a>o.cols-1?(h+=o.buffer.translateBufferLineToString(l,!1,e,a),a=0,e=0,l++):!n&&a<0&&(h+=o.buffer.translateBufferLineToString(l,!1,0,e+1),e=a=o.cols-1,l--);return h+o.buffer.translateBufferLineToString(l,!1,e,a)}function r5(e,i){return iJ.ESC+(i?"O":"[")+e}function r3(e,i){e=Math.floor(e);let r="";for(let s=0;s<e;s++)r+=i;return r}var r6=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,i=this.selectionEnd;return!!e&&!!i&&(e[1]>i[1]||e[1]===i[1]&&e[0]>i[0])}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function r4(e,i){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return i*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var r8=RegExp(" ","g"),r7=class extends eZ{constructor(e,i,r,s,n,o,a,l,h){super(),this._element=e,this._screenElement=i,this._linkifier=r,this._bufferService=s,this._coreService=n,this._mouseService=o,this._optionsService=a,this._renderService=l,this._coreBrowserService=h,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new ef,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new to),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new to),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new to),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new to),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new r6(this._bufferService),this._activeSelectionMode=0,this._register(eX(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.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 e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!!e&&!!i&&(e[0]!==i[0]||e[1]!==i[1])}get selectionText(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;if(!e||!i)return"";let r=this._bufferService.buffer,s=[];if(3===this._activeSelectionMode){if(e[0]===i[0])return"";let n=e[0]<i[0]?e[0]:i[0],o=e[0]<i[0]?i[0]:e[0];for(let a=e[1];a<=i[1];a++){let e=r.translateBufferLineToString(a,!0,n,o);s.push(e)}}else{let n=e[1]===i[1]?i[0]:void 0;s.push(r.translateBufferLineToString(e[1],!0,e[0],n));for(let n=e[1]+1;n<=i[1]-1;n++){let e=r.lines.get(n),i=r.translateBufferLineToString(n,!0);e?.isWrapped?s[s.length-1]+=i:s.push(i)}if(e[1]!==i[1]){let e=r.lines.get(i[1]),n=r.translateBufferLineToString(i[1],!0,0,i[0]);e&&e.isWrapped?s[s.length-1]+=n:s.push(n)}}return s.map(e=>e.replace(r8," ")).join(rK?`\r
14
- `:`
15
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),rU&&e&&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:3===this._activeSelectionMode})}_isClickInSelection(e){let i=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!!r&&!!s&&!!i&&this._areCoordsInSelection(i,r,s)}isCellInSelection(e,i){let r=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!!r&&!!s&&this._areCoordsInSelection([e,i],r,s)}_areCoordsInSelection(e,i,r){return e[1]>i[1]&&e[1]<r[1]||i[1]===r[1]&&e[1]===i[1]&&e[0]>=i[0]&&e[0]<r[0]||i[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||i[1]<r[1]&&e[1]===i[1]&&e[0]>=i[0]}_selectWordAtCursor(e,i){let r=this._linkifier.currentLink?.link?.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=r4(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let s=this._getMouseBufferCoords(e);return!!s&&(this._selectWordAt(s,i),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,i){this._model.clearSelection(),e=Math.max(e,0),i=Math.min(i,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,i],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let i=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(i)return i[0]--,i[1]--,i[1]+=this._bufferService.buffer.ydisp,i}_getMouseEventScrollAmount(e){let i=rO(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return i>=0&&i<=r?0:(i>r&&(i-=r),(i=Math.min(Math.max(i,-50),50)/50)/Math.abs(i)+Math.round(14*i))}shouldForceSelection(e){return rz?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(2===e.button&&this.hasSelection)&&0===e.button){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):1===e.detail?this._handleSingleClick(e):2===e.detail?this._handleDoubleClick(e):3===e.detail&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=3*!!this.shouldColumnSelect(e),this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let i=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);i&&i.length!==this._model.selectionStart[0]&&0===i.hasWidth(this._model.selectionStart[0])&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let i=this._getMouseBufferCoords(e);i&&(this._activeSelectionMode=2,this._selectLineAt(i[1]))}shouldColumnSelect(e){return e.altKey&&!(rz&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let i=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd)return void this.refresh(!0);2===this._activeSelectionMode?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:1===this._activeSelectionMode&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),3!==this._activeSelectionMode&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let r=this._bufferService.buffer;if(this._model.selectionEnd[1]<r.lines.length){let e=r.lines.get(this._model.selectionEnd[1]);e&&0===e.hasWidth(this._model.selectionEnd[0])&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}i&&i[0]===this._model.selectionEnd[0]&&i[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 e=this._bufferService.buffer;this._dragScrollAmount>0?(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let i=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&i<500&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let i=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&void 0!==i[0]&&void 0!==i[1]){let e=function(e,i,r,s){var n,o,a,l,h,c,d,u,f,p,_,g,v,m,S,y,b,w;let C,x=r.buffer.x,k=r.buffer.y;if(!r.buffer.hasScrollback){let b,w,C;return n=x,a=0,(0===r0(o=k,i,l=r,h=s).length?"":r3(r2(n,o,n,o-r1(o,l),!1,l).length,r5("D",h)))+r0(k,i,r,s)+(c=x,d=k,u=e,b=r0(d,f=i,p=r,_=s).length>0?f-r1(f,p):d,C=(g=c,v=d,w=r0(m=u,S=f,y=p,_).length>0?S-r1(S,y):v,g<m&&w<=S||g>=m&&w<S?"C":"D"),r3(r2(c,b,u,f,"C"===C,p).length,r5(C,_)))}if(k===i)return C=x>e?"D":"C",r3(Math.abs(x-e),r5(C,s));C=k>i?"D":"C";let E=Math.abs(k-i);return r3((b=k>i?e:x,r.cols-b+(E-1)*r.cols+1+(w=0,(k>i?x:e)-1)),r5(C,s))}(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd,r=!!e&&!!i&&(e[0]!==i[0]||e[1]!==i[1]);if(!r){this._oldHasSelection&&this._fireOnSelectionChange(e,i,r);return}!e||!i||this._oldSelectionStart&&this._oldSelectionEnd&&e[0]===this._oldSelectionStart[0]&&e[1]===this._oldSelectionStart[1]&&i[0]===this._oldSelectionEnd[0]&&i[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(e,i,r)}_fireOnSelectionChange(e,i,r){this._oldSelectionStart=e,this._oldSelectionEnd=i,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,i){let r=i;for(let s=0;i>=s;s++){let n=e.loadCell(s,this._workCell).getChars().length;0===this._workCell.getWidth()?r--:n>1&&i!==s&&(r+=n-1)}return r}setSelection(e,i,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,i],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,i,r=!0,s=!0){if(e[0]>=this._bufferService.cols)return;let n=this._bufferService.buffer,o=n.lines.get(e[1]);if(!o)return;let a=n.translateBufferLineToString(e[1],!1),l=this._convertViewportColToCharacterIndex(o,e[0]),h=l,c=e[0]-l,d=0,u=0,f=0,p=0;if(" "===a.charAt(l)){for(;l>0&&" "===a.charAt(l-1);)l--;for(;h<a.length&&" "===a.charAt(h+1);)h++}else{let i=e[0],r=e[0];0===o.getWidth(i)&&(d++,i--),2===o.getWidth(r)&&(u++,r++);let s=o.getString(r).length;for(s>1&&(p+=s-1,h+=s-1);i>0&&l>0&&!this._isCharWordSeparator(o.loadCell(i-1,this._workCell));){o.loadCell(i-1,this._workCell);let e=this._workCell.getChars().length;0===this._workCell.getWidth()?(d++,i--):e>1&&(f+=e-1,l-=e-1),l--,i--}for(;r<o.length&&h+1<a.length&&!this._isCharWordSeparator(o.loadCell(r+1,this._workCell));){o.loadCell(r+1,this._workCell);let e=this._workCell.getChars().length;2===this._workCell.getWidth()?(u++,r++):e>1&&(p+=e-1,h+=e-1),h++,r++}}h++;let _=l+c-d+f,g=Math.min(this._bufferService.cols,h-l+d+u-f-p);if(!(!i&&""===a.slice(l,h).trim())){if(r&&0===_&&32!==o.getCodePoint(0)){let i=n.lines.get(e[1]-1);if(i&&o.isWrapped&&32!==i.getCodePoint(this._bufferService.cols-1)){let i=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(i){let e=this._bufferService.cols-i.start;_-=e,g+=e}}}if(s&&_+g===this._bufferService.cols&&32!==o.getCodePoint(this._bufferService.cols-1)){let i=n.lines.get(e[1]+1);if(i?.isWrapped&&32!==i.getCodePoint(0)){let i=this._getWordAt([0,e[1]+1],!1,!1,!0);i&&(g+=i.length)}}return{start:_,length:g}}}_selectWordAt(e,i){let r=this._getWordAt(e,i);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let i=this._getWordAt(e,!0);if(i){let r=e[1];for(;i.start<0;)i.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;i.start+i.length>this._bufferService.cols;)i.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?i.start:i.start+i.length,r]}}_isCharWordSeparator(e){return 0!==e.getWidth()&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let i=this._bufferService.buffer.getWrappedRangeForLine(e),r={start:{x:0,y:i.first},end:{x:this._bufferService.cols-1,y:i.last}};this._model.selectionStart=[0,i.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=r4(r,this._bufferService.cols)}};r7=ee([et(3,em),et(4,ey),et(5,eI),et(6,ex),et(7,eR),et(8,eP)],r7);var r9=class{constructor(){this._data={}}set(e,i,r){this._data[e]||(this._data[e]={}),this._data[e][i]=r}get(e,i){return this._data[e]?this._data[e][i]:void 0}clear(){this._data={}}},se=class{constructor(){this._color=new r9,this._css=new r9}setCss(e,i,r){this._css.set(e,i,r)}getCss(e,i){return this._css.get(e,i)}setColor(e,i,r){this._color.set(e,i,r)}getColor(e,i){return this._color.get(e,i)}clear(){this._color.clear(),this._css.clear()}},st=Object.freeze((()=>{let e=[sA.toColor("#2e3436"),sA.toColor("#cc0000"),sA.toColor("#4e9a06"),sA.toColor("#c4a000"),sA.toColor("#3465a4"),sA.toColor("#75507b"),sA.toColor("#06989a"),sA.toColor("#d3d7cf"),sA.toColor("#555753"),sA.toColor("#ef2929"),sA.toColor("#8ae234"),sA.toColor("#fce94f"),sA.toColor("#729fcf"),sA.toColor("#ad7fa8"),sA.toColor("#34e2e2"),sA.toColor("#eeeeec")],i=[0,95,135,175,215,255];for(let r=0;r<216;r++){let s=i[r/36%6|0],n=i[r/6%6|0],o=i[r%6];e.push({css:i1.toCss(s,n,o),rgba:i1.toRgba(s,n,o)})}for(let i=0;i<24;i++){let r=8+10*i;e.push({css:i1.toCss(r,r,r),rgba:i1.toRgba(r,r,r)})}return e})()),si=sA.toColor("#ffffff"),sr=sA.toColor("#000000"),ss=sA.toColor("#ffffff"),sn={css:"rgba(255, 255, 255, 0.3)",rgba:0xffffff4d},so=class extends eZ{constructor(e){super(),this._optionsService=e,this._contrastCache=new se,this._halfContrastCache=new se,this._onChangeColors=this._register(new to),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:si,background:sr,cursor:ss,cursorAccent:sr,selectionForeground:void 0,selectionBackgroundTransparent:sn,selectionBackgroundOpaque:sB.blend(sr,sn),selectionInactiveBackgroundTransparent:sn,selectionInactiveBackgroundOpaque:sB.blend(sr,sn),scrollbarSliderBackground:sB.opacity(si,.2),scrollbarSliderHoverBackground:sB.opacity(si,.4),scrollbarSliderActiveBackground:sB.opacity(si,.5),overviewRulerBorder:si,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(e={}){let i=this._colors;if(i.foreground=sa(e.foreground,si),i.background=sa(e.background,sr),i.cursor=sB.blend(i.background,sa(e.cursor,ss)),i.cursorAccent=sB.blend(i.background,sa(e.cursorAccent,sr)),i.selectionBackgroundTransparent=sa(e.selectionBackground,sn),i.selectionBackgroundOpaque=sB.blend(i.background,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundTransparent=sa(e.selectionInactiveBackground,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundOpaque=sB.blend(i.background,i.selectionInactiveBackgroundTransparent),i.selectionForeground=e.selectionForeground?sa(e.selectionForeground,i4):void 0,i.selectionForeground===i4&&(i.selectionForeground=void 0),sB.isOpaque(i.selectionBackgroundTransparent)&&(i.selectionBackgroundTransparent=sB.opacity(i.selectionBackgroundTransparent,.3)),sB.isOpaque(i.selectionInactiveBackgroundTransparent)&&(i.selectionInactiveBackgroundTransparent=sB.opacity(i.selectionInactiveBackgroundTransparent,.3)),i.scrollbarSliderBackground=sa(e.scrollbarSliderBackground,sB.opacity(i.foreground,.2)),i.scrollbarSliderHoverBackground=sa(e.scrollbarSliderHoverBackground,sB.opacity(i.foreground,.4)),i.scrollbarSliderActiveBackground=sa(e.scrollbarSliderActiveBackground,sB.opacity(i.foreground,.5)),i.overviewRulerBorder=sa(e.overviewRulerBorder,si),i.ansi=st.slice(),i.ansi[0]=sa(e.black,st[0]),i.ansi[1]=sa(e.red,st[1]),i.ansi[2]=sa(e.green,st[2]),i.ansi[3]=sa(e.yellow,st[3]),i.ansi[4]=sa(e.blue,st[4]),i.ansi[5]=sa(e.magenta,st[5]),i.ansi[6]=sa(e.cyan,st[6]),i.ansi[7]=sa(e.white,st[7]),i.ansi[8]=sa(e.brightBlack,st[8]),i.ansi[9]=sa(e.brightRed,st[9]),i.ansi[10]=sa(e.brightGreen,st[10]),i.ansi[11]=sa(e.brightYellow,st[11]),i.ansi[12]=sa(e.brightBlue,st[12]),i.ansi[13]=sa(e.brightMagenta,st[13]),i.ansi[14]=sa(e.brightCyan,st[14]),i.ansi[15]=sa(e.brightWhite,st[15]),e.extendedAnsi){let r=Math.min(i.ansi.length-16,e.extendedAnsi.length);for(let s=0;s<r;s++)i.ansi[s+16]=sa(e.extendedAnsi[s],st[s+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(void 0===e){for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];return}switch(e){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[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function sa(e,i){if(void 0!==e)try{return sA.toColor(e)}catch{}return i}so=ee([et(0,ex)],so);var sl=class{constructor(...e){for(let[i,r]of(this._entries=new Map,e))this.set(i,r)}set(e,i){let r=this._entries.get(e);return this._entries.set(e,i),r}forEach(e){for(let[i,r]of this._entries.entries())e(i,r)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},sh=class{constructor(){this._services=new sl,this._services.set(ew,this)}setService(e,i){this._services.set(e,i)}getService(e){return this._services.get(e)}createInstance(e,...i){let r=(e[e_]||[]).sort((e,i)=>e.index-i.index),s=[];for(let i of r){let r=this._services.get(i.id);if(!r)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${i.id._id}.`);s.push(r)}let n=r.length>0?r[0].index:i.length;if(i.length!==n)throw Error(`[createInstance] First service dependency of ${e.name} at position ${n+1} conflicts with ${i.length} static arguments`);return new e(...i,...s)}},sc={trace:0,debug:1,info:2,warn:3,error:4,off:5},sd=class extends eZ{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=sc[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;i<e.length;i++)"function"==typeof e[i]&&(e[i]=e[i]())}_log(e,i,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+i,...r)}trace(e,...i){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,i)}debug(e,...i){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,i)}info(e,...i){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,i)}warn(e,...i){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,i)}error(e,...i){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,i)}};sd=ee([et(0,ex)],sd);var su=class extends eZ{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new to),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new to),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new to),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let i=Array(e);for(let r=0;r<Math.min(e,this.length);r++)i[r]=this._array[this._getCyclicIndex(r)];this._array=i,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let i=this._length;i<e;i++)this._array[i]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,i){this._array[this._getCyclicIndex(e)]=i}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw 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(e,i,...r){if(i){for(let r=e;r<this._length-i;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+i)];this._length-=i,this.onDeleteEmitter.fire({index:e,amount:i})}for(let i=this._length-1;i>=e;i--)this._array[this._getCyclicIndex(i+r.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<r.length;i++)this._array[this._getCyclicIndex(e+i)]=r[i];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){let e=this._length+r.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,i,r){if(!(i<=0)){if(e<0||e>=this._length)throw Error("start argument out of range");if(e+r<0)throw Error("Cannot shift elements in list beyond index 0");if(r>0){for(let s=i-1;s>=0;s--)this.set(e+s+r,this.get(e+s));let s=e+i+r-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<i;s++)this.set(e+s+r,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},sf=Object.freeze(new ed),sp=0,s_=class e{constructor(e,i,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);let s=i||ef.fromCharData([0,"",1,0]);for(let i=0;i<e;++i)this.setCell(i,s);this.length=e}get(e){let i=this._data[3*e+0],r=2097151&i;return[this._data[3*e+1],2097152&i?this._combined[e]:r?ea(r):"",i>>22,2097152&i?this._combined[e].charCodeAt(this._combined[e].length-1):r]}set(e,i){this._data[3*e+1]=i[0],i[1].length>1?(this._combined[e]=i[1],this._data[3*e+0]=2097152|e|i[2]<<22):this._data[3*e+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 0xc00000&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){let i=this._data[3*e+0];return 2097152&i?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&i}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){let i=this._data[3*e+0];return 2097152&i?this._combined[e]:2097151&i?ea(2097151&i):""}isProtected(e){return 0x20000000&this._data[3*e+2]}loadCell(e,i){return sp=3*e,i.content=this._data[sp+0],i.fg=this._data[sp+1],i.bg=this._data[sp+2],2097152&i.content&&(i.combinedData=this._combined[e]),0x10000000&i.bg&&(i.extended=this._extendedAttrs[e]),i}setCell(e,i){2097152&i.content&&(this._combined[e]=i.combinedData),0x10000000&i.bg&&(this._extendedAttrs[e]=i.extended),this._data[3*e+0]=i.content,this._data[3*e+1]=i.fg,this._data[3*e+2]=i.bg}setCellFromCodepoint(e,i,r,s){0x10000000&s.bg&&(this._extendedAttrs[e]=s.extended),this._data[3*e+0]=i|r<<22,this._data[3*e+1]=s.fg,this._data[3*e+2]=s.bg}addCodepointToCell(e,i,r){let s=this._data[3*e+0];2097152&s?this._combined[e]+=ea(i):2097151&s?(this._combined[e]=ea(2097151&s)+ea(i),s&=-2097152,s|=2097152):s=4194304|i,r&&(s&=-0xc00001,s|=r<<22),this._data[3*e+0]=s}insertCells(e,i,r){if((e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,r),i<this.length-e){let s=new ef;for(let r=this.length-e-i-1;r>=0;--r)this.setCell(e+i+r,this.loadCell(e+r,s));for(let s=0;s<i;++s)this.setCell(e+s,r)}else for(let i=e;i<this.length;++i)this.setCell(i,r);2===this.getWidth(this.length-1)&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(e,i,r){if(e%=this.length,i<this.length-e){let s=new ef;for(let r=0;r<this.length-e-i;++r)this.setCell(e+r,this.loadCell(e+i+r,s));for(let e=this.length-i;e<this.length;++e)this.setCell(e,r)}else for(let i=e;i<this.length;++i)this.setCell(i,r);e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,r),0!==this.getWidth(e)||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,r)}replaceCells(e,i,r,s=!1){if(s){for(e&&2===this.getWidth(e-1)&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,r),i<this.length&&2===this.getWidth(i-1)&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,r);e<i&&e<this.length;)this.isProtected(e)||this.setCell(e,r),e++;return}for(e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,r),i<this.length&&2===this.getWidth(i-1)&&this.setCellFromCodepoint(i,0,1,r);e<i&&e<this.length;)this.setCell(e++,r)}resize(e,i){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let r=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*r)this._data=new Uint32Array(this._data.buffer,0,r);else{let e=new Uint32Array(r);e.set(this._data),this._data=e}for(let r=this.length;r<e;++r)this.setCell(r,i)}else{this._data=this._data.subarray(0,r);let i=Object.keys(this._combined);for(let r=0;r<i.length;r++){let s=parseInt(i[r],10);s>=e&&delete this._combined[s]}let s=Object.keys(this._extendedAttrs);for(let i=0;i<s.length;i++){let r=parseInt(s[i],10);r>=e&&delete this._extendedAttrs[r]}}return this.length=e,4*r*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,i=!1){if(i){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){for(let i in this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={},e._combined)this._combined[i]=e._combined[i];for(let i in this._extendedAttrs={},e._extendedAttrs)this._extendedAttrs[i]=e._extendedAttrs[i];this.isWrapped=e.isWrapped}clone(){let i=new e(0);for(let e in i._data=new Uint32Array(this._data),i.length=this.length,this._combined)i._combined[e]=this._combined[e];for(let e in this._extendedAttrs)i._extendedAttrs[e]=this._extendedAttrs[e];return i.isWrapped=this.isWrapped,i}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||0x3000000&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,i,r,s,n){let o=e._data;if(n)for(let n=s-1;n>=0;n--){for(let e=0;e<3;e++)this._data[(r+n)*3+e]=o[(i+n)*3+e];0x10000000&o[(i+n)*3+2]&&(this._extendedAttrs[r+n]=e._extendedAttrs[i+n])}else for(let n=0;n<s;n++){for(let e=0;e<3;e++)this._data[(r+n)*3+e]=o[(i+n)*3+e];0x10000000&o[(i+n)*3+2]&&(this._extendedAttrs[r+n]=e._extendedAttrs[i+n])}let a=Object.keys(e._combined);for(let s=0;s<a.length;s++){let n=parseInt(a[s],10);n>=i&&(this._combined[n-i+r]=e._combined[n])}}translateToString(e,i,r,s){i=i??0,r=r??this.length,e&&(r=Math.min(r,this.getTrimmedLength())),s&&(s.length=0);let n="";for(;i<r;){let e=this._data[3*i+0],r=2097151&e,o=2097152&e?this._combined[i]:r?ea(r):" ";if(n+=o,s)for(let e=0;e<o.length;++e)s.push(i);i+=e>>22||1}return s&&s.push(i),n}};function sg(e,i,r){if(i===e.length-1)return e[i].getTrimmedLength();let s=!e[i].hasContent(r-1)&&1===e[i].getWidth(r-1),n=2===e[i+1].getWidth(0);return s&&n?r-1:r}var sv=class e{constructor(i){this.line=i,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new to),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),eq(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};sv._nextId=1;var sm={},sS=sm.B;sm[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:"≥","{":"π","|":"≠","}":"£","~":"·"},sm.A={"#":"£"},sm.B=void 0,sm[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},sm.C=sm[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},sm.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},sm.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},sm.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},sm.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},sm.E=sm[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},sm.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},sm.H=sm[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},sm["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var sy=class{constructor(e,i,r){this._hasScrollback=e,this._optionsService=i,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=sf.clone(),this.savedCharset=sS,this.markers=[],this._nullCell=ef.fromCharData([0,"",1,0]),this._whitespaceCell=ef.fromCharData([0," ",1,32]),this._isClearing=!1,this._memoryCleanupQueue=new rG,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new su(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new eu),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new eu),this._whitespaceCell}getBlankLine(e,i){return new s_(this._bufferService.cols,this.getNullCell(e),i)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let i=e+this._optionsService.rawOptions.scrollback;return i>0xffffffff?0xffffffff:i}fillViewportRows(e){if(0===this.lines.length){void 0===e&&(e=sf);let i=this._rows;for(;i--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new su(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,i){let r=this.getNullCell(sf),s=0,n=this._getCorrectBufferLength(i);if(n>this.lines.maxLength&&(this.lines.maxLength=n),this.lines.length>0){if(this._cols<e)for(let i=0;i<this.lines.length;i++)s+=+this.lines.get(i).resize(e,r);let o=0;if(this._rows<i)for(let s=this._rows;s<i;s++)this.lines.length<i+this.ybase&&(this._optionsService.rawOptions.windowsMode||void 0!==this._optionsService.rawOptions.windowsPty.backend||void 0!==this._optionsService.rawOptions.windowsPty.buildNumber?this.lines.push(new s_(e,r)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new s_(e,r)));else for(let e=this._rows;e>i;e--)this.lines.length>i+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(n<this.lines.maxLength){let e=this.lines.length-n;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=n}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,i-1),o&&(this.y+=o),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=i-1,this._isReflowEnabled&&(this._reflow(e,i),this._cols>e))for(let i=0;i<this.lines.length;i++)s+=+this.lines.get(i).resize(e,r);this._cols=e,this._rows=i,this._memoryCleanupQueue.clear(),s>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let i=0;for(;this._memoryCleanupPosition<this.lines.length;)if((i+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory())>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&"conpty"===e.backend&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,i){this._cols!==e&&(e>this._cols?this._reflowLarger(e,i):this._reflowSmaller(e,i))}_reflowLarger(e,i){let r=this._optionsService.rawOptions.reflowCursorLine,s=function(e,i,r,s,n,o){let a=[];for(let l=0;l<e.length-1;l++){let h=l,c=e.get(++h);if(!c.isWrapped)continue;let d=[e.get(l)];for(;h<e.length&&c.isWrapped;)d.push(c),c=e.get(++h);if(!o&&s>=l&&s<h){l+=d.length-1;continue}let u=0,f=sg(d,0,i),p=1,_=0;for(;p<d.length;){let e=sg(d,p,i),s=Math.min(e-_,r-f);d[u].copyCellsFrom(d[p],_,f,s,!1),(f+=s)===r&&(u++,f=0),(_+=s)===e&&(p++,_=0),0===f&&0!==u&&2===d[u-1].getWidth(r-1)&&(d[u].copyCellsFrom(d[u-1],r-1,f++,1,!1),d[u-1].setCell(r-1,n))}d[u].replaceCells(f,r,n);let g=0;for(let e=d.length-1;e>0&&(e>u||0===d[e].getTrimmedLength());e--)g++;g>0&&(a.push(l+d.length-g),a.push(g)),l+=d.length-1}return a}(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(sf),r);if(s.length>0){let r=function(e,i){let r=[],s=0,n=i[0],o=0;for(let a=0;a<e.length;a++)if(n===a){let r=i[++s];e.onDeleteEmitter.fire({index:a-o,amount:r}),a+=r-1,o+=r,n=i[++s]}else r.push(a);return{layout:r,countRemoved:o}}(this.lines,s);(function(e,i){let r=[];for(let s=0;s<i.length;s++)r.push(e.get(i[s]));for(let i=0;i<r.length;i++)e.set(i,r[i]);e.length=i.length})(this.lines,r.layout),this._reflowLargerAdjustViewport(e,i,r.countRemoved)}}_reflowLargerAdjustViewport(e,i,r){let s=this.getNullCell(sf),n=r;for(;n-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length<i&&this.lines.push(new s_(e,s))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-r,0)}_reflowSmaller(e,i){let r=this._optionsService.rawOptions.reflowCursorLine,s=this.getNullCell(sf),n=[],o=0;for(let a=this.lines.length-1;a>=0;a--){let l=this.lines.get(a);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;let h=[l];for(;l.isWrapped&&a>0;)l=this.lines.get(--a),h.unshift(l);if(!r){let e=this.ybase+this.y;if(e>=a&&e<a+h.length)continue}let c=h[h.length-1].getTrimmedLength(),d=function(e,i,r){let s=[],n=e.map((r,s)=>sg(e,s,i)).reduce((e,i)=>e+i),o=0,a=0,l=0;for(;l<n;){if(n-l<r){s.push(n-l);break}o+=r;let h=sg(e,a,i);o>h&&(o-=h,a++);let c=2===e[a].getWidth(o-1);c&&o--;let d=c?r-1:r;s.push(d),l+=d}return s}(h,this._cols,e),u=d.length-h.length,f;f=0===this.ybase&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+u):Math.max(0,this.lines.length-this.lines.maxLength+u);let p=[];for(let e=0;e<u;e++){let e=this.getBlankLine(sf,!0);p.push(e)}p.length>0&&(n.push({start:a+h.length+o,newLines:p}),o+=p.length),h.push(...p);let _=d.length-1,g=d[_];0===g&&(g=d[--_]);let v=h.length-u-1,m=c;for(;v>=0;){let e=Math.min(m,g);if(void 0===h[_])break;h[_].copyCellsFrom(h[v],m-e,g-e,e,!0),0==(g-=e)&&(g=d[--_]),0==(m-=e)&&(m=sg(h,Math.max(--v,0),this._cols))}for(let i=0;i<h.length;i++)d[i]<e&&h[i].setCell(d[i],s);let S=u-f;for(;S-- >0;)0===this.ybase?this.y<i-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+o)-i&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+u,this.ybase+i-1)}if(n.length>0){let e=[],i=[];for(let e=0;e<this.lines.length;e++)i.push(this.lines.get(e));let r=this.lines.length,s=r-1,a=0,l=n[0];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let h=0;for(let c=Math.min(this.lines.maxLength-1,r+o-1);c>=0;c--)if(l&&l.start>s+h){for(let e=l.newLines.length-1;e>=0;e--)this.lines.set(c--,l.newLines[e]);c++,e.push({index:s+1,amount:l.newLines.length}),h+=l.newLines.length,l=n[++a]}else this.lines.set(c,i[s--]);let c=0;for(let i=e.length-1;i>=0;i--)e[i].index+=c,this.lines.onInsertEmitter.fire(e[i]),c+=e[i].amount;let d=Math.max(0,r+o-this.lines.maxLength);d>0&&this.lines.onTrimEmitter.fire(d)}}translateBufferLineToString(e,i,r=0,s){let n=this.lines.get(e);return n?n.translateToString(i,r,s):""}getWrappedRangeForLine(e){let i=e,r=e;for(;i>0&&this.lines.get(i).isWrapped;)i--;for(;r+1<this.lines.length&&this.lines.get(r+1).isWrapped;)r++;return{first:i,last:r}}setupTabStops(e){for(null!=e?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(null==e&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(null==e&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let i=0;i<this.markers.length;i++)this.markers[i].line===e&&(this.markers[i].dispose(),this.markers.splice(i--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let i=new sv(e);return this.markers.push(i),i.register(this.lines.onTrim(e=>{i.line-=e,i.line<0&&i.dispose()})),i.register(this.lines.onInsert(e=>{i.line>=e.index&&(i.line+=e.amount)})),i.register(this.lines.onDelete(e=>{i.line>=e.index&&i.line<e.index+e.amount&&i.dispose(),i.line>e.index&&(i.line-=e.amount)})),i.register(i.onDispose(()=>this._removeMarker(i))),i}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},sb=class extends eZ{constructor(e,i){super(),this._optionsService=e,this._bufferService=i,this._onBufferActivate=this._register(new to),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 sy(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new sy(!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(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),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(e,i){this._normal.resize(e,i),this._alt.resize(e,i),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},sw=class extends eZ{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new to),this.onResize=this._onResize.event,this._onScroll=this._register(new to),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,2),this.rows=Math.max(e.rawOptions.rows||0,1),this.buffers=this._register(new sb(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,i){let r=this.cols!==e,s=this.rows!==i;this.cols=e,this.rows=i,this.buffers.resize(e,i),this._onResize.fire({cols:e,rows:i,colsChanged:r,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,i=!1){let r=this.buffer,s;(s=this._cachedBlankLine)&&s.length===this.cols&&s.getFg(0)===e.fg&&s.getBg(0)===e.bg||(s=r.getBlankLine(e,i),this._cachedBlankLine=s),s.isWrapped=i;let n=r.ybase+r.scrollTop,o=r.ybase+r.scrollBottom;if(0===r.scrollTop){let e=r.lines.isFull;o===r.lines.length-1?e?r.lines.recycle().copyFrom(s):r.lines.push(s.clone()):r.lines.splice(o+1,0,s.clone()),e?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let e=o-n+1;r.lines.shiftElements(n+1,e-1,-1),r.lines.set(o,s.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,i){let r=this.buffer;if(e<0){if(0===r.ydisp)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let s=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),s!==r.ydisp&&(i||this._onScroll.fire(r.ydisp))}};sw=ee([et(0,ex)],sw);var sC={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:rz,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},sx=["normal","bold","100","200","300","400","500","600","700","800","900"],sk=class extends eZ{constructor(e){super(),this._onOptionChange=this._register(new to),this.onOptionChange=this._onOptionChange.event;let i={...sC};for(let r in e)if(r in i)try{let s=e[r];i[r]=this._sanitizeAndValidateOption(r,s)}catch(e){console.error(e)}this.rawOptions=i,this.options={...i},this._setupOptions(),this._register(eX(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,i){return this.onOptionChange(r=>{r===e&&i(this.rawOptions[e])})}onMultipleOptionChange(e,i){return this.onOptionChange(r=>{-1!==e.indexOf(r)&&i()})}_setupOptions(){let e=e=>{if(!(e in sC))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},i=(e,i)=>{if(!(e in sC))throw Error(`No option with key "${e}"`);i=this._sanitizeAndValidateOption(e,i),this.rawOptions[e]!==i&&(this.rawOptions[e]=i,this._onOptionChange.fire(e))};for(let r in this.rawOptions){let s={get:e.bind(this,r),set:i.bind(this,r)};Object.defineProperty(this.options,r,s)}}_sanitizeAndValidateOption(e,i){switch(e){case"cursorStyle":var r;if(i||(i=sC[e]),"block"!==(r=i)&&"underline"!==r&&"bar"!==r)throw Error(`"${i}" is not a valid value for ${e}`);break;case"wordSeparator":i||(i=sC[e]);break;case"fontWeight":case"fontWeightBold":if("number"==typeof i&&1<=i&&i<=1e3)break;i=sx.includes(i)?i:sC[e];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw Error(`${e} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(10*i)/10));break;case"scrollback":if((i=Math.min(i,0xffffffff))<0)throw Error(`${e} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&0!==i)throw Error(`${e} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{}}return i}};function sE(e,i=5){if("object"!=typeof e)return e;let r=Array.isArray(e)?[]:{};for(let s in e)r[s]=i<=1?e[s]:e[s]&&sE(e[s],i-1);return r}var sD=Object.freeze({insertMode:!1}),sO=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),sT=class extends eZ{constructor(e,i,r){super(),this._bufferService=e,this._logService=i,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new to),this.onData=this._onData.event,this._onUserInput=this._register(new to),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new to),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new to),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=sE(sD),this.decPrivateModes=sE(sO)}reset(){this.modes=sE(sD),this.decPrivateModes=sE(sO)}triggerDataEvent(e,i=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;i&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),i&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};sT=ee([et(0,em),et(1,eC),et(2,ex)],sT);var sP={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>4!==e.button&&1===e.action&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>32!==e.action},DRAG:{events:23,restrict:e=>32!==e.action||3!==e.button},ANY:{events:31,restrict:e=>!0}};function sI(e,i){let r=16*!!e.ctrl|4*!!e.shift|8*!!e.alt;return 4===e.button?(r|=64,r|=e.action):(r|=3&e.button,4&e.button&&(r|=64),8&e.button&&(r|=128),32===e.action?r|=32:0!==e.action||i||(r|=3)),r}var sR=String.fromCharCode,sM={DEFAULT:e=>{let i=[sI(e,!1)+32,e.col+32,e.row+32];return i[0]>255||i[1]>255||i[2]>255?"":`\x1b[M${sR(i[0])}${sR(i[1])}${sR(i[2])}`},SGR:e=>{let i=0===e.action&&4!==e.button?"m":"M";return`\x1b[<${sI(e,!0)};${e.col};${e.row}${i}`},SGR_PIXELS:e=>{let i=0===e.action&&4!==e.button?"m":"M";return`\x1b[<${sI(e,!0)};${e.x};${e.y}${i}`}},sN=class extends eZ{constructor(e,i,r){for(let s of(super(),this._bufferService=e,this._coreService=i,this._optionsService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new to),this.onProtocolChange=this._onProtocolChange.event,Object.keys(sP)))this.addProtocol(s,sP[s]);for(let e of Object.keys(sM))this.addEncoding(e,sM[e]);this.reset()}addProtocol(e,i){this._protocols[e]=i}addEncoding(e,i){this._encodings[e]=i}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return 0!==this._protocols[this._activeProtocol].events}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,i,r){if(0===e.deltaY||e.shiftKey||void 0===i||void 0===r)return 0;let s=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=i/r+0,50>Math.abs(e.deltaY)&&(s*=.3),this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(e,i){return i.altKey||i.ctrlKey||i.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||4===e.button&&32===e.action||3===e.button&&32!==e.action||4!==e.button&&(2===e.action||3===e.action)||(e.col++,e.row++,32===e.action&&this._lastEvent&&this._equalEvents(this._lastEvent,e,"SGR_PIXELS"===this._activeEncoding))||!this._protocols[this._activeProtocol].restrict(e))return!1;let i=this._encodings[this._activeEncoding](e);return i&&("DEFAULT"===this._activeEncoding?this._coreService.triggerBinaryEvent(i):this._coreService.triggerDataEvent(i,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_equalEvents(e,i,r){if(r){if(e.x!==i.x||e.y!==i.y)return!1}else if(e.col!==i.col||e.row!==i.row)return!1;return e.button===i.button&&e.action===i.action&&e.ctrl===i.ctrl&&e.alt===i.alt&&e.shift===i.shift}};sN=ee([et(0,em),et(1,ey),et(2,ex)],sN);var sL,sB,sA,sj,sH,sW,sz=[[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]],sF=[[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]],s$=class{constructor(){if(this.version="6",!sW){(sW=new Uint8Array(65536)).fill(1),sW[0]=0,sW.fill(0,1,32),sW.fill(0,127,160),sW.fill(2,4352,4448),sW[9001]=2,sW[9002]=2,sW.fill(2,11904,42192),sW[12351]=1,sW.fill(2,44032,55204),sW.fill(2,63744,64256),sW.fill(2,65040,65050),sW.fill(2,65072,65136),sW.fill(2,65280,65377),sW.fill(2,65504,65511);for(let e=0;e<sz.length;++e)sW.fill(0,sz[e][0],sz[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?sW[e]:!function(e,i){let r=0,s=i.length-1,n;if(e<i[0][0]||e>i[s][1])return!1;for(;s>=r;)if(e>i[n=r+s>>1][1])r=n+1;else{if(!(e<i[n][0]))return!0;s=n-1}return!1}(e,sF)?e>=131072&&e<=196605||e>=196608&&e<=262141?2:1:0}charProperties(e,i){let r=this.wcwidth(e),s=0===r&&0!==i;if(s){let e=sK.extractWidth(i);0===e?s=!1:e>r&&(r=e)}return sK.createPropertyValue(0,r,s)}},sK=class e{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new to,this.onChange=this._onChange.event;let e=new s$;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(1&e)!=0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,i,r=!1){return(0xffffff&e)<<3|(3&i)<<1|!!r}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw 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(i){let r=0,s=0,n=i.length;for(let o=0;o<n;++o){let a=i.charCodeAt(o);if(55296<=a&&a<=56319){if(++o>=n)return r+this.wcwidth(a);let e=i.charCodeAt(o);56320<=e&&e<=57343?a=(a-55296)*1024+e-56320+65536:r+=this.wcwidth(e)}let l=this.charProperties(a,s),h=e.extractWidth(l);e.extractShouldJoin(l)&&(h-=e.extractWidth(s)),r+=h,s=l}return r}charProperties(e,i){return this._activeProvider.charProperties(e,i)}},sU=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,i){this._charsets[e]=i,this.glevel===e&&(this.charset=i)}};function sY(e){let i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&i&&(r.isWrapped=0!==i[3]&&32!==i[3])}var sq=class e{constructor(e=32,i=32){if(this.maxLength=e,this.maxSubParamsLength=i,i>256)throw Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(i){let r=new e;if(!i.length)return r;for(let e=+!!Array.isArray(i[0]);e<i.length;++e){let s=i[e];if(Array.isArray(s))for(let e=0;e<s.length;++e)r.addSubParam(s[e]);else r.addParam(s)}return r}clone(){let i=new e(this.maxLength,this.maxSubParamsLength);return i.params.set(this.params),i.length=this.length,i._subParams.set(this._subParams),i._subParamsLength=this._subParamsLength,i._subParamsIdx.set(this._subParamsIdx),i._rejectDigits=this._rejectDigits,i._rejectSubDigits=this._rejectSubDigits,i._digitIsSub=this._digitIsSub,i}toArray(){let e=[];for(let i=0;i<this.length;++i){e.push(this.params[i]);let r=this._subParamsIdx[i]>>8,s=255&this._subParamsIdx[i];s-r>0&&e.push(Array.prototype.slice.call(this._subParams,r,s))}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 Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>0x7fffffff?0x7fffffff:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>0x7fffffff?0x7fffffff:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let i=this._subParamsIdx[e]>>8,r=255&this._subParamsIdx[e];return r-i>0?this._subParams.subarray(i,r):null}getSubParamsAll(){let e={};for(let i=0;i<this.length;++i){let r=this._subParamsIdx[i]>>8,s=255&this._subParamsIdx[i];s-r>0&&(e[i]=this._subParams.slice(r,s))}return e}addDigit(e){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,s=r[i-1];r[i-1]=~s?Math.min(10*s+e,0x7fffffff):e}},sX=[],sV=class{constructor(){this._state=0,this._active=sX,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,i){void 0===this._handlers[e]&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(i),{dispose:()=>{let e=r.indexOf(i);-1!==e&&r.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=sX}reset(){if(2===this._state)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=sX,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||sX,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,"START")}_put(e,i,r){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,i,r);else this._handlerFb(this._id,"PUT",el(e,i,r))}start(){this.reset(),this._state=1}put(e,i,r){if(3!==this._state){if(1===this._state)for(;i<r;){let r=e[i++];if(59===r){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}-1===this._id&&(this._id=0),this._id=10*this._id+r-48}2===this._state&&r-i>0&&this._put(e,i,r)}}end(e,i=!0){if(0!==this._state){if(3!==this._state)if(1===this._state&&this._start(),this._active.length){let r=!1,s=this._active.length-1,n=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,r=i,n=this._stack.fallThrough,this._stack.paused=!1),!n&&!1===r){for(;s>=0&&!0!==(r=this._active[s].end(e));s--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,r;s--}for(;s>=0;s--)if((r=this._active[s].end(!1))instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,r}else this._handlerFb(this._id,"END",e);this._active=sX,this._id=-1,this._state=0}}},sG=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,i,r){this._hitLimit||(this._data+=el(e,i,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let i=!1;if(this._hitLimit)i=!1;else if(e&&(i=this._handler(this._data))instanceof Promise)return i.then(e=>(this._data="",this._hitLimit=!1,e));return this._data="",this._hitLimit=!1,i}},sZ=[],sJ=class{constructor(){this._handlers=Object.create(null),this._active=sZ,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=sZ}registerHandler(e,i){void 0===this._handlers[e]&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(i),{dispose:()=>{let e=r.indexOf(i);-1!==e&&r.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=sZ,this._ident=0}hook(e,i){if(this.reset(),this._ident=e,this._active=this._handlers[e]||sZ,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(i);else this._handlerFb(this._ident,"HOOK",i)}put(e,i,r){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,i,r);else this._handlerFb(this._ident,"PUT",el(e,i,r))}unhook(e,i=!0){if(this._active.length){let r=!1,s=this._active.length-1,n=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,r=i,n=this._stack.fallThrough,this._stack.paused=!1),!n&&!1===r){for(;s>=0&&!0!==(r=this._active[s].unhook(e));s--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,r;s--}for(;s>=0;s--)if((r=this._active[s].unhook(!1))instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,r}else this._handlerFb(this._ident,"UNHOOK",e);this._active=sZ,this._ident=0}},sQ=new sq;sQ.addParam(0);var s0=class{constructor(e){this._handler=e,this._data="",this._params=sQ,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():sQ,this._data="",this._hitLimit=!1}put(e,i,r){this._hitLimit||(this._data+=el(e,i,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let i=!1;if(this._hitLimit)i=!1;else if(e&&(i=this._handler(this._data,this._params))instanceof Promise)return i.then(e=>(this._params=sQ,this._data="",this._hitLimit=!1,e));return this._params=sQ,this._data="",this._hitLimit=!1,i}},s1=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,i){this.table.fill(e<<4|i)}add(e,i,r,s){this.table[i<<8|e]=r<<4|s}addMany(e,i,r,s){for(let n=0;n<e.length;n++)this.table[i<<8|e[n]]=r<<4|s}},s2=function(){let e=new s1(4095),i=Array.apply(null,Array(256)).map((e,i)=>i),r=(e,r)=>i.slice(e,r),s=r(32,127),n=r(0,24);n.push(25),n.push.apply(n,r(28,32));let o=r(0,14),a;for(a in e.setDefault(1,0),e.addMany(s,0,2,0),o)e.addMany([24,26,153,154],a,3,0),e.addMany(r(128,144),a,3,0),e.addMany(r(144,152),a,3,0),e.add(156,a,0,0),e.add(27,a,11,1),e.add(157,a,4,8),e.addMany([152,158,159],a,0,7),e.add(155,a,11,3),e.add(144,a,11,9);return e.addMany(n,0,3,0),e.addMany(n,1,3,1),e.add(127,1,0,1),e.addMany(n,8,0,8),e.addMany(n,3,3,3),e.add(127,3,0,3),e.addMany(n,4,3,4),e.add(127,4,0,4),e.addMany(n,6,3,6),e.addMany(n,5,3,5),e.add(127,5,0,5),e.addMany(n,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(s,7,0,7),e.addMany(n,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(n,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(n,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(n,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(n,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(n,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(160,0,2,0),e.add(160,8,5,8),e.add(160,6,0,6),e.add(160,11,0,11),e.add(160,13,13,13),e}(),s5=class extends eZ{constructor(e=s2){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new sq,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,i,r)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,i)=>{},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(eX(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new sV),this._dcsParser=this._register(new sJ),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,i=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw Error("only one byte as prefix supported");if((r=e.prefix.charCodeAt(0))&&60>r||r>63)throw Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw Error("only two bytes as intermediates are supported");for(let i=0;i<e.intermediates.length;++i){let s=e.intermediates.charCodeAt(i);if(32>s||s>47)throw Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=s}}if(1!==e.final.length)throw Error("final must be a single byte");let s=e.final.charCodeAt(0);if(i[0]>s||s>i[1])throw Error(`final must be in range ${i[0]} .. ${i[1]}`);return r<<=8,r|=s}identToString(e){let i=[];for(;e;)i.push(String.fromCharCode(255&e)),e>>=8;return i.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,i){let r=this._identifier(e,[48,126]);void 0===this._escHandlers[r]&&(this._escHandlers[r]=[]);let s=this._escHandlers[r];return s.push(i),{dispose:()=>{let e=s.indexOf(i);-1!==e&&s.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,i){this._executeHandlers[e.charCodeAt(0)]=i}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,i){let r=this._identifier(e);void 0===this._csiHandlers[r]&&(this._csiHandlers[r]=[]);let s=this._csiHandlers[r];return s.push(i),{dispose:()=>{let e=s.indexOf(i);-1!==e&&s.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,i){return this._dcsParser.registerHandler(this._identifier(e),i)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,i){return this._oscParser.registerHandler(e,i)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}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,0!==this._parseStack.state&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,i,r,s,n){this._parseStack.state=e,this._parseStack.handlers=i,this._parseStack.handlerPos=r,this._parseStack.transition=s,this._parseStack.chunkPos=n}parse(e,i,r){let s=0,n=0,o=0,a;if(this._parseStack.state)if(2===this._parseStack.state)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(void 0===r||1===this._parseStack.state)throw this._parseStack.state=1,Error("improper continuation due to previous async handler, giving up parsing");let i=this._parseStack.handlers,n=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===r&&n>-1){for(;n>=0&&!0!==(a=i[n](this._params));n--)if(a instanceof Promise)return this._parseStack.handlerPos=n,a}this._parseStack.handlers=[];break;case 4:if(!1===r&&n>-1){for(;n>=0&&!0!==(a=i[n]());n--)if(a instanceof Promise)return this._parseStack.handlerPos=n,a}this._parseStack.handlers=[];break;case 6:if(s=e[this._parseStack.chunkPos],a=this._dcsParser.unhook(24!==s&&26!==s,r))return a;27===s&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(s=e[this._parseStack.chunkPos],a=this._oscParser.end(24!==s&&26!==s,r))return a;27===s&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let r=o;r<i;++r){switch(s=e[r],(n=this._transitions.table[this.currentState<<8|(s<160?s:160)])>>4){case 2:for(let n=r+1;;++n)if(n>=i||(s=e[n])<32||s>126&&s<160||++n>=i||(s=e[n])<32||s>126&&s<160||++n>=i||(s=e[n])<32||s>126&&s<160||++n>=i||(s=e[n])<32||s>126&&s<160){this._printHandler(e,r,n),r=n-1;break}break;case 3:this._executeHandlers[s]?this._executeHandlers[s]():this._executeHandlerFb(s),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:r,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let o=this._csiHandlers[this._collect<<8|s],l=o?o.length-1:-1;for(;l>=0&&!0!==(a=o[l](this._params));l--)if(a instanceof Promise)return this._preserveStack(3,o,l,n,r),a;l<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0;break;case 8:do switch(s){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(s-48)}while(++r<i&&(s=e[r])>47&&s<60)r--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let h=this._escHandlers[this._collect<<8|s],c=h?h.length-1:-1;for(;c>=0&&!0!==(a=h[c]());c--)if(a instanceof Promise)return this._preserveStack(4,h,c,n,r),a;c<0&&this._escHandlerFb(this._collect<<8|s),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|s,this._params);break;case 13:for(let n=r+1;;++n)if(n>=i||24===(s=e[n])||26===s||27===s||s>127&&s<160){this._dcsParser.put(e,r,n),r=n-1;break}break;case 14:if(a=this._dcsParser.unhook(24!==s&&26!==s))return this._preserveStack(6,[],0,n,r),a;27===s&&(n|=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 n=r+1;;n++)if(n>=i||(s=e[n])<32||s>127&&s<160){this._oscParser.put(e,r,n),r=n-1;break}break;case 6:if(a=this._oscParser.end(24!==s&&26!==s))return this._preserveStack(5,[],0,n,r),a;27===s&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&n}}},s3=/^([\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})$/,s6=/^[\da-f]+$/;function s4(e){if(!e)return;let i=e.toLowerCase();if(0===i.indexOf("rgb:")){i=i.slice(4);let e=s3.exec(i);if(e){let i=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/i*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/i*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/i*255)]}}else if(0===i.indexOf("#")&&(i=i.slice(1),s6.exec(i)&&[3,6,9,12].includes(i.length))){let e=i.length/3,r=[0,0,0];for(let s=0;s<3;++s){let n=parseInt(i.slice(e*s,e*s+e),16);r[s]=1===e?n<<4:2===e?n:3===e?n>>4:n>>8}return r}}function s8(e,i){let r=e.toString(16),s=r.length<2?"0"+r:r;switch(i){case 4:return r[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}var s7={"(":0,")":1,"*":2,"+":3,"-":1,".":2};function s9(e,i){if(e>24)return i.setWinLines||!1;switch(e){case 1:return!!i.restoreWin;case 2:return!!i.minimizeWin;case 3:return!!i.setWinPosition;case 4:return!!i.setWinSizePixels;case 5:return!!i.raiseWin;case 6:return!!i.lowerWin;case 7:return!!i.refreshWin;case 8:return!!i.setWinSizeChars;case 9:return!!i.maximizeWin;case 10:return!!i.fullscreenWin;case 11:return!!i.getWinState;case 13:return!!i.getWinPosition;case 14:return!!i.getWinSizePixels;case 15:return!!i.getScreenSizePixels;case 16:return!!i.getCellSizePixels;case 18:return!!i.getWinSizeChars;case 19:return!!i.getScreenSizeChars;case 20:return!!i.getIconTitle;case 21:return!!i.getWinTitle;case 22:return!!i.pushTitle;case 23:return!!i.popTitle;case 24:return!!i.setWinLines}return!1}var ne=0,nt=class extends eZ{constructor(e,i,r,s,n,o,a,l,h=new s5){for(let c in super(),this._bufferService=e,this._charsetService=i,this._coreService=r,this._logService=s,this._optionsService=n,this._oscLinkService=o,this._coreMouseService=a,this._unicodeService=l,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new eh,this._utf8Decoder=new ec,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=sf.clone(),this._eraseAttrDataInternal=sf.clone(),this._onRequestBell=this._register(new to),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new to),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new to),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new to),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new to),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new to),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new to),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new to),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new to),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new to),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new to),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new to),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new to),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 ni(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,i)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(e),params:i.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug("Unknown EXECUTE code: ",{code:e})}),this._parser.setOscHandlerFallback((e,i,r)=>{this._logService.debug("Unknown OSC code: ",{identifier:e,action:i,data:r})}),this._parser.setDcsHandlerFallback((e,i,r)=>{"HOOK"===i&&(r=r.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(e),action:i,payload:r})}),this._parser.setPrintHandler((e,i,r)=>this.print(e,i,r)),this._parser.registerCsiHandler({final:"@"},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:"A"},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:"B"},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:"C"},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:"D"},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:"E"},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:"F"},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:"G"},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:"H"},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:"I"},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:"J"},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:"K"},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:"L"},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:"M"},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:"P"},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:"S"},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:"T"},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:"X"},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:"Z"},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:"a"},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:"b"},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:"c"},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:">",final:"c"},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:"d"},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:"e"},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:"f"},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:"g"},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:"h"},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"h"},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:"l"},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"l"},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:"m"},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:"n"},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:"?",final:"n"},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:"r"},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:"s"},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:"t"},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:"u"},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(iJ.BEL,()=>this.bell()),this._parser.setExecuteHandler(iJ.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(iJ.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(iJ.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(iJ.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(iJ.BS,()=>this.backspace()),this._parser.setExecuteHandler(iJ.HT,()=>this.tab()),this._parser.setExecuteHandler(iJ.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(iJ.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(iQ.IND,()=>this.index()),this._parser.setExecuteHandler(iQ.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(iQ.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new sG(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new sG(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new sG(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new sG(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new sG(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new sG(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new sG(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new sG(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new sG(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new sG(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new sG(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new sG(e=>this.restoreCursorColor(e))),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()),sm)this._parser.registerEscHandler({intermediates:"(",final:c},()=>this.selectCharset("("+c)),this._parser.registerEscHandler({intermediates:")",final:c},()=>this.selectCharset(")"+c)),this._parser.registerEscHandler({intermediates:"*",final:c},()=>this.selectCharset("*"+c)),this._parser.registerEscHandler({intermediates:"+",final:c},()=>this.selectCharset("+"+c)),this._parser.registerEscHandler({intermediates:"-",final:c},()=>this.selectCharset("-"+c)),this._parser.registerEscHandler({intermediates:".",final:c},()=>this.selectCharset("."+c)),this._parser.registerEscHandler({intermediates:"/",final:c},()=>this.selectCharset("/"+c));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error("Parsing error: ",e),e)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new s0((e,i)=>this.requestStatusString(e,i)))}getAttrData(){return this._curAttrData}_preserveStack(e,i,r,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=i,this._parseStack.decodedLength=r,this._parseStack.position=s}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),5e3))]).catch(e=>{if("#SLOW_TIMEOUT"!==e)throw e;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,i){let r,s=this._activeBuffer.x,n=this._activeBuffer.y,o=0,a=this._parseStack.paused;if(a){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,i))return this._logSlowResolvingAsync(r),r;s=this._parseStack.cursorStartX,n=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>131072&&(o=this._parseStack.position+131072)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${"string"==typeof e?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join("")}"`}`),0===this._logService.logLevel&&this._logService.trace("parsing data (codes)","string"==typeof e?e.split("").map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<131072&&(this._parseBuffer=new Uint32Array(Math.min(e.length,131072))),a||this._dirtyRowTracker.clearRange(),e.length>131072)for(let i=o;i<e.length;i+=131072){let o=i+131072<e.length?i+131072:e.length,a="string"==typeof e?this._stringDecoder.decode(e.substring(i,o),this._parseBuffer):this._utf8Decoder.decode(e.subarray(i,o),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,a))return this._preserveStack(s,n,a,i),this._logSlowResolvingAsync(r),r}else if(!a){let i="string"==typeof e?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,i))return this._preserveStack(s,n,i,0),this._logSlowResolvingAsync(r),r}(this._activeBuffer.x!==s||this._activeBuffer.y!==n)&&this._onCursorMove.fire();let l=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),h=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);h<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(h,this._bufferService.rows-1),end:Math.min(l,this._bufferService.rows-1)})}print(e,i,r){let s,n,o=this._charsetService.charset,a=this._optionsService.rawOptions.screenReaderMode,l=this._bufferService.cols,h=this._coreService.decPrivateModes.wraparound,c=this._coreService.modes.insertMode,d=this._curAttrData,u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-i>0&&2===u.getWidth(this._activeBuffer.x-1)&&u.setCellFromCodepoint(this._activeBuffer.x-1,0,1,d);let f=this._parser.precedingJoinState;for(let p=i;p<r;++p){if((s=e[p])<127&&o){let e=o[String.fromCharCode(s)];e&&(s=e.charCodeAt(0))}let i=this._unicodeService.charProperties(s,f);n=sK.extractWidth(i);let r=sK.extractShouldJoin(i),_=r?sK.extractWidth(f):0;if(f=i,a&&this._onA11yChar.fire(ea(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+n-_>l){if(h){let e=u,i=this._activeBuffer.x-_;for(this._activeBuffer.x=_,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),u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),_>0&&u instanceof s_&&u.copyCellsFrom(e,i,0,_,!1);i<l;)e.setCellFromCodepoint(i++,0,1,d)}else if(this._activeBuffer.x=l-1,2===n)continue}if(r&&this._activeBuffer.x){let e=u.getWidth(this._activeBuffer.x-1)?1:2;u.addCodepointToCell(this._activeBuffer.x-e,s,n);for(let e=n-_;--e>=0;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,d);continue}if(c&&(u.insertCells(this._activeBuffer.x,n-_,this._activeBuffer.getNullCell(d)),2===u.getWidth(l-1)&&u.setCellFromCodepoint(l-1,0,1,d)),u.setCellFromCodepoint(this._activeBuffer.x++,s,n,d),n>0)for(;--n;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,d)}this._parser.precedingJoinState=f,this._activeBuffer.x<l&&r-i>0&&0===u.getWidth(this._activeBuffer.x)&&!u.hasContent(this._activeBuffer.x)&&u.setCellFromCodepoint(this._activeBuffer.x,0,1,d),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,i){return"t"!==e.final||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,i):this._parser.registerCsiHandler(e,e=>!s9(e.params[0],this._optionsService.rawOptions.windowOptions)||i(e))}registerDcsHandler(e,i){return this._parser.registerDcsHandler(e,new s0(i))}registerEscHandler(e,i){return this._parser.registerEscHandler(e,i)}registerOscHandler(e,i){return this._parser.registerOscHandler(e,new sG(i))}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(0===this._activeBuffer.x&&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 e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,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(e,i){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+i):(this._activeBuffer.x=e,this._activeBuffer.y=i),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,i){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+i)}cursorUp(e){let i=this._activeBuffer.y-this._activeBuffer.scrollTop;return i>=0?this._moveCursor(0,-Math.min(i,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let i=this._activeBuffer.scrollBottom-this._activeBuffer.y;return i>=0?this._moveCursor(0,Math.min(i,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let i=e.params[0];return 0===i?delete this._activeBuffer.tabs[this._activeBuffer.x]:3===i&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let i=e.params[0]||1;for(;i--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let i=e.params[0]||1;for(;i--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let i=e.params[0];return 1===i&&(this._curAttrData.bg|=0x20000000),(2===i||0===i)&&(this._curAttrData.bg&=-0x20000001),!0}_eraseInBufferLine(e,i,r,s=!1,n=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(i,r,this._activeBuffer.getNullCell(this._eraseAttrData()),n),s&&(o.isWrapped=!1)}_resetBufferLine(e,i=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),i),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,i=!1){let r;switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,i);r<this._bufferService.rows;r++)this._resetBufferLine(r,i);this._dirtyRowTracker.markDirty(r);break;case 1:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r,0,this._activeBuffer.x+1,!0,i),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(r+1).isWrapped=!1);r--;)this._resetBufferLine(r,i);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(r=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,r-1);r--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+r)?.getTrimmedLength(););for(;r>=0;r--)this._bufferService.scroll(this._eraseAttrData())}else{for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,i);this._dirtyRowTracker.markDirty(0)}break;case 3:let s=this._activeBuffer.lines.length-this._bufferService.rows;s>0&&(this._activeBuffer.lines.trimStart(s),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-s,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-s,0),this._onScroll.fire(0))}return!0}eraseInLine(e,i=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,i);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,i);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,i)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let i=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;i--;)this._activeBuffer.lines.splice(n-1,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let i=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,s;for(s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-s;i--;)this._activeBuffer.lines.splice(r,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}insertChars(e){this._restrictCursor();let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return i&&(i.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return i&&(i.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let i=e.params[0]||1;for(;i--;)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(e){let i=e.params[0]||1;for(;i--;)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(sf));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r.deleteCells(0,i,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r.insertCells(0,i,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r.insertCells(this._activeBuffer.x,i,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r.deleteCells(this._activeBuffer.x,i,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return i&&(i.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let i=this._parser.precedingJoinState;if(!i)return!0;let r=e.params[0]||1,s=sK.extractWidth(i),n=this._activeBuffer.x-s,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(n),a=new Uint32Array(o.length*r),l=0;for(let e=0;e<o.length;){let i=o.codePointAt(e)||0;a[l++]=i,e+=i>65535?2:1}let h=l;for(let e=1;e<r;++e)a.copyWithin(h,0,l),h+=l;return this.print(a,0,h),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(iJ.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(iJ.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(iJ.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(iJ.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(iJ.ESC+"[>83;40003;0c")),!0}_is(e){return 0===(this._optionsService.rawOptions.termName+"").indexOf(e)}setMode(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,sS),this._charsetService.setgCharset(1,sS),this._charsetService.setgCharset(2,sS),this._charsetService.setgCharset(3,sS);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}return!0}resetMode(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),1049===e.params[i]&&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)}return!0}requestMode(e,i){let r,s,n,o;(s=r||={})[s.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",s[s.SET=1]="SET",s[s.RESET=2]="RESET",s[s.PERMANENTLY_SET=3]="PERMANENTLY_SET",s[s.PERMANENTLY_RESET=4]="PERMANENTLY_RESET";let a=this._coreService.decPrivateModes,{activeProtocol:l,activeEncoding:h}=this._coreMouseService,c=this._coreService,{buffers:d,cols:u}=this._bufferService,{active:f,alt:p}=d,_=this._optionsService.rawOptions,g=e=>e?1:2,v=e.params[0];return n=v,o=i?2===v?4:4===v?g(c.modes.insertMode):12===v?3:20===v?g(_.convertEol):0:1===v?g(a.applicationCursorKeys):3===v?_.windowOptions.setWinLines?80===u?2:+(132===u):0:6===v?g(a.origin):7===v?g(a.wraparound):8===v?3:9===v?g("X10"===l):12===v?g(_.cursorBlink):25===v?g(!c.isCursorHidden):45===v?g(a.reverseWraparound):66===v?g(a.applicationKeypad):67===v?4:1e3===v?g("VT200"===l):1002===v?g("DRAG"===l):1003===v?g("ANY"===l):1004===v?g(a.sendFocus):1005===v?4:1006===v?g("SGR"===h):1015===v?4:1016===v?g("SGR_PIXELS"===h):1048===v?1:47===v||1047===v||1049===v?g(f===p):2004===v?g(a.bracketedPasteMode):2026===v?g(a.synchronizedOutput):0,c.triggerDataEvent(`${iJ.ESC}[${i?"":"?"}${n};${o}$y`),!0}_updateAttrColor(e,i,r,s,n){return 2===i?(e|=0x3000000,e&=-0x1000000,e|=ed.fromColorRGB([r,s,n])):5===i&&(e&=-0x3000100,e|=0x2000000|255&r),e}_extractColor(e,i,r){let s=[0,0,-1,0,0,0],n=0,o=0;do{if(s[o+n]=e.params[i+o],e.hasSubParams(i+o)){let r=e.getSubParams(i+o),a=0;do 5===s[1]&&(n=1),s[o+a+1+n]=r[a];while(++a<r.length&&a+o+1+n<s.length)break}if(5===s[1]&&o+n>=2||2===s[1]&&o+n>=5)break;s[1]&&(n=1)}while(++o+i<e.length&&o+n<s.length)for(let e=2;e<s.length;++e)-1===s[e]&&(s[e]=0);switch(s[0]){case 38:r.fg=this._updateAttrColor(r.fg,s[1],s[3],s[4],s[5]);break;case 48:r.bg=this._updateAttrColor(r.bg,s[1],s[3],s[4],s[5]);break;case 58:r.extended=r.extended.clone(),r.extended.underlineColor=this._updateAttrColor(r.extended.underlineColor,s[1],s[3],s[4],s[5])}return o}_processUnderline(e,i){i.extended=i.extended.clone(),(!~e||e>5)&&(e=1),i.extended.underlineStyle=e,i.fg|=0x10000000,0===e&&(i.fg&=-0x10000001),i.updateExtended()}_processSGR0(e){e.fg=sf.fg,e.bg=sf.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-0x4000000,e.updateExtended()}charAttributes(e){if(1===e.length&&0===e.params[0])return this._processSGR0(this._curAttrData),!0;let i=e.length,r,s=this._curAttrData;for(let n=0;n<i;n++)(r=e.params[n])>=30&&r<=37?(s.fg&=-0x3000100,s.fg|=0x1000000|r-30):r>=40&&r<=47?(s.bg&=-0x3000100,s.bg|=0x1000000|r-40):r>=90&&r<=97?(s.fg&=-0x3000100,s.fg|=0x1000000|r-90|8):r>=100&&r<=107?(s.bg&=-0x3000100,s.bg|=0x1000000|r-100|8):0===r?this._processSGR0(s):1===r?s.fg|=0x8000000:3===r?s.bg|=0x4000000:4===r?(s.fg|=0x10000000,this._processUnderline(e.hasSubParams(n)?e.getSubParams(n)[0]:1,s)):5===r?s.fg|=0x20000000:7===r?s.fg|=0x4000000:8===r?s.fg|=0x40000000:9===r?s.fg|=0x80000000:2===r?s.bg|=0x8000000:21===r?this._processUnderline(2,s):22===r?(s.fg&=-0x8000001,s.bg&=-0x8000001):23===r?s.bg&=-0x4000001:24===r?(s.fg&=-0x10000001,this._processUnderline(0,s)):25===r?s.fg&=-0x20000001:27===r?s.fg&=-0x4000001:28===r?s.fg&=-0x40000001:29===r?s.fg&=0x7fffffff:39===r?(s.fg&=-0x4000000,s.fg|=0xffffff&sf.fg):49===r?(s.bg&=-0x4000000,s.bg|=0xffffff&sf.bg):38===r||48===r||58===r?n+=this._extractColor(e,n,s):53===r?s.bg|=0x40000000:55===r?s.bg&=-0x40000001:59===r?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):100===r?(s.fg&=-0x4000000,s.fg|=0xffffff&sf.fg,s.bg&=-0x4000000,s.bg|=0xffffff&sf.bg):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${iJ.ESC}[0n`);break;case 6:let i=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${iJ.ESC}[${i};${r}R`)}return!0}deviceStatusPrivate(e){if(6===e.params[0]){let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${iJ.ESC}[?${e};${i}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=sf.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(e){let i=0===e.length?1:e.params[0];if(0===i)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(i){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"}this._coreService.decPrivateModes.cursorBlink=i%2==1}return!0}setScrollRegion(e){let i=e.params[0]||1,r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||0===r)&&(r=this._bufferService.rows),r>i&&(this._activeBuffer.scrollTop=i-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!s9(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let i=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:2!==i&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${iJ.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(0===i||2===i)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),(0===i||1===i)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:(0===i||2===i)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(0===i||1===i)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){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(e){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(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let i=[],r=e.split(";");for(;r.length>1;){let e=r.shift(),s=r.shift();if(/^\d+$/.exec(e)){let r=parseInt(e);if(nr(r))if("?"===s)i.push({type:0,index:r});else{let e=s4(s);e&&i.push({type:1,index:r,color:e})}}}return i.length&&this._onColor.fire(i),!0}setHyperlink(e){let i=e.indexOf(";");if(-1===i)return!0;let r=e.slice(0,i).trim(),s=e.slice(i+1);return s?this._createHyperlink(r,s):!r.trim()&&this._finishHyperlink()}_createHyperlink(e,i){this._getCurrentLinkId()&&this._finishHyperlink();let r=e.split(":"),s,n=r.findIndex(e=>e.startsWith("id="));return -1!==n&&(s=r[n].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:i}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,i){let r=e.split(";");for(let e=0;e<r.length&&!(i>=this._specialColors.length);++e,++i)if("?"===r[e])this._onColor.fire([{type:0,index:this._specialColors[i]}]);else{let s=s4(r[e]);s&&this._onColor.fire([{type:1,index:this._specialColors[i],color:s}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let i=[],r=e.split(";");for(let e=0;e<r.length;++e)if(/^\d+$/.exec(r[e])){let s=parseInt(r[e]);nr(s)&&i.push({type:2,index:s})}return i.length&&this._onColor.fire(i),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){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,sS),!0}selectCharset(e){return 2!==e.length?this.selectDefaultCharset():"/"===e[0]||this._charsetService.setgCharset(s7[e[0]],sm[e[1]]||sS),!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 e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,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=sf.clone(),this._eraseAttrDataInternal=sf.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-0x4000000,this._eraseAttrDataInternal.bg|=0x3ffffff&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new ef;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let i=0;i<this._bufferService.rows;++i){let r=this._activeBuffer.ybase+this._activeBuffer.y+i,s=this._activeBuffer.lines.get(r);s&&(s.fill(e),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,i){let r=e=>(this._coreService.triggerDataEvent(`${iJ.ESC}${e}${iJ.ESC}\\`),!0),s=this._bufferService.buffer,n=this._optionsService.rawOptions;return r('"q'===e?`P1$r${+!!this._curAttrData.isProtected()}"q`:'"p'===e?'P1$r61;1"p':"r"===e?`P1$r${s.scrollTop+1};${s.scrollBottom+1}r`:"m"===e?"P1$r0m":" q"===e?`P1$r${({block:2,underline:4,bar:6})[n.cursorStyle]-!!n.cursorBlink} q`:"P0$r")}markRangeDirty(e,i){this._dirtyRowTracker.markRangeDirty(e,i)}},ni=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,i){e>i&&(ne=e,e=i,i=ne),e<this.start&&(this.start=e),i>this.end&&(this.end=i)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function nr(e){return 0<=e&&e<256}ni=ee([et(0,em)],ni);var ns=class extends eZ{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new to),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,i){let r;if(void 0!==i&&this._syncCalls>i){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,!this._isSyncWriting){for(this._isSyncWriting=!0;r=this._writeBuffer.shift();){this._action(r);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=0x7fffffff,this._isSyncWriting=!1,this._syncCalls=0}}write(e,i){if(this._pendingData>5e7)throw 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+=e.length,this._writeBuffer.push(e),this._callbacks.push(i),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i)}_innerWrite(e=0,i=!0){let r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],s=this._action(e,i);if(s){let e=e=>performance.now()-r>=12?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(r,e);s.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e);return}let n=this._callbacks[this._bufferOffset];if(n&&n(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-r>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},nn=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let i=this._bufferService.buffer;if(void 0===e.id){let r=i.addMarker(i.ybase+i.y),s={data:e,id:this._nextId++,lines:[r]};return r.onDispose(()=>this._removeMarkerFromLink(s,r)),this._dataByLinkId.set(s.id,s),s.id}let r=this._getEntryIdKey(e),s=this._entriesWithId.get(r);if(s)return this.addLineToLink(s.id,i.ybase+i.y),s.id;let n=i.addMarker(i.ybase+i.y),o={id:this._nextId++,key:this._getEntryIdKey(e),data:e,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(o,n)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,i){let r=this._dataByLinkId.get(e);if(r&&r.lines.every(e=>e.line!==i)){let e=this._bufferService.buffer.addMarker(i);r.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(r,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,i){let r=e.lines.indexOf(i);-1!==r&&(e.lines.splice(r,1),0===e.lines.length&&(void 0!==e.data.id&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};nn=ee([et(0,em)],nn);var no=!1,na=class extends eZ{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new eJ),this._onBinary=this._register(new to),this.onBinary=this._onBinary.event,this._onData=this._register(new to),this.onData=this._onData.event,this._onLineFeed=this._register(new to),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new to),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new to),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new to),this._instantiationService=new sh,this.optionsService=this._register(new sk(e)),this._instantiationService.setService(ex,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(sw)),this._instantiationService.setService(em,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(sd)),this._instantiationService.setService(eC,this._logService),this.coreService=this._register(this._instantiationService.createInstance(sT)),this._instantiationService.setService(ey,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(sN)),this._instantiationService.setService(eS,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(sK)),this._instantiationService.setService(eE,this.unicodeService),this._charsetService=this._instantiationService.createInstance(sU),this._instantiationService.setService(eb,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(nn),this._instantiationService.setService(ek,this._oscLinkService),this._inputHandler=this._register(new nt(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(e9.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(e9.forward(this._bufferService.onResize,this._onResize)),this._register(e9.forward(this.coreService.onData,this._onData)),this._register(e9.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 ns((e,i)=>this._inputHandler.parse(e,i))),this._register(e9.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new to),this._onScroll.event(e=>{this._onScrollApi?.fire(e.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(e){for(let i in e)this.optionsService.options[i]=e[i]}write(e,i){this._writeBuffer.write(e,i)}writeSync(e,i){this._logService.logLevel<=3&&!no&&(this._logService.warn("writeSync is unreliable and will be removed soon."),no=!0),this._writeBuffer.writeSync(e,i)}input(e,i=!0){this.coreService.triggerDataEvent(e,i)}resize(e,i){isNaN(e)||isNaN(i)||(e=Math.max(e,2),i=Math.max(i,1),this._bufferService.resize(e,i))}scroll(e,i=!1){this._bufferService.scroll(e,i)}scrollLines(e,i){this._bufferService.scrollLines(e,i)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;0!==i&&this.scrollLines(i)}registerEscHandler(e,i){return this._inputHandler.registerEscHandler(e,i)}registerDcsHandler(e,i){return this._inputHandler.registerDcsHandler(e,i)}registerCsiHandler(e,i){return this._inputHandler.registerCsiHandler(e,i)}registerOscHandler(e,i){return this._inputHandler.registerOscHandler(e,i)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,i=this.optionsService.rawOptions.windowsPty;i&&void 0!==i.buildNumber&&void 0!==i.buildNumber?e="conpty"===i.backend&&i.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(sY.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(sY(this._bufferService),!1))),this._windowsWrappingHeuristics.value=eX(()=>{for(let i of e)i.dispose()})}}},nl={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:["'",'"']},nh=0,nc=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new rG,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new rG,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(e){this._flushCleanupDeleted(),0===this._insertedValues.length&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,i)=>this._getKey(e)-this._getKey(i)),i=0,r=0,s=Array(this._array.length+this._insertedValues.length);for(let n=0;n<s.length;n++)r>=this._array.length||this._getKey(e[i])<=this._getKey(this._array[r])?(s[n]=e[i],i++):s[n]=this._array[r++];this._array=s,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),0===this._array.length)return!1;let i=this._getKey(e);if(void 0===i||-1===(nh=this._search(i))||this._getKey(this._array[nh])!==i)return!1;do if(this._array[nh]===e)return 0===this._deletedIndices.length&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(nh),!0;while(++nh<this._array.length&&this._getKey(this._array[nh])===i)return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,i)=>e-i),i=0,r=Array(this._array.length-e.length),s=0;for(let n=0;n<this._array.length;n++)e[i]===n?i++:r[s++]=this._array[n];this._array=r,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),0!==this._array.length&&!((nh=this._search(e))<0||nh>=this._array.length)&&this._getKey(this._array[nh])===e)do yield this._array[nh];while(++nh<this._array.length&&this._getKey(this._array[nh])===e)}forEachByKey(e,i){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),0!==this._array.length&&!((nh=this._search(e))<0||nh>=this._array.length)&&this._getKey(this._array[nh])===e)do i(this._array[nh]);while(++nh<this._array.length&&this._getKey(this._array[nh])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let i=0,r=this._array.length-1;for(;r>=i;){let s=i+r>>1,n=this._getKey(this._array[s]);if(n>e)r=s-1;else if(n<e)i=s+1;else{for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}}return i}},nd=0,nu=0,nf=class extends eZ{constructor(){super(),this._decorations=new nc(e=>e?.marker.line),this._onDecorationRegistered=this._register(new to),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new to),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(eX(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let i=new np(e);if(i){let e=i.marker.onDispose(()=>i.dispose()),r=i.onDispose(()=>{r.dispose(),i&&(this._decorations.delete(i)&&this._onDecorationRemoved.fire(i),e.dispose())});this._decorations.insert(i),this._onDecorationRegistered.fire(i)}return i}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,i,r){let s=0,n=0;for(let o of this._decorations.getKeyIterator(i))n=(s=o.options.x??0)+(o.options.width??1),e>=s&&e<n&&(!r||(o.options.layer??"bottom")===r)&&(yield o)}forEachDecorationAtCell(e,i,r,s){this._decorations.forEachByKey(i,i=>{nu=(nd=i.options.x??0)+(i.options.width??1),e>=nd&&e<nu&&(!r||(i.options.layer??"bottom")===r)&&s(i)})}},np=class extends eG{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new to),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new to),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return null===this._cachedBg&&(this.options.backgroundColor?this._cachedBg=sA.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return null===this._cachedFg&&(this.options.foregroundColor?this._cachedFg=sA.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},n_=class{constructor(e,i=1e3){this._renderCallback=e,this._debounceThresholdMS=i,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,i,r){this._rowCount=r,e=void 0!==e?e:0,i=void 0!==i?i:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,i):i;let s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=s-this._lastRefreshMs,i=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},i)}}_innerRefresh(){if(void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return;let e=Math.max(this._rowStart,0),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i)}},ng=class extends eZ{constructor(e,i,r,s){super(),this._terminal=e,this._coreBrowserService=r,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let n=this._coreBrowserService.mainDocument;this._accessibilityContainer=n.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=n.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,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=n.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new n_(this._renderRows.bind(this))),!this._terminal.element)throw Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
16
- `))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(id(n,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(eX(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let i=0;i<e;i++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
17
- `&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=er)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,i){this._liveRegionDebouncer.refresh(e,i,this._terminal.rows)}_renderRows(e,i){let r=this._terminal.buffer,s=r.lines.length.toString();for(let n=e;n<=i;n++){let e=r.lines.get(r.ydisp+n),i=[],o=e?.translateToString(!0,void 0,void 0,i)||"",a=(r.ydisp+n+1).toString(),l=this._rowElements[n];l&&(0===o.length?(l.textContent=" ",this._rowColumns.set(l,[0,1])):(l.textContent=o,this._rowColumns.set(l,i)),l.setAttribute("aria-posinset",a),l.setAttribute("aria-setsize",s),this._alignRowWidth(l))}this._announceCharacters()}_announceCharacters(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,i){let r,s,n=e.target,o=this._rowElements[0===i?1:this._rowElements.length-2];if(n.getAttribute("aria-posinset")!==(0===i?"1":`${this._terminal.buffer.lines.length}`)&&e.relatedTarget===o){if(0===i?(r=n,s=this._rowElements.pop(),this._rowContainer.removeChild(s)):(r=this._rowElements.shift(),s=n,this._rowContainer.removeChild(r)),r.removeEventListener("focus",this._topBoundaryFocusListener),s.removeEventListener("focus",this._bottomBoundaryFocusListener),0===i){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement("afterbegin",e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(0===i?-1:1),this._rowElements[0===i?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}}_handleSelectionChange(){if(0===this._rowElements.length)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode)return void console.error("anchorNode and/or focusNode are null");let i={node:e.anchorNode,offset:e.anchorOffset},r={node:e.focusNode,offset:e.focusOffset};if((i.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||i.node===r.node&&i.offset>r.offset)&&([i,r]=[r,i]),i.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(i={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(i.node))return;let s=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:s,offset:s.textContent?.length??0}),!this._rowContainer.contains(r.node))return;let n=({node:e,offset:i})=>{let r=e instanceof Text?e.parentNode:e,s=parseInt(r?.getAttribute("aria-posinset"),10)-1;if(isNaN(s))return console.warn("row is invalid. Race condition?"),null;let n=this._rowColumns.get(r);if(!n)return console.warn("columns is null. Race condition?"),null;let o=i<n.length?n[i]:n.slice(-1)[0]+1;return o>=this._terminal.cols&&(++s,o=0),{row:s,column:o}},o=n(i),a=n(r);if(!(!o||!a)){if(o.row>a.row||o.row===a.row&&o.column>=a.column)throw Error("invalid range");this._terminal.select(o.column,o.row,(a.row-o.row)*this._terminal.cols-o.column+a.column)}}_handleResize(e){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>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_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 e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform="";let i=e.getBoundingClientRect().width,r=this._rowColumns.get(e)?.slice(-1)?.[0];if(!r)return;let s=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${s/i})`}};ng=ee([et(1,ew),et(2,eP),et(3,eR)],ng);var nv=class extends eZ{constructor(e,i,r,s,n){super(),this._element=e,this._mouseService=i,this._renderService=r,this._bufferService=s,this._linkProviderService=n,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new to),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new to),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(eX(()=>{eq(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(id(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(id(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(id(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(id(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let i=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!i)return;this._isMouseOut=!1;let r=e.composedPath();for(let e=0;e<r.length;e++){let i=r[e];if(i.classList.contains("xterm"))break;if(i.classList.contains("xterm-hover"))return}this._lastBufferCell&&i.x===this._lastBufferCell.x&&i.y===this._lastBufferCell.y||(this._handleHover(i),this._lastBufferCell=i)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,i){this._activeProviderReplies&&i||(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[s,n]of this._linkProviderService.linkProviders.entries())i?this._activeProviderReplies?.get(s)&&(r=this._checkLinkProviderResult(s,e,r)):n.provideLinks(e.y,i=>{if(this._isMouseOut)return;let n=i?.map(e=>({link:e}));this._activeProviderReplies?.set(s,n),r=this._checkLinkProviderResult(s,e,r),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,i){let r=new Set;for(let s=0;s<i.size;s++){let n=i.get(s);if(n)for(let i=0;i<n.length;i++){let s=n[i],o=s.link.range.start.y<e?0:s.link.range.start.x,a=s.link.range.end.y>e?this._bufferService.cols:s.link.range.end.x;for(let e=o;e<=a;e++){if(r.has(e)){n.splice(i--,1);break}r.add(e)}}}}_checkLinkProviderResult(e,i,r){if(!this._activeProviderReplies)return r;let s=this._activeProviderReplies.get(e),n=!1;for(let i=0;i<e;i++)(!this._activeProviderReplies.has(i)||this._activeProviderReplies.get(i))&&(n=!0);if(!n&&s){let e=s.find(e=>this._linkAtPosition(e.link,i));e&&(r=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let e=0;e<this._activeProviderReplies.size;e++){let s=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,i));if(s){r=!0,this._handleNewLink(s);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){var i,r;if(!this._currentLink)return;let s=this._positionFromMouseEvent(e,this._element,this._mouseService);s&&this._mouseDownLink&&(i=this._mouseDownLink.link,r=this._currentLink.link,i.text===r.text&&i.range.start.x===r.range.start.x&&i.range.start.y===r.range.start.y&&i.range.end.x===r.range.end.x&&i.range.end.y===r.range.end.y)&&this._linkAtPosition(this._currentLink.link,s)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,i){this._currentLink&&this._lastMouseEvent&&(!e||!i||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=i)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,eq(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(e.link,i)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:i=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let i=0===e.start?0:e.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(i,r),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,i,r){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),i.hover&&i.hover(r,i.text)}_fireUnderlineEvent(e,i){let r=e.range,s=this._bufferService.buffer.ydisp,n=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-s-1,r.end.x,r.end.y-s-1,void 0);(i?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(n)}_linkLeave(e,i,r){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),i.leave&&i.leave(r,i.text)}_linkAtPosition(e,i){let r=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,n=i.y*this._bufferService.cols+i.x;return r<=n&&n<=s}_positionFromMouseEvent(e,i,r){let s=r.getCoords(e,i,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,i,r,s,n){return{x1:e,y1:i,x2:r,y2:s,cols:this._bufferService.cols,fg:n}}};nv=ee([et(1,eI),et(2,eR),et(3,em),et(4,eB)],nv);var nm=class extends na{constructor(e={}){super(e),this._linkifier=this._register(new eJ),this.browser=rI,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new eJ),this._onCursorMove=this._register(new to),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new to),this.onKey=this._onKey.event,this._onRender=this._register(new to),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new to),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new to),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new to),this.onBell=this._onBell.event,this._onFocus=this._register(new to),this._onBlur=this._register(new to),this._onA11yCharEmitter=this._register(new to),this._onA11yTabEmitter=this._register(new to),this._onWillOpen=this._register(new to),this._setup(),this._decorationService=this._instantiationService.createInstance(nf),this._instantiationService.setService(eD,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(rD),this._instantiationService.setService(eB,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(eO)),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(e9.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(e9.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(e9.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(e9.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(eX(()=>{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(e){if(this._themeService)for(let i of e){let e,r="";switch(i.index){case 256:e="foreground",r="10";break;case 257:e="background",r="11";break;case 258:e="cursor",r="12";break;default:e="ansi",r="4;"+i.index}switch(i.type){case 0:let s=sB.toColorRGB("ansi"===e?this._themeService.colors.ansi[i.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${iJ.ESC}]${r};${function(e,i=16){let[r,s,n]=e;return`rgb:${s8(r,i)}/${s8(s,i)}/${s8(n,i)}`}(s)}${i0.ST}`);break;case 1:if("ansi"===e)this._themeService.modifyColors(e=>e.ansi[i.index]=i1.toColor(...i.color));else{let r=e;this._themeService.modifyColors(e=>e[r]=i1.toColor(...i.color))}break;case 2:this._themeService.restoreColor(i.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(ng,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(iJ.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(iJ.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,i=this.buffer.lines.get(e);if(!i)return;let r=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,n=i.getWidth(r),o=this._renderService.dimensions.css.cell.width*n,a=this.buffer.y*this._renderService.dimensions.css.cell.height,l=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=l+"px",this.textarea.style.top=a+"px",this.textarea.style.width=o+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(id(this.element,"copy",e=>{var i;this.hasSelection()&&(i=this._selectionService,e.clipboardData&&e.clipboardData.setData("text/plain",i.selectionText),e.preventDefault())}));let e=e=>{var i,r,s;return i=this.textarea,r=this.coreService,s=this.optionsService,void(e.stopPropagation(),e.clipboardData&&es(e.clipboardData.getData("text/plain"),i,r,s))};this._register(id(this.textarea,"paste",e)),this._register(id(this.element,"paste",e)),rA?this._register(id(this.element,"mousedown",e=>{2===e.button&&eo(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(id(this.element,"contextmenu",e=>{eo(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),rU&&this._register(id(this.element,"auxclick",e=>{1===e.button&&en(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(id(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(id(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(id(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(id(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(id(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(id(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(id(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error("Terminal requires a parent element.");if(e.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=e.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"),e.appendChild(this.element);let i=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),i.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(id(this.screenElement,"mousemove",e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),i.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",ei),rY||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",()=>r.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(rk,this.textarea,e.ownerDocument.defaultView??window,this._document??"u">typeof window?window.document:null)),this._instantiationService.setService(eP,this._coreBrowserService),this._register(id(this.textarea,"focus",e=>this._handleTextAreaFocus(e))),this._register(id(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(rb,this._document,this._helperContainer),this._instantiationService.setService(eT,this._charSizeService),this._themeService=this._instantiationService.createInstance(so),this._instantiationService.setService(eL,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(ra),this._instantiationService.setService(eN,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(rJ,this.rows,this.screenElement)),this._instantiationService.setService(eR,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(iY,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(rT),this._instantiationService.setService(eI,this._mouseService);let s=this._linkifier.value=this._register(this._instantiationService.createInstance(nv,this.screenElement));this.element.appendChild(i);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(iH,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(r7,this.element,this.screenElement,s)),this._instantiationService.setService(eM,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(e9.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(iW,this.screenElement)),this._register(id(this.element,"mousedown",e=>this._selectionService.handleMouseDown(e))),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(ng,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(iU,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(iU,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(ry,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,i=this.element;function r(i){let r,s,n=e._mouseService.getMouseReportCoords(i,e.screenElement);if(!n)return!1;switch(i.overrideType||i.type){case"mousemove":s=32,void 0===i.buttons?(r=3,void 0!==i.button&&(r=i.button<3?i.button:3)):r=1&i.buttons?0:4&i.buttons?1:2&i.buttons?2:3;break;case"mouseup":s=0,r=i.button<3?i.button:3;break;case"mousedown":s=1,r=i.button<3?i.button:3;break;case"wheel":if(e._customWheelEventHandler&&!1===e._customWheelEventHandler(i))return!1;let o=i.deltaY;if(0===o||0===e.coreMouseService.consumeWheelEvent(i,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr))return!1;s=o<0?0:1,r=4;break;default:return!1}return void 0!==s&&void 0!==r&&!(r>4)&&e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:s,ctrl:i.ctrlKey,alt:i.altKey,shift:i.shiftKey})}let s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},n=e=>(r(e),e.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)),this.cancel(e)),o=e=>(r(e),this.cancel(e,!0)),a=e=>{e.buttons&&r(e)},l=e=>{e.buttons||r(e)};this._register(this.coreMouseService.onProtocolChange(e=>{e?("debug"===this.optionsService.rawOptions.logLevel&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(e)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&e?s.mousemove||(i.addEventListener("mousemove",l),s.mousemove=l):(i.removeEventListener("mousemove",s.mousemove),s.mousemove=null),16&e?s.wheel||(i.addEventListener("wheel",o,{passive:!1}),s.wheel=o):(i.removeEventListener("wheel",s.wheel),s.wheel=null),2&e?s.mouseup||(s.mouseup=n):(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),4&e?s.mousedrag||(s.mousedrag=a):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(id(i,"mousedown",e=>{if(e.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(e)))return r(e),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag),this.cancel(e)})),this._register(id(i,"wheel",i=>{if(!s.wheel){if(this._customWheelEventHandler&&!1===this._customWheelEventHandler(i))return!1;if(!this.buffer.hasScrollback){if(0===i.deltaY)return!1;if(0===e.coreMouseService.consumeWheelEvent(i,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr))return this.cancel(i,!0);let r=iJ.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(i.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(r,!0),this.cancel(i,!0)}}},{passive:!1}))}refresh(e,i){this._renderService?.refreshRows(e,i)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?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(e,i){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,i),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;0!==i&&this.scrollLines(i)}paste(e){es(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error("Terminal must be opened first");let i=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),i}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(e,i,r){this._selectionService.setSelection(e,i,r)}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(e,i){this._selectionService?.selectLines(e,i)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;let i=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!i&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;i||"Dead"!==e.key&&"AltGraph"!==e.key||(this._unprocessedDeadKey=!0);let r=function(e,i,r,s){let n={type:0,cancel:!1,key:void 0},o=!!e.shiftKey|2*!!e.altKey|4*!!e.ctrlKey|8*!!e.metaKey;switch(e.keyCode){case 0:"UIKeyInputUpArrow"===e.key?i?n.key=iJ.ESC+"OA":n.key=iJ.ESC+"[A":"UIKeyInputLeftArrow"===e.key?i?n.key=iJ.ESC+"OD":n.key=iJ.ESC+"[D":"UIKeyInputRightArrow"===e.key?i?n.key=iJ.ESC+"OC":n.key=iJ.ESC+"[C":"UIKeyInputDownArrow"===e.key&&(i?n.key=iJ.ESC+"OB":n.key=iJ.ESC+"[B");break;case 8:n.key=e.ctrlKey?"\b":iJ.DEL,e.altKey&&(n.key=iJ.ESC+n.key);break;case 9:if(e.shiftKey){n.key=iJ.ESC+"[Z";break}n.key=iJ.HT,n.cancel=!0;break;case 13:n.key=e.altKey?iJ.ESC+iJ.CR:iJ.CR,n.cancel=!0;break;case 27:n.key=iJ.ESC,e.altKey&&(n.key=iJ.ESC+iJ.ESC),n.cancel=!0;break;case 37:if(e.metaKey)break;o?n.key=iJ.ESC+"[1;"+(o+1)+"D":i?n.key=iJ.ESC+"OD":n.key=iJ.ESC+"[D";break;case 39:if(e.metaKey)break;o?n.key=iJ.ESC+"[1;"+(o+1)+"C":i?n.key=iJ.ESC+"OC":n.key=iJ.ESC+"[C";break;case 38:if(e.metaKey)break;o?n.key=iJ.ESC+"[1;"+(o+1)+"A":i?n.key=iJ.ESC+"OA":n.key=iJ.ESC+"[A";break;case 40:if(e.metaKey)break;o?n.key=iJ.ESC+"[1;"+(o+1)+"B":i?n.key=iJ.ESC+"OB":n.key=iJ.ESC+"[B";break;case 45:e.shiftKey||e.ctrlKey||(n.key=iJ.ESC+"[2~");break;case 46:o?n.key=iJ.ESC+"[3;"+(o+1)+"~":n.key=iJ.ESC+"[3~";break;case 36:o?n.key=iJ.ESC+"[1;"+(o+1)+"H":i?n.key=iJ.ESC+"OH":n.key=iJ.ESC+"[H";break;case 35:o?n.key=iJ.ESC+"[1;"+(o+1)+"F":i?n.key=iJ.ESC+"OF":n.key=iJ.ESC+"[F";break;case 33:e.shiftKey?n.type=2:e.ctrlKey?n.key=iJ.ESC+"[5;"+(o+1)+"~":n.key=iJ.ESC+"[5~";break;case 34:e.shiftKey?n.type=3:e.ctrlKey?n.key=iJ.ESC+"[6;"+(o+1)+"~":n.key=iJ.ESC+"[6~";break;case 112:o?n.key=iJ.ESC+"[1;"+(o+1)+"P":n.key=iJ.ESC+"OP";break;case 113:o?n.key=iJ.ESC+"[1;"+(o+1)+"Q":n.key=iJ.ESC+"OQ";break;case 114:o?n.key=iJ.ESC+"[1;"+(o+1)+"R":n.key=iJ.ESC+"OR";break;case 115:o?n.key=iJ.ESC+"[1;"+(o+1)+"S":n.key=iJ.ESC+"OS";break;case 116:o?n.key=iJ.ESC+"[15;"+(o+1)+"~":n.key=iJ.ESC+"[15~";break;case 117:o?n.key=iJ.ESC+"[17;"+(o+1)+"~":n.key=iJ.ESC+"[17~";break;case 118:o?n.key=iJ.ESC+"[18;"+(o+1)+"~":n.key=iJ.ESC+"[18~";break;case 119:o?n.key=iJ.ESC+"[19;"+(o+1)+"~":n.key=iJ.ESC+"[19~";break;case 120:o?n.key=iJ.ESC+"[20;"+(o+1)+"~":n.key=iJ.ESC+"[20~";break;case 121:o?n.key=iJ.ESC+"[21;"+(o+1)+"~":n.key=iJ.ESC+"[21~";break;case 122:o?n.key=iJ.ESC+"[23;"+(o+1)+"~":n.key=iJ.ESC+"[23~";break;case 123:o?n.key=iJ.ESC+"[24;"+(o+1)+"~":n.key=iJ.ESC+"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if((!r||s)&&e.altKey&&!e.metaKey){let i=nl[e.keyCode]?.[+!!e.shiftKey];if(i)n.key=iJ.ESC+i;else if(e.keyCode>=65&&e.keyCode<=90){let i=String.fromCharCode(e.ctrlKey?e.keyCode-64:e.keyCode+32);e.shiftKey&&(i=i.toUpperCase()),n.key=iJ.ESC+i}else if(32===e.keyCode)n.key=iJ.ESC+(e.ctrlKey?iJ.NUL:" ");else if("Dead"===e.key&&e.code.startsWith("Key")){let i=e.code.slice(3,4);e.shiftKey||(i=i.toLowerCase()),n.key=iJ.ESC+i,n.cancel=!0}}else!r||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?!e.key||e.ctrlKey||e.altKey||e.metaKey||!(e.keyCode>=48)||1!==e.key.length?e.key&&e.ctrlKey&&("_"===e.key&&(n.key=iJ.US),"@"===e.key&&(n.key=iJ.NUL)):n.key=e.key:65===e.keyCode&&(n.type=1);else e.keyCode>=65&&e.keyCode<=90?n.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?n.key=iJ.NUL:e.keyCode>=51&&e.keyCode<=55?n.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?n.key=iJ.DEL:219===e.keyCode?n.key=iJ.ESC:220===e.keyCode?n.key=iJ.FS:221===e.keyCode&&(n.key=iJ.GS)}return n}(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),3===r.type||2===r.type){let i=this.rows-1;return this.scrollLines(2===r.type?-i:i),this.cancel(e,!0)}return 1===r.type&&this.selectAll(),!!(this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&1===e.key.length&&e.key.charCodeAt(0)>=65&&90>=e.key.charCodeAt(0))||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):((r.key===iJ.ETX||r.key===iJ.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)?this.cancel(e,!0):void(this._keyDownHandled=!0))}_isThirdLevelShift(e,i){let r=e.isMac&&!this.options.macOptionIsMeta&&i.altKey&&!i.ctrlKey&&!i.metaKey||e.isWindows&&i.altKey&&i.ctrlKey&&!i.metaKey||e.isWindows&&i.getModifierState("AltGraph");return"keypress"===i.type?r:r&&(!i.keyCode||i.keyCode>47)}_keyUp(e){var i;this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(16===(i=e).keyCode||17===i.keyCode||18===i.keyCode||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let i;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)i=e.charCode;else if(null===e.which||void 0===e.which)i=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;i=e.which}return!!i&&(!e.altKey&&!e.ctrlKey&&!e.metaKey||!!this._isThirdLevelShift(this.browser,e))&&(i=String.fromCharCode(i),this._onKey.fire({key:i,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&"insertText"===e.inputType&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let i=e.data;return this.coreService.triggerDataEvent(i,!0),this.cancel(e),!0}return!1}resize(e,i){if(e===this.cols&&i===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,i)}_afterResize(e,i){this._charSizeService?.measure()}clear(){if(0!==this.buffer.ybase||0!==this.buffer.y){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 e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(sf));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 e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(iJ.ESC+"[I"):this.coreService.triggerDataEvent(iJ.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let i=this._renderService.dimensions.css.canvas.width.toFixed(0),r=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${iJ.ESC}[4;${r};${i}t`);break;case 1:let s=this._renderService.dimensions.css.cell.width.toFixed(0),n=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${iJ.ESC}[6;${n};${s}t`)}}cancel(e,i){if(!(!this.options.cancelEvents&&!i))return e.preventDefault(),e.stopPropagation(),!1}},nS=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,i){let r={instance:i,dispose:i.dispose,isDisposed:!1};this._addons.push(r),i.dispose=()=>this._wrappedAddonDispose(r),i.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let i=-1;for(let r=0;r<this._addons.length;r++)if(this._addons[r]===e){i=r;break}if(-1===i)throw Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(i,1)}},ny=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,i){if(!(e<0||e>=this._line.length))return i?(this._line.loadCell(e,i),i):this._line.loadCell(e,new ef)}translateToString(e,i,r){return this._line.translateToString(e,i,r)}},nb=class{constructor(e,i){this._buffer=e,this.type=i}init(e){return this._buffer=e,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(e){let i=this._buffer.lines.get(e);if(i)return new ny(i)}getNullCell(){return new ef}},nw=class extends eZ{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new to),this.onBufferChange=this._onBufferChange.event,this._normal=new nb(this._core.buffers.normal,"normal"),this._alternate=new nb(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 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)}},nC=class{constructor(e){this._core=e}registerCsiHandler(e,i){return this._core.registerCsiHandler(e,e=>i(e.toArray()))}addCsiHandler(e,i){return this.registerCsiHandler(e,i)}registerDcsHandler(e,i){return this._core.registerDcsHandler(e,(e,r)=>i(e,r.toArray()))}addDcsHandler(e,i){return this.registerDcsHandler(e,i)}registerEscHandler(e,i){return this._core.registerEscHandler(e,i)}addEscHandler(e,i){return this.registerEscHandler(e,i)}registerOscHandler(e,i){return this._core.registerOscHandler(e,i)}addOscHandler(e,i){return this.registerOscHandler(e,i)}},nx=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},nk=["cols","rows"],nE=0,nD=class extends eZ{constructor(e){super(),this._core=this._register(new nm(e)),this._addonManager=this._register(new nS),this._publicOptions={...this._core.options};let i=e=>this._core.options[e],r=(e,i)=>{this._checkReadonlyOptions(e),this._core.options[e]=i};for(let e in this._core.options){let s={get:i.bind(this,e),set:r.bind(this,e)};Object.defineProperty(this._publicOptions,e,s)}}_checkReadonlyOptions(e){if(nk.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw 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 nC(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new nx(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 nw(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,i="none";switch(this._core.coreMouseService.activeProtocol){case"X10":i="x10";break;case"VT200":i="vt200";break;case"DRAG":i="drag";break;case"ANY":i="any"}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:i,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let i in e)this._publicOptions[i]=e[i]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,i=!0){this._core.input(e,i)}resize(e,i){this._verifyIntegers(e,i),this._core.resize(e,i)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,i,r){this._verifyIntegers(e,i,r),this._core.select(e,i,r)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,i){this._verifyIntegers(e,i),this._core.selectLines(e,i)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,i){this._core.write(e,i)}writeln(e,i){this._core.write(e),this._core.write(`\r
18
- `,i)}paste(e){this._core.paste(e)}refresh(e,i){this._verifyIntegers(e,i),this._core.refresh(e,i)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return ei},set promptLabel(t){ei=t},get tooMuchOutput(){return er},set tooMuchOutput(t){er=t}}}_verifyIntegers(...e){for(nE of e)if(nE===1/0||isNaN(nE)||nE%1!=0)throw Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(nE of e)if(nE&&(nE===1/0||isNaN(nE)||nE%1!=0||nE<0))throw Error("This API only accepts positive integers")}},nO=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let i=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(i._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(0===e.css.cell.width||0===e.css.cell.height)return;let i=0===this._terminal.options.scrollback?0:this._terminal.options.overviewRuler?.width||14,r=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(r.getPropertyValue("height")),n=Math.max(0,parseInt(r.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),a={top:parseInt(o.getPropertyValue("padding-top")),bottom:parseInt(o.getPropertyValue("padding-bottom")),right:parseInt(o.getPropertyValue("padding-right")),left:parseInt(o.getPropertyValue("padding-left"))},l=a.top+a.bottom;return{cols:Math.max(2,Math.floor((n-(a.right+a.left)-i)/e.css.cell.width)),rows:Math.max(1,Math.floor((s-l)/e.css.cell.height))}}},nT=class{constructor(e,i,r,s={}){this._terminal=e,this._regex=i,this._handler=r,this._options=s}provideLinks(e,i){let r=nP.computeLink(e,this._regex,this._terminal,this._handler);i(this._addCallbacks(r))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(i,r)=>{if(this._options.hover){let{range:s}=e;this._options.hover(i,r,s)}},e))}},nP=class e{static computeLink(i,r,s,n){let o=RegExp(r.source,(r.flags||"")+"g"),[a,l]=e._getWindowedLineStrings(i-1,s),h=a.join(""),c,d=[];for(;c=o.exec(h);){let i=c[0];if(!function(e){try{let i=new URL(e),r=i.password&&i.username?`${i.protocol}//${i.username}:${i.password}@${i.host}`:i.username?`${i.protocol}//${i.username}@${i.host}`:`${i.protocol}//${i.host}`;return e.toLocaleLowerCase().startsWith(r.toLocaleLowerCase())}catch{return!1}}(i))continue;let[r,o]=e._mapStrIdx(s,l,0,c.index),[a,h]=e._mapStrIdx(s,r,o,i.length);if(-1===r||-1===o||-1===a||-1===h)continue;let u={start:{x:o+1,y:r+1},end:{x:h,y:a+1}};d.push({range:u,text:i,activate:n})}return d}static _getWindowedLineStrings(e,i){let r,s=e,n=e,o=0,a="",l=[];if(r=i.buffer.active.getLine(e)){let e=r.translateToString(!0);if(r.isWrapped&&" "!==e[0]){for(o=0;(r=i.buffer.active.getLine(--s))&&o<2048&&(o+=(a=r.translateToString(!0)).length,l.push(a),!(!r.isWrapped||-1!==a.indexOf(" "))););l.reverse()}for(l.push(e),o=0;(r=i.buffer.active.getLine(++n))&&r.isWrapped&&o<2048&&(o+=(a=r.translateToString(!0)).length,l.push(a),-1===a.indexOf(" ")););}return[l,s]}static _mapStrIdx(e,i,r,s){let n=e.buffer.active,o=n.getNullCell(),a=r;for(;s;){let e=n.getLine(i);if(!e)return[-1,-1];for(let r=a;r<e.length;++r){e.getCell(r,o);let a=o.getChars();if(o.getWidth()&&(s-=a.length||1,r===e.length-1&&""===a)){let e=n.getLine(i+1);e&&e.isWrapped&&(e.getCell(0,o),2===o.getWidth()&&(s+=1))}if(s<0)return[i,r]}i++,a=0}return[i,a]}},nI=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function nR(e,i){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}var nM=class{constructor(e=nR,i={}){this._handler=e,this._options=i}activate(e){this._terminal=e;let i=this._options,r=i.urlRegex||nI;this._linkProvider=this._terminal.registerLinkProvider(new nT(this._terminal,r,this._handler,i))}dispose(){this._linkProvider?.dispose()}};let nN={background:"#0b0d10",foreground:"#e5e7eb",cursor:"#e5e7eb",cursorAccent:"#0b0d10",selectionBackground:"#3b82f680",black:"#1f2937",red:"#ef4444",green:"#22c55e",yellow:"#eab308",blue:"#3b82f6",magenta:"#a855f7",cyan:"#06b6d4",white:"#e5e7eb",brightBlack:"#4b5563",brightRed:"#f87171",brightGreen:"#4ade80",brightYellow:"#facc15",brightBlue:"#60a5fa",brightMagenta:"#c084fc",brightCyan:"#22d3ee",brightWhite:"#f9fafb"};function nL({cwd:e,className:i}){let r=(0,R.useRef)(null),s=(0,R.useRef)(null),n=(0,R.useRef)(null),o=(0,R.useRef)(null),a=(0,R.useRef)(null),[l,h]=(0,R.useState)("initializing"),[c,d]=(0,R.useState)(null);return(0,R.useEffect)(()=>{if(!r.current)return;let i=!1,l=new nD({cursorBlink:!0,fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace',fontSize:13,lineHeight:1.2,theme:nN,allowProposedApi:!0,scrollback:5e3,convertEol:!0}),c=new nO;l.loadAddon(c),l.loadAddon(new nM),l.open(r.current),s.current=l,n.current=c;try{c.fit()}catch{}(async()=>{try{let r=await fetch("/api/terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e,cols:l.cols,rows:l.rows})});if(!r.ok){let e=await r.json().catch(()=>({error:r.statusText}));throw Error(e.error??`HTTP ${r.status}`)}let s=await r.json();if(i)return;o.current=s.sessionId;let n=new EventSource(`/api/terminal/${s.sessionId}/stream`);a.current=n,n.addEventListener("data",e=>{try{let i=JSON.parse(e.data);l.write(i.data)}catch{}}),n.addEventListener("exit",e=>{try{let i=JSON.parse(e.data);l.writeln(""),l.writeln(`\x1b[90m[process exited with code ${i.code??"null"}]\x1b[0m`)}catch{l.writeln("\x1b[90m[process exited]\x1b[0m")}h("exited"),n.close(),a.current=null}),n.onopen=()=>{i||h("connected")},n.onerror=()=>{i||h(e=>"initializing"===e?(d("Failed to connect to terminal stream"),"error"):e)},l.onData(e=>{let i=o.current;i&&fetch(`/api/terminal/${i}/input`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:e})}).catch(()=>{})});let c=null;l.onResize(({cols:e,rows:i})=>{let r=o.current;r&&(c&&clearTimeout(c),c=setTimeout(()=>{fetch(`/api/terminal/${r}/resize`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cols:e,rows:i})}).catch(()=>{})},50))})}catch(e){if(i)return;h("error"),d(e instanceof Error?e.message:String(e)),l.writeln(`\x1b[31m[terminal error: ${e instanceof Error?e.message:String(e)}]\x1b[0m`)}})();let u=new ResizeObserver(()=>{try{c.fit()}catch{}});return u.observe(r.current),()=>{i=!0,u.disconnect();let e=a.current;e&&(e.close(),a.current=null);let r=o.current;r&&(fetch(`/api/terminal/${r}`,{method:"DELETE",keepalive:!0}).catch(()=>{}),o.current=null);try{l.dispose()}catch{}s.current=null,n.current=null}},[e]),(0,I.jsxs)("div",{className:`relative flex min-h-0 flex-1 flex-col bg-[#0b0d10] ${i??""}`,children:["error"===l&&null!==c&&(0,I.jsx)("div",{className:"absolute top-2 left-2 z-10 rounded border border-red-500/40 bg-red-950/80 px-2 py-1 text-[11px] text-red-200",role:"alert",children:c}),(0,I.jsx)("div",{ref:r,className:"min-h-0 flex-1 px-2 py-2"})]})}let nB=(0,B.default)("panel-right-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);var nA=e.i(56032);let nj=(0,R.createContext)(null);function nH(){let e=(0,R.useContext)(nj);if(null===e)throw Error("No Tree Api Provided");return e}let nW=(0,R.createContext)(null),nz=(0,R.createContext)(null),nF=(0,R.createContext)(0);function n$(){(0,R.useContext)(nF)}function nK(e,i,r){return Math.max(Math.min(e,r),i)}function nU(e){return e&&e.isLeaf}function nY(e){return e&&e.isInternal&&!e.isOpen}function nq(e){var i;return e&&e.isOpen&&!(null==(i=e.children)?void 0:i.length)}let nX=e=>{if(!e.parent)throw Error("Node does not have a parent");return e.parent.children.findIndex(i=>i.id===e.id)};function nV(){}function nG(e){let i,r=nJ(e);for(let o=0;o<r.length;++o)if(r[o]===e){var s,n;s=r,i=(n=o)+1<s.length?s[n+1]:s[0];break}null==i||i.focus()}function nZ(e){let i,r=nJ(e);for(let o=0;o<r.length;++o)if(r[o]===e){var s,n;s=r,i=(n=o)-1>=0?s[n-1]:s[s.length-1];break}null==i||i.focus()}function nJ(e){return Array.from(document.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), details:not([disabled]), summary:not(:disabled)')).filter(i=>i===e||!e.contains(i))}function nQ(e,i){return"boolean"==typeof i?i:"string"==typeof i?e[i]:i(e)}function n0(e){return null===e?null:n1(e)}function n1(e){return"string"==typeof e?e:e.id}function n2(...e){return i=>{e.forEach(e=>{"function"==typeof e?e(i):null!=e&&(e.current=i)})}}function n5(e,...i){if(e)return e(...i)}function n3(e){return new Promise((i,r)=>{let s=0;!function n(){100===(s+=1)&&r(),e()?i():setTimeout(n,10)}()})}function n6(e){var i,r;let s=e.focusedNode;return s?s.isOpen?0:s.parent?s.childIndex+1:0:null!=(r=null==(i=e.root.children)?void 0:i.length)?r:0}function n4(e){let i=e.focusedNode;return i?i.isOpen?i.id:i.parent&&!i.parent.isRoot?i.parent.id:null:null}e.s(["access",()=>nQ,"bound",()=>nK,"dfs",()=>function e(i,r){if(!i)return null;if(i.id===r)return i;if(i.children)for(let s of i.children){let i=e(s,r);if(i)return i}return null},"focusNextElement",()=>nG,"focusPrevElement",()=>nZ,"getInsertIndex",()=>n6,"getInsertParentId",()=>n4,"identify",()=>n1,"identifyNull",()=>n0,"indexOf",0,nX,"isClosed",()=>nY,"isDescendant",0,(e,i)=>{let r=e;for(;r;){if(r.id===i.id)return!0;r=r.parent}return!1},"isItem",()=>nU,"isOpenWithEmptyChildren",()=>nq,"mergeRefs",()=>n2,"noop",()=>nV,"safeRun",()=>n5,"waitFor",()=>n3,"walk",()=>function e(i,r){if(r(i),i.children)for(let s of i.children)e(s,r)}],55498);var n8=e.i(55498);let n7={display:"flex",alignItems:"center",zIndex:1},n9={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},oe={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},ot=R.default.memo(function({top:e,left:i,indent:r}){return(0,I.jsxs)("div",{style:Object.assign(Object.assign({},n7),{position:"absolute",pointerEvents:"none",top:e-2+"px",left:i+"px",right:r+"px"}),children:[(0,I.jsx)("div",{style:Object.assign({},oe)}),(0,I.jsx)("div",{style:Object.assign({},n9)})]})});function oi({node:e,attrs:i,innerRef:r,children:s}){return(0,I.jsx)("div",Object.assign({},i,{ref:r,onFocus:e=>e.stopPropagation(),onClick:e.handleClick,children:s}))}function or(e){return(0,I.jsxs)("div",{ref:e.dragHandle,style:e.style,children:[(0,I.jsx)("span",{onClick:i=>{i.stopPropagation(),e.node.toggle()},children:e.node.isLeaf?"🌳":e.node.isOpen?"🗁":"🗀"})," ",e.node.isEditing?(0,I.jsx)(on,Object.assign({},e)):(0,I.jsx)(os,Object.assign({},e))]})}function os(e){return(0,I.jsx)(I.Fragment,{children:(0,I.jsx)("span",{children:e.node.data.name})})}function on({node:e}){let i=(0,R.useRef)();return(0,R.useEffect)(()=>{var e,r;null==(e=i.current)||e.focus(),null==(r=i.current)||r.select()},[]),(0,I.jsx)("input",{ref:i,defaultValue:e.data.name,onBlur:()=>e.reset(),onKeyDown:r=>{var s;"Escape"===r.key&&e.reset(),"Enter"===r.key&&e.submit((null==(s=i.current)?void 0:s.value)||"")}})}function oo(e){return{type:"EDIT",id:e}}function oa(e){return{type:"FOCUS",id:e}}class ol{constructor(e){this.handleClick=e=>{e.metaKey&&!this.tree.props.disableMultiSelection?this.isSelected?this.deselect():this.selectMulti():e.shiftKey&&!this.tree.props.disableMultiSelection?this.selectContiguous():(this.select(),this.activate())},this.tree=e.tree,this.id=e.id,this.data=e.data,this.level=e.level,this.children=e.children,this.parent=e.parent,this.isDraggable=e.isDraggable,this.rowIndex=e.rowIndex}get isRoot(){return this.id===oh}get isLeaf(){return!Array.isArray(this.children)}get isInternal(){return!this.isLeaf}get isOpen(){return!this.isLeaf&&this.tree.isOpen(this.id)}get isClosed(){return!this.isLeaf&&!this.tree.isOpen(this.id)}get isEditable(){return this.tree.isEditable(this.data)}get isEditing(){return this.tree.editingId===this.id}get isSelected(){return this.tree.isSelected(this.id)}get isOnlySelection(){return this.isSelected&&this.tree.hasOneSelection}get isSelectedStart(){var e;return this.isSelected&&!(null==(e=this.prev)?void 0:e.isSelected)}get isSelectedEnd(){var e;return this.isSelected&&!(null==(e=this.next)?void 0:e.isSelected)}get isFocused(){return this.tree.isFocused(this.id)}get isDragging(){return this.tree.isDragging(this.id)}get willReceiveDrop(){return this.tree.willReceiveDrop(this.id)}get state(){return{isClosed:this.isClosed,isDragging:this.isDragging,isEditing:this.isEditing,isFocused:this.isFocused,isInternal:this.isInternal,isLeaf:this.isLeaf,isOpen:this.isOpen,isSelected:this.isSelected,isSelectedEnd:this.isSelectedEnd,isSelectedStart:this.isSelectedStart,willReceiveDrop:this.willReceiveDrop}}get childIndex(){return this.parent&&this.parent.children?this.parent.children.findIndex(e=>e.id===this.id):-1}get next(){return null===this.rowIndex?null:this.tree.at(this.rowIndex+1)}get prev(){return null===this.rowIndex?null:this.tree.at(this.rowIndex-1)}get nextSibling(){var e,i;let r=this.childIndex;return null!=(i=null==(e=this.parent)?void 0:e.children[r+1])?i:null}isAncestorOf(e){if(!e)return!1;let i=e;for(;i;){if(i.id===this.id)return!0;i=i.parent}return!1}select(){this.tree.select(this)}deselect(){this.tree.deselect(this)}selectMulti(){this.tree.selectMulti(this)}selectContiguous(){this.tree.selectContiguous(this)}activate(){this.tree.activate(this)}focus(){this.tree.focus(this)}toggle(){this.tree.toggle(this)}open(){this.tree.open(this)}openParents(){this.tree.openParents(this)}close(){this.tree.close(this)}submit(e){this.tree.submit(this,e)}reset(){this.tree.reset()}clone(){return new ol(Object.assign({},this))}edit(){return this.tree.edit(this)}}let oh="__REACT_ARBORIST_INTERNAL_ROOT__";function oc(e){var i;let r=new ol({tree:e,id:oh,data:{id:oh},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null});return r.children=(null!=(i=e.props.data)?i:[]).map(i=>(function i(r,s,n){let o=e.accessId(r),a=new ol({tree:e,data:r,level:s,parent:n,id:o,children:null,isDraggable:e.isDraggable(r),rowIndex:null}),l=e.accessChildren(r);return l&&(a.children=l.map(e=>i(e,s+1,a))),a})(i,0,r)),r}function od(e={},i){if("VISIBILITY_OPEN"===i.type)return Object.assign(Object.assign({},e),{[i.id]:!0});if("VISIBILITY_CLOSE"===i.type)return Object.assign(Object.assign({},e),{[i.id]:!1});if("VISIBILITY_TOGGLE"===i.type){let r=e[i.id];return Object.assign(Object.assign({},e),{[i.id]:!r})}if("VISIBILITY_CLEAR"===i.type)return{};return e}let ou=e=>{var i;return{nodes:{open:{filtered:{},unfiltered:null!=(i=null==e?void 0:e.initialOpenState)?i:{}},focus:{id:null,treeFocused:!1},edit:{id:null},drag:{id:null,selectedIds:[],destinationParentId:null,destinationIndex:null},selection:{ids:new Set,anchor:null,mostRecent:null}},dnd:{cursor:{type:"none"},dragId:null,dragIds:[],parentId:null,index:-1}}},of=e=>({type:"SELECTION_ADD",ids:(Array.isArray(e)?e:[e]).map(n1)}),op=e=>({type:"SELECTION_REMOVE",ids:(Array.isArray(e)?e:[e]).map(n1)}),o_=e=>({type:"SELECTION_MOST_RECENT",id:null===e?null:n1(e)}),og=e=>({type:"SELECTION_ANCHOR",id:null===e?null:n1(e)}),ov=e=>({type:"DND_CURSOR",cursor:e}),om=(e,i)=>({type:"DND_HOVERING",parentId:e,index:i}),oS={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"};function oy({offset:e,mouse:i,id:r,dragIds:s,isDragging:n}){return(0,I.jsxs)(ob,{isDragging:n,children:[(0,I.jsx)(ow,{offset:e,children:(0,I.jsx)(ox,{id:r,dragIds:s})}),(0,I.jsx)(oC,{mouse:i,count:s.length})]})}let ob=(0,R.memo)(function(e){return e.isDragging?(0,I.jsx)("div",{style:oS,children:e.children}):null});function ow(e){return(0,I.jsx)("div",{className:"row preview",style:(e=>{if(!e)return{display:"none"};let{x:i,y:r}=e;return{transform:`translate(${i}px, ${r}px)`}})(e.offset),children:e.children})}function oC(e){let{count:i,mouse:r}=e;return i>1?(0,I.jsx)("div",{className:"selected-count",style:(e=>{if(!e)return{display:"none"};let{x:i,y:r}=e;return{transform:`translate(${i+10}px, ${r+10}px)`}})(r),children:i}):null}let ox=(0,R.memo)(function(e){let i=nH(),r=i.get(e.id);return r?(0,I.jsx)(i.renderNode,{preview:!0,node:r,style:{paddingLeft:r.level*i.indent,opacity:.2,background:"transparent"},tree:i}):null});function ok(){return(ok=Object.assign.bind()).apply(null,arguments)}function oE(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function oD(e,i){return(oD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,i){return e.__proto__=i,e})(e,i)}var oO=Number.isNaN||function(e){return"number"==typeof e&&e!=e};function oT(e,i){if(e.length!==i.length)return!1;for(var r,s,n=0;n<e.length;n++)if(!((r=e[n])===(s=i[n])||oO(r)&&oO(s))&&1)return!1;return!0}let oP=function(e,i){void 0===i&&(i=oT);var r,s,n=[],o=!1;return function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];return o&&r===this&&i(a,n)||(s=e.apply(this,a),o=!0,r=this,n=a),s}};var oI="object"==typeof performance&&"function"==typeof performance.now?function(){return performance.now()}:function(){return Date.now()};function oR(e){cancelAnimationFrame(e.id)}var oM=-1;function oN(e){if(void 0===e&&(e=!1),-1===oM||e){var i=document.createElement("div"),r=i.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(i),oM=i.offsetWidth-i.clientWidth,document.body.removeChild(i)}return oM}var oL=null;function oB(e){if(void 0===e&&(e=!1),null===oL||e){var i=document.createElement("div"),r=i.style;r.width="50px",r.height="50px",r.overflow="scroll",r.direction="rtl";var s=document.createElement("div"),n=s.style;n.width="100px",n.height="100px",i.appendChild(s),document.body.appendChild(i),i.scrollLeft>0?oL="positive-descending":(i.scrollLeft=1,oL=0===i.scrollLeft?"negative":"positive-ascending"),document.body.removeChild(i)}return oL}var oA=function(e,i){return e},oj=function(e,i){e.children,e.direction,e.height,e.layout,e.innerTagName,e.outerTagName,e.width,i.instance},oH=(g=(p={getItemOffset:function(e,i){return i*e.itemSize},getItemSize:function(e,i){return e.itemSize},getEstimatedTotalSize:function(e){var i=e.itemCount;return e.itemSize*i},getOffsetForIndexAndAlignment:function(e,i,r,s,n,o){var a=e.direction,l=e.height,h=e.itemCount,c=e.itemSize,d=e.layout,u=e.width,f="horizontal"===a||"horizontal"===d?u:l,p=Math.max(0,h*c-f),_=Math.min(p,i*c),g=Math.max(0,i*c-f+c+o);switch("smart"===r&&(r=s>=g-f&&s<=_+f?"auto":"center"),r){case"start":return _;case"end":return g;case"center":var v=Math.round(g+(_-g)/2);if(v<Math.ceil(f/2))return 0;if(v>p+Math.floor(f/2))return p;return v;default:if(s>=g&&s<=_)return s;if(s<g)return g;return _}},getStartIndexForOffset:function(e,i){return Math.max(0,Math.min(e.itemCount-1,Math.floor(i/e.itemSize)))},getStopIndexForStartIndex:function(e,i,r){var s=e.direction,n=e.height,o=e.itemCount,a=e.itemSize,l=e.layout,h=e.width,c=Math.ceil((("horizontal"===s||"horizontal"===l?h:n)+r-i*a)/a);return Math.max(0,Math.min(o-1,i+c-1))},initInstanceProps:function(e){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(e){e.itemSize}}).getItemOffset,v=p.getEstimatedTotalSize,m=p.getItemSize,S=p.getOffsetForIndexAndAlignment,y=p.getStartIndexForOffset,b=p.getStopIndexForStartIndex,w=p.initInstanceProps,C=p.shouldResetStyleCacheOnItemSizeChange,x=p.validateProps,(_=function(e){function i(i){var r;return(r=e.call(this,i)||this)._instanceProps=w(r.props,oE(r)),r._outerRef=void 0,r._resetIsScrollingTimeoutId=null,r.state={instance:oE(r),isScrolling:!1,scrollDirection:"forward",scrollOffset:"number"==typeof r.props.initialScrollOffset?r.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},r._callOnItemsRendered=void 0,r._callOnItemsRendered=oP(function(e,i,s,n){return r.props.onItemsRendered({overscanStartIndex:e,overscanStopIndex:i,visibleStartIndex:s,visibleStopIndex:n})}),r._callOnScroll=void 0,r._callOnScroll=oP(function(e,i,s){return r.props.onScroll({scrollDirection:e,scrollOffset:i,scrollUpdateWasRequested:s})}),r._getItemStyle=void 0,r._getItemStyle=function(e){var i,s=r.props,n=s.direction,o=s.itemSize,a=s.layout,l=r._getItemStyleCache(C&&o,C&&a,C&&n);if(l.hasOwnProperty(e))i=l[e];else{var h=g(r.props,e,r._instanceProps),c=m(r.props,e,r._instanceProps),d="horizontal"===n||"horizontal"===a,u="rtl"===n,f=d?h:0;l[e]=i={position:"absolute",left:u?void 0:f,right:u?f:void 0,top:d?0:h,height:d?"100%":c,width:d?c:"100%"}}return i},r._getItemStyleCache=void 0,r._getItemStyleCache=oP(function(e,i,r){return{}}),r._onScrollHorizontal=function(e){var i=e.currentTarget,s=i.clientWidth,n=i.scrollLeft,o=i.scrollWidth;r.setState(function(e){if(e.scrollOffset===n)return null;var i=r.props.direction,a=n;if("rtl"===i)switch(oB()){case"negative":a=-n;break;case"positive-descending":a=o-s-n}return a=Math.max(0,Math.min(a,o-s)),{isScrolling:!0,scrollDirection:e.scrollOffset<a?"forward":"backward",scrollOffset:a,scrollUpdateWasRequested:!1}},r._resetIsScrollingDebounced)},r._onScrollVertical=function(e){var i=e.currentTarget,s=i.clientHeight,n=i.scrollHeight,o=i.scrollTop;r.setState(function(e){if(e.scrollOffset===o)return null;var i=Math.max(0,Math.min(o,n-s));return{isScrolling:!0,scrollDirection:e.scrollOffset<i?"forward":"backward",scrollOffset:i,scrollUpdateWasRequested:!1}},r._resetIsScrollingDebounced)},r._outerRefSetter=function(e){var i=r.props.outerRef;r._outerRef=e,"function"==typeof i?i(e):null!=i&&"object"==typeof i&&i.hasOwnProperty("current")&&(i.current=e)},r._resetIsScrollingDebounced=function(){var e,i,s;null!==r._resetIsScrollingTimeoutId&&oR(r._resetIsScrollingTimeoutId),e=r._resetIsScrolling,i=oI(),r._resetIsScrollingTimeoutId=s={id:requestAnimationFrame(function r(){oI()-i>=150?e.call(null):s.id=requestAnimationFrame(r)})}},r._resetIsScrolling=function(){r._resetIsScrollingTimeoutId=null,r.setState({isScrolling:!1},function(){r._getItemStyleCache(-1,null)})},r}(r=i).prototype=Object.create((s=e).prototype),r.prototype.constructor=r,oD(r,s),i.getDerivedStateFromProps=function(e,i){return oj(e,i),x(e),null};var r,s,n=i.prototype;return n.scrollTo=function(e){e=Math.max(0,e),this.setState(function(i){return i.scrollOffset===e?null:{scrollDirection:i.scrollOffset<e?"forward":"backward",scrollOffset:e,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},n.scrollToItem=function(e,i){void 0===i&&(i="auto");var r=this.props,s=r.itemCount,n=r.layout,o=this.state.scrollOffset;e=Math.max(0,Math.min(e,s-1));var a=0;if(this._outerRef){var l=this._outerRef;a="vertical"===n?l.scrollWidth>l.clientWidth?oN():0:l.scrollHeight>l.clientHeight?oN():0}this.scrollTo(S(this.props,e,i,o,this._instanceProps,a))},n.componentDidMount=function(){var e=this.props,i=e.direction,r=e.initialScrollOffset,s=e.layout;if("number"==typeof r&&null!=this._outerRef){var n=this._outerRef;"horizontal"===i||"horizontal"===s?n.scrollLeft=r:n.scrollTop=r}this._callPropsCallbacks()},n.componentDidUpdate=function(){var e=this.props,i=e.direction,r=e.layout,s=this.state,n=s.scrollOffset;if(s.scrollUpdateWasRequested&&null!=this._outerRef){var o=this._outerRef;if("horizontal"===i||"horizontal"===r)if("rtl"===i)switch(oB()){case"negative":o.scrollLeft=-n;break;case"positive-ascending":o.scrollLeft=n;break;default:var a=o.clientWidth,l=o.scrollWidth;o.scrollLeft=l-a-n}else o.scrollLeft=n;else o.scrollTop=n}this._callPropsCallbacks()},n.componentWillUnmount=function(){null!==this._resetIsScrollingTimeoutId&&oR(this._resetIsScrollingTimeoutId)},n.render=function(){var e=this.props,i=e.children,r=e.className,s=e.direction,n=e.height,o=e.innerRef,a=e.innerElementType,l=e.innerTagName,h=e.itemCount,c=e.itemData,d=e.itemKey,u=void 0===d?oA:d,f=e.layout,p=e.outerElementType,_=e.outerTagName,g=e.style,m=e.useIsScrolling,S=e.width,y=this.state.isScrolling,b="horizontal"===s||"horizontal"===f,w=b?this._onScrollHorizontal:this._onScrollVertical,C=this._getRangeToRender(),x=C[0],k=C[1],E=[];if(h>0)for(var D=x;D<=k;D++)E.push((0,R.createElement)(i,{data:c,key:u(D,c),index:D,isScrolling:m?y:void 0,style:this._getItemStyle(D)}));var O=v(this.props,this._instanceProps);return(0,R.createElement)(p||_||"div",{className:r,onScroll:w,ref:this._outerRefSetter,style:ok({position:"relative",height:n,width:S,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:s},g)},(0,R.createElement)(a||l||"div",{children:E,ref:o,style:{height:b?"100%":O,pointerEvents:y?"none":void 0,width:b?O:"100%"}}))},n._callPropsCallbacks=function(){if("function"==typeof this.props.onItemsRendered&&this.props.itemCount>0){var e=this._getRangeToRender(),i=e[0],r=e[1],s=e[2],n=e[3];this._callOnItemsRendered(i,r,s,n)}if("function"==typeof this.props.onScroll){var o=this.state,a=o.scrollDirection,l=o.scrollOffset,h=o.scrollUpdateWasRequested;this._callOnScroll(a,l,h)}},n._getRangeToRender=function(){var e=this.props,i=e.itemCount,r=e.overscanCount,s=this.state,n=s.isScrolling,o=s.scrollDirection,a=s.scrollOffset;if(0===i)return[0,0,0,0];var l=y(this.props,a,this._instanceProps),h=b(this.props,l,a,this._instanceProps);return[Math.max(0,l-(n&&"backward"!==o?1:Math.max(1,r))),Math.max(0,Math.min(i-1,h+(n&&"forward"!==o?1:Math.max(1,r)))),l,h]},i}(R.PureComponent)).defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},_);function oW(){var e,i;let r=nH(),s=function(){let e=(0,R.useContext)(nz);if(null===e)throw Error("Provide a DnDContext");return e}().cursor;if(!s||"line"!==s.type)return null;let n=r.indent,o=r.rowHeight*s.index+(null!=(i=null!=(e=r.props.padding)?e:r.props.paddingTop)?i:0),a=n*s.level,l=r.renderCursor;return(0,I.jsx)(l,{top:o,left:a,indent:n})}var oz=function(e,i){var r={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&0>i.indexOf(s)&&(r[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,s=Object.getOwnPropertySymbols(e);n<s.length;n++)0>i.indexOf(s[n])&&Object.prototype.propertyIsEnumerable.call(e,s[n])&&(r[s[n]]=e[s[n]]);return r};let oF=(0,R.forwardRef)(function(e,i){let{children:r}=e,s=oz(e,["children"]),n=nH();return(0,I.jsxs)("div",Object.assign({ref:i},s,{onClick:e=>{e.currentTarget===e.target&&n.deselectAll()},children:[(0,I.jsx)(o$,{}),r]}))}),o$=()=>{let e=nH();return(0,I.jsx)("div",{style:{height:e.visibleNodes.length*e.rowHeight,width:"100%",position:"absolute",left:"0",right:"0"},children:(0,I.jsx)(oW,{})})};var oK=function(e,i){var r={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&0>i.indexOf(s)&&(r[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,s=Object.getOwnPropertySymbols(e);n<s.length;n++)0>i.indexOf(s[n])&&Object.prototype.propertyIsEnumerable.call(e,s[n])&&(r[s[n]]=e[s[n]]);return r};let oU=(0,R.forwardRef)(function(e,i){var r,s,n,o,{style:a}=e,l=oK(e,["style"]);let h=nH(),c=null!=(s=null!=(r=h.props.padding)?r:h.props.paddingTop)?s:0,d=null!=(o=null!=(n=h.props.padding)?n:h.props.paddingBottom)?o:0;return(0,I.jsx)("div",Object.assign({ref:i,style:Object.assign(Object.assign({},a),{height:`${parseFloat(a.height)+c+d}px`})},l))});var oY="u">typeof window?R.useLayoutEffect:R.useEffect;function oq(e){return(oq="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function oX(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}var oV=function(){var e;function i(e,r,s){if(!(this instanceof i))throw TypeError("Cannot call a class as a function");oX(this,"spec",void 0),oX(this,"monitor",void 0),oX(this,"connector",void 0),this.spec=e,this.monitor=r,this.connector=s}return e=[{key:"beginDrag",value:function(){var e,i=this.spec,r=this.monitor;return null!=(e="object"===oq(i.item)?i.item:"function"==typeof i.item?i.item(r):{})?e:null}},{key:"canDrag",value:function(){var e=this.spec,i=this.monitor;return"boolean"==typeof e.canDrag?e.canDrag:"function"!=typeof e.canDrag||e.canDrag(i)}},{key:"isDragging",value:function(e,i){var r=this.spec,s=this.monitor,n=r.isDragging;return n?n(s):i===e.getSourceId()}},{key:"endDrag",value:function(){var e=this.spec,i=this.monitor,r=this.connector,s=e.end;s&&s(i.getItem(),i),r.reconnect()}}],function(e,i){for(var r=0;r<i.length;r++){var s=i[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(i.prototype,e),i}();function oG(e,i){for(var r,s=arguments.length,n=Array(s>2?s-2:0),o=2;o<s;o++)n[o-2]=arguments[o];if(!e){if(void 0===i)r=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var a=0;(r=Error(i.replace(/%s/g,function(){return n[a++]}))).name="Invariant Violation"}throw r.framesToPop=1,r}}var oZ=(0,R.createContext)({dragDropManager:void 0});function oJ(){var e=(0,R.useContext)(oZ).dragDropManager;return oG(null!=e,"Expected drag drop context"),e}function oQ(e,i){(null==i||i>e.length)&&(i=e.length);for(var r=0,s=Array(i);r<i;r++)s[r]=e[r];return s}function o0(e,i){(null==i||i>e.length)&&(i=e.length);for(var r=0,s=Array(i);r<i;r++)s[r]=e[r];return s}function o1(e,i){var r,s=function(e){if(Array.isArray(e))return o0(e)}(r=i||[])||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(r)||function(e,i){if(e){if("string"==typeof e)return o0(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o0(e,void 0)}}(r)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();return null==i&&"function"!=typeof e&&s.push(e),(0,R.useMemo)(function(){return"function"==typeof e?e():e},s)}function o2(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}var o5=!1,o3=!1,o6=function(){var e;function i(e){if(!(this instanceof i))throw TypeError("Cannot call a class as a function");o2(this,"internalMonitor",void 0),o2(this,"sourceId",null),this.internalMonitor=e.getMonitor()}return e=[{key:"receiveHandlerId",value:function(e){this.sourceId=e}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){oG(!o5,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return o5=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{o5=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;oG(!o3,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return o3=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{o3=!1}}},{key:"subscribeToStateChange",value:function(e,i){return this.internalMonitor.subscribeToStateChange(e,i)}},{key:"isDraggingSource",value:function(e){return this.internalMonitor.isDraggingSource(e)}},{key:"isOverTarget",value:function(e,i){return this.internalMonitor.isOverTarget(e,i)}},{key:"getTargetIds",value:function(){return this.internalMonitor.getTargetIds()}},{key:"isSourcePublic",value:function(){return this.internalMonitor.isSourcePublic()}},{key:"getSourceId",value:function(){return this.internalMonitor.getSourceId()}},{key:"subscribeToOffsetChange",value:function(e){return this.internalMonitor.subscribeToOffsetChange(e)}},{key:"canDragSource",value:function(e){return this.internalMonitor.canDragSource(e)}},{key:"canDropOnTarget",value:function(e){return this.internalMonitor.canDropOnTarget(e)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}],function(e,i){for(var r=0;r<i.length;r++){var s=i[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(i.prototype,e),i}();function o4(e){var i={};return Object.keys(e).forEach(function(r){var s=e[r];if(r.endsWith("Ref"))i[r]=e[r];else{var n=function(){var e,i,r,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!(0,R.isValidElement)(n))return s(n,o),n;if("string"!=typeof n.type){var a=n.type.displayName||n.type.name||"the component";throw Error("Only native element nodes can now be passed to React DnD connectors."+"You can either wrap ".concat(a," into a <div>, or turn it into a ")+"drag source or a drop target itself.")}return e=n,i=o?function(e){return s(e,o)}:s,(oG("string"!=typeof(r=e.ref),"Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r)?(0,R.cloneElement)(e,{ref:function(e){o8(r,e),o8(i,e)}}):(0,R.cloneElement)(e,{ref:i})};i[r]=function(){return n}}}),i}function o8(e,i){"function"==typeof e?e(i):e.current=i}function o7(e){return(o7="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o9(e){return null!==e&&"object"===o7(e)&&Object.prototype.hasOwnProperty.call(e,"current")}function ae(e,i,r,s){var n=r?r.call(s,e,i):void 0;if(void 0!==n)return!!n;if(e===i)return!0;if("object"!=typeof e||!e||"object"!=typeof i||!i)return!1;var o=Object.keys(e),a=Object.keys(i);if(o.length!==a.length)return!1;for(var l=Object.prototype.hasOwnProperty.bind(i),h=0;h<o.length;h++){var c=o[h];if(!l(c))return!1;var d=e[c],u=i[c];if(!1===(n=r?r.call(s,d,u,c):void 0)||void 0===n&&d!==u)return!1}return!0}function at(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}var ai=function(){var e;function i(e){var r=this;if(!(this instanceof i))throw TypeError("Cannot call a class as a function");at(this,"hooks",o4({dragSource:function(e,i){r.clearDragSource(),r.dragSourceOptions=i||null,o9(e)?r.dragSourceRef=e:r.dragSourceNode=e,r.reconnectDragSource()},dragPreview:function(e,i){r.clearDragPreview(),r.dragPreviewOptions=i||null,o9(e)?r.dragPreviewRef=e:r.dragPreviewNode=e,r.reconnectDragPreview()}})),at(this,"handlerId",null),at(this,"dragSourceRef",null),at(this,"dragSourceNode",void 0),at(this,"dragSourceOptionsInternal",null),at(this,"dragSourceUnsubscribe",void 0),at(this,"dragPreviewRef",null),at(this,"dragPreviewNode",void 0),at(this,"dragPreviewOptionsInternal",null),at(this,"dragPreviewUnsubscribe",void 0),at(this,"lastConnectedHandlerId",null),at(this,"lastConnectedDragSource",null),at(this,"lastConnectedDragSourceOptions",null),at(this,"lastConnectedDragPreview",null),at(this,"lastConnectedDragPreviewOptions",null),at(this,"backend",void 0),this.backend=e}return e=[{key:"receiveHandlerId",value:function(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}},{key:"connectTarget",get:function(){return this.dragSource}},{key:"dragSourceOptions",get:function(){return this.dragSourceOptionsInternal},set:function(e){this.dragSourceOptionsInternal=e}},{key:"dragPreviewOptions",get:function(){return this.dragPreviewOptionsInternal},set:function(e){this.dragPreviewOptionsInternal=e}},{key:"reconnect",value:function(){this.reconnectDragSource(),this.reconnectDragPreview()}},{key:"reconnectDragSource",value:function(){var e=this.dragSource,i=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();if(i&&this.disconnectDragSource(),this.handlerId){if(!e){this.lastConnectedDragSource=e;return}i&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions))}}},{key:"reconnectDragPreview",value:function(){var e=this.dragPreview,i=this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(i&&this.disconnectDragPreview(),this.handlerId){if(!e){this.lastConnectedDragPreview=e;return}i&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=e,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,e,this.dragPreviewOptions))}}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didConnectedDragSourceChange",value:function(){return this.lastConnectedDragSource!==this.dragSource}},{key:"didConnectedDragPreviewChange",value:function(){return this.lastConnectedDragPreview!==this.dragPreview}},{key:"didDragSourceOptionsChange",value:function(){return!ae(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!ae(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}},{key:"disconnectDragSource",value:function(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}},{key:"disconnectDragPreview",value:function(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}},{key:"dragSource",get:function(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}},{key:"dragPreview",get:function(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}},{key:"clearDragSource",value:function(){this.dragSourceNode=null,this.dragSourceRef=null}},{key:"clearDragPreview",value:function(){this.dragPreviewNode=null,this.dragPreviewRef=null}}],function(e,i){for(var r=0;r<i.length;r++){var s=i[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(i.prototype,e),i}(),ar=e.i(65932);function as(e,i){(null==i||i>e.length)&&(i=e.length);for(var r=0,s=Array(i);r<i;r++)s[r]=e[r];return s}function an(e,i,r){var s,n=function(e){if(Array.isArray(e))return e}(s=(0,R.useState)(function(){return i(e)}))||function(e,i){var r,s,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),2!==o.length);a=!0);}catch(e){l=!0,s=e}finally{try{a||null==n.return||n.return()}finally{if(l)throw s}}return o}}(s,2)||function(e,i){if(e){if("string"==typeof e)return as(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return as(e,2)}}(s,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),o=n[0],a=n[1],l=(0,R.useCallback)(function(){var s=i(e);!(0,ar.default)(o,s)&&(a(s),r&&r())},[o,e,r]);return oY(l),[o,l]}function ao(e,i){(null==i||i>e.length)&&(i=e.length);for(var r=0,s=Array(i);r<i;r++)s[r]=e[r];return s}function aa(e,i,r){var s,n,o,a;return o=(n=function(e){if(Array.isArray(e))return e}(s=an(i,e||function(){return{}},function(){return r.reconnect()}))||function(e,i){var r,s,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),2!==o.length);a=!0);}catch(e){l=!0,s=e}finally{try{a||null==n.return||n.return()}finally{if(l)throw s}}return o}}(s,2)||function(e,i){if(e){if("string"==typeof e)return ao(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ao(e,2)}}(s,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],oY(function(){var e=i.getHandlerId();if(null!=e)return i.subscribeToStateChange(a,{handlerIds:[e]})},[i,a=n[1]]),o}function al(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}var ah=function(){var e;function i(e,r){if(!(this instanceof i))throw TypeError("Cannot call a class as a function");al(this,"spec",void 0),al(this,"monitor",void 0),this.spec=e,this.monitor=r}return e=[{key:"canDrop",value:function(){var e=this.spec,i=this.monitor;return!e.canDrop||e.canDrop(i.getItem(),i)}},{key:"hover",value:function(){var e=this.spec,i=this.monitor;e.hover&&e.hover(i.getItem(),i)}},{key:"drop",value:function(){var e=this.spec,i=this.monitor;if(e.drop)return e.drop(i.getItem(),i)}}],function(e,i){for(var r=0;r<i.length;r++){var s=i[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(i.prototype,e),i}();function ac(e,i){(null==i||i>e.length)&&(i=e.length);for(var r=0,s=Array(i);r<i;r++)s[r]=e[r];return s}function ad(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}var au=!1,af=function(){var e;function i(e){if(!(this instanceof i))throw TypeError("Cannot call a class as a function");ad(this,"internalMonitor",void 0),ad(this,"targetId",null),this.internalMonitor=e.getMonitor()}return e=[{key:"receiveHandlerId",value:function(e){this.targetId=e}},{key:"getHandlerId",value:function(){return this.targetId}},{key:"subscribeToStateChange",value:function(e,i){return this.internalMonitor.subscribeToStateChange(e,i)}},{key:"canDrop",value:function(){if(!this.targetId)return!1;oG(!au,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return au=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{au=!1}}},{key:"isOver",value:function(e){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,e)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}],function(e,i){for(var r=0;r<i.length;r++){var s=i[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(i.prototype,e),i}();function ap(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}var a_=function(){var e;function i(e){var r=this;if(!(this instanceof i))throw TypeError("Cannot call a class as a function");ap(this,"hooks",o4({dropTarget:function(e,i){r.clearDropTarget(),r.dropTargetOptions=i,o9(e)?r.dropTargetRef=e:r.dropTargetNode=e,r.reconnect()}})),ap(this,"handlerId",null),ap(this,"dropTargetRef",null),ap(this,"dropTargetNode",void 0),ap(this,"dropTargetOptionsInternal",null),ap(this,"unsubscribeDropTarget",void 0),ap(this,"lastConnectedHandlerId",null),ap(this,"lastConnectedDropTarget",null),ap(this,"lastConnectedDropTargetOptions",null),ap(this,"backend",void 0),this.backend=e}return e=[{key:"connectTarget",get:function(){return this.dropTarget}},{key:"reconnect",value:function(){var e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();var i=this.dropTarget;if(this.handlerId){if(!i){this.lastConnectedDropTarget=i;return}e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=i,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,i,this.dropTargetOptions))}}},{key:"receiveHandlerId",value:function(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}},{key:"dropTargetOptions",get:function(){return this.dropTargetOptionsInternal},set:function(e){this.dropTargetOptionsInternal=e}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didDropTargetChange",value:function(){return this.lastConnectedDropTarget!==this.dropTarget}},{key:"didOptionsChange",value:function(){return!ae(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}},{key:"disconnectDropTarget",value:function(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}},{key:"dropTarget",get:function(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}},{key:"clearDropTarget",value:function(){this.dropTargetRef=null,this.dropTargetNode=null}}],function(e,i){for(var r=0;r<i.length;r++){var s=i[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(i.prototype,e),i}();function ag(e,i){var r,s,n,o,a,l,h,c,d,u=o1(e,i),f=(r=oJ(),(0,R.useMemo)(function(){return new af(r)},[r])),p=(s=u.options,n=oJ(),o=(0,R.useMemo)(function(){return new a_(n.getBackend())},[n]),oY(function(){return o.dropTargetOptions=s||null,o.reconnect(),function(){return o.disconnectDropTarget()}},[s]),o);return a=oJ(),l=(0,R.useMemo)(function(){return new ah(u,f)},[f]),(0,R.useEffect)(function(){l.spec=u},[u]),oY(function(){var e,i,r,s,n=function(e){if(Array.isArray(e))return e}((e=d,s=[r=(i=a.getRegistry()).addTarget(e,h),function(){return i.removeTarget(r)}]))||function(e,i){var r,s,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),2!==o.length);a=!0);}catch(e){l=!0,s=e}finally{try{a||null==n.return||n.return()}finally{if(l)throw s}}return o}}(s,2)||function(e,i){if(e){if("string"==typeof e)return ac(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ac(e,2)}}(s,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),o=n[0],l=n[1];return f.receiveHandlerId(o),p.receiveHandlerId(o),l},[a,f,h=l,p,(c=u.accept,d=(0,R.useMemo)(function(){return oG(null!=u.accept,"accept must be defined"),Array.isArray(c)?c:[c]},[c])).map(function(e){return e.toString()}).join("|")]),[aa(u.collect,f,p),(0,R.useMemo)(function(){return p.hooks.dropTarget()},[p])]}function av(e,i){return{parentId:e||null,index:i}}function am(e,i){return{type:"line",index:e,level:i}}function aS(e,i){var r;let s=e;for(;s.parent&&s.level>i;)s=s.parent;return{parentId:(null==(r=s.parent)?void 0:r.id)||null,index:nX(s)+1}}function ay(e){var i,r,s;let n,o,a,l,h,c,d,u,f=(r=e.element,s=e.offset,n=r.getBoundingClientRect(),o=s.x-Math.round(n.x),a=s.y-Math.round(n.y),c=!(h=a<(l=n.height)/2),{x:o,inTopHalf:h,inBottomHalf:c,inMiddle:u=a>(d=l/4)&&a<l-d,atTop:!u&&h,atBottom:!u&&c}),p=e.indent,_=Math.round(Math.max(0,f.x-p)/p),{node:g,nextNode:v,prevNode:m}=e,[S,y]=function(e,i,r,s){if(!e)return[i,null];if(e.isInternal)if(s.atTop)return[i,e];else if(s.inMiddle)return[e,e];else return[e,r];return s.inTopHalf?[i,e]:[e,r]}(g,m,v,f);if(g&&g.isInternal&&f.inMiddle)return{drop:av(g.id,null),cursor:{type:"highlight",id:g.id}};if(!S)return{drop:av(null==(i=null==y?void 0:y.parent)?void 0:i.id,0),cursor:am(0,0)};if(nU(S)||nY(S)){let e=nK(_,(null==y?void 0:y.level)||0,S.level);return{drop:aS(S,e),cursor:am(S.rowIndex+1,e)}}if(nq(S)){let e=nK(_,0,S.level+1);return e>S.level?{drop:av(S.id,0),cursor:am(S.rowIndex+1,e)}:{drop:aS(S,e),cursor:am(S.rowIndex+1,e)}}return{drop:av(null==S?void 0:S.id,0),cursor:am(S.rowIndex+1,S.level+1)}}let ab=R.default.memo(function({index:e,style:i}){n$(),function(){if(null===(0,R.useContext)(nW))throw Error("Provide a NodesContext")}();let r=nH(),s=function(e){let i=nH(),r=i.at(e);if(!r)throw Error(`Could not find node for index: ${e}`);return(0,R.useMemo)(()=>{let s=r.clone();return i.visibleNodes[e]=s,s},[...Object.values(r.state),r])}(e),n=(0,R.useRef)(null),o=function(e){var i,r,s,n,o,a,l,h,c,d,u,f;let p=nH(),_=p.selectedIds,[g,v,m]=(oG(!(i=o1(()=>({canDrag:()=>e.isDraggable,type:"NODE",item:()=>{let i,r=p.isSelected(e.id)?Array.from(_):[e.id];return p.dispatch((i=e.id,{type:"DND_DRAG_START",id:i,dragIds:r})),{id:e.id,dragIds:r}},end:()=>{p.hideCursor(),p.dispatch({type:"DND_DRAG_END"})}}),[_,e])).begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)"),r=oJ(),s=(0,R.useMemo)(function(){return new o6(r)},[r]),n=i.options,o=i.previewOptions,a=oJ(),oY(function(){return l.dragSourceOptions=n||null,l.reconnect(),function(){return l.disconnectDragSource()}},[l=(0,R.useMemo)(function(){return new ai(a.getBackend())},[a]),n]),oY(function(){return l.dragPreviewOptions=o||null,l.reconnect(),function(){return l.disconnectDragPreview()}},[l,o]),h=l,c=oJ(),d=(0,R.useMemo)(function(){return new oV(i,s,h)},[s,h]),(0,R.useEffect)(function(){d.spec=i},[i]),oY(function(){if(null!=f){var e,i,r,n,o=function(e){if(Array.isArray(e))return e}((e=f,n=[r=(i=c.getRegistry()).addSource(e,u),function(){return i.removeSource(r)}]))||function(e,i){var r,s,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),2!==o.length);a=!0);}catch(e){l=!0,s=e}finally{try{a||null==n.return||n.return()}finally{if(l)throw s}}return o}}(n,2)||function(e,i){if(e){if("string"==typeof e)return oQ(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return oQ(e,2)}}(n,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),a=o[0],l=o[1];return s.receiveHandlerId(a),h.receiveHandlerId(a),l}},[c,s,h,u=d,f=(0,R.useMemo)(function(){var e=i.type;return oG(null!=e,"spec.type must be defined"),e},[i])]),[aa(i.collect,s,h),(0,R.useMemo)(function(){return h.hooks.dragSource()},[h]),(0,R.useMemo)(function(){return h.hooks.dragPreview()},[h])]);return(0,R.useEffect)(()=>{m((D||((D=new Image).src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),D))},[m]),v}(s),a=function(e,i){let r=nH(),[s,n]=ag(()=>({accept:"NODE",canDrop:()=>r.canDrop(),hover:(s,n)=>{let o=n.getClientOffset();if(!e.current||!o)return;let{cursor:a,drop:l}=ay({element:e.current,offset:o,indent:r.indent,node:i,prevNode:i.prev,nextNode:i.next});l&&r.dispatch(om(l.parentId,l.index)),n.canDrop()?a&&r.showCursor(a):r.hideCursor()},drop:(e,i)=>{if(!i.canDrop())return null;let{parentId:s,index:n,dragIds:o}=r.state.dnd;n5(r.props.onMove,{dragIds:o,parentId:s===oh?null:s,index:null===n?0:n,dragNodes:r.dragNodes,parentNode:r.get(s)}),r.open(s)}}),[i,e.current,r.props]);return n}(n,s),l=(0,R.useCallback)(e=>{n.current=e,a(e)},[a]),h=r.indent*s.level,c=(0,R.useMemo)(()=>({paddingLeft:h}),[h]),d=(0,R.useMemo)(()=>{var e,s;return Object.assign(Object.assign({},i),{top:parseFloat(i.top)+(null!=(s=null!=(e=r.props.padding)?e:r.props.paddingTop)?s:0)})},[i,r.props.padding,r.props.paddingTop]),u={role:"treeitem","aria-level":s.level+1,"aria-selected":s.isSelected,"aria-expanded":s.isOpen,style:d,tabIndex:-1,className:r.props.rowClassName};(0,R.useEffect)(()=>{var e;!s.isEditing&&s.isFocused&&(null==(e=n.current)||e.focus({preventScroll:!0}))},[s.isEditing,s.isFocused,n.current]);let f=r.renderNode,p=r.renderRow;return(0,I.jsx)(p,{node:s,innerRef:l,attrs:u,children:(0,I.jsx)(f,{node:s,tree:r,style:c,dragHandle:o})})}),aw="",aC=null;function ax(){n$();let e=nH();return(0,I.jsx)("div",{role:"tree",style:{height:e.height,width:e.width,minHeight:0,minWidth:0},onContextMenu:e.props.onContextMenu,onClick:e.props.onClick,tabIndex:0,onFocus:i=>{i.currentTarget.contains(i.relatedTarget)||e.onFocus()},onBlur:i=>{i.currentTarget.contains(i.relatedTarget)||e.onBlur()},onKeyDown:i=>{var r;if(e.isEditing)return;if("Backspace"===i.key){if(!e.props.onDelete)return;let i=Array.from(e.selectedIds);if(i.length>1){let r=e.mostRecentNode;for(;r&&r.isSelected;)r=r.nextSibling;r||(r=e.lastNode),e.focus(r,{scroll:!1}),e.delete(Array.from(i))}else{let i=e.focusedNode;if(i){let r=i.nextSibling,s=i.parent;e.focus(r||s,{scroll:!1}),e.delete(i)}}return}if("Tab"===i.key&&!i.shiftKey){i.preventDefault(),nG(i.currentTarget);return}if("Tab"===i.key&&i.shiftKey){i.preventDefault(),nZ(i.currentTarget);return}if("ArrowDown"===i.key){i.preventDefault();let r=e.nextNode;if(i.metaKey){e.select(e.focusedNode),e.activate(e.focusedNode);return}{if(!i.shiftKey||e.props.disableMultiSelection)return void e.focus(r);if(!r)return;let s=e.focusedNode;return void(s?s.isSelected?e.selectContiguous(r):e.selectMulti(r):e.focus(e.firstNode))}}if("ArrowUp"===i.key){i.preventDefault();let r=e.prevNode;if(!i.shiftKey||e.props.disableMultiSelection)return void e.focus(r);{if(!r)return;let i=e.focusedNode;i?i.isSelected?e.selectContiguous(r):e.selectMulti(r):e.focus(e.lastNode);return}}if("ArrowRight"===i.key){let i=e.focusedNode;if(!i)return;i.isInternal&&i.isOpen?e.focus(e.nextNode):i.isInternal&&e.open(i.id);return}if("ArrowLeft"===i.key){let i=e.focusedNode;if(!i||i.isRoot)return;i.isInternal&&i.isOpen?e.close(i.id):(null==(r=i.parent)?void 0:r.isRoot)||e.focus(i.parent);return}if("a"===i.key&&i.metaKey&&!e.props.disableMultiSelection){i.preventDefault(),e.selectAll();return}if("a"===i.key&&!i.metaKey&&e.props.onCreate)return void e.createLeaf();if("A"===i.key&&!i.metaKey){if(!e.props.onCreate)return;e.createInternal();return}if("Home"===i.key){i.preventDefault(),e.focus(e.firstNode);return}if("End"===i.key){i.preventDefault(),e.focus(e.lastNode);return}if("Enter"===i.key){let i=e.focusedNode;if(!i||!i.isEditable||!e.props.onRename)return;setTimeout(()=>{i&&e.edit(i)});return}if(" "===i.key){i.preventDefault();let r=e.focusedNode;if(!r)return;r.isLeaf?(r.select(),r.activate()):r.toggle();return}if("*"===i.key){let i=e.focusedNode;if(!i)return;e.openSiblings(i);return}if("PageUp"===i.key){i.preventDefault(),e.pageUp();return}"PageDown"===i.key&&(i.preventDefault(),e.pageDown()),clearTimeout(aC),aw+=i.key,aC=setTimeout(()=>{aw=""},600);let s=e.visibleNodes.find(e=>{let i=e.data.name;return"string"==typeof i&&i.toLowerCase().startsWith(aw)});s&&e.focus(s.id)},children:(0,I.jsx)(oH,{className:e.props.className,outerRef:e.listEl,itemCount:e.visibleNodes.length,height:e.height,width:e.width,itemSize:e.rowHeight,overscanCount:e.overscanCount,itemKey:i=>{var r;return(null==(r=e.visibleNodes[i])?void 0:r.id)||i},outerElementType:oF,innerElementType:oU,onScroll:e.props.onScroll,onItemsRendered:e.onItemsRendered.bind(e),ref:e.list,children:ab})})}function ak(e){var i,r,s;let n,o,a;return e.isFiltered?(i=e.root,r=e.isMatch.bind(e),n={},o=[],!function e(i){if(!i.isRoot&&r(i)){n[i.id]=!0;let e=i.parent;for(;e;)n[e.id]=!0,e=e.parent}if(i.children)for(let r of i.children)e(r)}(i),!function e(i){var r;i.level>=0&&n[i.id]&&o.push(i),i.isOpen&&(null==(r=i.children)||r.forEach(e))}(i),o.forEach(aE),o):(s=e.root,a=[],!function e(i){var r;i.level>=0&&a.push(i),i.isOpen&&(null==(r=i.children)||r.forEach(e))}(s),a.forEach(aE),a)}function aE(e,i){e.rowIndex=i}let aD=e=>e.reduce((e,i,r)=>(e[i.id]=r,e),{});var aO=function(e,i,r,s){return new(r||(r=Promise))(function(n,o){function a(e){try{h(s.next(e))}catch(e){o(e)}}function l(e){try{h(s.throw(e))}catch(e){o(e)}}function h(e){var i;e.done?n(e.value):((i=e.value)instanceof r?i:new r(function(e){e(i)})).then(a,l)}h((s=s.apply(e,i||[])).next())})};let{safeRun:aT,identify:aP,identifyNull:aI}=n8;class aR{constructor(e,i,r,s){this.store=e,this.props=i,this.list=r,this.listEl=s,this.visibleStartIndex=0,this.visibleStopIndex=0,this.root=oc(this),this.visibleNodes=ak(this),this.idToIndex=aD(this.visibleNodes)}update(e){this.props=e,this.root=oc(this),this.visibleNodes=ak(this),this.idToIndex=aD(this.visibleNodes)}dispatch(e){return this.store.dispatch(e)}get state(){return this.store.getState()}get openState(){return this.state.nodes.open.unfiltered}get width(){var e;return null!=(e=this.props.width)?e:300}get height(){var e;return null!=(e=this.props.height)?e:500}get indent(){var e;return null!=(e=this.props.indent)?e:24}get rowHeight(){var e;return null!=(e=this.props.rowHeight)?e:24}get overscanCount(){var e;return null!=(e=this.props.overscanCount)?e:1}get searchTerm(){return(this.props.searchTerm||"").trim()}get matchFn(){var e;let i=null!=(e=this.props.searchMatch)?e:(e,i)=>JSON.stringify(Object.values(e.data)).toLocaleLowerCase().includes(i.toLocaleLowerCase());return e=>i(e,this.searchTerm)}accessChildren(e){var i;let r=this.props.childrenAccessor||"children";return null!=(i=n8.access(e,r))?i:null}accessId(e){let i=this.props.idAccessor||"id",r=n8.access(e,i);if(!r)throw Error("Data must contain an 'id' property or props.idAccessor must return a string");return r}get firstNode(){var e;return null!=(e=this.visibleNodes[0])?e:null}get lastNode(){var e;return null!=(e=this.visibleNodes[this.visibleNodes.length-1])?e:null}get focusedNode(){var e;return null!=(e=this.get(this.state.nodes.focus.id))?e:null}get mostRecentNode(){var e;return null!=(e=this.get(this.state.nodes.selection.mostRecent))?e:null}get nextNode(){let e=this.indexOf(this.focusedNode);return null===e?null:this.at(e+1)}get prevNode(){let e=this.indexOf(this.focusedNode);return null===e?null:this.at(e-1)}get(e){return e&&e in this.idToIndex&&this.visibleNodes[this.idToIndex[e]]||null}at(e){return this.visibleNodes[e]||null}nodesBetween(e,i){var r;if(null===e||null===i)return[];let s=null!=(r=this.indexOf(e))?r:0,n=this.indexOf(i);if(null===n)return[];let o=Math.min(s,n),a=Math.max(s,n);return this.visibleNodes.slice(o,a+1)}indexOf(e){let i=n8.identifyNull(e);return i?this.idToIndex[i]:null}get editingId(){return this.state.nodes.edit.id}createInternal(){return this.create({type:"internal"})}createLeaf(){return this.create({type:"leaf"})}create(){return aO(this,arguments,void 0,function*(e={}){var i,r;let s=void 0===e.parentId?n8.getInsertParentId(this):e.parentId,n=null!=(i=e.index)?i:n8.getInsertIndex(this),o=null!=(r=e.type)?r:"leaf",a=yield aT(this.props.onCreate,{type:o,parentId:s,index:n,parentNode:this.get(s)});a&&(this.focus(a),setTimeout(()=>{this.edit(a).then(()=>{this.select(a),this.activate(a)})}))})}delete(e){return aO(this,void 0,void 0,function*(){if(!e)return;let i=(Array.isArray(e)?e:[e]).map(aP),r=i.map(e=>this.get(e)).filter(e=>!!e);yield aT(this.props.onDelete,{nodes:r,ids:i})})}edit(e){let i=aP(e);return this.resolveEdit({cancelled:!0}),this.scrollTo(i),this.dispatch(oo(i)),new Promise(e=>{aR.editPromise=e})}submit(e,i){return aO(this,void 0,void 0,function*(){if(!e)return;let r=aP(e);yield aT(this.props.onRename,{id:r,name:i,node:this.get(r)}),this.dispatch(oo(null)),this.resolveEdit({cancelled:!1,value:i}),setTimeout(()=>this.onFocus())})}reset(){this.dispatch(oo(null)),this.resolveEdit({cancelled:!0}),setTimeout(()=>this.onFocus())}activate(e){let i=this.get(aI(e));i&&aT(this.props.onActivate,i)}resolveEdit(e){let i=aR.editPromise;i&&i(e),aR.editPromise=null}get selectedIds(){return this.state.nodes.selection.ids}get selectedNodes(){let e=[];for(let i of Array.from(this.selectedIds)){let r=this.get(i);r&&e.push(r)}return e}focus(e,i={}){e&&(this.props.selectionFollowsFocus?this.select(e):(this.dispatch(oa(aP(e))),!1!==i.scroll&&this.scrollTo(e),this.focusedNode&&aT(this.props.onFocus,this.focusedNode)))}pageUp(){var e,i;let r=this.visibleStartIndex,s=this.visibleStopIndex-r,n=null!=(i=null==(e=this.focusedNode)?void 0:e.rowIndex)?i:0;n=n>r?r:Math.max(r-s,0),this.focus(this.at(n))}pageDown(){var e,i;let r=this.visibleStartIndex,s=this.visibleStopIndex,n=s-r,o=null!=(i=null==(e=this.focusedNode)?void 0:e.rowIndex)?i:0;o=o<s?s:Math.min(o+n,this.visibleNodes.length-1),this.focus(this.at(o))}select(e,i={}){if(!e)return;let r=!1!==i.focus,s=aP(e);r&&this.dispatch(oa(s)),this.dispatch({type:"SELECTION_ONLY",id:n1(s)}),this.dispatch(og(s)),this.dispatch(o_(s)),this.scrollTo(s,i.align),this.focusedNode&&r&&aT(this.props.onFocus,this.focusedNode),aT(this.props.onSelect,this.selectedNodes)}deselect(e){if(!e)return;let i=aP(e);this.dispatch(op(i)),aT(this.props.onSelect,this.selectedNodes)}selectMulti(e){let i=this.get(aI(e));i&&(this.dispatch(oa(i.id)),this.dispatch(of(i.id)),this.dispatch(og(i.id)),this.dispatch(o_(i.id)),this.scrollTo(i),this.focusedNode&&aT(this.props.onFocus,this.focusedNode),aT(this.props.onSelect,this.selectedNodes))}selectContiguous(e){if(!e)return;let i=aP(e),{anchor:r,mostRecent:s}=this.state.nodes.selection;this.dispatch(oa(i)),this.dispatch(op(this.nodesBetween(r,s))),this.dispatch(of(this.nodesBetween(r,aI(i)))),this.dispatch(o_(i)),this.scrollTo(i),this.focusedNode&&aT(this.props.onFocus,this.focusedNode),aT(this.props.onSelect,this.selectedNodes)}deselectAll(){this.setSelection({ids:[],anchor:null,mostRecent:null}),aT(this.props.onSelect,this.selectedNodes)}selectAll(){var e;this.setSelection({ids:Object.keys(this.idToIndex),anchor:this.firstNode,mostRecent:this.lastNode}),this.dispatch(oa(null==(e=this.lastNode)?void 0:e.id)),this.focusedNode&&aT(this.props.onFocus,this.focusedNode),aT(this.props.onSelect,this.selectedNodes)}setSelection(e){var i;let r=new Set(null==(i=e.ids)?void 0:i.map(aP)),s=aI(e.anchor),n=aI(e.mostRecent);this.dispatch(Object.assign({type:"SELECTION_SET"},{ids:r,anchor:s,mostRecent:n})),aT(this.props.onSelect,this.selectedNodes)}get cursorParentId(){let{cursor:e}=this.state.dnd;return"highlight"===e.type?e.id:null}get cursorOverFolder(){return"highlight"===this.state.dnd.cursor.type}get dragNodes(){return this.state.dnd.dragIds.map(e=>this.get(e)).filter(e=>!!e)}get dragNode(){return this.get(this.state.nodes.drag.id)}get dragDestinationParent(){return this.get(this.state.nodes.drag.destinationParentId)}get dragDestinationIndex(){return this.state.nodes.drag.destinationIndex}canDrop(){var e;if(this.isFiltered)return!1;let i=null!=(e=this.get(this.state.dnd.parentId))?e:this.root,r=this.dragNodes,s=this.props.disableDrop;for(let e of r)if(!e||!i||e.isInternal&&n8.isDescendant(i,e))return!1;return"function"==typeof s?!s({parentNode:i,dragNodes:this.dragNodes,index:this.state.dnd.index||0}):"string"==typeof s?!i.data[s]:"boolean"!=typeof s||!s}hideCursor(){this.dispatch(ov({type:"none"}))}showCursor(e){this.dispatch(ov(e))}open(e){let i,r=aI(e);!r||this.isOpen(r)||(this.dispatch((i=r,{type:"VISIBILITY_OPEN",id:i,filtered:this.isFiltered})),aT(this.props.onToggle,r))}close(e){let i,r=aI(e);!r||this.isOpen(r)&&(this.dispatch((i=r,{type:"VISIBILITY_CLOSE",id:i,filtered:this.isFiltered})),aT(this.props.onToggle,r))}toggle(e){let i=aI(e);if(i)return this.isOpen(i)?this.close(i):this.open(i)}openParents(e){let i=aI(e);if(!i)return;let r=n8.dfs(this.root,i),s=null==r?void 0:r.parent;for(;s;)this.open(s.id),s=s.parent}openSiblings(e){let i=e.parent;if(i){if(i.children){let r=e.isOpen;for(let e of i.children)e.isInternal&&(r?this.close(e.id):this.open(e.id));this.scrollTo(this.focusedNode)}}else this.toggle(e.id)}openAll(){n8.walk(this.root,e=>{e.isInternal&&e.open()})}closeAll(){n8.walk(this.root,e=>{e.isInternal&&e.close()})}scrollTo(e,i="smart"){if(!e)return;let r=aP(e);return this.openParents(r),n8.waitFor(()=>r in this.idToIndex).then(()=>{var e;let s=this.idToIndex[r];void 0!==s&&(null==(e=this.list.current)||e.scrollToItem(s,i))}).catch(()=>{})}get isEditing(){return null!==this.state.nodes.edit.id}get isFiltered(){var e;return!!(null==(e=this.props.searchTerm)?void 0:e.trim())}get hasFocus(){return this.state.nodes.focus.treeFocused}get hasNoSelection(){return 0===this.state.nodes.selection.ids.size}get hasOneSelection(){return 1===this.state.nodes.selection.ids.size}get hasMultipleSelections(){return this.state.nodes.selection.ids.size>1}isSelected(e){return!!e&&this.state.nodes.selection.ids.has(e)}isOpen(e){var i,r,s;if(!e)return!1;if(e===oh)return!0;let n=null==(i=this.props.openByDefault)||i;return this.isFiltered?null==(r=this.state.nodes.open.filtered[e])||r:null!=(s=this.state.nodes.open.unfiltered[e])?s:n}isEditable(e){let i=this.props.disableEdit||(()=>!1);return!n8.access(e,i)}isDraggable(e){let i=this.props.disableDrag||(()=>!1);return!n8.access(e,i)}isDragging(e){let i=aI(e);return!!i&&this.state.nodes.drag.id===i}isFocused(e){return this.hasFocus&&this.state.nodes.focus.id===e}isMatch(e){return this.matchFn(e)}willReceiveDrop(e){let i=aI(e);if(!i)return!1;let{destinationParentId:r,destinationIndex:s}=this.state.nodes.drag;return i===r&&null===s}onFocus(){let e=this.focusedNode||this.firstNode;e&&this.dispatch(oa(e.id))}onBlur(){this.dispatch({type:"TREE_BLUR"})}onItemsRendered(e){this.visibleStartIndex=e.visibleStartIndex,this.visibleStopIndex=e.visibleStopIndex}get renderContainer(){return this.props.renderContainer||ax}get renderRow(){return this.props.renderRow||oi}get renderNode(){return this.props.children||or}get renderDragPreview(){return this.props.renderDragPreview||oy}get renderCursor(){return this.props.renderCursor||ot}}function aM(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var aN="function"==typeof Symbol&&Symbol.observable||"@@observable",aL=()=>Math.random().toString(36).substring(7).split("").join("."),aB={INIT:`@@redux/INIT${aL()}`,REPLACE:`@@redux/REPLACE${aL()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${aL()}`};function aA(e){let i,r=Object.keys(e),s={};for(let i=0;i<r.length;i++){let n=r[i];"function"==typeof e[n]&&(s[n]=e[n])}let n=Object.keys(s);try{Object.keys(s).forEach(e=>{let i=s[e];if(void 0===i(void 0,{type:aB.INIT}))throw Error(aM(12));if(void 0===i(void 0,{type:aB.PROBE_UNKNOWN_ACTION()}))throw Error(aM(13))})}catch(e){i=e}return function(e={},r){if(i)throw i;let o=!1,a={};for(let i=0;i<n.length;i++){let l=n[i],h=s[l],c=e[l],d=h(c,r);if(void 0===d)throw r&&r.type,Error(aM(14));a[l]=d,o=o||d!==c}return(o=o||n.length!==Object.keys(e).length)?a:e}}let aj=aA({nodes:aA({focus:function(e={id:null,treeFocused:!1},i){return"FOCUS"===i.type?Object.assign(Object.assign({},e),{id:i.id,treeFocused:!0}):"TREE_BLUR"===i.type?Object.assign(Object.assign({},e),{treeFocused:!1}):e},edit:function(e={id:null},i){return"EDIT"===i.type?Object.assign(Object.assign({},e),{id:i.id}):e},open:function(e={filtered:{},unfiltered:{}},i){return i.type.startsWith("VISIBILITY")?i.filtered?Object.assign(Object.assign({},e),{filtered:od(e.filtered,i)}):Object.assign(Object.assign({},e),{unfiltered:od(e.unfiltered,i)}):e},selection:function(e=ou().nodes.selection,i){let r=e.ids;switch(i.type){case"SELECTION_CLEAR":return Object.assign(Object.assign({},e),{ids:new Set});case"SELECTION_ONLY":return Object.assign(Object.assign({},e),{ids:new Set([i.id])});case"SELECTION_ADD":if(0===i.ids.length)return e;return i.ids.forEach(e=>r.add(e)),Object.assign(Object.assign({},e),{ids:new Set(r)});case"SELECTION_REMOVE":if(0===i.ids.length)return e;return i.ids.forEach(e=>r.delete(e)),Object.assign(Object.assign({},e),{ids:new Set(r)});case"SELECTION_SET":return Object.assign(Object.assign({},e),{ids:i.ids,mostRecent:i.mostRecent,anchor:i.anchor});case"SELECTION_MOST_RECENT":return Object.assign(Object.assign({},e),{mostRecent:i.id});case"SELECTION_ANCHOR":return Object.assign(Object.assign({},e),{anchor:i.id});default:return e}},drag:function(e=ou().nodes.drag,i){switch(i.type){case"DND_DRAG_START":return Object.assign(Object.assign({},e),{id:i.id,selectedIds:i.dragIds});case"DND_DRAG_END":return Object.assign(Object.assign({},e),{id:null,destinationParentId:null,destinationIndex:null,selectedIds:[]});case"DND_HOVERING":if(i.parentId!==e.destinationParentId||i.index!=e.destinationIndex)return Object.assign(Object.assign({},e),{destinationParentId:i.parentId,destinationIndex:i.index});return e;default:return e}}}),dnd:function(e=ou().dnd,i){switch(i.type){case"DND_CURSOR":return Object.assign(Object.assign({},e),{cursor:i.cursor});case"DND_DRAG_START":return Object.assign(Object.assign({},e),{dragId:i.id,dragIds:i.dragIds});case"DND_DRAG_END":return ou().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},e),{parentId:i.parentId,index:i.index});default:return e}}});function aH(e){var i=null;return function(){return null==i&&(i=e()),i}}function aW(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}var az=function(){var e;function i(e){if(!(this instanceof i))throw TypeError("Cannot call a class as a function");aW(this,"entered",[]),aW(this,"isNodeInDocument",void 0),this.isNodeInDocument=e}return e=[{key:"enter",value:function(e){var i,r,s,n,o,a=this,l=this.entered.length;return this.entered=(i=this.entered.filter(function(i){return a.isNodeInDocument(i)&&(!i.contains||i.contains(e))}),r=[e],s=new Set,n=function(e){return s.add(e)},i.forEach(n),r.forEach(n),o=[],s.forEach(function(e){return o.push(e)}),o),0===l&&this.entered.length>0}},{key:"leave",value:function(e){var i,r=this.entered.length;return this.entered=(i=this.entered.filter(this.isNodeInDocument),i.filter(function(i){return i!==e})),r>0&&0===this.entered.length}},{key:"reset",value:function(){this.entered=[]}}],function(e,i){for(var r=0;r<i.length;r++){var s=i[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(i.prototype,e),i}(),aF=aH(function(){return/firefox/i.test(navigator.userAgent)}),a$=aH(function(){return!!window.safari});function aK(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}var aU=function(){var e;function i(e,r){if(!(this instanceof i))throw TypeError("Cannot call a class as a function");aK(this,"xs",void 0),aK(this,"ys",void 0),aK(this,"c1s",void 0),aK(this,"c2s",void 0),aK(this,"c3s",void 0);for(var s,n,o,a=e.length,l=[],h=0;h<a;h++)l.push(h);l.sort(function(i,r){return e[i]<e[r]?-1:1});for(var c=[],d=[],u=[],f=0;f<a-1;f++)s=e[f+1]-e[f],n=r[f+1]-r[f],d.push(s),c.push(n),u.push(n/s);for(var p=[u[0]],_=0;_<d.length-1;_++){var g=u[_],v=u[_+1];if(g*v<=0)p.push(0);else{s=d[_];var m=d[_+1],S=s+m;p.push(3*S/((S+m)/g+(S+s)/v))}}p.push(u[u.length-1]);for(var y=[],b=[],w=0;w<p.length-1;w++){o=u[w];var C=p[w],x=1/d[w],k=C+p[w+1]-o-o;y.push((o-C-k)*x),b.push(k*x*x)}this.xs=e,this.ys=r,this.c1s=p,this.c2s=y,this.c3s=b}return e=[{key:"interpolate",value:function(e){var i,r=this.xs,s=this.ys,n=this.c1s,o=this.c2s,a=this.c3s,l=r.length-1;if(e===r[l])return s[l];for(var h=0,c=a.length-1;h<=c;){var d=r[i=Math.floor(.5*(h+c))];if(d<e)h=i+1;else{if(!(d>e))return s[i];c=i-1}}var u=e-r[l=Math.max(0,c)],f=u*u;return s[l]+n[l]*u+o[l]*f+a[l]*u*f}}],function(e,i){for(var r=0;r<i.length;r++){var s=i[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(i.prototype,e),i}();function aY(e){var i=1===e.nodeType?e:e.parentElement;if(!i)return null;var r=i.getBoundingClientRect(),s=r.top;return{x:r.left,y:s}}function aq(e){return{x:e.clientX,y:e.clientY}}var aX="__NATIVE_FILE__",aV="__NATIVE_URL__",aG="__NATIVE_TEXT__",aZ="__NATIVE_HTML__";function aJ(e,i,r){var s=i.reduce(function(i,r){return i||e.getData(r)},"");return null!=s?s:r}function aQ(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}e.s(["FILE",()=>aX,"HTML",()=>aZ,"TEXT",()=>aG,"URL",()=>aV],59368);var a0=(aQ(O={},aX,{exposeProperties:{files:function(e){return Array.prototype.slice.call(e.files)},items:function(e){return e.items},dataTransfer:function(e){return e}},matchesTypes:["Files"]}),aQ(O,aZ,{exposeProperties:{html:function(e,i){return aJ(e,i,"")},dataTransfer:function(e){return e}},matchesTypes:["Html","text/html"]}),aQ(O,aV,{exposeProperties:{urls:function(e,i){return aJ(e,i,"").split("\n")},dataTransfer:function(e){return e}},matchesTypes:["Url","text/uri-list"]}),aQ(O,aG,{exposeProperties:{text:function(e,i){return aJ(e,i,"")},dataTransfer:function(e){return e}},matchesTypes:["Text","text/plain"]}),O);function a1(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}var a2=function(){var e;function i(e){if(!(this instanceof i))throw TypeError("Cannot call a class as a function");a1(this,"item",void 0),a1(this,"config",void 0),this.config=e,this.item={},this.initializeExposedProperties()}return e=[{key:"initializeExposedProperties",value:function(){var e=this;Object.keys(this.config.exposeProperties).forEach(function(i){Object.defineProperty(e.item,i,{configurable:!0,enumerable:!0,get:function(){return console.warn("Browser doesn't allow reading \"".concat(i,'" until the drop event.')),null}})})}},{key:"loadDataTransfer",value:function(e){var i=this;if(e){var r={};Object.keys(this.config.exposeProperties).forEach(function(s){r[s]={value:i.config.exposeProperties[s](e,i.config.matchesTypes),configurable:!0,enumerable:!0}}),Object.defineProperties(this.item,r)}}},{key:"canDrag",value:function(){return!0}},{key:"beginDrag",value:function(){return this.item}},{key:"isDragging",value:function(e,i){return i===e.getSourceId()}},{key:"endDrag",value:function(){}}],function(e,i){for(var r=0;r<i.length;r++){var s=i[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(i.prototype,e),i}();function a5(e){if(!e)return null;var i=Array.prototype.slice.call(e.types||[]);return Object.keys(a0).filter(function(e){return a0[e].matchesTypes.some(function(e){return i.indexOf(e)>-1})})[0]||null}var a3=e.i(59368);function a6(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}var a4=function(){var e;function i(e,r){if(!(this instanceof i))throw TypeError("Cannot call a class as a function");a6(this,"ownerDocument",null),a6(this,"globalContext",void 0),a6(this,"optionsArgs",void 0),this.globalContext=e,this.optionsArgs=r}return e=[{key:"window",get:function(){return this.globalContext?this.globalContext:"u">typeof window?window:void 0}},{key:"document",get:function(){var e;return null!=(e=this.globalContext)&&e.document?this.globalContext.document:this.window?this.window.document:void 0}},{key:"rootElement",get:function(){var e;return(null==(e=this.optionsArgs)?void 0:e.rootElement)||this.window}}],function(e,i){for(var r=0;r<i.length;r++){var s=i[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(i.prototype,e),i}();function a8(e,i){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);i&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,s)}return r}function a7(e){for(var i=1;i<arguments.length;i++){var r=null!=arguments[i]?arguments[i]:{};i%2?a8(Object(r),!0).forEach(function(i){a9(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a8(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function a9(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}var le=function(){var e;function i(e,r,s){var n=this;if(!(this instanceof i))throw TypeError("Cannot call a class as a function");a9(this,"options",void 0),a9(this,"actions",void 0),a9(this,"monitor",void 0),a9(this,"registry",void 0),a9(this,"enterLeaveCounter",void 0),a9(this,"sourcePreviewNodes",new Map),a9(this,"sourcePreviewNodeOptions",new Map),a9(this,"sourceNodes",new Map),a9(this,"sourceNodeOptions",new Map),a9(this,"dragStartSourceIds",null),a9(this,"dropTargetIds",[]),a9(this,"dragEnterTargetIds",[]),a9(this,"currentNativeSource",null),a9(this,"currentNativeHandle",null),a9(this,"currentDragSourceNode",null),a9(this,"altKeyPressed",!1),a9(this,"mouseMoveTimeoutTimer",null),a9(this,"asyncEndDragFrameId",null),a9(this,"dragOverTargetIds",null),a9(this,"lastClientOffset",null),a9(this,"hoverRafId",null),a9(this,"getSourceClientOffset",function(e){var i=n.sourceNodes.get(e);return i&&aY(i)||null}),a9(this,"endDragNativeItem",function(){n.isDraggingNativeItem()&&(n.actions.endDrag(),n.currentNativeHandle&&n.registry.removeSource(n.currentNativeHandle),n.currentNativeHandle=null,n.currentNativeSource=null)}),a9(this,"isNodeInDocument",function(e){return!!(e&&n.document&&n.document.body&&n.document.body.contains(e))}),a9(this,"endDragIfSourceWasRemovedFromDOM",function(){var e=n.currentDragSourceNode;!(null==e||n.isNodeInDocument(e))&&n.clearCurrentDragSourceNode()&&n.monitor.isDragging()&&n.actions.endDrag()}),a9(this,"handleTopDragStartCapture",function(){n.clearCurrentDragSourceNode(),n.dragStartSourceIds=[]}),a9(this,"handleTopDragStart",function(e){if(!e.defaultPrevented){var i=n.dragStartSourceIds;n.dragStartSourceIds=null;var r=aq(e);n.monitor.isDragging()&&n.actions.endDrag(),n.actions.beginDrag(i||[],{publishSource:!1,getSourceClientOffset:n.getSourceClientOffset,clientOffset:r});var s=e.dataTransfer,o=a5(s);if(n.monitor.isDragging()){if(s&&"function"==typeof s.setDragImage){var a=n.monitor.getSourceId(),l=n.sourceNodes.get(a),h=n.sourcePreviewNodes.get(a)||l;if(h){var c,d,u,f,p,_,g,v,m,S,y,b,w,C,x,k,E,D,O=n.getCurrentSourcePreviewNodeOptions(),T=O.anchorX,P=O.anchorY,I=O.offsetX,R=O.offsetY,M=(c={anchorX:T,anchorY:P},d={offsetX:I,offsetY:R},p=aY((f="IMG"===h.nodeName&&(aF()||!(null!=(u=document.documentElement)&&u.contains(h))))?l:h),_={x:r.x-p.x,y:r.y-p.y},g=l.offsetWidth,v=l.offsetHeight,m=c.anchorX,S=c.anchorY,C=(y=f?h.width:g,b=f?h.height:v,a$()&&f&&(b/=window.devicePixelRatio,y/=window.devicePixelRatio),w={dragPreviewWidth:y,dragPreviewHeight:b}).dragPreviewWidth,x=w.dragPreviewHeight,k=d.offsetX,E=d.offsetY,{x:0===k||k?k:new aU([0,.5,1],[_.x,_.x/g*C,_.x+C-g]).interpolate(m),y:0===E||E?E:(D=new aU([0,.5,1],[_.y,_.y/v*x,_.y+x-v]).interpolate(S),a$()&&f&&(D+=(window.devicePixelRatio-1)*x),D)});s.setDragImage(h,M.x,M.y)}}try{null==s||s.setData("application/json",{})}catch(e){}n.setCurrentDragSourceNode(e.target),n.getCurrentSourcePreviewNodeOptions().captureDraggingState?n.actions.publishDragSource():setTimeout(function(){return n.actions.publishDragSource()},0)}else if(o)n.beginDragNativeItem(o);else{if(s&&!s.types&&(e.target&&!e.target.hasAttribute||!e.target.hasAttribute("draggable")))return;e.preventDefault()}}}),a9(this,"handleTopDragEndCapture",function(){n.clearCurrentDragSourceNode()&&n.monitor.isDragging()&&n.actions.endDrag()}),a9(this,"handleTopDragEnterCapture",function(e){if(n.dragEnterTargetIds=[],!(!n.enterLeaveCounter.enter(e.target)||n.monitor.isDragging())){var i=e.dataTransfer,r=a5(i);r&&n.beginDragNativeItem(r,i)}}),a9(this,"handleTopDragEnter",function(e){var i=n.dragEnterTargetIds;n.dragEnterTargetIds=[],n.monitor.isDragging()&&(n.altKeyPressed=e.altKey,i.length>0&&n.actions.hover(i,{clientOffset:aq(e)}),i.some(function(e){return n.monitor.canDropOnTarget(e)})&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=n.getCurrentDropEffect())))}),a9(this,"handleTopDragOverCapture",function(){n.dragOverTargetIds=[]}),a9(this,"handleTopDragOver",function(e){var i=n.dragOverTargetIds;if(n.dragOverTargetIds=[],!n.monitor.isDragging()){e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none");return}n.altKeyPressed=e.altKey,n.lastClientOffset=aq(e),null===n.hoverRafId&&"u">typeof requestAnimationFrame&&(n.hoverRafId=requestAnimationFrame(function(){n.monitor.isDragging()&&n.actions.hover(i||[],{clientOffset:n.lastClientOffset}),n.hoverRafId=null})),(i||[]).some(function(e){return n.monitor.canDropOnTarget(e)})?(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=n.getCurrentDropEffect())):n.isDraggingNativeItem()?e.preventDefault():(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none"))}),a9(this,"handleTopDragLeaveCapture",function(e){n.isDraggingNativeItem()&&e.preventDefault(),n.enterLeaveCounter.leave(e.target)&&n.isDraggingNativeItem()&&setTimeout(function(){return n.endDragNativeItem()},0)}),a9(this,"handleTopDropCapture",function(e){if(n.dropTargetIds=[],n.isDraggingNativeItem()){var i;e.preventDefault(),null==(i=n.currentNativeSource)||i.loadDataTransfer(e.dataTransfer)}else a5(e.dataTransfer)&&e.preventDefault();n.enterLeaveCounter.reset()}),a9(this,"handleTopDrop",function(e){var i=n.dropTargetIds;n.dropTargetIds=[],n.actions.hover(i,{clientOffset:aq(e)}),n.actions.drop({dropEffect:n.getCurrentDropEffect()}),n.isDraggingNativeItem()?n.endDragNativeItem():n.monitor.isDragging()&&n.actions.endDrag()}),a9(this,"handleSelectStart",function(e){var i=e.target;"function"!=typeof i.dragDrop||"INPUT"===i.tagName||"SELECT"===i.tagName||"TEXTAREA"===i.tagName||i.isContentEditable||(e.preventDefault(),i.dragDrop())}),this.options=new a4(r,s),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new az(this.isNodeInDocument)}return e=[{key:"profile",value:function(){var e,i;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:(null==(e=this.dragStartSourceIds)?void 0:e.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:(null==(i=this.dragOverTargetIds)?void 0:i.length)||0}}},{key:"window",get:function(){return this.options.window}},{key:"document",get:function(){return this.options.document}},{key:"rootElement",get:function(){return this.options.rootElement}},{key:"setup",value:function(){var e=this.rootElement;if(void 0!==e){if(e.__isReactDndBackendSetUp)throw Error("Cannot have two HTML5 backends at the same time.");e.__isReactDndBackendSetUp=!0,this.addEventListeners(e)}}},{key:"teardown",value:function(){var e,i=this.rootElement;void 0!==i&&(i.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId&&(null==(e=this.window)||e.cancelAnimationFrame(this.asyncEndDragFrameId)))}},{key:"connectDragPreview",value:function(e,i,r){var s=this;return this.sourcePreviewNodeOptions.set(e,r),this.sourcePreviewNodes.set(e,i),function(){s.sourcePreviewNodes.delete(e),s.sourcePreviewNodeOptions.delete(e)}}},{key:"connectDragSource",value:function(e,i,r){var s=this;this.sourceNodes.set(e,i),this.sourceNodeOptions.set(e,r);var n=function(i){return s.handleDragStart(i,e)},o=function(e){return s.handleSelectStart(e)};return i.setAttribute("draggable","true"),i.addEventListener("dragstart",n),i.addEventListener("selectstart",o),function(){s.sourceNodes.delete(e),s.sourceNodeOptions.delete(e),i.removeEventListener("dragstart",n),i.removeEventListener("selectstart",o),i.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(e,i){var r=this,s=function(i){return r.handleDragEnter(i,e)},n=function(i){return r.handleDragOver(i,e)},o=function(i){return r.handleDrop(i,e)};return i.addEventListener("dragenter",s),i.addEventListener("dragover",n),i.addEventListener("drop",o),function(){i.removeEventListener("dragenter",s),i.removeEventListener("dragover",n),i.removeEventListener("drop",o)}}},{key:"addEventListeners",value:function(e){e.addEventListener&&(e.addEventListener("dragstart",this.handleTopDragStart),e.addEventListener("dragstart",this.handleTopDragStartCapture,!0),e.addEventListener("dragend",this.handleTopDragEndCapture,!0),e.addEventListener("dragenter",this.handleTopDragEnter),e.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.addEventListener("dragover",this.handleTopDragOver),e.addEventListener("dragover",this.handleTopDragOverCapture,!0),e.addEventListener("drop",this.handleTopDrop),e.addEventListener("drop",this.handleTopDropCapture,!0))}},{key:"removeEventListeners",value:function(e){e.removeEventListener&&(e.removeEventListener("dragstart",this.handleTopDragStart),e.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),e.removeEventListener("dragend",this.handleTopDragEndCapture,!0),e.removeEventListener("dragenter",this.handleTopDragEnter),e.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.removeEventListener("dragover",this.handleTopDragOver),e.removeEventListener("dragover",this.handleTopDragOverCapture,!0),e.removeEventListener("drop",this.handleTopDrop),e.removeEventListener("drop",this.handleTopDropCapture,!0))}},{key:"getCurrentSourceNodeOptions",value:function(){var e=this.monitor.getSourceId(),i=this.sourceNodeOptions.get(e);return a7({dropEffect:this.altKeyPressed?"copy":"move"},i||{})}},{key:"getCurrentDropEffect",value:function(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}},{key:"getCurrentSourcePreviewNodeOptions",value:function(){var e=this.monitor.getSourceId();return a7({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}},{key:"isDraggingNativeItem",value:function(){var e=this.monitor.getItemType();return Object.keys(a3).some(function(i){return a3[i]===e})}},{key:"beginDragNativeItem",value:function(e,i){var r;this.clearCurrentDragSourceNode(),this.currentNativeSource=((r=new a2(a0[e])).loadDataTransfer(i),r),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}},{key:"setCurrentDragSourceNode",value:function(e){var i=this;this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e,this.mouseMoveTimeoutTimer=setTimeout(function(){var e;return null==(e=i.rootElement)?void 0:e.addEventListener("mousemove",i.endDragIfSourceWasRemovedFromDOM,!0)},1e3)}},{key:"clearCurrentDragSourceNode",value:function(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var e;null==(e=this.window)||e.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}},{key:"handleDragStart",value:function(e,i){e.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(i))}},{key:"handleDragEnter",value:function(e,i){this.dragEnterTargetIds.unshift(i)}},{key:"handleDragOver",value:function(e,i){null===this.dragOverTargetIds&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(i)}},{key:"handleDrop",value:function(e,i){this.dropTargetIds.unshift(i)}}],function(e,i){for(var r=0;r<i.length;r++){var s=i[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(i.prototype,e),i}(),lt=function(e,i,r){return new le(e,i,r)},li="dnd-core/INIT_COORDS",lr="dnd-core/BEGIN_DRAG",ls="dnd-core/PUBLISH_DRAG_SOURCE",ln="dnd-core/HOVER",lo="dnd-core/DROP",la="dnd-core/END_DRAG";function ll(e,i){return{type:li,payload:{sourceClientOffset:i||null,clientOffset:e||null}}}function lh(e){return(lh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function lc(e){return"object"===lh(e)}var ld={type:li,payload:{clientOffset:null,sourceClientOffset:null}};function lu(e,i){return null===i?null===e:Array.isArray(e)?e.some(function(e){return e===i}):e===i}function lf(e,i){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);i&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,s)}return r}function lp(e){for(var i=1;i<arguments.length;i++){var r=null!=arguments[i]?arguments[i]:{};i%2?lf(Object(r),!0).forEach(function(i){var s,n,o;s=e,n=i,o=r[i],n in s?Object.defineProperty(s,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):s[n]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lf(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function l_(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}var lg=function(){var e;function i(e,r){var s=this;if(!(this instanceof i))throw TypeError("Cannot call a class as a function");l_(this,"store",void 0),l_(this,"monitor",void 0),l_(this,"backend",void 0),l_(this,"isSetUp",!1),l_(this,"handleRefCountChange",function(){var e=s.store.getState().refCount>0;s.backend&&(e&&!s.isSetUp?(s.backend.setup(),s.isSetUp=!0):!e&&s.isSetUp&&(s.backend.teardown(),s.isSetUp=!1))}),this.store=e,this.monitor=r,e.subscribe(this.handleRefCountChange)}return e=[{key:"receiveBackend",value:function(e){this.backend=e}},{key:"getMonitor",value:function(){return this.monitor}},{key:"getBackend",value:function(){return this.backend}},{key:"getRegistry",value:function(){return this.monitor.registry}},{key:"getActions",value:function(){var e,i,r,s,n,o=this,a=this.store.dispatch,l={beginDrag:(e=this,function(){var i,r,s,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{publishSource:!0},a=o.publishSource,l=o.clientOffset,h=o.getSourceClientOffset,c=e.getMonitor(),d=e.getRegistry();e.dispatch(ll(l)),i=n,r=c,s=d,oG(!r.isDragging(),"Cannot call beginDrag while dragging."),i.forEach(function(e){oG(s.getSource(e),"Expected sourceIds to be registered.")});var u=function(e,i){for(var r=null,s=e.length-1;s>=0;s--)if(i.canDragSource(e[s])){r=e[s];break}return r}(n,c);if(null===u)return void e.dispatch(ld);var f=null;if(l){if(!h)throw Error("getSourceClientOffset must be defined");oG("function"==typeof h,"When clientOffset is provided, getSourceClientOffset must be a function."),f=h(u)}e.dispatch(ll(l,f));var p=d.getSource(u).beginDrag(c,u);if(null!=p)return oG(lc(p),"Item must be an object."),d.pinSource(u),{type:lr,payload:{itemType:d.getSourceType(u),item:p,sourceId:u,clientOffset:l||null,sourceClientOffset:f||null,isSourcePublic:!!(void 0===a||a)}}}),publishDragSource:(i=this,function(){if(i.getMonitor().isDragging())return{type:ls}}),hover:(r=this,function(e){var i,s,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=o.clientOffset;oG(Array.isArray(e),"Expected targetIds to be an array.");var l=e.slice(0),h=r.getMonitor(),c=r.getRegistry();return function(e,i,r){oG(i.isDragging(),"Cannot call hover while not dragging."),oG(!i.didDrop(),"Cannot call hover after drop.");for(var s=0;s<e.length;s++){var n=e[s];oG(e.lastIndexOf(n)===s,"Expected targetIds to be unique in the passed array."),oG(r.getTarget(n),"Expected targetIds to be registered.")}}(l,h,c),function(e,i,r){for(var s=e.length-1;s>=0;s--){var n=e[s];lu(i.getTargetType(n),r)||e.splice(s,1)}}(l,c,h.getItemType()),i=l,s=h,n=c,i.forEach(function(e){n.getTarget(e).hover(s,e)}),{type:ln,payload:{targetIds:l,clientOffset:a||null}}}),drop:(s=this,function(){var e,i,r,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=s.getMonitor(),a=s.getRegistry();oG((e=o).isDragging(),"Cannot call drop while not dragging."),oG(!e.didDrop(),"Cannot call drop twice during one drag operation."),((r=(i=o).getTargetIds().filter(i.canDropOnTarget,i)).reverse(),r).forEach(function(e,i){var r,l,h,c,d,u,f,p=(r=e,l=i,h=a,c=o,oG(void 0===(f=u=(d=h.getTarget(r))?d.drop(c,r):void 0)||lc(f),"Drop result must either be an object or undefined."),void 0===u&&(u=0===l?{}:c.getDropResult()),u),_={type:lo,payload:{dropResult:lp(lp({},n),p)}};s.dispatch(_)})}),endDrag:(n=this,function(){var e=n.getMonitor(),i=n.getRegistry();oG(e.isDragging(),"Cannot call endDrag while not dragging.");var r=e.getSourceId();return null!=r&&(i.getSource(r,!0).endDrag(e,r),i.unpinSource()),{type:la}})};return Object.keys(l).reduce(function(e,i){var r=l[i];return e[i]=function(){for(var e=arguments.length,i=Array(e),s=0;s<e;s++)i[s]=arguments[s];var n=r.apply(o,i);void 0!==n&&a(n)},e},{})}},{key:"dispatch",value:function(e){this.store.dispatch(e)}}],function(e,i){for(var r=0;r<i.length;r++){var s=i[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(i.prototype,e),i}();function lv(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var lm="function"==typeof Symbol&&Symbol.observable||"@@observable",lS=function(){return Math.random().toString(36).substring(7).split("").join(".")},ly={INIT:"@@redux/INIT"+lS(),REPLACE:"@@redux/REPLACE"+lS(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+lS()}},lb=function(e,i){return e===i};function lw(e,i){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);i&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,s)}return r}function lC(e){for(var i=1;i<arguments.length;i++){var r=null!=arguments[i]?arguments[i]:{};i%2?lw(Object(r),!0).forEach(function(i){var s,n,o;s=e,n=i,o=r[i],n in s?Object.defineProperty(s,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):s[n]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lw(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}var lx={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null},lk="dnd-core/ADD_SOURCE",lE="dnd-core/ADD_TARGET",lD="dnd-core/REMOVE_SOURCE",lO="dnd-core/REMOVE_TARGET";function lT(e,i){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);i&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,s)}return r}function lP(e){for(var i=1;i<arguments.length;i++){var r=null!=arguments[i]?arguments[i]:{};i%2?lT(Object(r),!0).forEach(function(i){var s,n,o;s=e,n=i,o=r[i],n in s?Object.defineProperty(s,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):s[n]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lT(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}var lI={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null},lR=[],lM=[];function lN(e,i){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);i&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,s)}return r}function lL(e){for(var i=1;i<arguments.length;i++){var r=null!=arguments[i]?arguments[i]:{};i%2?lN(Object(r),!0).forEach(function(i){var s,n,o;s=e,n=i,o=r[i],n in s?Object.defineProperty(s,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):s[n]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lN(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function lB(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];var e,i,r,s=arguments.length>1?arguments[1]:void 0;switch(s.type){case ln:break;case lk:case lE:case lO:case lD:return lR;default:return lM}var n=s.payload,o=n.targetIds,a=void 0===o?[]:o,l=n.prevTargetIds,h=void 0===l?[]:l,c=(e=new Map,i=function(i){e.set(i,e.has(i)?e.get(i)+1:1)},a.forEach(i),h.forEach(i),r=[],e.forEach(function(e,i){1===e&&r.push(i)}),r);if(!(c.length>0||!function(e,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:lb;if(e.length!==i.length)return!1;for(var s=0;s<e.length;++s)if(!r(e[s],i[s]))return!1;return!0}(a,h)))return lR;var d=h[h.length-1],u=a[a.length-1];return d!==u&&(d&&c.push(d),u&&c.push(u)),c}(i.dirtyHandlerIds,{type:r.type,payload:lL(lL({},r.payload),{},{prevTargetIds:(e=[],"dragOperation.targetIds".split(".").reduce(function(i,r){return i&&i[r]?i[r]:e||null},i))})}),dragOffset:function(){var e,i,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:lx,s=arguments.length>1?arguments[1]:void 0,n=s.payload;switch(s.type){case li:case lr:return{initialSourceClientOffset:n.sourceClientOffset,initialClientOffset:n.clientOffset,clientOffset:n.clientOffset};case ln:if(e=r.clientOffset,i=n.clientOffset,!e&&!i||e&&i&&e.x===i.x&&e.y===i.y)return r;return lC(lC({},r),{},{clientOffset:n.clientOffset});case la:case lo:return lx;default:return r}}(i.dragOffset,r),refCount:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1?arguments[1]:void 0;switch(i.type){case lk:case lE:return e+1;case lD:case lO:return e-1;default:return e}}(i.refCount,r),dragOperation:function(){var e,i,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:lI,s=arguments.length>1?arguments[1]:void 0,n=s.payload;switch(s.type){case lr:return lP(lP({},r),{},{itemType:n.itemType,item:n.item,sourceId:n.sourceId,isSourcePublic:n.isSourcePublic,dropResult:null,didDrop:!1});case ls:return lP(lP({},r),{},{isSourcePublic:!0});case ln:return lP(lP({},r),{},{targetIds:n.targetIds});case lO:if(-1===r.targetIds.indexOf(n.targetId))return r;return lP(lP({},r),{},{targetIds:(e=r.targetIds,i=n.targetId,e.filter(function(e){return e!==i}))});case lo:return lP(lP({},r),{},{dropResult:n.dropResult,didDrop:!0,targetIds:[]});case la:return lP(lP({},r),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return r}}(i.dragOperation,r),stateId:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e+1}(i.stateId)}}function lA(e,i){return{x:e.x-i.x,y:e.y-i.y}}lR.__IS_NONE__=!0,lM.__IS_ALL__=!0;function lj(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}var lH=function(){var e;function i(e,r){if(!(this instanceof i))throw TypeError("Cannot call a class as a function");lj(this,"store",void 0),lj(this,"registry",void 0),this.store=e,this.registry=r}return e=[{key:"subscribeToStateChange",value:function(e){var i=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{handlerIds:void 0},s=r.handlerIds;oG("function"==typeof e,"listener must be a function."),oG(void 0===s||Array.isArray(s),"handlerIds, when specified, must be an array of strings.");var n=this.store.getState().stateId;return this.store.subscribe(function(){var r=i.store.getState(),o=r.stateId;try{o===n||o===n+1&&!function(e,i){return e!==lR&&(e===lM||void 0===i||i.filter(function(i){return e.indexOf(i)>-1}).length>0)}(r.dirtyHandlerIds,s)||e()}finally{n=o}})}},{key:"subscribeToOffsetChange",value:function(e){var i=this;oG("function"==typeof e,"listener must be a function.");var r=this.store.getState().dragOffset;return this.store.subscribe(function(){var s=i.store.getState().dragOffset;s!==r&&(r=s,e())})}},{key:"canDragSource",value:function(e){if(!e)return!1;var i=this.registry.getSource(e);return oG(i,"Expected to find a valid source. sourceId=".concat(e)),!this.isDragging()&&i.canDrag(this,e)}},{key:"canDropOnTarget",value:function(e){if(!e)return!1;var i=this.registry.getTarget(e);return oG(i,"Expected to find a valid target. targetId=".concat(e)),!(!this.isDragging()||this.didDrop())&&lu(this.registry.getTargetType(e),this.getItemType())&&i.canDrop(this,e)}},{key:"isDragging",value:function(){return!!this.getItemType()}},{key:"isDraggingSource",value:function(e){if(!e)return!1;var i=this.registry.getSource(e,!0);return oG(i,"Expected to find a valid source. sourceId=".concat(e)),!!this.isDragging()&&!!this.isSourcePublic()&&this.registry.getSourceType(e)===this.getItemType()&&i.isDragging(this,e)}},{key:"isOverTarget",value:function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shallow:!1};if(!e)return!1;var r=i.shallow;if(!this.isDragging())return!1;var s=this.registry.getTargetType(e),n=this.getItemType();if(n&&!lu(s,n))return!1;var o=this.getTargetIds();if(!o.length)return!1;var a=o.indexOf(e);return r?a===o.length-1:a>-1}},{key:"getItemType",value:function(){return this.store.getState().dragOperation.itemType}},{key:"getItem",value:function(){return this.store.getState().dragOperation.item}},{key:"getSourceId",value:function(){return this.store.getState().dragOperation.sourceId}},{key:"getTargetIds",value:function(){return this.store.getState().dragOperation.targetIds}},{key:"getDropResult",value:function(){return this.store.getState().dragOperation.dropResult}},{key:"didDrop",value:function(){return this.store.getState().dragOperation.didDrop}},{key:"isSourcePublic",value:function(){return!!this.store.getState().dragOperation.isSourcePublic}},{key:"getInitialClientOffset",value:function(){return this.store.getState().dragOffset.initialClientOffset}},{key:"getInitialSourceClientOffset",value:function(){return this.store.getState().dragOffset.initialSourceClientOffset}},{key:"getClientOffset",value:function(){return this.store.getState().dragOffset.clientOffset}},{key:"getSourceClientOffset",value:function(){return function(e){var i=e.clientOffset,r=e.initialClientOffset,s=e.initialSourceClientOffset;return i&&r&&s?lA({x:i.x+s.x,y:i.y+s.y},r):null}(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){var e,i,r;return i=(e=this.store.getState().dragOffset).clientOffset,r=e.initialClientOffset,i&&r?lA(i,r):null}}],function(e,i){for(var r=0;r<i.length;r++){var s=i[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(i.prototype,e),i}(),lW=0;function lz(e){return(lz="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function lF(e,i){i&&Array.isArray(e)?e.forEach(function(e){return lF(e,!1)}):oG("string"==typeof e||"symbol"===lz(e),i?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}(k=T||(T={})).SOURCE="SOURCE",k.TARGET="TARGET";let l$=e.g,lK=l$.MutationObserver||l$.WebKitMutationObserver;function lU(e){return function(){let i=setTimeout(s,0),r=setInterval(s,50);function s(){clearTimeout(i),clearInterval(r),e()}}}let lY="function"==typeof lK?function(e){let i=1,r=new lK(e),s=document.createTextNode("");return r.observe(s,{characterData:!0}),function(){s.data=i=-i}}:lU;class lq{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,i){this.onError=e,this.release=i,this.task=null}}let lX=new class{enqueueTask(e){let{queue:i,requestFlush:r}=this;i.length||(r(),this.flushing=!0),i[i.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{let{queue:e}=this;for(;this.index<e.length;){let i=this.index;if(this.index++,e[i].call(),this.index>this.capacity){for(let i=0,r=e.length-this.index;i<r;i++)e[i]=e[i+this.index];e.length-=this.index,this.index=0}}e.length=0,this.index=0,this.flushing=!1},this.registerPendingError=e=>{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=lY(this.flush),this.requestErrorThrow=lU(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},lV=new class{create(e){let i=this.freeTasks,r=i.length?i.pop():new lq(this.onError,e=>i[i.length]=e);return r.task=e,r}constructor(e){this.onError=e,this.freeTasks=[]}}(lX.registerPendingError);function lG(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}function lZ(e,i){(null==i||i>e.length)&&(i=e.length);for(var r=0,s=Array(i);r<i;r++)s[r]=e[r];return s}function lJ(e){switch(e[0]){case"S":return T.SOURCE;case"T":return T.TARGET;default:oG(!1,"Cannot parse handler ID: ".concat(e))}}function lQ(e,i){var r=e.entries(),s=!1;do{var n,o=r.next(),a=o.done;if((n=o.value,function(e){if(Array.isArray(e))return e}(n)||function(e,i){var r,s,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),2!==o.length);a=!0);}catch(e){l=!0,s=e}finally{try{a||null==n.return||n.return()}finally{if(l)throw s}}return o}}(n,2)||function(e,i){if(e){if("string"==typeof e)return lZ(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return lZ(e,2)}}(n,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[1]===i)return!0;s=!!a}while(!s)return!1}var l0=function(){var e;function i(e){if(!(this instanceof i))throw TypeError("Cannot call a class as a function");lG(this,"types",new Map),lG(this,"dragSources",new Map),lG(this,"dropTargets",new Map),lG(this,"pinnedSourceId",null),lG(this,"pinnedSource",null),lG(this,"store",void 0),this.store=e}return e=[{key:"addSource",value:function(e,i){lF(e),oG("function"==typeof i.canDrag,"Expected canDrag to be a function."),oG("function"==typeof i.beginDrag,"Expected beginDrag to be a function."),oG("function"==typeof i.endDrag,"Expected endDrag to be a function.");var r=this.addHandler(T.SOURCE,e,i);return this.store.dispatch({type:lk,payload:{sourceId:r}}),r}},{key:"addTarget",value:function(e,i){lF(e,!0),oG("function"==typeof i.canDrop,"Expected canDrop to be a function."),oG("function"==typeof i.hover,"Expected hover to be a function."),oG("function"==typeof i.drop,"Expected beginDrag to be a function.");var r=this.addHandler(T.TARGET,e,i);return this.store.dispatch({type:lE,payload:{targetId:r}}),r}},{key:"containsHandler",value:function(e){return lQ(this.dragSources,e)||lQ(this.dropTargets,e)}},{key:"getSource",value:function(e){var i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return oG(this.isSourceId(e),"Expected a valid source ID."),i&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}},{key:"getTarget",value:function(e){return oG(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}},{key:"getSourceType",value:function(e){return oG(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}},{key:"getTargetType",value:function(e){return oG(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}},{key:"isSourceId",value:function(e){return lJ(e)===T.SOURCE}},{key:"isTargetId",value:function(e){return lJ(e)===T.TARGET}},{key:"removeSource",value:function(e){var i=this;oG(this.getSource(e),"Expected an existing source."),this.store.dispatch({type:lD,payload:{sourceId:e}}),lX.enqueueTask(lV.create(function(){i.dragSources.delete(e),i.types.delete(e)}))}},{key:"removeTarget",value:function(e){oG(this.getTarget(e),"Expected an existing target."),this.store.dispatch({type:lO,payload:{targetId:e}}),this.dropTargets.delete(e),this.types.delete(e)}},{key:"pinSource",value:function(e){var i=this.getSource(e);oG(i,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=i}},{key:"unpinSource",value:function(){oG(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(e,i,r){var s=function(e){var i=(lW++).toString();switch(e){case T.SOURCE:return"S".concat(i);case T.TARGET:return"T".concat(i);default:throw Error("Unknown Handler Role: ".concat(e))}}(e);return this.types.set(s,i),e===T.SOURCE?this.dragSources.set(s,r):e===T.TARGET&&this.dropTargets.set(s,r),s}}],function(e,i){for(var r=0;r<i.length;r++){var s=i[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(i.prototype,e),i}(),l1=["children"];function l2(e,i){(null==i||i>e.length)&&(i=e.length);for(var r=0,s=Array(i);r<i;r++)s[r]=e[r];return s}var l5=0,l3=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),l6=(0,R.memo)(function(i){var r,s,n=i.children,o=function(e){if(Array.isArray(e))return e}(s="manager"in(r=function(e,i){if(null==e)return{};var r,s,n=function(e,i){if(null==e)return{};var r,s,n={},o=Object.keys(e);for(s=0;s<o.length;s++)r=o[s],i.indexOf(r)>=0||(n[r]=e[r]);return n}(e,i);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)r=o[s],!(i.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}(i,l1))?[{dragDropManager:r.manager},!1]:[function(i){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return e.g}(),s=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;return r[l3]||(r[l3]={dragDropManager:function(e){var i,r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=(i=o,r="u">typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__,function e(i,r,s){if("function"==typeof r&&"function"==typeof s||"function"==typeof s&&"function"==typeof arguments[3])throw Error(lv(0));if("function"==typeof r&&void 0===s&&(s=r,r=void 0),void 0!==s){if("function"!=typeof s)throw Error(lv(1));return s(e)(i,r)}if("function"!=typeof i)throw Error(lv(2));var n,o=i,a=r,l=[],h=l,c=!1;function d(){h===l&&(h=l.slice())}function u(){if(c)throw Error(lv(3));return a}function f(e){if("function"!=typeof e)throw Error(lv(4));if(c)throw Error(lv(5));var i=!0;return d(),h.push(e),function(){if(i){if(c)throw Error(lv(6));i=!1,d();var r=h.indexOf(e);h.splice(r,1),l=null}}}function p(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var i=e;null!==Object.getPrototypeOf(i);)i=Object.getPrototypeOf(i);return Object.getPrototypeOf(e)===i}(e))throw Error(lv(7));if(void 0===e.type)throw Error(lv(8));if(c)throw Error(lv(9));try{c=!0,a=o(a,e)}finally{c=!1}for(var i=l=h,r=0;r<i.length;r++)(0,i[r])();return e}return p({type:ly.INIT}),(n={dispatch:p,subscribe:f,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw Error(lv(10));o=e,p({type:ly.REPLACE})}})[lm]=function(){var e;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw Error(lv(11));function i(){e.next&&e.next(u())}return i(),{unsubscribe:f(i)}}})[lm]=function(){return this},e},n}(lB,i&&r&&r({name:"dnd-core",instanceId:"dnd-core"}))),l=new lH(a,new l0(a)),h=new lg(a,l),c=e(h,s,n);return h.receiveBackend(c),h}(i,r,s,n)}),r[l3]}(r.backend,r.context,r.options,r.debugMode),!r.context])||function(e,i){var r,s,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),2!==o.length);a=!0);}catch(e){l=!0,s=e}finally{try{a||null==n.return||n.return()}finally{if(l)throw s}}return o}}(s,2)||function(e,i){if(e){if("string"==typeof e)return l2(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return l2(e,2)}}(s,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),a=o[0],l=o[1];return(0,R.useEffect)(function(){if(l){var i=e.g;return++l5,function(){0==--l5&&(i[l3]=null)}}},[]),(0,I.jsx)(oZ.Provider,Object.assign({value:a},{children:n}),void 0)});let l4=ou();function l8({treeProps:e,imperativeHandle:i,children:r}){let s=(0,R.useRef)(null),n=(0,R.useRef)(null),o=(0,R.useRef)(function e(i,r,s){if("function"!=typeof i)throw Error(aM(2));if("function"==typeof r&&"function"==typeof s||"function"==typeof s&&"function"==typeof arguments[3])throw Error(aM(0));if("function"==typeof r&&void 0===s&&(s=r,r=void 0),void 0!==s){if("function"!=typeof s)throw Error(aM(1));return s(e)(i,r)}let n=i,o=r,a=new Map,l=a,h=0,c=!1;function d(){l===a&&(l=new Map,a.forEach((e,i)=>{l.set(i,e)}))}function u(){if(c)throw Error(aM(3));return o}function f(e){if("function"!=typeof e)throw Error(aM(4));if(c)throw Error(aM(5));let i=!0;d();let r=h++;return l.set(r,e),function(){if(i){if(c)throw Error(aM(6));i=!1,d(),l.delete(r),a=null}}}function p(e){if(!function(e){if("object"!=typeof e||null===e)return!1;let i=e;for(;null!==Object.getPrototypeOf(i);)i=Object.getPrototypeOf(i);return Object.getPrototypeOf(e)===i||null===Object.getPrototypeOf(e)}(e))throw Error(aM(7));if(void 0===e.type)throw Error(aM(8));if("string"!=typeof e.type)throw Error(aM(17));if(c)throw Error(aM(9));try{c=!0,o=n(o,e)}finally{c=!1}return(a=l).forEach(e=>{e()}),e}return p({type:aB.INIT}),{dispatch:p,subscribe:f,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw Error(aM(10));n=e,p({type:aB.REPLACE})},[aN]:function(){return{subscribe(e){if("object"!=typeof e||null===e)throw Error(aM(11));function i(){e.next&&e.next(u())}return i(),{unsubscribe:f(i)}},[aN](){return this}}}}}(aj,ou(e))),a=(0,nA.useSyncExternalStore)(o.current.subscribe,o.current.getState,()=>l4),l=(0,R.useMemo)(()=>new aR(o.current,e,s,n),[]),h=(0,R.useRef)(0);return(0,R.useMemo)(()=>{h.current+=1,l.update(e)},[...Object.values(e),a.nodes.open]),(0,R.useImperativeHandle)(i,()=>l),(0,R.useEffect)(()=>{l.props.selection?l.select(l.props.selection,{focus:!1}):l.deselectAll()},[l.props.selection]),(0,R.useEffect)(()=>{l.props.searchTerm||o.current.dispatch({type:"VISIBILITY_CLEAR",filtered:!0})},[l.props.searchTerm]),(0,I.jsx)(nj.Provider,{value:l,children:(0,I.jsx)(nF.Provider,{value:h.current,children:(0,I.jsx)(nW.Provider,{value:a.nodes,children:(0,I.jsx)(nz.Provider,{value:a.dnd,children:(0,I.jsx)(l6,Object.assign({backend:lt,options:{rootElement:l.props.dndRootElement||void 0}},e.dndManager&&{manager:e.dndManager},{children:r}))})})})})}function l7(e){return!function(){let e=nH(),[,i]=ag(()=>({accept:"NODE",canDrop:(i,r)=>!!r.isOver({shallow:!0})&&e.canDrop(),hover:(i,r)=>{if(!r.isOver({shallow:!0}))return;let s=r.getClientOffset();if(!e.listEl.current||!s)return;let{cursor:n,drop:o}=ay({element:e.listEl.current,offset:s,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});o&&e.dispatch(om(o.parentId,o.index)),r.canDrop()?n&&e.showCursor(n):e.hideCursor()}}),[e]);i(e.listEl)}(),e.children}function l9(){let e=nH().props.renderContainer||ax;return(0,I.jsx)(I.Fragment,{children:(0,I.jsx)(e,{})})}function he(e,i){(null==i||i>e.length)&&(i=e.length);for(var r=0,s=Array(i);r<i;r++)s[r]=e[r];return s}function ht(){var e,i,r,s,n,o;let a=nH(),{offset:l,mouse:h,item:c,isDragging:d}=(e=e=>({offset:e.getSourceClientOffset(),mouse:e.getClientOffset(),item:e.getItem(),isDragging:e.isDragging()}),n=(s=function(e){if(Array.isArray(e))return e}(r=an(i=oJ().getMonitor(),e))||function(e,i){var r,s,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),2!==o.length);a=!0);}catch(e){l=!0,s=e}finally{try{a||null==n.return||n.return()}finally{if(l)throw s}}return o}}(r,2)||function(e,i){if(e){if("string"==typeof e)return he(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return he(e,2)}}(r,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],o=s[1],(0,R.useEffect)(function(){return i.subscribeToOffsetChange(o)}),(0,R.useEffect)(function(){return i.subscribeToStateChange(o)}),n),u=a.props.renderDragPreview||oy;return(0,I.jsx)(u,{offset:l,mouse:h,id:(null==c?void 0:c.id)||null,dragIds:(null==c?void 0:c.dragIds)||[],isDragging:d})}class hi{constructor(e){this.root=function(e){let i=new hs({id:"ROOT"},null);return i.children=e.map(e=>hr(e,i)),i}(e)}get data(){var e,i;return null!=(i=null==(e=this.root.children)?void 0:e.map(e=>e.data))?i:[]}create(e){let i=e.parentId?this.find(e.parentId):this.root;if(!i)return null;i.addChild(e.data,e.index)}move(e){let i=this.find(e.id),r=e.parentId?this.find(e.parentId):this.root;i&&r&&(r.addChild(i.data,e.index),i.drop())}update(e){let i=this.find(e.id);i&&i.update(e.changes)}drop(e){let i=this.find(e.id);i&&i.drop()}find(e,i=this.root){if(!i)return null;if(i.id===e)return i;if(i.children)for(let r of i.children){let i=this.find(e,r);if(i)return i}return null}}function hr(e,i){let r=new hs(e,i);return e.children&&(r.children=e.children.map(e=>hr(e,r))),r}class hs{constructor(e,i){this.data=e,this.parent=i,this.id=e.id}hasParent(){return!!this.parent}get childIndex(){return this.hasParent()?this.parent.children.indexOf(this):-1}addChild(e,i){var r,s;let n=hr(e,this);this.children=null!=(r=this.children)?r:[],this.children.splice(i,0,n),this.data.children=null!=(s=this.data.children)?s:[],this.data.children.splice(i,0,e)}removeChild(e){var i,r;null==(i=this.children)||i.splice(e,1),null==(r=this.data.children)||r.splice(e,1)}update(e){if(this.hasParent()){let i=this.childIndex;this.parent.addChild(Object.assign(Object.assign({},this.data),e),i),this.drop()}}drop(){this.hasParent()&&this.parent.removeChild(this.childIndex)}}let hn=0,ho=(0,R.forwardRef)(function(e,i){let r=function(e){if(e.initialData&&e.data)throw Error("React Arborist Tree => Provide either a data or initialData prop, but not both.");if(e.initialData&&(e.onCreate||e.onDelete||e.onMove||e.onRename))throw Error(`React Arborist Tree => You passed the initialData prop along with a data handler.
19
- Use the data prop if you want to provide your own handlers.`);if(!e.initialData)return e;{let[i,r]=function(e){let[i,r]=(0,R.useState)(e),s=(0,R.useMemo)(()=>new hi(i),[i]);return[i,{onMove:e=>{for(let i of e.dragIds)s.move({id:i,parentId:e.parentId,index:e.index});r(s.data)},onRename:({name:e,id:i})=>{s.update({id:i,changes:{name:e}}),r(s.data)},onCreate:({parentId:e,index:i,type:n})=>{let o={id:`simple-tree-id-${hn++}`,name:""};return"internal"===n&&(o.children=[]),s.create({parentId:e,index:i,data:o}),r(s.data),o},onDelete:e=>{e.ids.forEach(e=>s.drop({id:e})),r(s.data)}}]}(e.initialData);return Object.assign(Object.assign(Object.assign({},e),r),{data:i})}}(e);return(0,I.jsxs)(l8,{treeProps:r,imperativeHandle:i,children:[(0,I.jsx)(l7,{children:(0,I.jsx)(l9,{})}),(0,I.jsx)(ht,{})]})});var ha=e.i(99105),hl=e.i(76016),hh=e.i(76505),hh=hh;let hc=(0,B.default)("folder-closed",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M2 10h20",key:"1ir3d8"}]]),hd={current:null};function hu({node:e,style:i}){let r=e.data.isDirectory,s=e.isOpen;return(0,I.jsxs)("div",{style:i,className:(0,q.cn)("flex h-6 cursor-pointer items-center gap-1 rounded-sm px-1 text-[12px] select-none",e.isSelected?"bg-primary/10 text-foreground":"text-muted-foreground hover:bg-muted/60"),onMouseDown:i=>{if(0===i.button){if(r)return void e.toggle();e.select(),hd.current?.onOpenFile(e.data.path,"preview")}},onDoubleClick:i=>{r||(i.preventDefault(),hd.current?.onOpenFile(e.data.path,"persistent"))},children:[r?s?(0,I.jsx)(ha.ChevronDown,{className:"h-3 w-3 shrink-0"}):(0,I.jsx)(hl.ChevronRight,{className:"h-3 w-3 shrink-0"}):(0,I.jsx)("span",{className:"inline-block w-3 shrink-0"}),r?s?(0,I.jsx)(z.FolderOpen,{className:"h-3.5 w-3.5 shrink-0 text-amber-500"}):(0,I.jsx)(hc,{className:"h-3.5 w-3.5 shrink-0 text-amber-500"}):(0,I.jsx)(hh.default,{className:"h-3.5 w-3.5 shrink-0 text-sky-500"}),(0,I.jsx)("span",{className:"truncate",children:e.data.name})]})}function hf({tree:e,loading:i,error:r,activePath:s,onOpenFile:n}){let o=(0,R.useMemo)(()=>(function e(i){return i?i.map(i=>({id:i.path||i.name,name:i.name,isDirectory:i.isDirectory,path:i.path,children:i.isDirectory?e(i.children):void 0})):[]})(e?.children),[e]),a=(0,R.useRef)(null),l=(0,R.useRef)(null),[h,c]=(0,R.useState)({w:280,h:400});return((0,R.useEffect)(()=>(hd.current={onOpenFile:n},()=>{hd.current?.onOpenFile===n&&(hd.current=null)}),[n]),(0,R.useEffect)(()=>{let e=l.current;if(!e)return;let i=new ResizeObserver(e=>{let i=e[0]?.contentRect;i&&c({w:Math.floor(i.width),h:Math.floor(i.height)})});return i.observe(e),()=>i.disconnect()},[]),i&&!e)?(0,I.jsx)("div",{className:"text-muted-foreground flex h-full items-center justify-center text-xs",children:"Loading files…"}):r?(0,I.jsx)("div",{className:"text-destructive flex h-full items-center justify-center p-2 text-center text-xs",children:r}):e?(0,I.jsx)("div",{ref:l,className:"h-full w-full overflow-hidden",children:(0,I.jsx)(ho,{ref:a,data:o,openByDefault:!1,width:h.w,height:h.h,rowHeight:24,indent:12,padding:4,selection:s??void 0,children:hu})}):null}var hp=e.i(47901),h_=e.i(427),hg=e.i(12878),hv=e.i(87889),hm=e.i(86076),hh=hh;let hS=(0,B.default)("panel-right",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);var hy=e.i(60253),hb=function(e,i){return Number(e.toFixed(i))},hw=function(e,i,r){r&&"function"==typeof r&&r(e,i)},hC={easeOut:function(e){return-Math.cos(e*Math.PI)/2+.5},linear:function(e){return e},easeInQuad:function(e){return e*e},easeOutQuad:function(e){return e*(2-e)},easeInOutQuad:function(e){return e<.5?2*e*e:-1+(4-2*e)*e},easeInCubic:function(e){return e*e*e},easeOutCubic:function(e){return--e*e*e+1},easeInOutCubic:function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},easeInQuart:function(e){return e*e*e*e},easeOutQuart:function(e){return 1- --e*e*e*e},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},easeInQuint:function(e){return e*e*e*e*e},easeOutQuint:function(e){return 1+--e*e*e*e*e},easeInOutQuint:function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e}},hx=function(e){"number"==typeof e&&cancelAnimationFrame(e)},hk=function(e){e.mounted&&(hx(e.animation),e.isAnimating=!1,e.animation=null,e.velocity=null)};function hE(e,i,r,s){if(e.mounted){var n=new Date().getTime();hk(e),e.animation=function(){if(!e.mounted)return hx(e.animation);var o=new Date().getTime()-n,a=(0,hC[i])(o/r);o>=r?(s(1),e.animation=null):e.animation&&(s(a),requestAnimationFrame(e.animation))},requestAnimationFrame(e.animation)}}function hD(e,i,r,s){var n,o,a,l=(n=i.scale,o=i.positionX,a=i.positionY,!(Number.isNaN(n)||Number.isNaN(o)||Number.isNaN(a)));if(e.mounted&&l){var h=e.setState,c=e.state,d=c.scale,u=c.positionX,f=c.positionY,p=i.scale-d,_=i.positionX-u,g=i.positionY-f;0===r?h(i.scale,i.positionX,i.positionY):hE(e,s,r,function(i){1!==i?e.isAnimating=!0:e.isAnimating=!1,h(d+p*i,u+_*i,f+g*i)})}}var hO=function(e,i,r,s,n,o,a){var l=e>i?r*(a?.5:1):0,h=s>n?o*(a?.5:1):0;return{minPositionX:e-i-l,maxPositionX:l,minPositionY:s-n-h,maxPositionY:h,scaleWidthFactor:l,scaleHeightFactor:h}},hT=function(e,i){var r,s,n,o,a,l,h=e.wrapperComponent,c=e.contentComponent,d=e.setup,u=d.centerZoomedOut,f=d.disablePadding;if(!h||!c)throw Error("Components are not mounted");var p=(r=h.offsetWidth,s=h.offsetHeight,n=c.offsetWidth,o=c.offsetHeight,{wrapperWidth:r,wrapperHeight:s,newContentWidth:a=n*i,newDiffWidth:r-a,newContentHeight:l=o*i,newDiffHeight:s-l}),_=p.wrapperWidth,g=p.wrapperHeight,v=p.newContentWidth,m=p.newContentHeight,S=hO(_,v,p.newDiffWidth,g,m,p.newDiffHeight,!!u),y=_>=v&&g>=m;f&&y&&!u&&(S.minPositionX=0,S.maxPositionX=0,S.minPositionY=0,S.maxPositionY=0);var b=e.setup,w=b.minPositionX,C=b.maxPositionX,x=b.minPositionY,k=b.maxPositionY;return null!=w&&(S.minPositionX=_*(1-i)+w*i),null!=C&&(S.maxPositionX=C*i),null!=x&&(S.minPositionY=g*(1-i)+x*i),null!=k&&(S.maxPositionY=k*i),S},hP=function(e,i,r,s){return s?e<i?hb(i,2):e>r?hb(r,2):hb(e,2):hb(e,2)},hI=function(e,i){var r=hT(e,i);return e.bounds=r,r};function hR(e,i,r,s,n,o,a){var l=r.minPositionX,h=r.minPositionY,c=r.maxPositionX,d=r.maxPositionY,u=0,f=0;return a&&(u=n,f=o),{x:hP(e,l-u,c+u,s),y:hP(i,h-f,d+f,s)}}function hM(e,i,r,s,n,o){var a=e.state,l=a.scale,h=a.positionX,c=a.positionY,d=s-l;return"number"!=typeof i||"number"!=typeof r?(console.error("Mouse X and Y position were not provided!"),{x:h,y:c}):hR(h-i*d,c-r*d,n,o,0,0,null)}function hN(e,i,r,s,n){var o=n?s:0,a=Math.max(i-o,1e-7),l=r+o;return!Number.isNaN(r)&&e>=l?l:!Number.isNaN(i)&&e<=a?a:Math.max(e,1e-7)}var hL=function(e,i){var r=e.setup.panning.excluded,s=e.isInitialized,n=e.wrapperComponent,o=i.target,a="shadowRoot"in o&&"composedPath"in i?i.composedPath().some(function(e){return e instanceof Element&&(null==n?void 0:n.contains(e))}):null==n?void 0:n.contains(o);return!(!(s&&o&&a)||ce(o,r))&&"true"!==o.getAttribute("draggable")&&"true"!==o.getAttribute("contenteditable")&&!o.isContentEditable},hB=function(e){var i=e.isInitialized,r=e.isPanning,s=e.setup.panning.disabled;return!!(i&&r&&!s)},hA=function(e,i){var r=e.state,s=r.positionX,n=r.positionY;e.isPanning=!0,e.startCoords={x:i.clientX-s,y:i.clientY-n}},hj=function(e,i){var r=i.touches,s=e.state,n=s.positionX,o=s.positionY;e.isPanning=!0,1===r.length&&(e.startCoords={x:r[0].clientX-n,y:r[0].clientY-o})};function hH(e,i,r,s,n){var o=e.setup.limitToBounds,a=e.wrapperComponent,l=e.bounds,h=e.state,c=h.scale,d=h.positionX,u=h.positionY;if(null!==a&&null!==l&&(i!==d||r!==u)){var f=hR(i,r,l,o,s,n,a),p=f.x,_=f.y;e.setState(c,p,_)}}var hW=function(e,i,r){var s=e.startCoords,n=e.state,o=e.setup.panning,a=o.lockAxisX,l=o.lockAxisY,h=n.positionX,c=n.positionY;if(!s)return{x:h,y:c};var d=i-s.x,u=r-s.y;return{x:a?h:d,y:l?c:u}},hz=function(e,i,r){var s=e.setup,n=e.state,o=s.minScale,a=s.disablePadding,l=s.centerZoomedOut,h=null!=r?r:n.scale;return i>0&&h>=o&&!a&&!l?i:0};(E=P||(P={})).TRACK_PAD="track_pad",E.MOUSE="mouse",E.TOUCH="touch";var hF=function(e){var i=e.mounted,r=e.wrapperComponent,s=e.contentComponent,n=e.setup,o=n.disabled,a=n.velocityAnimation,l=n.limitToBounds,h=e.state.scale;return!a.disabled&&!o&&!!i&&!!r&&!!s&&(!l||r.offsetWidth<s.offsetWidth*h||r.offsetHeight<s.offsetHeight*h)},h$=function(e){var i=e.mounted,r=e.velocity,s=e.bounds,n=e.setup,o=n.disabled;return!!(!n.velocityAnimation.disabled&&!o&&i)&&!!r&&!!s};function hK(e,i,r,s,n,o,a,l,h,c){if(n){if(i>a&&r>a){var d=a+(e-a)*c;return d>h?h:d<a?a:d}if(i<o&&r<o){var d=o+(e-o)*c;return d<l?l:d>o?o:d}}return s?i:hP(e,o,a,n)}var hU=function(e,i,r){var s=e*r;return Number.isNaN(s)?0:e<0?Math.max(s,-i):Math.min(s,i)};function hY(e,i){var r=e.state,s=r.scale;e.panStartPosition={x:r.positionX,y:r.positionY},hk(e),hI(e,s),void 0!==window.TouchEvent&&i instanceof TouchEvent?hj(e,i):hA(e,i)}function hq(e,i){var r=e.state.scale,s=e.setup,n=s.minScale,o=s.autoAlignment,a=o.disabled,l=o.sizeX,h=o.sizeY,c=o.animationTime,d=o.animationType;if(!(a||r<n||!l&&!h)){var u=function(e){var i=e.state,r=i.positionX,s=i.positionY,n=i.scale,o=e.setup,a=o.disabled,l=o.limitToBounds,h=o.centerZoomedOut,c=e.wrapperComponent;if(!a&&c&&e.bounds){var d=e.bounds,u=d.maxPositionX,f=d.minPositionX,p=d.maxPositionY,_=d.minPositionY,g=r>u?c.offsetWidth:e.setup.minPositionX||0,v=s>p?c.offsetHeight:e.setup.minPositionY||0,m=hM(e,g,v,n,e.bounds,l||h),S=m.x,y=m.y;return{scale:n,positionX:r>u||r<f?S:r,positionY:s>p||s<_?y:s}}}(e);u&&hD(e,u,null!=i?i:c,d)}}function hX(e,i,r,s){var n=e.startCoords,o=e.setup.autoAlignment,a=o.sizeX,l=o.sizeY;if(n){var h=hW(e,i,r),c=h.x,d=h.y,u=hz(e,a),f=hz(e,l);!function(e,i,r){var s,n;if(hF(e)){var o=e.lastMousePosition,a=e.velocityTime,l=e.setup,h=e.wrapperComponent,c=l.velocityAnimation,d=c.maxStrengthMouse,u=c.maxStrengthTouch,f=c.sensitivityTouch,p=c.sensitivityMouse,_=Date.now();if(o&&a&&h){var g,v=Number.isNaN(g=h.offsetWidth/window.innerWidth)?1:Math.min(1,g),m=((s={})[P.TOUCH]=f,s[P.MOUSE]=p,s)[r],S=((n={})[P.TOUCH]=u,n[P.MOUSE]=d,n)[r],y=i.x-o.x,b=i.y-o.y;e.velocity={velocityX:hU(y/v,S,m),velocityY:hU(b/v,S,m),total:hU(Math.sqrt(y*y+b*b)/(_-a),S,m)}}e.lastMousePosition=i,e.velocityTime=_}}(e,{x:c,y:d},s),hH(e,c,d,u,f)}}function hV(e,i,r,s){var n=e.setup,o=n.minScale,a=n.maxScale,l=n.limitToBounds,h=hN(hb(i,2),o,a,0,!1),c=hI(e,h),d=hM(e,r,s,h,c,l);return{scale:h,positionX:d.x,positionY:d.y}}function hG(e,i,r){var s=e.state.scale,n=e.wrapperComponent,o=e.setup,a=o.minScale,l=o.maxScale,h=o.limitToBounds,c=o.zoomAnimation,d=c.disabled,u=c.animationTime,f=c.animationType,p=s>=a&&s<=l;if((s>=1||h)&&hq(e),!(d||p)&&n&&e.mounted){var _=hV(e,s<a?a:l,i||n.offsetWidth/2,r||n.offsetHeight/2);_&&hD(e,_,u,f)}}var hZ=function(){return(hZ=Object.assign||function(e){for(var i,r=1,s=arguments.length;r<s;r++)for(var n in i=arguments[r])Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);return e}).apply(this,arguments)};function hJ(e,i,r){if(r||2==arguments.length)for(var s,n=0,o=i.length;n<o;n++)!s&&n in i||(s||(s=Array.prototype.slice.call(i,0,n)),s[n]=i[n]);return e.concat(s||Array.prototype.slice.call(i))}"function"==typeof SuppressedError&&SuppressedError;var hQ={disabled:!1,minPositionX:null,maxPositionX:null,minPositionY:null,maxPositionY:null,minScale:1,maxScale:8,limitToBounds:!0,centerZoomedOut:!1,centerOnInit:!1,disablePadding:!1,smooth:!0,detached:!1,wheel:{step:.015,disabled:!1,wheelDisabled:!1,touchPadDisabled:!1,activationKeys:[],excluded:[]},trackPadPanning:{disabled:!0,velocityDisabled:!1,lockAxisX:!1,lockAxisY:!1,activationKeys:[],excluded:[]},panning:{disabled:!1,velocityDisabled:!1,lockAxisX:!1,lockAxisY:!1,allowLeftClickPan:!0,allowMiddleClickPan:!0,allowRightClickPan:!0,activationKeys:[],excluded:[]},pinch:{step:5,disabled:!1,allowPanning:!0,excluded:[]},doubleClick:{disabled:!1,step:.7,mode:"zoomIn",animationType:"easeOut",animationTime:200,excluded:[]},zoomAnimation:{disabled:!1,size:.4,animationTime:200,animationType:"easeOut"},autoAlignment:{disabled:!1,sizeX:100,sizeY:100,animationTime:200,velocityAlignmentTime:400,animationType:"easeOut"},velocityAnimation:{disabled:!1,sensitivityMouse:1,sensitivityTouch:1.2,maxStrengthMouse:20,maxStrengthTouch:40,inertia:1,animationTime:300,maxAnimationTime:800,animationType:"easeOut"}},h0="react-transform-wrapper",h1=function(e){var i,r,s,n,o,a,l,h,c,d=Math.max(null!=(i=e.minScale)?i:hQ.minScale,1e-7),u=null!=(r=e.maxScale)?r:hQ.maxScale,f=Math.min(Math.max(null!=(s=e.initialScale)?s:1,d),u);return{previousScale:f,scale:f,positionX:hP(null!=(n=e.initialPositionX)?n:0,null!=(o=e.minPositionX)?o:-1/0,null!=(a=e.maxPositionX)?a:1/0,null!=e.minPositionX||null!=e.maxPositionX),positionY:hP(null!=(l=e.initialPositionY)?l:0,null!=(h=e.minPositionY)?h:-1/0,null!=(c=e.maxPositionY)?c:1/0,null!=e.minPositionY||null!=e.maxPositionY)}},h2=function(e){var i=hZ({},hQ);return Object.keys(e).forEach(function(r){var s=void 0!==e[r];if(void 0!==hQ[r]&&s){var n=Object.prototype.toString.call(hQ[r]);"[object Object]"===n?i[r]=hZ(hZ({},hQ[r]),e[r]):"[object Array]"===n?i[r]=hJ(hJ([],hQ[r],!0),e[r],!0):i[r]=e[r]}}),i.minScale<=0&&(i.minScale=1e-7),i},h5=function(e,i,r){var s=e.state.scale,n=e.wrapperComponent,o=e.setup,a=o.maxScale,l=o.minScale,h=o.zoomAnimation,c=o.smooth,d=h.size;if(!n)throw Error("Wrapper is not mounted");return hN(hb(c?s*Math.exp(i*r):s+i*r,3),l,a,d,!1)};function h3(e,i,r,s,n){var o,a,l=e.wrapperComponent,h=e.state,c=h.scale,d=h.positionX,u=h.positionY,f=e.setup.zoomAnimation;if(!l)return console.error("No WrapperComponent found");var p=f.disabled?0:s,_=l.offsetWidth,g=l.offsetHeight,v=h5(e,i,r),m=hV(e,v,(_/2-d)/c,(g/2-u)/c);if(!m)return console.error("Error during zoom event. New transformation state was not calculated.");var S=e.props,y=S.onZoomStart,b=S.onZoom,w=S.onZoomStop,C=new MouseEvent("mousemove",{bubbles:!0}),x=h8(e);hw(x,C,y),hw(x,C,b),hD(e,m,p,n);var k=null!=(a=null==(o=l.ownerDocument)?void 0:o.defaultView)?a:"u">typeof window?window:null;k&&k.setTimeout(function(){e.mounted&&hw(h8(e),C,w)},p)}function h6(e,i,r,s){var n,o,a=e.setup,l=e.wrapperComponent,h=e.contentComponent,c=a.limitToBounds,d=a.centerOnInit,u=h1(e.props),f=e.state,p=f.scale,_=f.positionX,g=f.positionY;if(l){var v=u.positionX,m=u.positionY;if(d&&h){var S=cr(u.scale,l,h);v=S.positionX,m=S.positionY}var y=hR(v,m,hT(e,u.scale),c,0,0,l),b={scale:u.scale,positionX:y.x,positionY:y.y};if(p!==u.scale||_!==u.positionX||g!==u.positionY){null==s||s();var w=e.props,C=w.onZoomStart,x=w.onZoom,k=w.onZoomStop,E=new MouseEvent("mousemove",{bubbles:!0}),D=h8(e);hw(D,E,C),hw(D,E,x),hD(e,b,i,r);var O=null!=(o=null==(n=l.ownerDocument)?void 0:n.defaultView)?o:"u">typeof window?window:null;O&&O.setTimeout(function(){e.mounted&&hw(h8(e),E,k)},i)}}}var h4=function(e){return{instance:e,state:e.state,zoomIn:function(i,r,s){void 0===i&&(i=.5),void 0===r&&(r=300),void 0===s&&(s="easeOut"),h3(e,1,i,r,s)},zoomOut:function(i,r,s){void 0===i&&(i=.5),void 0===r&&(r=300),void 0===s&&(s="easeOut"),h3(e,-1,i,r,s)},setTransform:function(i,r,s,n,o){void 0===n&&(n=300),void 0===o&&(o="easeOut");var a=e.state,l=a.positionX,h=a.positionY,c=a.scale,d=e.wrapperComponent,u=e.contentComponent;!e.setup.disabled&&d&&u&&hD(e,{positionX:Number.isNaN(i)?l:i,positionY:Number.isNaN(r)?h:r,scale:Number.isNaN(s)?c:s},n,o)},resetTransform:function(i,r){void 0===i&&(i=200),void 0===r&&(r="easeOut"),h6(e,i,r)},centerView:function(i,r,s){void 0===r&&(r=200),void 0===s&&(s="easeOut");var n=e.state,o=e.wrapperComponent,a=e.contentComponent;o&&a&&hD(e,cr(i||n.scale,o,a),r,s)},zoomToElement:function(i,r,s,n,o,a){void 0===s&&(s=600),void 0===n&&(n="easeOut"),void 0===o&&(o=0),void 0===a&&(a=0),hk(e);var l=e.wrapperComponent,h="string"==typeof i?document.getElementById(i):i;if(l&&h&&l.contains(h)){var c=function(e,i,r,s,n){void 0===s&&(s=0),void 0===n&&(n=0);var o,a,l,h,c,d=e.wrapperComponent,u=e.contentComponent,f=e.state,p=e.setup,_=p.limitToBounds,g=p.minScale,v=p.maxScale;if(!d||!u)return f;var m=d.getBoundingClientRect(),S=i.getBoundingClientRect(),y=(o=i.getBoundingClientRect(),a=d.getBoundingClientRect(),l=u.getBoundingClientRect(),h=a.x*f.scale,c=a.y*f.scale,{x:(o.x-l.x+h)/f.scale,y:(o.y-l.y+c)/f.scale}),b=y.x,w=y.y,C=S.width/f.scale,x=S.height/f.scale,k=d.offsetWidth/C,E=d.offsetHeight/x,D=hN(r||Math.min(k,E),g,v,0,!1),O=(m.width-C*D)/2,T=(m.height-x*D)/2,P=hR((m.left-b)*D+O+s,(m.top-w)*D+T+n,hT(e,D),_,0,0,d);return{positionX:P.x,positionY:P.y,scale:D}}(e,h,r,o,a);hD(e,c,s,n)}}}},h8=function(e){var i={};return Object.assign(i,{instance:e,state:e.state}),Object.assign(i,h4(e)),i};function h7(){try{return{get passive(){return!1}}}catch(e){return!1}}var h9=".".concat(h0),ce=function(e,i){return i.some(function(i){return e.matches("".concat(h9," ").concat(i,", ").concat(h9," .").concat(i,", ").concat(h9," ").concat(i," *, ").concat(h9," .").concat(i," *"))})},ct=function(e){e&&clearTimeout(e)},ci=function(e,i,r){var s=Number.parseFloat(r.toFixed(8));return"translate(".concat(e,"px, ").concat(i,"px) scale(").concat(s,")")},cr=function(e,i,r){var s=r.offsetWidth*e,n=r.offsetHeight*e;return{scale:e,positionX:(i.offsetWidth-s)/2,positionY:(i.offsetHeight-n)/2}},cs=function(e,i){var r=e.setup.wheel,s=r.disabled,n=r.wheelDisabled,o=r.touchPadDisabled,a=r.excluded,l=e.isInitialized,h=e.isPanning,c=i.target;return!(!(l&&!h&&!s&&c)||n&&!i.ctrlKey||o&&i.ctrlKey||ce(c,a))&&!!e.isPressingKeys(e.setup.wheel.activationKeys)},cn=function(e,i){var r=e.setup,s=r.disabled,n=r.trackPadPanning,o=n.activationKeys,a=n.excluded;return!(!e.wrapperComponent||!e.contentComponent||s||n.disabled||i.ctrlKey||cs(e,i)||ce(i.target,a))&&!!e.isPressingKeys(o)};function co(e,i,r){var s=i.getBoundingClientRect(),n=0,o=0;if("clientX"in e)n=(e.clientX-s.left)/r,o=(e.clientY-s.top)/r;else{var a=e.touches[0];n=(a.clientX-s.left)/r,o=(a.clientY-s.top)/r}return(Number.isNaN(n)||Number.isNaN(o))&&console.error("No mouse or touch offset found"),{x:n,y:o}}var ca=function(e,i,r,s,n){var o=e.state.scale,a=e.wrapperComponent,l=e.setup,h=l.maxScale,c=l.minScale,d=l.zoomAnimation,u=l.disablePadding,f=d.size,p=d.disabled;if(!a)throw Error("Wrapper is not mounted");var _=o+i*r;return n?_:hN(_,c,h,f,!s&&!p&&!u)},cl=function(e,i){var r=e.previousWheelEvent,s=e.state.scale,n=e.setup,o=n.maxScale,a=n.minScale;return!!r&&(!!(s<o)||!!(s>a)||Math.sign(r.deltaY)!==Math.sign(i.deltaY)||!!(r.deltaY>0)&&!!(r.deltaY<i.deltaY)||!!(r.deltaY<0)&&!!(r.deltaY>i.deltaY)||Math.sign(r.deltaY)!==Math.sign(i.deltaY))},ch=function(e,i){var r=e.setup.pinch,s=r.disabled,n=r.excluded,o=e.isInitialized,a=i.target;return!(!(o&&!s&&a)||ce(a,n))},cc=function(e){var i=e.setup.pinch.disabled,r=e.isInitialized,s=e.pinchStartDistance;return!!(r&&!i&&null!==s)},cd=function(e,i,r){var s=r.getBoundingClientRect(),n=e.touches,o=n[0].clientX-s.left,a=n[0].clientY-s.top;return{x:(o+(n[1].clientX-s.left))/2/i,y:(a+(n[1].clientY-s.top))/2/i}},cu=function(e){return Math.sqrt(Math.pow(e.touches[0].pageX-e.touches[1].pageX,2)+Math.pow(e.touches[0].pageY-e.touches[1].pageY,2))},cf=function(e,i){var r=e.pinchStartScale,s=e.pinchStartDistance,n=e.setup,o=n.maxScale,a=n.minScale,l=n.zoomAnimation,h=n.disablePadding,c=n.pinch,d=l.size,u=l.disabled,f=c.step;if(!r||null===s)throw Error("Pinch touches distance was not provided");if(i<0)return e.state.scale;var p=r+f/5*(i/s*r-r);return hN(p===1/0?0:hb(p,10),a,o,d,!u&&!h)},cp=function(e,i){var r=e.props,s=r.onWheelStart,n=r.onZoomStart;e.wheelStopEventTimer||(hk(e),hw(h8(e),i,s),hw(h8(e),i,n))},c_=function(e,i){var r,s=e.props,n=s.onWheel,o=s.onZoom,a=e.contentComponent,l=e.setup,h=e.state.scale,c=l.limitToBounds,d=l.centerZoomedOut,u=l.zoomAnimation,f=l.wheel,p=l.disablePadding,_=l.smooth,g=u.size,v=u.disabled,m=f.step;if(!a)throw Error("Component not mounted");i.preventDefault(),i.stopPropagation();var S=ca(e,(r=i?i.deltaY<0?1:-1:0,r),_?m*Math.abs(i.deltaY):m,!i.ctrlKey);if(h!==S){var y=hI(e,S),b=co(i,a,h),w=hM(e,b.x,b.y,S,y,c&&(v||0===g||d||p)),C=w.x,x=w.y;e.previousWheelEvent=i,e.setState(S,C,x),hw(h8(e),i,n),hw(h8(e),i,o)}},cg=function(e,i){var r=e.props,s=r.onWheelStop,n=r.onZoomStop;ct(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout(function(){e.mounted&&(hG(e,i.x,i.y),e.wheelAnimationTimer=null)},100),cl(e,i)&&(ct(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout(function(){e.mounted&&(e.wheelStopEventTimer=null,hw(h8(e),i,s),hw(h8(e),i,n))},160))},cv=function(e,i){var r=e.props,s=r.onWheelStart,n=r.onPanningStart;e.wheelStopEventTimer||(hk(e),hw(h8(e),i,s),hw(h8(e),i,n))},cm=function(e,i){var r=e.props,s=r.onWheelStop,n=r.onPanningStop;ct(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout(function(){e.mounted&&(hG(e,i.x,i.y),e.wheelAnimationTimer=null)},100),cl(e,i)&&(ct(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout(function(){e.mounted&&(e.wheelStopEventTimer=null,hw(h8(e),i,s),hw(h8(e),i,n))},160))},cS=function(e){for(var i=0,r=0,s=0;s<2;s+=1)i+=e.touches[s].clientX,r+=e.touches[s].clientY;return{x:i/2,y:r/2}},cy=function(e,i){var r=cu(i);e.pinchStartDistance=r,e.lastDistance=r,e.pinchStartScale=e.state.scale,e.isPanning=!1,e.isPinching=!0,e.pinchPreviousCenter=cS(i),hk(e)},cb=function(e,i){var r=e.contentComponent,s=e.pinchStartDistance,n=e.wrapperComponent,o=e.pinchPreviousCenter,a=e.state.scale,l=e.setup,h=l.limitToBounds,c=l.centerZoomedOut,d=l.zoomAnimation,u=l.autoAlignment,f=l.pinch,p=l.panning,_=d.disabled,g=d.size,v=f.allowPanning;if(null!==s&&r){var m=cd(i,a,r);if(Number.isFinite(m.x)&&Number.isFinite(m.y)){var S=cu(i),y=cf(e,S),b=cS(i),w=a/y,C=(b.x-((null==o?void 0:o.x)||0))*w,x=(b.y-((null==o?void 0:o.y)||0))*w;if(y!==a||0!==C||0!==x){e.pinchPreviousCenter=b;var k=hI(e,y),E=hM(e,m.x,m.y,y,k,h&&(_||0===g||c)),D=E.x,O=E.y;if(e.pinchMidpoint=m,e.lastDistance=S,p.disabled||!v)e.setState(y,D,O);else{var T=u.sizeX,P=u.sizeY,I=hR(D+C,O+x,k,h,hz(e,T,y),hz(e,P,y),n),R=I.x,M=I.y;e.setState(y,R,M)}}}}},cw=function(e){var i=e.pinchMidpoint;e.velocity=null,e.lastDistance=null,e.pinchMidpoint=null,e.pinchStartScale=null,e.pinchStartDistance=null,e.isPinching=!1,hG(e,null==i?void 0:i.x,null==i?void 0:i.y)},cC=function(e,i){var r=e.props.onZoomStop,s=e.setup.doubleClick.animationTime;ct(e.doubleClickStopEventTimer),e.doubleClickStopEventTimer=setTimeout(function(){e.doubleClickStopEventTimer=null,hw(h8(e),i,r)},s)},cx=function(e,i){var r=e.props,s=r.onZoomStart,n=r.onZoom,o=e.setup.doubleClick,a=o.animationTime,l=o.animationType;hw(h8(e),i,s),h6(e,a,l,function(){return hw(h8(e),i,n)}),cC(e,i)},ck=function(e,i){var r=e.isInitialized,s=e.setup,n=e.wrapperComponent,o=s.doubleClick,a=o.disabled,l=o.excluded,h=i.target,c=null==n?void 0:n.contains(h);return!(!(r&&h&&c&&!a)||ce(h,l))},cE=function(e){var i=this;this.mounted=!0,this.onChangeCallbacks=new Set,this.onInitCallbacks=new Set,this.onTransformCallbacks=new Set,this.wrapperComponent=null,this.contentComponent=null,this.isInitialized=!1,this.bounds=null,this.previousWheelEvent=null,this.wheelStopEventTimer=null,this.wheelAnimationTimer=null,this.isPanning=!1,this.isWheelPanning=!1,this.startCoords=null,this.panStartPosition=null,this.lastTouch=null,this.isPinching=!1,this.distance=null,this.lastDistance=null,this.pinchStartDistance=null,this.pinchStartScale=null,this.pinchMidpoint=null,this.pinchPreviousCenter=null,this.doubleClickStopEventTimer=null,this.velocity=null,this.velocityTime=null,this.lastMousePosition=null,this.isAnimating=!1,this.animation=null,this.pressedKeys={},this.mount=function(){i.initializeWindowEvents()},this.unmount=function(){i.cleanupWindowEvents()},this.update=function(e){i.props=e,i.wrapperComponent&&i.contentComponent&&hI(i,i.state.scale),i.setup=h2(e)},this.initializeWindowEvents=function(){var e,r,s,n,o=h7(),a=null==(e=i.wrapperComponent)?void 0:e.ownerDocument,l=null==a?void 0:a.defaultView;null==(r=i.wrapperComponent)||r.addEventListener("wheel",i.onWheelPanning,o),null==(s=i.wrapperComponent)||s.addEventListener("keyup",i.setKeyUnPressed,o),null==(n=i.wrapperComponent)||n.addEventListener("keydown",i.setKeyPressed,o),null==l||l.addEventListener("mousedown",i.onPanningStart,o),null==l||l.addEventListener("mousemove",i.onPanning,o),null==l||l.addEventListener("mouseup",i.onPanningStop,o),null==a||a.addEventListener("mouseleave",i.clearPanning,o),null==l||l.addEventListener("keyup",i.setKeyUnPressed,o),null==l||l.addEventListener("keydown",i.setKeyPressed,o),null==l||l.addEventListener("blur",i.handleWindowBlur)},this.cleanupWindowEvents=function(){var e,r,s,n,o,a=h7(),l=null==(e=i.wrapperComponent)?void 0:e.ownerDocument,h=null==l?void 0:l.defaultView;null==h||h.removeEventListener("mousedown",i.onPanningStart,a),null==h||h.removeEventListener("mousemove",i.onPanning,a),null==h||h.removeEventListener("mouseup",i.onPanningStop,a),null==l||l.removeEventListener("mouseleave",i.clearPanning,a),null==h||h.removeEventListener("keyup",i.setKeyUnPressed,a),null==h||h.removeEventListener("keydown",i.setKeyPressed,a),null==h||h.removeEventListener("blur",i.handleWindowBlur),document.removeEventListener("mouseleave",i.clearPanning,a),null==(r=i.wrapperComponent)||r.removeEventListener("wheel",i.onWheelPanning,a),null==(s=i.wrapperComponent)||s.removeEventListener("keyup",i.setKeyUnPressed,a),null==(n=i.wrapperComponent)||n.removeEventListener("keydown",i.setKeyPressed,a),hk(i),null==(o=i.observer)||o.disconnect()},this.handleInitializeWrapperEvents=function(e){var r=h7();e.addEventListener("wheel",i.onWheelZoom,r),e.addEventListener("dblclick",i.onDoubleClick,r),e.addEventListener("touchstart",i.onTouchPanningStart,r),e.addEventListener("touchmove",i.onTouchPanning,r),e.addEventListener("touchend",i.onTouchPanningStop,r)},this.handleInitialize=function(e){var r=i.setup.centerOnInit;i.applyTransformation(),i.onInitCallbacks.forEach(function(e){return e(h8(i))}),r&&(i.setCenter(),i.observer=new ResizeObserver(function(){var r,s=e.offsetWidth,n=e.offsetHeight;(s>0||n>0)&&(i.onInitCallbacks.forEach(function(e){return e(h8(i))}),i.setCenter(),null==(r=i.observer)||r.disconnect())}),setTimeout(function(){var e;null==(e=i.observer)||e.disconnect()},5e3),i.observer.observe(e))},this.onWheelZoom=function(e){i.setup.disabled||(i.syncModifierKeys(e),cs(i,e)&&(cp(i,e),c_(i,e),cg(i,e)))},this.onWheelPanning=function(e){var r=i.props.onPanning,s=i.setup.trackPadPanning,n=s.lockAxisX,o=s.lockAxisY;if(i.syncModifierKeys(e),cn(i,e)){e.preventDefault(),e.stopPropagation();var a=i.state,l=a.positionX,h=a.positionY,c=l-e.deltaX,d=h-e.deltaY,u=n?l:c,f=o?h:d,p=i.setup.autoAlignment,_=p.sizeX,g=p.sizeY,v=hz(i,_),m=hz(i,g);(u!==l||f!==h)&&(cv(i,e),hH(i,u,f,v,m),hw(h8(i),e,r),cm(i,e))}},this.onPanningStart=function(e){var r=i.setup.disabled,s=i.props.onPanningStart;r||(i.syncModifierKeys(e),hL(i,e)&&i.isPressingKeys(i.setup.panning.activationKeys)&&(0!==e.button||i.setup.panning.allowLeftClickPan)&&(1!==e.button||i.setup.panning.allowMiddleClickPan)&&(2!==e.button||i.setup.panning.allowRightClickPan)&&(e.preventDefault(),e.stopPropagation(),hk(i),hY(i,e),hw(h8(i),e,s)))},this.onPanning=function(e){var r=i.setup.disabled,s=i.props.onPanning;r||((i.syncModifierKeys(e),i.isPanning&&0===e.buttons)?i.clearPanning(e):!hB(i)||i.isPressingKeys(i.setup.panning.activationKeys)&&(e.preventDefault(),e.stopPropagation(),hX(i,e.clientX,e.clientY,P.MOUSE),hw(h8(i),e,s)))},this.onPanningStop=function(e){var r=i.setup.panning.velocityDisabled,s=i.props.onPanningStop;i.isPanning&&(!function(e,i){if(e.isPanning){var r=e.velocity,s=e.wrapperComponent,n=e.contentComponent;e.isPanning=!1;var o=e.state,a=o.positionX,l=o.positionY,h=o.scale,c=e.panStartPosition;if(e.panStartPosition=null,c){var d=a-c.x,u=l-c.y;if(d*d+u*u<=25)return}e.isAnimating=!1,e.animation=null;var f=(null==s?void 0:s.offsetWidth)||0,p=(null==s?void 0:s.offsetHeight)||0,_=((null==n?void 0:n.offsetWidth)||0)*h,g=((null==n?void 0:n.offsetHeight)||0)*h,v=!e.setup.limitToBounds||f<_||p<g;!i&&r&&r.total>.1&&v?function(e){var i=e.velocity,r=e.bounds,s=e.setup,n=e.wrapperComponent;if(h$(e)&&i&&r&&n){var o,a,l,h=i.velocityX,c=i.velocityY,d=i.total,u=r.maxPositionX,f=r.minPositionX,p=r.maxPositionY,_=r.minPositionY,g=s.limitToBounds,v=s.autoAlignment,m=s.zoomAnimation,S=s.panning,y=S.lockAxisY,b=S.lockAxisX,w=m.animationType,C=v.sizeX,x=v.sizeY,k=v.velocityAlignmentTime,E=Math.max((a=(o=e.setup.velocityAnimation).animationTime,l=o.maxAnimationTime,Math.min(a*Math.max(1,Math.abs(d/o.inertia)),l)),k),D=hz(e,C),O=hz(e,x),T=D*n.offsetWidth/100,P=O*n.offsetHeight/100,I=u+T,R=f-T,M=p+P,N=_-P,L=e.state,B=new Date().getTime();hE(e,w,E,function(i){var r=e.state,s=r.scale,n=r.positionX,o=r.positionY,a=new Date().getTime()-B,l=1-(0,hC[v.animationType])(Math.min(1,a/k)),d=1-i,m=n+h*d,S=o+c*d,w=hK(m,L.positionX,n,b,g,f,u,R,I,l),C=hK(S,L.positionY,o,y,g,_,p,N,M,l);if(n!==m||o!==S){e.setState(s,w,C);var x=e.props.onPanning;x&&x(h8(e),{})}})}}(e):hq(e)}}(i,r),hw(h8(i),e,s))},this.onPinchStart=function(e){var r=i.setup.disabled,s=i.props.onPinchStart;r||ch(i,e)&&(cy(i,e),hk(i),hw(h8(i),e,s))},this.onPinch=function(e){var r=i.setup.disabled,s=i.props.onPinch;r||cc(i)&&(e.preventDefault(),e.stopPropagation(),cb(i,e),hw(h8(i),e,s))},this.onPinchStop=function(e){var r=i.props.onPinchStop;i.pinchStartScale&&(cw(i),hw(h8(i),e,r))},this.onTouchPanningStart=function(e){var r=i.setup,s=r.disabled,n=r.doubleClick,o=i.props.onPanningStart;if(!s){var a=!(null==n?void 0:n.disabled),l=i.lastTouch&&new Date-i.lastTouch<200;if(a&&l&&1===e.touches.length)i.onDoubleClick(e);else{i.lastTouch=+new Date,hk(i);var h=e.touches,c=1===h.length,d=2===h.length,u=hL(i,e);if(c){if(!u)return;hk(i),hY(i,e),hw(h8(i),e,o)}d&&i.onPinchStart(e)}}},this.onTouchPanning=function(e){var r=i.setup.disabled,s=i.props.onPanning;if(i.isPanning&&1===e.touches.length){if(r||!hB(i))return;e.cancelable&&e.preventDefault(),e.stopPropagation();var n=e.touches[0];hX(i,n.clientX,n.clientY,P.TOUCH),hw(h8(i),e,s)}else e.touches.length>1&&i.onPinch(e)},this.onTouchPanningStop=function(e){i.onPanningStop(e),i.onPinchStop(e)},this.onDoubleClick=function(e){i.setup.disabled||ck(i,e)&&function(e,i){var r,s=e.setup,n=e.doubleClickStopEventTimer,o=e.state,a=e.contentComponent,l=o.scale,h=e.props,c=h.onZoomStart,d=h.onZoom,u=s.doubleClick,f=u.disabled,p=u.mode,_=u.step,g=u.animationTime,v=u.animationType;if(!f&&!n){if("reset"===p)return cx(e,i);if(!a)return console.error("No ContentComponent found");var m=(r=e.state.scale,"toggle"===p?1===r?1:-1:"zoomOut"===p?-1:1),S=h5(e,m,_);if(l!==S){hw(h8(e),i,c);var y=co(i,a,l),b=hV(e,S,y.x,y.y);if(!b)return console.error("Error during zoom event. New transformation state was not calculated.");hw(h8(e),i,d),hD(e,b,g,v),cC(e,i)}}}(i,e)},this.clearPanning=function(e){i.isPanning&&i.onPanningStop(e)},this.handleWindowBlur=function(){i.pressedKeys={},i.isPanning&&(i.isPanning=!1,i.startCoords=null)},this.syncModifierKeys=function(e){var r=e.ctrlKey,s=e.metaKey,n=e.shiftKey,o=e.altKey;"boolean"==typeof r&&(i.pressedKeys.Control=r),"boolean"==typeof s&&(i.pressedKeys.Meta=s),"boolean"==typeof n&&(i.pressedKeys.Shift=n),"boolean"==typeof o&&(i.pressedKeys.Alt=o)},this.setKeyPressed=function(e){i.pressedKeys[e.key]=!0},this.setKeyUnPressed=function(e){i.pressedKeys[e.key]=!1},this.isPressingKeys=function(e){return"function"==typeof e?e(Object.entries(i.pressedKeys).filter(function(e){return e[1]}).map(function(e){return e[0]})):!e.length||!!e.every(function(e){return i.pressedKeys[e]})},this.setCenter=function(){if(i.wrapperComponent&&i.contentComponent){var e=cr(i.state.scale,i.wrapperComponent,i.contentComponent);i.setState(e.scale,e.positionX,e.positionY)}},this.handleTransformStyles=function(e,r,s){return i.props.customTransform?i.props.customTransform(e,r,s):ci(e,r,s)},this.getContext=function(){return h8(i)},this.applyTransformation=function(){if(i.mounted&&i.contentComponent){var e=i.state,r=e.scale,s=e.positionX,n=e.positionY,o=i.handleTransformStyles(s,n,r);i.props.detached||(i.contentComponent.style.transform=o),i.onTransformCallbacks.forEach(function(e){return e({scale:r,positionX:s,positionY:n,previousScale:i.state.previousScale,ref:h8(i)})})}},this.setState=function(e,r,s){var n=i.props.onTransform;if(Number.isNaN(e)||Number.isNaN(r)||Number.isNaN(s))console.error("Detected NaN set state values");else{var o=Math.max(e,1e-7);o!==i.state.scale&&(i.state.previousScale=i.state.scale,i.state.scale=o),i.state.positionX=r,i.state.positionY=s,i.applyTransformation();var a=h8(i);i.onChangeCallbacks.forEach(function(e){return e(a)}),hw(a,{scale:i.state.scale,positionX:r,positionY:s},n)}},this.onTransform=function(e){return i.onTransformCallbacks.has(e)||i.onTransformCallbacks.add(e),function(){i.onTransformCallbacks.delete(e)}},this.onChange=function(e){return i.onChangeCallbacks.has(e)||i.onChangeCallbacks.add(e),function(){i.onChangeCallbacks.delete(e)}},this.onInit=function(e){return i.onInitCallbacks.has(e)||i.onInitCallbacks.add(e),function(){i.onInitCallbacks.delete(e)}},this.init=function(e,r){i.cleanupWindowEvents(),i.wrapperComponent=e,i.contentComponent=r,hI(i,i.state.scale),i.handleInitializeWrapperEvents(e),i.handleInitialize(r),i.initializeWindowEvents(),i.isInitialized=!0;var s,n=h8(i);hw(n,void 0,i.props.onInit),s=i.props.ref,null!=s&&("function"==typeof s?s(n):s.current=n)},this.props=e,this.setup=h2(this.props),this.state=h1(this.props)},cD=R.default.createContext(null),cO=R.default.forwardRef(function(e,i){var r,s,n=(0,R.useRef)(new cE(e)).current,o=(r=e.children,s=h4(n),"function"==typeof r?r(s):r);return(0,R.useImperativeHandle)(i,function(){return h4(n)},[n]),(0,R.useEffect)(function(){n.update(e)},[n,e]),(0,I.jsx)(cD.Provider,hZ({value:n},{children:o}))});R.default.forwardRef(function(e,i){var r,s=(0,R.useRef)(null),n=(0,R.useContext)(cD);return(0,R.useEffect)(function(){return n.onChange(function(e){s.current&&(s.current.style.transform=n.handleTransformStyles(0,0,1/e.instance.state.scale))})},[n]),(0,I.jsx)("div",hZ({},e,{ref:(r=[s,i],function(e){r.forEach(function(i){"function"==typeof i?i(e):null!=i&&(i.current=e)})})}))});!function(e,i){void 0===i&&(i={});var r=i.insertAt;if(e&&"u">typeof document){var s=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===r&&s.firstChild?s.insertBefore(n,s.firstChild):s.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}(".transform-component-module_wrapper__SPB86 {\n position: relative;\n width: -moz-fit-content;\n width: fit-content;\n height: -moz-fit-content;\n height: fit-content;\n overflow: hidden;\n -webkit-touch-callout: none; /* iOS Safari */\n -webkit-user-select: none; /* Safari */\n -khtml-user-select: none; /* Konqueror HTML */\n -moz-user-select: none; /* Firefox */\n -ms-user-select: none; /* Internet Explorer/Edge */\n user-select: none;\n margin: 0;\n padding: 0;\n transform: translate3d(0, 0, 0);\n}\n.transform-component-module_content__FBWxo {\n display: flex;\n flex-wrap: wrap;\n width: -moz-fit-content;\n width: fit-content;\n height: -moz-fit-content;\n height: fit-content;\n margin: 0;\n padding: 0;\n transform-origin: 0% 0%;\n}\n.transform-component-module_content__FBWxo img {\n pointer-events: none;\n}\n.transform-component-module_infiniteGrid__Z-aP3 {\n position: absolute;\n inset: 0;\n pointer-events: none;\n background-image: radial-gradient(\n circle,\n rgba(0, 0, 0, 0.12) 1px,\n transparent 1px\n );\n background-size: 20px 20px;\n background-position: 0 0;\n}\n");var cT=function(e){var i=e.children,r=e.wrapperClass,s=e.contentClass,n=e.wrapperStyle,o=e.contentStyle,a=e.wrapperProps,l=e.contentProps,h=e.infinite,c=void 0!==h&&h,d=(0,R.useContext)(cD),u=d.init,f=d.cleanupWindowEvents,p=(0,R.useRef)(null),_=(0,R.useRef)(null),g=(0,R.useRef)(null);return(0,R.useEffect)(function(){var e=p.current,i=_.current;return null!==e&&null!==i&&u&&(null==u||u(e,i)),function(){null==f||f()}},[]),(0,R.useEffect)(function(){if(c){var e=g.current;if(e){var i=function(){var i=d.state,r=i.positionX,s=i.positionY;e.style.backgroundPosition="".concat(r,"px ").concat(s,"px")};return i(),d.onChange(i)}}},[c,d]),(0,I.jsxs)("div",hZ({},void 0===a?{}:a,{ref:p,className:"".concat(h0," ").concat("transform-component-module_wrapper__SPB86"," ").concat(void 0===r?"":r),style:n},{children:[c&&(0,I.jsx)("div",{ref:g,className:"transform-component-module_infiniteGrid__Z-aP3","aria-hidden":!0}),(0,I.jsx)("div",hZ({},void 0===l?{}:l,{ref:_,className:"".concat("react-transform-component"," ").concat("transform-component-module_content__FBWxo"," ").concat(void 0===s?"":s),style:hZ(hZ({},o),{transform:ci(d.state.positionX,d.state.positionY,d.state.scale)})},{children:i}))]}))};R.default.forwardRef(function(e,i){var r=e.x,s=e.y,n=e.width,o=e.height,a=e.margin,l=void 0===a?0:a,h=e.threshold,c=void 0===h?0:h,d=e.placeholder,u=void 0===d?null:d,f=e.onShow,p=e.onHide,_=e.children,g=e.className,v=e.style,m=(0,R.useContext)(cD),S=(0,R.useState)(!1),y=S[0],b=S[1],w=(0,R.useRef)(!1),C=(0,R.useRef)(f),x=(0,R.useRef)(p);return(C.current=f,x.current=p,(0,R.useEffect)(function(){var e,i=function(){var e,i,a=m.wrapperComponent;if(a){var h=function(e){var i=e.elementX,r=e.elementY,s=e.elementWidth,n=e.elementHeight,o=e.scale,a=e.positionX,l=e.positionY,h=e.viewportWidth,c=e.viewportHeight,d=e.margin,u=void 0===d?0:d,f=e.threshold,p=void 0===f?0:f,_={x:-u,y:-u,width:h+2*u,height:c+2*u},g={x:i*o+a,y:r*o+l,width:s*o,height:n*o};if(p<=0){var v=g.x<_.x+_.width&&g.x+g.width>_.x,m=g.y<_.y+_.height&&g.y+g.height>_.y;return v&&m}var S=g.width*g.height;return!(S<=0)&&Math.max(0,Math.min(_.x+_.width,g.x+g.width)-Math.max(_.x,g.x))*Math.max(0,Math.min(_.y+_.height,g.y+g.height)-Math.max(_.y,g.y))/S>=p}({elementX:r,elementY:s,elementWidth:n,elementHeight:o,scale:m.state.scale,positionX:m.state.positionX,positionY:m.state.positionY,viewportWidth:a.offsetWidth,viewportHeight:a.offsetHeight,margin:l,threshold:c});h!==w.current&&(w.current=h,b(h),h?null==(e=C.current)||e.call(C):null==(i=x.current)||i.call(x))}};i();var a=m.onChange(i);return m.wrapperComponent||(e=m.onInit(function(){return i()})),function(){a(),null==e||e()}},[m,r,s,n,o,l,c]),y)?(0,I.jsx)("div",hZ({ref:i,className:g,style:v},{children:_})):u?(0,I.jsx)(I.Fragment,{children:u}):null});var cP=e.i(81181),cI=e.i(30702);let cR=(0,B.default)("flip-horizontal-2",[["path",{d:"m3 7 5 5-5 5V7",key:"couhi7"}],["path",{d:"m21 7-5 5 5 5V7",key:"6ouia7"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 2v2",key:"tus03m"}]]),cM=(0,B.default)("flip-vertical-2",[["path",{d:"m17 3-5 5-5-5h10",key:"1ftt6x"}],["path",{d:"m17 21-5-5-5 5h10",key:"1m0wmu"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}]]),cN=(0,B.default)("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);var cL=e.i(87538),cB=e.i(34808),cA=e.i(9388),cj=e.i(3214),cH=e.i(38227);let cW=(0,B.default)("rotate-cw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);var cz=e.i(6910);let cF=R.useLayoutEffect;function c$(){let[e,i]=(0,R.useState)("light");return cF(()=>{let e=document.documentElement,r=()=>i("u"<typeof document?"light":document.documentElement.classList.contains("dark")?"dark":"light");r();let s=new MutationObserver(r);return s.observe(e,{attributes:!0,attributeFilter:["class"]}),()=>s.disconnect()},[]),e}let cK=["checkered","black","white","transparent"];function cU({applicationId:e,path:i}){let r,s=`/api/applications/${e}/files/raw?path=${encodeURIComponent(i)}`,n="dark"===c$(),o=(0,R.useMemo)(()=>{let e,i;return e=n?"#1e1e1e":"#ffffff",i=n?"#2a2a2a":"#e5e7eb",{checkered:{backgroundImage:`linear-gradient(45deg, ${i} 25%, transparent 25%), linear-gradient(-45deg, ${i} 25%, transparent 25%), linear-gradient(45deg, transparent 75%, ${i} 75%), linear-gradient(-45deg, transparent 75%, ${i} 75%)`,backgroundSize:"16px 16px",backgroundPosition:"0 0, 0 8px, 8px -8px, -8px 0px",backgroundColor:e},black:{backgroundColor:"#000000"},white:{backgroundColor:"#ffffff"},transparent:{backgroundColor:e}}},[n]),a=n?"bg-[#1e1e1e]":"bg-[#ffffff]",l=(0,R.useRef)(null),[h,c]=(0,R.useState)("checkered"),[d,u]=(0,R.useState)(0),[f,p]=(0,R.useState)(!1),[_,g]=(0,R.useState)(!1),[v,m]=(0,R.useState)(1),[S,y]=(0,R.useState)(null),[b,w]=(0,R.useState)(null),[C,x]=(0,R.useState)(null);(0,R.useEffect)(()=>{u(0),p(!1),g(!1),m(1),y(null),w(null),x(null),l.current?.resetTransform?.()},[i]),(0,R.useEffect)(()=>{let e=!1;return(async()=>{try{let i=await fetch(s,{cache:"no-store"});if(!i.ok)return void x(`Failed to load image (${i.status})`);let r=await i.arrayBuffer();e||w(r.byteLength)}catch(i){e||x(i instanceof Error?i.message:String(i))}})(),()=>{e=!0}},[s]);let k=async()=>{try{let e=new URL(s,window.location.origin).toString();await navigator.clipboard.writeText(e),L.toast.success("Image URL copied")}catch{L.toast.error("Failed to copy URL")}};return C?(0,I.jsx)("div",{className:(0,q.cn)("flex h-full items-center justify-center text-xs text-red-500 dark:text-red-400",a),children:C}):(0,I.jsxs)("div",{className:(0,q.cn)("flex h-full min-h-0 flex-col",a),children:[(0,I.jsx)(cY,{scale:v,dimensions:S,bytes:b,bgMode:h,flipH:f,flipV:_,onZoomIn:()=>l.current?.zoomIn?.(.25),onZoomOut:()=>l.current?.zoomOut?.(.25),onReset:()=>l.current?.resetTransform?.(),onFit:()=>l.current?.centerView?.(1),onActualSize:()=>l.current?.setTransform?.(0,0,1),onRotateCcw:()=>u(e=>(e+270)%360),onRotateCw:()=>u(e=>(e+90)%360),onFlipH:()=>p(e=>!e),onFlipV:()=>g(e=>!e),onCycleBackground:()=>{c(e=>{let i=cK.indexOf(e);return cK[(i+1)%cK.length]})},onCopyUrl:k,onOpenInNewTab:()=>window.open(s,"_blank","noopener,noreferrer"),downloadHref:s,downloadName:-1===(r=i.lastIndexOf("/"))?i:i.slice(r+1)}),(0,I.jsx)("div",{className:"relative min-h-0 flex-1 overflow-hidden",style:o[h],children:(0,I.jsx)(cO,{ref:l,initialScale:1,minScale:.1,maxScale:40,centerOnInit:!0,wheel:{step:.05},doubleClick:{mode:"reset"},pinch:{step:2},onTransform:(e,i)=>m(i.scale),children:(0,I.jsx)(cT,{wrapperStyle:{width:"100%",height:"100%"},contentStyle:{width:"100%",height:"100%"},children:(0,I.jsx)("div",{className:"flex h-full w-full items-center justify-center",children:(0,I.jsx)("img",{src:s,alt:i,draggable:!1,onLoad:e=>{let i=e.currentTarget;y({w:i.naturalWidth,h:i.naturalHeight})},style:{transform:`rotate(${d}deg) scaleX(${f?-1:1}) scaleY(${_?-1:1})`,transformOrigin:"center",maxWidth:"90%",maxHeight:"90%",objectFit:"contain",imageRendering:v>=4?"pixelated":"auto",transition:"transform 120ms ease"}})})})})})]})}function cY({scale:e,dimensions:i,bytes:r,bgMode:s,flipH:n,flipV:o,onZoomIn:a,onZoomOut:l,onReset:h,onFit:c,onActualSize:d,onRotateCcw:u,onRotateCw:f,onFlipH:p,onFlipV:_,onCycleBackground:g,onCopyUrl:v,onOpenInNewTab:m,downloadHref:S,downloadName:y}){return(0,I.jsxs)("div",{className:"border-border bg-background/95 text-muted-foreground flex h-9 shrink-0 items-center gap-0.5 border-b px-2 text-[11px]",children:[(0,I.jsx)(cX,{label:"Zoom out",onClick:l,icon:(0,I.jsx)(cB.Minus,{className:"h-3.5 w-3.5"})}),(0,I.jsx)(cX,{label:"Zoom in",onClick:a,icon:(0,I.jsx)(cj.Plus,{className:"h-3.5 w-3.5"})}),(0,I.jsxs)("button",{type:"button",onClick:h,className:"text-foreground hover:bg-muted/60 h-6 min-w-[3.25rem] rounded-sm px-1.5 text-center font-mono tabular-nums",title:"Reset zoom",children:[Math.round(100*e),"%"]}),(0,I.jsx)(cq,{}),(0,I.jsx)(cX,{label:"Fit to screen",onClick:c,icon:(0,I.jsx)(cL.Maximize2,{className:"h-3.5 w-3.5"})}),(0,I.jsx)(cX,{label:"Actual size (1:1)",onClick:d,icon:(0,I.jsx)(cz.Square,{className:"h-3.5 w-3.5"})}),(0,I.jsx)(cq,{}),(0,I.jsx)(cX,{label:"Rotate 90° counter-clockwise",onClick:u,icon:(0,I.jsx)(cH.RotateCcw,{className:"h-3.5 w-3.5"})}),(0,I.jsx)(cX,{label:"Rotate 90° clockwise",onClick:f,icon:(0,I.jsx)(cW,{className:"h-3.5 w-3.5"})}),(0,I.jsx)(cX,{label:"Flip horizontal",onClick:p,icon:(0,I.jsx)(cR,{className:"h-3.5 w-3.5"}),active:n}),(0,I.jsx)(cX,{label:"Flip vertical",onClick:_,icon:(0,I.jsx)(cM,{className:"h-3.5 w-3.5"}),active:o}),(0,I.jsx)(cq,{}),(0,I.jsx)(cX,{label:`Background: ${s}`,onClick:g,icon:(0,I.jsx)(cA.Monitor,{className:"h-3.5 w-3.5"})}),(0,I.jsx)(cX,{label:"Copy URL",onClick:v,icon:(0,I.jsx)(cN,{className:"h-3.5 w-3.5"})}),(0,I.jsx)(cX,{label:"Open in new tab",onClick:m,icon:(0,I.jsx)(cI.ExternalLink,{className:"h-3.5 w-3.5"})}),(0,I.jsx)("a",{href:S,download:y,className:"text-muted-foreground hover:text-foreground hover:bg-muted/60 flex h-6 w-6 items-center justify-center rounded-sm",title:"Download",children:(0,I.jsx)(cP.Download,{className:"h-3.5 w-3.5"})}),(0,I.jsx)("div",{className:"flex-1"}),(0,I.jsxs)("div",{className:"flex items-center gap-2 font-mono text-[10px]",children:[i?(0,I.jsxs)("span",{children:[i.w," × ",i.h]}):null,(0,I.jsx)("span",{children:null==r||Number.isNaN(r)?"—":r<1024?`${r} B`:r<1048576?`${(r/1024).toFixed(1)} KB`:`${(r/1048576).toFixed(2)} MB`})]})]})}function cq(){return(0,I.jsx)("span",{className:"bg-border/60 mx-1 h-4 w-px shrink-0"})}function cX({label:e,onClick:i,icon:r,active:s}){return(0,I.jsx)("button",{type:"button",onClick:i,"aria-label":e,title:e,className:(0,q.cn)("hover:bg-muted/60 flex h-6 w-6 items-center justify-center rounded-sm transition-colors",s?"text-foreground bg-muted/60":"text-muted-foreground hover:text-foreground"),children:r})}let cV=(0,hp.default)(()=>e.A(63812),{loadableGenerated:{modules:[58480]},ssr:!1,loading:()=>(0,I.jsx)("div",{className:"text-muted-foreground flex h-full items-center justify-center text-xs",children:"Loading editor…"})}),cG={ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",json:"json",md:"markdown",mdx:"markdown",css:"css",scss:"scss",html:"html",yml:"yaml",yaml:"yaml",toml:"ini",ini:"ini",sh:"shell",bash:"shell",py:"python",go:"go",rs:"rust",java:"java",sql:"sql",xml:"xml",dockerfile:"dockerfile"};function cZ({applicationId:e,openFiles:i,activePath:r,onSelect:s,onClose:n,onChange:o,onSave:a,onPromote:l,onToggleViewMode:h,sidebarCollapsed:c,onShowSidebar:d}){let u=(0,R.useMemo)(()=>i.find(e=>e.path===r)??null,[i,r]),f="dark"===c$();(0,R.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&("s"===e.key||"S"===e.key)&&(e.preventDefault(),a())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[a]);let p=(0,R.useCallback)(e=>{u&&o(u.path,e??"")},[u,o]);return(0,I.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,I.jsxs)("div",{role:"tablist","aria-label":"Open files",className:"border-border bg-muted/30 flex h-8 shrink-0 items-center border-b",children:[(0,I.jsx)("div",{className:"flex min-w-0 flex-1 items-center overflow-x-auto",children:0===i.length?(0,I.jsx)("div",{className:"text-muted-foreground px-3 text-[11px]",children:"No file open"}):i.map(e=>{var i;let o,a=e.content!==e.originalContent,h=e.path===r;return(0,I.jsxs)("div",{role:"tab","aria-selected":h,onClick:()=>s(e.path),onDoubleClick:()=>l(e.path),className:(0,q.cn)("group border-border flex h-8 shrink-0 cursor-pointer items-center gap-1.5 border-r px-3 text-[11px]",h?"bg-background text-foreground":"text-muted-foreground hover:bg-muted/60"),title:e.isPreview?`${e.path} — preview (double-click tab or edit to keep open)`:e.path,children:[(0,I.jsx)(hh.default,{className:"h-3 w-3 shrink-0 text-sky-500"}),(0,I.jsx)("span",{className:(0,q.cn)("truncate",e.isPreview&&"italic"),children:-1===(o=(i=e.path).lastIndexOf("/"))?i:i.slice(o+1)}),a?(0,I.jsx)("span",{className:"bg-primary/70 inline-block h-1.5 w-1.5 rounded-full","aria-label":"Unsaved changes"}):null,(0,I.jsx)("button",{type:"button",onClick:i=>{i.stopPropagation(),n(e.path)},className:"text-muted-foreground/70 hover:text-foreground ml-1 rounded-sm p-0.5","aria-label":`Close ${e.path}`,children:(0,I.jsx)(hy.X,{className:"h-3 w-3"})})]},e.path)})}),u?.isMarkdown?(0,I.jsx)("button",{type:"button",onClick:()=>h(u.path),className:"text-muted-foreground hover:text-foreground border-border flex h-8 w-8 shrink-0 items-center justify-center border-l","aria-label":"rendered"===u.viewMode?"Show markdown source":"Show markdown preview",title:"rendered"===u.viewMode?"Show markdown source":"Show markdown preview",children:"rendered"===u.viewMode?(0,I.jsx)(hm.FileCode,{className:"h-3.5 w-3.5"}):(0,I.jsx)(hv.Eye,{className:"h-3.5 w-3.5"})}):null,c?(0,I.jsx)("button",{type:"button",onClick:d,className:"text-muted-foreground hover:text-foreground border-border flex h-8 w-8 shrink-0 items-center justify-center border-l","aria-label":"Show file explorer",title:"Show file explorer",children:(0,I.jsx)(hS,{className:"h-3.5 w-3.5"})}):null]}),(0,I.jsx)("div",{className:(0,q.cn)("min-h-0 flex-1",f?"bg-[#1e1e1e]":"bg-[#ffffff]"),children:u?u.isImage?(0,I.jsx)(cU,{applicationId:e,path:u.path}):u.binary?(0,I.jsx)(cJ,{children:"Binary file — preview not available"}):u.tooLarge?(0,I.jsx)(cJ,{children:"File is too large to preview"}):u.isMarkdown&&"rendered"===u.viewMode?(0,I.jsx)(c0,{source:u.content,isDark:f}):(0,I.jsx)(cV,{height:"100%",theme:f?"vs-dark":"vs",language:function(e){let i=e.split("/").pop()??e;if("dockerfile"===i.toLowerCase())return"dockerfile";let r=i.includes(".")?i.split(".").pop()?.toLowerCase():"";return(r?cG[r]:void 0)??"plaintext"}(u.path),value:u.content,onChange:p,options:{fontSize:13,minimap:{enabled:!0},scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,wordWrap:"off",renderWhitespace:"selection",smoothScrolling:!0}},u.path):(0,I.jsx)(cJ,{children:"Select a file from the tree to start editing"})})]})}function cJ({children:e}){return(0,I.jsx)("div",{className:"text-muted-foreground flex h-full items-center justify-center text-xs",children:e})}let cQ={h1:({children:e})=>(0,I.jsx)("h1",{className:"border-border text-foreground mt-6 mb-4 border-b pb-2 text-2xl font-semibold",children:e}),h2:({children:e})=>(0,I.jsx)("h2",{className:"border-border text-foreground mt-5 mb-3 border-b pb-1 text-xl font-semibold",children:e}),h3:({children:e})=>(0,I.jsx)("h3",{className:"text-foreground mt-4 mb-2 text-lg font-semibold",children:e}),p:({children:e})=>(0,I.jsx)("p",{className:"my-3",children:e}),a:({children:e,href:i})=>(0,I.jsx)("a",{href:i,target:"_blank",rel:"noreferrer",className:"text-sky-600 underline hover:text-sky-500 dark:text-sky-400 dark:hover:text-sky-300",children:e}),ul:({children:e})=>(0,I.jsx)("ul",{className:"my-3 ml-6 list-disc",children:e}),ol:({children:e})=>(0,I.jsx)("ol",{className:"my-3 ml-6 list-decimal",children:e}),li:({children:e})=>(0,I.jsx)("li",{className:"my-1",children:e}),blockquote:({children:e})=>(0,I.jsx)("blockquote",{className:"border-border text-muted-foreground my-3 border-l-4 pl-4 italic",children:e}),code:({className:e,children:i})=>e?(0,I.jsx)("code",{className:(0,q.cn)("font-mono text-[12px]",e),children:i}):(0,I.jsx)("code",{className:"bg-muted rounded px-1.5 py-0.5 font-mono text-[12px] text-pink-600 dark:text-pink-300",children:i}),pre:({children:e})=>(0,I.jsx)("pre",{className:"border-border bg-muted/60 my-4 overflow-auto rounded-md border p-3",children:e}),hr:()=>(0,I.jsx)("hr",{className:"border-border my-6"}),table:({children:e})=>(0,I.jsx)("table",{className:"border-border my-4 border-collapse border",children:e}),th:({children:e})=>(0,I.jsx)("th",{className:"border-border bg-muted/60 border px-3 py-1 text-left font-semibold",children:e}),td:({children:e})=>(0,I.jsx)("td",{className:"border-border border px-3 py-1",children:e})};function c0({source:e,isDark:i}){return(0,I.jsx)("div",{className:(0,q.cn)("text-foreground h-full overflow-auto px-8 py-6 text-[13px]",i?"bg-[#1e1e1e]":"bg-[#ffffff]"),children:(0,I.jsx)("div",{className:"markdown-preview mx-auto max-w-3xl leading-6",children:(0,I.jsx)(h_.default,{remarkPlugins:[hg.default],components:cQ,children:e})})})}async function c1(e){let i=await fetch(`/api/applications/${e}/files`,{cache:"no-store"});if(!i.ok)throw Error((await i.json().catch(()=>({}))).error??`Failed to load file tree (${i.status})`);return(await i.json()).tree}async function c2(e,i){let r=`/api/applications/${e}/files/content?path=${encodeURIComponent(i)}`,s=await fetch(r,{cache:"no-store"});if(!s.ok)throw Error((await s.json().catch(()=>({}))).error??`Failed to read file (${s.status})`);return await s.json()}async function c5(e,i,r){let s=await fetch(`/api/applications/${e}/files/content`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:i,content:r})});if(!s.ok)throw Error((await s.json().catch(()=>({}))).error??`Failed to save file (${s.status})`)}let c3=new Set(["png","jpg","jpeg","gif","webp","avif","bmp","ico","svg"]),c6=new Set(["md","mdx","markdown"]);function c4(e){let i=e.split("/").pop()??e,r=i.lastIndexOf(".");return -1===r?"":i.slice(r+1).toLowerCase()}function c8({applicationId:e}){let i=function(e){let[i,r]=(0,R.useState)(null),[s,n]=(0,R.useState)(null),[o,a]=(0,R.useState)(!0),[l,h]=(0,R.useState)([]),[c,d]=(0,R.useState)(null),u=(0,R.useRef)([]);(0,R.useEffect)(()=>{u.current=l},[l]);let f=(0,R.useCallback)(async()=>{try{let i=await c1(e);r(i),n(null)}catch(e){n(e instanceof Error?e.message:String(e))}finally{a(!1)}},[e]);(0,R.useEffect)(()=>{f()},[f]);let p=(0,R.useCallback)(async(i,r)=>{let s=r?.mode??"preview",n=u.current.find(e=>e.path===i);if(n){d(i),"persistent"===s&&n.isPreview&&h(e=>e.map(e=>e.path===i?{...e,isPreview:!1}:e));return}try{if(c3.has(c4(i))){let e={path:i,originalContent:"",content:"",isImage:!0,viewMode:"rendered",isPreview:"preview"===s};h(i=>{if("preview"===s){let r=i.findIndex(e=>e.isPreview);if(-1!==r){let s=i.slice();return s[r]=e,s}}return[...i,e]}),d(i);return}let r=await c2(e,i),n=r.path||i,o=c6.has(c4(n)),a={path:n,originalContent:r.content,content:r.content,tooLarge:r.tooLarge,binary:r.binary,isMarkdown:o,viewMode:o?"rendered":"source",isPreview:"preview"===s};h(e=>{if("preview"===s){let i=e.findIndex(e=>e.isPreview);if(-1!==i){let r=e.slice();return r[i]=a,r}}return[...e,a]}),d(n)}catch(e){L.toast.error("Could not open file",{description:e instanceof Error?e.message:String(e)})}},[e]),_=(0,R.useCallback)(e=>{h(i=>i.map(i=>i.path===e?{...i,isPreview:!1}:i))},[]),g=(0,R.useCallback)(e=>{h(i=>i.map(i=>i.path===e?{...i,viewMode:"rendered"===i.viewMode?"source":"rendered"}:i))},[]),v=(0,R.useCallback)(e=>{h(i=>{let r=i.filter(i=>i.path!==e);return d(s=>{if(s!==e)return s;if(0===r.length)return null;let n=Math.min(i.findIndex(i=>i.path===e),r.length-1);return r[Math.max(0,n)].path}),r})},[]),m=(0,R.useCallback)(e=>{d(e)},[]),S=(0,R.useCallback)((e,i)=>{h(r=>r.map(r=>r.path===e?{...r,content:i,isPreview:!r.isPreview&&r.isPreview}:r))},[]),y=(0,R.useCallback)(async()=>{let i=u.current.find(e=>e.path===c);if(i&&i.content!==i.originalContent)try{await c5(e,i.path,i.content),h(e=>e.map(e=>e.path===i.path?{...e,originalContent:i.content}:e)),L.toast.success("Saved",{description:i.path})}catch(e){L.toast.error("Failed to save",{description:e instanceof Error?e.message:String(e)})}},[e,c]);return(0,R.useEffect)(()=>{let i=new EventSource(`/api/applications/${e}/files/watch`),r=null;return i.addEventListener("change",i=>{try{let s=JSON.parse(i.data);if(r||(r=setTimeout(()=>{r=null,f()},250)),!u.current.some(e=>e.path===s.path)||s.isDirectory)return;if("deleted"===s.kind)return void L.toast.message("File deleted on disk",{description:s.path});(async()=>{try{let i=await c2(e,s.path);h(e=>e.map(e=>e.path!==s.path||e.content!==e.originalContent?e:{...e,originalContent:i.content,content:i.content,tooLarge:i.tooLarge,binary:i.binary}))}catch{}})()}catch{}}),i.onerror=()=>{},()=>{i.close(),r&&clearTimeout(r)}},[e,f]),{tree:i,treeError:s,treeLoading:o,openFiles:l,activePath:c,openFile:p,closeFile:v,selectFile:m,promoteFile:_,updateBuffer:S,toggleViewMode:g,saveActive:y}}(e),[r,s]=(0,R.useState)(260),[n,o]=(0,R.useState)(!1),a=(0,R.useRef)(null),l=(0,R.useRef)(!1),h=(0,R.useCallback)(e=>{e.preventDefault(),l.current=!0,e.currentTarget.setPointerCapture(e.pointerId)},[]),c=(0,R.useCallback)(e=>{if(!l.current||!a.current)return;let i=a.current.getBoundingClientRect();s(Math.max(160,Math.min(i.right-e.clientX,i.width-300)))},[]),d=(0,R.useCallback)(()=>{l.current=!1},[]),u=(0,R.useCallback)(()=>o(!1),[]),f=(0,R.useCallback)(()=>o(!0),[]),p=(0,R.useCallback)((e,r)=>{i.openFile(e,{mode:r})},[i]);return(0,I.jsxs)("div",{ref:a,className:"bg-background flex h-full min-h-0 flex-1","data-testid":"ide-tab",children:[(0,I.jsx)("section",{className:"min-w-0 flex-1",children:(0,I.jsx)(cZ,{applicationId:e,openFiles:i.openFiles,activePath:i.activePath,onSelect:i.selectFile,onClose:i.closeFile,onChange:i.updateBuffer,onSave:i.saveActive,onPromote:i.promoteFile,onToggleViewMode:i.toggleViewMode,sidebarCollapsed:n,onShowSidebar:u})}),!n&&(0,I.jsx)("div",{role:"separator","aria-orientation":"vertical",className:"border-border hover:bg-primary/20 relative w-px shrink-0 cursor-col-resize border-l transition-colors",onPointerDown:h,onPointerMove:c,onPointerUp:d,children:(0,I.jsx)("span",{className:"absolute inset-y-0 -right-1 -left-1"})}),!n&&(0,I.jsxs)("aside",{className:"border-border flex min-h-0 shrink-0 flex-col border-l",style:{width:r},children:[(0,I.jsxs)("div",{className:"text-muted-foreground border-border bg-muted/30 flex h-8 shrink-0 items-center justify-between border-b px-2 text-[10px] font-medium tracking-wide uppercase",children:[(0,I.jsx)("span",{children:"Explorer"}),(0,I.jsx)("button",{type:"button",onClick:f,className:"text-muted-foreground hover:text-foreground -mr-1 flex h-6 w-6 items-center justify-center rounded-sm","aria-label":"Hide file explorer",title:"Hide file explorer",children:(0,I.jsx)(nB,{className:"h-3.5 w-3.5"})})]}),(0,I.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden",children:(0,I.jsx)(hf,{tree:i.tree,loading:i.treeLoading,error:i.treeError,activePath:i.activePath,onOpenFile:p})})]})]})}var c7=e.i(24042),c9=e.i(83428),de=e.i(70002);function dt({deploy:e,className:i,variant:r="full"}){let s=(0,R.useCallback)(()=>{e.url&&window.open(e.url,"_blank","noopener,noreferrer")},[e.url]);if(e.status===Y.DeploymentState.Booting||e.deployLoading)return(0,I.jsxs)("button",{type:"button",onClick:e.stop,disabled:e.stopLoading,className:(0,q.cn)("inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-amber-500/40 bg-amber-500/10 px-2 text-[11px] font-medium text-amber-600 transition-colors hover:bg-amber-500/20 dark:text-amber-400",i),title:"Dev server is starting — click to stop","aria-label":"Stop starting dev server",children:[(0,I.jsx)(c9.Loader2,{className:"h-3 w-3 animate-spin"}),(0,I.jsx)("span",{children:"Starting…"})]});if(e.status===Y.DeploymentState.Ready&&e.url&&"compact"===r)return(0,I.jsx)("button",{type:"button",onClick:e.stop,disabled:e.stopLoading,className:(0,q.cn)("inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-red-500/30 bg-red-500/5 text-red-600 transition-colors hover:border-red-500/60 hover:bg-red-500/15 dark:text-red-400",i),title:"Stop dev server","aria-label":"Stop dev server",children:e.stopLoading?(0,I.jsx)(c9.Loader2,{className:"h-3 w-3 animate-spin"}):(0,I.jsx)(cz.Square,{className:"h-3 w-3 fill-current"})});if(e.status===Y.DeploymentState.Ready&&e.url){let r=e.url.replace(/^https?:\/\//,"");return(0,I.jsxs)("div",{className:(0,q.cn)("inline-flex h-7 shrink-0 items-stretch overflow-hidden rounded-md border border-violet-500/40 bg-violet-500/10 text-[11px] font-medium text-violet-700 dark:text-violet-300",i),children:[(0,I.jsxs)("button",{type:"button",onClick:s,className:"inline-flex items-center gap-1.5 px-2 font-mono transition-colors hover:bg-violet-500/20",title:`Open ${e.url}`,"aria-label":`Open dev server at ${e.url}`,children:[(0,I.jsxs)("span",{className:"relative flex h-2 w-2 shrink-0",children:[(0,I.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-violet-400 opacity-60"}),(0,I.jsx)("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-violet-500"})]}),(0,I.jsx)("span",{className:"truncate",children:r}),(0,I.jsx)(cI.ExternalLink,{className:"h-3 w-3 opacity-60"})]}),(0,I.jsx)("span",{className:"w-px bg-violet-500/30","aria-hidden":!0}),(0,I.jsx)("button",{type:"button",onClick:e.stop,disabled:e.stopLoading,className:"inline-flex items-center justify-center px-1.5 text-red-600 transition-colors hover:bg-red-500/20 dark:text-red-400",title:"Stop dev server","aria-label":"Stop dev server",children:e.stopLoading?(0,I.jsx)(c9.Loader2,{className:"h-3 w-3 animate-spin"}):(0,I.jsx)(cz.Square,{className:"h-3 w-3 fill-current"})})]})}return e.deployError?(0,I.jsxs)("button",{type:"button",onClick:e.deploy,className:(0,q.cn)("inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-red-500/40 bg-red-500/10 px-2 text-[11px] font-medium text-red-600 transition-colors hover:bg-red-500/20 dark:text-red-400",i),title:e.deployError,"aria-label":"Retry starting dev server",children:[(0,I.jsx)(de.TriangleAlert,{className:"h-3 w-3"}),(0,I.jsx)("span",{children:"Retry"})]}):(0,I.jsxs)("button",{type:"button",onClick:e.deploy,className:(0,q.cn)("inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-violet-500/50 bg-gradient-to-br from-indigo-500/15 to-violet-500/20 px-2.5 text-[11px] font-medium text-violet-700 transition-colors hover:from-indigo-500/25 hover:to-violet-500/30 dark:text-violet-300",i),title:"Install dependencies and preview the app","aria-label":"Preview app",children:[(0,I.jsx)(c7.Play,{className:"h-3 w-3 fill-current"}),(0,I.jsx)("span",{children:"Preview"})]})}var di=e.i(32494);function dr({deploy:e}){let i=(0,R.useCallback)(()=>{e.url&&window.open(e.url,"_blank","noopener,noreferrer")},[e.url]);return e.status===Y.DeploymentState.Ready&&e.url?(0,I.jsxs)("div",{className:"bg-background flex min-h-0 flex-1 flex-col",children:[(0,I.jsxs)("div",{className:"border-border bg-muted/70 text-foreground flex h-8 shrink-0 items-center gap-2 border-b px-2 text-[11px] dark:bg-neutral-900",children:[(0,I.jsxs)("span",{className:"relative flex h-2 w-2 shrink-0",children:[(0,I.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-60"}),(0,I.jsx)("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-emerald-500"})]}),(0,I.jsx)("span",{className:"text-foreground/90 truncate font-mono",children:e.url}),(0,I.jsx)("div",{className:"flex-1"}),(0,I.jsxs)("button",{type:"button",onClick:i,className:"text-muted-foreground hover:text-foreground hover:bg-background/60 inline-flex items-center gap-1 rounded px-1.5 py-0.5 transition-colors dark:hover:bg-neutral-800",title:"Open in a new browser tab",children:[(0,I.jsx)(cI.ExternalLink,{className:"h-3 w-3"}),(0,I.jsx)("span",{children:"Open"})]})]}),(0,I.jsx)("iframe",{src:e.url,className:"min-h-0 w-full flex-1 border-0 bg-white",title:"Application preview"},e.url)]}):e.status===Y.DeploymentState.Booting||e.deployLoading?(0,I.jsx)(ds,{icon:(0,I.jsx)(c9.Loader2,{className:"text-muted-foreground h-8 w-8 animate-spin"}),title:"Starting dev server…",description:"Installing dependencies and booting the app. This can take a minute on the first run."}):e.deployError?(0,I.jsx)(ds,{icon:(0,I.jsx)(de.TriangleAlert,{className:"h-8 w-8 text-red-500"}),title:"Failed to start dev server",description:e.deployError,actionLabel:"Retry",onAction:e.deploy}):(0,I.jsx)(ds,{icon:(0,I.jsx)(di.Globe,{className:"text-muted-foreground h-8 w-8"}),title:"No dev server running",description:"Click Preview to install dependencies and start the app. The preview will appear here.",actionLabel:"Preview",actionIcon:(0,I.jsx)(c7.Play,{className:"h-3.5 w-3.5 fill-current"}),onAction:e.deploy})}function ds({icon:e,title:i,description:r,actionLabel:s,actionIcon:n,onAction:o}){return(0,I.jsx)("div",{className:"flex min-h-0 flex-1 items-center justify-center p-6",children:(0,I.jsxs)("div",{className:"flex max-w-sm flex-col items-center gap-3 text-center",children:[e,(0,I.jsx)("h3",{className:"text-foreground text-sm font-semibold",children:i}),(0,I.jsx)("p",{className:"text-muted-foreground text-xs leading-relaxed",children:r}),s&&o?(0,I.jsxs)("button",{type:"button",onClick:o,className:"mt-2 inline-flex h-8 items-center gap-1.5 rounded-md border border-violet-500/50 bg-gradient-to-br from-indigo-500/15 to-violet-500/20 px-3 text-xs font-medium text-violet-700 transition-colors hover:from-indigo-500/25 hover:to-violet-500/30 dark:text-violet-300",children:[n,(0,I.jsx)("span",{children:s})]}):null]})})}var dn=e.i(8537),da=e.i(80554),dl=e.i(98440),dh=e.i(3402),dc=e.i(21023);let dd=(0,dc.createServerReference)("40944a288e4871edb2ec62b9df6ed2c6684a794d95",dc.callServer,void 0,dc.findSourceMapURL,"getApplicationDebugPrompt");var du=e.i(79988);let df=["ide","terminal","web"],dp={ide:"IDE",terminal:"Terminal",web:"Web"};function d_({application:e,activeView:i,onViewChange:r,onBack:s,initialChatState:n,deploy:o}){return(0,I.jsxs)("header",{className:(0,q.cn)("bg-background/95 supports-[backdrop-filter]:bg-background/70 sticky top-0 z-20 flex shrink-0 items-center gap-2 border-b px-3 backdrop-blur","h-11"),children:[(0,I.jsx)(X.Button,{variant:"ghost",size:"icon","aria-label":"Back to canvas",onClick:s,className:"h-7 w-7",children:(0,I.jsx)(A,{className:"h-3.5 w-3.5"})}),(0,I.jsx)("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-gradient-to-br from-indigo-500 to-violet-500",children:(0,I.jsx)(j.LayoutGrid,{className:"h-3 w-3 text-white"})}),(0,I.jsx)("h1",{className:"min-w-0 truncate text-sm font-semibold",children:e.name}),(0,I.jsx)(dy,{applicationId:e.id,persistedStatus:e.status,deployReady:o.status===Y.DeploymentState.Ready}),(0,I.jsx)(db,{}),(0,I.jsx)(dg,{repositoryPath:e.repositoryPath}),(0,I.jsx)("div",{className:"flex-1"}),(0,I.jsx)(dm,{featureId:`app-${e.id}`,initialChatState:n}),(0,I.jsx)(dS,{applicationId:e.id}),(0,I.jsx)(dt,{deploy:o}),(0,I.jsx)(dw,{active:i,onChange:r})]})}function dg({repositoryPath:e}){let i,r,s=(0,R.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),L.toast.success("Path copied",{description:e})}catch{L.toast.error("Failed to copy path")}},[e]),n=(0,R.useCallback)(async()=>{let i=await (0,dh.openFolder)(e);i.success||L.toast.error("Could not open folder",{description:i.error})},[e]);return(0,I.jsxs)("div",{className:"text-muted-foreground flex min-w-0 items-center gap-1.5 text-xs",children:[(0,I.jsx)("span",{className:"truncate font-mono text-[11px]",title:e,children:-1===(r=(i=e.replace(/\\/g,"/").replace(/\/+$/,"")).lastIndexOf("/"))?i:i.slice(r+1)}),(0,I.jsx)(X.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-foreground h-5 w-5",onClick:s,"aria-label":"Copy path",title:"Copy path",children:(0,I.jsx)(W.Copy,{className:"h-3 w-3"})}),(0,I.jsx)(X.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-foreground h-5 w-5",onClick:n,"aria-label":"Open in file manager",title:"Open in file manager",children:(0,I.jsx)(z.FolderOpen,{className:"h-3 w-3"})}),(0,I.jsx)("span",{className:"text-muted-foreground/40",children:"·"}),(0,I.jsx)(dv,{repositoryPath:e})]})}function dv({repositoryPath:e}){let{data:i}=(0,N.useQuery)({queryKey:["git-repo-info",e],queryFn:()=>(0,du.getGitRepoInfo)(e,1),enabled:!!e,refetchInterval:5e3,refetchOnWindowFocus:!0,staleTime:2e3}),r=i?.currentBranch?.trim(),s=r&&r.length>0?r:"main",n=i?.workingTree.untracked??0,o=i?.workingTree.modified??0,a=i?.diffStats?.insertions??0,l=i?.diffStats?.deletions??0,h=n>0||o>0,c=(0,R.useCallback)(()=>{L.toast.info("Commit (not wired up yet)",{description:`Would commit ${o} edited / ${n} added file(s) on ${s}`})},[n,o,s]),d=(0,R.useCallback)(()=>{L.toast.info("Commit & Push (not wired up yet)",{description:`Would commit and push ${o} edited / ${n} added file(s) on ${s}`})},[n,o,s]);return(0,I.jsxs)("div",{className:"flex items-center gap-2 font-mono text-[11px]",children:[(0,I.jsxs)("span",{className:"flex items-center gap-1",title:`Branch: ${s}`,children:[(0,I.jsx)(H.GitBranch,{className:"h-3 w-3"}),s]}),n>0?(0,I.jsxs)("span",{className:"flex items-center gap-0.5 text-emerald-500",title:`${n} added ${1===n?"file":"files"}`,children:[(0,I.jsx)(K.FilePlus,{className:"h-3 w-3"}),n]}):null,o>0?(0,I.jsxs)("span",{className:"flex items-center gap-0.5 text-amber-500",title:`${o} edited ${1===o?"file":"files"}`,children:[(0,I.jsx)(U.default,{className:"h-3 w-3"}),o]}):null,a>0||l>0?(0,I.jsxs)("span",{className:"flex items-center gap-1",title:`${a} insertions, ${l} deletions vs HEAD`,children:[a>0?(0,I.jsxs)("span",{className:"text-emerald-500",children:["+",a]}):null,l>0?(0,I.jsxs)("span",{className:"text-rose-500",children:["-",l]}):null]}):null,h?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("button",{type:"button",onClick:c,className:"border-border bg-background text-foreground hover:bg-muted inline-flex h-6 shrink-0 items-center gap-1 rounded-md border px-2 text-[11px] font-medium transition-colors",title:"Commit working tree changes",children:"Commit"}),(0,I.jsx)("button",{type:"button",onClick:d,className:"inline-flex h-6 shrink-0 items-center gap-1 rounded-md border border-indigo-500/40 bg-indigo-500/10 px-2 text-[11px] font-medium text-indigo-600 transition-colors hover:bg-indigo-500/20 dark:text-indigo-400",title:"Commit and push to remote",children:"Commit & Push"})]}):null]})}function dm({featureId:e,initialChatState:i}){let{data:r}=(0,N.useQuery)({queryKey:(0,dl.chatQueryKey)(e),queryFn:()=>(0,dl.fetchChatState)(e),initialData:i,staleTime:1/0,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),s=r?.sessionInfo,n=s?.sessionId??null,o=s?.model??null,a=n?n.slice(0,8):null,l=(0,R.useCallback)(async()=>{if(n)try{await navigator.clipboard.writeText(n),L.toast.success("Session ID copied",{description:n})}catch{L.toast.error("Failed to copy session id")}},[n]);return(0,I.jsxs)("button",{type:"button",onClick:l,disabled:!n,className:(0,q.cn)("border-border/60 bg-muted/40 text-muted-foreground inline-flex h-6 shrink-0 items-center gap-1.5 rounded-md border px-2 font-mono text-[10px] transition-colors",n?"hover:bg-muted hover:text-foreground cursor-pointer":"cursor-default opacity-60"),title:n?`Click to copy full session id: ${n}`:"No session yet","aria-label":n?"Copy session id":"No active session",children:[(0,I.jsx)($.Cpu,{className:"h-3 w-3 opacity-60"}),(0,I.jsx)("span",{className:"font-medium",children:o??"agent"}),(0,I.jsx)("span",{className:"text-muted-foreground/50",children:"·"}),(0,I.jsx)("span",{children:a??"—"})]})}function dS({applicationId:e}){let[i,r]=(0,R.useState)(!1),s=(0,R.useCallback)(async()=>{if(!i){r(!0);try{let i=await dd(e);if(i.error||!i.combined)return void L.toast.error("Failed to build prompt",{description:i.error});await navigator.clipboard.writeText(i.combined);let r=i.systemPrompt?.length??0,s=i.userMessage?.length??0;L.toast.success("Prompt copied to clipboard",{description:`${r} chars system + ${s} chars user`})}catch(e){L.toast.error("Failed to copy prompt",{description:e instanceof Error?e.message:String(e)})}finally{r(!1)}}},[e,i]);return(0,I.jsx)(X.Button,{variant:"ghost",size:"icon",onClick:s,disabled:i,className:"text-muted-foreground hover:text-foreground h-7 w-7","aria-label":"Copy full generated prompt (debug)",title:"Copy full generated prompt (debug) — system + user message",children:(0,I.jsx)(F.ClipboardList,{className:"h-3.5 w-3.5"})})}function dy({applicationId:e,persistedStatus:i,deployReady:r}){let s=(0,da.useTurnStatus)(`app-${e}`),n="processing"===s?{label:"In Progress",dotClass:"bg-violet-500",pulse:!0}:"awaiting_input"===s?{label:"Warning",dotClass:"bg-amber-500",pulse:!0}:r?{label:"Live",dotClass:"bg-emerald-500",pulse:!0}:"Error"===i?{label:"Error",dotClass:"bg-red-500",pulse:!1}:{label:"Ready",dotClass:"bg-sky-500",pulse:!1};return(0,I.jsxs)("span",{className:"border-border/60 inline-flex h-5 shrink-0 items-center gap-1 rounded-full border px-2 text-[10px] font-medium tracking-wide uppercase",children:[(0,I.jsx)("span",{className:(0,q.cn)("relative flex h-1.5 w-1.5 items-center justify-center rounded-full",n.dotClass),children:n.pulse?(0,I.jsx)("span",{className:(0,q.cn)("absolute inline-flex h-full w-full animate-ping rounded-full opacity-60",n.dotClass)}):null}),n.label]})}function db(){return(0,I.jsx)("span",{className:"bg-border/60 mx-1 h-4 w-px shrink-0"})}function dw({active:e,onChange:i}){return(0,I.jsx)("div",{role:"tablist","aria-label":"Right pane view",className:"bg-muted/60 flex items-center rounded-md p-0.5",children:df.map(r=>{let s=r===e;return(0,I.jsx)("button",{type:"button",role:"tab","aria-selected":s,onClick:()=>i(r),className:(0,q.cn)("h-6 cursor-pointer rounded-sm px-2.5 text-[11px] font-medium transition-colors",s?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:dp[r]},r)})})}function dC({left:e,right:i}){let r=(0,R.useRef)(null),[s,n]=(0,R.useState)(.4),o=(0,R.useRef)(!1),a=(0,R.useCallback)(e=>{e.preventDefault(),o.current=!0,e.currentTarget.setPointerCapture(e.pointerId)},[]),l=(0,R.useCallback)(e=>{if(!o.current||!r.current)return;let i=r.current.getBoundingClientRect(),s=i.width;n(Math.max(400,Math.min(e.clientX-i.left,s-400))/s)},[]),h=(0,R.useCallback)(()=>{o.current=!1},[]);return(0,I.jsxs)("div",{ref:r,className:"flex min-h-0 flex-1",children:[(0,I.jsx)("div",{className:"flex min-h-0 flex-col overflow-hidden",style:{flexBasis:`${100*s}%`,flexShrink:0},children:e}),(0,I.jsx)("div",{role:"separator","aria-orientation":"vertical",className:"group border-border hover:bg-primary/20 relative w-px shrink-0 cursor-col-resize border-l transition-colors",onPointerDown:a,onPointerMove:l,onPointerUp:h,children:(0,I.jsx)("span",{className:"absolute inset-y-0 -right-1 -left-1"})}),(0,I.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:i})]})}function dx({activeView:e,applicationId:i,terminalCwd:r,deploy:s}){let n=s.status===Y.DeploymentState.Ready||s.status===Y.DeploymentState.Booting||s.deployLoading||!!s.deployError;return(0,I.jsxs)("div",{className:"relative flex min-h-0 flex-1",children:[(0,I.jsx)("div",{className:(0,q.cn)("absolute inset-0 flex min-h-0 flex-col","terminal"===e?"visible":"pointer-events-none invisible"),"aria-hidden":"terminal"!==e,children:(0,I.jsx)(nL,{cwd:r})}),(0,I.jsx)("div",{className:(0,q.cn)("absolute inset-0 flex min-h-0 flex-col","ide"===e?"visible":"pointer-events-none invisible"),"aria-hidden":"ide"!==e,children:(0,I.jsx)(c8,{applicationId:i})}),n?(0,I.jsx)("div",{className:(0,q.cn)("absolute inset-0 flex min-h-0 flex-col","web"===e?"visible":"pointer-events-none invisible"),"aria-hidden":"web"!==e,children:(0,I.jsx)(dr,{deploy:s})}):"web"===e&&(0,I.jsx)(dr,{deploy:s})]})}function dk({application:e,initialChatState:i}){let r=(0,M.useRouter)(),[s,n]=(0,R.useState)("ide"),o=(0,dn.useDeployAction)({targetId:e.id,targetType:"application",repositoryPath:e.repositoryPath}),a=(0,R.useRef)(!1);(0,R.useEffect)(()=>{o.status===Y.DeploymentState.Ready&&o.url&&!a.current&&(a.current=!0,n("web")),o.status!==Y.DeploymentState.Ready&&(a.current=!1)},[o.status,o.url]);let l=(0,R.useCallback)(()=>{r.push("/"),r.refresh()},[r]);return(0,I.jsxs)("div",{className:"bg-background flex h-dvh flex-col",children:[(0,I.jsx)(d_,{application:e,activeView:s,onViewChange:n,onBack:l,initialChatState:i,deploy:o}),(0,I.jsx)(dC,{left:(0,I.jsx)(V.ChatTab,{featureId:`app-${e.id}`,worktreePath:e.repositoryPath,initialAgent:e.agentType,initialModel:e.modelOverride,initialChatState:i,hideHeader:!0,workflowPlaceholder:G,onAllStepsComplete:()=>{o.status===Y.DeploymentState.Ready||o.status===Y.DeploymentState.Booting||o.deployLoading||o.deploy()}}),right:(0,I.jsx)(dx,{activeView:s,applicationId:e.id,terminalCwd:e.repositoryPath,deploy:o})})]})}e.s(["ApplicationPage",()=>dk],97687)}]);