spec-cat 0.1.63 → 0.1.65

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 (271) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/_nuxt/B-bFNWCF.js +43 -0
  3. package/.output/public/_nuxt/{D4LyIv_t.js → BEWSHKZd.js} +1 -1
  4. package/.output/public/_nuxt/{Su-Cl_JF.js → BHhMtuRK.js} +1 -1
  5. package/.output/public/_nuxt/{DwpuOtAP.js → BwRpECPL.js} +1 -1
  6. package/.output/public/_nuxt/{FfyCVKRU.js → CC_9aMCT.js} +1 -1
  7. package/.output/public/_nuxt/CHHbeXzh.js +1 -0
  8. package/.output/public/_nuxt/{DIOhMCOf.js → CzV__9yP.js} +3 -3
  9. package/.output/public/_nuxt/{Bz2rU2zs.js → DWDrIutw.js} +1 -1
  10. package/.output/public/_nuxt/D_4Ow2w2.js +1 -0
  11. package/.output/public/_nuxt/D_T_F7lf.js +1 -0
  12. package/.output/public/_nuxt/{DPOGSCeV.js → DqFq1MXh.js} +1 -1
  13. package/.output/public/_nuxt/YzuyFhrD.js +174 -0
  14. package/.output/public/_nuxt/builds/latest.json +1 -1
  15. package/.output/public/_nuxt/builds/meta/cdc4ded8-9ff7-4e22-abbe-3b8c94caa781.json +1 -0
  16. package/.output/public/_nuxt/default.Cyeq1Er8.css +1 -0
  17. package/.output/public/_nuxt/entry.uBSFaL6A.css +1 -0
  18. package/.output/public/_nuxt/{useTheme.Cny4Z64J.css → useTheme.B4wINCoW.css} +1 -1
  19. package/.output/public/_nuxt/uyJF9wDo.js +58 -0
  20. package/.output/server/chunks/_/aiProviderRegistry.mjs +1 -2
  21. package/.output/server/chunks/_/aiProviderRegistry.mjs.map +1 -1
  22. package/.output/server/chunks/_/aiProviderSelection.mjs +2 -2
  23. package/.output/server/chunks/_/chatGit.mjs +1 -2
  24. package/.output/server/chunks/_/chatGit.mjs.map +1 -1
  25. package/.output/server/chunks/_/claudeProvider.mjs +1 -215
  26. package/.output/server/chunks/_/claudeProvider.mjs.map +1 -1
  27. package/.output/server/chunks/_/claudeService.mjs +50 -54
  28. package/.output/server/chunks/_/claudeService.mjs.map +1 -1
  29. package/.output/server/chunks/_/codexProvider.mjs +47 -812
  30. package/.output/server/chunks/_/codexProvider.mjs.map +1 -1
  31. package/.output/server/chunks/_/git.mjs +1 -2
  32. package/.output/server/chunks/_/git.mjs.map +1 -1
  33. package/.output/server/chunks/_/gitApiHelpers.mjs +1 -1
  34. package/.output/server/chunks/_/gitBranchOperations.mjs +1 -1
  35. package/.output/server/chunks/_/interactiveProviderQuery.mjs +160 -0
  36. package/.output/server/chunks/_/interactiveProviderQuery.mjs.map +1 -0
  37. package/.output/server/chunks/_/jobPersister.mjs +37 -6
  38. package/.output/server/chunks/_/jobPersister.mjs.map +1 -1
  39. package/.output/server/chunks/_/jobQueue.mjs +430 -278
  40. package/.output/server/chunks/_/jobQueue.mjs.map +1 -1
  41. package/.output/server/chunks/_/terminalSessions.mjs +582 -0
  42. package/.output/server/chunks/_/terminalSessions.mjs.map +1 -0
  43. package/.output/server/chunks/_/worktreeSetup.mjs +98 -0
  44. package/.output/server/chunks/_/worktreeSetup.mjs.map +1 -0
  45. package/.output/server/chunks/build/client.precomputed.mjs +1 -1
  46. package/.output/server/chunks/build/client.precomputed.mjs.map +1 -1
  47. package/.output/server/chunks/nitro/nitro.mjs +1227 -620
  48. package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
  49. package/.output/server/chunks/routes/_ws.mjs +21 -111
  50. package/.output/server/chunks/routes/_ws.mjs.map +1 -1
  51. package/.output/server/chunks/routes/api/ai/providers.get.mjs +3 -1
  52. package/.output/server/chunks/routes/api/ai/providers.get.mjs.map +1 -1
  53. package/.output/server/chunks/routes/api/chat/compare.get.mjs +4 -5
  54. package/.output/server/chunks/routes/api/chat/compare.get.mjs.map +1 -1
  55. package/.output/server/chunks/routes/api/chat/context.get.mjs +4 -2
  56. package/.output/server/chunks/routes/api/chat/context.get.mjs.map +1 -1
  57. package/.output/server/chunks/routes/api/chat/finalize.post.mjs +11 -7
  58. package/.output/server/chunks/routes/api/chat/finalize.post.mjs.map +1 -1
  59. package/.output/server/chunks/routes/api/chat/generate-commit-message.post.mjs +26 -29
  60. package/.output/server/chunks/routes/api/chat/generate-commit-message.post.mjs.map +1 -1
  61. package/.output/server/chunks/routes/api/chat/preview-sync.post.mjs +4 -5
  62. package/.output/server/chunks/routes/api/chat/preview-sync.post.mjs.map +1 -1
  63. package/.output/server/chunks/routes/api/chat/preview.delete.mjs +4 -5
  64. package/.output/server/chunks/routes/api/chat/preview.delete.mjs.map +1 -1
  65. package/.output/server/chunks/routes/api/chat/preview.post.mjs +4 -6
  66. package/.output/server/chunks/routes/api/chat/preview.post.mjs.map +1 -1
  67. package/.output/server/chunks/routes/api/chat/rebase.post.mjs +4 -7
  68. package/.output/server/chunks/routes/api/chat/rebase.post.mjs.map +1 -1
  69. package/.output/server/chunks/routes/api/chat/worktree-commit.post.mjs +4 -6
  70. package/.output/server/chunks/routes/api/chat/worktree-commit.post.mjs.map +1 -1
  71. package/.output/server/chunks/routes/api/chat/worktree.delete.mjs +11 -4
  72. package/.output/server/chunks/routes/api/chat/worktree.delete.mjs.map +1 -1
  73. package/.output/server/chunks/routes/api/chat/worktree.post.mjs +4 -6
  74. package/.output/server/chunks/routes/api/chat/worktree.post.mjs.map +1 -1
  75. package/.output/server/chunks/routes/api/conversations/_conversationId/archive.post.mjs +10 -9
  76. package/.output/server/chunks/routes/api/conversations/_conversationId/archive.post.mjs.map +1 -1
  77. package/.output/server/chunks/routes/api/conversations/archives/_archiveId/restore.post.mjs +4 -7
  78. package/.output/server/chunks/routes/api/conversations/archives/_archiveId/restore.post.mjs.map +1 -1
  79. package/.output/server/chunks/routes/api/conversations/archives/_archiveId_.delete.mjs +4 -7
  80. package/.output/server/chunks/routes/api/conversations/archives/_archiveId_.delete.mjs.map +1 -1
  81. package/.output/server/chunks/routes/api/conversations/archives.delete.mjs +40 -0
  82. package/.output/server/chunks/routes/api/conversations/archives.delete.mjs.map +1 -0
  83. package/.output/server/chunks/routes/api/conversations/archives.get.mjs +4 -7
  84. package/.output/server/chunks/routes/api/conversations/archives.get.mjs.map +1 -1
  85. package/.output/server/chunks/routes/api/conversations/update.post.mjs +4 -7
  86. package/.output/server/chunks/routes/api/conversations/update.post.mjs.map +1 -1
  87. package/.output/server/chunks/routes/api/conversations.get.mjs +4 -7
  88. package/.output/server/chunks/routes/api/conversations.get.mjs.map +1 -1
  89. package/.output/server/chunks/routes/api/conversations.post.mjs +4 -7
  90. package/.output/server/chunks/routes/api/conversations.post.mjs.map +1 -1
  91. package/.output/server/chunks/routes/api/cwd.get.mjs +4 -2
  92. package/.output/server/chunks/routes/api/cwd.get.mjs.map +1 -1
  93. package/.output/server/chunks/routes/api/git/branch-rename.post.mjs +3 -4
  94. package/.output/server/chunks/routes/api/git/branch-rename.post.mjs.map +1 -1
  95. package/.output/server/chunks/routes/api/git/branch.delete.mjs +4 -5
  96. package/.output/server/chunks/routes/api/git/branch.delete.mjs.map +1 -1
  97. package/.output/server/chunks/routes/api/git/branches.get.mjs +4 -6
  98. package/.output/server/chunks/routes/api/git/branches.get.mjs.map +1 -1
  99. package/.output/server/chunks/routes/api/git/checkout.post.mjs +4 -5
  100. package/.output/server/chunks/routes/api/git/checkout.post.mjs.map +1 -1
  101. package/.output/server/chunks/routes/api/git/cherry-pick.post.mjs +3 -4
  102. package/.output/server/chunks/routes/api/git/cherry-pick.post.mjs.map +1 -1
  103. package/.output/server/chunks/routes/api/git/clean.post.mjs +3 -4
  104. package/.output/server/chunks/routes/api/git/clean.post.mjs.map +1 -1
  105. package/.output/server/chunks/routes/api/git/commit/_id_.get.mjs +3 -4
  106. package/.output/server/chunks/routes/api/git/commit/_id_.get.mjs.map +1 -1
  107. package/.output/server/chunks/routes/api/git/commit.post.mjs +4 -5
  108. package/.output/server/chunks/routes/api/git/commit.post.mjs.map +1 -1
  109. package/.output/server/chunks/routes/api/git/diff.get.mjs +4 -5
  110. package/.output/server/chunks/routes/api/git/diff.get.mjs.map +1 -1
  111. package/.output/server/chunks/routes/api/git/fetch.post.mjs +3 -4
  112. package/.output/server/chunks/routes/api/git/fetch.post.mjs.map +1 -1
  113. package/.output/server/chunks/routes/api/git/file-diff.get.mjs +4 -5
  114. package/.output/server/chunks/routes/api/git/file-diff.get.mjs.map +1 -1
  115. package/.output/server/chunks/routes/api/git/graph.get.mjs +4 -5
  116. package/.output/server/chunks/routes/api/git/graph.get.mjs.map +1 -1
  117. package/.output/server/chunks/routes/api/git/log.get.mjs +4 -5
  118. package/.output/server/chunks/routes/api/git/log.get.mjs.map +1 -1
  119. package/.output/server/chunks/routes/api/git/merge-base.get.mjs +4 -5
  120. package/.output/server/chunks/routes/api/git/merge-base.get.mjs.map +1 -1
  121. package/.output/server/chunks/routes/api/git/merge.post.mjs +3 -4
  122. package/.output/server/chunks/routes/api/git/merge.post.mjs.map +1 -1
  123. package/.output/server/chunks/routes/api/git/pull.post.mjs +3 -4
  124. package/.output/server/chunks/routes/api/git/pull.post.mjs.map +1 -1
  125. package/.output/server/chunks/routes/api/git/push.post.mjs +3 -4
  126. package/.output/server/chunks/routes/api/git/push.post.mjs.map +1 -1
  127. package/.output/server/chunks/routes/api/git/rebase.post.mjs +3 -4
  128. package/.output/server/chunks/routes/api/git/rebase.post.mjs.map +1 -1
  129. package/.output/server/chunks/routes/api/git/remote.delete.mjs +3 -4
  130. package/.output/server/chunks/routes/api/git/remote.delete.mjs.map +1 -1
  131. package/.output/server/chunks/routes/api/git/remote.post.mjs +3 -4
  132. package/.output/server/chunks/routes/api/git/remote.post.mjs.map +1 -1
  133. package/.output/server/chunks/routes/api/git/remote.put.mjs +3 -4
  134. package/.output/server/chunks/routes/api/git/remote.put.mjs.map +1 -1
  135. package/.output/server/chunks/routes/api/git/remotes.get.mjs +3 -4
  136. package/.output/server/chunks/routes/api/git/remotes.get.mjs.map +1 -1
  137. package/.output/server/chunks/routes/api/git/reset.post.mjs +3 -4
  138. package/.output/server/chunks/routes/api/git/reset.post.mjs.map +1 -1
  139. package/.output/server/chunks/routes/api/git/revert.post.mjs +3 -4
  140. package/.output/server/chunks/routes/api/git/revert.post.mjs.map +1 -1
  141. package/.output/server/chunks/routes/api/git/show.get.mjs +4 -5
  142. package/.output/server/chunks/routes/api/git/show.get.mjs.map +1 -1
  143. package/.output/server/chunks/routes/api/git/stage.post.mjs +4 -5
  144. package/.output/server/chunks/routes/api/git/stage.post.mjs.map +1 -1
  145. package/.output/server/chunks/routes/api/git/stash-apply.post.mjs +3 -4
  146. package/.output/server/chunks/routes/api/git/stash-apply.post.mjs.map +1 -1
  147. package/.output/server/chunks/routes/api/git/stash-branch.post.mjs +3 -4
  148. package/.output/server/chunks/routes/api/git/stash-branch.post.mjs.map +1 -1
  149. package/.output/server/chunks/routes/api/git/stash-drop.post.mjs +3 -4
  150. package/.output/server/chunks/routes/api/git/stash-drop.post.mjs.map +1 -1
  151. package/.output/server/chunks/routes/api/git/stash-pop.post.mjs +3 -4
  152. package/.output/server/chunks/routes/api/git/stash-pop.post.mjs.map +1 -1
  153. package/.output/server/chunks/routes/api/git/stash.get.mjs +3 -4
  154. package/.output/server/chunks/routes/api/git/stash.get.mjs.map +1 -1
  155. package/.output/server/chunks/routes/api/git/stash.post.mjs +3 -4
  156. package/.output/server/chunks/routes/api/git/stash.post.mjs.map +1 -1
  157. package/.output/server/chunks/routes/api/git/state.get.mjs +3 -4
  158. package/.output/server/chunks/routes/api/git/state.get.mjs.map +1 -1
  159. package/.output/server/chunks/routes/api/git/status.get.mjs +4 -5
  160. package/.output/server/chunks/routes/api/git/status.get.mjs.map +1 -1
  161. package/.output/server/chunks/routes/api/git/tag/_name_.get.mjs +3 -4
  162. package/.output/server/chunks/routes/api/git/tag/_name_.get.mjs.map +1 -1
  163. package/.output/server/chunks/routes/api/git/tag-push.post.mjs +3 -4
  164. package/.output/server/chunks/routes/api/git/tag-push.post.mjs.map +1 -1
  165. package/.output/server/chunks/routes/api/git/tag.delete.mjs +3 -4
  166. package/.output/server/chunks/routes/api/git/tag.delete.mjs.map +1 -1
  167. package/.output/server/chunks/routes/api/git/tag.post.mjs +3 -4
  168. package/.output/server/chunks/routes/api/git/tag.post.mjs.map +1 -1
  169. package/.output/server/chunks/routes/api/git/unstage.post.mjs +4 -5
  170. package/.output/server/chunks/routes/api/git/unstage.post.mjs.map +1 -1
  171. package/.output/server/chunks/routes/api/index.get.mjs +7 -4
  172. package/.output/server/chunks/routes/api/index.get.mjs.map +1 -1
  173. package/.output/server/chunks/routes/api/index.get2.mjs +4 -2
  174. package/.output/server/chunks/routes/api/index.get2.mjs.map +1 -1
  175. package/.output/server/chunks/routes/api/index.get3.mjs +4 -2
  176. package/.output/server/chunks/routes/api/index.get3.mjs.map +1 -1
  177. package/.output/server/chunks/routes/api/index.post.mjs +19 -16
  178. package/.output/server/chunks/routes/api/index.post.mjs.map +1 -1
  179. package/.output/server/chunks/routes/api/index.post2.mjs +4 -6
  180. package/.output/server/chunks/routes/api/index.post2.mjs.map +1 -1
  181. package/.output/server/chunks/routes/api/jobs/_id/cancel.post.mjs +6 -3
  182. package/.output/server/chunks/routes/api/jobs/_id/cancel.post.mjs.map +1 -1
  183. package/.output/server/chunks/routes/api/jobs/_id_.get.mjs +7 -4
  184. package/.output/server/chunks/routes/api/jobs/_id_.get.mjs.map +1 -1
  185. package/.output/server/chunks/routes/api/rebase/abort.post.mjs +4 -2
  186. package/.output/server/chunks/routes/api/rebase/abort.post.mjs.map +1 -1
  187. package/.output/server/chunks/routes/api/rebase/ai-resolve.post.mjs +19 -105
  188. package/.output/server/chunks/routes/api/rebase/ai-resolve.post.mjs.map +1 -1
  189. package/.output/server/chunks/routes/api/rebase/conflicts.get.mjs +3 -1
  190. package/.output/server/chunks/routes/api/rebase/conflicts.get.mjs.map +1 -1
  191. package/.output/server/chunks/routes/api/rebase/continue-sync.post.mjs +4 -2
  192. package/.output/server/chunks/routes/api/rebase/continue-sync.post.mjs.map +1 -1
  193. package/.output/server/chunks/routes/api/rebase/continue.post.mjs +71 -73
  194. package/.output/server/chunks/routes/api/rebase/continue.post.mjs.map +1 -1
  195. package/.output/server/chunks/routes/api/rebase/resolve.put.mjs +3 -1
  196. package/.output/server/chunks/routes/api/rebase/resolve.put.mjs.map +1 -1
  197. package/.output/server/chunks/routes/api/repository/status.get.mjs +4 -5
  198. package/.output/server/chunks/routes/api/repository/status.get.mjs.map +1 -1
  199. package/.output/server/chunks/routes/api/settings.get.mjs +6 -5
  200. package/.output/server/chunks/routes/api/settings.get.mjs.map +1 -1
  201. package/.output/server/chunks/routes/api/settings.post.mjs +5 -3
  202. package/.output/server/chunks/routes/api/settings.post.mjs.map +1 -1
  203. package/.output/server/chunks/routes/api/skills/_skillId/prompt.post.mjs +3 -1
  204. package/.output/server/chunks/routes/api/skills/_skillId/prompt.post.mjs.map +1 -1
  205. package/.output/server/chunks/routes/api/specs/_featureId/_...filename_.get.mjs +3 -1
  206. package/.output/server/chunks/routes/api/specs/_featureId/_...filename_.get.mjs.map +1 -1
  207. package/.output/server/chunks/routes/api/specs/_featureId/_...filename_.put.mjs +3 -1
  208. package/.output/server/chunks/routes/api/specs/_featureId/_...filename_.put.mjs.map +1 -1
  209. package/.output/server/chunks/routes/api/specs/features.get.mjs +3 -1
  210. package/.output/server/chunks/routes/api/specs/features.get.mjs.map +1 -1
  211. package/.output/server/chunks/routes/api/specs/reindex.post.mjs +4 -2
  212. package/.output/server/chunks/routes/api/specs/reindex.post.mjs.map +1 -1
  213. package/.output/server/chunks/routes/api/specs/search.get.mjs +4 -2
  214. package/.output/server/chunks/routes/api/specs/search.get.mjs.map +1 -1
  215. package/.output/server/chunks/routes/api/specs/status.get.mjs +4 -2
  216. package/.output/server/chunks/routes/api/specs/status.get.mjs.map +1 -1
  217. package/.output/server/chunks/routes/api/specs/traceability/_featureId_.get.mjs +4 -2
  218. package/.output/server/chunks/routes/api/specs/traceability/_featureId_.get.mjs.map +1 -1
  219. package/.output/server/chunks/routes/api/worktrees/_name/switch.post.mjs +4 -2
  220. package/.output/server/chunks/routes/api/worktrees/_name/switch.post.mjs.map +1 -1
  221. package/.output/server/chunks/routes/api/worktrees/_name_.delete.mjs +3 -1
  222. package/.output/server/chunks/routes/api/worktrees/_name_.delete.mjs.map +1 -1
  223. package/.output/server/chunks/routes/git-watcher-ws.mjs +4 -2
  224. package/.output/server/chunks/routes/git-watcher-ws.mjs.map +1 -1
  225. package/.output/server/chunks/routes/renderer.mjs +4 -2
  226. package/.output/server/chunks/routes/terminal-ws.mjs +230 -0
  227. package/.output/server/chunks/routes/terminal-ws.mjs.map +1 -0
  228. package/.output/server/index.mjs +4 -2
  229. package/.output/server/index.mjs.map +1 -1
  230. package/.output/server/node_modules/node-pty/build/Makefile +369 -0
  231. package/.output/server/node_modules/node-pty/build/Release/pty.node +0 -0
  232. package/.output/server/node_modules/node-pty/build/binding.Makefile +6 -0
  233. package/.output/server/node_modules/node-pty/build/config.gypi +513 -0
  234. package/.output/server/node_modules/node-pty/build/pty.target.mk +168 -0
  235. package/.output/server/node_modules/node-pty/lib/eventEmitter2.js +47 -0
  236. package/.output/server/node_modules/node-pty/lib/index.js +52 -0
  237. package/.output/server/node_modules/node-pty/lib/shared/conout.js +11 -0
  238. package/.output/server/node_modules/node-pty/lib/terminal.js +190 -0
  239. package/.output/server/node_modules/node-pty/lib/unixTerminal.js +346 -0
  240. package/.output/server/node_modules/node-pty/lib/utils.js +39 -0
  241. package/.output/server/node_modules/node-pty/lib/windowsConoutConnection.js +125 -0
  242. package/.output/server/node_modules/node-pty/lib/windowsPtyAgent.js +320 -0
  243. package/.output/server/node_modules/node-pty/lib/windowsTerminal.js +199 -0
  244. package/.output/server/node_modules/node-pty/package.json +64 -0
  245. package/.output/server/package.json +2 -1
  246. package/package.json +6 -1
  247. package/.output/public/_nuxt/2zamijve.js +0 -1
  248. package/.output/public/_nuxt/BEjIzkrM.js +0 -85
  249. package/.output/public/_nuxt/BaSsfm-t.js +0 -36
  250. package/.output/public/_nuxt/BjdLSVUw.js +0 -1
  251. package/.output/public/_nuxt/DeqM2TrP.js +0 -1
  252. package/.output/public/_nuxt/builds/meta/74089fa1-2fbb-4792-94aa-7535d2aec557.json +0 -1
  253. package/.output/public/_nuxt/default.DKSPicGu.css +0 -1
  254. package/.output/public/_nuxt/entry.BUDfUMkE.css +0 -1
  255. package/.output/public/_nuxt/zrVRZSxq.js +0 -64
  256. package/.output/server/chunks/_/baseBranch.mjs +0 -137
  257. package/.output/server/chunks/_/baseBranch.mjs.map +0 -1
  258. package/.output/server/chunks/_/claude.mjs +0 -164
  259. package/.output/server/chunks/_/claude.mjs.map +0 -1
  260. package/.output/server/chunks/_/conversationStore.mjs +0 -257
  261. package/.output/server/chunks/_/conversationStore.mjs.map +0 -1
  262. package/.output/server/chunks/_/geminiProvider.mjs +0 -372
  263. package/.output/server/chunks/_/geminiProvider.mjs.map +0 -1
  264. package/.output/server/chunks/_/gitExec.mjs +0 -48
  265. package/.output/server/chunks/_/gitExec.mjs.map +0 -1
  266. package/.output/server/chunks/_/providerProcessError.mjs +0 -163
  267. package/.output/server/chunks/_/providerProcessError.mjs.map +0 -1
  268. package/.output/server/chunks/_/uiAdapter.mjs +0 -421
  269. package/.output/server/chunks/_/uiAdapter.mjs.map +0 -1
  270. package/.output/server/chunks/routes/api/chat.post.mjs +0 -276
  271. package/.output/server/chunks/routes/api/chat.post.mjs.map +0 -1
@@ -0,0 +1,174 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./D_4Ow2w2.js","./CzV__9yP.js","./entry.uBSFaL6A.css","./DqFq1MXh.js"])))=>i.map(i=>d[i]);
2
+ import{y,z as S,A as m,d as Xe,C as le,G as v,S as je,U as at,V as $i,K as Me,E as We,B as F,I as se,g as N,L as Ke,W as fn,k as he,N as gr,J as Ie,H as xe,o as Qt,X as _i,Y as Q2,M as Ye,Z as xi,T as or,_ as jl,P as xm,$ as Be,a0 as dh,R as hs,D as gt,O as Ri,a1 as b_,a2 as nr,a3 as gn,a4 as wf,a5 as A2,c as R2,a6 as Vg,s as ul,a7 as B2,q as L2,a8 as E2,x as D2,a9 as _c}from"./CzV__9yP.js";import{r as hi,c as os,b as Pu,a as Kn}from"./DWDrIutw.js";import{c as Tu,m as I2,p as z2,d as qg,r as N2,i as Hg,a as W2,j as Z2,k as X2,w as F2,l as V2,e as q2,u as y_,n as Ug,C as H2,o as vo,f as wm,s as U2,q as Y2,b as Sm,g as Yg,h as jg}from"./uyJF9wDo.js";import{_ as zs}from"./DlAUqK2U.js";import{S as Eh,s as Sf,i as j2,b as G2,P as K2,W as Gg,M as Kg,c as Jg,d as ev,g as tv,e as J2,D as dl,f as ek,j as tk,a as Gl,k as Zi,u as Kl,l as bc,m as yc}from"./D_4Ow2w2.js";import{u as iv,_ as ik}from"./BHhMtuRK.js";function rk(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10.5 6h9.75M10.5 6a1.5 1.5 0 1 1-3 0m3 0a1.5 1.5 0 1 0-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-9.75 0h9.75"})])}function sk(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m20.25 7.5-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5m8.25 3v6.75m0 0-3-3m3 3 3-3M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"})])}function nk(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 8.25H7.5a2.25 2.25 0 0 0-2.25 2.25v9a2.25 2.25 0 0 0 2.25 2.25h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25H15M9 12l3 3m0 0 3-3m-3 3V2.25"})])}function ok(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3"})])}function ak(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"})])}function x_(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 0 0-3.7-3.7 48.678 48.678 0 0 0-7.324 0 4.006 4.006 0 0 0-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 0 0 3.7 3.7 48.656 48.656 0 0 0 7.324 0 4.006 4.006 0 0 0 3.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3-3 3"})])}function w_(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5"})])}function S_(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 15 3 9m0 0 6-6M3 9h12a6 6 0 0 1 0 12h-3"})])}function k_(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 9V4.5M9 9H4.5M9 9 3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5 5.25 5.25"})])}function C_(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"})])}function $_(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5"})])}function lk(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.75 3.104v5.714a2.25 2.25 0 0 1-.659 1.591L5 14.5M9.75 3.104c-.251.023-.501.05-.75.082m.75-.082a24.301 24.301 0 0 1 4.5 0m0 0v5.714c0 .597.237 1.17.659 1.591L19.8 15.3M14.25 3.104c.251.023.501.05.75.082M19.8 15.3l-1.57.393A9.065 9.065 0 0 1 12 15a9.065 9.065 0 0 0-6.23-.693L5 14.5m14.8.8 1.402 1.402c1.232 1.232.65 3.318-1.067 3.611A48.309 48.309 0 0 1 12 21c-2.773 0-5.491-.235-8.135-.687-1.718-.293-2.3-2.379-1.067-3.61L5 14.5"})])}function ck(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m3.75 13.5 10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75Z"})])}function hk(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M7.5 14.25v2.25m3-4.5v4.5m3-6.75v6.75m3-9v9M6 20.25h12A2.25 2.25 0 0 0 20.25 18V6A2.25 2.25 0 0 0 18 3.75H6A2.25 2.25 0 0 0 3.75 6v12A2.25 2.25 0 0 0 6 20.25Z"})])}function P_(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M20.25 8.511c.884.284 1.5 1.128 1.5 2.097v4.286c0 1.136-.847 2.1-1.98 2.193-.34.027-.68.052-1.02.072v3.091l-3-3c-1.354 0-2.694-.055-4.02-.163a2.115 2.115 0 0 1-.825-.242m9.345-8.334a2.126 2.126 0 0 0-.476-.095 48.64 48.64 0 0 0-8.048 0c-1.131.094-1.976 1.057-1.976 2.192v4.286c0 .837.46 1.58 1.155 1.951m9.345-8.334V6.637c0-1.621-1.152-3.026-2.76-3.235A48.455 48.455 0 0 0 11.25 3c-2.115 0-4.198.137-6.24.402-1.608.209-2.76 1.614-2.76 3.235v6.226c0 1.621 1.152 3.026 2.76 3.235.577.075 1.157.14 1.74.194V21l4.155-4.155"})])}function uk(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M2.25 12.76c0 1.6 1.123 2.994 2.707 3.227 1.087.16 2.185.283 3.293.369V21l4.076-4.076a1.526 1.526 0 0 1 1.037-.443 48.282 48.282 0 0 0 5.68-.494c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0 0 12 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018Z"})])}function km(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m4.5 12.75 6 6 9-13.5"})])}function dk(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})])}function Dh(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 15 12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9"})])}function fk(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5"})])}function T_(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 0 0 2.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 0 0-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25ZM6.75 12h.008v.008H6.75V12Zm0 3h.008v.008H6.75V15Zm0 3h.008v.008H6.75V18Z"})])}function Xo(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 7.5V6.108c0-1.135.845-2.098 1.976-2.192.373-.03.748-.057 1.123-.08M15.75 18H18a2.25 2.25 0 0 0 2.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 0 0-1.123-.08M15.75 18.75v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5A3.375 3.375 0 0 0 6.375 7.5H5.25m11.9-3.664A2.251 2.251 0 0 0 15 2.25h-1.5a2.251 2.251 0 0 0-2.15 1.586m5.8 0c.065.21.1.433.1.664v.75h-6V4.5c0-.231.035-.454.1-.664M6.75 7.5H4.875c-.621 0-1.125.504-1.125 1.125v12c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V16.5a9 9 0 0 0-9-9Z"})])}function M_(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9.75v6.75m0 0-3-3m3 3 3-3m-8.25 6a4.5 4.5 0 0 1-1.41-8.775 5.25 5.25 0 0 1 10.233-2.33 3 3 0 0 1 3.758 3.848A3.752 3.752 0 0 1 18 19.5H6.75Z"})])}function pk(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M14.25 9.75 16.5 12l-2.25 2.25m-4.5 0L7.5 12l2.25-2.25M6 20.25h12A2.25 2.25 0 0 0 20.25 18V6A2.25 2.25 0 0 0 18 3.75H6A2.25 2.25 0 0 0 3.75 6v12A2.25 2.25 0 0 0 6 20.25Z"})])}function kf(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z"}),m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})])}function Q_(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z"})])}function mk(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10.125 2.25h-4.5c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125v-9M10.125 2.25h.375a9 9 0 0 1 9 9v.375M10.125 2.25A3.375 3.375 0 0 1 13.5 5.625v1.5c0 .621.504 1.125 1.125 1.125h1.5a3.375 3.375 0 0 1 3.375 3.375M9 15l2.25 2.25L15 12"})])}function gk(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 0 1-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 0 1 1.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 0 0-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 0 1-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H9.75"})])}function vk(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m5.231 13.481L15 17.25m-4.5-15H5.625c-.621 0-1.125.504-1.125 1.125v16.5c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Zm3.75 11.625a2.625 2.625 0 1 1-5.25 0 2.625 2.625 0 0 1 5.25 0Z"})])}function Jn(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"})])}function vn(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"})])}function Ok(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.451 10.451 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88"})])}function _k(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})])}function bk(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026m-16.5 0a2.25 2.25 0 0 0-1.883 2.542l.857 6a2.25 2.25 0 0 0 2.227 1.932H19.05a2.25 2.25 0 0 0 2.227-1.932l.857-6a2.25 2.25 0 0 0-1.883-2.542m-16.5 0V6A2.25 2.25 0 0 1 6 3.75h3.879a1.5 1.5 0 0 1 1.06.44l2.122 2.12a1.5 1.5 0 0 0 1.06.44H18A2.25 2.25 0 0 1 20.25 9v.776"})])}function yk(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 0 1-.659 1.591l-5.432 5.432a2.25 2.25 0 0 0-.659 1.591v2.927a2.25 2.25 0 0 1-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 0 0-.659-1.591L3.659 7.409A2.25 2.25 0 0 1 3 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0 1 12 3Z"})])}function xk(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5.25 8.25h15m-16.5 7.5h15m-1.8-13.5-3.9 19.5m-2.1-19.5-3.9 19.5"})])}function wk(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"})])}function Sk(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 18v-5.25m0 0a6.01 6.01 0 0 0 1.5-.189m-1.5.189a6.01 6.01 0 0 1-1.5-.189m3.75 7.478a12.06 12.06 0 0 1-4.5 0m3.75 2.383a14.406 14.406 0 0 1-3 0M14.25 18v-.192c0-.983.658-1.823 1.508-2.316a7.5 7.5 0 1 0-7.517 0c.85.493 1.509 1.333 1.509 2.316V18"})])}function A_(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 6.75h12M8.25 12h12m-12 5.25h12M3.75 6.75h.007v.008H3.75V6.75Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0ZM3.75 12h.007v.008H3.75V12Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm-.375 5.25h.007v.008H3.75v-.008Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"})])}function Hn(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"})])}function kk(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 12h14"})])}function R_(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10"})])}function Ck(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.347a1.125 1.125 0 0 1 0 1.972l-11.54 6.347a1.125 1.125 0 0 1-1.667-.986V5.653Z"})])}function rv(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959v0a.64.64 0 0 1-.657.643 48.39 48.39 0 0 1-4.163-.3c.186 1.613.293 3.25.315 4.907a.656.656 0 0 1-.658.663v0c-.355 0-.676-.186-.959-.401a1.647 1.647 0 0 0-1.003-.349c-1.036 0-1.875 1.007-1.875 2.25s.84 2.25 1.875 2.25c.369 0 .713-.128 1.003-.349.283-.215.604-.401.959-.401v0c.31 0 .555.26.532.57a48.039 48.039 0 0 1-.642 5.056c1.518.19 3.058.309 4.616.354a.64.64 0 0 0 .657-.643v0c0-.355-.186-.676-.401-.959a1.647 1.647 0 0 1-.349-1.003c0-1.035 1.008-1.875 2.25-1.875 1.243 0 2.25.84 2.25 1.875 0 .369-.128.713-.349 1.003-.215.283-.4.604-.4.959v0c0 .333.277.599.61.58a48.1 48.1 0 0 0 5.427-.63 48.05 48.05 0 0 0 .582-4.717.532.532 0 0 0-.533-.57v0c-.355 0-.676.186-.959.401-.29.221-.634.349-1.003.349-1.035 0-1.875-1.007-1.875-2.25s.84-2.25 1.875-2.25c.37 0 .713.128 1.003.349.283.215.604.401.96.401v0a.656.656 0 0 0 .658-.663 48.422 48.422 0 0 0-.37-5.36c-1.886.342-3.81.574-5.766.689a.578.578 0 0 1-.61-.58v0Z"})])}function B_(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 5.25h.008v.008H12v-.008Z"})])}function $k(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.75 12h16.5m-16.5 3.75h16.5M3.75 19.5h16.5M5.625 4.5h12.75a1.875 1.875 0 0 1 0 3.75H5.625a1.875 1.875 0 0 1 0-3.75Z"})])}function L_(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z"})])}function E_(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3.75m0-10.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.75c0 5.592 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.57-.598-3.75h-.152c-3.196 0-6.1-1.25-8.25-3.286Zm0 13.036h.008v.008H12v-.008Z"})])}function xl(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09ZM18.259 8.715 18 9.75l-.259-1.035a3.375 3.375 0 0 0-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 0 0 2.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 0 0 2.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 0 0-2.456 2.456ZM16.894 20.567 16.5 21.75l-.394-1.183a2.25 2.25 0 0 0-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 0 0 1.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 0 0 1.423 1.423l1.183.394-1.183.394a2.25 2.25 0 0 0-1.423 1.423Z"})])}function D_(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}),m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 9.563C9 9.252 9.252 9 9.563 9h4.874c.311 0 .563.252.563.563v4.874c0 .311-.252.563-.563.563H9.564A.562.562 0 0 1 9 14.437V9.564Z"})])}function Cm(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.568 3H5.25A2.25 2.25 0 0 0 3 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 0 0 5.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 0 0 9.568 3Z"}),m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 6h.008v.008H6V6Z"})])}function Pk(i,e){return y(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M11.42 15.17 17.25 21A2.652 2.652 0 0 0 21 17.25l-5.877-5.877M11.42 15.17l2.496-3.03c.317-.384.74-.626 1.208-.766M11.42 15.17l-4.655 5.653a2.548 2.548 0 1 1-3.586-3.586l6.837-5.63m5.108-.233c.55-.164 1.163-.188 1.743-.14a4.5 4.5 0 0 0 4.486-6.336l-3.276 3.277a3.004 3.004 0 0 1-2.25-2.25l3.276-3.276a4.5 4.5 0 0 0-6.336 4.486c.091 1.076-.071 2.264-.904 2.95l-.102.085m-1.745 1.437L5.909 7.5H4.5L2.25 3.75l1.5-1.5L7.5 4.5v1.409l4.26 4.26m-1.745 1.437 1.745-1.437m6.615 8.206L15.75 15.75M4.867 19.125h.008v.008h-.008v-.008Z"})])}async function sv(i){return $fetch("/api/chat/worktree",{method:"POST",body:i})}async function Tk(i){await $fetch("/api/chat/worktree",{method:"DELETE",body:i})}async function Mk(i){const e=await $fetch("/api/chat/preview-sync",{method:"POST",body:i});if(!e.success)throw new Error(e.error||"Unknown preview sync failure")}const Qk={class:"flex items-center gap-1.5 px-2 py-1.5 bg-retro-panel border-b border-retro-border"},Ak={class:"relative flex-1 min-w-0"},Rk={key:0,class:"text-[11px] text-retro-muted flex-shrink-0 min-w-[60px] text-center"},Bk=["disabled"],Lk=["disabled"],Ek=Xe({__name:"GitFindWidget",props:{resultCount:{},currentIndex:{}},emits:["search","next","prev","close"],setup(i,{expose:e,emit:t}){const r=t,s=N(""),n=N(null);let o=null;function a(){o&&clearTimeout(o),o=setTimeout(()=>{r("search",s.value)},200)}function l(h){h.key==="Escape"?(h.preventDefault(),r("close")):h.key==="Enter"&&(h.preventDefault(),h.shiftKey?r("prev"):r("next"))}function c(){n.value?.focus(),n.value?.select()}return e({focus:c}),(h,u)=>(y(),S("div",Qk,[le(v(Hn),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),m("div",Ak,[je(m("input",{ref_key:"inputRef",ref:n,"onUpdate:modelValue":u[0]||(u[0]=d=>at(s)?s.value=d:null),type:"text",placeholder:"Find in commits...","aria-label":"Search commits",class:"w-full px-2 py-1 text-sm bg-retro-dark border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan",onInput:a,onKeydown:l},null,544),[[$i,v(s)]])]),v(s)?(y(),S("span",Rk,[i.resultCount>0?(y(),S(Me,{key:0},[We(F(i.currentIndex+1)+" of "+F(i.resultCount),1)],64)):(y(),S(Me,{key:1},[We(" No results ")],64))])):se("",!0),m("button",{class:"p-0.5 text-retro-muted hover:text-retro-text disabled:opacity-30 disabled:cursor-not-allowed transition-colors",disabled:i.resultCount===0,"aria-label":"Previous result",title:"Previous (Shift+Enter)",onClick:u[1]||(u[1]=d=>r("prev"))},[le(v(fk),{class:"w-4 h-4"})],8,Bk),m("button",{class:"p-0.5 text-retro-muted hover:text-retro-text disabled:opacity-30 disabled:cursor-not-allowed transition-colors",disabled:i.resultCount===0,"aria-label":"Next result",title:"Next (Enter)",onClick:u[2]||(u[2]=d=>r("next"))},[le(v(dk),{class:"w-4 h-4"})],8,Lk),m("button",{class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors","aria-label":"Close find widget",title:"Close (Escape)",onClick:u[3]||(u[3]=d=>r("close"))},[le(v(hi),{class:"w-4 h-4"})])]))}}),Dk={class:"flex flex-col bg-retro-dark border border-retro-border rounded shadow-lg max-w-md w-full"},Ik={class:"flex items-center justify-between px-3 py-2 border-b border-retro-border"},zk={class:"flex-1 overflow-auto max-h-[300px]"},Nk={class:"font-semibold text-retro-cyan flex-shrink-0 min-w-[60px]"},Wk=["onKeyup"],Zk=["onClick"],Xk={class:"text-retro-muted truncate flex-1 font-mono"},Fk=["onClick"],Vk=["onClick"],qk={key:0,class:"px-3 py-4 text-center text-retro-muted text-xs"},Hk={key:0,class:"px-3 py-2 border-t border-retro-border space-y-2"},Uk={class:"flex gap-2 justify-end"},Yk=["disabled"],jk={key:1,class:"px-3 py-2 border-t border-retro-border"},Gk=Xe({__name:"GitRemoteManager",props:{remotes:{},loading:{type:Boolean}},emits:["add","edit","delete","close"],setup(i,{emit:e}){const t=e,r=N(!1),s=N(""),n=N(""),o=N(null),a=N("");function l(){r.value=!0,s.value="",n.value=""}function c(){!s.value.trim()||!n.value.trim()||(t("add",{name:s.value.trim(),url:n.value.trim()}),r.value=!1)}function h(f){o.value=f.name,a.value=f.fetchUrl}function u(f){a.value.trim()&&(t("edit",{name:f,newUrl:a.value.trim()}),o.value=null)}function d(){o.value=null}return(f,p)=>(y(),S("div",Dk,[m("div",Ik,[p[5]||(p[5]=m("h3",{class:"text-sm font-semibold text-retro-text"},"Remote Repositories",-1)),m("button",{class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",onClick:p[0]||(p[0]=g=>t("close"))},[le(v(hi),{class:"w-4 h-4"})])]),m("div",zk,[(y(!0),S(Me,null,Ke(i.remotes,g=>(y(),S("div",{key:g.name,class:"flex items-center gap-2 px-3 py-2 border-b border-retro-border/50 text-xs"},[m("span",Nk,F(g.name),1),v(o)===g.name?(y(),S(Me,{key:0},[je(m("input",{"onUpdate:modelValue":p[1]||(p[1]=O=>at(a)?a.value=O:null),type:"text",class:"flex-1 px-2 py-1 text-xs bg-retro-panel border border-retro-border rounded text-retro-text focus:outline-none focus:border-retro-cyan",onKeyup:[fn(O=>u(g.name),["enter"]),fn(d,["escape"])]},null,40,Wk),[[$i,v(a)]]),m("button",{class:"p-0.5 text-retro-green hover:text-retro-green/80",onClick:O=>u(g.name)},[le(v(km),{class:"w-3.5 h-3.5"})],8,Zk),m("button",{class:"p-0.5 text-retro-muted hover:text-retro-text",onClick:d},[le(v(hi),{class:"w-3.5 h-3.5"})])],64)):(y(),S(Me,{key:1},[m("span",Xk,F(g.fetchUrl),1),m("button",{class:"p-0.5 text-retro-muted hover:text-retro-text",title:"Edit",onClick:O=>h(g)},[le(v(R_),{class:"w-3.5 h-3.5"})],8,Fk),m("button",{class:"p-0.5 text-retro-muted hover:text-retro-red",title:"Delete",onClick:O=>t("delete",g.name)},[le(v(os),{class:"w-3.5 h-3.5"})],8,Vk)],64))]))),128)),i.remotes.length===0?(y(),S("div",qk," No remotes configured ")):se("",!0)]),v(r)?(y(),S("div",Hk,[je(m("input",{"onUpdate:modelValue":p[2]||(p[2]=g=>at(s)?s.value=g:null),type:"text",placeholder:"Remote name (e.g., origin)",class:"w-full px-2 py-1 text-xs bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan"},null,512),[[$i,v(s)]]),je(m("input",{"onUpdate:modelValue":p[3]||(p[3]=g=>at(n)?n.value=g:null),type:"text",placeholder:"Remote URL",class:"w-full px-2 py-1 text-xs bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan",onKeyup:fn(c,["enter"])},null,544),[[$i,v(n)]]),m("div",Uk,[m("button",{class:"px-2 py-1 text-xs text-retro-muted hover:text-retro-text transition-colors",onClick:p[4]||(p[4]=g=>r.value=!1)}," Cancel "),m("button",{class:"px-2 py-1 text-xs bg-retro-cyan/20 text-retro-cyan border border-retro-cyan/40 rounded hover:bg-retro-cyan/30 transition-colors",disabled:!v(s).trim()||!v(n).trim(),onClick:c}," Add Remote ",8,Yk)])])):se("",!0),v(r)?se("",!0):(y(),S("div",jk,[m("button",{class:"flex items-center gap-1 text-xs text-retro-cyan hover:text-retro-cyan/80 transition-colors",onClick:l},[le(v(Pu),{class:"w-3.5 h-3.5"}),p[6]||(p[6]=We(" Add Remote ",-1))])]))]))}}),Mu={NODE_RADIUS:4,ROW_HEIGHT:32,COLUMN_WIDTH:20,PADDING:10,VISIBLE_BUFFER:10},xc=["#3B82F6","#EF4444","#10B981","#F59E0B","#8B5CF6","#EC4899","#14B8A6","#F97316","#06B6D4","#84CC16","#F43F5E","#A855F7"],Fo={A:{label:"Added",colorClass:"text-retro-green"},M:{label:"Modified",colorClass:"text-retro-yellow"},D:{label:"Deleted",colorClass:"text-retro-red"},R:{label:"Renamed",colorClass:"text-retro-blue"},C:{label:"Copied",colorClass:"text-retro-purple"},U:{label:"Unmerged",colorClass:"text-retro-cyan"}},Kk=["width","height"],Jk=["d","stroke","stroke-dasharray"],e5={key:0},t5=["cx","r"],i5=["cx","r","fill"],r5=["cx","r","stroke"],s5=["cx","r","fill"],n5=["cx","r","stroke"],o5=["cx","r","fill"],a5=["cx","r"],l5=["cx","r","fill"],I_=Xe({__name:"GitGraphSvg",props:{rowData:{},maxLane:{default:4},highlightBranches:{},tooltipText:{}},setup(i){const e=i,{COLUMN_WIDTH:t,ROW_HEIGHT:r,NODE_RADIUS:s,PADDING:n}=Mu,o=he(()=>n*2+(e.maxLane+1)*t),a=r,l=r/2;function c(d){return n+d*t}function h(d){const f=c(d.fromLane),p=c(d.toLane);if(d.type==="vertical")return`M ${f} 0 L ${p} ${a}`;if(d.type==="vertical-top")return`M ${f} 0 L ${f} ${l}`;if(d.type==="vertical-bottom")return`M ${f} ${l} L ${f} ${a}`;if(d.style==="rounded")return`M ${f} ${l} C ${f} ${a}, ${p} ${a}, ${p} ${a}`;{const g=a*.75;return`M ${f} ${l} L ${f} ${g} L ${p} ${a}`}}const u=he(()=>e.rowData?c(e.rowData.lane):n);return(d,f)=>(y(),S("svg",{width:v(o),height:v(a),class:"block flex-shrink-0","aria-hidden":"true"},[i.rowData?(y(),S(Me,{key:0},[(y(!0),S(Me,null,Ke(i.rowData.connections,(p,g)=>(y(),S("path",{key:g,d:h(p),stroke:p.color,"stroke-width":"2",fill:"none","stroke-dasharray":p.type.startsWith("merge")?"4 3":"none"},null,8,Jk))),128)),m("g",null,[i.tooltipText?(y(),S("title",e5,F(i.tooltipText),1)):se("",!0),i.rowData.nodeType==="head"?(y(),S(Me,{key:1},[m("circle",{cx:v(u),cy:l,r:v(s)+2,fill:"none",stroke:"currentColor","stroke-width":"2",class:"text-retro-cyan"},null,8,t5),m("circle",{cx:v(u),cy:l,r:v(s),fill:i.rowData.color},null,8,i5)],64)):i.rowData.nodeType==="merge"?(y(),S(Me,{key:2},[m("circle",{cx:v(u),cy:l,r:v(s)+1,fill:"none",stroke:i.rowData.color,"stroke-width":"1.5"},null,8,r5),m("circle",{cx:v(u),cy:l,r:v(s)-1,fill:i.rowData.color},null,8,s5)],64)):i.rowData.nodeType==="stash"?(y(),S(Me,{key:3},[m("circle",{cx:v(u),cy:l,r:v(s),fill:"none",stroke:i.rowData.color,"stroke-width":"2"},null,8,n5),m("circle",{cx:v(u),cy:l,r:v(s)-2,fill:i.rowData.color},null,8,o5)],64)):i.rowData.nodeType==="uncommitted"?(y(),S("circle",{key:4,cx:v(u),cy:l,r:v(s),fill:"none",stroke:"currentColor","stroke-width":"2",class:"text-retro-yellow","stroke-dasharray":"3 2"},null,8,a5)):(y(),S("circle",{key:5,cx:v(u),cy:l,r:v(s),fill:i.rowData.color},null,8,l5))])],64)):se("",!0)],8,Kk))}}),c5=["aria-selected","aria-label"],h5={key:1,class:"flex gap-1 flex-shrink-0"},u5=["title","onContextmenu"],d5={key:2,class:"flex gap-1 flex-shrink-0"},f5=["onContextmenu"],p5={class:"text-retro-text text-xs truncate flex-1"},m5={key:5,class:"flex-shrink-0 text-retro-muted text-[10px] hidden sm:inline"},g5={key:6,class:"flex-shrink-0 text-retro-muted text-[10px]"},nv=72,v5=Xe({__name:"GitCommitRow",props:{commit:{},index:{},isSelected:{type:Boolean},isHighlighted:{type:Boolean},isBranchHighlighted:{type:Boolean},isFeatureHighlighted:{type:Boolean},isPreviewHighlighted:{type:Boolean},isMuted:{type:Boolean},currentBranchName:{},localBranchNames:{},graphRowData:{},maxLane:{},columnVisibility:{}},emits:["click","keydown","branchContextMenu","commitContextMenu","tagContextMenu"],setup(i,{emit:e}){const t=i,r=e,s=he(()=>{const d=t.commit.branches;if(d.length===0)return[];const f=t.localBranchNames,p=[],g=[];for(const w of d)f.has(w)?p.push(w):g.push(w);const O=new Set(p),_=new Map,k=[];for(const w of g){const C=w.indexOf("/");if(C>0){const M=w.substring(C+1),D=w.substring(0,C);O.has(M)?(_.has(M)||_.set(M,[]),_.get(M).push(D)):k.push(w)}else k.push(w)}const P=[];for(const w of p){const C=_.get(w)||[];C.length>0?P.push({displayName:`${w}/${C.join(",")}`,originalBranches:[w,...C.map(M=>`${M}/${w}`)],isLocal:!0}):P.push({displayName:w,originalBranches:[w],isLocal:!0})}for(const w of k)P.push({displayName:w,originalBranches:[w],isLocal:!1});return P});function n(d,f){d.preventDefault(),d.stopPropagation();const p=f.originalBranches[0];r("branchContextMenu",{branch:p,x:d.clientX,y:d.clientY,isCurrentBranch:f.isLocal&&f.originalBranches.includes(t.currentBranchName??""),isLocal:f.isLocal})}function o(d,f){d.preventDefault(),d.stopPropagation(),r("tagContextMenu",{tag:f,x:d.clientX,y:d.clientY})}function a(d){d.preventDefault(),d.stopPropagation(),r("commitContextMenu",{x:d.clientX,y:d.clientY})}const{ROW_HEIGHT:l}=Mu,c=he(()=>{const d=[t.commit.shortHash];return t.commit.branches.length>0&&d.push(t.commit.branches.join(", ")),t.commit.tags.length>0&&d.push(t.commit.tags.map(f=>`tag: ${f}`).join(", ")),d.join(" — ")});function h(d){const p=Date.now()/1e3-d;return p<60?"just now":p<3600?`${Math.floor(p/60)}m ago`:p<86400?`${Math.floor(p/3600)}h ago`:p<604800?`${Math.floor(p/86400)}d ago`:p<2592e3?`${Math.floor(p/604800)}w ago`:new Date(d*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function u(d){const f=d.split(`
3
+ `)[0];return f.length>nv?f.substring(0,nv-3)+"...":f}return(d,f)=>{const p=I_;return y(),S("div",{class:Ie(["flex items-center cursor-pointer group focus:outline-none focus:ring-1 focus:ring-retro-cyan/50 focus:ring-inset",{"opacity-40":i.isMuted,"bg-retro-magenta/10":i.isPreviewHighlighted,"bg-retro-yellow/20":i.isFeatureHighlighted&&!i.isPreviewHighlighted}]),style:gr({height:`${v(l)}px`}),role:"row",tabindex:"0","aria-selected":i.isSelected,"aria-label":`Commit ${i.commit.shortHash} by ${i.commit.author}: ${i.commit.message.split(`
4
+ `)[0]}`,onClick:f[0]||(f[0]=g=>r("click",g)),onKeydown:f[1]||(f[1]=g=>r("keydown",g)),onContextmenu:a},[le(p,{rowData:i.graphRowData,maxLane:i.maxLane,tooltipText:v(c)},null,8,["rowData","maxLane","tooltipText"]),m("div",{class:Ie(["flex-1 flex items-center gap-2 px-2 min-w-0 rounded-r transition-colors",{"bg-retro-magenta/10 border-l-2 border-retro-magenta/40":i.isPreviewHighlighted,"bg-retro-yellow/30 border-l-2 border-retro-yellow":i.isFeatureHighlighted&&!i.isPreviewHighlighted,"bg-retro-cyan/15":i.isSelected&&!i.isFeatureHighlighted&&!i.isPreviewHighlighted,"bg-retro-yellow/10":i.isHighlighted&&!i.isSelected&&!i.isFeatureHighlighted&&!i.isPreviewHighlighted,"bg-retro-cyan/5":i.isBranchHighlighted&&!i.isSelected&&!i.isHighlighted&&!i.isFeatureHighlighted&&!i.isPreviewHighlighted,"group-hover:bg-retro-panel/50":!i.isSelected&&!i.isHighlighted&&!i.isFeatureHighlighted&&!i.isPreviewHighlighted&&!i.isBranchHighlighted}]),style:gr({height:`${v(l)-4}px`})},[!i.columnVisibility||i.columnVisibility.commit!==!1?(y(),S("span",{key:0,class:Ie(["flex-shrink-0 font-mono text-[11px]",i.commit.isHead?"text-retro-cyan font-semibold":"text-retro-muted"])},F(i.commit.shortHash),3)):se("",!0),v(s).length>0?(y(),S("div",h5,[(y(!0),S(Me,null,Ke(v(s),g=>(y(),S("span",{key:g.displayName,class:Ie(["px-1.5 py-0.5 text-[10px] rounded font-semibold leading-none cursor-context-menu hover:ring-1 hover:ring-retro-cyan/50",i.commit.isHead&&g.isLocal?"bg-retro-cyan/20 text-retro-cyan border border-retro-cyan/40":i.isPreviewHighlighted?"bg-retro-magenta/10 text-retro-magenta border border-retro-magenta/40":i.isFeatureHighlighted?"bg-retro-yellow/15 text-retro-yellow border border-retro-yellow/30":i.isBranchHighlighted?"bg-retro-cyan/15 text-retro-cyan/80 border border-retro-cyan/30":g.isLocal?"bg-retro-green/15 text-retro-green border border-retro-green/30":"bg-retro-orange/15 text-retro-orange border border-retro-orange/30"]),title:g.originalBranches.join(", "),onContextmenu:O=>n(O,g)},F(g.displayName),43,u5))),128))])):se("",!0),i.commit.tags.length>0?(y(),S("div",d5,[(y(!0),S(Me,null,Ke(i.commit.tags,g=>(y(),S("span",{key:g,class:"px-1 py-0.5 text-[10px] rounded-sm bg-retro-yellow/15 text-retro-yellow border border-retro-yellow/25 flex items-center gap-0.5 leading-none cursor-context-menu hover:ring-1 hover:ring-retro-yellow/50",onContextmenu:O=>o(O,g)},[le(v(Cm),{class:"w-2.5 h-2.5"}),We(" "+F(g),1)],40,f5))),128))])):se("",!0),m("span",p5,F(u(i.commit.message)),1),i.commit.signatureStatus==="good"?(y(),xe(v(L_),{key:3,class:"w-3.5 h-3.5 flex-shrink-0 text-retro-green",title:"Verified signature"})):i.commit.signatureStatus==="bad"?(y(),xe(v(E_),{key:4,class:"w-3.5 h-3.5 flex-shrink-0 text-retro-red",title:"Bad signature"})):se("",!0),!i.columnVisibility||i.columnVisibility.author!==!1?(y(),S("span",m5,F(i.commit.author),1)):se("",!0),!i.columnVisibility||i.columnVisibility.date!==!1?(y(),S("span",g5,F(h(i.commit.timestamp)),1)):se("",!0)],6)],46,c5)}}});function O5(){const{COLUMN_WIDTH:i,ROW_HEIGHT:e,NODE_RADIUS:t,PADDING:r}=Mu;function s(l){let c=0;for(let h=0;h<l.length;h++){const u=l.charCodeAt(h);c=(c<<5)-c+u,c=c&c}return Math.abs(c)}function n(l){const c=s(l)%xc.length;return xc[c]}function o(l,c="rounded"){const h=new Map;if(l.length===0)return h;const u=new Set,d=new Map;for(const P of l)d.set(P.hash,P);const f=l[0];if(f){let P=f;for(;P;){u.add(P.hash);const w=P.parents?.[0];P=w?d.get(w):void 0}}const p=new Map,g=new Map,O=new Map,_=new Map,k=new Map;for(let P=0;P<l.length;P++){const w=l[P];k.set(w.hash,P);const C=u.has(w.hash);let M,D;if(_.has(w.hash)){const x=_.get(w.hash);M=x.lane,D=x.color,_.delete(w.hash)}else if(C)M=0,D=xc[0];else{for(M=1;O.has(M);)M++;D=n(w.hash.substring(0,7))}p.set(w.hash,M),g.set(w.hash,D),O.set(M,w.hash);const j=w.isMerge||w.parents&&w.parents.length>1;let oe="regular";w.isHead?oe="head":j&&(oe="merge"),h.set(w.hash,{commitHash:w.hash,lane:M,color:D,nodeType:oe,isMainline:u.has(w.hash),connections:[]});const ae=w.parents||[];for(let x=0;x<ae.length;x++){const b=ae[x];if(p.has(b)||_.has(b))continue;const T=u.has(b);let $,R;if(x===0)$=M,R=D;else if(T)$=0,R=xc[0];else{for($=1;O.has($)||$===M;)$++;R=n(b.substring(0,7))}_.set(b,{lane:$,color:R,childHash:w.hash})}const G=ae[0];if(!G)O.delete(M);else{const x=p.get(G),b=_.get(G),T=x??b?.lane;T!==void 0&&T!==M&&O.delete(M)}}for(let P=0;P<l.length;P++){const w=l[P],C=h.get(w.hash);if(!C)continue;const M=w.parents||[];for(let D=0;D<M.length;D++){const j=M[D],oe=p.get(j),ae=k.get(j);if(oe===void 0)continue;const G=C.lane,x=oe,b=D===0?C.color:g.get(j)||n(j.substring(0,7));if(G===x?C.connections.push({type:"vertical-bottom",fromLane:G,toLane:x,color:b,style:c}):D>0?C.connections.push({type:G<x?"merge-out":"merge-in",fromLane:G,toLane:x,color:b,style:c}):C.connections.push({type:G<x?"branch-out":"branch-in",fromLane:G,toLane:x,color:b,style:c}),ae!==void 0&&ae>P+1)for(let T=P+1;T<ae;T++){const $=l[T],R=h.get($.hash);R&&R.connections.push({type:"vertical",fromLane:x,toLane:x,color:b,style:c})}if(ae!==void 0){const T=h.get(j);T&&T.connections.push({type:"vertical-top",fromLane:x,toLane:x,color:b,style:c})}}}return h}function a(l){let c=0;for(const h of l.values()){h.lane>c&&(c=h.lane);for(const u of h.connections)u.fromLane>c&&(c=u.fromLane),u.toLane>c&&(c=u.toLane)}return c}return{computeGraphRows:o,computeMaxLane:a,getBranchColor:n,COLUMN_WIDTH:i,ROW_HEIGHT:e,NODE_RADIUS:t,PADDING:r}}const _5=["aria-selected"],b5={class:"text-retro-yellow text-xs font-medium"},y5={key:1,class:"flex items-center justify-center gap-2 p-2 text-retro-muted text-sm"},x5={key:2,class:"p-2 text-center text-retro-muted/50 text-xs"},w5=Xe({__name:"GitCommitList",props:{commits:{},stashes:{},selectedCommit:{},hasMore:{type:Boolean},loading:{type:Boolean},loadingMore:{type:Boolean},searchQuery:{},uncommittedChangesCount:{},isUncommittedChangesSelected:{type:Boolean},highlightBranches:{},featureHighlightBranches:{},featureMergeBases:{},previewHighlightBranches:{},previewMergeBases:{},currentBranchName:{},localBranchNames:{},graphStyle:{default:"rounded"},muteNonAncestral:{type:Boolean},columnVisibility:{}},emits:["select","compareSelect","loadMore","branchContextMenu","commitContextMenu","tagContextMenu","stashContextMenu","selectUncommittedChanges","scrollStart","scrollEnd"],setup(i,{expose:e,emit:t}){const r=i,s=t;function n(){s("selectUncommittedChanges")}function o(ie){(ie.key==="Enter"||ie.key===" ")&&(ie.preventDefault(),s("selectUncommittedChanges"))}const a=he(()=>r.searchQuery?.toLowerCase()??""),l=he(()=>new Set(r.highlightBranches??[])),c=he(()=>l.value.size>0),h=he(()=>{const ie=a.value;if(!ie)return new Set;const q=new Set;for(const ee of r.commits)(ee.message.toLowerCase().includes(ie)||ee.author.toLowerCase().includes(ie)||ee.shortHash.toLowerCase().includes(ie)||ee.hash.toLowerCase().includes(ie)||ee.branches.some(te=>te.toLowerCase().includes(ie))||ee.tags.some(te=>te.toLowerCase().includes(ie)))&&q.add(ee.hash);return q}),u=he(()=>{if(!c.value)return new Set;const ie=new Set;for(const q of r.commits)q.branches.some(ee=>l.value.has(ee))&&ie.add(q.hash);return ie}),d=he(()=>{if(!r.featureHighlightBranches||r.featureHighlightBranches.length===0)return new Set;const ie=r.featureMergeBases??{},q=new Map;for(const te of r.commits)q.set(te.hash,te);const ee=new Set;for(const te of r.featureHighlightBranches){const Oe=r.commits.find(Ze=>Ze.branches.includes(te));if(!Oe)continue;const Te=ie[te]??null;if(!Te)continue;let ke=Oe;for(;ke&&ke.hash!==Te;)ee.add(ke.hash),ke=ke.parents?.[0]?q.get(ke.parents[0]):void 0}return ee}),f=he(()=>{if(!r.previewHighlightBranches||r.previewHighlightBranches.length===0)return new Set;const ie=r.previewMergeBases??{},q=new Map;for(const te of r.commits)q.set(te.hash,te);const ee=new Set;for(const te of r.previewHighlightBranches){const Oe=r.commits.find(Ze=>Ze.branches.includes(te));if(!Oe)continue;const Te=ie[te]??null;if(!Te)continue;let ke=Oe;for(;ke&&ke.hash!==Te;)ee.add(ke.hash),ke=ke.parents?.[0]?q.get(ke.parents[0]):void 0}return ee});function p(ie,q){s("branchContextMenu",{...q,commitHash:ie.hash})}function g(ie,q){s("commitContextMenu",{commit:ie,...q})}function O(ie,q){s("tagContextMenu",{...q,commitHash:ie.hash})}const{ROW_HEIGHT:_,VISIBLE_BUFFER:k}=Mu,{computeGraphRows:P,computeMaxLane:w}=O5(),C=he(()=>P([...r.commits],r.graphStyle)),M=he(()=>w(C.value)),D=he(()=>{const ie=r.stashes||[];if(ie.length===0)return r.commits.map((Oe,Te)=>({type:"commit",commit:Oe,commitIndex:Te}));const q=[],ee=[...ie].sort((Oe,Te)=>new Date(Te.date).getTime()-new Date(Oe.date).getTime());let te=0;for(let Oe=0;Oe<r.commits.length;Oe++){const Te=r.commits[Oe],ke=Te.timestamp*1e3;for(;te<ee.length&&new Date(ee[te].date).getTime()>=ke;)q.push({type:"stash",stash:ee[te]}),te++;q.push({type:"commit",commit:Te,commitIndex:Oe})}for(;te<ee.length;)q.push({type:"stash",stash:ee[te]}),te++;return q}),j=N(null),oe=N(0),ae=N(400);let G=null;const x=he(()=>{const ie=k,q=D.value.length,ee=Math.max(0,Math.floor(oe.value/_)-ie),te=Math.min(q,Math.ceil((oe.value+ae.value)/_)+ie);return{startIndex:ee,endIndex:te}}),b=he(()=>{const{startIndex:ie,endIndex:q}=x.value;return D.value.slice(ie,q).map((ee,te)=>({row:ee,index:ie+te,graphRow:ee.type==="commit"&&C.value.get(ee.commit.hash)||null,isHighlighted:ee.type==="commit"?h.value.has(ee.commit.hash):!1,isBranchHighlighted:ee.type==="commit"?u.value.has(ee.commit.hash):!1,isFeatureHighlighted:ee.type==="commit"?d.value.has(ee.commit.hash):!1,isPreviewHighlighted:ee.type==="commit"?f.value.has(ee.commit.hash):!1,isMuted:ee.type==="commit"&&r.muteNonAncestral?!(C.value.get(ee.commit.hash)?.isMainline??!1):!1}))}),T=he(()=>D.value.length*_),$=he(()=>x.value.startIndex*_);function R(ie){const q=ie.target;oe.value=q.scrollTop,G||s("scrollStart"),G&&clearTimeout(G),G=setTimeout(()=>{G=null,s("scrollEnd")},150),r.hasMore&&!r.loading&&!r.loadingMore&&q.scrollTop+q.clientHeight>=q.scrollHeight-200&&s("loadMore")}function E(ie,q){q.ctrlKey||q.metaKey?s("compareSelect",ie):s("select",ie)}function Z(ie,q,ee){if(ie.key==="Enter"||ie.key===" ")ie.preventDefault(),s("select",q);else if(ie.key==="ArrowDown"){ie.preventDefault();for(let te=ee+1;te<D.value.length;te++){const Oe=D.value[te];if(Oe.type==="commit"){s("select",Oe.commit),K(te);break}}}else if(ie.key==="ArrowUp"){ie.preventDefault();for(let te=ee-1;te>=0;te--){const Oe=D.value[te];if(Oe.type==="commit"){s("select",Oe.commit),K(te);break}}}}function K(ie){if(!j.value)return;const q=ie*_,ee=j.value.scrollTop,te=ee+j.value.clientHeight;q<ee?j.value.scrollTop=q:q+_>te&&(j.value.scrollTop=q+_-j.value.clientHeight)}Qt(()=>{if(j.value){ae.value=j.value.clientHeight;const ie=new ResizeObserver(q=>{for(const ee of q)ae.value=ee.contentRect.height});ie.observe(j.value),_i(()=>ie.disconnect())}});function X(){return j.value?.scrollTop??0}function V(ie){j.value&&(j.value.scrollTop=ie)}return e({getScrollPosition:X,setScrollPosition:V,scrollToIndex:K}),(ie,q)=>{const ee=I_,te=v5;return y(),S("div",{ref_key:"containerRef",ref:j,class:"h-full overflow-auto",role:"list","aria-label":"Commit history",onScroll:R},[i.uncommittedChangesCount&&i.uncommittedChangesCount>0?(y(),S("div",{key:0,class:"flex items-center cursor-pointer group sticky top-0 z-10 bg-retro-dark border-b border-retro-border",style:gr({height:`${v(_)}px`}),role:"button",tabindex:"0","aria-selected":i.isUncommittedChangesSelected,onClick:n,onKeydown:o},[le(ee,{rowData:{commitHash:"uncommitted",lane:0,color:"#F59E0B",nodeType:"uncommitted",isMainline:!1,connections:[]},maxLane:v(M)},null,8,["maxLane"]),m("div",{class:Ie(["flex-1 flex items-center gap-2 px-2 min-w-0 rounded-r transition-colors",{"bg-retro-yellow/15":i.isUncommittedChangesSelected,"group-hover:bg-retro-panel/50":!i.isUncommittedChangesSelected}]),style:gr({height:`${v(_)-4}px`})},[le(v(Tu),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),m("span",b5," Uncommitted Changes ("+F(i.uncommittedChangesCount)+") ",1),q[1]||(q[1]=m("span",{class:"flex-1"},null,-1)),q[2]||(q[2]=m("span",{class:"text-retro-muted text-[10px]"},"Working tree",-1))],6)],44,_5)):se("",!0),m("div",{class:"relative",style:gr({height:`${v(T)}px`})},[m("div",{class:"absolute left-0 right-0",style:gr({transform:`translateY(${v($)}px)`})},[(y(!0),S(Me,null,Ke(v(b),({row:Oe,index:Te,graphRow:ke,isHighlighted:Ze,isBranchHighlighted:Je,isFeatureHighlighted:Ve,isPreviewHighlighted:I,isMuted:L})=>(y(),S(Me,{key:Oe.type==="commit"?Oe.commit.hash:`stash-${Oe.stash.index}`},[Oe.type==="commit"?Q2([Oe.commit.hash,Oe.commit.message,Oe.commit.timestamp,Oe.commit.branches.join("|"),Oe.commit.tags.join("|"),i.selectedCommit?.hash===Oe.commit.hash,Ze,Je,Ve,I,L,r.currentBranchName||"",r.columnVisibility?.date!==!1,r.columnVisibility?.author!==!1,r.columnVisibility?.commit!==!1],()=>(y(),xe(te,{key:0,commit:Oe.commit,index:Oe.commitIndex,isSelected:i.selectedCommit?.hash===Oe.commit.hash,isHighlighted:Ze,isBranchHighlighted:Je,isFeatureHighlighted:Ve,isPreviewHighlighted:I,isMuted:L,currentBranchName:r.currentBranchName,localBranchNames:r.localBranchNames,graphRowData:ke,maxLane:v(M),columnVisibility:r.columnVisibility,onClick:z=>E(Oe.commit,z),onKeydown:z=>Z(z,Oe.commit,Te),onBranchContextMenu:z=>p(Oe.commit,z),onCommitContextMenu:z=>g(Oe.commit,z),onTagContextMenu:z=>O(Oe.commit,z)},null,8,["commit","index","isSelected","isHighlighted","isBranchHighlighted","isFeatureHighlighted","isPreviewHighlighted","isMuted","currentBranchName","localBranchNames","graphRowData","maxLane","columnVisibility","onClick","onKeydown","onBranchContextMenu","onCommitContextMenu","onTagContextMenu"])),q,0):se("",!0)],64))),128))],4)],4),(i.loading||i.loadingMore)&&i.commits.length>0?(y(),S("div",y5,[...q[3]||(q[3]=[m("div",{class:"w-3 h-3 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),We(" Loading more commits... ",-1)])])):se("",!0),!i.hasMore&&i.commits.length>0&&!i.loading?(y(),S("div",x5,F(i.commits.length)+" commits loaded ",1)):se("",!0)],544)}}});function S5(i){const e=i.charAt(0).toUpperCase();return e in Fo?e:"M"}function wc(i,e){if(i&&typeof i=="object"){const t=i;if(typeof t.data?.message=="string"&&t.data.message.trim())return t.data.message;if(typeof t.statusMessage=="string"&&t.statusMessage.trim())return t.statusMessage;if(typeof t.message=="string"&&t.message.trim())return t.message}return i instanceof Error&&i.message?i.message:e}function z_(i,e){const t=e.trim().toLowerCase();return t?i.filter(r=>r.message.toLowerCase().includes(t)||r.author.toLowerCase().includes(t)||r.shortHash.includes(t)||r.hash.includes(t)||r.branches.some(s=>s.toLowerCase().includes(t))||r.tags.some(s=>s.toLowerCase().includes(t))):[...i]}function k5(i,e){return e.size===0?[...i]:i.filter(t=>t.branches.some(r=>e.has(r)))}function C5(i=10){const e=new Map;function t(s,n){const o=n.toLowerCase(),a=`${o}:${s.length}`,l=e.get(a);if(l)return l;const c=z_(s,o);if(e.size>=i){const h=e.keys().next().value;h!==void 0&&e.delete(h)}return e.set(a,c),c}function r(){e.clear()}return{filter:t,clear:r}}const $5={class:"flex flex-col h-full border-t border-retro-border bg-retro-dark"},P5={class:"flex items-center justify-between p-2 border-b border-retro-border flex-shrink-0"},T5={class:"flex items-center gap-2 text-xs min-w-0"},M5={class:"font-mono text-retro-cyan"},Q5={class:"font-mono text-retro-cyan"},A5={key:0,class:"px-3 py-1.5 text-xs text-retro-muted border-b border-retro-border flex-shrink-0"},R5={class:"text-retro-green"},B5={class:"text-retro-red"},L5={key:1,class:"flex-1 flex items-center justify-center"},E5={key:2,class:"flex-1 overflow-auto"},D5={class:"text-retro-text truncate flex-1"},I5={class:"text-retro-muted"},z5={key:0,class:"flex-shrink-0 text-[10px] font-mono"},N5={key:0,class:"text-retro-green"},W5={key:1,class:"text-retro-red ml-1"},Z5={key:1,class:"flex-shrink-0 text-[10px] text-retro-muted italic"},X5={key:3,class:"flex-1 flex items-center justify-center text-retro-muted text-sm"},F5=Xe({__name:"GitComparisonView",props:{fromCommit:{},toCommit:{},files:{},stats:{},loading:{type:Boolean}},emits:["close"],setup(i,{emit:e}){const t=e;function r(s){const n=S5(s);return Fo[n]||Fo.M}return(s,n)=>(y(),S("div",$5,[m("div",P5,[m("div",T5,[n[1]||(n[1]=m("span",{class:"text-retro-muted"},"Comparing",-1)),m("span",M5,F(i.fromCommit.shortHash),1),n[2]||(n[2]=m("span",{class:"text-retro-muted"},"→",-1)),m("span",Q5,F(i.toCommit.shortHash),1)]),m("button",{class:"p-1 text-retro-muted hover:text-retro-text transition-colors flex-shrink-0","aria-label":"Close comparison",onClick:n[0]||(n[0]=o=>t("close"))},[le(v(hi),{class:"w-4 h-4"})])]),i.stats?(y(),S("div",A5,[We(F(i.stats.filesChanged)+" file"+F(i.stats.filesChanged!==1?"s":"")+" changed, ",1),m("span",R5,"+"+F(i.stats.additions),1),m("span",B5," -"+F(i.stats.deletions),1)])):se("",!0),i.loading?(y(),S("div",L5,[...n[3]||(n[3]=[m("div",{class:"flex items-center gap-2 text-retro-muted text-sm"},[m("div",{class:"w-4 h-4 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"}),We(" Loading comparison... ")],-1)])])):i.files&&i.files.length>0?(y(),S("div",E5,[(y(!0),S(Me,null,Ke(i.files,o=>(y(),S("div",{key:o.path,class:"flex items-center gap-2 px-3 py-1.5 hover:bg-retro-panel/50 text-xs border-b border-retro-border/50"},[m("span",{class:Ie(["flex-shrink-0 w-4 text-center font-semibold text-[10px]",r(o.status).colorClass])},F(o.status.charAt(0)),3),m("span",D5,[o.oldPath&&o.status.startsWith("R")?(y(),S(Me,{key:0},[m("span",I5,F(o.oldPath),1),n[4]||(n[4]=m("span",{class:"text-retro-muted mx-1"},"→",-1))],64)):se("",!0),We(" "+F(o.path),1)]),o.binary?(y(),S("span",Z5,"binary")):(y(),S("span",z5,[o.additions>0?(y(),S("span",N5,"+"+F(o.additions),1)):se("",!0),o.deletions>0?(y(),S("span",W5,"-"+F(o.deletions),1)):se("",!0)]))]))),128))])):i.files&&i.files.length===0?(y(),S("div",X5," No differences between these commits ")):se("",!0)]))}}),V5={":art:":"🎨",":zap:":"⚡",":fire:":"🔥",":bug:":"🐛",":ambulance:":"🚑",":sparkles:":"✨",":memo:":"📝",":rocket:":"🚀",":lipstick:":"💄",":tada:":"🎉",":white_check_mark:":"✅",":lock:":"🔒",":closed_lock_with_key:":"🔐",":bookmark:":"🔖",":rotating_light:":"🚨",":construction:":"🚧",":green_heart:":"💚",":arrow_down:":"⬇️",":arrow_up:":"⬆️",":pushpin:":"📌",":construction_worker:":"👷",":chart_with_upwards_trend:":"📈",":recycle:":"♻️",":heavy_plus_sign:":"➕",":heavy_minus_sign:":"➖",":wrench:":"🔧",":hammer:":"🔨",":globe_with_meridians:":"🌐",":pencil2:":"✏️",":poop:":"💩",":rewind:":"⏪",":twisted_rightwards_arrows:":"🔀",":package:":"📦",":alien:":"👽",":truck:":"🚚",":page_facing_up:":"📄",":boom:":"💥",":bento:":"🍱",":wheelchair:":"♿",":bulb:":"💡",":beers:":"🍻",":speech_balloon:":"💬",":card_file_box:":"🗃️",":loud_sound:":"🔊",":mute:":"🔇",":busts_in_silhouette:":"👥",":children_crossing:":"🚸",":building_construction:":"🏗️",":iphone:":"📱",":clown_face:":"🤡",":egg:":"🥚",":see_no_evil:":"🙈",":camera_flash:":"📸",":alembic:":"⚗️",":mag:":"🔍",":label:":"🏷️",":seedling:":"🌱",":triangular_flag_on_post:":"🚩",":goal_net:":"🥅",":dizzy:":"💫",":wastebasket:":"🗑️",":passport_control:":"🛂",":adhesive_bandage:":"🩹",":monocle_face:":"🧐",":coffin:":"⚰️",":test_tube:":"🧪",":necktie:":"👔",":stethoscope:":"🩺",":bricks:":"🧱",":technologist:":"🧑‍💻",":money_with_wings:":"💸",":thread:":"🧵",":safety_vest:":"🦺"},q5=/https?:\/\/[^\s<>)"']+/g;function H5(i){return i.replace(q5,e=>`<a href="${e}" target="_blank" rel="noopener noreferrer" class="text-retro-blue hover:underline">${e}</a>`)}function U5(i){return i.replace(/:[a-z0-9_]+:/g,e=>V5[e]||e)}function Y5(i){if(!i)return"";let e=U5(i);return e=I2.parse(e),e=H5(e),e=z2.sanitize(e,{ALLOWED_TAGS:["a","strong","em","code","b","i","br","p","ul","ol","li","pre","blockquote","h1","h2","h3"],ALLOWED_ATTR:["href","target","rel","class"]}),e}const j5={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border bg-retro-panel"},G5={class:"flex items-center gap-2 min-w-0"},K5={class:"text-retro-cyan font-mono text-sm"},J5={class:"text-retro-muted text-sm truncate"},eC={class:"flex items-center gap-1 flex-shrink-0"},tC=["aria-label","title"],iC={class:"flex-1 overflow-auto p-4 space-y-4"},rC={class:"space-y-2"},sC={class:"flex items-center gap-2 text-sm"},nC={class:"text-retro-text font-mono text-xs bg-retro-panel px-2 py-1 rounded"},oC={class:"flex items-center gap-2 text-sm"},aC={class:"text-retro-text"},lC={class:"text-retro-muted"},cC={key:0,class:"flex items-center gap-2 text-sm"},hC={class:"text-retro-text"},uC={class:"text-retro-muted"},dC={class:"flex items-center gap-2 text-sm"},fC={class:"text-retro-text"},pC={key:1,class:"flex items-start gap-2 text-sm"},mC={class:"flex flex-wrap gap-1"},gC=["onClick","title"],vC={key:2,class:"flex items-start gap-2 text-sm"},OC={class:"flex flex-wrap gap-1"},_C={key:3,class:"flex items-start gap-2 text-sm"},bC={class:"flex flex-wrap gap-1"},yC={class:"space-y-1"},xC={class:"text-retro-text text-sm font-mono bg-retro-panel p-3 rounded"},wC={key:0,class:"space-y-1"},SC=["innerHTML"],kC={key:1,class:"space-y-2"},CC={class:"flex items-center gap-2 text-sm"},$C={class:"text-retro-muted"},PC={key:0,class:"flex items-center gap-2"},TC={class:"text-retro-green text-xs font-mono"},MC={class:"flex-1 h-2 rounded overflow-hidden bg-retro-panel flex"},QC={class:"text-retro-red text-xs font-mono"},AC={key:2,class:"space-y-2"},RC={class:"flex items-center justify-between"},BC={class:"text-retro-muted text-xs uppercase tracking-wide"},LC={class:"flex items-center gap-1"},EC={key:0,class:"text-retro-muted text-sm py-2"},DC={key:1,class:"space-y-0.5"},IC=["onClick"],zC=["title"],NC={class:"text-retro-text font-mono text-xs truncate flex-1"},WC={class:"text-retro-muted"},ZC={class:"text-retro-text"},XC={key:0,class:"flex-shrink-0 font-mono text-xs flex items-center gap-1"},FC={key:0,class:"text-retro-green"},VC={key:1,class:"text-retro-red"},qC={key:1,class:"flex-shrink-0 font-mono text-xs text-retro-muted"},HC={key:2,class:"space-y-0"},UC=["onClick"],YC={class:"text-retro-text font-mono text-xs"},jC=["title"],GC={class:"text-retro-text font-mono text-xs truncate flex-1"},KC={class:"text-retro-muted"},JC={class:"text-retro-text"},e$={key:0,class:"flex-shrink-0 font-mono text-xs flex items-center gap-1"},t$={key:0,class:"text-retro-green"},i$={key:1,class:"text-retro-red"},r$={key:1,class:"flex-shrink-0 font-mono text-xs text-retro-muted"},s$={key:3,class:"flex items-center gap-2 text-retro-muted text-sm py-2"},n$={key:4,class:"text-retro-muted text-sm py-2"},o$=Xe({__name:"GitCommitDetail",props:{commit:{},files:{},stats:{},loading:{type:Boolean,default:!1},committer:{},committerEmail:{},detailPosition:{default:"inline"}},emits:["close","navigateToCommit","togglePosition","navigatePrev","navigateNext","openFileDiff"],setup(i,{emit:e}){const t=i,r=e,s=N(null),n=N("flat"),o=N(new Set),a=he(()=>!t.committer||!t.committerEmail?!1:t.committer!==t.commit.author||t.committerEmail!==t.commit.email),l=he(()=>{const G=t.commit.body;return G?Y5(G):""}),c=he(()=>{if(!t.stats)return"";const{filesChanged:G,additions:x,deletions:b}=t.stats,$=[`${G} ${G===1?"file":"files"} changed`];return x>0&&$.push(`+${x} insertion${x===1?"":"s"}`),b>0&&$.push(`-${b} deletion${b===1?"":"s"}`),$.join(", ")});function h(G){const x=[];for(const b of G){const T=b.path.split("/");let $=x;for(let R=0;R<T.length;R++){const E=T[R],Z=R===T.length-1,K=T.slice(0,R+1).join("/");let X=$.find(V=>V.name===E&&V.isDirectory===!Z);X||(X={name:E,fullPath:K,isDirectory:!Z,children:[],file:Z?b:void 0},$.push(X)),Z||($=X.children)}}return u(x),x}function u(G){for(const x of G)if(x.isDirectory)for(u(x.children);x.children.length===1&&x.children[0].isDirectory;){const b=x.children[0];x.name=`${x.name}/${b.name}`,x.fullPath=b.fullPath,x.children=b.children}}function d(G){return[...G].sort((x,b)=>x.isDirectory&&!b.isDirectory?-1:!x.isDirectory&&b.isDirectory?1:x.name.localeCompare(b.name))}function f(G,x,b){const T=[];for(const $ of d(G)){const R=b.size===0?!0:b.has($.fullPath);T.push({key:$.fullPath,depth:x,isDirectory:$.isDirectory,name:$.name,fullPath:$.fullPath,expanded:$.isDirectory?R:!1,file:$.file}),$.isDirectory&&R&&T.push(...f($.children,x+1,b))}return T}const p=he(()=>!t.files||t.files.length===0?[]:h(t.files)),g=he(()=>f(p.value,0,o.value));function O(G){o.value.has(G)?o.value.delete(G):o.value.add(G),o.value=new Set(o.value)}function _(){const G=x=>{const b=[];for(const T of x)T.isDirectory&&(b.push(T.fullPath),b.push(...G(T.children)));return b};o.value=new Set(G(p.value))}function k(){o.value=new Set}Ye(n,G=>{G==="tree"&&_()});function P(G){return new Date(G*1e3).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0})}function w(G){return Fo[G]||{label:G,colorClass:"text-retro-muted"}}const C=he(()=>{if(!t.stats)return{addPct:0,delPct:0};const G=t.stats.additions+t.stats.deletions;return G===0?{addPct:50,delPct:50}:{addPct:Math.round(t.stats.additions/G*100),delPct:Math.round(t.stats.deletions/G*100)}});function M(G){G.key==="ArrowUp"?(G.preventDefault(),r("navigatePrev")):G.key==="ArrowDown"?(G.preventDefault(),r("navigateNext")):G.key==="Escape"&&(G.preventDefault(),r("close"))}Qt(()=>{xi(()=>{s.value?.focus()})}),Ye(()=>t.commit.hash,()=>{xi(()=>{s.value?.focus()})});function D(){r("close")}function j(G){r("navigateToCommit",G)}function oe(){r("togglePosition")}function ae(G){r("openFileDiff",G)}return(G,x)=>(y(),S("section",{ref_key:"containerRef",ref:s,tabindex:0,onKeydown:M,class:"flex-1 min-h-0 flex flex-col border-t border-retro-border bg-retro-dark focus:outline-none","aria-label":"Commit details",role:"region"},[m("div",j5,[m("div",G5,[m("span",K5,F(i.commit.shortHash),1),m("span",J5,F(i.commit.message.split(`
5
+ `)[0]),1)]),m("div",eC,[m("button",{onClick:oe,class:"p-1 hover:bg-retro-dark rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan","aria-label":i.detailPosition==="inline"?"Dock detail to bottom":"Show detail inline",title:i.detailPosition==="inline"?"Dock to bottom":"Show inline"},[i.detailPosition==="inline"?(y(),xe(v(C_),{key:0,class:"w-4 h-4 text-retro-muted hover:text-retro-text"})):(y(),xe(v(k_),{key:1,class:"w-4 h-4 text-retro-muted hover:text-retro-text"}))],8,tC),m("button",{onClick:D,class:"p-1 hover:bg-retro-dark rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan","aria-label":"Close commit details"},[le(v(hi),{class:"w-4 h-4 text-retro-muted hover:text-retro-text"})])])]),m("div",iC,[m("div",rC,[m("div",sC,[x[2]||(x[2]=m("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Hash:",-1)),m("code",nC,F(i.commit.hash),1)]),m("div",oC,[le(v(qg),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),m("span",aC,F(i.commit.author),1),m("span",lC,"<"+F(i.commit.email)+">",1)]),a.value?(y(),S("div",cC,[le(v(qg),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),x[3]||(x[3]=m("span",{class:"text-retro-muted text-xs uppercase mr-1"},"Committer:",-1)),m("span",hC,F(i.committer),1),m("span",uC,"<"+F(i.committerEmail)+">",1)])):se("",!0),m("div",dC,[le(v(N2),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),m("span",fC,F(P(i.commit.timestamp)),1)]),i.commit.parents?.length>0?(y(),S("div",pC,[x[4]||(x[4]=m("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Parents:",-1)),m("div",mC,[(y(!0),S(Me,null,Ke(i.commit.parents,b=>(y(),S("button",{key:b,onClick:T=>j(b),class:"text-retro-cyan font-mono text-xs bg-retro-panel px-2 py-0.5 rounded hover:bg-retro-dark hover:text-retro-text transition-colors cursor-pointer focus:outline-none focus:ring-2 focus:ring-retro-cyan",title:`Navigate to parent ${b.substring(0,7)}`},F(b.substring(0,7)),9,gC))),128))])])):se("",!0),i.commit.branches?.length>0?(y(),S("div",vC,[x[5]||(x[5]=m("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Branches:",-1)),m("div",OC,[(y(!0),S(Me,null,Ke(i.commit.branches,b=>(y(),S("span",{key:b,class:"text-retro-green font-mono text-xs bg-retro-panel px-2 py-0.5 rounded"},F(b),1))),128))])])):se("",!0),i.commit.tags?.length>0?(y(),S("div",_C,[x[6]||(x[6]=m("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Tags:",-1)),m("div",bC,[(y(!0),S(Me,null,Ke(i.commit.tags,b=>(y(),S("span",{key:b,class:"text-retro-yellow font-mono text-xs bg-retro-panel px-2 py-0.5 rounded"},F(b),1))),128))])])):se("",!0)]),m("div",yC,[x[7]||(x[7]=m("h4",{class:"text-retro-muted text-xs uppercase tracking-wide"}," Message ",-1)),m("div",xC,F(i.commit.message.split(`
6
+ `)[0]),1)]),i.commit.body?(y(),S("div",wC,[x[8]||(x[8]=m("h4",{class:"text-retro-muted text-xs uppercase tracking-wide"}," Body ",-1)),m("div",{class:"text-retro-text text-sm font-mono bg-retro-panel p-3 rounded commit-body-rendered",innerHTML:l.value},null,8,SC)])):se("",!0),i.stats?(y(),S("div",kC,[m("div",CC,[m("span",$C,F(c.value),1)]),i.stats.additions>0||i.stats.deletions>0?(y(),S("div",PC,[m("span",TC,"+"+F(i.stats.additions),1),m("div",MC,[m("div",{class:"bg-retro-green h-full transition-all",style:gr({width:C.value.addPct+"%"})},null,4),m("div",{class:"bg-retro-red h-full transition-all",style:gr({width:C.value.delPct+"%"})},null,4)]),m("span",QC,"-"+F(i.stats.deletions),1)])):se("",!0)])):se("",!0),i.files?(y(),S("div",AC,[m("div",RC,[m("h4",BC," Files Changed ("+F(i.files.length)+") ",1),m("div",LC,[m("button",{onClick:x[0]||(x[0]=b=>n.value="flat"),class:Ie(["p-1 rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan",n.value==="flat"?"bg-retro-panel text-retro-cyan":"text-retro-muted hover:text-retro-text"]),"aria-label":"Flat file list",title:"Flat file list"},[le(v(A_),{class:"w-4 h-4"})],2),m("button",{onClick:x[1]||(x[1]=b=>n.value="tree"),class:Ie(["p-1 rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan",n.value==="tree"?"bg-retro-panel text-retro-cyan":"text-retro-muted hover:text-retro-text"]),"aria-label":"Tree file view",title:"Tree file view"},[le(v(Hg),{class:"w-4 h-4"})],2)])]),i.files.length===0?(y(),S("div",EC," No files changed in this commit. ")):n.value==="flat"?(y(),S("ul",DC,[(y(!0),S(Me,null,Ke(i.files,b=>(y(),S("li",{key:b.path,class:"flex items-center gap-2 text-sm py-1 px-2 hover:bg-retro-panel rounded group cursor-pointer",onClick:T=>ae(b)},[m("span",{class:Ie(["flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs font-bold rounded",w(b.status).colorClass]),title:w(b.status).label},F(b.status),11,zC),le(v(Jn),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),m("span",NC,[b.status==="R"&&b.oldPath?(y(),S(Me,{key:0},[m("span",WC,F(b.oldPath),1),x[9]||(x[9]=m("span",{class:"text-retro-yellow mx-1"},"→",-1)),m("span",ZC,F(b.path),1)],64)):(y(),S(Me,{key:1},[We(F(b.path),1)],64))]),!b.binary&&(b.additions>0||b.deletions>0)?(y(),S("span",XC,[b.additions>0?(y(),S("span",FC,"+"+F(b.additions),1)):se("",!0),b.deletions>0?(y(),S("span",VC,"-"+F(b.deletions),1)):se("",!0)])):b.binary?(y(),S("span",qC,"binary")):se("",!0)],8,IC))),128))])):(y(),S("div",HC,[m("div",{class:"flex items-center gap-2 mb-1"},[m("button",{onClick:_,class:"text-xs text-retro-muted hover:text-retro-text transition-colors"}," Expand all "),x[10]||(x[10]=m("span",{class:"text-retro-muted text-xs"},"|",-1)),m("button",{onClick:k,class:"text-xs text-retro-muted hover:text-retro-text transition-colors"}," Collapse all ")]),(y(!0),S(Me,null,Ke(g.value,b=>(y(),S("div",{key:b.key,class:Ie(["flex items-center gap-1 py-0.5 px-1 hover:bg-retro-panel rounded text-sm cursor-pointer",{"select-none":b.isDirectory}]),style:gr({paddingLeft:b.depth*16+4+"px"}),onClick:T=>b.isDirectory?O(b.fullPath):b.file?ae(b.file):void 0},[b.isDirectory?(y(),S(Me,{key:0},[le(v(W2),{class:Ie(["w-3 h-3 text-retro-muted transition-transform flex-shrink-0",{"rotate-90":b.expanded}])},null,8,["class"]),le(v(Hg),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),m("span",YC,F(b.name),1)],64)):b.file?(y(),S(Me,{key:1},[m("span",{class:Ie(["flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs font-bold rounded",w(b.file.status).colorClass]),title:w(b.file.status).label},F(b.file.status),11,jC),le(v(Jn),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),m("span",GC,[b.file.status==="R"&&b.file.oldPath?(y(),S(Me,{key:0},[m("span",KC,F(b.file.oldPath.split("/").pop()),1),x[11]||(x[11]=m("span",{class:"text-retro-yellow mx-1"},"→",-1)),m("span",JC,F(b.name),1)],64)):(y(),S(Me,{key:1},[We(F(b.name),1)],64))]),!b.file.binary&&(b.file.additions>0||b.file.deletions>0)?(y(),S("span",e$,[b.file.additions>0?(y(),S("span",t$,"+"+F(b.file.additions),1)):se("",!0),b.file.deletions>0?(y(),S("span",i$,"-"+F(b.file.deletions),1)):se("",!0)])):b.file.binary?(y(),S("span",r$,"binary")):se("",!0)],64)):se("",!0)],14,UC))),128))]))])):i.loading?(y(),S("div",s$,[...x[12]||(x[12]=[m("div",{class:"w-3 h-3 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),We(" Loading file changes... ",-1)])])):(y(),S("div",n$," Failed to load file changes. "))])],544))}}),a$=zs(o$,[["__scopeId","data-v-29f450ea"]]),l$={class:"flex-1 min-h-0 flex flex-col border-t border-retro-border bg-retro-dark","aria-label":"Uncommitted changes details"},c$={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border bg-retro-panel"},h$={class:"flex items-center gap-2 min-w-0"},u$={class:"text-retro-muted text-sm"},d$={key:0,class:"w-3 h-3 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin",title:"Staging..."},f$={class:"flex-1 overflow-auto p-4 space-y-3"},p$={class:"space-y-2"},m$=["disabled"],g$={class:"space-y-1"},v$={class:"flex items-center justify-between"},O$={class:"text-retro-green text-xs uppercase tracking-wide font-semibold"},_$={key:0,class:"text-retro-muted text-xs py-1"},b$={key:1,class:"space-y-0.5"},y$=["aria-label","onClick"],x$={class:"text-retro-text font-mono text-xs truncate"},w$={class:"space-y-1"},S$={class:"flex items-center justify-between"},k$={class:"text-retro-yellow text-xs uppercase tracking-wide font-semibold"},C$={key:0,class:"text-retro-muted text-xs py-1"},$$={key:1,class:"space-y-0.5"},P$=["aria-label","onClick"],T$={class:"text-retro-text font-mono text-xs truncate"},M$=Xe({__name:"GitUncommittedDetail",props:{stagedFiles:{default:()=>[]},unstagedFiles:{default:()=>[]},isStaging:{type:Boolean,default:!1},isCommitting:{type:Boolean,default:!1}},emits:["close","stageFiles","unstageFiles","stageAll","unstageAll","commit"],setup(i,{emit:e}){const t=i,r=e,s=N(""),n=N(!1),o=he(()=>s.value.trim().length>0&&t.stagedFiles.length>0&&!n.value&&!t.isCommitting);function a(g){return Fo[g]||{label:g,colorClass:"text-retro-muted"}}function l(){r("close")}function c(g){r("stageFiles",[g.path])}function h(g){r("unstageFiles",[g.path])}function u(){r("stageAll")}function d(){r("unstageAll")}async function f(){o.value&&(n.value=!0,r("commit",s.value.trim()),s.value="",n.value=!1)}function p(g){(g.metaKey||g.ctrlKey)&&g.key==="Enter"&&(g.preventDefault(),f())}return(g,O)=>(y(),S("section",l$,[m("div",c$,[m("div",h$,[le(v(Tu),{class:"w-4 h-4 text-retro-yellow"}),O[1]||(O[1]=m("span",{class:"text-retro-yellow font-semibold text-sm"},"Uncommitted Changes",-1)),m("span",u$,"("+F(i.stagedFiles.length+i.unstagedFiles.length)+" files)",1),t.isStaging?(y(),S("div",d$)):se("",!0)]),m("button",{onClick:l,class:"p-1 hover:bg-retro-dark rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan","aria-label":"Close uncommitted changes details"},[le(v(hi),{class:"w-4 h-4 text-retro-muted hover:text-retro-text"})])]),m("div",f$,[m("div",p$,[je(m("textarea",{"onUpdate:modelValue":O[0]||(O[0]=_=>at(s)?s.value=_:null),placeholder:"Commit message...",rows:"3",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan resize-none font-mono",onKeydown:p},null,544),[[$i,v(s)]]),m("button",{disabled:!v(o),class:Ie(["w-full px-3 py-1.5 text-sm font-semibold rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed",v(o)?"bg-retro-green text-retro-dark hover:bg-retro-green/90":"bg-retro-green/30 text-retro-dark"]),onClick:f},F(v(n)||t.isCommitting?"Committing...":`Commit (${i.stagedFiles.length} staged)`),11,m$)]),m("div",g$,[m("div",v$,[m("h4",O$," Staged Changes ("+F(i.stagedFiles.length)+") ",1),i.stagedFiles.length>0?(y(),S("button",{key:0,class:"text-[11px] text-retro-muted hover:text-retro-text transition-colors",onClick:d}," Unstage All ")):se("",!0)]),i.stagedFiles.length===0?(y(),S("div",_$," No staged files. Stage files below to commit. ")):(y(),S("ul",b$,[(y(!0),S(Me,null,Ke(i.stagedFiles,_=>(y(),S("li",{key:"staged-"+_.path,class:"flex items-center gap-2 text-sm py-1 px-2 hover:bg-retro-panel rounded group"},[m("button",{class:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded hover:bg-retro-red/20 transition-colors opacity-60 group-hover:opacity-100",title:"Unstage file","aria-label":`Unstage ${_.path}`,onClick:k=>h(_)},[le(v(kk),{class:"w-3.5 h-3.5 text-retro-red"})],8,y$),m("span",{class:Ie(["flex-shrink-0 w-4 text-center text-xs font-bold",a(_.status).colorClass])},F(_.status),3),le(v(Jn),{class:"w-3.5 h-3.5 text-retro-muted flex-shrink-0"}),m("span",x$,F(_.oldPath?`${_.oldPath} → ${_.path}`:_.path),1)]))),128))]))]),m("div",w$,[m("div",S$,[m("h4",k$," Unstaged Changes ("+F(i.unstagedFiles.length)+") ",1),i.unstagedFiles.length>0?(y(),S("button",{key:0,class:"text-[11px] text-retro-muted hover:text-retro-text transition-colors",onClick:u}," Stage All ")):se("",!0)]),i.unstagedFiles.length===0?(y(),S("div",C$," No unstaged changes. ")):(y(),S("ul",$$,[(y(!0),S(Me,null,Ke(i.unstagedFiles,_=>(y(),S("li",{key:"unstaged-"+_.path,class:"flex items-center gap-2 text-sm py-1 px-2 hover:bg-retro-panel rounded group"},[m("button",{class:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded hover:bg-retro-green/20 transition-colors opacity-60 group-hover:opacity-100",title:"Stage file","aria-label":`Stage ${_.path}`,onClick:k=>c(_)},[le(v(Pu),{class:"w-3.5 h-3.5 text-retro-green"})],8,P$),m("span",{class:Ie(["flex-shrink-0 w-4 text-center text-xs font-bold",a(_.status).colorClass])},F(_.status),3),le(v(Jn),{class:"w-3.5 h-3.5 text-retro-muted flex-shrink-0"}),m("span",T$,F(_.oldPath?`${_.oldPath} → ${_.path}`:_.path),1)]))),128))]))])])]))}}),Q$=["aria-label"],A$={key:0,class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border truncate font-mono"},R$={key:0,class:"my-1 border-t border-retro-border",role:"separator"},B$=["aria-disabled","onClick","onMouseenter"],L$={key:1,class:"w-4 h-4 flex-shrink-0"},ov=220,E$=36,D$=9,I$=29,bs=8,Jl=Xe({__name:"GitContextMenu",props:{items:{},x:{},y:{},title:{}},emits:["close","action"],setup(i,{emit:e}){const t=i,r=e,s=N(null),n=N(-1),o=he(()=>t.items.map((f,p)=>({item:f,i:p})).filter(({item:f})=>!f.disabled).map(({i:f})=>f));let a=!1;function l(f){a&&s.value&&!s.value.contains(f.target)&&r("close")}Qt(()=>{requestAnimationFrame(()=>{a=!0}),document.addEventListener("mousedown",l),document.addEventListener("contextmenu",l),xi(()=>{s.value?.focus()})}),_i(()=>{a=!1,document.removeEventListener("mousedown",l),document.removeEventListener("contextmenu",l)});function c(f){const p=o.value;if(p.length===0)return;if(n.value===-1){n.value=f===1?p[0]:p[p.length-1];return}const g=p.indexOf(n.value);if(g===-1){n.value=f===1?p[0]:p[p.length-1];return}const O=g+f;O>=0&&O<p.length&&(n.value=p[O])}function h(f){switch(f.key){case"Escape":f.preventDefault(),r("close");break;case"ArrowDown":f.preventDefault(),c(1);break;case"ArrowUp":f.preventDefault(),c(-1);break;case"Enter":{f.preventDefault();const p=t.items[n.value];p&&!p.disabled&&(r("action",p.key),r("close"));break}}}function u(f){f.disabled||(r("action",f.key),r("close"))}const d=he(()=>{const f=t.title?I$:0,p=t.items.filter(P=>P.separator).length,g=t.items.length*E$+p*D$+bs,O=f+g;let _=t.x,k=t.y;return typeof window<"u"&&(_+ov>window.innerWidth-bs&&(_=window.innerWidth-ov-bs),_<bs&&(_=bs),k+O>window.innerHeight-bs&&(k=window.innerHeight-O-bs),k<bs&&(k=bs)),{left:`${_}px`,top:`${k}px`}});return(f,p)=>(y(),xe(or,{to:"body"},[m("div",{ref_key:"menuRef",ref:s,class:"fixed z-50 bg-retro-panel border border-retro-border rounded shadow-lg py-1 min-w-[220px]",style:gr(v(d)),role:"menu","aria-label":i.title??"Context menu",tabindex:"-1",onKeydown:h},[i.title?(y(),S("div",A$,F(i.title),1)):se("",!0),(y(!0),S(Me,null,Ke(i.items,(g,O)=>(y(),S(Me,{key:g.key},[g.separator?(y(),S("div",R$)):se("",!0),m("button",{class:Ie(["w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors focus:outline-none",[g.disabled?"text-retro-muted/50 cursor-not-allowed":g.danger?["text-retro-red hover:bg-retro-red/10 focus:bg-retro-red/10",v(n)===O?"bg-retro-red/10":""]:["text-retro-text hover:bg-retro-cyan/10 focus:bg-retro-cyan/10",v(n)===O?"bg-retro-cyan/10":""]]]),role:"menuitem","aria-disabled":g.disabled||void 0,tabindex:-1,onClick:_=>u(g),onMouseenter:_=>n.value=g.disabled?v(n):O,onMouseleave:p[0]||(p[0]=_=>n.value=-1)},[g.icon?(y(),xe(jl(g.icon),{key:0,class:Ie(["w-4 h-4 flex-shrink-0",g.disabled?"opacity-50":g.danger?"":"text-retro-muted"])},null,8,["class"])):(y(),S("span",L$)),We(" "+F(g.label),1)],42,B$)],64))),128))],44,Q$)]))}}),z$=Xe({__name:"GitBranchMenu",props:{branchName:{},isCurrentBranch:{type:Boolean},isLocal:{type:Boolean},x:{},y:{}},emits:["close","checkout","createBranch","deleteBranch","rename","merge","rebase","push","pull","fetch","copyName"],setup(i,{emit:e}){const t=i,r=e,s=he(()=>[{key:"checkout",label:"Checkout",icon:Kn,disabled:t.isCurrentBranch},{key:"rename",label:"Rename",icon:Z2,separator:!0},{key:"deleteBranch",label:"Delete",icon:os,danger:!0,disabled:t.isCurrentBranch},{key:"merge",label:"Merge into Current",icon:$_,separator:!0,disabled:t.isCurrentBranch},{key:"rebase",label:"Rebase Current Onto",icon:x_,disabled:t.isCurrentBranch},{key:"push",label:"Push",icon:w_,separator:!0},{key:"copyName",label:"Copy Branch Name",icon:Xo,separator:!0}]),n=he(()=>[{key:"checkout",label:"Checkout",icon:Kn},{key:"deleteBranch",label:"Delete Remote Branch",icon:os,separator:!0,danger:!0},{key:"fetch",label:"Fetch",icon:M_,separator:!0},{key:"pull",label:"Pull into Current",icon:ok},{key:"copyName",label:"Copy Branch Name",icon:Xo,separator:!0}]),o=he(()=>t.isLocal?s.value:n.value),a={checkout:()=>r("checkout"),createBranch:()=>r("createBranch"),deleteBranch:()=>r("deleteBranch"),rename:()=>r("rename"),merge:()=>r("merge"),rebase:()=>r("rebase"),push:()=>r("push"),pull:()=>r("pull"),fetch:()=>r("fetch"),copyName:()=>r("copyName")};function l(c){a[c]?.(),r("close")}return(c,h)=>{const u=Jl;return y(),xe(u,{items:v(o),x:i.x,y:i.y,title:i.branchName,onAction:l,onClose:h[0]||(h[0]=d=>r("close"))},null,8,["items","x","y","title"])}}}),N$=Xe({__name:"GitCommitMenu",props:{commit:{},x:{},y:{}},emits:["close","addTag","createBranch","checkout","cherryPick","revert","mergeInto","reset","copyHash","copySubject"],setup(i,{emit:e}){const t=e,r=he(()=>[{key:"addTag",label:"Add Tag",icon:Cm},{key:"createBranch",label:"Create Branch",icon:Pu},{key:"checkout",label:"Checkout (detached HEAD)",icon:Kn,separator:!0},{key:"cherryPick",label:"Cherry Pick",icon:gk},{key:"revert",label:"Revert",icon:S_},{key:"mergeInto",label:"Merge into Current",icon:$_,separator:!0},{key:"reset",label:"Reset Current Branch to Here",icon:x_,danger:!0},{key:"copyHash",label:"Copy Commit Hash",icon:Xo,separator:!0},{key:"copySubject",label:"Copy Commit Subject",icon:Xo}]),s={addTag:()=>t("addTag"),createBranch:()=>t("createBranch"),checkout:()=>t("checkout"),cherryPick:()=>t("cherryPick"),revert:()=>t("revert"),mergeInto:()=>t("mergeInto"),reset:()=>t("reset"),copyHash:()=>t("copyHash"),copySubject:()=>t("copySubject")};function n(o){s[o]?.(),t("close")}return(o,a)=>{const l=Jl;return y(),xe(l,{items:v(r),x:i.x,y:i.y,title:i.commit.shortHash,onAction:n,onClose:a[0]||(a[0]=c=>t("close"))},null,8,["items","x","y","title"])}}}),W$=Xe({__name:"GitTagMenu",props:{tagName:{},x:{},y:{}},emits:["close","viewDetails","deleteTag","pushTag","copyName"],setup(i,{emit:e}){const t=e,r=[{key:"viewDetails",label:"View Details",icon:Cm},{key:"deleteTag",label:"Delete Tag",icon:os,separator:!0,danger:!0},{key:"pushTag",label:"Push Tag",icon:w_},{key:"copyName",label:"Copy Tag Name",icon:Xo,separator:!0}],s={viewDetails:()=>t("viewDetails"),deleteTag:()=>t("deleteTag"),pushTag:()=>t("pushTag"),copyName:()=>t("copyName")};function n(o){s[o]?.()}return(o,a)=>{const l=Jl;return y(),xe(l,{items:r,x:i.x,y:i.y,title:i.tagName,onClose:a[0]||(a[0]=c=>t("close")),onAction:n},null,8,["x","y","title"])}}}),Z$=Xe({__name:"GitStashMenu",props:{stashIndex:{},stashMessage:{},x:{},y:{}},emits:["close","apply","pop","drop","createBranch","copyName","copyHash"],setup(i,{emit:e}){const t=e,r=[{key:"apply",label:"Apply Stash",icon:nk},{key:"pop",label:"Pop Stash",icon:S_},{key:"createBranch",label:"Create Branch from Stash",icon:X2,separator:!0},{key:"drop",label:"Drop Stash",icon:os,separator:!0,danger:!0},{key:"copyName",label:"Copy Stash Reference",icon:Xo,separator:!0},{key:"copyHash",label:"Copy Stash Hash",icon:xk}],s={apply:()=>t("apply"),pop:()=>t("pop"),drop:()=>t("drop"),createBranch:()=>t("createBranch"),copyName:()=>t("copyName"),copyHash:()=>t("copyHash")};function n(o){s[o]?.()}return(o,a)=>{const l=Jl;return y(),xe(l,{items:r,x:i.x,y:i.y,title:i.stashMessage,onClose:a[0]||(a[0]=c=>t("close")),onAction:n},null,8,["x","y","title"])}}}),X$=Xe({__name:"GitUncommittedMenu",props:{x:{},y:{}},emits:["close","stash","reset","clean"],setup(i,{emit:e}){const t=e,r=[{key:"stash",label:"Stash Uncommitted Changes",icon:sk},{key:"reset",label:"Reset Working Directory",icon:Kn,separator:!0,danger:!0},{key:"clean",label:"Clean Untracked Files",icon:os,danger:!0}],s={stash:()=>t("stash"),reset:()=>t("reset"),clean:()=>t("clean")};function n(o){s[o]?.()}return(o,a)=>{const l=Jl;return y(),xe(l,{items:r,x:i.x,y:i.y,title:"Uncommitted Changes",onClose:a[0]||(a[0]=c=>t("close")),onAction:n},null,8,["x","y"])}}});async function F$(i,e,t){try{return(await $fetch("/api/git/merge-base",{params:{workingDirectory:i,branch:e,baseBranch:t??void 0}})).mergeBase}catch{return null}}function av(i){const e={};for(const{branch:t,mergeBase:r}of i)t&&r&&(e[t]=r);return e}async function V$(i){return $fetch("/api/git/file-diff",{query:i})}async function q$(i){return $fetch("/api/git/diff",{query:i})}const Qu=xm("gitGraph",()=>{const i=N([]),e=N([]),t=N([]),r=N(new Set),s=N([]),n=N([]),o=N(0),a=N(!1),l=N(null),c=N(null),h=N(null),u=N(!1),d=N(null),f=N(!1),p=N(0),g=N(""),O=N([]),_=N(null),k=N(!1),P=N(!1),w=N(!1),C=N(!1),M=8e3,D=N(null);let j=null;function oe(re){D.value=re,j&&clearTimeout(j),j=setTimeout(()=>{D.value=null},M)}function ae(){D.value=null,j&&(clearTimeout(j),j=null)}async function G(re,fe,Ne,Ii){if(!_.value)return{success:!1,error:"No working directory set"};try{const Zr=await $fetch(re,{method:Ii?.method??"POST",body:{workingDirectory:_.value,...fe}});return(Ii?.reloadGraph??!0)&&await ut(_.value),{success:!0,data:Zr}}catch(Zr){const Xr=wc(Zr,Ne);return oe(Xr),{success:!1,error:Xr}}}const x=N(null),b=N(!1),T=N(!1),$=N(null),R=N([]),E=N([]),Z=N(null),K=N(null),X=N(null),V=N("inline"),ie=N("list"),q=N("rounded"),ee=N(!1),te=N({date:!0,author:!0,commit:!0}),Oe=N(0),Te=N(0),ke=N(null),Ze=N(null),Je=N(null),Ve=N(null),I=N(null),L=N(null),z=N(null),Q=N(null),J=N(null),de=N(null),Y=N(null),be=N(!1),Ce=C5(),rt=he(()=>{if(!g.value&&O.value.length===0)return i.value;let re=i.value;if(g.value&&(re=Ce.filter(re,g.value)),O.value.length>0){const fe=new Set(O.value);re=k5(re,fe)}return re}),ot=he(()=>e.value.find(re=>re.isHead)||null);async function ut(re){_.value=re,u.value=!0,d.value=null;try{const[fe,Ne,Ii,Zr,Xr]=await Promise.all([$fetch("/api/git/log",{query:{workingDirectory:re}}),$fetch("/api/git/status",{query:{workingDirectory:re}}),$fetch("/api/git/stash",{query:{workingDirectory:re}}).then(Ys=>Ys.stashes).catch(()=>[]),$fetch("/api/git/remotes",{query:{workingDirectory:re}}).then(Ys=>Ys.remotes).catch(()=>[]),$fetch("/api/git/state",{query:{workingDirectory:re}}).then(Ys=>Ys.state).catch(()=>null)]);i.value=fe.commits,e.value=fe.branches,t.value=fe.tags,r.value=new Set(fe.localBranches??[]),f.value=fe.hasMore,p.value=fe.totalCount,s.value=Ne.stagedFiles??[],n.value=Ne.unstagedFiles??[],o.value=(Ne.stagedCount??0)+(Ne.unstagedCount??0),R.value=Ii,E.value=Zr,$.value=Xr,x.value=Date.now(),await Hs()}catch(fe){const Ne=fe instanceof Error?fe.message:"Failed to load git graph";d.value=Ne,i.value=[],e.value=[],t.value=[],s.value=[],n.value=[],o.value=0,R.value=[],E.value=[]}finally{u.value=!1}}async function ce(){if(_.value)try{const re=await $fetch("/api/git/status",{query:{workingDirectory:_.value}});s.value=re.stagedFiles??[],n.value=re.unstagedFiles??[],o.value=(re.stagedCount??0)+(re.unstagedCount??0)}catch(re){console.error("Failed to refresh uncommitted changes:",re)}}const _e=N(!1);async function Se(){if(!(!_.value||!f.value||u.value||_e.value)){_e.value=!0;try{const re=await $fetch("/api/git/log",{query:{workingDirectory:_.value,offset:i.value.length}});i.value=[...i.value,...re.commits],f.value=re.hasMore}catch(re){console.error("Failed to load more commits:",re)}finally{_e.value=!1}}}async function Fe(re){if(l.value=re,c.value=null,h.value=null,a.value=!1,k.value=!0,!_.value){k.value=!1;return}try{const fe=await $fetch("/api/git/show",{query:{workingDirectory:_.value,hash:re.hash}});c.value=fe.files,h.value=fe.stats}catch(fe){console.error("Failed to load commit details:",fe),c.value=[],h.value={additions:0,deletions:0,filesChanged:0},oe("Failed to load commit details")}finally{k.value=!1}}function Ct(){l.value=null,c.value=null,h.value=null,a.value=!1}function fi(){l.value=null,h.value=null,c.value=null,a.value=!0}function vt(re){g.value=re,Oe.value=0,Ir()}const Cr=he(()=>g.value?z_(i.value,g.value).map(re=>re.hash):[]);function Ir(){Te.value=Cr.value.length}function ua(){Cr.value.length!==0&&(Oe.value=(Oe.value+1)%Cr.value.length,Ir(),Fs())}function da(){Cr.value.length!==0&&(Oe.value=Oe.value<=0?Cr.value.length-1:Oe.value-1,Ir(),Fs())}function Fs(){const re=Cr.value[Oe.value];if(re){const fe=i.value.find(Ne=>Ne.hash===re);fe&&Fe(fe)}}function ao(re){const fe=O.value.indexOf(re);fe===-1?O.value.push(re):O.value.splice(fe,1)}function fa(){g.value="",O.value=[]}async function lo(re){if(!_.value)return{success:!1,error:"No working directory set"};C.value=!0;try{const fe=await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:_.value,branchName:re}});return fe.success&&await ut(_.value),{success:fe.success,error:fe.error}}catch(fe){const Ne=fe instanceof Error?fe.message:"Failed to checkout branch";return oe(Ne),{success:!1,error:Ne}}finally{C.value=!1}}async function Cn(re,fe){if(!_.value)return{success:!1,error:"No working directory set"};try{const Ne=await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:_.value,branchName:re,createBranch:!0,fromCommit:fe}});return Ne.success&&await ut(_.value),{success:Ne.success,error:Ne.error}}catch(Ne){return{success:!1,error:Ne instanceof Error?Ne.message:"Failed to create branch"}}}async function co(re,fe=!1){return G("/api/git/branch",{branchName:re,force:fe},"Failed to delete branch",{method:"DELETE"})}async function pa(re){return G("/api/git/branch",{branchName:re,remote:!0},"Failed to delete remote branch",{method:"DELETE"})}async function ma(re){if(!_.value)return{success:!1,error:"No working directory set"};P.value=!0;try{return await $fetch("/api/git/stage",{method:"POST",body:{workingDirectory:_.value,files:re}}),await ce(),{success:!0}}catch(fe){const Ne=fe instanceof Error?fe.message:"Failed to stage files";return oe(Ne),{success:!1,error:Ne}}finally{P.value=!1}}async function ga(re){if(!_.value)return{success:!1,error:"No working directory set"};P.value=!0;try{return await $fetch("/api/git/unstage",{method:"POST",body:{workingDirectory:_.value,files:re}}),await ce(),{success:!0}}catch(fe){const Ne=fe instanceof Error?fe.message:"Failed to unstage files";return oe(Ne),{success:!1,error:Ne}}finally{P.value=!1}}async function zr(re){if(!_.value)return{success:!1,error:"No working directory set"};w.value=!0;try{return await $fetch("/api/git/commit",{method:"POST",body:{workingDirectory:_.value,message:re}}),await ut(_.value),{success:!0}}catch(fe){const Ne=fe instanceof Error?fe.message:"Failed to commit changes";return oe(Ne),{success:!1,error:Ne}}finally{w.value=!1}}async function va(re,fe){return G("/api/git/branch-rename",{oldName:re,newName:fe},"Failed to rename branch")}async function Oa(re,fe){return G("/api/git/merge",{branch:re,...fe},"Failed to merge branch")}async function _a(re){return G("/api/git/rebase",{onto:re},"Failed to rebase branch")}async function ba(re,fe,Ne,Ii){return G("/api/git/push",{branch:re,remote:fe,force:Ne,forceWithLease:Ii},"Failed to push branch")}async function ya(re,fe,Ne,Ii){return G("/api/git/pull",{branch:re,remote:fe,noFastForward:Ne,squash:Ii},"Failed to pull branch")}async function xa(re,fe,Ne){return G("/api/git/fetch",{branch:re,remote:fe,...Ne},"Failed to fetch")}async function wa(re,fe,Ne){return G("/api/git/cherry-pick",{hash:re,recordOrigin:fe,noCommit:Ne},"Failed to cherry-pick commit")}async function Sa(re){return G("/api/git/revert",{hash:re},"Failed to revert commit")}async function ka(re,fe){return G("/api/git/reset",{hash:re,mode:fe},"Failed to reset to commit")}async function Ca(re){if(!_.value)return{success:!1,error:"No working directory set"};try{return await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:_.value,branchName:re}}),await ut(_.value),{success:!0}}catch(fe){const Ne=fe?.data?.message||fe?.statusMessage||fe?.message||"Failed to checkout commit";return oe(Ne),{success:!1,error:Ne}}}async function $a(re){const fe=re.message.split(`
7
+ `)[0];return ve(fe)}async function Pa(re,fe,Ne,Ii,Zr){return G("/api/git/tag",{name:re,hash:fe,annotated:Ne,message:Ii,pushToRemote:Zr},"Failed to create tag")}async function Ta(re,fe){return G("/api/git/tag",{name:re,deleteFromRemote:fe},"Failed to delete tag",{method:"DELETE"})}async function Ma(re,fe){return G("/api/git/tag-push",{name:re,remote:fe},"Failed to push tag")}async function ho(re){if(!_.value)return{success:!1,error:"No working directory set"};try{return{success:!0,data:await $fetch(`/api/git/tag/${encodeURIComponent(re)}`,{query:{workingDirectory:_.value}})}}catch(fe){const Ne=wc(fe,"Failed to get tag detail");return oe(Ne),{success:!1,error:Ne}}}async function Qa(re){return ve(re)}async function qt(){if(!_.value)return{success:!1,error:"No working directory set"};try{const re=await $fetch("/api/git/stash",{query:{workingDirectory:_.value}});return R.value=re.stashes,{success:!0}}catch(re){const fe=wc(re,"Failed to load stashes");return oe(fe),{success:!1,error:fe}}}async function Jt(re,fe){return G("/api/git/stash-apply",{index:re,reinstateIndex:fe},"Failed to apply stash")}async function uo(re,fe){return G("/api/git/stash-pop",{index:re,reinstateIndex:fe},"Failed to pop stash")}async function Nr(re){return G("/api/git/stash-drop",{index:re},"Failed to drop stash")}async function Vs(re,fe){return G("/api/git/stash-branch",{index:re,branchName:fe},"Failed to create branch from stash")}async function $r(re,fe){return G("/api/git/stash",{message:re,includeUntracked:fe},"Failed to stash changes")}async function lr(){if(!_.value)return{success:!1,error:"No working directory set"};try{const re=await $fetch("/api/git/remotes",{query:{workingDirectory:_.value}});return E.value=re.remotes,{success:!0}}catch(re){const fe=wc(re,"Failed to load remotes");return oe(fe),{success:!1,error:fe}}}async function fo(re,fe){return G("/api/git/remote",{name:re,url:fe},"Failed to add remote")}async function Aa(re,fe){return G("/api/git/remote",{name:re,newUrl:fe},"Failed to edit remote",{method:"PUT"})}async function $n(re){return G("/api/git/remote",{name:re},"Failed to delete remote",{method:"DELETE"})}async function Pn(re,fe){return G("/api/git/fetch",{all:!0,prune:re,pruneTags:fe},"Failed to fetch all")}function zt(){V.value=V.value==="inline"?"bottom":"inline"}function Wr(){ie.value=ie.value==="list"?"tree":"list"}function cr(re){q.value=re}function po(){ee.value=!ee.value}function Ra(re){te.value={...te.value,[re]:!te.value[re]}}async function Pr(re,fe,Ne){if(!fe||!_.value){re.value=null;return}re.value=await F$(_.value,fe,Ne)}async function mo(re){ke.value=re,await Pr(Ze,re)}async function qs(re,fe){Je.value=re,I.value=fe??null,await Pr(Ve,re,fe)}async function Ba(re,fe){L.value=re,Q.value=fe??null,await Pr(z,re,fe)}async function Hs(){_.value&&await Promise.all([Pr(Ze,ke.value),Pr(Ve,Je.value,I.value),Pr(z,L.value,Q.value)])}function Ee(re){const fe=i.value.find(Ne=>Ne.hash===re||Ne.shortHash===re);fe&&Fe(fe)}async function me(re){return G("/api/git/reset",{hash:"HEAD",mode:re},"Failed to reset working directory")}async function Nt(){return G("/api/git/clean",{},"Failed to clean untracked files")}function Us(re){K.value=re}function gs(){K.value=null}function Tn(re){X.value=re}function La(){X.value=null}const vs=N(null),Os=N(null),A=N(!1),H=he(()=>!!Z.value&&!!l.value);function W(re){Z.value=re,re&&l.value&&ne()}function U(){Z.value=null,vs.value=null,Os.value=null,A.value=!1}async function ne(){if(!(!_.value||!l.value||!Z.value)){A.value=!0;try{const re=await q$({workingDirectory:_.value,from:Z.value.hash,to:l.value.hash});vs.value=re.files,Os.value=re.stats}catch(re){console.error("Failed to load comparison:",re),oe("Failed to load commit comparison"),vs.value=null,Os.value=null}finally{A.value=!1}}}async function ve(re){try{return await F2(re),{success:!0}}catch(fe){const Ne=fe?.message||"Failed to copy to clipboard";return oe(Ne),{success:!1,error:Ne}}}async function ge(re,fe){J.value=fe,de.value=re,Y.value=null,be.value=!0,await lt()}function Le(){J.value=null,de.value=null,Y.value=null,be.value=!1}async function lt(){if(!_.value||!de.value||!J.value){be.value=!1;return}be.value=!0;try{Y.value=await V$({workingDirectory:_.value,commitHash:de.value,filePath:J.value.path})}catch(re){console.error("Failed to load file diff:",re),oe("Failed to load file diff"),Y.value=null}finally{be.value=!1}}function Ge(){i.value=[],e.value=[],t.value=[],r.value=new Set,s.value=[],n.value=[],o.value=0,a.value=!1,l.value=null,c.value=null,h.value=null,u.value=!1,d.value=null,f.value=!1,p.value=0,g.value="",O.value=[],_.value=null,x.value=null,b.value=!1,T.value=!1,$.value=null,_e.value=!1,k.value=!1,P.value=!1,w.value=!1,C.value=!1,R.value=[],E.value=[],Z.value=null,vs.value=null,Os.value=null,A.value=!1,K.value=null,X.value=null,V.value="inline",ie.value="list",q.value="rounded",ee.value=!1,te.value={date:!0,author:!0,commit:!0},Oe.value=0,Te.value=0,ke.value=null,Je.value=null,Ve.value=null,I.value=null,L.value=null,z.value=null,Q.value=null,J.value=null,de.value=null,Y.value=null,be.value=!1,ae(),Ce.clear()}async function ft(){if(!_.value||T.value||u.value)return!1;T.value=!0;try{const re=(await $fetch("/api/git/state",{query:{workingDirectory:_.value}})).state,fe=$.value;if($.value=re,x.value=Date.now(),!fe)return!1;const Ne=fe.headCommit!==re.headCommit||fe.branchListHash!==re.branchListHash,Ii=fe.workingTreeHash!==re.workingTreeHash,Zr=fe.stashListHash!==re.stashListHash;if(Ne){const[js,Oc,T2]=await Promise.all([$fetch("/api/git/log",{query:{workingDirectory:_.value}}),$fetch("/api/git/status",{query:{workingDirectory:_.value}}),$fetch("/api/git/stash",{query:{workingDirectory:_.value}}).then(M2=>M2.stashes).catch(()=>[])]);return i.value=js.commits,e.value=js.branches,t.value=js.tags,r.value=new Set(js.localBranches??[]),f.value=js.hasMore,p.value=js.totalCount,s.value=Oc.stagedFiles??[],n.value=Oc.unstagedFiles??[],o.value=(Oc.stagedCount??0)+(Oc.unstagedCount??0),R.value=T2,await Hs(),!0}if(!Ii&&!Zr)return!1;const[Xr,Ys]=await Promise.all([Ii?$fetch("/api/git/status",{query:{workingDirectory:_.value}}):Promise.resolve(null),Zr?$fetch("/api/git/stash",{query:{workingDirectory:_.value}}).then(js=>js.stashes).catch(()=>[]):Promise.resolve(null)]);return Xr&&(s.value=Xr.stagedFiles??[],n.value=Xr.unstagedFiles??[],o.value=(Xr.stagedCount??0)+(Xr.unstagedCount??0)),Ys&&(R.value=Ys),!0}catch(re){return console.error("Failed to refresh git graph:",re),!1}finally{T.value=!1}}function go(){b.value=!0}function _s(){b.value=!1}return{commits:Be(i),branches:Be(e),tags:Be(t),localBranchNames:Be(r),stagedFiles:Be(s),unstagedFiles:Be(n),uncommittedChangesCount:Be(o),isUncommittedChangesSelected:Be(a),selectedCommit:Be(l),selectedCommitFiles:Be(c),selectedCommitStats:Be(h),loading:Be(u),loadingMore:Be(_e),error:Be(d),hasMore:Be(f),totalCount:Be(p),searchQuery:Be(g),filteredBranches:Be(O),workingDirectory:Be(_),stashes:Be(R),remotes:Be(E),comparisonCommit:Be(Z),comparisonFiles:Be(vs),comparisonStats:Be(Os),comparisonLoading:Be(A),isComparing:H,activeDialog:Be(K),activeContextMenu:Be(X),detailViewPosition:Be(V),fileViewMode:Be(ie),graphStyle:Be(q),muteNonAncestral:Be(ee),columnVisibility:Be(te),searchResultIndex:Be(Oe),searchResultCount:Be(Te),selectedFeatureId:Be(ke),featureMergeBase:Be(Ze),conversationBranch:Be(Je),conversationMergeBase:Be(Ve),conversationBaseBranch:Be(I),previewBranch:Be(L),previewMergeBase:Be(z),previewBaseBranch:Be(Q),diffViewerFile:Be(J),diffViewerCommitHash:Be(de),diffViewerContent:Be(Y),diffViewerLoading:Be(be),lastRefreshTime:Be(x),isPollingActive:Be(b),isRefreshing:Be(T),isLoadingDetails:Be(k),isStaging:Be(P),isCommitting:Be(w),isCheckingOut:Be(C),operationError:Be(D),filteredCommits:rt,currentBranch:ot,searchResultHashes:Cr,loadGitGraph:ut,loadMoreCommits:Se,refreshUncommittedChanges:ce,selectCommit:Fe,selectUncommittedChanges:fi,clearSelection:Ct,setSearchQuery:vt,toggleBranchFilter:ao,clearFilters:fa,nextSearchResult:ua,prevSearchResult:da,checkoutBranch:lo,createBranch:Cn,deleteLocalBranch:co,deleteRemoteBranch:pa,stageFiles:ma,unstageFiles:ga,commitChanges:zr,reset:Ge,clearOperationError:ae,renameBranch:va,mergeBranch:Oa,rebaseBranch:_a,pushBranch:ba,pullBranch:ya,fetchBranch:xa,cherryPickCommit:wa,revertCommit:Sa,resetToCommit:ka,checkoutCommit:Ca,copyCommitSubject:$a,createTag:Pa,deleteTag:Ta,pushTag:Ma,getTagDetail:ho,copyTagName:Qa,loadStashes:qt,applyStash:Jt,popStash:uo,dropStash:Nr,stashBranch:Vs,stashChanges:$r,loadRemotes:lr,addRemote:fo,editRemote:Aa,deleteRemote:$n,fetchAll:Pn,setActiveDialog:Us,clearActiveDialog:gs,setActiveContextMenu:Tn,clearActiveContextMenu:La,selectComparisonCommit:W,clearComparison:U,loadComparisonData:ne,copyToClipboard:ve,toggleDetailViewPosition:zt,toggleFileViewMode:Wr,setGraphStyle:cr,toggleMuteNonAncestral:po,toggleColumnVisibility:Ra,navigateToCommit:Ee,resetWorking:me,cleanUntracked:Nt,setSelectedFeatureId:mo,setConversationBranch:qs,setPreviewBranch:Ba,openFileDiff:ge,closeFileDiff:Le,checkAndRefresh:ft,startPolling:go,stopPolling:_s}});async function lv(){if(typeof window>"u")return{conversations:[],archivedConversations:[],discardedConversations:0,discardedArchives:0};try{const i=await $fetch("/api/conversations");if(!i||!Array.isArray(i.conversations))return console.warn("[conversationStorage] Invalid data structure from server"),{conversations:[],archivedConversations:[],discardedConversations:0,discardedArchives:0};i.version!==Eh&&console.warn(`[conversationStorage] Storage version mismatch: ${i.version} vs ${Eh}`);const e=i.conversations.map(l=>{if(!l||typeof l!="object")return l;const c=l,h={...c};return"claudeSessionId"in c&&!("providerSessionId"in c)&&(h.providerSessionId=c.claudeSessionId),typeof c.title=="string"&&(h.title=Sf(c.title)),h}),r=(Array.isArray(i.archivedConversations)?i.archivedConversations:[]).map(l=>{if(!l||typeof l!="object")return l;const c=l,h={...c};return"claudeSessionId"in c&&!("providerSessionId"in c)&&(h.providerSessionId=c.claudeSessionId),typeof c.title=="string"&&(h.title=Sf(c.title)),h}),s=e.filter(j2),n=r.filter(G2),o=e.length-s.length,a=r.length-n.length;return o>0&&console.warn(`[conversationStorage] Discarded ${o} corrupted active conversation(s)`),a>0&&console.warn(`[conversationStorage] Discarded ${a} corrupted archive conversation(s)`),{conversations:s,archivedConversations:n,discardedConversations:o,discardedArchives:a}}catch(i){return console.error("[conversationStorage] Failed to load conversations:",i),{conversations:[],archivedConversations:[],discardedConversations:0,discardedArchives:0}}}async function H$(i,e=[]){if(typeof window>"u")return!1;try{return await $fetch("/api/conversations",{method:"POST",body:{version:Eh,conversations:i,archivedConversations:e}}),!0}catch(t){return console.error("Failed to save conversations:",t),!1}}async function U$(i){if(typeof window>"u")return!1;try{return await $fetch("/api/conversations/update",{method:"POST",body:{version:Eh,conversation:i}}),!0}catch(e){return console.error("Failed to save conversation:",e),!1}}function Sc(i){i.contentBlocks&&(i.content=V2(i.contentBlocks))}function Y$(i,e){if(i.type!==e.type)return!0;switch(e.type){case"text":return i.text!==e.text;case"tool_use":{const t=i;return t.name!==e.name||t.inputSummary!==e.inputSummary}case"tool_result":{const t=i;return t.content!==e.content||t.isError!==e.isError}default:return!1}}function j$(i,e,t="info",r,s=Date.now,n=Math.random){return{id:`conflict-msg-${s()}-${n().toString(36).slice(2,7)}`,role:i,content:e,timestamp:s(),type:t,fileRef:r}}function G$(i,e){return e===0?{message:`All ${i} file${i===1?"":"s"} resolved successfully. Click "Continue Rebase" to proceed.`,succeeded:!0}:{message:`Resolution complete: ${i} succeeded, ${e} failed. You can retry or abort.`,succeeded:!1}}function K$(i,e){const t=[];for(let r=0;r<i.length;r+=e)t.push(i.slice(r,r+e));return t}function J$(i,e){return i.filter(t=>!e.has(t.path))}function e3(i){return`Detected ${i} conflicted file${i===1?"":"s"}. Enter optional guidance below and click "Resolve Conflicts Automatically" to start.`}function t3(i){return`Starting AI resolution for ${i} file${i===1?"":"s"} (parallel)...`}async function i3(i){return $fetch("/api/chat/preview",{method:"POST",body:i})}async function r3(i){return $fetch("/api/chat/preview",{method:"DELETE",body:i})}function s3(i,e){return i===e?{kind:"end-current",id:e}:i?{kind:"swap",endId:i,startId:e}:{kind:"start",id:e}}function n3(i){const e=new Map,t=i.setTimer??setTimeout,r=i.clearTimer??clearTimeout;function s(l){if(e.has(l))return;const c=t(()=>{e.delete(l),i.onFlush(l)},i.delayMs);e.set(l,c)}function n(l){const c=e.get(l);c&&(r(c),e.delete(l)),i.onFlush(l)}function o(l){const c=e.get(l);c&&(r(c),e.delete(l))}function a(){for(const l of e.values())r(l);e.clear()}return{schedule:s,flush:n,cancel:o,cancelAll:a,hasPending:l=>e.has(l),pendingCount:()=>e.size}}async function o3(i){return $fetch("/api/chat/finalize",{method:"POST",body:i})}async function a3(i){return $fetch("/api/chat/rebase",{method:"POST",body:i})}async function l3(i){return $fetch("/api/rebase/conflicts",{params:{worktreePath:i}})}async function c3(i){const{signal:e,...t}=i;return $fetch("/api/rebase/resolve",{method:"PUT",body:t,signal:e})}async function h3(i){const e=i.mode==="sync"?"/api/rebase/continue-sync":"/api/rebase/continue",{mode:t,...r}=i;return $fetch(e,{method:"POST",body:r})}async function cv(i){return $fetch("/api/rebase/abort",{method:"POST",body:{worktreePath:i}})}async function u3(i){const{signal:e,...t}=i;return $fetch("/api/rebase/ai-resolve",{method:"POST",body:t,signal:e})}const kc="New Conversation",Lr=xm("chat",()=>{const i=N(!1),e=N(K2),t=N("ask"),r=N(""),s=N([]),n=N([]),o=N(null),a=N("active"),l=N(new Set),c=new Map,h=N(!1),u=N(0),f=n3({delayMs:1200,onFlush:A=>{const H=s.value.find(W=>W.id===A);H&&(H.updatedAt=new Date().toISOString(),U$(H))}}),p=N(null),g=N(null);let O=null,_=!1;function k(A){return A?c.get(A)??null:null}function P(A){let H=c.get(A);return H||(H={session:null,pendingPermission:null,pendingPlanApproval:null,lastError:null,debugEvents:[]},c.set(A,H)),H}const w=he(()=>s.value.find(A=>A.id===o.value)||null),C=he(()=>w.value?.messages??[]),M=he(()=>(u.value,k(o.value)?.session??null)),D=he(()=>(u.value,k(o.value)?.pendingPermission??null)),j=he(()=>(u.value,k(o.value)?.pendingPlanApproval??null)),oe=he(()=>(u.value,k(o.value)?.lastError??null)),ae=he(()=>(u.value,k(o.value)?.debugEvents??[])),G=he(()=>M.value?.status==="streaming"),x=he(()=>w.value?.providerSessionId??""),b=he(()=>C.value.length>0),T=he(()=>C.value[C.value.length-1]||null);function $(A){if(l.value.has(A))return!0;u.value;const H=c.get(A);if(H?.pendingPermission||H?.pendingPlanApproval)return!1;const W=s.value.find(U=>U.id===A);if(!W)return!1;for(let U=W.messages.length-1;U>=0;U--){const ne=W.messages[U];if(ne.role==="assistant")return ne.status==="streaming"}return!1}function R(A){return l.value.has(A)}const E=he(()=>o.value?$(o.value):!1),Z=he(()=>s.value.length>0),K=he(()=>n.value.length>0),X=he(()=>s.value.length),V=he(()=>X.value>=Gg),ie=he(()=>s.value),q=he(()=>n.value),ee=he(()=>p.value&&s.value.find(A=>A.id===p.value)||null);function te(A){return p.value===A}function Oe(A){a.value=A}function Te(){typeof window>"u"||$fetch("/api/settings",{method:"POST",body:{activeConversationId:o.value,isPanelOpen:i.value}}).catch(A=>{console.error("Failed to save active conversation state:",A)})}function ke(){const A=o.value,W=(A?s.value.find(U=>U.id===A):null)??s.value[0]??null;o.value=W?.id??null,W?.cwd&&(r.value=W.cwd),W||(i.value=!1),o.value!==A&&Te()}async function Ze(A){if(!(!A?.previewBranch||!A.worktreePath))try{await Mk({previewBranch:A.previewBranch,worktreePath:A.worktreePath})}catch(H){console.warn("[chat] Failed to sync preview branch after worktree update",{conversationId:A.id,previewBranch:A.previewBranch,worktreePath:A.worktreePath,error:H instanceof Error?H.message:String(H)})}}async function Je(A){if(R(A))return{success:!1,error:"Cannot archive while this conversation is streaming"};if(s.value.findIndex(W=>W.id===A)===-1)return{success:!1,error:"Conversation not found"};try{const W=await $fetch(`/api/conversations/${A}/archive`,{method:"POST"});return W.success&&W.archived?(f.cancel(A),c.delete(A),s.value=s.value.filter(U=>U.id!==A),n.value=[W.archived,...n.value],Nr(),Vs(),p.value===A&&(p.value=null),o.value===A&&(o.value=s.value[0]?.id??null),typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:o.value}}).catch(U=>{console.error("Failed to save active conversation:",U)}),{success:!0}):{success:!1,error:"Failed to archive conversation"}}catch(W){return{success:!1,error:W instanceof Error?W.message:"Failed to archive conversation"}}}async function Ve(A,H){if(Tn().atLimit)return{success:!1,error:`Cannot restore. Active conversations reached ${Kg}.`};if(!n.value.some(U=>U.id===A))return{success:!1,error:"Archived conversation not found"};try{const U=await $fetch(`/api/conversations/archives/${A}/restore`,{method:"POST",body:{baseBranch:H}});return U.success&&U.conversation?(s.value=Array.isArray(U.conversations)?U.conversations:[U.conversation,...s.value],Array.isArray(U.archivedConversations)?n.value=U.archivedConversations:n.value=n.value.filter(ne=>ne.id!==A),a.value="active",lr(U.conversation.id),Nr(),qt(),{success:!0,conversationId:U.conversation.id}):{success:!1,error:"Failed to restore archived conversation"}}catch(U){return{success:!1,error:U instanceof Error?U.message:"Failed to restore archived conversation"}}}async function I(A){const H=n.value.findIndex(W=>W.id===A);if(H===-1)return{success:!1,error:"Archived conversation not found"};try{return await $fetch(`/api/conversations/archives/${A}`,{method:"DELETE"}),n.value.splice(H,1),Vs(),{success:!0}}catch{return n.value.splice(H,1),qt(),{success:!0}}}async function L(){const A=n.value.length;if(A===0)return{success:!0,deletedCount:0};try{return await $fetch("/api/conversations/archives",{method:"DELETE"}),n.value=[],{success:!0,deletedCount:A}}catch{return n.value=[],qt(),{success:!0,deletedCount:A}}}async function z(){if(!(typeof window>"u"))try{const A=await $fetch("/api/settings");if(A){if(typeof A.panelWidth=="number"){const U=A.panelWidth;U>=Jg&&U<=ev&&(e.value=U)}typeof A.isPanelOpen=="boolean"&&(i.value=A.isPanelOpen),typeof A.activeConversationId=="string"&&(o.value=A.activeConversationId);const{useSettingsStore:H}=await dh(async()=>{const{useSettingsStore:U}=await import("./D_4Ow2w2.js").then(ne=>ne.n);return{useSettingsStore:U}},__vite__mapDeps([0,1,2]),import.meta.url),W=H();await W.hydrate(),t.value=W.permissionMode}}catch(A){console.error("Failed to load chat settings:",A)}}function Q(A){t.value=A,typeof window<"u"&&dh(async()=>{const{useSettingsStore:H}=await import("./D_4Ow2w2.js").then(W=>W.n);return{useSettingsStore:H}},__vite__mapDeps([0,1,2]),import.meta.url).then(({useSettingsStore:H})=>{H().setPermissionMode(A)})}function J(A,H){const W=H??o.value;if(!W)return;const U=P(W);U.pendingPermission=A,u.value++}function de(A){const H=A??o.value;if(!H)return;const W=c.get(H);W&&(W.pendingPermission=null,u.value++)}function Y(A,H){const W=H??o.value;if(!W)return;const U=P(W);U.pendingPlanApproval=A,u.value++}function be(A){const H=A??o.value;if(!H)return;const W=c.get(H);W&&(W.pendingPlanApproval=null,u.value++)}function Ce(){i.value=!i.value,ut()}function rt(){i.value=!0,ut()}function ot(){i.value=!1,ut()}function ut(){typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{isPanelOpen:i.value}}).catch(A=>{console.error("Failed to save panel state:",A)})}function ce(A){const H=Math.max(Jg,Math.min(ev,A));e.value=H,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{panelWidth:H}}).catch(W=>{console.error("Failed to save panel width:",W)})}function _e(A){r.value=A}function Se(A,H){const W=H??o.value;if(!W)return;const U=s.value.find(ne=>ne.id===W);U&&(U.providerSessionId=A)}function Fe(A,H){const W=s.value.find(U=>U.id===A);W&&(W.worktreeBranch=H,W.lastCommitTime=new Date().toISOString())}function Ct(A,H){const W=s.value.find(U=>U.id===A);W&&(H.worktreePath&&(W.cwd=H.worktreePath,W.worktreePath=H.worktreePath,W.hasWorktree=!0),H.worktreeBranch&&(W.worktreeBranch=H.worktreeBranch),H.baseBranch&&(W.baseBranch=H.baseBranch),W.updatedAt=new Date().toISOString(),Jt(A))}async function fi(A){const H=s.value.find(U=>U.id===A);if(!H?.worktreeBranch)return null;const W=H.worktreeBranch.trim();if(!W)return null;try{const ne=(await $fetch("/api/specs/features")).features.find(ve=>ve.id===W);return ne?(H.featureId!==ne.id&&(H.featureId=ne.id,H.updatedAt=new Date().toISOString(),qt()),ne.id):null}catch(U){return console.warn("[chat] Failed to map branch to feature",{conversationId:A,branchName:W,error:U instanceof Error?U.message:String(U)}),null}}function vt(A,H,W){const U=s.value.find(ne=>ne.id===A);U&&(U.providerId=H,W!==void 0&&(U.providerModelKey=W))}function Cr(A){const H=A??o.value;if(!H)return;const W=s.value.find(U=>U.id===H);W&&(W.providerSessionId="")}function Ir(A){return s.value.find(W=>W.id===A)?.providerSessionId??""}function ua(A){l.value.add(A)}function da(A){l.value.delete(A)}function Fs(A,H){const W=H??o.value;if(!W)return;const U=s.value.find(ne=>ne.id===W);U&&U.messages.push(A)}function ao(A,H,W){const U={id:tv(),role:"user",content:A,attachments:W&&W.length>0?W:void 0,timestamp:new Date().toISOString()};return Fs(U,H),gs(H),U}function fa(A){const H={id:tv(),role:"assistant",content:"",timestamp:new Date().toISOString(),status:"streaming"};return Fs(H,A),H}function lo(A,H,W){const U=W??o.value;if(!U)return;const ne=s.value.find(ge=>ge.id===U);if(!ne)return;const ve=ne.messages.findIndex(ge=>ge.id===A);ve!==-1&&(ne.messages[ve]={...ne.messages[ve],...H})}function Cn(A,H){const W=s.value.find(ne=>ne.id===H);if(!W)return;const U=W.messages.findIndex(ne=>ne.id===A);U!==-1&&(W.messages[U]={...W.messages[U],content:"",status:"streaming",contentBlocks:[]})}function co(A,H,W){const U=W??o.value;if(!U)return;const ne=s.value.find(ge=>ge.id===U);if(!ne)return;const ve=ne.messages.findIndex(ge=>ge.id===A);ve!==-1&&(ne.messages[ve].content+=H)}function pa(A,H,W){const U=W??o.value;if(!U)return;const ne=s.value.find(ge=>ge.id===U);if(!ne)return;const ve=ne.messages.findIndex(ge=>ge.id===A);if(ve!==-1){const ge=ne.messages[ve],Le=ge.tools?[...ge.tools,H]:[H];ne.messages[ve]={...ge,tools:Le}}}function ma(A,H,W,U){const ne=U??o.value;if(!ne)return;const ve=s.value.find(Le=>Le.id===ne);if(!ve)return;const ge=ve.messages.findIndex(Le=>Le.id===A);if(ge!==-1){const Le=ve.messages[ge];if(Le.tools){const lt=Le.tools.findIndex(Ge=>Ge.id===H);if(lt!==-1){const Ge=[...Le.tools];Ge[lt]={...Ge[lt],...W},ve.messages[ge]={...Le,tools:Ge}}}}Jt(ne,!1)}function ga(A,H){const W=H??o.value;if(!W)return;const U=s.value.find(ve=>ve.id===W);if(!U)return;const ne=U.messages.find(ve=>ve.id===A);ne&&!ne.contentBlocks&&(ne.contentBlocks=[])}function zr(A,H,W){const U=W??o.value;if(!U)return;const ne=s.value.find(ge=>ge.id===U);if(!ne)return;const ve=ne.messages.find(ge=>ge.id===A);ve&&(ve.contentBlocks||(ve.contentBlocks=[]),ve.contentBlocks.push(H),Sc(ve))}function va(A,H,W,U){const ne=U??o.value;if(!ne)return;const ve=s.value.find(ft=>ft.id===ne);if(!ve)return;const ge=ve.messages.find(ft=>ft.id===A);if(!ge?.contentBlocks)return;const Le=ge.contentBlocks.findIndex(ft=>ft.id===H);if(Le===-1)return;const Ge={...ge.contentBlocks[Le]};W(Ge),ge.contentBlocks[Le]=Ge}function Oa(A,H,W,U,ne){const ve=U??o.value;if(!ve)return;const ge=s.value.find(_s=>_s.id===ve);if(!ge)return;const Le=ge.messages.find(_s=>_s.id===A);if(!Le?.contentBlocks)return;const lt=Le.contentBlocks.findIndex(_s=>_s.id===H);if(lt===-1)return;const Ge=Le.contentBlocks[lt],ft={...Ge};W(ft),Le.contentBlocks[lt]=ft,ne?.syncContent!==!1&&Y$(Ge,ft)&&Sc(Le),Jt(ve,!1)}function _a(A,H,W){const U=W??o.value;if(!U)return;const ne=s.value.find(ge=>ge.id===U);if(!ne)return;const ve=ne.messages.find(ge=>ge.id===A);ve&&(ve.contentBlocks||(ve.contentBlocks=[]),ve.contentBlocks.push(H),Sc(ve),Jt(U,!1))}function ba(A,H,W){const U=W??o.value;if(!U)return null;const ne=s.value.find(ge=>ge.id===U);if(!ne)return null;const ve=ne.messages.find(ge=>ge.id===A);return ve?.contentBlocks?ve.contentBlocks.find(ge=>ge.type==="tool_use"&&ge.toolUseId===H)??null:null}function ya(A,H,W,U,ne){const ve=s.value.find(Le=>Le.id===ne);if(!ve)return;const ge=ve.messages.findIndex(Le=>Le.id===A);ge!==-1&&(ve.messages[ge]={...ve.messages[ge],content:W,contentBlocks:H,status:U},Jt(ne,!0))}function xa(A,H){const W=H??o.value;if(!W)return;const U=c.get(W);U?.session&&(U.session.status=A,u.value++)}function wa(A,H){const W=H??o.value;if(!W)return;const U=P(W);U.session={sessionId:A,cwd:r.value,status:"streaming",startedAt:new Date().toISOString()},U.lastError=null,u.value++}function Sa(A){const H=A??o.value;if(!H)return;const W=c.get(H);W?.session&&(W.session.status="idle",u.value++)}function ka(A,H){const W=H??o.value;if(!W)return;const U=P(W);U.session&&(U.session.status="error",U.session.error=A),U.lastError=A,u.value++}function Ca(A,H){if(!h.value)return;const W=H??o.value;if(!W)return;const U=P(W),ne=(()=>{if(typeof A.payload=="string")return A.payload;try{return JSON.stringify(A.payload,null,2)}catch{return String(A.payload)}})(),ve=8e3,ge=300,Le=ne.length>ve?`${ne.slice(0,ve)}
8
+ ... (truncated)`:ne;U.debugEvents.push({id:`dbg-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,timestamp:new Date().toISOString(),direction:A.direction,channel:A.channel,eventType:A.eventType||"unknown",payload:Le}),U.debugEvents.length>ge&&U.debugEvents.splice(0,U.debugEvents.length-ge),u.value++}function $a(A){h.value=A}function Pa(A){const H=A??o.value;if(!H)return;const W=c.get(H);W&&(W.debugEvents=[],u.value++)}function Ta(){if(!o.value)return;const A=s.value.find(W=>W.id===o.value);A&&(A.messages=[]);const H=o.value;c.delete(H),u.value++}function Ma(A){const H=A??o.value;if(!H)return;const W=c.get(H);W&&(W.lastError=null,W.session&&(W.session.error=void 0),u.value++)}async function ho(){const A=await lv();if(s.value=A.conversations,n.value=A.archivedConversations,A.discardedArchives>0&&console.warn(`[chat] Skipped ${A.discardedArchives} corrupted archived conversation(s)`),Nr(),Vs(),!p.value){const H=s.value.find(W=>!!W.previewBranch&&!W.finalized);H&&(p.value=H.id)}ke()}async function Qa(){const A=await lv(),H=new Map(s.value.map(ge=>[ge.id,ge])),W=new Set(A.conversations.map(ge=>ge.id));let U=0,ne=0,ve=0;for(const ge of A.conversations){const Le=H.get(ge.id);if(!Le)s.value.push(ge),H.set(ge.id,ge),U++,console.log(`[chat] refresh: added new conversation ${ge.id} (source=${ge.source}, msgs=${ge.messages.length})`);else if(ge.source!=="user"&&(ge.messages.length>Le.messages.length||ge.updatedAt>(Le.updatedAt||""))){const lt=s.value.findIndex(Ge=>Ge.id===ge.id);lt!==-1&&(s.value.splice(lt,1,ge),console.log(`[chat] refresh: updated conversation ${ge.id} (msgs: ${Le.messages.length} → ${ge.messages.length}, updatedAt: ${Le.updatedAt} → ${ge.updatedAt})`)),ne++}else Le&&ge.messages.length!==Le.messages.length&&console.log(`[chat] refresh: skipped update for ${ge.id} (source=${ge.source}, server msgs=${ge.messages.length}, local msgs=${Le.messages.length})`)}for(let ge=s.value.length-1;ge>=0;ge--){const Le=s.value[ge];if(!W.has(Le.id)&&!l.value.has(Le.id)){if(console.log(`[chat] refresh: removed conversation ${Le.id} (no longer on server)`),o.value===Le.id){const lt=s.value.find(Ge=>Ge.id!==Le.id)??null;o.value=lt?.id??null,lt?.cwd&&(r.value=lt.cwd),lt||(i.value=!1),Te()}s.value.splice(ge,1),ve++}}return A.archivedConversations&&(n.value=A.archivedConversations),(U>0||ne>0||ve>0)&&Nr(),console.log(`[chat] refreshServerConversations: loaded=${A.conversations.length}, added=${U}, updated=${ne}, removed=${ve}`),U+ne+ve}function qt(){H$(s.value,n.value)}function Jt(A,H=!1){s.value.find(U=>U.id===A)&&(H?f.flush(A):f.schedule(A))}function uo(A=!1){o.value&&Jt(o.value,A)}function Nr(){s.value.sort((A,H)=>new Date(H.createdAt).getTime()-new Date(A.createdAt).getTime())}function Vs(){n.value.sort((A,H)=>new Date(H.archivedAt).getTime()-new Date(A.archivedAt).getTime())}async function $r(A){if(Tn().atLimit)return"";const W=J2();let U=null;if(A?.featureId){const Ge=await sv({conversationId:W,featureId:A.featureId,baseBranch:A.baseBranch});if(!Ge.success&&Ge.error)throw new Error(Ge.error);U=Ge}let ne=null;if(typeof window<"u")try{const{useSettingsStore:Ge}=await dh(async()=>{const{useSettingsStore:go}=await import("./D_4Ow2w2.js").then(_s=>_s.n);return{useSettingsStore:go}},__vite__mapDeps([0,1,2]),import.meta.url),ft=Ge();await ft.hydrate(),ne=ft.providerSelection}catch(Ge){console.warn("[chat] Failed to load provider selection for new conversation",Ge)}const ve=ne||{providerId:dl,modelKey:ek},ge=A?.providerId||ve.providerId,Le=A?.providerModelKey||(A?.providerId?void 0:ve.modelKey),lt={id:W,title:kc,messages:[],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),cwd:r.value||process.cwd?.()||"",source:A?.featureId?"cascade":"user",featureId:A?.featureId,providerId:ge,providerModelKey:Le};if(U?.success&&U.worktreePath&&U.branch&&(lt.worktreePath=U.worktreePath,lt.worktreeBranch=U.branch,lt.cwd=U.worktreePath,lt.hasWorktree=!0,U.baseBranch&&(lt.baseBranch=U.baseBranch)),s.value.unshift(lt),o.value=W,i.value=!0,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:W,isPanelOpen:!0}}).catch(Ge=>{console.error("Failed to save active conversation:",Ge)}),!A?.featureId)try{const Ge=await sv({conversationId:W,baseBranch:A?.baseBranch});if(Ge.success&&Ge.worktreePath&&Ge.branch){const ft=s.value.find(go=>go.id===W);ft&&(ft.worktreePath=Ge.worktreePath,ft.worktreeBranch=Ge.branch,ft.cwd=Ge.worktreePath,ft.hasWorktree=!0,Ge.baseBranch&&(ft.baseBranch=Ge.baseBranch))}}catch(Ge){console.warn("[chat] Failed to create worktree for conversation",W,Ge)}return Jt(W,!0),W}function lr(A){const H=s.value.find(W=>W.id===A);H&&(o.value=A,i.value=!0,H.cwd&&(r.value=H.cwd),!H.featureId&&H.worktreeBranch&&fi(A),typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:A,isPanelOpen:!0}}).catch(W=>{console.error("Failed to save active conversation:",W)}))}async function fo(A){const H=s.value.findIndex(U=>U.id===A);if(H===-1)return;const W=s.value[H];if(p.value===A&&(p.value=null),W.hasWorktree&&W.worktreePath&&W.worktreeBranch)try{await Tk({worktreePath:W.worktreePath,branch:W.worktreeBranch,conversationId:A})}catch(U){console.warn("[chat] Failed to clean up worktree for conversation",A,U)}s.value.splice(H,1),c.delete(A),l.value.delete(A),f.cancel(A),o.value===A&&(o.value=null,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:null}}).catch(U=>{console.error("Failed to clear active conversation:",U)})),qt()}async function Aa(A,H,W){const U=s.value.find(ve=>ve.id===A);if(!U)return{success:!1,error:"Conversation not found"};if(!U.hasWorktree)return{success:!1,error:"No worktree associated with this conversation"};const ne=W||U.baseBranch;try{const ve=await o3({conversationId:A,commitMessage:H,baseBranch:ne,worktreePath:U.worktreePath,worktreeBranch:U.worktreeBranch,previewBranch:U.previewBranch});return ve.success?(p.value===A&&(p.value=null),U.worktreePath=void 0,U.worktreeBranch=void 0,U.hasWorktree=!1,U.baseBranch=void 0,U.previewBranch=void 0,U.finalized=!0,U.updatedAt=new Date().toISOString(),qt()):ve.rebaseInProgress&&(await Pn(A,U.worktreePath,ne||"main",H),qs().catch(()=>{})),ve}catch(ve){return{success:!1,error:ve instanceof Error?ve.message:String(ve)}}}async function $n(A,H){const W=s.value.find(ne=>ne.id===A);if(!W)return{success:!1,error:"Conversation not found"};if(!W.hasWorktree)return{success:!1,error:"No worktree associated with this conversation"};const U=H||W.baseBranch;try{const ne=await a3({conversationId:A,baseBranch:U,worktreePath:W.worktreePath});return ne.rebaseInProgress?(await Pn(A,W.worktreePath,U||"main","","sync"),qs().catch(()=>{})):ne.success&&(await Ze(W),W.baseBranch=U,qt()),ne}catch(ne){return{success:!1,error:ne instanceof Error?ne.message:String(ne)}}}async function Pn(A,H,W,U,ne="finalize"){g.value={conversationId:A,worktreePath:H,baseBranch:W,commitMessage:U,files:[],resolvedFiles:new Set,loading:!0,error:null,mode:ne,retryCount:0,strategy:"auto",chatMessages:[],userGuidance:"",lifecycleState:"detected"};try{const ve=await l3(H);g.value&&(g.value.files=ve.files,g.value.loading=!1,zt("system",e3(ve.files.length),"info"))}catch(ve){g.value&&(g.value.error=ve instanceof Error?ve.message:String(ve),g.value.loading=!1)}}function zt(A,H,W="info",U){g.value&&g.value.chatMessages.push(j$(A,H,W,U))}function Wr(A){g.value&&(g.value.userGuidance=A)}async function cr(A,H,W){if(!g.value||W?.aborted)return!1;try{const U=await c3({worktreePath:g.value.worktreePath,filePath:A,content:H,signal:W});return U.success&&g.value&&g.value.resolvedFiles.add(A),U.success}catch{return!1}}async function po(){if(!g.value)return{success:!1,error:"No conflict resolution in progress"};const{conversationId:A,commitMessage:H,baseBranch:W,mode:U,worktreePath:ne}=g.value;try{const ve=s.value.find(Le=>Le.id===A),ge=await h3({mode:U,conversationId:A,commitMessage:H,baseBranch:W,worktreePath:ne,worktreeBranch:ve?.worktreeBranch,previewBranch:ve?.previewBranch});if(ge.success){if(U==="finalize"){p.value===A&&(p.value=null);const Le=s.value.find(lt=>lt.id===A);Le&&(Le.worktreePath=void 0,Le.worktreeBranch=void 0,Le.hasWorktree=!1,Le.baseBranch=void 0,Le.previewBranch=void 0,Le.finalized=!0,Le.updatedAt=new Date().toISOString(),qt())}else if(U==="sync"){const Le=s.value.find(lt=>lt.id===A);Le&&(await Ze(Le),Le.baseBranch=W,Le.updatedAt=new Date().toISOString(),qt())}g.value=null}else ge.rebaseInProgress&&await Pn(A,ne,W,H,U);return ge}catch(ve){return{success:!1,error:ve instanceof Error?ve.message:String(ve)}}}async function Ra(){if(!g.value)return!1;try{const A=await cv(g.value.worktreePath);return g.value=null,A.success}catch{return g.value=null,!1}}async function Pr(A,H){if(!g.value||H?.aborted)return!1;const W=g.value.files.find(U=>U.path===A);if(!W)return!1;try{const U=await u3({worktreePath:g.value.worktreePath,filePath:A,conflictContent:W.content,userGuidance:g.value.userGuidance||void 0,signal:H});if(H?.aborted)return!1;if(U.success&&U.resolvedContent!==void 0){W.content=U.resolvedContent;const ne=await cr(A,U.resolvedContent,H);return ne?zt("assistant",`Resolved: ${A}`,"success",A):zt("assistant",`Failed to write resolved content for ${A}`,"error",A),ne}return zt("assistant",`Failed to resolve ${A}: ${U.error||"Unknown error"}`,"error",A),!1}catch(U){const ne=U instanceof Error?U.message:String(U);return zt("assistant",`Error resolving ${A}: ${ne}`,"error",A),!1}}async function mo(){if(!g.value)return;const A=J$(g.value.files,g.value.resolvedFiles);if(A.length===0){zt("system","All files are already resolved.","info");return}const H=new AbortController;O=H;const W=H.signal;g.value.lifecycleState="resolving";const U=g.value.userGuidance;U&&zt("user",U),zt("system",t3(A.length),"info");let ne=0,ve=0;const ge=K$(A,3);for(const lt of ge){if(!g.value||W.aborted)break;for(const ft of lt)zt("assistant",`Resolving: ${ft.path}...`,"progress",ft.path);const Ge=await Promise.all(lt.map(ft=>Pr(ft.path,W)));for(const ft of Ge)ft?ne++:ve++}if(O===H&&(O=null),!g.value||W.aborted)return;const Le=G$(ne,ve);g.value.lifecycleState=Le.succeeded?"resolved":"failed",zt("system",Le.message,"summary")}async function qs(){if(_)return;_=!0;const A=20;try{for(let H=0;H<A;H++){const W=g.value;if(!W||W.error||W.lifecycleState==="resolving")return;await mo();const U=g.value;if(!U)return;if(U.lifecycleState!=="resolved"){zt("system","Automatic resolution needs help on the remaining conflicts. Review them, add guidance, or abort.","info");return}const ne=await po();if(!g.value)return;if(!ne.rebaseInProgress){zt("system",`Could not continue the rebase: ${ne.error||"unknown error"}.`,"error");return}}zt("system","Reached the automatic resolution limit. Continue manually to finish.","info")}finally{_=!1}}async function Ba(){if(!g.value)return;O&&(O.abort(),O=null);const{worktreePath:A}=g.value;zt("system","Resolution cancelled. Resetting conflict state...","info");try{await cv(A)}catch{}g.value=null}async function Hs(A){const H=s.value.find(W=>W.id===A);if(!H)return{success:!1,error:"Conversation not found"};if(!H.hasWorktree||!H.worktreePath||!H.baseBranch)return{success:!1,error:"No worktree to preview"};try{const W=await i3({conversationId:A,worktreePath:H.worktreePath,baseBranch:H.baseBranch});return W.success&&W.previewBranch&&(H.previewBranch=W.previewBranch,p.value=A,H.updatedAt=new Date().toISOString(),qt()),{success:W.success,error:W.error}}catch(W){return{success:!1,error:W instanceof Error?W.message:String(W)}}}async function Ee(A){const H=s.value.find(W=>W.id===A);if(!H)return{success:!1,error:"Conversation not found"};if(!H.previewBranch||!H.baseBranch)return p.value=null,{success:!1,error:"No active preview"};try{const W=await r3({previewBranch:H.previewBranch,baseBranch:H.baseBranch});return W.success&&(H.previewBranch=void 0,p.value=null,H.updatedAt=new Date().toISOString(),qt()),{success:W.success,error:W.error}}catch(W){return{success:!1,error:W instanceof Error?W.message:String(W)}}}async function me(A){const H=s3(p.value,A);if(H.kind==="end-current")return await Ee(H.id);if(H.kind==="swap"){const W=await Ee(H.endId);return W.success?await Hs(H.startId):{success:!1,error:`Failed to end previous preview: ${W.error}`}}return await Hs(H.id)}function Nt(A){const H=A.trim();if(!H)return null;const W=s.value.filter(U=>U.featureId===H?!0:U.worktreeBranch?.trim()===H);return W.length===0?null:W.sort((U,ne)=>new Date(ne.updatedAt).getTime()-new Date(U.updatedAt).getTime())[0]||null}function Us(A,H){const W=s.value.find(U=>U.id===A);W&&(W.title=Sf(H),W.updatedAt=new Date().toISOString(),Nr(),qt())}function gs(A){const H=A??o.value;if(!H)return;const W=s.value.find(ne=>ne.id===H);if(!W||W.title.trim().toLowerCase()!==kc.toLowerCase())return;const U=W.messages.find(ne=>ne.role==="user");U&&(U.content.trim().length>0?W.title=tk(U.content):U.attachments&&U.attachments.length>0&&(W.title=U.attachments.length===1?`[Image] ${kc}`:`[${U.attachments.length} Images] ${kc}`))}function Tn(){const A=s.value.length;return{atLimit:A>=Kg,nearLimit:A>=Gg,count:A}}async function La(A,H){o.value||await $r();const W=ao(A,void 0,H);return uo(!0),W}function vs(A,H,W){const U=W??o.value;co(A,H,U??void 0),U&&Jt(U,!1)}function Os(A,H){const W=H??o.value;lo(A,{status:"complete"},W??void 0),W&&Jt(W,!0)}return{messages:C,session:M,isPanelOpen:i,panelWidth:Be(e),permissionMode:Be(t),pendingPermission:D,pendingPlanApproval:j,cwd:Be(r),lastError:oe,debugEvents:ae,debugStreamEnabled:Be(h),providerSessionId:x,conversations:Be(s),archivedConversations:Be(n),activeConversationId:Be(o),conversationViewMode:Be(a),conflictState:Be(g),previewingConversationId:Be(p),isStreaming:G,hasMessages:b,lastMessage:T,isActiveConversationStreaming:E,hasConversations:Z,hasArchivedConversations:K,activeConversation:w,conversationCount:X,isNearStorageLimit:V,sortedConversations:ie,sortedArchivedConversations:q,previewingConversation:ee,streamingConversations:Be(l),initialize:z,togglePanel:Ce,openPanel:rt,closePanel:ot,setPanelWidth:ce,setPermissionMode:Q,setPendingPermission:J,clearPendingPermission:de,setPendingPlanApproval:Y,clearPendingPlanApproval:be,setCwd:_e,setProviderSessionId:Se,clearProviderSession:Cr,getProviderSessionId:Ir,updateWorktreeBranch:Fe,updateConversationWorktree:Ct,setConversationProviderSelection:vt,startConversationStreaming:ua,endConversationStreaming:da,isConversationStreaming:$,isConversationActivelyStreaming:R,addMessage:Fs,addUserMessage:ao,addAssistantMessage:fa,updateMessage:lo,resetMessageForReplay:Cn,appendToMessage:co,addToolToMessage:pa,updateToolInMessage:ma,initContentBlocks:ga,appendContentBlock:zr,appendContentBlockWithSave:_a,updateBlockById:va,updateBlockWithSave:Oa,findToolUseBlock:ba,batchSetMessageBlocks:ya,syncContentFromBlocks:Sc,setSessionStatus:xa,startSession:wa,endSession:Sa,setSessionError:ka,setDebugStreamEnabled:$a,pushDebugEvent:Ca,clearDebugEvents:Pa,clearMessages:Ta,clearError:Ma,loadConversations:ho,refreshServerConversations:Qa,saveAllConversations:qt,saveCurrentConversation:uo,saveConversation:Jt,createConversation:$r,selectConversation:lr,deleteConversation:fo,archiveConversation:Je,restoreArchivedConversation:Ve,deleteArchivedConversation:I,deleteAllArchivedConversations:L,setConversationViewMode:Oe,findConversationByFeature:Nt,syncConversationFeatureFromBranch:fi,renameConversation:Us,checkStorageLimits:Tn,finalizeConversation:Aa,rebaseConversation:$n,resolveConflictFile:cr,continueRebase:po,abortRebase:Ra,aiResolveConflictFile:Pr,aiResolveAllConflicts:mo,addConflictChatMessage:zt,setConflictUserGuidance:Wr,cancelConflictResolution:Ba,previewConversation:Hs,unpreviewConversation:Ee,togglePreview:me,isConversationPreviewing:te,addUserMessageWithConversation:La,appendToMessageWithSave:vs,completeMessageWithSave:Os}});function d3(i={}){const e=Qu(),t=300,r=5e3,s=250;let n=null,o=null,a=null,l=null,c=null,h=!1,u=!1;const d=N(!1),f=N(!1);let p=i;function g(x){p=x}async function O(){const x=p.getScrollPosition?.()??0,b=await e.checkAndRefresh();return b&&p.setScrollPosition&&(await xi(),p.setScrollPosition(x)),b}function _(){return d.value||!!e.activeContextMenu||!!e.activeDialog}async function k(){if(_()){f.value=!0;return}w()}async function P(){if(h){u=!0;return}h=!0;try{await O()}finally{h=!1,u&&(u=!1,w())}}function w(){o&&clearTimeout(o),o=setTimeout(()=>{o=null,P()},s)}function C(x){if(typeof window>"u")return;if(a&&a.readyState===WebSocket.OPEN){a.send(JSON.stringify({type:"watch",workingDirectory:x}));return}l&&(clearTimeout(l),l=null);const T=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/git-watcher-ws`;a=new WebSocket(T),a.onopen=()=>{a.send(JSON.stringify({type:"watch",workingDirectory:x}))},a.onmessage=$=>{try{JSON.parse($.data).type==="git_changed"&&k()}catch{}},a.onclose=()=>{a=null,e.isPollingActive&&c&&(l=setTimeout(()=>{c&&C(c)},r))},a.onerror=()=>{}}function M(){l&&(clearTimeout(l),l=null),a&&(a.close(),a=null)}function D(x){x&&(c=x),!e.isPollingActive&&(e.startPolling(),c&&C(c))}function j(){M(),e.stopPolling()}function oe(){d.value=!0,n&&(clearTimeout(n),n=null)}function ae(){n&&clearTimeout(n),n=setTimeout(async()=>{d.value=!1,f.value&&(f.value=!1,w())},t)}function G(){j(),n&&(clearTimeout(n),n=null),o&&(clearTimeout(o),o=null),h=!1,u=!1,c=null}return Ye(()=>[e.activeContextMenu,e.activeDialog],()=>{!e.activeContextMenu&&!e.activeDialog&&f.value&&!d.value&&(f.value=!1,w())}),{isUserInteracting:Be(d),isDeferredRefresh:Be(f),startPolling:D,stopPolling:j,startInteraction:oe,endInteraction:ae,cleanup:G,setScrollCallbacks:g}}function f3(i){function e(s){if((s.ctrlKey||s.metaKey)&&s.key==="h"){s.preventDefault(),i.onScrollToHead();return}if(s.key==="Escape"){s.preventDefault(),i.onEscape();return}}function t(){document.addEventListener("keydown",e)}function r(){document.removeEventListener("keydown",e)}return{start:t,stop:r}}function p3(i){const e=N({visible:!1,branchName:"",loading:!1,error:null});async function t(){e.value.loading=!0,e.value.error=null;const X=await i.checkoutBranch(e.value.branchName);e.value.loading=!1,X.success?e.value.visible=!1:e.value.error=X.error||"Unknown error"}const r=N({visible:!1,fromCommit:"",loading:!1,error:null});async function s(X){r.value.loading=!0,r.value.error=null;const V=await i.createBranch(X.name,r.value.fromCommit);r.value.loading=!1,V.success?(X.checkout&&await i.checkoutBranch(X.name),r.value.visible=!1):r.value.error=V.error||"Unknown error"}const n=N({visible:!1,branchName:"",isLocal:!0,force:!1,loading:!1,error:null});async function o(X){n.value.loading=!0,n.value.error=null;const{branchName:V,isLocal:ie}=n.value,q=X?.force??n.value.force,ee=ie?await i.deleteLocalBranch(V,q):await i.deleteRemoteBranch(V);n.value.loading=!1,ee.success?n.value.visible=!1:n.value.error=ee.error||"Unknown error"}const a=N({visible:!1,branchName:"",newName:"",loading:!1,error:null});async function l(){if(!a.value.newName.trim()){a.value.error="Branch name is required";return}a.value.loading=!0,a.value.error=null;const X=await i.renameBranch(a.value.branchName,a.value.newName.trim());a.value.loading=!1,X.success?a.value.visible=!1:a.value.error=X.error||"Unknown error"}const c=N({visible:!1,branchName:"",loading:!1,error:null});async function h(X){c.value.loading=!0,c.value.error=null;const V=await i.mergeBranch(c.value.branchName,X);c.value.loading=!1,V.success?c.value.visible=!1:c.value.error=V.error||"Unknown error"}const u=N({visible:!1,branchName:"",loading:!1,error:null});async function d(){u.value.loading=!0,u.value.error=null;const X=await i.rebaseBranch(u.value.branchName);u.value.loading=!1,X.success?u.value.visible=!1:u.value.error=X.error||"Unknown error"}const f=N({visible:!1,branchName:"",loading:!1,error:null});async function p(X){f.value.loading=!0,f.value.error=null;const V=await i.pushBranch(f.value.branchName,X.remote,X.force,X.forceWithLease);f.value.loading=!1,V.success?f.value.visible=!1:f.value.error=V.error||"Unknown error"}const g=N({visible:!1,branchName:"",loading:!1,error:null});async function O(X){g.value.loading=!0,g.value.error=null;const V=await i.pullBranch(g.value.branchName,X.remote,X.noFastForward,X.squash);g.value.loading=!1,V.success?g.value.visible=!1:g.value.error=V.error||"Unknown error"}const _=N({visible:!1,commitHash:"",commitMessage:"",loading:!1,error:null});async function k(X){_.value.loading=!0,_.value.error=null;const V=await i.cherryPickCommit(_.value.commitHash,X.recordOrigin,X.noCommit);_.value.loading=!1,V.success?_.value.visible=!1:_.value.error=V.error||"Unknown error"}const P=N({visible:!1,commitHash:"",commitMessage:"",loading:!1,error:null});async function w(X){P.value.loading=!0,P.value.error=null;const V=await i.resetToCommit(P.value.commitHash,X.mode);P.value.loading=!1,V.success?P.value.visible=!1:P.value.error=V.error||"Unknown error"}const C=N({visible:!1,commitHash:"",loading:!1,error:null});async function M(X){C.value.loading=!0,C.value.error=null;const V=await i.createTag(X.name,C.value.commitHash,X.annotated,X.message,X.pushToRemote);C.value.loading=!1,V.success?C.value.visible=!1:C.value.error=V.error||"Unknown error"}const D=N({visible:!1,tagName:"",loading:!1,error:null});async function j(X){D.value.loading=!0,D.value.error=null;const V=await i.deleteTag(D.value.tagName,X.deleteFromRemote?X.remote||"origin":void 0);D.value.loading=!1,V.success?D.value.visible=!1:D.value.error=V.error||"Unknown error"}const oe=N({visible:!1,tagName:"",loading:!1,tagDetail:null}),ae=N({visible:!1,loading:!1,error:null});async function G(X){ae.value.loading=!0,ae.value.error=null;const V=await i.stashChanges(X.message,X.includeUntracked);ae.value.loading=!1,V.success?ae.value.visible=!1:ae.value.error=V.error||"Unknown error"}const x=N({visible:!1,stashIndex:0,loading:!1,error:null}),b=N("");async function T(X){x.value.loading=!0,x.value.error=null;const V=await i.stashBranch(x.value.stashIndex,X);x.value.loading=!1,V.success?x.value.visible=!1:x.value.error=V.error||"Unknown error"}const $=N({visible:!1,loading:!1,error:null});async function R(X){$.value.loading=!0,$.value.error=null;const V=await i.resetWorking(X.mode);$.value.loading=!1,V.success?$.value.visible=!1:$.value.error=V.error||"Unknown error"}const E=N({visible:!1,loading:!1,error:null});async function Z(){E.value.loading=!0,E.value.error=null;const X=await i.cleanUntracked();E.value.loading=!1,X.success?E.value.visible=!1:E.value.error=X.error||"Unknown error"}const K=he(()=>e.value.visible||r.value.visible||n.value.visible||a.value.visible||c.value.visible||u.value.visible||f.value.visible||g.value.visible||_.value.visible||P.value.visible||C.value.visible||D.value.visible||oe.value.visible||ae.value.visible||x.value.visible||$.value.visible||E.value.visible);return{checkoutDialog:e,confirmCheckout:t,createBranchDialog:r,confirmCreateBranch:s,deleteBranchDialog:n,confirmDeleteBranch:o,renameDialog:a,confirmRenameBranch:l,mergeDialog:c,confirmMerge:h,rebaseDialog:u,confirmRebase:d,pushDialog:f,confirmPush:p,pullDialog:g,confirmPull:O,cherryPickDialog:_,confirmCherryPick:k,resetDialog:P,confirmReset:w,tagCreateDialog:C,confirmTagCreate:M,tagDeleteDialog:D,confirmTagDelete:j,tagDetailDialog:oe,stashDialog:ae,confirmStash:G,stashBranchDialog:x,stashBranchInput:b,confirmStashBranch:T,resetWorkingDialog:$,confirmResetWorking:R,cleanUntrackedDialog:E,confirmCleanUntracked:Z,isAnyDialogOpen:K}}function m3(i,e){const t=N({visible:!1,x:0,y:0});function r(Y,be){t.value={visible:!0,x:Y,y:be},setTimeout(()=>{t.value.visible=!1},1500)}const s=N({visible:!1,branch:"",x:0,y:0,isCurrentBranch:!1,isLocal:!0,commitHash:""});function n(Y){s.value={visible:!0,...Y},i.setActiveContextMenu({type:"branch",props:Y,position:{x:Y.x,y:Y.y}})}function o(){s.value.visible=!1,i.clearActiveContextMenu()}function a(){o(),e.checkoutDialog.value={visible:!0,branchName:s.value.branch,loading:!1,error:null}}function l(){const Y=s.value.branch;o(),e.renameDialog.value={visible:!0,branchName:Y,newName:Y,loading:!1,error:null}}function c(){const{branch:Y,isLocal:be}=s.value;o(),e.deleteBranchDialog.value={visible:!0,branchName:Y,isLocal:be,force:!1,loading:!1,error:null}}function h(){const Y=s.value.branch;o(),e.mergeDialog.value={visible:!0,branchName:Y,loading:!1,error:null}}function u(){const Y=s.value.branch;o(),e.rebaseDialog.value={visible:!0,branchName:Y,loading:!1,error:null}}function d(){const Y=s.value.branch;o(),e.pushDialog.value={visible:!0,branchName:Y,loading:!1,error:null}}function f(){const Y=s.value.branch;o(),e.pullDialog.value={visible:!0,branchName:Y,loading:!1,error:null}}async function p(){const Y=s.value.branch;o(),await i.fetchBranch(Y)}async function g(){const{branch:Y,x:be,y:Ce}=s.value;o(),(await i.copyToClipboard(Y)).success&&r(be,Ce)}function O(){o(),e.createBranchDialog.value={visible:!0,fromCommit:s.value.commitHash,loading:!1,error:null}}const _=N({visible:!1,commit:null,x:0,y:0});function k(Y){_.value={visible:!0,commit:Y.commit,x:Y.x,y:Y.y},i.setActiveContextMenu({type:"commit",props:Y,position:{x:Y.x,y:Y.y}})}function P(){_.value.visible=!1,i.clearActiveContextMenu()}function w(Y){return Y===!1?!1:typeof Y=="object"&&Y!==null&&"success"in Y?!!Y.success:!0}function C(Y){const be=_.value.commit;if(!be)return!1;P();const Ce=Y(be);return Ce&&typeof Ce.then=="function"?Ce.then(w).catch(()=>!1):w(Ce)}function M(){C(Y=>{e.tagCreateDialog.value={visible:!0,commitHash:Y.hash,loading:!1,error:null}})}function D(){C(Y=>{e.createBranchDialog.value={visible:!0,fromCommit:Y.hash,loading:!1,error:null}})}function j(){C(Y=>{e.checkoutDialog.value={visible:!0,branchName:Y.hash,loading:!1,error:null}})}function oe(){C(Y=>{e.cherryPickDialog.value={visible:!0,commitHash:Y.hash,commitMessage:Y.message,loading:!1,error:null}})}async function ae(){await C(Y=>i.revertCommit(Y.hash))}function G(){C(Y=>{e.mergeDialog.value={visible:!0,branchName:Y.shortHash,loading:!1,error:null}})}function x(){C(Y=>{e.resetDialog.value={visible:!0,commitHash:Y.hash,commitMessage:Y.message,loading:!1,error:null}})}async function b(){const{x:Y,y:be}=_.value;await C(rt=>i.copyToClipboard(rt.hash))&&r(Y,be)}async function T(){const{x:Y,y:be}=_.value;await C(rt=>i.copyCommitSubject(rt))&&r(Y,be)}const $=N({visible:!1,tag:"",x:0,y:0,commitHash:""});function R(Y){$.value={visible:!0,...Y},i.setActiveContextMenu({type:"tag",props:Y,position:{x:Y.x,y:Y.y}})}function E(){$.value.visible=!1,i.clearActiveContextMenu()}async function Z(){const Y=$.value.tag;E(),e.tagDetailDialog.value={visible:!0,tagName:Y,loading:!0,tagDetail:null};const be=await i.getTagDetail(Y);e.tagDetailDialog.value.loading=!1,be.success&&be.data&&(e.tagDetailDialog.value.tagDetail=be.data)}function K(){const Y=$.value.tag;E(),e.tagDeleteDialog.value={visible:!0,tagName:Y,loading:!1,error:null}}async function X(){const Y=$.value.tag;E(),await i.pushTag(Y)}async function V(){const{tag:Y,x:be,y:Ce}=$.value;E(),(await i.copyToClipboard(Y)).success&&r(be,Ce)}const ie=N({visible:!1,x:0,y:0});function q(Y){ie.value={visible:!0,...Y},i.setActiveContextMenu({type:"uncommitted",props:Y,position:{x:Y.x,y:Y.y}})}function ee(){ie.value.visible=!1,i.clearActiveContextMenu()}function te(){ee(),e.stashDialog.value={visible:!0,loading:!1,error:null}}function Oe(){ee(),e.resetWorkingDialog.value={visible:!0,loading:!1,error:null}}function Te(){ee(),e.cleanUntrackedDialog.value={visible:!0,loading:!1,error:null}}const ke=N({visible:!1,stash:null,x:0,y:0});function Ze(Y){ke.value={visible:!0,stash:Y.stash,x:Y.x,y:Y.y},i.setActiveContextMenu({type:"stash",props:Y,position:{x:Y.x,y:Y.y}})}function Je(){ke.value.visible=!1,i.clearActiveContextMenu()}function Ve(Y){const be=ke.value.stash;if(!be)return!1;Je();const Ce=Y(be);return Ce&&typeof Ce.then=="function"?Ce.then(w).catch(()=>!1):w(Ce)}async function I(){await Ve(Y=>i.applyStash(Y.index))}async function L(){await Ve(Y=>i.popStash(Y.index))}async function z(){await Ve(Y=>i.dropStash(Y.index))}function Q(){Ve(Y=>{e.stashBranchDialog.value={visible:!0,stashIndex:Y.index,loading:!1,error:null}})}async function J(){const{x:Y,y:be}=ke.value;await Ve(rt=>i.copyToClipboard(`stash@{${rt.index}}`))&&r(Y,be)}async function de(){const{x:Y,y:be}=ke.value;await Ve(rt=>i.copyToClipboard(rt.hash))&&r(Y,be)}return{copyFeedback:t,showCopyFeedback:r,branchMenu:s,handleBranchContextMenu:n,closeBranchMenu:o,handleBranchCheckout:a,handleBranchRename:l,handleBranchDelete:c,handleBranchMerge:h,handleBranchRebase:u,handleBranchPush:d,handleBranchPull:f,handleBranchFetch:p,handleBranchCopyName:g,handleBranchCreateBranch:O,commitMenu:_,handleCommitContextMenu:k,closeCommitMenu:P,handleCommitAddTag:M,handleCommitCreateBranch:D,handleCommitCheckout:j,handleCommitCherryPick:oe,handleCommitRevert:ae,handleCommitMergeInto:G,handleCommitReset:x,handleCommitCopyHash:b,handleCommitCopySubject:T,tagMenu:$,handleTagContextMenu:R,closeTagMenu:E,handleTagViewDetails:Z,handleTagDelete:K,handleTagPush:X,handleTagCopyName:V,uncommittedMenu:ie,handleUncommittedContextMenu:q,closeUncommittedMenu:ee,handleUncommittedStash:te,handleUncommittedReset:Oe,handleUncommittedClean:Te,stashMenu:ke,handleStashContextMenu:Ze,closeStashMenu:Je,handleStashApply:I,handleStashPop:L,handleStashDrop:z,handleStashCreateBranch:Q,handleStashCopyName:J,handleStashCopyHash:de}}const g3={class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},v3={class:"flex items-center justify-between px-4 py-3 border-b border-retro-border"},O3={class:"text-sm font-mono text-retro-text"},_3={class:"p-4"},b3={key:0,class:"mb-3 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},y3={class:"flex justify-end gap-2 px-4 py-3 border-t border-retro-border"},x3=["disabled"],w3=["disabled"],bi=Xe({__name:"GitDialog",props:{title:{},visible:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null},confirmLabel:{default:"Confirm"},confirmDanger:{type:Boolean,default:!1},cancelLabel:{default:"Cancel"}},emits:["close","confirm"],setup(i,{emit:e}){const t=i,r=e;function s(n){n.key==="Escape"&&r("close"),n.key==="Enter"&&!t.loading&&(n.preventDefault(),r("confirm"))}return Ye(()=>t.visible,n=>{n?document.addEventListener("keydown",s):document.removeEventListener("keydown",s)}),_i(()=>{document.removeEventListener("keydown",s)}),(n,o)=>(y(),xe(or,{to:"body"},[le(hs,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:gt(()=>[i.visible?(y(),S("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",role:"dialog","aria-modal":"true",onClick:o[3]||(o[3]=Ri(a=>r("close"),["self"]))},[m("div",g3,[m("div",v3,[m("h3",O3,F(i.title),1),m("button",{type:"button",class:"p-1 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Close",onClick:o[0]||(o[0]=a=>r("close"))},[le(v(hi),{class:"h-4 w-4"})])]),m("div",_3,[i.error?(y(),S("div",b3,F(i.error),1)):se("",!0),b_(n.$slots,"default")]),m("div",y3,[m("button",{type:"button",class:"px-3 py-1.5 text-xs font-mono text-retro-muted hover:text-retro-text bg-retro-panel hover:bg-retro-border rounded transition-colors",disabled:i.loading,onClick:o[1]||(o[1]=a=>r("close"))},F(i.cancelLabel),9,x3),m("button",{type:"button",class:Ie(["px-3 py-1.5 text-xs font-mono rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed",[i.confirmDanger?"text-retro-red bg-retro-red/10 border border-retro-red/30 hover:bg-retro-red/20":"text-retro-black bg-retro-cyan hover:bg-retro-cyan/80"]]),disabled:i.loading,onClick:o[2]||(o[2]=a=>r("confirm"))},F(i.loading?"Loading...":i.confirmLabel),11,w3)])])])):se("",!0)]),_:3})]))}}),S3={class:"text-retro-text text-sm font-mono mb-4"},k3={class:"text-retro-cyan"},C3={class:"space-y-3"},$3={class:"flex items-center gap-2 cursor-pointer"},P3={class:"flex items-center gap-2 cursor-pointer"},T3={class:"flex items-center gap-2 cursor-pointer"},M3=Xe({__name:"MergeDialog",props:{visible:{type:Boolean},branchName:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(i,{emit:e}){const t=i,r=e,s=N(!1),n=N(!1),o=N(!1);function a(){r("confirm",{noCommit:s.value,noFastForward:n.value,squash:o.value})}return Ye(()=>t.visible,l=>{l&&(s.value=!1,n.value=!1,o.value=!1)}),(l,c)=>(y(),xe(bi,{title:"Merge Branch",visible:i.visible,loading:i.loading,error:i.error,"confirm-label":"Merge",onClose:c[3]||(c[3]=h=>r("close")),onConfirm:a},{default:gt(()=>[m("p",S3,[c[4]||(c[4]=We(" Merge ",-1)),m("span",k3,F(i.branchName),1),c[5]||(c[5]=We(" into current branch ",-1))]),m("div",C3,[m("label",$3,[je(m("input",{"onUpdate:modelValue":c[0]||(c[0]=h=>at(s)?s.value=h:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[nr,v(s)]]),c[6]||(c[6]=m("span",{class:"text-retro-muted text-sm"},"No commit (stage changes only)",-1))]),m("label",P3,[je(m("input",{"onUpdate:modelValue":c[1]||(c[1]=h=>at(n)?n.value=h:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[nr,v(n)]]),c[7]||(c[7]=m("span",{class:"text-retro-muted text-sm"},"No fast-forward (always create merge commit)",-1))]),m("label",T3,[je(m("input",{"onUpdate:modelValue":c[2]||(c[2]=h=>at(o)?o.value=h:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[nr,v(o)]]),c[8]||(c[8]=m("span",{class:"text-retro-muted text-sm"},"Squash (combine all commits into one)",-1))])])]),_:1},8,["visible","loading","error"]))}}),Q3={class:"text-retro-text text-sm font-mono mb-2"},A3={class:"text-retro-cyan"},R3={class:"space-y-3 mt-4"},B3={class:"flex items-center gap-2 cursor-pointer"},L3=Xe({__name:"DeleteBranchDialog",props:{visible:{type:Boolean},branchName:{},isLocal:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(i,{emit:e}){const t=i,r=e,s=N(!1);function n(){r("confirm",{force:s.value})}return Ye(()=>t.visible,o=>{o&&(s.value=!1)}),(o,a)=>(y(),xe(bi,{title:"Delete Branch",visible:i.visible,loading:i.loading,error:i.error,"confirm-label":"Delete","confirm-danger":!0,onClose:a[1]||(a[1]=l=>r("close")),onConfirm:n},{default:gt(()=>[a[4]||(a[4]=m("div",{class:"mb-4 p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"}," This action is permanent and cannot be undone. ",-1)),m("p",Q3,[We(" Delete "+F(i.isLocal?"local":"remote")+" branch ",1),m("span",A3,F(i.branchName),1),a[2]||(a[2]=We("? ",-1))]),m("div",R3,[m("label",B3,[je(m("input",{"onUpdate:modelValue":a[0]||(a[0]=l=>at(s)?s.value=l:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[nr,v(s)]]),a[3]||(a[3]=m("span",{class:"text-retro-muted text-sm"},"Force delete (even if not fully merged)",-1))])])]),_:1},8,["visible","loading","error"]))}}),E3={class:"text-retro-text text-sm font-mono mb-4"},D3={class:"text-retro-cyan"},I3={class:"space-y-3"},z3=["value"],N3={class:"flex items-center gap-2 cursor-pointer"},W3=["checked"],Z3={class:"flex items-center gap-2 cursor-pointer"},X3=["checked"],F3={key:0,class:"p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"},V3=Xe({__name:"PushDialog",props:{visible:{type:Boolean},branchName:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(i,{emit:e}){const t=i,r=e,s=N("origin"),n=N(!1),o=N(!1);function a(h){n.value=h,h&&(o.value=!1)}function l(h){o.value=h,h&&(n.value=!1)}function c(){r("confirm",{remote:s.value,force:n.value,forceWithLease:o.value})}return Ye(()=>t.visible,h=>{h&&(s.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin",n.value=!1,o.value=!1)}),(h,u)=>(y(),xe(bi,{title:"Push Branch",visible:i.visible,loading:i.loading,error:i.error,"confirm-label":"Push",onClose:u[3]||(u[3]=d=>r("close")),onConfirm:c},{default:gt(()=>[m("p",E3,[u[4]||(u[4]=We(" Push ",-1)),m("span",D3,F(i.branchName),1),u[5]||(u[5]=We(" to remote ",-1))]),m("div",I3,[m("div",null,[u[6]||(u[6]=m("label",{class:"text-retro-muted text-sm block mb-1"},"Remote",-1)),je(m("select",{"onUpdate:modelValue":u[0]||(u[0]=d=>at(s)?s.value=d:null),class:"w-full bg-retro-panel border border-retro-border rounded text-retro-text text-sm px-2 py-1.5 font-mono focus:outline-none focus:border-retro-cyan"},[(y(!0),S(Me,null,Ke(i.remotes,d=>(y(),S("option",{key:d,value:d},F(d),9,z3))),128))],512),[[gn,v(s)]])]),m("label",N3,[m("input",{checked:v(n),type:"checkbox",class:"accent-retro-cyan",onChange:u[1]||(u[1]=d=>a(d.target.checked))},null,40,W3),u[7]||(u[7]=m("span",{class:"text-retro-muted text-sm"},"Force push",-1))]),m("label",Z3,[m("input",{checked:v(o),type:"checkbox",class:"accent-retro-cyan",onChange:u[2]||(u[2]=d=>l(d.target.checked))},null,40,X3),u[8]||(u[8]=m("span",{class:"text-retro-muted text-sm"},"Force with lease (safer force push)",-1))]),v(n)||v(o)?(y(),S("div",F3,F(v(n)?"Force push will overwrite remote history. Use with caution.":"Force with lease will reject the push if the remote has been updated since your last fetch."),1)):se("",!0)])]),_:1},8,["visible","loading","error"]))}}),q3={class:"text-retro-text text-sm font-mono mb-4"},H3={class:"text-retro-cyan"},U3={class:"space-y-3"},Y3=["value"],j3={class:"flex items-center gap-2 cursor-pointer"},G3={class:"flex items-center gap-2 cursor-pointer"},K3=Xe({__name:"PullDialog",props:{visible:{type:Boolean},branchName:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(i,{emit:e}){const t=i,r=e,s=N("origin"),n=N(!1),o=N(!1);function a(){r("confirm",{remote:s.value,noFastForward:n.value,squash:o.value})}return Ye(()=>t.visible,l=>{l&&(s.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin",n.value=!1,o.value=!1)}),(l,c)=>(y(),xe(bi,{title:"Pull Branch",visible:i.visible,loading:i.loading,error:i.error,"confirm-label":"Pull",onClose:c[3]||(c[3]=h=>r("close")),onConfirm:a},{default:gt(()=>[m("p",q3,[c[4]||(c[4]=We(" Pull ",-1)),m("span",H3,F(i.branchName),1),c[5]||(c[5]=We(" from remote ",-1))]),m("div",U3,[m("div",null,[c[6]||(c[6]=m("label",{class:"text-retro-muted text-sm block mb-1"},"Remote",-1)),je(m("select",{"onUpdate:modelValue":c[0]||(c[0]=h=>at(s)?s.value=h:null),class:"w-full bg-retro-panel border border-retro-border rounded text-retro-text text-sm px-2 py-1.5 font-mono focus:outline-none focus:border-retro-cyan"},[(y(!0),S(Me,null,Ke(i.remotes,h=>(y(),S("option",{key:h,value:h},F(h),9,Y3))),128))],512),[[gn,v(s)]])]),m("label",j3,[je(m("input",{"onUpdate:modelValue":c[1]||(c[1]=h=>at(n)?n.value=h:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[nr,v(n)]]),c[7]||(c[7]=m("span",{class:"text-retro-muted text-sm"},"No fast-forward (always create merge commit)",-1))]),m("label",G3,[je(m("input",{"onUpdate:modelValue":c[2]||(c[2]=h=>at(o)?o.value=h:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[nr,v(o)]]),c[8]||(c[8]=m("span",{class:"text-retro-muted text-sm"},"Squash (combine all commits into one)",-1))])])]),_:1},8,["visible","loading","error"]))}}),J3={class:"text-retro-text text-sm font-mono mb-4"},eP={class:"text-retro-cyan"},tP={class:"text-retro-cyan"},iP={class:"p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"},rP={class:"text-retro-cyan"},sP={class:"text-retro-cyan"},nP=Xe({__name:"RebaseDialog",props:{visible:{type:Boolean},branchName:{},ontoBranch:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(i,{emit:e}){const t=e;return(r,s)=>(y(),xe(bi,{title:"Rebase Branch",visible:i.visible,loading:i.loading,error:i.error,"confirm-label":"Rebase",onClose:s[0]||(s[0]=n=>t("close")),onConfirm:s[1]||(s[1]=n=>t("confirm"))},{default:gt(()=>[m("p",J3,[s[2]||(s[2]=We(" Rebase ",-1)),m("span",eP,F(i.branchName),1),s[3]||(s[3]=We(" onto ",-1)),m("span",tP,F(i.ontoBranch),1)]),m("div",iP,[s[4]||(s[4]=We(" This will rewrite commit history. Commits from ",-1)),m("span",rP,F(i.branchName),1),s[5]||(s[5]=We(" will be replayed on top of ",-1)),m("span",sP,F(i.ontoBranch),1),s[6]||(s[6]=We(". ",-1))])]),_:1},8,["visible","loading","error"]))}}),oP={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},aP={class:"text-sm font-mono text-retro-cyan"},lP={class:"text-xs font-mono text-retro-text mt-1 truncate"},cP={class:"space-y-3"},hP={class:"flex items-start gap-2 cursor-pointer group"},uP={class:"flex items-start gap-2 cursor-pointer group"},dP=Xe({__name:"CherryPickDialog",props:{visible:{type:Boolean},commitHash:{},commitMessage:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(i,{emit:e}){const t=e,r=N(!1),s=N(!1);function n(){t("confirm",{recordOrigin:r.value,noCommit:s.value})}function o(){r.value=!1,s.value=!1,t("close")}return(a,l)=>(y(),xe(bi,{title:"Cherry-Pick Commit",visible:i.visible,loading:i.loading,error:i.error,"confirm-label":"Cherry-Pick",onClose:o,onConfirm:n},{default:gt(()=>[m("div",oP,[l[2]||(l[2]=m("div",{class:"text-xs font-mono text-retro-muted mb-1"},"Commit",-1)),m("div",aP,F(i.commitHash.slice(0,7)),1),m("div",lP,F(i.commitMessage.split(`
9
+ `)[0]),1)]),m("div",cP,[m("label",hP,[je(m("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>at(r)?r.value=c:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[nr,v(r)]]),l[3]||(l[3]=m("div",null,[m("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," Record origin (-x) "),m("p",{class:"text-xs font-mono text-retro-muted mt-0.5"},' Append "(cherry picked from commit ...)" to the commit message ')],-1))]),m("label",uP,[je(m("input",{"onUpdate:modelValue":l[1]||(l[1]=c=>at(s)?s.value=c:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[nr,v(s)]]),l[4]||(l[4]=m("div",null,[m("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," No commit "),m("p",{class:"text-xs font-mono text-retro-muted mt-0.5"}," Apply changes to the working directory without committing ")],-1))])])]),_:1},8,["visible","loading","error"]))}}),fP={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},pP={class:"text-sm font-mono text-retro-cyan"},mP={class:"text-xs font-mono text-retro-text mt-1 truncate"},gP={class:"space-y-2"},vP=["value"],OP={key:0,class:"mt-3 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},_P=Xe({__name:"ResetDialog",props:{visible:{type:Boolean},commitHash:{},commitMessage:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(i,{emit:e}){const t=e,r=N("mixed"),s=[{value:"soft",label:"Soft",description:"Move HEAD, keep staged changes and working directory"},{value:"mixed",label:"Mixed",description:"Move HEAD, reset staging area, keep working directory"},{value:"hard",label:"Hard",description:"Move HEAD, reset staging area and working directory (DESTRUCTIVE)"}];function n(){t("confirm",{mode:r.value})}function o(){r.value="mixed",t("close")}return(a,l)=>(y(),xe(bi,{title:"Reset to Commit",visible:i.visible,loading:i.loading,error:i.error,"confirm-label":"Reset","confirm-danger":v(r)==="hard",onClose:o,onConfirm:n},{default:gt(()=>[m("div",fP,[l[1]||(l[1]=m("div",{class:"text-xs font-mono text-retro-muted mb-1"},"Reset to",-1)),m("div",pP,F(i.commitHash.slice(0,7)),1),m("div",mP,F(i.commitMessage.split(`
10
+ `)[0]),1)]),m("div",gP,[l[2]||(l[2]=m("div",{class:"text-xs font-mono text-retro-muted mb-2"},"Reset mode",-1)),(y(),S(Me,null,Ke(s,c=>m("label",{key:c.value,class:Ie(["flex items-start gap-2 p-2 rounded cursor-pointer group border transition-colors",[v(r)===c.value?"border-retro-cyan bg-retro-cyan/5":"border-transparent hover:bg-retro-panel"]])},[je(m("input",{"onUpdate:modelValue":l[0]||(l[0]=h=>at(r)?r.value=h:null),type:"radio",name:"reset-mode",value:c.value,class:"mt-0.5 accent-retro-cyan"},null,8,vP),[[wf,v(r)]]),m("div",null,[m("span",{class:Ie(["text-sm font-mono transition-colors",[c.value==="hard"?"text-retro-red":"text-retro-text",v(r)===c.value?"text-retro-cyan":""]])},F(c.label),3),m("p",{class:Ie(["text-xs font-mono mt-0.5",c.value==="hard"?"text-retro-red/70":"text-retro-muted"])},F(c.description),3)])],2)),64))]),v(r)==="hard"?(y(),S("div",OP," Warning: Hard reset will permanently discard all uncommitted changes in your working directory and staging area. This action cannot be undone. ")):se("",!0)]),_:1},8,["visible","loading","error","confirm-danger"]))}}),bP={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},yP={class:"text-sm font-mono text-retro-cyan"},xP={class:"mb-4"},wP={class:"mb-3"},SP={class:"flex items-start gap-2 cursor-pointer group"},kP={key:0,class:"mb-4"},CP={class:"space-y-2"},$P={class:"flex items-start gap-2 cursor-pointer group"},PP=["disabled"],TP={key:0,class:"ml-6"},MP=["value"],QP=Xe({__name:"TagCreateDialog",props:{visible:{type:Boolean},commitHash:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(i,{emit:e}){const t=e,r=N(""),s=N(!1),n=N(""),o=N(!1),a=N(""),l=he(()=>r.value.trim().length>0);function c(){if(!l.value)return;const u={name:r.value.trim(),annotated:s.value};s.value&&n.value.trim()&&(u.message=n.value.trim()),o.value&&a.value&&(u.pushToRemote=a.value),t("confirm",u)}function h(){r.value="",s.value=!1,n.value="",o.value=!1,a.value="",t("close")}return Ye(()=>s.value,u=>{u||(n.value="")}),(u,d)=>(y(),xe(bi,{title:"Create Tag",visible:i.visible,loading:i.loading,error:i.error,"confirm-label":"Create Tag",onClose:h,onConfirm:c},{default:gt(()=>[m("div",bP,[d[5]||(d[5]=m("div",{class:"text-xs font-mono text-retro-muted mb-1"},"At commit",-1)),m("div",yP,F(i.commitHash.slice(0,7)),1)]),m("div",xP,[d[6]||(d[6]=m("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Tag name",-1)),je(m("input",{"onUpdate:modelValue":d[0]||(d[0]=f=>at(r)?r.value=f:null),type:"text",placeholder:"v1.0.0",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan"},null,512),[[$i,v(r)]])]),m("div",wP,[m("label",SP,[je(m("input",{"onUpdate:modelValue":d[1]||(d[1]=f=>at(s)?s.value=f:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[nr,v(s)]]),d[7]||(d[7]=m("div",null,[m("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," Annotated tag "),m("p",{class:"text-xs font-mono text-retro-muted mt-0.5"}," Create a full tag object with message and tagger info ")],-1))])]),v(s)?(y(),S("div",kP,[d[8]||(d[8]=m("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Tag message",-1)),je(m("textarea",{"onUpdate:modelValue":d[2]||(d[2]=f=>at(n)?n.value=f:null),rows:"3",placeholder:"Release description...",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan resize-none"},null,512),[[$i,v(n)]])])):se("",!0),m("div",CP,[m("label",$P,[je(m("input",{"onUpdate:modelValue":d[3]||(d[3]=f=>at(o)?o.value=f:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan",disabled:i.remotes.length===0},null,8,PP),[[nr,v(o)]]),m("div",null,[m("span",{class:Ie(["text-sm font-mono transition-colors",i.remotes.length===0?"text-retro-muted":"text-retro-text group-hover:text-retro-cyan"])}," Push to remote ",2)])]),v(o)&&i.remotes.length>0?(y(),S("div",TP,[je(m("select",{"onUpdate:modelValue":d[4]||(d[4]=f=>at(a)?a.value=f:null),class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text focus:outline-none focus:border-retro-cyan"},[d[9]||(d[9]=m("option",{value:"",disabled:"",class:"text-retro-muted"},"Select remote",-1)),(y(!0),S(Me,null,Ke(i.remotes,f=>(y(),S("option",{key:f,value:f},F(f),9,MP))),128))],512),[[gn,v(a)]])])):se("",!0)])]),_:1},8,["visible","loading","error"]))}}),AP={class:"text-retro-text text-sm font-mono mb-2"},RP={class:"text-retro-cyan"},BP={class:"space-y-3 mt-4"},LP={class:"flex items-center gap-2 cursor-pointer"},EP={key:0,class:"ml-6"},DP=["value"],IP=Xe({__name:"TagDeleteDialog",props:{visible:{type:Boolean},tagName:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(i,{emit:e}){const t=i,r=e,s=N(!1),n=N("origin");function o(){r("confirm",{deleteFromRemote:s.value,remote:s.value?n.value:void 0})}return Ye(()=>t.visible,a=>{a&&(s.value=!1,n.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin")}),(a,l)=>(y(),xe(bi,{title:"Delete Tag",visible:i.visible,loading:i.loading,error:i.error,"confirm-label":"Delete","confirm-danger":!0,onClose:l[2]||(l[2]=c=>r("close")),onConfirm:o},{default:gt(()=>[l[7]||(l[7]=m("div",{class:"mb-4 p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"}," This action is permanent and cannot be undone. ",-1)),m("p",AP,[l[3]||(l[3]=We(" Delete tag ",-1)),m("span",RP,F(i.tagName),1),l[4]||(l[4]=We("? ",-1))]),m("div",BP,[m("label",LP,[je(m("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>at(s)?s.value=c:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[nr,v(s)]]),l[5]||(l[5]=m("span",{class:"text-retro-muted text-sm"},"Also delete from remote",-1))]),v(s)?(y(),S("div",EP,[l[6]||(l[6]=m("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Remote",-1)),je(m("select",{"onUpdate:modelValue":l[1]||(l[1]=c=>at(n)?n.value=c:null),class:"w-full px-2 py-1.5 text-sm font-mono bg-retro-panel border border-retro-border rounded text-retro-text focus:outline-none focus:border-retro-cyan"},[(y(!0),S(Me,null,Ke(i.remotes,c=>(y(),S("option",{key:c,value:c},F(c),9,DP))),128))],512),[[gn,v(n)]])])):se("",!0)])]),_:1},8,["visible","loading","error"]))}}),zP={class:"mb-4"},NP={class:"text-retro-cyan text-sm font-mono"},WP={class:"mb-4"},ZP={class:"text-retro-text text-sm font-mono"},XP={class:"mb-4"},FP={class:"text-retro-text text-sm font-mono break-all select-all"},VP={class:"mb-4"},qP={class:"text-retro-text text-sm font-mono"},HP={class:"text-retro-muted"},UP={class:"mb-4"},YP={class:"text-retro-text text-sm font-mono"},jP={key:1,class:"mb-2"},GP={class:"p-2 text-sm font-mono text-retro-text bg-retro-panel border border-retro-border rounded whitespace-pre-wrap"},KP={key:1,class:"text-retro-muted text-sm font-mono text-center py-4"},JP=Xe({__name:"TagDetailDialog",props:{visible:{type:Boolean},tagName:{},tagDetail:{},loading:{type:Boolean,default:!1}},emits:["close"],setup(i,{emit:e}){const t=e;return(r,s)=>(y(),xe(bi,{title:"Tag Details",visible:i.visible,loading:i.loading,"confirm-label":"Close","cancel-label":"Close",onClose:s[0]||(s[0]=n=>t("close")),onConfirm:s[1]||(s[1]=n=>t("close"))},{default:gt(()=>[m("div",zP,[s[2]||(s[2]=m("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Tag",-1)),m("p",NP,F(i.tagName),1)]),i.tagDetail?(y(),S(Me,{key:0},[m("div",WP,[s[3]||(s[3]=m("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Type",-1)),m("p",ZP,F(i.tagDetail.isAnnotated?"Annotated":"Lightweight"),1)]),m("div",XP,[s[4]||(s[4]=m("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Hash",-1)),m("p",FP,F(i.tagDetail.hash),1)]),i.tagDetail.tagger?(y(),S(Me,{key:0},[m("div",VP,[s[5]||(s[5]=m("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Tagger",-1)),m("p",qP,[We(F(i.tagDetail.tagger.name)+" ",1),m("span",HP,"<"+F(i.tagDetail.tagger.email)+">",1)])]),m("div",UP,[s[6]||(s[6]=m("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Date",-1)),m("p",YP,F(i.tagDetail.tagger.date),1)])],64)):se("",!0),i.tagDetail.message?(y(),S("div",jP,[s[7]||(s[7]=m("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Message",-1)),m("div",GP,F(i.tagDetail.message),1)])):se("",!0)],64)):i.loading?(y(),S("div",KP," Loading tag details... ")):se("",!0)]),_:1},8,["visible","loading"]))}}),e4={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},t4={class:"text-sm font-mono text-retro-cyan"},i4={class:"mb-4"},r4={class:"flex items-start gap-2 cursor-pointer group"},s4=Xe({__name:"CreateBranchDialog",props:{visible:{type:Boolean},fromCommit:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(i,{emit:e}){const t=e,r=N(""),s=N(!0),n=he(()=>r.value.trim().length>0);function o(){n.value&&t("confirm",{name:r.value.trim(),checkout:s.value})}function a(){r.value="",s.value=!0,t("close")}return(l,c)=>(y(),xe(bi,{title:"Create Branch",visible:i.visible,loading:i.loading,error:i.error,"confirm-label":"Create Branch",onClose:a,onConfirm:o},{default:gt(()=>[m("div",e4,[c[2]||(c[2]=m("div",{class:"text-xs font-mono text-retro-muted mb-1"},"From",-1)),m("div",t4,F(i.fromCommit.slice(0,7)),1)]),m("div",i4,[c[3]||(c[3]=m("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Branch name",-1)),je(m("input",{"onUpdate:modelValue":c[0]||(c[0]=h=>at(r)?r.value=h:null),type:"text",placeholder:"feature/my-branch",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan"},null,512),[[$i,v(r)]])]),m("label",r4,[je(m("input",{"onUpdate:modelValue":c[1]||(c[1]=h=>at(s)?s.value=h:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[nr,v(s)]]),c[4]||(c[4]=m("div",null,[m("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," Switch to new branch "),m("p",{class:"text-xs font-mono text-retro-muted mt-0.5"}," Checkout the branch after creating it ")],-1))])]),_:1},8,["visible","loading","error"]))}}),n4={class:"space-y-4"},o4={class:"flex items-center gap-2 cursor-pointer"},a4=Xe({__name:"StashDialog",props:{visible:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(i,{emit:e}){const t=i,r=e,s=N(""),n=N(!1);function o(){r("confirm",{message:s.value.trim()||void 0,includeUntracked:n.value})}return Ye(()=>t.visible,a=>{a&&(s.value="",n.value=!1)}),(a,l)=>(y(),xe(bi,{title:"Stash Changes",visible:i.visible,loading:i.loading,error:i.error,"confirm-label":"Stash",onClose:l[2]||(l[2]=c=>r("close")),onConfirm:o},{default:gt(()=>[l[5]||(l[5]=m("p",{class:"text-retro-text text-sm font-mono mb-4"}," Save uncommitted changes to the stash. ",-1)),m("div",n4,[m("div",null,[l[3]||(l[3]=m("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Message (optional)",-1)),je(m("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>at(s)?s.value=c:null),type:"text",placeholder:"Stash description...",class:"w-full px-2 py-1.5 text-sm font-mono bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted/50 focus:outline-none focus:border-retro-cyan"},null,512),[[$i,v(s)]])]),m("label",o4,[je(m("input",{"onUpdate:modelValue":l[1]||(l[1]=c=>at(n)?n.value=c:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[nr,v(n)]]),l[4]||(l[4]=m("span",{class:"text-retro-muted text-sm"},"Include untracked files",-1))])])]),_:1},8,["visible","loading","error"]))}}),l4={class:"space-y-3"},c4={class:"flex items-start gap-2 cursor-pointer"},h4={class:"flex items-start gap-2 cursor-pointer"},u4={key:0,class:"mt-4 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},d4=Xe({__name:"ResetWorkingDialog",props:{visible:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(i,{emit:e}){const t=i,r=e,s=N("mixed"),n=he(()=>s.value==="hard");function o(){r("confirm",{mode:s.value})}return Ye(()=>t.visible,a=>{a&&(s.value="mixed")}),(a,l)=>(y(),xe(bi,{title:"Reset Working Directory",visible:i.visible,loading:i.loading,error:i.error,"confirm-label":"Reset","confirm-danger":v(n),onClose:l[2]||(l[2]=c=>r("close")),onConfirm:o},{default:gt(()=>[l[5]||(l[5]=m("p",{class:"text-retro-text text-sm font-mono mb-4"}," Reset the working directory to HEAD. ",-1)),m("div",l4,[m("label",c4,[je(m("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>at(s)?s.value=c:null),type:"radio",value:"mixed",name:"reset-mode",class:"accent-retro-cyan mt-0.5"},null,512),[[wf,v(s)]]),l[3]||(l[3]=m("div",null,[m("span",{class:"text-retro-text text-sm font-mono"},"Mixed"),m("p",{class:"text-retro-muted text-xs font-mono mt-0.5"}," Reset staging area, keep working directory ")],-1))]),m("label",h4,[je(m("input",{"onUpdate:modelValue":l[1]||(l[1]=c=>at(s)?s.value=c:null),type:"radio",value:"hard",name:"reset-mode",class:"accent-retro-cyan mt-0.5"},null,512),[[wf,v(s)]]),l[4]||(l[4]=m("div",null,[m("span",{class:"text-retro-text text-sm font-mono"},"Hard"),m("p",{class:"text-retro-muted text-xs font-mono mt-0.5"}," Reset staging area AND working directory (DESTRUCTIVE) ")],-1))])]),v(n)?(y(),S("div",u4," WARNING: Hard reset will permanently discard all uncommitted changes. This cannot be undone. ")):se("",!0)]),_:1},8,["visible","loading","error","confirm-danger"]))}}),f4=Xe({__name:"CleanUntrackedDialog",props:{visible:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(i,{emit:e}){const t=e;return(r,s)=>(y(),xe(bi,{title:"Clean Untracked Files",visible:i.visible,loading:i.loading,error:i.error,"confirm-label":"Clean","confirm-danger":"",onClose:s[0]||(s[0]=n=>t("close")),onConfirm:s[1]||(s[1]=n=>t("confirm"))},{default:gt(()=>[...s[2]||(s[2]=[m("div",{class:"space-y-3"},[m("p",{class:"text-retro-text text-sm font-mono"}," Remove all untracked files and directories from the working tree. "),m("p",{class:"text-retro-muted text-xs font-mono"},[We(" This runs "),m("code",null,"git clean -fd"),We(" and cannot be undone. ")])],-1)])]),_:1},8,["visible","loading","error"]))}}),p4={class:"text-retro-muted text-sm"},m4={class:"text-retro-cyan font-mono"},g4={class:"space-y-3"},v4={class:"text-retro-muted text-sm"},O4={class:"text-retro-cyan font-mono"},_4={class:"space-y-3"},b4={class:"text-retro-muted text-sm"},y4={class:"text-retro-magenta font-mono"},x4={key:0,class:"fixed bottom-4 right-4 z-50 flex items-center gap-2 px-4 py-2.5 text-sm bg-retro-red/90 text-white rounded-lg shadow-lg max-w-sm",role:"alert"},w4={class:"flex-1"},S4=Xe({__name:"GitGraphDialogs",props:{dialogs:{},store:{},remoteNames:{},copyFeedback:{}},setup(i){const e=i,{checkoutDialog:t,confirmCheckout:r,createBranchDialog:s,confirmCreateBranch:n,deleteBranchDialog:o,confirmDeleteBranch:a,renameDialog:l,confirmRenameBranch:c,mergeDialog:h,confirmMerge:u,rebaseDialog:d,confirmRebase:f,pushDialog:p,confirmPush:g,pullDialog:O,confirmPull:_,cherryPickDialog:k,confirmCherryPick:P,resetDialog:w,confirmReset:C,tagCreateDialog:M,confirmTagCreate:D,tagDeleteDialog:j,confirmTagDelete:oe,tagDetailDialog:ae,stashDialog:G,confirmStash:x,stashBranchDialog:b,stashBranchInput:T,confirmStashBranch:$,resetWorkingDialog:R,confirmResetWorking:E,cleanUntrackedDialog:Z,confirmCleanUntracked:K}=e.dialogs;return(X,V)=>(y(),S(Me,null,[v(t).visible?(y(),xe(bi,{key:0,title:"Checkout",visible:v(t).visible,loading:v(t).loading,error:v(t).error,confirmLabel:"Checkout",onClose:V[0]||(V[0]=ie=>v(t).visible=!1),onConfirm:v(r)},{default:gt(()=>[m("p",p4,[V[23]||(V[23]=We(" Are you sure you want to checkout ",-1)),m("span",m4,F(v(t).branchName),1),V[24]||(V[24]=We("? ",-1))])]),_:1},8,["visible","loading","error","onConfirm"])):se("",!0),v(l).visible?(y(),xe(bi,{key:1,title:"Rename Branch",visible:v(l).visible,loading:v(l).loading,error:v(l).error,confirmLabel:"Rename",onClose:V[3]||(V[3]=ie=>v(l).visible=!1),onConfirm:v(c)},{default:gt(()=>[m("div",g4,[m("p",v4,[V[25]||(V[25]=We(" Rename ",-1)),m("span",O4,F(v(l).branchName),1)]),je(m("input",{"onUpdate:modelValue":V[1]||(V[1]=ie=>v(l).newName=ie),type:"text",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan",placeholder:"New branch name",onKeyup:V[2]||(V[2]=fn((...ie)=>v(c)&&v(c)(...ie),["enter"]))},null,544),[[$i,v(l).newName]])])]),_:1},8,["visible","loading","error","onConfirm"])):se("",!0),v(h).visible?(y(),xe(M3,{key:2,visible:v(h).visible,branchName:v(h).branchName,loading:v(h).loading,error:v(h).error,onClose:V[4]||(V[4]=ie=>v(h).visible=!1),onConfirm:v(u)},null,8,["visible","branchName","loading","error","onConfirm"])):se("",!0),v(o).visible?(y(),xe(L3,{key:3,visible:v(o).visible,branchName:v(o).branchName,isLocal:v(o).isLocal,loading:v(o).loading,error:v(o).error,onClose:V[5]||(V[5]=ie=>v(o).visible=!1),onConfirm:v(a)},null,8,["visible","branchName","isLocal","loading","error","onConfirm"])):se("",!0),v(p).visible?(y(),xe(V3,{key:4,visible:v(p).visible,branchName:v(p).branchName,remotes:i.remoteNames,loading:v(p).loading,error:v(p).error,onClose:V[6]||(V[6]=ie=>v(p).visible=!1),onConfirm:v(g)},null,8,["visible","branchName","remotes","loading","error","onConfirm"])):se("",!0),v(O).visible?(y(),xe(K3,{key:5,visible:v(O).visible,branchName:v(O).branchName,remotes:i.remoteNames,loading:v(O).loading,error:v(O).error,onClose:V[7]||(V[7]=ie=>v(O).visible=!1),onConfirm:v(_)},null,8,["visible","branchName","remotes","loading","error","onConfirm"])):se("",!0),v(d).visible?(y(),xe(nP,{key:6,visible:v(d).visible,branchName:i.store.currentBranch?.name||"HEAD",ontoBranch:v(d).branchName,loading:v(d).loading,error:v(d).error,onClose:V[8]||(V[8]=ie=>v(d).visible=!1),onConfirm:v(f)},null,8,["visible","branchName","ontoBranch","loading","error","onConfirm"])):se("",!0),v(k).visible?(y(),xe(dP,{key:7,visible:v(k).visible,commitHash:v(k).commitHash,commitMessage:v(k).commitMessage,loading:v(k).loading,error:v(k).error,onClose:V[9]||(V[9]=ie=>v(k).visible=!1),onConfirm:v(P)},null,8,["visible","commitHash","commitMessage","loading","error","onConfirm"])):se("",!0),v(w).visible?(y(),xe(_P,{key:8,visible:v(w).visible,commitHash:v(w).commitHash,commitMessage:v(w).commitMessage,loading:v(w).loading,error:v(w).error,onClose:V[10]||(V[10]=ie=>v(w).visible=!1),onConfirm:v(C)},null,8,["visible","commitHash","commitMessage","loading","error","onConfirm"])):se("",!0),v(M).visible?(y(),xe(QP,{key:9,visible:v(M).visible,commitHash:v(M).commitHash,remotes:i.remoteNames,loading:v(M).loading,error:v(M).error,onClose:V[11]||(V[11]=ie=>v(M).visible=!1),onConfirm:v(D)},null,8,["visible","commitHash","remotes","loading","error","onConfirm"])):se("",!0),v(j).visible?(y(),xe(IP,{key:10,visible:v(j).visible,tagName:v(j).tagName,remotes:i.remoteNames,loading:v(j).loading,error:v(j).error,onClose:V[12]||(V[12]=ie=>v(j).visible=!1),onConfirm:v(oe)},null,8,["visible","tagName","remotes","loading","error","onConfirm"])):se("",!0),v(ae).visible?(y(),xe(JP,{key:11,visible:v(ae).visible,tagName:v(ae).tagName,tagDetail:v(ae).tagDetail,loading:v(ae).loading,onClose:V[13]||(V[13]=ie=>v(ae).visible=!1)},null,8,["visible","tagName","tagDetail","loading"])):se("",!0),v(s).visible?(y(),xe(s4,{key:12,visible:v(s).visible,fromCommit:v(s).fromCommit,loading:v(s).loading,error:v(s).error,onClose:V[14]||(V[14]=ie=>v(s).visible=!1),onConfirm:v(n)},null,8,["visible","fromCommit","loading","error","onConfirm"])):se("",!0),v(b).visible?(y(),xe(bi,{key:13,title:"Create Branch from Stash",visible:v(b).visible,loading:v(b).loading,error:v(b).error,confirmLabel:"Create Branch",onClose:V[17]||(V[17]=ie=>v(b).visible=!1),onConfirm:V[18]||(V[18]=ie=>v($)(v(T)))},{default:gt(()=>[m("div",_4,[m("p",b4,[V[26]||(V[26]=We(" Create a new branch from ",-1)),m("span",y4,"stash@"+F("{")+F(v(b).stashIndex)+F("}"),1)]),je(m("input",{"onUpdate:modelValue":V[15]||(V[15]=ie=>at(T)?T.value=ie:null),type:"text",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan",placeholder:"Branch name",onKeyup:V[16]||(V[16]=fn(ie=>v($)(v(T)),["enter"]))},null,544),[[$i,v(T)]])])]),_:1},8,["visible","loading","error"])):se("",!0),v(G).visible?(y(),xe(a4,{key:14,visible:v(G).visible,loading:v(G).loading,error:v(G).error,onClose:V[19]||(V[19]=ie=>v(G).visible=!1),onConfirm:v(x)},null,8,["visible","loading","error","onConfirm"])):se("",!0),v(R).visible?(y(),xe(d4,{key:15,visible:v(R).visible,loading:v(R).loading,error:v(R).error,onClose:V[20]||(V[20]=ie=>v(R).visible=!1),onConfirm:v(E)},null,8,["visible","loading","error","onConfirm"])):se("",!0),v(Z).visible?(y(),xe(f4,{key:16,visible:v(Z).visible,loading:v(Z).loading,error:v(Z).error,onClose:V[21]||(V[21]=ie=>v(Z).visible=!1),onConfirm:v(K)},null,8,["visible","loading","error","onConfirm"])):se("",!0),(y(),xe(or,{to:"body"},[le(hs,{name:"fade"},{default:gt(()=>[i.copyFeedback.visible?(y(),S("div",{key:0,class:"fixed z-50 px-3 py-1.5 text-sm bg-retro-green text-retro-dark rounded shadow-lg",style:gr({left:`${i.copyFeedback.x}px`,top:`${i.copyFeedback.y-40}px`})}," Copied! ",4)):se("",!0)]),_:1})])),(y(),xe(or,{to:"body"},[le(hs,{name:"fade"},{default:gt(()=>[i.store.operationError?(y(),S("div",x4,[le(v(vn),{class:"w-4 h-4 flex-shrink-0"}),m("span",w4,F(i.store.operationError),1),m("button",{class:"flex-shrink-0 p-0.5 hover:bg-white/20 rounded transition-colors",onClick:V[22]||(V[22]=ie=>i.store.clearOperationError()),"aria-label":"Dismiss error"},[le(v(hi),{class:"w-3.5 h-3.5"})])])):se("",!0)]),_:1})]))],64))}}),k4=zs(S4,[["__scopeId","data-v-c47c4487"]]),$m=globalThis.setInterval,C4={class:"h-full flex flex-col bg-retro-dark",role:"region","aria-label":"Git Graph"},$4={key:0,class:"flex-1 flex flex-col items-center justify-center gap-3"},P4={key:1,class:"flex-1 flex flex-col items-center justify-center p-8 text-center"},T4={key:2,class:"flex-1 flex flex-col items-center justify-center p-8 text-center"},M4={class:"text-retro-red text-sm mb-4"},Q4={key:3,class:"flex-1 flex items-center justify-center p-4"},A4={class:"flex-shrink-0 flex items-center gap-2 p-2 border-b border-retro-border"},R4={class:"relative"},B4={key:0,class:"absolute left-0 top-full mt-1 z-10 bg-retro-panel border border-retro-border rounded shadow-lg py-2 min-w-[200px]"},L4={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},E4=["checked"],D4={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},I4=["checked"],z4={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},N4=["checked"],W4={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Z4=["checked"],X4={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},F4=["checked"],V4={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},q4=["checked"],H4={class:"relative"},U4=["aria-expanded"],Y4={key:0,class:"text-xs"},j4={key:0,class:"absolute right-0 top-full mt-1 z-10 bg-retro-panel border border-retro-border rounded shadow-lg py-1 min-w-[220px] max-h-[400px] overflow-auto"},G4=["checked","onChange"],K4={class:"text-sm text-retro-text truncate"},J4={key:0,class:"text-[10px] text-retro-cyan"},eT={class:"px-3 py-1 text-[10px] text-retro-orange font-semibold uppercase tracking-wider mt-1"},tT=["checked","onChange"],iT={class:"text-sm text-retro-text truncate"},rT={class:"relative"},sT={key:0,class:"absolute right-0 top-full mt-1 z-20"},nT=["title"],oT=5e3,aT=Xe({__name:"GitGraph",props:{workingDirectory:{},isActive:{type:Boolean,default:!0}},setup(i){const e=i,t=Qu(),r=Lr(),s=d3(),n=p3(t),o=m3(t,n),{checkoutDialog:a,confirmCheckout:l,createBranchDialog:c,confirmCreateBranch:h,deleteBranchDialog:u,confirmDeleteBranch:d,renameDialog:f,confirmRenameBranch:p,mergeDialog:g,confirmMerge:O,rebaseDialog:_,confirmRebase:k,pushDialog:P,confirmPush:w,pullDialog:C,confirmPull:M,cherryPickDialog:D,confirmCherryPick:j,resetDialog:oe,confirmReset:ae,tagCreateDialog:G,confirmTagCreate:x,tagDeleteDialog:b,confirmTagDelete:T,tagDetailDialog:$,stashDialog:R,confirmStash:E,stashBranchDialog:Z,stashBranchInput:K,confirmStashBranch:X,resetWorkingDialog:V,confirmResetWorking:ie,cleanUntrackedDialog:q,confirmCleanUntracked:ee,isAnyDialogOpen:te}=n,{copyFeedback:Oe,branchMenu:Te,handleBranchContextMenu:ke,closeBranchMenu:Ze,handleBranchCheckout:Je,handleBranchRename:Ve,handleBranchDelete:I,handleBranchMerge:L,handleBranchRebase:z,handleBranchPush:Q,handleBranchPull:J,handleBranchFetch:de,handleBranchCopyName:Y,handleBranchCreateBranch:be,commitMenu:Ce,handleCommitContextMenu:rt,closeCommitMenu:ot,handleCommitAddTag:ut,handleCommitCreateBranch:ce,handleCommitCheckout:_e,handleCommitCherryPick:Se,handleCommitRevert:Fe,handleCommitMergeInto:Ct,handleCommitReset:fi,handleCommitCopyHash:vt,handleCommitCopySubject:Cr,tagMenu:Ir,handleTagContextMenu:ua,closeTagMenu:da,handleTagViewDetails:Fs,handleTagDelete:ao,handleTagPush:fa,handleTagCopyName:lo,uncommittedMenu:Cn,closeUncommittedMenu:co,handleUncommittedStash:pa,handleUncommittedReset:ma,handleUncommittedClean:ga,stashMenu:zr,handleStashContextMenu:va,closeStashMenu:Oa,handleStashApply:_a,handleStashPop:ba,handleStashDrop:ya,handleStashCreateBranch:xa,handleStashCopyName:wa,handleStashCopyHash:Sa}=o,ka=he(()=>{const Ee=r.activeConversation?.worktreeBranch;return Ee?[Ee]:[]}),Ca=he(()=>{const Ee=[],me=t.selectedFeatureId;me&&Ee.push(me);const Nt=t.conversationBranch;return Nt&&!Ee.includes(Nt)&&Ee.push(Nt),Ee});Ye(()=>[r.activeConversation?.worktreeBranch,r.activeConversation?.baseBranch],([Ee,me])=>{t.setConversationBranch(Ee??null,me??null)},{immediate:!0});const $a=he(()=>{const Ee=t.previewBranch;return Ee?[Ee]:[]});Ye(()=>[r.previewingConversation?.worktreeBranch,r.previewingConversation?.baseBranch],([Ee,me])=>{t.setPreviewBranch(Ee??null,me??null)},{immediate:!0});const Pa=he(()=>av([{branch:t.previewBranch,mergeBase:t.previewMergeBase}])),Ta=he(()=>av([{branch:t.selectedFeatureId,mergeBase:t.featureMergeBase},{branch:t.conversationBranch,mergeBase:t.conversationMergeBase}])),Ma=he(()=>t.remotes.map(Ee=>Ee.name)),ho=N(null);Ye(()=>e.workingDirectory,async Ee=>{if(Ee){await t.loadGitGraph(Ee);const me=r.previewingConversation?.worktreeBranch;me&&await t.setPreviewBranch(me,r.previewingConversation?.baseBranch??null);const Nt=r.activeConversation?.worktreeBranch;Nt&&await t.setConversationBranch(Nt,r.activeConversation?.baseBranch??null)}},{immediate:!0}),Ye(()=>e.isActive,Ee=>{Ee&&t.commits.length>0&&!t.error?s.startPolling(e.workingDirectory):s.stopPolling()},{immediate:!0}),Ye(()=>t.commits.length,Ee=>{Ee>0&&e.isActive&&!t.error&&s.startPolling(e.workingDirectory)}),Ye(()=>ho.value,Ee=>{Ee&&s.setScrollCallbacks({getScrollPosition:()=>Ee.getScrollPosition(),setScrollPosition:me=>Ee.setScrollPosition(me)})}),_i(()=>{s.cleanup(),t.reset()});const Qa=he(()=>t.error?.includes("Not a Git repository")),qt=N(Date.now());let Jt=null;const uo=()=>{Jt||(Jt=$m(()=>{qt.value=Date.now()},oT))},Nr=()=>{Jt&&(clearInterval(Jt),Jt=null)};Qt(()=>{Ye(()=>e.isActive,Ee=>{Ee?(qt.value=Date.now(),uo()):Nr()},{immediate:!0})}),_i(()=>{Nr()});const Vs=he(()=>{const Ee=t.lastRefreshTime;if(!Ee)return null;const me=Math.floor((qt.value-Ee)/1e3);return t.isRefreshing?"Syncing...":me<5?"Just now":me<60?`${me}s ago`:`${Math.floor(me/60)}m ago`}),$r=N(!1),lr=N(!1),fo=N(null);function Aa(){$r.value=!0,xi(()=>fo.value?.focus())}function $n(){$r.value=!1,t.setSearchQuery("")}function Pn(Ee){t.setSearchQuery(Ee)}const zt=f3({onScrollToHead:()=>{const Ee=t.commits.find(me=>me.isHead);Ee&&t.selectCommit(Ee)},onEscape:()=>{Wr.value?Wr.value=!1:lr.value?lr.value=!1:cr.value?cr.value=!1:$r.value?$n():t.isComparing?t.clearComparison():(t.selectedCommit||t.isUncommittedChangesSelected)&&t.clearSelection()}});Qt(()=>{zt.start()}),_i(()=>{zt.stop()});const Wr=N(!1),cr=N(!1);async function po(){await t.fetchAll(!0)}async function Ra(Ee){await t.addRemote(Ee.name,Ee.url)}async function Pr(Ee){await t.editRemote(Ee.name,Ee.newUrl)}async function mo(Ee){await t.deleteRemote(Ee)}const qs=he(()=>{const Ee=[],me={};for(const Nt of t.branches)if(t.localBranchNames.has(Nt.name))Ee.push(Nt);else{const Us=Nt.name.indexOf("/");if(Us>0){const gs=Nt.name.substring(0,Us);me[gs]||(me[gs]=[]),me[gs].push(Nt)}else Ee.push(Nt)}return{local:Ee,remotes:me}});Ye(te,Ee=>{Ee?t.setActiveDialog({type:"generic",props:{}}):t.clearActiveDialog()});function Ba(Ee){t.selectedCommit?t.selectComparisonCommit(Ee):t.selectCommit(Ee)}function Hs(Ee){t.navigateToCommit(Ee)}return(Ee,me)=>{const Nt=Ek,Us=Gk,gs=w5,Tn=F5,La=a$,vs=M$,Os=z$,A=N$,H=W$,W=Z$,U=X$;return y(),S("div",C4,[v(t).loading&&v(t).commits.length===0?(y(),S("div",$4,[...me[20]||(me[20]=[m("div",{class:"w-6 h-6 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),m("div",{class:"text-retro-muted text-sm"},"Loading git history...",-1)])])):v(Qa)?(y(),S("div",P4,[le(v(vn),{class:"w-12 h-12 text-retro-yellow mb-4"}),me[21]||(me[21]=m("h3",{class:"text-retro-text font-semibold mb-2"},"Not a Git Repository",-1)),me[22]||(me[22]=m("p",{class:"text-retro-muted text-sm max-w-xs"},[We(" This directory is not initialized as a Git repository. Run "),m("code",{class:"text-retro-cyan"},"git init"),We(" to get started. ")],-1))])):v(t).error?(y(),S("div",T4,[le(v(vn),{class:"w-10 h-10 text-retro-red mb-3"}),m("p",M4,F(v(t).error),1),m("button",{class:"flex items-center gap-2 px-3 py-1.5 text-sm text-retro-text border border-retro-border rounded hover:border-retro-cyan hover:text-retro-cyan transition-colors",onClick:me[0]||(me[0]=ne=>v(t).loadGitGraph(e.workingDirectory))},[le(v(Kn),{class:"w-4 h-4"}),me[23]||(me[23]=We(" Retry ",-1))])])):v(t).commits.length===0?(y(),S("div",Q4,[...me[24]||(me[24]=[m("div",{class:"text-retro-muted text-center"},[m("p",null,"No commits found in this repository.")],-1)])])):(y(),S(Me,{key:4},[v($r)?(y(),xe(Nt,{key:0,ref_key:"findWidgetRef",ref:fo,resultCount:v(t).searchResultHashes.length,currentIndex:v(t).searchResultIndex,onSearch:Pn,onNext:v(t).nextSearchResult,onPrev:v(t).prevSearchResult,onClose:$n},null,8,["resultCount","currentIndex","onNext","onPrev"])):se("",!0),m("div",A4,[m("button",{class:Ie(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",v($r)?"border-retro-cyan text-retro-cyan bg-retro-cyan/10":"border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text"]),"aria-label":"Find",title:"Find",onClick:me[1]||(me[1]=ne=>v($r)?$n():Aa())},[le(v(Hn),{class:"w-4 h-4"})],2),m("div",R4,[m("button",{class:Ie(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",v(Wr)?"border-retro-cyan text-retro-cyan bg-retro-cyan/10":"border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text"]),"aria-label":"Graph settings",title:"Settings",onClick:me[2]||(me[2]=ne=>Wr.value=!v(Wr))},[le(v(rk),{class:"w-4 h-4"})],2),v(Wr)?(y(),S("div",B4,[me[31]||(me[31]=m("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border mb-1"}," Graph Style ",-1)),m("label",L4,[m("input",{type:"radio",name:"graphStyle",value:"rounded",checked:v(t).graphStyle==="rounded",class:"accent-retro-cyan",onChange:me[3]||(me[3]=ne=>v(t).setGraphStyle("rounded"))},null,40,E4),me[25]||(me[25]=m("span",{class:"text-sm text-retro-text"},"Rounded",-1))]),m("label",D4,[m("input",{type:"radio",name:"graphStyle",value:"angular",checked:v(t).graphStyle==="angular",class:"accent-retro-cyan",onChange:me[4]||(me[4]=ne=>v(t).setGraphStyle("angular"))},null,40,I4),me[26]||(me[26]=m("span",{class:"text-sm text-retro-text"},"Angular",-1))]),me[32]||(me[32]=m("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border mt-2 mb-1"}," Display ",-1)),m("label",z4,[m("input",{type:"checkbox",checked:v(t).muteNonAncestral,class:"accent-retro-cyan",onChange:me[5]||(me[5]=ne=>v(t).toggleMuteNonAncestral())},null,40,N4),me[27]||(me[27]=m("span",{class:"text-sm text-retro-text"},"Mute non-ancestral",-1))]),me[33]||(me[33]=m("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border mt-2 mb-1"}," Columns ",-1)),m("label",W4,[m("input",{type:"checkbox",checked:v(t).columnVisibility.commit!==!1,class:"accent-retro-cyan",onChange:me[6]||(me[6]=ne=>v(t).toggleColumnVisibility("commit"))},null,40,Z4),me[28]||(me[28]=m("span",{class:"text-sm text-retro-text"},"Hash",-1))]),m("label",X4,[m("input",{type:"checkbox",checked:v(t).columnVisibility.author!==!1,class:"accent-retro-cyan",onChange:me[7]||(me[7]=ne=>v(t).toggleColumnVisibility("author"))},null,40,F4),me[29]||(me[29]=m("span",{class:"text-sm text-retro-text"},"Author",-1))]),m("label",V4,[m("input",{type:"checkbox",checked:v(t).columnVisibility.date!==!1,class:"accent-retro-cyan",onChange:me[8]||(me[8]=ne=>v(t).toggleColumnVisibility("date"))},null,40,q4),me[30]||(me[30]=m("span",{class:"text-sm text-retro-text"},"Date",-1))])])):se("",!0)]),me[36]||(me[36]=m("span",{class:"flex-1"},null,-1)),m("div",H4,[m("button",{class:Ie(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",v(lr)||v(t).filteredBranches.length>0?"border-retro-cyan text-retro-cyan bg-retro-cyan/10":"border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text"]),"aria-label":"Filter by branch","aria-expanded":v(lr),onClick:me[9]||(me[9]=ne=>lr.value=!v(lr))},[le(v(yk),{class:"w-4 h-4"}),v(t).filteredBranches.length>0?(y(),S("span",Y4," ("+F(v(t).filteredBranches.length)+") ",1)):se("",!0)],10,U4),v(lr)?(y(),S("div",j4,[me[35]||(me[35]=m("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border"}," Filter by Branch ",-1)),v(t).filteredBranches.length>0?(y(),S("button",{key:0,class:"w-full text-left px-3 py-1.5 text-sm text-retro-cyan hover:bg-retro-cyan/10",onClick:me[10]||(me[10]=ne=>v(t).clearFilters())}," Clear All Filters ")):se("",!0),v(qs).local.length>0?(y(),S(Me,{key:1},[me[34]||(me[34]=m("div",{class:"px-3 py-1 text-[10px] text-retro-green font-semibold uppercase tracking-wider mt-1"}," Local ",-1)),(y(!0),S(Me,null,Ke(v(qs).local,ne=>(y(),S("label",{key:ne.name,class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},[m("input",{type:"checkbox",checked:v(t).filteredBranches.includes(ne.name),class:"accent-retro-cyan",onChange:ve=>v(t).toggleBranchFilter(ne.name)},null,40,G4),m("span",K4,F(ne.name),1),ne.isHead?(y(),S("span",J4,"(HEAD)")):se("",!0)]))),128))],64)):se("",!0),(y(!0),S(Me,null,Ke(v(qs).remotes,(ne,ve)=>(y(),S(Me,{key:ve},[m("div",eT,F(ve),1),(y(!0),S(Me,null,Ke(ne,ge=>(y(),S("label",{key:ge.name,class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},[m("input",{type:"checkbox",checked:v(t).filteredBranches.includes(ge.name),class:"accent-retro-cyan",onChange:Le=>v(t).toggleBranchFilter(ge.name)},null,40,tT),m("span",iT,F(ge.name),1)]))),128))],64))),128))])):se("",!0)]),m("button",{class:Ie(["flex items-center gap-1 px-2 py-1.5 text-sm border border-retro-border text-retro-muted rounded hover:text-retro-text hover:border-retro-text transition-colors",{"animate-spin":v(t).isRefreshing}]),"aria-label":"Refresh",title:"Refresh",onClick:me[11]||(me[11]=ne=>v(t).loadGitGraph(e.workingDirectory))},[le(v(Kn),{class:"w-4 h-4"})],2),m("button",{class:"flex items-center gap-1 px-2 py-1.5 text-sm border border-retro-border text-retro-muted rounded hover:text-retro-text hover:border-retro-text transition-colors","aria-label":"Fetch all remotes",title:"Fetch All",onClick:po},[le(v(M_),{class:"w-4 h-4"})]),m("div",rT,[m("button",{class:Ie(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",v(cr)?"border-retro-cyan text-retro-cyan bg-retro-cyan/10":"border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text"]),"aria-label":"Manage remotes",title:"Remotes",onClick:me[12]||(me[12]=ne=>cr.value=!v(cr))},[le(v(kf),{class:"w-4 h-4"})],2),v(cr)?(y(),S("div",sT,[le(Us,{remotes:v(t).remotes,onAdd:Ra,onEdit:Pr,onDelete:mo,onClose:me[13]||(me[13]=ne=>cr.value=!1)},null,8,["remotes"])])):se("",!0)]),v(Vs)&&e.isActive?(y(),S("div",{key:0,class:Ie(["flex items-center text-[10px] text-retro-muted",{"text-retro-cyan":v(t).isRefreshing}]),title:v(t).lastRefreshTime?`Last checked: ${new Date(v(t).lastRefreshTime).toLocaleTimeString()}`:"","aria-live":"polite","aria-atomic":"true"},[m("span",{class:Ie(["inline-block w-1.5 h-1.5 rounded-full mr-1",v(t).isRefreshing?"bg-retro-cyan animate-pulse":"bg-retro-muted/50"]),"aria-hidden":"true"},null,2),We(" "+F(v(Vs)),1)],10,nT)):se("",!0)]),m("div",{class:Ie(["flex-1 min-h-0 overflow-hidden",{"max-h-[50%]":v(t).selectedCommit||v(t).isUncommittedChangesSelected}])},[le(gs,{ref_key:"commitListRef",ref:ho,commits:v(t).filteredCommits,stashes:v(t).stashes,selectedCommit:v(t).selectedCommit,hasMore:v(t).hasMore,loading:v(t).loading,loadingMore:v(t).loadingMore,searchQuery:v(t).searchQuery,uncommittedChangesCount:v(t).uncommittedChangesCount,isUncommittedChangesSelected:v(t).isUncommittedChangesSelected,highlightBranches:v(ka),featureHighlightBranches:v(Ca),featureMergeBases:v(Ta),previewHighlightBranches:v($a),previewMergeBases:v(Pa),currentBranchName:v(t).currentBranch?.name,localBranchNames:v(t).localBranchNames,graphStyle:v(t).graphStyle,muteNonAncestral:v(t).muteNonAncestral,columnVisibility:v(t).columnVisibility,onSelect:v(t).selectCommit,onLoadMore:v(t).loadMoreCommits,onBranchContextMenu:v(ke),onCommitContextMenu:v(rt),onTagContextMenu:v(ua),onStashContextMenu:v(va),onCompareSelect:Ba,onSelectUncommittedChanges:v(t).selectUncommittedChanges,onScrollStart:v(s).startInteraction,onScrollEnd:v(s).endInteraction},null,8,["commits","stashes","selectedCommit","hasMore","loading","loadingMore","searchQuery","uncommittedChangesCount","isUncommittedChangesSelected","highlightBranches","featureHighlightBranches","featureMergeBases","previewHighlightBranches","previewMergeBases","currentBranchName","localBranchNames","graphStyle","muteNonAncestral","columnVisibility","onSelect","onLoadMore","onBranchContextMenu","onCommitContextMenu","onTagContextMenu","onStashContextMenu","onSelectUncommittedChanges","onScrollStart","onScrollEnd"])],2),v(t).isComparing&&v(t).selectedCommit&&v(t).comparisonCommit?(y(),xe(Tn,{key:1,fromCommit:v(t).comparisonCommit,toCommit:v(t).selectedCommit,files:v(t).comparisonFiles,stats:v(t).comparisonStats,loading:v(t).comparisonLoading,onClose:v(t).clearComparison},null,8,["fromCommit","toCommit","files","stats","loading","onClose"])):v(t).selectedCommit?(y(),xe(La,{key:2,commit:v(t).selectedCommit,files:v(t).selectedCommitFiles,stats:v(t).selectedCommitStats,loading:v(t).isLoadingDetails,detailPosition:v(t).detailViewPosition,onClose:v(t).clearSelection,onNavigateToCommit:Hs,onTogglePosition:v(t).toggleDetailViewPosition,onOpenFileDiff:me[14]||(me[14]=ne=>v(t).selectedCommit&&v(t).openFileDiff(v(t).selectedCommit.hash,ne))},null,8,["commit","files","stats","loading","detailPosition","onClose","onTogglePosition"])):se("",!0),v(t).isUncommittedChangesSelected?(y(),xe(vs,{key:3,stagedFiles:v(t).stagedFiles,unstagedFiles:v(t).unstagedFiles,isStaging:v(t).isStaging,isCommitting:v(t).isCommitting,onClose:v(t).clearSelection,onStageFiles:me[15]||(me[15]=ne=>v(t).stageFiles(ne)),onUnstageFiles:me[16]||(me[16]=ne=>v(t).unstageFiles(ne)),onStageAll:me[17]||(me[17]=()=>v(t).stageFiles([])),onUnstageAll:me[18]||(me[18]=()=>v(t).unstageFiles([])),onCommit:me[19]||(me[19]=ne=>v(t).commitChanges(ne))},null,8,["stagedFiles","unstagedFiles","isStaging","isCommitting","onClose"])):se("",!0)],64)),v(Te).visible?(y(),xe(Os,{key:5,branchName:v(Te).branch,isCurrentBranch:v(Te).isCurrentBranch,isLocal:v(Te).isLocal,x:v(Te).x,y:v(Te).y,onClose:v(Ze),onCheckout:v(Je),onCreateBranch:v(be),onDeleteBranch:v(I),onRename:v(Ve),onMerge:v(L),onRebase:v(z),onPush:v(Q),onPull:v(J),onFetch:v(de),onCopyName:v(Y)},null,8,["branchName","isCurrentBranch","isLocal","x","y","onClose","onCheckout","onCreateBranch","onDeleteBranch","onRename","onMerge","onRebase","onPush","onPull","onFetch","onCopyName"])):se("",!0),v(Ce).visible&&v(Ce).commit?(y(),xe(A,{key:6,commit:v(Ce).commit,x:v(Ce).x,y:v(Ce).y,onClose:v(ot),onAddTag:v(ut),onCreateBranch:v(ce),onCheckout:v(_e),onCherryPick:v(Se),onRevert:v(Fe),onMergeInto:v(Ct),onReset:v(fi),onCopyHash:v(vt),onCopySubject:v(Cr)},null,8,["commit","x","y","onClose","onAddTag","onCreateBranch","onCheckout","onCherryPick","onRevert","onMergeInto","onReset","onCopyHash","onCopySubject"])):se("",!0),v(Ir).visible?(y(),xe(H,{key:7,tagName:v(Ir).tag,x:v(Ir).x,y:v(Ir).y,onClose:v(da),onViewDetails:v(Fs),onDeleteTag:v(ao),onPushTag:v(fa),onCopyName:v(lo)},null,8,["tagName","x","y","onClose","onViewDetails","onDeleteTag","onPushTag","onCopyName"])):se("",!0),v(zr).visible&&v(zr).stash?(y(),xe(W,{key:8,stashIndex:v(zr).stash.index,stashMessage:v(zr).stash.message,x:v(zr).x,y:v(zr).y,onClose:v(Oa),onApply:v(_a),onPop:v(ba),onDrop:v(ya),onCreateBranch:v(xa),onCopyName:v(wa),onCopyHash:v(Sa)},null,8,["stashIndex","stashMessage","x","y","onClose","onApply","onPop","onDrop","onCreateBranch","onCopyName","onCopyHash"])):se("",!0),v(Cn).visible?(y(),xe(U,{key:9,x:v(Cn).x,y:v(Cn).y,onClose:v(co),onStash:v(pa),onReset:v(ma),onClean:v(ga)},null,8,["x","y","onClose","onStash","onReset","onClean"])):se("",!0),le(k4,{dialogs:v(n),store:v(t),remoteNames:v(Ma),copyFeedback:v(Oe)},null,8,["dialogs","store","remoteNames","copyFeedback"])])}}}),lT=zs(aT,[["__scopeId","data-v-e2b31aba"]]),hv=A2("/app-logo.svg"),cT={class:"flex items-start justify-between gap-2"},hT={class:"flex-1 min-w-0"},uT={class:"flex items-center gap-2"},dT={class:"font-mono text-sm text-retro-text truncate"},fT={class:"text-xs font-mono text-retro-muted mt-1 truncate"},pT={class:"flex items-center gap-1 flex-shrink-0"},mT={key:0,class:"inline-flex items-center gap-1 text-[10px] font-mono text-retro-red",title:"Critical traceability gaps"},gT={key:1,class:"inline-flex items-center gap-1 text-[10px] font-mono text-retro-yellow",title:"Major traceability gaps"},vT={key:2,class:"text-[10px] font-mono text-retro-muted mr-1",title:"Completed tasks / total tasks"},OT={key:3,class:"w-2 h-2 rounded-full bg-retro-green",title:"spec"},_T={key:4,class:"w-2 h-2 rounded-full bg-retro-cyan",title:"plan"},bT={key:5,class:"w-2 h-2 rounded-full bg-retro-yellow",title:"tasks"},yT={class:"flex flex-wrap items-center justify-between gap-1 mt-2"},xT={key:0,class:"flex items-center gap-1"},wT=["title","disabled","onClick"],ST=Xe({__name:"FeatureCard",props:{feature:{},skills:{},isActive:{type:Boolean},criticalAlerts:{},majorAlerts:{}},emits:["select","cascade","openChat","skill"],setup(i,{emit:e}){const t={DocumentCheckIcon:mk,PuzzlePieceIcon:rv,DocumentMagnifyingGlassIcon:vk,WrenchScrewdriverIcon:Pk,SparklesIcon:xl,BeakerIcon:lk,ShieldCheckIcon:L_,CommandLineIcon:Q_,CpuChipIcon:q2,LightBulbIcon:Sk},r=i,s=e,n=Lr();function o(d){return t[d]||rv}function a(d){return d.prerequisites.every(f=>r.feature.files.some(p=>p.filename===f))}function l(d){return d.prerequisites.filter(f=>!r.feature.files.some(p=>p.filename===f))}function c(d){return a(d)?`${d.name} (Shift+click: new conversation)`:`Requires: ${l(d).join(", ")}`}const h=he(()=>{const d=n.findConversationByFeature(r.feature.id);return d?n.isConversationStreaming(d.id):!1}),u=he(()=>r.isActive?["border-retro-cyan shadow-retro","feature-card-active","dark:bg-gradient-to-br dark:from-retro-cyan/10 dark:via-retro-panel dark:to-retro-magenta/5"]:["border-retro-border","feature-card-light","hover:border-retro-muted","dark:bg-gradient-to-br","dark:from-retro-panel dark:via-retro-panel dark:to-retro-cyan/5","dark:hover:from-retro-cyan/5 dark:hover:via-retro-panel dark:hover:to-retro-magenta/5"]);return(d,f)=>(y(),S("button",{type:"button",class:Ie(["w-full p-3 text-left rounded-lg border transition-all duration-200 group",v(u)]),onClick:f[5]||(f[5]=p=>s("select",i.feature.id))},[m("div",cT,[m("div",hT,[m("div",uT,[le(v(Jn),{class:Ie(["h-4 w-4 flex-shrink-0 transition-colors duration-200",i.isActive?"text-retro-cyan":"text-retro-muted group-hover:text-retro-cyan"])},null,8,["class"]),m("span",dT,F(i.feature.id),1)]),m("p",fT,F(i.feature.name),1)]),m("div",pT,[i.criticalAlerts>0?(y(),S("span",mT,[f[6]||(f[6]=m("span",{class:"w-1.5 h-1.5 rounded-full bg-retro-red"},null,-1)),We(" "+F(i.criticalAlerts),1)])):se("",!0),i.majorAlerts>0?(y(),S("span",gT,[f[7]||(f[7]=m("span",{class:"w-1.5 h-1.5 rounded-full bg-retro-yellow"},null,-1)),We(" "+F(i.majorAlerts),1)])):se("",!0),i.feature.hasTasks?(y(),S("span",vT,F(i.feature.completedTasks)+"/"+F(i.feature.totalTasks),1)):se("",!0),i.feature.hasSpec?(y(),S("span",OT)):se("",!0),i.feature.hasPlan?(y(),S("span",_T)):se("",!0),i.feature.hasTasks?(y(),S("span",bT)):se("",!0)])]),m("div",yT,[i.feature.hasSpec?(y(),S("div",xT,[m("button",{type:"button",class:"flex items-center justify-center p-1 bg-retro-cyan/20 text-retro-cyan rounded hover:bg-retro-cyan/30 transition-colors",title:"Clarify spec (Shift+click: new conversation)",onClick:f[0]||(f[0]=Ri(p=>s("cascade",p,i.feature.id,"clarify"),["stop"]))},[le(v(B_),{class:"h-3.5 w-3.5"})]),m("button",{type:"button",class:"flex items-center justify-center p-1 bg-retro-cyan/20 text-retro-cyan rounded hover:bg-retro-cyan/30 transition-colors",title:"Plan → Tasks → Implement (Shift+click: new conversation)",onClick:f[1]||(f[1]=Ri(p=>s("cascade",p,i.feature.id,"plan"),["stop"]))},[le(v(T_),{class:"h-3.5 w-3.5"})]),i.feature.hasPlan?(y(),S("button",{key:0,type:"button",class:"flex items-center justify-center p-1 bg-retro-yellow/20 text-retro-yellow rounded hover:bg-retro-yellow/30 transition-colors",title:"Tasks → Implement (Shift+click: new conversation)",onClick:f[2]||(f[2]=Ri(p=>s("cascade",p,i.feature.id,"tasks"),["stop"]))},[le(v(A_),{class:"h-3.5 w-3.5"})])):se("",!0),i.feature.hasTasks?(y(),S("button",{key:1,type:"button",class:"flex items-center justify-center p-1 bg-retro-magenta/20 text-retro-magenta rounded hover:bg-retro-magenta/30 transition-colors",title:"Implement (Shift+click: new conversation)",onClick:f[3]||(f[3]=Ri(p=>s("cascade",p,i.feature.id,"implement"),["stop"]))},[le(v(Ck),{class:"h-3.5 w-3.5"})])):se("",!0),i.skills.length>0?(y(),S(Me,{key:2},[f[8]||(f[8]=m("div",{class:"w-px h-4 bg-retro-border mx-0.5"},null,-1)),(y(!0),S(Me,null,Ke(i.skills,p=>(y(),S("button",{key:p.id,type:"button",class:Ie(["flex items-center justify-center p-1 rounded transition-colors",[a(p)&&!v(h)?"bg-retro-pink/20 text-retro-pink hover:bg-retro-pink/30":"bg-retro-subtle/10 text-retro-subtle cursor-not-allowed",v(h)?"animate-pulse":""]]),title:c(p),disabled:!a(p)||v(h),onClick:Ri(g=>s("skill",g,i.feature.id,p.id),["stop"])},[(y(),xe(jl(o(p.icon)),{class:"h-3.5 w-3.5"}))],10,wT))),128))],64)):se("",!0)])):se("",!0),i.feature.hasSpec?(y(),S("button",{key:1,type:"button",class:"flex items-center justify-center p-1 bg-retro-green/20 text-retro-green rounded hover:bg-retro-green/30 transition-colors",title:"Open new chat linked to this spec",onClick:f[4]||(f[4]=Ri(p=>s("openChat",p,i.feature.id),["stop"]))},[le(v(uk),{class:"h-3.5 w-3.5"})])):se("",!0)])],2))}});let Cf=[],N_=[];(()=>{let i="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<i.length;e++)(e%2?N_:Cf).push(t=t+i[e])})();function kT(i){if(i<768)return!1;for(let e=0,t=Cf.length;;){let r=e+t>>1;if(i<Cf[r])t=r;else if(i>=N_[r])e=r+1;else return!0;if(e==t)return!1}}function uv(i){return i>=127462&&i<=127487}const dv=8205;function CT(i,e,t=!0,r=!0){return(t?W_:$T)(i,e,r)}function W_(i,e,t){if(e==i.length)return e;e&&Z_(i.charCodeAt(e))&&X_(i.charCodeAt(e-1))&&e--;let r=Ku(i,e);for(e+=fv(r);e<i.length;){let s=Ku(i,e);if(r==dv||s==dv||t&&kT(s))e+=fv(s),r=s;else if(uv(s)){let n=0,o=e-2;for(;o>=0&&uv(Ku(i,o));)n++,o-=2;if(n%2==0)break;e+=2}else break}return e}function $T(i,e,t){for(;e>0;){let r=W_(i,e-2,t);if(r<e)return r;e--}return 0}function Ku(i,e){let t=i.charCodeAt(e);if(!X_(t)||e+1==i.length)return t;let r=i.charCodeAt(e+1);return Z_(r)?(t-55296<<10)+(r-56320)+65536:t}function Z_(i){return i>=56320&&i<57344}function X_(i){return i>=55296&&i<56320}function fv(i){return i<65536?1:2}let ct=class F_{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,r){[e,t]=Vo(this,e,t);let s=[];return this.decompose(0,e,s,2),r.length&&r.decompose(0,r.length,s,3),this.decompose(t,this.length,s,1),Kr.from(s,this.length-(t-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Vo(this,e,t);let r=[];return this.decompose(e,t,r,0),Kr.from(r,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),s=new fl(this),n=new fl(e);for(let o=t,a=t;;){if(s.next(o),n.next(o),o=0,s.lineBreak!=n.lineBreak||s.done!=n.done||s.value!=n.value)return!1;if(a+=s.value.length,s.done||a>=r)return!0}}iter(e=1){return new fl(this,e)}iterRange(e,t=this.length){return new V_(this,e,t)}iterLines(e,t){let r;if(e==null)r=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;r=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new q_(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?F_.empty:e.length<=32?new Dt(e):Kr.from(Dt.split(e,[]))}};class Dt extends ct{constructor(e,t=PT(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,r,s){for(let n=0;;n++){let o=this.text[n],a=s+o.length;if((t?r:a)>=e)return new TT(s,a,r,o);s=a+1,r++}}decompose(e,t,r,s){let n=e<=0&&t>=this.length?this:new Dt(pv(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=r.pop(),a=fh(n.text,o.text.slice(),0,n.length);if(a.length<=32)r.push(new Dt(a,o.length+n.length));else{let l=a.length>>1;r.push(new Dt(a.slice(0,l)),new Dt(a.slice(l)))}}else r.push(n)}replace(e,t,r){if(!(r instanceof Dt))return super.replace(e,t,r);[e,t]=Vo(this,e,t);let s=fh(this.text,fh(r.text,pv(this.text,0,e)),t),n=this.length+r.length-(t-e);return s.length<=32?new Dt(s,n):Kr.from(Dt.split(s,[]),n)}sliceString(e,t=this.length,r=`
11
+ `){[e,t]=Vo(this,e,t);let s="";for(let n=0,o=0;n<=t&&o<this.text.length;o++){let a=this.text[o],l=n+a.length;n>e&&o&&(s+=r),e<l&&t>n&&(s+=a.slice(Math.max(0,e-n),t-n)),n=l+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let r=[],s=-1;for(let n of e)r.push(n),s+=n.length+1,r.length==32&&(t.push(new Dt(r,s)),r=[],s=-1);return s>-1&&t.push(new Dt(r,s)),t}}class Kr extends ct{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,t,r,s){for(let n=0;;n++){let o=this.children[n],a=s+o.length,l=r+o.lines-1;if((t?l:a)>=e)return o.lineInner(e,t,r,s);s=a+1,r=l+1}}decompose(e,t,r,s){for(let n=0,o=0;o<=t&&n<this.children.length;n++){let a=this.children[n],l=o+a.length;if(e<=l&&t>=o){let c=s&((o<=e?1:0)|(l>=t?2:0));o>=e&&l<=t&&!c?r.push(a):a.decompose(e-o,t-o,r,c)}o=l+1}}replace(e,t,r){if([e,t]=Vo(this,e,t),r.lines<this.lines)for(let s=0,n=0;s<this.children.length;s++){let o=this.children[s],a=n+o.length;if(e>=n&&t<=a){let l=o.replace(e-n,t-n,r),c=this.lines-o.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let h=this.children.slice();return h[s]=l,new Kr(h,this.length-(t-e)+r.length)}return super.replace(n,a,l)}n=a+1}return super.replace(e,t,r)}sliceString(e,t=this.length,r=`
12
+ `){[e,t]=Vo(this,e,t);let s="";for(let n=0,o=0;n<this.children.length&&o<=t;n++){let a=this.children[n],l=o+a.length;o>e&&n&&(s+=r),e<l&&t>o&&(s+=a.sliceString(e-o,t-o,r)),o=l+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Kr))return 0;let r=0,[s,n,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,n+=t){if(s==o||n==a)return r;let l=this.children[s],c=e.children[n];if(l!=c)return r+l.scanIdentical(c,t);r+=l.length+1}}static from(e,t=e.reduce((r,s)=>r+s.length+1,-1)){let r=0;for(let f of e)r+=f.lines;if(r<32){let f=[];for(let p of e)p.flatten(f);return new Dt(f,t)}let s=Math.max(32,r>>5),n=s<<1,o=s>>1,a=[],l=0,c=-1,h=[];function u(f){let p;if(f.lines>n&&f instanceof Kr)for(let g of f.children)u(g);else f.lines>o&&(l>o||!l)?(d(),a.push(f)):f instanceof Dt&&l&&(p=h[h.length-1])instanceof Dt&&f.lines+p.lines<=32?(l+=f.lines,c+=f.length+1,h[h.length-1]=new Dt(p.text.concat(f.text),p.length+1+f.length)):(l+f.lines>s&&d(),l+=f.lines,c+=f.length+1,h.push(f))}function d(){l!=0&&(a.push(h.length==1?h[0]:Kr.from(h,c)),c=-1,l=h.length=0)}for(let f of e)u(f);return d(),a.length==1?a[0]:new Kr(a,t)}}ct.empty=new Dt([""],0);function PT(i){let e=-1;for(let t of i)e+=t.length+1;return e}function fh(i,e,t=0,r=1e9){for(let s=0,n=0,o=!0;n<i.length&&s<=r;n++){let a=i[n],l=s+a.length;l>=t&&(l>r&&(a=a.slice(0,r-s)),s<t&&(a=a.slice(t-s)),o?(e[e.length-1]+=a,o=!1):e.push(a)),s=l+1}return e}function pv(i,e,t){return fh(i,[""],e,t)}class fl{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof Dt?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,s=this.nodes[r],n=this.offsets[r],o=n>>1,a=s instanceof Dt?s.text.length:s.children.length;if(o==(t>0?a:0)){if(r==0)return this.done=!0,this.value="",this;t>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((n&1)==(t>0?0:1)){if(this.offsets[r]+=t,e==0)return this.lineBreak=!0,this.value=`
13
+ `,this;e--}else if(s instanceof Dt){let l=s.text[o+(t<0?-1:0)];if(this.offsets[r]+=t,l.length>Math.max(0,e))return this.value=e==0?l:t>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=s.children[o+(t<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=t):(t<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(t>0?1:(l instanceof Dt?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class V_{constructor(e,t,r){this.value="",this.done=!1,this.cursor=new fl(e,t>r?-1:1),this.pos=t>r?e.length:0,this.from=Math.min(t,r),this.to=Math.max(t,r)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let r=t<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=r?s:t<0?s.slice(s.length-r):s.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class q_{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:r,value:s}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(ct.prototype[Symbol.iterator]=function(){return this.iter()},fl.prototype[Symbol.iterator]=V_.prototype[Symbol.iterator]=q_.prototype[Symbol.iterator]=function(){return this});let TT=class{constructor(e,t,r,s){this.from=e,this.to=t,this.number=r,this.text=s}get length(){return this.to-this.from}};function Vo(i,e,t){return e=Math.max(0,Math.min(i.length,e)),[e,Math.max(e,Math.min(i.length,t))]}function ci(i,e,t=!0,r=!0){return CT(i,e,t,r)}function MT(i){return i>=56320&&i<57344}function QT(i){return i>=55296&&i<56320}function Xi(i,e){let t=i.charCodeAt(e);if(!QT(t)||e+1==i.length)return t;let r=i.charCodeAt(e+1);return MT(r)?(t-55296<<10)+(r-56320)+65536:t}function Pm(i){return i<=65535?String.fromCharCode(i):(i-=65536,String.fromCharCode((i>>10)+55296,(i&1023)+56320))}function Jr(i){return i<65536?1:2}const $f=/\r\n?|\n/;var vi=(function(i){return i[i.Simple=0]="Simple",i[i.TrackDel=1]="TrackDel",i[i.TrackBefore=2]="TrackBefore",i[i.TrackAfter=3]="TrackAfter",i})(vi||(vi={}));class as{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let r=this.sections[t+1];e+=r<0?this.sections[t]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,r=0,s=0;t<this.sections.length;){let n=this.sections[t++],o=this.sections[t++];o<0?(e(r,s,n),s+=n):s+=o,r+=n}}iterChangedRanges(e,t=!1){Pf(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let r=this.sections[t++],s=this.sections[t++];s<0?e.push(r,s):e.push(s,r)}return new as(e)}composeDesc(e){return this.empty?e:e.empty?this:H_(this,e)}mapDesc(e,t=!1){return e.empty?this:Tf(this,e,t)}mapPos(e,t=-1,r=vi.Simple){let s=0,n=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=s+a;if(l<0){if(c>e)return n+(e-s);n+=a}else{if(r!=vi.Simple&&c>=e&&(r==vi.TrackDel&&s<e&&c>e||r==vi.TrackBefore&&s<e||r==vi.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!a)return e==s||t<0?n:n+l;n+=l}s=c}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return n}touchesRange(e,t=e){for(let r=0,s=0;r<this.sections.length&&s<=t;){let n=this.sections[r++],o=this.sections[r++],a=s+n;if(o>=0&&s<=t&&a>=e)return s<e&&a>t?"cover":!0;s=a}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let r=this.sections[t++],s=this.sections[t++];e+=(e?" ":"")+r+(s>=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new as(e)}static create(e){return new as(e)}}class jt extends as{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Pf(this,(t,r,s,n,o)=>e=e.replace(s,s+(r-t),o),!1),e}mapDesc(e,t=!1){return Tf(this,e,t,!0)}invert(e){let t=this.sections.slice(),r=[];for(let s=0,n=0;s<t.length;s+=2){let o=t[s],a=t[s+1];if(a>=0){t[s]=a,t[s+1]=o;let l=s>>1;for(;r.length<l;)r.push(ct.empty);r.push(o?e.slice(n,n+o):ct.empty)}n+=o}return new jt(t,r)}compose(e){return this.empty?e:e.empty?this:H_(this,e,!0)}map(e,t=!1){return e.empty?this:Tf(this,e,t,!0)}iterChanges(e,t=!1){Pf(this,e,t)}get desc(){return as.create(this.sections)}filter(e){let t=[],r=[],s=[],n=new wl(this);e:for(let o=0,a=0;;){let l=o==e.length?1e9:e[o++];for(;a<l||a==l&&n.len==0;){if(n.done)break e;let h=Math.min(n.len,l-a);ki(s,h,-1);let u=n.ins==-1?-1:n.off==0?n.ins:0;ki(t,h,u),u>0&&un(r,t,n.text),n.forward(h),a+=h}let c=e[o++];for(;a<c;){if(n.done)break e;let h=Math.min(n.len,c-a);ki(t,h,-1),ki(s,h,n.ins==-1?-1:n.off==0?n.ins:0),n.forward(h),a+=h}}return{changes:new jt(t,r),filtered:as.create(s)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let r=this.sections[t],s=this.sections[t+1];s<0?e.push(r):s==0?e.push([r]):e.push([r].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,r){let s=[],n=[],o=0,a=null;function l(h=!1){if(!h&&!s.length)return;o<t&&ki(s,t-o,-1);let u=new jt(s,n);a=a?a.compose(u.map(a)):u,s=[],n=[],o=0}function c(h){if(Array.isArray(h))for(let u of h)c(u);else if(h instanceof jt){if(h.length!=t)throw new RangeError(`Mismatched change set length (got ${h.length}, expected ${t})`);l(),a=a?a.compose(h.map(a)):h}else{let{from:u,to:d=u,insert:f}=h;if(u>d||u<0||d>t)throw new RangeError(`Invalid change range ${u} to ${d} (in doc of length ${t})`);let p=f?typeof f=="string"?ct.of(f.split(r||$f)):f:ct.empty,g=p.length;if(u==d&&g==0)return;u<o&&l(),u>o&&ki(s,u-o,-1),ki(s,d-u,g),un(n,s,p),o=d}}return c(e),l(!a),a}static empty(e){return new jt(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],r=[];for(let s=0;s<e.length;s++){let n=e[s];if(typeof n=="number")t.push(n,-1);else{if(!Array.isArray(n)||typeof n[0]!="number"||n.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(n.length==1)t.push(n[0],0);else{for(;r.length<s;)r.push(ct.empty);r[s]=ct.of(n.slice(1)),t.push(n[0],r[s].length)}}}return new jt(t,r)}static createSet(e,t){return new jt(e,t)}}function ki(i,e,t,r=!1){if(e==0&&t<=0)return;let s=i.length-2;s>=0&&t<=0&&t==i[s+1]?i[s]+=e:s>=0&&e==0&&i[s]==0?i[s+1]+=t:r?(i[s]+=e,i[s+1]+=t):i.push(e,t)}function un(i,e,t){if(t.length==0)return;let r=e.length-2>>1;if(r<i.length)i[i.length-1]=i[i.length-1].append(t);else{for(;i.length<r;)i.push(ct.empty);i.push(t)}}function Pf(i,e,t){let r=i.inserted;for(let s=0,n=0,o=0;o<i.sections.length;){let a=i.sections[o++],l=i.sections[o++];if(l<0)s+=a,n+=a;else{let c=s,h=n,u=ct.empty;for(;c+=a,h+=l,l&&r&&(u=u.append(r[o-2>>1])),!(t||o==i.sections.length||i.sections[o+1]<0);)a=i.sections[o++],l=i.sections[o++];e(s,c,n,h,u),s=c,n=h}}}function Tf(i,e,t,r=!1){let s=[],n=r?[]:null,o=new wl(i),a=new wl(e);for(let l=-1;;){if(o.done&&a.len||a.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&a.ins==-1){let c=Math.min(o.len,a.len);ki(s,c,-1),o.forward(c),a.forward(c)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!t))){let c=a.len;for(ki(s,a.ins,-1);c;){let h=Math.min(o.len,c);o.ins>=0&&l<o.i&&o.len<=h&&(ki(s,0,o.ins),n&&un(n,s,o.text),l=o.i),o.forward(h),c-=h}a.next()}else if(o.ins>=0){let c=0,h=o.len;for(;h;)if(a.ins==-1){let u=Math.min(h,a.len);c+=u,h-=u,a.forward(u)}else if(a.ins==0&&a.len<h)h-=a.len,a.next();else break;ki(s,c,l<o.i?o.ins:0),n&&l<o.i&&un(n,s,o.text),l=o.i,o.forward(o.len-h)}else{if(o.done&&a.done)return n?jt.createSet(s,n):as.create(s);throw new Error("Mismatched change set lengths")}}}function H_(i,e,t=!1){let r=[],s=t?[]:null,n=new wl(i),o=new wl(e);for(let a=!1;;){if(n.done&&o.done)return s?jt.createSet(r,s):as.create(r);if(n.ins==0)ki(r,n.len,0,a),n.next();else if(o.len==0&&!o.done)ki(r,0,o.ins,a),s&&un(s,r,o.text),o.next();else{if(n.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(n.len2,o.len),c=r.length;if(n.ins==-1){let h=o.ins==-1?-1:o.off?0:o.ins;ki(r,l,h,a),s&&h&&un(s,r,o.text)}else o.ins==-1?(ki(r,n.off?0:n.len,l,a),s&&un(s,r,n.textBit(l))):(ki(r,n.off?0:n.len,o.off?0:o.ins,a),s&&!o.off&&un(s,r,o.text));a=(n.ins>l||o.ins>=0&&o.len>l)&&(a||r.length>c),n.forward2(l),o.forward(l)}}}}class wl{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?ct.empty:e[t]}textBit(e){let{inserted:t}=this.set,r=this.i-2>>1;return r>=t.length&&!e?ct.empty:t[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Wn{constructor(e,t,r){this.from=e,this.to=t,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let r,s;return this.empty?r=s=e.mapPos(this.from,t):(r=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),r==this.from&&s==this.to?this:new Wn(r,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return ue.range(e,t);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return ue.range(this.anchor,r)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return ue.range(e.anchor,e.head)}static create(e,t,r){return new Wn(e,t,r)}}class ue{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:ue.create(this.ranges.map(r=>r.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new ue([this.main],0)}addRange(e,t=!0){return ue.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let r=this.ranges.slice();return r[t]=e,ue.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new ue(e.ranges.map(t=>Wn.fromJSON(t)),e.main)}static single(e,t=e){return new ue([ue.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,s=0;s<e.length;s++){let n=e[s];if(n.empty?n.from<=r:n.from<r)return ue.normalized(e.slice(),t);r=n.to}return new ue(e,t)}static cursor(e,t=0,r,s){return Wn.create(e,e,(t==0?0:t<0?8:16)|(r==null?7:Math.min(6,r))|(s??16777215)<<6)}static range(e,t,r,s){let n=(r??16777215)<<6|(s==null?7:Math.min(6,s));return t<e?Wn.create(t,e,48|n):Wn.create(e,t,(t>e?8:0)|n)}static normalized(e,t=0){let r=e[t];e.sort((s,n)=>s.from-n.from),t=e.indexOf(r);for(let s=1;s<e.length;s++){let n=e[s],o=e[s-1];if(n.empty?n.from<=o.to:n.from<o.to){let a=o.from,l=Math.max(n.to,o.to);s<=t&&t--,e.splice(--s,2,n.anchor>n.head?ue.range(l,a):ue.range(a,l))}}return new ue(e,t)}}function U_(i,e){for(let t of i.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Tm=0;class Ae{constructor(e,t,r,s,n){this.combine=e,this.compareInput=t,this.compare=r,this.isStatic=s,this.id=Tm++,this.default=e([]),this.extensions=typeof n=="function"?n(this):n}get reader(){return this}static define(e={}){return new Ae(e.combine||(t=>t),e.compareInput||((t,r)=>t===r),e.compare||(e.combine?(t,r)=>t===r:Mm),!!e.static,e.enables)}of(e){return new ph([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new ph(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new ph(e,this,2,t)}from(e,t){return t||(t=r=>r),this.compute([e],r=>t(r.field(e)))}}function Mm(i,e){return i==e||i.length==e.length&&i.every((t,r)=>t===e[r])}class ph{constructor(e,t,r,s){this.dependencies=e,this.facet=t,this.type=r,this.value=s,this.id=Tm++}dynamicSlot(e){var t;let r=this.value,s=this.facet.compareInput,n=this.id,o=e[n]>>1,a=this.type==2,l=!1,c=!1,h=[];for(let u of this.dependencies)u=="doc"?l=!0:u=="selection"?c=!0:(((t=e[u.id])!==null&&t!==void 0?t:1)&1)==0&&h.push(e[u.id]);return{create(u){return u.values[o]=r(u),1},update(u,d){if(l&&d.docChanged||c&&(d.docChanged||d.selection)||Mf(u,h)){let f=r(u);if(a?!mv(f,u.values[o],s):!s(f,u.values[o]))return u.values[o]=f,1}return 0},reconfigure:(u,d)=>{let f,p=d.config.address[n];if(p!=null){let g=zh(d,p);if(this.dependencies.every(O=>O instanceof Ae?d.facet(O)===u.facet(O):O instanceof ui?d.field(O,!1)==u.field(O,!1):!0)||(a?mv(f=r(u),g,s):s(f=r(u),g)))return u.values[o]=g,0}else f=r(u);return u.values[o]=f,1}}}}function mv(i,e,t){if(i.length!=e.length)return!1;for(let r=0;r<i.length;r++)if(!t(i[r],e[r]))return!1;return!0}function Mf(i,e){let t=!1;for(let r of e)pl(i,r)&1&&(t=!0);return t}function AT(i,e,t){let r=t.map(l=>i[l.id]),s=t.map(l=>l.type),n=r.filter(l=>!(l&1)),o=i[e.id]>>1;function a(l){let c=[];for(let h=0;h<r.length;h++){let u=zh(l,r[h]);if(s[h]==2)for(let d of u)c.push(d);else c.push(u)}return e.combine(c)}return{create(l){for(let c of r)pl(l,c);return l.values[o]=a(l),1},update(l,c){if(!Mf(l,n))return 0;let h=a(l);return e.compare(h,l.values[o])?0:(l.values[o]=h,1)},reconfigure(l,c){let h=Mf(l,r),u=c.config.facets[e.id],d=c.facet(e);if(u&&!h&&Mm(t,u))return l.values[o]=d,0;let f=a(l);return e.compare(f,d)?(l.values[o]=d,0):(l.values[o]=f,1)}}}const Cc=Ae.define({static:!0});class ui{constructor(e,t,r,s,n){this.id=e,this.createF=t,this.updateF=r,this.compareF=s,this.spec=n,this.provides=void 0}static define(e){let t=new ui(Tm++,e.create,e.update,e.compare||((r,s)=>r===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Cc).find(r=>r.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:r=>(r.values[t]=this.create(r),1),update:(r,s)=>{let n=r.values[t],o=this.updateF(n,s);return this.compareF(n,o)?0:(r.values[t]=o,1)},reconfigure:(r,s)=>{let n=r.facet(Cc),o=s.facet(Cc),a;return(a=n.find(l=>l.field==this))&&a!=o.find(l=>l.field==this)?(r.values[t]=a.create(r),1):s.config.address[this.id]!=null?(r.values[t]=s.field(this),0):(r.values[t]=this.create(r),1)}}}init(e){return[this,Cc.of({field:this,create:e})]}get extension(){return this}}const In={lowest:4,low:3,default:2,high:1,highest:0};function Ea(i){return e=>new Y_(e,i)}const Ns={highest:Ea(In.highest),high:Ea(In.high),default:Ea(In.default),low:Ea(In.low),lowest:Ea(In.lowest)};class Y_{constructor(e,t){this.inner=e,this.prec=t}}class Au{of(e){return new Qf(this,e)}reconfigure(e){return Au.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Qf{constructor(e,t){this.compartment=e,this.inner=t}}class Ih{constructor(e,t,r,s,n,o){for(this.base=e,this.compartments=t,this.dynamicSlots=r,this.address=s,this.staticValues=n,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,r){let s=[],n=Object.create(null),o=new Map;for(let d of RT(e,t,o))d instanceof ui?s.push(d):(n[d.facet.id]||(n[d.facet.id]=[])).push(d);let a=Object.create(null),l=[],c=[];for(let d of s)a[d.id]=c.length<<1,c.push(f=>d.slot(f));let h=r?.config.facets;for(let d in n){let f=n[d],p=f[0].facet,g=h&&h[d]||[];if(f.every(O=>O.type==0))if(a[p.id]=l.length<<1|1,Mm(g,f))l.push(r.facet(p));else{let O=p.combine(f.map(_=>_.value));l.push(r&&p.compare(O,r.facet(p))?r.facet(p):O)}else{for(let O of f)O.type==0?(a[O.id]=l.length<<1|1,l.push(O.value)):(a[O.id]=c.length<<1,c.push(_=>O.dynamicSlot(_)));a[p.id]=c.length<<1,c.push(O=>AT(O,p,f))}}let u=c.map(d=>d(a));return new Ih(e,o,u,a,l,n)}}function RT(i,e,t){let r=[[],[],[],[],[]],s=new Map;function n(o,a){let l=s.get(o);if(l!=null){if(l<=a)return;let c=r[l].indexOf(o);c>-1&&r[l].splice(c,1),o instanceof Qf&&t.delete(o.compartment)}if(s.set(o,a),Array.isArray(o))for(let c of o)n(c,a);else if(o instanceof Qf){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(o.compartment)||o.inner;t.set(o.compartment,c),n(c,a)}else if(o instanceof Y_)n(o.inner,o.prec);else if(o instanceof ui)r[a].push(o),o.provides&&n(o.provides,a);else if(o instanceof ph)r[a].push(o),o.facet.extensions&&n(o.facet.extensions,In.default);else{let c=o.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);n(c,a)}}return n(i,In.default),r.reduce((o,a)=>o.concat(a))}function pl(i,e){if(e&1)return 2;let t=e>>1,r=i.status[t];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;i.status[t]=4;let s=i.computeSlot(i,i.config.dynamicSlots[t]);return i.status[t]=2|s}function zh(i,e){return e&1?i.config.staticValues[e>>1]:i.values[e>>1]}const j_=Ae.define(),Af=Ae.define({combine:i=>i.some(e=>e),static:!0}),G_=Ae.define({combine:i=>i.length?i[0]:void 0,static:!0}),K_=Ae.define(),J_=Ae.define(),eb=Ae.define(),tb=Ae.define({combine:i=>i.length?i[0]:!1});class Ws{constructor(e,t){this.type=e,this.value=t}static define(){return new BT}}class BT{of(e){return new Ws(this,e)}}class LT{constructor(e){this.map=e}of(e){return new He(this,e)}}class He{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new He(this.type,t)}is(e){return this.type==e}static define(e={}){return new LT(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let r=[];for(let s of e){let n=s.map(t);n&&r.push(n)}return r}}He.reconfigure=He.define();He.appendConfig=He.define();class Ft{constructor(e,t,r,s,n,o){this.startState=e,this.changes=t,this.selection=r,this.effects=s,this.annotations=n,this.scrollIntoView=o,this._doc=null,this._state=null,r&&U_(r,t.newLength),n.some(a=>a.type==Ft.time)||(this.annotations=n.concat(Ft.time.of(Date.now())))}static create(e,t,r,s,n,o){return new Ft(e,t,r,s,n,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(Ft.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}Ft.time=Ws.define();Ft.userEvent=Ws.define();Ft.addToHistory=Ws.define();Ft.remote=Ws.define();function ET(i,e){let t=[];for(let r=0,s=0;;){let n,o;if(r<i.length&&(s==e.length||e[s]>=i[r]))n=i[r++],o=i[r++];else if(s<e.length)n=e[s++],o=e[s++];else return t;!t.length||t[t.length-1]<n?t.push(n,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function ib(i,e,t){var r;let s,n,o;return t?(s=e.changes,n=jt.empty(e.changes.length),o=i.changes.compose(e.changes)):(s=e.changes.map(i.changes),n=i.changes.mapDesc(e.changes,!0),o=i.changes.compose(s)),{changes:o,selection:e.selection?e.selection.map(n):(r=i.selection)===null||r===void 0?void 0:r.map(s),effects:He.mapEffects(i.effects,s).concat(He.mapEffects(e.effects,n)),annotations:i.annotations.length?i.annotations.concat(e.annotations):e.annotations,scrollIntoView:i.scrollIntoView||e.scrollIntoView}}function Rf(i,e,t){let r=e.selection,s=Bo(e.annotations);return e.userEvent&&(s=s.concat(Ft.userEvent.of(e.userEvent))),{changes:e.changes instanceof jt?e.changes:jt.of(e.changes||[],t,i.facet(G_)),selection:r&&(r instanceof ue?r:ue.single(r.anchor,r.head)),effects:Bo(e.effects),annotations:s,scrollIntoView:!!e.scrollIntoView}}function rb(i,e,t){let r=Rf(i,e.length?e[0]:{},i.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let n=1;n<e.length;n++){e[n].filter===!1&&(t=!1);let o=!!e[n].sequential;r=ib(r,Rf(i,e[n],o?r.changes.newLength:i.doc.length),o)}let s=Ft.create(i,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return IT(t?DT(s):s)}function DT(i){let e=i.startState,t=!0;for(let s of e.facet(K_)){let n=s(i);if(n===!1){t=!1;break}Array.isArray(n)&&(t=t===!0?n:ET(t,n))}if(t!==!0){let s,n;if(t===!1)n=i.changes.invertedDesc,s=jt.empty(e.doc.length);else{let o=i.changes.filter(t);s=o.changes,n=o.filtered.mapDesc(o.changes).invertedDesc}i=Ft.create(e,s,i.selection&&i.selection.map(n),He.mapEffects(i.effects,n),i.annotations,i.scrollIntoView)}let r=e.facet(J_);for(let s=r.length-1;s>=0;s--){let n=r[s](i);n instanceof Ft?i=n:Array.isArray(n)&&n.length==1&&n[0]instanceof Ft?i=n[0]:i=rb(e,Bo(n),!1)}return i}function IT(i){let e=i.startState,t=e.facet(eb),r=i;for(let s=t.length-1;s>=0;s--){let n=t[s](i);n&&Object.keys(n).length&&(r=ib(r,Rf(e,n,i.changes.newLength),!0))}return r==i?i:Ft.create(e,i.changes,i.selection,r.effects,r.annotations,r.scrollIntoView)}const zT=[];function Bo(i){return i==null?zT:Array.isArray(i)?i:[i]}var $t=(function(i){return i[i.Word=0]="Word",i[i.Space=1]="Space",i[i.Other=2]="Other",i})($t||($t={}));const NT=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Bf;try{Bf=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function WT(i){if(Bf)return Bf.test(i);for(let e=0;e<i.length;e++){let t=i[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||NT.test(t)))return!0}return!1}function ZT(i){return e=>{if(!/\S/.test(e))return $t.Space;if(WT(e))return $t.Word;for(let t=0;t<i.length;t++)if(e.indexOf(i[t])>-1)return $t.Word;return $t.Other}}class st{constructor(e,t,r,s,n,o){this.config=e,this.doc=t,this.selection=r,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=n,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)pl(this,a<<1);this.computeSlot=null}field(e,t=!0){let r=this.config.address[e.id];if(r==null){if(t)throw new RangeError("Field is not present in this state");return}return pl(this,r),zh(this,r)}update(...e){return rb(this,e,!0)}applyTransaction(e){let t=this.config,{base:r,compartments:s}=t;for(let a of e.effects)a.is(Au.reconfigure)?(t&&(s=new Map,t.compartments.forEach((l,c)=>s.set(c,l)),t=null),s.set(a.value.compartment,a.value.extension)):a.is(He.reconfigure)?(t=null,r=a.value):a.is(He.appendConfig)&&(t=null,r=Bo(r).concat(a.value));let n;t?n=e.startState.values.slice():(t=Ih.resolve(r,s,this),n=new st(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let o=e.startState.facet(Af)?e.newSelection:e.newSelection.asSingle();new st(t,e.newDoc,o,n,(a,l)=>l.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:ue.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,r=e(t.ranges[0]),s=this.changes(r.changes),n=[r.range],o=Bo(r.effects);for(let a=1;a<t.ranges.length;a++){let l=e(t.ranges[a]),c=this.changes(l.changes),h=c.map(s);for(let d=0;d<a;d++)n[d]=n[d].map(h);let u=s.mapDesc(c,!0);n.push(l.range.map(u)),s=s.compose(h),o=He.mapEffects(o,h).concat(He.mapEffects(Bo(l.effects),u))}return{changes:s,selection:ue.create(n,t.mainIndex),effects:o}}changes(e=[]){return e instanceof jt?e:jt.of(e,this.doc.length,this.facet(st.lineSeparator))}toText(e){return ct.of(e.split(this.facet(st.lineSeparator)||$f))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(pl(this,t),zh(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let s=e[r];s instanceof ui&&this.config.address[s.id]!=null&&(t[r]=s.spec.toJSON(this.field(e[r]),this))}return t}static fromJSON(e,t={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(r){for(let n in r)if(Object.prototype.hasOwnProperty.call(e,n)){let o=r[n],a=e[n];s.push(o.init(l=>o.spec.fromJSON(a,l)))}}return st.create({doc:e.doc,selection:ue.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=Ih.resolve(e.extensions||[],new Map),r=e.doc instanceof ct?e.doc:ct.of((e.doc||"").split(t.staticFacet(st.lineSeparator)||$f)),s=e.selection?e.selection instanceof ue?e.selection:ue.single(e.selection.anchor,e.selection.head):ue.single(0);return U_(s,r.length),t.staticFacet(Af)||(s=s.asSingle()),new st(t,r,s,t.dynamicSlots.map(()=>null),(n,o)=>o.create(n),null)}get tabSize(){return this.facet(st.tabSize)}get lineBreak(){return this.facet(st.lineSeparator)||`
14
+ `}get readOnly(){return this.facet(tb)}phrase(e,...t){for(let r of this.facet(st.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(r,s)=>{if(s=="$")return"$";let n=+(s||1);return!n||n>t.length?r:t[n-1]})),e}languageDataAt(e,t,r=-1){let s=[];for(let n of this.facet(j_))for(let o of n(this,t,r))Object.prototype.hasOwnProperty.call(o,e)&&s.push(o[e]);return s}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return ZT(t.length?t[0]:"")}wordAt(e){let{text:t,from:r,length:s}=this.doc.lineAt(e),n=this.charCategorizer(e),o=e-r,a=e-r;for(;o>0;){let l=ci(t,o,!1);if(n(t.slice(l,o))!=$t.Word)break;o=l}for(;a<s;){let l=ci(t,a);if(n(t.slice(a,l))!=$t.Word)break;a=l}return o==a?null:ue.range(o+r,a+r)}}st.allowMultipleSelections=Af;st.tabSize=Ae.define({combine:i=>i.length?i[0]:4});st.lineSeparator=G_;st.readOnly=tb;st.phrases=Ae.define({compare(i,e){let t=Object.keys(i),r=Object.keys(e);return t.length==r.length&&t.every(s=>i[s]==e[s])}});st.languageData=j_;st.changeFilter=K_;st.transactionFilter=J_;st.transactionExtender=eb;Au.reconfigure=He.define();function fs(i,e,t={}){let r={};for(let s of i)for(let n of Object.keys(s)){let o=s[n],a=r[n];if(a===void 0)r[n]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(t,n))r[n]=t[n](a,o);else throw new Error("Config merge conflict for field "+n)}for(let s in e)r[s]===void 0&&(r[s]=e[s]);return r}class On{eq(e){return this==e}range(e,t=e){return Lf.create(e,t,this)}}On.prototype.startSide=On.prototype.endSide=0;On.prototype.point=!1;On.prototype.mapMode=vi.TrackDel;function Qm(i,e){return i==e||i.constructor==e.constructor&&i.eq(e)}let Lf=class sb{constructor(e,t,r){this.from=e,this.to=t,this.value=r}static create(e,t,r){return new sb(e,t,r)}};function Ef(i,e){return i.from-e.from||i.value.startSide-e.value.startSide}class Am{constructor(e,t,r,s){this.from=e,this.to=t,this.value=r,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,t,r,s=0){let n=r?this.to:this.from;for(let o=s,a=n.length;;){if(o==a)return o;let l=o+a>>1,c=n[l]-e||(r?this.value[l].endSide:this.value[l].startSide)-t;if(l==o)return c>=0?o:a;c>=0?a=l:o=l+1}}between(e,t,r,s){for(let n=this.findIndex(t,-1e9,!0),o=this.findIndex(r,1e9,!1,n);n<o;n++)if(s(this.from[n]+e,this.to[n]+e,this.value[n])===!1)return!1}map(e,t){let r=[],s=[],n=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let c=this.value[l],h=this.from[l]+e,u=this.to[l]+e,d,f;if(h==u){let p=t.mapPos(h,c.startSide,c.mapMode);if(p==null||(d=f=p,c.startSide!=c.endSide&&(f=t.mapPos(h,c.endSide),f<d)))continue}else if(d=t.mapPos(h,c.startSide),f=t.mapPos(u,c.endSide),d>f||d==f&&c.startSide>0&&c.endSide<=0)continue;(f-d||c.endSide-c.startSide)<0||(o<0&&(o=d),c.point&&(a=Math.max(a,f-d)),r.push(c),s.push(d-o),n.push(f-o))}return{mapped:r.length?new Am(s,n,r,a):null,pos:o}}}class it{constructor(e,t,r,s){this.chunkPos=e,this.chunk=t,this.nextLayer=r,this.maxPoint=s}static create(e,t,r,s){return new it(e,t,r,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:r=!1,filterFrom:s=0,filterTo:n=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(r&&(t=t.slice().sort(Ef)),this.isEmpty)return t.length?it.of(t):this;let a=new nb(this,null,-1).goto(0),l=0,c=[],h=new Es;for(;a.value||l<t.length;)if(l<t.length&&(a.from-t[l].from||a.startSide-t[l].value.startSide)>=0){let u=t[l++];h.addInner(u.from,u.to,u.value)||c.push(u)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==t.length||this.chunkEnd(a.chunkIndex)<t[l].from)&&(!o||s>this.chunkEnd(a.chunkIndex)||n<this.chunkPos[a.chunkIndex])&&h.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||s>a.to||n<a.from||o(a.from,a.to,a.value))&&(h.addInner(a.from,a.to,a.value)||c.push(Lf.create(a.from,a.to,a.value))),a.next());return h.finishInner(this.nextLayer.isEmpty&&!c.length?it.empty:this.nextLayer.update({add:c,filter:o,filterFrom:s,filterTo:n}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],r=[],s=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o],c=e.touchesRange(a,a+l.length);if(c===!1)s=Math.max(s,l.maxPoint),t.push(l),r.push(e.mapPos(a));else if(c===!0){let{mapped:h,pos:u}=l.map(a,e);h&&(s=Math.max(s,h.maxPoint),t.push(h),r.push(u))}}let n=this.nextLayer.map(e);return t.length==0?n:new it(r,t,n||it.empty,s)}between(e,t,r){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let n=this.chunkPos[s],o=this.chunk[s];if(t>=n&&e<=n+o.length&&o.between(n,e-n,t-n,r)===!1)return}this.nextLayer.between(e,t,r)}}iter(e=0){return Sl.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Sl.from(e).goto(t)}static compare(e,t,r,s,n=-1){let o=e.filter(u=>u.maxPoint>0||!u.isEmpty&&u.maxPoint>=n),a=t.filter(u=>u.maxPoint>0||!u.isEmpty&&u.maxPoint>=n),l=gv(o,a,r),c=new Da(o,l,n),h=new Da(a,l,n);r.iterGaps((u,d,f)=>vv(c,u,h,d,f,s)),r.empty&&r.length==0&&vv(c,0,h,0,0,s)}static eq(e,t,r=0,s){s==null&&(s=999999999);let n=e.filter(h=>!h.isEmpty&&t.indexOf(h)<0),o=t.filter(h=>!h.isEmpty&&e.indexOf(h)<0);if(n.length!=o.length)return!1;if(!n.length)return!0;let a=gv(n,o),l=new Da(n,a,0).goto(r),c=new Da(o,a,0).goto(r);for(;;){if(l.to!=c.to||!Df(l.active,c.active)||l.point&&(!c.point||!Qm(l.point,c.point)))return!1;if(l.to>s)return!0;l.next(),c.next()}}static spans(e,t,r,s,n=-1){let o=new Da(e,null,n).goto(t),a=t,l=o.openStart;for(;;){let c=Math.min(o.to,r);if(o.point){let h=o.activeForPoint(o.to),u=o.pointFrom<t?h.length+1:o.point.startSide<0?h.length:Math.min(h.length,l);s.point(a,c,o.point,h,u,o.pointRank),l=Math.min(o.openEnd(c),h.length)}else c>a&&(s.span(a,c,o.active,l),l=o.openEnd(c));if(o.to>r)return l+(o.point&&o.to>r?1:0);a=o.to,o.next()}}static of(e,t=!1){let r=new Es;for(let s of e instanceof Lf?[e]:t?XT(e):e)r.add(s.from,s.to,s.value);return r.finish()}static join(e){if(!e.length)return it.empty;let t=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let s=e[r];s!=it.empty;s=s.nextLayer)t=new it(s.chunkPos,s.chunk,t,Math.max(s.maxPoint,t.maxPoint));return t}}it.empty=new it([],[],null,-1);function XT(i){if(i.length>1)for(let e=i[0],t=1;t<i.length;t++){let r=i[t];if(Ef(e,r)>0)return i.slice().sort(Ef);e=r}return i}it.empty.nextLayer=it.empty;class Es{finishChunk(e){this.chunks.push(new Am(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,r){this.addInner(e,t,r)||(this.nextLayer||(this.nextLayer=new Es)).add(e,t,r)}addInner(e,t,r){let s=e-this.lastTo||r.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=t,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let r=t.value.length-1;return this.last=t.value[r],this.lastFrom=t.from[r]+e,this.lastTo=t.to[r]+e,!0}finish(){return this.finishInner(it.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=it.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function gv(i,e,t){let r=new Map;for(let n of i)for(let o=0;o<n.chunk.length;o++)n.chunk[o].maxPoint<=0&&r.set(n.chunk[o],n.chunkPos[o]);let s=new Set;for(let n of e)for(let o=0;o<n.chunk.length;o++){let a=r.get(n.chunk[o]);a!=null&&(t?t.mapPos(a):a)==n.chunkPos[o]&&!t?.touchesRange(a,a+n.chunk[o].length)&&s.add(n.chunk[o])}return s}class nb{constructor(e,t,r,s=0){this.layer=e,this.skip=t,this.minPoint=r,this.rank=s}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,r){for(;this.chunkIndex<this.layer.chunk.length;){let s=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(s)||this.layer.chunkEnd(this.chunkIndex)<e||s.maxPoint<this.minPoint))break;this.chunkIndex++,r=!1}if(this.chunkIndex<this.layer.chunk.length){let s=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!r||this.rangeIndex<s)&&this.setRangeIndex(s)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],r=e+t.from[this.rangeIndex];if(this.from=r,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Sl{constructor(e){this.heap=e}static from(e,t=null,r=-1){let s=[];for(let n=0;n<e.length;n++)for(let o=e[n];!o.isEmpty;o=o.nextLayer)o.maxPoint>=r&&s.push(new nb(o,t,r,n));return s.length==1?s[0]:new Sl(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let r of this.heap)r.goto(e,t);for(let r=this.heap.length>>1;r>=0;r--)Ju(this.heap,r);return this.next(),this}forward(e,t){for(let r of this.heap)r.forward(e,t);for(let r=this.heap.length>>1;r>=0;r--)Ju(this.heap,r);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Ju(this.heap,0)}}}function Ju(i,e){for(let t=i[e];;){let r=(e<<1)+1;if(r>=i.length)break;let s=i[r];if(r+1<i.length&&s.compare(i[r+1])>=0&&(s=i[r+1],r++),t.compare(s)<0)break;i[r]=t,i[e]=s,e=r}}class Da{constructor(e,t,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Sl.from(e,t,r)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){$c(this.active,e),$c(this.activeTo,e),$c(this.activeRank,e),this.minActive=Ov(this.active,this.activeTo)}addActive(e){let t=0,{value:r,to:s,rank:n}=this.cursor;for(;t<this.activeRank.length&&(n-this.activeRank[t]||s-this.activeTo[t])>0;)t++;Pc(this.active,t,r),Pc(this.activeTo,t,s),Pc(this.activeRank,t,n),e&&Pc(e,t,this.cursor.from),this.minActive=Ov(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),r&&$c(r,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let n=this.cursor.value;if(!n.point)this.addActive(r),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=n,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=n.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(r){this.openStart=0;for(let s=r.length-1;s>=0&&r[s]<e;s--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let r=this.active.length-1;r>=0&&!(this.activeRank[r]<this.pointRank);r--)(this.activeTo[r]>e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&t.push(this.active[r]);return t.reverse()}openEnd(e){let t=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)t++;return t}}function vv(i,e,t,r,s,n){i.goto(e),t.goto(r);let o=r+s,a=r,l=r-e,c=!!n.boundChange;for(let h=!1;;){let u=i.to+l-t.to,d=u||i.endSide-t.endSide,f=d<0?i.to+l:t.to,p=Math.min(f,o);if(i.point||t.point?(i.point&&t.point&&Qm(i.point,t.point)&&Df(i.activeForPoint(i.to),t.activeForPoint(t.to))||n.comparePoint(a,p,i.point,t.point),h=!1):(h&&n.boundChange(a),p>a&&!Df(i.active,t.active)&&n.compareRange(a,p,i.active,t.active),c&&p<o&&(u||i.openEnd(f)!=t.openEnd(f))&&(h=!0)),f>o)break;a=f,d<=0&&i.next(),d>=0&&t.next()}}function Df(i,e){if(i.length!=e.length)return!1;for(let t=0;t<i.length;t++)if(i[t]!=e[t]&&!Qm(i[t],e[t]))return!1;return!0}function $c(i,e){for(let t=e,r=i.length-1;t<r;t++)i[t]=i[t+1];i.pop()}function Pc(i,e,t){for(let r=i.length-1;r>=e;r--)i[r+1]=i[r];i[e]=t}function Ov(i,e){let t=-1,r=1e9;for(let s=0;s<e.length;s++)(e[s]-r||i[s].endSide-i[t].endSide)<0&&(t=s,r=e[s]);return t}function Ar(i,e,t=i.length){let r=0;for(let s=0;s<t&&s<i.length;)i.charCodeAt(s)==9?(r+=e-r%e,s++):(r++,s=ci(i,s));return r}function If(i,e,t,r){for(let s=0,n=0;;){if(n>=e)return s;if(s==i.length)break;n+=i.charCodeAt(s)==9?t-n%t:1,s=ci(i,s)}return r===!0?-1:i.length}const zf="ͼ",_v=typeof Symbol>"u"?"__"+zf:Symbol.for(zf),Nf=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),bv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class _n{constructor(e,t){this.rules=[];let{finish:r}=t||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function n(o,a,l,c){let h=[],u=/^@(\w+)\b/.exec(o[0]),d=u&&u[1]=="keyframes";if(u&&a==null)return l.push(o[0]+";");for(let f in a){let p=a[f];if(/&/.test(f))n(f.split(/,\s*/).map(g=>o.map(O=>g.replace(/&/,O))).reduce((g,O)=>g.concat(O)),p,l);else if(p&&typeof p=="object"){if(!u)throw new RangeError("The value of a property ("+f+") should be a primitive value.");n(s(f),p,h,d)}else p!=null&&h.push(f.replace(/_.*/,"").replace(/[A-Z]/g,g=>"-"+g.toLowerCase())+": "+p+";")}(h.length||d)&&l.push((r&&!u&&!c?o.map(r):o).join(", ")+" {"+h.join(" ")+"}")}for(let o in e)n(s(o),e[o],this.rules)}getRules(){return this.rules.join(`
15
+ `)}static newName(){let e=bv[_v]||1;return bv[_v]=e+1,zf+e.toString(36)}static mount(e,t,r){let s=e[Nf],n=r&&r.nonce;s?n&&s.setNonce(n):s=new FT(e,n),s.mount(Array.isArray(t)?t:[t],e)}}let yv=new Map;class FT{constructor(e,t){let r=e.ownerDocument||e,s=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let n=yv.get(r);if(n)return e[Nf]=n;this.sheet=new s.CSSStyleSheet,yv.set(r,this)}else this.styleTag=r.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Nf]=this}mount(e,t){let r=this.sheet,s=0,n=0;for(let o=0;o<e.length;o++){let a=e[o],l=this.modules.indexOf(a);if(l<n&&l>-1&&(this.modules.splice(l,1),n--,l=-1),l==-1){if(this.modules.splice(n++,0,a),r)for(let c=0;c<a.rules.length;c++)r.insertRule(a.rules[c],s++)}else{for(;n<l;)s+=this.modules[n++].rules.length;s+=a.rules.length,n++}}if(r)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let o="";for(let l=0;l<this.modules.length;l++)o+=this.modules[l].getRules()+`
16
+ `;this.styleTag.textContent=o;let a=t.head||t;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var bn={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},kl={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},VT=typeof navigator<"u"&&/Mac/.test(navigator.platform),qT=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var gi=0;gi<10;gi++)bn[48+gi]=bn[96+gi]=String(gi);for(var gi=1;gi<=24;gi++)bn[gi+111]="F"+gi;for(var gi=65;gi<=90;gi++)bn[gi]=String.fromCharCode(gi+32),kl[gi]=String.fromCharCode(gi);for(var ed in bn)kl.hasOwnProperty(ed)||(kl[ed]=bn[ed]);function HT(i){var e=VT&&i.metaKey&&i.shiftKey&&!i.ctrlKey&&!i.altKey||qT&&i.shiftKey&&i.key&&i.key.length==1||i.key=="Unidentified",t=!e&&i.key||(i.shiftKey?kl:bn)[i.keyCode]||i.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function mt(){var i=arguments[0];typeof i=="string"&&(i=document.createElement(i));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var s=t[r];typeof s=="string"?i.setAttribute(r,s):s!=null&&(i[r]=s)}e++}for(;e<arguments.length;e++)ob(i,arguments[e]);return i}function ob(i,e){if(typeof e=="string")i.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)i.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)ob(i,e[t]);else throw new RangeError("Unsupported child node: "+e)}let Ai=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Wf=typeof document<"u"?document:{documentElement:{style:{}}};const Zf=/Edge\/(\d+)/.exec(Ai.userAgent),ab=/MSIE \d/.test(Ai.userAgent),Xf=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ai.userAgent),Ru=!!(ab||Xf||Zf),xv=!Ru&&/gecko\/(\d+)/i.test(Ai.userAgent),td=!Ru&&/Chrome\/(\d+)/.exec(Ai.userAgent),UT="webkitFontSmoothing"in Wf.documentElement.style,Ff=!Ru&&/Apple Computer/.test(Ai.vendor),wv=Ff&&(/Mobile\/\w+/.test(Ai.userAgent)||Ai.maxTouchPoints>2);var Re={mac:wv||/Mac/.test(Ai.platform),windows:/Win/.test(Ai.platform),linux:/Linux|X11/.test(Ai.platform),ie:Ru,ie_version:ab?Wf.documentMode||6:Xf?+Xf[1]:Zf?+Zf[1]:0,gecko:xv,gecko_version:xv?+(/Firefox\/(\d+)/.exec(Ai.userAgent)||[0,0])[1]:0,chrome:!!td,chrome_version:td?+td[1]:0,ios:wv,android:/Android\b/.test(Ai.userAgent),webkit_version:UT?+(/\bAppleWebKit\/(\d+)/.exec(Ai.userAgent)||[0,0])[1]:0,safari:Ff,safari_version:Ff?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Ai.userAgent)||[0,0])[1]:0,tabSize:Wf.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Rm(i,e){for(let t in i)t=="class"&&e.class?e.class+=" "+i.class:t=="style"&&e.style?e.style+=";"+i.style:e[t]=i[t];return e}const Nh=Object.create(null);function Bm(i,e,t){if(i==e)return!0;i||(i=Nh),e||(e=Nh);let r=Object.keys(i),s=Object.keys(e);if(r.length-0!=s.length-0)return!1;for(let n of r)if(n!=t&&(s.indexOf(n)==-1||i[n]!==e[n]))return!1;return!0}function YT(i,e){for(let t=i.attributes.length-1;t>=0;t--){let r=i.attributes[t].name;e[r]==null&&i.removeAttribute(r)}for(let t in e){let r=e[t];t=="style"?i.style.cssText=r:i.getAttribute(t)!=r&&i.setAttribute(t,r)}}function Sv(i,e,t){let r=!1;if(e)for(let s in e)t&&s in t||(r=!0,s=="style"?i.style.cssText="":i.removeAttribute(s));if(t)for(let s in t)e&&e[s]==t[s]||(r=!0,s=="style"?i.style.cssText=t[s]:i.setAttribute(s,t[s]));return r}function jT(i){let e=Object.create(null);for(let t=0;t<i.attributes.length;t++){let r=i.attributes[t];e[r.name]=r.value}return e}class ps{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var yi=(function(i){return i[i.Text=0]="Text",i[i.WidgetBefore=1]="WidgetBefore",i[i.WidgetAfter=2]="WidgetAfter",i[i.WidgetRange=3]="WidgetRange",i})(yi||(yi={}));class ze extends On{constructor(e,t,r,s){super(),this.startSide=e,this.endSide=t,this.widget=r,this.spec=s}get heightRelevant(){return!1}static mark(e){return new ec(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return t+=r&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new eo(e,t,t,r,e.widget||null,!1)}static replace(e){let t=!!e.block,r,s;if(e.isBlockGap)r=-5e8,s=4e8;else{let{start:n,end:o}=lb(e,t);r=(n?t?-3e8:-1:5e8)-1,s=(o?t?2e8:1:-6e8)+1}return new eo(e,r,s,t,e.widget||null,!0)}static line(e){return new tc(e)}static set(e,t=!1){return it.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}ze.none=it.empty;class ec extends ze{constructor(e){let{start:t,end:r}=lb(e);super(t?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Rm(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||Nh}eq(e){return this==e||e instanceof ec&&this.tagName==e.tagName&&Bm(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}ec.prototype.point=!1;class tc extends ze{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof tc&&this.spec.class==e.spec.class&&Bm(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}tc.prototype.mapMode=vi.TrackBefore;tc.prototype.point=!0;class eo extends ze{constructor(e,t,r,s,n,o){super(t,r,n,e),this.block=s,this.isReplace=o,this.mapMode=s?t<=0?vi.TrackBefore:vi.TrackAfter:vi.TrackDel}get type(){return this.startSide!=this.endSide?yi.WidgetRange:this.startSide<=0?yi.WidgetBefore:yi.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof eo&&GT(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}eo.prototype.point=!0;function lb(i,e=!1){let{inclusiveStart:t,inclusiveEnd:r}=i;return t==null&&(t=i.inclusive),r==null&&(r=i.inclusive),{start:t??e,end:r??e}}function GT(i,e){return i==e||!!(i&&e&&i.compare(e))}function Lo(i,e,t,r=0){let s=t.length-1;s>=0&&t[s]+r>=i?t[s]=Math.max(t[s],e):t.push(i,e)}class Cl extends On{constructor(e,t){super(),this.tagName=e,this.attributes=t}eq(e){return e==this||e instanceof Cl&&this.tagName==e.tagName&&Bm(this.attributes,e.attributes)}static create(e){return new Cl(e.tagName,e.attributes||Nh)}static set(e,t=!1){return it.of(e,t)}}Cl.prototype.startSide=Cl.prototype.endSide=-1;function $l(i){let e;return i.nodeType==11?e=i.getSelection?i:i.ownerDocument:e=i,e.getSelection()}function Vf(i,e){return e?i==e||i.contains(e.nodeType!=1?e.parentNode:e):!1}function ml(i,e){if(!e.anchorNode)return!1;try{return Vf(i,e.anchorNode)}catch{return!1}}function mh(i){return i.nodeType==3?Pl(i,0,i.nodeValue.length).getClientRects():i.nodeType==1?i.getClientRects():[]}function gl(i,e,t,r){return t?kv(i,e,t,r,-1)||kv(i,e,t,r,1):!1}function yn(i){for(var e=0;;e++)if(i=i.previousSibling,!i)return e}function Wh(i){return i.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(i.nodeName)}function kv(i,e,t,r,s){for(;;){if(i==t&&e==r)return!0;if(e==(s<0?0:Ds(i))){if(i.nodeName=="DIV")return!1;let n=i.parentNode;if(!n||n.nodeType!=1)return!1;e=yn(i)+(s<0?0:1),i=n}else if(i.nodeType==1){if(i=i.childNodes[e+(s<0?-1:0)],i.nodeType==1&&i.contentEditable=="false")return!1;e=s<0?Ds(i):0}else return!1}}function Ds(i){return i.nodeType==3?i.nodeValue.length:i.childNodes.length}function Zh(i,e){let t=e?i.left:i.right;return{left:t,right:t,top:i.top,bottom:i.bottom}}function KT(i){let e=i.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:i.innerWidth,top:0,bottom:i.innerHeight}}function cb(i,e){let t=e.width/i.offsetWidth,r=e.height/i.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-i.offsetWidth)<1)&&(t=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-i.offsetHeight)<1)&&(r=1),{scaleX:t,scaleY:r}}function JT(i,e,t,r,s,n,o,a){let l=i.ownerDocument,c=l.defaultView||window;for(let h=i,u=!1;h&&!u;)if(h.nodeType==1){let d,f=h==l.body,p=1,g=1;if(f)d=KT(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(u=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let k=h.getBoundingClientRect();({scaleX:p,scaleY:g}=cb(h,k)),d={left:k.left,right:k.left+h.clientWidth*p,top:k.top,bottom:k.top+h.clientHeight*g}}let O=0,_=0;if(s=="nearest")e.top<d.top?(_=e.top-(d.top+o),t>0&&e.bottom>d.bottom+_&&(_=e.bottom-d.bottom+o)):e.bottom>d.bottom&&(_=e.bottom-d.bottom+o,t<0&&e.top-_<d.top&&(_=e.top-(d.top+o)));else{let k=e.bottom-e.top,P=d.bottom-d.top;_=(s=="center"&&k<=P?e.top+k/2-P/2:s=="start"||s=="center"&&t<0?e.top-o:e.bottom-P+o)-d.top}if(r=="nearest"?e.left<d.left?(O=e.left-(d.left+n),t>0&&e.right>d.right+O&&(O=e.right-d.right+n)):e.right>d.right&&(O=e.right-d.right+n,t<0&&e.left<d.left+O&&(O=e.left-(d.left+n))):O=(r=="center"?e.left+(e.right-e.left)/2-(d.right-d.left)/2:r=="start"==a?e.left-n:e.right-(d.right-d.left)+n)-d.left,O||_)if(f)c.scrollBy(O,_);else{let k=0,P=0;if(_){let w=h.scrollTop;h.scrollTop+=_/g,P=(h.scrollTop-w)*g}if(O){let w=h.scrollLeft;h.scrollLeft+=O/p,k=(h.scrollLeft-w)*p}e={left:e.left-k,top:e.top-P,right:e.right-k,bottom:e.bottom-P},k&&Math.abs(k-O)<1&&(r="nearest"),P&&Math.abs(P-_)<1&&(s="nearest")}if(f)break;(e.top<d.top||e.bottom>d.bottom||e.left<d.left||e.right>d.right)&&(e={left:Math.max(e.left,d.left),right:Math.min(e.right,d.right),top:Math.max(e.top,d.top),bottom:Math.min(e.bottom,d.bottom)}),h=h.assignedSlot||h.parentNode}else if(h.nodeType==11)h=h.host;else break}function eM(i){let e=i.ownerDocument,t,r;for(let s=i.parentNode;s&&!(s==e.body||t&&r);)if(s.nodeType==1)!r&&s.scrollHeight>s.clientHeight&&(r=s),!t&&s.scrollWidth>s.clientWidth&&(t=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:t,y:r}}class tM{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:r}=e;this.set(t,Math.min(e.anchorOffset,t?Ds(t):0),r,Math.min(e.focusOffset,r?Ds(r):0))}set(e,t,r,s){this.anchorNode=e,this.anchorOffset=t,this.focusNode=r,this.focusOffset=s}}let Ln=null;Re.safari&&Re.safari_version>=26&&(Ln=!1);function hb(i){if(i.setActive)return i.setActive();if(Ln)return i.focus(Ln);let e=[];for(let t=i;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(i.focus(Ln==null?{get preventScroll(){return Ln={preventScroll:!0},!0}}:void 0),!Ln){Ln=!1;for(let t=0;t<e.length;){let r=e[t++],s=e[t++],n=e[t++];r.scrollTop!=s&&(r.scrollTop=s),r.scrollLeft!=n&&(r.scrollLeft=n)}}}let Cv;function Pl(i,e,t=e){let r=Cv||(Cv=document.createRange());return r.setEnd(i,t),r.setStart(i,e),r}function Eo(i,e,t,r){let s={key:e,code:e,keyCode:t,which:t,cancelable:!0};r&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=r);let n=new KeyboardEvent("keydown",s);n.synthetic=!0,i.dispatchEvent(n);let o=new KeyboardEvent("keyup",s);return o.synthetic=!0,i.dispatchEvent(o),n.defaultPrevented||o.defaultPrevented}function iM(i){for(;i;){if(i&&(i.nodeType==9||i.nodeType==11&&i.host))return i;i=i.assignedSlot||i.parentNode}return null}function rM(i,e){let t=e.focusNode,r=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=r)return!1;for(r=Math.min(r,Ds(t));;)if(r){if(t.nodeType!=1)return!1;let s=t.childNodes[r-1];s.contentEditable=="false"?r--:(t=s,r=Ds(t))}else{if(t==i)return!0;r=yn(t),t=t.parentNode}}function ub(i){return i.scrollTop>Math.max(1,i.scrollHeight-i.clientHeight-4)}function db(i,e){for(let t=i,r=e;;){if(t.nodeType==3&&r>0)return{node:t,offset:r};if(t.nodeType==1&&r>0){if(t.contentEditable=="false")return null;t=t.childNodes[r-1],r=Ds(t)}else if(t.parentNode&&!Wh(t))r=yn(t),t=t.parentNode;else return null}}function fb(i,e){for(let t=i,r=e;;){if(t.nodeType==3&&r<t.nodeValue.length)return{node:t,offset:r};if(t.nodeType==1&&r<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[r],r=0}else if(t.parentNode&&!Wh(t))r=yn(t)+1,t=t.parentNode;else return null}}class Qr{constructor(e,t,r=!0){this.node=e,this.offset=t,this.precise=r}static before(e,t){return new Qr(e.parentNode,yn(e),t)}static after(e,t){return new Qr(e.parentNode,yn(e)+1,t)}}var _t=(function(i){return i[i.LTR=0]="LTR",i[i.RTL=1]="RTL",i})(_t||(_t={}));const to=_t.LTR,Lm=_t.RTL;function pb(i){let e=[];for(let t=0;t<i.length;t++)e.push(1<<+i[t]);return e}const sM=pb("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),nM=pb("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),qf=Object.create(null),Fr=[];for(let i of["()","[]","{}"]){let e=i.charCodeAt(0),t=i.charCodeAt(1);qf[e]=t,qf[t]=-e}function mb(i){return i<=247?sM[i]:1424<=i&&i<=1524?2:1536<=i&&i<=1785?nM[i-1536]:1774<=i&&i<=2220?4:8192<=i&&i<=8204?256:64336<=i&&i<=65023?4:1}const oM=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class ts{get dir(){return this.level%2?Lm:to}constructor(e,t,r){this.from=e,this.to=t,this.level=r}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,r,s){let n=-1;for(let o=0;o<e.length;o++){let a=e[o];if(a.from<=t&&a.to>=t){if(a.level==r)return o;(n<0||(s!=0?s<0?a.from<t:a.to>t:e[n].level>a.level))&&(n=o)}}if(n<0)throw new RangeError("Index out of range");return n}}function gb(i,e){if(i.length!=e.length)return!1;for(let t=0;t<i.length;t++){let r=i[t],s=e[t];if(r.from!=s.from||r.to!=s.to||r.direction!=s.direction||!gb(r.inner,s.inner))return!1}return!0}const Ot=[];function aM(i,e,t,r,s){for(let n=0;n<=r.length;n++){let o=n?r[n-1].to:e,a=n<r.length?r[n].from:t,l=n?256:s;for(let c=o,h=l,u=l;c<a;c++){let d=mb(i.charCodeAt(c));d==512?d=h:d==8&&u==4&&(d=16),Ot[c]=d==4?2:d,d&7&&(u=d),h=d}for(let c=o,h=l,u=l;c<a;c++){let d=Ot[c];if(d==128)c<a-1&&h==Ot[c+1]&&h&24?d=Ot[c]=h:Ot[c]=256;else if(d==64){let f=c+1;for(;f<a&&Ot[f]==64;)f++;let p=c&&h==8||f<t&&Ot[f]==8?u==1?1:8:256;for(let g=c;g<f;g++)Ot[g]=p;c=f-1}else d==8&&u==1&&(Ot[c]=1);h=d,d&7&&(u=d)}}}function lM(i,e,t,r,s){let n=s==1?2:1;for(let o=0,a=0,l=0;o<=r.length;o++){let c=o?r[o-1].to:e,h=o<r.length?r[o].from:t;for(let u=c,d,f,p;u<h;u++)if(f=qf[d=i.charCodeAt(u)])if(f<0){for(let g=a-3;g>=0;g-=3)if(Fr[g+1]==-f){let O=Fr[g+2],_=O&2?s:O&4?O&1?n:s:0;_&&(Ot[u]=Ot[Fr[g]]=_),a=g;break}}else{if(Fr.length==189)break;Fr[a++]=u,Fr[a++]=d,Fr[a++]=l}else if((p=Ot[u])==2||p==1){let g=p==s;l=g?0:1;for(let O=a-3;O>=0;O-=3){let _=Fr[O+2];if(_&2)break;if(g)Fr[O+2]|=2;else{if(_&4)break;Fr[O+2]|=4}}}}}function cM(i,e,t,r){for(let s=0,n=r;s<=t.length;s++){let o=s?t[s-1].to:i,a=s<t.length?t[s].from:e;for(let l=o;l<a;){let c=Ot[l];if(c==256){let h=l+1;for(;;)if(h==a){if(s==t.length)break;h=t[s++].to,a=s<t.length?t[s].from:e}else if(Ot[h]==256)h++;else break;let u=n==1,d=(h<e?Ot[h]:r)==1,f=u==d?u?1:2:r;for(let p=h,g=s,O=g?t[g-1].to:i;p>l;)p==O&&(p=t[--g].from,O=g?t[g-1].to:i),Ot[--p]=f;l=h}else n=c,l++}}}function Hf(i,e,t,r,s,n,o){let a=r%2?2:1;if(r%2==s%2)for(let l=e,c=0;l<t;){let h=!0,u=!1;if(c==n.length||l<n[c].from){let g=Ot[l];g!=a&&(h=!1,u=g==16)}let d=!h&&a==1?[]:null,f=h?r:r+1,p=l;e:for(;;)if(c<n.length&&p==n[c].from){if(u)break e;let g=n[c];if(!h)for(let O=g.to,_=c+1;;){if(O==t)break e;if(_<n.length&&n[_].from==O)O=n[_++].to;else{if(Ot[O]==a)break e;break}}if(c++,d)d.push(g);else{g.from>l&&o.push(new ts(l,g.from,f));let O=g.direction==to!=!(f%2);Uf(i,O?r+1:r,s,g.inner,g.from,g.to,o),l=g.to}p=g.to}else{if(p==t||(h?Ot[p]!=a:Ot[p]==a))break;p++}d?Hf(i,l,p,r+1,s,d,o):l<p&&o.push(new ts(l,p,f)),l=p}else for(let l=t,c=n.length;l>e;){let h=!0,u=!1;if(!c||l>n[c-1].to){let g=Ot[l-1];g!=a&&(h=!1,u=g==16)}let d=!h&&a==1?[]:null,f=h?r:r+1,p=l;e:for(;;)if(c&&p==n[c-1].to){if(u)break e;let g=n[--c];if(!h)for(let O=g.from,_=c;;){if(O==e)break e;if(_&&n[_-1].to==O)O=n[--_].from;else{if(Ot[O-1]==a)break e;break}}if(d)d.push(g);else{g.to<l&&o.push(new ts(g.to,l,f));let O=g.direction==to!=!(f%2);Uf(i,O?r+1:r,s,g.inner,g.from,g.to,o),l=g.from}p=g.from}else{if(p==e||(h?Ot[p-1]!=a:Ot[p-1]==a))break;p--}d?Hf(i,p,l,r+1,s,d,o):p<l&&o.push(new ts(p,l,f)),l=p}}function Uf(i,e,t,r,s,n,o){let a=e%2?2:1;aM(i,s,n,r,a),lM(i,s,n,r,a),cM(s,n,r,a),Hf(i,s,n,e,t,r,o)}function hM(i,e,t){if(!i)return[new ts(0,0,e==Lm?1:0)];if(e==to&&!t.length&&!oM.test(i))return vb(i.length);if(t.length)for(;i.length>Ot.length;)Ot[Ot.length]=256;let r=[],s=e==to?0:1;return Uf(i,s,s,t,0,i.length,r),r}function vb(i){return[new ts(0,i,0)]}let Ob="";function uM(i,e,t,r,s){var n;let o=r.head-i.from,a=ts.find(e,o,(n=r.bidiLevel)!==null&&n!==void 0?n:-1,r.assoc),l=e[a],c=l.side(s,t);if(o==c){let d=a+=s?1:-1;if(d<0||d>=e.length)return null;l=e[a=d],o=l.side(!s,t),c=l.side(s,t)}let h=ci(i.text,o,l.forward(s,t));(h<l.from||h>l.to)&&(h=c),Ob=i.text.slice(Math.min(o,h),Math.max(o,h));let u=a==(s?e.length-1:0)?null:e[a+(s?1:-1)];return u&&h==c&&u.level+(s?0:1)<l.level?ue.cursor(u.side(!s,t)+i.from,u.forward(s,t)?1:-1,u.level):ue.cursor(h+i.from,l.forward(s,t)?-1:1,l.level)}function dM(i,e,t){for(let r=e;r<t;r++){let s=mb(i.charCodeAt(r));if(s==1)return to;if(s==2||s==4)return Lm}return to}const _b=Ae.define(),bb=Ae.define(),yb=Ae.define(),xb=Ae.define(),Yf=Ae.define(),wb=Ae.define(),Sb=Ae.define(),Em=Ae.define(),Dm=Ae.define(),kb=Ae.define({combine:i=>i.some(e=>e)}),Cb=Ae.define({combine:i=>i.some(e=>e)}),$b=Ae.define();class Do{constructor(e,t="nearest",r="nearest",s=5,n=5,o=!1){this.range=e,this.y=t,this.x=r,this.yMargin=s,this.xMargin=n,this.isSnapshot=o}map(e){return e.empty?this:new Do(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Do(ue.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Tc=He.define({map:(i,e)=>i.map(e)}),Pb=He.define();function qi(i,e,t){let r=i.facet(xb);r.length?r[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const Qs=Ae.define({combine:i=>i.length?i[0]:!0});let fM=0;const $o=Ae.define({combine(i){return i.filter((e,t)=>{for(let r=0;r<t;r++)if(i[r].plugin==e.plugin)return!1;return!0})}});class It{constructor(e,t,r,s,n){this.id=e,this.create=t,this.domEventHandlers=r,this.domEventObservers=s,this.baseExtensions=n(this),this.extension=this.baseExtensions.concat($o.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat($o.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:r,eventObservers:s,provide:n,decorations:o}=t||{};return new It(fM++,e,r,s,a=>{let l=[];return o&&l.push(Bu.of(c=>{let h=c.plugin(a);return h?o(h):ze.none})),n&&l.push(n(a)),l})}static fromClass(e,t){return It.define((r,s)=>new e(r,s),t)}}class id{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(r){if(qi(t.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){qi(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(r){qi(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Tb=Ae.define(),Im=Ae.define(),Bu=Ae.define(),Mb=Ae.define(),zm=Ae.define(),ic=Ae.define(),Qb=Ae.define();function $v(i,e){let t=i.state.facet(Qb);if(!t.length)return t;let r=t.map(n=>n instanceof Function?n(i):n),s=[];return it.spans(r,e.from,e.to,{point(){},span(n,o,a,l){let c=n-e.from,h=o-e.from,u=s;for(let d=a.length-1;d>=0;d--,l--){let f=a[d].spec.bidiIsolate,p;if(f==null&&(f=dM(e.text,c,h)),l>0&&u.length&&(p=u[u.length-1]).to==c&&p.direction==f)p.to=h,u=p.inner;else{let g={from:c,to:h,direction:f,inner:[]};u.push(g),u=g.inner}}}}),s}const Ab=Ae.define();function Nm(i){let e=0,t=0,r=0,s=0;for(let n of i.state.facet(Ab)){let o=n(i);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:e,right:t,top:r,bottom:s}}const el=Ae.define();class vr{constructor(e,t,r,s){this.fromA=e,this.toA=t,this.fromB=r,this.toB=s}join(e){return new vr(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,r=this;for(;t>0;t--){let s=e[t-1];if(!(s.fromA>r.toA)){if(s.toA<r.fromA)break;r=r.join(s),e.splice(t-1,1)}}return e.splice(t,0,r),e}static extendWithRanges(e,t){if(t.length==0)return e;let r=[];for(let s=0,n=0,o=0;;){let a=s<e.length?e[s].fromB:1e9,l=n<t.length?t[n]:1e9,c=Math.min(a,l);if(c==1e9)break;let h=c+o,u=c,d=h;for(;;)if(n<t.length&&t[n]<=u){let f=t[n+1];n+=2,u=Math.max(u,f);for(let p=s;p<e.length&&e[p].fromB<=u;p++)o=e[p].toA-e[p].toB;d=Math.max(d,f+o)}else if(s<e.length&&e[s].fromB<=u){let f=e[s++];u=Math.max(u,f.toB),d=Math.max(d,f.toA),o=f.toA-f.toB}else break;r.push(new vr(h,d,c,u))}return r}}class Xh{constructor(e,t,r){this.view=e,this.state=t,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=jt.empty(this.startState.doc.length);for(let n of r)this.changes=this.changes.compose(n.changes);let s=[];this.changes.iterChangedRanges((n,o,a,l)=>s.push(new vr(n,o,a,l))),this.changedRanges=s}static create(e,t,r){return new Xh(e,t,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const pM=[];class Vt{constructor(e,t,r=0){this.dom=e,this.length=t,this.flags=r,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return pM}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let t=this.domAttrs;t&&YT(this.dom,t)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let r=t;for(let s of this.children){if(s==e)return r;r+=s.length+s.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t){return null}domPosFor(e,t){let r=yn(this.dom),s=this.length?e>0:t>0;return new Qr(this.parent.dom,r+(s?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof Eu)return e;return null}static get(e){return e.cmTile}}class Lu extends Vt{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,r=null,s,n=e?.node==t?e:null,o=0;for(let a of this.children){if(a.sync(e),o+=a.length+a.breakAfter,s=r?r.nextSibling:t.firstChild,n&&s!=a.dom&&(n.written=!0),a.dom.parentNode==t)for(;s&&s!=a.dom;)s=Pv(s);else t.insertBefore(a.dom,s);r=a.dom}for(s=r?r.nextSibling:t.firstChild,n&&s&&(n.written=!0);s;)s=Pv(s);this.length=o}}function Pv(i){let e=i.nextSibling;return i.parentNode.removeChild(i),e}class Eu extends Lu{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=Vt.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],r=this,s=0,n=0;;)if(s==r.children.length){if(!t.length)return;r=r.parent,r.breakAfter&&n++,s=t.pop()}else{let o=r.children[s++];if(o instanceof Bs)t.push(s),r=o,s=0;else{let a=n+o.length,l=e(o,n);if(l!==void 0)return l;n=a+o.breakAfter}}}resolveBlock(e,t){let r,s=-1,n,o=-1;if(this.blockTiles((a,l)=>{let c=l+a.length;if(e>=l&&e<=c){if(a.isWidget()&&t>=-1&&t<=1){if(a.flags&32)return!0;a.flags&16&&(r=void 0)}(l<e||e==c&&(t<-1?a.length:a.covers(1)))&&(!r||!a.isWidget()&&r.isWidget())&&(r=a,s=e-l),(c>e||e==l&&(t>1?a.length:a.covers(-1)))&&(!n||!a.isWidget()&&n.isWidget())&&(n=a,o=e-l)}}),!r&&!n)throw new Error("No tile at position "+e);return r&&t<0||!n?{tile:r,offset:s}:{tile:n,offset:o}}}class Bs extends Lu{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,t){let r=new Bs(t||document.createElement(e.tagName),e);return t||(r.flags|=4),r}}class qo extends Lu{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,r){let s=new qo(t||document.createElement("div"),e);return(!t||!r)&&(s.flags|=4),s}get domAttrs(){return this.attrs}resolveInline(e,t,r){let s=null,n=-1,o=null,a=-1;function l(h,u){for(let d=0,f=0;d<h.children.length&&f<=u;d++){let p=h.children[d],g=f+p.length;g>=u&&(p.isComposite()?l(p,u-f):(!o||o.isHidden&&(t>0||r&&gM(o,p)))&&(g>u||p.flags&32)?(o=p,a=u-f):(f<u||p.flags&16&&!p.isHidden)&&(s=p,n=u-f)),f=g}}l(this,e);let c=(t<0?s:o)||s||o;return c?{tile:c,offset:c==s?n:a}:null}coordsIn(e,t){let r=this.resolveInline(e,t,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),t):mM(this)}domIn(e,t){let r=this.resolveInline(e,t);if(r){let{tile:s,offset:n}=r;if(this.dom.contains(s.dom))return s.isText()?new Qr(s.dom,Math.min(s.dom.nodeValue.length,n)):s.domPosFor(n,s.flags&16?1:s.flags&32?-1:t);let o=r.tile.parent,a=!1;for(let l of o.children){if(a)return new Qr(l.dom,0);l==r.tile&&(a=!0)}}return new Qr(this.dom,0)}}function mM(i){let e=i.dom.lastChild;if(!e)return i.dom.getBoundingClientRect();let t=mh(e);return t[t.length-1]||null}function gM(i,e){let t=i.coordsIn(0,1),r=e.coordsIn(0,1);return t&&r&&r.top<t.bottom}class Vi extends Lu{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let r=new Vi(t||document.createElement(e.tagName),e);return t||(r.flags|=4),r}}class Zn extends Vt{constructor(e,t){super(e,t.length),this.text=t}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t){let r=this.dom.nodeValue.length;e>r&&(e=r);let s=e,n=e,o=0;e==0&&t<0||e==r&&t>=0?Re.chrome||Re.gecko||(e?(s--,o=1):n<r&&(n++,o=-1)):t<0?s--:n<r&&n++;let a=Pl(this.dom,s,n).getClientRects();if(!a.length)return null;let l=a[(o?o<0:t>=0)?0:a.length-1];return Re.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),o?Zh(l,o<0):l||null}static of(e,t){let r=new Zn(t||document.createTextNode(e),e);return t||(r.flags|=2),r}}class io extends Vt{constructor(e,t,r,s){super(e,t,s),this.widget=r}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,r){let s=this.widget.coordsAt(this.dom,e,t);if(s)return s;if(r)return Zh(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let n=this.dom.getClientRects(),o=null;if(!n.length)return null;let a=this.flags&16?!0:this.flags&32?!1:e>0;for(let l=a?n.length-1:0;o=n[l],!(e>0?l==0:l==n.length-1||o.top<o.bottom);l+=a?-1:1);return Zh(o,!a)}}get overrideDOMText(){if(!this.length)return ct.empty;let{root:e}=this;if(!e)return ct.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,t,r,s,n){return n||(n=e.toDOM(t),e.editable||(n.contentEditable="false")),new io(n,r,e,s)}}class Fh extends Vt{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return ct.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class vM{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,r){let{tile:s,index:n,beforeBreak:o,parents:a}=this;for(;e||t>0;)if(s.isComposite())if(o){if(!e)break;r&&r.break(),e--,o=!1}else if(n==s.children.length){if(!e&&!a.length)break;r&&r.leave(s),o=!!s.breakAfter,{tile:s,index:n}=a.pop(),n++}else{let l=s.children[n],c=l.breakAfter;(t>0?l.length<=e:l.length<e)&&(!r||r.skip(l,0,l.length)!==!1||!l.isComposite)?(o=!!c,n++,e-=l.length):(a.push({tile:s,index:n}),s=l,n=0,r&&l.isComposite()&&r.enter(l))}else if(n==s.length)o=!!s.breakAfter,{tile:s,index:n}=a.pop(),n++;else if(e){let l=Math.min(e,s.length-n);r&&r.skip(s,n,n+l),e-=l,n+=l}else break;return this.tile=s,this.index=n,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class OM{constructor(e,t,r,s){this.from=e,this.to=t,this.wrapper=r,this.rank=s}}class _M{constructor(e,t,r){this.cache=e,this.root=t,this.blockWrappers=r,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,r,s){var n;this.flushBuffer();let o=this.ensureMarks(t,r),a=o.lastChild;if(a&&a.isText()&&!(a.flags&8)&&a.length+e.length<512){this.cache.reused.set(a,2);let l=o.children[o.children.length-1]=new Zn(a.dom,a.text+e);l.parent=o}else o.append(s||Zn.of(e,(n=this.cache.find(Zn))===null||n===void 0?void 0:n.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let r=this.curLine;r.dom!=t.line.dom&&(r.setDOM(this.cache.reused.has(t.line)?rd(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let s=r;for(let a=t.marks.length-1;a>=0;a--){let l=t.marks[a],c=s.lastChild;if(c instanceof Vi&&c.mark.eq(l.mark))c.dom!=l.dom&&c.setDOM(rd(l.dom)),s=c;else{if(this.cache.reused.get(l)){let u=Vt.get(l.dom);u&&u.setDOM(rd(l.dom))}let h=Vi.of(l.mark,l.dom);s.append(h),s=h}this.cache.reused.set(l,2)}let n=Vt.get(e.text);n&&this.cache.reused.set(n,2);let o=new Zn(e.text,e.text.nodeValue);o.flags|=8,s.append(o)}addInlineWidget(e,t,r){let s=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);s||this.flushBuffer();let n=this.ensureMarks(t,r);!s&&!(e.flags&16)&&n.append(this.getBuffer(1)),n.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,r){this.flushBuffer(),this.ensureMarks(t,r).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var r;e||(e=Rb);let s=qo.start(e,t||((r=this.cache.find(qo))===null||r===void 0?void 0:r.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=s)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var r;let s=this.curLine;for(let n=e.length-1;n>=0;n--){let o=e[n],a;if(t>0&&(a=s.lastChild)&&a instanceof Vi&&a.mark.eq(o))s=a,t--;else{let l=Vi.of(o,(r=this.cache.find(Vi,c=>c.mark.eq(o)))===null||r===void 0?void 0:r.dom);s.append(l),s=l,t=0}}return s}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!Tv(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(Re.ios&&Tv(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(sd,0,32)||new io(sd.toDOM(),0,sd,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=new OM(e.from,e.to,e.value,e.rank),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-t.rank||this.wrappers[r-1].to-t.to)<0;)r--;this.wrappers.splice(r,0,t)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let r of this.wrappers){let s=t.lastChild;if(r.from<this.pos&&s instanceof Bs&&s.wrapper.eq(r.wrapper))t=s;else{let n=Bs.of(r.wrapper,(e=this.cache.find(Bs,o=>o.wrapper.eq(r.wrapper)))===null||e===void 0?void 0:e.dom);t.append(n),t=n}}return t}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),r=this.cache.find(Fh,void 0,1);return r&&(r.flags=t),r||new Fh(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class bM{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:s,lineBreak:n,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=s;let a=this.textOff=Math.min(e,s.length);return n?null:s.slice(0,a)}let t=Math.min(this.text.length,this.textOff+e),r=this.text.slice(this.textOff,t);return this.textOff=t,r}}const Vh=[io,qo,Zn,Vi,Fh,Bs,Eu];for(let i=0;i<Vh.length;i++)Vh[i].bucket=i;class yM{constructor(e){this.view=e,this.buckets=Vh.map(()=>[]),this.index=Vh.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,r=this.buckets[t];r.length<6?r.push(e):r[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,r=2){let s=e.bucket,n=this.buckets[s],o=this.index[s];for(let a=n.length-1;a>=0;a--){let l=(a+o)%n.length,c=n[l];if((!t||t(c))&&!this.reused.has(c))return n.splice(l,1),l<o&&this.index[s]--,this.reused.set(c,r),c}return null}findWidget(e,t,r){let s=this.buckets[0];if(s.length)for(let n=0,o=0;;n++){if(n==s.length){if(o)return null;o=1,n=0}let a=s[n];if(!this.reused.has(a)&&(o==0?a.widget.compare(e):a.widget.constructor==e.constructor&&e.updateDOM(a.dom,this.view)))return s.splice(n,1),n<this.index[0]&&this.index[0]--,a.widget==e&&a.length==t&&(a.flags&497)==r?(this.reused.set(a,1),a):(this.reused.set(a,2),new io(a.dom,t,e,a.flags&-498|r))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class xM{constructor(e,t,r,s,n){this.view=e,this.decorations=s,this.disallowBlockEffectsFor=n,this.openWidget=!1,this.openMarks=0,this.cache=new yM(e),this.text=new bM(e.state.doc),this.builder=new _M(this.cache,new Eu(e,e.contentDOM),it.iter(r)),this.cache.reused.set(t,2),this.old=new vM(t),this.reuseWalker={skip:(o,a,l)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,t){let r=t&&this.getCompositionContext(t.text);for(let s=0,n=0,o=0;;){let a=o<e.length?e[o++]:null,l=a?a.fromA:this.old.root.length;if(l>s){let c=l-s;this.preserve(c,!o,!a),s=l,n+=c}if(!a)break;t&&a.fromA<=t.range.fromA&&a.toA>=t.range.toA?(this.forward(a.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(n,t.range.fromB),this.cache.clear(),this.builder.addComposition(t,r),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,a.toA),this.emit(t.range.toB,a.toB)):(this.forward(a.fromA,a.toA),this.emit(n,a.toB)),n=a.toB,s=a.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,r){let s=kM(this.old),n=this.openMarks;this.old.advance(e,r?1:-1,{skip:(o,a,l)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(l-a);else{let c=l>0||a<o.length?io.of(o.widget,this.view,l-a,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);c.flags&256?(c.flags&=-2,this.builder.addBlockWidget(c)):(this.builder.ensureLine(null),this.builder.addInlineWidget(c,s,n),n=s.length)}else if(o.isText())this.builder.ensureLine(null),!a&&l==o.length?this.builder.addText(o.text,s,n,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(a,l),s,n)),n=s.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof Fh)this.cache.add(o);else if(o instanceof Vi)this.builder.ensureLine(null),this.builder.addMark(o,s,n),this.cache.reused.set(o,1),n=s.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof Vi&&s.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?s.length&&(s.length=n=0):o instanceof Vi&&(s.shift(),n=Math.min(n,s.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let r=null,s=this.builder,n=0,o=it.spans(this.decorations,e,t,{point:(a,l,c,h,u,d)=>{if(c instanceof eo){if(this.disallowBlockEffectsFor[d]){if(c.block)throw new RangeError("Block decorations may not be specified via plugins");if(l>this.view.state.doc.lineAt(a).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(n=h.length,u>h.length)s.continueWidget(l-a);else{let f=c.widget||(c.block?Ho.block:Ho.inline),p=wM(c),g=this.cache.findWidget(f,l-a,p)||io.of(f,this.view,l-a,p);c.block?(c.startSide>0&&s.addLineStartIfNotCovered(r),s.addBlockWidget(g)):(s.ensureLine(r),s.addInlineWidget(g,h,u))}r=null}else r=SM(r,c);l>a&&this.text.skip(l-a)},span:(a,l,c,h)=>{for(let u=a;u<l;){let d=this.text.next(Math.min(512,l-u));d==null?(s.addLineStartIfNotCovered(r),s.addBreak(),u++):(s.ensureLine(r),s.addText(d,c,u==a?h:c.length),u+=d.length),r=null}}});s.addLineStartIfNotCovered(r),this.openWidget=o>n,this.openMarks=o}forward(e,t,r=1){t-e<=10?this.old.advance(t-e,r,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,r,this.reuseWalker))}getCompositionContext(e){let t=[],r=null;for(let s=e.parentNode;;s=s.parentNode){let n=Vt.get(s);if(s==this.view.contentDOM)break;n instanceof Vi?t.push(n):n?.isLine()?r=n:n instanceof Bs||(s.nodeName=="DIV"&&!r&&s!=this.view.contentDOM?r=new qo(s,Rb):r||t.push(Vi.of(new ec({tagName:s.nodeName.toLowerCase(),attributes:jT(s)}),s)))}return{line:r,marks:t}}}function Tv(i,e){let t=r=>{for(let s of r.children)if((e?s.isText():s.length)||t(s))return!0;return!1};return t(i)}function wM(i){let e=i.isReplace?(i.startSide<0?64:0)|(i.endSide>0?128:0):i.startSide>0?32:16;return i.block&&(e|=256),e}const Rb={class:"cm-line"};function SM(i,e){let t=e.spec.attributes,r=e.spec.class;return!t&&!r||(i||(i={class:"cm-line"}),t&&Rm(t,i),r&&(i.class+=" "+r)),i}function kM(i){let e=[];for(let t=i.parents.length;t>1;t--){let r=t==i.parents.length?i.tile:i.parents[t].tile;r instanceof Vi&&e.push(r.mark)}return e}function rd(i){let e=Vt.get(i);return e&&e.setDOM(i.cloneNode()),i}class Ho extends ps{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Ho.inline=new Ho("span");Ho.block=new Ho("div");const sd=new class extends ps{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class Mv{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=ze.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new Eu(e,e.contentDOM),this.updateInner([new vr(0,0,0,e.state.doc.length)],null)}update(e){var t;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:h,toA:u})=>u<this.minWidthFrom||h>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?s=this.domChanged.newSel.head:!BM(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let n=s>-1?$M(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){let{from:h,to:u}=this.hasComposition;r=new vr(h,u,e.changes.mapPos(h,-1),e.changes.mapPos(u,1)).addToSet(r.slice())}this.hasComposition=n?{from:n.range.fromB,to:n.range.toB}:null,(Re.ie||Re.chrome)&&!n&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.blockWrappers;this.updateDeco();let l=MM(o,this.decorations,e.changes);l.length&&(r=vr.extendWithRanges(r,l));let c=AM(a,this.blockWrappers,e.changes);return c.length&&(r=vr.extendWithRanges(r,c)),n&&!r.some(h=>h.fromA<=n.range.fromA&&h.toA>=n.range.toA)&&(r=n.range.addToSet(r.slice())),this.tile.flags&2&&r.length==0?!1:(this.updateInner(r,n),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(t||e.length){let o=this.tile,a=new xM(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);this.tile=a.run(e,t),jf(o,a.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let n=Re.chrome||Re.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(n),n&&(n.written||r.selectionRange.focusNode!=n.node||!this.tile.dom.contains(n.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let n of this.tile.children)n.isWidget()&&n.widget instanceof nd&&s.push(n.dom);r.updateGaps(s)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let r of t.effects)r.is(Pb)&&(this.editContextFormatting=r.value)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:r}=this.tile,s=this.view.root.activeElement,n=s==r,o=!n&&!(this.view.state.facet(Qs)||r.tabIndex>-1)&&ml(r,this.view.observer.selectionRange)&&!(s&&r.contains(s));if(!(n||t||o))return;let a=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,c,h;if(l.empty?h=c=this.inlineDOMNearPos(l.anchor,l.assoc||1):(h=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1),c=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1)),Re.gecko&&l.empty&&!this.hasComposition&&CM(c)){let d=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(d,c.node.childNodes[c.offset]||null)),c=h=new Qr(d,0),a=!0}let u=this.view.observer.selectionRange;(a||!u.focusNode||(!gl(c.node,c.offset,u.anchorNode,u.anchorOffset)||!gl(h.node,h.offset,u.focusNode,u.focusOffset))&&!this.suppressWidgetCursorChange(u,l))&&(this.view.observer.ignore(()=>{Re.android&&Re.chrome&&r.contains(u.focusNode)&&RM(u.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let d=$l(this.view.root);if(d)if(l.empty){if(Re.gecko){let f=PM(c.node,c.offset);if(f&&f!=3){let p=(f==1?db:fb)(c.node,c.offset);p&&(c=new Qr(p.node,p.offset))}}d.collapse(c.node,c.offset),l.bidiLevel!=null&&d.caretBidiLevel!==void 0&&(d.caretBidiLevel=l.bidiLevel)}else if(d.extend){d.collapse(c.node,c.offset);try{d.extend(h.node,h.offset)}catch{}}else{let f=document.createRange();l.anchor>l.head&&([c,h]=[h,c]),f.setEnd(h.node,h.offset),f.setStart(c.node,c.offset),d.removeAllRanges(),d.addRange(f)}o&&this.view.root.activeElement==r&&(r.blur(),s&&s.focus())}),this.view.observer.setSelectionRange(c,h)),this.impreciseAnchor=c.precise?null:new Qr(u.anchorNode,u.anchorOffset),this.impreciseHead=h.precise?null:new Qr(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&gl(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,r=$l(e.root),{anchorNode:s,anchorOffset:n}=e.observer.selectionRange;if(!r||!t.empty||!t.assoc||!r.modify)return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let a=o.posAtStart;if(t.head==a||t.head==a+o.length)return;let l=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!l||!c||l.bottom>c.top)return;let h=this.domAtPos(t.head+t.assoc,t.assoc);r.collapse(h.node,h.offset),r.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let u=e.observer.selectionRange;e.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=t.from&&r.collapse(s,n)}posFromDOM(e,t){let r=this.tile.nearest(e);if(!r)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let s=r.posAtStart;if(r.isComposite()){let n;if(e==r.dom)n=r.dom.childNodes[t];else{let o=Ds(e)==0?0:t==0?-1:1;for(;;){let a=e.parentNode;if(a==r.dom)break;o==0&&a.firstChild!=a.lastChild&&(e==a.firstChild?o=-1:o=1),e=a}o<0?n=e:n=e.nextSibling}if(n==r.dom.firstChild)return s;for(;n&&!Vt.get(n);)n=n.nextSibling;if(!n)return s+r.length;for(let o=0,a=s;;o++){let l=r.children[o];if(l.dom==n)return a;a+=l.length+l.breakAfter}}else return r.isText()?e==r.dom?s+t:s+(t?r.length:0):s}domAtPos(e,t){let{tile:r,offset:s}=this.tile.resolveBlock(e,t);return r.isWidget()?r.domPosFor(e,t):r.domIn(s,t)}inlineDOMNearPos(e,t){let r,s=-1,n=!1,o,a=-1,l=!1;return this.tile.blockTiles((c,h)=>{if(c.isWidget()){if(c.flags&32&&h>=e)return!0;c.flags&16&&(n=!0)}else{let u=h+c.length;if(h<=e&&(r=c,s=e-h,n=u<e),u>=e&&!o&&(o=c,a=e-h,l=h>e),h>e&&o)return!0}}),!r&&!o?this.domAtPos(e,t):(n&&o?r=null:l&&r&&(o=null),r&&t<0||!o?r.domIn(s,t):o.domIn(a,t))}coordsAt(e,t){let{tile:r,offset:s}=this.tile.resolveBlock(e,t);return r.isWidget()?r.widget instanceof nd?null:r.coordsInWidget(s,t,!0):r.coordsIn(s,t)}lineAt(e,t){let{tile:r}=this.tile.resolveBlock(e,t);return r.isLine()?r:null}coordsForChar(e){let{tile:t,offset:r}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function s(n,o){if(n.isComposite())for(let a of n.children){if(a.length>=o){let l=s(a,o);if(l)return l}if(o-=a.length,o<0)break}else if(n.isText()&&o<n.length){let a=ci(n.text,o);if(a==o)return null;let l=Pl(n.dom,o,a).getClientRects();for(let c=0;c<l.length;c++){let h=l[c];if(c==l.length-1||h.top<h.bottom&&h.left<h.right)return h}}return null}return s(t,r)}measureVisibleLineHeights(e){let t=[],{from:r,to:s}=e,n=this.view.contentDOM.clientWidth,o=n>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==_t.LTR,c=0,h=(u,d,f)=>{for(let p=0;p<u.children.length&&!(d>s);p++){let g=u.children[p],O=d+g.length,_=g.dom.getBoundingClientRect(),{height:k}=_;if(f&&!p&&(c+=_.top-f.top),g instanceof Bs)O>r&&h(g,d,_);else if(d>=r&&(c>0&&t.push(-c),t.push(k+c),c=0,o)){let P=g.dom.lastChild,w=P?mh(P):[];if(w.length){let C=w[w.length-1],M=l?C.right-_.left:_.right-C.left;M>a&&(a=M,this.minWidth=n,this.minWidthFrom=d,this.minWidthTo=O)}}f&&p==u.children.length-1&&(c+=f.bottom-_.bottom),d=O+g.breakAfter}};return h(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?_t.RTL:_t.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let a=0,l;for(let c of o.children){if(!c.isText()||/[^ -~]/.test(c.text))return;let h=mh(c.dom);if(h.length!=1)return;a+=h[0].width,l=h[0].height}if(a)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:a/o.length,textHeight:l}}});if(e)return e;let t=document.createElement("div"),r,s,n;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let o=mh(t.firstChild)[0];r=t.getBoundingClientRect().height,s=o&&o.width?o.width/27:7,n=o&&o.height?o.height:r,t.remove()}),{lineHeight:r,charWidth:s,textHeight:n}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let r=0,s=0;;s++){let n=s==t.viewports.length?null:t.viewports[s],o=n?n.from-1:this.view.state.doc.length;if(o>r){let a=(t.lineBlockAt(o).bottom-t.lineBlockAt(r).top)/this.view.scaleY;e.push(ze.replace({widget:new nd(a),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!n)break;r=n.to+1}return ze.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Bu).map(n=>(this.dynamicDecorationMap[e++]=typeof n=="function")?n(this.view):n),r=!1,s=this.view.state.facet(zm).map((n,o)=>{let a=typeof n=="function";return a&&(r=!0),a?n(this.view):n});for(s.length&&(this.dynamicDecorationMap[e++]=r,t.push(it.join(s))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(Mb).map(n=>typeof n=="function"?n(this.view):n)}scrollIntoView(e){if(e.isSnapshot){let c=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=c.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let c of this.view.state.facet($b))try{if(c(this.view,e.range,e))return!0}catch(h){qi(this.view.state,h,"scroll handler")}let{range:t}=e,r=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),s;if(!r)return;!t.empty&&(s=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(r={left:Math.min(r.left,s.left),top:Math.min(r.top,s.top),right:Math.max(r.right,s.right),bottom:Math.max(r.bottom,s.bottom)});let n=Nm(this.view),o={left:r.left-n.left,top:r.top-n.top,right:r.right+n.right,bottom:r.bottom+n.bottom},{offsetWidth:a,offsetHeight:l}=this.view.scrollDOM;if(JT(this.view.scrollDOM,o,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,a),-a),Math.max(Math.min(e.yMargin,l),-l),this.view.textDirection==_t.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(r.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||r.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let c=this.view.docView.lineAt(t.head,1);c&&c.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(e){let t=r=>r.isWidget()||r.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){jf(this.tile)}}function jf(i,e){let t=e?.get(i);if(t!=1){t==null&&i.destroy();for(let r of i.children)jf(r,e)}}function CM(i){return i.node.nodeType==1&&i.node.firstChild&&(i.offset==0||i.node.childNodes[i.offset-1].contentEditable=="false")&&(i.offset==i.node.childNodes.length||i.node.childNodes[i.offset].contentEditable=="false")}function Bb(i,e){let t=i.observer.selectionRange;if(!t.focusNode)return null;let r=db(t.focusNode,t.focusOffset),s=fb(t.focusNode,t.focusOffset),n=r||s;if(s&&r&&s.node!=r.node){let a=Vt.get(s.node);if(!a||a.isText()&&a.text!=s.node.nodeValue)n=s;else if(i.docView.lastCompositionAfterCursor){let l=Vt.get(r.node);!l||l.isText()&&l.text!=r.node.nodeValue||(n=s)}}if(i.docView.lastCompositionAfterCursor=n!=r,!n)return null;let o=e-n.offset;return{from:o,to:o+n.node.nodeValue.length,node:n.node}}function $M(i,e,t){let r=Bb(i,t);if(!r)return null;let{node:s,from:n,to:o}=r,a=s.nodeValue;if(/[\n\r]/.test(a)||i.state.doc.sliceString(r.from,r.to)!=a)return null;let l=e.invertedDesc;return{range:new vr(l.mapPos(n),l.mapPos(o),n,o),text:s}}function PM(i,e){return i.nodeType!=1?0:(e&&i.childNodes[e-1].contentEditable=="false"?1:0)|(e<i.childNodes.length&&i.childNodes[e].contentEditable=="false"?2:0)}let TM=class{constructor(){this.changes=[]}compareRange(e,t){Lo(e,t,this.changes)}comparePoint(e,t){Lo(e,t,this.changes)}boundChange(e){Lo(e,e,this.changes)}};function MM(i,e,t){let r=new TM;return it.compare(i,e,t,r),r.changes}class QM{constructor(){this.changes=[]}compareRange(e,t){Lo(e,t,this.changes)}comparePoint(){}boundChange(e){Lo(e,e,this.changes)}}function AM(i,e,t){let r=new QM;return it.compare(i,e,t,r),r.changes}function RM(i,e){for(let t=i;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function BM(i,e){let t=!1;return e&&i.iterChangedRanges((r,s)=>{r<e.to&&s>e.from&&(t=!0)}),t}class nd extends ps{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function LM(i,e,t=1){let r=i.charCategorizer(e),s=i.doc.lineAt(e),n=e-s.from;if(s.length==0)return ue.cursor(e);n==0?t=1:n==s.length&&(t=-1);let o=n,a=n;t<0?o=ci(s.text,n,!1):a=ci(s.text,n);let l=r(s.text.slice(o,a));for(;o>0;){let c=ci(s.text,o,!1);if(r(s.text.slice(c,o))!=l)break;o=c}for(;a<s.length;){let c=ci(s.text,a);if(r(s.text.slice(a,c))!=l)break;a=c}return ue.range(o+s.from,a+s.from)}function EM(i,e,t,r,s){let n=Math.round((r-e.left)*i.defaultCharacterWidth);if(i.lineWrapping&&t.height>i.defaultLineHeight*1.5){let a=i.viewState.heightOracle.textHeight,l=Math.floor((s-t.top-(i.defaultLineHeight-a)*.5)/a);n+=l*i.viewState.heightOracle.lineLength}let o=i.state.sliceDoc(t.from,t.to);return t.from+If(o,n,i.state.tabSize)}function Gf(i,e,t){let r=i.lineBlockAt(e);if(Array.isArray(r.type)){let s;for(let n of r.type){if(n.from>e)break;if(!(n.to<e)){if(n.from<e&&n.to>e)return n;(!s||n.type==yi.Text&&(s.type!=n.type||(t<0?n.from<e:n.to>e)))&&(s=n)}}return s||r}return r}function DM(i,e,t,r){let s=Gf(i,e.head,e.assoc||-1),n=!r||s.type!=yi.Text||!(i.lineWrapping||s.widgetLineBreaks)?null:i.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(n){let o=i.dom.getBoundingClientRect(),a=i.textDirectionAt(s.from),l=i.posAtCoords({x:t==(a==_t.LTR)?o.right-1:o.left+1,y:(n.top+n.bottom)/2});if(l!=null)return ue.cursor(l,t?-1:1)}return ue.cursor(t?s.to:s.from,t?-1:1)}function Qv(i,e,t,r){let s=i.state.doc.lineAt(e.head),n=i.bidiSpans(s),o=i.textDirectionAt(s.from);for(let a=e,l=null;;){let c=uM(s,n,o,a,t),h=Ob;if(!c){if(s.number==(t?i.state.doc.lines:1))return a;h=`
17
+ `,s=i.state.doc.line(s.number+(t?1:-1)),n=i.bidiSpans(s),c=i.visualLineSide(s,!t)}if(l){if(!l(h))return a}else{if(!r)return c;l=r(h)}a=c}}function IM(i,e,t){let r=i.state.charCategorizer(e),s=r(t);return n=>{let o=r(n);return s==$t.Space&&(s=o),s==o}}function zM(i,e,t,r){let s=e.head,n=t?1:-1;if(s==(t?i.state.doc.length:0))return ue.cursor(s,e.assoc);let o=e.goalColumn,a,l=i.contentDOM.getBoundingClientRect(),c=i.coordsAtPos(s,(e.empty?e.assoc:0)||(t?1:-1)),h=i.documentTop;if(c)o==null&&(o=c.left-l.left),a=n<0?c.top:c.bottom;else{let p=i.viewState.lineBlockAt(s);o==null&&(o=Math.min(l.right-l.left,i.defaultCharacterWidth*(s-p.from))),a=(n<0?p.top:p.bottom)+h}let u=l.left+o,d=r??i.viewState.heightOracle.textHeight>>1,f=Kf(i,{x:u,y:a+d*n},!1,n);return ue.cursor(f.pos,f.assoc,void 0,o)}function vl(i,e,t){for(;;){let r=0;for(let s of i)s.between(e-1,e+1,(n,o,a)=>{if(e>n&&e<o){let l=r||t||(e-n<o-e?-1:1);e=l<0?n:o,r=l}});if(!r)return e}}function Lb(i,e){let t=null;for(let r=0;r<e.ranges.length;r++){let s=e.ranges[r],n=null;if(s.empty){let o=vl(i,s.from,0);o!=s.from&&(n=ue.cursor(o,-1))}else{let o=vl(i,s.from,-1),a=vl(i,s.to,1);(o!=s.from||a!=s.to)&&(n=ue.range(s.from==s.anchor?o:a,s.from==s.head?o:a))}n&&(t||(t=e.ranges.slice()),t[r]=n)}return t?ue.create(t,e.mainIndex):e}function od(i,e,t){let r=vl(i.state.facet(ic).map(s=>s(i)),t.from,e.head>t.from?-1:1);return r==t.from?t:ue.cursor(r,r<t.from?1:-1)}class es{constructor(e,t){this.pos=e,this.assoc=t}}function Kf(i,e,t,r){let s=i.contentDOM.getBoundingClientRect(),n=s.top+i.viewState.paddingTop,{x:o,y:a}=e,l=a-n,c;for(;;){if(l<0)return new es(0,1);if(l>i.viewState.docHeight)return new es(i.state.doc.length,-1);if(c=i.elementAtHeight(l),r==null)break;if(c.type==yi.Text){if(r<0?c.to<i.viewport.from:c.from>i.viewport.to)break;let d=i.docView.coordsAt(r<0?c.from:c.to,r>0?-1:1);if(d&&(r<0?d.top<=l+n:d.bottom>=l+n))break}let u=i.viewState.heightOracle.textHeight/2;l=r>0?c.bottom+u:c.top-u}if(i.viewport.from>=c.to||i.viewport.to<=c.from){if(t)return null;if(c.type==yi.Text){let u=EM(i,s,c,o,a);return new es(u,u==c.from?1:-1)}}if(c.type!=yi.Text)return l<(c.top+c.bottom)/2?new es(c.from,1):new es(c.to,-1);let h=i.docView.lineAt(c.from,2);return(!h||h.length!=c.length)&&(h=i.docView.lineAt(c.from,-2)),new NM(i,o,a,i.textDirectionAt(c.from)).scanTile(h,c.from)}class NM{constructor(e,t,r,s){this.view=e,this.x=t,this.y=r,this.baseDir=s,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:r,spans:s}=this.bidiSpansAt(e);return s[ts.find(s,e-r.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:r,spans:s}=this.bidiSpansAt(e);return s[ts.find(s,e-r.from,-1,t)].dir}bidiIn(e,t){let{spans:r,line:s}=this.bidiSpansAt(e);return r.length>1||r.length&&(r[0].level!=this.baseDir||r[0].to+s.from<t)}scan(e,t){let r=0,s=e.length-1,n=new Set,o=this.bidiIn(e[0],e[s]),a,l,c=-1,h=1e9,u;e:for(;r<s;){let f=s-r,p=r+s>>1;t:if(n.has(p)){let O=r+Math.floor(Math.random()*f);for(let _=0;_<f;_++){if(!n.has(O)){p=O;break t}O++,O==s&&(O=r)}break e}n.add(p);let g=t(p);if(g)for(let O=0;O<g.length;O++){let _=g[O],k=0;if(_.bottom<this.y)(!a||a.bottom<_.bottom)&&(a=_),k=1;else if(_.top>this.y)(!l||l.top>_.top)&&(l=_),k=-1;else{let P=_.left>this.x?this.x-_.left:_.right<this.x?this.x-_.right:0,w=Math.abs(P);w<h&&(c=p,h=w,u=_),P&&(k=P<0==(this.baseDir==_t.LTR)?-1:1)}k==-1&&(!o||this.baseDirAt(e[p],1))?s=p:k==1&&(!o||this.baseDirAt(e[p+1],-1))&&(r=p+1)}}if(!u){let f=a&&(!l||this.y-a.bottom<l.top-this.y)?a:l;return this.y=(f.top+f.bottom)/2,this.scan(e,t)}let d=(o?this.dirAt(e[c],1):this.baseDir)==_t.LTR;return{i:c,after:this.x>(u.left+u.right)/2==d}}scanText(e,t){let r=[];for(let n=0;n<e.length;n=ci(e.text,n))r.push(t+n);r.push(t+e.length);let s=this.scan(r,n=>{let o=r[n]-t,a=r[n+1]-t;return Pl(e.dom,o,a).getClientRects()});return s.after?new es(r[s.i+1],-1):new es(r[s.i],1)}scanTile(e,t){if(!e.length)return new es(t,1);if(e.children.length==1){let a=e.children[0];if(a.isText())return this.scanText(a,t);if(a.isComposite())return this.scanTile(a,t)}let r=[t];for(let a=0,l=t;a<e.children.length;a++)r.push(l+=e.children[a].length);let s=this.scan(r,a=>{let l=e.children[a];return l.flags&48?null:(l.dom.nodeType==1?l.dom:Pl(l.dom,0,l.length)).getClientRects()}),n=e.children[s.i],o=r[s.i];return n.isText()?this.scanText(n,o):n.isComposite()?this.scanTile(n,o):s.after?new es(r[s.i+1],-1):new es(o,1)}}const tl="￿";class WM{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(st.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=tl}readRange(e,t){if(!e)return this;let r=e.parentNode;for(let s=e;;){this.findPointBefore(r,s);let n=this.text.length;this.readNode(s);let o=Vt.get(s),a=s.nextSibling;if(a==t){o?.breakAfter&&!a&&r!=this.view.contentDOM&&this.lineBreak();break}let l=Vt.get(a);(o&&l?o.breakAfter:(o?o.breakAfter:Wh(s))||Wh(a)&&(s.nodeName!="BR"||o?.isWidget())&&this.text.length>n)&&!XM(a,t)&&this.lineBreak(),s=a}return this.findPointBefore(r,t),this}readTextNode(e){let t=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,t.length));for(let r=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let n=-1,o=1,a;if(this.lineSeparator?(n=t.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(a=s.exec(t))&&(n=a.index,o=a[0].length),this.append(t.slice(r,n<0?t.length:n)),n<0)break;if(this.lineBreak(),o>1)for(let l of this.points)l.node==e&&l.pos>this.text.length&&(l.pos-=o-1);r=n+o}}readNode(e){let t=Vt.get(e),r=t&&t.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let s=r.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==t&&(r.pos=this.text.length)}findPointInside(e,t){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(ZM(e,r.node,r.offset)?t:0))}}function ZM(i,e,t){for(;;){if(!e||t<Ds(e))return!1;if(e==i)return!0;t=yn(e)+1,e=e.parentNode}}function XM(i,e){let t;for(;!(i==e||!i);i=i.nextSibling){let r=Vt.get(i);if(!r?.isWidget())return!1;r&&(t||(t=[])).push(r)}if(t)for(let r of t){let s=r.overrideDOMText;if(s?.length)return!1}return!0}class Av{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class FM{constructor(e,t,r,s){this.typeOver=s,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:n,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=Eb(e.docView.tile,t,r,0))){let a=n||o?[]:qM(e),l=new WM(a,e);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=HM(a,this.bounds.from)}else{let a=e.observer.selectionRange,l=n&&n.node==a.focusNode&&n.offset==a.focusOffset||!Vf(e.contentDOM,a.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),c=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!Vf(e.contentDOM,a.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),h=e.viewport;if((Re.ios||Re.chrome)&&e.state.selection.main.empty&&l!=c&&(h.from>0||h.to<e.state.doc.length)){let u=Math.min(l,c),d=Math.max(l,c),f=h.from-u,p=h.to-d;(f==0||f==1||u==0)&&(p==0||p==-1||d==e.state.doc.length)&&(l=0,c=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(ue.range(c,l)):this.newSel=ue.single(c,l)}}}function Eb(i,e,t,r){if(i.isComposite()){let s=-1,n=-1,o=-1,a=-1;for(let l=0,c=r,h=r;l<i.children.length;l++){let u=i.children[l],d=c+u.length;if(c<e&&d>t)return Eb(u,e,t,c);if(d>=e&&s==-1&&(s=l,n=c),c>t&&u.dom.parentNode==i.dom){o=l,a=h;break}h=d,c=d+u.breakAfter}return{from:n,to:a<0?r+i.length:a,startDOM:(s?i.children[s-1].dom.nextSibling:null)||i.dom.firstChild,endDOM:o<i.children.length&&o>=0?i.children[o].dom:null}}else return i.isText()?{from:r,to:r+i.length,startDOM:i.dom,endDOM:i.dom.nextSibling}:null}function Db(i,e){let t,{newSel:r}=e,s=i.state.selection.main,n=i.inputState.lastKeyTime>Date.now()-100?i.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:a}=e.bounds,l=s.from,c=null;(n===8||Re.android&&e.text.length<a-o)&&(l=s.to,c="end");let h=Ib(i.state.doc.sliceString(o,a,tl),e.text,l-o,c);h&&(Re.chrome&&n==13&&h.toB==h.from+2&&e.text.slice(h.from,h.toB)==tl+tl&&h.toB--,t={from:o+h.from,to:o+h.toA,insert:ct.of(e.text.slice(h.from,h.toB).split(tl))})}else r&&(!i.hasFocus&&i.state.facet(Qs)||qh(r,s))&&(r=null);if(!t&&!r)return!1;if(!t&&e.typeOver&&!s.empty&&r&&r.main.empty?t={from:s.from,to:s.to,insert:i.state.doc.slice(s.from,s.to)}:(Re.mac||Re.android)&&t&&t.from==t.to&&t.from==s.head-1&&/^\. ?$/.test(t.insert.toString())&&i.contentDOM.getAttribute("autocorrect")=="off"?(r&&t.insert.length==2&&(r=ue.single(r.main.anchor-1,r.main.head-1)),t={from:t.from,to:t.to,insert:ct.of([t.insert.toString().replace("."," ")])}):t&&t.from>=s.from&&t.to<=s.to&&(t.from!=s.from||t.to!=s.to)&&s.to-s.from-(t.to-t.from)<=4?t={from:s.from,to:s.to,insert:i.state.doc.slice(s.from,t.from).append(t.insert).append(i.state.doc.slice(t.to,s.to))}:i.state.doc.lineAt(s.from).to<s.to&&i.docView.lineHasWidget(s.to)&&i.inputState.insertingTextAt>Date.now()-50?t={from:s.from,to:s.to,insert:i.state.toText(i.inputState.insertingText)}:Re.chrome&&t&&t.from==t.to&&t.from==s.head&&t.insert.toString()==`
18
+ `&&i.lineWrapping&&(r&&(r=ue.single(r.main.anchor-1,r.main.head-1)),t={from:s.from,to:s.to,insert:ct.of([" "])}),t)return Wm(i,t,r,n);if(r&&!qh(r,s)){let o=!1,a="select";return i.inputState.lastSelectionTime>Date.now()-50&&(i.inputState.lastSelectionOrigin=="select"&&(o=!0),a=i.inputState.lastSelectionOrigin,a=="select.pointer"&&(r=Lb(i.state.facet(ic).map(l=>l(i)),r))),i.dispatch({selection:r,scrollIntoView:o,userEvent:a}),!0}else return!1}function Wm(i,e,t,r=-1){if(Re.ios&&i.inputState.flushIOSKey(e))return!0;let s=i.state.selection.main;if(Re.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&i.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Eo(i.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>s.head)&&Eo(i.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&Eo(i.contentDOM,"Delete",46)))return!0;let n=e.insert.toString();i.inputState.composing>=0&&i.inputState.composing++;let o,a=()=>o||(o=VM(i,e,t));return i.state.facet(wb).some(l=>l(i,e.from,e.to,n,a))||i.dispatch(a()),!0}function VM(i,e,t){let r,s=i.state,n=s.selection.main,o=-1;if(e.from==e.to&&e.from<n.from||e.from>n.to){let l=e.from<n.from?-1:1,c=l<0?n.from:n.to,h=vl(s.facet(ic).map(u=>u(i)),c,l);e.from==h&&(o=h)}if(o>-1)r={changes:e,selection:ue.cursor(e.from+e.insert.length,-1)};else if(e.from>=n.from&&e.to<=n.to&&e.to-e.from>=(n.to-n.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&i.inputState.composing<0){let l=n.from<e.from?s.sliceDoc(n.from,e.from):"",c=n.to>e.to?s.sliceDoc(e.to,n.to):"";r=s.replaceSelection(i.state.toText(l+e.insert.sliceString(0,void 0,i.state.lineBreak)+c))}else{let l=s.changes(e),c=t&&t.main.to<=l.newLength?t.main:void 0;if(s.selection.ranges.length>1&&(i.inputState.composing>=0||i.inputState.compositionPendingChange)&&e.to<=n.to+10&&e.to>=n.to-10){let h=i.state.sliceDoc(e.from,e.to),u,d=t&&Bb(i,t.main.head);if(d){let p=e.insert.length-(e.to-e.from);u={from:d.from,to:d.to-p}}else u=i.state.doc.lineAt(n.head);let f=n.to-e.to;r=s.changeByRange(p=>{if(p.from==n.from&&p.to==n.to)return{changes:l,range:c||p.map(l)};let g=p.to-f,O=g-h.length;if(i.state.sliceDoc(O,g)!=h||g>=u.from&&O<=u.to)return{range:p};let _=s.changes({from:O,to:g,insert:e.insert}),k=p.to-n.to;return{changes:_,range:c?ue.range(Math.max(0,c.anchor+k),Math.max(0,c.head+k)):p.map(_)}})}else r={changes:l,selection:c&&s.selection.replaceRange(c)}}let a="input.type";return(i.composing||i.inputState.compositionPendingChange&&i.inputState.compositionEndedAt>Date.now()-50)&&(i.inputState.compositionPendingChange=!1,a+=".compose",i.inputState.compositionFirstChange&&(a+=".start",i.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:a,scrollIntoView:!0})}function Ib(i,e,t,r){let s=Math.min(i.length,e.length),n=0;for(;n<s&&i.charCodeAt(n)==e.charCodeAt(n);)n++;if(n==s&&i.length==e.length)return null;let o=i.length,a=e.length;for(;o>0&&a>0&&i.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(r=="end"){let l=Math.max(0,n-Math.min(o,a));t-=o+l-n}if(o<n&&i.length<e.length){let l=t<=n&&t>=o?n-t:0;n-=l,a=n+(a-o),o=n}else if(a<n){let l=t<=n&&t>=a?n-t:0;n-=l,o=n+(o-a),a=n}return{from:n,toA:o,toB:a}}function qM(i){let e=[];if(i.root.activeElement!=i.contentDOM)return e;let{anchorNode:t,anchorOffset:r,focusNode:s,focusOffset:n}=i.observer.selectionRange;return t&&(e.push(new Av(t,r)),(s!=t||n!=r)&&e.push(new Av(s,n))),e}function HM(i,e){if(i.length==0)return null;let t=i[0].pos,r=i.length==2?i[1].pos:t;return t>-1&&r>-1?ue.single(t+e,r+e):null}function qh(i,e){return e.head==i.main.head&&e.anchor==i.main.anchor}class UM{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Re.safari&&e.contentDOM.addEventListener("input",()=>null),Re.gecko&&cQ(e.contentDOM.ownerDocument)}handleEvent(e){!iQ(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let r=this.handlers[e];if(r){for(let s of r.observers)s(this.view,t);for(let s of r.handlers){if(t.defaultPrevented)break;if(s(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=YM(e),r=this.handlers,s=this.view.contentDOM;for(let n in t)if(n!="scroll"){let o=!t[n].handlers.length,a=r[n];a&&o!=!a.handlers.length&&(s.removeEventListener(n,this.handleEvent),a=null),a||s.addEventListener(n,this.handleEvent,{passive:o})}for(let n in r)n!="scroll"&&!t[n]&&s.removeEventListener(n,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&Nb.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Re.android&&Re.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return Re.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=zb.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||jM.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Eo(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:Re.safari&&!Re.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Rv(i,e){return(t,r)=>{try{return e.call(i,r,t)}catch(s){qi(t.state,s)}}}function YM(i){let e=Object.create(null);function t(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of i){let s=r.spec,n=s&&s.plugin.domEventHandlers,o=s&&s.plugin.domEventObservers;if(n)for(let a in n){let l=n[a];l&&t(a).handlers.push(Rv(r.value,l))}if(o)for(let a in o){let l=o[a];l&&t(a).observers.push(Rv(r.value,l))}}for(let r in Rr)t(r).handlers.push(Rr[r]);for(let r in wr)t(r).observers.push(wr[r]);return e}const zb=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],jM="dthko",Nb=[16,17,18,20,91,92,224,225],Mc=6;function Qc(i){return Math.max(0,i)*.7+8}function GM(i,e){return Math.max(Math.abs(i.clientX-e.clientX),Math.abs(i.clientY-e.clientY))}class KM{constructor(e,t,r,s){this.view=e,this.startEvent=t,this.style=r,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=eM(e.contentDOM),this.atoms=e.state.facet(ic).map(o=>o(e));let n=e.contentDOM.ownerDocument;n.addEventListener("mousemove",this.move=this.move.bind(this)),n.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(st.allowMultipleSelections)&&JM(e,t),this.dragging=tQ(e,t)&&Xb(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&GM(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,r=0,s=0,n=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:n,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=Nm(this.view);e.clientX-l.left<=s+Mc?t=-Qc(s-e.clientX):e.clientX+l.right>=o-Mc&&(t=Qc(e.clientX-o)),e.clientY-l.top<=n+Mc?r=-Qc(n-e.clientY):e.clientY+l.bottom>=a-Mc&&(r=Qc(e.clientY-a)),this.setScrollSpeed(t,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,r=Lb(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function JM(i,e){let t=i.state.facet(_b);return t.length?t[0](e):Re.mac?e.metaKey:e.ctrlKey}function eQ(i,e){let t=i.state.facet(bb);return t.length?t[0](e):Re.mac?!e.altKey:!e.ctrlKey}function tQ(i,e){let{main:t}=i.state.selection;if(t.empty)return!1;let r=$l(i.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let n=0;n<s.length;n++){let o=s[n];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function iQ(i,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,r;t!=i.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(r=Vt.get(t))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(e))return!1;return!0}const Rr=Object.create(null),wr=Object.create(null),Wb=Re.ie&&Re.ie_version<15||Re.ios&&Re.webkit_version<604;function rQ(i){let e=i.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{i.focus(),t.remove(),Zb(i,t.value)},50)}function Du(i,e,t){for(let r of i.facet(e))t=r(t,i);return t}function Zb(i,e){e=Du(i.state,Em,e);let{state:t}=i,r,s=1,n=t.toText(e),o=n.lines==t.selection.ranges.length;if(Jf!=null&&t.selection.ranges.every(l=>l.empty)&&Jf==n.toString()){let l=-1;r=t.changeByRange(c=>{let h=t.doc.lineAt(c.from);if(h.from==l)return{range:c};l=h.from;let u=t.toText((o?n.line(s++).text:e)+t.lineBreak);return{changes:{from:h.from,insert:u},range:ue.cursor(c.from+u.length)}})}else o?r=t.changeByRange(l=>{let c=n.line(s++);return{changes:{from:l.from,to:l.to,insert:c.text},range:ue.cursor(l.from+c.length)}}):r=t.replaceSelection(n);i.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}wr.scroll=i=>{i.inputState.lastScrollTop=i.scrollDOM.scrollTop,i.inputState.lastScrollLeft=i.scrollDOM.scrollLeft};Rr.keydown=(i,e)=>(i.inputState.setSelectionOrigin("select"),e.keyCode==27&&i.inputState.tabFocusMode!=0&&(i.inputState.tabFocusMode=Date.now()+2e3),!1);wr.touchstart=(i,e)=>{i.inputState.lastTouchTime=Date.now(),i.inputState.setSelectionOrigin("select.pointer")};wr.touchmove=i=>{i.inputState.setSelectionOrigin("select.pointer")};Rr.mousedown=(i,e)=>{if(i.observer.flush(),i.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let r of i.state.facet(yb))if(t=r(i,e),t)break;if(!t&&e.button==0&&(t=nQ(i,e)),t){let r=!i.hasFocus;i.inputState.startMouseSelection(new KM(i,e,t,r)),r&&i.observer.ignore(()=>{hb(i.contentDOM);let n=i.root.activeElement;n&&!n.contains(i.contentDOM)&&n.blur()});let s=i.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else i.inputState.setSelectionOrigin("select.pointer");return!1};function Bv(i,e,t,r){if(r==1)return ue.cursor(e,t);if(r==2)return LM(i.state,e,t);{let s=i.docView.lineAt(e,t),n=i.state.doc.lineAt(s?s.posAtEnd:e),o=s?s.posAtStart:n.from,a=s?s.posAtEnd:n.to;return a<i.state.doc.length&&a==n.to&&a++,ue.range(o,a)}}const sQ=Re.ie&&Re.ie_version<=11;let Lv=null,Ev=0,Dv=0;function Xb(i){if(!sQ)return i.detail;let e=Lv,t=Dv;return Lv=i,Dv=Date.now(),Ev=!e||t>Date.now()-400&&Math.abs(e.clientX-i.clientX)<2&&Math.abs(e.clientY-i.clientY)<2?(Ev+1)%3:1}function nQ(i,e){let t=i.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),r=Xb(e),s=i.state.selection;return{update(n){n.docChanged&&(t.pos=n.changes.mapPos(t.pos),s=s.map(n.changes))},get(n,o,a){let l=i.posAndSideAtCoords({x:n.clientX,y:n.clientY},!1),c,h=Bv(i,l.pos,l.assoc,r);if(t.pos!=l.pos&&!o){let u=Bv(i,t.pos,t.assoc,r),d=Math.min(u.from,h.from),f=Math.max(u.to,h.to);h=d<h.from?ue.range(d,f):ue.range(f,d)}return o?s.replaceRange(s.main.extend(h.from,h.to)):a&&r==1&&s.ranges.length>1&&(c=oQ(s,l.pos))?c:a?s.addRange(h):ue.create([h])}}}function oQ(i,e){for(let t=0;t<i.ranges.length;t++){let{from:r,to:s}=i.ranges[t];if(r<=e&&s>=e)return ue.create(i.ranges.slice(0,t).concat(i.ranges.slice(t+1)),i.mainIndex==t?0:i.mainIndex-(i.mainIndex>t?1:0))}return null}Rr.dragstart=(i,e)=>{let{selection:{main:t}}=i.state;if(e.target.draggable){let s=i.docView.tile.nearest(e.target);if(s&&s.isWidget()){let n=s.posAtStart,o=n+s.length;(n>=t.to||o<=t.from)&&(t=ue.range(n,o))}}let{inputState:r}=i;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",Du(i.state,Dm,i.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Rr.dragend=i=>(i.inputState.draggedContent=null,!1);function Iv(i,e,t,r){if(t=Du(i.state,Em,t),!t)return;let s=i.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:n}=i.inputState,o=r&&n&&eQ(i,e)?{from:n.from,to:n.to}:null,a={from:s,insert:t},l=i.state.changes(o?[o,a]:a);i.focus(),i.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),i.inputState.draggedContent=null}Rr.drop=(i,e)=>{if(!e.dataTransfer)return!1;if(i.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let r=Array(t.length),s=0,n=()=>{++s==t.length&&Iv(i,e,r.filter(o=>o!=null).join(i.state.lineBreak),!1)};for(let o=0;o<t.length;o++){let a=new FileReader;a.onerror=n,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(r[o]=a.result),n()},a.readAsText(t[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return Iv(i,e,r,!0),!0}return!1};Rr.paste=(i,e)=>{if(i.state.readOnly)return!0;i.observer.flush();let t=Wb?null:e.clipboardData;return t?(Zb(i,t.getData("text/plain")||t.getData("text/uri-list")),!0):(rQ(i),!1)};function aQ(i,e){let t=i.dom.parentNode;if(!t)return;let r=t.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),i.focus()},50)}function lQ(i){let e=[],t=[],r=!1;for(let s of i.selection.ranges)s.empty||(e.push(i.sliceDoc(s.from,s.to)),t.push(s));if(!e.length){let s=-1;for(let{from:n}of i.selection.ranges){let o=i.doc.lineAt(n);o.number>s&&(e.push(o.text),t.push({from:o.from,to:Math.min(i.doc.length,o.to+1)})),s=o.number}r=!0}return{text:Du(i,Dm,e.join(i.lineBreak)),ranges:t,linewise:r}}let Jf=null;Rr.copy=Rr.cut=(i,e)=>{if(!ml(i.contentDOM,i.observer.selectionRange))return!1;let{text:t,ranges:r,linewise:s}=lQ(i.state);if(!t&&!s)return!1;Jf=s?t:null,e.type=="cut"&&!i.state.readOnly&&i.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let n=Wb?null:e.clipboardData;return n?(n.clearData(),n.setData("text/plain",t),!0):(aQ(i,t),!1)};const Fb=Ws.define();function Vb(i,e){let t=[];for(let r of i.facet(Sb)){let s=r(i,e);s&&t.push(s)}return t.length?i.update({effects:t,annotations:Fb.of(!0)}):null}function qb(i){setTimeout(()=>{let e=i.hasFocus;if(e!=i.inputState.notifiedFocused){let t=Vb(i.state,e);t?i.dispatch(t):i.update([])}},10)}wr.focus=i=>{i.inputState.lastFocusTime=Date.now(),!i.scrollDOM.scrollTop&&(i.inputState.lastScrollTop||i.inputState.lastScrollLeft)&&(i.scrollDOM.scrollTop=i.inputState.lastScrollTop,i.scrollDOM.scrollLeft=i.inputState.lastScrollLeft),qb(i)};wr.blur=i=>{i.observer.clearSelectionRange(),qb(i)};wr.compositionstart=wr.compositionupdate=i=>{i.observer.editContext||(i.inputState.compositionFirstChange==null&&(i.inputState.compositionFirstChange=!0),i.inputState.composing<0&&(i.inputState.composing=0))};wr.compositionend=i=>{i.observer.editContext||(i.inputState.composing=-1,i.inputState.compositionEndedAt=Date.now(),i.inputState.compositionPendingKey=!0,i.inputState.compositionPendingChange=i.observer.pendingRecords().length>0,i.inputState.compositionFirstChange=null,Re.chrome&&Re.android?i.observer.flushSoon():i.inputState.compositionPendingChange?Promise.resolve().then(()=>i.observer.flush()):setTimeout(()=>{i.inputState.composing<0&&i.docView.hasComposition&&i.update([])},50))};wr.contextmenu=i=>{i.inputState.lastContextMenu=Date.now()};Rr.beforeinput=(i,e)=>{var t,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(i.inputState.insertingText=e.data,i.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&i.observer.editContext){let n=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(n&&o.length){let a=o[0],l=i.posAtDOM(a.startContainer,a.startOffset),c=i.posAtDOM(a.endContainer,a.endOffset);return Wm(i,{from:l,to:c,insert:i.state.toText(n)},null),!0}}let s;if(Re.chrome&&Re.android&&(s=zb.find(n=>n.inputType==e.inputType))&&(i.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let n=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>n+10&&i.hasFocus&&(i.contentDOM.blur(),i.focus())},100)}return Re.ios&&e.inputType=="deleteContentForward"&&i.observer.flushSoon(),Re.safari&&e.inputType=="insertText"&&i.inputState.composing>=0&&setTimeout(()=>wr.compositionend(i,e),20),!1};const zv=new Set;function cQ(i){zv.has(i)||(zv.add(i),i.addEventListener("copy",()=>{}),i.addEventListener("cut",()=>{}))}const Nv=["pre-wrap","normal","pre-line","break-spaces"];let Uo=!1;function Wv(){Uo=!1}class hQ{constructor(e){this.lineWrapping=e,this.doc=ct.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let r=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((t-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Nv.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let r=0;r<e.length;r++){let s=e[r];s<0?r++:this.heightSamples[Math.floor(s*10)]||(t=!0,this.heightSamples[Math.floor(s*10)]=!0)}return t}refresh(e,t,r,s,n,o){let a=Nv.indexOf(e)>-1,l=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=a||Math.abs(r-this.charWidth)>.1;if(this.lineWrapping=a,this.lineHeight=t,this.charWidth=r,this.textHeight=s,this.lineLength=n,l){this.heightSamples={};for(let c=0;c<o.length;c++){let h=o[c];h<0?c++:this.heightSamples[Math.floor(h*10)]=!0}}return l}}class uQ{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class Mr{constructor(e,t,r,s,n){this.from=e,this.length=t,this.top=r,this.height=s,this._content=n}get type(){return typeof this._content=="number"?yi.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof eo?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Mr(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var xt=(function(i){return i[i.ByPos=0]="ByPos",i[i.ByHeight=1]="ByHeight",i[i.ByPosNoHeight=2]="ByPosNoHeight",i})(xt||(xt={}));const gh=.001;class Li{constructor(e,t,r=2){this.length=e,this.height=t,this.flags=r}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>gh&&(Uo=!0),this.height=e)}replace(e,t,r){return Li.of(r)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,r,s){let n=this,o=r.doc;for(let a=s.length-1;a>=0;a--){let{fromA:l,toA:c,fromB:h,toB:u}=s[a],d=n.lineAt(l,xt.ByPosNoHeight,r.setDoc(t),0,0),f=d.to>=c?d:n.lineAt(c,xt.ByPosNoHeight,r,0,0);for(u+=f.to-c,c=f.to;a>0&&d.from<=s[a-1].toA;)l=s[a-1].fromA,h=s[a-1].fromB,a--,l<d.from&&(d=n.lineAt(l,xt.ByPosNoHeight,r,0,0));h+=d.from-l,l=d.from;let p=Zm.build(r.setDoc(o),e,h,u);n=Hh(n,n.replace(l,c,p))}return n.updateHeight(r,0)}static empty(){return new tr(0,0,0)}static of(e){if(e.length==1)return e[0];let t=0,r=e.length,s=0,n=0;for(;;)if(t==r)if(s>n*2){let a=e[t-1];a.break?e.splice(--t,1,a.left,null,a.right):e.splice(--t,1,a.left,a.right),r+=1+a.break,s-=a.size}else if(n>s*2){let a=e[r];a.break?e.splice(r,1,a.left,null,a.right):e.splice(r,1,a.left,a.right),r+=2+a.break,n-=a.size}else break;else if(s<n){let a=e[t++];a&&(s+=a.size)}else{let a=e[--r];a&&(n+=a.size)}let o=0;return e[t-1]==null?(o=1,t--):e[t]==null&&(o=1,r++),new fQ(Li.of(e.slice(0,t)),o,Li.of(e.slice(r)))}}function Hh(i,e){return i==e?i:(i.constructor!=e.constructor&&(Uo=!0),e)}Li.prototype.size=1;const dQ=ze.replace({});class Hb extends Li{constructor(e,t,r){super(e,t),this.deco=r,this.spaceAbove=0}mainBlock(e,t){return new Mr(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,r,s){return this.spaceAbove&&e<r+this.spaceAbove?new Mr(s,0,r,this.spaceAbove,dQ):this.mainBlock(r,s)}lineAt(e,t,r,s,n){let o=this.mainBlock(s,n);return this.spaceAbove?this.blockAt(0,r,s,n).join(o):o}forEachLine(e,t,r,s,n,o){e<=n+this.length&&t>=n&&o(this.lineAt(0,xt.ByPos,r,s,n))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,r=!1,s){return s&&s.from<=t&&s.more&&this.setMeasuredHeight(s),this.outdated=!1,this}toString(){return`block(${this.length})`}}class tr extends Hb{constructor(e,t,r){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(e,t){return new Mr(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,r){let s=r[0];return r.length==1&&(s instanceof tr||s instanceof mi&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof mi?s=new tr(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):Li.of(r)}updateHeight(e,t=0,r=!1,s){return s&&s.from<=t&&s.more?this.setMeasuredHeight(s):(r||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class mi extends Li{constructor(e){super(e,0)}heightMetrics(e,t){let r=e.doc.lineAt(t).number,s=e.doc.lineAt(t+this.length).number,n=s-r+1,o,a=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*n);o=l/n,this.length>n+1&&(a=(this.height-l)/(this.length-n-1))}else o=this.height/n;return{firstLine:r,lastLine:s,perLine:o,perChar:a}}blockAt(e,t,r,s){let{firstLine:n,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(t,s);if(t.lineWrapping){let c=s+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),h=t.doc.lineAt(c),u=a+h.length*l,d=Math.max(r,e-u/2);return new Mr(h.from,h.length,d,u,0)}else{let c=Math.max(0,Math.min(o-n,Math.floor((e-r)/a))),{from:h,length:u}=t.doc.line(n+c);return new Mr(h,u,r+a*c,a,0)}}lineAt(e,t,r,s,n){if(t==xt.ByHeight)return this.blockAt(e,r,s,n);if(t==xt.ByPosNoHeight){let{from:f,to:p}=r.doc.lineAt(e);return new Mr(f,p-f,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(r,n),c=r.doc.lineAt(e),h=a+c.length*l,u=c.number-o,d=s+a*u+l*(c.from-n-u);return new Mr(c.from,c.length,Math.max(s,Math.min(d,s+this.height-h)),h,0)}forEachLine(e,t,r,s,n,o){e=Math.max(e,n),t=Math.min(t,n+this.length);let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(r,n);for(let h=e,u=s;h<=t;){let d=r.doc.lineAt(h);if(h==e){let p=d.number-a;u+=l*p+c*(e-n-p)}let f=l+c*d.length;o(new Mr(d.from,d.length,u,f,0)),u+=f,h=d.to+1}}replace(e,t,r){let s=this.length-t;if(s>0){let n=r[r.length-1];n instanceof mi?r[r.length-1]=new mi(n.length+s):r.push(null,new mi(s-1))}if(e>0){let n=r[0];n instanceof mi?r[0]=new mi(e+n.length):r.unshift(new mi(e-1),null)}return Li.of(r)}decomposeLeft(e,t){t.push(new mi(e-1),null)}decomposeRight(e,t){t.push(null,new mi(this.length-e-1))}updateHeight(e,t=0,r=!1,s){let n=t+this.length;if(s&&s.from<=t+this.length&&s.more){let o=[],a=Math.max(t,s.from),l=-1;for(s.from>t&&o.push(new mi(s.from-t-1).updateHeight(e,t));a<=n&&s.more;){let h=e.doc.lineAt(a).length;o.length&&o.push(null);let u=s.heights[s.index++],d=0;u<0&&(d=-u,u=s.heights[s.index++]),l==-1?l=u:Math.abs(u-l)>=gh&&(l=-2);let f=new tr(h,u,d);f.outdated=!1,o.push(f),a+=h+1}a<=n&&o.push(null,new mi(n-a).updateHeight(e,a));let c=Li.of(o);return(l<0||Math.abs(c.height-this.height)>=gh||Math.abs(l-this.heightMetrics(e,t).perLine)>=gh)&&(Uo=!0),Hh(this,c)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class fQ extends Li{constructor(e,t,r){super(e.length+t+r.length,e.height+r.height,t|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,t,r,s){let n=r+this.left.height;return e<n?this.left.blockAt(e,t,r,s):this.right.blockAt(e,t,n,s+this.left.length+this.break)}lineAt(e,t,r,s,n){let o=s+this.left.height,a=n+this.left.length+this.break,l=t==xt.ByHeight?e<o:e<a,c=l?this.left.lineAt(e,t,r,s,n):this.right.lineAt(e,t,r,o,a);if(this.break||(l?c.to<a:c.from>a))return c;let h=t==xt.ByPosNoHeight?xt.ByPosNoHeight:xt.ByPos;return l?c.join(this.right.lineAt(a,h,r,o,a)):this.left.lineAt(a,h,r,s,n).join(c)}forEachLine(e,t,r,s,n,o){let a=s+this.left.height,l=n+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,t,r,s,n,o),t>=l&&this.right.forEachLine(e,t,r,a,l,o);else{let c=this.lineAt(l,xt.ByPos,r,s,n);e<c.from&&this.left.forEachLine(e,c.from-1,r,s,n,o),c.to>=e&&c.from<=t&&o(c),t>c.to&&this.right.forEachLine(c.to+1,t,r,a,l,o)}}replace(e,t,r){let s=this.left.length+this.break;if(t<s)return this.balanced(this.left.replace(e,t,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-s,t-s,r));let n=[];e>0&&this.decomposeLeft(e,n);let o=n.length;for(let a of r)n.push(a);if(e>0&&Zv(n,o-1),t<this.length){let a=n.length;this.decomposeRight(t,n),Zv(n,a)}return Li.of(n)}decomposeLeft(e,t){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(r++,e>=r&&t.push(null)),e>r&&this.right.decomposeLeft(e-r,t)}decomposeRight(e,t){let r=this.left.length,s=r+this.break;if(e>=s)return this.right.decomposeRight(e-s,t);e<r&&this.left.decomposeRight(e,t),this.break&&e<s&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?Li.of(this.break?[e,null,t]:[e,t]):(this.left=Hh(this.left,e),this.right=Hh(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,r=!1,s){let{left:n,right:o}=this,a=t+n.length+this.break,l=null;return s&&s.from<=t+n.length&&s.more?l=n=n.updateHeight(e,t,r,s):n.updateHeight(e,t,r),s&&s.from<=a+o.length&&s.more?l=o=o.updateHeight(e,a,r,s):o.updateHeight(e,a,r),l?this.balanced(n,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Zv(i,e){let t,r;i[e]==null&&(t=i[e-1])instanceof mi&&(r=i[e+1])instanceof mi&&i.splice(e-1,3,new mi(t.length+1+r.length))}const pQ=5;class Zm{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let r=Math.min(t,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof tr?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new tr(r-this.pos,-1,0)),this.writtenTo=r,t>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,r){if(e<t||r.heightRelevant){let s=r.widget?r.widget.estimatedHeight:0,n=r.widget?r.widget.lineBreaks:0;s<0&&(s=this.oracle.lineHeight);let o=t-e;r.block?this.addBlock(new Hb(o,s,r)):(o||n||s>=pQ)&&this.addLineDeco(s,n,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new tr(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let r=new mi(t-e);return this.oracle.doc.lineAt(e).to==t&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof tr)return e;let t=new tr(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,r){let s=this.ensureLine();s.length+=r,s.collapsed+=r,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=t,this.writtenTo=this.pos=this.pos+r}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof tr)&&!this.isCovered?this.nodes.push(new tr(0,-1,0)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=e;for(let s of this.nodes)s instanceof tr&&s.updateHeight(this.oracle,r),r+=s?s.length:1;return this.nodes}static build(e,t,r,s){let n=new Zm(r,e);return it.spans(t,r,s,n,0),n.finish(r)}}function mQ(i,e,t){let r=new gQ;return it.compare(i,e,t,r,0),r.changes}class gQ{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,r,s){(e<t||r&&r.heightRelevant||s&&s.heightRelevant)&&Lo(e,t,this.changes,5)}}function vQ(i,e){let t=i.getBoundingClientRect(),r=i.ownerDocument,s=r.defaultView||window,n=Math.max(0,t.left),o=Math.min(s.innerWidth,t.right),a=Math.max(0,t.top),l=Math.min(s.innerHeight,t.bottom);for(let c=i.parentNode;c&&c!=r.body;)if(c.nodeType==1){let h=c,u=window.getComputedStyle(h);if((h.scrollHeight>h.clientHeight||h.scrollWidth>h.clientWidth)&&u.overflow!="visible"){let d=h.getBoundingClientRect();n=Math.max(n,d.left),o=Math.min(o,d.right),a=Math.max(a,d.top),l=Math.min(c==i.parentNode?s.innerHeight:l,d.bottom)}c=u.position=="absolute"||u.position=="fixed"?h.offsetParent:h.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:n-t.left,right:Math.max(n,o)-t.left,top:a-(t.top+e),bottom:Math.max(a,l)-(t.top+e)}}function OQ(i){let e=i.getBoundingClientRect(),t=i.ownerDocument.defaultView||window;return e.left<t.innerWidth&&e.right>0&&e.top<t.innerHeight&&e.bottom>0}function _Q(i,e){let t=i.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class ad{constructor(e,t,r,s){this.from=e,this.to=t,this.size=r,this.displaySize=s}static same(e,t){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++){let s=e[r],n=t[r];if(s.from!=n.from||s.to!=n.to||s.size!=n.size)return!1}return!0}draw(e,t){return ze.replace({widget:new bQ(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class bQ extends ps{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class Xv{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Fv,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=_t.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(Im).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new hQ(t),this.stateDeco=Vv(e),this.heightMap=Li.empty().applyChanges(this.stateDeco,ct.empty,this.heightOracle.setDoc(e.doc),[new vr(0,0,0,e.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ze.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let r=0;r<=1;r++){let s=r?t.head:t.anchor;if(!e.some(({from:n,to:o})=>s>=n&&s<=o)){let{from:n,to:o}=this.lineBlockAt(s);e.push(new Ac(n,o))}}return this.viewports=e.sort((r,s)=>r.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Fv:new Xm(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(il(e,this.scaler))})}update(e,t=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=Vv(this.state);let s=e.changedRanges,n=vr.extendWithRanges(s,mQ(r,this.stateDeco,e?e.changes:jt.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Wv(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),n),(this.heightMap.height!=o||Uo)&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let l=n.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<l.from||t.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,t));let c=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,e.flags|=this.updateForViewport(),(c||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Cb)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,r=window.getComputedStyle(t),s=this.heightOracle,n=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?_t.RTL:_t.LTR;let o=this.heightOracle.mustRefreshForWrapping(n)||this.mustMeasureContent==="refresh",a=t.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let c=0,h=0;if(a.width&&a.height){let{scaleX:w,scaleY:C}=cb(t,a);(w>.005&&Math.abs(this.scaleX-w)>.005||C>.005&&Math.abs(this.scaleY-C)>.005)&&(this.scaleX=w,this.scaleY=C,c|=16,o=l=!0)}let u=(parseInt(r.paddingTop)||0)*this.scaleY,d=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=u||this.paddingBottom!=d)&&(this.paddingTop=u,this.paddingBottom=d,c|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=16);let f=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=f&&(this.scrollAnchorHeight=-1,this.scrollTop=f),this.scrolledToBottom=ub(e.scrollDOM);let p=(this.printing?_Q:vQ)(t,this.paddingTop),g=p.top-this.pixelViewport.top,O=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let _=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(_!=this.inView&&(this.inView=_,_&&(l=!0)),!this.inView&&!this.scrollTarget&&!OQ(e.dom))return 0;let k=a.width;if((this.contentDOMWidth!=k||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,c|=16),l){let w=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(w)&&(o=!0),o||s.lineWrapping&&Math.abs(k-this.contentDOMWidth)>s.charWidth){let{lineHeight:C,charWidth:M,textHeight:D}=e.docView.measureTextSize();o=C>0&&s.refresh(n,C,M,D,Math.max(5,k/M),w),o&&(e.docView.minWidth=0,c|=16)}g>0&&O>0?h=Math.max(g,O):g<0&&O<0&&(h=Math.min(g,O)),Wv();for(let C of this.viewports){let M=C.from==this.viewport.from?w:e.docView.measureVisibleLineHeights(C);this.heightMap=(o?Li.empty().applyChanges(this.stateDeco,ct.empty,this.heightOracle,[new vr(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new uQ(C.from,M))}Uo&&(c|=2)}let P=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return P&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(h,this.scrollTarget),c|=this.updateForViewport()),(c&2||P)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,n=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new Ac(s.lineAt(o-r*1e3,xt.ByHeight,n,0,0).from,s.lineAt(a+(1-r)*1e3,xt.ByHeight,n,0,0).to);if(t){let{head:c}=t.range;if(c<l.from||c>l.to){let h=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),u=s.lineAt(c,xt.ByPos,n,0,0),d;t.y=="center"?d=(u.top+u.bottom)/2-h/2:t.y=="start"||t.y=="nearest"&&c<l.from?d=u.top:d=u.bottom-h,l=new Ac(s.lineAt(d-1e3/2,xt.ByHeight,n,0,0).from,s.lineAt(d+h+1e3/2,xt.ByHeight,n,0,0).to)}}return l}mapViewport(e,t){let r=t.mapPos(e.from,-1),s=t.mapPos(e.to,1);return new Ac(this.heightMap.lineAt(r,xt.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,xt.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},r=0){if(!this.inView)return!0;let{top:s}=this.heightMap.lineAt(e,xt.ByPos,this.heightOracle,0,0),{bottom:n}=this.heightMap.lineAt(t,xt.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(e==0||s<=o-Math.max(10,Math.min(-r,250)))&&(t==this.state.doc.length||n>=a+Math.max(10,Math.min(r,250)))&&s>o-2*1e3&&n<a+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let r=[];for(let s of e)t.touchesRange(s.from,s.to)||r.push(new ad(t.mapPos(s.from),t.mapPos(s.to),s.size,s.displaySize));return r}ensureLineGaps(e,t){let r=this.heightOracle.lineWrapping,s=r?1e4:2e3,n=s>>1,o=s<<1;if(this.defaultTextDirection!=_t.LTR&&!r)return[];let a=[],l=(h,u,d,f)=>{if(u-h<n)return;let p=this.state.selection.main,g=[p.from];p.empty||g.push(p.to);for(let _ of g)if(_>h&&_<u){l(h,_-10,d,f),l(_+10,u,d,f);return}let O=xQ(e,_=>_.from>=d.from&&_.to<=d.to&&Math.abs(_.from-h)<n&&Math.abs(_.to-u)<n&&!g.some(k=>_.from<k&&_.to>k));if(!O){if(u<d.to&&t&&r&&t.visibleRanges.some(P=>P.from<=u&&P.to>=u)){let P=t.moveToLineBoundary(ue.cursor(u),!1,!0).head;P>h&&(u=P)}let _=this.gapSize(d,h,u,f),k=r||_<2e6?_:2e6;O=new ad(h,u,_,k)}a.push(O)},c=h=>{if(h.length<o||h.type!=yi.Text)return;let u=yQ(h.from,h.to,this.stateDeco);if(u.total<o)return;let d=this.scrollTarget?this.scrollTarget.range.head:null,f,p;if(r){let g=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,O,_;if(d!=null){let k=Bc(u,d),P=((this.visibleBottom-this.visibleTop)/2+g)/h.height;O=k-P,_=k+P}else O=(this.visibleTop-h.top-g)/h.height,_=(this.visibleBottom-h.top+g)/h.height;f=Rc(u,O),p=Rc(u,_)}else{let g=u.total*this.heightOracle.charWidth,O=s*this.heightOracle.charWidth,_=0;if(g>2e6)for(let M of e)M.from>=h.from&&M.from<h.to&&M.size!=M.displaySize&&M.from*this.heightOracle.charWidth+_<this.pixelViewport.left&&(_=M.size-M.displaySize);let k=this.pixelViewport.left+_,P=this.pixelViewport.right+_,w,C;if(d!=null){let M=Bc(u,d),D=((P-k)/2+O)/g;w=M-D,C=M+D}else w=(k-O)/g,C=(P+O)/g;f=Rc(u,w),p=Rc(u,C)}f>h.from&&l(h.from,f,h,u),p<h.to&&l(p,h.to,h,u)};for(let h of this.viewportLines)Array.isArray(h.type)?h.type.forEach(c):c(h);return a}gapSize(e,t,r,s){let n=Bc(s,r)-Bc(s,t);return this.heightOracle.lineWrapping?e.height*n:s.total*this.heightOracle.charWidth*n}updateLineGaps(e){ad.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=ze.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let r=[];it.spans(t,this.viewport.from,this.viewport.to,{span(n,o){r.push({from:n,to:o})},point(){}},20);let s=0;if(r.length!=this.visibleRanges.length)s=12;else for(let n=0;n<r.length&&!(s&8);n++){let o=this.visibleRanges[n],a=r[n];(o.from!=a.from||o.to!=a.to)&&(s|=4,e&&e.mapPos(o.from,-1)==a.from&&e.mapPos(o.to,1)==a.to||(s|=8))}return this.visibleRanges=r,s}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||il(this.heightMap.lineAt(e,xt.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||il(this.heightMap.lineAt(this.scaler.fromDOM(e),xt.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return il(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Ac{constructor(e,t){this.from=e,this.to=t}}function yQ(i,e,t){let r=[],s=i,n=0;return it.spans(t,i,e,{span(){},point(o,a){o>s&&(r.push({from:s,to:o}),n+=o-s),s=a}},20),s<e&&(r.push({from:s,to:e}),n+=e-s),{total:n,ranges:r}}function Rc({total:i,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let r=Math.floor(i*t);for(let s=0;;s++){let{from:n,to:o}=e[s],a=o-n;if(r<=a)return n+r;r-=a}}function Bc(i,e){let t=0;for(let{from:r,to:s}of i.ranges){if(e<=s){t+=e-r;break}t+=s-r}return t/i.total}function xQ(i,e){for(let t of i)if(e(t))return t}const Fv={toDOM(i){return i},fromDOM(i){return i},scale:1,eq(i){return i==this}};function Vv(i){let e=i.facet(Bu).filter(r=>typeof r!="function"),t=i.facet(zm).filter(r=>typeof r!="function");return t.length&&e.push(it.join(t)),e}class Xm{constructor(e,t,r){let s=0,n=0,o=0;this.viewports=r.map(({from:a,to:l})=>{let c=t.lineAt(a,xt.ByPos,e,0,0).top,h=t.lineAt(l,xt.ByPos,e,0,0).bottom;return s+=h-c,{from:a,to:l,top:c,bottom:h,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(t.height-s);for(let a of this.viewports)a.domTop=o+(a.top-n)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),n=a.bottom}toDOM(e){for(let t=0,r=0,s=0;;t++){let n=t<this.viewports.length?this.viewports[t]:null;if(!n||e<n.top)return s+(e-r)*this.scale;if(e<=n.bottom)return n.domTop+(e-n.top);r=n.bottom,s=n.domBottom}}fromDOM(e){for(let t=0,r=0,s=0;;t++){let n=t<this.viewports.length?this.viewports[t]:null;if(!n||e<n.domTop)return r+(e-s)/this.scale;if(e<=n.domBottom)return n.top+(e-n.domTop);r=n.bottom,s=n.domBottom}}eq(e){return e instanceof Xm?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,r)=>t.from==e.viewports[r].from&&t.to==e.viewports[r].to):!1}}function il(i,e){if(e.scale==1)return i;let t=e.toDOM(i.top),r=e.toDOM(i.bottom);return new Mr(i.from,i.length,t,r-t,Array.isArray(i._content)?i._content.map(s=>il(s,e)):i._content)}const Lc=Ae.define({combine:i=>i.join(" ")}),ep=Ae.define({combine:i=>i.indexOf(!0)>-1}),tp=_n.newName(),Ub=_n.newName(),Yb=_n.newName(),jb={"&light":"."+Ub,"&dark":"."+Yb};function ip(i,e,t){return new _n(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,s=>{if(s=="&")return i;if(!t||!t[s])throw new RangeError(`Unsupported selector: ${s}`);return t[s]}):i+" "+r}})}const wQ=ip("."+tp,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},jb),SQ={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},ld=Re.ie&&Re.ie_version<=11;class kQ{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new tM,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let r of t)this.queue.push(r);(Re.ie&&Re.ie_version<=11||Re.ios&&e.composing)&&t.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Re.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Re.chrome&&Re.chrome_version<126)&&(this.editContext=new $Q(e),e.state.facet(Qs)&&(e.contentDOM.editContext=this.editContext.editContext)),ld&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,r)=>t!=e[r]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,s=this.selectionRange;if(r.state.facet(Qs)?r.root.activeElement!=this.dom:!ml(this.dom,s))return;let n=s.anchorNode&&r.docView.tile.nearest(s.anchorNode);if(n&&n.isWidget()&&n.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(Re.ie&&Re.ie_version<=11||Re.android&&Re.chrome)&&!r.state.selection.main.empty&&s.focusNode&&gl(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=$l(e.root);if(!t)return!1;let r=Re.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&CQ(this.view,t)||t;if(!r||this.selectionRange.eq(r))return!1;let s=ml(this.dom,r);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&rM(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),s&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let r=this.dom;r;)if(r.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=t)r.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,SQ),ld&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),ld&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var r;if(!this.delayedAndroidKey){let s=()=>{let n=this.delayedAndroidKey;n&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=n.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&n.force&&Eo(this.dom,n.key,n.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,r=-1,s=!1;for(let n of e){let o=this.readMutation(n);o&&(o.typeOver&&(s=!0),t==-1?{from:t,to:r}=o:(t=Math.min(o.from,t),r=Math.max(o.to,r)))}return{from:t,to:r,typeOver:s}}readChange(){let{from:e,to:t,typeOver:r}=this.processRecords(),s=this.selectionChanged&&ml(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let n=new FM(this.view,e,t,r);return this.view.docView.domChanged={newSel:n.newSel?n.newSel.main:null},n}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let r=this.view.state,s=Db(this.view,t);return this.view.state==r&&(t.domChanged||t.newSel&&!qh(this.view.state.selection,t.newSel.main))&&this.view.update([]),s}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let r=qv(t,e.previousSibling||e.target.previousSibling,-1),s=qv(t,e.nextSibling||e.target.nextSibling,1);return{from:r?t.posAfter(r):t.posAtStart,to:s?t.posBefore(s):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Qs)!=e.state.facet(Qs)&&(e.view.contentDOM.editContext=e.state.facet(Qs)?this.editContext.editContext:null))}destroy(){var e,t,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function qv(i,e,t){for(;e;){let r=Vt.get(e);if(r&&r.parent==i)return r;let s=e.parentNode;e=s!=i.dom?s:t>0?e.nextSibling:e.previousSibling}return null}function Hv(i,e){let t=e.startContainer,r=e.startOffset,s=e.endContainer,n=e.endOffset,o=i.docView.domAtPos(i.state.selection.main.anchor,1);return gl(o.node,o.offset,s,n)&&([t,r,s,n]=[s,n,t,r]),{anchorNode:t,anchorOffset:r,focusNode:s,focusOffset:n}}function CQ(i,e){if(e.getComposedRanges){let s=e.getComposedRanges(i.root)[0];if(s)return Hv(i,s)}let t=null;function r(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}return i.contentDOM.addEventListener("beforeinput",r,!0),i.dom.ownerDocument.execCommand("indent"),i.contentDOM.removeEventListener("beforeinput",r,!0),t?Hv(i,t):null}class $Q{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let s=e.state.selection.main,{anchor:n,head:o}=s,a=this.toEditorPos(r.updateRangeStart),l=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:a,drifted:!1});let c=l-a>r.text.length;a==this.from&&n<this.from?a=n:l==this.to&&n>this.to&&(l=n);let h=Ib(e.state.sliceDoc(a,l),r.text,(c?s.from:s.to)-a,c?"end":null);if(!h){let d=ue.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));qh(d,s)||e.dispatch({selection:d,userEvent:"select"});return}let u={from:h.from+a,to:h.toA+a,insert:ct.of(r.text.slice(h.from,h.toB).split(`
19
+ `))};if((Re.mac||Re.android)&&u.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(u={from:a,to:l,insert:ct.of([r.text.replace("."," ")])}),this.pendingContextChange=u,!e.state.readOnly){let d=this.to-this.from+(u.to-u.from+u.insert.length);Wm(e,u,ue.single(this.toEditorPos(r.selectionStart,d),this.toEditorPos(r.selectionEnd,d)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),u.from<u.to&&!u.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(t.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let s=[],n=null;for(let o=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.rangeEnd);o<a;o++){let l=e.coordsForChar(o);n=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||n||new DOMRect,s.push(n)}t.updateCharacterBounds(r.rangeStart,s)},this.handlers.textformatupdate=r=>{let s=[];for(let n of r.getTextFormats()){let o=n.underlineStyle,a=n.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(n.rangeStart),c=this.toEditorPos(n.rangeEnd);if(l<c){let h=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;s.push(ze.mark({attributes:{style:h}}).range(l,c))}}}e.dispatch({effects:Pb.of(ze.set(s))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)t.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let s=$l(r.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,r=!1,s=this.pendingContextChange;return e.changes.iterChanges((n,o,a,l,c)=>{if(r)return;let h=c.length-(o-n);if(s&&o>=s.to)if(s.from==n&&s.to==o&&s.insert.eq(c)){s=this.pendingContextChange=null,t+=h,this.to+=h;return}else s=null,this.revertPending(e.state);if(n+=t,o+=t,o<=this.from)this.from+=h,this.to+=h;else if(n<this.to){if(n<this.from||o>this.to||this.to-this.from+c.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(n),this.toContextPos(o),c.toString()),this.to+=h}t+=h}),s&&!r&&this.revertPending(e.state),!r}update(e){let t=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),s=this.toContextPos(t.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(r,s)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class Pe{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(s=>s.forEach(n=>r(n,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||iM(e.parent)||document,this.viewState=new Xv(e.state||st.create(e)),e.scrollTo&&e.scrollTo.is(Tc)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet($o).map(s=>new id(s));for(let s of this.plugins)s.update(this);this.observer=new kQ(this),this.inputState=new UM(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Mv(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof Ft?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,r=!1,s,n=this.state;for(let d of e){if(d.startState!=n)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");n=d.state}if(this.destroyed){this.viewState.state=n;return}let o=this.hasFocus,a=0,l=null;e.some(d=>d.annotation(Fb))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=Vb(n,o),l||(a=1));let c=this.observer.delayedAndroidKey,h=null;if(c?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(n.doc)||!this.state.selection.eq(n.selection))&&(h=null)):this.observer.clear(),n.facet(st.phrases)!=this.state.facet(st.phrases))return this.setState(n);s=Xh.create(this,n,e),s.flags|=a;let u=this.viewState.scrollTarget;try{this.updateState=2;for(let d of e){if(u&&(u=u.map(d.changes)),d.scrollIntoView){let{main:f}=d.state.selection;u=new Do(f.empty?f:ue.cursor(f.head,f.head>f.anchor?-1:1))}for(let f of d.effects)f.is(Tc)&&(u=f.value.clip(this.state))}this.viewState.update(s,u),this.bidiCache=Uh.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),t=this.docView.update(s),this.state.facet(el)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(d=>d.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Lc)!=s.state.facet(Lc)&&(this.viewState.mustMeasureContent=!0),(t||r||u||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!s.empty)for(let d of this.state.facet(Yf))try{d(s)}catch(f){qi(this.state,f,"update listener")}(l||h)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),h&&!Db(this,h)&&c.force&&Eo(this.contentDOM,c.key,c.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new Xv(e),this.plugins=e.facet($o).map(r=>new id(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new Mv(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet($o),r=e.state.facet($o);if(t!=r){let s=[];for(let n of r){let o=t.indexOf(n);if(o<0)s.push(new id(n));else{let a=this.plugins[o];a.mustUpdate=e,s.push(a)}}for(let n of this.plugins)n.mustUpdate!=e&&n.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s<this.plugins.length;s++)this.plugins[s].update(this);t!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(r){qi(this.state,r,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,r=this.scrollDOM,s=r.scrollTop*this.scaleY,{scrollAnchorPos:n,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(ub(r))n=-1,o=this.viewState.heightMap.height;else{let f=this.viewState.scrollAnchorAt(s);n=f.from,o=f.top}this.updateState=1;let l=this.viewState.measure(this);if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];l&4||([this.measureRequests,c]=[c,this.measureRequests]);let h=c.map(f=>{try{return f.read(this)}catch(p){return qi(this.state,p),Uv}}),u=Xh.create(this,this.state,[]),d=!1;u.flags|=l,t?t.flags|=l:t=u,this.updateState=2,u.empty||(this.updatePlugins(u),this.inputState.update(u),this.updateAttrs(),d=this.docView.update(u),d&&this.docViewUpdate());for(let f=0;f<c.length;f++)if(h[f]!=Uv)try{let p=c[f];p.write&&p.write(h[f],this)}catch(p){qi(this.state,p)}if(d&&this.docView.updateSelection(!0),!u.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let p=(n<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(n).top)-o;if(p>1||p<-1){s=s+p,r.scrollTop=s/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let a of this.state.facet(Yf))a(t)}get themeClasses(){return tp+" "+(this.state.facet(ep)?Yb:Ub)+" "+this.state.facet(Lc)}updateAttrs(){let e=Yv(this,Tb,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Qs)?"true":"false",class:"cm-content",style:`${Re.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Yv(this,Im,t);let r=this.observer.ignore(()=>{let s=Sv(this.contentDOM,this.contentAttrs,t),n=Sv(this.dom,this.editorAttrs,e);return s||n});return this.editorAttrs=e,this.contentAttrs=t,r}showAnnouncements(e){let t=!0;for(let r of e)for(let s of r.effects)if(s.is(Pe.announce)){t&&(this.announceDOM.textContent=""),t=!1;let n=this.announceDOM.appendChild(document.createElement("div"));n.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(el);let e=this.state.facet(Pe.cspNonce);_n.mount(this.root,this.styleModules.concat(wQ).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(r=>r.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,r){return od(this,e,Qv(this,e,t,r))}moveByGroup(e,t){return od(this,e,Qv(this,e,t,r=>IM(this,e.head,r)))}visualLineSide(e,t){let r=this.bidiSpans(e),s=this.textDirectionAt(e.from),n=r[t?r.length-1:0];return ue.cursor(n.side(t,s)+e.from,n.forward(!t,s)?1:-1)}moveToLineBoundary(e,t,r=!0){return DM(this,e,t,r)}moveVertically(e,t,r){return od(this,e,zM(this,e,t,r))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let r=Kf(this,e,t);return r&&r.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),Kf(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let r=this.docView.coordsAt(e,t);if(!r||r.left==r.right)return r;let s=this.state.doc.lineAt(e),n=this.bidiSpans(s),o=n[ts.find(n,e-s.from,-1,t)];return Zh(r,o.dir==_t.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(kb)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>PQ)return vb(e.length);let t=this.textDirectionAt(e.from),r;for(let n of this.bidiCache)if(n.from==e.from&&n.dir==t&&(n.fresh||gb(n.isolates,r=$v(this,e))))return n.order;r||(r=$v(this,e));let s=hM(e.text,t,r);return this.bidiCache.push(new Uh(e.from,e.to,t,r,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Re.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{hb(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Tc.of(new Do(typeof e=="number"?ue.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return Tc.of(new Do(ue.cursor(r.from),"start","start",r.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return It.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return It.define(()=>({}),{eventObservers:e})}static theme(e,t){let r=_n.newName(),s=[Lc.of(r),el.of(ip(`.${r}`,e))];return t&&t.dark&&s.push(ep.of(!0)),s}static baseTheme(e){return Ns.lowest(el.of(ip("."+tp,e,jb)))}static findFromDOM(e){var t;let r=e.querySelector(".cm-content"),s=r&&Vt.get(r)||Vt.get(e);return((t=s?.root)===null||t===void 0?void 0:t.view)||null}}Pe.styleModule=el;Pe.inputHandler=wb;Pe.clipboardInputFilter=Em;Pe.clipboardOutputFilter=Dm;Pe.scrollHandler=$b;Pe.focusChangeEffect=Sb;Pe.perLineTextDirection=kb;Pe.exceptionSink=xb;Pe.updateListener=Yf;Pe.editable=Qs;Pe.mouseSelectionStyle=yb;Pe.dragMovesSelection=bb;Pe.clickAddsSelectionRange=_b;Pe.decorations=Bu;Pe.blockWrappers=Mb;Pe.outerDecorations=zm;Pe.atomicRanges=ic;Pe.bidiIsolatedRanges=Qb;Pe.scrollMargins=Ab;Pe.darkTheme=ep;Pe.cspNonce=Ae.define({combine:i=>i.length?i[0]:""});Pe.contentAttributes=Im;Pe.editorAttributes=Tb;Pe.lineWrapping=Pe.contentAttributes.of({class:"cm-lineWrapping"});Pe.announce=He.define();const PQ=4096,Uv={};class Uh{constructor(e,t,r,s,n,o){this.from=e,this.to=t,this.dir=r,this.isolates=s,this.fresh=n,this.order=o}static update(e,t){if(t.empty&&!e.some(n=>n.fresh))return e;let r=[],s=e.length?e[e.length-1].dir:_t.LTR;for(let n=Math.max(0,e.length-10);n<e.length;n++){let o=e[n];o.dir==s&&!t.touchesRange(o.from,o.to)&&r.push(new Uh(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function Yv(i,e,t){for(let r=i.state.facet(e),s=r.length-1;s>=0;s--){let n=r[s],o=typeof n=="function"?n(i):n;o&&Rm(o,t)}return t}const TQ=Re.mac?"mac":Re.windows?"win":Re.linux?"linux":"key";function MQ(i,e){const t=i.split(/-(?!$)/);let r=t[t.length-1];r=="Space"&&(r=" ");let s,n,o,a;for(let l=0;l<t.length-1;++l){const c=t[l];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))s=!0;else if(/^(c|ctrl|control)$/i.test(c))n=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))e=="mac"?a=!0:n=!0;else throw new Error("Unrecognized modifier name: "+c)}return s&&(r="Alt-"+r),n&&(r="Ctrl-"+r),a&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function Ec(i,e,t){return e.altKey&&(i="Alt-"+i),e.ctrlKey&&(i="Ctrl-"+i),e.metaKey&&(i="Meta-"+i),t!==!1&&e.shiftKey&&(i="Shift-"+i),i}const QQ=Ns.default(Pe.domEventHandlers({keydown(i,e){return Kb(Gb(e.state),i,e,"editor")}})),rc=Ae.define({enables:QQ}),jv=new WeakMap;function Gb(i){let e=i.facet(rc),t=jv.get(e);return t||jv.set(e,t=BQ(e.reduce((r,s)=>r.concat(s),[]))),t}function AQ(i,e,t){return Kb(Gb(i.state),e,i,t)}let hn=null;const RQ=4e3;function BQ(i,e=TQ){let t=Object.create(null),r=Object.create(null),s=(o,a)=>{let l=r[o];if(l==null)r[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},n=(o,a,l,c,h)=>{var u,d;let f=t[o]||(t[o]=Object.create(null)),p=a.split(/ (?!$)/).map(_=>MQ(_,e));for(let _=1;_<p.length;_++){let k=p.slice(0,_).join(" ");s(k,!0),f[k]||(f[k]={preventDefault:!0,stopPropagation:!1,run:[P=>{let w=hn={view:P,prefix:k,scope:o};return setTimeout(()=>{hn==w&&(hn=null)},RQ),!0}]})}let g=p.join(" ");s(g,!1);let O=f[g]||(f[g]={preventDefault:!1,stopPropagation:!1,run:((d=(u=f._any)===null||u===void 0?void 0:u.run)===null||d===void 0?void 0:d.slice())||[]});l&&O.run.push(l),c&&(O.preventDefault=!0),h&&(O.stopPropagation=!0)};for(let o of i){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let h=t[c]||(t[c]=Object.create(null));h._any||(h._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:u}=o;for(let d in h)h[d].run.push(f=>u(f,rp))}let l=o[e]||o.key;if(l)for(let c of a)n(c,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&n(c,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return t}let rp=null;function Kb(i,e,t,r){rp=e;let s=HT(e),n=Xi(s,0),o=Jr(n)==s.length&&s!=" ",a="",l=!1,c=!1,h=!1;hn&&hn.view==t&&hn.scope==r&&(a=hn.prefix+" ",Nb.indexOf(e.keyCode)<0&&(c=!0,hn=null));let u=new Set,d=O=>{if(O){for(let _ of O.run)if(!u.has(_)&&(u.add(_),_(t)))return O.stopPropagation&&(h=!0),!0;O.preventDefault&&(O.stopPropagation&&(h=!0),c=!0)}return!1},f=i[r],p,g;return f&&(d(f[a+Ec(s,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Re.windows&&e.ctrlKey&&e.altKey)&&!(Re.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(p=bn[e.keyCode])&&p!=s?(d(f[a+Ec(p,e,!0)])||e.shiftKey&&(g=kl[e.keyCode])!=s&&g!=p&&d(f[a+Ec(g,e,!1)]))&&(l=!0):o&&e.shiftKey&&d(f[a+Ec(s,e,!0)])&&(l=!0),!l&&d(f._any)&&(l=!0)),c&&(l=!0),l&&h&&e.stopPropagation(),rp=null,l}class sc{constructor(e,t,r,s,n){this.className=e,this.left=t,this.top=r,this.width=s,this.height=n}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,r){if(r.empty){let s=e.coordsAtPos(r.head,r.assoc||1);if(!s)return[];let n=Jb(e);return[new sc(t,s.left-n.left,s.top-n.top,null,s.bottom-s.top)]}else return LQ(e,t,r)}}function Jb(i){let e=i.scrollDOM.getBoundingClientRect();return{left:(i.textDirection==_t.LTR?e.left:e.right-i.scrollDOM.clientWidth*i.scaleX)-i.scrollDOM.scrollLeft*i.scaleX,top:e.top-i.scrollDOM.scrollTop*i.scaleY}}function Gv(i,e,t,r){let s=i.coordsAtPos(e,t*2);if(!s)return r;let n=i.dom.getBoundingClientRect(),o=(s.top+s.bottom)/2,a=i.posAtCoords({x:n.left+1,y:o}),l=i.posAtCoords({x:n.right-1,y:o});return a==null||l==null?r:{from:Math.max(r.from,Math.min(a,l)),to:Math.min(r.to,Math.max(a,l))}}function LQ(i,e,t){if(t.to<=i.viewport.from||t.from>=i.viewport.to)return[];let r=Math.max(t.from,i.viewport.from),s=Math.min(t.to,i.viewport.to),n=i.textDirection==_t.LTR,o=i.contentDOM,a=o.getBoundingClientRect(),l=Jb(i),c=o.querySelector(".cm-line"),h=c&&window.getComputedStyle(c),u=a.left+(h?parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)):0),d=a.right-(h?parseInt(h.paddingRight):0),f=Gf(i,r,1),p=Gf(i,s,-1),g=f.type==yi.Text?f:null,O=p.type==yi.Text?p:null;if(g&&(i.lineWrapping||f.widgetLineBreaks)&&(g=Gv(i,r,1,g)),O&&(i.lineWrapping||p.widgetLineBreaks)&&(O=Gv(i,s,-1,O)),g&&O&&g.from==O.from&&g.to==O.to)return k(P(t.from,t.to,g));{let C=g?P(t.from,null,g):w(f,!1),M=O?P(null,t.to,O):w(p,!0),D=[];return(g||f).to<(O||p).from-(g&&O?1:0)||f.widgetLineBreaks>1&&C.bottom+i.defaultLineHeight/2<M.top?D.push(_(u,C.bottom,d,M.top)):C.bottom<M.top&&i.elementAtHeight((C.bottom+M.top)/2).type==yi.Text&&(C.bottom=M.top=(C.bottom+M.top)/2),k(C).concat(D).concat(k(M))}function _(C,M,D,j){return new sc(e,C-l.left,M-l.top,Math.max(0,D-C),j-M)}function k({top:C,bottom:M,horizontal:D}){let j=[];for(let oe=0;oe<D.length;oe+=2)j.push(_(D[oe],C,D[oe+1],M));return j}function P(C,M,D){let j=1e9,oe=-1e9,ae=[];function G(T,$,R,E,Z){let K=i.coordsAtPos(T,T==D.to?-2:2),X=i.coordsAtPos(R,R==D.from?2:-2);!K||!X||(j=Math.min(K.top,X.top,j),oe=Math.max(K.bottom,X.bottom,oe),Z==_t.LTR?ae.push(n&&$?u:K.left,n&&E?d:X.right):ae.push(!n&&E?u:X.left,!n&&$?d:K.right))}let x=C??D.from,b=M??D.to;for(let T of i.visibleRanges)if(T.to>x&&T.from<b)for(let $=Math.max(T.from,x),R=Math.min(T.to,b);;){let E=i.state.doc.lineAt($);for(let Z of i.bidiSpans(E)){let K=Z.from+E.from,X=Z.to+E.from;if(K>=R)break;X>$&&G(Math.max(K,$),C==null&&K<=x,Math.min(X,R),M==null&&X>=b,Z.dir)}if($=E.to+1,$>=R)break}return ae.length==0&&G(x,C==null,b,M==null,i.textDirection),{top:j,bottom:oe,horizontal:ae}}function w(C,M){let D=a.top+(M?C.top:C.bottom);return{top:D,bottom:D,horizontal:[]}}}function EQ(i,e){return i.constructor==e.constructor&&i.eq(e)}class DQ{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(vh)!=e.state.facet(vh)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,r=e.facet(vh);for(;t<r.length&&r[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((t,r)=>!EQ(t,this.drawn[r]))){let t=this.dom.firstChild,r=0;for(let s of e)s.update&&t&&s.constructor&&this.drawn[r].constructor&&s.update(t,this.drawn[r])?(t=t.nextSibling,r++):this.dom.insertBefore(s.draw(),t);for(;t;){let s=t.nextSibling;t.remove(),t=s}this.drawn=e,Re.safari&&Re.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const vh=Ae.define();function ey(i){return[It.define(e=>new DQ(e,i)),vh.of(i)]}const Tl=Ae.define({combine(i){return fs(i,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function IQ(i={}){return[Tl.of(i),zQ,NQ,WQ,Cb.of(!0)]}function ty(i){return i.startState.facet(Tl)!=i.state.facet(Tl)}const zQ=ey({above:!0,markers(i){let{state:e}=i,t=e.facet(Tl),r=[];for(let s of e.selection.ranges){let n=s==e.selection.main;if(s.empty||t.drawRangeCursor){let o=n?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=s.empty?s:ue.cursor(s.head,s.head>s.anchor?-1:1);for(let l of sc.forRange(i,o,a))r.push(l)}}return r},update(i,e){i.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=ty(i);return t&&Kv(i.state,e),i.docChanged||i.selectionSet||t},mount(i,e){Kv(e.state,i)},class:"cm-cursorLayer"});function Kv(i,e){e.style.animationDuration=i.facet(Tl).cursorBlinkRate+"ms"}const NQ=ey({above:!1,markers(i){return i.state.selection.ranges.map(e=>e.empty?[]:sc.forRange(i,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(i,e){return i.docChanged||i.selectionSet||i.viewportChanged||ty(i)},class:"cm-selectionLayer"}),WQ=Ns.highest(Pe.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),iy=He.define({map(i,e){return i==null?null:e.mapPos(i)}}),rl=ui.define({create(){return null},update(i,e){return i!=null&&(i=e.changes.mapPos(i)),e.effects.reduce((t,r)=>r.is(iy)?r.value:t,i)}}),ZQ=It.fromClass(class{constructor(i){this.view=i,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(i){var e;let t=i.state.field(rl);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(i.startState.field(rl)!=t||i.docChanged||i.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:i}=this,e=i.state.field(rl),t=e!=null&&i.coordsAtPos(e);if(!t)return null;let r=i.scrollDOM.getBoundingClientRect();return{left:t.left-r.left+i.scrollDOM.scrollLeft*i.scaleX,top:t.top-r.top+i.scrollDOM.scrollTop*i.scaleY,height:t.bottom-t.top}}drawCursor(i){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;i?(this.cursor.style.left=i.left/e+"px",this.cursor.style.top=i.top/t+"px",this.cursor.style.height=i.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(i){this.view.state.field(rl)!=i&&this.view.dispatch({effects:iy.of(i)})}},{eventObservers:{dragover(i){this.setDropPos(this.view.posAtCoords({x:i.clientX,y:i.clientY}))},dragleave(i){(i.target==this.view.contentDOM||!this.view.contentDOM.contains(i.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function XQ(){return[rl,ZQ]}function Jv(i,e,t,r,s){e.lastIndex=0;for(let n=i.iterRange(t,r),o=t,a;!n.next().done;o+=n.value.length)if(!n.lineBreak)for(;a=e.exec(n.value);)s(o+a.index,a)}function FQ(i,e){let t=i.visibleRanges;if(t.length==1&&t[0].from==i.viewport.from&&t[0].to==i.viewport.to)return t;let r=[];for(let{from:s,to:n}of t)s=Math.max(i.state.doc.lineAt(s).from,s-e),n=Math.min(i.state.doc.lineAt(n).to,n+e),r.length&&r[r.length-1].to>=s?r[r.length-1].to=n:r.push({from:s,to:n});return r}class VQ{constructor(e){const{regexp:t,decoration:r,decorate:s,boundary:n,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,s)this.addMatch=(a,l,c,h)=>s(h,c,c+a[0].length,a,l);else if(typeof r=="function")this.addMatch=(a,l,c,h)=>{let u=r(a,l,c);u&&h(c,c+a[0].length,u)};else if(r)this.addMatch=(a,l,c,h)=>h(c,c+a[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=n,this.maxLength=o}createDeco(e){let t=new Es,r=t.add.bind(t);for(let{from:s,to:n}of FQ(e,this.maxLength))Jv(e.state.doc,this.regexp,s,n,(o,a)=>this.addMatch(a,e,o,r));return t.finish()}updateDeco(e,t){let r=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((n,o,a,l)=>{l>=e.view.viewport.from&&a<=e.view.viewport.to&&(r=Math.min(a,r),s=Math.max(l,s))}),e.viewportMoved||s-r>1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,t.map(e.changes),r,s):t}updateRange(e,t,r,s){for(let n of e.visibleRanges){let o=Math.max(n.from,r),a=Math.min(n.to,s);if(a>=o){let l=e.state.doc.lineAt(o),c=l.to<a?e.state.doc.lineAt(a):l,h=Math.max(n.from,l.from),u=Math.min(n.to,c.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){h=o;break}for(;a<c.to;a++)if(this.boundary.test(c.text[a-c.from])){u=a;break}}let d=[],f,p=(g,O,_)=>d.push(_.range(g,O));if(l==c)for(this.regexp.lastIndex=h-l.from;(f=this.regexp.exec(l.text))&&f.index<u-l.from;)this.addMatch(f,e,f.index+l.from,p);else Jv(e.state.doc,this.regexp,h,u,(g,O)=>this.addMatch(O,e,g,p));t=t.update({filterFrom:h,filterTo:u,filter:(g,O)=>g<h||O>u,add:d})}}return t}}const sp=/x/.unicode!=null?"gu":"g",qQ=new RegExp(`[\0-\b
20
+ --Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,sp),HQ={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let cd=null;function UQ(){var i;if(cd==null&&typeof document<"u"&&document.body){let e=document.body.style;cd=((i=e.tabSize)!==null&&i!==void 0?i:e.MozTabSize)!=null}return cd||!1}const Oh=Ae.define({combine(i){let e=fs(i,{render:null,specialChars:qQ,addSpecialChars:null});return(e.replaceTabs=!UQ())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,sp)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,sp)),e}});function YQ(i={}){return[Oh.of(i),jQ()]}let e0=null;function jQ(){return e0||(e0=It.fromClass(class{constructor(i){this.view=i,this.decorations=ze.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(i.state.facet(Oh)),this.decorations=this.decorator.createDeco(i)}makeDecorator(i){return new VQ({regexp:i.specialChars,decoration:(e,t,r)=>{let{doc:s}=t.state,n=Xi(e[0],0);if(n==9){let o=s.lineAt(r),a=t.state.tabSize,l=Ar(o.text,a,r-o.from);return ze.replace({widget:new e6((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[n]||(this.decorationCache[n]=ze.replace({widget:new JQ(i,n)}))},boundary:i.replaceTabs?void 0:/[^]/})}update(i){let e=i.state.facet(Oh);i.startState.facet(Oh)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(i.view)):this.decorations=this.decorator.updateDeco(i,this.decorations)}},{decorations:i=>i.decorations}))}const GQ="•";function KQ(i){return i>=32?GQ:i==10?"␤":String.fromCharCode(9216+i)}class JQ extends ps{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=KQ(this.code),r=e.state.phrase("Control character")+" "+(HQ[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,r,t);if(s)return s;let n=document.createElement("span");return n.textContent=t,n.title=r,n.setAttribute("aria-label",r),n.className="cm-specialChar",n}ignoreEvent(){return!1}}class e6 extends ps{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function t6(){return r6}const i6=ze.line({class:"cm-activeLine"}),r6=It.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.docChanged||i.selectionSet)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let e=-1,t=[];for(let r of i.state.selection.ranges){let s=i.lineBlockAt(r.head);s.from>e&&(t.push(i6.range(s.from)),e=s.from)}return ze.set(t)}},{decorations:i=>i.decorations}),np=2e3;function s6(i,e,t){let r=Math.min(e.line,t.line),s=Math.max(e.line,t.line),n=[];if(e.off>np||t.off>np||e.col<0||t.col<0){let o=Math.min(e.off,t.off),a=Math.max(e.off,t.off);for(let l=r;l<=s;l++){let c=i.doc.line(l);c.length<=a&&n.push(ue.range(c.from+o,c.to+a))}}else{let o=Math.min(e.col,t.col),a=Math.max(e.col,t.col);for(let l=r;l<=s;l++){let c=i.doc.line(l),h=If(c.text,o,i.tabSize,!0);if(h<0)n.push(ue.cursor(c.to));else{let u=If(c.text,a,i.tabSize);n.push(ue.range(c.from+h,c.from+u))}}}return n}function n6(i,e){let t=i.coordsAtPos(i.viewport.from);return t?Math.round(Math.abs((t.left-e)/i.defaultCharacterWidth)):-1}function t0(i,e){let t=i.posAtCoords({x:e.clientX,y:e.clientY},!1),r=i.state.doc.lineAt(t),s=t-r.from,n=s>np?-1:s==r.length?n6(i,e.clientX):Ar(r.text,i.state.tabSize,t-r.from);return{line:r.number,col:n,off:s}}function o6(i,e){let t=t0(i,e),r=i.state.selection;return t?{update(s){if(s.docChanged){let n=s.changes.mapPos(s.startState.doc.line(t.line).from),o=s.state.doc.lineAt(n);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},r=r.map(s.changes)}},get(s,n,o){let a=t0(i,s);if(!a)return r;let l=s6(i.state,t,a);return l.length?o?ue.create(l.concat(r.ranges)):ue.create(l):r}}:null}function a6(i){let e=(t=>t.altKey&&t.button==0);return Pe.mouseSelectionStyle.of((t,r)=>e(r)?o6(t,r):null)}const l6={Alt:[18,i=>!!i.altKey],Control:[17,i=>!!i.ctrlKey],Shift:[16,i=>!!i.shiftKey],Meta:[91,i=>!!i.metaKey]},c6={style:"cursor: crosshair"};function h6(i={}){let[e,t]=l6[i.key||"Alt"],r=It.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||t(s))},keyup(s){(s.keyCode==e||!t(s))&&this.set(!1)},mousemove(s){this.set(t(s))}}});return[r,Pe.contentAttributes.of(s=>{var n;return!((n=s.plugin(r))===null||n===void 0)&&n.isDown?c6:null})]}const Dc="-10000px";class ry{constructor(e,t,r,s){this.facet=t,this.createTooltipView=r,this.removeTooltipView=s,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let n=null;this.tooltipViews=this.tooltips.map(o=>n=r(o,n))}update(e,t){var r;let s=e.state.facet(this.facet),n=s.filter(l=>l);if(s===this.input){for(let l of this.tooltipViews)l.update&&l.update(e);return!1}let o=[],a=t?[]:null;for(let l=0;l<n.length;l++){let c=n[l],h=-1;if(c){for(let u=0;u<this.tooltips.length;u++){let d=this.tooltips[u];d&&d.create==c.create&&(h=u)}if(h<0)o[l]=this.createTooltipView(c,l?o[l-1]:null),a&&(a[l]=!!c.above);else{let u=o[l]=this.tooltipViews[h];a&&(a[l]=t[h]),u.update&&u.update(e)}}}for(let l of this.tooltipViews)o.indexOf(l)<0&&(this.removeTooltipView(l),(r=l.destroy)===null||r===void 0||r.call(l));return t&&(a.forEach((l,c)=>t[c]=l),t.length=a.length),this.input=s,this.tooltips=n,this.tooltipViews=o,!0}}function u6(i){let e=i.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const hd=Ae.define({combine:i=>{var e,t,r;return{position:Re.ios?"absolute":((e=i.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=i.find(s=>s.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((r=i.find(s=>s.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||u6}}}),i0=new WeakMap,Fm=It.fromClass(class{constructor(i){this.view=i,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=i.state.facet(hd);this.position=e.position,this.parent=e.parent,this.classes=i.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new ry(i,Vm,(t,r)=>this.createTooltip(t,r),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),i.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let i of this.manager.tooltipViews)this.intersectionObserver.observe(i.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(i){i.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(i,this.above);e&&this.observeIntersection();let t=e||i.geometryChanged,r=i.state.facet(hd);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;t=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(i,e){let t=i.create(this.view),r=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),i.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",t.dom.appendChild(s)}return t.dom.style.position=this.position,t.dom.style.top=Dc,t.dom.style.left="0px",this.container.insertBefore(t.dom,r),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var i,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(i=r.destroy)===null||i===void 0||i.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let i=1,e=1,t=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:n}=this.manager.tooltipViews[0];if(Re.safari){let o=n.getBoundingClientRect();t=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else t=!!n.offsetParent&&n.offsetParent!=this.container.ownerDocument.body}if(t||this.position=="absolute")if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(i=n.width/this.parent.offsetWidth,e=n.height/this.parent.offsetHeight)}else({scaleX:i,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),s=Nm(this.view);return{visible:{left:r.left+s.left,top:r.top+s.top,right:r.right-s.right,bottom:r.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((n,o)=>{let a=this.manager.tooltipViews[o];return a.getCoords?a.getCoords(n.pos):this.view.coordsAtPos(n.pos)}),size:this.manager.tooltipViews.map(({dom:n})=>n.getBoundingClientRect()),space:this.view.state.facet(hd).tooltipSpace(this.view),scaleX:i,scaleY:e,makeAbsolute:t}}writeMeasure(i){var e;if(i.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{visible:t,space:r,scaleX:s,scaleY:n}=i,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:h}=c,u=i.pos[a],d=i.size[a];if(!u||l.clip!==!1&&(u.bottom<=Math.max(t.top,r.top)||u.top>=Math.min(t.bottom,r.bottom)||u.right<Math.max(t.left,r.left)-.1||u.left>Math.min(t.right,r.right)+.1)){h.style.top=Dc;continue}let f=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,p=f?7:0,g=d.right-d.left,O=(e=i0.get(c))!==null&&e!==void 0?e:d.bottom-d.top,_=c.offset||f6,k=this.view.textDirection==_t.LTR,P=d.width>r.right-r.left?k?r.left:r.right-d.width:k?Math.max(r.left,Math.min(u.left-(f?14:0)+_.x,r.right-g)):Math.min(Math.max(r.left,u.left-g+(f?14:0)-_.x),r.right-g),w=this.above[a];!l.strictSide&&(w?u.top-O-p-_.y<r.top:u.bottom+O+p+_.y>r.bottom)&&w==r.bottom-u.bottom>u.top-r.top&&(w=this.above[a]=!w);let C=(w?u.top-r.top:r.bottom-u.bottom)-p;if(C<O&&c.resize!==!1){if(C<this.view.defaultLineHeight){h.style.top=Dc;continue}i0.set(c,O),h.style.height=(O=C)/n+"px"}else h.style.height&&(h.style.height="");let M=w?u.top-O-p-_.y:u.bottom+p+_.y,D=P+g;if(c.overlap!==!0)for(let j of o)j.left<D&&j.right>P&&j.top<M+O&&j.bottom>M&&(M=w?j.top-O-2-p:j.bottom+p+2);if(this.position=="absolute"?(h.style.top=(M-i.parent.top)/n+"px",r0(h,(P-i.parent.left)/s)):(h.style.top=M/n+"px",r0(h,P/s)),f){let j=u.left+(k?_.x:-_.x)-(P+14-7);f.style.left=j/s+"px"}c.overlap!==!0&&o.push({left:P,top:M,right:D,bottom:M+O}),h.classList.toggle("cm-tooltip-above",w),h.classList.toggle("cm-tooltip-below",!w),c.positioned&&c.positioned(i.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let i of this.manager.tooltipViews)i.dom.style.top=Dc}},{eventObservers:{scroll(){this.maybeMeasure()}}});function r0(i,e){let t=parseInt(i.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(i.style.left=e+"px")}const d6=Pe.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),f6={x:0,y:0},Vm=Ae.define({enables:[Fm,d6]}),Yh=Ae.define({combine:i=>i.reduce((e,t)=>e.concat(t),[])});class Iu{static create(e){return new Iu(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new ry(e,Yh,(t,r)=>this.createHostedView(t,r),t=>t.dom.remove())}createHostedView(e,t){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let r of this.manager.tooltipViews){let s=r[e];if(s!==void 0){if(t===void 0)t=s;else if(t!==s)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const p6=Vm.compute([Yh],i=>{let e=i.facet(Yh);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var r;return(r=t.end)!==null&&r!==void 0?r:t.pos})),create:Iu.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class m6{constructor(e,t,r,s,n){this.view=e,this.source=t,this.field=r,this.setHover=s,this.hoverTime=n,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,r=e.docView.tile.nearest(t.target);if(!r)return;let s,n=1;if(r.isWidget())s=r.posAtStart;else{if(s=e.posAtCoords(t),s==null)return;let a=e.coordsAtPos(s);if(!a||t.y<a.top||t.y>a.bottom||t.x<a.left-e.defaultCharacterWidth||t.x>a.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(s)).find(h=>h.from<=s&&h.to>=s),c=l&&l.dir==_t.RTL?-1:1;n=t.x<a.left?-c:c}let o=this.source(e,s,n);if(o?.then){let a=this.pending={pos:s};o.then(l=>{this.pending==a&&(this.pending=null,l&&!(Array.isArray(l)&&!l.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(l)?l:[l])}))},l=>qi(e.state,l,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(Fm),t=e?e.manager.tooltips.findIndex(r=>r.create==Iu.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:n}=this;if(s.length&&n&&!g6(n.dom,e)||this.pending){let{pos:o}=s[0]||this.pending,a=(r=(t=s[0])===null||t===void 0?void 0:t.end)!==null&&r!==void 0?r:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!v6(this.view,o,a,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=r=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Ic=4;function g6(i,e){let{left:t,right:r,top:s,bottom:n}=i.getBoundingClientRect(),o;if(o=i.querySelector(".cm-tooltip-arrow")){let a=o.getBoundingClientRect();s=Math.min(a.top,s),n=Math.max(a.bottom,n)}return e.clientX>=t-Ic&&e.clientX<=r+Ic&&e.clientY>=s-Ic&&e.clientY<=n+Ic}function v6(i,e,t,r,s,n){let o=i.scrollDOM.getBoundingClientRect(),a=i.documentTop+i.documentPadding.top+i.contentHeight;if(o.left>r||o.right<r||o.top>s||Math.min(o.bottom,a)<s)return!1;let l=i.posAtCoords({x:r,y:s},!1);return l>=e&&l<=t}function O6(i,e={}){let t=He.define(),r=ui.define({create(){return[]},update(s,n){if(s.length&&(e.hideOnChange&&(n.docChanged||n.selection)?s=[]:e.hideOn&&(s=s.filter(o=>!e.hideOn(n,o))),n.docChanged)){let o=[];for(let a of s){let l=n.changes.mapPos(a.pos,-1,vi.TrackDel);if(l!=null){let c=Object.assign(Object.create(null),a);c.pos=l,c.end!=null&&(c.end=n.changes.mapPos(c.end)),o.push(c)}}s=o}for(let o of n.effects)o.is(t)&&(s=o.value),o.is(_6)&&(s=[]);return s},provide:s=>Yh.from(s)});return{active:r,extension:[r,It.define(s=>new m6(s,i,r,t,e.hoverTime||300)),p6]}}function sy(i,e){let t=i.plugin(Fm);if(!t)return null;let r=t.manager.tooltips.indexOf(e);return r<0?null:t.manager.tooltipViews[r]}const _6=He.define(),s0=Ae.define({combine(i){let e,t;for(let r of i)e=e||r.topContainer,t=t||r.bottomContainer;return{topContainer:e,bottomContainer:t}}});function qm(i,e){let t=i.plugin(ny),r=t?t.specs.indexOf(e):-1;return r>-1?t.panels[r]:null}const ny=It.fromClass(class{constructor(i){this.input=i.state.facet(Ml),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(i));let e=i.state.facet(s0);this.top=new zc(i,!0,e.topContainer),this.bottom=new zc(i,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(i){let e=i.state.facet(s0);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new zc(i.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new zc(i.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=i.state.facet(Ml);if(t!=this.input){let r=t.filter(l=>l),s=[],n=[],o=[],a=[];for(let l of r){let c=this.specs.indexOf(l),h;c<0?(h=l(i.view),a.push(h)):(h=this.panels[c],h.update&&h.update(i)),s.push(h),(h.top?n:o).push(h)}this.specs=r,this.panels=s,this.top.sync(n),this.bottom.sync(o);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let r of this.panels)r.update&&r.update(i)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:i=>Pe.scrollMargins.of(e=>{let t=e.plugin(i);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class zc{constructor(e,t,r){this.view=e,this.top=t,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=n0(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=n0(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function n0(i){let e=i.nextSibling;return i.remove(),e}const Ml=Ae.define({enables:ny});function b6(i,e){let t,r=new Promise(o=>t=o),s=o=>y6(o,e,t);i.state.field(ud,!1)?i.dispatch({effects:oy.of(s)}):i.dispatch({effects:He.appendConfig.of(ud.init(()=>[s]))});let n=ay.of(s);return{close:n,result:r.then(o=>((i.win.queueMicrotask||(l=>i.win.setTimeout(l,10)))(()=>{i.state.field(ud).indexOf(s)>-1&&i.dispatch({effects:n})}),o))}}const ud=ui.define({create(){return[]},update(i,e){for(let t of e.effects)t.is(oy)?i=[t.value].concat(i):t.is(ay)&&(i=i.filter(r=>r!=t.value));return i},provide:i=>Ml.computeN([i],e=>e.field(i))}),oy=He.define(),ay=He.define();function y6(i,e,t){let r=e.content?e.content(i,()=>o(null)):null;if(!r){if(r=mt("form"),e.input){let a=mt("input",e.input);/^(text|password|number|email|tel|url)$/.test(a.type)&&a.classList.add("cm-textfield"),a.name||(a.name="input"),r.appendChild(mt("label",(e.label||"")+": ",a))}else r.appendChild(document.createTextNode(e.label||""));r.appendChild(document.createTextNode(" ")),r.appendChild(mt("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let s=r.nodeName=="FORM"?[r]:r.querySelectorAll("form");for(let a=0;a<s.length;a++){let l=s[a];l.addEventListener("keydown",c=>{c.keyCode==27?(c.preventDefault(),o(null)):c.keyCode==13&&(c.preventDefault(),o(l))}),l.addEventListener("submit",c=>{c.preventDefault(),o(l)})}let n=mt("div",r,mt("button",{onclick:()=>o(null),"aria-label":i.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(n.className=e.class),n.classList.add("cm-dialog");function o(a){n.contains(n.ownerDocument.activeElement)&&i.focus(),t(a)}return{dom:n,top:e.top,mount:()=>{if(e.focus){let a;typeof e.focus=="string"?a=r.querySelector(e.focus):a=r.querySelector("input")||r.querySelector("button"),a&&"select"in a?a.select():a&&"focus"in a&&a.focus()}}}}class Is extends On{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Is.prototype.elementClass="";Is.prototype.toDOM=void 0;Is.prototype.mapMode=vi.TrackBefore;Is.prototype.startSide=Is.prototype.endSide=-1;Is.prototype.point=!0;const _h=Ae.define(),x6=Ae.define(),w6={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>it.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Ol=Ae.define();function S6(i){return[ly(),Ol.of({...w6,...i})]}const o0=Ae.define({combine:i=>i.some(e=>e)});function ly(i){return[k6]}const k6=It.fromClass(class{constructor(i){this.view=i,this.domAfter=null,this.prevViewport=i.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=i.state.facet(Ol).map(e=>new l0(i,e)),this.fixed=!i.state.facet(o0);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),i.scrollDOM.insertBefore(this.dom,i.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(i){if(this.updateGutters(i)){let e=this.prevViewport,t=i.view.viewport,r=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(r<(t.to-t.from)*.8)}if(i.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(o0)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=i.view.viewport}syncGutters(i){let e=this.dom.nextSibling;i&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=it.iter(this.view.state.facet(_h),this.view.viewport.from),r=[],s=this.gutters.map(n=>new C6(n,this.view.viewport,-this.view.documentPadding.top));for(let n of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(n.type)){let o=!0;for(let a of n.type)if(a.type==yi.Text&&o){op(t,r,a.from);for(let l of s)l.line(this.view,a,r);o=!1}else if(a.widget)for(let l of s)l.widget(this.view,a)}else if(n.type==yi.Text){op(t,r,n.from);for(let o of s)o.line(this.view,n,r)}else if(n.widget)for(let o of s)o.widget(this.view,n);for(let n of s)n.finish();i&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(i){let e=i.startState.facet(Ol),t=i.state.facet(Ol),r=i.docChanged||i.heightChanged||i.viewportChanged||!it.eq(i.startState.facet(_h),i.state.facet(_h),i.view.viewport.from,i.view.viewport.to);if(e==t)for(let s of this.gutters)s.update(i)&&(r=!0);else{r=!0;let s=[];for(let n of t){let o=e.indexOf(n);o<0?s.push(new l0(this.view,n)):(this.gutters[o].update(i),s.push(this.gutters[o]))}for(let n of this.gutters)n.dom.remove(),s.indexOf(n)<0&&n.destroy();for(let n of s)n.config.side=="after"?this.getDOMAfter().appendChild(n.dom):this.dom.appendChild(n.dom);this.gutters=s}return r}destroy(){for(let i of this.gutters)i.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:i=>Pe.scrollMargins.of(e=>{let t=e.plugin(i);if(!t||t.gutters.length==0||!t.fixed)return null;let r=t.dom.offsetWidth*e.scaleX,s=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==_t.LTR?{left:r,right:s}:{right:r,left:s}})});function a0(i){return Array.isArray(i)?i:[i]}function op(i,e,t){for(;i.value&&i.from<=t;)i.from==t&&e.push(i.value),i.next()}class C6{constructor(e,t,r){this.gutter=e,this.height=r,this.i=0,this.cursor=it.iter(e.markers,t.from)}addElement(e,t,r){let{gutter:s}=this,n=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==s.elements.length){let a=new cy(e,o,n,r);s.elements.push(a),s.dom.appendChild(a.dom)}else s.elements[this.i].update(e,o,n,r);this.height=t.bottom,this.i++}line(e,t,r){let s=[];op(this.cursor,s,t.from),r.length&&(s=s.concat(r));let n=this.gutter.config.lineMarker(e,t,s);n&&s.unshift(n);let o=this.gutter;s.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,s)}widget(e,t){let r=this.gutter.config.widgetMarker(e,t.widget,t),s=r?[r]:null;for(let n of e.state.facet(x6)){let o=n(e,t.widget,t);o&&(s||(s=[])).push(o)}s&&this.addElement(e,t,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class l0{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in t.domEventHandlers)this.dom.addEventListener(r,s=>{let n=s.target,o;if(n!=this.dom&&this.dom.contains(n)){for(;n.parentNode!=this.dom;)n=n.parentNode;let l=n.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=s.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[r](e,a,s)&&s.preventDefault()});this.markers=a0(t.markers(e)),t.initialSpacer&&(this.spacer=new cy(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=a0(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let r=e.view.viewport;return!it.eq(this.markers,t,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class cy{constructor(e,t,r,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,r,s)}update(e,t,r,s){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),$6(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,t){let r="cm-gutterElement",s=this.dom.firstChild;for(let n=0,o=0;;){let a=o,l=n<t.length?t[n++]:null,c=!1;if(l){let h=l.elementClass;h&&(r+=" "+h);for(let u=o;u<this.markers.length;u++)if(this.markers[u].compare(l)){a=u,c=!0;break}}else a=this.markers.length;for(;o<a;){let h=this.markers[o++];if(h.toDOM){h.destroy(s);let u=s.nextSibling;s.remove(),s=u}}if(!l)break;l.toDOM&&(c?s=s.nextSibling:this.dom.insertBefore(l.toDOM(e),s)),c&&o++}this.dom.className=r,this.markers=t}destroy(){this.setMarkers(null,[])}}function $6(i,e){if(i.length!=e.length)return!1;for(let t=0;t<i.length;t++)if(!i[t].compare(e[t]))return!1;return!0}const P6=Ae.define(),T6=Ae.define(),Po=Ae.define({combine(i){return fs(i,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let r=Object.assign({},e);for(let s in t){let n=r[s],o=t[s];r[s]=n?(a,l,c)=>n(a,l,c)||o(a,l,c):o}return r}})}});class dd extends Is{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function fd(i,e){return i.state.facet(Po).formatNumber(e,i.state)}const M6=Ol.compute([Po],i=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(P6)},lineMarker(e,t,r){return r.some(s=>s.toDOM)?null:new dd(fd(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,r)=>{for(let s of e.state.facet(T6)){let n=s(e,t,r);if(n)return n}return null},lineMarkerChange:e=>e.startState.facet(Po)!=e.state.facet(Po),initialSpacer(e){return new dd(fd(e,c0(e.state.doc.lines)))},updateSpacer(e,t){let r=fd(t.view,c0(t.view.state.doc.lines));return r==e.number?e:new dd(r)},domEventHandlers:i.facet(Po).domEventHandlers,side:"before"}));function Q6(i={}){return[Po.of(i),ly(),M6]}function c0(i){let e=9;for(;e<i;)e=e*10+9;return e}const A6=new class extends Is{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},R6=_h.compute(["selection"],i=>{let e=[],t=-1;for(let r of i.selection.ranges){let s=i.doc.lineAt(r.head).from;s>t&&(t=s,e.push(A6.range(s)))}return it.of(e)});function B6(){return R6}const hy=1024;let L6=0;class Or{constructor(e,t){this.from=e,this.to=t}}class Ue{constructor(e={}){this.id=L6++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Gt.match(e)),t=>{let r=e(t);return r===void 0?null:[this,r]}}}Ue.closedBy=new Ue({deserialize:i=>i.split(" ")});Ue.openedBy=new Ue({deserialize:i=>i.split(" ")});Ue.group=new Ue({deserialize:i=>i.split(" ")});Ue.isolate=new Ue({deserialize:i=>{if(i&&i!="rtl"&&i!="ltr"&&i!="auto")throw new RangeError("Invalid value for isolate: "+i);return i||"auto"}});Ue.contextHash=new Ue({perNode:!0});Ue.lookAhead=new Ue({perNode:!0});Ue.mounted=new Ue({perNode:!0});class Io{constructor(e,t,r,s=!1){this.tree=e,this.overlay=t,this.parser=r,this.bracketed=s}static get(e){return e&&e.props&&e.props[Ue.mounted.id]}}const E6=Object.create(null);class Gt{constructor(e,t,r,s=0){this.name=e,this.props=t,this.id=r,this.flags=s}static define(e){let t=e.props&&e.props.length?Object.create(null):E6,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new Gt(e.name||"",t,e.id,r);if(e.props){for(let n of e.props)if(Array.isArray(n)||(n=n(s)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[n[0].id]=n[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(Ue.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let r in e)for(let s of r.split(" "))t[s]=e[r];return r=>{for(let s=r.prop(Ue.group),n=-1;n<(s?s.length:0);n++){let o=t[n<0?r.name:s[n]];if(o)return o}}}}Gt.none=new Gt("",Object.create(null),0,8);class nc{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let r of this.types){let s=null;for(let n of e){let o=n(r);if(o){s||(s=Object.assign({},r.props));let a=o[1],l=o[0];l.combine&&l.id in s&&(a=l.combine(s[l.id],a)),s[l.id]=a}}t.push(s?new Gt(r.name,s,r.id,r.flags):r)}return new nc(t)}}const Nc=new WeakMap,h0=new WeakMap;var dt;(function(i){i[i.ExcludeBuffers=1]="ExcludeBuffers",i[i.IncludeAnonymous=2]="IncludeAnonymous",i[i.IgnoreMounts=4]="IgnoreMounts",i[i.IgnoreOverlays=8]="IgnoreOverlays",i[i.EnterBracketed=16]="EnterBracketed"})(dt||(dt={}));class ht{constructor(e,t,r,s,n){if(this.type=e,this.children=t,this.positions=r,this.length=s,this.props=null,n&&n.length){this.props=Object.create(null);for(let[o,a]of n)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=Io.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let r of this.children){let s=r.toString();s&&(t&&(t+=","),t+=s)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new jh(this.topNode,e)}cursorAt(e,t=0,r=0){let s=Nc.get(this)||this.topNode,n=new jh(s);return n.moveTo(e,t),Nc.set(this,n._tree),n}get topNode(){return new Pi(this,0,0,null)}resolve(e,t=0){let r=Ql(Nc.get(this)||this.topNode,e,t,!1);return Nc.set(this,r),r}resolveInner(e,t=0){let r=Ql(h0.get(this)||this.topNode,e,t,!0);return h0.set(this,r),r}resolveStack(e,t=0){return z6(this,e,t)}iterate(e){let{enter:t,leave:r,from:s=0,to:n=this.length}=e,o=e.mode||0,a=(o&dt.IncludeAnonymous)>0;for(let l=this.cursor(o|dt.IncludeAnonymous);;){let c=!1;if(l.from<=n&&l.to>=s&&(!a&&l.type.isAnonymous||t(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(a||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Ym(Gt.none,this.children,this.positions,0,this.children.length,0,this.length,(t,r,s)=>new ht(this.type,t,r,s,this.propValues),e.makeTree||((t,r,s)=>new ht(Gt.none,t,r,s)))}static build(e){return N6(e)}}ht.empty=new ht(Gt.none,[],[],0);class Hm{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Hm(this.buffer,this.index)}}class xn{constructor(e,t,r){this.buffer=e,this.length=t,this.set=r}get type(){return Gt.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],r=this.buffer[e+3],s=this.set.types[t],n=s.name;if(/\W/.test(n)&&!s.isError&&(n=JSON.stringify(n)),e+=4,r==e)return n;let o=[];for(;e<r;)o.push(this.childString(e)),e=this.buffer[e+3];return n+"("+o.join(",")+")"}findChild(e,t,r,s,n){let{buffer:o}=this,a=-1;for(let l=e;l!=t&&!(uy(n,s,o[l+1],o[l+2])&&(a=l,r>0));l=o[l+3]);return a}slice(e,t,r){let s=this.buffer,n=new Uint16Array(t-e),o=0;for(let a=e,l=0;a<t;){n[l++]=s[a++],n[l++]=s[a++]-r;let c=n[l++]=s[a++]-r;n[l++]=s[a++]-e,o=Math.max(o,c)}return new xn(n,o,this.set)}}function uy(i,e,t,r){switch(i){case-2:return t<e;case-1:return r>=e&&t<e;case 0:return t<e&&r>e;case 1:return t<=e&&r>e;case 2:return r>e;case 4:return!0}}function Ql(i,e,t,r){for(var s;i.from==i.to||(t<1?i.from>=e:i.from>e)||(t>-1?i.to<=e:i.to<e);){let o=!r&&i instanceof Pi&&i.index<0?null:i.parent;if(!o)return i;i=o}let n=r?0:dt.IgnoreOverlays;if(r)for(let o=i,a=o.parent;a;o=a,a=o.parent)o instanceof Pi&&o.index<0&&((s=a.enter(e,t,n))===null||s===void 0?void 0:s.from)!=o.from&&(i=a);for(;;){let o=i.enter(e,t,n);if(!o)return i;i=o}}class dy{cursor(e=0){return new jh(this,e)}getChild(e,t=null,r=null){let s=u0(this,e,t,r);return s.length?s[0]:null}getChildren(e,t=null,r=null){return u0(this,e,t,r)}resolve(e,t=0){return Ql(this,e,t,!1)}resolveInner(e,t=0){return Ql(this,e,t,!0)}matchContext(e){return ap(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),r=this;for(;t;){let s=t.lastChild;if(!s||s.to!=t.to)break;s.type.isError&&s.from==s.to?(r=t,t=s.prevSibling):t=s}return r}get node(){return this}get next(){return this.parent}}class Pi extends dy{constructor(e,t,r,s){super(),this._tree=e,this.from=t,this.index=r,this._parent=s}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,r,s,n=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,c=t>0?a.length:-1;e!=c;e+=t){let h=a[e],u=l[e]+o.from,d;if(!(!(n&dt.EnterBracketed&&h instanceof ht&&(d=Io.get(h))&&!d.overlay&&d.bracketed&&r>=u&&r<=u+h.length)&&!uy(s,r,u,u+h.length))){if(h instanceof xn){if(n&dt.ExcludeBuffers)continue;let f=h.findChild(0,h.buffer.length,t,r-u,s);if(f>-1)return new is(new D6(o,h,e,u),null,f)}else if(n&dt.IncludeAnonymous||!h.type.isAnonymous||Um(h)){let f;if(!(n&dt.IgnoreMounts)&&(f=Io.get(h))&&!f.overlay)return new Pi(f.tree,u,e,o);let p=new Pi(h,u,e,o);return n&dt.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(t<0?h.children.length-1:0,t,r,s,n)}}}if(n&dt.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,r=0){let s;if(!(r&dt.IgnoreOverlays)&&(s=Io.get(this._tree))&&s.overlay){let n=e-this.from,o=r&dt.EnterBracketed&&s.bracketed;for(let{from:a,to:l}of s.overlay)if((t>0||o?a<=n:a<n)&&(t<0||o?l>=n:l>n))return new Pi(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function u0(i,e,t,r){let s=i.cursor(),n=[];if(!s.firstChild())return n;if(t!=null){for(let o=!1;!o;)if(o=s.type.is(t),!s.nextSibling())return n}for(;;){if(r!=null&&s.type.is(r))return n;if(s.type.is(e)&&n.push(s.node),!s.nextSibling())return r==null?n:[]}}function ap(i,e,t=e.length-1){for(let r=i;t>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[t]&&e[t]!=r.name)return!1;t--}}return!0}class D6{constructor(e,t,r,s){this.parent=e,this.buffer=t,this.index=r,this.start=s}}class is extends dy{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,r){super(),this.context=e,this._parent=t,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,t,r){let{buffer:s}=this.context,n=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.context.start,r);return n<0?null:new is(this.context,this,n)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,r=0){if(r&dt.ExcludeBuffers)return null;let{buffer:s}=this.context,n=s.findChild(this.index+4,s.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return n<0?null:new is(this.context,this,n)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new is(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new is(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:r}=this.context,s=this.index+4,n=r.buffer[this.index+3];if(n>s){let o=r.buffer[this.index+1];e.push(r.slice(s,n,o)),t.push(0)}return new ht(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function fy(i){if(!i.length)return null;let e=0,t=i[0];for(let n=1;n<i.length;n++){let o=i[n];(o.from>t.from||o.to<t.to)&&(t=o,e=n)}let r=t instanceof Pi&&t.index<0?null:t.parent,s=i.slice();return r?s[e]=r:s.splice(e,1),new I6(s,t)}class I6{constructor(e,t){this.heads=e,this.node=t}get next(){return fy(this.heads)}}function z6(i,e,t){let r=i.resolveInner(e,t),s=null;for(let n=r instanceof Pi?r:r.context.parent;n;n=n.parent)if(n.index<0){let o=n.parent;(s||(s=[r])).push(o.resolve(e,t)),n=o}else{let o=Io.get(n.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new Pi(o.tree,o.overlay[0].from+n.from,-1,n);(s||(s=[r])).push(Ql(a,e,t,!1))}}return s?fy(s):r}class jh{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~dt.EnterBracketed,e instanceof Pi)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:r,buffer:s}=this.buffer;return this.type=t||s.set.types[s.buffer[e]],this.from=r+s.buffer[e+1],this.to=r+s.buffer[e+2],!0}yield(e){return e?e instanceof Pi?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,r,this.mode));let{buffer:s}=this.buffer,n=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.buffer.start,r);return n<0?!1:(this.stack.push(this.index),this.yieldBuf(n))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,r=this.mode){return this.buffer?r&dt.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&dt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&dt.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,r=this.stack.length-1;if(e<0){let s=r<0?0:this.stack[r]+4;if(this.index!=s)return this.yieldBuf(t.findChild(s,this.index,-1,0,4))}else{let s=t.buffer[this.index+3];if(s<(r<0?t.buffer.length:t.buffer[this.stack[r]+3]))return this.yieldBuf(s)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,r,{buffer:s}=this;if(s){if(e>0){if(this.index<s.buffer.buffer.length)return!1}else for(let n=0;n<this.index;n++)if(s.buffer.buffer[n+3]<this.index)return!1;({index:t,parent:r}=s)}else({index:t,_parent:r}=this._tree);for(;r;{index:t,_parent:r}=r)if(t>-1)for(let n=t+e,o=e<0?-1:r._tree.children.length;n!=o;n+=e){let a=r._tree.children[n];if(this.mode&dt.IncludeAnonymous||a instanceof xn||!a.type.isAnonymous||Um(a))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,r=0;if(e&&e.context==this.buffer)e:for(let s=this.index,n=this.stack.length;n>=0;){for(let o=e;o;o=o._parent)if(o.index==s){if(s==this.index)return o;t=o,r=n+1;break e}s=this.stack[--n]}for(let s=r;s<this.stack.length;s++)t=new is(this.buffer,t,this.stack[s]);return this.bufferNode=new is(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let r=0;;){let s=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(s=!0)}for(;;){if(s&&t&&t(this),s=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,s=!0}}}matchContext(e){if(!this.buffer)return ap(this.node.parent,e);let{buffer:t}=this.buffer,{types:r}=t.set;for(let s=e.length-1,n=this.stack.length-1;s>=0;n--){if(n<0)return ap(this._tree,e,s);let o=r[t.buffer[this.stack[n]]];if(!o.isAnonymous){if(e[s]&&e[s]!=o.name)return!1;s--}}return!0}}function Um(i){return i.children.some(e=>e instanceof xn||!e.type.isAnonymous||Um(e))}function N6(i){var e;let{buffer:t,nodeSet:r,maxBufferLength:s=hy,reused:n=[],minRepeatType:o=r.types.length}=i,a=Array.isArray(t)?new Hm(t,t.length):t,l=r.types,c=0,h=0;function u(C,M,D,j,oe,ae){let{id:G,start:x,end:b,size:T}=a,$=h,R=c;if(T<0)if(a.next(),T==-1){let V=n[G];D.push(V),j.push(x-C);return}else if(T==-3){c=G;return}else if(T==-4){h=G;return}else throw new RangeError(`Unrecognized record size: ${T}`);let E=l[G],Z,K,X=x-C;if(b-x<=s&&(K=O(a.pos-M,oe))){let V=new Uint16Array(K.size-K.skip),ie=a.pos-K.size,q=V.length;for(;a.pos>ie;)q=_(K.start,V,q);Z=new xn(V,b-K.start,r),X=K.start-C}else{let V=a.pos-T;a.next();let ie=[],q=[],ee=G>=o?G:-1,te=0,Oe=b;for(;a.pos>V;)ee>=0&&a.id==ee&&a.size>=0?(a.end<=Oe-s&&(p(ie,q,x,te,a.end,Oe,ee,$,R),te=ie.length,Oe=a.end),a.next()):ae>2500?d(x,V,ie,q):u(x,V,ie,q,ee,ae+1);if(ee>=0&&te>0&&te<ie.length&&p(ie,q,x,te,x,Oe,ee,$,R),ie.reverse(),q.reverse(),ee>-1&&te>0){let Te=f(E,R);Z=Ym(E,ie,q,0,ie.length,0,b-x,Te,Te)}else Z=g(E,ie,q,b-x,$-b,R)}D.push(Z),j.push(X)}function d(C,M,D,j){let oe=[],ae=0,G=-1;for(;a.pos>M;){let{id:x,start:b,end:T,size:$}=a;if($>4)a.next();else{if(G>-1&&b<G)break;G<0&&(G=T-s),oe.push(x,b,T),ae++,a.next()}}if(ae){let x=new Uint16Array(ae*4),b=oe[oe.length-2];for(let T=oe.length-3,$=0;T>=0;T-=3)x[$++]=oe[T],x[$++]=oe[T+1]-b,x[$++]=oe[T+2]-b,x[$++]=$;D.push(new xn(x,oe[2]-b,r)),j.push(b-C)}}function f(C,M){return(D,j,oe)=>{let ae=0,G=D.length-1,x,b;if(G>=0&&(x=D[G])instanceof ht){if(!G&&x.type==C&&x.length==oe)return x;(b=x.prop(Ue.lookAhead))&&(ae=j[G]+x.length+b)}return g(C,D,j,oe,ae,M)}}function p(C,M,D,j,oe,ae,G,x,b){let T=[],$=[];for(;C.length>j;)T.push(C.pop()),$.push(M.pop()+D-oe);C.push(g(r.types[G],T,$,ae-oe,x-ae,b)),M.push(oe-D)}function g(C,M,D,j,oe,ae,G){if(ae){let x=[Ue.contextHash,ae];G=G?[x].concat(G):[x]}if(oe>25){let x=[Ue.lookAhead,oe];G=G?[x].concat(G):[x]}return new ht(C,M,D,j,G)}function O(C,M){let D=a.fork(),j=0,oe=0,ae=0,G=D.end-s,x={size:0,start:0,skip:0};e:for(let b=D.pos-C;D.pos>b;){let T=D.size;if(D.id==M&&T>=0){x.size=j,x.start=oe,x.skip=ae,ae+=4,j+=4,D.next();continue}let $=D.pos-T;if(T<0||$<b||D.start<G)break;let R=D.id>=o?4:0,E=D.start;for(D.next();D.pos>$;){if(D.size<0)if(D.size==-3||D.size==-4)R+=4;else break e;else D.id>=o&&(R+=4);D.next()}oe=E,j+=T,ae+=R}return(M<0||j==C)&&(x.size=j,x.start=oe,x.skip=ae),x.size>4?x:void 0}function _(C,M,D){let{id:j,start:oe,end:ae,size:G}=a;if(a.next(),G>=0&&j<o){let x=D;if(G>4){let b=a.pos-(G-4);for(;a.pos>b;)D=_(C,M,D)}M[--D]=x,M[--D]=ae-C,M[--D]=oe-C,M[--D]=j}else G==-3?c=j:G==-4&&(h=j);return D}let k=[],P=[];for(;a.pos>0;)u(i.start||0,i.bufferStart||0,k,P,-1,0);let w=(e=i.length)!==null&&e!==void 0?e:k.length?P[0]+k[0].length:0;return new ht(l[i.topID],k.reverse(),P.reverse(),w)}const d0=new WeakMap;function bh(i,e){if(!i.isAnonymous||e instanceof xn||e.type!=i)return 1;let t=d0.get(e);if(t==null){t=1;for(let r of e.children){if(r.type!=i||!(r instanceof ht)){t=1;break}t+=bh(i,r)}d0.set(e,t)}return t}function Ym(i,e,t,r,s,n,o,a,l){let c=0;for(let p=r;p<s;p++)c+=bh(i,e[p]);let h=Math.ceil(c*1.5/8),u=[],d=[];function f(p,g,O,_,k){for(let P=O;P<_;){let w=P,C=g[P],M=bh(i,p[P]);for(P++;P<_;P++){let D=bh(i,p[P]);if(M+D>=h)break;M+=D}if(P==w+1){if(M>h){let D=p[w];f(D.children,D.positions,0,D.children.length,g[w]+k);continue}u.push(p[w])}else{let D=g[P-1]+p[P-1].length-C;u.push(Ym(i,p,g,w,P,C,D,null,l))}d.push(C+k-n)}}return f(e,t,r,s,0),(a||l)(u,d,o)}class py{constructor(){this.map=new WeakMap}setBuffer(e,t,r){let s=this.map.get(e);s||this.map.set(e,s=new Map),s.set(t,r)}getBuffer(e,t){let r=this.map.get(e);return r&&r.get(t)}set(e,t){e instanceof is?this.setBuffer(e.context.buffer,e.index,t):e instanceof Pi&&this.map.set(e.tree,t)}get(e){return e instanceof is?this.getBuffer(e.context.buffer,e.index):e instanceof Pi?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Ls{constructor(e,t,r,s,n=!1,o=!1){this.from=e,this.to=t,this.tree=r,this.offset=s,this.open=(n?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],r=!1){let s=[new Ls(0,e.length,e,0,!1,r)];for(let n of t)n.to>e.length&&s.push(n);return s}static applyChanges(e,t,r=128){if(!t.length)return e;let s=[],n=1,o=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let h=a<t.length?t[a]:null,u=h?h.fromA:1e9;if(u-l>=r)for(;o&&o.from<u;){let d=o;if(l>=d.from||u<=d.to||c){let f=Math.max(d.from,l)-c,p=Math.min(d.to,u)-c;d=f>=p?null:new Ls(f,p,d.tree,d.offset+c,a>0,!!h)}if(d&&s.push(d),o.to>u)break;o=n<e.length?e[n++]:null}if(!h)break;l=h.toA,c=h.toA-h.toB}return s}}class jm{startParse(e,t,r){return typeof e=="string"&&(e=new W6(e)),r=r?r.length?r.map(s=>new Or(s.from,s.to)):[new Or(0,0)]:[new Or(0,e.length)],this.createParse(e,t||[],r)}parse(e,t,r){let s=this.startParse(e,t,r);for(;;){let n=s.advance();if(n)return n}}}class W6{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function my(i){return(e,t,r,s)=>new X6(e,i,t,r,s)}class f0{constructor(e,t,r,s,n,o){this.parser=e,this.parse=t,this.overlay=r,this.bracketed=s,this.target=n,this.from=o}}function p0(i){if(!i.length||i.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(i))}class Z6{constructor(e,t,r,s,n,o,a,l){this.parser=e,this.predicate=t,this.mounts=r,this.index=s,this.start=n,this.bracketed=o,this.target=a,this.prev=l,this.depth=0,this.ranges=[]}}const lp=new Ue({perNode:!0});class X6{constructor(e,t,r,s,n){this.nest=t,this.input=r,this.fragments=s,this.ranges=n,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let r=this.baseParse.advance();if(!r)return null;if(this.baseParse=null,this.baseTree=r,this.startInner(),this.stoppedAt!=null)for(let s of this.inner)s.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let r=this.baseTree;return this.stoppedAt!=null&&(r=new ht(r.type,r.children,r.positions,r.length,r.propValues.concat([[lp,this.stoppedAt]]))),r}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let r=Object.assign(Object.create(null),e.target.props);r[Ue.mounted.id]=new Io(t,e.overlay,e.parser,e.bracketed),e.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new q6(this.fragments),t=null,r=null,s=new jh(new Pi(this.baseTree,this.ranges[0].from,0,null),dt.IncludeAnonymous|dt.IgnoreMounts);e:for(let n,o;;){let a=!0,l;if(this.stoppedAt!=null&&s.from>=this.stoppedAt)a=!1;else if(e.hasNode(s)){if(t){let c=t.mounts.find(h=>h.frag.from<=s.from&&h.frag.to>=s.to&&h.mount.overlay);if(c)for(let h of c.mount.overlay){let u=h.from+c.pos,d=h.to+c.pos;u>=s.from&&d<=s.to&&!t.ranges.some(f=>f.from<d&&f.to>u)&&t.ranges.push({from:u,to:d})}}a=!1}else if(r&&(o=F6(r.ranges,s.from,s.to)))a=o!=2;else if(!s.type.isAnonymous&&(n=this.nest(s,this.input))&&(s.from<s.to||!n.overlay)){s.tree||(V6(s),t&&t.depth++,r&&r.depth++);let c=e.findMounts(s.from,n.parser);if(typeof n.overlay=="function")t=new Z6(n.parser,n.overlay,c,this.inner.length,s.from,!!n.bracketed,s.tree,t);else{let h=v0(this.ranges,n.overlay||(s.from<s.to?[new Or(s.from,s.to)]:[]));h.length&&p0(h),(h.length||!n.overlay)&&this.inner.push(new f0(n.parser,h.length?n.parser.startParse(this.input,O0(c,h),h):n.parser.startParse(""),n.overlay?n.overlay.map(u=>new Or(u.from-s.from,u.to-s.from)):null,!!n.bracketed,s.tree,h.length?h[0].from:s.from)),n.overlay?h.length&&(r={ranges:h,depth:0,prev:r}):a=!1}}else if(t&&(l=t.predicate(s))&&(l===!0&&(l=new Or(s.from,s.to)),l.from<l.to)){let c=t.ranges.length-1;c>=0&&t.ranges[c].to==l.from?t.ranges[c]={from:t.ranges[c].from,to:l.to}:t.ranges.push(l)}if(a&&s.firstChild())t&&t.depth++,r&&r.depth++;else for(;!s.nextSibling();){if(!s.parent())break e;if(t&&!--t.depth){let c=v0(this.ranges,t.ranges);c.length&&(p0(c),this.inner.splice(t.index,0,new f0(t.parser,t.parser.startParse(this.input,O0(t.mounts,c),c),t.ranges.map(h=>new Or(h.from-t.start,h.to-t.start)),t.bracketed,t.target,c[0].from))),t=t.prev}r&&!--r.depth&&(r=r.prev)}}}}function F6(i,e,t){for(let r of i){if(r.from>=t)break;if(r.to>e)return r.from<=e&&r.to>=t?2:1}return 0}function m0(i,e,t,r,s,n){if(e<t){let o=i.buffer[e+1];r.push(i.slice(e,t,o)),s.push(o-n)}}function V6(i){let{node:e}=i,t=[],r=e.context.buffer;do t.push(i.index),i.parent();while(!i.tree);let s=i.tree,n=s.children.indexOf(r),o=s.children[n],a=o.buffer,l=[n];function c(h,u,d,f,p,g){let O=t[g],_=[],k=[];m0(o,h,O,_,k,f);let P=a[O+1],w=a[O+2];l.push(_.length);let C=g?c(O+4,a[O+3],o.set.types[a[O]],P,w-P,g-1):e.toTree();return _.push(C),k.push(P-f),m0(o,a[O+3],u,_,k,f),new ht(d,_,k,p)}s.children[n]=c(0,a.length,Gt.none,0,o.length,t.length-1);for(let h of l){let u=i.tree.children[h],d=i.tree.positions[h];i.yield(new Pi(u,d+i.from,h,i._tree))}}class g0{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(dt.IncludeAnonymous|dt.IgnoreMounts)}moveTo(e){let{cursor:t}=this,r=e-this.offset;for(;!this.done&&t.from<r;)t.to>=e&&t.enter(r,1,dt.IgnoreOverlays|dt.ExcludeBuffers)||t.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof ht)t=t.children[0];else break}return!1}}let q6=class{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let r=this.curFrag=e[0];this.curTo=(t=r.tree.prop(lp))!==null&&t!==void 0?t:r.to,this.inner=new g0(r.tree,-r.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(lp))!==null&&e!==void 0?e:t.to,this.inner=new g0(t.tree,-t.offset)}}findMounts(e,t){var r;let s=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let n=this.inner.cursor.node;n;n=n.parent){let o=(r=n.tree)===null||r===void 0?void 0:r.prop(Ue.mounted);if(o&&o.parser==t)for(let a=this.fragI;a<this.fragments.length;a++){let l=this.fragments[a];if(l.from>=n.to)break;l.tree==this.curFrag.tree&&s.push({frag:l,pos:n.from-l.offset,mount:o})}}}return s}};function v0(i,e){let t=null,r=e;for(let s=1,n=0;s<i.length;s++){let o=i[s-1].to,a=i[s].from;for(;n<r.length;n++){let l=r[n];if(l.from>=a)break;l.to<=o||(t||(r=t=e.slice()),l.from<o?(t[n]=new Or(l.from,o),l.to>a&&t.splice(n+1,0,new Or(a,l.to))):l.to>a?t[n--]=new Or(a,l.to):t.splice(n--,1))}}return r}function H6(i,e,t,r){let s=0,n=0,o=!1,a=!1,l=-1e9,c=[];for(;;){let h=s==i.length?1e9:o?i[s].to:i[s].from,u=n==e.length?1e9:a?e[n].to:e[n].from;if(o!=a){let d=Math.max(l,t),f=Math.min(h,u,r);d<f&&c.push(new Or(d,f))}if(l=Math.min(h,u),l==1e9)break;h==l&&(o?(o=!1,s++):o=!0),u==l&&(a?(a=!1,n++):a=!0)}return c}function O0(i,e){let t=[];for(let{pos:r,mount:s,frag:n}of i){let o=r+(s.overlay?s.overlay[0].from:0),a=o+s.tree.length,l=Math.max(n.from,o),c=Math.min(n.to,a);if(s.overlay){let h=s.overlay.map(d=>new Or(d.from+r,d.to+r)),u=H6(e,h,l,c);for(let d=0,f=l;;d++){let p=d==u.length,g=p?c:u[d].from;if(g>f&&t.push(new Ls(f,g,s.tree,-o,n.from>=f||n.openStart,n.to<=g||n.openEnd)),p)break;f=u[d].to}}else t.push(new Ls(l,c,s.tree,-o,n.from>=o||n.openStart,n.to<=a||n.openEnd))}return t}let U6=0;class rr{constructor(e,t,r,s){this.name=e,this.set=t,this.base=r,this.modified=s,this.id=U6++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let r=typeof e=="string"?e:"?";if(e instanceof rr&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let s=new rr(r,[],null,[]);if(s.set.push(s),t)for(let n of t.set)s.set.push(n);return s}static defineModifier(e){let t=new Gh(e);return r=>r.modified.indexOf(t)>-1?r:Gh.get(r.base||r,r.modified.concat(t).sort((s,n)=>s.id-n.id))}}let Y6=0;class Gh{constructor(e){this.name=e,this.instances=[],this.id=Y6++}static get(e,t){if(!t.length)return e;let r=t[0].instances.find(a=>a.base==e&&j6(t,a.modified));if(r)return r;let s=[],n=new rr(e.name,s,e,t);for(let a of t)a.instances.push(n);let o=G6(t);for(let a of e.set)if(!a.modified.length)for(let l of o)s.push(Gh.get(a,l));return n}}function j6(i,e){return i.length==e.length&&i.every((t,r)=>t==e[r])}function G6(i){let e=[[]];for(let t=0;t<i.length;t++)for(let r=0,s=e.length;r<s;r++)e.push(e[r].concat(i[t]));return e.sort((t,r)=>r.length-t.length)}function ra(i){let e=Object.create(null);for(let t in i){let r=i[t];Array.isArray(r)||(r=[r]);for(let s of t.split(" "))if(s){let n=[],o=2,a=s;for(let u=0;;){if(a=="..."&&u>0&&u+3==s.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!d)throw new RangeError("Invalid path: "+s);if(n.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),u+=d[0].length,u==s.length)break;let f=s[u++];if(u==s.length&&f=="!"){o=0;break}if(f!="/")throw new RangeError("Invalid path: "+s);a=s.slice(u)}let l=n.length-1,c=n[l];if(!c)throw new RangeError("Invalid path: "+s);let h=new Al(r,o,l>0?n.slice(0,l):null);e[c]=h.sort(e[c])}}return gy.add(e)}const gy=new Ue({combine(i,e){let t,r,s;for(;i||e;){if(!i||e&&i.depth>=e.depth?(s=e,e=e.next):(s=i,i=i.next),t&&t.mode==s.mode&&!s.context&&!t.context)continue;let n=new Al(s.tags,s.mode,s.context);t?t.next=n:r=n,t=n}return r}});class Al{constructor(e,t,r,s){this.tags=e,this.mode=t,this.context=r,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}Al.empty=new Al([],2,null);function vy(i,e){let t=Object.create(null);for(let n of i)if(!Array.isArray(n.tag))t[n.tag.id]=n.class;else for(let o of n.tag)t[o.id]=n.class;let{scope:r,all:s=null}=e||{};return{style:n=>{let o=s;for(let a of n)for(let l of a.set){let c=t[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:r}}function K6(i,e){let t=null;for(let r of i){let s=r.style(e);s&&(t=t?t+" "+s:s)}return t}function J6(i,e,t,r=0,s=i.length){let n=new eA(r,Array.isArray(e)?e:[e],t);n.highlightRange(i.cursor(),r,s,"",n.highlighters),n.flush(s)}class eA{constructor(e,t,r){this.at=e,this.highlighters=t,this.span=r,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,r,s,n){let{type:o,from:a,to:l}=e;if(a>=r||l<=t)return;o.isTop&&(n=this.highlighters.filter(f=>!f.scope||f.scope(o)));let c=s,h=tA(e)||Al.empty,u=K6(n,h.tags);if(u&&(c&&(c+=" "),c+=u,h.mode==1&&(s+=(s?" ":"")+u)),this.startSpan(Math.max(t,a),c),h.opaque)return;let d=e.tree&&e.tree.prop(Ue.mounted);if(d&&d.overlay){let f=e.node.enter(d.overlay[0].from+a,1),p=this.highlighters.filter(O=>!O.scope||O.scope(d.tree.type)),g=e.firstChild();for(let O=0,_=a;;O++){let k=O<d.overlay.length?d.overlay[O]:null,P=k?k.from+a:l,w=Math.max(t,_),C=Math.min(r,P);if(w<C&&g)for(;e.from<C&&(this.highlightRange(e,w,C,s,n),this.startSpan(Math.min(C,e.to),c),!(e.to>=P||!e.nextSibling())););if(!k||P>r)break;_=k.to+a,_>t&&(this.highlightRange(f.cursor(),Math.max(t,k.from+a),Math.min(r,_),"",p),this.startSpan(Math.min(r,_),c))}g&&e.parent()}else if(e.firstChild()){d&&(s="");do if(!(e.to<=t)){if(e.from>=r)break;this.highlightRange(e,t,r,s,n),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}}function tA(i){let e=i.type.prop(gy);for(;e&&e.context&&!i.matchContext(e.context);)e=e.next;return e||null}const $e=rr.define,Wc=$e(),an=$e(),_0=$e(an),b0=$e(an),ln=$e(),Zc=$e(ln),pd=$e(ln),jr=$e(),Mn=$e(jr),Vr=$e(),qr=$e(),cp=$e(),Ia=$e(cp),Xc=$e(),B={comment:Wc,lineComment:$e(Wc),blockComment:$e(Wc),docComment:$e(Wc),name:an,variableName:$e(an),typeName:_0,tagName:$e(_0),propertyName:b0,attributeName:$e(b0),className:$e(an),labelName:$e(an),namespace:$e(an),macroName:$e(an),literal:ln,string:Zc,docString:$e(Zc),character:$e(Zc),attributeValue:$e(Zc),number:pd,integer:$e(pd),float:$e(pd),bool:$e(ln),regexp:$e(ln),escape:$e(ln),color:$e(ln),url:$e(ln),keyword:Vr,self:$e(Vr),null:$e(Vr),atom:$e(Vr),unit:$e(Vr),modifier:$e(Vr),operatorKeyword:$e(Vr),controlKeyword:$e(Vr),definitionKeyword:$e(Vr),moduleKeyword:$e(Vr),operator:qr,derefOperator:$e(qr),arithmeticOperator:$e(qr),logicOperator:$e(qr),bitwiseOperator:$e(qr),compareOperator:$e(qr),updateOperator:$e(qr),definitionOperator:$e(qr),typeOperator:$e(qr),controlOperator:$e(qr),punctuation:cp,separator:$e(cp),bracket:Ia,angleBracket:$e(Ia),squareBracket:$e(Ia),paren:$e(Ia),brace:$e(Ia),content:jr,heading:Mn,heading1:$e(Mn),heading2:$e(Mn),heading3:$e(Mn),heading4:$e(Mn),heading5:$e(Mn),heading6:$e(Mn),contentSeparator:$e(jr),list:$e(jr),quote:$e(jr),emphasis:$e(jr),strong:$e(jr),link:$e(jr),monospace:$e(jr),strikethrough:$e(jr),inserted:$e(),deleted:$e(),changed:$e(),invalid:$e(),meta:Xc,documentMeta:$e(Xc),annotation:$e(Xc),processingInstruction:$e(Xc),definition:rr.defineModifier("definition"),constant:rr.defineModifier("constant"),function:rr.defineModifier("function"),standard:rr.defineModifier("standard"),local:rr.defineModifier("local"),special:rr.defineModifier("special")};for(let i in B){let e=B[i];e instanceof rr&&(e.name=i)}vy([{tag:B.link,class:"tok-link"},{tag:B.heading,class:"tok-heading"},{tag:B.emphasis,class:"tok-emphasis"},{tag:B.strong,class:"tok-strong"},{tag:B.keyword,class:"tok-keyword"},{tag:B.atom,class:"tok-atom"},{tag:B.bool,class:"tok-bool"},{tag:B.url,class:"tok-url"},{tag:B.labelName,class:"tok-labelName"},{tag:B.inserted,class:"tok-inserted"},{tag:B.deleted,class:"tok-deleted"},{tag:B.literal,class:"tok-literal"},{tag:B.string,class:"tok-string"},{tag:B.number,class:"tok-number"},{tag:[B.regexp,B.escape,B.special(B.string)],class:"tok-string2"},{tag:B.variableName,class:"tok-variableName"},{tag:B.local(B.variableName),class:"tok-variableName tok-local"},{tag:B.definition(B.variableName),class:"tok-variableName tok-definition"},{tag:B.special(B.variableName),class:"tok-variableName2"},{tag:B.definition(B.propertyName),class:"tok-propertyName tok-definition"},{tag:B.typeName,class:"tok-typeName"},{tag:B.namespace,class:"tok-namespace"},{tag:B.className,class:"tok-className"},{tag:B.macroName,class:"tok-macroName"},{tag:B.propertyName,class:"tok-propertyName"},{tag:B.operator,class:"tok-operator"},{tag:B.comment,class:"tok-comment"},{tag:B.meta,class:"tok-meta"},{tag:B.invalid,class:"tok-invalid"},{tag:B.punctuation,class:"tok-punctuation"}]);var md;const Xn=new Ue;function Gm(i){return Ae.define({combine:i?e=>e.concat(i):void 0})}const Km=new Ue;class _r{constructor(e,t,r=[],s=""){this.data=e,this.name=s,st.prototype.hasOwnProperty("tree")||Object.defineProperty(st.prototype,"tree",{get(){return bt(this)}}),this.parser=t,this.extension=[wn.of(this),st.languageData.of((n,o,a)=>{let l=y0(n,o,a),c=l.type.prop(Xn);if(!c)return[];let h=n.facet(c),u=l.type.prop(Km);if(u){let d=l.resolve(o-l.from,a);for(let f of u)if(f.test(d,n)){let p=n.facet(f.facet);return f.type=="replace"?p:p.concat(h)}}return h})].concat(r)}isActiveAt(e,t,r=-1){return y0(e,t,r).type.prop(Xn)==this.data}findRegions(e){let t=e.facet(wn);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let r=[],s=(n,o)=>{if(n.prop(Xn)==this.data){r.push({from:o,to:o+n.length});return}let a=n.prop(Ue.mounted);if(a){if(a.tree.prop(Xn)==this.data){if(a.overlay)for(let l of a.overlay)r.push({from:l.from+o,to:l.to+o});else r.push({from:o,to:o+n.length});return}else if(a.overlay){let l=r.length;if(s(a.tree,a.overlay[0].from+o),r.length>l)return}}for(let l=0;l<n.children.length;l++){let c=n.children[l];c instanceof ht&&s(c,n.positions[l]+o)}};return s(bt(e),0),r}get allowsNesting(){return!0}}_r.setState=He.define();function y0(i,e,t){let r=i.facet(wn),s=bt(i).topNode;if(!r||r.allowsNesting)for(let n=s;n;n=n.enter(e,t,dt.ExcludeBuffers|dt.EnterBracketed))n.type.isTop&&(s=n);return s}class Yo extends _r{constructor(e,t,r){super(e,t,[],r),this.parser=t}static define(e){let t=Gm(e.languageData);return new Yo(t,e.parser.configure({props:[Xn.add(r=>r.isTop?t:void 0)]}),e.name)}configure(e,t){return new Yo(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function bt(i){let e=i.field(_r.state,!1);return e?e.tree:ht.empty}class iA{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let r=this.cursorPos-this.string.length;return e<r||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-r,t-r)}}let za=null;class Rl{constructor(e,t,r=[],s,n,o,a,l){this.parser=e,this.state=t,this.fragments=r,this.tree=s,this.treeLen=n,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,t,r){return new Rl(e,t,[],ht.empty,0,r,[],null)}startParse(){return this.parser.startParse(new iA(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=ht.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let s=this.parse.advance();if(s)if(this.fragments=this.withoutTempSkipped(Ls.addTree(s,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=s,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(Ls.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=za;za=this;try{return e()}finally{za=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=x0(e,t.from,t.to);return e}changes(e,t){let{fragments:r,tree:s,treeLen:n,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,h,u,d)=>l.push({fromA:c,toA:h,fromB:u,toB:d})),r=Ls.applyChanges(r,l),s=ht.empty,n=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let h=e.mapPos(c.from,1),u=e.mapPos(c.to,-1);h<u&&a.push({from:h,to:u})}}}return new Rl(this.parser,t,r,s,n,o,a,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:s,to:n}=this.skipped[r];s<e.to&&n>e.from&&(this.fragments=x0(this.fragments,s,n),this.skipped.splice(r--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends jm{createParse(t,r,s){let n=s[0].from,o=s[s.length-1].to;return{parsedPos:n,advance(){let l=za;if(l){for(let c of s)l.tempSkipped.push(c);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new ht(Gt.none,[],[],o-n)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return za}}function x0(i,e,t){return Ls.applyChanges(i,[{fromA:e,toA:t,fromB:e,toB:t}])}class jo{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,r)||t.takeTree(),new jo(t)}static init(e){let t=Math.min(3e3,e.doc.length),r=Rl.create(e.facet(wn).parser,e,{from:0,to:t});return r.work(20,t)||r.takeTree(),new jo(r)}}_r.state=ui.define({create:jo.init,update(i,e){for(let t of e.effects)if(t.is(_r.setState))return t.value;return e.startState.facet(wn)!=e.state.facet(wn)?jo.init(e.state):i.apply(e)}});let Oy=i=>{let e=setTimeout(()=>i(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Oy=i=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(i,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const gd=typeof navigator<"u"&&(!((md=navigator.scheduling)===null||md===void 0)&&md.isInputPending)?()=>navigator.scheduling.isInputPending():null,rA=It.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(_r.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(_r.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Oy(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:s}}=this.view,n=r.field(_r.state);if(n.tree==n.context.tree&&n.context.isDone(s+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!gd?Math.max(25,e.timeRemaining()-5):1e9),a=n.context.treeLen<s&&r.doc.length>s+1e3,l=n.context.work(()=>gd&&gd()||Date.now()>o,s+(a?0:1e5));this.chunkBudget-=Date.now()-t,(l||this.chunkBudget<=0)&&(n.context.takeTree(),this.view.dispatch({effects:_r.setState.of(new jo(n.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(n.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>qi(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),wn=Ae.define({combine(i){return i.length?i[0]:null},enables:i=>[_r.state,rA,Pe.contentAttributes.compute([i],e=>{let t=e.facet(i);return t&&t.name?{"data-language":t.name}:{}})]});class Bl{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}class Kh{constructor(e,t,r,s,n,o=void 0){this.name=e,this.alias=t,this.extensions=r,this.filename=s,this.loadFunc=n,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:t,support:r}=e;if(!t){if(!r)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(r)}return new Kh(e.name,(e.alias||[]).concat(e.name).map(s=>s.toLowerCase()),e.extensions||[],e.filename,t,r)}static matchFilename(e,t){for(let s of e)if(s.filename&&s.filename.test(t))return s;let r=/\.([^.]+)$/.exec(t);if(r){for(let s of e)if(s.extensions.indexOf(r[1])>-1)return s}return null}static matchLanguageName(e,t,r=!0){t=t.toLowerCase();for(let s of e)if(s.alias.some(n=>n==t))return s;if(r)for(let s of e)for(let n of s.alias){let o=t.indexOf(n);if(o>-1&&(n.length>2||!/\w/.test(t[o-1])&&!/\w/.test(t[o+n.length])))return s}return null}}const sA=Ae.define(),oc=Ae.define({combine:i=>{if(!i.length)return" ";let e=i[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(i[0]));return e}});function Jh(i){let e=i.facet(oc);return e.charCodeAt(0)==9?i.tabSize*e.length:e.length}function Ll(i,e){let t="",r=i.tabSize,s=i.facet(oc)[0];if(s==" "){for(;e>=r;)t+=" ",e-=r;s=" "}for(let n=0;n<e;n++)t+=s;return t}function Jm(i,e){i instanceof st&&(i=new zu(i));for(let r of i.state.facet(sA)){let s=r(i,e);if(s!==void 0)return s}let t=bt(i.state);return t.length>=e?nA(i,t,e):null}class zu{constructor(e,t={}){this.state=e,this.options=t,this.unit=Jh(e)}lineAt(e,t=1){let r=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:n}=this.options;return s!=null&&s>=r.from&&s<=r.to?n&&s==e?{text:"",from:e}:(t<0?s<e:s<=e)?{text:r.text.slice(s-r.from),from:s}:{text:r.text.slice(0,s-r.from),from:r.from}:r}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:s}=this.lineAt(e,t);return r.slice(e-s,Math.min(r.length,e+100-s))}column(e,t=1){let{text:r,from:s}=this.lineAt(e,t),n=this.countColumn(r,e-s),o=this.options.overrideIndentation?this.options.overrideIndentation(s):-1;return o>-1&&(n+=o-this.countColumn(r,r.search(/\S|$/))),n}countColumn(e,t=e.length){return Ar(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:r,from:s}=this.lineAt(e,t),n=this.options.overrideIndentation;if(n){let o=n(s);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const ac=new Ue;function nA(i,e,t){let r=e.resolveStack(t),s=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(s!=r.node){let n=[];for(let o=s;o&&!(o.from<r.node.from||o.to>r.node.to||o.from==r.node.from&&o.type==r.node.type);o=o.parent)n.push(o);for(let o=n.length-1;o>=0;o--)r={node:n[o],next:r}}return _y(r,i,t)}function _y(i,e,t){for(let r=i;r;r=r.next){let s=aA(r.node);if(s)return s(eg.create(e,t,r))}return 0}function oA(i){return i.pos==i.options.simulateBreak&&i.options.simulateDoubleBreak}function aA(i){let e=i.type.prop(ac);if(e)return e;let t=i.firstChild,r;if(t&&(r=t.type.prop(Ue.closedBy))){let s=i.lastChild,n=s&&r.indexOf(s.name)>-1;return o=>by(o,!0,1,void 0,n&&!oA(o)?s.from:void 0)}return i.parent==null?lA:null}function lA(){return 0}class eg extends zu{constructor(e,t,r){super(e.state,e.options),this.base=e,this.pos=t,this.context=r}get node(){return this.context.node}static create(e,t,r){return new eg(e,t,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(t.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(cA(r,e))break;t=this.state.doc.lineAt(r.from)}return this.lineIndent(t.from)}continue(){return _y(this.context.next,this.base,this.pos)}}function cA(i,e){for(let t=e;t;t=t.parent)if(i==t)return!0;return!1}function hA(i){let e=i.node,t=e.childAfter(e.from),r=e.lastChild;if(!t)return null;let s=i.options.simulateBreak,n=i.state.doc.lineAt(t.from),o=s==null||s<=n.from?n.to:Math.min(n.to,s);for(let a=t.to;;){let l=e.childAfter(a);if(!l||l==r)return null;if(!l.type.isSkipped){if(l.from>=o)return null;let c=/^ */.exec(n.text.slice(t.to-n.from))[0].length;return{from:t.from,to:t.to+c}}a=l.to}}function uA({closing:i,align:e=!0,units:t=1}){return r=>by(r,e,t,i)}function by(i,e,t,r,s){let n=i.textAfter,o=n.match(/^\s*/)[0].length,a=r&&n.slice(o,o+r.length)==r||s==i.pos+o,l=e?hA(i):null;return l?a?i.column(l.from):i.column(l.to):i.baseIndent+(a?0:i.unit*t)}const dA=i=>i.baseIndent;function yh({except:i,units:e=1}={}){return t=>{let r=i&&i.test(t.textAfter);return t.baseIndent+(r?0:e*t.unit)}}const fA=200;function pA(){return st.transactionFilter.of(i=>{if(!i.docChanged||!i.isUserEvent("input.type")&&!i.isUserEvent("input.complete"))return i;let e=i.startState.languageDataAt("indentOnInput",i.startState.selection.main.head);if(!e.length)return i;let t=i.newDoc,{head:r}=i.newSelection.main,s=t.lineAt(r);if(r>s.from+fA)return i;let n=t.sliceString(s.from,r);if(!e.some(c=>c.test(n)))return i;let{state:o}=i,a=-1,l=[];for(let{head:c}of o.selection.ranges){let h=o.doc.lineAt(c);if(h.from==a)continue;a=h.from;let u=Jm(o,h.from);if(u==null)continue;let d=/^\s*/.exec(h.text)[0],f=Ll(o,u);d!=f&&l.push({from:h.from,to:h.from+d.length,insert:f})}return l.length?[i,{changes:l,sequential:!0}]:i})}const yy=Ae.define(),sa=new Ue;function xy(i){let e=i.firstChild,t=i.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?i.to:t.from}:null}function mA(i,e,t){let r=bt(i);if(r.length<t)return null;let s=r.resolveStack(t,1),n=null;for(let o=s;o;o=o.next){let a=o.node;if(a.to<=t||a.from>t)continue;if(n&&a.from<e)break;let l=a.type.prop(sa);if(l&&(a.to<r.length-50||r.length==i.doc.length||!gA(a))){let c=l(a,i);c&&c.from<=t&&c.from>=e&&c.to>t&&(n=c)}}return n}function gA(i){let e=i.lastChild;return e&&e.to==i.to&&e.type.isError}function eu(i,e,t){for(let r of i.facet(yy)){let s=r(i,e,t);if(s)return s}return mA(i,e,t)}function wy(i,e){let t=e.mapPos(i.from,1),r=e.mapPos(i.to,-1);return t>=r?void 0:{from:t,to:r}}const Nu=He.define({map:wy}),lc=He.define({map:wy});function Sy(i){let e=[];for(let{head:t}of i.state.selection.ranges)e.some(r=>r.from<=t&&r.to>=t)||e.push(i.lineBlockAt(t));return e}const ro=ui.define({create(){return ze.none},update(i,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((t,r)=>i=w0(i,t,r)),i=i.map(e.changes);for(let t of e.effects)if(t.is(Nu)&&!vA(i,t.value.from,t.value.to)){let{preparePlaceholder:r}=e.state.facet($y),s=r?ze.replace({widget:new SA(r(e.state,t.value))}):S0;i=i.update({add:[s.range(t.value.from,t.value.to)]})}else t.is(lc)&&(i=i.update({filter:(r,s)=>t.value.from!=r||t.value.to!=s,filterFrom:t.value.from,filterTo:t.value.to}));return e.selection&&(i=w0(i,e.selection.main.head)),i},provide:i=>Pe.decorations.from(i),toJSON(i,e){let t=[];return i.between(0,e.doc.length,(r,s)=>{t.push(r,s)}),t},fromJSON(i){if(!Array.isArray(i)||i.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t<i.length;){let r=i[t++],s=i[t++];if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid JSON for fold state");e.push(S0.range(r,s))}return ze.set(e,!0)}});function w0(i,e,t=e){let r=!1;return i.between(e,t,(s,n)=>{s<t&&n>e&&(r=!0)}),r?i.update({filterFrom:e,filterTo:t,filter:(s,n)=>s>=t||n<=e}):i}function tu(i,e,t){var r;let s=null;return(r=i.field(ro,!1))===null||r===void 0||r.between(e,t,(n,o)=>{(!s||s.from>n)&&(s={from:n,to:o})}),s}function vA(i,e,t){let r=!1;return i.between(e,e,(s,n)=>{s==e&&n==t&&(r=!0)}),r}function ky(i,e){return i.field(ro,!1)?e:e.concat(He.appendConfig.of(Py()))}const OA=i=>{for(let e of Sy(i)){let t=eu(i.state,e.from,e.to);if(t)return i.dispatch({effects:ky(i.state,[Nu.of(t),Cy(i,t)])}),!0}return!1},_A=i=>{if(!i.state.field(ro,!1))return!1;let e=[];for(let t of Sy(i)){let r=tu(i.state,t.from,t.to);r&&e.push(lc.of(r),Cy(i,r,!1))}return e.length&&i.dispatch({effects:e}),e.length>0};function Cy(i,e,t=!0){let r=i.state.doc.lineAt(e.from).number,s=i.state.doc.lineAt(e.to).number;return Pe.announce.of(`${i.state.phrase(t?"Folded lines":"Unfolded lines")} ${r} ${i.state.phrase("to")} ${s}.`)}const bA=i=>{let{state:e}=i,t=[];for(let r=0;r<e.doc.length;){let s=i.lineBlockAt(r),n=eu(e,s.from,s.to);n&&t.push(Nu.of(n)),r=(n?i.lineBlockAt(n.to):s).to+1}return t.length&&i.dispatch({effects:ky(i.state,t)}),!!t.length},yA=i=>{let e=i.state.field(ro,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,i.state.doc.length,(r,s)=>{t.push(lc.of({from:r,to:s}))}),i.dispatch({effects:t}),!0},xA=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:OA},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:_A},{key:"Ctrl-Alt-[",run:bA},{key:"Ctrl-Alt-]",run:yA}],wA={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},$y=Ae.define({combine(i){return fs(i,wA)}});function Py(i){return[ro,$A]}function Ty(i,e){let{state:t}=i,r=t.facet($y),s=o=>{let a=i.lineBlockAt(i.posAtDOM(o.target)),l=tu(i.state,a.from,a.to);l&&i.dispatch({effects:lc.of(l)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(i,s,e);let n=document.createElement("span");return n.textContent=r.placeholderText,n.setAttribute("aria-label",t.phrase("folded code")),n.title=t.phrase("unfold"),n.className="cm-foldPlaceholder",n.onclick=s,n}const S0=ze.replace({widget:new class extends ps{toDOM(i){return Ty(i,null)}}});class SA extends ps{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return Ty(e,this.value)}}const kA={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class vd extends Is{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function CA(i={}){let e={...kA,...i},t=new vd(e,!0),r=new vd(e,!1),s=It.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(wn)!=o.state.facet(wn)||o.startState.field(ro,!1)!=o.state.field(ro,!1)||bt(o.startState)!=bt(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new Es;for(let l of o.viewportLineBlocks){let c=tu(o.state,l.from,l.to)?r:eu(o.state,l.from,l.to)?t:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:n}=e;return[s,S6({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(s))===null||a===void 0?void 0:a.markers)||it.empty},initialSpacer(){return new vd(e,!1)},domEventHandlers:{...n,click:(o,a,l)=>{if(n.click&&n.click(o,a,l))return!0;let c=tu(o.state,a.from,a.to);if(c)return o.dispatch({effects:lc.of(c)}),!0;let h=eu(o.state,a.from,a.to);return h?(o.dispatch({effects:Nu.of(h)}),!0):!1}}}),Py()]}const $A=Pe.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class cc{constructor(e,t){this.specs=e;let r;function s(a){let l=_n.newName();return(r||(r=Object.create(null)))["."+l]=a,l}const n=typeof t.all=="string"?t.all:t.all?s(t.all):void 0,o=t.scope;this.scope=o instanceof _r?a=>a.prop(Xn)==o.data:o?a=>a==o:void 0,this.style=vy(e.map(a=>({tag:a.tag,class:a.class||s(Object.assign({},a,{tag:null}))})),{all:n}).style,this.module=r?new _n(r):null,this.themeType=t.themeType}static define(e,t){return new cc(e,t||{})}}const hp=Ae.define(),My=Ae.define({combine(i){return i.length?[i[0]]:null}});function Od(i){let e=i.facet(hp);return e.length?e:i.facet(My)}function Qy(i,e){let t=[TA],r;return i instanceof cc&&(i.module&&t.push(Pe.styleModule.of(i.module)),r=i.themeType),e?.fallback?t.push(My.of(i)):r?t.push(hp.computeN([Pe.darkTheme],s=>s.facet(Pe.darkTheme)==(r=="dark")?[i]:[])):t.push(hp.of(i)),t}class PA{constructor(e){this.markCache=Object.create(null),this.tree=bt(e.state),this.decorations=this.buildDeco(e,Od(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=bt(e.state),r=Od(e.state),s=r!=Od(e.startState),{viewport:n}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<n.to&&!s&&t.type==this.tree.type&&o>=n.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||s)&&(this.tree=t,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=n.to)}buildDeco(e,t){if(!t||!this.tree.length)return ze.none;let r=new Es;for(let{from:s,to:n}of e.visibleRanges)J6(this.tree,t,(o,a,l)=>{r.add(o,a,this.markCache[l]||(this.markCache[l]=ze.mark({class:l})))},s,n);return r.finish()}}const TA=Ns.high(It.fromClass(PA,{decorations:i=>i.decorations})),MA=cc.define([{tag:B.meta,color:"#404740"},{tag:B.link,textDecoration:"underline"},{tag:B.heading,textDecoration:"underline",fontWeight:"bold"},{tag:B.emphasis,fontStyle:"italic"},{tag:B.strong,fontWeight:"bold"},{tag:B.strikethrough,textDecoration:"line-through"},{tag:B.keyword,color:"#708"},{tag:[B.atom,B.bool,B.url,B.contentSeparator,B.labelName],color:"#219"},{tag:[B.literal,B.inserted],color:"#164"},{tag:[B.string,B.deleted],color:"#a11"},{tag:[B.regexp,B.escape,B.special(B.string)],color:"#e40"},{tag:B.definition(B.variableName),color:"#00f"},{tag:B.local(B.variableName),color:"#30a"},{tag:[B.typeName,B.namespace],color:"#085"},{tag:B.className,color:"#167"},{tag:[B.special(B.variableName),B.macroName],color:"#256"},{tag:B.definition(B.propertyName),color:"#00c"},{tag:B.comment,color:"#940"},{tag:B.invalid,color:"#f00"}]),QA=Pe.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Ay=1e4,Ry="()[]{}",By=Ae.define({combine(i){return fs(i,{afterCursor:!0,brackets:Ry,maxScanDistance:Ay,renderMatch:BA})}}),AA=ze.mark({class:"cm-matchingBracket"}),RA=ze.mark({class:"cm-nonmatchingBracket"});function BA(i){let e=[],t=i.matched?AA:RA;return e.push(t.range(i.start.from,i.start.to)),i.end&&e.push(t.range(i.end.from,i.end.to)),e}function k0(i){let e=[],t=i.facet(By);for(let r of i.selection.ranges){if(!r.empty)continue;let s=rs(i,r.head,-1,t)||r.head>0&&rs(i,r.head-1,1,t)||t.afterCursor&&(rs(i,r.head,1,t)||r.head<i.doc.length&&rs(i,r.head+1,-1,t));s&&(e=e.concat(t.renderMatch(s,i)))}return ze.set(e,!0)}const LA=It.fromClass(class{constructor(i){this.paused=!1,this.decorations=k0(i.state)}update(i){(i.docChanged||i.selectionSet||this.paused)&&(i.view.composing?(this.decorations=this.decorations.map(i.changes),this.paused=!0):(this.decorations=k0(i.state),this.paused=!1))}},{decorations:i=>i.decorations}),EA=[LA,QA];function DA(i={}){return[By.of(i),EA]}const Ly=new Ue;function up(i,e,t){let r=i.prop(e<0?Ue.openedBy:Ue.closedBy);if(r)return r;if(i.name.length==1){let s=t.indexOf(i.name);if(s>-1&&s%2==(e<0?1:0))return[t[s+e]]}return null}function dp(i){let e=i.type.prop(Ly);return e?e(i.node):i}function rs(i,e,t,r={}){let s=r.maxScanDistance||Ay,n=r.brackets||Ry,o=bt(i),a=o.resolveInner(e,t);for(let l=a;l;l=l.parent){let c=up(l.type,t,n);if(c&&l.from<l.to){let h=dp(l);if(h&&(t>0?e>=h.from&&e<h.to:e>h.from&&e<=h.to))return IA(i,e,t,l,h,c,n)}}return zA(i,e,t,o,a.type,s,n)}function IA(i,e,t,r,s,n,o){let a=r.parent,l={from:s.from,to:s.to},c=0,h=a?.cursor();if(h&&(t<0?h.childBefore(r.from):h.childAfter(r.to)))do if(t<0?h.to<=r.from:h.from>=r.to){if(c==0&&n.indexOf(h.type.name)>-1&&h.from<h.to){let u=dp(h);return{start:l,end:u?{from:u.from,to:u.to}:void 0,matched:!0}}else if(up(h.type,t,o))c++;else if(up(h.type,-t,o)){if(c==0){let u=dp(h);return{start:l,end:u&&u.from<u.to?{from:u.from,to:u.to}:void 0,matched:!1}}c--}}while(t<0?h.prevSibling():h.nextSibling());return{start:l,matched:!1}}function zA(i,e,t,r,s,n,o){let a=t<0?i.sliceDoc(e-1,e):i.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%2==0!=t>0)return null;let c={from:t<0?e-1:e,to:t>0?e+1:e},h=i.doc.iterRange(e,t>0?i.doc.length:0),u=0;for(let d=0;!h.next().done&&d<=n;){let f=h.value;t<0&&(d+=f.length);let p=e+d*t;for(let g=t>0?0:f.length-1,O=t>0?f.length:-1;g!=O;g+=t){let _=o.indexOf(f[g]);if(!(_<0||r.resolveInner(p+g,1).type!=s))if(_%2==0==t>0)u++;else{if(u==1)return{start:c,end:{from:p+g,to:p+g+1},matched:_>>1==l>>1};u--}}t>0&&(d+=f.length)}return h.done?{start:c,matched:!1}:null}const NA=Object.create(null),C0=[Gt.none],$0=[],P0=Object.create(null),WA=Object.create(null);for(let[i,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])WA[i]=ZA(NA,e);function _d(i,e){$0.indexOf(i)>-1||($0.push(i),console.warn(e))}function ZA(i,e){let t=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let h=i[c]||B[c];h?typeof h=="function"?l.length?l=l.map(h):_d(c,`Modifier ${c} used at start of tag`):l.length?_d(c,`Tag ${c} used as modifier`):l=Array.isArray(h)?h:[h]:_d(c,`Unknown highlighting tag ${c}`)}for(let c of l)t.push(c)}if(!t.length)return 0;let r=e.replace(/ /g,"_"),s=r+" "+t.map(a=>a.id),n=P0[s];if(n)return n.id;let o=P0[s]=Gt.define({id:C0.length,name:r,props:[ra({[r]:t})]});return C0.push(o),o.id}_t.RTL,_t.LTR;const XA=i=>{let{state:e}=i,t=e.doc.lineAt(e.selection.main.from),r=ig(i.state,t.from);return r.line?FA(i):r.block?qA(i):!1};function tg(i,e){return({state:t,dispatch:r})=>{if(t.readOnly)return!1;let s=i(e,t);return s?(r(t.update(s)),!0):!1}}const FA=tg(YA,0),VA=tg(Ey,0),qA=tg((i,e)=>Ey(i,e,UA(e)),0);function ig(i,e){let t=i.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const Na=50;function HA(i,{open:e,close:t},r,s){let n=i.sliceDoc(r-Na,r),o=i.sliceDoc(s,s+Na),a=/\s*$/.exec(n)[0].length,l=/^\s*/.exec(o)[0].length,c=n.length-a;if(n.slice(c-e.length,c)==e&&o.slice(l,l+t.length)==t)return{open:{pos:r-a,margin:a&&1},close:{pos:s+l,margin:l&&1}};let h,u;s-r<=2*Na?h=u=i.sliceDoc(r,s):(h=i.sliceDoc(r,r+Na),u=i.sliceDoc(s-Na,s));let d=/^\s*/.exec(h)[0].length,f=/\s*$/.exec(u)[0].length,p=u.length-f-t.length;return h.slice(d,d+e.length)==e&&u.slice(p,p+t.length)==t?{open:{pos:r+d+e.length,margin:/\s/.test(h.charAt(d+e.length))?1:0},close:{pos:s-f-t.length,margin:/\s/.test(u.charAt(p-1))?1:0}}:null}function UA(i){let e=[];for(let t of i.selection.ranges){let r=i.doc.lineAt(t.from),s=t.to<=r.to?r:i.doc.lineAt(t.to);s.from>r.from&&s.from==t.to&&(s=t.to==r.to+1?r:i.doc.lineAt(t.to-1));let n=e.length-1;n>=0&&e[n].to>r.from?e[n].to=s.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:s.to})}return e}function Ey(i,e,t=e.selection.ranges){let r=t.map(n=>ig(e,n.from).block);if(!r.every(n=>n))return null;let s=t.map((n,o)=>HA(e,r[o],n.from,n.to));if(i!=2&&!s.every(n=>n))return{changes:e.changes(t.map((n,o)=>s[o]?[]:[{from:n.from,insert:r[o].open+" "},{from:n.to,insert:" "+r[o].close}]))};if(i!=1&&s.some(n=>n)){let n=[];for(let o=0,a;o<s.length;o++)if(a=s[o]){let l=r[o],{open:c,close:h}=a;n.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:h.pos-h.margin,to:h.pos+l.close.length})}return{changes:n}}return null}function YA(i,e,t=e.selection.ranges){let r=[],s=-1;e:for(let{from:n,to:o}of t){let a=r.length,l=1e9,c;for(let h=n;h<=o;){let u=e.doc.lineAt(h);if(c==null&&(c=ig(e,u.from).line,!c))continue e;if(u.from>s&&(n==o||o>u.from)){s=u.from;let d=/^\s*/.exec(u.text)[0].length,f=d==u.length,p=u.text.slice(d,d+c.length)==c?d:-1;d<u.text.length&&d<l&&(l=d),r.push({line:u,comment:p,token:c,indent:d,empty:f,single:!1})}h=u.to+1}if(l<1e9)for(let h=a;h<r.length;h++)r[h].indent<r[h].line.text.length&&(r[h].indent=l);r.length==a+1&&(r[a].single=!0)}if(i!=2&&r.some(n=>n.comment<0&&(!n.empty||n.single))){let n=[];for(let{line:a,token:l,indent:c,empty:h,single:u}of r)(u||!h)&&n.push({from:a.from+c,insert:l+" "});let o=e.changes(n);return{changes:o,selection:e.selection.map(o,1)}}else if(i!=1&&r.some(n=>n.comment>=0)){let n=[];for(let{line:o,comment:a,token:l}of r)if(a>=0){let c=o.from+a,h=c+l.length;o.text[h-o.from]==" "&&h++,n.push({from:c,to:h})}return{changes:n}}return null}const fp=Ws.define(),jA=Ws.define(),GA=Ae.define(),Dy=Ae.define({combine(i){return fs(i,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(r,s)=>e(r,s)||t(r,s)})}}),Iy=ui.define({create(){return ss.empty},update(i,e){let t=e.state.facet(Dy),r=e.annotation(fp);if(r){let l=Hi.fromTransaction(e,r.selection),c=r.side,h=c==0?i.undone:i.done;return l?h=iu(h,h.length,t.minDepth,l):h=Wy(h,e.startState.selection),new ss(c==0?r.rest:h,c==0?h:r.rest)}let s=e.annotation(jA);if((s=="full"||s=="before")&&(i=i.isolate()),e.annotation(Ft.addToHistory)===!1)return e.changes.empty?i:i.addMapping(e.changes.desc);let n=Hi.fromTransaction(e),o=e.annotation(Ft.time),a=e.annotation(Ft.userEvent);return n?i=i.addChanges(n,o,a,t,e):e.selection&&(i=i.addSelection(e.startState.selection,o,a,t.newGroupDelay)),(s=="full"||s=="after")&&(i=i.isolate()),i},toJSON(i){return{done:i.done.map(e=>e.toJSON()),undone:i.undone.map(e=>e.toJSON())}},fromJSON(i){return new ss(i.done.map(Hi.fromJSON),i.undone.map(Hi.fromJSON))}});function KA(i={}){return[Iy,Dy.of(i),Pe.domEventHandlers({beforeinput(e,t){let r=e.inputType=="historyUndo"?zy:e.inputType=="historyRedo"?pp:null;return r?(e.preventDefault(),r(t)):!1}})]}function Wu(i,e){return function({state:t,dispatch:r}){if(!e&&t.readOnly)return!1;let s=t.field(Iy,!1);if(!s)return!1;let n=s.pop(i,t,e);return n?(r(n),!0):!1}}const zy=Wu(0,!1),pp=Wu(1,!1),JA=Wu(0,!0),e7=Wu(1,!0);class Hi{constructor(e,t,r,s,n){this.changes=e,this.effects=t,this.mapped=r,this.startSelection=s,this.selectionsAfter=n}setSelAfter(e){return new Hi(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new Hi(e.changes&&jt.fromJSON(e.changes),[],e.mapped&&as.fromJSON(e.mapped),e.startSelection&&ue.fromJSON(e.startSelection),e.selectionsAfter.map(ue.fromJSON))}static fromTransaction(e,t){let r=br;for(let s of e.startState.facet(GA)){let n=s(e);n.length&&(r=r.concat(n))}return!r.length&&e.changes.empty?null:new Hi(e.changes.invert(e.startState.doc),r,void 0,t||e.startState.selection,br)}static selection(e){return new Hi(void 0,br,void 0,void 0,e)}}function iu(i,e,t,r){let s=e+1>t+20?e-t-1:0,n=i.slice(s,e);return n.push(r),n}function t7(i,e){let t=[],r=!1;return i.iterChangedRanges((s,n)=>t.push(s,n)),e.iterChangedRanges((s,n,o,a)=>{for(let l=0;l<t.length;){let c=t[l++],h=t[l++];a>=c&&o<=h&&(r=!0)}}),r}function i7(i,e){return i.ranges.length==e.ranges.length&&i.ranges.filter((t,r)=>t.empty!=e.ranges[r].empty).length===0}function Ny(i,e){return i.length?e.length?i.concat(e):i:e}const br=[],r7=200;function Wy(i,e){if(i.length){let t=i[i.length-1],r=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-r7));return r.length&&r[r.length-1].eq(e)?i:(r.push(e),iu(i,i.length-1,1e9,t.setSelAfter(r)))}else return[Hi.selection([e])]}function s7(i){let e=i[i.length-1],t=i.slice();return t[i.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function bd(i,e){if(!i.length)return i;let t=i.length,r=br;for(;t;){let s=n7(i[t-1],e,r);if(s.changes&&!s.changes.empty||s.effects.length){let n=i.slice(0,t);return n[t-1]=s,n}else e=s.mapped,t--,r=s.selectionsAfter}return r.length?[Hi.selection(r)]:br}function n7(i,e,t){let r=Ny(i.selectionsAfter.length?i.selectionsAfter.map(a=>a.map(e)):br,t);if(!i.changes)return Hi.selection(r);let s=i.changes.map(e),n=e.mapDesc(i.changes,!0),o=i.mapped?i.mapped.composeDesc(n):n;return new Hi(s,He.mapEffects(i.effects,e),o,i.startSelection.map(n),r)}const o7=/^(input\.type|delete)($|\.)/;class ss{constructor(e,t,r=0,s=void 0){this.done=e,this.undone=t,this.prevTime=r,this.prevUserEvent=s}isolate(){return this.prevTime?new ss(this.done,this.undone):this}addChanges(e,t,r,s,n){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!r||o7.test(r))&&(!a.selectionsAfter.length&&t-this.prevTime<s.newGroupDelay&&s.joinToEvent(n,t7(a.changes,e.changes))||r=="input.type.compose")?o=iu(o,o.length-1,s.minDepth,new Hi(e.changes.compose(a.changes),Ny(He.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,br)):o=iu(o,o.length,s.minDepth,e),new ss(o,br,t,r)}addSelection(e,t,r,s){let n=this.done.length?this.done[this.done.length-1].selectionsAfter:br;return n.length>0&&t-this.prevTime<s&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&i7(n[n.length-1],e)?this:new ss(Wy(this.done,e),this.undone,t,r)}addMapping(e){return new ss(bd(this.done,e),bd(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,r){let s=e==0?this.done:this.undone;if(s.length==0)return null;let n=s[s.length-1],o=n.selectionsAfter[0]||(n.startSelection?n.startSelection.map(n.changes.invertedDesc,1):t.selection);if(r&&n.selectionsAfter.length)return t.update({selection:n.selectionsAfter[n.selectionsAfter.length-1],annotations:fp.of({side:e,rest:s7(s),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(n.changes){let a=s.length==1?br:s.slice(0,s.length-1);return n.mapped&&(a=bd(a,n.mapped)),t.update({changes:n.changes,selection:n.startSelection,effects:n.effects,annotations:fp.of({side:e,rest:a,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}ss.empty=new ss(br,br);const a7=[{key:"Mod-z",run:zy,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:pp,preventDefault:!0},{linux:"Ctrl-Shift-z",run:pp,preventDefault:!0},{key:"Mod-u",run:JA,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:e7,preventDefault:!0}];function na(i,e){return ue.create(i.ranges.map(e),i.mainIndex)}function Er(i,e){return i.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Dr({state:i,dispatch:e},t){let r=na(i.selection,t);return r.eq(i.selection,!0)?!1:(e(Er(i,r)),!0)}function Zu(i,e){return ue.cursor(e?i.to:i.from)}function Zy(i,e){return Dr(i,t=>t.empty?i.moveByChar(t,e):Zu(t,e))}function Ti(i){return i.textDirectionAt(i.state.selection.main.head)==_t.LTR}const Xy=i=>Zy(i,!Ti(i)),Fy=i=>Zy(i,Ti(i));function Vy(i,e){return Dr(i,t=>t.empty?i.moveByGroup(t,e):Zu(t,e))}const l7=i=>Vy(i,!Ti(i)),c7=i=>Vy(i,Ti(i));function h7(i,e,t){if(e.type.prop(t))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(i.sliceDoc(e.from,e.to)))||e.firstChild}function Xu(i,e,t){let r=bt(i).resolveInner(e.head),s=t?Ue.closedBy:Ue.openedBy;for(let l=e.head;;){let c=t?r.childAfter(l):r.childBefore(l);if(!c)break;h7(i,c,s)?r=c:l=t?c.to:c.from}let n=r.type.prop(s),o,a;return n&&(o=t?rs(i,r.from,1):rs(i,r.to,-1))&&o.matched?a=t?o.end.to:o.end.from:a=t?r.to:r.from,ue.cursor(a,t?-1:1)}const u7=i=>Dr(i,e=>Xu(i.state,e,!Ti(i))),d7=i=>Dr(i,e=>Xu(i.state,e,Ti(i)));function qy(i,e){return Dr(i,t=>{if(!t.empty)return Zu(t,e);let r=i.moveVertically(t,e);return r.head!=t.head?r:i.moveToLineBoundary(t,e)})}const Hy=i=>qy(i,!1),Uy=i=>qy(i,!0);function Yy(i){let e=i.scrollDOM.clientHeight<i.scrollDOM.scrollHeight-2,t=0,r=0,s;if(e){for(let n of i.state.facet(Pe.scrollMargins)){let o=n(i);o?.top&&(t=Math.max(o?.top,t)),o?.bottom&&(r=Math.max(o?.bottom,r))}s=i.scrollDOM.clientHeight-t-r}else s=(i.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:r,selfScroll:e,height:Math.max(i.defaultLineHeight,s-5)}}function jy(i,e){let t=Yy(i),{state:r}=i,s=na(r.selection,o=>o.empty?i.moveVertically(o,e,t.height):Zu(o,e));if(s.eq(r.selection))return!1;let n;if(t.selfScroll){let o=i.coordsAtPos(r.selection.main.head),a=i.scrollDOM.getBoundingClientRect(),l=a.top+t.marginTop,c=a.bottom-t.marginBottom;o&&o.top>l&&o.bottom<c&&(n=Pe.scrollIntoView(s.main.head,{y:"start",yMargin:o.top-l}))}return i.dispatch(Er(r,s),{effects:n}),!0}const T0=i=>jy(i,!1),mp=i=>jy(i,!0);function kn(i,e,t){let r=i.lineBlockAt(e.head),s=i.moveToLineBoundary(e,t);if(s.head==e.head&&s.head!=(t?r.to:r.from)&&(s=i.moveToLineBoundary(e,t,!1)),!t&&s.head==r.from&&r.length){let n=/^\s*/.exec(i.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&e.head!=r.from+n&&(s=ue.cursor(r.from+n))}return s}const f7=i=>Dr(i,e=>kn(i,e,!0)),p7=i=>Dr(i,e=>kn(i,e,!1)),m7=i=>Dr(i,e=>kn(i,e,!Ti(i))),g7=i=>Dr(i,e=>kn(i,e,Ti(i))),v7=i=>Dr(i,e=>ue.cursor(i.lineBlockAt(e.head).from,1)),O7=i=>Dr(i,e=>ue.cursor(i.lineBlockAt(e.head).to,-1));function _7(i,e,t){let r=!1,s=na(i.selection,n=>{let o=rs(i,n.head,-1)||rs(i,n.head,1)||n.head>0&&rs(i,n.head-1,1)||n.head<i.doc.length&&rs(i,n.head+1,-1);if(!o||!o.end)return n;r=!0;let a=o.start.from==n.head?o.end.to:o.end.from;return ue.cursor(a)});return r?(e(Er(i,s)),!0):!1}const b7=({state:i,dispatch:e})=>_7(i,e);function Sr(i,e){let t=na(i.state.selection,r=>{let s=e(r);return ue.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return t.eq(i.state.selection)?!1:(i.dispatch(Er(i.state,t)),!0)}function Gy(i,e){return Sr(i,t=>i.moveByChar(t,e))}const Ky=i=>Gy(i,!Ti(i)),Jy=i=>Gy(i,Ti(i));function ex(i,e){return Sr(i,t=>i.moveByGroup(t,e))}const y7=i=>ex(i,!Ti(i)),x7=i=>ex(i,Ti(i)),w7=i=>Sr(i,e=>Xu(i.state,e,!Ti(i))),S7=i=>Sr(i,e=>Xu(i.state,e,Ti(i)));function tx(i,e){return Sr(i,t=>i.moveVertically(t,e))}const ix=i=>tx(i,!1),rx=i=>tx(i,!0);function sx(i,e){return Sr(i,t=>i.moveVertically(t,e,Yy(i).height))}const M0=i=>sx(i,!1),Q0=i=>sx(i,!0),k7=i=>Sr(i,e=>kn(i,e,!0)),C7=i=>Sr(i,e=>kn(i,e,!1)),$7=i=>Sr(i,e=>kn(i,e,!Ti(i))),P7=i=>Sr(i,e=>kn(i,e,Ti(i))),T7=i=>Sr(i,e=>ue.cursor(i.lineBlockAt(e.head).from)),M7=i=>Sr(i,e=>ue.cursor(i.lineBlockAt(e.head).to)),A0=({state:i,dispatch:e})=>(e(Er(i,{anchor:0})),!0),R0=({state:i,dispatch:e})=>(e(Er(i,{anchor:i.doc.length})),!0),B0=({state:i,dispatch:e})=>(e(Er(i,{anchor:i.selection.main.anchor,head:0})),!0),L0=({state:i,dispatch:e})=>(e(Er(i,{anchor:i.selection.main.anchor,head:i.doc.length})),!0),Q7=({state:i,dispatch:e})=>(e(i.update({selection:{anchor:0,head:i.doc.length},userEvent:"select"})),!0),A7=({state:i,dispatch:e})=>{let t=Fu(i).map(({from:r,to:s})=>ue.range(r,Math.min(s+1,i.doc.length)));return e(i.update({selection:ue.create(t),userEvent:"select"})),!0},R7=({state:i,dispatch:e})=>{let t=na(i.selection,r=>{let s=bt(i),n=s.resolveStack(r.from,1);if(r.empty){let o=s.resolveStack(r.from,-1);o.node.from>=n.node.from&&o.node.to<=n.node.to&&(n=o)}for(let o=n;o;o=o.next){let{node:a}=o;if((a.from<r.from&&a.to>=r.to||a.to>r.to&&a.from<=r.from)&&o.next)return ue.range(a.to,a.from)}return r});return t.eq(i.selection)?!1:(e(Er(i,t)),!0)};function nx(i,e){let{state:t}=i,r=t.selection,s=t.selection.ranges.slice();for(let n of t.selection.ranges){let o=t.doc.lineAt(n.head);if(e?o.to<i.state.doc.length:o.from>0)for(let a=n;;){let l=i.moveVertically(a,e);if(l.head<o.from||l.head>o.to){s.some(c=>c.head==l.head)||s.push(l);break}else{if(l.head==a.head)break;a=l}}}return s.length==r.ranges.length?!1:(i.dispatch(Er(t,ue.create(s,s.length-1))),!0)}const B7=i=>nx(i,!1),L7=i=>nx(i,!0),E7=({state:i,dispatch:e})=>{let t=i.selection,r=null;return t.ranges.length>1?r=ue.create([t.main]):t.main.empty||(r=ue.create([ue.cursor(t.main.head)])),r?(e(Er(i,r)),!0):!1};function hc(i,e){if(i.state.readOnly)return!1;let t="delete.selection",{state:r}=i,s=r.changeByRange(n=>{let{from:o,to:a}=n;if(o==a){let l=e(n);l<o?(t="delete.backward",l=Fc(i,l,!1)):l>o&&(t="delete.forward",l=Fc(i,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=Fc(i,o,!1),a=Fc(i,a,!0);return o==a?{range:n}:{changes:{from:o,to:a},range:ue.cursor(o,o<n.head?-1:1)}});return s.changes.empty?!1:(i.dispatch(r.update(s,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?Pe.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Fc(i,e,t){if(i instanceof Pe)for(let r of i.state.facet(Pe.atomicRanges).map(s=>s(i)))r.between(e,e,(s,n)=>{s<e&&n>e&&(e=t?n:s)});return e}const ox=(i,e,t)=>hc(i,r=>{let s=r.from,{state:n}=i,o=n.doc.lineAt(s),a,l;if(t&&!e&&s>o.from&&s<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,s-o.from))){if(a[a.length-1]==" ")return s-1;let c=Ar(a,n.tabSize),h=c%Jh(n)||Jh(n);for(let u=0;u<h&&a[a.length-1-u]==" ";u++)s--;l=s}else l=ci(o.text,s-o.from,e,e)+o.from,l==s&&o.number!=(e?n.doc.lines:1)?l+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,s-o.from))&&(l=ci(o.text,l-o.from,!1,!1)+o.from);return l}),gp=i=>ox(i,!1,!0),ax=i=>ox(i,!0,!1),lx=(i,e)=>hc(i,t=>{let r=t.head,{state:s}=i,n=s.doc.lineAt(r),o=s.charCategorizer(r);for(let a=null;;){if(r==(e?n.to:n.from)){r==t.head&&n.number!=(e?s.doc.lines:1)&&(r+=e?1:-1);break}let l=ci(n.text,r-n.from,e)+n.from,c=n.text.slice(Math.min(r,l)-n.from,Math.max(r,l)-n.from),h=o(c);if(a!=null&&h!=a)break;(c!=" "||r!=t.head)&&(a=h),r=l}return r}),cx=i=>lx(i,!1),D7=i=>lx(i,!0),I7=i=>hc(i,e=>{let t=i.lineBlockAt(e.head).to;return e.head<t?t:Math.min(i.state.doc.length,e.head+1)}),z7=i=>hc(i,e=>{let t=i.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),N7=i=>hc(i,e=>{let t=i.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(i.state.doc.length,e.head+1)}),W7=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=i.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:ct.of(["",""])},range:ue.cursor(r.from)}));return e(i.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},Z7=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=i.changeByRange(r=>{if(!r.empty||r.from==0||r.from==i.doc.length)return{range:r};let s=r.from,n=i.doc.lineAt(s),o=s==n.from?s-1:ci(n.text,s-n.from,!1)+n.from,a=s==n.to?s+1:ci(n.text,s-n.from,!0)+n.from;return{changes:{from:o,to:a,insert:i.doc.slice(s,a).append(i.doc.slice(o,s))},range:ue.cursor(a)}});return t.changes.empty?!1:(e(i.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Fu(i){let e=[],t=-1;for(let r of i.selection.ranges){let s=i.doc.lineAt(r.from),n=i.doc.lineAt(r.to);if(!r.empty&&r.to==n.from&&(n=i.doc.lineAt(r.to-1)),t>=s.number){let o=e[e.length-1];o.to=n.to,o.ranges.push(r)}else e.push({from:s.from,to:n.to,ranges:[r]});t=n.number+1}return e}function hx(i,e,t){if(i.readOnly)return!1;let r=[],s=[];for(let n of Fu(i)){if(t?n.to==i.doc.length:n.from==0)continue;let o=i.doc.lineAt(t?n.to+1:n.from-1),a=o.length+1;if(t){r.push({from:n.to,to:o.to},{from:n.from,insert:o.text+i.lineBreak});for(let l of n.ranges)s.push(ue.range(Math.min(i.doc.length,l.anchor+a),Math.min(i.doc.length,l.head+a)))}else{r.push({from:o.from,to:n.from},{from:n.to,insert:i.lineBreak+o.text});for(let l of n.ranges)s.push(ue.range(l.anchor-a,l.head-a))}}return r.length?(e(i.update({changes:r,scrollIntoView:!0,selection:ue.create(s,i.selection.mainIndex),userEvent:"move.line"})),!0):!1}const X7=({state:i,dispatch:e})=>hx(i,e,!1),F7=({state:i,dispatch:e})=>hx(i,e,!0);function ux(i,e,t){if(i.readOnly)return!1;let r=[];for(let n of Fu(i))t?r.push({from:n.from,insert:i.doc.slice(n.from,n.to)+i.lineBreak}):r.push({from:n.to,insert:i.lineBreak+i.doc.slice(n.from,n.to)});let s=i.changes(r);return e(i.update({changes:s,selection:i.selection.map(s,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const V7=({state:i,dispatch:e})=>ux(i,e,!1),q7=({state:i,dispatch:e})=>ux(i,e,!0),H7=i=>{if(i.state.readOnly)return!1;let{state:e}=i,t=e.changes(Fu(e).map(({from:s,to:n})=>(s>0?s--:n<e.doc.length&&n++,{from:s,to:n}))),r=na(e.selection,s=>{let n;if(i.lineWrapping){let o=i.lineBlockAt(s.head),a=i.coordsAtPos(s.head,s.assoc||1);a&&(n=o.bottom+i.documentTop-a.bottom+i.defaultLineHeight/2)}return i.moveVertically(s,!0,n)}).map(t);return i.dispatch({changes:t,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function U7(i,e){if(/\(\)|\[\]|\{\}/.test(i.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=bt(i).resolveInner(e),r=t.childBefore(e),s=t.childAfter(e),n;return r&&s&&r.to<=e&&s.from>=e&&(n=r.type.prop(Ue.closedBy))&&n.indexOf(s.name)>-1&&i.doc.lineAt(r.to).from==i.doc.lineAt(s.from).from&&!/\S/.test(i.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}const E0=dx(!1),Y7=dx(!0);function dx(i){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=e.changeByRange(s=>{let{from:n,to:o}=s,a=e.doc.lineAt(n),l=!i&&n==o&&U7(e,n);i&&(n=o=(o<=a.to?a:e.doc.lineAt(o)).to);let c=new zu(e,{simulateBreak:n,simulateDoubleBreak:!!l}),h=Jm(c,n);for(h==null&&(h=Ar(/^\s*/.exec(e.doc.lineAt(n).text)[0],e.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:n,to:o}=l:n>a.from&&n<a.from+100&&!/\S/.test(a.text.slice(0,n))&&(n=a.from);let u=["",Ll(e,h)];return l&&u.push(Ll(e,c.lineIndent(a.from,-1))),{changes:{from:n,to:o,insert:ct.of(u)},range:ue.cursor(n+1+u[1].length)}});return t(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function rg(i,e){let t=-1;return i.changeByRange(r=>{let s=[];for(let o=r.from;o<=r.to;){let a=i.doc.lineAt(o);a.number>t&&(r.empty||r.to>a.from)&&(e(a,s,r),t=a.number),o=a.to+1}let n=i.changes(s);return{changes:s,range:ue.range(n.mapPos(r.anchor,1),n.mapPos(r.head,1))}})}const j7=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=Object.create(null),r=new zu(i,{overrideIndentation:n=>{let o=t[n];return o??-1}}),s=rg(i,(n,o,a)=>{let l=Jm(r,n.from);if(l==null)return;/\S/.test(n.text)||(l=0);let c=/^\s*/.exec(n.text)[0],h=Ll(i,l);(c!=h||a.from<n.from+c.length)&&(t[n.from]=l,o.push({from:n.from,to:n.from+c.length,insert:h}))});return s.changes.empty||e(i.update(s,{userEvent:"indent"})),!0},G7=({state:i,dispatch:e})=>i.readOnly?!1:(e(i.update(rg(i,(t,r)=>{r.push({from:t.from,insert:i.facet(oc)})}),{userEvent:"input.indent"})),!0),K7=({state:i,dispatch:e})=>i.readOnly?!1:(e(i.update(rg(i,(t,r)=>{let s=/^\s*/.exec(t.text)[0];if(!s)return;let n=Ar(s,i.tabSize),o=0,a=Ll(i,Math.max(0,n-Jh(i)));for(;o<s.length&&o<a.length&&s.charCodeAt(o)==a.charCodeAt(o);)o++;r.push({from:t.from+o,to:t.from+s.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),J7=i=>(i.setTabFocusMode(),!0),eR=[{key:"Ctrl-b",run:Xy,shift:Ky,preventDefault:!0},{key:"Ctrl-f",run:Fy,shift:Jy},{key:"Ctrl-p",run:Hy,shift:ix},{key:"Ctrl-n",run:Uy,shift:rx},{key:"Ctrl-a",run:v7,shift:T7},{key:"Ctrl-e",run:O7,shift:M7},{key:"Ctrl-d",run:ax},{key:"Ctrl-h",run:gp},{key:"Ctrl-k",run:I7},{key:"Ctrl-Alt-h",run:cx},{key:"Ctrl-o",run:W7},{key:"Ctrl-t",run:Z7},{key:"Ctrl-v",run:mp}],tR=[{key:"ArrowLeft",run:Xy,shift:Ky,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:l7,shift:y7,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:m7,shift:$7,preventDefault:!0},{key:"ArrowRight",run:Fy,shift:Jy,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:c7,shift:x7,preventDefault:!0},{mac:"Cmd-ArrowRight",run:g7,shift:P7,preventDefault:!0},{key:"ArrowUp",run:Hy,shift:ix,preventDefault:!0},{mac:"Cmd-ArrowUp",run:A0,shift:B0},{mac:"Ctrl-ArrowUp",run:T0,shift:M0},{key:"ArrowDown",run:Uy,shift:rx,preventDefault:!0},{mac:"Cmd-ArrowDown",run:R0,shift:L0},{mac:"Ctrl-ArrowDown",run:mp,shift:Q0},{key:"PageUp",run:T0,shift:M0},{key:"PageDown",run:mp,shift:Q0},{key:"Home",run:p7,shift:C7,preventDefault:!0},{key:"Mod-Home",run:A0,shift:B0},{key:"End",run:f7,shift:k7,preventDefault:!0},{key:"Mod-End",run:R0,shift:L0},{key:"Enter",run:E0,shift:E0},{key:"Mod-a",run:Q7},{key:"Backspace",run:gp,shift:gp,preventDefault:!0},{key:"Delete",run:ax,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:cx,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:D7,preventDefault:!0},{mac:"Mod-Backspace",run:z7,preventDefault:!0},{mac:"Mod-Delete",run:N7,preventDefault:!0}].concat(eR.map(i=>({mac:i.key,run:i.run,shift:i.shift}))),iR=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:u7,shift:w7},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:d7,shift:S7},{key:"Alt-ArrowUp",run:X7},{key:"Shift-Alt-ArrowUp",run:V7},{key:"Alt-ArrowDown",run:F7},{key:"Shift-Alt-ArrowDown",run:q7},{key:"Mod-Alt-ArrowUp",run:B7},{key:"Mod-Alt-ArrowDown",run:L7},{key:"Escape",run:E7},{key:"Mod-Enter",run:Y7},{key:"Alt-l",mac:"Ctrl-l",run:A7},{key:"Mod-i",run:R7,preventDefault:!0},{key:"Mod-[",run:K7},{key:"Mod-]",run:G7},{key:"Mod-Alt-\\",run:j7},{key:"Shift-Mod-k",run:H7},{key:"Shift-Mod-\\",run:b7},{key:"Mod-/",run:XA},{key:"Alt-A",run:VA},{key:"Ctrl-m",mac:"Shift-Alt-m",run:J7}].concat(tR),D0=typeof String.prototype.normalize=="function"?i=>i.normalize("NFKD"):i=>i;class Go{constructor(e,t,r=0,s=e.length,n,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,s),this.bufferStart=r,this.normalize=n?a=>n(D0(a)):D0,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Xi(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Pm(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=Jr(e);let s=this.normalize(t);if(s.length)for(let n=0,o=r;;n++){let a=s.charCodeAt(n),l=this.match(a,o,this.bufferPos+this.bufferStart);if(n==s.length-1){if(l)return this.value=l,this;break}o==r&&n<t.length&&t.charCodeAt(n)==a&&o++}}}match(e,t,r){let s=null;for(let n=0;n<this.matches.length;n+=2){let o=this.matches[n],a=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?s={from:this.matches[n+1],to:r}:(this.matches[n]++,a=!0)),a||(this.matches.splice(n,2),n-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?s={from:t,to:r}:this.matches.push(1,t)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(Go.prototype[Symbol.iterator]=function(){return this});const fx={from:-1,to:-1,match:/.*/.exec("")},sg="gm"+(/x/.unicode==null?"":"u");class px{constructor(e,t,r,s=0,n=e.length){if(this.text=e,this.to=n,this.curLine="",this.done=!1,this.value=fx,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new mx(e,t,r,s,n);this.re=new RegExp(t,sg+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=e.iter();let o=e.lineAt(s);this.curLineStart=o.from,this.matchPos=ru(e,s),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let r=this.curLineStart+t.index,s=r+t[0].length;if(this.matchPos=ru(this.text,s+(r==s?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<s||r>this.value.to)&&(!this.test||this.test(r,s,t)))return this.value={from:r,to:s,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const yd=new WeakMap;class zo{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,r){let s=yd.get(e);if(!s||s.from>=r||s.to<=t){let a=new zo(t,e.sliceString(t,r));return yd.set(e,a),a}if(s.from==t&&s.to==r)return s;let{text:n,from:o}=s;return o>t&&(n=e.sliceString(t,o)+n,o=t),s.to<r&&(n+=e.sliceString(s.to,r)),yd.set(e,new zo(o,n)),new zo(t,n.slice(t-o,r-o))}}class mx{constructor(e,t,r,s,n){this.text=e,this.to=n,this.done=!1,this.value=fx,this.matchPos=ru(e,s),this.re=new RegExp(t,sg+(r?.ignoreCase?"i":"")),this.test=r?.test,this.flat=zo.get(e,s,this.chunkEnd(s+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let r=this.flat.from+t.index,s=r+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,s,t)))return this.value={from:r,to:s,match:t},this.matchPos=ru(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=zo.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(px.prototype[Symbol.iterator]=mx.prototype[Symbol.iterator]=function(){return this});function rR(i){try{return new RegExp(i,sg),!0}catch{return!1}}function ru(i,e){if(e>=i.length)return e;let t=i.lineAt(e),r;for(;e<t.to&&(r=t.text.charCodeAt(e-t.from))>=56320&&r<57344;)e++;return e}const sR=i=>{let{state:e}=i,t=String(e.doc.lineAt(i.state.selection.main.head).number),{close:r,result:s}=b6(i,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:t},focus:!0,submitLabel:e.phrase("go")});return s.then(n=>{let o=n&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.elements.line.value);if(!o){i.dispatch({effects:r});return}let a=e.doc.lineAt(e.selection.main.head),[,l,c,h,u]=o,d=h?+h.slice(1):0,f=c?+c:a.number;if(c&&u){let O=f/100;l&&(O=O*(l=="-"?-1:1)+a.number/e.doc.lines),f=Math.round(e.doc.lines*O)}else c&&l&&(f=f*(l=="-"?-1:1)+a.number);let p=e.doc.line(Math.max(1,Math.min(e.doc.lines,f))),g=ue.cursor(p.from+Math.max(0,Math.min(d,p.length)));i.dispatch({effects:[r,Pe.scrollIntoView(g.from,{y:"center"})],selection:g})}),!0},nR={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},oR=Ae.define({combine(i){return fs(i,nR,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function aR(i){return[dR,uR]}const lR=ze.mark({class:"cm-selectionMatch"}),cR=ze.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function I0(i,e,t,r){return(t==0||i(e.sliceDoc(t-1,t))!=$t.Word)&&(r==e.doc.length||i(e.sliceDoc(r,r+1))!=$t.Word)}function hR(i,e,t,r){return i(e.sliceDoc(t,t+1))==$t.Word&&i(e.sliceDoc(r-1,r))==$t.Word}const uR=It.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.selectionSet||i.docChanged||i.viewportChanged)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let e=i.state.facet(oR),{state:t}=i,r=t.selection;if(r.ranges.length>1)return ze.none;let s=r.main,n,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return ze.none;let l=t.wordAt(s.head);if(!l)return ze.none;o=t.charCategorizer(s.head),n=t.sliceDoc(l.from,l.to)}else{let l=s.to-s.from;if(l<e.minSelectionLength||l>200)return ze.none;if(e.wholeWords){if(n=t.sliceDoc(s.from,s.to),o=t.charCategorizer(s.head),!(I0(o,t,s.from,s.to)&&hR(o,t,s.from,s.to)))return ze.none}else if(n=t.sliceDoc(s.from,s.to),!n)return ze.none}let a=[];for(let l of i.visibleRanges){let c=new Go(t.doc,n,l.from,l.to);for(;!c.next().done;){let{from:h,to:u}=c.value;if((!o||I0(o,t,h,u))&&(s.empty&&h<=s.from&&u>=s.to?a.push(cR.range(h,u)):(h>=s.to||u<=s.from)&&a.push(lR.range(h,u)),a.length>e.maxMatches))return ze.none}}return ze.set(a)}},{decorations:i=>i.decorations}),dR=Pe.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),fR=({state:i,dispatch:e})=>{let{selection:t}=i,r=ue.create(t.ranges.map(s=>i.wordAt(s.head)||ue.cursor(s.head)),t.mainIndex);return r.eq(t)?!1:(e(i.update({selection:r})),!0)};function pR(i,e){let{main:t,ranges:r}=i.selection,s=i.wordAt(t.head),n=s&&s.from==t.from&&s.to==t.to;for(let o=!1,a=new Go(i.doc,e,r[r.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new Go(i.doc,e,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(l=>l.from==a.value.from))continue;if(n){let l=i.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const mR=({state:i,dispatch:e})=>{let{ranges:t}=i.selection;if(t.some(n=>n.from===n.to))return fR({state:i,dispatch:e});let r=i.sliceDoc(t[0].from,t[0].to);if(i.selection.ranges.some(n=>i.sliceDoc(n.from,n.to)!=r))return!1;let s=pR(i,r);return s?(e(i.update({selection:i.selection.addRange(ue.range(s.from,s.to),!1),effects:Pe.scrollIntoView(s.to)})),!0):!1},oa=Ae.define({combine(i){return fs(i,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new TR(e),scrollToMatch:e=>Pe.scrollIntoView(e)})}});class gx{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||rR(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,r)=>r=="n"?`
21
+ `:r=="r"?"\r":r=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new yR(this):new OR(this)}getCursor(e,t=0,r){let s=e.doc?e:st.create({doc:e});return r==null&&(r=s.doc.length),this.regexp?ko(this,s,t,r):So(this,s,t,r)}}class vx{constructor(e){this.spec=e}}function gR(i,e,t){return(r,s,n,o)=>{if(t&&!t(r,s,n,o))return!1;let a=r>=o&&s<=o+n.length?n.slice(r-o,s-o):e.doc.sliceString(r,s);return i(a,e,r,s)}}function So(i,e,t,r){let s;return i.wholeWord&&(s=vR(e.doc,e.charCategorizer(e.selection.main.head))),i.test&&(s=gR(i.test,e,s)),new Go(e.doc,i.unquoted,t,r,i.caseSensitive?void 0:n=>n.toLowerCase(),s)}function vR(i,e){return(t,r,s,n)=>((n>t||n+s.length<r)&&(n=Math.max(0,t-2),s=i.sliceString(n,Math.min(i.length,r+2))),(e(su(s,t-n))!=$t.Word||e(nu(s,t-n))!=$t.Word)&&(e(nu(s,r-n))!=$t.Word||e(su(s,r-n))!=$t.Word))}class OR extends vx{constructor(e){super(e)}nextMatch(e,t,r){let s=So(this.spec,e,r,e.doc.length).nextOverlapping();if(s.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);s=So(this.spec,e,0,n).nextOverlapping()}return s.done||s.value.from==t&&s.value.to==r?null:s.value}prevMatchInRange(e,t,r){for(let s=r;;){let n=Math.max(t,s-1e4-this.spec.unquoted.length),o=So(this.spec,e,n,s),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(n==t)return null;s-=1e4}}prevMatch(e,t,r){let s=this.prevMatchInRange(e,0,t);return s||(s=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),s&&(s.from!=t||s.to!=r)?s:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let r=So(this.spec,e,0,e.doc.length),s=[];for(;!r.next().done;){if(s.length>=t)return null;s.push(r.value)}return s}highlight(e,t,r,s){let n=So(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!n.next().done;)s(n.value.from,n.value.to)}}function _R(i,e,t){return(r,s,n)=>(!t||t(r,s,n))&&i(n[0],e,r,s)}function ko(i,e,t,r){let s;return i.wholeWord&&(s=bR(e.charCategorizer(e.selection.main.head))),i.test&&(s=_R(i.test,e,s)),new px(e.doc,i.search,{ignoreCase:!i.caseSensitive,test:s},t,r)}function su(i,e){return i.slice(ci(i,e,!1),e)}function nu(i,e){return i.slice(e,ci(i,e))}function bR(i){return(e,t,r)=>!r[0].length||(i(su(r.input,r.index))!=$t.Word||i(nu(r.input,r.index))!=$t.Word)&&(i(nu(r.input,r.index+r[0].length))!=$t.Word||i(su(r.input,r.index+r[0].length))!=$t.Word)}class yR extends vx{nextMatch(e,t,r){let s=ko(this.spec,e,r,e.doc.length).next();return s.done&&(s=ko(this.spec,e,0,t).next()),s.done?null:s.value}prevMatchInRange(e,t,r){for(let s=1;;s++){let n=Math.max(t,r-s*1e4),o=ko(this.spec,e,n,r),a=null;for(;!o.next().done;)a=o.value;if(a&&(n==t||a.from>n+10))return a;if(n==t)return null}}prevMatch(e,t,r){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let s=r.length;s>0;s--){let n=+r.slice(0,s);if(n>0&&n<e.match.length)return e.match[n]+r.slice(s)}return t})}matchAll(e,t){let r=ko(this.spec,e,0,e.doc.length),s=[];for(;!r.next().done;){if(s.length>=t)return null;s.push(r.value)}return s}highlight(e,t,r,s){let n=ko(this.spec,e,Math.max(0,t-250),Math.min(r+250,e.doc.length));for(;!n.next().done;)s(n.value.from,n.value.to)}}const El=He.define(),ng=He.define(),pn=ui.define({create(i){return new xd(vp(i).create(),null)},update(i,e){for(let t of e.effects)t.is(El)?i=new xd(t.value.create(),i.panel):t.is(ng)&&(i=new xd(i.query,t.value?og:null));return i},provide:i=>Ml.from(i,e=>e.panel)});class xd{constructor(e,t){this.query=e,this.panel=t}}const xR=ze.mark({class:"cm-searchMatch"}),wR=ze.mark({class:"cm-searchMatch cm-searchMatch-selected"}),SR=It.fromClass(class{constructor(i){this.view=i,this.decorations=this.highlight(i.state.field(pn))}update(i){let e=i.state.field(pn);(e!=i.startState.field(pn)||i.docChanged||i.selectionSet||i.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:i,panel:e}){if(!e||!i.spec.valid)return ze.none;let{view:t}=this,r=new Es;for(let s=0,n=t.visibleRanges,o=n.length;s<o;s++){let{from:a,to:l}=n[s];for(;s<o-1&&l>n[s+1].from-500;)l=n[++s].to;i.highlight(t.state,a,l,(c,h)=>{let u=t.state.selection.ranges.some(d=>d.from==c&&d.to==h);r.add(c,h,u?wR:xR)})}return r.finish()}},{decorations:i=>i.decorations});function uc(i){return e=>{let t=e.state.field(pn,!1);return t&&t.query.spec.valid?i(e,t):bx(e)}}const ou=uc((i,{query:e})=>{let{to:t}=i.state.selection.main,r=e.nextMatch(i.state,t,t);if(!r)return!1;let s=ue.single(r.from,r.to),n=i.state.facet(oa);return i.dispatch({selection:s,effects:[ag(i,r),n.scrollToMatch(s.main,i)],userEvent:"select.search"}),_x(i),!0}),au=uc((i,{query:e})=>{let{state:t}=i,{from:r}=t.selection.main,s=e.prevMatch(t,r,r);if(!s)return!1;let n=ue.single(s.from,s.to),o=i.state.facet(oa);return i.dispatch({selection:n,effects:[ag(i,s),o.scrollToMatch(n.main,i)],userEvent:"select.search"}),_x(i),!0}),kR=uc((i,{query:e})=>{let t=e.matchAll(i.state,1e3);return!t||!t.length?!1:(i.dispatch({selection:ue.create(t.map(r=>ue.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),CR=({state:i,dispatch:e})=>{let t=i.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:r,to:s}=t.main,n=[],o=0;for(let a=new Go(i.doc,i.sliceDoc(r,s));!a.next().done;){if(n.length>1e3)return!1;a.value.from==r&&(o=n.length),n.push(ue.range(a.value.from,a.value.to))}return e(i.update({selection:ue.create(n,o),userEvent:"select.search.matches"})),!0},z0=uc((i,{query:e})=>{let{state:t}=i,{from:r,to:s}=t.selection.main;if(t.readOnly)return!1;let n=e.nextMatch(t,r,r);if(!n)return!1;let o=n,a=[],l,c,h=[];o.from==r&&o.to==s&&(c=t.toText(e.getReplacement(o)),a.push({from:o.from,to:o.to,insert:c}),o=e.nextMatch(t,o.from,o.to),h.push(Pe.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(r).number)+".")));let u=i.state.changes(a);return o&&(l=ue.single(o.from,o.to).map(u),h.push(ag(i,o)),h.push(t.facet(oa).scrollToMatch(l.main,i))),i.dispatch({changes:u,selection:l,effects:h,userEvent:"input.replace"}),!0}),$R=uc((i,{query:e})=>{if(i.state.readOnly)return!1;let t=e.matchAll(i.state,1e9).map(s=>{let{from:n,to:o}=s;return{from:n,to:o,insert:e.getReplacement(s)}});if(!t.length)return!1;let r=i.state.phrase("replaced $ matches",t.length)+".";return i.dispatch({changes:t,effects:Pe.announce.of(r),userEvent:"input.replace.all"}),!0});function og(i){return i.state.facet(oa).createPanel(i)}function vp(i,e){var t,r,s,n,o;let a=i.selection.main,l=a.empty||a.to>a.from+100?"":i.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=i.facet(oa);return new gx({search:((t=e?.literal)!==null&&t!==void 0?t:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:c.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:c.literal,regexp:(n=e?.regexp)!==null&&n!==void 0?n:c.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function Ox(i){let e=qm(i,og);return e&&e.dom.querySelector("[main-field]")}function _x(i){let e=Ox(i);e&&e==i.root.activeElement&&e.select()}const bx=i=>{let e=i.state.field(pn,!1);if(e&&e.panel){let t=Ox(i);if(t&&t!=i.root.activeElement){let r=vp(i.state,e.query.spec);r.valid&&i.dispatch({effects:El.of(r)}),t.focus(),t.select()}}else i.dispatch({effects:[ng.of(!0),e?El.of(vp(i.state,e.query.spec)):He.appendConfig.of(QR)]});return!0},yx=i=>{let e=i.state.field(pn,!1);if(!e||!e.panel)return!1;let t=qm(i,og);return t&&t.dom.contains(i.root.activeElement)&&i.focus(),i.dispatch({effects:ng.of(!1)}),!0},PR=[{key:"Mod-f",run:bx,scope:"editor search-panel"},{key:"F3",run:ou,shift:au,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:ou,shift:au,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:yx,scope:"editor search-panel"},{key:"Mod-Shift-l",run:CR},{key:"Mod-Alt-g",run:sR},{key:"Mod-d",run:mR,preventDefault:!0}];class TR{constructor(e){this.view=e;let t=this.query=e.state.field(pn).query.spec;this.commit=this.commit.bind(this),this.searchField=mt("input",{value:t.search,placeholder:Ui(e,"Find"),"aria-label":Ui(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=mt("input",{value:t.replace,placeholder:Ui(e,"Replace"),"aria-label":Ui(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=mt("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=mt("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=mt("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function r(s,n,o){return mt("button",{class:"cm-button",name:s,onclick:n,type:"button"},o)}this.dom=mt("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,r("next",()=>ou(e),[Ui(e,"next")]),r("prev",()=>au(e),[Ui(e,"previous")]),r("select",()=>kR(e),[Ui(e,"all")]),mt("label",null,[this.caseField,Ui(e,"match case")]),mt("label",null,[this.reField,Ui(e,"regexp")]),mt("label",null,[this.wordField,Ui(e,"by word")]),...e.state.readOnly?[]:[mt("br"),this.replaceField,r("replace",()=>z0(e),[Ui(e,"replace")]),r("replaceAll",()=>$R(e),[Ui(e,"replace all")])],mt("button",{name:"close",onclick:()=>yx(e),"aria-label":Ui(e,"close"),type:"button"},["×"])])}commit(){let e=new gx({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:El.of(e)}))}keydown(e){AQ(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?au:ou)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),z0(this.view))}update(e){for(let t of e.transactions)for(let r of t.effects)r.is(El)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(oa).top}}function Ui(i,e){return i.state.phrase(e)}const Vc=30,qc=/[\s\.,:;?!]/;function ag(i,{from:e,to:t}){let r=i.state.doc.lineAt(e),s=i.state.doc.lineAt(t).to,n=Math.max(r.from,e-Vc),o=Math.min(s,t+Vc),a=i.state.sliceDoc(n,o);if(n!=r.from){for(let l=0;l<Vc;l++)if(!qc.test(a[l+1])&&qc.test(a[l])){a=a.slice(l);break}}if(o!=s){for(let l=a.length-1;l>a.length-Vc;l--)if(!qc.test(a[l-1])&&qc.test(a[l])){a=a.slice(0,l);break}}return Pe.announce.of(`${i.state.phrase("current match")}. ${a} ${i.state.phrase("on line")} ${r.number}.`)}const MR=Pe.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),QR=[pn,Ns.low(SR),MR];class lg{constructor(e,t,r,s){this.state=e,this.pos=t,this.explicit=r,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=bt(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),r=Math.max(t.from,this.pos-250),s=t.text.slice(r-t.from,this.pos-t.from),n=s.search(wx(e,!1));return n<0?null:{from:r+n,to:this.pos,text:s.slice(n)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function N0(i){let e=Object.keys(i).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function AR(i){let e=Object.create(null),t=Object.create(null);for(let{label:s}of i){e[s[0]]=!0;for(let n=1;n<s.length;n++)t[s[n]]=!0}let r=N0(e)+N0(t)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function xx(i){let e=i.map(s=>typeof s=="string"?{label:s}:s),[t,r]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:AR(e);return s=>{let n=s.matchBefore(r);return n||s.explicit?{from:n?n.from:s.pos,options:e,validFor:t}:null}}function RR(i,e){return t=>{for(let r=bt(t.state).resolveInner(t.pos,-1);r;r=r.parent){if(i.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(t)}}class W0{constructor(e,t,r,s){this.completion=e,this.source=t,this.match=r,this.score=s}}function Un(i){return i.selection.main.from}function wx(i,e){var t;let{source:r}=i,s=e&&r[0]!="^",n=r[r.length-1]!="$";return!s&&!n?i:new RegExp(`${s?"^":""}(?:${r})${n?"$":""}`,(t=i.flags)!==null&&t!==void 0?t:i.ignoreCase?"i":"")}const cg=Ws.define();function BR(i,e,t,r){let{main:s}=i.selection,n=t-s.from,o=r-s.from;return{...i.changeByRange(a=>{if(a!=s&&t!=r&&i.sliceDoc(a.from+n,a.from+o)!=i.sliceDoc(t,r))return{range:a};let l=i.toText(e);return{changes:{from:a.from+n,to:r==s.from?a.to:a.from+o,insert:l},range:ue.cursor(a.from+n+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const Z0=new WeakMap;function LR(i){if(!Array.isArray(i))return i;let e=Z0.get(i);return e||Z0.set(i,e=xx(i)),e}const lu=He.define(),Dl=He.define();class ER{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let r=Xi(e,t),s=Jr(r);this.chars.push(r);let n=e.slice(t,t+s),o=n.toUpperCase();this.folded.push(Xi(o==n?n.toLowerCase():o,0)),t+=s}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:r,any:s,precise:n,byWord:o}=this;if(t.length==1){let k=Xi(e,0),P=Jr(k),w=P==e.length?0:-100;if(k!=t[0])if(k==r[0])w+=-200;else return null;return this.ret(w,[0,P])}let a=e.indexOf(this.pattern);if(a==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=t.length,c=0;if(a<0){for(let k=0,P=Math.min(e.length,200);k<P&&c<l;){let w=Xi(e,k);(w==t[c]||w==r[c])&&(s[c++]=k),k+=Jr(w)}if(c<l)return null}let h=0,u=0,d=!1,f=0,p=-1,g=-1,O=/[a-z]/.test(e),_=!0;for(let k=0,P=Math.min(e.length,200),w=0;k<P&&u<l;){let C=Xi(e,k);a<0&&(h<l&&C==t[h]&&(n[h++]=k),f<l&&(C==t[f]||C==r[f]?(f==0&&(p=k),g=k+1,f++):f=0));let M,D=C<255?C>=48&&C<=57||C>=97&&C<=122?2:C>=65&&C<=90?1:0:(M=Pm(C))!=M.toLowerCase()?1:M!=M.toUpperCase()?2:0;(!k||D==1&&O||w==0&&D!=0)&&(t[u]==C||r[u]==C&&(d=!0)?o[u++]=k:o.length&&(_=!1)),w=D,k+=Jr(C)}return u==l&&o[0]==0&&_?this.result(-100+(d?-200:0),o,e):f==l&&p==0?this.ret(-200-e.length+(g==e.length?0:-100),[0,g]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):f==l?this.ret(-900-e.length,[p,g]):u==l?this.result(-100+(d?-200:0)+-700+(_?0:-1100),o,e):t.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,t,r){let s=[],n=0;for(let o of t){let a=o+(this.astral?Jr(Xi(r,o)):1);n&&s[n-1]==o?s[n-1]=a:(s[n++]=o,s[n++]=a)}return this.ret(e-r.length,s)}}class DR{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),r=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,t.length],this.score=r+(e.length==this.pattern.length?0:-100),this)}}const li=Ae.define({combine(i){return fs(i,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:IR,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>r=>X0(e(r),t(r)),optionClass:(e,t)=>r=>X0(e(r),t(r)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function X0(i,e){return i?e?i+" "+e:i:e}function IR(i,e,t,r,s,n){let o=i.textDirection==_t.RTL,a=o,l=!1,c="top",h,u,d=e.left-s.left,f=s.right-e.right,p=r.right-r.left,g=r.bottom-r.top;if(a&&d<Math.min(p,f)?a=!1:!a&&f<Math.min(p,d)&&(a=!0),p<=(a?d:f))h=Math.max(s.top,Math.min(t.top,s.bottom-g))-e.top,u=Math.min(400,a?d:f);else{l=!0,u=Math.min(400,(o?e.right:s.right-e.left)-30);let k=s.bottom-e.bottom;k>=g||k>e.top?h=t.bottom-e.top:(c="bottom",h=e.bottom-t.top)}let O=(e.bottom-e.top)/n.offsetHeight,_=(e.right-e.left)/n.offsetWidth;return{style:`${c}: ${h/O}px; max-width: ${u/_}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}function zR(i){let e=i.addToOptions.slice();return i.icons&&e.push({render(t){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),t.type&&r.classList.add(...t.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(t,r,s,n){let o=document.createElement("span");o.className="cm-completionLabel";let a=t.displayLabel||t.label,l=0;for(let c=0;c<n.length;){let h=n[c++],u=n[c++];h>l&&o.appendChild(document.createTextNode(a.slice(l,h)));let d=o.appendChild(document.createElement("span"));d.appendChild(document.createTextNode(a.slice(h,u))),d.className="cm-completionMatchedText",l=u}return l<a.length&&o.appendChild(document.createTextNode(a.slice(l))),o},position:50},{render(t){if(!t.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=t.detail,r},position:80}),e.sort((t,r)=>t.position-r.position).map(t=>t.render)}function wd(i,e,t){if(i<=t)return{from:0,to:i};if(e<0&&(e=0),e<=i>>1){let s=Math.floor(e/t);return{from:s*t,to:(s+1)*t}}let r=Math.floor((i-e)/t);return{from:i-(r+1)*t,to:i-r*t}}class NR{constructor(e,t,r){this.view=e,this.stateField=t,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let s=e.state.field(t),{options:n,selected:o}=s.open,a=e.state.facet(li);this.optionContent=zR(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=wd(n.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:c}=e.state.field(t).open;for(let h=l.target,u;h&&h!=this.dom;h=h.parentNode)if(h.nodeName=="LI"&&(u=/-(\d+)$/.exec(h.id))&&+u[1]<c.length){this.applyCompletion(e,c[+u[1]]),l.preventDefault();return}}),this.dom.addEventListener("focusout",l=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(li).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:Dl.of(null)})}),this.showOptions(n,s.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let r=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=s){let{options:n,selected:o,disabled:a}=r.open;(!s.open||s.open.options!=n)&&(this.range=wd(n.length,o,e.state.facet(li).maxRenderedOptions),this.showOptions(n,r.id)),this.updateSel(),a!=((t=s.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of t.split(" "))r&&this.dom.classList.add(r);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=wd(t.options.length,t.selected,this.view.state.facet(li).maxRenderedOptions),this.showOptions(t.options,e.id));let r=this.updateSelectedOption(t.selected);if(r){this.destroyInfo();let{completion:s}=t.options[t.selected],{info:n}=s;if(!n)return;let o=typeof n=="string"?document.createTextNode(n):n(s);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(a,s)}).catch(a=>qi(this.view.state,a,"completion info")):(this.addInfoPane(o,s),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:n}=e;r.appendChild(s),this.infoDestroy=n||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let r=this.list.firstChild,s=this.range.from;r;r=r.nextSibling,s++)r.nodeName!="LI"||!r.id?s--:s==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),t=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return t&&ZR(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),n=this.space;if(!n){let o=this.dom.ownerDocument.documentElement;n={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return s.top>Math.min(n.bottom,t.bottom)-10||s.bottom<Math.max(n.top,t.top)+10?null:this.view.state.facet(li).positionInfo(this.view,t,s,r,n,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,r){const s=document.createElement("ul");s.id=t,s.setAttribute("role","listbox"),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-label",this.view.state.phrase("Completions")),s.addEventListener("mousedown",o=>{o.target==s&&o.preventDefault()});let n=null;for(let o=r.from;o<r.to;o++){let{completion:a,match:l}=e[o],{section:c}=a;if(c){let d=typeof c=="string"?c:c.name;if(d!=n&&(o>r.from||r.from==0))if(n=d,typeof c!="string"&&c.header)s.appendChild(c.header(c));else{let f=s.appendChild(document.createElement("completion-section"));f.textContent=d}}const h=s.appendChild(document.createElement("li"));h.id=t+"-"+o,h.setAttribute("role","option");let u=this.optionClass(a);u&&(h.className=u);for(let d of this.optionContent){let f=d(a,this.view.state,this.view,l);f&&h.appendChild(f)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.to<e.length&&s.classList.add("cm-completionListIncompleteBottom"),s}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function WR(i,e){return t=>new NR(t,i,e)}function ZR(i,e){let t=i.getBoundingClientRect(),r=e.getBoundingClientRect(),s=t.height/i.offsetHeight;r.top<t.top?i.scrollTop-=(t.top-r.top)/s:r.bottom>t.bottom&&(i.scrollTop+=(r.bottom-t.bottom)/s)}function F0(i){return(i.boost||0)*100+(i.apply?10:0)+(i.info?5:0)+(i.type?1:0)}function XR(i,e){let t=[],r=null,s=null,n=h=>{t.push(h);let{section:u}=h.completion;if(u){r||(r=[]);let d=typeof u=="string"?u:u.name;r.some(f=>f.name==d)||r.push(typeof u=="string"?{name:d}:u)}},o=e.facet(li);for(let h of i)if(h.hasResult()){let u=h.result.getMatch;if(h.result.filter===!1)for(let d of h.result.options)n(new W0(d,h.source,u?u(d):[],1e9-t.length));else{let d=e.sliceDoc(h.from,h.to),f,p=o.filterStrict?new DR(d):new ER(d);for(let g of h.result.options)if(f=p.match(g.label)){let O=g.displayLabel?u?u(g,f.matched):[]:f.matched,_=f.score+(g.boost||0);if(n(new W0(g,h.source,O,_)),typeof g.section=="object"&&g.section.rank==="dynamic"){let{name:k}=g.section;s||(s=Object.create(null)),s[k]=Math.max(_,s[k]||-1e9)}}}}if(r){let h=Object.create(null),u=0,d=(f,p)=>(f.rank==="dynamic"&&p.rank==="dynamic"?s[p.name]-s[f.name]:0)||(typeof f.rank=="number"?f.rank:1e9)-(typeof p.rank=="number"?p.rank:1e9)||(f.name<p.name?-1:1);for(let f of r.sort(d))u-=1e5,h[f.name]=u;for(let f of t){let{section:p}=f.completion;p&&(f.score+=h[typeof p=="string"?p:p.name])}}let a=[],l=null,c=o.compareCompletions;for(let h of t.sort((u,d)=>d.score-u.score||c(u.completion,d.completion))){let u=h.completion;!l||l.label!=u.label||l.detail!=u.detail||l.type!=null&&u.type!=null&&l.type!=u.type||l.apply!=u.apply||l.boost!=u.boost?a.push(h):F0(h.completion)>F0(l)&&(a[a.length-1]=h),l=h.completion}return a}class To{constructor(e,t,r,s,n,o){this.options=e,this.attrs=t,this.tooltip=r,this.timestamp=s,this.selected=n,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new To(this.options,V0(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,r,s,n,o){if(s&&!o&&e.some(c=>c.isPending))return s.setDisabled();let a=XR(e,t);if(!a.length)return s&&e.some(c=>c.isPending)?s.setDisabled():null;let l=t.facet(li).selectOnOpen?0:-1;if(s&&s.selected!=l&&s.selected!=-1){let c=s.options[s.selected].completion;for(let h=0;h<a.length;h++)if(a[h].completion==c){l=h;break}}return new To(a,V0(r,l),{pos:e.reduce((c,h)=>h.hasResult()?Math.min(c,h.from):c,1e8),create:YR,above:n.aboveCursor},s?s.timestamp:Date.now(),l,!1)}map(e){return new To(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new To(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class cu{constructor(e,t,r){this.active=e,this.id=t,this.open=r}static start(){return new cu(HR,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,r=t.facet(li),n=(r.override||t.languageDataAt("autocomplete",Un(t)).map(LR)).map(l=>(this.active.find(h=>h.source==l)||new yr(l,this.active.some(h=>h.state!=0)?1:0)).update(e,r));n.length==this.active.length&&n.every((l,c)=>l==this.active[c])&&(n=this.active);let o=this.open,a=e.effects.some(l=>l.is(hg));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||n.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!FR(n,this.active)||a?o=To.build(n,t,this.id,o,r,a):o&&o.disabled&&!n.some(l=>l.isPending)&&(o=null),!o&&n.every(l=>!l.isPending)&&n.some(l=>l.hasResult())&&(n=n.map(l=>l.hasResult()?new yr(l.source,0):l));for(let l of e.effects)l.is(kx)&&(o=o&&o.setSelected(l.value,this.id));return n==this.active&&o==this.open?this:new cu(n,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?VR:qR}}function FR(i,e){if(i==e)return!0;for(let t=0,r=0;;){for(;t<i.length&&!i[t].hasResult();)t++;for(;r<e.length&&!e[r].hasResult();)r++;let s=t==i.length,n=r==e.length;if(s||n)return s==n;if(i[t++].result!=e[r++].result)return!1}}const VR={"aria-autocomplete":"list"},qR={};function V0(i,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":i};return e>-1&&(t["aria-activedescendant"]=i+"-"+e),t}const HR=[];function Sx(i,e){if(i.isUserEvent("input.complete")){let r=i.annotation(cg);if(r&&e.activateOnCompletion(r))return 12}let t=i.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:i.isUserEvent("delete.backward")?2:i.selection?8:i.docChanged?16:0}class yr{constructor(e,t,r=!1){this.source=e,this.state=t,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let r=Sx(e,t),s=this;(r&8||r&16&&this.touches(e))&&(s=new yr(s.source,0)),r&4&&s.state==0&&(s=new yr(this.source,1)),s=s.updateFor(e,r);for(let n of e.effects)if(n.is(lu))s=new yr(s.source,1,n.value);else if(n.is(Dl))s=new yr(s.source,0);else if(n.is(hg))for(let o of n.value)o.source==s.source&&(s=o);return s}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Un(e.state))}}class No extends yr{constructor(e,t,r,s,n,o){super(e,3,t),this.limit=r,this.result=s,this.from=n,this.to=o}hasResult(){return!0}updateFor(e,t){var r;if(!(t&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let n=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=Un(e.state);if(a>o||!s||t&2&&(Un(e.startState)==this.from||a<this.limit))return new yr(this.source,t&4?1:0);let l=e.changes.mapPos(this.limit);return UR(s.validFor,e.state,n,o)?new No(this.source,this.explicit,l,s,n,o):s.update&&(s=s.update(s,n,o,new lg(e.state,a,!1)))?new No(this.source,this.explicit,l,s,s.from,(r=s.to)!==null&&r!==void 0?r:Un(e.state)):new yr(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new No(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new yr(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function UR(i,e,t,r){if(!i)return!1;let s=e.sliceDoc(t,r);return typeof i=="function"?i(s,t,r,e):wx(i,!0).test(s)}const hg=He.define({map(i,e){return i.map(t=>t.map(e))}}),kx=He.define(),Fi=ui.define({create(){return cu.start()},update(i,e){return i.update(e)},provide:i=>[Vm.from(i,e=>e.tooltip),Pe.contentAttributes.from(i,e=>e.attrs)]});function ug(i,e){const t=e.completion.apply||e.completion.label;let r=i.state.field(Fi).active.find(s=>s.source==e.source);return r instanceof No?(typeof t=="string"?i.dispatch({...BR(i.state,t,r.from,r.to),annotations:cg.of(e.completion)}):t(i,e.completion,r.from,r.to),!0):!1}const YR=WR(Fi,ug);function Hc(i,e="option"){return t=>{let r=t.state.field(Fi,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<t.state.facet(li).interactionDelay)return!1;let s=1,n;e=="page"&&(n=sy(t,r.open.tooltip))&&(s=Math.max(2,Math.floor(n.dom.offsetHeight/n.dom.querySelector("li").offsetHeight)-1));let{length:o}=r.open.options,a=r.open.selected>-1?r.open.selected+s*(i?1:-1):i?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),t.dispatch({effects:kx.of(a)}),!0}}const jR=i=>{let e=i.state.field(Fi,!1);return i.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<i.state.facet(li).interactionDelay?!1:ug(i,e.open.options[e.open.selected])},Sd=i=>i.state.field(Fi,!1)?(i.dispatch({effects:lu.of(!0)}),!0):!1,GR=i=>{let e=i.state.field(Fi,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(i.dispatch({effects:Dl.of(null)}),!0)};class KR{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const JR=50,eB=1e3,tB=It.fromClass(class{constructor(i){this.view=i,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of i.state.field(Fi).active)e.isPending&&this.startQuery(e)}update(i){let e=i.state.field(Fi),t=i.state.facet(li);if(!i.selectionSet&&!i.docChanged&&i.startState.field(Fi)==e)return;let r=i.transactions.some(n=>{let o=Sx(n,t);return o&8||(n.selection||n.docChanged)&&!(o&3)});for(let n=0;n<this.running.length;n++){let o=this.running[n];if(r||o.context.abortOnDocChange&&i.docChanged||o.updates.length+i.transactions.length>JR&&Date.now()-o.time>eB){for(let a of o.context.abortListeners)try{a()}catch(l){qi(this.view.state,l)}o.context.abortListeners=null,this.running.splice(n--,1)}else o.updates.push(...i.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),i.transactions.some(n=>n.effects.some(o=>o.is(lu)))&&(this.pendingStart=!0);let s=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(n=>n.isPending&&!this.running.some(o=>o.active.source==n.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let n of i.transactions)n.isUserEvent("input.type")?this.composing=2:this.composing==2&&n.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:i}=this.view,e=i.field(Fi);for(let t of e.active)t.isPending&&!this.running.some(r=>r.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(li).updateSyncTime))}startQuery(i){let{state:e}=this.view,t=Un(e),r=new lg(e,t,i.explicit,this.view),s=new KR(i,r);this.running.push(s),Promise.resolve(i.source(r)).then(n=>{s.context.aborted||(s.done=n||null,this.scheduleAccept())},n=>{this.view.dispatch({effects:Dl.of(null)}),qi(this.view.state,n)})}scheduleAccept(){this.running.every(i=>i.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(li).updateSyncTime))}accept(){var i;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(li),r=this.view.state.field(Fi);for(let s=0;s<this.running.length;s++){let n=this.running[s];if(n.done===void 0)continue;if(this.running.splice(s--,1),n.done){let a=Un(n.updates.length?n.updates[0].startState:this.view.state),l=Math.min(a,n.done.from+(n.active.explicit?0:1)),c=new No(n.active.source,n.active.explicit,l,n.done,n.done.from,(i=n.done.to)!==null&&i!==void 0?i:a);for(let h of n.updates)c=c.update(h,t);if(c.hasResult()){e.push(c);continue}}let o=r.active.find(a=>a.source==n.active.source);if(o&&o.isPending)if(n.done==null){let a=new yr(n.active.source,0);for(let l of n.updates)a=a.update(l,t);a.isPending||e.push(a)}else this.startQuery(o)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:hg.of(e)})}},{eventHandlers:{blur(i){let e=this.view.state.field(Fi,!1);if(e&&e.tooltip&&this.view.state.facet(li).closeOnBlur){let t=e.open&&sy(this.view,e.open.tooltip);(!t||!t.dom.contains(i.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Dl.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:lu.of(!1)}),20),this.composing=0}}}),iB=typeof navigator=="object"&&/Win/.test(navigator.platform),rB=Ns.highest(Pe.domEventHandlers({keydown(i,e){let t=e.state.field(Fi,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||i.key.length>1||i.ctrlKey&&!(iB&&i.altKey)||i.metaKey)return!1;let r=t.open.options[t.open.selected],s=t.active.find(o=>o.source==r.source),n=r.completion.commitCharacters||s.result.commitCharacters;return n&&n.indexOf(i.key)>-1&&ug(e,r),!1}})),Cx=Pe.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class sB{constructor(e,t,r,s){this.field=e,this.line=t,this.from=r,this.to=s}}class dg{constructor(e,t,r){this.field=e,this.from=t,this.to=r}map(e){let t=e.mapPos(this.from,-1,vi.TrackDel),r=e.mapPos(this.to,1,vi.TrackDel);return t==null||r==null?null:new dg(this.field,t,r)}}class fg{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let r=[],s=[t],n=e.doc.lineAt(t),o=/^\s*/.exec(n.text)[0];for(let l of this.lines){if(r.length){let c=o,h=/^\t*/.exec(l)[0].length;for(let u=0;u<h;u++)c+=e.facet(oc);s.push(t+c.length-h),l=c+l.slice(h)}r.push(l),t+=l.length+1}let a=this.fieldPositions.map(l=>new dg(l.field,s[l.line]+l.from,s[l.line]+l.to));return{text:r,ranges:a}}static parse(e){let t=[],r=[],s=[],n;for(let o of e.split(/\r\n?|\n/)){for(;n=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let a=n[1]?+n[1]:null,l=n[2]||n[3]||"",c=-1,h=l.replace(/\\[{}]/g,u=>u[1]);for(let u=0;u<t.length;u++)(a!=null?t[u].seq==a:h&&t[u].name==h)&&(c=u);if(c<0){let u=0;for(;u<t.length&&(a==null||t[u].seq!=null&&t[u].seq<a);)u++;t.splice(u,0,{seq:a,name:h}),c=u;for(let d of s)d.field>=c&&d.field++}for(let u of s)if(u.line==r.length&&u.from>n.index){let d=n[2]?3+(n[1]||"").length:2;u.from-=d,u.to-=d}s.push(new sB(c,r.length,n.index,n.index+h.length)),o=o.slice(0,n.index)+l+o.slice(n.index+n[0].length)}o=o.replace(/\\([{}])/g,(a,l,c)=>{for(let h of s)h.line==r.length&&h.from>c&&(h.from--,h.to--);return l}),r.push(o)}return new fg(r,s)}}let nB=ze.widget({widget:new class extends ps{toDOM(){let i=document.createElement("span");return i.className="cm-snippetFieldPosition",i}ignoreEvent(){return!1}}}),oB=ze.mark({class:"cm-snippetField"});class aa{constructor(e,t){this.ranges=e,this.active=t,this.deco=ze.set(e.map(r=>(r.from==r.to?nB:oB).range(r.from,r.to)),!0)}map(e){let t=[];for(let r of this.ranges){let s=r.map(e);if(!s)return null;t.push(s)}return new aa(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(r=>r.field==this.active&&r.from<=t.from&&r.to>=t.to))}}const dc=He.define({map(i,e){return i&&i.map(e)}}),aB=He.define(),Il=ui.define({create(){return null},update(i,e){for(let t of e.effects){if(t.is(dc))return t.value;if(t.is(aB)&&i)return new aa(i.ranges,t.value)}return i&&e.docChanged&&(i=i.map(e.changes)),i&&e.selection&&!i.selectionInsideField(e.selection)&&(i=null),i},provide:i=>Pe.decorations.from(i,e=>e?e.deco:ze.none)});function pg(i,e){return ue.create(i.filter(t=>t.field==e).map(t=>ue.range(t.from,t.to)))}function lB(i){let e=fg.parse(i);return(t,r,s,n)=>{let{text:o,ranges:a}=e.instantiate(t.state,s),{main:l}=t.state.selection,c={changes:{from:s,to:n==l.from?l.to:n,insert:ct.of(o)},scrollIntoView:!0,annotations:r?[cg.of(r),Ft.userEvent.of("input.complete")]:void 0};if(a.length&&(c.selection=pg(a,0)),a.some(h=>h.field>0)){let h=new aa(a,0),u=c.effects=[dc.of(h)];t.state.field(Il,!1)===void 0&&u.push(He.appendConfig.of([Il,fB,pB,Cx]))}t.dispatch(t.state.update(c))}}function $x(i){return({state:e,dispatch:t})=>{let r=e.field(Il,!1);if(!r||i<0&&r.active==0)return!1;let s=r.active+i,n=i>0&&!r.ranges.some(o=>o.field==s+i);return t(e.update({selection:pg(r.ranges,s),effects:dc.of(n?null:new aa(r.ranges,s)),scrollIntoView:!0})),!0}}const cB=({state:i,dispatch:e})=>i.field(Il,!1)?(e(i.update({effects:dc.of(null)})),!0):!1,hB=$x(1),uB=$x(-1),dB=[{key:"Tab",run:hB,shift:uB},{key:"Escape",run:cB}],q0=Ae.define({combine(i){return i.length?i[0]:dB}}),fB=Ns.highest(rc.compute([q0],i=>i.facet(q0)));function Wi(i,e){return{...e,apply:lB(i)}}const pB=Pe.domEventHandlers({mousedown(i,e){let t=e.state.field(Il,!1),r;if(!t||(r=e.posAtCoords({x:i.clientX,y:i.clientY}))==null)return!1;let s=t.ranges.find(n=>n.from<=r&&n.to>=r);return!s||s.field==t.active?!1:(e.dispatch({selection:pg(t.ranges,s.field),effects:dc.of(t.ranges.some(n=>n.field>s.field)?new aa(t.ranges,s.field):null),scrollIntoView:!0}),!0)}}),zl={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Fn=He.define({map(i,e){let t=e.mapPos(i,-1,vi.TrackAfter);return t??void 0}}),mg=new class extends On{};mg.startSide=1;mg.endSide=-1;const Px=ui.define({create(){return it.empty},update(i,e){if(i=i.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);i=i.update({filter:r=>r>=t.from&&r<=t.to})}for(let t of e.effects)t.is(Fn)&&(i=i.update({add:[mg.range(t.value,t.value+1)]}));return i}});function mB(){return[vB,Px]}const kd="()[]{}<>«»»«[]{}";function Tx(i){for(let e=0;e<kd.length;e+=2)if(kd.charCodeAt(e)==i)return kd.charAt(e+1);return Pm(i<128?i:i+1)}function Mx(i,e){return i.languageDataAt("closeBrackets",e)[0]||zl}const gB=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),vB=Pe.inputHandler.of((i,e,t,r)=>{if((gB?i.composing:i.compositionStarted)||i.state.readOnly)return!1;let s=i.state.selection.main;if(r.length>2||r.length==2&&Jr(Xi(r,0))==1||e!=s.from||t!=s.to)return!1;let n=bB(i.state,r);return n?(i.dispatch(n),!0):!1}),OB=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let r=Mx(i,i.selection.main.head).brackets||zl.brackets,s=null,n=i.changeByRange(o=>{if(o.empty){let a=yB(i.doc,o.head);for(let l of r)if(l==a&&Vu(i.doc,o.head)==Tx(Xi(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:ue.cursor(o.head-l.length)}}return{range:s=o}});return s||e(i.update(n,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},_B=[{key:"Backspace",run:OB}];function bB(i,e){let t=Mx(i,i.selection.main.head),r=t.brackets||zl.brackets;for(let s of r){let n=Tx(Xi(s,0));if(e==s)return n==s?SB(i,s,r.indexOf(s+s+s)>-1,t):xB(i,s,n,t.before||zl.before);if(e==n&&Qx(i,i.selection.main.from))return wB(i,s,n)}return null}function Qx(i,e){let t=!1;return i.field(Px).between(0,i.doc.length,r=>{r==e&&(t=!0)}),t}function Vu(i,e){let t=i.sliceString(e,e+2);return t.slice(0,Jr(Xi(t,0)))}function yB(i,e){let t=i.sliceString(e-2,e);return Jr(Xi(t,0))==t.length?t:t.slice(1)}function xB(i,e,t,r){let s=null,n=i.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:Fn.of(o.to+e.length),range:ue.range(o.anchor+e.length,o.head+e.length)};let a=Vu(i.doc,o.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:e+t,from:o.head},effects:Fn.of(o.head+e.length),range:ue.cursor(o.head+e.length)}:{range:s=o}});return s?null:i.update(n,{scrollIntoView:!0,userEvent:"input.type"})}function wB(i,e,t){let r=null,s=i.changeByRange(n=>n.empty&&Vu(i.doc,n.head)==t?{changes:{from:n.head,to:n.head+t.length,insert:t},range:ue.cursor(n.head+t.length)}:r={range:n});return r?null:i.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function SB(i,e,t,r){let s=r.stringPrefixes||zl.stringPrefixes,n=null,o=i.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:Fn.of(a.to+e.length),range:ue.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=Vu(i.doc,l),h;if(c==e){if(H0(i,l))return{changes:{insert:e+e,from:l},effects:Fn.of(l+e.length),range:ue.cursor(l+e.length)};if(Qx(i,l)){let d=t&&i.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+d.length,insert:d},range:ue.cursor(l+d.length)}}}else{if(t&&i.sliceDoc(l-2*e.length,l)==e+e&&(h=U0(i,l-2*e.length,s))>-1&&H0(i,h))return{changes:{insert:e+e+e+e,from:l},effects:Fn.of(l+e.length),range:ue.cursor(l+e.length)};if(i.charCategorizer(l)(c)!=$t.Word&&U0(i,l,s)>-1&&!kB(i,l,e,s))return{changes:{insert:e+e,from:l},effects:Fn.of(l+e.length),range:ue.cursor(l+e.length)}}return{range:n=a}});return n?null:i.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function H0(i,e){let t=bt(i).resolveInner(e+1);return t.parent&&t.from==e}function kB(i,e,t,r){let s=bt(i).resolveInner(e,-1),n=r.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=i.sliceDoc(s.from,Math.min(s.to,s.from+t.length+n)),l=a.indexOf(t);if(!l||l>-1&&r.indexOf(a.slice(0,l))>-1){let h=s.firstChild;for(;h&&h.from==s.from&&h.to-h.from>t.length+l;){if(i.sliceDoc(h.to-t.length,h.to)==t)return!1;h=h.firstChild}return!0}let c=s.to==e&&s.parent;if(!c)break;s=c}return!1}function U0(i,e,t){let r=i.charCategorizer(e);if(r(i.sliceDoc(e-1,e))!=$t.Word)return e;for(let s of t){let n=e-s.length;if(i.sliceDoc(n,e)==s&&r(i.sliceDoc(n-1,n))!=$t.Word)return n}return-1}function CB(i={}){return[rB,Fi,li.of(i),tB,$B,Cx]}const Ax=[{key:"Ctrl-Space",run:Sd},{mac:"Alt-`",run:Sd},{mac:"Alt-i",run:Sd},{key:"Escape",run:GR},{key:"ArrowDown",run:Hc(!0)},{key:"ArrowUp",run:Hc(!1)},{key:"PageDown",run:Hc(!0,"page")},{key:"PageUp",run:Hc(!1,"page")},{key:"Enter",run:jR}],$B=Ns.highest(rc.computeN([li],i=>i.facet(li).defaultKeymap?[Ax]:[]));class Y0{constructor(e,t,r){this.from=e,this.to=t,this.diagnostic=r}}class zn{constructor(e,t,r){this.diagnostics=e,this.panel=t,this.selected=r}static init(e,t,r){let s=r.facet(Nl).markerFilter;s&&(e=s(e,r));let n=e.slice().sort((f,p)=>f.from-p.from||f.to-p.to),o=new Es,a=[],l=0,c=r.doc.iter(),h=0,u=r.doc.length;for(let f=0;;){let p=f==n.length?null:n[f];if(!p&&!a.length)break;let g,O;if(a.length)g=l,O=a.reduce((P,w)=>Math.min(P,w.to),p&&p.from>g?p.from:1e8);else{if(g=p.from,g>u)break;O=p.to,a.push(p),f++}for(;f<n.length;){let P=n[f];if(P.from==g&&(P.to>P.from||P.to==g))a.push(P),f++,O=Math.min(P.to,O);else{O=Math.min(P.from,O);break}}O=Math.min(O,u);let _=!1;if(a.some(P=>P.from==g&&(P.to==O||O==u))&&(_=g==O,!_&&O-g<10)){let P=g-(h+c.value.length);P>0&&(c.next(P),h=g);for(let w=g;;){if(w>=O){_=!0;break}if(!c.lineBreak&&h+c.value.length>w)break;w=h+c.value.length,h+=c.value.length,c.next()}}let k=NB(a);if(_)o.add(g,g,ze.widget({widget:new EB(k),diagnostics:a.slice()}));else{let P=a.reduce((w,C)=>C.markClass?w+" "+C.markClass:w,"");o.add(g,O,ze.mark({class:"cm-lintRange cm-lintRange-"+k+P,diagnostics:a.slice(),inclusiveEnd:a.some(w=>w.to>O)}))}if(l=O,l==u)break;for(let P=0;P<a.length;P++)a[P].to<=l&&a.splice(P--,1)}let d=o.finish();return new zn(d,t,Sn(d))}}function Sn(i,e=null,t=0){let r=null;return i.between(t,1e9,(s,n,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!r)r=new Y0(s,n,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new Y0(r.from,n,r.diagnostic)}}),r}function PB(i,e){let t=e.pos,r=e.end||t,s=i.state.facet(Nl).hideOn(i,t,r);if(s!=null)return s;let n=i.startState.doc.lineAt(e.pos);return!!(i.effects.some(o=>o.is(Rx))||i.changes.touchesRange(n.from,Math.max(n.to,r)))}function TB(i,e){return i.field(sr,!1)?e:e.concat(He.appendConfig.of(WB))}const Rx=He.define(),gg=He.define(),Bx=He.define(),sr=ui.define({create(){return new zn(ze.none,null,null)},update(i,e){if(e.docChanged&&i.diagnostics.size){let t=i.diagnostics.map(e.changes),r=null,s=i.panel;if(i.selected){let n=e.changes.mapPos(i.selected.from,1);r=Sn(t,i.selected.diagnostic,n)||Sn(t,null,n)}!t.size&&s&&e.state.facet(Nl).autoPanel&&(s=null),i=new zn(t,s,r)}for(let t of e.effects)if(t.is(Rx)){let r=e.state.facet(Nl).autoPanel?t.value.length?Wl.open:null:i.panel;i=zn.init(t.value,r,e.state)}else t.is(gg)?i=new zn(i.diagnostics,t.value?Wl.open:null,i.selected):t.is(Bx)&&(i=new zn(i.diagnostics,i.panel,t.value));return i},provide:i=>[Ml.from(i,e=>e.panel),Pe.decorations.from(i,e=>e.diagnostics)]}),MB=ze.mark({class:"cm-lintRange cm-lintRange-active"});function QB(i,e,t){let{diagnostics:r}=i.state.field(sr),s,n=-1,o=-1;r.between(e-(t<0?1:0),e+(t>0?1:0),(l,c,{spec:h})=>{if(e>=l&&e<=c&&(l==c||(e>l||t>0)&&(e<c||t<0)))return s=h.diagnostics,n=l,o=c,!1});let a=i.state.facet(Nl).tooltipFilter;return s&&a&&(s=a(s,i.state)),s?{pos:n,end:o,above:i.state.doc.lineAt(n).to<o,create(){return{dom:AB(i,s)}}}:null}function AB(i,e){return mt("ul",{class:"cm-tooltip-lint"},e.map(t=>Ex(i,t,!1)))}const RB=i=>{let e=i.state.field(sr,!1);(!e||!e.panel)&&i.dispatch({effects:TB(i.state,[gg.of(!0)])});let t=qm(i,Wl.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},j0=i=>{let e=i.state.field(sr,!1);return!e||!e.panel?!1:(i.dispatch({effects:gg.of(!1)}),!0)},BB=i=>{let e=i.state.field(sr,!1);if(!e)return!1;let t=i.state.selection.main,r=Sn(e.diagnostics,null,t.to+1);return!r&&(r=Sn(e.diagnostics,null,0),!r||r.from==t.from&&r.to==t.to)?!1:(i.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},LB=[{key:"Mod-Shift-m",run:RB,preventDefault:!0},{key:"F8",run:BB}],Nl=Ae.define({combine(i){return{sources:i.map(e=>e.source).filter(e=>e!=null),...fs(i.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:G0,tooltipFilter:G0,needsRefresh:(e,t)=>e?t?r=>e(r)||t(r):e:t,hideOn:(e,t)=>e?t?(r,s,n)=>e(r,s,n)||t(r,s,n):e:t,autoPanel:(e,t)=>e||t})}}});function G0(i,e){return i?e?(t,r)=>e(i(t,r),r):i:e}function Lx(i){let e=[];if(i)e:for(let{name:t}of i){for(let r=0;r<t.length;r++){let s=t[r];if(/[a-zA-Z]/.test(s)&&!e.some(n=>n.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function Ex(i,e,t){var r;let s=t?Lx(e.actions):[];return mt("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},mt("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(i):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((n,o)=>{let a=!1,l=f=>{if(f.preventDefault(),a)return;a=!0;let p=Sn(i.state.field(sr).diagnostics,e);p&&n.apply(i,p.from,p.to)},{name:c}=n,h=s[o]?c.indexOf(s[o]):-1,u=h<0?c:[c.slice(0,h),mt("u",c.slice(h,h+1)),c.slice(h+1)],d=n.markClass?" "+n.markClass:"";return mt("button",{type:"button",class:"cm-diagnosticAction"+d,onclick:l,onmousedown:l,"aria-label":` Action: ${c}${h<0?"":` (access key "${s[o]})"`}.`},u)}),e.source&&mt("div",{class:"cm-diagnosticSource"},e.source))}class EB extends ps{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return mt("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class K0{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Ex(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Wl{constructor(e){this.view=e,this.items=[];let t=s=>{if(!(s.ctrlKey||s.altKey||s.metaKey)){if(s.keyCode==27)j0(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:n}=this.items[this.selectedIndex],o=Lx(n.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==s.keyCode){let l=Sn(this.view.state.field(sr).diagnostics,n);l&&n.actions[a].apply(e,l.from,l.to)}}else return;s.preventDefault()}},r=s=>{for(let n=0;n<this.items.length;n++)this.items[n].dom.contains(s.target)&&this.moveSelection(n)};this.list=mt("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:r}),this.dom=mt("div",{class:"cm-panel-lint"},this.list,mt("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>j0(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(sr).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(sr),r=0,s=!1,n=null,o=new Set;for(e.between(0,this.view.state.doc.length,(a,l,{spec:c})=>{for(let h of c.diagnostics){if(o.has(h))continue;o.add(h);let u=-1,d;for(let f=r;f<this.items.length;f++)if(this.items[f].diagnostic==h){u=f;break}u<0?(d=new K0(this.view,h),this.items.splice(r,0,d),s=!0):(d=this.items[u],u>r&&(this.items.splice(r,u-r),s=!0)),t&&d.diagnostic==t.diagnostic?d.dom.hasAttribute("aria-selected")||(d.dom.setAttribute("aria-selected","true"),n=d):d.dom.hasAttribute("aria-selected")&&d.dom.removeAttribute("aria-selected"),r++}});r<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)s=!0,this.items.pop();this.items.length==0&&(this.items.push(new K0(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),n?(this.list.setAttribute("aria-activedescendant",n.id),this.view.requestMeasure({key:this,read:()=>({sel:n.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:a,panel:l})=>{let c=l.height/this.list.offsetHeight;a.top<l.top?this.list.scrollTop-=(l.top-a.top)/c:a.bottom>l.bottom&&(this.list.scrollTop+=(a.bottom-l.bottom)/c)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function t(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)t();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(sr),r=Sn(t.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:Bx.of(r)})}static open(e){return new Wl(e)}}function DB(i,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(i)}</svg>')`}function Uc(i){return DB(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${i}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const IB=Pe.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Uc("#d11")},".cm-lintRange-warning":{backgroundImage:Uc("orange")},".cm-lintRange-info":{backgroundImage:Uc("#999")},".cm-lintRange-hint":{backgroundImage:Uc("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function zB(i){return i=="error"?4:i=="warning"?3:i=="info"?2:1}function NB(i){let e="hint",t=1;for(let r of i){let s=zB(r.severity);s>t&&(t=s,e=r.severity)}return e}const WB=[sr,Pe.decorations.compute([sr],i=>{let{selected:e,panel:t}=i.field(sr);return!e||!t||e.from==e.to?ze.none:ze.set([MB.range(e.from,e.to)])}),O6(QB,{hideOn:PB}),IB],ZB=[Q6(),B6(),YQ(),KA(),CA(),IQ(),XQ(),st.allowMultipleSelections.of(!0),pA(),Qy(MA,{fallback:!0}),DA(),mB(),CB(),a6(),h6(),t6(),aR(),rc.of([..._B,...iR,...PR,...a7,...xA,...Ax,...LB])];class hu{static create(e,t,r,s,n){let o=s+(s<<8)+e+(t<<4)|0;return new hu(e,t,r,o,n,[],[])}constructor(e,t,r,s,n,o,a){this.type=e,this.value=t,this.from=r,this.hash=s,this.end=n,this.children=o,this.positions=a,this.hashProp=[[Ue.contextHash,s]]}addChild(e,t){e.prop(Ue.contextHash)!=this.hash&&(e=new ht(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(t)}toTree(e,t=this.end){let r=this.children.length-1;return r>=0&&(t=Math.max(t,this.positions[r]+this.children[r].length+this.from)),new ht(e.types[this.type],this.children,this.positions,t-this.from).balance({makeTree:(s,n,o)=>new ht(Gt.none,s,n,o,this.hashProp)})}}var ye;(function(i){i[i.Document=1]="Document",i[i.CodeBlock=2]="CodeBlock",i[i.FencedCode=3]="FencedCode",i[i.Blockquote=4]="Blockquote",i[i.HorizontalRule=5]="HorizontalRule",i[i.BulletList=6]="BulletList",i[i.OrderedList=7]="OrderedList",i[i.ListItem=8]="ListItem",i[i.ATXHeading1=9]="ATXHeading1",i[i.ATXHeading2=10]="ATXHeading2",i[i.ATXHeading3=11]="ATXHeading3",i[i.ATXHeading4=12]="ATXHeading4",i[i.ATXHeading5=13]="ATXHeading5",i[i.ATXHeading6=14]="ATXHeading6",i[i.SetextHeading1=15]="SetextHeading1",i[i.SetextHeading2=16]="SetextHeading2",i[i.HTMLBlock=17]="HTMLBlock",i[i.LinkReference=18]="LinkReference",i[i.Paragraph=19]="Paragraph",i[i.CommentBlock=20]="CommentBlock",i[i.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",i[i.Escape=22]="Escape",i[i.Entity=23]="Entity",i[i.HardBreak=24]="HardBreak",i[i.Emphasis=25]="Emphasis",i[i.StrongEmphasis=26]="StrongEmphasis",i[i.Link=27]="Link",i[i.Image=28]="Image",i[i.InlineCode=29]="InlineCode",i[i.HTMLTag=30]="HTMLTag",i[i.Comment=31]="Comment",i[i.ProcessingInstruction=32]="ProcessingInstruction",i[i.Autolink=33]="Autolink",i[i.HeaderMark=34]="HeaderMark",i[i.QuoteMark=35]="QuoteMark",i[i.ListMark=36]="ListMark",i[i.LinkMark=37]="LinkMark",i[i.EmphasisMark=38]="EmphasisMark",i[i.CodeMark=39]="CodeMark",i[i.CodeText=40]="CodeText",i[i.CodeInfo=41]="CodeInfo",i[i.LinkTitle=42]="LinkTitle",i[i.LinkLabel=43]="LinkLabel",i[i.URL=44]="URL"})(ye||(ye={}));class XB{constructor(e,t){this.start=e,this.content=t,this.marks=[],this.parsers=[]}}class FB{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return _l(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,t=0,r=0){for(let s=t;s<e;s++)r+=this.text.charCodeAt(s)==9?4-r%4:1;return r}findColumn(e){let t=0;for(let r=0;t<this.text.length&&r<e;t++)r+=this.text.charCodeAt(t)==9?4-r%4:1;return t}scrub(){if(!this.baseIndent)return this.text;let e="";for(let t=0;t<this.basePos;t++)e+=" ";return e+this.text.slice(this.basePos)}}function J0(i,e,t){if(t.pos==t.text.length||i!=e.block&&t.indent>=e.stack[t.depth+1].value+t.baseIndent)return!0;if(t.indent>=t.baseIndent+4)return!1;let r=(i.type==ye.OrderedList?_g:Og)(t,e,!1);return r>0&&(i.type!=ye.BulletList||vg(t,e,!1)<0)&&t.text.charCodeAt(t.pos+r-1)==i.value}const Dx={[ye.Blockquote](i,e,t){return t.next!=62?!1:(t.markers.push(nt(ye.QuoteMark,e.lineStart+t.pos,e.lineStart+t.pos+1)),t.moveBase(t.pos+(kr(t.text.charCodeAt(t.pos+1))?2:1)),i.end=e.lineStart+t.text.length,!0)},[ye.ListItem](i,e,t){return t.indent<t.baseIndent+i.value&&t.next>-1?!1:(t.moveBaseColumn(t.baseIndent+i.value),!0)},[ye.OrderedList]:J0,[ye.BulletList]:J0,[ye.Document](){return!0}};function kr(i){return i==32||i==9||i==10||i==13}function _l(i,e=0){for(;e<i.length&&kr(i.charCodeAt(e));)e++;return e}function e1(i,e,t){for(;e>t&&kr(i.charCodeAt(e-1));)e--;return e}function Ix(i){if(i.next!=96&&i.next!=126)return-1;let e=i.pos+1;for(;e<i.text.length&&i.text.charCodeAt(e)==i.next;)e++;if(e<i.pos+3)return-1;if(i.next==96){for(let t=e;t<i.text.length;t++)if(i.text.charCodeAt(t)==96)return-1}return e}function zx(i){return i.next!=62?-1:i.text.charCodeAt(i.pos+1)==32?2:1}function vg(i,e,t){if(i.next!=42&&i.next!=45&&i.next!=95)return-1;let r=1;for(let s=i.pos+1;s<i.text.length;s++){let n=i.text.charCodeAt(s);if(n==i.next)r++;else if(!kr(n))return-1}return t&&i.next==45&&Zx(i)>-1&&i.depth==e.stack.length&&e.parser.leafBlockParsers.indexOf(qx.SetextHeading)>-1||r<3?-1:1}function Nx(i,e){for(let t=i.stack.length-1;t>=0;t--)if(i.stack[t].type==e)return!0;return!1}function Og(i,e,t){return(i.next==45||i.next==43||i.next==42)&&(i.pos==i.text.length-1||kr(i.text.charCodeAt(i.pos+1)))&&(!t||Nx(e,ye.BulletList)||i.skipSpace(i.pos+2)<i.text.length)?1:-1}function _g(i,e,t){let r=i.pos,s=i.next;for(;s>=48&&s<=57;){r++;if(r==i.text.length)return-1;s=i.text.charCodeAt(r)}return r==i.pos||r>i.pos+9||s!=46&&s!=41||r<i.text.length-1&&!kr(i.text.charCodeAt(r+1))||t&&!Nx(e,ye.OrderedList)&&(i.skipSpace(r+1)==i.text.length||r>i.pos+1||i.next!=49)?-1:r+1-i.pos}function Wx(i){if(i.next!=35)return-1;let e=i.pos+1;for(;e<i.text.length&&i.text.charCodeAt(e)==35;)e++;if(e<i.text.length&&i.text.charCodeAt(e)!=32)return-1;let t=e-i.pos;return t>6?-1:t}function Zx(i){if(i.next!=45&&i.next!=61||i.indent>=i.baseIndent+4)return-1;let e=i.pos+1;for(;e<i.text.length&&i.text.charCodeAt(e)==i.next;)e++;let t=e;for(;e<i.text.length&&kr(i.text.charCodeAt(e));)e++;return e==i.text.length?t:-1}const Op=/^[ \t]*$/,Xx=/-->/,Fx=/\?>/,_p=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,Xx],[/^\s*<\?/,Fx],[/^\s*<![A-Z]/,/>/],[/^\s*<!\[CDATA\[/,/\]\]>/],[/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i,Op],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,Op]];function Vx(i,e,t){if(i.next!=60)return-1;let r=i.text.slice(i.pos);for(let s=0,n=_p.length-(t?1:0);s<n;s++)if(_p[s][0].test(r))return s;return-1}function t1(i,e){let t=i.countIndent(e,i.pos,i.indent),r=i.countIndent(i.skipSpace(e),e,t);return r>=t+5?t+1:r}function Gs(i,e,t){let r=i.length-1;r>=0&&i[r].to==e&&i[r].type==ye.CodeText?i[r].to=t:i.push(nt(ye.CodeText,e,t))}const Yc={LinkReference:void 0,IndentedCode(i,e){let t=e.baseIndent+4;if(e.indent<t)return!1;let r=e.findColumn(t),s=i.lineStart+r,n=i.lineStart+e.text.length,o=[],a=[];for(Gs(o,s,n);i.nextLine()&&e.depth>=i.stack.length;)if(e.pos==e.text.length){Gs(a,i.lineStart-1,i.lineStart);for(let l of e.markers)a.push(l)}else{if(e.indent<t)break;{if(a.length){for(let c of a)c.type==ye.CodeText?Gs(o,c.from,c.to):o.push(c);a=[]}Gs(o,i.lineStart-1,i.lineStart);for(let c of e.markers)o.push(c);n=i.lineStart+e.text.length;let l=i.lineStart+e.findColumn(e.baseIndent+4);l<n&&Gs(o,l,n)}}return a.length&&(a=a.filter(l=>l.type!=ye.CodeText),a.length&&(e.markers=a.concat(e.markers))),i.addNode(i.buffer.writeElements(o,-s).finish(ye.CodeBlock,n-s),s),!0},FencedCode(i,e){let t=Ix(e);if(t<0)return!1;let r=i.lineStart+e.pos,s=e.next,n=t-e.pos,o=e.skipSpace(t),a=e1(e.text,e.text.length,o),l=[nt(ye.CodeMark,r,r+n)];o<a&&l.push(nt(ye.CodeInfo,i.lineStart+o,i.lineStart+a));for(let c=!0,h=!0,u=!1;i.nextLine()&&e.depth>=i.stack.length;c=!1){let d=e.pos;if(e.indent-e.baseIndent<4)for(;d<e.text.length&&e.text.charCodeAt(d)==s;)d++;if(d-e.pos>=n&&e.skipSpace(d)==e.text.length){for(let f of e.markers)l.push(f);h&&u&&Gs(l,i.lineStart-1,i.lineStart),l.push(nt(ye.CodeMark,i.lineStart+e.pos,i.lineStart+d)),i.nextLine();break}else{u=!0,c||(Gs(l,i.lineStart-1,i.lineStart),h=!1);for(let g of e.markers)l.push(g);let f=i.lineStart+e.basePos,p=i.lineStart+e.text.length;f<p&&(Gs(l,f,p),h=!1)}}return i.addNode(i.buffer.writeElements(l,-r).finish(ye.FencedCode,i.prevLineEnd()-r),r),!0},Blockquote(i,e){let t=zx(e);return t<0?!1:(i.startContext(ye.Blockquote,e.pos),i.addNode(ye.QuoteMark,i.lineStart+e.pos,i.lineStart+e.pos+1),e.moveBase(e.pos+t),null)},HorizontalRule(i,e){if(vg(e,i,!1)<0)return!1;let t=i.lineStart+e.pos;return i.nextLine(),i.addNode(ye.HorizontalRule,t),!0},BulletList(i,e){let t=Og(e,i,!1);if(t<0)return!1;i.block.type!=ye.BulletList&&i.startContext(ye.BulletList,e.basePos,e.next);let r=t1(e,e.pos+1);return i.startContext(ye.ListItem,e.basePos,r-e.baseIndent),i.addNode(ye.ListMark,i.lineStart+e.pos,i.lineStart+e.pos+t),e.moveBaseColumn(r),null},OrderedList(i,e){let t=_g(e,i,!1);if(t<0)return!1;i.block.type!=ye.OrderedList&&i.startContext(ye.OrderedList,e.basePos,e.text.charCodeAt(e.pos+t-1));let r=t1(e,e.pos+t);return i.startContext(ye.ListItem,e.basePos,r-e.baseIndent),i.addNode(ye.ListMark,i.lineStart+e.pos,i.lineStart+e.pos+t),e.moveBaseColumn(r),null},ATXHeading(i,e){let t=Wx(e);if(t<0)return!1;let r=e.pos,s=i.lineStart+r,n=e1(e.text,e.text.length,r),o=n;for(;o>r&&e.text.charCodeAt(o-1)==e.next;)o--;(o==n||o==r||!kr(e.text.charCodeAt(o-1)))&&(o=e.text.length);let a=i.buffer.write(ye.HeaderMark,0,t).writeElements(i.parser.parseInline(e.text.slice(r+t+1,o),s+t+1),-s);o<e.text.length&&a.write(ye.HeaderMark,o-r,n-r);let l=a.finish(ye.ATXHeading1-1+t,e.text.length-r);return i.nextLine(),i.addNode(l,s),!0},HTMLBlock(i,e){let t=Vx(e,i,!1);if(t<0)return!1;let r=i.lineStart+e.pos,s=_p[t][1],n=[],o=s!=Op;for(;!s.test(e.text)&&i.nextLine();){if(e.depth<i.stack.length){o=!1;break}for(let c of e.markers)n.push(c)}o&&i.nextLine();let a=s==Xx?ye.CommentBlock:s==Fx?ye.ProcessingInstructionBlock:ye.HTMLBlock,l=i.prevLineEnd();return i.addNode(i.buffer.writeElements(n,-r).finish(a,l-r),r),!0},SetextHeading:void 0};class VB{constructor(e){this.stage=0,this.elts=[],this.pos=0,this.start=e.start,this.advance(e.content)}nextLine(e,t,r){if(this.stage==-1)return!1;let s=r.content+`
22
+ `+t.scrub(),n=this.advance(s);return n>-1&&n<s.length?this.complete(e,r,n):!1}finish(e,t){return(this.stage==2||this.stage==3)&&_l(t.content,this.pos)==t.content.length?this.complete(e,t,t.content.length):!1}complete(e,t,r){return e.addLeafElement(t,nt(ye.LinkReference,this.start,this.start+r,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(tw(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(nt(ye.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(Jx(e,_l(e,this.pos),this.start)))return-1}else if(this.stage==2){let t=_l(e,this.pos),r=0;if(t>this.pos){let s=ew(e,t,this.start);if(s){let n=Cd(e,s.to-this.start);n>0&&(this.nextStage(s),r=n)}}return r||(r=Cd(e,this.pos)),r>0&&r<e.length?r:-1}else return Cd(e,this.pos)}}}function Cd(i,e){for(;e<i.length;e++){let t=i.charCodeAt(e);if(t==10)break;if(!kr(t))return-1}return e}class qB{nextLine(e,t,r){let s=t.depth<e.stack.length?-1:Zx(t),n=t.next;if(s<0)return!1;let o=nt(ye.HeaderMark,e.lineStart+t.pos,e.lineStart+s);return e.nextLine(),e.addLeafElement(r,nt(n==61?ye.SetextHeading1:ye.SetextHeading2,r.start,e.prevLineEnd(),[...e.parser.parseInline(r.content,r.start),o])),!0}finish(){return!1}}const qx={LinkReference(i,e){return e.content.charCodeAt(0)==91?new VB(e):null},SetextHeading(){return new qB}},HB=[(i,e)=>Wx(e)>=0,(i,e)=>Ix(e)>=0,(i,e)=>zx(e)>=0,(i,e)=>Og(e,i,!0)>=0,(i,e)=>_g(e,i,!0)>=0,(i,e)=>vg(e,i,!0)>=0,(i,e)=>Vx(e,i,!0)>=0],UB={text:"",end:0};class YB{constructor(e,t,r,s){this.parser=e,this.input=t,this.ranges=s,this.line=new FB,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=s[s.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=s[0].from,this.block=hu.create(ye.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=r.length?new KB(r,t):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let r=0;;){let s=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;r<e.markers.length&&(!s||e.markers[r].from<s.end);){let n=e.markers[r++];this.addNode(n.type,n.from,n.to)}if(!s)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;e:for(;;){for(let r of this.parser.blockParsers)if(r){let s=r(this,e);if(s!=!1){if(s==!0)return null;e.forward();continue e}}break}let t=new XB(this.lineStart+e.pos,e.text.slice(e.pos));for(let r of this.parser.leafBlockParsers)if(r){let s=r(this,t);s&&t.parsers.push(s)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let r of this.parser.endLeafBlock)if(r(this,e,t))break e}for(let r of t.parsers)if(r.nextLine(this,e,t))return null;t.content+=`
23
+ `+e.scrub();for(let r of e.markers)t.marks.push(r)}return this.finishLeaf(t),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let t=this.fragments.takeNodes(this);return t?(this.absoluteLineStart+=t,this.lineStart=iw(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let t=UB;if(t.end=e,e>=this.to)t.text="";else if(t.text=this.lineChunkAt(e),t.end+=t.text.length,this.ranges.length>1){let r=this.absoluteLineStart,s=this.rangeI;for(;this.ranges[s].to<t.end;){s++;let n=this.ranges[s].from,o=this.lineChunkAt(n);t.end=n+o.length,t.text=t.text.slice(0,this.ranges[s-1].to-r)+o,r=t.end-t.text.length}}return t}readLine(){let{line:e}=this,{text:t,end:r}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=r,e.reset(t);e.depth<this.stack.length;e.depth++){let s=this.stack[e.depth],n=this.parser.skipContextMarkup[s.type];if(!n)throw new Error("Unhandled block context "+ye[s.type]);let o=this.line.markers.length;if(!n(s,this,e)){this.line.markers.length>o&&(s.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let t=this.input.chunk(e),r;if(this.input.lineChunks)r=t==`
24
+ `?"":t;else{let s=t.indexOf(`
25
+ `);r=s<0?t:t.slice(0,s)}return e+r.length>this.to?r.slice(0,this.to-e):r}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,t,r=0){this.block=hu.create(e,r,this.lineStart+t,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,t,r=0){this.startContext(this.parser.getNodeType(e),t,r)}addNode(e,t,r){typeof e=="number"&&(e=new ht(this.parser.nodeSet.types[e],Ko,Ko,(r??this.prevLineEnd())-t)),this.block.addChild(e,t-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,t){this.addNode(this.buffer.writeElements(yp(t.children,e.marks),-t.from).finish(t.type,t.to-t.from),t.from)}finishContext(){let e=this.stack.pop(),t=this.stack[this.stack.length-1];t.addChild(e.toTree(this.parser.nodeSet),e.from-t.from),this.block=t}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(e){return this.ranges.length>1?Hx(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let r of e.parsers)if(r.finish(this,e))return;let t=yp(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(t,-e.start).finish(ye.Paragraph,e.content.length),e.start)}elt(e,t,r,s){return typeof e=="string"?nt(this.parser.getNodeType(e),t,r,s):new jx(e,t)}get buffer(){return new Yx(this.parser.nodeSet)}}function Hx(i,e,t,r,s){let n=i[e].to,o=[],a=[],l=t.from+r;function c(h,u){for(;u?h>=n:h>n;){let d=i[e+1].from-n;r+=d,h+=d,e++,n=i[e].to}}for(let h=t.firstChild;h;h=h.nextSibling){c(h.from+r,!0);let u=h.from+r,d,f=s.get(h.tree);f?d=f:h.to+r>n?(d=Hx(i,e,h,r,s),c(h.to+r,!1)):d=h.toTree(),o.push(d),a.push(u-l)}return c(t.to+r,!1),new ht(t.type,o,a,t.to+r-l,t.tree?t.tree.propValues:void 0)}class qu extends jm{constructor(e,t,r,s,n,o,a,l,c){super(),this.nodeSet=e,this.blockParsers=t,this.leafBlockParsers=r,this.blockNames=s,this.endLeafBlock=n,this.skipContextMarkup=o,this.inlineParsers=a,this.inlineNames=l,this.wrappers=c,this.nodeTypes=Object.create(null);for(let h of e.types)this.nodeTypes[h.name]=h.id}createParse(e,t,r){let s=new YB(this,e,t,r);for(let n of this.wrappers)s=n(s,e,t,r);return s}configure(e){let t=bp(e);if(!t)return this;let{nodeSet:r,skipContextMarkup:s}=this,n=this.blockParsers.slice(),o=this.leafBlockParsers.slice(),a=this.blockNames.slice(),l=this.inlineParsers.slice(),c=this.inlineNames.slice(),h=this.endLeafBlock.slice(),u=this.wrappers;if(Wa(t.defineNodes)){s=Object.assign({},s);let d=r.types.slice(),f;for(let p of t.defineNodes){let{name:g,block:O,composite:_,style:k}=typeof p=="string"?{name:p}:p;if(d.some(C=>C.name==g))continue;_&&(s[d.length]=(C,M,D)=>_(M,D,C.value));let P=d.length,w=_?["Block","BlockContext"]:O?P>=ye.ATXHeading1&&P<=ye.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;d.push(Gt.define({id:P,name:g,props:w&&[[Ue.group,w]]})),k&&(f||(f={}),Array.isArray(k)||k instanceof rr?f[g]=k:Object.assign(f,k))}r=new nc(d),f&&(r=r.extend(ra(f)))}if(Wa(t.props)&&(r=r.extend(...t.props)),Wa(t.remove))for(let d of t.remove){let f=this.blockNames.indexOf(d),p=this.inlineNames.indexOf(d);f>-1&&(n[f]=o[f]=void 0),p>-1&&(l[p]=void 0)}if(Wa(t.parseBlock))for(let d of t.parseBlock){let f=a.indexOf(d.name);if(f>-1)n[f]=d.parse,o[f]=d.leaf;else{let p=d.before?jc(a,d.before):d.after?jc(a,d.after)+1:a.length-1;n.splice(p,0,d.parse),o.splice(p,0,d.leaf),a.splice(p,0,d.name)}d.endLeaf&&h.push(d.endLeaf)}if(Wa(t.parseInline))for(let d of t.parseInline){let f=c.indexOf(d.name);if(f>-1)l[f]=d.parse;else{let p=d.before?jc(c,d.before):d.after?jc(c,d.after)+1:c.length-1;l.splice(p,0,d.parse),c.splice(p,0,d.name)}}return t.wrap&&(u=u.concat(t.wrap)),new qu(r,n,o,a,h,s,l,c,u)}getNodeType(e){let t=this.nodeTypes[e];if(t==null)throw new RangeError(`Unknown node type '${e}'`);return t}parseInline(e,t){let r=new bg(this,e,t);e:for(let s=t;s<r.end;){let n=r.char(s);for(let o of this.inlineParsers)if(o){let a=o(r,n,s);if(a>=0){s=a;continue e}}s++}return r.resolveMarkers(0)}}function Wa(i){return i!=null&&i.length>0}function bp(i){if(!Array.isArray(i))return i;if(i.length==0)return null;let e=bp(i[0]);if(i.length==1)return e;let t=bp(i.slice(1));if(!t||!e)return e||t;let r=(o,a)=>(o||Ko).concat(a||Ko),s=e.wrap,n=t.wrap;return{props:r(e.props,t.props),defineNodes:r(e.defineNodes,t.defineNodes),parseBlock:r(e.parseBlock,t.parseBlock),parseInline:r(e.parseInline,t.parseInline),remove:r(e.remove,t.remove),wrap:s?n?(o,a,l,c)=>s(n(o,a,l,c),a,l,c):s:n}}function jc(i,e){let t=i.indexOf(e);if(t<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return t}let Ux=[Gt.none];for(let i=1,e;e=ye[i];i++)Ux[i]=Gt.define({id:i,name:e,props:i>=ye.Escape?[]:[[Ue.group,i in Dx?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});const Ko=[];class Yx{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e,t,r,s=0){return this.content.push(e,t,r,4+s*4),this}writeElements(e,t=0){for(let r of e)r.writeTo(this,t);return this}finish(e,t){return ht.build({buffer:this.content,nodeSet:this.nodeSet,reused:this.nodes,topID:e,length:t})}}let Zl=class{constructor(e,t,r,s=Ko){this.type=e,this.from=t,this.to=r,this.children=s}writeTo(e,t){let r=e.content.length;e.writeElements(this.children,t),e.content.push(this.type,this.from+t,this.to+t,e.content.length+4-r)}toTree(e){return new Yx(e).writeElements(this.children,-this.from).finish(this.type,this.to-this.from)}};class jx{constructor(e,t){this.tree=e,this.from=t}get to(){return this.from+this.tree.length}get type(){return this.tree.type.id}get children(){return Ko}writeTo(e,t){e.nodes.push(this.tree),e.content.push(e.nodes.length-1,this.from+t,this.to+t,-1)}toTree(){return this.tree}}function nt(i,e,t,r){return new Zl(i,e,t,r)}const Gx={resolve:"Emphasis",mark:"EmphasisMark"},Kx={resolve:"Emphasis",mark:"EmphasisMark"},Nn={},uu={};class ir{constructor(e,t,r,s){this.type=e,this.from=t,this.to=r,this.side=s}}const i1="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";let Xl=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;try{Xl=new RegExp("[\\p{S}|\\p{P}]","u")}catch{}const $d={Escape(i,e,t){if(e!=92||t==i.end-1)return-1;let r=i.char(t+1);for(let s=0;s<i1.length;s++)if(i1.charCodeAt(s)==r)return i.append(nt(ye.Escape,t,t+2));return-1},Entity(i,e,t){if(e!=38)return-1;let r=/^(?:#\d+|#x[a-f\d]+|\w+);/i.exec(i.slice(t+1,t+31));return r?i.append(nt(ye.Entity,t,t+1+r[0].length)):-1},InlineCode(i,e,t){if(e!=96||t&&i.char(t-1)==96)return-1;let r=t+1;for(;r<i.end&&i.char(r)==96;)r++;let s=r-t,n=0;for(;r<i.end;r++)if(i.char(r)==96){if(n++,n==s&&i.char(r+1)!=96)return i.append(nt(ye.InlineCode,t,r+1,[nt(ye.CodeMark,t,t+s),nt(ye.CodeMark,r+1-s,r+1)]))}else n=0;return-1},HTMLTag(i,e,t){if(e!=60||t==i.end-1)return-1;let r=i.slice(t+1,i.end),s=/^(?:[a-z][-\w+.]+:[^\s>]+|[a-z\d.!#$%&'*+/=?^_`{|}~-]+@[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*)>/i.exec(r);if(s)return i.append(nt(ye.Autolink,t,t+1+s[0].length,[nt(ye.LinkMark,t,t+1),nt(ye.URL,t+1,t+s[0].length),nt(ye.LinkMark,t+s[0].length,t+1+s[0].length)]));let n=/^!--[^>](?:-[^-]|[^-])*?-->/i.exec(r);if(n)return i.append(nt(ye.Comment,t,t+1+n[0].length));let o=/^\?[^]*?\?>/.exec(r);if(o)return i.append(nt(ye.ProcessingInstruction,t,t+1+o[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(r);return a?i.append(nt(ye.HTMLTag,t,t+1+a[0].length)):-1},Emphasis(i,e,t){if(e!=95&&e!=42)return-1;let r=t+1;for(;i.char(r)==e;)r++;let s=i.slice(t-1,t),n=i.slice(r,r+1),o=Xl.test(s),a=Xl.test(n),l=/\s|^$/.test(s),c=/\s|^$/.test(n),h=!c&&(!a||l||o),u=!l&&(!o||c||a),d=h&&(e==42||!u||o),f=u&&(e==42||!h||a);return i.append(new ir(e==95?Gx:Kx,t,r,(d?1:0)|(f?2:0)))},HardBreak(i,e,t){if(e==92&&i.char(t+1)==10)return i.append(nt(ye.HardBreak,t,t+2));if(e==32){let r=t+1;for(;i.char(r)==32;)r++;if(i.char(r)==10&&r>=t+2)return i.append(nt(ye.HardBreak,t,r+1))}return-1},Link(i,e,t){return e==91?i.append(new ir(Nn,t,t+1,1)):-1},Image(i,e,t){return e==33&&i.char(t+1)==91?i.append(new ir(uu,t,t+2,1)):-1},LinkEnd(i,e,t){if(e!=93)return-1;for(let r=i.parts.length-1;r>=0;r--){let s=i.parts[r];if(s instanceof ir&&(s.type==Nn||s.type==uu)){if(!s.side||i.skipSpace(s.to)==t&&!/[(\[]/.test(i.slice(t+1,t+2)))return i.parts[r]=null,-1;let n=i.takeContent(r),o=i.parts[r]=jB(i,n,s.type==Nn?ye.Link:ye.Image,s.from,t+1);if(s.type==Nn)for(let a=0;a<r;a++){let l=i.parts[a];l instanceof ir&&l.type==Nn&&(l.side=0)}return o.to}}return-1}};function jB(i,e,t,r,s){let{text:n}=i,o=i.char(s),a=s;if(e.unshift(nt(ye.LinkMark,r,r+(t==ye.Image?2:1))),e.push(nt(ye.LinkMark,s-1,s)),o==40){let l=i.skipSpace(s+1),c=Jx(n,l-i.offset,i.offset),h;c&&(l=i.skipSpace(c.to),l!=c.to&&(h=ew(n,l-i.offset,i.offset),h&&(l=i.skipSpace(h.to)))),i.char(l)==41&&(e.push(nt(ye.LinkMark,s,s+1)),a=l+1,c&&e.push(c),h&&e.push(h),e.push(nt(ye.LinkMark,l,a)))}else if(o==91){let l=tw(n,s-i.offset,i.offset,!1);l&&(e.push(l),a=l.to)}return nt(t,r,a,e)}function Jx(i,e,t){if(i.charCodeAt(e)==60){for(let s=e+1;s<i.length;s++){let n=i.charCodeAt(s);if(n==62)return nt(ye.URL,e+t,s+1+t);if(n==60||n==10)return!1}return null}else{let s=0,n=e;for(let o=!1;n<i.length;n++){let a=i.charCodeAt(n);if(kr(a))break;if(o)o=!1;else if(a==40)s++;else if(a==41){if(!s)break;s--}else a==92&&(o=!0)}return n>e?nt(ye.URL,e+t,n+t):n==i.length?null:!1}}function ew(i,e,t){let r=i.charCodeAt(e);if(r!=39&&r!=34&&r!=40)return!1;let s=r==40?41:r;for(let n=e+1,o=!1;n<i.length;n++){let a=i.charCodeAt(n);if(o)o=!1;else{if(a==s)return nt(ye.LinkTitle,e+t,n+1+t);a==92&&(o=!0)}}return null}function tw(i,e,t,r){for(let s=!1,n=e+1,o=Math.min(i.length,n+999);n<o;n++){let a=i.charCodeAt(n);if(s)s=!1;else{if(a==93)return r?!1:nt(ye.LinkLabel,e+t,n+1+t);if(r&&!kr(a)&&(r=!1),a==91)return!1;a==92&&(s=!0)}}return null}class bg{constructor(e,t,r){this.parser=e,this.text=t,this.offset=r,this.parts=[]}char(e){return e>=this.end?-1:this.text.charCodeAt(e-this.offset)}get end(){return this.offset+this.text.length}slice(e,t){return this.text.slice(e-this.offset,t-this.offset)}append(e){return this.parts.push(e),e.to}addDelimiter(e,t,r,s,n){return this.append(new ir(e,t,r,(s?1:0)|(n?2:0)))}get hasOpenLink(){for(let e=this.parts.length-1;e>=0;e--){let t=this.parts[e];if(t instanceof ir&&(t.type==Nn||t.type==uu))return!0}return!1}addElement(e){return this.append(e)}resolveMarkers(e){for(let r=e;r<this.parts.length;r++){let s=this.parts[r];if(!(s instanceof ir&&s.type.resolve&&s.side&2))continue;let n=s.type==Gx||s.type==Kx,o=s.to-s.from,a,l=r-1;for(;l>=e;l--){let g=this.parts[l];if(g instanceof ir&&g.side&1&&g.type==s.type&&!(n&&(s.side&1||g.side&2)&&(g.to-g.from+o)%3==0&&((g.to-g.from)%3||o%3))){a=g;break}}if(!a)continue;let c=s.type.resolve,h=[],u=a.from,d=s.to;if(n){let g=Math.min(2,a.to-a.from,o);u=a.to-g,d=s.from+g,c=g==1?"Emphasis":"StrongEmphasis"}a.type.mark&&h.push(this.elt(a.type.mark,u,a.to));for(let g=l+1;g<r;g++)this.parts[g]instanceof Zl&&h.push(this.parts[g]),this.parts[g]=null;s.type.mark&&h.push(this.elt(s.type.mark,s.from,d));let f=this.elt(c,u,d,h);this.parts[l]=n&&a.from!=u?new ir(a.type,a.from,u,a.side):null,(this.parts[r]=n&&s.to!=d?new ir(s.type,d,s.to,s.side):null)?this.parts.splice(r,0,f):this.parts[r]=f}let t=[];for(let r=e;r<this.parts.length;r++){let s=this.parts[r];s instanceof Zl&&t.push(s)}return t}findOpeningDelimiter(e){for(let t=this.parts.length-1;t>=0;t--){let r=this.parts[t];if(r instanceof ir&&r.type==e&&r.side&1)return t}return null}takeContent(e){let t=this.resolveMarkers(e);return this.parts.length=e,t}getDelimiterAt(e){let t=this.parts[e];return t instanceof ir?t:null}skipSpace(e){return _l(this.text,e-this.offset)+this.offset}elt(e,t,r,s){return typeof e=="string"?nt(this.parser.getNodeType(e),t,r,s):new jx(e,t)}}bg.linkStart=Nn;bg.imageStart=uu;function yp(i,e){if(!e.length)return i;if(!i.length)return e;let t=i.slice(),r=0;for(let s of e){for(;r<t.length&&t[r].to<s.to;)r++;if(r<t.length&&t[r].from<s.from){let n=t[r];n instanceof Zl&&(t[r]=new Zl(n.type,n.from,n.to,yp(n.children,[s])))}else t.splice(r++,0,s)}return t}const GB=[ye.CodeBlock,ye.ListItem,ye.OrderedList,ye.BulletList];let KB=class{constructor(e,t){this.fragments=e,this.input=t,this.i=0,this.fragment=null,this.fragmentEnd=-1,this.cursor=null,e.length&&(this.fragment=e[this.i++])}nextFragment(){this.fragment=this.i<this.fragments.length?this.fragments[this.i++]:null,this.cursor=null,this.fragmentEnd=-1}moveTo(e,t){for(;this.fragment&&this.fragment.to<=e;)this.nextFragment();if(!this.fragment||this.fragment.from>(e?e-1:0))return!1;if(this.fragmentEnd<0){let n=this.fragment.to;for(;n>0&&this.input.read(n-1,n)!=`
26
+ `;)n--;this.fragmentEnd=n?n-1:0}let r=this.cursor;r||(r=this.cursor=this.fragment.tree.cursor(),r.firstChild());let s=e+this.fragment.offset;for(;r.to<=s;)if(!r.parent())return!1;for(;;){if(r.from>=s)return this.fragment.from<=t;if(!r.childAfter(s))return!1}}matches(e){let t=this.cursor.tree;return t&&t.prop(Ue.contextHash)==e}takeNodes(e){let t=this.cursor,r=this.fragment.offset,s=this.fragmentEnd-(this.fragment.openEnd?1:0),n=e.absoluteLineStart,o=n,a=e.block.children.length,l=o,c=a;for(;;){if(t.to-r>s){if(t.type.isAnonymous&&t.firstChild())continue;break}let h=iw(t.from-r,e.ranges);if(t.to-r<=e.ranges[e.rangeI].to)e.addNode(t.tree,h);else{let u=new ht(e.parser.nodeSet.types[ye.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(u,t.tree),e.addNode(u,h)}if(t.type.is("Block")&&(GB.indexOf(t.type.id)<0?(o=t.to-r,a=e.block.children.length):(o=l,a=c),l=t.to-r,c=e.block.children.length),!t.nextSibling())break}for(;e.block.children.length>a;)e.block.children.pop(),e.block.positions.pop();return o-n}};function iw(i,e){let t=i;for(let r=1;r<e.length;r++){let s=e[r-1].to,n=e[r].from;s<i&&(t-=n-s)}return t}const JB=ra({"Blockquote/...":B.quote,HorizontalRule:B.contentSeparator,"ATXHeading1/... SetextHeading1/...":B.heading1,"ATXHeading2/... SetextHeading2/...":B.heading2,"ATXHeading3/...":B.heading3,"ATXHeading4/...":B.heading4,"ATXHeading5/...":B.heading5,"ATXHeading6/...":B.heading6,"Comment CommentBlock":B.comment,Escape:B.escape,Entity:B.character,"Emphasis/...":B.emphasis,"StrongEmphasis/...":B.strong,"Link/... Image/...":B.link,"OrderedList/... BulletList/...":B.list,"BlockQuote/...":B.quote,"InlineCode CodeText":B.monospace,"URL Autolink":B.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":B.processingInstruction,"CodeInfo LinkLabel":B.labelName,LinkTitle:B.string,Paragraph:B.content}),eL=new qu(new nc(Ux).extend(JB),Object.keys(Yc).map(i=>Yc[i]),Object.keys(Yc).map(i=>qx[i]),Object.keys(Yc),HB,Dx,Object.keys($d).map(i=>$d[i]),Object.keys($d),[]);function tL(i,e,t){let r=[];for(let s=i.firstChild,n=e;;s=s.nextSibling){let o=s?s.from:t;if(o>n&&r.push({from:n,to:o}),!s)break;n=s.to}return r}function iL(i){let{codeParser:e,htmlParser:t}=i;return{wrap:my((s,n)=>{let o=s.type.id;if(e&&(o==ye.CodeBlock||o==ye.FencedCode)){let a="";if(o==ye.FencedCode){let c=s.node.getChild(ye.CodeInfo);c&&(a=n.read(c.from,c.to))}let l=e(a);if(l)return{parser:l,overlay:c=>c.type.id==ye.CodeText,bracketed:o==ye.FencedCode}}else if(t&&(o==ye.HTMLBlock||o==ye.HTMLTag||o==ye.CommentBlock))return{parser:t,overlay:tL(s.node,s.from,s.to)};return null})}}const rL={resolve:"Strikethrough",mark:"StrikethroughMark"},sL={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":B.strikethrough}},{name:"StrikethroughMark",style:B.processingInstruction}],parseInline:[{name:"Strikethrough",parse(i,e,t){if(e!=126||i.char(t+1)!=126||i.char(t+2)==126)return-1;let r=i.slice(t-1,t),s=i.slice(t+2,t+3),n=/\s|^$/.test(r),o=/\s|^$/.test(s),a=Xl.test(r),l=Xl.test(s);return i.addDelimiter(rL,t,t+2,!o&&(!l||n||a),!n&&(!a||o||l))},after:"Emphasis"}]};function bl(i,e,t=0,r,s=0){let n=0,o=!0,a=-1,l=-1,c=!1,h=()=>{r.push(i.elt("TableCell",s+a,s+l,i.parser.parseInline(e.slice(a,l),s+a)))};for(let u=t;u<e.length;u++){let d=e.charCodeAt(u);d==124&&!c?((!o||a>-1)&&n++,o=!1,r&&(a>-1&&h(),r.push(i.elt("TableDelimiter",u+s,u+s+1))),a=l=-1):(c||d!=32&&d!=9)&&(a<0&&(a=u),l=u+1),c=!c&&d==92}return a>-1&&(n++,r&&h()),n}function r1(i,e){for(let t=e;t<i.length;t++){let r=i.charCodeAt(t);if(r==124)return!0;r==92&&t++}return!1}const rw=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;class s1{constructor(){this.rows=null}nextLine(e,t,r){if(this.rows==null){this.rows=!1;let s;if((t.next==45||t.next==58||t.next==124)&&rw.test(s=t.text.slice(t.pos))){let n=[];bl(e,r.content,0,n,r.start)==bl(e,s,t.pos)&&(this.rows=[e.elt("TableHeader",r.start,r.start+r.content.length,n),e.elt("TableDelimiter",e.lineStart+t.pos,e.lineStart+t.text.length)])}}else if(this.rows){let s=[];bl(e,t.text,t.pos,s,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+t.pos,e.lineStart+t.text.length,s))}return!1}finish(e,t){return this.rows?(e.addLeafElement(t,e.elt("Table",t.start,t.start+t.content.length,this.rows)),!0):!1}}const nL={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":B.heading}},"TableRow",{name:"TableCell",style:B.content},{name:"TableDelimiter",style:B.processingInstruction}],parseBlock:[{name:"Table",leaf(i,e){return r1(e.content,0)?new s1:null},endLeaf(i,e,t){if(t.parsers.some(s=>s instanceof s1)||!r1(e.text,e.basePos))return!1;let r=i.peekLine();return rw.test(r)&&bl(i,e.text,e.basePos)==bl(i,r,e.basePos)},before:"SetextHeading"}]};class oL{nextLine(){return!1}finish(e,t){return e.addLeafElement(t,e.elt("Task",t.start,t.start+t.content.length,[e.elt("TaskMarker",t.start,t.start+3),...e.parser.parseInline(t.content.slice(3),t.start+3)])),!0}}const aL={defineNodes:[{name:"Task",block:!0,style:B.list},{name:"TaskMarker",style:B.atom}],parseBlock:[{name:"TaskList",leaf(i,e){return/^\[[ xX]\][ \t]/.test(e.content)&&i.parentType().name=="ListItem"?new oL:null},after:"SetextHeading"}]},n1=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,o1=/[\w-]+(\.[\w-]+)+(\/[^\s<]*)?/gy,lL=/[\w-]+\.[\w-]+($|\/)/,a1=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,l1=/\/[a-zA-Z\d@.]+/gy;function c1(i,e,t,r){let s=0;for(let n=e;n<t;n++)i[n]==r&&s++;return s}function cL(i,e){o1.lastIndex=e;let t=o1.exec(i);if(!t||lL.exec(t[0])[0].indexOf("_")>-1)return-1;let r=e+t[0].length;for(;;){let s=i[r-1],n;if(/[?!.,:*_~]/.test(s)||s==")"&&c1(i,e,r,")")>c1(i,e,r,"("))r--;else if(s==";"&&(n=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(i.slice(e,r))))r=e+n.index;else break}return r}function h1(i,e){a1.lastIndex=e;let t=a1.exec(i);if(!t)return-1;let r=t[0][t[0].length-1];return r=="_"||r=="-"?-1:e+t[0].length-(r=="."?1:0)}const hL={parseInline:[{name:"Autolink",parse(i,e,t){let r=t-i.offset;if(r&&/\w/.test(i.text[r-1]))return-1;n1.lastIndex=r;let s=n1.exec(i.text),n=-1;if(!s)return-1;if(s[1]||s[2]){if(n=cL(i.text,r+s[0].length),n>-1&&i.hasOpenLink){let o=/([^\[\]]|\[[^\]]*\])*/.exec(i.text.slice(r,n));n=r+o[0].length}}else s[3]?n=h1(i.text,r):(n=h1(i.text,r+s[0].length),n>-1&&s[0]=="xmpp:"&&(l1.lastIndex=n,s=l1.exec(i.text),s&&(n=s.index+s[0].length)));return n<0?-1:(i.addElement(i.elt("URL",t,n+i.offset)),n+i.offset)}}]},uL=[nL,aL,sL,hL];function sw(i,e,t){return(r,s,n)=>{if(s!=i||r.char(n+1)==i)return-1;let o=[r.elt(t,n,n+1)];for(let a=n+1;a<r.end;a++){let l=r.char(a);if(l==i)return r.addElement(r.elt(e,n,a+1,o.concat(r.elt(t,a,a+1))));if(l==92&&o.push(r.elt("Escape",a,a+++2)),kr(l))break}return-1}}const dL={defineNodes:[{name:"Superscript",style:B.special(B.content)},{name:"SuperscriptMark",style:B.processingInstruction}],parseInline:[{name:"Superscript",parse:sw(94,"Superscript","SuperscriptMark")}]},fL={defineNodes:[{name:"Subscript",style:B.special(B.content)},{name:"SubscriptMark",style:B.processingInstruction}],parseInline:[{name:"Subscript",parse:sw(126,"Subscript","SubscriptMark")}]},pL={defineNodes:[{name:"Emoji",style:B.character}],parseInline:[{name:"Emoji",parse(i,e,t){let r;return e!=58||!(r=/^[a-zA-Z_0-9]+:/.exec(i.slice(t+1,i.end)))?-1:i.addElement(i.elt("Emoji",t,t+1+r[0].length))}}]};var u1={};class du{constructor(e,t,r,s,n,o,a,l,c,h=0,u){this.p=e,this.stack=t,this.state=r,this.reducePos=s,this.pos=n,this.score=o,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=h,this.parent=u}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,r=0){let s=e.parser.context;return new du(e,[],t,r,r,0,[],0,s?new d1(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let r=e>>19,s=e&65535,{parser:n}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=n.dynamicPrecedence(s);if(a&&(this.score+=a),r==0){this.pushState(n.getGoto(this.state,s,!0),this.reducePos),s<n.minRepeatTerm&&this.storeNode(s,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(s,this.reducePos);return}let l=this.stack.length-(r-1)*3-(e&262144?6:0),c=l?this.stack[l-2]:this.p.ranges[0].from,h=this.reducePos-c;h>=2e3&&!(!((t=this.p.parser.nodeSet.types[s])===null||t===void 0)&&t.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSize<h&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=h));let u=l?this.stack[l-1]:0,d=this.bufferBase+this.buffer.length-u;if(s<n.minRepeatTerm||e&131072){let f=n.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(s,c,f,d+4,!0)}if(e&262144)this.state=this.stack[l];else{let f=this.stack[l-3];this.state=n.getGoto(f,s,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(s,c)}storeNode(e,t,r,s=4,n=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,a=this.buffer.length;if(a==0&&o.parent&&(a=o.bufferBase-o.parent.bufferBase,o=o.parent),a>0&&o.buffer[a-4]==0&&o.buffer[a-1]>-1){if(t==r)return;if(o.buffer[a-2]>=t){o.buffer[a-2]=r;return}}}if(!n||this.pos==r)this.buffer.push(e,t,r,s);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let a=!1;for(let l=o;l>0&&this.buffer[l-2]>r;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,s>4&&(s-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=r,this.buffer[o+3]=s}}shift(e,t,r,s){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let n=e,{parser:o}=this.p;this.pos=s;let a=o.stateFlag(n,1);!a&&(s>r||t<=o.maxNode)&&(this.reducePos=s),this.pushState(n,a?r:Math.min(r,this.reducePos)),this.shiftContext(t,r),t<=o.maxNode&&this.buffer.push(t,r,s,4)}else this.pos=s,this.shiftContext(t,r),t<=this.p.parser.maxNode&&this.buffer.push(t,r,s,4)}apply(e,t,r,s){e&65536?this.reduce(e):this.shift(e,t,r,s)}useNode(e,t){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(t,s),this.buffer.push(r,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let r=e.buffer.slice(t),s=e.bufferBase+t;for(;e&&s==e.bufferBase;)e=e.parent;return new du(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,s,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,r?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new mL(this);;){let r=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(r==0)return!1;if((r&65536)==0)return!0;t.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let s=[];for(let n=0,o;n<t.length;n+=2)(o=t[n+1])!=this.state&&this.p.parser.hasAction(o,e)&&s.push(t[n],o);if(this.stack.length<120)for(let n=0;s.length<8&&n<t.length;n+=2){let o=t[n+1];s.some((a,l)=>l&1&&a==o)||s.push(t[n],o)}t=s}let r=[];for(let s=0;s<t.length&&r.length<4;s+=2){let n=t[s+1];if(n==this.state)continue;let o=this.split();o.pushState(n,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(t[s],this.pos),o.reducePos=this.pos,o.score-=200,r.push(o)}return r}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if((t&65536)==0)return!1;if(!e.validAction(this.state,t)){let r=t>>19,s=t&65535,n=this.stack.length-r*3;if(n<0||e.getGoto(this.stack[n],s,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],r=(s,n)=>{if(!t.includes(s))return t.push(s),e.allActions(s,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-n;if(a>1){let l=o&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=r(o,n+1);if(a!=null)return a}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new d1(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class d1{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class mL{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=s}}class fu{constructor(e,t,r){this.stack=e,this.pos=t,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new fu(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new fu(this.stack,this.pos,this.index)}}function sl(i,e=Uint16Array){if(typeof i!="string")return i;let t=null;for(let r=0,s=0;r<i.length;){let n=0;for(;;){let o=i.charCodeAt(r++),a=!1;if(o==126){n=65535;break}o>=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),n+=l,a)break;n*=46}t?t[s++]=n:t=new e(n)}return t}class xh{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const f1=new xh;class gL{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=f1,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let r=this.range,s=this.rangeIndex,n=this.pos+e;for(;n<r.from;){if(!s)return null;let o=this.ranges[--s];n-=r.from-o.to,r=o}for(;t<0?n>r.to:n>=r.to;){if(s==this.ranges.length-1)return null;let o=this.ranges[++s];n+=o.from-r.to,r=o}return n}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,r,s;if(t>=0&&t<this.chunk.length)r=this.pos+e,s=this.chunk.charCodeAt(t);else{let n=this.resolveOffset(e,1);if(n==null)return-1;if(r=n,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)s=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let o=this.rangeIndex,a=this.range;for(;a.to<=r;)a=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-r)),s=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),s}acceptToken(e,t=0){let r=t?this.resolveOffset(t,-1):this.pos;if(r==null||r<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=f1,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let r="";for(let s of this.ranges){if(s.from>=t)break;s.to>e&&(r+=this.input.read(Math.max(s.from,e),Math.min(s.to,t)))}return r}}class Wo{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:r}=t.p;nw(this.data,e,t,this.id,r.data,r.tokenPrecTable)}}Wo.prototype.contextual=Wo.prototype.fallback=Wo.prototype.extend=!1;class pu{constructor(e,t,r){this.precTable=t,this.elseToken=r,this.data=typeof e=="string"?sl(e):e}token(e,t){let r=e.pos,s=0;for(;;){let n=e.next<0,o=e.resolveOffset(1,1);if(nw(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(n||s++,o==null)break;e.reset(o,e.token)}s&&(e.reset(r,e.token),e.acceptToken(this.elseToken,s))}}pu.prototype.contextual=Wo.prototype.fallback=Wo.prototype.extend=!1;class ar{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function nw(i,e,t,r,s,n){let o=0,a=1<<r,{dialect:l}=t.p.parser;e:for(;(a&i[o])!=0;){let c=i[o+1];for(let f=o+3;f<c;f+=2)if((i[f+1]&a)>0){let p=i[f];if(l.allows(p)&&(e.token.value==-1||e.token.value==p||vL(p,e.token.value,s,n))){e.acceptToken(p);break}}let h=e.next,u=0,d=i[o+2];if(e.next<0&&d>u&&i[c+d*3-3]==65535){o=i[c+d*3-1];continue e}for(;u<d;){let f=u+d>>1,p=c+f+(f<<1),g=i[p],O=i[p+1]||65536;if(h<g)d=f;else if(h>=O)u=f+1;else{o=i[p+2],e.advance();continue e}}break}}function p1(i,e,t){for(let r=e,s;(s=i[r])!=65535;r++)if(s==t)return r-e;return-1}function vL(i,e,t,r){let s=p1(t,r,e);return s<0||p1(t,r,i)<s}const Yi=typeof process<"u"&&u1&&/\bparse\b/.test(u1.LOG);let Pd=null;function m1(i,e,t){let r=i.cursor(dt.IncludeAnonymous);for(r.moveTo(e);;)if(!(t<0?r.childBefore(e):r.childAfter(e)))for(;;){if((t<0?r.to<e:r.from>e)&&!r.type.isError)return t<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(i.length,Math.max(r.from+1,e+25));if(t<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return t<0?0:i.length}}class OL{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?m1(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?m1(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let r=this.trees[t],s=this.index[t];if(s==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let n=r.children[s],o=this.start[t]+r.positions[s];if(o>e)return this.nextStart=o,null;if(n instanceof ht){if(o==e){if(o<this.safeFrom)return null;let a=o+n.length;if(a<=this.safeTo){let l=n.prop(Ue.lookAhead);if(!l||a+l<this.fragment.to)return n}}this.index[t]++,o+n.length>=Math.max(this.safeFrom,e)&&(this.trees.push(n),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+n.length}}}class _L{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new xh)}getActions(e){let t=0,r=null,{parser:s}=e.p,{tokenizers:n}=s,o=s.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<n.length;c++){if((1<<c&o)==0)continue;let h=n[c],u=this.tokens[c];if(!(r&&!h.fallback)&&((h.contextual||u.start!=e.pos||u.mask!=o||u.context!=a)&&(this.updateCachedToken(u,h,e),u.mask=o,u.context=a),u.lookAhead>u.end+25&&(l=Math.max(u.lookAhead,l)),u.value!=0)){let d=t;if(u.extended>-1&&(t=this.addActions(e,u.extended,u.end,t)),t=this.addActions(e,u.value,u.end,t),!h.extend&&(r=u,t>d))break}}for(;this.actions.length>t;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new xh,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,t=this.addActions(e,r.value,r.end,t)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new xh,{pos:r,p:s}=e;return t.start=r,t.end=Math.min(r+1,s.stream.end),t.value=r==s.stream.end?s.parser.eofTerm:0,t}updateCachedToken(e,t,r){let s=this.stream.clipPos(r.pos);if(t.token(this.stream.reset(s,e),r),e.value>-1){let{parser:n}=r.p;for(let o=0;o<n.specialized.length;o++)if(n.specialized[o]==e.value){let a=n.specializers[o](this.stream.read(e.start,e.end),r);if(a>=0&&r.p.parser.dialect.allows(a>>1)){(a&1)==0?e.value=a>>1:e.extended=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,t,r,s){for(let n=0;n<s;n+=3)if(this.actions[n]==e)return s;return this.actions[s++]=e,this.actions[s++]=t,this.actions[s++]=r,s}addActions(e,t,r,s){let{state:n}=e,{parser:o}=e.p,{data:a}=o;for(let l=0;l<2;l++)for(let c=o.stateSlot(n,l?2:1);;c+=3){if(a[c]==65535)if(a[c+1]==1)c=Ms(a,c+2);else{s==0&&a[c+1]==2&&(s=this.putAction(Ms(a,c+2),t,r,s));break}a[c]==t&&(s=this.putAction(Ms(a,c+1),t,r,s))}return s}}class bL{constructor(e,t,r,s){this.parser=e,this.input=t,this.ranges=s,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new gL(t,s),this.tokens=new _L(e,this.stream),this.topTerm=e.top[1];let{from:n}=s[0];this.stacks=[du.start(this,e.top[0],n)],this.fragments=r.length&&this.stream.end-n>e.bufferLength*4?new OL(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,r=this.stacks=[],s,n;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let a=e[o];for(;;){if(this.tokens.mainToken=null,a.pos>t)r.push(a);else{if(this.advanceStack(a,r,e))continue;{s||(s=[],n=[]),s.push(a);let l=this.tokens.getMainToken(a);n.push(l.value,l.end)}}break}}if(!r.length){let o=s&&xL(s);if(o)return Yi&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Yi&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&s){let o=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,n,r);if(o)return Yi&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(r.length>o)for(r.sort((a,l)=>l.score-a.score);r.length>o;)r.pop();r.some(a=>a.reducePos>t)&&this.recovering--}else if(r.length>1){e:for(let o=0;o<r.length-1;o++){let a=r[o];for(let l=o+1;l<r.length;l++){let c=r[l];if(a.sameState(c)||a.buffer.length>500&&c.buffer.length>500)if((a.score-c.score||a.buffer.length-c.buffer.length)>0)r.splice(l--,1);else{r.splice(o--,1);continue e}}}r.length>12&&(r.sort((o,a)=>a.score-o.score),r.splice(12,r.length-12))}this.minStackPos=r[0].pos;for(let o=1;o<r.length;o++)r[o].pos<this.minStackPos&&(this.minStackPos=r[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,r){let s=e.pos,{parser:n}=this,o=Yi?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,h=c?e.curContext.hash:0;for(let u=this.fragments.nodeAt(s);u;){let d=this.parser.nodeSet.types[u.type.id]==u.type?n.getGoto(e.state,u.type.id):-1;if(d>-1&&u.length&&(!c||(u.prop(Ue.contextHash)||0)==h))return e.useNode(u,d),Yi&&console.log(o+this.stackID(e)+` (via reuse of ${n.getName(u.type.id)})`),!0;if(!(u instanceof ht)||u.children.length==0||u.positions[0]>0)break;let f=u.children[0];if(f instanceof ht&&u.positions[0]==0)u=f;else break}}let a=n.stateSlot(e.state,4);if(a>0)return e.reduce(a),Yi&&console.log(o+this.stackID(e)+` (via always-reduce ${n.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;c<l.length;){let h=l[c++],u=l[c++],d=l[c++],f=c==l.length||!r,p=f?e:e.split(),g=this.tokens.mainToken;if(p.apply(h,u,g?g.start:p.pos,d),Yi&&console.log(o+this.stackID(p)+` (via ${(h&65536)==0?"shift":`reduce of ${n.getName(h&65535)}`} for ${n.getName(u)} @ ${s}${p==e?"":", split"})`),f)return!0;p.pos>s?t.push(p):r.push(p)}return!1}advanceFully(e,t){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return g1(e,t),!0}}runRecovery(e,t,r){let s=null,n=!1;for(let o=0;o<e.length;o++){let a=e[o],l=t[o<<1],c=t[(o<<1)+1],h=Yi?this.stackID(a)+" -> ":"";if(a.deadEnd&&(n||(n=!0,a.restart(),Yi&&console.log(h+this.stackID(a)+" (restarted)"),this.advanceFully(a,r))))continue;let u=a.split(),d=h;for(let f=0;f<10&&u.forceReduce()&&(Yi&&console.log(d+this.stackID(u)+" (via force-reduce)"),!this.advanceFully(u,r));f++)Yi&&(d=this.stackID(u)+" -> ");for(let f of a.recoverByInsert(l))Yi&&console.log(h+this.stackID(f)+" (via recover-insert)"),this.advanceFully(f,r);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),Yi&&console.log(h+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),g1(a,r)):(!s||s.score<u.score)&&(s=u)}return s}stackToTree(e){return e.close(),ht.build({buffer:fu.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(Pd||(Pd=new WeakMap)).get(e);return t||Pd.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function g1(i,e){for(let t=0;t<e.length;t++){let r=e[t];if(r.pos==i.pos&&r.sameState(i)){e[t].score<i.score&&(e[t]=i);return}}e.push(i)}class yL{constructor(e,t,r){this.source=e,this.flags=t,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}const Td=i=>i;class ow{constructor(e){this.start=e.start,this.shift=e.shift||Td,this.reduce=e.reduce||Td,this.reuse=e.reuse||Td,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Jo extends jm{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let a=0;a<e.repeatNodeCount;a++)t.push("");let r=Object.keys(e.topRules).map(a=>e.topRules[a][1]),s=[];for(let a=0;a<t.length;a++)s.push([]);function n(a,l,c){s[a].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=Ue[l]);for(let c=1;c<a.length;){let h=a[c++];if(h>=0)n(h,l,a[c++]);else{let u=a[c+-h];for(let d=-h;d>0;d--)n(a[c++],l,u);c++}}}this.nodeSet=new nc(t.map((a,l)=>Gt.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:s[l],top:r.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=hy;let o=sl(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(v1),this.states=sl(e.states,Uint32Array),this.data=sl(e.stateData),this.goto=sl(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new Wo(o,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,r){let s=new bL(this,e,t,r);for(let n of this.wrappers)s=n(s,e,t,r);return s}getGoto(e,t,r=!1){let s=this.goto;if(t>=s[0])return-1;for(let n=s[t+1];;){let o=s[n++],a=o&1,l=s[n++];if(a&&r)return l;for(let c=n+(o>>1);n<c;n++)if(s[n]==e)return l;if(a)return-1}}hasAction(e,t){let r=this.data;for(let s=0;s<2;s++)for(let n=this.stateSlot(e,s?2:1),o;;n+=3){if((o=r[n])==65535)if(r[n+1]==1)o=r[n=Ms(r,n+2)];else{if(r[n+1]==2)return Ms(r,n+2);break}if(o==t||o==0)return Ms(r,n+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,r=>r==t?!0:null)}allActions(e,t){let r=this.stateSlot(e,4),s=r?t(r):void 0;for(let n=this.stateSlot(e,1);s==null;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=Ms(this.data,n+2);else break;s=t(Ms(this.data,n+1))}return s}nextStates(e){let t=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Ms(this.data,r+2);else break;if((this.data[r+2]&1)==0){let s=this.data[r+1];t.some((n,o)=>o&1&&n==s)||t.push(this.data[r],s)}}return t}configure(e){let t=Object.assign(Object.create(Jo.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=r}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(r=>{let s=e.tokenizers.find(n=>n.from==r);return s?s.to:r})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((r,s)=>{let n=e.specializers.find(a=>a.from==r.external);if(!n)return r;let o=Object.assign(Object.assign({},r),{external:n.to});return t.specializers[s]=v1(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),r=t.map(()=>!1);if(e)for(let n of e.split(" ")){let o=t.indexOf(n);o>=0&&(r[o]=!0)}let s=null;for(let n=0;n<t.length;n++)if(!r[n])for(let o=this.dialects[t[n]],a;(a=this.data[o++])!=65535;)(s||(s=new Uint8Array(this.maxTerm+1)))[a]=1;return new yL(e,r,s)}static deserialize(e){return new Jo(e)}}function Ms(i,e){return i[e]|i[e+1]<<16}function xL(i){let e=null;for(let t of i){let r=t.p.stoppedAt;(t.pos==t.p.stream.end||r!=null&&t.pos>r)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function v1(i){if(i.external){let e=i.extend?1:0;return(t,r)=>i.external(t,r)<<1|e}return i.get}const wL=55,SL=1,kL=56,CL=2,$L=57,PL=3,O1=4,TL=5,yg=6,aw=7,lw=8,cw=9,hw=10,ML=11,QL=12,AL=13,Md=58,RL=14,BL=15,_1=59,uw=21,LL=23,dw=24,EL=25,xp=27,fw=28,DL=29,IL=32,zL=35,NL=37,WL=38,ZL=0,XL=1,FL={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},VL={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},b1={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function qL(i){return i==45||i==46||i==58||i>=65&&i<=90||i==95||i>=97&&i<=122||i>=161}let y1=null,x1=null,w1=0;function wp(i,e){let t=i.pos+e;if(w1==t&&x1==i)return y1;let r=i.peek(e),s="";for(;qL(r);)s+=String.fromCharCode(r),r=i.peek(++e);return x1=i,w1=t,y1=s?s.toLowerCase():r==HL||r==UL?void 0:null}const pw=60,mu=62,xg=47,HL=63,UL=33,YL=45;function S1(i,e){this.name=i,this.parent=e}const jL=[yg,hw,aw,lw,cw],GL=new ow({start:null,shift(i,e,t,r){return jL.indexOf(e)>-1?new S1(wp(r,1)||"",i):i},reduce(i,e){return e==uw&&i?i.parent:i},reuse(i,e,t,r){let s=e.type.id;return s==yg||s==NL?new S1(wp(r,1)||"",i):i},strict:!1}),KL=new ar((i,e)=>{if(i.next!=pw){i.next<0&&e.context&&i.acceptToken(Md);return}i.advance();let t=i.next==xg;t&&i.advance();let r=wp(i,0);if(r===void 0)return;if(!r)return i.acceptToken(t?BL:RL);let s=e.context?e.context.name:null;if(t){if(r==s)return i.acceptToken(ML);if(s&&VL[s])return i.acceptToken(Md,-2);if(e.dialectEnabled(ZL))return i.acceptToken(QL);for(let n=e.context;n;n=n.parent)if(n.name==r)return;i.acceptToken(AL)}else{if(r=="script")return i.acceptToken(aw);if(r=="style")return i.acceptToken(lw);if(r=="textarea")return i.acceptToken(cw);if(FL.hasOwnProperty(r))return i.acceptToken(hw);s&&b1[s]&&b1[s][r]?i.acceptToken(Md,-1):i.acceptToken(yg)}},{contextual:!0}),JL=new ar(i=>{for(let e=0,t=0;;t++){if(i.next<0){t&&i.acceptToken(_1);break}if(i.next==YL)e++;else if(i.next==mu&&e>=2){t>=3&&i.acceptToken(_1,-2);break}else e=0;i.advance()}});function eE(i){for(;i;i=i.parent)if(i.name=="svg"||i.name=="math")return!0;return!1}const tE=new ar((i,e)=>{if(i.next==xg&&i.peek(1)==mu){let t=e.dialectEnabled(XL)||eE(e.context);i.acceptToken(t?TL:O1,2)}else i.next==mu&&i.acceptToken(O1,1)});function wg(i,e,t){let r=2+i.length;return new ar(s=>{for(let n=0,o=0,a=0;;a++){if(s.next<0){a&&s.acceptToken(e);break}if(n==0&&s.next==pw||n==1&&s.next==xg||n>=2&&n<r&&s.next==i.charCodeAt(n-2))n++,o++;else if(n==r&&s.next==mu){a>o?s.acceptToken(e,-o):s.acceptToken(t,-(o-2));break}else if((s.next==10||s.next==13)&&a){s.acceptToken(e,1);break}else n=o=0;s.advance()}})}const iE=wg("script",wL,SL),rE=wg("style",kL,CL),sE=wg("textarea",$L,PL),nE=ra({"Text RawText IncompleteTag IncompleteCloseTag":B.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":B.angleBracket,TagName:B.tagName,"MismatchedCloseTag/TagName":[B.tagName,B.invalid],AttributeName:B.attributeName,"AttributeValue UnquotedAttributeValue":B.attributeValue,Is:B.definitionOperator,"EntityReference CharacterReference":B.character,Comment:B.blockComment,ProcessingInst:B.processingInstruction,DoctypeDecl:B.documentMeta}),oE=Jo.deserialize({version:14,states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ncompleteTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:68,context:GL,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,22,31,34,37,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,30,33,36,38,"OpenTag"],["group",-10,14,15,18,19,20,21,40,41,42,43,"Entity",17,"Entity TextContent",-3,29,32,35,"TextContent Entity"],["isolate",-11,22,30,31,33,34,36,37,38,39,42,43,"ltr",-3,27,28,40,""]],propSources:[nE],skippedNodes:[0],repeatNodeCount:9,tokenData:"!<p!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs3_sv-_vw3}wxHYx}-_}!OH{!O!P-_!P!Q$q!Q![-_![!]Mz!]!^-_!^!_!$S!_!`!;x!`!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz1p4U-_4U4dMz4d4e-_4e$ISMz$IS$I`-_$I`$IbMz$Ib$Kh-_$Kh%#tMz%#t&/x-_&/x&EtMz&Et&FV-_&FV;'SMz;'S;:j!#|;:j;=`3X<%l?&r-_?&r?AhMz?Ah?BY$q?BY?MnMz?MnO$q!Z$|caPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr$qrs&}sv$qvw+Pwx(tx!^$q!^!_*V!_!a&X!a#S$q#S#T&X#T;'S$q;'S;=`+z<%lO$q!R&bXaP!b`!dpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&Xq'UVaP!dpOv&}wx'kx!^&}!^!_(V!_;'S&};'S;=`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dpOr*Vrs(Vsv*Vwx)ex#X*V#X#Y!+q#Y;'S*V;'S;=`*s<%lO*V!R!4{Y!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!a!4t!a!b!:]!b;'S!4t;'S;=`!;r<%lO!4tq!5pV!dpOv!5kvx!6Vx!a!5k!a!b!7W!b;'S!5k;'S;=`!8V<%lO!5kP!6YTO!a!6V!a!b!6i!b;'S!6V;'S;=`!7Q<%lO!6VP!6lTO!`!6V!`!a!6{!a;'S!6V;'S;=`!7Q<%lO!6VP!7QOyPP!7TP;=`<%l!6Vq!7]V!dpOv!5kvx!6Vx!`!5k!`!a!7r!a;'S!5k;'S;=`!8V<%lO!5kq!7yS!dpyPOv(Vx;'S(V;'S;=`(h<%lO(Vq!8YP;=`<%l!5ka!8bX!b`Or!8]rs!6Vsv!8]vw!6Vw!a!8]!a!b!8}!b;'S!8];'S;=`!:V<%lO!8]a!9SX!b`Or!8]rs!6Vsv!8]vw!6Vw!`!8]!`!a!9o!a;'S!8];'S;=`!:V<%lO!8]a!9vT!b`yPOr)esv)ew;'S)e;'S;=`)y<%lO)ea!:YP;=`<%l!8]!R!:dY!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!`!4t!`!a!;S!a;'S!4t;'S;=`!;r<%lO!4t!R!;]V!b`!dpyPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!<TXjSaP!b`!dpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X",tokenizers:[iE,rE,sE,tE,KL,JL,0,1,2,3,4,5],topRules:{Document:[0,16]},dialects:{noMatch:0,selfClosing:515},tokenPrec:517});function mw(i,e){let t=Object.create(null);for(let r of i.getChildren(dw)){let s=r.getChild(EL),n=r.getChild(xp)||r.getChild(fw);s&&(t[e.read(s.from,s.to)]=n?n.type.id==xp?e.read(n.from+1,n.to-1):e.read(n.from,n.to):"")}return t}function k1(i,e){let t=i.getChild(LL);return t?e.read(t.from,t.to):" "}function Qd(i,e,t){let r;for(let s of t)if(!s.attrs||s.attrs(r||(r=mw(i.node.parent.firstChild,e))))return{parser:s.parser,bracketed:!0};return null}function gw(i=[],e=[]){let t=[],r=[],s=[],n=[];for(let a of i)(a.tag=="script"?t:a.tag=="style"?r:a.tag=="textarea"?s:n).push(a);let o=e.length?Object.create(null):null;for(let a of e)(o[a.name]||(o[a.name]=[])).push(a);return my((a,l)=>{let c=a.type.id;if(c==DL)return Qd(a,l,t);if(c==IL)return Qd(a,l,r);if(c==zL)return Qd(a,l,s);if(c==uw&&n.length){let h=a.node,u=h.firstChild,d=u&&k1(u,l),f;if(d){for(let p of n)if(p.tag==d&&(!p.attrs||p.attrs(f||(f=mw(u,l))))){let g=h.lastChild,O=g.type.id==WL?g.from:h.to;if(O>u.to)return{parser:p.parser,overlay:[{from:u.to,to:O}]}}}}if(o&&c==dw){let h=a.node,u;if(u=h.firstChild){let d=o[l.read(u.from,u.to)];if(d)for(let f of d){if(f.tagName&&f.tagName!=k1(h.parent,l))continue;let p=h.lastChild;if(p.type.id==xp){let g=p.from+1,O=p.lastChild,_=p.to-(O&&O.isError?0:1);if(_>g)return{parser:f.parser,overlay:[{from:g,to:_}],bracketed:!0}}else if(p.type.id==fw)return{parser:f.parser,overlay:[{from:p.from,to:p.to}]}}}}return null})}const aE=122,C1=1,lE=123,cE=124,vw=2,hE=125,uE=3,dE=4,Ow=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],fE=58,pE=40,_w=95,mE=91,wh=45,gE=46,vE=35,OE=37,_E=38,bE=92,yE=10,xE=42;function Fl(i){return i>=65&&i<=90||i>=97&&i<=122||i>=161}function Sg(i){return i>=48&&i<=57}function $1(i){return Sg(i)||i>=97&&i<=102||i>=65&&i<=70}const bw=(i,e,t)=>(r,s)=>{for(let n=!1,o=0,a=0;;a++){let{next:l}=r;if(Fl(l)||l==wh||l==_w||n&&Sg(l))!n&&(l!=wh||a>0)&&(n=!0),o===a&&l==wh&&o++,r.advance();else if(l==bE&&r.peek(1)!=yE){if(r.advance(),$1(r.next)){do r.advance();while($1(r.next));r.next==32&&r.advance()}else r.next>-1&&r.advance();n=!0}else{n&&r.acceptToken(o==2&&s.canShift(vw)?e:l==pE?t:i);break}}},wE=new ar(bw(lE,vw,cE)),SE=new ar(bw(hE,uE,dE)),kE=new ar(i=>{if(Ow.includes(i.peek(-1))){let{next:e}=i;(Fl(e)||e==_w||e==vE||e==gE||e==xE||e==mE||e==fE&&Fl(i.peek(1))||e==wh||e==_E)&&i.acceptToken(aE)}}),CE=new ar(i=>{if(!Ow.includes(i.peek(-1))){let{next:e}=i;if(e==OE&&(i.advance(),i.acceptToken(C1)),Fl(e)){do i.advance();while(Fl(i.next)||Sg(i.next));i.acceptToken(C1)}}}),$E=ra({"AtKeyword import charset namespace keyframes media supports":B.definitionKeyword,"from to selector":B.keyword,NamespaceName:B.namespace,KeyframeName:B.labelName,KeyframeRangeName:B.operatorKeyword,TagName:B.tagName,ClassName:B.className,PseudoClassName:B.constant(B.className),IdName:B.labelName,"FeatureName PropertyName":B.propertyName,AttributeName:B.attributeName,NumberLiteral:B.number,KeywordQuery:B.keyword,UnaryQueryOp:B.operatorKeyword,"CallTag ValueName":B.atom,VariableName:B.variableName,Callee:B.operatorKeyword,Unit:B.unit,"UniversalSelector NestingSelector":B.definitionOperator,"MatchOp CompareOp":B.compareOperator,"ChildOp SiblingOp, LogicOp":B.logicOperator,BinOp:B.arithmeticOperator,Important:B.modifier,Comment:B.blockComment,ColorLiteral:B.color,"ParenthesizedContent StringLiteral":B.string,":":B.punctuation,"PseudoOp #":B.derefOperator,"; ,":B.separator,"( )":B.paren,"[ ]":B.squareBracket,"{ }":B.brace}),PE={__proto__:null,lang:38,"nth-child":38,"nth-last-child":38,"nth-of-type":38,"nth-last-of-type":38,dir:38,"host-context":38,if:84,url:124,"url-prefix":124,domain:124,regexp:124},TE={__proto__:null,or:98,and:98,not:106,only:106,layer:170},ME={__proto__:null,selector:112,layer:166},QE={__proto__:null,"@import":162,"@media":174,"@charset":178,"@namespace":182,"@keyframes":188,"@supports":200,"@scope":204},AE={__proto__:null,to:207},RE=Jo.deserialize({version:14,states:"EbQYQdOOO#qQdOOP#xO`OOOOQP'#Cf'#CfOOQP'#Ce'#CeO#}QdO'#ChO$nQaO'#CcO$xQdO'#CkO%TQdO'#DpO%YQdO'#DrO%_QdO'#DuO%_QdO'#DxOOQP'#FV'#FVO&eQhO'#EhOOQS'#FU'#FUOOQS'#Ek'#EkQYQdOOO&lQdO'#EOO&PQhO'#EUO&lQdO'#EWO'aQdO'#EYO'lQdO'#E]O'tQhO'#EcO(VQdO'#EeO(bQaO'#CfO)VQ`O'#D{O)[Q`O'#F`O)gQdO'#F`QOQ`OOP)qO&jO'#CaPOOO)C@t)C@tOOQP'#Cj'#CjOOQP,59S,59SO#}QdO,59SO)|QdO,59VO%TQdO,5:[O%YQdO,5:^O%_QdO,5:aO%_QdO,5:cO%_QdO,5:dO%_QdO'#ErO*XQ`O,58}O*aQdO'#DzOOQS,58},58}OOQP'#Cn'#CnOOQO'#Dn'#DnOOQP,59V,59VO*hQ`O,59VO*mQ`O,59VOOQP'#Dq'#DqOOQP,5:[,5:[OOQO'#Ds'#DsO*rQpO,5:^O+]QaO,5:aO+sQaO,5:dOOQW'#DZ'#DZO,ZQhO'#DdO,xQhO'#FaO'tQhO'#DbO-WQ`O'#DhOOQW'#F['#F[O-]Q`O,5;SO-eQ`O'#DeOOQS-E8i-E8iOOQ['#Cs'#CsO-jQdO'#CtO.QQdO'#CzO.hQdO'#C}O/OQ!pO'#DPO1RQ!jO,5:jOOQO'#DU'#DUO*mQ`O'#DTO1cQ!nO'#FXO3`Q`O'#DVO3eQ`O'#DkOOQ['#FX'#FXO-`Q`O,5:pO3jQ!bO,5:rOOQS'#E['#E[O3rQ`O,5:tO3wQdO,5:tOOQO'#E_'#E_O4PQ`O,5:wO4UQhO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%hR&p&P]#s!c!d!e#t#v#xW!Z]b!g$PQ!ufQ#f!YQ#l![Q$v#iQ$w#jQ$z#mS%V$R%XR&i%xQ#h!YQ%w$tR&w&hR$|#mR$n#`QlPR#_zQ!_]Q!nbQ$O!gR%U$P",nodeNames:"⚠ Unit VariableName VariableName QueryCallee Comment StyleSheet RuleSet UniversalSelector TagSelector TagName NestingSelector ClassSelector . ClassName PseudoClassSelector : :: PseudoClassName PseudoClassName ) ( ArgList ValueName ParenthesizedValue AtKeyword # ; ] [ BracketedValue } { BracedValue ColorLiteral NumberLiteral StringLiteral BinaryExpression BinOp CallExpression Callee IfExpression if ArgList IfBranch KeywordQuery FeatureQuery FeatureName BinaryQuery LogicOp ComparisonQuery CompareOp UnaryQuery UnaryQueryOp ParenthesizedQuery SelectorQuery selector ParenthesizedSelector CallQuery ArgList , CallLiteral CallTag ParenthesizedContent PseudoClassName ArgList IdSelector IdName AttributeSelector AttributeName MatchOp ChildSelector ChildOp DescendantSelector SiblingSelector SiblingOp Block Declaration PropertyName Important ImportStatement import Layer layer LayerName layer MediaStatement media CharsetStatement charset NamespaceStatement namespace NamespaceName KeyframesStatement keyframes KeyframeName KeyframeList KeyframeSelector KeyframeRangeName SupportsStatement supports ScopeStatement scope to AtRule Styles",maxTerm:143,nodeProps:[["isolate",-2,5,36,""],["openedBy",20,"(",28,"[",31,"{"],["closedBy",21,")",29,"]",32,"}"]],propSources:[$E],skippedNodes:[0,5,106],repeatNodeCount:15,tokenData:"JQ~R!YOX$qX^%i^p$qpq%iqr({rs-ust/itu6Wuv$qvw7Qwx7cxy9Qyz9cz{9h{|:R|}>t}!O?V!O!P?t!P!Q@]!Q![AU![!]BP!]!^B{!^!_C^!_!`DY!`!aDm!a!b$q!b!cEn!c!}$q!}#OG{#O#P$q#P#QH^#Q#R6W#R#o$q#o#pHo#p#q6W#q#rIQ#r#sIc#s#y$q#y#z%i#z$f$q$f$g%i$g#BY$q#BY#BZ%i#BZ$IS$q$IS$I_%i$I_$I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a`Oy%Qz;'S%Q;'S;=`%c<%lO%QlDaS!TW!hSOy%Qz;'S%Q;'S;=`%c<%lO%QjDtV!jQ!TWOy%Qz!_%Q!_!`Cu!`!aEZ!a;'S%Q;'S;=`%c<%lO%QbEbS!jQ!a`Oy%Qz;'S%Q;'S;=`%c<%lO%QjEqYOy%Qz}%Q}!OFa!O!c%Q!c!}GO!}#T%Q#T#oGO#o;'S%Q;'S;=`%c<%lO%QjFfW!a`Oy%Qz!c%Q!c!}GO!}#T%Q#T#oGO#o;'S%Q;'S;=`%c<%lO%QjGV[iY!a`Oy%Qz}%Q}!OGO!O!Q%Q!Q![GO![!c%Q!c!}GO!}#T%Q#T#oGO#o;'S%Q;'S;=`%c<%lO%QjHQSmYOy%Qz;'S%Q;'S;=`%c<%lO%QnHcSl^Oy%Qz;'S%Q;'S;=`%c<%lO%QjHtSpYOy%Qz;'S%Q;'S;=`%c<%lO%QjIVSoYOy%Qz;'S%Q;'S;=`%c<%lO%QfIhU!mQOy%Qz!_%Q!_!`6m!`;'S%Q;'S;=`%c<%lO%Q`I}P;=`<%l$q",tokenizers:[kE,CE,wE,SE,1,2,3,4,new pu("m~RRYZ[z{a~~g~aO#v~~dP!P!Qg~lO#w~~",28,129)],topRules:{StyleSheet:[0,6],Styles:[1,105]},dynamicPrecedences:{76:1},specialized:[{term:124,get:i=>PE[i]||-1},{term:125,get:i=>TE[i]||-1},{term:4,get:i=>ME[i]||-1},{term:25,get:i=>QE[i]||-1},{term:123,get:i=>AE[i]||-1}],tokenPrec:1963});let Ad=null;function Rd(){if(!Ad&&typeof document=="object"&&document.body){let{style:i}=document.body,e=[],t=new Set;for(let r in i)r!="cssText"&&r!="cssFloat"&&typeof i[r]=="string"&&(/[A-Z]/.test(r)&&(r=r.replace(/[A-Z]/g,s=>"-"+s.toLowerCase())),t.has(r)||(e.push(r),t.add(r)));Ad=e.sort().map(r=>({type:"property",label:r,apply:r+": "}))}return Ad||[]}const P1=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(i=>({type:"class",label:i})),T1=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(i=>({type:"keyword",label:i})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(i=>({type:"constant",label:i}))),BE=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(i=>({type:"type",label:i})),LE=["@charset","@color-profile","@container","@counter-style","@font-face","@font-feature-values","@font-palette-values","@import","@keyframes","@layer","@media","@namespace","@page","@position-try","@property","@scope","@starting-style","@supports","@view-transition"].map(i=>({type:"keyword",label:i})),ys=/^(\w[\w-]*|-\w[\w-]*|)$/,EE=/^-(-[\w-]*)?$/;function DE(i,e){var t;if((i.name=="("||i.type.isError)&&(i=i.parent||i),i.name!="ArgList")return!1;let r=(t=i.parent)===null||t===void 0?void 0:t.firstChild;return r?.name!="Callee"?!1:e.sliceString(r.from,r.to)=="var"}const M1=new py,IE=["Declaration"];function zE(i){for(let e=i;;){if(e.type.isTop)return e;if(!(e=e.parent))return i}}function yw(i,e,t){if(e.to-e.from>4096){let r=M1.get(e);if(r)return r;let s=[],n=new Set,o=e.cursor(dt.IncludeAnonymous);if(o.firstChild())do for(let a of yw(i,o.node,t))n.has(a.label)||(n.add(a.label),s.push(a));while(o.nextSibling());return M1.set(e,s),s}else{let r=[],s=new Set;return e.cursor().iterate(n=>{var o;if(t(n)&&n.matchContext(IE)&&((o=n.node.nextSibling)===null||o===void 0?void 0:o.name)==":"){let a=i.sliceString(n.from,n.to);s.has(a)||(s.add(a),r.push({label:a,type:"variable"}))}}),r}}const NE=i=>e=>{let{state:t,pos:r}=e,s=bt(t).resolveInner(r,-1),n=s.type.isError&&s.from==s.to-1&&t.doc.sliceString(s.from,s.to)=="-";if(s.name=="PropertyName"||(n||s.name=="TagName")&&/^(Block|Styles)$/.test(s.resolve(s.to).name))return{from:s.from,options:Rd(),validFor:ys};if(s.name=="ValueName")return{from:s.from,options:T1,validFor:ys};if(s.name=="PseudoClassName")return{from:s.from,options:P1,validFor:ys};if(i(s)||(e.explicit||n)&&DE(s,t.doc))return{from:i(s)||n?s.from:r,options:yw(t.doc,zE(s),i),validFor:EE};if(s.name=="TagName"){for(let{parent:l}=s;l;l=l.parent)if(l.name=="Block")return{from:s.from,options:Rd(),validFor:ys};return{from:s.from,options:BE,validFor:ys}}if(s.name=="AtKeyword")return{from:s.from,options:LE,validFor:ys};if(!e.explicit)return null;let o=s.resolve(r),a=o.childBefore(r);return a&&a.name==":"&&o.name=="PseudoClassSelector"?{from:r,options:P1,validFor:ys}:a&&a.name==":"&&o.name=="Declaration"||o.name=="ArgList"?{from:r,options:T1,validFor:ys}:o.name=="Block"||o.name=="Styles"?{from:r,options:Rd(),validFor:ys}:null},WE=NE(i=>i.name=="VariableName"),gu=Yo.define({name:"css",parser:RE.configure({props:[ac.add({Declaration:yh()}),sa.add({"Block KeyframeList":xy})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function ZE(){return new Bl(gu,gu.data.of({autocomplete:WE}))}const XE=316,FE=317,Q1=1,VE=2,qE=3,HE=4,UE=318,YE=320,jE=321,GE=5,KE=6,JE=0,Sp=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],xw=125,e8=59,kp=47,t8=42,i8=43,r8=45,s8=60,n8=44,o8=63,a8=46,l8=91,c8=new ow({start:!1,shift(i,e){return e==GE||e==KE||e==YE?i:e==jE},strict:!1}),h8=new ar((i,e)=>{let{next:t}=i;(t==xw||t==-1||e.context)&&i.acceptToken(UE)},{contextual:!0,fallback:!0}),u8=new ar((i,e)=>{let{next:t}=i,r;Sp.indexOf(t)>-1||t==kp&&((r=i.peek(1))==kp||r==t8)||t!=xw&&t!=e8&&t!=-1&&!e.context&&i.acceptToken(XE)},{contextual:!0}),d8=new ar((i,e)=>{i.next==l8&&!e.context&&i.acceptToken(FE)},{contextual:!0}),f8=new ar((i,e)=>{let{next:t}=i;if(t==i8||t==r8){if(i.advance(),t==i.next){i.advance();let r=!e.context&&e.canShift(Q1);i.acceptToken(r?Q1:VE)}}else t==o8&&i.peek(1)==a8&&(i.advance(),i.advance(),(i.next<48||i.next>57)&&i.acceptToken(qE))},{contextual:!0});function Bd(i,e){return i>=65&&i<=90||i>=97&&i<=122||i==95||i>=192||!e&&i>=48&&i<=57}const p8=new ar((i,e)=>{if(i.next!=s8||!e.dialectEnabled(JE)||(i.advance(),i.next==kp))return;let t=0;for(;Sp.indexOf(i.next)>-1;)i.advance(),t++;if(Bd(i.next,!0)){for(i.advance(),t++;Bd(i.next,!1);)i.advance(),t++;for(;Sp.indexOf(i.next)>-1;)i.advance(),t++;if(i.next==n8)return;for(let r=0;;r++){if(r==7){if(!Bd(i.next,!0))return;break}if(i.next!="extends".charCodeAt(r))break;i.advance(),t++}}i.acceptToken(HE,-t)}),m8=ra({"get set async static":B.modifier,"for while do if else switch try catch finally return throw break continue default case defer":B.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":B.operatorKeyword,"let var const using function class extends":B.definitionKeyword,"import export from":B.moduleKeyword,"with debugger new":B.keyword,TemplateString:B.special(B.string),super:B.atom,BooleanLiteral:B.bool,this:B.self,null:B.null,Star:B.modifier,VariableName:B.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":B.function(B.variableName),VariableDefinition:B.definition(B.variableName),Label:B.labelName,PropertyName:B.propertyName,PrivatePropertyName:B.special(B.propertyName),"CallExpression/MemberExpression/PropertyName":B.function(B.propertyName),"FunctionDeclaration/VariableDefinition":B.function(B.definition(B.variableName)),"ClassDeclaration/VariableDefinition":B.definition(B.className),"NewExpression/VariableName":B.className,PropertyDefinition:B.definition(B.propertyName),PrivatePropertyDefinition:B.definition(B.special(B.propertyName)),UpdateOp:B.updateOperator,"LineComment Hashbang":B.lineComment,BlockComment:B.blockComment,Number:B.number,String:B.string,Escape:B.escape,ArithOp:B.arithmeticOperator,LogicOp:B.logicOperator,BitOp:B.bitwiseOperator,CompareOp:B.compareOperator,RegExp:B.regexp,Equals:B.definitionOperator,Arrow:B.function(B.punctuation),": Spread":B.punctuation,"( )":B.paren,"[ ]":B.squareBracket,"{ }":B.brace,"InterpolationStart InterpolationEnd":B.special(B.brace),".":B.derefOperator,", ;":B.separator,"@":B.meta,TypeName:B.typeName,TypeDefinition:B.definition(B.typeName),"type enum interface implements namespace module declare":B.definitionKeyword,"abstract global Privacy readonly override":B.modifier,"is keyof unique infer asserts":B.operatorKeyword,JSXAttributeValue:B.attributeValue,JSXText:B.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":B.angleBracket,"JSXIdentifier JSXNameSpacedName":B.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":B.attributeName,"JSXBuiltin/JSXIdentifier":B.standard(B.tagName)}),g8={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:235,private:235,protected:235,readonly:237,instanceof:256,satisfies:259,import:292,keyof:349,unique:353,infer:359,asserts:395,is:397,abstract:417,implements:419,type:421,let:424,var:426,using:429,interface:435,enum:439,namespace:445,module:447,declare:451,global:455,defer:471,for:476,of:485,while:488,with:492,do:496,if:500,else:502,switch:506,case:512,try:518,catch:522,finally:526,return:530,throw:534,break:538,continue:542,debugger:546},v8={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:401},O8={__proto__:null,"<":193},_8=Jo.deserialize({version:14,states:"$F|Q%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&jO'#CjO+oO#@ItO'#DaO.QQlO'#DgO.bQlO'#DrO%[QlO'#DzO0fQlO'#ESOOQ!0Lf'#E['#E[O1PQ`O'#EXOOQO'#Ep'#EpOOQO'#Il'#IlO1XQ`O'#GsO1dQ`O'#EoO1iQ`O'#EoO3hQ!0MxO'#JrO6[Q!0MxO'#JsO6uQ`O'#F]O6z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z#d%m&r&t&u&w,s,x2[2_Q&l!VR,h&itmOXst!U!V!Z#d%m&i&r&t&u&w,s,x2[2_R,o&oT%lm,oR1k,XR,g&gQ&U|S+}&V&WR1^,OR+s&PT&p!W&sT&q!W&sT2^,x2_",nodeNames:"⚠ ArithOp ArithOp ?. JSXStartTag LineComment BlockComment Script Hashbang ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:380,context:c8,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,207,211,215,216,218,221,224,234,237,243,245,247,249,252,258,264,266,268,270,272,274,275,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,120,121,136,139,141,142,143,144,145,147,148,167,169,171,"Expression",-23,31,33,37,41,43,45,173,175,177,178,180,181,182,184,185,186,188,189,190,201,203,205,206,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"<",38,"InterpolationStart",56,"[",60,"{",73,"(",160,"JSXStartCloseTag"],["closedBy",-2,24,168,">",40,"InterpolationEnd",50,"]",61,"}",74,")",165,"JSXEndTag"]],propSources:[m8],skippedNodes:[0,5,6,278],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q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qr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr07[$D|k$i&j(Wp(Z!b'}0/l$]#t(T,2j(e$I[OY%ZYZ&cZr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$g%Z$g;'SEr;'S;=`I|<%lOEr",tokenizers:[u8,d8,f8,p8,2,3,4,5,6,7,8,9,10,11,12,13,14,h8,new pu("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOx~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!U~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(c~~",141,340),new pu("j~RQYZXz{^~^O(Q~~aP!P!Qd~iO(R~~",25,323)],topRules:{Script:[0,7],SingleExpression:[1,276],SingleClassItem:[2,277]},dialects:{jsx:0,ts:15175},dynamicPrecedences:{80:1,82:1,94:1,169:1,199:1},specialized:[{term:327,get:i=>g8[i]||-1},{term:343,get:i=>v8[i]||-1},{term:95,get:i=>O8[i]||-1}],tokenPrec:15201}),ww=[Wi("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),Wi("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),Wi("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Wi("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Wi("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),Wi(`try {
27
+ \${}
28
+ } catch (\${error}) {
29
+ \${}
30
+ }`,{label:"try",detail:"/ catch block",type:"keyword"}),Wi("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),Wi(`if (\${}) {
31
+ \${}
32
+ } else {
33
+ \${}
34
+ }`,{label:"if",detail:"/ else block",type:"keyword"}),Wi(`class \${name} {
35
+ constructor(\${params}) {
36
+ \${}
37
+ }
38
+ }`,{label:"class",detail:"definition",type:"keyword"}),Wi('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Wi('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],b8=ww.concat([Wi("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Wi("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Wi("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),A1=new py,Sw=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Za(i){return(e,t)=>{let r=e.node.getChild("VariableDefinition");return r&&t(r,i),!0}}const y8=["FunctionDeclaration"],x8={FunctionDeclaration:Za("function"),ClassDeclaration:Za("class"),ClassExpression:()=>!0,EnumDeclaration:Za("constant"),TypeAliasDeclaration:Za("type"),NamespaceDeclaration:Za("namespace"),VariableDefinition(i,e){i.matchContext(y8)||e(i,"variable")},TypeDefinition(i,e){e(i,"type")},__proto__:null};function kw(i,e){let t=A1.get(e);if(t)return t;let r=[],s=!0;function n(o,a){let l=i.sliceString(o.from,o.to);r.push({label:l,type:a})}return e.cursor(dt.IncludeAnonymous).iterate(o=>{if(s)s=!1;else if(o.name){let a=x8[o.name];if(a&&a(o,n)||Sw.has(o.name))return!1}else if(o.to-o.from>8192){for(let a of kw(i,o.node))r.push(a);return!1}}),A1.set(e,r),r}const R1=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Cw=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function w8(i){let e=bt(i.state).resolveInner(i.pos,-1);if(Cw.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&R1.test(i.state.sliceDoc(e.from,e.to));if(!t&&!i.explicit)return null;let r=[];for(let s=e;s;s=s.parent)Sw.has(s.name)&&(r=r.concat(kw(i.state.doc,s)));return{options:r,from:t?e.from:i.pos,validFor:R1}}const ls=Yo.define({name:"javascript",parser:_8.configure({props:[ac.add({IfStatement:yh({except:/^\s*({|else\b)/}),TryStatement:yh({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:dA,SwitchBody:i=>{let e=i.textAfter,t=/^\s*\}/.test(e),r=/^\s*(case|default)\b/.test(e);return i.baseIndent+(t?0:r?1:2)*i.unit},Block:uA({closing:"}"}),ArrowFunction:i=>i.baseIndent+i.unit,"TemplateString BlockComment":()=>null,"Statement Property":yh({except:/^\s*{/}),JSXElement(i){let e=/^\s*<\//.test(i.textAfter);return i.lineIndent(i.node.from)+(e?0:i.unit)},JSXEscape(i){let e=/\s*\}/.test(i.textAfter);return i.lineIndent(i.node.from)+(e?0:i.unit)},"JSXOpenTag JSXSelfClosingTag"(i){return i.column(i.node.from)+i.unit}}),sa.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":xy,BlockComment(i){return{from:i.from+2,to:i.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),$w={test:i=>/^JSX/.test(i.name),facet:Gm({commentTokens:{block:{open:"{/*",close:"*/}"}}})},Pw=ls.configure({dialect:"ts"},"typescript"),Tw=ls.configure({dialect:"jsx",props:[Km.add(i=>i.isTop?[$w]:void 0)]}),Mw=ls.configure({dialect:"jsx ts",props:[Km.add(i=>i.isTop?[$w]:void 0)]},"typescript");let Qw=i=>({label:i,type:"keyword"});const Aw="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(Qw),S8=Aw.concat(["declare","implements","private","protected","public"].map(Qw));function k8(i={}){let e=i.jsx?i.typescript?Mw:Tw:i.typescript?Pw:ls,t=i.typescript?b8.concat(S8):ww.concat(Aw);return new Bl(e,[ls.data.of({autocomplete:RR(Cw,xx(t))}),ls.data.of({autocomplete:w8}),i.jsx?P8:[]])}function C8(i){for(;;){if(i.name=="JSXOpenTag"||i.name=="JSXSelfClosingTag"||i.name=="JSXFragmentTag")return i;if(i.name=="JSXEscape"||!i.parent)return null;i=i.parent}}function B1(i,e,t=i.length){for(let r=e?.firstChild;r;r=r.nextSibling)if(r.name=="JSXIdentifier"||r.name=="JSXBuiltin"||r.name=="JSXNamespacedName"||r.name=="JSXMemberExpression")return i.sliceString(r.from,Math.min(r.to,t));return""}const $8=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),P8=Pe.inputHandler.of((i,e,t,r,s)=>{if(($8?i.composing:i.compositionStarted)||i.state.readOnly||e!=t||r!=">"&&r!="/"||!ls.isActiveAt(i.state,e,-1))return!1;let n=s(),{state:o}=n,a=o.changeByRange(l=>{var c;let{head:h}=l,u=bt(o).resolveInner(h-1,-1),d;if(u.name=="JSXStartTag"&&(u=u.parent),!(o.doc.sliceString(h-1,h)!=r||u.name=="JSXAttributeValue"&&u.to>h)){if(r==">"&&u.name=="JSXFragmentTag")return{range:l,changes:{from:h,insert:"</>"}};if(r=="/"&&u.name=="JSXStartCloseTag"){let f=u.parent,p=f.parent;if(p&&f.from==h-2&&((d=B1(o.doc,p.firstChild,h))||((c=p.firstChild)===null||c===void 0?void 0:c.name)=="JSXFragmentTag")){let g=`${d}>`;return{range:ue.cursor(h+g.length,-1),changes:{from:h,insert:g}}}}else if(r==">"){let f=C8(u);if(f&&f.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(o.doc.sliceString(h,h+2))&&(d=B1(o.doc,f,h)))return{range:l,changes:{from:h,insert:`</${d}>`}}}}return{range:l}});return a.changes.empty?!1:(i.dispatch([n,o.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),Xa=["_blank","_self","_top","_parent"],Ld=["ascii","utf-8","utf-16","latin1","latin1"],Ed=["get","post","put","delete"],Dd=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],ji=["true","false"],De={},T8={a:{attrs:{href:null,ping:null,type:null,media:null,target:Xa,hreflang:null}},abbr:De,address:De,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:De,aside:De,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:De,base:{attrs:{href:null,target:Xa}},bdi:De,bdo:De,blockquote:{attrs:{cite:null}},body:De,br:De,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:Dd,formmethod:Ed,formnovalidate:["novalidate"],formtarget:Xa,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:De,center:De,cite:De,code:De,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:De,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:De,div:De,dl:De,dt:De,em:De,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:De,figure:De,footer:De,form:{attrs:{action:null,name:null,"accept-charset":Ld,autocomplete:["on","off"],enctype:Dd,method:Ed,novalidate:["novalidate"],target:Xa}},h1:De,h2:De,h3:De,h4:De,h5:De,h6:De,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:De,hgroup:De,hr:De,html:{attrs:{manifest:null}},i:De,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:Dd,formmethod:Ed,formnovalidate:["novalidate"],formtarget:Xa,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:De,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:De,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:De,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Ld,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:De,noscript:De,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:De,param:{attrs:{name:null,value:null}},pre:De,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:De,rt:De,ruby:De,samp:De,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Ld}},section:De,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:De,source:{attrs:{src:null,type:null,media:null}},span:De,strong:De,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:De,summary:De,sup:De,table:De,tbody:De,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:De,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:De,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:De,time:{attrs:{datetime:null}},title:De,tr:De,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:De,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:De},Rw={accesskey:null,class:null,contenteditable:ji,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:ji,autocorrect:ji,autocapitalize:ji,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":ji,"aria-autocomplete":["inline","list","both","none"],"aria-busy":ji,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":ji,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":ji,"aria-hidden":ji,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":ji,"aria-multiselectable":ji,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":ji,"aria-relevant":null,"aria-required":ji,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},Bw="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(i=>"on"+i);for(let i of Bw)Rw[i]=null;class Vl{constructor(e,t){this.tags={...T8,...e},this.globalAttrs={...Rw,...t},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}Vl.default=new Vl;function ea(i,e,t=i.length){if(!e)return"";let r=e.firstChild,s=r&&r.getChild("TagName");return s?i.sliceString(s.from,Math.min(s.to,t)):""}function ta(i,e=!1){for(;i;i=i.parent)if(i.name=="Element")if(e)e=!1;else return i;return null}function Lw(i,e,t){let r=t.tags[ea(i,ta(e))];return r?.children||t.allTags}function kg(i,e){let t=[];for(let r=ta(e);r&&!r.type.isTop;r=ta(r.parent)){let s=ea(i,r);if(s&&r.lastChild.name=="CloseTag")break;s&&t.indexOf(s)<0&&(e.name=="EndTag"||e.from>=r.firstChild.to)&&t.push(s)}return t}const Ew=/^[:\-\.\w\u00b7-\uffff]*$/;function L1(i,e,t,r,s){let n=/\s*>/.test(i.sliceDoc(s,s+5))?"":">",o=ta(t,t.name=="StartTag"||t.name=="TagName");return{from:r,to:s,options:Lw(i.doc,o,e).map(a=>({label:a,type:"type"})).concat(kg(i.doc,t).map((a,l)=>({label:"/"+a,apply:"/"+a+n,type:"type",boost:99-l}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function E1(i,e,t,r){let s=/\s*>/.test(i.sliceDoc(r,r+5))?"":">";return{from:t,to:r,options:kg(i.doc,e).map((n,o)=>({label:n,apply:n+s,type:"type",boost:99-o})),validFor:Ew}}function M8(i,e,t,r){let s=[],n=0;for(let o of Lw(i.doc,t,e))s.push({label:"<"+o,type:"type"});for(let o of kg(i.doc,t))s.push({label:"</"+o+">",type:"type",boost:99-n++});return{from:r,to:r,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function Q8(i,e,t,r,s){let n=ta(t),o=n?e.tags[ea(i.doc,n)]:null,a=o&&o.attrs?Object.keys(o.attrs):[],l=o&&o.globalAttrs===!1?a:a.length?a.concat(e.globalAttrNames):e.globalAttrNames;return{from:r,to:s,options:l.map(c=>({label:c,type:"property"})),validFor:Ew}}function A8(i,e,t,r,s){var n;let o=(n=t.parent)===null||n===void 0?void 0:n.getChild("AttributeName"),a=[],l;if(o){let c=i.sliceDoc(o.from,o.to),h=e.globalAttrs[c];if(!h){let u=ta(t),d=u?e.tags[ea(i.doc,u)]:null;h=d?.attrs&&d.attrs[c]}if(h){let u=i.sliceDoc(r,s).toLowerCase(),d='"',f='"';/^['"]/.test(u)?(l=u[0]=='"'?/^[^"]*$/:/^[^']*$/,d="",f=i.sliceDoc(s,s+1)==u[0]?"":u[0],u=u.slice(1),r++):l=/^[^\s<>='"]*$/;for(let p of h)a.push({label:p,apply:d+p+f,type:"constant"})}}return{from:r,to:s,options:a,validFor:l}}function Dw(i,e){let{state:t,pos:r}=e,s=bt(t).resolveInner(r,-1),n=s.resolve(r);for(let o=r,a;n==s&&(a=s.childBefore(o));){let l=a.lastChild;if(!l||!l.type.isError||l.from<l.to)break;n=s=a,o=l.from}return s.name=="TagName"?s.parent&&/CloseTag$/.test(s.parent.name)?E1(t,s,s.from,r):L1(t,i,s,s.from,r):s.name=="StartTag"||s.name=="IncompleteTag"?L1(t,i,s,r,r):s.name=="StartCloseTag"||s.name=="IncompleteCloseTag"?E1(t,s,r,r):s.name=="OpenTag"||s.name=="SelfClosingTag"||s.name=="AttributeName"?Q8(t,i,s,s.name=="AttributeName"?s.from:r,r):s.name=="Is"||s.name=="AttributeValue"||s.name=="UnquotedAttributeValue"?A8(t,i,s,s.name=="Is"?r:s.from,r):e.explicit&&(n.name=="Element"||n.name=="Text"||n.name=="Document")?M8(t,i,s,r):null}function R8(i){return Dw(Vl.default,i)}function B8(i){let{extraTags:e,extraGlobalAttributes:t}=i,r=t||e?new Vl(e,t):Vl.default;return s=>Dw(r,s)}const L8=ls.parser.configure({top:"SingleExpression"}),Iw=[{tag:"script",attrs:i=>i.type=="text/typescript"||i.lang=="ts",parser:Pw.parser},{tag:"script",attrs:i=>i.type=="text/babel"||i.type=="text/jsx",parser:Tw.parser},{tag:"script",attrs:i=>i.type=="text/typescript-jsx",parser:Mw.parser},{tag:"script",attrs(i){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(i.type)},parser:L8},{tag:"script",attrs(i){return!i.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(i.type)},parser:ls.parser},{tag:"style",attrs(i){return(!i.lang||i.lang=="css")&&(!i.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(i.type))},parser:gu.parser}],zw=[{name:"style",parser:gu.parser.configure({top:"Styles"})}].concat(Bw.map(i=>({name:i,parser:ls.parser}))),Nw=Yo.define({name:"html",parser:oE.configure({props:[ac.add({Element(i){let e=/^(\s*)(<\/)?/.exec(i.textAfter);return i.node.to<=i.pos+e[0].length?i.continue():i.lineIndent(i.node.from)+(e[2]?0:i.unit)},"OpenTag CloseTag SelfClosingTag"(i){return i.column(i.node.from)+i.unit},Document(i){if(i.pos+/\s*/.exec(i.textAfter)[0].length<i.node.to)return i.continue();let e=null,t;for(let r=i.node;;){let s=r.lastChild;if(!s||s.name!="Element"||s.to!=r.to)break;e=r=s}return e&&!((t=e.lastChild)&&(t.name=="CloseTag"||t.name=="SelfClosingTag"))?i.lineIndent(e.from)+i.unit:null}}),sa.add({Element(i){let e=i.firstChild,t=i.lastChild;return!e||e.name!="OpenTag"?null:{from:e.to,to:t.name=="CloseTag"?t.from:i.to}}}),Ly.add({"OpenTag CloseTag":i=>i.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),Sh=Nw.configure({wrap:gw(Iw,zw)});function E8(i={}){let e="",t;i.matchClosingTags===!1&&(e="noMatch"),i.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(i.nestedLanguages&&i.nestedLanguages.length||i.nestedAttributes&&i.nestedAttributes.length)&&(t=gw((i.nestedLanguages||[]).concat(Iw),(i.nestedAttributes||[]).concat(zw)));let r=t?Nw.configure({wrap:t,dialect:e}):e?Sh.configure({dialect:e}):Sh;return new Bl(r,[Sh.data.of({autocomplete:B8(i)}),i.autoCloseTags!==!1?D8:[],k8().support,ZE().support])}const D1=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),D8=Pe.inputHandler.of((i,e,t,r,s)=>{if(i.composing||i.state.readOnly||e!=t||r!=">"&&r!="/"||!Sh.isActiveAt(i.state,e,-1))return!1;let n=s(),{state:o}=n,a=o.changeByRange(l=>{var c,h,u;let d=o.doc.sliceString(l.from-1,l.to)==r,{head:f}=l,p=bt(o).resolveInner(f,-1),g;if(d&&r==">"&&p.name=="EndTag"){let O=p.parent;if(((h=(c=O.parent)===null||c===void 0?void 0:c.lastChild)===null||h===void 0?void 0:h.name)!="CloseTag"&&(g=ea(o.doc,O.parent,f))&&!D1.has(g)){let _=f+(o.doc.sliceString(f,f+1)===">"?1:0),k=`</${g}>`;return{range:l,changes:{from:f,to:_,insert:k}}}}else if(d&&r=="/"&&p.name=="IncompleteCloseTag"){let O=p.parent;if(p.from==f-2&&((u=O.lastChild)===null||u===void 0?void 0:u.name)!="CloseTag"&&(g=ea(o.doc,O,f))&&!D1.has(g)){let _=f+(o.doc.sliceString(f,f+1)===">"?1:0),k=`${g}>`;return{range:ue.cursor(f+k.length,-1),changes:{from:f,to:_,insert:k}}}}return{range:l}});return a.changes.empty?!1:(i.dispatch([n,o.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),Ww=Gm({commentTokens:{block:{open:"<!--",close:"-->"}}}),Zw=new Ue,Xw=eL.configure({props:[sa.add(i=>!i.is("Block")||i.is("Document")||Cp(i)!=null||I8(i)?void 0:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})),Zw.add(Cp),ac.add({Document:()=>null}),Xn.add({Document:Ww})]});function Cp(i){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(i.name);return e?+e[1]:void 0}function I8(i){return i.name=="OrderedList"||i.name=="BulletList"}function z8(i,e){let t=i;for(;;){let r=t.nextSibling,s;if(!r||(s=Cp(r.type))!=null&&s<=e)break;t=r}return t.to}const N8=yy.of((i,e,t)=>{for(let r=bt(i).resolveInner(t,-1);r&&!(r.from<e);r=r.parent){let s=r.type.prop(Zw);if(s==null)continue;let n=z8(r,s);if(n>t)return{from:t,to:n}}return null});function Cg(i){return new _r(Ww,i,[],"markdown")}const W8=Cg(Xw),Z8=Xw.configure([uL,fL,dL,pL,{props:[sa.add({Table:(i,e)=>({from:e.doc.lineAt(i.from).to,to:i.to})})]}]),vu=Cg(Z8);function X8(i,e){return t=>{if(t&&i){let r=null;if(t=/\S*/.exec(t)[0],typeof i=="function"?r=i(t):r=Kh.matchLanguageName(i,t,!0),r instanceof Kh)return r.support?r.support.language.parser:Rl.getSkippingParser(r.load());if(r)return r.parser}return e?e.parser:null}}class Id{constructor(e,t,r,s,n,o,a){this.node=e,this.from=t,this.to=r,this.spaceBefore=s,this.spaceAfter=n,this.type=o,this.item=a}blank(e,t=!0){let r=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;r.length<e;)r+=" ";return r}else{for(let s=this.to-this.from-r.length-this.spaceAfter.length;s>0;s--)r+=" ";return r+(t?this.spaceAfter:"")}}marker(e,t){let r=this.node.name=="OrderedList"?String(+Vw(this.item,e)[2]+t):"";return this.spaceBefore+r+this.type+this.spaceAfter}}function Fw(i,e){let t=[],r=[];for(let s=i;s;s=s.parent){if(s.name=="FencedCode")return r;(s.name=="ListItem"||s.name=="Blockquote")&&t.push(s)}for(let s=t.length-1;s>=0;s--){let n=t[s],o,a=e.lineAt(n.from),l=n.from-a.from;if(n.name=="Blockquote"&&(o=/^ *>( ?)/.exec(a.text.slice(l))))r.push(new Id(n,l,l+o[0].length,"",o[1],">",null));else if(n.name=="ListItem"&&n.parent.name=="OrderedList"&&(o=/^( *)\d+([.)])( *)/.exec(a.text.slice(l)))){let c=o[3],h=o[0].length;c.length>=4&&(c=c.slice(0,c.length-4),h-=4),r.push(new Id(n.parent,l,l+h,o[1],c,o[2],n))}else if(n.name=="ListItem"&&n.parent.name=="BulletList"&&(o=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(a.text.slice(l)))){let c=o[4],h=o[0].length;c.length>4&&(c=c.slice(0,c.length-4),h-=4);let u=o[2];o[3]&&(u+=o[3].replace(/[xX]/," ")),r.push(new Id(n.parent,l,l+h,o[1],c,u,n))}}return r}function Vw(i,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(i.from,i.from+10))}function zd(i,e,t,r=0){for(let s=-1,n=i;;){if(n.name=="ListItem"){let a=Vw(n,e),l=+a[2];if(s>=0){if(l!=s+1)return;t.push({from:n.from+a[1].length,to:n.from+a[0].length,insert:String(s+2+r)})}s=l}let o=n.nextSibling;if(!o)break;n=o}}function $g(i,e){let t=/^[ \t]*/.exec(i)[0].length;if(!t||e.facet(oc)!=" ")return i;let r=Ar(i,4,t),s="";for(let n=r;n>0;)n>=4?(s+=" ",n-=4):(s+=" ",n--);return s+i.slice(t)}const F8=(i={})=>({state:e,dispatch:t})=>{let r=bt(e),{doc:s}=e,n=null,o=e.changeByRange(a=>{if(!a.empty||!vu.isActiveAt(e,a.from,-1)&&!vu.isActiveAt(e,a.from,1))return n={range:a};let l=a.from,c=s.lineAt(l),h=Fw(r.resolveInner(l,-1),s);for(;h.length&&h[h.length-1].from>l-c.from;)h.pop();if(!h.length)return n={range:a};let u=h[h.length-1];if(u.to-u.spaceAfter.length>l-c.from)return n={range:a};let d=l>=u.to-u.spaceAfter.length&&!/\S/.test(c.text.slice(u.to));if(u.item&&d){let _=u.node.firstChild,k=u.node.getChild("ListItem","ListItem");if(_.to>=l||k&&k.to<l||c.from>0&&!/[^\s>]/.test(s.lineAt(c.from-1).text)||i.nonTightLists===!1){let P=h.length>1?h[h.length-2]:null,w,C="";P&&P.item?(w=c.from+P.from,C=P.marker(s,1)):w=c.from+(P?P.to:0);let M=[{from:w,to:l,insert:C}];return u.node.name=="OrderedList"&&zd(u.item,s,M,-2),P&&P.node.name=="OrderedList"&&zd(P.item,s,M),{range:ue.cursor(w+C.length),changes:M}}else{let P=z1(h,e,c);return{range:ue.cursor(l+P.length+1),changes:{from:c.from,insert:P+e.lineBreak}}}}if(u.node.name=="Blockquote"&&d&&c.from){let _=s.lineAt(c.from-1),k=/>\s*$/.exec(_.text);if(k&&k.index==u.from){let P=e.changes([{from:_.from+k.index,to:_.to},{from:c.from+u.from,to:c.to}]);return{range:a.map(P),changes:P}}}let f=[];u.node.name=="OrderedList"&&zd(u.item,s,f);let p=u.item&&u.item.from<c.from,g="";if(!p||/^[\s\d.)\-+*>]*/.exec(c.text)[0].length>=u.to)for(let _=0,k=h.length-1;_<=k;_++)g+=_==k&&!p?h[_].marker(s,1):h[_].blank(_<k?Ar(c.text,4,h[_+1].from)-g.length:null);let O=l;for(;O>c.from&&/\s/.test(c.text.charAt(O-c.from-1));)O--;return g=$g(g,e),q8(u.node,e.doc)&&(g=z1(h,e,c)+e.lineBreak+g),f.push({from:O,to:l,insert:e.lineBreak+g}),{range:ue.cursor(O+g.length+1),changes:f}});return n?!1:(t(e.update(o,{scrollIntoView:!0,userEvent:"input"})),!0)},V8=F8();function I1(i){return i.name=="QuoteMark"||i.name=="ListMark"}function q8(i,e){if(i.name!="OrderedList"&&i.name!="BulletList")return!1;let t=i.firstChild,r=i.getChild("ListItem","ListItem");if(!r)return!1;let s=e.lineAt(t.to),n=e.lineAt(r.from),o=/^[\s>]*$/.test(s.text);return s.number+(o?0:1)<n.number}function z1(i,e,t){let r="";for(let s=0,n=i.length-2;s<=n;s++)r+=i[s].blank(s<n?Ar(t.text,4,i[s+1].from)-r.length:null,s<n);return $g(r,e)}function H8(i,e){let t=i.resolveInner(e,-1),r=e;I1(t)&&(r=t.from,t=t.parent);for(let s;s=t.childBefore(r);)if(I1(s))r=s.from;else if(s.name=="OrderedList"||s.name=="BulletList")t=s.lastChild,r=t.to;else break;return t}const U8=({state:i,dispatch:e})=>{let t=bt(i),r=null,s=i.changeByRange(n=>{let o=n.from,{doc:a}=i;if(n.empty&&vu.isActiveAt(i,n.from)){let l=a.lineAt(o),c=Fw(H8(t,o),a);if(c.length){let h=c[c.length-1],u=h.to-h.spaceAfter.length+(h.spaceAfter?1:0);if(o-l.from>u&&!/\S/.test(l.text.slice(u,o-l.from)))return{range:ue.cursor(l.from+u),changes:{from:l.from+u,to:o}};if(o-l.from==u&&(!h.item||l.from<=h.item.from||!/\S/.test(l.text.slice(0,h.to)))){let d=l.from+h.from;if(h.item&&h.node.from<h.item.from&&/\S/.test(l.text.slice(h.from,h.to))){let f=h.blank(Ar(l.text,4,h.to)-Ar(l.text,4,h.from));return d==l.from&&(f=$g(f,i)),{range:ue.cursor(d+f.length),changes:{from:d,to:l.from+h.to,insert:f}}}if(d<o)return{range:ue.cursor(d),changes:{from:d,to:o}}}}}return r={range:n}});return r?!1:(e(i.update(s,{scrollIntoView:!0,userEvent:"delete"})),!0)},Y8=[{key:"Enter",run:V8},{key:"Backspace",run:U8}],qw=E8({matchClosingTags:!1});function j8(i={}){let{codeLanguages:e,defaultCodeLanguage:t,addKeymap:r=!0,base:{parser:s}=W8,completeHTMLTags:n=!0,pasteURLAsLink:o=!0,htmlTagLanguage:a=qw}=i;if(!(s instanceof qu))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let l=i.extensions?[i.extensions]:[],c=[a.support,N8],h;o&&c.push(eD),t instanceof Bl?(c.push(t.support),h=t.language):t&&(h=t);let u=e||h?X8(e,h):void 0;l.push(iL({codeParser:u,htmlParser:a.language.parser})),r&&c.push(Ns.high(rc.of(Y8)));let d=Cg(s.configure(l));return n&&c.push(d.data.of({autocomplete:G8})),new Bl(d,c)}function G8(i){let{state:e,pos:t}=i,r=/<[:\-\.\w\u00b7-\uffff]*$/.exec(e.sliceDoc(t-25,t));if(!r)return null;let s=bt(e).resolveInner(t,-1);for(;s&&!s.type.isTop;){if(s.name=="CodeBlock"||s.name=="FencedCode"||s.name=="ProcessingInstructionBlock"||s.name=="CommentBlock"||s.name=="Link"||s.name=="Image")return null;s=s.parent}return{from:t-r[0].length,to:t,options:K8(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let Nd=null;function K8(){if(Nd)return Nd;let i=R8(new lg(st.create({extensions:qw}),0,!0));return Nd=i?i.options:[]}const J8=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,eD=Pe.domEventHandlers({paste:(i,e)=>{var t;let{main:r}=e.state.selection;if(r.empty)return!1;let s=(t=i.clipboardData)===null||t===void 0?void 0:t.getData("text/plain");if(!s||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(s)||(/^www\./.test(s)&&(s="https://"+s),!vu.isActiveAt(e.state,r.from,1)))return!1;let n=bt(e.state),o=!1;return n.iterate({from:r.from,to:r.to,enter:a=>{(a.from>r.from||J8.test(a.name))&&(o=!0)},leave:a=>{a.to<r.to&&(o=!0)}}),o?!1:(e.dispatch({changes:[{from:r.from,insert:"["},{from:r.to,insert:`](${s})`}],userEvent:"input.paste",scrollIntoView:!0}),!0)}}),tD="#e5c07b",N1="#e06c75",iD="#56b6c2",rD="#ffffff",kh="#abb2bf",$p="#7d8799",sD="#61afef",nD="#98c379",W1="#d19a66",oD="#c678dd",aD="#21252b",Z1="#2c313a",X1="#282c34",Wd="#353a42",lD="#3E4451",F1="#528bff",cD=Pe.theme({"&":{color:kh,backgroundColor:X1},".cm-content":{caretColor:F1},".cm-cursor, .cm-dropCursor":{borderLeftColor:F1},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:lD},".cm-panels":{backgroundColor:aD,color:kh},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:X1,color:$p,border:"none"},".cm-activeLineGutter":{backgroundColor:Z1},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Wd},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Wd,borderBottomColor:Wd},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Z1,color:kh}}},{dark:!0}),hD=cc.define([{tag:B.keyword,color:oD},{tag:[B.name,B.deleted,B.character,B.propertyName,B.macroName],color:N1},{tag:[B.function(B.variableName),B.labelName],color:sD},{tag:[B.color,B.constant(B.name),B.standard(B.name)],color:W1},{tag:[B.definition(B.name),B.separator],color:kh},{tag:[B.typeName,B.className,B.number,B.changed,B.annotation,B.modifier,B.self,B.namespace],color:tD},{tag:[B.operator,B.operatorKeyword,B.url,B.escape,B.regexp,B.link,B.special(B.string)],color:iD},{tag:[B.meta,B.comment],color:$p},{tag:B.strong,fontWeight:"bold"},{tag:B.emphasis,fontStyle:"italic"},{tag:B.strikethrough,textDecoration:"line-through"},{tag:B.link,color:$p,textDecoration:"underline"},{tag:B.heading,fontWeight:"bold",color:N1},{tag:[B.atom,B.bool,B.special(B.variableName)],color:W1},{tag:[B.processingInstruction,B.string,B.inserted],color:nD},{tag:B.invalid,color:rD}]),uD=[cD,Qy(hD)],dD=Xe({__name:"MarkdownCodeEditor",props:{modelValue:{},readOnly:{type:Boolean,default:!1},lineToReveal:{default:null}},emits:["update:modelValue"],setup(i,{emit:e}){const t=i,r=e,s=N(null);let n=null,o=!1,a=null;const l=He.define(),c=He.define(),h=ui.define({create(){return ze.none},update(p,g){let O=p.map(g.changes);for(const _ of g.effects)if(_.is(c)&&(O=ze.none),_.is(l)){const k=Math.max(1,Math.min(_.value,g.state.doc.lines)),P=g.state.doc.line(k);O=ze.set([ze.line({class:"cm-target-line"}).range(P.from)])}return O},provide:p=>Pe.decorations.from(p)});function u(){n&&(a&&clearTimeout(a),a=setTimeout(()=>{n&&n.dispatch({effects:c.of(void 0)})},1600))}function d(p){if(!n)return;const g=Math.max(1,Math.min(p,n.state.doc.lines)),O=n.state.doc.line(g);n.dispatch({selection:{anchor:O.from},effects:[Pe.scrollIntoView(O.from,{y:"center"}),l.of(g)]}),n.focus(),u()}function f(p,g){return st.create({doc:p,extensions:[ZB,j8(),uD,Pe.lineWrapping,h,Pe.updateListener.of(O=>{!O.docChanged||o||r("update:modelValue",O.state.doc.toString())}),Pe.theme({"&":{height:"100%",fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace",fontSize:"13px",backgroundColor:"rgb(var(--color-retro-black))",color:"rgb(var(--color-retro-text))"},".cm-scroller":{overflow:"auto",lineHeight:"1.6"},".cm-gutters":{backgroundColor:"rgb(var(--color-retro-dark))",color:"rgb(var(--color-retro-subtle))",borderRight:"1px solid rgb(var(--color-retro-border))"},".cm-content":{caretColor:"rgb(var(--color-retro-cyan))",padding:"12px 0"},".cm-activeLine":{backgroundColor:"rgba(34, 211, 238, 0.08)"},".cm-selectionBackground, &.cm-focused .cm-selectionBackground":{backgroundColor:"rgba(34, 211, 238, 0.22)"}}),st.readOnly.of(g)]})}return Qt(()=>{s.value&&(n=new Pe({state:f(t.modelValue,t.readOnly),parent:s.value}),t.lineToReveal&&d(t.lineToReveal))}),Ye(()=>t.modelValue,p=>{if(!n)return;const g=n.state.doc.toString();g!==p&&(o=!0,n.dispatch({changes:{from:0,to:g.length,insert:p}}),o=!1)}),Ye(()=>t.lineToReveal,p=>{p&&d(p)}),R2(()=>{a&&clearTimeout(a),n&&(n.destroy(),n=null)}),(p,g)=>(y(),S("div",{ref_key:"rootRef",ref:s,class:"h-full w-full"},null,512))}}),fD=zs(dD,[["__scopeId","data-v-d77d4160"]]),pD={class:"fixed inset-0 z-50 flex items-center justify-center"},mD={class:"relative w-[96vw] h-[94vh] bg-retro-black border border-retro-border rounded-lg shadow-2xl flex flex-col overflow-hidden"},gD={class:"flex-shrink-0 flex items-center justify-between px-4 h-12 border-b border-retro-border bg-retro-dark"},vD={class:"flex items-center gap-3 min-w-0"},OD={class:"text-sm font-mono font-bold text-retro-cyan truncate"},_D={class:"text-xs font-mono text-retro-subtle"},bD={class:"flex items-center gap-2"},yD=["disabled"],xD={class:"flex-shrink-0 flex items-center gap-0 border-b border-retro-border bg-retro-dark overflow-x-auto"},wD=["onClick"],SD={class:"flex-1 min-h-0 overflow-y-auto"},kD={key:0,class:"p-5 max-w-6xl mx-auto"},CD={key:0,class:"flex items-center justify-center py-12"},$D={key:1,class:"flex flex-col items-center justify-center py-12 text-center px-4"},PD={class:"text-sm font-mono text-retro-red"},TD={key:2,class:"space-y-4"},MD={key:0,class:"rounded border border-retro-cyan/40 bg-retro-cyan/10 px-3 py-2 text-xs font-mono text-retro-cyan"},QD={class:"grid grid-cols-2 lg:grid-cols-5 gap-2"},AD={class:"rounded border border-retro-border bg-retro-panel px-3 py-2"},RD={class:"text-sm font-mono text-retro-text"},BD={class:"rounded border border-retro-border bg-retro-panel px-3 py-2"},LD={class:"text-sm font-mono text-retro-cyan"},ED={class:"rounded border border-retro-border bg-retro-panel px-3 py-2"},DD={class:"text-sm font-mono text-retro-yellow"},ID={class:"rounded border border-retro-border bg-retro-panel px-3 py-2"},zD={class:"text-sm font-mono text-retro-green"},ND={class:"rounded border border-retro-border bg-retro-panel px-3 py-2"},WD={class:"text-sm font-mono text-retro-text"},ZD={class:"rounded border border-retro-border bg-retro-panel px-3 py-3"},XD={class:"flex items-center justify-between gap-2 mb-2"},FD={class:"text-[11px] font-mono text-retro-subtle"},VD={key:0,class:"text-xs font-mono text-retro-green"},qD={key:1,class:"space-y-2"},HD={class:"uppercase tracking-wide mr-2"},UD={class:"rounded border border-retro-border bg-retro-panel p-3 overflow-x-auto"},YD={class:"min-w-[760px]"},jD={class:"text-retro-text"},GD=["disabled","onClick"],KD=["disabled","onClick"],JD=["disabled","onClick"],e9={class:"text-retro-muted"},t9={key:1,class:"flex items-center justify-center py-12"},i9={key:2,class:"flex flex-col items-center justify-center py-12 text-center px-4"},r9={class:"text-sm font-mono text-retro-red"},s9={key:3,class:"flex flex-col items-center justify-center py-12 text-center"},n9={key:4,class:"h-full flex flex-col"},o9=["innerHTML"],a9=Xe({__name:"SpecViewerModal",props:{feature:{}},emits:["close"],setup(i,{emit:e}){const t=i,r=e,s=Gl(),{renderMarkdown:n}=y_(),o=N(t.feature.files[0]?.filename||""),a=N("document"),l=N(""),c=N(!1),h=N(null),u=N(!1),d=N(""),f=N(!1),p=N(null),g=N(null),O=N(!1),_=N(null),k=N(null),P=he(()=>{const E={critical:0,major:1,minor:2};return[...k.value?.alerts??[]].sort((Z,K)=>E[Z.severity]-E[K.severity])});function w(E){return E.status==="covered"?"text-retro-green border-retro-green/40 bg-retro-green/10":E.status==="partial"?"text-retro-yellow border-retro-yellow/40 bg-retro-yellow/10":"text-retro-red border-retro-red/40 bg-retro-red/10"}function C(E){return E.severity==="critical"?"text-retro-red border-retro-red/40 bg-retro-red/10":E.severity==="major"?"text-retro-yellow border-retro-yellow/40 bg-retro-yellow/10":"text-retro-cyan border-retro-cyan/40 bg-retro-cyan/10"}async function M(){O.value=!0,_.value=null;try{k.value=await $fetch(`/api/specs/traceability/${t.feature.id}`)}catch{_.value="Failed to load traceability data",k.value=null}finally{O.value=!1}}async function D(E=o.value){if(E){c.value=!0,h.value=null;try{const Z=`/api/specs/${t.feature.id}/${E}`,K=await $fetch(Z);l.value=K.content}catch{h.value="Failed to load file",l.value=""}finally{c.value=!1}}}function j(){D()}const oe=he(()=>l.value?n(l.value):"");function ae(E){g.value=null,a.value="document",u.value&&(u.value=!1),o.value=E,D()}function G(){u.value&&T(),a.value="traceability",!k.value&&!O.value&&M()}async function x(E,Z,K){Z&&(o.value!==E?(o.value=E,await D(E)):l.value||await D(E),a.value="document",u.value=!0,d.value=l.value,p.value=null,g.value={filename:E,line:Z,requirementId:K},await xi(),p.value=Z)}function b(){d.value=l.value,p.value=null,u.value=!0}function T(){u.value=!1,d.value=""}async function $(){f.value=!0;try{const E=`/api/specs/${t.feature.id}/${o.value}`;await $fetch(E,{method:"PUT",body:{content:d.value}}),l.value=d.value,u.value=!1,s.success("Saved")}catch{s.error("Failed to save")}finally{f.value=!1}}function R(E){E.key==="Escape"&&(u.value?T():r("close"))}return Qt(()=>{window.addEventListener("keydown",R),D(),M()}),_i(()=>{window.removeEventListener("keydown",R)}),(E,Z)=>{const K=fD;return y(),xe(or,{to:"body"},[m("div",pD,[m("div",{class:"absolute inset-0 bg-black/80",onClick:Z[0]||(Z[0]=X=>r("close"))}),m("div",mD,[m("div",gD,[m("div",vD,[m("span",OD,F(i.feature.name),1),m("span",_D,F(i.feature.id),1)]),m("div",bD,[v(u)?(y(),S(Me,{key:0},[m("button",{type:"button",class:"px-3 py-1 text-xs font-mono rounded border border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-muted transition-colors",onClick:T}," Cancel "),m("button",{type:"button",class:"px-3 py-1 text-xs font-mono rounded border border-retro-cyan text-retro-cyan hover:bg-retro-cyan/10 transition-colors disabled:opacity-50",disabled:v(f),onClick:$},F(v(f)?"Saving...":"Save"),9,yD)],64)):v(a)==="document"&&v(l)&&!v(c)&&!v(h)?(y(),S("button",{key:1,type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"Edit",onClick:b},[le(v(R_),{class:"h-4 w-4"})])):se("",!0),m("button",{type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Close (ESC)",onClick:Z[1]||(Z[1]=X=>r("close"))},[le(v(hi),{class:"h-4 w-4"})])])]),m("div",xD,[m("button",{type:"button",class:Ie(["px-4 py-2 text-xs font-mono border-b-2 transition-colors whitespace-nowrap flex items-center gap-1",[v(a)==="traceability"?"border-retro-magenta text-retro-magenta bg-retro-black":"border-transparent text-retro-muted hover:text-retro-text hover:bg-retro-panel"]]),onClick:G},[le(v(hk),{class:"h-3.5 w-3.5"}),Z[3]||(Z[3]=We(" Traceability ",-1))],2),(y(!0),S(Me,null,Ke(i.feature.files,X=>(y(),S("button",{key:X.filename,type:"button",class:Ie(["px-4 py-2 text-xs font-mono border-b-2 transition-colors whitespace-nowrap",[v(a)==="document"&&v(o)===X.filename?"border-retro-cyan text-retro-cyan bg-retro-black":"border-transparent text-retro-muted hover:text-retro-text hover:bg-retro-panel"]]),onClick:V=>ae(X.filename)},F(X.label),11,wD))),128))]),m("div",SD,[v(a)==="traceability"?(y(),S("div",kD,[v(O)?(y(),S("div",CD,[...Z[4]||(Z[4]=[m("span",{class:"text-sm font-mono text-retro-muted animate-pulse"},"Loading traceability...",-1)])])):v(_)?(y(),S("div",$D,[m("p",PD,F(v(_)),1),m("button",{type:"button",class:"mt-3 px-3 py-1.5 text-xs font-mono bg-retro-panel border border-retro-border rounded text-retro-muted hover:text-retro-cyan hover:border-retro-cyan transition-colors",onClick:M}," Retry ")])):v(k)?(y(),S("div",TD,[v(g)?(y(),S("div",MD," Jump target: "+F(v(g).requirementId)+" → "+F(v(g).filename)+":"+F(v(g).line),1)):se("",!0),m("div",QD,[m("div",AD,[Z[5]||(Z[5]=m("p",{class:"text-[11px] font-mono text-retro-subtle"},"FR total",-1)),m("p",RD,F(v(k).summary.frTotal),1)]),m("div",BD,[Z[6]||(Z[6]=m("p",{class:"text-[11px] font-mono text-retro-subtle"},"Plan coverage",-1)),m("p",LD,F(v(k).summary.frWithPlan)+"/"+F(v(k).summary.frTotal),1)]),m("div",ED,[Z[7]||(Z[7]=m("p",{class:"text-[11px] font-mono text-retro-subtle"},"Task mapping",-1)),m("p",DD,F(v(k).summary.frWithTasks)+"/"+F(v(k).summary.frTotal),1)]),m("div",ID,[Z[8]||(Z[8]=m("p",{class:"text-[11px] font-mono text-retro-subtle"},"Fully covered",-1)),m("p",zD,F(v(k).summary.frFullyCovered)+"/"+F(v(k).summary.frTotal),1)]),m("div",ND,[Z[9]||(Z[9]=m("p",{class:"text-[11px] font-mono text-retro-subtle"},"Task progress",-1)),m("p",WD,F(v(k).summary.taskCompleted)+"/"+F(v(k).summary.taskTotal),1)])]),m("div",ZD,[m("div",XD,[Z[10]||(Z[10]=m("h3",{class:"text-xs font-mono text-retro-text"},"Gap Alerts",-1)),m("span",FD,F(v(P).length)+" issues",1)]),v(P).length===0?(y(),S("div",VD," No traceability gaps detected. ")):(y(),S("div",qD,[(y(!0),S(Me,null,Ke(v(P),X=>(y(),S("div",{key:X.id,class:Ie(["rounded border px-2.5 py-2 text-xs font-mono",C(X)])},[m("span",HD,F(X.severity),1),m("span",null,F(X.message),1)],2))),128))]))]),m("div",UD,[m("div",YD,[Z[11]||(Z[11]=m("div",{class:"grid grid-cols-[140px_1fr_1fr_1fr_120px] gap-2 text-[11px] font-mono text-retro-subtle px-2 pb-2 border-b border-retro-border"},[m("span",null,"Requirement"),m("span",null,"Spec"),m("span",null,"Plan"),m("span",null,"Tasks"),m("span",null,"Progress")],-1)),(y(!0),S(Me,null,Ke(v(k).requirements,X=>(y(),S("div",{key:X.id,class:"grid grid-cols-[140px_1fr_1fr_1fr_120px] gap-2 items-center px-2 py-2 border-b border-retro-border/60 text-xs font-mono"},[m("span",jD,F(X.id),1),m("button",{type:"button",class:"h-6 rounded border border-retro-green/40 bg-retro-green/10 flex items-center px-2 text-retro-green disabled:opacity-50 disabled:cursor-not-allowed",disabled:!X.locations.specLine,onClick:V=>x("spec.md",X.locations.specLine,X.id)},[m("span",null,F(X.locations.specLine?`L${X.locations.specLine}`:"Defined"),1)],8,GD),m("button",{type:"button",class:Ie(["h-6 rounded border flex items-center px-2 disabled:opacity-50 disabled:cursor-not-allowed",X.inPlan?"text-retro-cyan border-retro-cyan/40 bg-retro-cyan/10":"text-retro-subtle border-retro-border bg-retro-black/50"]),disabled:!X.locations.planLine,onClick:V=>x("plan.md",X.locations.planLine,X.id)},[m("span",null,F(X.locations.planLine?`L${X.locations.planLine}`:X.inPlan?"Linked":"Missing"),1)],10,KD),m("button",{type:"button",class:Ie(["h-6 rounded border flex items-center px-2 disabled:opacity-50 disabled:cursor-not-allowed",w(X)]),disabled:X.locations.taskLines.length===0,onClick:V=>x("tasks.md",X.locations.taskLines[0],X.id)},[m("span",null,F(X.locations.taskLines.length>0?`L${X.locations.taskLines[0]}`:X.inTasks?"Mapped":"Missing"),1)],10,JD),m("span",e9,F(X.taskCompleted)+"/"+F(X.taskTotal),1)]))),128))])])])):se("",!0)])):v(c)?(y(),S("div",t9,[...Z[12]||(Z[12]=[m("span",{class:"text-sm font-mono text-retro-muted animate-pulse"},"Loading...",-1)])])):v(h)?(y(),S("div",i9,[m("p",r9,F(v(h)),1),m("button",{type:"button",class:"mt-3 px-3 py-1.5 text-xs font-mono bg-retro-panel border border-retro-border rounded text-retro-muted hover:text-retro-cyan hover:border-retro-cyan transition-colors",onClick:j}," Retry ")])):i.feature.files.length===0?(y(),S("div",s9,[...Z[13]||(Z[13]=[m("p",{class:"text-sm font-mono text-retro-muted"},"No spec files found",-1),m("p",{class:"mt-1 text-xs font-mono text-retro-subtle"}," This feature directory has no .md files ",-1)])])):v(u)?(y(),S("div",n9,[le(K,{modelValue:v(d),"onUpdate:modelValue":Z[2]||(Z[2]=X=>at(d)?d.value=X:null),"line-to-reveal":v(p),class:"flex-1"},null,8,["modelValue","line-to-reveal"])])):(y(),S("div",{key:5,class:"spec-markdown p-6 text-sm font-mono text-retro-text max-w-4xl mx-auto",innerHTML:v(oe)},null,8,o9))])])])])}}}),l9={class:"w-full max-w-2xl rounded-xl border border-retro-border/80 bg-retro-black shadow-[0_24px_70px_rgba(0,0,0,0.55)] overflow-hidden"},c9={class:"flex items-center justify-between px-4 py-2 border-b border-retro-border/60 bg-retro-dark/70"},h9={class:"flex items-center gap-2 px-4 py-3 border-b border-retro-border/60"},u9={class:"flex items-center justify-between px-4 py-1.5 border-b border-retro-border/40 bg-retro-dark/30 text-[10px] font-mono text-retro-subtle"},d9={class:"flex items-center gap-3"},f9={class:"inline-flex items-center gap-1"},p9={key:0},m9={key:0,class:"truncate max-w-[42%]"},g9={class:"max-h-[58vh] overflow-y-auto"},v9={key:0,class:"px-4 py-3 text-xs font-mono text-retro-subtle animate-pulse"},O9={key:1,class:"px-4 py-4 text-xs font-mono text-retro-subtle"},_9={key:2,class:"px-4 py-4 text-xs font-mono text-retro-subtle"},b9={key:3,class:"px-4 py-3 text-xs font-mono text-retro-red"},y9={key:4,class:"py-2 px-2 space-y-2"},x9=["onMouseenter","onClick"],w9={class:"flex items-center justify-between gap-3 text-[10px] font-mono"},S9={class:"text-retro-cyan/90"},k9={class:"text-retro-subtle truncate"},C9=["innerHTML"],$9={key:5,class:"px-4 py-3 text-xs font-mono text-retro-subtle"},P9={class:"flex items-center justify-between gap-3 px-4 py-2 border-t border-retro-border/60 bg-retro-dark/50 text-[11px] font-mono text-retro-subtle"},T9={key:0,class:"text-retro-yellow"},M9={key:0,class:"px-4 pb-3 text-xs font-mono text-retro-red flex items-center gap-2"},Q9=400,A9=Xe({__name:"FeatureSearchModal",props:{availableFeatureIds:{}},emits:["close","select"],setup(i,{emit:e}){const t=i,r=e,{renderMarkdown:s}=y_(),n=N(""),o=N(!1),a=N(!1),l=N(null),c=N(null),h=N(null),u=N(null),d=N([]),f=N(-1),p=N(null),g=N([]);let O=null,_=0;const k=he(()=>n.value.trim()),P=he(()=>{const $=k.value.toLowerCase().split(/\s+/).map(R=>R.trim()).filter(R=>R.length>=2);return Array.from(new Set($)).slice(0,8)}),w=he(()=>l.value||c.value?"error":!k.value&&a.value?"empty-query":d.value.length>0?"results":a.value&&!o.value?"no-results":"idle");function C($){return{featureId:$.chunk.featureId,sourcePath:$.chunk.sourcePath,headingHierarchy:$.chunk.headingHierarchy,snippet:$.chunk.content,matchType:$.matchType,score:$.score,lineStart:$.chunk.lineStart,lineEnd:$.chunk.lineEnd}}async function M(){const $=k.value;if(c.value=null,!$){a.value=!0,h.value=null,u.value=null,l.value=null,d.value=[],f.value=-1;return}const R=++_;a.value=!0,l.value=null,o.value=!0;try{const E=await $fetch("/api/specs/search",{query:{q:$,mode:"keyword",limit:20}});if(R!==_)return;h.value=E.warning??null,u.value=E.searchTime,d.value=E.results.map(C),f.value=d.value.length>0?0:-1}catch(E){if(R!==_)return;const Z=E instanceof Error?E.message:"Failed to search specs";l.value=Z,u.value=null,d.value=[],f.value=-1}finally{R===_&&(o.value=!1)}}Ye(n,()=>{l.value=null,c.value=null,O&&clearTimeout(O),O=setTimeout(()=>{M()},Q9)}),Ye(d,()=>{g.value=[]}),Ye(f,async $=>{$<0||(await xi(),g.value[$]?.scrollIntoView({block:"nearest"}))});function D(){r("close")}function j($){const R=d.value[$];if(R){if(!t.availableFeatureIds.includes(R.featureId)){c.value="Feature unavailable";return}r("select",R.featureId),r("close")}}function oe($){if(d.value.length===0)return;if(f.value<0){f.value=0;return}const R=f.value+$;if(R<0){f.value=d.value.length-1;return}if(R>=d.value.length){f.value=0;return}f.value=R}function ae($){if($.key==="ArrowDown"){$.preventDefault(),oe(1);return}if($.key==="ArrowUp"){$.preventDefault(),oe(-1);return}if($.key==="Enter"){$.preventDefault(),f.value>=0&&j(f.value);return}$.key==="Escape"&&($.preventDefault(),D())}function G($){$.target===$.currentTarget&&D()}function x($,R){if(!R){g.value[$]=null;return}if(R instanceof HTMLElement){g.value[$]=R;return}const E=R.$el;g.value[$]=E instanceof HTMLElement?E:null}function b(){M()}function T($){const R=$.trim();if(!R)return"";const E=R.length>700?`${R.slice(0,700)}...`:R,Z=s(E);if(P.value.length===0)return Z;const K=P.value.map(V=>V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),X=new RegExp(`(${K.join("|")})`,"gi");return Z.split(/(<[^>]+>)/g).map(V=>V.startsWith("<")?V:V.replace(X,"<mark>$1</mark>")).join("")}return Qt(()=>{xi(()=>{p.value?.focus()})}),_i(()=>{O&&clearTimeout(O)}),($,R)=>(y(),xe(or,{to:"body"},[le(hs,{appear:"","enter-active-class":"transition duration-150 ease-out","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition duration-120 ease-in","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:gt(()=>[m("div",{class:"fixed inset-0 z-50 flex items-start justify-center pt-16 px-4 bg-black/75 backdrop-blur-[1px]",onClick:G},[le(hs,{appear:"","enter-active-class":"transition duration-150 ease-out","enter-from-class":"opacity-0 translate-y-2 scale-[0.99]","enter-to-class":"opacity-100 translate-y-0 scale-100","leave-active-class":"transition duration-120 ease-in","leave-from-class":"opacity-100 translate-y-0 scale-100","leave-to-class":"opacity-0 translate-y-1 scale-[0.995]"},{default:gt(()=>[m("div",l9,[m("div",c9,[R[1]||(R[1]=m("div",{class:"flex items-center gap-2"},[m("span",{class:"inline-flex items-center rounded px-2 py-0.5 text-[10px] font-mono border border-retro-cyan/50 text-retro-cyan bg-retro-cyan/10"}," Command Palette "),m("span",{class:"text-[10px] font-mono text-retro-subtle"},"Global spec search")],-1)),m("button",{type:"button",class:"p-1 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Close (Escape)",onClick:D},[le(v(hi),{class:"h-4 w-4"})])]),m("div",h9,[le(v(Hn),{class:"h-4 w-4 text-retro-cyan"}),je(m("input",{ref_key:"inputRef",ref:p,"onUpdate:modelValue":R[0]||(R[0]=E=>at(n)?n.value=E:null),type:"text",placeholder:"Search specs across all features...",class:"flex-1 bg-transparent text-sm font-mono text-retro-text placeholder:text-retro-subtle focus:outline-none",onKeydown:ae},null,544),[[$i,v(n)]]),R[2]||(R[2]=m("span",{class:"text-[10px] font-mono text-retro-subtle border border-retro-border/60 rounded px-1.5 py-0.5"},"400ms",-1))]),m("div",u9,[m("div",d9,[m("span",f9,[le(v(Jn),{class:"h-3.5 w-3.5"}),We(" "+F(v(d).length)+" results ",1)]),v(u)!==null?(y(),S("span",p9,F(v(u))+"ms",1)):se("",!0)]),v(k)?(y(),S("span",m9,"“"+F(v(k))+"”",1)):se("",!0)]),m("div",g9,[v(o)?(y(),S("div",v9," Searching... ")):v(w)==="empty-query"?(y(),S("div",O9," Enter a search term to search across all feature specs. ")):v(w)==="no-results"?(y(),S("div",_9," No matching features found. ")):v(w)==="error"?(y(),S("div",b9,[m("p",null,F(v(c)||v(l)),1),v(l)?(y(),S("button",{key:0,type:"button",class:"mt-2 px-2 py-1 rounded border border-retro-border text-retro-muted hover:text-retro-cyan hover:border-retro-cyan transition-colors",onClick:b}," Retry ")):se("",!0)])):v(d).length>0?(y(),S("ul",y9,[(y(!0),S(Me,null,Ke(v(d),(E,Z)=>(y(),S("li",{key:`${E.featureId}:${E.sourcePath}:${Z}`},[m("button",{type:"button",ref_for:!0,ref:K=>x(Z,K),class:Ie(["w-full text-left px-4 py-3 min-h-[132px] rounded-lg border border-retro-border/40 border-l-2 transition-colors",Z===v(f)?"border-retro-cyan bg-retro-panel/95 text-retro-text shadow-[0_0_0_1px_rgba(34,211,238,0.18)]":"text-retro-muted hover:text-retro-text hover:bg-retro-panel/90"]),onMouseenter:K=>f.value=Z,onClick:K=>j(Z)},[m("div",w9,[m("span",S9,F(E.featureId),1),m("span",k9,F(E.sourcePath)+":"+F(E.lineStart)+"-"+F(E.lineEnd),1)]),m("div",{class:"snippet-markdown mt-2 max-h-20 overflow-hidden text-xs text-retro-text",innerHTML:T(E.snippet)},null,8,C9),R[3]||(R[3]=m("div",{class:"mt-2 text-[10px] font-mono text-retro-subtle"}," Select feature ",-1))],42,x9)]))),128))])):(y(),S("div",$9," Start typing to search. "))]),m("div",P9,[R[4]||(R[4]=m("div",{class:"flex items-center gap-2"},[m("span",{class:"border border-retro-border/70 rounded px-1.5 py-0.5"},"↑↓ move"),m("span",{class:"border border-retro-border/70 rounded px-1.5 py-0.5"},"Enter select"),m("span",{class:"border border-retro-border/70 rounded px-1.5 py-0.5"},"Esc close")],-1)),v(h)?(y(),S("span",T9,F(v(h)),1)):se("",!0)]),v(c)?(y(),S("div",M9,[le(v(vn),{class:"h-3.5 w-3.5"}),m("span",null,F(v(c)),1)])):se("",!0)])]),_:1})])]),_:1})]))}}),R9=zs(A9,[["__scopeId","data-v-5199b408"]]);function B9(i){return/^\/speckit\.(clarify|plan|tasks|implement)(\s|$)/.test(i)}function L9(i=Date.now,e=Math.random){return`req-${i()}-${e().toString(36).slice(2,8)}`}function V1(i=Date.now){return`session-${i()}`}function Zd(i,e=!1){const t={};return(!e||i?.hasWorktree)&&i?.worktreePath&&(t.cwd=i.worktreePath,t.worktreeBranch=i.worktreeBranch),i?.baseBranch&&(t.baseBranch=i.baseBranch),i?.featureId&&(t.featureId=i.featureId),Object.keys(t).length>0?t:void 0}function Hw(i){if(i.file_path)return String(i.file_path);if(i.path)return String(i.path);if(i.command)return String(i.command).slice(0,50);if(i.pattern)return String(i.pattern);for(const e of Object.values(i))if(typeof e=="string"&&e.length<100)return e;return""}function E9(i){switch(i){case 1e3:return"Normal closure";case 1001:return"Endpoint is going away (server shutdown or page navigation)";case 1002:return"Protocol error";case 1003:return"Unsupported data";case 1005:return"No status code received from peer (close frame had no code)";case 1006:return"Abnormal closure (connection dropped without close frame)";case 1007:return"Invalid payload data";case 1008:return"Policy violation";case 1009:return"Message too big";case 1010:return"Missing required extension";case 1011:return"Internal server error";case 1012:return"Service restart";case 1013:return"Try again later (temporary overload)";case 1015:return"TLS handshake failure";default:return i>=4e3&&i<=4999?"Application-specific close code":"Unknown close code"}}function D9(i,e){const t=[];return i.reason?t.push(i.reason):t.push(E9(i.code)),e?.lastServerError?t.push(`Last server error: ${e.lastServerError}`):e?.lastSocketError&&t.push(`Last socket error: ${e.lastSocketError}`),t.push(`wasClean: ${i.wasClean?"yes":"no"}`),t.join(" | ")}function q1(i,e="Permission"){const t=i||"",r=t.match(/write to (.+?)(?:[\s,?]|$)/i),s=t.match(/read (.+?)(?:[\s,?]|$)/i),n=t.match(/run (.+?)(?:[?,]|$)/i);return r?.[1]?{tool:"Write",description:t,filePath:r[1].trim()}:s?.[1]?{tool:"Read",description:t,filePath:s[1].trim()}:n?.[1]?{tool:"Bash",description:t,command:n[1].trim()}:{tool:e,description:t}}function I9(){return typeof document>"u"||typeof document.hasFocus!="function"?!1:document.visibilityState==="visible"&&document.hasFocus()}function z9(){return typeof window>"u"?"":`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/_ws`}function Xd(i,e){return`${i}:${e}`}function Gc(i,e){for(const t of i)if(t.type==="tool_use"){const r=t;(r.status==="running"||r.status==="pending")&&(r.status=e)}}function N9(){const i=new Map;function e(a,l,c){i.set(a,{featureId:l,queue:[...c]})}function t(a){a?i.delete(a):i.clear()}function r(a){return i.get(a)}function s(a){const l=i.get(a);if(!l||l.queue.length===0)return null;const c=l.queue.shift();return l.queue.length===0&&i.delete(a),{featureId:l.featureId,step:c}}function n(a){return i.has(a)}function o(){return i.size}return{enable:e,disable:t,get:r,popNextStep:s,has:n,size:o}}function Uw(i,e=Zi){return{id:e(),type:"session_init",model:i.model,tools:i.tools,permissionMode:i.permissionMode,cwd:i.cwd}}function Yw(i,e=Zi){return{id:i.blockId||e(),type:"text",text:i.text||""}}function jw(i,e=Zi){return{id:i.blockId||e(),type:"thinking",thinking:i.thinking||""}}function Gw(i,e=Zi){if(!i.toolUseId||!i.name)return null;const t=i.blockId||e();return{block:{id:t,type:"tool_use",toolUseId:i.toolUseId,name:i.name,input:{},inputSummary:"",status:"running"},tracking:{blockId:t,toolUseId:i.toolUseId,name:i.name,inputJson:""},index:i.index??0}}function Kw(i,e=Zi){return{id:e(),type:"tool_result",toolUseId:i.toolUseId,content:i.content||"",isError:!!i.isError}}function Jw(i,e=Zi){return i.subtype!=="success"||!i.usage?null:{id:e(),type:"result_summary",totalCostUsd:i.totalCostUsd??0,durationMs:i.durationMs??0,numTurns:i.numTurns??0,usage:i.usage}}function Ou(i,e,t){if(e!==void 0){const r=i.get(e);if(r)return r}if(t){for(const[,r]of i)if(r.blockId===t)return r}}function W9(i,e=Zi){const t=[],r=new Map,s=[];let n="",o=null,a=null,l="streaming",c=!1;for(const h of i){if(h.type==="done"){h.denied||h.aborted?(Gc(t,"error"),l="stopped"):h.awaitingUserInput?l="complete":l==="error"||l==="stopped"?Gc(t,"error"):(Gc(t,"complete"),l="complete"),c=!0;continue}if(h.type==="error"){Gc(t,"error"),l="error";continue}if(h.type!=="ui_event"||!h.event)continue;const u=h.event;switch(u.sessionId&&s.push(u.sessionId),u.type){case"session_init":{t.push(Uw(u,e));break}case"block_start":{if(u.blockType==="text"){const d=Yw(u,e);t.push(d),o=d.id,u.text&&(n+=u.text)}else if(u.blockType==="thinking"){const d=jw(u,e);t.push(d),a=d.id}else if(u.blockType==="tool_use"){const d=Gw(u,e);d&&(t.push(d.block),r.set(d.index,d.tracking))}break}case"block_delta":{if(u.text&&o){const d=t.find(f=>f.id===o);d&&d.type==="text"&&(d.text+=u.text,n+=u.text)}if(u.thinking&&a){const d=t.find(f=>f.id===a);d&&d.type==="thinking"&&(d.thinking+=u.thinking)}if(u.partialJson){const d=Ou(r,u.index,u.blockId);d&&(d.inputJson+=u.partialJson)}break}case"block_end":{const d=Ou(r,u.index,u.blockId);if(!d)o&&(o=null),a&&(a=null);else{let f={};try{f=JSON.parse(d.inputJson)}catch{}const p=t.find(g=>g.id===d.blockId);if(p&&p.type==="tool_use"){const g=p;g.input=f,g.inputSummary=Hw(f),g.status="pending"}for(const[g,O]of r)if(O===d){r.delete(g);break}}break}case"tool_result":{const d=t.find(f=>f.type==="tool_use"&&f.toolUseId===u.toolUseId);d&&d.type==="tool_use"&&(d.status=u.isError?"error":"complete"),t.push(Kw(u,e));break}case"turn_result":{u.subtype!=="success"&&(l="error");const d=Jw(u,e);d&&t.push(d);break}case"error":{l="error";break}}}return{contentBlocks:t,flatText:n,currentTextBlockId:o,currentThinkingBlockId:a,activeTools:r,finalStatus:l,isDone:c,providerSessionIds:s}}function Z9(i,e,t=Date.now){return{ws:i,currentMessageId:"",conversationId:e,activeTools:new Map,currentTextBlockId:null,currentThinkingBlockId:null,healthCheckInterval:null,lastMessageTime:t(),lastServerError:null,lastSocketError:null,cliTurnStopSeen:!1,cliTurnStopConfirmed:!1,cliSubmittedPrompt:null,isReplaying:!1,replayBuffer:[]}}function Fd(i,e,t){const r=i.get(e);return!!r&&r.ws!==t}function X9(i,e){const t=i.get(e);return t?t.ws.readyState===WebSocket.OPEN?{kind:"open",conn:t}:{kind:"stale",conn:t}:{kind:"none"}}const yt=new Map;let Kc=0;const Oo=N9(),Mo=new Map,Jc=new Set;function eh(i){if(i){const e=Mo.get(i);e&&(clearTimeout(e),Mo.delete(i))}else{for(const e of Mo.values())clearTimeout(e);Mo.clear()}}const F9=3e4,eS=18e4,V9=Math.round(eS/1e3);function Pg(){const i=Lr(),e=Kl();Kc++;function t(I){const z=i.conversations.find(Q=>Q.id===I)?.title?.trim()||"Chat";return new Notification("Spec Cat",{body:`${z} response completed.`,tag:`chat-complete-${I}`})}async function r(I){if(!(typeof window>"u"||typeof Notification>"u")&&!I9()){if(Notification.permission==="granted"){t(I);return}if(Notification.permission==="default")try{await Notification.requestPermission()==="granted"&&t(I)}catch(L){console.warn("[useChatStream] Failed to request browser notification permission:",L)}}}function s(I){I.healthCheckInterval&&(clearInterval(I.healthCheckInterval),I.healthCheckInterval=null)}function n(I){s(I),I.lastMessageTime=Date.now(),I.healthCheckInterval=$m(()=>{const L=I.conversationId;if(yt.get(L)!==I){s(I);return}if(I.ws.readyState!==WebSocket.OPEN){console.warn(`[useChatStream] Health check: WebSocket not open for ${L}`),s(I),i.isConversationStreaming(L)&&(c(I.currentMessageId,L,"error"),i.updateMessage(I.currentMessageId,{status:"error"},L),i.setSessionError("Connection lost during streaming",L),i.endSession(L),i.endConversationStreaming(L)),yt.delete(L);return}if(i.isConversationStreaming(L)){const z=Date.now()-I.lastMessageTime;z>eS&&(console.warn(`[useChatStream] Health check: streaming timeout for ${L} (${Math.round(z/1e3)}s)`),s(I),c(I.currentMessageId,L,"error"),i.updateMessage(I.currentMessageId,{status:"error"},L),i.setSessionError(`Streaming timed out — no response from server for ${V9} seconds`,L),i.endSession(L),i.endConversationStreaming(L),I.ws.close(),yt.delete(L))}},F9)}function o(I,L){return i.conversations.find(Q=>Q.id===I)?.messages.find(Q=>Q.id===L)?.status}function a(I,L=!0){const z=yt.get(I);z&&(s(z),L&&z.ws.readyState!==WebSocket.CLOSED&&z.ws.readyState!==WebSocket.CLOSING&&z.ws.close(),yt.delete(I))}function l(I,L,z){!z||!I.currentTextBlockId||(i.updateBlockWithSave(I.currentMessageId,I.currentTextBlockId,Q=>{Q.type==="text"&&(Q.text+=z)},L,{syncContent:!1}),i.appendToMessage(I.currentMessageId,z,L))}function c(I,L,z){const J=i.conversations.find(de=>de.id===L)?.messages.find(de=>de.id===I);if(J?.contentBlocks)for(const de of J.contentBlocks)de.type==="tool_use"&&(de.status==="running"||de.status==="pending")&&i.updateBlockById(I,de.id,Y=>{Y.type==="tool_use"&&(Y.status=z)},L)}async function h(I){try{(await u(I)).send(JSON.stringify({type:"reset_context"})),i.clearProviderSession(I),console.log("[useChatStream] Context reset requested for conversation:",I)}catch(L){throw console.error("[useChatStream] Failed to reset context:",L),L}}function u(I){return new Promise((L,z)=>{let Q=!1;const J=ot=>{Q||(Q=!0,L(ot))},de=ot=>{Q||(Q=!0,z(ot))},Y=X9(yt,I);if(Y.kind==="open"){J(Y.conn.ws);return}Y.kind==="stale"&&(s(Y.conn),Y.conn.ws.close(),yt.delete(I));const be=z9(),Ce=new WebSocket(be),rt=Z9(Ce,I);yt.set(I,rt),Ce.onopen=()=>{J(Ce)},Ce.onerror=ot=>{if(console.error(`[useChatStream] WebSocket error for conversation ${I}:`,ot),Fd(yt,I,Ce))return;const ut=yt.get(I);ut&&(ut.lastSocketError="Browser reported a WebSocket transport error (network/proxy/server)"),i.isConversationStreaming(I)&&(ut?.currentMessageId&&(c(ut.currentMessageId,I,"error"),i.updateMessage(ut.currentMessageId,{status:"error"},I)),i.setSessionError("Connection error during streaming",I),i.endSession(I),i.endConversationStreaming(I)),yt.delete(I),de(new Error("WebSocket connection failed. Server may be unavailable."))},Ce.onclose=ot=>{if(Fd(yt,I,Ce))return;const ut=yt.get(I);if(ut&&s(ut),yt.delete(I),Oo.disable(I),!Q){de(new Error(`WebSocket closed before connection was established (code: ${ot.code})`));return}if(i.isConversationStreaming(I)){ut?.currentMessageId&&(c(ut.currentMessageId,I,"error"),i.updateMessage(ut.currentMessageId,{status:"error"},I));const ce=D9(ot,ut);i.setSessionError(`Connection closed: ${ce} (code: ${ot.code})`,I),i.endSession(I),i.endConversationStreaming(I)}},Ce.onmessage=ot=>{Fd(yt,I,Ce)||p(ot.data,I)}})}async function d(I,L=3){for(let z=0;z<L;z++){const Q=i.conversations.find(J=>J.id===I);if(Q)return Q;z<L-1&&await new Promise(J=>setTimeout(J,100))}console.error("[useChatStream] Conversation not found after retries:",I)}function f(I,L){const z=i.conversations.find(J=>J.id===I);if(!z)return null;const Q=z.messages.findIndex(J=>J.id===L);if(Q<=0)return null;for(let J=Q-1;J>=0;J--){const de=z.messages[J];if(de.role==="user"&&de.content.trim().length>0)return de.content}return null}async function p(I,L){const z=yt.get(L);if(z){z.lastMessageTime=Date.now();try{i.pushDebugEvent({direction:"in",channel:"ws",eventType:"ws.raw",payload:I},L);const Q=JSON.parse(I);if(i.pushDebugEvent({direction:"in",channel:"ws",eventType:Q.type,payload:Q},L),z.isReplaying&&((Q.type==="ui_event"||Q.type==="done"||Q.type==="error")&&z.replayBuffer.push(Q),Q.type!=="replay_end"))return;if(Q.type==="error")return await C(Q,z,L),void 0;if(Q.type==="done"){await M(Q,z,L);return}if(Q.type==="cli_hook"||Q.type==="cli_prompt_submitted"||Q.type==="cli_tool_completed"||Q.type==="cli_turn_stop"||Q.type==="cli_subagent_stop"||Q.type==="cli_turn_stop_confirmed"){oe(Q,z,L);return}if(Q.type==="pong")return;if(Q.type==="session_reset"){console.warn(`[useChatStream] Session reset for ${L}:`,Q.reason),i.setProviderSessionId("",L),Z(z.currentMessageId,`
39
+
40
+ > **Session Reset**: Previous session could not be resumed. Retrying with a fresh session...
41
+
42
+ `,L);return}if(Q.type==="worktree_recovered"){console.log(`[useChatStream] Worktree recovered for ${L}`),Z(z.currentMessageId,`
43
+
44
+ > **Worktree recovered**: The work directory was restored after a system restart.
45
+
46
+ `,L);return}if(Q.type==="context_reset"){console.log(`[useChatStream] Context reset confirmed for ${L}`);return}if(Q.type==="aborted"){console.log(`[useChatStream] Abort confirmed for ${L}`);return}if(Q.type==="subscribed"){console.log(`[useChatStream] Subscribed to ${L}`,Q.jobId?`(job: ${Q.jobId}, status: ${Q.jobStatus})`:"(no active job)"),Q.jobId||(i.endSession(L),i.endConversationStreaming(L));return}if(Q.type==="replay_start"){console.log(`[useChatStream] Replay start for ${L}: ${Q.eventCount} events from job ${Q.jobId}`),z.isReplaying=!0,z.replayBuffer=[];return}if(Q.type==="replay_end"){console.log(`[useChatStream] Replay end for ${L}: nextCursor=${Q.nextCursor}`),R(z,L),z.isReplaying=!1,z.replayBuffer=[];return}if(Q.type==="notification"){T(Q);return}if(Q.type==="permission_request"){_(Q,z,L);return}if(Q.type==="permission_prompt"&&Q.text){k(Q,z,L);return}Q.type==="ui_event"&&Q.event?$(Q.event,L):Q.type==="provider_json"&&Q.data}catch(Q){console.error(`[useChatStream] Failed to parse WebSocket message for ${L}:`,Q,"Raw data:",I?.slice(0,200)),c(z.currentMessageId,L,"error"),i.updateMessage(z.currentMessageId,{status:"error"},L),i.setSessionError(`Failed to parse server response: ${Q instanceof Error?Q.message:"Invalid JSON"}`,L),i.endSession(L),i.endConversationStreaming(L),ie(L),i.saveConversation(L,!0),a(L)}}}function g(I,L,z){if(I.text&&L.currentTextBlockId&&l(L,z,I.text),I.thinking&&L.currentThinkingBlockId&&i.updateBlockWithSave(L.currentMessageId,L.currentThinkingBlockId,Q=>{Q.type==="thinking"&&(Q.thinking+=I.thinking)},z,{syncContent:!1}),I.partialJson){const Q=Ou(L.activeTools,I.index,I.blockId);Q&&(Q.inputJson+=I.partialJson)}}function O(I,L,z){const Q=Ou(L.activeTools,I.index,I.blockId);if(!Q){L.currentTextBlockId&&(L.currentTextBlockId=null),L.currentThinkingBlockId&&(L.currentThinkingBlockId=null);return}let J={};try{J=JSON.parse(Q.inputJson)}catch{}if(Q.name==="ExitPlanMode"){const de={allowedPrompts:J.allowedPrompts};i.setPendingPlanApproval(de,z)}i.updateBlockWithSave(L.currentMessageId,Q.blockId,de=>{if(de.type==="tool_use"){const Y=de;Y.input=J,Y.inputSummary=Hw(J),Y.status="pending"}},z);for(const[de,Y]of L.activeTools)if(Y===Q){L.activeTools.delete(de);break}}function _(I,L,z){s(L),i.endConversationStreaming(z);const Q=q1(I.description||"",I.tool||"Permission");i.setPendingPermission(Q,z);let J=`
47
+
48
+ **Permission Required**: ${Q.tool}`;Q.filePath&&(J+=` - ${Q.filePath}`),Z(L.currentMessageId,J+`
49
+ `,z)}function k(I,L,z){s(L),i.endConversationStreaming(z);const Q=q1(I.text||"","Permission");i.setPendingPermission(Q,z);const J=`
50
+
51
+ **${Q.tool}**: ${Q.filePath||Q.command||Q.description}
52
+ `;Z(L.currentMessageId,J,z)}const P=/codex cannot access session files|failed to clean up stale arg0 temp dirs: Permission denied|failed to initialize rollout recorder: Permission denied|failed to create session: Permission denied|\/\.codex\/.*permission denied/i,w=/state db missing rollout path for thread/i;async function C(I,L,z){console.error(`[useChatStream] Server error for ${z}:`,I.error);const Q=I.error||"Unknown server error";L.lastServerError=Q;const J=P.test(Q);if(w.test(Q)&&!J){const Y=Xd(z,L.currentMessageId);if(!Jc.has(Y)){const be=f(z,L.currentMessageId);if(be){Jc.add(Y),i.setProviderSessionId("",z),Z(L.currentMessageId,`
53
+
54
+ > **Session Reset**: Codex resume state was corrupted. Retrying once with a fresh session...
55
+
56
+ `,z);try{const Ce=i.conversations.find(ot=>ot.id===z),rt=Zd(Ce);return await K(be,L.currentMessageId,z,rt),!0}catch(Ce){console.error(`[useChatStream] Rollout-path recovery retry failed for ${z}:`,Ce)}}}}return s(L),c(L.currentMessageId,z,"error"),i.updateMessage(L.currentMessageId,{status:"error"},z),w.test(Q)&&i.setProviderSessionId("",z),Jc.delete(Xd(z,L.currentMessageId)),i.setSessionError(Q,z),i.endSession(z),i.endConversationStreaming(z),ie(z),i.saveConversation(z,!0),a(z),!1}async function M(I,L,z){s(L);const Q=o(z,L.currentMessageId);if(Jc.delete(Xd(z,L.currentMessageId)),I.denied||I.aborted){c(L.currentMessageId,z,"error"),i.updateMessage(L.currentMessageId,{status:"stopped"},z),D(L,z);return}if(I.awaitingUserInput){i.completeMessageWithSave(L.currentMessageId,z),i.endSession(z),i.endConversationStreaming(z),r(z),i.clearPendingPermission(z),i.saveConversation(z,!0),L.activeTools.clear();return}if(Q==="error"||Q==="stopped"){c(L.currentMessageId,z,"error"),D(L,z);return}c(L.currentMessageId,z,"complete"),i.completeMessageWithSave(L.currentMessageId,z),i.endSession(z),i.endConversationStreaming(z),r(z);const J=await d(z),de=G(L).then(be=>be?j(J,z,L):void 0),Y=Oo.popNextStep(z);Y&&de.then(()=>{const be=setTimeout(()=>{Mo.delete(z),q(z,Y.featureId,Y.step)},1500);eh(z),Mo.set(z,be)}),i.clearPendingPermission(z),i.saveConversation(z,!0),L.activeTools.clear()}function D(I,L){i.endSession(L),i.endConversationStreaming(L),ie(L),i.clearPendingPermission(L),I.activeTools.clear(),i.saveConversation(L,!0)}function j(I,L,z){return!I?.hasWorktree||!I.worktreePath?Promise.resolve():$fetch("/api/chat/worktree-commit",{method:"POST",body:{worktreePath:I.worktreePath,conversationId:L,previousBranch:I.worktreeBranch}}).then(Q=>I.previewBranch&&I.worktreePath?$fetch("/api/chat/preview-sync",{method:"POST",body:{previewBranch:I.previewBranch,worktreePath:I.worktreePath}}).then(J=>{if(!J.success)throw new Error(J.error||"Unknown preview sync failure");return Q}):Q).then(async Q=>{if(Q?.success&&Q.currentBranch!==I.worktreeBranch){const J=I.worktreeBranch||"unknown";i.updateWorktreeBranch(L,Q.currentBranch);const de=await i.syncConversationFeatureFromBranch(L),Y=Q.deletedPreviousBranch?` and deleted \`${J}\``:"",be=de?` and linked to feature \`${de}\``:"";Z(z.currentMessageId,`
57
+
58
+ > **Branch changed**: AI switched from \`${J}\` to \`${Q.currentBranch}\`${Y}${be}
59
+
60
+ `,L)}else Q?.success&&I.worktreeBranch&&i.updateWorktreeBranch(L,I.worktreeBranch);return i.saveConversation(L,!1),Q}).catch(Q=>{console.warn("[useChatStream] Auto-commit/preview-sync failed:",Q)})}function oe(I,L,z){if(I.type==="cli_prompt_submitted"&&typeof I.prompt=="string"&&I.prompt.trim()){L.cliSubmittedPrompt=I.prompt,ae(z,I.prompt);return}if(I.type==="cli_turn_stop"){L.cliTurnStopSeen=!0;return}if(I.type==="cli_turn_stop_confirmed"){L.cliTurnStopConfirmed=!0;return}I.type==="cli_tool_completed"&&I.failed&&console.warn("[useChatStream] CLI tool hook reported failure:",I.toolName||I.hookEventName)}function ae(I,L){const z=L.trim();if(!z||z.length>2e4)return;const Q=i.conversations.find(Y=>Y.id===I);if(!Q)return;const J=[...Q.messages].reverse().find(Y=>Y.role==="user");if(!J)return;const de=J.content.trim();de!==z&&(z.includes(de)&&z.length>de.length*3||(i.updateMessage(J.id,{content:z},I),i.saveConversation(I,!1)))}async function G(I){if(!I.cliTurnStopSeen||I.cliTurnStopConfirmed)return!0;const L=Date.now();for(;Date.now()-L<750;)if(await new Promise(z=>setTimeout(z,50)),I.cliTurnStopConfirmed)return!0;return console.warn("[useChatStream] CLI Stop seen but not confirmed before done; committing anyway."),!0}let x=null;const b=500;function T(I){const L=I.notificationEvent,z=I.source;console.log(`[useChatStream] Global notification: ${L}`,{jobId:I.jobId,conversationId:I.conversationId,source:z,status:I.status}),(L==="job_created"&&z!=="user"||L==="job_completed"||L==="job_persisted")&&(x&&clearTimeout(x),x=setTimeout(()=>{x=null,i.refreshServerConversations()},b))}function $(I,L){const z=yt.get(L);if(z)switch(i.pushDebugEvent({direction:"in",channel:"ui",eventType:I.type,payload:I},L),I.sessionId&&i.setProviderSessionId(I.sessionId,L),I.type){case"session_init":{E(z.currentMessageId,L),i.appendContentBlockWithSave(z.currentMessageId,Uw(I),L);break}case"block_start":{if(E(z.currentMessageId,L),I.blockType==="text"){const Q=Yw(I);i.appendContentBlockWithSave(z.currentMessageId,Q,L),z.currentTextBlockId=Q.id}else if(I.blockType==="thinking"){const Q=jw(I);i.appendContentBlockWithSave(z.currentMessageId,Q,L),z.currentThinkingBlockId=Q.id}else if(I.blockType==="tool_use"){const Q=Gw(I);Q&&(i.appendContentBlockWithSave(z.currentMessageId,Q.block,L),z.activeTools.set(Q.index,Q.tracking))}break}case"block_delta":{g(I,z,L);break}case"block_end":{O(I,z,L);break}case"tool_result":{E(z.currentMessageId,L);const Q=i.findToolUseBlock(z.currentMessageId,I.toolUseId,L);Q&&Q.type==="tool_use"&&i.updateBlockById(z.currentMessageId,Q.id,J=>{J.type==="tool_use"&&(J.status=I.isError?"error":"complete")},L),i.appendContentBlockWithSave(z.currentMessageId,Kw(I),L);break}case"permission_request":{s(z),i.endConversationStreaming(L);const Q={tool:I.tool,description:I.description,input:I.input,tools:I.tools};i.setPendingPermission(Q,L),Z(z.currentMessageId,`
61
+
62
+ **Permission Required**: ${Q.tool}
63
+ `,L);break}case"turn_result":{I.subtype!=="success"&&(i.updateMessage(z.currentMessageId,{status:"error"},L),ie(L),I.subtype==="max_turns"?i.setSessionError("Maximum conversation turns reached. Please start a new conversation.",L):i.setSessionError("Provider reported an execution error.",L));const Q=Jw(I);Q&&(E(z.currentMessageId,L),i.appendContentBlockWithSave(z.currentMessageId,Q,L));break}case"error":{i.updateMessage(z.currentMessageId,{status:"error"},L),i.setSessionError(I.error,L);break}}}function R(I,L){const z=I.replayBuffer;if(z.length===0)return;const Q=W9(z);for(const J of Q.providerSessionIds)i.setProviderSessionId(J,L);i.batchSetMessageBlocks(I.currentMessageId,Q.contentBlocks,Q.flatText,Q.finalStatus,L),I.currentTextBlockId=Q.currentTextBlockId,I.currentThinkingBlockId=Q.currentThinkingBlockId,I.activeTools=Q.activeTools,Q.isDone&&(s(I),i.endSession(L),i.endConversationStreaming(L),r(L),Q.finalStatus==="complete"&&d(L).then(J=>j(J,L,I)).catch(J=>console.warn("[useChatStream] Replay post-turn commit failed:",J))),console.log(`[useChatStream] Replay batch processed: ${z.length} events → ${Q.contentBlocks.length} blocks, status=${Q.finalStatus}`)}function E(I,L){i.initContentBlocks(I,L)}function Z(I,L,z){E(I,z);const Q={id:Zi(),type:"text",text:L};i.appendContentBlockWithSave(I,Q,z)}async function K(I,L,z,Q){if(typeof window>"u")return;const J=L9();try{const de=await u(z),Y=yt.get(z);Y&&(Y.currentMessageId=L,Y.activeTools.clear(),Y.currentTextBlockId=null,Y.currentThinkingBlockId=null,Y.cliTurnStopSeen=!1,Y.cliTurnStopConfirmed=!1,Y.cliSubmittedPrompt=null,n(Y)),B9(I)&&i.setProviderSessionId("",z);const Ce=i.getProviderSessionId(z),rt=i.conversations.find(_e=>_e.id===z),ot=rt?.providerId||e.providerSelection.providerId||dl,ut=rt?.providerModelKey;rt&&!rt.providerId&&(i.setConversationProviderSelection(z,ot),i.saveConversation(z,!0));const ce={type:"chat",message:I,assistantMessageId:L,attachments:Q?.attachments,requestId:J,sessionId:Ce||void 0,permissionMode:i.permissionMode,conversationId:z,cwd:Q?.cwd,worktreeBranch:Q?.worktreeBranch,baseBranch:Q?.baseBranch,featureId:Q?.featureId,providerId:ot,providerModelKey:ut};i.pushDebugEvent({direction:"out",channel:"ws",eventType:"chat",payload:ce},z),de.send(JSON.stringify(ce))}catch(de){i.updateMessage(L,{status:"error"},z),i.setSessionError(de.message||"Connection failed",z),i.endSession(z),i.endConversationStreaming(z),i.saveConversation(z,!0),a(z)}}function X(I,L){const z=L??i.activeConversationId;if(!z)return;const Q=yt.get(z);if(!Q||Q.ws.readyState!==WebSocket.OPEN)return;const J={type:"permission_response",allow:I};i.pushDebugEvent({direction:"out",channel:"ws",eventType:"permission_response",payload:J},z),Q.ws.send(JSON.stringify(J)),I&&(i.startConversationStreaming(z),n(Q));const de=I?"Allowed":"Denied";Z(Q.currentMessageId,`${de}
64
+ `,z),i.clearPendingPermission(z)}function V(I,L,z){Oo.enable(L,I,z)}function ie(I){eh(I),Oo.disable(I)}async function q(I,L,z){const Q=i.conversations.find(be=>be.id===I);if(!Q){ie(I);return}i.activeConversationId!==I&&i.selectConversation(I);let J;if(z.startsWith("skill:")){const be=z.replace("skill:","");try{J=(await $fetch(`/api/skills/${be}/prompt`,{method:"POST",body:{featureId:L,cwd:Q?.worktreePath}})).prompt}catch(Ce){console.error(`[useChatStream] Failed to render skill prompt for ${be}:`,Ce);return}}else J=`/speckit.${z} ${L}`;i.addUserMessage(J,I),i.saveConversation(I,!0);const de=i.addAssistantMessage(I);i.startSession(V1(),I),i.startConversationStreaming(I);const Y=Zd(Q);await K(J,de.id,I,Y)}async function ee(I,L,z=0){if(!(typeof window>"u"))try{const Q=await u(I),J=yt.get(I);J&&(J.currentMessageId=L,J.activeTools.clear(),J.currentTextBlockId=null,J.currentThinkingBlockId=null,J.cliTurnStopSeen=!1,J.cliTurnStopConfirmed=!1,J.cliSubmittedPrompt=null,n(J)),i.startConversationStreaming(I);const de={type:"subscribe",conversationId:I,cursor:z};i.pushDebugEvent({direction:"out",channel:"ws",eventType:"subscribe",payload:de},I),Q.send(JSON.stringify(de))}catch(Q){console.error(`[useChatStream] Failed to subscribe to ${I}:`,Q),i.setSessionError(Q.message||"Subscribe failed",I)}}function te(I){const L=I??i.activeConversationId;if(!L)return;const z=yt.get(L);if(z){if(s(z),z.ws.readyState===WebSocket.OPEN){const J={type:"abort",conversationId:L};i.pushDebugEvent({direction:"out",channel:"ws",eventType:"abort",payload:J},L),z.ws.send(JSON.stringify(J))}z.ws.readyState!==WebSocket.CLOSED&&z.ws.readyState!==WebSocket.CLOSING&&z.ws.close(),yt.delete(L)}const Q=z?.currentMessageId??Oe(L);Q&&(c(Q,L,"error"),i.updateMessage(Q,{status:"stopped"},L)),i.endSession(L),i.endConversationStreaming(L),i.clearPendingPermission(L),ie(L),i.saveConversation(L,!0)}function Oe(I){const L=i.conversations.find(z=>z.id===I);if(!L)return null;for(let z=L.messages.length-1;z>=0;z--){const Q=L.messages[z];if(Q.role==="assistant"&&Q.status==="streaming")return Q.id}return null}function Te(I){const L=yt.get(I);L&&(s(L),L.ws.close(),yt.delete(I)),eh(I),Oo.disable(I)}function ke(){for(const[I,L]of yt)s(L),L.ws.close(),yt.delete(I);eh(),Oo.disable()}async function Ze(I){const L=I??i.activeConversationId;if(!L)return;i.clearPendingPlanApproval(L),i.setPermissionMode("auto");const z="Approved. Proceed with the implementation.";i.addUserMessage(z,L),i.saveConversation(L,!0);const Q=i.addAssistantMessage(L);i.startSession(V1(),L),i.startConversationStreaming(L);const J=i.conversations.find(Y=>Y.id===L),de=Zd(J,!0);await K(z,Q.id,L,de)}function Je(I){const L=I??i.activeConversationId;L&&i.clearPendingPlanApproval(L)}async function Ve(I){if(typeof window>"u")return!1;try{const L=await $fetch("/api/jobs",{params:{conversationId:I}}),Q=L.find(Y=>Y.status==="running"||Y.status==="waiting_permission"||Y.status==="queued")||[...L].sort((Y,be)=>be.eventCount-Y.eventCount).find(Y=>Y.eventCount>0),J=i.conversations.find(Y=>Y.id===I);if(!J)return!1;const de=[...J.messages].reverse().find(Y=>Y.role==="assistant");return Q?!de||de.status!=="streaming"?!1:(console.log("[useChatStream] Resuming streaming for",I,"job:",Q.id,"status:",Q.status,"events:",Q.eventCount),i.resetMessageForReplay(de.id,I),i.startSession(`resume-${Date.now()}`,I),await ee(I,de.id,0),!0):(de&&de.status==="streaming"&&(i.updateMessage(de.id,{status:"error"},I),i.setSessionError("Streaming was interrupted (server job no longer active)",I)),!1)}catch(L){return console.error("[useChatStream] Failed to resume streaming:",L),!1}}return _i(()=>{Kc--,Kc<=0&&(Kc=0,ke())}),{sendMessage:K,sendPermissionResponse:X,subscribe:ee,tryResumeStreaming:Ve,approvePlan:Ze,rejectPlan:Je,abort:te,disconnect:ke,disconnectConversation:Te,enableCascade:V,disableCascade:ie,resetContext:h}}const q9=/^[0-9a-f]{7,40}$/i;function fc(i){if(typeof i!="string")return!1;const e=i.trim();return e.length>0&&e!=="HEAD"&&!e.startsWith("sc/")&&!q9.test(e)}function Tg(i,e){const t=e.map(s=>s.trim()).filter(Boolean),r=i?.trim()||"";return r&&t.includes(r)&&fc(r)?r:t.includes("main")?"main":t.includes("master")?"master":t[0]||null}function tS(i){return fc(i)?i.trim():"Loading branches..."}function Mg(i){const e=[i.name,i.ref];for(const t of e){if(typeof t!="string")continue;const r=t.trim();if(!r)continue;const s=r.startsWith("refs/heads/")?r.slice(11):r;if(fc(s))return s}return null}const H9={class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},U9={class:"px-4 py-3 border-b border-retro-border flex items-center justify-between"},Y9=["disabled"],j9=["onKeydown"],G9={class:"px-4 py-4 space-y-4"},K9={class:"space-y-2"},J9={class:"relative"},eI=["disabled"],tI={key:0,value:""},iI=["value"],rI={key:0,class:"space-y-2"},sI={class:"space-y-2"},nI={class:"relative"},oI=["disabled"],aI={key:0,value:""},lI=["value"],cI={key:1,class:"text-xs font-mono text-retro-red"},hI={key:2,class:"text-xs font-mono text-retro-red"},uI={key:3,class:"text-xs font-mono text-retro-muted"},dI={class:"px-4 py-3 border-t border-retro-border flex items-center gap-2 justify-end"},fI=["disabled"],pI=["disabled"],Pp=Xe({__name:"NewConversationModal",props:{show:{type:Boolean},creating:{type:Boolean},showProvider:{type:Boolean,default:!0}},emits:["close","create"],setup(i,{emit:e}){const t=i,r=e,s=Kl(),n=N([]),o=N(""),a=N([]),l=N(dl),c=N(!1),h=N(!1),u=N(""),d=N(""),f=N(null),p=he(()=>a.value.filter(M=>M.id==="claude"||M.id==="codex")),g=he(()=>p.value.find(M=>M.id===l.value)||p.value[0]),O=he(()=>!c.value&&!h.value&&!t.creating&&o.value.length>0&&n.value.length>0&&(t.showProvider===!1||!!g.value));function _(){if(p.value.length===0)return;const M=g.value;if(!M){l.value=dl;return}l.value=M.id}async function k(){c.value=!0,u.value="";try{const{cwd:M}=await $fetch("/api/cwd"),j=(await $fetch("/api/git/branches",{query:{excludeSc:!0,workingDirectory:M}})).branches.filter(ae=>!ae.isRemote).map(Mg).filter(ae=>!!ae),oe=Array.from(new Set(j)).sort((ae,G)=>{const x=T=>T==="main"?0:T==="master"?1:2,b=x(ae)-x(G);return b!==0?b:ae.localeCompare(G,void 0,{sensitivity:"base"})});if(n.value=oe,!oe.length){o.value="",u.value="No local branches available for chat creation.";return}o.value=Tg("main",oe)||oe[0]}catch(M){n.value=[],o.value="",u.value=M instanceof Error?M.message:"Failed to load branches"}finally{c.value=!1}}async function P(){h.value=!0,d.value="";try{await s.hydrate(),l.value=s.providerSelection.providerId;const M=await $fetch("/api/ai/providers");a.value=M.providers,_()}catch(M){a.value=[],l.value=dl,d.value=M instanceof Error?M.message:"Failed to load providers"}finally{h.value=!1}}Ye(()=>t.show,async M=>{M&&(await xi(),f.value?.focus(),k(),t.showProvider!==!1&&P())}),Ye(l,()=>{_()});function w(){O.value&&r("create",{baseBranch:o.value,providerId:t.showProvider===!1?s.providerSelection.providerId:l.value})}function C(M){const D=M.target;D instanceof HTMLElement&&D.closest("button")||D instanceof HTMLInputElement||D instanceof HTMLTextAreaElement||(M.preventDefault(),w())}return(M,D)=>(y(),xe(or,{to:"body"},[le(hs,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:gt(()=>[i.show?(y(),S("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:D[4]||(D[4]=Ri(j=>r("close"),["self"]))},[m("div",H9,[m("div",U9,[D[5]||(D[5]=m("h3",{class:"text-sm font-mono text-retro-text font-semibold"},"New Conversation",-1)),m("button",{type:"button",class:"p-1 text-retro-muted hover:text-retro-text transition-colors",disabled:i.creating,onClick:D[0]||(D[0]=j=>r("close"))},[le(v(hi),{class:"w-4 h-4"})],8,Y9)]),m("form",{ref_key:"formRef",ref:f,tabindex:"-1",onSubmit:Ri(w,["prevent"]),onKeydown:fn(Ri(C,["exact"]),["enter"])},[m("div",G9,[m("div",K9,[D[6]||(D[6]=m("label",{class:"block text-xs font-mono text-retro-muted"},"Base Branch",-1)),m("div",J9,[je(m("select",{"onUpdate:modelValue":D[1]||(D[1]=j=>o.value=j),disabled:c.value||i.creating||n.value.length===0,class:"w-full appearance-none bg-retro-black border border-retro-border rounded px-2 py-1.5 pr-7 text-xs font-mono text-retro-cyan focus:outline-none focus:border-retro-cyan disabled:opacity-40"},[c.value?(y(),S("option",tI,"Loading branches...")):se("",!0),(y(!0),S(Me,null,Ke(n.value,j=>(y(),S("option",{key:j,value:j},F(j),9,iI))),128))],8,eI),[[gn,o.value]]),le(v(Dh),{class:"absolute right-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})])]),i.showProvider!==!1?(y(),S("div",rI,[m("div",sI,[D[7]||(D[7]=m("label",{class:"block text-xs font-mono text-retro-muted"},"Provider",-1)),m("div",nI,[je(m("select",{"onUpdate:modelValue":D[2]||(D[2]=j=>l.value=j),disabled:h.value||i.creating||p.value.length===0,class:"w-full appearance-none bg-retro-black border border-retro-border rounded px-2 py-1.5 pr-7 text-xs font-mono text-retro-cyan focus:outline-none focus:border-retro-cyan disabled:opacity-40"},[h.value?(y(),S("option",aI,"Loading...")):se("",!0),(y(!0),S(Me,null,Ke(p.value,j=>(y(),S("option",{key:j.id,value:j.id},F(j.name),9,lI))),128))],8,oI),[[gn,l.value]]),le(v(Dh),{class:"absolute right-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})])])])):se("",!0),u.value?(y(),S("p",cI,F(u.value),1)):d.value?(y(),S("p",hI,F(d.value),1)):(y(),S("p",uI," Provider is fixed after the conversation is created. "))]),m("div",dI,[m("button",{type:"button",class:"px-3 py-1.5 text-xs font-mono rounded border border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text/30 transition-colors disabled:opacity-40",disabled:i.creating,onClick:D[3]||(D[3]=j=>r("close"))}," Cancel ",8,fI),m("button",{type:"submit",disabled:!O.value,class:"px-3 py-1.5 text-xs font-mono rounded border bg-retro-cyan/10 border-retro-cyan/50 text-retro-cyan hover:bg-retro-cyan/20 transition-colors disabled:opacity-40 disabled:cursor-not-allowed"},F(i.creating?"Creating...":"Create"),9,pI)])],40,j9)])])):se("",!0)]),_:1})]))}}),mI={class:"h-full flex flex-col bg-retro-black"},gI={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border"},vI={class:"flex items-center gap-1"},OI={class:"flex-shrink-0 px-3 pt-3"},_I={class:"relative"},bI={class:"flex-1 overflow-y-auto p-3"},yI={class:"space-y-2"},xI={key:0,class:"flex items-center justify-center py-12"},wI={key:1,class:"flex flex-col items-center justify-center py-12 text-center"},SI={key:2,class:"flex flex-col items-center justify-center py-12 text-center"},H1=Xe({__name:"FeaturesPanel",setup(i){const e=Lr(),t=Qu(),{sendMessage:r,enableCascade:s}=Pg(),n=Gl(),o=N("features"),a=N(null),l=N(null),c=N([]),h=N([]),u=N(!1),d=N({}),f=N(!1),p=N(null),g=N(!1),O=N(!1),_=N(!1),k=N(null),P=N(""),w=N("");let C=null;Ye(P,Q=>{C&&clearTimeout(C),C=setTimeout(()=>{w.value=Q},300)});const M=he(()=>{const Q=w.value.trim().toLowerCase();return Q?c.value.filter(J=>J.name.toLowerCase().includes(Q)||J.id.toLowerCase().includes(Q)):c.value}),D=N({}),j=he(()=>{const Q=e.activeConversation;if(!Q)return null;if(Q.featureId)return Q.featureId;const J=Q.worktreeBranch?.trim();return J&&c.value.some(de=>de.id===J)?J:null}),oe=he(()=>j.value||a.value);Ye(()=>e.activeConversationId,()=>{a.value=null;const Q=j.value;t.setSelectedFeatureId(Q),Q&&xi(()=>{const J=D.value[Q];J&&J.scrollIntoView({behavior:"auto",block:"nearest"})})}),Ye(a,Q=>{Q&&xi(()=>{const J=D.value[Q];J&&J.scrollIntoView({behavior:"auto",block:"nearest"})})});async function ae(){u.value=!0;try{const Q=await $fetch("/api/specs/features");c.value=Q.features,G(Q.features)}catch{n.error("Failed to load features"),c.value=[],d.value={}}finally{u.value=!1}}async function G(Q){if(Q.length===0){d.value={};return}const J=await Promise.allSettled(Q.map(async Y=>{const be=await $fetch(`/api/specs/traceability/${Y.id}`),Ce=be.alerts.filter(ot=>ot.severity==="critical").length,rt=be.alerts.filter(ot=>ot.severity==="major").length;return{featureId:Y.id,critical:Ce,major:rt}})),de={};for(const Y of J)Y.status==="fulfilled"&&(de[Y.value.featureId]={critical:Y.value.critical,major:Y.value.major});d.value=de}async function x(){try{const Q=await $fetch("/api/skills");h.value=Q.skills}catch{h.value=[]}}Qt(()=>{ae(),x(),window.addEventListener("keydown",$)}),_i(()=>{window.removeEventListener("keydown",$)});function b(Q,J={}){if(a.value=Q,l.value=null,o.value="files",t.setSelectedFeatureId(Q),J.openViewer!==!1){const de=c.value.find(Y=>Y.id===Q);de&&(p.value=de,f.value=!0)}}function T(){f.value=!1,p.value=null}function $(Q){(Q.ctrlKey||Q.metaKey)&&Q.key.toLowerCase()==="k"&&(Q.preventDefault(),g.value||(g.value=!0))}function R(){g.value=!1}function E(Q){b(Q,{openViewer:!1}),g.value=!1}function Z(){g.value=!0}const K=he(()=>c.value.map(Q=>Q.id));function X(Q){return d.value[Q]??{critical:0,major:0}}const V={plan:["tasks","implement"],tasks:["implement"],implement:[],clarify:[],analyze:[]},ie={analyze:["skill:better-spec"]};async function q(Q,J,de){if(Q.startsWith("skill:")){const Y=Q.replace("skill:",""),be=de?e.conversations.find(rt=>rt.id===de):null;return(await $fetch(`/api/skills/${Y}/prompt`,{method:"POST",body:{featureId:J,cwd:be?.worktreePath}})).prompt}return`/speckit.${Q} ${J}`}function ee(Q,J){if(J)return null;const de=e.findConversationByFeature(Q);return de&&!e.isConversationActivelyStreaming(de.id)&&!de.finalized?(e.selectConversation(de.id),de.id):null}function te(Q){const J=e.findConversationByFeature(Q);return J&&J.finalized?(n.error(`This feature has a finalized conversation "${J.title}". Please archive it first to start a new conversation.`),e.selectConversation(J.id),!0):!1}async function Oe(Q,J,de){const Y=await e.createConversation({featureId:Q,...de});if(!Y)throw new Error("Failed to create conversation");return e.renameConversation(Y,J),e.selectConversation(Y),Y}async function Te(Q,J){e.addUserMessage(J,Q),e.saveConversation(Q,!0);const de=e.conversations.find(Ce=>Ce.id===Q),Y=e.addAssistantMessage(Q);e.startSession(`session-${Date.now()}`,Q),e.startConversationStreaming(Q);const be={};de?.worktreePath&&(be.cwd=de.worktreePath,be.worktreeBranch=de.worktreeBranch),de?.featureId&&(be.featureId=de.featureId),await r(J,Y.id,Q,Object.keys(be).length>0?be:void 0)}async function ke(Q,J,de){const Y=ie[J];let be;if(Y&&Y.length>0){const Ce=[...Y.slice(1),J,...V[J]||[]];s(Q,de,Ce);const rt=Y[0];try{be=await q(rt,Q,de)}catch(ot){n.error(ot instanceof Error?ot.message:"Failed to resolve prerequisite step");return}}else{const Ce=V[J]||[];Ce.length>0&&s(Q,de,Ce),be=`/speckit.${J} ${Q}`}await Te(de,be)}async function Ze(Q,J,de){const Y=Q.shiftKey;if(!Y&&te(J))return;const be=ee(J,Y);if(be){try{await ke(J,de,be)}catch(Ce){n.error(Ce instanceof Error?Ce.message:"Failed to run cascade action")}return}k.value={type:"cascade",featureId:J,command:de,title:`${de}: ${J}`},O.value=!0}async function Je(Q,J){te(J)||(k.value={type:"open-chat",featureId:J,title:`spec: ${J}`},O.value=!0)}async function Ve(Q,J,de){let Y;try{const be=e.conversations.find(Ce=>Ce.id===de);Y=await $fetch(`/api/skills/${J}/prompt`,{method:"POST",body:{featureId:Q,cwd:be?.worktreePath}})}catch(be){throw new Error(be instanceof Error?be.message:"Failed to render skill prompt")}await Te(de,Y.prompt)}async function I(Q,J,de){const Y=Q.shiftKey;if(!Y&&te(J))return;const be=ee(J,Y);if(be){try{await Ve(J,de,be)}catch(Ce){n.error(Ce instanceof Error?Ce.message:"Failed to run skill")}return}k.value={type:"skill",featureId:J,skillId:de,title:`skill: ${de} — ${J}`},O.value=!0}function L(){O.value=!1,k.value=null}async function z(Q){if(k.value){_.value=!0;try{const J=k.value,de=await Oe(J.featureId,J.title,Q);J.type==="cascade"?await ke(J.featureId,J.command,de):J.type==="skill"&&await Ve(J.featureId,J.skillId,de),O.value=!1,k.value=null}catch(J){n.error(J instanceof Error?J.message:"Failed to create conversation")}finally{_.value=!1}}}return(Q,J)=>{const de=ST,Y=a9,be=R9;return y(),S("div",mI,[m("div",gI,[J[2]||(J[2]=m("div",{class:"flex items-center gap-2 min-w-0"},null,-1)),m("div",vI,[m("button",{type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"Search (Ctrl/Cmd+K)",onClick:Z},[le(v(Hn),{class:"h-4 w-4"})]),m("button",{type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"Refresh",onClick:ae},[le(v(Kn),{class:Ie(["h-4 w-4",{"animate-spin":v(u)}])},null,8,["class"])])])]),m("div",OI,[m("div",_I,[le(v(Hn),{class:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-retro-subtle"}),je(m("input",{"onUpdate:modelValue":J[0]||(J[0]=Ce=>at(P)?P.value=Ce:null),type:"text",placeholder:"Search features...",class:"w-full pl-8 pr-3 py-1.5 text-xs font-mono rounded border border-retro-border bg-retro-panel text-retro-text placeholder:text-retro-subtle focus:outline-none focus:border-retro-cyan transition-colors"},null,512),[[$i,v(P)]])])]),m("div",bI,[m("div",yI,[(y(!0),S(Me,null,Ke(v(M),Ce=>(y(),S("div",{key:Ce.id,ref_for:!0,ref:rt=>{v(D)[Ce.id]=rt}},[le(de,{feature:Ce,skills:v(h),"is-active":v(oe)===Ce.id,"critical-alerts":X(Ce.id).critical,"major-alerts":X(Ce.id).major,onSelect:J[1]||(J[1]=rt=>b(rt,{openViewer:!0})),onCascade:Ze,onOpenChat:Je,onSkill:I},null,8,["feature","skills","is-active","critical-alerts","major-alerts"])]))),128))]),v(u)&&v(c).length===0?(y(),S("div",xI,[...J[3]||(J[3]=[m("span",{class:"text-sm font-mono text-retro-muted animate-pulse"},"Loading features...",-1)])])):se("",!0),!v(u)&&v(c).length>0&&v(M).length===0?(y(),S("div",wI,[le(v(Hn),{class:"h-10 w-10 text-retro-subtle mb-3"}),J[4]||(J[4]=m("p",{class:"text-sm font-mono text-retro-muted"},"No matching features",-1)),J[5]||(J[5]=m("p",{class:"mt-1 text-xs font-mono text-retro-subtle"}," Try a different search term ",-1))])):se("",!0),!v(u)&&v(c).length===0?(y(),S("div",SI,[le(v(bk),{class:"h-10 w-10 text-retro-subtle mb-3"}),J[6]||(J[6]=m("p",{class:"text-sm font-mono text-retro-muted"},"No features found",-1)),J[7]||(J[7]=m("p",{class:"mt-1 text-xs font-mono text-retro-subtle"}," Create a feature in specs/ to get started ",-1))])):se("",!0)]),v(f)&&v(p)?(y(),xe(Y,{key:0,feature:v(p),onClose:T},null,8,["feature"])):se("",!0),v(g)?(y(),xe(be,{key:1,"available-feature-ids":v(K),onClose:R,onSelect:E},null,8,["available-feature-ids"])):se("",!0),le(Pp,{show:v(O),creating:v(_),onClose:L,onCreate:z},null,8,["show","creating"])])}}}),kI={class:"h-full flex flex-col bg-retro-black"},CI={class:"flex-shrink-0 px-3 py-2 border-b border-retro-border space-y-2"},$I={class:"flex items-center justify-between gap-2"},PI={class:"flex items-center gap-1"},TI={class:"relative"},MI=["placeholder"],QI={key:0,class:"flex-shrink-0 flex items-center gap-2 px-3 py-2 bg-retro-yellow/10 border-b border-retro-yellow/30 text-xs"},AI={class:"text-retro-yellow font-mono"},RI={class:"flex-1 overflow-y-auto p-2"},BI={key:0,class:"space-y-1"},LI={key:1,class:"text-center py-6 text-retro-muted"},EI={class:"font-mono text-xs"},DI={key:1,class:"text-center py-8 text-retro-muted"},II={key:0,class:"space-y-2"},zI={class:"flex items-center justify-end pb-1"},NI={class:"flex items-start justify-between gap-2"},WI={class:"min-w-0"},ZI={class:"text-sm font-mono text-retro-text truncate"},XI={class:"text-xs text-retro-muted mt-1 truncate"},FI={class:"text-xs text-retro-muted/70 mt-1"},VI={class:"text-xs text-retro-muted/70"},qI={class:"flex items-center gap-1 flex-shrink-0"},HI=["onClick"],UI=["onClick"],YI={key:1,class:"text-center py-6 text-retro-muted"},jI={class:"font-mono text-xs"},GI={key:1,class:"text-center py-8 text-retro-muted"},KI={class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},JI={class:"px-4 py-3 border-b border-retro-border flex items-center justify-between"},ez=["disabled"],tz={class:"px-4 py-4"},iz={class:"text-xs font-mono text-retro-text"},rz={class:"px-4 py-3 border-t border-retro-border flex items-center justify-end gap-2"},sz=["disabled"],nz=["disabled"],U1=Xe({__name:"ConversationsPanel",setup(i){const e=Lr(),t=Gl(),r=N(""),s=N(""),n=N(!1),o=N(!1),a=N(!1),l=N(!1),c=N(null),h=N(!1),u=N(!1);let d=null;function f(q){if(!(q instanceof HTMLElement))return!1;const ee=q.tagName.toLowerCase();return q.isContentEditable||ee==="input"||ee==="textarea"||ee==="select"}function p(q){q.key.toLowerCase()!=="n"||q.ctrlKey||q.metaKey||q.altKey||q.shiftKey||n.value||a.value||f(q.target)||(q.preventDefault(),G())}Ye(r,q=>{d&&clearTimeout(d),d=setTimeout(()=>{s.value=q},180)},{immediate:!0}),_i(()=>{d&&(clearTimeout(d),d=null),window.removeEventListener("keydown",p)}),Qt(()=>{window.addEventListener("keydown",p)});const g=new Map,O=new Map;function _(q){return[...q].reverse().find(ee=>ee.role==="user")}function k(q){const ee=_(q);return`${ee?.id||""}:${vo(ee?.content||"")}`}Ye(()=>e.sortedConversations.map(q=>q.id),q=>{const ee=new Set(q);for(const te of g.keys())ee.has(te)||g.delete(te)},{immediate:!0}),Ye(()=>e.sortedArchivedConversations.map(q=>q.id),q=>{const ee=new Set(q);for(const te of O.keys())ee.has(te)||O.delete(te)},{immediate:!0});function P(q){const ee=_(q.messages);return[q.updatedAt,q.title,q.messages.length,ee?.id||"",vo(ee?.content||"").length].join("|")}function w(q){const ee=_(q.messages);return[q.updatedAt,q.archivedAt,q.title,q.messages.length,ee?.id||"",vo(ee?.content||"").length].join("|")}function C(q){const ee=P(q),te=g.get(q.id);if(te&&te.signature===ee)return te.text;const Oe=[q.title,...q.messages.map(Te=>vo(Te.content||""))].join(`
65
+ `).toLowerCase();return g.set(q.id,{signature:ee,text:Oe}),Oe}function M(q){const ee=w(q),te=O.get(q.id);if(te&&te.signature===ee)return te.text;const Oe=[q.title,...q.messages.map(Te=>vo(Te.content||""))].join(`
66
+ `).toLowerCase();return O.set(q.id,{signature:ee,text:Oe}),Oe}const D=he(()=>e.conversationViewMode==="archive"),j=he(()=>{const q=e.sortedConversations;if(!s.value.trim())return q;const ee=s.value.toLowerCase().trim();return q.filter(te=>C(te).includes(ee))}),oe=he(()=>{const q=e.sortedArchivedConversations;if(!s.value.trim())return q;const ee=s.value.toLowerCase().trim();return q.filter(te=>M(te).includes(ee))}),ae=he(()=>e.previewingConversationId);async function G(){if(e.checkStorageLimits().atLimit){t.error("Delete or archive a conversation first (limit: 100).");return}n.value=!0}async function x(q){o.value=!0;try{if(!await e.createConversation(q)){t.error("Failed to create conversation");return}n.value=!1}catch(ee){t.error(ee instanceof Error?ee.message:"Failed to create conversation")}finally{o.value=!1}}function b(q){e.selectConversation(q),e.setConversationViewMode("active")}async function T(q){const ee=await e.archiveConversation(q);if(!ee.success){t.error(ee.error||"Failed to archive conversation");return}t.success("Conversation archived")}async function $(q){c.value=q,a.value=!0}function R(){a.value=!1,c.value=null}async function E(q){if(c.value){l.value=!0;try{const ee=await e.restoreArchivedConversation(c.value,q.baseBranch);if(!ee.success){t.error(ee.error||"Failed to restore archived conversation");return}t.success("Archived conversation restored"),a.value=!1,c.value=null}finally{l.value=!1}}}async function Z(q){const ee=await e.deleteArchivedConversation(q);if(!ee.success){t.error(ee.error||"Failed to delete archived conversation");return}t.success("Archived conversation deleted")}async function K(){u.value=!0;try{const q=await e.deleteAllArchivedConversations();if(!q.success){t.error(q.error||"Failed to clear archived conversations");return}h.value=!1,t.success(`Cleared ${q.deletedCount} archived conversation${q.deletedCount===1?"":"s"}`)}finally{u.value=!1}}function X(q,ee){e.renameConversation(q,ee)}function V(q){return new Date(q).toLocaleString()}function ie(q){if(!q.length)return"No messages";const ee=_(q),te=vo(ee?.content||"");return te?te.length>80?`${te.slice(0,80)}...`:te:"No user message"}return(q,ee)=>(y(),S("div",kI,[m("div",CI,[m("div",$I,[m("button",{onClick:G,class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"New conversation","aria-label":"New conversation"},[le(v(Pu),{class:"w-4 h-4"})]),m("div",PI,[m("button",{onClick:ee[0]||(ee[0]=te=>v(e).setConversationViewMode("active")),class:Ie(["p-1.5 rounded transition-colors",D.value?"text-retro-muted hover:text-retro-cyan hover:bg-retro-panel":"text-retro-cyan bg-retro-cyan/10"]),title:"Active conversations","aria-label":"Active conversations"},[le(v(P_),{class:"w-4 h-4"})],2),m("button",{onClick:ee[1]||(ee[1]=te=>v(e).setConversationViewMode("archive")),class:Ie(["p-1.5 rounded transition-colors",D.value?"text-retro-cyan bg-retro-cyan/10":"text-retro-muted hover:text-retro-cyan hover:bg-retro-panel"]),title:"Archived conversations","aria-label":"Archived conversations"},[le(v(Ug),{class:"w-4 h-4"})],2)])]),m("div",TI,[le(v(Hn),{class:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted"}),je(m("input",{"onUpdate:modelValue":ee[2]||(ee[2]=te=>r.value=te),type:"text",placeholder:D.value?"Search archive...":"Search conversations...",class:"w-full pl-8 pr-3 py-1.5 text-xs font-mono bg-retro-black border border-retro-border rounded focus:border-retro-cyan focus:outline-none focus:ring-1 focus:ring-retro-cyan text-retro-text placeholder-retro-muted"},null,8,MI),[[$i,r.value]])])]),v(e).isNearStorageLimit?(y(),S("div",QI,[le(v(vn),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),m("p",AI,F(v(e).conversationCount)+" active conversations. Limit is 100. ",1)])):se("",!0),m("div",RI,[D.value?(y(),S(Me,{key:1},[v(e).hasArchivedConversations?(y(),S("div",II,[m("div",zI,[m("button",{onClick:ee[5]||(ee[5]=te=>h.value=!0),class:"inline-flex items-center gap-1 px-2 py-1 text-xs font-mono border border-red-400/40 text-red-300 rounded hover:bg-red-500/10 transition-colors",title:"Delete all archived conversations"},[le(v(os),{class:"w-3.5 h-3.5"}),ee[13]||(ee[13]=We(" Clear all ",-1))])]),oe.value.length>0?(y(!0),S(Me,{key:0},Ke(oe.value,(te,Oe,Te,ke)=>{const Ze=[te.id,te.title,te.updatedAt,te.archivedAt,te.messages.length];if(ke&&ke.key===te.id&&Vg(ke,Ze))return ke;const Je=(y(),S("div",{key:te.id,onClick:Ve=>$(te.id),onKeydown:[fn(Ri(Ve=>$(te.id),["prevent"]),["enter"]),fn(Ri(Ve=>$(te.id),["prevent"]),["space"])],class:"w-full text-left p-3 rounded border border-retro-border hover:border-retro-cyan/50 hover:bg-retro-cyan/5 transition-colors",role:"button",tabindex:"0"},[m("div",NI,[m("div",WI,[m("h3",ZI,F(te.title),1),m("p",XI,F(ie(te.messages)),1),m("p",FI," Archived: "+F(V(te.archivedAt)),1),m("p",VI," Updated: "+F(V(te.updatedAt)),1)]),m("div",qI,[m("button",{onClick:Ri(Ve=>$(te.id),["stop"]),class:"inline-flex items-center gap-1 px-2 py-1 text-xs font-mono border border-retro-cyan/40 text-retro-cyan rounded hover:bg-retro-cyan/10 transition-colors",title:"Restore archived conversation"},[le(v(Ug),{class:"w-3.5 h-3.5"}),ee[14]||(ee[14]=We(" Restore ",-1))],8,HI),m("button",{onClick:Ri(Ve=>Z(te.id),["stop"]),class:"inline-flex items-center gap-1 px-2 py-1 text-xs font-mono border border-red-400/40 text-red-300 rounded hover:bg-red-500/10 transition-colors",title:"Delete archived conversation"},[le(v(os),{class:"w-3.5 h-3.5"}),ee[15]||(ee[15]=We(" Delete ",-1))],8,UI)])])],40,["onClick","onKeydown"]));return Je.memo=Ze,Je},ee,6),128)):(y(),S("div",YI,[m("p",jI,'No archived results for "'+F(r.value)+'"',1)]))])):(y(),S("div",GI,[...ee[16]||(ee[16]=[m("p",{class:"font-mono text-sm"},"No archived conversations",-1),m("p",{class:"text-xs mt-1"},"Archived conversations will appear here",-1)])]))],64)):(y(),S(Me,{key:0},[v(e).hasConversations?(y(),S("div",BI,[j.value.length>0?(y(!0),S(Me,{key:0},Ke(j.value,(te,Oe,Te,ke)=>{const Ze=[te.id,te.title,te.messages.length,k(te.messages),te.finalized,te.id===v(e).activeConversationId,v(e).isConversationStreaming(te.id),ae.value===te.id];if(ke&&ke.key===te.id&&Vg(ke,Ze))return ke;const Je=(y(),S("div",{key:te.id},[le(H2,{conversation:te,"is-active":te.id===v(e).activeConversationId,"is-streaming":v(e).isConversationStreaming(te.id),"is-previewing":ae.value===te.id,onSelect:Ve=>b(te.id),onArchive:Ve=>T(te.id),onRename:Ve=>X(te.id,Ve)},null,8,["conversation","is-active","is-streaming","is-previewing","onSelect","onArchive","onRename"])]));return Je.memo=Ze,Je},ee,3),128)):(y(),S("div",LI,[m("p",EI,'No results for "'+F(r.value)+'"',1)]))])):(y(),S("div",DI,[...ee[12]||(ee[12]=[m("p",{class:"font-mono text-sm"},"No conversations",-1),m("p",{class:"text-xs mt-1"},'Click "New" to start',-1)])]))],64))]),le(Pp,{show:n.value,creating:o.value,onClose:ee[8]||(ee[8]=te=>n.value=!1),onCreate:x},null,8,["show","creating"]),le(Pp,{show:a.value,creating:l.value,"show-provider":!1,onClose:R,onCreate:E},null,8,["show","creating"]),(y(),xe(or,{to:"body"},[le(hs,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:gt(()=>[h.value?(y(),S("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:ee[11]||(ee[11]=Ri(te=>!u.value&&(h.value=!1),["self"]))},[m("div",KI,[m("div",JI,[ee[17]||(ee[17]=m("h3",{class:"text-sm font-mono text-retro-text font-semibold"},"Clear archived conversations",-1)),m("button",{type:"button",class:"p-1 text-retro-muted hover:text-retro-text transition-colors",disabled:u.value,onClick:ee[9]||(ee[9]=te=>h.value=!1)},[le(v(hi),{class:"w-4 h-4"})],8,ez)]),m("div",tz,[m("p",iz," Delete all "+F(v(e).archivedConversations.length)+" archived conversation"+F(v(e).archivedConversations.length===1?"":"s")+"? This cannot be undone. ",1)]),m("div",rz,[m("button",{type:"button",disabled:u.value,class:"px-3 py-1 text-xs font-mono rounded border border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text/30 transition-colors disabled:opacity-40",onClick:ee[10]||(ee[10]=te=>h.value=!1)}," Cancel ",8,sz),m("button",{type:"button",disabled:u.value,class:"inline-flex items-center gap-1 px-3 py-1 text-xs font-mono rounded border border-red-400/50 text-red-300 hover:bg-red-500/10 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",onClick:K},[le(v(os),{class:"w-3.5 h-3.5"}),We(" "+F(u.value?"Clearing...":"Clear all"),1)],8,nz)])])])):se("",!0)]),_:1})]))]))}}),oz={mobile:768,tablet:1024};function az(i,e){return i<e.mobile?"mobile":i<e.tablet?"tablet":"desktop"}const iS=xm("layout",{state:()=>({currentViewport:"desktop",chatFullscreen:!1}),getters:{isMobile:i=>i.currentViewport==="mobile",isTablet:i=>i.currentViewport==="tablet",isDesktop:i=>i.currentViewport==="desktop",isChatFullscreen:i=>i.chatFullscreen},actions:{updateViewport(i){this.currentViewport=az(i,oz)},toggleChatFullscreen(){this.chatFullscreen=!this.chatFullscreen},setChatFullscreen(i){this.chatFullscreen=i}}});var rS=Object.defineProperty,lz=Object.getOwnPropertyDescriptor,cz=(i,e)=>{for(var t in e)rS(i,t,{get:e[t],enumerable:!0})},Lt=(i,e,t,r)=>{for(var s=r>1?void 0:r?lz(e,t):e,n=i.length-1,o;n>=0;n--)(o=i[n])&&(s=(r?o(e,t,s):o(s))||s);return r&&s&&rS(e,t,s),s},Qe=(i,e)=>(t,r)=>e(t,r,i),Y1="Terminal input",Tp={get:()=>Y1,set:i=>Y1=i},j1="Too much output to announce, navigate to rows manually to read",Mp={get:()=>j1,set:i=>j1=i};function hz(i){return i.replace(/\r?\n/g,"\r")}function uz(i,e){return e?"\x1B[200~"+i+"\x1B[201~":i}function dz(i,e){i.clipboardData&&i.clipboardData.setData("text/plain",e.selectionText),i.preventDefault()}function fz(i,e,t,r){if(i.stopPropagation(),i.clipboardData){let s=i.clipboardData.getData("text/plain");sS(s,e,t,r)}}function sS(i,e,t,r){i=hz(i),i=uz(i,t.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),t.triggerDataEvent(i,!0),e.value=""}function nS(i,e,t){let r=t.getBoundingClientRect(),s=i.clientX-r.left-10,n=i.clientY-r.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${s}px`,e.style.top=`${n}px`,e.style.zIndex="1000",e.focus()}function G1(i,e,t,r,s){nS(i,e,t),s&&r.rightClickSelect(i),e.value=r.selectionText,e.select()}function cn(i){return i>65535?(i-=65536,String.fromCharCode((i>>10)+55296)+String.fromCharCode(i%1024+56320)):String.fromCharCode(i)}function Hu(i,e=0,t=i.length){let r="";for(let s=e;s<t;++s){let n=i[s];n>65535?(n-=65536,r+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):r+=String.fromCharCode(n)}return r}var pz=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let r=e.length;if(!r)return 0;let s=0,n=0;if(this._interim){let o=e.charCodeAt(n++);56320<=o&&o<=57343?t[s++]=(this._interim-55296)*1024+o-56320+65536:(t[s++]=this._interim,t[s++]=o),this._interim=0}for(let o=n;o<r;++o){let a=e.charCodeAt(o);if(55296<=a&&a<=56319){if(++o>=r)return this._interim=a,s;let l=e.charCodeAt(o);56320<=l&&l<=57343?t[s++]=(a-55296)*1024+l-56320+65536:(t[s++]=a,t[s++]=l);continue}a!==65279&&(t[s++]=a)}return s}},mz=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let r=e.length;if(!r)return 0;let s=0,n,o,a,l,c=0,h=0;if(this.interim[0]){let f=!1,p=this.interim[0];p&=(p&224)===192?31:(p&240)===224?15:7;let g=0,O;for(;(O=this.interim[++g]&63)&&g<4;)p<<=6,p|=O;let _=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,k=_-g;for(;h<k;){if(h>=r)return 0;if(O=e[h++],(O&192)!==128){h--,f=!0;break}else this.interim[g++]=O,p<<=6,p|=O&63}f||(_===2?p<128?h--:t[s++]=p:_===3?p<2048||p>=55296&&p<=57343||p===65279||(t[s++]=p):p<65536||p>1114111||(t[s++]=p)),this.interim.fill(0)}let u=r-4,d=h;for(;d<r;){for(;d<u&&!((n=e[d])&128)&&!((o=e[d+1])&128)&&!((a=e[d+2])&128)&&!((l=e[d+3])&128);)t[s++]=n,t[s++]=o,t[s++]=a,t[s++]=l,d+=4;if(n=e[d++],n<128)t[s++]=n;else if((n&224)===192){if(d>=r)return this.interim[0]=n,s;if(o=e[d++],(o&192)!==128){d--;continue}if(c=(n&31)<<6|o&63,c<128){d--;continue}t[s++]=c}else if((n&240)===224){if(d>=r)return this.interim[0]=n,s;if(o=e[d++],(o&192)!==128){d--;continue}if(d>=r)return this.interim[0]=n,this.interim[1]=o,s;if(a=e[d++],(a&192)!==128){d--;continue}if(c=(n&15)<<12|(o&63)<<6|a&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[s++]=c}else if((n&248)===240){if(d>=r)return this.interim[0]=n,s;if(o=e[d++],(o&192)!==128){d--;continue}if(d>=r)return this.interim[0]=n,this.interim[1]=o,s;if(a=e[d++],(a&192)!==128){d--;continue}if(d>=r)return this.interim[0]=n,this.interim[1]=o,this.interim[2]=a,s;if(l=e[d++],(l&192)!==128){d--;continue}if(c=(n&7)<<18|(o&63)<<12|(a&63)<<6|l&63,c<65536||c>1114111)continue;t[s++]=c}}return s}},oS="",dn=" ",pc=class aS{constructor(){this.fg=0,this.bg=0,this.extended=new _u}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new aS;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},_u=class lS{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new lS(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},xr=class cS extends pc{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new _u,this.combinedData=""}static fromCharData(e){let t=new cS;return t.setFromCharData(e),t}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?cn(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){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:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},K1="di$target",Qp="di$dependencies",Vd=new Map;function gz(i){return i[Qp]||[]}function di(i){if(Vd.has(i))return Vd.get(i);let e=function(t,r,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");vz(e,t,s)};return e._id=i,Vd.set(i,e),e}function vz(i,e,t){e[K1]===e?e[Qp].push({id:i,index:t}):(e[Qp]=[{id:i,index:t}],e[K1]=e)}var Ei=di("BufferService"),hS=di("CoreMouseService"),oo=di("CoreService"),Oz=di("CharsetService"),Qg=di("InstantiationService"),uS=di("LogService"),Di=di("OptionsService"),dS=di("OscLinkService"),_z=di("UnicodeService"),mc=di("DecorationService"),Ap=class{constructor(e,t,r){this._bufferService=e,this._optionsService=t,this._oscLinkService=r}provideLinks(e,t){let r=this._bufferService.buffer.lines.get(e-1);if(!r){t(void 0);return}let s=[],n=this._optionsService.rawOptions.linkHandler,o=new xr,a=r.getTrimmedLength(),l=-1,c=-1,h=!1;for(let u=0;u<a;u++)if(!(c===-1&&!r.hasContent(u))){if(r.loadCell(u,o),o.hasExtendedAttrs()&&o.extended.urlId)if(c===-1){c=u,l=o.extended.urlId;continue}else h=o.extended.urlId!==l;else c!==-1&&(h=!0);if(h||c!==-1&&u===a-1){let d=this._oscLinkService.getLinkData(l)?.uri;if(d){let f={start:{x:c+1,y:e},end:{x:u+(!h&&u===a-1?1:0),y:e}},p=!1;if(!n?.allowNonHttpProtocols)try{let g=new URL(d);["http:","https:"].includes(g.protocol)||(p=!0)}catch{p=!0}p||s.push({text:d,range:f,activate:(g,O)=>n?n.activate(g,O,f):bz(g,O),hover:(g,O)=>n?.hover?.(g,O,f),leave:(g,O)=>n?.leave?.(g,O,f)})}h=!1,o.hasExtendedAttrs()&&o.extended.urlId?(c=u,l=o.extended.urlId):(c=-1,l=-1)}}t(s)}};Ap=Lt([Qe(0,Ei),Qe(1,Di),Qe(2,dS)],Ap);function bz(i,e){if(confirm(`Do you want to navigate to ${e}?
67
+
68
+ WARNING: This link could potentially be dangerous`)){let t=window.open();if(t){try{t.opener=null}catch{}t.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}var Uu=di("CharSizeService"),Zs=di("CoreBrowserService"),Ag=di("MouseService"),Xs=di("RenderService"),yz=di("SelectionService"),fS=di("CharacterJoinerService"),la=di("ThemeService"),pS=di("LinkProviderService"),xz=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?J1.isErrorNoTelemetry(e)?new J1(e.message+`
69
+
70
+ `+e.stack):new Error(e.message+`
71
+
72
+ `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(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)}},wz=new xz;function Ch(i){Sz(i)||wz.onUnexpectedError(i)}var Rp="Canceled";function Sz(i){return i instanceof kz?!0:i instanceof Error&&i.name===Rp&&i.message===Rp}var kz=class extends Error{constructor(){super(Rp),this.name=this.message}};function Cz(i){return new Error(`Illegal argument: ${i}`)}var J1=class Bp extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof Bp)return e;let t=new Bp;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},Lp=class mS extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,mS.prototype)}};function Gi(i,e=0){return i[i.length-(1+e)]}var $z;(i=>{function e(n){return n<0}i.isLessThan=e;function t(n){return n<=0}i.isLessThanOrEqual=t;function r(n){return n>0}i.isGreaterThan=r;function s(n){return n===0}i.isNeitherLessOrGreaterThan=s,i.greaterThan=1,i.lessThan=-1,i.neitherLessOrGreaterThan=0})($z||={});function Pz(i,e){let t=this,r=!1,s;return function(){return r||(r=!0,e||(s=i.apply(t,arguments))),s}}var gS;(i=>{function e(w){return w&&typeof w=="object"&&typeof w[Symbol.iterator]=="function"}i.is=e;let t=Object.freeze([]);function r(){return t}i.empty=r;function*s(w){yield w}i.single=s;function n(w){return e(w)?w:s(w)}i.wrap=n;function o(w){return w||t}i.from=o;function*a(w){for(let C=w.length-1;C>=0;C--)yield w[C]}i.reverse=a;function l(w){return!w||w[Symbol.iterator]().next().done===!0}i.isEmpty=l;function c(w){return w[Symbol.iterator]().next().value}i.first=c;function h(w,C){let M=0;for(let D of w)if(C(D,M++))return!0;return!1}i.some=h;function u(w,C){for(let M of w)if(C(M))return M}i.find=u;function*d(w,C){for(let M of w)C(M)&&(yield M)}i.filter=d;function*f(w,C){let M=0;for(let D of w)yield C(D,M++)}i.map=f;function*p(w,C){let M=0;for(let D of w)yield*C(D,M++)}i.flatMap=p;function*g(...w){for(let C of w)yield*C}i.concat=g;function O(w,C,M){let D=M;for(let j of w)D=C(D,j);return D}i.reduce=O;function*_(w,C,M=w.length){for(C<0&&(C+=w.length),M<0?M+=w.length:M>w.length&&(M=w.length);C<M;C++)yield w[C]}i.slice=_;function k(w,C=Number.POSITIVE_INFINITY){let M=[];if(C===0)return[M,w];let D=w[Symbol.iterator]();for(let j=0;j<C;j++){let oe=D.next();if(oe.done)return[M,i.empty()];M.push(oe.value)}return[M,{[Symbol.iterator](){return D}}]}i.consume=k;async function P(w){let C=[];for await(let M of w)C.push(M);return Promise.resolve(C)}i.asyncToArray=P})(gS||={});function so(i){if(gS.is(i)){let e=[];for(let t of i)if(t)try{t.dispose()}catch(r){e.push(r)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(i)?[]:i}else if(i)return i.dispose(),i}function Tz(...i){return Pt(()=>so(i))}function Pt(i){return{dispose:Pz(()=>{i()})}}var vS=class OS{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{so(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?OS.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};vS.DISABLE_DISPOSED_WARNING=!1;var mn=vS,tt=class{constructor(){this._store=new mn,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};tt.None=Object.freeze({dispose(){}});var ia=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},As=typeof window=="object"?window:globalThis,Ep=class Dp{constructor(e){this.element=e,this.next=Dp.Undefined,this.prev=Dp.Undefined}};Ep.Undefined=new Ep(void 0);var Tt=Ep,eO=class{constructor(){this._first=Tt.Undefined,this._last=Tt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Tt.Undefined}clear(){let e=this._first;for(;e!==Tt.Undefined;){let t=e.next;e.prev=Tt.Undefined,e.next=Tt.Undefined,e=t}this._first=Tt.Undefined,this._last=Tt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new Tt(e);if(this._first===Tt.Undefined)this._first=r,this._last=r;else if(t){let n=this._last;this._last=r,r.prev=n,n.next=r}else{let n=this._first;this._first=r,r.next=n,n.prev=r}this._size+=1;let s=!1;return()=>{s||(s=!0,this._remove(r))}}shift(){if(this._first!==Tt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Tt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Tt.Undefined&&e.next!==Tt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Tt.Undefined&&e.next===Tt.Undefined?(this._first=Tt.Undefined,this._last=Tt.Undefined):e.next===Tt.Undefined?(this._last=this._last.prev,this._last.next=Tt.Undefined):e.prev===Tt.Undefined&&(this._first=this._first.next,this._first.prev=Tt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Tt.Undefined;)yield e.element,e=e.next}},Mz=globalThis.performance&&typeof globalThis.performance.now=="function",Qz=class _S{static create(e){return new _S(e)}constructor(e){this._now=Mz&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Oi;(i=>{i.None=()=>tt.None;function e(x,b){return u(x,()=>{},0,void 0,!0,void 0,b)}i.defer=e;function t(x){return(b,T=null,$)=>{let R=!1,E;return E=x(Z=>{if(!R)return E?E.dispose():R=!0,b.call(T,Z)},null,$),R&&E.dispose(),E}}i.once=t;function r(x,b,T){return c(($,R=null,E)=>x(Z=>$.call(R,b(Z)),null,E),T)}i.map=r;function s(x,b,T){return c(($,R=null,E)=>x(Z=>{b(Z),$.call(R,Z)},null,E),T)}i.forEach=s;function n(x,b,T){return c(($,R=null,E)=>x(Z=>b(Z)&&$.call(R,Z),null,E),T)}i.filter=n;function o(x){return x}i.signal=o;function a(...x){return(b,T=null,$)=>{let R=Tz(...x.map(E=>E(Z=>b.call(T,Z))));return h(R,$)}}i.any=a;function l(x,b,T,$){let R=T;return r(x,E=>(R=b(R,E),R),$)}i.reduce=l;function c(x,b){let T,$={onWillAddFirstListener(){T=x(R.fire,R)},onDidRemoveLastListener(){T?.dispose()}},R=new we($);return b?.add(R),R.event}function h(x,b){return b instanceof Array?b.push(x):b&&b.add(x),x}function u(x,b,T=100,$=!1,R=!1,E,Z){let K,X,V,ie=0,q,ee={leakWarningThreshold:E,onWillAddFirstListener(){K=x(Oe=>{ie++,X=b(X,Oe),$&&!V&&(te.fire(X),X=void 0),q=()=>{let Te=X;X=void 0,V=void 0,(!$||ie>1)&&te.fire(Te),ie=0},typeof T=="number"?(clearTimeout(V),V=setTimeout(q,T)):V===void 0&&(V=0,queueMicrotask(q))})},onWillRemoveListener(){R&&ie>0&&q?.()},onDidRemoveLastListener(){q=void 0,K.dispose()}},te=new we(ee);return Z?.add(te),te.event}i.debounce=u;function d(x,b=0,T){return i.debounce(x,($,R)=>$?($.push(R),$):[R],b,void 0,!0,void 0,T)}i.accumulate=d;function f(x,b=($,R)=>$===R,T){let $=!0,R;return n(x,E=>{let Z=$||!b(E,R);return $=!1,R=E,Z},T)}i.latch=f;function p(x,b,T){return[i.filter(x,b,T),i.filter(x,$=>!b($),T)]}i.split=p;function g(x,b=!1,T=[],$){let R=T.slice(),E=x(X=>{R?R.push(X):K.fire(X)});$&&$.add(E);let Z=()=>{R?.forEach(X=>K.fire(X)),R=null},K=new we({onWillAddFirstListener(){E||(E=x(X=>K.fire(X)),$&&$.add(E))},onDidAddFirstListener(){R&&(b?setTimeout(Z):Z())},onDidRemoveLastListener(){E&&E.dispose(),E=null}});return $&&$.add(K),K.event}i.buffer=g;function O(x,b){return(T,$,R)=>{let E=b(new k);return x(function(Z){let K=E.evaluate(Z);K!==_&&T.call($,K)},void 0,R)}}i.chain=O;let _=Symbol("HaltChainable");class k{constructor(){this.steps=[]}map(b){return this.steps.push(b),this}forEach(b){return this.steps.push(T=>(b(T),T)),this}filter(b){return this.steps.push(T=>b(T)?T:_),this}reduce(b,T){let $=T;return this.steps.push(R=>($=b($,R),$)),this}latch(b=(T,$)=>T===$){let T=!0,$;return this.steps.push(R=>{let E=T||!b(R,$);return T=!1,$=R,E?R:_}),this}evaluate(b){for(let T of this.steps)if(b=T(b),b===_)break;return b}}function P(x,b,T=$=>$){let $=(...K)=>Z.fire(T(...K)),R=()=>x.on(b,$),E=()=>x.removeListener(b,$),Z=new we({onWillAddFirstListener:R,onDidRemoveLastListener:E});return Z.event}i.fromNodeEventEmitter=P;function w(x,b,T=$=>$){let $=(...K)=>Z.fire(T(...K)),R=()=>x.addEventListener(b,$),E=()=>x.removeEventListener(b,$),Z=new we({onWillAddFirstListener:R,onDidRemoveLastListener:E});return Z.event}i.fromDOMEventEmitter=w;function C(x){return new Promise(b=>t(x)(b))}i.toPromise=C;function M(x){let b=new we;return x.then(T=>{b.fire(T)},()=>{b.fire(void 0)}).finally(()=>{b.dispose()}),b.event}i.fromPromise=M;function D(x,b){return x(T=>b.fire(T))}i.forward=D;function j(x,b,T){return b(T),x($=>b($))}i.runAndSubscribe=j;class oe{constructor(b,T){this._observable=b,this._counter=0,this._hasChanged=!1;let $={onWillAddFirstListener:()=>{b.addObserver(this)},onDidRemoveLastListener:()=>{b.removeObserver(this)}};this.emitter=new we($),T&&T.add(this.emitter)}beginUpdate(b){this._counter++}handlePossibleChange(b){}handleChange(b,T){this._hasChanged=!0}endUpdate(b){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function ae(x,b){return new oe(x,b).emitter.event}i.fromObservable=ae;function G(x){return(b,T,$)=>{let R=0,E=!1,Z={beginUpdate(){R++},endUpdate(){R--,R===0&&(x.reportChanges(),E&&(E=!1,b.call(T)))},handlePossibleChange(){},handleChange(){E=!0}};x.addObserver(Z),x.reportChanges();let K={dispose(){x.removeObserver(Z)}};return $ instanceof mn?$.add(K):Array.isArray($)&&$.push(K),K}}i.fromObservableLight=G})(Oi||={});var Ip=class zp{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${zp._idPool++}`,zp.all.add(this)}start(e){this._stopWatch=new Qz,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}}};Ip.all=new Set,Ip._idPool=0;var Az=Ip,Rz=-1,bS=class yS{constructor(e,t,r=(yS._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=t,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let r=this.threshold;if(r<=0||t<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=r*.5;let[n,o]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${o}):`;console.warn(a),console.warn(n);let l=new Ez(a,n);this._errorHandler(l)}return()=>{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[r,s]of this._stacks)(!e||t<s)&&(e=[r,s],t=s);return e}};bS._idPool=1;var Bz=bS,Lz=class xS{constructor(e){this.value=e}static create(){let e=new Error;return new xS(e.stack??"")}print(){console.warn(this.value.split(`
73
+ `).slice(2).join(`
74
+ `))}},Ez=class extends Error{constructor(i,e){super(i),this.name="ListenerLeakError",this.stack=e}},Dz=class extends Error{constructor(i,e){super(i),this.name="ListenerRefusalError",this.stack=e}},Iz=0,qd=class{constructor(e){this.value=e,this.id=Iz++}},zz=2,Nz,we=class{constructor(i){this._size=0,this._options=i,this._leakageMon=this._options?.leakWarningThreshold?new Bz(i?.onListenerError??Ch,this._options?.leakWarningThreshold??Rz):void 0,this._perfMon=this._options?._profName?new Az(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??=(i,e,t)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let o=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(o);let a=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],l=new Dz(`${o}. HINT: Stack shows most frequent listener (${a[1]}-times)`,a[0]);return(this._options?.onListenerError||Ch)(l),tt.None}if(this._disposed)return tt.None;e&&(i=i.bind(e));let r=new qd(i),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Lz.create(),s=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof qd?(this._deliveryQueue??=new Wz,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let n=Pt(()=>{s?.(),this._removeListener(r)});return t instanceof mn?t.add(n):Array.isArray(t)&&t.push(n),n},this._event}_removeListener(i){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let e=this._listeners,t=e.indexOf(i);if(t===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,e[t]=void 0;let r=this._deliveryQueue.current===this;if(this._size*zz<=e.length){let s=0;for(let n=0;n<e.length;n++)e[n]?e[s++]=e[n]:r&&(this._deliveryQueue.end--,s<this._deliveryQueue.i&&this._deliveryQueue.i--);e.length=s}}_deliver(i,e){if(!i)return;let t=this._options?.onListenerError||Ch;if(!t){i.value(e);return}try{i.value(e)}catch(r){t(r)}}_deliverQueue(i){let e=i.current._listeners;for(;i.i<i.end;)this._deliver(e[i.i++],i.value);i.reset()}fire(i){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof qd)this._deliver(this._listeners,i);else{let e=this._deliveryQueue;e.enqueue(this,i,this._listeners.length),this._deliverQueue(e)}this._perfMon?.stop()}hasListeners(){return this._size>0}},Wz=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Np=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new we,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new we,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let r=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(r,e),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let r=this.getWindowId(t);this.mapWindowIdToFullScreen.set(r,e),this._onDidChangeFullscreen.fire(r)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Np.INSTANCE=new Np;var Rg=Np;function Zz(i,e,t){typeof e=="string"&&(e=i.matchMedia(e)),e.addEventListener("change",t)}Rg.INSTANCE.onDidChangeZoomLevel;function Xz(i){return Rg.INSTANCE.getZoomFactor(i)}Rg.INSTANCE.onDidChangeFullscreen;var ca=typeof navigator=="object"?navigator.userAgent:"",Wp=ca.indexOf("Firefox")>=0,Fz=ca.indexOf("AppleWebKit")>=0,Bg=ca.indexOf("Chrome")>=0,Vz=!Bg&&ca.indexOf("Safari")>=0;ca.indexOf("Electron/")>=0;ca.indexOf("Android")>=0;var Hd=!1;if(typeof As.matchMedia=="function"){let i=As.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=As.matchMedia("(display-mode: fullscreen)");Hd=i.matches,Zz(As,i,({matches:t})=>{Hd&&e.matches||(Hd=t)})}var Qo="en",Zp=!1,Xp=!1,$h=!1,wS=!1,th,Ph=Qo,tO=Qo,qz,$s,Yn=globalThis,Ji;typeof Yn.vscode<"u"&&typeof Yn.vscode.process<"u"?Ji=Yn.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Ji=process);var Hz=typeof Ji?.versions?.electron=="string",Uz=Hz&&Ji?.type==="renderer";if(typeof Ji=="object"){Zp=Ji.platform==="win32",Xp=Ji.platform==="darwin",$h=Ji.platform==="linux",$h&&Ji.env.SNAP&&Ji.env.SNAP_REVISION,Ji.env.CI||Ji.env.BUILD_ARTIFACTSTAGINGDIRECTORY,th=Qo,Ph=Qo;let i=Ji.env.VSCODE_NLS_CONFIG;if(i)try{let e=JSON.parse(i);th=e.userLocale,tO=e.osLocale,Ph=e.resolvedLanguage||Qo,qz=e.languagePack?.translationsConfigFile}catch{}wS=!0}else typeof navigator=="object"&&!Uz?($s=navigator.userAgent,Zp=$s.indexOf("Windows")>=0,Xp=$s.indexOf("Macintosh")>=0,($s.indexOf("Macintosh")>=0||$s.indexOf("iPad")>=0||$s.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,$h=$s.indexOf("Linux")>=0,$s?.indexOf("Mobi")>=0,Ph=globalThis._VSCODE_NLS_LANGUAGE||Qo,th=navigator.language.toLowerCase(),tO=th):console.error("Unable to resolve platform.");var SS=Zp,cs=Xp,Yz=$h,iO=wS,us=$s,Ks=Ph,jz;(i=>{function e(){return Ks}i.value=e;function t(){return Ks.length===2?Ks==="en":Ks.length>=3?Ks[0]==="e"&&Ks[1]==="n"&&Ks[2]==="-":!1}i.isDefaultVariant=t;function r(){return Ks==="en"}i.isDefault=r})(jz||={});var Gz=typeof Yn.postMessage=="function"&&!Yn.importScripts;(()=>{if(Gz){let i=[];Yn.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let r=0,s=i.length;r<s;r++){let n=i[r];if(n.id===t.data.vscodeScheduleAsyncWork){i.splice(r,1),n.callback();return}}});let e=0;return t=>{let r=++e;i.push({id:r,callback:t}),Yn.postMessage({vscodeScheduleAsyncWork:r},"*")}}return i=>setTimeout(i)})();var Kz=!!(us&&us.indexOf("Chrome")>=0);us&&us.indexOf("Firefox")>=0;!Kz&&us&&us.indexOf("Safari")>=0;us&&us.indexOf("Edg/")>=0;us&&us.indexOf("Android")>=0;var _o=typeof navigator=="object"?navigator:{};iO||document.queryCommandSupported&&document.queryCommandSupported("copy")||_o&&_o.clipboard&&_o.clipboard.writeText,iO||_o&&_o.clipboard&&_o.clipboard.readText;var Lg=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Ud=new Lg,rO=new Lg,sO=new Lg,Jz=new Array(230),kS;(i=>{function e(a){return Ud.keyCodeToStr(a)}i.toString=e;function t(a){return Ud.strToKeyCode(a)}i.fromString=t;function r(a){return rO.keyCodeToStr(a)}i.toUserSettingsUS=r;function s(a){return sO.keyCodeToStr(a)}i.toUserSettingsGeneral=s;function n(a){return rO.strToKeyCode(a)||sO.strToKeyCode(a)}i.fromUserSettings=n;function o(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Ud.keyCodeToStr(a)}i.toElectronAccelerator=o})(kS||={});var eN=class CS{constructor(e,t,r,s,n){this.ctrlKey=e,this.shiftKey=t,this.altKey=r,this.metaKey=s,this.keyCode=n}equals(e){return e instanceof CS&&this.ctrlKey===e.ctrlKey&&this.shiftKey===e.shiftKey&&this.altKey===e.altKey&&this.metaKey===e.metaKey&&this.keyCode===e.keyCode}getHashCode(){let e=this.ctrlKey?"1":"0",t=this.shiftKey?"1":"0",r=this.altKey?"1":"0",s=this.metaKey?"1":"0";return`K${e}${t}${r}${s}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new tN([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},tN=class{constructor(i){if(i.length===0)throw Cz("chords");this.chords=i}getHashCode(){let i="";for(let e=0,t=this.chords.length;e<t;e++)e!==0&&(i+=";"),i+=this.chords[e].getHashCode();return i}equals(i){if(i===null||this.chords.length!==i.chords.length)return!1;for(let e=0;e<this.chords.length;e++)if(!this.chords[e].equals(i.chords[e]))return!1;return!0}};function iN(i){if(i.charCode){let t=String.fromCharCode(i.charCode).toUpperCase();return kS.fromString(t)}let e=i.keyCode;if(e===3)return 7;if(Wp)switch(e){case 59:return 85;case 60:if(Yz)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(cs)return 57;break}else if(Fz&&(cs&&e===93||!cs&&e===92))return 57;return Jz[e]||0}var rN=cs?256:2048,sN=512,nN=1024,oN=cs?2048:256,nO=class{constructor(i){this._standardKeyboardEventBrand=!0;let e=i;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=iN(e),this.code=e.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(i){return this._asKeybinding===i}_computeKeybinding(){let i=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(i=this.keyCode);let e=0;return this.ctrlKey&&(e|=rN),this.altKey&&(e|=sN),this.shiftKey&&(e|=nN),this.metaKey&&(e|=oN),e|=i,e}_computeKeyCodeChord(){let i=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(i=this.keyCode),new eN(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,i)}},oO=new WeakMap;function aN(i){if(!i.parent||i.parent===i)return null;try{let e=i.location,t=i.parent.location;if(e.origin!=="null"&&t.origin!=="null"&&e.origin!==t.origin)return null}catch{return null}return i.parent}var lN=class{static getSameOriginWindowChain(i){let e=oO.get(i);if(!e){e=[],oO.set(i,e);let t=i,r;do r=aN(t),r?e.push({window:new WeakRef(t),iframeElement:t.frameElement||null}):e.push({window:new WeakRef(t),iframeElement:null}),t=r;while(t)}return e.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(i,e){if(!e||i===e)return{top:0,left:0};let t=0,r=0,s=this.getSameOriginWindowChain(i);for(let n of s){let o=n.window.deref();if(t+=o?.scrollY??0,r+=o?.scrollX??0,o===e||!n.iframeElement)break;let a=n.iframeElement.getBoundingClientRect();t+=a.top,r+=a.left}return{top:t,left:r}}},ih=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let r=lN.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},aO=class{constructor(e,t=0,r=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=r,this.deltaX=t;let s=!1;if(Bg){let n=navigator.userAgent.match(/Chrome\/(\d+)/);s=(n?parseInt(n[1]):123)<=122}if(e){let n=e,o=e,a=e.view?.devicePixelRatio||1;if(typeof n.wheelDeltaY<"u")s?this.deltaY=n.wheelDeltaY/(120*a):this.deltaY=n.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(e.type==="wheel"){let l=e;l.deltaMode===l.DOM_DELTA_LINE?Wp&&!cs?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof n.wheelDeltaX<"u")Vz&&SS?this.deltaX=-(n.wheelDeltaX/120):s?this.deltaX=n.wheelDeltaX/(120*a):this.deltaX=n.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let l=e;l.deltaMode===l.DOM_DELTA_LINE?Wp&&!cs?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(s?this.deltaY=e.wheelDelta/(120*a):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},$S=Object.freeze(function(i,e){let t=setTimeout(i.bind(e),0);return{dispose(){clearTimeout(t)}}}),cN;(i=>{function e(t){return t===i.None||t===i.Cancelled||t instanceof hN?!0:!t||typeof t!="object"?!1:typeof t.isCancellationRequested=="boolean"&&typeof t.onCancellationRequested=="function"}i.isCancellationToken=e,i.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Oi.None}),i.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:$S})})(cN||={});var hN=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?$S:(this._emitter||(this._emitter=new we),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Eg=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Lp("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Lp("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},uN=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,r=globalThis){if(this.isDisposed)throw new Lp("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let s=r.setInterval(()=>{e()},t);this.disposable=Pt(()=>{r.clearInterval(s),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},dN;(i=>{async function e(r){let s,n=await Promise.all(r.map(o=>o.then(a=>a,a=>{s||(s=a)})));if(typeof s<"u")throw s;return n}i.settled=e;function t(r){return new Promise(async(s,n)=>{try{await r(s,n)}catch(o){n(o)}})}i.withAsyncBody=t})(dN||={});var lO=class ur{static fromArray(e){return new ur(t=>{t.emitMany(e)})}static fromPromise(e){return new ur(async t=>{t.emitMany(await e)})}static fromPromises(e){return new ur(async t=>{await Promise.all(e.map(async r=>t.emitOne(await r)))})}static merge(e){return new ur(async t=>{await Promise.all(e.map(async r=>{for await(let s of r)t.emitOne(s)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new we,queueMicrotask(async()=>{let r={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(e(r)),this.resolve()}catch(s){this.reject(s)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await Oi.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(e,t){return new ur(async r=>{for await(let s of e)r.emitOne(t(s))})}map(e){return ur.map(this,e)}static filter(e,t){return new ur(async r=>{for await(let s of e)t(s)&&r.emitOne(s)})}filter(e){return ur.filter(this,e)}static coalesce(e){return ur.filter(e,t=>!!t)}coalesce(){return ur.coalesce(this)}static async toPromise(e){let t=[];for await(let r of e)t.push(r);return t}toPromise(){return ur.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};lO.EMPTY=lO.fromArray([]);var{getWindow:ns,getWindowId:fN,onDidRegisterWindow:pN}=(function(){let i=new Map,e={window:As,disposables:new mn};i.set(As.vscodeWindowId,e);let t=new we,r=new we,s=new we;function n(o,a){return(typeof o=="number"?i.get(o):void 0)??(a?e:void 0)}return{onDidRegisterWindow:t.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:r.event,registerWindow(o){if(i.has(o.vscodeWindowId))return tt.None;let a=new mn,l={window:o,disposables:a.add(new mn)};return i.set(o.vscodeWindowId,l),a.add(Pt(()=>{i.delete(o.vscodeWindowId),r.fire(o)})),a.add(qe(o,ti.BEFORE_UNLOAD,()=>{s.fire(o)})),t.fire(l),a},getWindows(){return i.values()},getWindowsCount(){return i.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return i.has(o)},getWindowById:n,getWindow(o){let a=o;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;let l=o;return l?.view?l.view.window:As},getDocument(o){return ns(o).document}}})(),mN=class{constructor(e,t,r,s){this._node=e,this._type=t,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 qe(i,e,t,r){return new mN(i,e,t,r)}var cO=function(i,e,t,r){return qe(i,e,t,r)},Dg,gN=class extends uN{constructor(i){super(),this.defaultTarget=i&&ns(i)}cancelAndSet(i,e,t){return super.cancelAndSet(i,e,t??this.defaultTarget)}},hO=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Ch(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let i=new Map,e=new Map,t=new Map,r=new Map,s=n=>{t.set(n,!1);let o=i.get(n)??[];for(e.set(n,o),i.set(n,[]),r.set(n,!0);o.length>0;)o.sort(hO.sort),o.shift().execute();r.set(n,!1)};Dg=(n,o,a=0)=>{let l=fN(n),c=new hO(o,a),h=i.get(l);return h||(h=[],i.set(l,h)),h.push(c),t.get(l)||(t.set(l,!0),n.requestAnimationFrame(()=>s(l))),c}})();function vN(i){let e=i.getBoundingClientRect(),t=ns(i);return{left:e.left+t.scrollX,top:e.top+t.scrollY,width:e.width,height:e.height}}var ti={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"},ON=class{constructor(i){this.domNode=i,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(i){let e=zi(i);this._maxWidth!==e&&(this._maxWidth=e,this.domNode.style.maxWidth=this._maxWidth)}setWidth(i){let e=zi(i);this._width!==e&&(this._width=e,this.domNode.style.width=this._width)}setHeight(i){let e=zi(i);this._height!==e&&(this._height=e,this.domNode.style.height=this._height)}setTop(i){let e=zi(i);this._top!==e&&(this._top=e,this.domNode.style.top=this._top)}setLeft(i){let e=zi(i);this._left!==e&&(this._left=e,this.domNode.style.left=this._left)}setBottom(i){let e=zi(i);this._bottom!==e&&(this._bottom=e,this.domNode.style.bottom=this._bottom)}setRight(i){let e=zi(i);this._right!==e&&(this._right=e,this.domNode.style.right=this._right)}setPaddingTop(i){let e=zi(i);this._paddingTop!==e&&(this._paddingTop=e,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(i){let e=zi(i);this._paddingLeft!==e&&(this._paddingLeft=e,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(i){let e=zi(i);this._paddingBottom!==e&&(this._paddingBottom=e,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(i){let e=zi(i);this._paddingRight!==e&&(this._paddingRight=e,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(i){this._fontFamily!==i&&(this._fontFamily=i,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(i){this._fontWeight!==i&&(this._fontWeight=i,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(i){let e=zi(i);this._fontSize!==e&&(this._fontSize=e,this.domNode.style.fontSize=this._fontSize)}setFontStyle(i){this._fontStyle!==i&&(this._fontStyle=i,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(i){this._fontFeatureSettings!==i&&(this._fontFeatureSettings=i,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(i){this._fontVariationSettings!==i&&(this._fontVariationSettings=i,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(i){this._textDecoration!==i&&(this._textDecoration=i,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(i){let e=zi(i);this._lineHeight!==e&&(this._lineHeight=e,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(i){let e=zi(i);this._letterSpacing!==e&&(this._letterSpacing=e,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(i){this._className!==i&&(this._className=i,this.domNode.className=this._className)}toggleClassName(i,e){this.domNode.classList.toggle(i,e),this._className=this.domNode.className}setDisplay(i){this._display!==i&&(this._display=i,this.domNode.style.display=this._display)}setPosition(i){this._position!==i&&(this._position=i,this.domNode.style.position=this._position)}setVisibility(i){this._visibility!==i&&(this._visibility=i,this.domNode.style.visibility=this._visibility)}setColor(i){this._color!==i&&(this._color=i,this.domNode.style.color=this._color)}setBackgroundColor(i){this._backgroundColor!==i&&(this._backgroundColor=i,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(i){this._layerHint!==i&&(this._layerHint=i,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(i){this._boxShadow!==i&&(this._boxShadow=i,this.domNode.style.boxShadow=i)}setContain(i){this._contain!==i&&(this._contain=i,this.domNode.style.contain=this._contain)}setAttribute(i,e){this.domNode.setAttribute(i,e)}removeAttribute(i){this.domNode.removeAttribute(i)}appendChild(i){this.domNode.appendChild(i.domNode)}removeChild(i){this.domNode.removeChild(i.domNode)}};function zi(i){return typeof i=="number"?`${i}px`:i}function yl(i){return new ON(i)}var PS=class{constructor(){this._hooks=new mn,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let r=this._onStopCallback;this._onStopCallback=null,e&&r&&r(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,r,s,n){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=s,this._onStopCallback=n;let o=e;try{e.setPointerCapture(t),this._hooks.add(Pt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=ns(e)}this._hooks.add(qe(o,ti.POINTER_MOVE,a=>{if(a.buttons!==r){this.stopMonitoring(!0);return}a.preventDefault(),this._pointerMoveCallback(a)})),this._hooks.add(qe(o,ti.POINTER_UP,a=>this.stopMonitoring(!0)))}};function _N(i,e,t){let r=null,s=null;if(typeof t.value=="function"?(r="value",s=t.value,s.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof t.get=="function"&&(r="get",s=t.get),!s)throw new Error("not supported");let n=`$memoize$${e}`;t[r]=function(...o){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,o)}),this[n]}}var Gr;(i=>(i.Tap="-xterm-gesturetap",i.Change="-xterm-gesturechange",i.Start="-xterm-gesturestart",i.End="-xterm-gesturesend",i.Contextmenu="-xterm-gesturecontextmenu"))(Gr||={});var nl=class Si extends tt{constructor(){super(),this.dispatched=!1,this.targets=new eO,this.ignoreTargets=new eO,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Oi.runAndSubscribe(pN,({window:e,disposables:t})=>{t.add(qe(e.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),t.add(qe(e.document,"touchend",r=>this.onTouchEnd(e,r))),t.add(qe(e.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:As,disposables:this._store}))}static addTarget(e){if(!Si.isTouchDevice())return tt.None;Si.INSTANCE||(Si.INSTANCE=new Si);let t=Si.INSTANCE.targets.push(e);return Pt(t)}static ignoreTarget(e){if(!Si.isTouchDevice())return tt.None;Si.INSTANCE||(Si.INSTANCE=new Si);let t=Si.INSTANCE.ignoreTargets.push(e);return Pt(t)}static isTouchDevice(){return"ontouchstart"in As||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,s=e.targetTouches.length;r<s;r++){let n=e.targetTouches.item(r);this.activeTouches[n.identifier]={id:n.identifier,initialTarget:n.target,initialTimeStamp:t,initialPageX:n.pageX,initialPageY:n.pageY,rollingTimestamps:[t],rollingPageX:[n.pageX],rollingPageY:[n.pageY]};let o=this.newGestureEvent(Gr.Start,n.target);o.pageX=n.pageX,o.pageY=n.pageY,this.dispatchEvent(o)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}onTouchEnd(e,t){let r=Date.now(),s=Object.keys(this.activeTouches).length;for(let n=0,o=t.changedTouches.length;n<o;n++){let a=t.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("move of an UNKNOWN touch",a);continue}let l=this.activeTouches[a.identifier],c=Date.now()-l.initialTimeStamp;if(c<Si.HOLD_DELAY&&Math.abs(l.initialPageX-Gi(l.rollingPageX))<30&&Math.abs(l.initialPageY-Gi(l.rollingPageY))<30){let h=this.newGestureEvent(Gr.Tap,l.initialTarget);h.pageX=Gi(l.rollingPageX),h.pageY=Gi(l.rollingPageY),this.dispatchEvent(h)}else if(c>=Si.HOLD_DELAY&&Math.abs(l.initialPageX-Gi(l.rollingPageX))<30&&Math.abs(l.initialPageY-Gi(l.rollingPageY))<30){let h=this.newGestureEvent(Gr.Contextmenu,l.initialTarget);h.pageX=Gi(l.rollingPageX),h.pageY=Gi(l.rollingPageY),this.dispatchEvent(h)}else if(s===1){let h=Gi(l.rollingPageX),u=Gi(l.rollingPageY),d=Gi(l.rollingTimestamps)-l.rollingTimestamps[0],f=h-l.rollingPageX[0],p=u-l.rollingPageY[0],g=[...this.targets].filter(O=>l.initialTarget instanceof Node&&O.contains(l.initialTarget));this.inertia(e,g,r,Math.abs(f)/d,f>0?1:-1,h,Math.abs(p)/d,p>0?1:-1,u)}this.dispatchEvent(this.newGestureEvent(Gr.End,l.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,t){let r=document.createEvent("CustomEvent");return r.initEvent(e,!1,!0),r.initialTarget=t,r.tapCount=0,r}dispatchEvent(e){if(e.type===Gr.Tap){let t=new Date().getTime(),r=0;t-this._lastSetTapCountTime>Si.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=t,e.tapCount=r}else(e.type===Gr.Change||e.type===Gr.Contextmenu)&&(this._lastSetTapCountTime=0);if(e.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(e.initialTarget))return;let t=[];for(let r of this.targets)if(r.contains(e.initialTarget)){let s=0,n=e.initialTarget;for(;n&&n!==r;)s++,n=n.parentElement;t.push([s,r])}t.sort((r,s)=>r[0]-s[0]);for(let[r,s]of t)s.dispatchEvent(e),this.dispatched=!0}}inertia(e,t,r,s,n,o,a,l,c){this.handle=Dg(e,()=>{let h=Date.now(),u=h-r,d=0,f=0,p=!0;s+=Si.SCROLL_FRICTION*u,a+=Si.SCROLL_FRICTION*u,s>0&&(p=!1,d=n*s*u),a>0&&(p=!1,f=l*a*u);let g=this.newGestureEvent(Gr.Change);g.translationX=d,g.translationY=f,t.forEach(O=>O.dispatchEvent(g)),p||this.inertia(e,t,h,s,n,o+d,a,l,c+f)})}onTouchMove(e){let t=Date.now();for(let r=0,s=e.changedTouches.length;r<s;r++){let n=e.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(n.identifier))){console.warn("end of an UNKNOWN touch",n);continue}let o=this.activeTouches[n.identifier],a=this.newGestureEvent(Gr.Change,o.initialTarget);a.translationX=n.pageX-Gi(o.rollingPageX),a.translationY=n.pageY-Gi(o.rollingPageY),a.pageX=n.pageX,a.pageY=n.pageY,this.dispatchEvent(a),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(n.pageX),o.rollingPageY.push(n.pageY),o.rollingTimestamps.push(t)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};nl.SCROLL_FRICTION=-.005,nl.HOLD_DELAY=700,nl.CLEAR_TAP_COUNT_TIME=400,Lt([_N],nl,"isTouchDevice",1);var bN=nl,Ig=class extends tt{onclick(e,t){this._register(qe(e,ti.CLICK,r=>t(new ih(ns(e),r))))}onmousedown(e,t){this._register(qe(e,ti.MOUSE_DOWN,r=>t(new ih(ns(e),r))))}onmouseover(e,t){this._register(qe(e,ti.MOUSE_OVER,r=>t(new ih(ns(e),r))))}onmouseleave(e,t){this._register(qe(e,ti.MOUSE_LEAVE,r=>t(new ih(ns(e),r))))}onkeydown(e,t){this._register(qe(e,ti.KEY_DOWN,r=>t(new nO(r))))}onkeyup(e,t){this._register(qe(e,ti.KEY_UP,r=>t(new nO(r))))}oninput(e,t){this._register(qe(e,ti.INPUT,t))}onblur(e,t){this._register(qe(e,ti.BLUR,t))}onfocus(e,t){this._register(qe(e,ti.FOCUS,t))}onchange(e,t){this._register(qe(e,ti.CHANGE,t))}ignoreGesture(e){return bN.ignoreTarget(e)}},uO=11,yN=class extends Ig{constructor(i){super(),this._onActivate=i.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=i.bgWidth+"px",this.bgDomNode.style.height=i.bgHeight+"px",typeof i.top<"u"&&(this.bgDomNode.style.top="0px"),typeof i.left<"u"&&(this.bgDomNode.style.left="0px"),typeof i.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof i.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=i.className,this.domNode.style.position="absolute",this.domNode.style.width=uO+"px",this.domNode.style.height=uO+"px",typeof i.top<"u"&&(this.domNode.style.top=i.top+"px"),typeof i.left<"u"&&(this.domNode.style.left=i.left+"px"),typeof i.bottom<"u"&&(this.domNode.style.bottom=i.bottom+"px"),typeof i.right<"u"&&(this.domNode.style.right=i.right+"px"),this._pointerMoveMonitor=this._register(new PS),this._register(cO(this.bgDomNode,ti.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(cO(this.domNode,ti.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new gN),this._pointerdownScheduleRepeatTimer=this._register(new Eg)}_arrowPointerDown(i){if(!i.target||!(i.target instanceof Element))return;let e=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,ns(i))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(e,200),this._pointerMoveMonitor.startMonitoring(i.target,i.pointerId,i.buttons,t=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),i.preventDefault()}},xN=class Fp{constructor(e,t,r,s,n,o,a){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t=t|0,r=r|0,s=s|0,n=n|0,o=o|0,a=a|0),this.rawScrollLeft=s,this.rawScrollTop=a,t<0&&(t=0),s+t>r&&(s=r-t),s<0&&(s=0),n<0&&(n=0),a+n>o&&(a=o-n),a<0&&(a=0),this.width=t,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(e,t){return new Fp(this._forceIntegerValues,typeof e.width<"u"?e.width:this.width,typeof e.scrollWidth<"u"?e.scrollWidth:this.scrollWidth,t?this.rawScrollLeft:this.scrollLeft,typeof e.height<"u"?e.height:this.height,typeof e.scrollHeight<"u"?e.scrollHeight:this.scrollHeight,t?this.rawScrollTop:this.scrollTop)}withScrollPosition(e){return new Fp(this._forceIntegerValues,this.width,this.scrollWidth,typeof e.scrollLeft<"u"?e.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof e.scrollTop<"u"?e.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){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:t,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}}},wN=class extends tt{constructor(i){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new we),this.onScroll=this._onScroll.event,this._smoothScrollDuration=i.smoothScrollDuration,this._scheduleAtNextAnimationFrame=i.scheduleAtNextAnimationFrame,this._state=new xN(i.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(i){this._smoothScrollDuration=i}validateScrollPosition(i){return this._state.withScrollPosition(i)}getScrollDimensions(){return this._state}setScrollDimensions(i,e){let t=this._state.withScrollDimensions(i,e);this._setState(t,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(i){let e=this._state.withScrollPosition(i);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(e,!1)}setScrollPositionSmooth(i,e){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(i);if(this._smoothScrolling){i={scrollLeft:typeof i.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:i.scrollLeft,scrollTop:typeof i.scrollTop>"u"?this._smoothScrolling.to.scrollTop:i.scrollTop};let t=this._state.withScrollPosition(i);if(this._smoothScrolling.to.scrollLeft===t.scrollLeft&&this._smoothScrolling.to.scrollTop===t.scrollTop)return;let r;e?r=new fO(this._smoothScrolling.from,t,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,t,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let t=this._state.withScrollPosition(i);this._smoothScrolling=fO.start(this._state,t,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 i=this._smoothScrolling.tick(),e=this._state.withScrollPosition(i);if(this._setState(e,!0),!!this._smoothScrolling){if(i.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(i,e){let t=this._state;t.equals(i)||(this._state=i,this._onScroll.fire(this._state.createScrollEvent(t,e)))}},dO=class{constructor(e,t,r){this.scrollLeft=e,this.scrollTop=t,this.isDone=r}};function Yd(i,e){let t=e-i;return function(r){return i+t*CN(r)}}function SN(i,e,t){return function(r){return r<t?i(r/t):e((r-t)/(1-t))}}var fO=class Vp{constructor(e,t,r,s){this.from=e,this.to=t,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,t,r){if(Math.abs(e-t)>2.5*r){let s,n;return e<t?(s=e+.75*r,n=t-.75*r):(s=e-.75*r,n=t+.75*r),SN(Yd(e,s),Yd(n,t),.33)}return Yd(e,t)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let t=(e-this.startTime)/this.duration;if(t<1){let r=this.scrollLeft(t),s=this.scrollTop(t);return new dO(r,s,!1)}return new dO(this.to.scrollLeft,this.to.scrollTop,!0)}combine(e,t,r){return Vp.start(e,t,r)}static start(e,t,r){r=r+10;let s=Date.now()-10;return new Vp(e,t,s,r)}};function kN(i){return Math.pow(i,3)}function CN(i){return 1-kN(1-i)}var $N=class extends tt{constructor(e,t,r){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=r,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Eg)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0: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(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},PN=140,TS=class extends Ig{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 $N(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new PS),this._shouldRender=!0,this.domNode=yl(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(qe(this.domNode.domNode,ti.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new yN(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,r,s){this.slider=yl(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof r=="number"&&this.slider.setWidth(r),typeof s=="number"&&this.slider.setHeight(s),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(qe(this.slider.domNode,ti.POINTER_DOWN,n=>{n.button===0&&(n.preventDefault(),this._sliderPointerDown(n))})),this.onclick(this.slider.domNode,n=>{n.leftButton&&n.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 t=this.domNode.domNode.getClientRects()[0].top,r=t+this._scrollbarState.getSliderPosition(),s=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),n=this._sliderPointerPosition(e);r<=n&&n<=s?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,r;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,r=e.offsetY;else{let n=vN(this.domNode.domNode);t=e.pageX-n.left,r=e.pageY-n.top}let s=this._pointerDownRelativePosition(t,r);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(s):this._scrollbarState.getDesiredScrollPositionFromOffset(s)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=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,n=>{let o=this._sliderOrthogonalPointerPosition(n),a=Math.abs(o-r);if(SS&&a>PN){this._setDesiredScrollPositionNow(s.getScrollPosition());return}let l=this._sliderPointerPosition(n)-t;this._setDesiredScrollPositionNow(s.getDesiredScrollPositionFromDelta(l))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},MS=class qp{constructor(e,t,r,s,n,o){this._scrollbarSize=Math.round(t),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 qp(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize!==t?(this._visibleSize=t,this._refreshComputedValues(),!0):!1}setScrollSize(e){let t=Math.round(e);return this._scrollSize!==t?(this._scrollSize=t,this._refreshComputedValues(),!0):!1}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition!==t?(this._scrollPosition=t,this._refreshComputedValues(),!0):!1}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,r,s,n){let o=Math.max(0,r-e),a=Math.max(0,o-2*t),l=s>0&&s>r;if(!l)return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(r*a/s))),h=(a-c)/(s-r),u=n*h;return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(c),computedSliderRatio:h,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let e=qp._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=e.computedAvailableSize,this._computedIsNeeded=e.computedIsNeeded,this._computedSliderSize=e.computedSliderSize,this._computedSliderRatio=e.computedSliderRatio,this._computedSliderPosition=e.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,r=this._scrollPosition;return t<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},TN=class extends TS{constructor(e,t,r){let s=e.getScrollDimensions(),n=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new MS(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,s.width,s.scrollWidth,n.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),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,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},MN=class extends TS{constructor(i,e,t){let r=i.getScrollDimensions(),s=i.getCurrentScrollPosition();if(super({lazyRender:e.lazyRender,host:t,scrollbarState:new MS(e.verticalHasArrows?e.arrowSize:0,e.vertical===2?0:e.verticalScrollbarSize,0,r.height,r.scrollHeight,s.scrollTop),visibility:e.vertical,extraScrollbarClassName:"vertical",scrollable:i,scrollByPage:e.scrollByPage}),e.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((e.verticalScrollbarSize-e.verticalSliderSize)/2),e.verticalSliderSize,void 0)}_updateSlider(i,e){this.slider.setHeight(i),this.slider.setTop(e)}_renderDomNode(i,e){this.domNode.setWidth(e),this.domNode.setHeight(i),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(i){return this._shouldRender=this._onElementScrollSize(i.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(i.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(i.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(i,e){return e}_sliderPointerPosition(i){return i.pageY}_sliderOrthogonalPointerPosition(i){return i.pageX}_updateScrollbarSize(i){this.slider.setWidth(i)}writeScrollPosition(i,e){i.scrollTop=e}updateOptions(i){this.updateScrollbarSize(i.vertical===2?0:i.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(i.vertical),this._scrollByPage=i.scrollByPage}},QN=500,pO=50,AN=class{constructor(e,t,r){this.timestamp=e,this.deltaX=t,this.deltaY=r,this.score=0}},Hp=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,t=0,r=1,s=this._rear;do{let n=s===this._front?e:Math.pow(2,-r);if(e-=n,t+=this._memory[s].score*n,s===this._front)break;s=(this._capacity+s-1)%this._capacity,r++}while(!0);return t<=.5}acceptStandardWheelEvent(e){if(Bg){let t=ns(e.browserEvent),r=Xz(t);this.accept(Date.now(),e.deltaX*r,e.deltaY*r)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,r){let s=null,n=new AN(e,t,r);this._front===-1&&this._rear===-1?(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,t){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),t){let s=Math.abs(e.deltaX),n=Math.abs(e.deltaY),o=Math.abs(t.deltaX),a=Math.abs(t.deltaY),l=Math.max(Math.min(s,o),1),c=Math.max(Math.min(n,a),1),h=Math.max(s,o),u=Math.max(n,a);h%l===0&&u%c===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};Hp.INSTANCE=new Hp;var RN=Hp,BN=class extends Ig{constructor(i,e,t){super(),this._onScroll=this._register(new we),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new we),this.onWillScroll=this._onWillScroll.event,this._options=EN(e),this._scrollable=t,this._register(this._scrollable.onScroll(s=>{this._onWillScroll.fire(s),this._onDidScroll(s),this._onScroll.fire(s)}));let r={onMouseWheel:s=>this._onMouseWheel(s),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new MN(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new TN(this._scrollable,this._options,r)),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(i),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=yl(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=yl(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=yl(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,s=>this._onMouseOver(s)),this.onmouseleave(this._listenOnDomNode,s=>this._onMouseLeave(s)),this._hideTimeout=this._register(new Eg),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=so(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(i){this._verticalScrollbar.delegatePointerDown(i)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(i){this._scrollable.setScrollDimensions(i,!1)}updateClassName(i){this._options.className=i,cs&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(i){typeof i.handleMouseWheel<"u"&&(this._options.handleMouseWheel=i.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof i.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=i.mouseWheelScrollSensitivity),typeof i.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=i.fastScrollSensitivity),typeof i.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=i.scrollPredominantAxis),typeof i.horizontal<"u"&&(this._options.horizontal=i.horizontal),typeof i.vertical<"u"&&(this._options.vertical=i.vertical),typeof i.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=i.horizontalScrollbarSize),typeof i.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=i.verticalScrollbarSize),typeof i.scrollByPage<"u"&&(this._options.scrollByPage=i.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(i){this._revealOnScroll=i}delegateScrollFromMouseWheelEvent(i){this._onMouseWheel(new aO(i))}_setListeningToMouseWheel(i){if(this._mouseWheelToDispose.length>0!==i&&(this._mouseWheelToDispose=so(this._mouseWheelToDispose),i)){let e=t=>{this._onMouseWheel(new aO(t))};this._mouseWheelToDispose.push(qe(this._listenOnDomNode,ti.MOUSE_WHEEL,e,{passive:!1}))}}_onMouseWheel(i){if(i.browserEvent?.defaultPrevented)return;let e=RN.INSTANCE;e.acceptStandardWheelEvent(i);let t=!1;if(i.deltaY||i.deltaX){let s=i.deltaY*this._options.mouseWheelScrollSensitivity,n=i.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=!cs&&i.browserEvent&&i.browserEvent.shiftKey;(this._options.scrollYToX||o)&&!n&&(n=s,s=0),i.browserEvent&&i.browserEvent.altKey&&(n=n*this._options.fastScrollSensitivity,s=s*this._options.fastScrollSensitivity);let a=this._scrollable.getFutureScrollPosition(),l={};if(s){let c=pO*s,h=a.scrollTop-(c<0?Math.floor(c):Math.ceil(c));this._verticalScrollbar.writeScrollPosition(l,h)}if(n){let c=pO*n,h=a.scrollLeft-(c<0?Math.floor(c):Math.ceil(c));this._horizontalScrollbar.writeScrollPosition(l,h)}l=this._scrollable.validateScrollPosition(l),(a.scrollLeft!==l.scrollLeft||a.scrollTop!==l.scrollTop)&&(this._options.mouseWheelSmoothScroll&&e.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(l):this._scrollable.setScrollPositionNow(l),t=!0)}let r=t;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(i.preventDefault(),i.stopPropagation())}_onDidScroll(i){this._shouldRender=this._horizontalScrollbar.onDidScroll(i)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(i)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let i=this._scrollable.getCurrentScrollPosition(),e=i.scrollTop>0,t=i.scrollLeft>0,r=t?" left":"",s=e?" top":"",n=t||e?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${n}${s}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(i){this._mouseIsOver=!1,this._hide()}_onMouseOver(i){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(),QN)}},LN=class extends BN{constructor(e,t,r){super(e,t,r)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function EN(i){let e={lazyRender:typeof i.lazyRender<"u"?i.lazyRender:!1,className:typeof i.className<"u"?i.className:"",useShadows:typeof i.useShadows<"u"?i.useShadows:!0,handleMouseWheel:typeof i.handleMouseWheel<"u"?i.handleMouseWheel:!0,flipAxes:typeof i.flipAxes<"u"?i.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof i.consumeMouseWheelIfScrollbarIsNeeded<"u"?i.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof i.alwaysConsumeMouseWheel<"u"?i.alwaysConsumeMouseWheel:!1,scrollYToX:typeof i.scrollYToX<"u"?i.scrollYToX:!1,mouseWheelScrollSensitivity:typeof i.mouseWheelScrollSensitivity<"u"?i.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof i.fastScrollSensitivity<"u"?i.fastScrollSensitivity:5,scrollPredominantAxis:typeof i.scrollPredominantAxis<"u"?i.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof i.mouseWheelSmoothScroll<"u"?i.mouseWheelSmoothScroll:!0,arrowSize:typeof i.arrowSize<"u"?i.arrowSize:11,listenOnDomNode:typeof i.listenOnDomNode<"u"?i.listenOnDomNode:null,horizontal:typeof i.horizontal<"u"?i.horizontal:1,horizontalScrollbarSize:typeof i.horizontalScrollbarSize<"u"?i.horizontalScrollbarSize:10,horizontalSliderSize:typeof i.horizontalSliderSize<"u"?i.horizontalSliderSize:0,horizontalHasArrows:typeof i.horizontalHasArrows<"u"?i.horizontalHasArrows:!1,vertical:typeof i.vertical<"u"?i.vertical:1,verticalScrollbarSize:typeof i.verticalScrollbarSize<"u"?i.verticalScrollbarSize:10,verticalHasArrows:typeof i.verticalHasArrows<"u"?i.verticalHasArrows:!1,verticalSliderSize:typeof i.verticalSliderSize<"u"?i.verticalSliderSize:0,scrollByPage:typeof i.scrollByPage<"u"?i.scrollByPage:!1};return e.horizontalSliderSize=typeof i.horizontalSliderSize<"u"?i.horizontalSliderSize:e.horizontalScrollbarSize,e.verticalSliderSize=typeof i.verticalSliderSize<"u"?i.verticalSliderSize:e.verticalScrollbarSize,cs&&(e.className+=" mac"),e}var Up=class extends tt{constructor(e,t,r,s,n,o,a,l){super(),this._bufferService=r,this._optionsService=a,this._renderService=l,this._onRequestScrollLines=this._register(new we),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new wN({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:h=>Dg(s.window,h)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new LN(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(n.onProtocolChange(h=>{this._scrollableElement.updateOptions({handleMouseWheel:!(h&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Oi.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Pt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Pt(()=>this._styleElement.remove())),this._register(Oi.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(`
75
+ `)})),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(h=>this._handleScroll(h)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,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){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(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 t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),r=t-this._bufferService.buffer.ydisp;r!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};Up=Lt([Qe(2,Ei),Qe(3,Zs),Qe(4,hS),Qe(5,la),Qe(6,Di),Qe(7,Xs)],Up);var Yp=class extends tt{constructor(e,t,r,s,n){super(),this._screenElement=e,this._bufferService=t,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(o=>this._removeDecoration(o))),this._register(Pt(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=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=`${t*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,t=e.element){if(!t)return;let r=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=r?`${r*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};Yp=Lt([Qe(1,Ei),Qe(2,Zs),Qe(3,mc),Qe(4,Xs)],Yp);var DN=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 t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}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,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,r){return t>=e.startBufferLine-this._linePadding[r||"full"]&&t<=e.endBufferLine+this._linePadding[r||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Hr={full:0,left:0,center:0,right:0},Js={full:0,left:0,center:0,right:0},Fa={full:0,left:0,center:0,right:0},bu=class extends tt{constructor(e,t,r,s,n,o,a,l){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=r,this._decorationService=s,this._renderService=n,this._optionsService=o,this._themeService=a,this._coreBrowserService=l,this._colorZoneStore=new DN,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(Pt(()=>this._canvas?.remove()));let c=this._canvas.getContext("2d");if(c)this._ctx=c;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Js.full=this._canvas.width,Js.left=e,Js.center=t,Js.right=e,this._refreshDrawHeightConstants(),Fa.full=1,Fa.left=1,Fa.center=1+Js.left,Fa.right=1+Js.left+Js.center}_refreshDrawHeightConstants(){Hr.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Hr.left=t,Hr.center=t,Hr.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Hr.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Hr.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Hr.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Hr.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);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(Fa[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Hr[e.position||"full"]/2),Js[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Hr[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};bu=Lt([Qe(2,Ei),Qe(3,mc),Qe(4,Xs),Qe(5,Di),Qe(6,la),Qe(7,Zs)],bu);var pe;(i=>(i.NUL="\0",i.SOH="",i.STX="",i.ETX="",i.EOT="",i.ENQ="",i.ACK="",i.BEL="\x07",i.BS="\b",i.HT=" ",i.LF=`
76
+ `,i.VT="\v",i.FF="\f",i.CR="\r",i.SO="",i.SI="",i.DLE="",i.DC1="",i.DC2="",i.DC3="",i.DC4="",i.NAK="",i.SYN="",i.ETB="",i.CAN="",i.EM="",i.SUB="",i.ESC="\x1B",i.FS="",i.GS="",i.RS="",i.US="",i.SP=" ",i.DEL=""))(pe||={});var Th;(i=>(i.PAD="€",i.HOP="",i.BPH="‚",i.NBH="ƒ",i.IND="„",i.NEL="…",i.SSA="†",i.ESA="‡",i.HTS="ˆ",i.HTJ="‰",i.VTS="Š",i.PLD="‹",i.PLU="Œ",i.RI="",i.SS2="Ž",i.SS3="",i.DCS="",i.PU1="‘",i.PU2="’",i.STS="“",i.CCH="”",i.MW="•",i.SPA="–",i.EPA="—",i.SOS="˜",i.SGCI="™",i.SCI="š",i.CSI="›",i.ST="œ",i.OSC="",i.PM="ž",i.APC="Ÿ"))(Th||={});var QS;(i=>i.ST=`${pe.ESC}\\`)(QS||={});var jp=class{constructor(e,t,r,s,n,o){this._textarea=e,this._compositionView=t,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(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let r;t.start+=this._dataAlreadySent.length,this._isComposing?r=this._textarea.value.substring(t.start,this._compositionPosition.start):r=this._textarea.value.substring(t.start),r.length>0&&this._coreService.triggerDataEvent(r,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,r=t.replace(e,"");this._dataAlreadySent=r,t.length>e.length?this._coreService.triggerDataEvent(r,!0):t.length<e.length?this._coreService.triggerDataEvent(`${pe.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),r=this._renderService.dimensions.css.cell.height,s=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,n=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=s+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=s+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};jp=Lt([Qe(2,Ei),Qe(3,Di),Qe(4,oo),Qe(5,Xs)],jp);var ii=0,ri=0,si=0,Rt=0,mO={css:"#00000000",rgba:0},Xt;(i=>{function e(s,n,o,a){return a!==void 0?`#${Qn(s)}${Qn(n)}${Qn(o)}${Qn(a)}`:`#${Qn(s)}${Qn(n)}${Qn(o)}`}i.toCss=e;function t(s,n,o,a=255){return(s<<24|n<<16|o<<8|a)>>>0}i.toRgba=t;function r(s,n,o,a){return{css:i.toCss(s,n,o,a),rgba:i.toRgba(s,n,o,a)}}i.toColor=r})(Xt||={});var St;(i=>{function e(l,c){if(Rt=(c.rgba&255)/255,Rt===1)return{css:c.css,rgba:c.rgba};let h=c.rgba>>24&255,u=c.rgba>>16&255,d=c.rgba>>8&255,f=l.rgba>>24&255,p=l.rgba>>16&255,g=l.rgba>>8&255;ii=f+Math.round((h-f)*Rt),ri=p+Math.round((u-p)*Rt),si=g+Math.round((d-g)*Rt);let O=Xt.toCss(ii,ri,si),_=Xt.toRgba(ii,ri,si);return{css:O,rgba:_}}i.blend=e;function t(l){return(l.rgba&255)===255}i.isOpaque=t;function r(l,c,h){let u=Mh.ensureContrastRatio(l.rgba,c.rgba,h);if(u)return Xt.toColor(u>>24&255,u>>16&255,u>>8&255)}i.ensureContrastRatio=r;function s(l){let c=(l.rgba|255)>>>0;return[ii,ri,si]=Mh.toChannels(c),{css:Xt.toCss(ii,ri,si),rgba:c}}i.opaque=s;function n(l,c){return Rt=Math.round(c*255),[ii,ri,si]=Mh.toChannels(l.rgba),{css:Xt.toCss(ii,ri,si,Rt),rgba:Xt.toRgba(ii,ri,si,Rt)}}i.opacity=n;function o(l,c){return Rt=l.rgba&255,n(l,Rt*c/255)}i.multiplyOpacity=o;function a(l){return[l.rgba>>24&255,l.rgba>>16&255,l.rgba>>8&255]}i.toColorRGB=a})(St||={});var Mt;(i=>{let e,t;try{let s=document.createElement("canvas");s.width=1,s.height=1;let n=s.getContext("2d",{willReadFrequently:!0});n&&(e=n,e.globalCompositeOperation="copy",t=e.createLinearGradient(0,0,1,1))}catch{}function r(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return ii=parseInt(s.slice(1,2).repeat(2),16),ri=parseInt(s.slice(2,3).repeat(2),16),si=parseInt(s.slice(3,4).repeat(2),16),Xt.toColor(ii,ri,si);case 5:return ii=parseInt(s.slice(1,2).repeat(2),16),ri=parseInt(s.slice(2,3).repeat(2),16),si=parseInt(s.slice(3,4).repeat(2),16),Rt=parseInt(s.slice(4,5).repeat(2),16),Xt.toColor(ii,ri,si,Rt);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let n=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return ii=parseInt(n[1]),ri=parseInt(n[2]),si=parseInt(n[3]),Rt=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Xt.toColor(ii,ri,si,Rt);if(!e||!t)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=t,e.fillStyle=s,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[ii,ri,si,Rt]=e.getImageData(0,0,1,1).data,Rt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Xt.toRgba(ii,ri,si,Rt),css:s}}i.toColor=r})(Mt||={});var Mi;(i=>{function e(r){return t(r>>16&255,r>>8&255,r&255)}i.relativeLuminance=e;function t(r,s,n){let o=r/255,a=s/255,l=n/255,c=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),h=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),u=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4);return c*.2126+h*.7152+u*.0722}i.relativeLuminance2=t})(Mi||={});var Mh;(i=>{function e(o,a){if(Rt=(a&255)/255,Rt===1)return a;let l=a>>24&255,c=a>>16&255,h=a>>8&255,u=o>>24&255,d=o>>16&255,f=o>>8&255;return ii=u+Math.round((l-u)*Rt),ri=d+Math.round((c-d)*Rt),si=f+Math.round((h-f)*Rt),Xt.toRgba(ii,ri,si)}i.blend=e;function t(o,a,l){let c=Mi.relativeLuminance(o>>8),h=Mi.relativeLuminance(a>>8);if(xs(c,h)<l){if(h<c){let f=r(o,a,l),p=xs(c,Mi.relativeLuminance(f>>8));if(p<l){let g=s(o,a,l),O=xs(c,Mi.relativeLuminance(g>>8));return p>O?f:g}return f}let u=s(o,a,l),d=xs(c,Mi.relativeLuminance(u>>8));if(d<l){let f=r(o,a,l),p=xs(c,Mi.relativeLuminance(f>>8));return d>p?u:f}return u}}i.ensureContrastRatio=t;function r(o,a,l){let c=o>>24&255,h=o>>16&255,u=o>>8&255,d=a>>24&255,f=a>>16&255,p=a>>8&255,g=xs(Mi.relativeLuminance2(d,f,p),Mi.relativeLuminance2(c,h,u));for(;g<l&&(d>0||f>0||p>0);)d-=Math.max(0,Math.ceil(d*.1)),f-=Math.max(0,Math.ceil(f*.1)),p-=Math.max(0,Math.ceil(p*.1)),g=xs(Mi.relativeLuminance2(d,f,p),Mi.relativeLuminance2(c,h,u));return(d<<24|f<<16|p<<8|255)>>>0}i.reduceLuminance=r;function s(o,a,l){let c=o>>24&255,h=o>>16&255,u=o>>8&255,d=a>>24&255,f=a>>16&255,p=a>>8&255,g=xs(Mi.relativeLuminance2(d,f,p),Mi.relativeLuminance2(c,h,u));for(;g<l&&(d<255||f<255||p<255);)d=Math.min(255,d+Math.ceil((255-d)*.1)),f=Math.min(255,f+Math.ceil((255-f)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),g=xs(Mi.relativeLuminance2(d,f,p),Mi.relativeLuminance2(c,h,u));return(d<<24|f<<16|p<<8|255)>>>0}i.increaseLuminance=s;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}i.toChannels=n})(Mh||={});function Qn(i){let e=i.toString(16);return e.length<2?"0"+e:e}function xs(i,e){return i<e?(e+.05)/(i+.05):(i+.05)/(e+.05)}var IN=class extends pc{constructor(e,t,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=r}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},yu=class{constructor(i){this._bufferService=i,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new xr}register(i){let e={id:this._nextCharacterJoinerId++,handler:i};return this._characterJoiners.push(e),e.id}deregister(i){for(let e=0;e<this._characterJoiners.length;e++)if(this._characterJoiners[e].id===i)return this._characterJoiners.splice(e,1),!0;return!1}getJoinedCharacters(i){if(this._characterJoiners.length===0)return[];let e=this._bufferService.buffer.lines.get(i);if(!e||e.length===0)return[];let t=[],r=e.translateToString(!0),s=0,n=0,o=0,a=e.getFg(0),l=e.getBg(0);for(let c=0;c<e.getTrimmedLength();c++)if(e.loadCell(c,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==a||this._workCell.bg!==l){if(c-s>1){let h=this._getJoinedRanges(r,o,n,e,s);for(let u=0;u<h.length;u++)t.push(h[u])}s=c,o=n,a=this._workCell.fg,l=this._workCell.bg}n+=this._workCell.getChars().length||dn.length}if(this._bufferService.cols-s>1){let c=this._getJoinedRanges(r,o,n,e,s);for(let h=0;h<c.length;h++)t.push(c[h])}return t}_getJoinedRanges(i,e,t,r,s){let n=i.substring(e,t),o=[];try{o=this._characterJoiners[0].handler(n)}catch(a){console.error(a)}for(let a=1;a<this._characterJoiners.length;a++)try{let l=this._characterJoiners[a].handler(n);for(let c=0;c<l.length;c++)yu._mergeRanges(o,l[c])}catch(l){console.error(l)}return this._stringRangesToCellRanges(o,r,s),o}_stringRangesToCellRanges(i,e,t){let r=0,s=!1,n=0,o=i[r];if(o){for(let a=t;a<this._bufferService.cols;a++){let l=e.getWidth(a),c=e.getString(a).length||dn.length;if(l!==0){if(!s&&o[0]<=n&&(o[0]=a,s=!0),o[1]<=n){if(o[1]=a,o=i[++r],!o)break;o[0]<=n?(o[0]=a,s=!0):s=!1}n+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(i,e){let t=!1;for(let r=0;r<i.length;r++){let s=i[r];if(t){if(e[1]<=s[0])return i[r-1][1]=e[1],i;if(e[1]<=s[1])return i[r-1][1]=Math.max(e[1],s[1]),i.splice(r,1),i;i.splice(r,1),r--}else{if(e[1]<=s[0])return i.splice(r,0,e),i;if(e[1]<=s[1])return s[0]=Math.min(e[0],s[0]),i;e[0]<s[1]&&(s[0]=Math.min(e[0],s[0]),t=!0);continue}}return t?i[i.length-1][1]=e[1]:i.push(e),i}};yu=Lt([Qe(0,Ei)],yu);function zN(i){return 57508<=i&&i<=57558}function NN(i){return 9472<=i&&i<=9631}function WN(i){return zN(i)||NN(i)}function ZN(){return{css:{canvas:rh(),cell:rh()},device:{canvas:rh(),cell:rh(),char:{width:0,height:0,left:0,top:0}}}}function rh(){return{width:0,height:0}}var Gp=class{constructor(e,t,r,s,n,o,a){this._document=e,this._characterJoinerService=t,this._optionsService=r,this._coreBrowserService=s,this._coreService=n,this._decorationService=o,this._themeService=a,this._workCell=new xr,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,r){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=r}createRow(e,t,r,s,n,o,a,l,c,h,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,g=e.getNoBgTrimmedLength();r&&g<o+1&&(g=o+1);let O,_=0,k="",P=0,w=0,C=0,M=0,D=!1,j=0,oe=!1,ae=0,G=0,x=[],b=h!==-1&&u!==-1;for(let T=0;T<g;T++){e.loadCell(T,this._workCell);let $=this._workCell.getWidth();if($===0)continue;let R=!1,E=T>=G,Z=T,K=this._workCell;if(f.length>0&&T===f[0][0]&&E){let z=f.shift(),Q=this._isCellInSelection(z[0],t);for(P=z[0]+1;P<z[1];P++)E&&=Q===this._isCellInSelection(P,t);E&&=!r||o<z[0]||o>=z[1],E?(R=!0,K=new IN(this._workCell,e.translateToString(!0,z[0],z[1]),z[1]-z[0]),Z=z[1]-1,$=K.getWidth()):G=z[1]}let X=this._isCellInSelection(T,t),V=r&&T===o,ie=b&&T>=h&&T<=u,q=!1;this._decorationService.forEachDecorationAtCell(T,t,void 0,z=>{q=!0});let ee=K.getChars()||dn;if(ee===" "&&(K.isUnderline()||K.isOverline())&&(ee=" "),ae=$*l-c.get(ee,K.isBold(),K.isItalic()),!O)O=this._document.createElement("span");else if(_&&(X&&oe||!X&&!oe&&K.bg===w)&&(X&&oe&&p.selectionForeground||K.fg===C)&&K.extended.ext===M&&ie===D&&ae===j&&!V&&!R&&!q&&E){K.isInvisible()?k+=dn:k+=ee,_++;continue}else _&&(O.textContent=k),O=this._document.createElement("span"),_=0,k="";if(w=K.bg,C=K.fg,M=K.extended.ext,D=ie,j=ae,oe=X,R&&o>=T&&o<=Z&&(o=T),!this._coreService.isCursorHidden&&V&&this._coreService.isCursorInitialized){if(x.push("xterm-cursor"),this._coreBrowserService.isFocused)a&&x.push("xterm-cursor-blink"),x.push(s==="bar"?"xterm-cursor-bar":s==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(n)switch(n){case"outline":x.push("xterm-cursor-outline");break;case"block":x.push("xterm-cursor-block");break;case"bar":x.push("xterm-cursor-bar");break;case"underline":x.push("xterm-cursor-underline");break}}if(K.isBold()&&x.push("xterm-bold"),K.isItalic()&&x.push("xterm-italic"),K.isDim()&&x.push("xterm-dim"),K.isInvisible()?k=dn:k=K.getChars()||dn,K.isUnderline()&&(x.push(`xterm-underline-${K.extended.underlineStyle}`),k===" "&&(k=" "),!K.isUnderlineColorDefault()))if(K.isUnderlineColorRGB())O.style.textDecorationColor=`rgb(${pc.toColorRGB(K.getUnderlineColor()).join(",")})`;else{let z=K.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&K.isBold()&&z<8&&(z+=8),O.style.textDecorationColor=p.ansi[z].css}K.isOverline()&&(x.push("xterm-overline"),k===" "&&(k=" ")),K.isStrikethrough()&&x.push("xterm-strikethrough"),ie&&(O.style.textDecoration="underline");let te=K.getFgColor(),Oe=K.getFgColorMode(),Te=K.getBgColor(),ke=K.getBgColorMode(),Ze=!!K.isInverse();if(Ze){let z=te;te=Te,Te=z;let Q=Oe;Oe=ke,ke=Q}let Je,Ve,I=!1;this._decorationService.forEachDecorationAtCell(T,t,void 0,z=>{z.options.layer!=="top"&&I||(z.backgroundColorRGB&&(ke=50331648,Te=z.backgroundColorRGB.rgba>>8&16777215,Je=z.backgroundColorRGB),z.foregroundColorRGB&&(Oe=50331648,te=z.foregroundColorRGB.rgba>>8&16777215,Ve=z.foregroundColorRGB),I=z.options.layer==="top")}),!I&&X&&(Je=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,Te=Je.rgba>>8&16777215,ke=50331648,I=!0,p.selectionForeground&&(Oe=50331648,te=p.selectionForeground.rgba>>8&16777215,Ve=p.selectionForeground)),I&&x.push("xterm-decoration-top");let L;switch(ke){case 16777216:case 33554432:L=p.ansi[Te],x.push(`xterm-bg-${Te}`);break;case 50331648:L=Xt.toColor(Te>>16,Te>>8&255,Te&255),this._addStyle(O,`background-color:#${gO((Te>>>0).toString(16),"0",6)}`);break;default:Ze?(L=p.foreground,x.push("xterm-bg-257")):L=p.background}switch(Je||K.isDim()&&(Je=St.multiplyOpacity(L,.5)),Oe){case 16777216:case 33554432:K.isBold()&&te<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(te+=8),this._applyMinimumContrast(O,L,p.ansi[te],K,Je,void 0)||x.push(`xterm-fg-${te}`);break;case 50331648:let z=Xt.toColor(te>>16&255,te>>8&255,te&255);this._applyMinimumContrast(O,L,z,K,Je,Ve)||this._addStyle(O,`color:#${gO(te.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(O,L,p.foreground,K,Je,Ve)||Ze&&x.push("xterm-fg-257")}x.length&&(O.className=x.join(" "),x.length=0),!V&&!R&&!q&&E?_++:O.textContent=k,ae!==this.defaultSpacing&&(O.style.letterSpacing=`${ae}px`),d.push(O),T=Z}return O&&_&&(O.textContent=k),d}_applyMinimumContrast(e,t,r,s,n,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||WN(s.getCode()))return!1;let a=this._getContrastCache(s),l;if(!n&&!o&&(l=a.getColor(t.rgba,r.rgba)),l===void 0){let c=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);l=St.ensureContrastRatio(n||t,o||r,c),a.setColor((n||t).rgba,(o||r).rgba,l??null)}return l?(this._addStyle(e,`color:${l.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let r=this._selectionStart,s=this._selectionEnd;return!r||!s?!1:this._columnSelectMode?r[0]<=s[0]?e>=r[0]&&t>=r[1]&&e<s[0]&&t<=s[1]:e<r[0]&&t>=r[1]&&e>=s[0]&&t<=s[1]:t>r[1]&&t<s[1]||r[1]===s[1]&&t===r[1]&&e>=r[0]&&e<s[0]||r[1]<s[1]&&t===s[1]&&e<s[0]||r[1]<s[1]&&t===r[1]&&e>=r[0]}};Gp=Lt([Qe(1,fS),Qe(2,Di),Qe(3,Zs),Qe(4,oo),Qe(5,mc),Qe(6,la)],Gp);function gO(i,e,t){for(;i.length<t;)i=e+i;return i}var XN=class{constructor(e,t){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),t.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,t,r,s){e===this._font&&t===this._fontSize&&r===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=t,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,t,r){let s=0;if(!t&&!r&&e.length===1&&(s=e.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];let a=this._measure(e,0);return a>0&&(this._flat[s]=a),a}let n=e;t&&(n+="B"),r&&(n+="I");let o=this._holey.get(n);if(o===void 0){let a=0;t&&(a|=1),r&&(a|=2),o=this._measure(e,a),o>0&&this._holey.set(n,o)}return o}_measure(e,t){let r=this._measureElements[t];return r.textContent=e.repeat(32),r.offsetWidth/32}},FN=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,t,r,s=!1){if(this.selectionStart=t,this.selectionEnd=r,!t||!r||t[0]===r[0]&&t[1]===r[1]){this.clear();return}let n=e.buffers.active.ydisp,o=t[1]-n,a=r[1]-n,l=Math.max(o,0),c=Math.min(a,e.rows-1);if(l>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=o,this.viewportEndRow=a,this.viewportCappedStartRow=l,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=r[0]}isCellSelected(e,t,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&r>=this.viewportCappedStartRow&&t<this.endCol&&r<=this.viewportCappedEndRow:t<this.startCol&&r>=this.viewportCappedStartRow&&t>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol):!1}};function VN(){return new FN}var jd="xterm-dom-renderer-owner-",hr="xterm-rows",sh="xterm-fg-",vO="xterm-bg-",Va="xterm-focus",nh="xterm-selection",qN=1,Kp=class extends tt{constructor(e,t,r,s,n,o,a,l,c,h,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=r,this._screenElement=s,this._viewportElement=n,this._helperContainer=o,this._linkifier2=a,this._charSizeService=c,this._optionsService=h,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=qN++,this._rowElements=[],this._selectionRenderModel=VN(),this.onRequestRedraw=this._register(new we).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(hr),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(nh),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=ZN(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(g=>this._injectCss(g))),this._injectCss(this._themeService.colors),this._rowFactory=l.createInstance(Gp,document),this._element.classList.add(jd+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(g=>this._handleLinkHover(g))),this._register(this._linkifier2.onHideLinkUnderline(g=>this._handleLinkLeave(g))),this._register(Pt(()=>{this._element.classList.remove(jd+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new XN(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;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;for(let r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${hr} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${hr} { 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}`;t+=`${this._terminalSelector} .${hr} .xterm-dim { color: ${St.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let r=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,n=`blink_block_${this._terminalClass}`;t+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${s} { 50% { box-shadow: none; }}`,t+=`@keyframes ${n} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${hr}.${Va} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${hr}.${Va} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${hr}.${Va} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${hr} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${hr} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${hr} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${hr} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${hr} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${nh} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${nh} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${nh} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,a]of e.ansi.entries())t+=`${this._terminalSelector} .${sh}${o} { color: ${a.css}; }${this._terminalSelector} .${sh}${o}.xterm-dim { color: ${St.multiplyOpacity(a,.5).css}; }${this._terminalSelector} .${vO}${o} { background-color: ${a.css}; }`;t+=`${this._terminalSelector} .${sh}257 { color: ${St.opaque(e.background).css}; }${this._terminalSelector} .${sh}257.xterm-dim { color: ${St.multiplyOpacity(St.opaque(e.background),.5).css}; }${this._terminalSelector} .${vO}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_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,t){for(let r=this._rowElements.length;r<=t;r++){let s=this._document.createElement("div");this._rowContainer.appendChild(s),this._rowElements.push(s)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),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(Va),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Va),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,r),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,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 c=e[0]>t[0];l.appendChild(this._createSelectionElement(o,c?t[0]:e[0],c?e[0]:t[0],a-o+1))}else{let c=s===o?e[0]:0,h=o===n?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(o,c,h));let u=a-o-1;if(l.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,u)),o!==a){let d=n===a?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(a,0,d))}}this._selectionContainer.appendChild(l)}_createSelectionElement(e,t,r,s=1){let n=this._document.createElement("div"),o=t*this.dimensions.css.cell.width,a=this.dimensions.css.cell.width*(r-t);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,t){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 c=e;c<=t;c++){let h=c+r.ydisp,u=this._rowElements[c],d=r.lines.get(h);if(!u||!d)break;u.replaceChildren(...this._rowFactory.createRow(d,h,h===s,a,l,n,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${jd}${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,t,r,s,n,o){r<0&&(e=0),s<0&&(t=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,c=l.ybase+l.y,h=Math.min(l.x,n-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=r;p<=s;++p){let g=p+l.ydisp,O=this._rowElements[p],_=l.lines.get(g);if(!O||!_)break;O.replaceChildren(...this._rowFactory.createRow(_,g,g===c,d,f,h,u,this.dimensions.css.cell.width,this._widthCache,o?p===r?e:0:-1,o?(p===s?t:n)-1:-1))}}};Kp=Lt([Qe(7,Qg),Qe(8,Uu),Qe(9,Di),Qe(10,Ei),Qe(11,oo),Qe(12,Zs),Qe(13,la)],Kp);var Jp=class extends tt{constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new we),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new UN(this._optionsService))}catch{this._measureStrategy=this._register(new HN(e,t,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())}};Jp=Lt([Qe(2,Di)],Jp);var AS=class extends tt{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(i,e){i!==void 0&&i>0&&e!==void 0&&e>0&&(this._result.width=i,this._result.height=e)}},HN=class extends AS{constructor(i,e,t){super(),this._document=i,this._parentElement=e,this._optionsService=t,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}},UN=class extends AS{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new 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}},YN=class extends tt{constructor(e,t,r){super(),this._textarea=e,this._window=t,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new jN(this._window)),this._onDprChange=this._register(new we),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new we),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(s=>this._screenDprMonitor.setWindow(s))),this._register(Oi.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(qe(this._textarea,"focus",()=>this._isFocused=!0)),this._register(qe(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 this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},jN=class extends tt{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new ia),this._onDprChange=this._register(new we),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Pt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=qe(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)}},GN=class extends tt{constructor(){super(),this.linkProviders=[],this._register(Pt(()=>this.linkProviders.length=0))}registerLinkProvider(i){return this.linkProviders.push(i),{dispose:()=>{let e=this.linkProviders.indexOf(i);e!==-1&&this.linkProviders.splice(e,1)}}}};function zg(i,e,t){let r=t.getBoundingClientRect(),s=i.getComputedStyle(t),n=parseInt(s.getPropertyValue("padding-left")),o=parseInt(s.getPropertyValue("padding-top"));return[e.clientX-r.left-n,e.clientY-r.top-o]}function KN(i,e,t,r,s,n,o,a,l){if(!n)return;let c=zg(i,e,t);if(c)return c[0]=Math.ceil((c[0]+(l?o/2:0))/o),c[1]=Math.ceil(c[1]/a),c[0]=Math.min(Math.max(c[0],1),r+(l?1:0)),c[1]=Math.min(Math.max(c[1],1),s),c}var em=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,s,n){return KN(window,e,t,r,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,n)}getMouseReportCoords(e,t){let r=zg(window,e,t);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])}}};em=Lt([Qe(0,Xs),Qe(1,Uu)],em);var JN=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,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,t,r){this._rowCount=r,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},RS={};cz(RS,{getSafariVersion:()=>tW,isChromeOS:()=>DS,isFirefox:()=>BS,isIpad:()=>iW,isIphone:()=>rW,isLegacyEdge:()=>eW,isLinux:()=>Ng,isMac:()=>xu,isNode:()=>Yu,isSafari:()=>LS,isWindows:()=>ES});var Yu=typeof process<"u"&&"title"in process,gc=Yu?"node":navigator.userAgent,vc=Yu?"node":navigator.platform,BS=gc.includes("Firefox"),eW=gc.includes("Edge"),LS=/^((?!chrome|android).)*safari/i.test(gc);function tW(){if(!LS)return 0;let i=gc.match(/Version\/(\d+)/);return i===null||i.length<2?0:parseInt(i[1])}var xu=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(vc),iW=vc==="iPad",rW=vc==="iPhone",ES=["Windows","Win16","Win32","WinCE"].includes(vc),Ng=vc.indexOf("Linux")>=0,DS=/\bCrOS\b/.test(gc),IS=class{constructor(){this._tasks=[],this._i=0}enqueue(i){this._tasks.push(i),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(i){this._idleCallback=void 0;let e=0,t=0,r=i.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(e=performance.now(),this._tasks[this._i]()||this._i++,e=Math.max(1,performance.now()-e),t=Math.max(e,t),s=i.timeRemaining(),t*1.5>s){r-e<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-e))}ms`),this._start();return}r=s}this.clear()}},sW=class extends IS{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},nW=class extends IS{_requestCallback(i){return requestIdleCallback(i)}_cancelCallback(i){cancelIdleCallback(i)}},wu=!Yu&&"requestIdleCallback"in window?nW:sW,oW=class{constructor(){this._queue=new wu}set(i){this._queue.clear(),this._queue.enqueue(i)}flush(){this._queue.flush()}},tm=class extends tt{constructor(e,t,r,s,n,o,a,l,c){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=s,this._coreService=n,this._coreBrowserService=l,this._renderer=this._register(new ia),this._pausedResizeTask=new oW,this._observerDisposable=this._register(new ia),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 we),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new we),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new we),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new we),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new JN((h,u)=>this._renderRows(h,u),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new aW(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Pt(()=>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(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(h=>this._registerIntersectionObserver(h,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(s=>this._handleIntersectionChange(s[s.length-1]),{threshold:0});r.observe(t),this._observerDisposable.value=Pt(()=>r.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!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,t,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let s=this._syncOutputHandler.flush();s&&(e=Math.min(e,s.start),t=Math.max(t,s.end)),r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),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:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,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(t=>this.refreshRows(t.start,t.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,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,r){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=r,this._renderer.value?.handleSelectionChanged(e,t,r)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};tm=Lt([Qe(2,Di),Qe(3,Uu),Qe(4,oo),Qe(5,mc),Qe(6,Ei),Qe(7,Zs),Qe(8,la)],tm);var aW=class{constructor(i,e,t){this._coreBrowserService=i,this._coreService=e,this._onTimeout=t,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(i,e){this._isBuffering?(this._start=Math.min(this._start,i),this._end=Math.max(this._end,e)):(this._start=i,this._end=e,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let i={start:this._start,end:this._end};return this._isBuffering=!1,i}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function lW(i,e,t,r){let s=t.buffer.x,n=t.buffer.y;if(!t.buffer.hasScrollback)return uW(s,n,i,e,t,r)+ju(n,e,t,r)+dW(s,n,i,e,t,r);let o;if(n===e)return o=s>i?"D":"C",Hl(Math.abs(s-i),ql(o,r));o=n>e?"D":"C";let a=Math.abs(n-e),l=hW(n>e?i:s,t)+(a-1)*t.cols+1+cW(n>e?s:i);return Hl(l,ql(o,r))}function cW(i,e){return i-1}function hW(i,e){return e.cols-i}function uW(i,e,t,r,s,n){return ju(e,r,s,n).length===0?"":Hl(NS(i,e,i,e-no(e,s),!1,s).length,ql("D",n))}function ju(i,e,t,r){let s=i-no(i,t),n=e-no(e,t),o=Math.abs(s-n)-fW(i,e,t);return Hl(o,ql(zS(i,e),r))}function dW(i,e,t,r,s,n){let o;ju(e,r,s,n).length>0?o=r-no(r,s):o=e;let a=r,l=pW(i,e,t,r,s,n);return Hl(NS(i,o,t,a,l==="C",s).length,ql(l,n))}function fW(i,e,t){let r=0,s=i-no(i,t),n=e-no(e,t);for(let o=0;o<Math.abs(s-n);o++){let a=zS(i,e)==="A"?-1:1;t.buffer.lines.get(s+a*o)?.isWrapped&&r++}return r}function no(i,e){let t=0,r=e.buffer.lines.get(i),s=r?.isWrapped;for(;s&&i>=0&&i<e.rows;)t++,r=e.buffer.lines.get(--i),s=r?.isWrapped;return t}function pW(i,e,t,r,s,n){let o;return ju(t,r,s,n).length>0?o=r-no(r,s):o=e,i<t&&o<=r||i>=t&&o<r?"C":"D"}function zS(i,e){return i>e?"A":"B"}function NS(i,e,t,r,s,n){let o=i,a=e,l="";for(;(o!==t||a!==r)&&a>=0&&a<n.buffer.lines.length;)o+=s?1:-1,s&&o>n.cols-1?(l+=n.buffer.translateBufferLineToString(a,!1,i,o),o=0,i=0,a++):!s&&o<0&&(l+=n.buffer.translateBufferLineToString(a,!1,0,i+1),o=n.cols-1,i=o,a--);return l+n.buffer.translateBufferLineToString(a,!1,i,o)}function ql(i,e){let t=e?"O":"[";return pe.ESC+t+i}function Hl(i,e){i=Math.floor(i);let t="";for(let r=0;r<i;r++)t+=e;return t}var mW=class{constructor(i){this._bufferService=i,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let i=this.selectionStart[0]+this.selectionStartLength;return i>this._bufferService.cols?i%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(i/this._bufferService.cols)-1]:[i%this._bufferService.cols,this.selectionStart[1]+Math.floor(i/this._bufferService.cols)]:[i,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let i=this.selectionStart[0]+this.selectionStartLength;return i>this._bufferService.cols?[i%this._bufferService.cols,this.selectionStart[1]+Math.floor(i/this._bufferService.cols)]:[Math.max(i,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let i=this.selectionStart,e=this.selectionEnd;return!i||!e?!1:i[1]>e[1]||i[1]===e[1]&&i[0]>e[0]}handleTrim(i){return this.selectionStart&&(this.selectionStart[1]-=i),this.selectionEnd&&(this.selectionEnd[1]-=i),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function OO(i,e){if(i.start.y>i.end.y)throw new Error(`Buffer range end (${i.end.x}, ${i.end.y}) cannot be before start (${i.start.x}, ${i.start.y})`);return e*(i.end.y-i.start.y)+(i.end.x-i.start.x+1)}var Gd=50,gW=15,vW=50,OW=500,_W=" ",bW=new RegExp(_W,"g"),im=class extends tt{constructor(e,t,r,s,n,o,a,l,c){super(),this._element=e,this._screenElement=t,this._linkifier=r,this._bufferService=s,this._coreService=n,this._mouseService=o,this._optionsService=a,this._renderService=l,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new xr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new we),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new we),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new we),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new we),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=h=>this._handleMouseMove(h),this._mouseUpListener=h=>this._handleMouseUp(h),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(h=>this._handleTrim(h)),this._register(this._bufferService.buffers.onBufferActivate(h=>this._handleBufferActivate(h))),this.enable(),this._model=new mW(this._bufferService),this._activeSelectionMode=0,this._register(Pt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(h=>{h.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,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let r=this._bufferService.buffer,s=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let n=e[0]<t[0]?e[0]:t[0],o=e[0]<t[0]?t[0]:e[0];for(let a=e[1];a<=t[1];a++){let l=r.translateBufferLineToString(a,!0,n,o);s.push(l)}}else{let n=e[1]===t[1]?t[0]:void 0;s.push(r.translateBufferLineToString(e[1],!0,e[0],n));for(let o=e[1]+1;o<=t[1]-1;o++){let a=r.lines.get(o),l=r.translateBufferLineToString(o,!0);a?.isWrapped?s[s.length-1]+=l:s.push(l)}if(e[1]!==t[1]){let o=r.lines.get(t[1]),a=r.translateBufferLineToString(t[1],!0,0,t[0]);o&&o.isWrapped?s[s.length-1]+=a:s.push(a)}}return s.map(n=>n.replace(bW," ")).join(ES?`\r
77
+ `:`
78
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Ng&&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:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!r||!s||!t?!1:this._areCoordsInSelection(t,r,s)}isCellInSelection(e,t){let r=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!r||!s?!1:this._areCoordsInSelection([e,t],r,s)}_areCoordsInSelection(e,t,r){return e[1]>t[1]&&e[1]<r[1]||t[1]===r[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<r[0]||t[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||t[1]<r[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let r=this._linkifier.currentLink?.link?.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=OO(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let s=this._getMouseBufferCoords(e);return s?(this._selectWordAt(s,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=zg(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=r?0:(t>r&&(t-=r),t=Math.min(Math.max(t,-Gd),Gd),t/=Gd,t/Math.abs(t)+Math.round(t*(gW-1)))}shouldForceSelection(e){return xu?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&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(),vW)}_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=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(xu&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(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 s=r.lines.get(this._model.selectionEnd[1]);s&&s.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[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?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<OW&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let r=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(r&&r[0]!==void 0&&r[1]!==void 0){let s=lW(r[0]-1,r[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(s,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,r=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!r){this._oldHasSelection&&this._fireOnSelectionChange(e,t,r);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,r)}_fireOnSelectionChange(e,t,r){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let r=t;for(let s=0;t>=s;s++){let n=e.loadCell(s,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:n>1&&t!==s&&(r+=n-1)}return r}setSelection(e,t,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,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]),c=l,h=e[0]-l,u=0,d=0,f=0,p=0;if(a.charAt(l)===" "){for(;l>0&&a.charAt(l-1)===" ";)l--;for(;c<a.length&&a.charAt(c+1)===" ";)c++}else{let _=e[0],k=e[0];o.getWidth(_)===0&&(u++,_--),o.getWidth(k)===2&&(d++,k++);let P=o.getString(k).length;for(P>1&&(p+=P-1,c+=P-1);_>0&&l>0&&!this._isCharWordSeparator(o.loadCell(_-1,this._workCell));){o.loadCell(_-1,this._workCell);let w=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,_--):w>1&&(f+=w-1,l-=w-1),l--,_--}for(;k<o.length&&c+1<a.length&&!this._isCharWordSeparator(o.loadCell(k+1,this._workCell));){o.loadCell(k+1,this._workCell);let w=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,k++):w>1&&(p+=w-1,c+=w-1),c++,k++}}c++;let g=l+h-u+f,O=Math.min(this._bufferService.cols,c-l+u+d-f-p);if(!(!t&&a.slice(l,c).trim()==="")){if(r&&g===0&&o.getCodePoint(0)!==32){let _=n.lines.get(e[1]-1);if(_&&o.isWrapped&&_.getCodePoint(this._bufferService.cols-1)!==32){let k=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(k){let P=this._bufferService.cols-k.start;g-=P,O+=P}}}if(s&&g+O===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let _=n.lines.get(e[1]+1);if(_?.isWrapped&&_.getCodePoint(0)!==32){let k=this._getWordAt([0,e[1]+1],!1,!1,!0);k&&(O+=k.length)}}return{start:g,length:O}}}_selectWordAt(e,t){let r=this._getWordAt(e,t);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 t=this._getWordAt(e,!0);if(t){let r=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,r]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),r={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=OO(r,this._bufferService.cols)}};im=Lt([Qe(3,Ei),Qe(4,oo),Qe(5,Ag),Qe(6,Di),Qe(7,Xs),Qe(8,Zs)],im);var _O=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},bO=class{constructor(){this._color=new _O,this._css=new _O}setCss(e,t,r){this._css.set(e,t,r)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,r){this._color.set(e,t,r)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Ht=Object.freeze((()=>{let i=[Mt.toColor("#2e3436"),Mt.toColor("#cc0000"),Mt.toColor("#4e9a06"),Mt.toColor("#c4a000"),Mt.toColor("#3465a4"),Mt.toColor("#75507b"),Mt.toColor("#06989a"),Mt.toColor("#d3d7cf"),Mt.toColor("#555753"),Mt.toColor("#ef2929"),Mt.toColor("#8ae234"),Mt.toColor("#fce94f"),Mt.toColor("#729fcf"),Mt.toColor("#ad7fa8"),Mt.toColor("#34e2e2"),Mt.toColor("#eeeeec")],e=[0,95,135,175,215,255];for(let t=0;t<216;t++){let r=e[t/36%6|0],s=e[t/6%6|0],n=e[t%6];i.push({css:Xt.toCss(r,s,n),rgba:Xt.toRgba(r,s,n)})}for(let t=0;t<24;t++){let r=8+t*10;i.push({css:Xt.toCss(r,r,r),rgba:Xt.toRgba(r,r,r)})}return i})()),En=Mt.toColor("#ffffff"),ol=Mt.toColor("#000000"),yO=Mt.toColor("#ffffff"),xO=ol,qa={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},yW=En,rm=class extends tt{constructor(e){super(),this._optionsService=e,this._contrastCache=new bO,this._halfContrastCache=new bO,this._onChangeColors=this._register(new we),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:En,background:ol,cursor:yO,cursorAccent:xO,selectionForeground:void 0,selectionBackgroundTransparent:qa,selectionBackgroundOpaque:St.blend(ol,qa),selectionInactiveBackgroundTransparent:qa,selectionInactiveBackgroundOpaque:St.blend(ol,qa),scrollbarSliderBackground:St.opacity(En,.2),scrollbarSliderHoverBackground:St.opacity(En,.4),scrollbarSliderActiveBackground:St.opacity(En,.5),overviewRulerBorder:En,ansi:Ht.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 t=this._colors;if(t.foreground=pt(e.foreground,En),t.background=pt(e.background,ol),t.cursor=St.blend(t.background,pt(e.cursor,yO)),t.cursorAccent=St.blend(t.background,pt(e.cursorAccent,xO)),t.selectionBackgroundTransparent=pt(e.selectionBackground,qa),t.selectionBackgroundOpaque=St.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=pt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=St.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?pt(e.selectionForeground,mO):void 0,t.selectionForeground===mO&&(t.selectionForeground=void 0),St.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=St.opacity(t.selectionBackgroundTransparent,.3)),St.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=St.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=pt(e.scrollbarSliderBackground,St.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=pt(e.scrollbarSliderHoverBackground,St.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=pt(e.scrollbarSliderActiveBackground,St.opacity(t.foreground,.5)),t.overviewRulerBorder=pt(e.overviewRulerBorder,yW),t.ansi=Ht.slice(),t.ansi[0]=pt(e.black,Ht[0]),t.ansi[1]=pt(e.red,Ht[1]),t.ansi[2]=pt(e.green,Ht[2]),t.ansi[3]=pt(e.yellow,Ht[3]),t.ansi[4]=pt(e.blue,Ht[4]),t.ansi[5]=pt(e.magenta,Ht[5]),t.ansi[6]=pt(e.cyan,Ht[6]),t.ansi[7]=pt(e.white,Ht[7]),t.ansi[8]=pt(e.brightBlack,Ht[8]),t.ansi[9]=pt(e.brightRed,Ht[9]),t.ansi[10]=pt(e.brightGreen,Ht[10]),t.ansi[11]=pt(e.brightYellow,Ht[11]),t.ansi[12]=pt(e.brightBlue,Ht[12]),t.ansi[13]=pt(e.brightMagenta,Ht[13]),t.ansi[14]=pt(e.brightCyan,Ht[14]),t.ansi[15]=pt(e.brightWhite,Ht[15]),e.extendedAnsi){let r=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let s=0;s<r;s++)t.ansi[s+16]=pt(e.extendedAnsi[s],Ht[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(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];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()}}};rm=Lt([Qe(0,Di)],rm);function pt(i,e){if(i!==void 0)try{return Mt.toColor(i)}catch{}return e}var xW=class{constructor(...e){this._entries=new Map;for(let[t,r]of e)this.set(t,r)}set(e,t){let r=this._entries.get(e);return this._entries.set(e,t),r}forEach(e){for(let[t,r]of this._entries.entries())e(t,r)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},wW=class{constructor(){this._services=new xW,this._services.set(Qg,this)}setService(i,e){this._services.set(i,e)}getService(i){return this._services.get(i)}createInstance(i,...e){let t=gz(i).sort((n,o)=>n.index-o.index),r=[];for(let n of t){let o=this._services.get(n.id);if(!o)throw new Error(`[createInstance] ${i.name} depends on UNKNOWN service ${n.id._id}.`);r.push(o)}let s=t.length>0?t[0].index:e.length;if(e.length!==s)throw new Error(`[createInstance] First service dependency of ${i.name} at position ${s+1} conflicts with ${e.length} static arguments`);return new i(...e,...r)}},SW={trace:0,debug:1,info:2,warn:3,error:4,off:5},kW="xterm.js: ",sm=class extends tt{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=SW[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":kW)+t,...r)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};sm=Lt([Qe(0,Di)],sm);var wO=class extends tt{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new we),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new we),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new we),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let r=0;r<Math.min(e,this.length);r++)t[r]=this._array[this._getCyclicIndex(r)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}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 new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...r){if(t){for(let s=e;s<this._length-t;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let s=this._length-1;s>=e;s--)this._array[this._getCyclicIndex(s+r.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<r.length;s++)this._array[this._getCyclicIndex(e+s)]=r[s];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){let s=this._length+r.length-this._maxLength;this._startIndex+=s,this._length=this._maxLength,this.onTrimEmitter.fire(s)}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,t,r){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let n=t-1;n>=0;n--)this.set(e+n+r,this.get(e+n));let s=e+t+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<t;s++)this.set(e+s+r,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},et=3,Wt=Object.freeze(new pc),oh=0,Kd=2,al=class WS{constructor(e,t,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*et);let s=t||xr.fromCharData([0,oS,1,0]);for(let n=0;n<e;++n)this.setCell(n,s);this.length=e}get(e){let t=this._data[e*et+0],r=t&2097151;return[this._data[e*et+1],t&2097152?this._combined[e]:r?cn(r):"",t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):r]}set(e,t){this._data[e*et+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*et+0]=e|2097152|t[2]<<22):this._data[e*et+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*et+0]>>22}hasWidth(e){return this._data[e*et+0]&12582912}getFg(e){return this._data[e*et+1]}getBg(e){return this._data[e*et+2]}hasContent(e){return this._data[e*et+0]&4194303}getCodePoint(e){let t=this._data[e*et+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*et+0]&2097152}getString(e){let t=this._data[e*et+0];return t&2097152?this._combined[e]:t&2097151?cn(t&2097151):""}isProtected(e){return this._data[e*et+2]&536870912}loadCell(e,t){return oh=e*et,t.content=this._data[oh+0],t.fg=this._data[oh+1],t.bg=this._data[oh+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*et+0]=t.content,this._data[e*et+1]=t.fg,this._data[e*et+2]=t.bg}setCellFromCodepoint(e,t,r,s){s.bg&268435456&&(this._extendedAttrs[e]=s.extended),this._data[e*et+0]=t|r<<22,this._data[e*et+1]=s.fg,this._data[e*et+2]=s.bg}addCodepointToCell(e,t,r){let s=this._data[e*et+0];s&2097152?this._combined[e]+=cn(t):s&2097151?(this._combined[e]=cn(s&2097151)+cn(t),s&=-2097152,s|=2097152):s=t|1<<22,r&&(s&=-12582913,s|=r<<22),this._data[e*et+0]=s}insertCells(e,t,r){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,r),t<this.length-e){let s=new xr;for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,s));for(let n=0;n<t;++n)this.setCell(e+n,r)}else for(let s=e;s<this.length;++s)this.setCell(s,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(e,t,r){if(e%=this.length,t<this.length-e){let s=new xr;for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,s));for(let n=this.length-t;n<this.length;++n)this.setCell(n,r)}else for(let s=e;s<this.length;++s)this.setCell(s,r);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,r),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,r)}replaceCells(e,t,r,s=!1){if(s){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,r),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,r);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,r),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,r),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,r);e<t&&e<this.length;)this.setCell(e++,r)}resize(e,t){if(e===this.length)return this._data.length*4*Kd<this._data.buffer.byteLength;let r=e*et;if(e>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let s=new Uint32Array(r);s.set(this._data),this._data=s}for(let s=this.length;s<e;++s)this.setCell(s,t)}else{this._data=this._data.subarray(0,r);let s=Object.keys(this._combined);for(let o=0;o<s.length;o++){let a=parseInt(s[o],10);a>=e&&delete this._combined[a]}let n=Object.keys(this._extendedAttrs);for(let o=0;o<n.length;o++){let a=parseInt(n[o],10);a>=e&&delete this._extendedAttrs[a]}}return this.length=e,r*4*Kd<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Kd<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,e);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,e)}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let e=new WS(0);e._data=new Uint32Array(this._data),e.length=this.length;for(let t in this._combined)e._combined[t]=this._combined[t];for(let t in this._extendedAttrs)e._extendedAttrs[t]=this._extendedAttrs[t];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*et+0]&4194303)return e+(this._data[e*et+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*et+0]&4194303||this._data[e*et+2]&50331648)return e+(this._data[e*et+0]>>22);return 0}copyCellsFrom(e,t,r,s,n){let o=e._data;if(n)for(let l=s-1;l>=0;l--){for(let c=0;c<et;c++)this._data[(r+l)*et+c]=o[(t+l)*et+c];o[(t+l)*et+2]&268435456&&(this._extendedAttrs[r+l]=e._extendedAttrs[t+l])}else for(let l=0;l<s;l++){for(let c=0;c<et;c++)this._data[(r+l)*et+c]=o[(t+l)*et+c];o[(t+l)*et+2]&268435456&&(this._extendedAttrs[r+l]=e._extendedAttrs[t+l])}let a=Object.keys(e._combined);for(let l=0;l<a.length;l++){let c=parseInt(a[l],10);c>=t&&(this._combined[c-t+r]=e._combined[c])}}translateToString(e,t,r,s){t=t??0,r=r??this.length,e&&(r=Math.min(r,this.getTrimmedLength())),s&&(s.length=0);let n="";for(;t<r;){let o=this._data[t*et+0],a=o&2097151,l=o&2097152?this._combined[t]:a?cn(a):dn;if(n+=l,s)for(let c=0;c<l.length;++c)s.push(t);t+=o>>22||1}return s&&s.push(t),n}};function CW(i,e,t,r,s,n){let o=[];for(let a=0;a<i.length-1;a++){let l=a,c=i.get(++l);if(!c.isWrapped)continue;let h=[i.get(a)];for(;l<i.length&&c.isWrapped;)h.push(c),c=i.get(++l);if(!n&&r>=a&&r<l){a+=h.length-1;continue}let u=0,d=Ul(h,u,e),f=1,p=0;for(;f<h.length;){let O=Ul(h,f,e),_=O-p,k=t-d,P=Math.min(_,k);h[u].copyCellsFrom(h[f],p,d,P,!1),d+=P,d===t&&(u++,d=0),p+=P,p===O&&(f++,p=0),d===0&&u!==0&&h[u-1].getWidth(t-1)===2&&(h[u].copyCellsFrom(h[u-1],t-1,d++,1,!1),h[u-1].setCell(t-1,s))}h[u].replaceCells(d,t,s);let g=0;for(let O=h.length-1;O>0&&(O>u||h[O].getTrimmedLength()===0);O--)g++;g>0&&(o.push(a+h.length-g),o.push(g)),a+=h.length-1}return o}function $W(i,e){let t=[],r=0,s=e[r],n=0;for(let o=0;o<i.length;o++)if(s===o){let a=e[++r];i.onDeleteEmitter.fire({index:o-n,amount:a}),o+=a-1,n+=a,s=e[++r]}else t.push(o);return{layout:t,countRemoved:n}}function PW(i,e){let t=[];for(let r=0;r<e.length;r++)t.push(i.get(e[r]));for(let r=0;r<t.length;r++)i.set(r,t[r]);i.length=e.length}function TW(i,e,t){let r=[],s=i.map((l,c)=>Ul(i,c,e)).reduce((l,c)=>l+c),n=0,o=0,a=0;for(;a<s;){if(s-a<t){r.push(s-a);break}n+=t;let l=Ul(i,o,e);n>l&&(n-=l,o++);let c=i[o].getWidth(n-1)===2;c&&n--;let h=c?t-1:t;r.push(h),a+=h}return r}function Ul(i,e,t){if(e===i.length-1)return i[e].getTrimmedLength();let r=!i[e].hasContent(t-1)&&i[e].getWidth(t-1)===1,s=i[e+1].getWidth(0)===2;return r&&s?t-1:t}var ZS=class XS{constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=XS._nextId++,this._onDispose=this.register(new we),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),so(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};ZS._nextId=1;var MW=ZS,Kt={},Dn=Kt.B;Kt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Kt.A={"#":"£"};Kt.B=void 0;Kt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Kt.C=Kt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Kt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Kt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Kt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Kt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Kt.E=Kt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Kt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Kt.H=Kt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Kt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var SO=4294967295,kO=class{constructor(i,e,t){this._hasScrollback=i,this._optionsService=e,this._bufferService=t,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Wt.clone(),this.savedCharset=Dn,this.markers=[],this._nullCell=xr.fromCharData([0,oS,1,0]),this._whitespaceCell=xr.fromCharData([0,dn,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new wu,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new wO(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(i){return i?(this._nullCell.fg=i.fg,this._nullCell.bg=i.bg,this._nullCell.extended=i.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new _u),this._nullCell}getWhitespaceCell(i){return i?(this._whitespaceCell.fg=i.fg,this._whitespaceCell.bg=i.bg,this._whitespaceCell.extended=i.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new _u),this._whitespaceCell}getBlankLine(i,e){return new al(this._bufferService.cols,this.getNullCell(i),e)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let i=this.ybase+this.y-this.ydisp;return i>=0&&i<this._rows}_getCorrectBufferLength(i){if(!this._hasScrollback)return i;let e=i+this._optionsService.rawOptions.scrollback;return e>SO?SO:e}fillViewportRows(i){if(this.lines.length===0){i===void 0&&(i=Wt);let e=this._rows;for(;e--;)this.lines.push(this.getBlankLine(i))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new wO(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(i,e){let t=this.getNullCell(Wt),r=0,s=this._getCorrectBufferLength(e);if(s>this.lines.maxLength&&(this.lines.maxLength=s),this.lines.length>0){if(this._cols<i)for(let o=0;o<this.lines.length;o++)r+=+this.lines.get(o).resize(i,t);let n=0;if(this._rows<e)for(let o=this._rows;o<e;o++)this.lines.length<e+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new al(i,t)):this.ybase>0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new al(i,t)));else for(let o=this._rows;o>e;o--)this.lines.length>e+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(s<this.lines.maxLength){let o=this.lines.length-s;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=s}this.x=Math.min(this.x,i-1),this.y=Math.min(this.y,e-1),n&&(this.y+=n),this.savedX=Math.min(this.savedX,i-1),this.scrollTop=0}if(this.scrollBottom=e-1,this._isReflowEnabled&&(this._reflow(i,e),this._cols>i))for(let n=0;n<this.lines.length;n++)r+=+this.lines.get(n).resize(i,t);this._cols=i,this._rows=e,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let i=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,i=!1);let e=0;for(;this._memoryCleanupPosition<this.lines.length;)if(e+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),e>100)return!0;return i}get _isReflowEnabled(){let i=this._optionsService.rawOptions.windowsPty;return i&&i.buildNumber?this._hasScrollback&&i.backend==="conpty"&&i.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(i,e){this._cols!==i&&(i>this._cols?this._reflowLarger(i,e):this._reflowSmaller(i,e))}_reflowLarger(i,e){let t=this._optionsService.rawOptions.reflowCursorLine,r=CW(this.lines,this._cols,i,this.ybase+this.y,this.getNullCell(Wt),t);if(r.length>0){let s=$W(this.lines,r);PW(this.lines,s.layout),this._reflowLargerAdjustViewport(i,e,s.countRemoved)}}_reflowLargerAdjustViewport(i,e,t){let r=this.getNullCell(Wt),s=t;for(;s-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<e&&this.lines.push(new al(i,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-t,0)}_reflowSmaller(i,e){let t=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(Wt),s=[],n=0;for(let o=this.lines.length-1;o>=0;o--){let a=this.lines.get(o);if(!a||!a.isWrapped&&a.getTrimmedLength()<=i)continue;let l=[a];for(;a.isWrapped&&o>0;)a=this.lines.get(--o),l.unshift(a);if(!t){let P=this.ybase+this.y;if(P>=o&&P<o+l.length)continue}let c=l[l.length-1].getTrimmedLength(),h=TW(l,this._cols,i),u=h.length-l.length,d;this.ybase===0&&this.y!==this.lines.length-1?d=Math.max(0,this.y-this.lines.maxLength+u):d=Math.max(0,this.lines.length-this.lines.maxLength+u);let f=[];for(let P=0;P<u;P++){let w=this.getBlankLine(Wt,!0);f.push(w)}f.length>0&&(s.push({start:o+l.length+n,newLines:f}),n+=f.length),l.push(...f);let p=h.length-1,g=h[p];g===0&&(p--,g=h[p]);let O=l.length-u-1,_=c;for(;O>=0;){let P=Math.min(_,g);if(l[p]===void 0)break;if(l[p].copyCellsFrom(l[O],_-P,g-P,P,!0),g-=P,g===0&&(p--,g=h[p]),_-=P,_===0){O--;let w=Math.max(O,0);_=Ul(l,w,this._cols)}}for(let P=0;P<l.length;P++)h[P]<i&&l[P].setCell(h[P],r);let k=u-d;for(;k-- >0;)this.ybase===0?this.y<e-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+n)-e&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+u,this.ybase+e-1)}if(s.length>0){let o=[],a=[];for(let g=0;g<this.lines.length;g++)a.push(this.lines.get(g));let l=this.lines.length,c=l-1,h=0,u=s[h];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+n);let d=0;for(let g=Math.min(this.lines.maxLength-1,l+n-1);g>=0;g--)if(u&&u.start>c+d){for(let O=u.newLines.length-1;O>=0;O--)this.lines.set(g--,u.newLines[O]);g++,o.push({index:c+1,amount:u.newLines.length}),d+=u.newLines.length,u=s[++h]}else this.lines.set(g,a[c--]);let f=0;for(let g=o.length-1;g>=0;g--)o[g].index+=f,this.lines.onInsertEmitter.fire(o[g]),f+=o[g].amount;let p=Math.max(0,l+n-this.lines.maxLength);p>0&&this.lines.onTrimEmitter.fire(p)}}translateBufferLineToString(i,e,t=0,r){let s=this.lines.get(i);return s?s.translateToString(e,t,r):""}getWrappedRangeForLine(i){let e=i,t=i;for(;e>0&&this.lines.get(e).isWrapped;)e--;for(;t+1<this.lines.length&&this.lines.get(t+1).isWrapped;)t++;return{first:e,last:t}}setupTabStops(i){for(i!=null?this.tabs[i]||(i=this.prevStop(i)):(this.tabs={},i=0);i<this._cols;i+=this._optionsService.rawOptions.tabStopWidth)this.tabs[i]=!0}prevStop(i){for(i==null&&(i=this.x);!this.tabs[--i]&&i>0;);return i>=this._cols?this._cols-1:i<0?0:i}nextStop(i){for(i==null&&(i=this.x);!this.tabs[++i]&&i<this._cols;);return i>=this._cols?this._cols-1:i<0?0:i}clearMarkers(i){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].line===i&&(this.markers[e].dispose(),this.markers.splice(e--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let i=0;i<this.markers.length;i++)this.markers[i].dispose();this.markers.length=0,this._isClearing=!1}addMarker(i){let e=new MW(i);return this.markers.push(e),e.register(this.lines.onTrim(t=>{e.line-=t,e.line<0&&e.dispose()})),e.register(this.lines.onInsert(t=>{e.line>=t.index&&(e.line+=t.amount)})),e.register(this.lines.onDelete(t=>{e.line>=t.index&&e.line<t.index+t.amount&&e.dispose(),e.line>t.index&&(e.line-=t.amount)})),e.register(e.onDispose(()=>this._removeMarker(e))),e}_removeMarker(i){this._isClearing||this.markers.splice(this.markers.indexOf(i),1)}},QW=class extends tt{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new we),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 kO(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new kO(!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,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},FS=2,VS=1,nm=class extends tt{constructor(i){super(),this.isUserScrolling=!1,this._onResize=this._register(new we),this.onResize=this._onResize.event,this._onScroll=this._register(new we),this.onScroll=this._onScroll.event,this.cols=Math.max(i.rawOptions.cols||0,FS),this.rows=Math.max(i.rawOptions.rows||0,VS),this.buffers=this._register(new QW(i,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(i,e){let t=this.cols!==i,r=this.rows!==e;this.cols=i,this.rows=e,this.buffers.resize(i,e),this._onResize.fire({cols:i,rows:e,colsChanged:t,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(i,e=!1){let t=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==i.fg||r.getBg(0)!==i.bg)&&(r=t.getBlankLine(i,e),this._cachedBlankLine=r),r.isWrapped=e;let s=t.ybase+t.scrollTop,n=t.ybase+t.scrollBottom;if(t.scrollTop===0){let o=t.lines.isFull;n===t.lines.length-1?o?t.lines.recycle().copyFrom(r):t.lines.push(r.clone()):t.lines.splice(n+1,0,r.clone()),o?this.isUserScrolling&&(t.ydisp=Math.max(t.ydisp-1,0)):(t.ybase++,this.isUserScrolling||t.ydisp++)}else{let o=n-s+1;t.lines.shiftElements(s+1,o-1,-1),t.lines.set(n,r.clone())}this.isUserScrolling||(t.ydisp=t.ybase),this._onScroll.fire(t.ydisp)}scrollLines(i,e){let t=this.buffer;if(i<0){if(t.ydisp===0)return;this.isUserScrolling=!0}else i+t.ydisp>=t.ybase&&(this.isUserScrolling=!1);let r=t.ydisp;t.ydisp=Math.max(Math.min(t.ydisp+i,t.ybase),0),r!==t.ydisp&&(e||this._onScroll.fire(t.ydisp))}};nm=Lt([Qe(0,Di)],nm);var bo={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:xu,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},AW=["normal","bold","100","200","300","400","500","600","700","800","900"],RW=class extends tt{constructor(e){super(),this._onOptionChange=this._register(new we),this.onOptionChange=this._onOptionChange.event;let t={...bo};for(let r in e)if(r in t)try{let s=e[r];t[r]=this._sanitizeAndValidateOption(r,s)}catch(s){console.error(s)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Pt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(r=>{r===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(r=>{e.indexOf(r)!==-1&&t()})}_setupOptions(){let e=r=>{if(!(r in bo))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},t=(r,s)=>{if(!(r in bo))throw new Error(`No option with key "${r}"`);s=this._sanitizeAndValidateOption(r,s),this.rawOptions[r]!==s&&(this.rawOptions[r]=s,this._onOptionChange.fire(r))};for(let r in this.rawOptions){let s={get:e.bind(this,r),set:t.bind(this,r)};Object.defineProperty(this.options,r,s)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=bo[e]),!BW(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=bo[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=AW.includes(t)?t:bo[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function BW(i){return i==="block"||i==="underline"||i==="bar"}function ll(i,e=5){if(typeof i!="object")return i;let t=Array.isArray(i)?[]:{};for(let r in i)t[r]=e<=1?i[r]:i[r]&&ll(i[r],e-1);return t}var CO=Object.freeze({insertMode:!1}),$O=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),om=class extends tt{constructor(e,t,r){super(),this._bufferService=e,this._logService=t,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new we),this.onData=this._onData.event,this._onUserInput=this._register(new we),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new we),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new we),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=ll(CO),this.decPrivateModes=ll($O)}reset(){this.modes=ll(CO),this.decPrivateModes=ll($O)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(s=>s.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(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};om=Lt([Qe(0,Ei),Qe(1,uS),Qe(2,Di)],om);var PO={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:i=>i.button===4||i.action!==1?!1:(i.ctrl=!1,i.alt=!1,i.shift=!1,!0)},VT200:{events:19,restrict:i=>i.action!==32},DRAG:{events:23,restrict:i=>!(i.action===32&&i.button===3)},ANY:{events:31,restrict:i=>!0}};function Jd(i,e){let t=(i.ctrl?16:0)|(i.shift?4:0)|(i.alt?8:0);return i.button===4?(t|=64,t|=i.action):(t|=i.button&3,i.button&4&&(t|=64),i.button&8&&(t|=128),i.action===32?t|=32:i.action===0&&!e&&(t|=3)),t}var ef=String.fromCharCode,TO={DEFAULT:i=>{let e=[Jd(i,!1)+32,i.col+32,i.row+32];return e[0]>255||e[1]>255||e[2]>255?"":`\x1B[M${ef(e[0])}${ef(e[1])}${ef(e[2])}`},SGR:i=>{let e=i.action===0&&i.button!==4?"m":"M";return`\x1B[<${Jd(i,!0)};${i.col};${i.row}${e}`},SGR_PIXELS:i=>{let e=i.action===0&&i.button!==4?"m":"M";return`\x1B[<${Jd(i,!0)};${i.x};${i.y}${e}`}},am=class extends tt{constructor(i,e,t){super(),this._bufferService=i,this._coreService=e,this._optionsService=t,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new we),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(PO))this.addProtocol(r,PO[r]);for(let r of Object.keys(TO))this.addEncoding(r,TO[r]);this.reset()}addProtocol(i,e){this._protocols[i]=e}addEncoding(i,e){this._encodings[i]=e}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(i){if(!this._protocols[i])throw new Error(`unknown protocol "${i}"`);this._activeProtocol=i,this._onProtocolChange.fire(this._protocols[i].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(i){if(!this._encodings[i])throw new Error(`unknown encoding "${i}"`);this._activeEncoding=i}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(i,e,t){if(i.deltaY===0||i.shiftKey||e===void 0||t===void 0)return 0;let r=e/t,s=this._applyScrollModifier(i.deltaY,i);return i.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=r+0,Math.abs(i.deltaY)<50&&(s*=.3),this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):i.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(i,e){return e.altKey||e.ctrlKey||e.shiftKey?i*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:i*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(i){if(i.col<0||i.col>=this._bufferService.cols||i.row<0||i.row>=this._bufferService.rows||i.button===4&&i.action===32||i.button===3&&i.action!==32||i.button!==4&&(i.action===2||i.action===3)||(i.col++,i.row++,i.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,i,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(i))return!1;let e=this._encodings[this._activeEncoding](i);return e&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(e):this._coreService.triggerDataEvent(e,!0)),this._lastEvent=i,!0}explainEvents(i){return{down:!!(i&1),up:!!(i&2),drag:!!(i&4),move:!!(i&8),wheel:!!(i&16)}}_equalEvents(i,e,t){if(t){if(i.x!==e.x||i.y!==e.y)return!1}else if(i.col!==e.col||i.row!==e.row)return!1;return!(i.button!==e.button||i.action!==e.action||i.ctrl!==e.ctrl||i.alt!==e.alt||i.shift!==e.shift)}};am=Lt([Qe(0,Ei),Qe(1,oo),Qe(2,Di)],am);var tf=[[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]],LW=[[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]],Ut;function EW(i,e){let t=0,r=e.length-1,s;if(i<e[0][0]||i>e[r][1])return!1;for(;r>=t;)if(s=t+r>>1,i>e[s][1])t=s+1;else if(i<e[s][0])r=s-1;else return!0;return!1}var DW=class{constructor(){if(this.version="6",!Ut){Ut=new Uint8Array(65536),Ut.fill(1),Ut[0]=0,Ut.fill(0,1,32),Ut.fill(0,127,160),Ut.fill(2,4352,4448),Ut[9001]=2,Ut[9002]=2,Ut.fill(2,11904,42192),Ut[12351]=1,Ut.fill(2,44032,55204),Ut.fill(2,63744,64256),Ut.fill(2,65040,65050),Ut.fill(2,65072,65136),Ut.fill(2,65280,65377),Ut.fill(2,65504,65511);for(let e=0;e<tf.length;++e)Ut.fill(0,tf[e][0],tf[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Ut[e]:EW(e,LW)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let r=this.wcwidth(e),s=r===0&&t!==0;if(s){let n=Vn.extractWidth(t);n===0?s=!1:n>r&&(r=n)}return Vn.createPropertyValue(0,r,s)}},Vn=class Qh{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new we,this.onChange=this._onChange.event;let e=new DW;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!==0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,r=!1){return(e&16777215)<<3|(t&3)<<1|(r?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let t=0,r=0,s=e.length;for(let n=0;n<s;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=s)return t+this.wcwidth(o);let c=e.charCodeAt(n);56320<=c&&c<=57343?o=(o-55296)*1024+c-56320+65536:t+=this.wcwidth(c)}let a=this.charProperties(o,r),l=Qh.extractWidth(a);Qh.extractShouldJoin(a)&&(l-=Qh.extractWidth(r)),t+=l,r=a}return t}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},IW=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,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function MO(i){let e=i.buffer.lines.get(i.buffer.ybase+i.buffer.y-1)?.get(i.cols-1),t=i.buffer.lines.get(i.buffer.ybase+i.buffer.y);t&&e&&(t.isWrapped=e[3]!==0&&e[3]!==32)}var Ha=2147483647,zW=256,qS=class lm{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>zW)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(e){let t=new lm;if(!e.length)return t;for(let r=Array.isArray(e[0])?1:0;r<e.length;++r){let s=e[r];if(Array.isArray(s))for(let n=0;n<s.length;++n)t.addSubParam(s[n]);else t.addParam(s)}return t}clone(){let e=new lm(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let r=this._subParamsIdx[t]>>8,s=this._subParamsIdx[t]&255;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 new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>Ha?Ha:e}addSubParam(e){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>Ha?Ha:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,r=this._subParamsIdx[e]&255;return r-t>0?this._subParams.subarray(t,r):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let r=this._subParamsIdx[t]>>8,s=this._subParamsIdx[t]&255;s-r>0&&(e[t]=this._subParams.slice(r,s))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,s=r[t-1];r[t-1]=~s?Math.min(s*10+e,Ha):e}},Ua=[],NW=class{constructor(){this._state=0,this._active=Ua,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let s=r.indexOf(t);s!==-1&&r.splice(s,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=Ua}reset(){if(this._state===2)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=Ua,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Ua,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,r){if(!this._active.length)this._handlerFb(this._id,"PUT",Hu(e,t,r));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,r)}start(){this.reset(),this._state=1}put(e,t,r){if(this._state!==3){if(this._state===1)for(;t<r;){let s=e[t++];if(s===59){this._state=2,this._start();break}if(s<48||57<s){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+s-48}this._state===2&&r-t>0&&this._put(e,t,r)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let r=!1,s=this._active.length-1,n=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,r=t,n=this._stack.fallThrough,this._stack.paused=!1),!n&&r===!1){for(;s>=0&&(r=this._active[s].end(e),r!==!0);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),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,r}this._active=Ua,this._id=-1,this._state=0}}},Ki=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=Hu(e,t,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(r=>(this._data="",this._hitLimit=!1,r));return this._data="",this._hitLimit=!1,t}},Ya=[],WW=class{constructor(){this._handlers=Object.create(null),this._active=Ya,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Ya}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let s=r.indexOf(t);s!==-1&&r.splice(s,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=Ya,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Ya,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let r=this._active.length-1;r>=0;r--)this._active[r].hook(t)}put(e,t,r){if(!this._active.length)this._handlerFb(this._ident,"PUT",Hu(e,t,r));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,r)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let r=!1,s=this._active.length-1,n=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,r=t,n=this._stack.fallThrough,this._stack.paused=!1),!n&&r===!1){for(;s>=0&&(r=this._active[s].unhook(e),r!==!0);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),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,r}this._active=Ya,this._ident=0}},cl=new qS;cl.addParam(0);var QO=class{constructor(i){this._handler=i,this._data="",this._params=cl,this._hitLimit=!1}hook(i){this._params=i.length>1||i.params[0]?i.clone():cl,this._data="",this._hitLimit=!1}put(i,e,t){this._hitLimit||(this._data+=Hu(i,e,t),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(i){let e=!1;if(this._hitLimit)e=!1;else if(i&&(e=this._handler(this._data,this._params),e instanceof Promise))return e.then(t=>(this._params=cl,this._data="",this._hitLimit=!1,t));return this._params=cl,this._data="",this._hitLimit=!1,e}},ZW=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,r,s){this.table[t<<8|e]=r<<4|s}addMany(e,t,r,s){for(let n=0;n<e.length;n++)this.table[t<<8|e[n]]=r<<4|s}},pr=160,XW=(function(){let i=new ZW(4095),e=Array.apply(null,Array(256)).map((a,l)=>l),t=(a,l)=>e.slice(a,l),r=t(32,127),s=t(0,24);s.push(25),s.push.apply(s,t(28,32));let n=t(0,14),o;i.setDefault(1,0),i.addMany(r,0,2,0);for(o in n)i.addMany([24,26,153,154],o,3,0),i.addMany(t(128,144),o,3,0),i.addMany(t(144,152),o,3,0),i.add(156,o,0,0),i.add(27,o,11,1),i.add(157,o,4,8),i.addMany([152,158,159],o,0,7),i.add(155,o,11,3),i.add(144,o,11,9);return i.addMany(s,0,3,0),i.addMany(s,1,3,1),i.add(127,1,0,1),i.addMany(s,8,0,8),i.addMany(s,3,3,3),i.add(127,3,0,3),i.addMany(s,4,3,4),i.add(127,4,0,4),i.addMany(s,6,3,6),i.addMany(s,5,3,5),i.add(127,5,0,5),i.addMany(s,2,3,2),i.add(127,2,0,2),i.add(93,1,4,8),i.addMany(r,8,5,8),i.add(127,8,5,8),i.addMany([156,27,24,26,7],8,6,0),i.addMany(t(28,32),8,0,8),i.addMany([88,94,95],1,0,7),i.addMany(r,7,0,7),i.addMany(s,7,0,7),i.add(156,7,0,0),i.add(127,7,0,7),i.add(91,1,11,3),i.addMany(t(64,127),3,7,0),i.addMany(t(48,60),3,8,4),i.addMany([60,61,62,63],3,9,4),i.addMany(t(48,60),4,8,4),i.addMany(t(64,127),4,7,0),i.addMany([60,61,62,63],4,0,6),i.addMany(t(32,64),6,0,6),i.add(127,6,0,6),i.addMany(t(64,127),6,0,0),i.addMany(t(32,48),3,9,5),i.addMany(t(32,48),5,9,5),i.addMany(t(48,64),5,0,6),i.addMany(t(64,127),5,7,0),i.addMany(t(32,48),4,9,5),i.addMany(t(32,48),1,9,2),i.addMany(t(32,48),2,9,2),i.addMany(t(48,127),2,10,0),i.addMany(t(48,80),1,10,0),i.addMany(t(81,88),1,10,0),i.addMany([89,90,92],1,10,0),i.addMany(t(96,127),1,10,0),i.add(80,1,11,9),i.addMany(s,9,0,9),i.add(127,9,0,9),i.addMany(t(28,32),9,0,9),i.addMany(t(32,48),9,9,12),i.addMany(t(48,60),9,8,10),i.addMany([60,61,62,63],9,9,10),i.addMany(s,11,0,11),i.addMany(t(32,128),11,0,11),i.addMany(t(28,32),11,0,11),i.addMany(s,10,0,10),i.add(127,10,0,10),i.addMany(t(28,32),10,0,10),i.addMany(t(48,60),10,8,10),i.addMany([60,61,62,63],10,0,11),i.addMany(t(32,48),10,9,12),i.addMany(s,12,0,12),i.add(127,12,0,12),i.addMany(t(28,32),12,0,12),i.addMany(t(32,48),12,9,12),i.addMany(t(48,64),12,0,11),i.addMany(t(64,127),12,12,13),i.addMany(t(64,127),10,12,13),i.addMany(t(64,127),9,12,13),i.addMany(s,13,13,13),i.addMany(r,13,13,13),i.add(127,13,0,13),i.addMany([27,156,24,26],13,14,0),i.add(pr,0,2,0),i.add(pr,8,5,8),i.add(pr,6,0,6),i.add(pr,11,0,11),i.add(pr,13,13,13),i})(),FW=class extends tt{constructor(e=XW){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 qS,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,r,s)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,r)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(Pt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new NW),this._dcsParser=this._register(new WW),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let n=0;n<e.intermediates.length;++n){let o=e.intermediates.charCodeAt(n);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let s=e.final.charCodeAt(0);if(t[0]>s||s>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return r<<=8,r|=s,r}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let r=this._identifier(e,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let s=this._escHandlers[r];return s.push(t),{dispose:()=>{let n=s.indexOf(t);n!==-1&&s.splice(n,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,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let r=this._identifier(e);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let s=this._csiHandlers[r];return s.push(t),{dispose:()=>{let n=s.indexOf(t);n!==-1&&s.splice(n,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}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,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,r,s,n){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=r,this._parseStack.transition=s,this._parseStack.chunkPos=n}parse(e,t,r){let s=0,n=0,o=0,a;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let l=this._parseStack.handlers,c=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&c>-1){for(;c>=0&&(a=l[c](this._params),a!==!0);c--)if(a instanceof Promise)return this._parseStack.handlerPos=c,a}this._parseStack.handlers=[];break;case 4:if(r===!1&&c>-1){for(;c>=0&&(a=l[c](),a!==!0);c--)if(a instanceof Promise)return this._parseStack.handlerPos=c,a}this._parseStack.handlers=[];break;case 6:if(s=e[this._parseStack.chunkPos],a=this._dcsParser.unhook(s!==24&&s!==26,r),a)return a;s===27&&(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(s!==24&&s!==26,r),a)return a;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let l=o;l<t;++l){switch(s=e[l],n=this._transitions.table[this.currentState<<8|(s<160?s:pr)],n>>4){case 2:for(let f=l+1;;++f){if(f>=t||(s=e[f])<32||s>126&&s<pr){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(s=e[f])<32||s>126&&s<pr){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(s=e[f])<32||s>126&&s<pr){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(s=e[f])<32||s>126&&s<pr){this._printHandler(e,l,f),l=f-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:l,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let c=this._csiHandlers[this._collect<<8|s],h=c?c.length-1:-1;for(;h>=0&&(a=c[h](this._params),a!==!0);h--)if(a instanceof Promise)return this._preserveStack(3,c,h,n,l),a;h<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(++l<t&&(s=e[l])>47&&s<60);l--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let u=this._escHandlers[this._collect<<8|s],d=u?u.length-1:-1;for(;d>=0&&(a=u[d](),a!==!0);d--)if(a instanceof Promise)return this._preserveStack(4,u,d,n,l),a;d<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 f=l+1;;++f)if(f>=t||(s=e[f])===24||s===26||s===27||s>127&&s<pr){this._dcsParser.put(e,l,f),l=f-1;break}break;case 14:if(a=this._dcsParser.unhook(s!==24&&s!==26),a)return this._preserveStack(6,[],0,n,l),a;s===27&&(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 f=l+1;;f++)if(f>=t||(s=e[f])<32||s>127&&s<pr){this._oscParser.put(e,l,f),l=f-1;break}break;case 6:if(a=this._oscParser.end(s!==24&&s!==26),a)return this._preserveStack(5,[],0,n,l),a;s===27&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=n&15}}},VW=/^([\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})$/,qW=/^[\da-f]+$/;function AO(i){if(!i)return;let e=i.toLowerCase();if(e.indexOf("rgb:")===0){e=e.slice(4);let t=VW.exec(e);if(t){let r=t[1]?15:t[4]?255:t[7]?4095:65535;return[Math.round(parseInt(t[1]||t[4]||t[7]||t[10],16)/r*255),Math.round(parseInt(t[2]||t[5]||t[8]||t[11],16)/r*255),Math.round(parseInt(t[3]||t[6]||t[9]||t[12],16)/r*255)]}}else if(e.indexOf("#")===0&&(e=e.slice(1),qW.exec(e)&&[3,6,9,12].includes(e.length))){let t=e.length/3,r=[0,0,0];for(let s=0;s<3;++s){let n=parseInt(e.slice(t*s,t*s+t),16);r[s]=t===1?n<<4:t===2?n:t===3?n>>4:n>>8}return r}}function rf(i,e){let t=i.toString(16),r=t.length<2?"0"+t:t;switch(e){case 4:return t[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function HW(i,e=16){let[t,r,s]=i;return`rgb:${rf(t,e)}/${rf(r,e)}/${rf(s,e)}`}var UW={"(":0,")":1,"*":2,"+":3,"-":1,".":2},en=131072,RO=10;function BO(i,e){if(i>24)return e.setWinLines||!1;switch(i){case 1:return!!e.restoreWin;case 2:return!!e.minimizeWin;case 3:return!!e.setWinPosition;case 4:return!!e.setWinSizePixels;case 5:return!!e.raiseWin;case 6:return!!e.lowerWin;case 7:return!!e.refreshWin;case 8:return!!e.setWinSizeChars;case 9:return!!e.maximizeWin;case 10:return!!e.fullscreenWin;case 11:return!!e.getWinState;case 13:return!!e.getWinPosition;case 14:return!!e.getWinSizePixels;case 15:return!!e.getScreenSizePixels;case 16:return!!e.getCellSizePixels;case 18:return!!e.getWinSizeChars;case 19:return!!e.getScreenSizeChars;case 20:return!!e.getIconTitle;case 21:return!!e.getWinTitle;case 22:return!!e.pushTitle;case 23:return!!e.popTitle;case 24:return!!e.setWinLines}return!1}var LO=5e3,EO=0,YW=class extends tt{constructor(i,e,t,r,s,n,o,a,l=new FW){super(),this._bufferService=i,this._charsetService=e,this._coreService=t,this._logService=r,this._optionsService=s,this._oscLinkService=n,this._coreMouseService=o,this._unicodeService=a,this._parser=l,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new pz,this._utf8Decoder=new mz,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Wt.clone(),this._eraseAttrDataInternal=Wt.clone(),this._onRequestBell=this._register(new we),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new we),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new we),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new we),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new we),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new we),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new we),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new we),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new we),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new we),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new we),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new we),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new we),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 cm(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(c=>this._activeBuffer=c.activeBuffer)),this._parser.setCsiHandlerFallback((c,h)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(c),params:h.toArray()})}),this._parser.setEscHandlerFallback(c=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(c)})}),this._parser.setExecuteHandlerFallback(c=>{this._logService.debug("Unknown EXECUTE code: ",{code:c})}),this._parser.setOscHandlerFallback((c,h,u)=>{this._logService.debug("Unknown OSC code: ",{identifier:c,action:h,data:u})}),this._parser.setDcsHandlerFallback((c,h,u)=>{h==="HOOK"&&(u=u.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(c),action:h,payload:u})}),this._parser.setPrintHandler((c,h,u)=>this.print(c,h,u)),this._parser.registerCsiHandler({final:"@"},c=>this.insertChars(c)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},c=>this.scrollLeft(c)),this._parser.registerCsiHandler({final:"A"},c=>this.cursorUp(c)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},c=>this.scrollRight(c)),this._parser.registerCsiHandler({final:"B"},c=>this.cursorDown(c)),this._parser.registerCsiHandler({final:"C"},c=>this.cursorForward(c)),this._parser.registerCsiHandler({final:"D"},c=>this.cursorBackward(c)),this._parser.registerCsiHandler({final:"E"},c=>this.cursorNextLine(c)),this._parser.registerCsiHandler({final:"F"},c=>this.cursorPrecedingLine(c)),this._parser.registerCsiHandler({final:"G"},c=>this.cursorCharAbsolute(c)),this._parser.registerCsiHandler({final:"H"},c=>this.cursorPosition(c)),this._parser.registerCsiHandler({final:"I"},c=>this.cursorForwardTab(c)),this._parser.registerCsiHandler({final:"J"},c=>this.eraseInDisplay(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},c=>this.eraseInDisplay(c,!0)),this._parser.registerCsiHandler({final:"K"},c=>this.eraseInLine(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},c=>this.eraseInLine(c,!0)),this._parser.registerCsiHandler({final:"L"},c=>this.insertLines(c)),this._parser.registerCsiHandler({final:"M"},c=>this.deleteLines(c)),this._parser.registerCsiHandler({final:"P"},c=>this.deleteChars(c)),this._parser.registerCsiHandler({final:"S"},c=>this.scrollUp(c)),this._parser.registerCsiHandler({final:"T"},c=>this.scrollDown(c)),this._parser.registerCsiHandler({final:"X"},c=>this.eraseChars(c)),this._parser.registerCsiHandler({final:"Z"},c=>this.cursorBackwardTab(c)),this._parser.registerCsiHandler({final:"`"},c=>this.charPosAbsolute(c)),this._parser.registerCsiHandler({final:"a"},c=>this.hPositionRelative(c)),this._parser.registerCsiHandler({final:"b"},c=>this.repeatPrecedingCharacter(c)),this._parser.registerCsiHandler({final:"c"},c=>this.sendDeviceAttributesPrimary(c)),this._parser.registerCsiHandler({prefix:">",final:"c"},c=>this.sendDeviceAttributesSecondary(c)),this._parser.registerCsiHandler({final:"d"},c=>this.linePosAbsolute(c)),this._parser.registerCsiHandler({final:"e"},c=>this.vPositionRelative(c)),this._parser.registerCsiHandler({final:"f"},c=>this.hVPosition(c)),this._parser.registerCsiHandler({final:"g"},c=>this.tabClear(c)),this._parser.registerCsiHandler({final:"h"},c=>this.setMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"h"},c=>this.setModePrivate(c)),this._parser.registerCsiHandler({final:"l"},c=>this.resetMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"l"},c=>this.resetModePrivate(c)),this._parser.registerCsiHandler({final:"m"},c=>this.charAttributes(c)),this._parser.registerCsiHandler({final:"n"},c=>this.deviceStatus(c)),this._parser.registerCsiHandler({prefix:"?",final:"n"},c=>this.deviceStatusPrivate(c)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},c=>this.softReset(c)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},c=>this.setCursorStyle(c)),this._parser.registerCsiHandler({final:"r"},c=>this.setScrollRegion(c)),this._parser.registerCsiHandler({final:"s"},c=>this.saveCursor(c)),this._parser.registerCsiHandler({final:"t"},c=>this.windowOptions(c)),this._parser.registerCsiHandler({final:"u"},c=>this.restoreCursor(c)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},c=>this.insertColumns(c)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},c=>this.deleteColumns(c)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},c=>this.selectProtected(c)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},c=>this.requestMode(c,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},c=>this.requestMode(c,!1)),this._parser.setExecuteHandler(pe.BEL,()=>this.bell()),this._parser.setExecuteHandler(pe.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(pe.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(pe.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(pe.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(pe.BS,()=>this.backspace()),this._parser.setExecuteHandler(pe.HT,()=>this.tab()),this._parser.setExecuteHandler(pe.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(pe.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Th.IND,()=>this.index()),this._parser.setExecuteHandler(Th.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Th.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Ki(c=>(this.setTitle(c),this.setIconName(c),!0))),this._parser.registerOscHandler(1,new Ki(c=>this.setIconName(c))),this._parser.registerOscHandler(2,new Ki(c=>this.setTitle(c))),this._parser.registerOscHandler(4,new Ki(c=>this.setOrReportIndexedColor(c))),this._parser.registerOscHandler(8,new Ki(c=>this.setHyperlink(c))),this._parser.registerOscHandler(10,new Ki(c=>this.setOrReportFgColor(c))),this._parser.registerOscHandler(11,new Ki(c=>this.setOrReportBgColor(c))),this._parser.registerOscHandler(12,new Ki(c=>this.setOrReportCursorColor(c))),this._parser.registerOscHandler(104,new Ki(c=>this.restoreIndexedColor(c))),this._parser.registerOscHandler(110,new Ki(c=>this.restoreFgColor(c))),this._parser.registerOscHandler(111,new Ki(c=>this.restoreBgColor(c))),this._parser.registerOscHandler(112,new Ki(c=>this.restoreCursorColor(c))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let c in Kt)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(c=>(this._logService.error("Parsing error: ",c),c)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new QO((c,h)=>this.requestStatusString(c,h)))}getAttrData(){return this._curAttrData}_preserveStack(i,e,t,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=i,this._parseStack.cursorStartY=e,this._parseStack.decodedLength=t,this._parseStack.position=r}_logSlowResolvingAsync(i){this._logService.logLevel<=3&&Promise.race([i,new Promise((e,t)=>setTimeout(()=>t("#SLOW_TIMEOUT"),LO))]).catch(e=>{if(e!=="#SLOW_TIMEOUT")throw e;console.warn(`async parser handler taking longer than ${LO} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(i,e){let t,r=this._activeBuffer.x,s=this._activeBuffer.y,n=0,o=this._parseStack.paused;if(o){if(t=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,e))return this._logSlowResolvingAsync(t),t;r=this._parseStack.cursorStartX,s=this._parseStack.cursorStartY,this._parseStack.paused=!1,i.length>en&&(n=this._parseStack.position+en)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof i=="string"?` "${i}"`:` "${Array.prototype.map.call(i,c=>String.fromCharCode(c)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof i=="string"?i.split("").map(c=>c.charCodeAt(0)):i),this._parseBuffer.length<i.length&&this._parseBuffer.length<en&&(this._parseBuffer=new Uint32Array(Math.min(i.length,en))),o||this._dirtyRowTracker.clearRange(),i.length>en)for(let c=n;c<i.length;c+=en){let h=c+en<i.length?c+en:i.length,u=typeof i=="string"?this._stringDecoder.decode(i.substring(c,h),this._parseBuffer):this._utf8Decoder.decode(i.subarray(c,h),this._parseBuffer);if(t=this._parser.parse(this._parseBuffer,u))return this._preserveStack(r,s,u,c),this._logSlowResolvingAsync(t),t}else if(!o){let c=typeof i=="string"?this._stringDecoder.decode(i,this._parseBuffer):this._utf8Decoder.decode(i,this._parseBuffer);if(t=this._parser.parse(this._parseBuffer,c))return this._preserveStack(r,s,c,0),this._logSlowResolvingAsync(t),t}(this._activeBuffer.x!==r||this._activeBuffer.y!==s)&&this._onCursorMove.fire();let a=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),l=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);l<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(l,this._bufferService.rows-1),end:Math.min(a,this._bufferService.rows-1)})}print(i,e,t){let r,s,n=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,l=this._coreService.decPrivateModes.wraparound,c=this._coreService.modes.insertMode,h=this._curAttrData,u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&t-e>0&&u.getWidth(this._activeBuffer.x-1)===2&&u.setCellFromCodepoint(this._activeBuffer.x-1,0,1,h);let d=this._parser.precedingJoinState;for(let f=e;f<t;++f){if(r=i[f],r<127&&n){let _=n[String.fromCharCode(r)];_&&(r=_.charCodeAt(0))}let p=this._unicodeService.charProperties(r,d);s=Vn.extractWidth(p);let g=Vn.extractShouldJoin(p),O=g?Vn.extractWidth(d):0;if(d=p,o&&this._onA11yChar.fire(cn(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-O>a){if(l){let _=u,k=this._activeBuffer.x-O;for(this._activeBuffer.x=O,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),O>0&&u instanceof al&&u.copyCellsFrom(_,k,0,O,!1);k<a;)_.setCellFromCodepoint(k++,0,1,h)}else if(this._activeBuffer.x=a-1,s===2)continue}if(g&&this._activeBuffer.x){let _=u.getWidth(this._activeBuffer.x-1)?1:2;u.addCodepointToCell(this._activeBuffer.x-_,r,s);for(let k=s-O;--k>=0;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h);continue}if(c&&(u.insertCells(this._activeBuffer.x,s-O,this._activeBuffer.getNullCell(h)),u.getWidth(a-1)===2&&u.setCellFromCodepoint(a-1,0,1,h)),u.setCellFromCodepoint(this._activeBuffer.x++,r,s,h),s>0)for(;--s;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h)}this._parser.precedingJoinState=d,this._activeBuffer.x<a&&t-e>0&&u.getWidth(this._activeBuffer.x)===0&&!u.hasContent(this._activeBuffer.x)&&u.setCellFromCodepoint(this._activeBuffer.x,0,1,h),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(i,e){return i.final==="t"&&!i.prefix&&!i.intermediates?this._parser.registerCsiHandler(i,t=>BO(t.params[0],this._optionsService.rawOptions.windowOptions)?e(t):!0):this._parser.registerCsiHandler(i,e)}registerDcsHandler(i,e){return this._parser.registerDcsHandler(i,new QO(e))}registerEscHandler(i,e){return this._parser.registerEscHandler(i,e)}registerOscHandler(i,e){return this._parser.registerOscHandler(i,new Ki(e))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);i.hasWidth(this._activeBuffer.x)&&!i.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let i=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-i),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(i=this._bufferService.cols-1){this._activeBuffer.x=Math.min(i,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(i,e){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=i,this._activeBuffer.y=this._activeBuffer.scrollTop+e):(this._activeBuffer.x=i,this._activeBuffer.y=e),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(i,e){this._restrictCursor(),this._setCursor(this._activeBuffer.x+i,this._activeBuffer.y+e)}cursorUp(i){let e=this._activeBuffer.y-this._activeBuffer.scrollTop;return e>=0?this._moveCursor(0,-Math.min(e,i.params[0]||1)):this._moveCursor(0,-(i.params[0]||1)),!0}cursorDown(i){let e=this._activeBuffer.scrollBottom-this._activeBuffer.y;return e>=0?this._moveCursor(0,Math.min(e,i.params[0]||1)):this._moveCursor(0,i.params[0]||1),!0}cursorForward(i){return this._moveCursor(i.params[0]||1,0),!0}cursorBackward(i){return this._moveCursor(-(i.params[0]||1),0),!0}cursorNextLine(i){return this.cursorDown(i),this._activeBuffer.x=0,!0}cursorPrecedingLine(i){return this.cursorUp(i),this._activeBuffer.x=0,!0}cursorCharAbsolute(i){return this._setCursor((i.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(i){return this._setCursor(i.length>=2?(i.params[1]||1)-1:0,(i.params[0]||1)-1),!0}charPosAbsolute(i){return this._setCursor((i.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(i){return this._moveCursor(i.params[0]||1,0),!0}linePosAbsolute(i){return this._setCursor(this._activeBuffer.x,(i.params[0]||1)-1),!0}vPositionRelative(i){return this._moveCursor(0,i.params[0]||1),!0}hVPosition(i){return this.cursorPosition(i),!0}tabClear(i){let e=i.params[0];return e===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:e===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(i){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=i.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(i){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=i.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(i){let e=i.params[0];return e===1&&(this._curAttrData.bg|=536870912),(e===2||e===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(i,e,t,r=!1,s=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);n.replaceCells(e,t,this._activeBuffer.getNullCell(this._eraseAttrData()),s),r&&(n.isWrapped=!1)}_resetBufferLine(i,e=!1){let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);t&&(t.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),e),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+i),t.isWrapped=!1)}eraseInDisplay(i,e=!1){this._restrictCursor(this._bufferService.cols);let t;switch(i.params[0]){case 0:for(t=this._activeBuffer.y,this._dirtyRowTracker.markDirty(t),this._eraseInBufferLine(t++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);t<this._bufferService.rows;t++)this._resetBufferLine(t,e);this._dirtyRowTracker.markDirty(t);break;case 1:for(t=this._activeBuffer.y,this._dirtyRowTracker.markDirty(t),this._eraseInBufferLine(t,0,this._activeBuffer.x+1,!0,e),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(t+1).isWrapped=!1);t--;)this._resetBufferLine(t,e);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(t=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,t-1);t--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+t)?.getTrimmedLength(););for(;t>=0;t--)this._bufferService.scroll(this._eraseAttrData())}else{for(t=this._bufferService.rows,this._dirtyRowTracker.markDirty(t-1);t--;)this._resetBufferLine(t,e);this._dirtyRowTracker.markDirty(0)}break;case 3:let r=this._activeBuffer.lines.length-this._bufferService.rows;r>0&&(this._activeBuffer.lines.trimStart(r),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-r,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-r,0),this._onScroll.fire(0));break}return!0}eraseInLine(i,e=!1){switch(this._restrictCursor(this._bufferService.cols),i.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,e);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,e);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(i){this._restrictCursor();let e=i.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;e--;)this._activeBuffer.lines.splice(s-1,1),this._activeBuffer.lines.splice(t,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(i){this._restrictCursor();let e=i.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;e--;)this._activeBuffer.lines.splice(t,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}insertChars(i){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.insertCells(this._activeBuffer.x,i.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(i){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.deleteCells(this._activeBuffer.x,i.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(i){let e=i.params[0]||1;for(;e--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(i){let e=i.params[0]||1;for(;e--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Wt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(i){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=i.params[0]||1;for(let t=this._activeBuffer.scrollTop;t<=this._activeBuffer.scrollBottom;++t){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);r.deleteCells(0,e,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(i){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=i.params[0]||1;for(let t=this._activeBuffer.scrollTop;t<=this._activeBuffer.scrollBottom;++t){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);r.insertCells(0,e,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(i){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=i.params[0]||1;for(let t=this._activeBuffer.scrollTop;t<=this._activeBuffer.scrollBottom;++t){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);r.insertCells(this._activeBuffer.x,e,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(i){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=i.params[0]||1;for(let t=this._activeBuffer.scrollTop;t<=this._activeBuffer.scrollBottom;++t){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);r.deleteCells(this._activeBuffer.x,e,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(i){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(i.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(i){let e=this._parser.precedingJoinState;if(!e)return!0;let t=i.params[0]||1,r=Vn.extractWidth(e),s=this._activeBuffer.x-r,n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),o=new Uint32Array(n.length*t),a=0;for(let c=0;c<n.length;){let h=n.codePointAt(c)||0;o[a++]=h,c+=h>65535?2:1}let l=a;for(let c=1;c<t;++c)o.copyWithin(l,0,a),l+=a;return this.print(o,0,l),!0}sendDeviceAttributesPrimary(i){return i.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(pe.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(pe.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(i){return i.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(pe.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(pe.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(i.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(pe.ESC+"[>83;40003;0c")),!0}_is(i){return(this._optionsService.rawOptions.termName+"").indexOf(i)===0}setMode(i){for(let e=0;e<i.length;e++)switch(i.params[e]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(i){for(let e=0;e<i.length;e++)switch(i.params[e]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Dn),this._charsetService.setgCharset(1,Dn),this._charsetService.setgCharset(2,Dn),this._charsetService.setgCharset(3,Dn);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(i){for(let e=0;e<i.length;e++)switch(i.params[e]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(i){for(let e=0;e<i.length;e++)switch(i.params[e]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),i.params[e]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(i,e){let t;(g=>(g[g.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",g[g.SET=1]="SET",g[g.RESET=2]="RESET",g[g.PERMANENTLY_SET=3]="PERMANENTLY_SET",g[g.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(t||={});let r=this._coreService.decPrivateModes,{activeProtocol:s,activeEncoding:n}=this._coreMouseService,o=this._coreService,{buffers:a,cols:l}=this._bufferService,{active:c,alt:h}=a,u=this._optionsService.rawOptions,d=(g,O)=>(o.triggerDataEvent(`${pe.ESC}[${e?"":"?"}${g};${O}$y`),!0),f=g=>g?1:2,p=i.params[0];return e?p===2?d(p,4):p===4?d(p,f(o.modes.insertMode)):p===12?d(p,3):p===20?d(p,f(u.convertEol)):d(p,0):p===1?d(p,f(r.applicationCursorKeys)):p===3?d(p,u.windowOptions.setWinLines?l===80?2:l===132?1:0:0):p===6?d(p,f(r.origin)):p===7?d(p,f(r.wraparound)):p===8?d(p,3):p===9?d(p,f(s==="X10")):p===12?d(p,f(u.cursorBlink)):p===25?d(p,f(!o.isCursorHidden)):p===45?d(p,f(r.reverseWraparound)):p===66?d(p,f(r.applicationKeypad)):p===67?d(p,4):p===1e3?d(p,f(s==="VT200")):p===1002?d(p,f(s==="DRAG")):p===1003?d(p,f(s==="ANY")):p===1004?d(p,f(r.sendFocus)):p===1005?d(p,4):p===1006?d(p,f(n==="SGR")):p===1015?d(p,4):p===1016?d(p,f(n==="SGR_PIXELS")):p===1048?d(p,1):p===47||p===1047||p===1049?d(p,f(c===h)):p===2004?d(p,f(r.bracketedPasteMode)):p===2026?d(p,f(r.synchronizedOutput)):d(p,0)}_updateAttrColor(i,e,t,r,s){return e===2?(i|=50331648,i&=-16777216,i|=pc.fromColorRGB([t,r,s])):e===5&&(i&=-50331904,i|=33554432|t&255),i}_extractColor(i,e,t){let r=[0,0,-1,0,0,0],s=0,n=0;do{if(r[n+s]=i.params[e+n],i.hasSubParams(e+n)){let o=i.getSubParams(e+n),a=0;do r[1]===5&&(s=1),r[n+a+1+s]=o[a];while(++a<o.length&&a+n+1+s<r.length);break}if(r[1]===5&&n+s>=2||r[1]===2&&n+s>=5)break;r[1]&&(s=1)}while(++n+e<i.length&&n+s<r.length);for(let o=2;o<r.length;++o)r[o]===-1&&(r[o]=0);switch(r[0]){case 38:t.fg=this._updateAttrColor(t.fg,r[1],r[3],r[4],r[5]);break;case 48:t.bg=this._updateAttrColor(t.bg,r[1],r[3],r[4],r[5]);break;case 58:t.extended=t.extended.clone(),t.extended.underlineColor=this._updateAttrColor(t.extended.underlineColor,r[1],r[3],r[4],r[5])}return n}_processUnderline(i,e){e.extended=e.extended.clone(),(!~i||i>5)&&(i=1),e.extended.underlineStyle=i,e.fg|=268435456,i===0&&(e.fg&=-268435457),e.updateExtended()}_processSGR0(i){i.fg=Wt.fg,i.bg=Wt.bg,i.extended=i.extended.clone(),i.extended.underlineStyle=0,i.extended.underlineColor&=-67108864,i.updateExtended()}charAttributes(i){if(i.length===1&&i.params[0]===0)return this._processSGR0(this._curAttrData),!0;let e=i.length,t,r=this._curAttrData;for(let s=0;s<e;s++)t=i.params[s],t>=30&&t<=37?(r.fg&=-50331904,r.fg|=16777216|t-30):t>=40&&t<=47?(r.bg&=-50331904,r.bg|=16777216|t-40):t>=90&&t<=97?(r.fg&=-50331904,r.fg|=16777216|t-90|8):t>=100&&t<=107?(r.bg&=-50331904,r.bg|=16777216|t-100|8):t===0?this._processSGR0(r):t===1?r.fg|=134217728:t===3?r.bg|=67108864:t===4?(r.fg|=268435456,this._processUnderline(i.hasSubParams(s)?i.getSubParams(s)[0]:1,r)):t===5?r.fg|=536870912:t===7?r.fg|=67108864:t===8?r.fg|=1073741824:t===9?r.fg|=2147483648:t===2?r.bg|=134217728:t===21?this._processUnderline(2,r):t===22?(r.fg&=-134217729,r.bg&=-134217729):t===23?r.bg&=-67108865:t===24?(r.fg&=-268435457,this._processUnderline(0,r)):t===25?r.fg&=-536870913:t===27?r.fg&=-67108865:t===28?r.fg&=-1073741825:t===29?r.fg&=2147483647:t===39?(r.fg&=-67108864,r.fg|=Wt.fg&16777215):t===49?(r.bg&=-67108864,r.bg|=Wt.bg&16777215):t===38||t===48||t===58?s+=this._extractColor(i,s,r):t===53?r.bg|=1073741824:t===55?r.bg&=-1073741825:t===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):t===100?(r.fg&=-67108864,r.fg|=Wt.fg&16777215,r.bg&=-67108864,r.bg|=Wt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",t);return!0}deviceStatus(i){switch(i.params[0]){case 5:this._coreService.triggerDataEvent(`${pe.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${pe.ESC}[${e};${t}R`);break}return!0}deviceStatusPrivate(i){if(i.params[0]===6){let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${pe.ESC}[?${e};${t}R`)}return!0}softReset(i){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Wt.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(i){let e=i.length===0?1:i.params[0];if(e===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(e){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let t=e%2===1;this._coreService.decPrivateModes.cursorBlink=t}return!0}setScrollRegion(i){let e=i.params[0]||1,t;return(i.length<2||(t=i.params[1])>this._bufferService.rows||t===0)&&(t=this._bufferService.rows),t>e&&(this._activeBuffer.scrollTop=e-1,this._activeBuffer.scrollBottom=t-1,this._setCursor(0,0)),!0}windowOptions(i){if(!BO(i.params[0],this._optionsService.rawOptions.windowOptions))return!0;let e=i.length>1?i.params[1]:0;switch(i.params[0]){case 14:e!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${pe.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(e===0||e===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>RO&&this._windowTitleStack.shift()),(e===0||e===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>RO&&this._iconNameStack.shift());break;case 23:(e===0||e===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(e===0||e===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(i){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(i){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(i){return this._windowTitle=i,this._onTitleChange.fire(i),!0}setIconName(i){return this._iconName=i,!0}setOrReportIndexedColor(i){let e=[],t=i.split(";");for(;t.length>1;){let r=t.shift(),s=t.shift();if(/^\d+$/.exec(r)){let n=parseInt(r);if(DO(n))if(s==="?")e.push({type:0,index:n});else{let o=AO(s);o&&e.push({type:1,index:n,color:o})}}}return e.length&&this._onColor.fire(e),!0}setHyperlink(i){let e=i.indexOf(";");if(e===-1)return!0;let t=i.slice(0,e).trim(),r=i.slice(e+1);return r?this._createHyperlink(t,r):t.trim()?!1:this._finishHyperlink()}_createHyperlink(i,e){this._getCurrentLinkId()&&this._finishHyperlink();let t=i.split(":"),r,s=t.findIndex(n=>n.startsWith("id="));return s!==-1&&(r=t[s].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:e}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(i,e){let t=i.split(";");for(let r=0;r<t.length&&!(e>=this._specialColors.length);++r,++e)if(t[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[e]}]);else{let s=AO(t[r]);s&&this._onColor.fire([{type:1,index:this._specialColors[e],color:s}])}return!0}setOrReportFgColor(i){return this._setOrReportSpecialColor(i,0)}setOrReportBgColor(i){return this._setOrReportSpecialColor(i,1)}setOrReportCursorColor(i){return this._setOrReportSpecialColor(i,2)}restoreIndexedColor(i){if(!i)return this._onColor.fire([{type:2}]),!0;let e=[],t=i.split(";");for(let r=0;r<t.length;++r)if(/^\d+$/.exec(t[r])){let s=parseInt(t[r]);DO(s)&&e.push({type:2,index:s})}return e.length&&this._onColor.fire(e),!0}restoreFgColor(i){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(i){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(i){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,Dn),!0}selectCharset(i){return i.length!==2?(this.selectDefaultCharset(),!0):(i[0]==="/"||this._charsetService.setgCharset(UW[i[0]],Kt[i[1]]||Dn),!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 i=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,i,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=Wt.clone(),this._eraseAttrDataInternal=Wt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(i){return this._charsetService.setgLevel(i),!0}screenAlignmentPattern(){let i=new xr;i.content=1<<22|69,i.fg=this._curAttrData.fg,i.bg=this._curAttrData.bg,this._setCursor(0,0);for(let e=0;e<this._bufferService.rows;++e){let t=this._activeBuffer.ybase+this._activeBuffer.y+e,r=this._activeBuffer.lines.get(t);r&&(r.fill(i),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(i,e){let t=o=>(this._coreService.triggerDataEvent(`${pe.ESC}${o}${pe.ESC}\\`),!0),r=this._bufferService.buffer,s=this._optionsService.rawOptions;return t(i==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:i==='"p'?'P1$r61;1"p':i==="r"?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:i==="m"?"P1$r0m":i===" q"?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(i,e){this._dirtyRowTracker.markRangeDirty(i,e)}},cm=class{constructor(i){this._bufferService=i,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(i){i<this.start?this.start=i:i>this.end&&(this.end=i)}markRangeDirty(i,e){i>e&&(EO=i,i=e,e=EO),i<this.start&&(this.start=i),e>this.end&&(this.end=e)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};cm=Lt([Qe(0,Ei)],cm);function DO(i){return 0<=i&&i<256}var jW=5e7,IO=12,GW=50,KW=class extends tt{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 we),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let r;for(;r=this._writeBuffer.shift();){this._action(r);let s=this._callbacks.shift();s&&s()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>jW)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let s=this._writeBuffer[this._bufferOffset],n=this._action(s,t);if(n){let a=l=>performance.now()-r>=IO?setTimeout(()=>this._innerWrite(0,l)):this._innerWrite(r,l);n.catch(l=>(queueMicrotask(()=>{throw l}),Promise.resolve(!1))).then(a);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=s.length,performance.now()-r>=IO)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>GW&&(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()}},hm=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let l=t.addMarker(t.ybase+t.y),c={data:e,id:this._nextId++,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(c,l)),this._dataByLinkId.set(c.id,c),c.id}let r=e,s=this._getEntryIdKey(r),n=this._entriesWithId.get(s);if(n)return this.addLineToLink(n.id,t.ybase+t.y),n.id;let o=t.addMarker(t.ybase+t.y),a={id:this._nextId++,key:this._getEntryIdKey(r),data:r,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(a,o)),this._entriesWithId.set(a.key,a),this._dataByLinkId.set(a.id,a),a.id}addLineToLink(e,t){let r=this._dataByLinkId.get(e);if(r&&r.lines.every(s=>s.line!==t)){let s=this._bufferService.buffer.addMarker(t);r.lines.push(s),s.onDispose(()=>this._removeMarkerFromLink(r,s))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let r=e.lines.indexOf(t);r!==-1&&(e.lines.splice(r,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};hm=Lt([Qe(0,Ei)],hm);var zO=!1,JW=class extends tt{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new ia),this._onBinary=this._register(new we),this.onBinary=this._onBinary.event,this._onData=this._register(new we),this.onData=this._onData.event,this._onLineFeed=this._register(new we),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new we),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new we),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new we),this._instantiationService=new wW,this.optionsService=this._register(new RW(e)),this._instantiationService.setService(Di,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(nm)),this._instantiationService.setService(Ei,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(sm)),this._instantiationService.setService(uS,this._logService),this.coreService=this._register(this._instantiationService.createInstance(om)),this._instantiationService.setService(oo,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(am)),this._instantiationService.setService(hS,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Vn)),this._instantiationService.setService(_z,this.unicodeService),this._charsetService=this._instantiationService.createInstance(IW),this._instantiationService.setService(Oz,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(hm),this._instantiationService.setService(dS,this._oscLinkService),this._inputHandler=this._register(new YW(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Oi.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Oi.forward(this._bufferService.onResize,this._onResize)),this._register(Oi.forward(this.coreService.onData,this._onData)),this._register(Oi.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 KW((t,r)=>this._inputHandler.parse(t,r))),this._register(Oi.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new we),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 t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!zO&&(this._logService.warn("writeSync is unreliable and will be removed soon."),zO=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,FS),t=Math.max(t,VS),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}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 t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.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(MO.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(MO(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Pt(()=>{for(let t of e)t.dispose()})}}},eZ={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function tZ(i,e,t,r){let s={type:0,cancel:!1,key:void 0},n=(i.shiftKey?1:0)|(i.altKey?2:0)|(i.ctrlKey?4:0)|(i.metaKey?8:0);switch(i.keyCode){case 0:i.key==="UIKeyInputUpArrow"?e?s.key=pe.ESC+"OA":s.key=pe.ESC+"[A":i.key==="UIKeyInputLeftArrow"?e?s.key=pe.ESC+"OD":s.key=pe.ESC+"[D":i.key==="UIKeyInputRightArrow"?e?s.key=pe.ESC+"OC":s.key=pe.ESC+"[C":i.key==="UIKeyInputDownArrow"&&(e?s.key=pe.ESC+"OB":s.key=pe.ESC+"[B");break;case 8:s.key=i.ctrlKey?"\b":pe.DEL,i.altKey&&(s.key=pe.ESC+s.key);break;case 9:if(i.shiftKey){s.key=pe.ESC+"[Z";break}s.key=pe.HT,s.cancel=!0;break;case 13:s.key=i.altKey?pe.ESC+pe.CR:pe.CR,s.cancel=!0;break;case 27:s.key=pe.ESC,i.altKey&&(s.key=pe.ESC+pe.ESC),s.cancel=!0;break;case 37:if(i.metaKey)break;n?s.key=pe.ESC+"[1;"+(n+1)+"D":e?s.key=pe.ESC+"OD":s.key=pe.ESC+"[D";break;case 39:if(i.metaKey)break;n?s.key=pe.ESC+"[1;"+(n+1)+"C":e?s.key=pe.ESC+"OC":s.key=pe.ESC+"[C";break;case 38:if(i.metaKey)break;n?s.key=pe.ESC+"[1;"+(n+1)+"A":e?s.key=pe.ESC+"OA":s.key=pe.ESC+"[A";break;case 40:if(i.metaKey)break;n?s.key=pe.ESC+"[1;"+(n+1)+"B":e?s.key=pe.ESC+"OB":s.key=pe.ESC+"[B";break;case 45:!i.shiftKey&&!i.ctrlKey&&(s.key=pe.ESC+"[2~");break;case 46:n?s.key=pe.ESC+"[3;"+(n+1)+"~":s.key=pe.ESC+"[3~";break;case 36:n?s.key=pe.ESC+"[1;"+(n+1)+"H":e?s.key=pe.ESC+"OH":s.key=pe.ESC+"[H";break;case 35:n?s.key=pe.ESC+"[1;"+(n+1)+"F":e?s.key=pe.ESC+"OF":s.key=pe.ESC+"[F";break;case 33:i.shiftKey?s.type=2:i.ctrlKey?s.key=pe.ESC+"[5;"+(n+1)+"~":s.key=pe.ESC+"[5~";break;case 34:i.shiftKey?s.type=3:i.ctrlKey?s.key=pe.ESC+"[6;"+(n+1)+"~":s.key=pe.ESC+"[6~";break;case 112:n?s.key=pe.ESC+"[1;"+(n+1)+"P":s.key=pe.ESC+"OP";break;case 113:n?s.key=pe.ESC+"[1;"+(n+1)+"Q":s.key=pe.ESC+"OQ";break;case 114:n?s.key=pe.ESC+"[1;"+(n+1)+"R":s.key=pe.ESC+"OR";break;case 115:n?s.key=pe.ESC+"[1;"+(n+1)+"S":s.key=pe.ESC+"OS";break;case 116:n?s.key=pe.ESC+"[15;"+(n+1)+"~":s.key=pe.ESC+"[15~";break;case 117:n?s.key=pe.ESC+"[17;"+(n+1)+"~":s.key=pe.ESC+"[17~";break;case 118:n?s.key=pe.ESC+"[18;"+(n+1)+"~":s.key=pe.ESC+"[18~";break;case 119:n?s.key=pe.ESC+"[19;"+(n+1)+"~":s.key=pe.ESC+"[19~";break;case 120:n?s.key=pe.ESC+"[20;"+(n+1)+"~":s.key=pe.ESC+"[20~";break;case 121:n?s.key=pe.ESC+"[21;"+(n+1)+"~":s.key=pe.ESC+"[21~";break;case 122:n?s.key=pe.ESC+"[23;"+(n+1)+"~":s.key=pe.ESC+"[23~";break;case 123:n?s.key=pe.ESC+"[24;"+(n+1)+"~":s.key=pe.ESC+"[24~";break;default:if(i.ctrlKey&&!i.shiftKey&&!i.altKey&&!i.metaKey)i.keyCode>=65&&i.keyCode<=90?s.key=String.fromCharCode(i.keyCode-64):i.keyCode===32?s.key=pe.NUL:i.keyCode>=51&&i.keyCode<=55?s.key=String.fromCharCode(i.keyCode-51+27):i.keyCode===56?s.key=pe.DEL:i.keyCode===219?s.key=pe.ESC:i.keyCode===220?s.key=pe.FS:i.keyCode===221&&(s.key=pe.GS);else if((!t||r)&&i.altKey&&!i.metaKey){let o=eZ[i.keyCode]?.[i.shiftKey?1:0];if(o)s.key=pe.ESC+o;else if(i.keyCode>=65&&i.keyCode<=90){let a=i.ctrlKey?i.keyCode-64:i.keyCode+32,l=String.fromCharCode(a);i.shiftKey&&(l=l.toUpperCase()),s.key=pe.ESC+l}else if(i.keyCode===32)s.key=pe.ESC+(i.ctrlKey?pe.NUL:" ");else if(i.key==="Dead"&&i.code.startsWith("Key")){let a=i.code.slice(3,4);i.shiftKey||(a=a.toLowerCase()),s.key=pe.ESC+a,s.cancel=!0}}else t&&!i.altKey&&!i.ctrlKey&&!i.shiftKey&&i.metaKey?i.keyCode===65&&(s.type=1):i.key&&!i.ctrlKey&&!i.altKey&&!i.metaKey&&i.keyCode>=48&&i.key.length===1?s.key=i.key:i.key&&i.ctrlKey&&(i.key==="_"&&(s.key=pe.US),i.key==="@"&&(s.key=pe.NUL));break}return s}var Et=0,iZ=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new wu,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new wu,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(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((n,o)=>this._getKey(n)-this._getKey(o)),t=0,r=0,s=new Array(this._array.length+this._insertedValues.length);for(let n=0;n<s.length;n++)r>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[r])?(s[n]=e[t],t++):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(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(Et=this._search(t),Et===-1)||this._getKey(this._array[Et])!==t)return!1;do if(this._array[Et]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Et),!0;while(++Et<this._array.length&&this._getKey(this._array[Et])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((n,o)=>n-o),t=0,r=new Array(this._array.length-e.length),s=0;for(let n=0;n<this._array.length;n++)e[t]===n?t++: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(),this._array.length!==0&&(Et=this._search(e),!(Et<0||Et>=this._array.length)&&this._getKey(this._array[Et])===e))do yield this._array[Et];while(++Et<this._array.length&&this._getKey(this._array[Et])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Et=this._search(e),!(Et<0||Et>=this._array.length)&&this._getKey(this._array[Et])===e))do t(this._array[Et]);while(++Et<this._array.length&&this._getKey(this._array[Et])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,r=this._array.length-1;for(;r>=t;){let s=t+r>>1,n=this._getKey(this._array[s]);if(n>e)r=s-1;else if(n<e)t=s+1;else{for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}}return t}},sf=0,NO=0,rZ=class extends tt{constructor(){super(),this._decorations=new iZ(i=>i?.marker.line),this._onDecorationRegistered=this._register(new we),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new we),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Pt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(i){if(i.marker.isDisposed)return;let e=new sZ(i);if(e){let t=e.marker.onDispose(()=>e.dispose()),r=e.onDispose(()=>{r.dispose(),e&&(this._decorations.delete(e)&&this._onDecorationRemoved.fire(e),t.dispose())});this._decorations.insert(e),this._onDecorationRegistered.fire(e)}return e}reset(){for(let i of this._decorations.values())i.dispose();this._decorations.clear()}*getDecorationsAtCell(i,e,t){let r=0,s=0;for(let n of this._decorations.getKeyIterator(e))r=n.options.x??0,s=r+(n.options.width??1),i>=r&&i<s&&(!t||(n.options.layer??"bottom")===t)&&(yield n)}forEachDecorationAtCell(i,e,t,r){this._decorations.forEachByKey(e,s=>{sf=s.options.x??0,NO=sf+(s.options.width??1),i>=sf&&i<NO&&(!t||(s.options.layer??"bottom")===t)&&r(s)})}},sZ=class extends mn{constructor(i){super(),this.options=i,this.onRenderEmitter=this.add(new we),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new we),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=i.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Mt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Mt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},nZ=1e3,oZ=class{constructor(e,t=nZ){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,r){this._rowCount=r,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){let n=s-this._lastRefreshMs,o=this._debounceThresholdMS-n;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},WO=20,Su=class extends tt{constructor(i,e,t,r){super(),this._terminal=i,this._coreBrowserService=t,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let s=this._coreBrowserService.mainDocument;this._accessibilityContainer=s.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=s.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let n=0;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);if(this._topBoundaryFocusListener=n=>this._handleBoundaryFocus(n,0),this._bottomBoundaryFocusListener=n=>this._handleBoundaryFocus(n,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=s.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new oZ(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(n=>this._handleResize(n.rows))),this._register(this._terminal.onRender(n=>this._refreshRows(n.start,n.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(n=>this._handleChar(n))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
79
+ `))),this._register(this._terminal.onA11yTab(n=>this._handleTab(n))),this._register(this._terminal.onKey(n=>this._handleKey(n.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(qe(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Pt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(i){for(let e=0;e<i;e++)this._handleChar(" ")}_handleChar(i){this._liveRegionLineCount<WO+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==i&&(this._charsToAnnounce+=i):this._charsToAnnounce+=i,i===`
80
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===WO+1&&(this._liveRegion.textContent+=Mp.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(i){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(i)||this._charsToConsume.push(i)}_refreshRows(i,e){this._liveRegionDebouncer.refresh(i,e,this._terminal.rows)}_renderRows(i,e){let t=this._terminal.buffer,r=t.lines.length.toString();for(let s=i;s<=e;s++){let n=t.lines.get(t.ydisp+s),o=[],a=n?.translateToString(!0,void 0,void 0,o)||"",l=(t.ydisp+s+1).toString(),c=this._rowElements[s];c&&(a.length===0?(c.textContent=" ",this._rowColumns.set(c,[0,1])):(c.textContent=a,this._rowColumns.set(c,o)),c.setAttribute("aria-posinset",l),c.setAttribute("aria-setsize",r),this._alignRowWidth(c))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(i,e){let t=i.target,r=this._rowElements[e===0?1:this._rowElements.length-2],s=t.getAttribute("aria-posinset"),n=e===0?"1":`${this._terminal.buffer.lines.length}`;if(s===n||i.relatedTarget!==r)return;let o,a;if(e===0?(o=t,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(o=this._rowElements.shift(),a=t,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),a.removeEventListener("focus",this._bottomBoundaryFocusListener),e===0){let l=this._createAccessibilityTreeNode();this._rowElements.unshift(l),this._rowContainer.insertAdjacentElement("afterbegin",l)}else{let l=this._createAccessibilityTreeNode();this._rowElements.push(l),this._rowContainer.appendChild(l)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(e===0?-1:1),this._rowElements[e===0?1:this._rowElements.length-2].focus(),i.preventDefault(),i.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let i=this._coreBrowserService.mainDocument.getSelection();if(!i)return;if(i.isCollapsed){this._rowContainer.contains(i.anchorNode)&&this._terminal.clearSelection();return}if(!i.anchorNode||!i.focusNode){console.error("anchorNode and/or focusNode are null");return}let e={node:i.anchorNode,offset:i.anchorOffset},t={node:i.focusNode,offset:i.focusOffset};if((e.node.compareDocumentPosition(t.node)&Node.DOCUMENT_POSITION_PRECEDING||e.node===t.node&&e.offset>t.offset)&&([e,t]=[t,e]),e.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(e={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(e.node))return;let r=this._rowElements.slice(-1)[0];if(t.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(t={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(t.node))return;let s=({node:a,offset:l})=>{let c=a instanceof Text?a.parentNode:a,h=parseInt(c?.getAttribute("aria-posinset"),10)-1;if(isNaN(h))return console.warn("row is invalid. Race condition?"),null;let u=this._rowColumns.get(c);if(!u)return console.warn("columns is null. Race condition?"),null;let d=l<u.length?u[l]:u.slice(-1)[0]+1;return d>=this._terminal.cols&&(++h,d=0),{row:h,column:d}},n=s(e),o=s(t);if(!(!n||!o)){if(n.row>o.row||n.row===o.row&&n.column>=o.column)throw new Error("invalid range");this._terminal.select(n.column,n.row,(o.row-n.row)*this._terminal.cols-n.column+o.column)}}_handleResize(i){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>i;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let i=this._coreBrowserService.mainDocument.createElement("div");return i.setAttribute("role","listitem"),i.tabIndex=-1,this._refreshRowDimensions(i),i}_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 i=0;i<this._terminal.rows;i++)this._refreshRowDimensions(this._rowElements[i]),this._alignRowWidth(this._rowElements[i])}}_refreshRowDimensions(i){i.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(i){i.style.transform="";let e=i.getBoundingClientRect().width,t=this._rowColumns.get(i)?.slice(-1)?.[0];if(!t)return;let r=t*this._renderService.dimensions.css.cell.width;i.style.transform=`scaleX(${r/e})`}};Su=Lt([Qe(1,Qg),Qe(2,Zs),Qe(3,Xs)],Su);var um=class extends tt{constructor(i,e,t,r,s){super(),this._element=i,this._mouseService=e,this._renderService=t,this._bufferService=r,this._linkProviderService=s,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new we),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new we),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Pt(()=>{so(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(qe(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(qe(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(qe(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(qe(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(i){this._lastMouseEvent=i;let e=this._positionFromMouseEvent(i,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;let t=i.composedPath();for(let r=0;r<t.length;r++){let s=t[r];if(s.classList.contains("xterm"))break;if(s.classList.contains("xterm-hover"))return}(!this._lastBufferCell||e.x!==this._lastBufferCell.x||e.y!==this._lastBufferCell.y)&&(this._handleHover(e),this._lastBufferCell=e)}_handleHover(i){if(this._activeLine!==i.y||this._wasResized){this._clearCurrentLink(),this._askForLink(i,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,i)||(this._clearCurrentLink(),this._askForLink(i,!0))}_askForLink(i,e){(!this._activeProviderReplies||!e)&&(this._activeProviderReplies?.forEach(r=>{r?.forEach(s=>{s.link.dispose&&s.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=i.y);let t=!1;for(let[r,s]of this._linkProviderService.linkProviders.entries())e?this._activeProviderReplies?.get(r)&&(t=this._checkLinkProviderResult(r,i,t)):s.provideLinks(i.y,n=>{if(this._isMouseOut)return;let o=n?.map(a=>({link:a}));this._activeProviderReplies?.set(r,o),t=this._checkLinkProviderResult(r,i,t),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(i.y,this._activeProviderReplies)})}_removeIntersectingLinks(i,e){let t=new Set;for(let r=0;r<e.size;r++){let s=e.get(r);if(s)for(let n=0;n<s.length;n++){let o=s[n],a=o.link.range.start.y<i?0:o.link.range.start.x,l=o.link.range.end.y>i?this._bufferService.cols:o.link.range.end.x;for(let c=a;c<=l;c++){if(t.has(c)){s.splice(n--,1);break}t.add(c)}}}}_checkLinkProviderResult(i,e,t){if(!this._activeProviderReplies)return t;let r=this._activeProviderReplies.get(i),s=!1;for(let n=0;n<i;n++)(!this._activeProviderReplies.has(n)||this._activeProviderReplies.get(n))&&(s=!0);if(!s&&r){let n=r.find(o=>this._linkAtPosition(o.link,e));n&&(t=!0,this._handleNewLink(n))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!t)for(let n=0;n<this._activeProviderReplies.size;n++){let o=this._activeProviderReplies.get(n)?.find(a=>this._linkAtPosition(a.link,e));if(o){t=!0,this._handleNewLink(o);break}}return t}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(i){if(!this._currentLink)return;let e=this._positionFromMouseEvent(i,this._element,this._mouseService);e&&this._mouseDownLink&&aZ(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(i,this._currentLink.link.text)}_clearCurrentLink(i,e){!this._currentLink||!this._lastMouseEvent||(!i||!e||this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,so(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(i){if(!this._lastMouseEvent)return;let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(i.link,e)&&(this._currentLink=i,this._currentLink.state={decorations:{underline:i.link.decorations===void 0?!0:i.link.decorations.underline,pointerCursor:i.link.decorations===void 0?!0:i.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,i.link,this._lastMouseEvent),i.link.decorations={},Object.defineProperties(i.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:t=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==t&&(this._currentLink.state.decorations.pointerCursor=t,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",t))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(i.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(t=>{if(!this._currentLink)return;let r=t.start===0?0:t.start+1+this._bufferService.buffer.ydisp,s=this._bufferService.buffer.ydisp+1+t.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=s&&(this._clearCurrentLink(r,s),this._lastMouseEvent)){let n=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);n&&this._askForLink(n,!1)}})))}_linkHover(i,e,t){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&i.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(t,e.text)}_fireUnderlineEvent(i,e){let t=i.range,r=this._bufferService.buffer.ydisp,s=this._createLinkUnderlineEvent(t.start.x-1,t.start.y-r-1,t.end.x,t.end.y-r-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(s)}_linkLeave(i,e,t){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&i.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(t,e.text)}_linkAtPosition(i,e){let t=i.range.start.y*this._bufferService.cols+i.range.start.x,r=i.range.end.y*this._bufferService.cols+i.range.end.x,s=e.y*this._bufferService.cols+e.x;return t<=s&&s<=r}_positionFromMouseEvent(i,e,t){let r=t.getCoords(i,e,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(i,e,t,r,s){return{x1:i,y1:e,x2:t,y2:r,cols:this._bufferService.cols,fg:s}}};um=Lt([Qe(1,Ag),Qe(2,Xs),Qe(3,Ei),Qe(4,pS)],um);function aZ(i,e){return i.text===e.text&&i.range.start.x===e.range.start.x&&i.range.start.y===e.range.start.y&&i.range.end.x===e.range.end.x&&i.range.end.y===e.range.end.y}var lZ=class extends JW{constructor(e={}){super(e),this._linkifier=this._register(new ia),this.browser=RS,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new ia),this._onCursorMove=this._register(new we),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new we),this.onKey=this._onKey.event,this._onRender=this._register(new we),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new we),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new we),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new we),this.onBell=this._onBell.event,this._onFocus=this._register(new we),this._onBlur=this._register(new we),this._onA11yCharEmitter=this._register(new we),this._onA11yTabEmitter=this._register(new we),this._onWillOpen=this._register(new we),this._setup(),this._decorationService=this._instantiationService.createInstance(rZ),this._instantiationService.setService(mc,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(GN),this._instantiationService.setService(pS,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Ap)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh(t?.start??0,t?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(Oi.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Oi.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Oi.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Oi.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Pt(()=>{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 t of e){let r,s="";switch(t.index){case 256:r="foreground",s="10";break;case 257:r="background",s="11";break;case 258:r="cursor",s="12";break;default:r="ansi",s="4;"+t.index}switch(t.type){case 0:let n=St.toColorRGB(r==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${pe.ESC}]${s};${HW(n)}${QS.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=Xt.toColor(...t.color));else{let o=r;this._themeService.modifyColors(a=>a[o]=Xt.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_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(Su,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(pe.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(pe.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,t=this.buffer.lines.get(e);if(!t)return;let r=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,n=t.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(qe(this.element,"copy",t=>{this.hasSelection()&&dz(t,this._selectionService)}));let e=t=>fz(t,this.textarea,this.coreService,this.optionsService);this._register(qe(this.textarea,"paste",e)),this._register(qe(this.element,"paste",e)),BS?this._register(qe(this.element,"mousedown",t=>{t.button===2&&G1(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(qe(this.element,"contextmenu",t=>{G1(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Ng&&this._register(qe(this.element,"auxclick",t=>{t.button===1&&nS(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(qe(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(qe(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(qe(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(qe(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(qe(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(qe(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(qe(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new 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 t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(qe(this.screenElement,"mousemove",n=>this.updateCursorStyle(n))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Tp.get()),DS||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(YN,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Zs,this._coreBrowserService),this._register(qe(this.textarea,"focus",n=>this._handleTextAreaFocus(n))),this._register(qe(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Jp,this._document,this._helperContainer),this._instantiationService.setService(Uu,this._charSizeService),this._themeService=this._instantiationService.createInstance(rm),this._instantiationService.setService(la,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(yu),this._instantiationService.setService(fS,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(tm,this.rows,this.screenElement)),this._instantiationService.setService(Xs,this._renderService),this._register(this._renderService.onRenderedViewportChange(n=>this._onRender.fire(n))),this.onResize(n=>this._renderService.resize(n.cols,n.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(jp,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(em),this._instantiationService.setService(Ag,this._mouseService);let s=this._linkifier.value=this._register(this._instantiationService.createInstance(um,this.screenElement));this.element.appendChild(t);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(Up,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(n=>{super.scrollLines(n,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(im,this.element,this.screenElement,s)),this._instantiationService.setService(yz,this._selectionService),this._register(this._selectionService.onRequestScrollLines(n=>this.scrollLines(n.amount,n.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(n=>this._renderService.handleSelectionChanged(n.start,n.end,n.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(n=>{this.textarea.value=n,this.textarea.focus(),this.textarea.select()})),this._register(Oi.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Yp,this.screenElement)),this._register(qe(this.element,"mousedown",n=>this._selectionService.handleMouseDown(n))),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(Su,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",n=>this._handleScreenReaderModeOptionChange(n))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(bu,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",n=>{!this._overviewRulerRenderer&&n&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(bu,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Kp,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function r(o){let a=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!a)return!1;let l,c;switch(o.overrideType||o.type){case"mousemove":c=32,o.buttons===void 0?(l=3,o.button!==void 0&&(l=o.button<3?o.button:3)):l=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":c=0,l=o.button<3?o.button:3;break;case"mousedown":c=1,l=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let h=o.deltaY;if(h===0||e.coreMouseService.consumeWheelEvent(o,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;c=h<0?0:1,l=4;break;default:return!1}return c===void 0||l===void 0||l>4?!1:e.coreMouseService.triggerMouseEvent({col:a.col,row:a.row,x:a.x,y:a.y,button:l,action:c,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},n={mouseup:o=>(r(o),o.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)),this.cancel(o)),wheel:o=>(r(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&r(o)},mousemove:o=>{o.buttons||r(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),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()),o&8?s.mousemove||(t.addEventListener("mousemove",n.mousemove),s.mousemove=n.mousemove):(t.removeEventListener("mousemove",s.mousemove),s.mousemove=null),o&16?s.wheel||(t.addEventListener("wheel",n.wheel,{passive:!1}),s.wheel=n.wheel):(t.removeEventListener("wheel",s.wheel),s.wheel=null),o&2?s.mouseup||(s.mouseup=n.mouseup):(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),o&4?s.mousedrag||(s.mousedrag=n.mousedrag):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(qe(t,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return r(o),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag),this.cancel(o)})),this._register(qe(t,"wheel",o=>{if(!s.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(o,!0);let a=pe.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(a,!0),this.cancel(o,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}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,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),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 t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){sS(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 new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new 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:!1}select(e,t,r){this._selectionService.setSelection(e,t,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,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let r=tZ(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),r.type===3||r.type===2){let s=this.rows-1;return this.scrollLines(r.type===2?-s:s),this.cancel(e,!0)}if(r.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((r.key===pe.ETX||r.key===pe.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)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let r=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?r:r&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(cZ(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(Wt));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(pe.ESC+"[I"):this.coreService.triggerDataEvent(pe.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),r=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${pe.ESC}[4;${r};${t}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(`${pe.ESC}[6;${n};${s}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function cZ(i){return i.keyCode===16||i.keyCode===17||i.keyCode===18}var hZ=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let r={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(r),t.dispose=()=>this._wrappedAddonDispose(r),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let r=0;r<this._addons.length;r++)if(this._addons[r]===e){t=r;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},uZ=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new xr)}translateToString(e,t,r){return this._line.translateToString(e,t,r)}},ZO=class{constructor(i,e){this._buffer=i,this.type=e}init(i){return this._buffer=i,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(i){let e=this._buffer.lines.get(i);if(e)return new uZ(e)}getNullCell(){return new xr}},dZ=class extends tt{constructor(i){super(),this._core=i,this._onBufferChange=this._register(new we),this.onBufferChange=this._onBufferChange.event,this._normal=new ZO(this._core.buffers.normal,"normal"),this._alternate=new ZO(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},fZ=class{constructor(i){this._core=i}registerCsiHandler(i,e){return this._core.registerCsiHandler(i,t=>e(t.toArray()))}addCsiHandler(i,e){return this.registerCsiHandler(i,e)}registerDcsHandler(i,e){return this._core.registerDcsHandler(i,(t,r)=>e(t,r.toArray()))}addDcsHandler(i,e){return this.registerDcsHandler(i,e)}registerEscHandler(i,e){return this._core.registerEscHandler(i,e)}addEscHandler(i,e){return this.registerEscHandler(i,e)}registerOscHandler(i,e){return this._core.registerOscHandler(i,e)}addOscHandler(i,e){return this.registerOscHandler(i,e)}},pZ=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}},mZ=["cols","rows"],Ur=0,HS=class extends tt{constructor(i){super(),this._core=this._register(new lZ(i)),this._addonManager=this._register(new hZ),this._publicOptions={...this._core.options};let e=r=>this._core.options[r],t=(r,s)=>{this._checkReadonlyOptions(r),this._core.options[r]=s};for(let r in this._core.options){let s={get:e.bind(this,r),set:t.bind(this,r)};Object.defineProperty(this._publicOptions,r,s)}}_checkReadonlyOptions(i){if(mZ.includes(i))throw new Error(`Option "${i}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new fZ(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new pZ(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 dZ(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let i=this._core.coreService.decPrivateModes,e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any";break}return{applicationCursorKeysMode:i.applicationCursorKeys,applicationKeypadMode:i.applicationKeypad,bracketedPasteMode:i.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:i.origin,reverseWraparoundMode:i.reverseWraparound,sendFocusMode:i.sendFocus,synchronizedOutputMode:i.synchronizedOutput,wraparoundMode:i.wraparound}}get options(){return this._publicOptions}set options(i){for(let e in i)this._publicOptions[e]=i[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(i,e=!0){this._core.input(i,e)}resize(i,e){this._verifyIntegers(i,e),this._core.resize(i,e)}open(i){this._core.open(i)}attachCustomKeyEventHandler(i){this._core.attachCustomKeyEventHandler(i)}attachCustomWheelEventHandler(i){this._core.attachCustomWheelEventHandler(i)}registerLinkProvider(i){return this._core.registerLinkProvider(i)}registerCharacterJoiner(i){return this._checkProposedApi(),this._core.registerCharacterJoiner(i)}deregisterCharacterJoiner(i){this._checkProposedApi(),this._core.deregisterCharacterJoiner(i)}registerMarker(i=0){return this._verifyIntegers(i),this._core.registerMarker(i)}registerDecoration(i){return this._checkProposedApi(),this._verifyPositiveIntegers(i.x??0,i.width??0,i.height??0),this._core.registerDecoration(i)}hasSelection(){return this._core.hasSelection()}select(i,e,t){this._verifyIntegers(i,e,t),this._core.select(i,e,t)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(i,e){this._verifyIntegers(i,e),this._core.selectLines(i,e)}dispose(){super.dispose()}scrollLines(i){this._verifyIntegers(i),this._core.scrollLines(i)}scrollPages(i){this._verifyIntegers(i),this._core.scrollPages(i)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(i){this._verifyIntegers(i),this._core.scrollToLine(i)}clear(){this._core.clear()}write(i,e){this._core.write(i,e)}writeln(i,e){this._core.write(i),this._core.write(`\r
81
+ `,e)}paste(i){this._core.paste(i)}refresh(i,e){this._verifyIntegers(i,e),this._core.refresh(i,e)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(i){this._addonManager.loadAddon(this,i)}static get strings(){return{get promptLabel(){return Tp.get()},set promptLabel(i){Tp.set(i)},get tooMuchOutput(){return Mp.get()},set tooMuchOutput(i){Mp.set(i)}}}_verifyIntegers(...i){for(Ur of i)if(Ur===1/0||isNaN(Ur)||Ur%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...i){for(Ur of i)if(Ur&&(Ur===1/0||isNaN(Ur)||Ur%1!==0||Ur<0))throw new Error("This API only accepts positive integers")}};var gZ=2,vZ=1,OZ=class{activate(i){this._terminal=i}dispose(){}fit(){let i=this.proposeDimensions();if(!i||!this._terminal||isNaN(i.cols)||isNaN(i.rows))return;let e=this._terminal._core;(this._terminal.rows!==i.rows||this._terminal.cols!==i.cols)&&(e._renderService.clear(),this._terminal.resize(i.cols,i.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let i=this._terminal._core._renderService.dimensions;if(i.css.cell.width===0||i.css.cell.height===0)return;let e=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,t=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(t.getPropertyValue("height")),s=Math.max(0,parseInt(t.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),o={top:parseInt(n.getPropertyValue("padding-top")),bottom:parseInt(n.getPropertyValue("padding-bottom")),right:parseInt(n.getPropertyValue("padding-right")),left:parseInt(n.getPropertyValue("padding-left"))},a=o.top+o.bottom,l=o.right+o.left,c=r-a,h=s-l-e;return{cols:Math.max(gZ,Math.floor(h/i.css.cell.width)),rows:Math.max(vZ,Math.floor(c/i.css.cell.height))}}};var _Z=(i,e,t,r)=>{for(var s=e,n=i.length-1,o;n>=0;n--)(o=i[n])&&(s=o(s)||s);return s},bZ=(i,e)=>(t,r)=>e(t,r,i),yZ=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(i){setTimeout(()=>{throw i.stack?XO.isErrorNoTelemetry(i)?new XO(i.message+`
82
+
83
+ `+i.stack):new Error(i.message+`
84
+
85
+ `+i.stack):i},0)}}addListener(i){return this.listeners.push(i),()=>{this._removeListener(i)}}emit(i){this.listeners.forEach(e=>{e(i)})}_removeListener(i){this.listeners.splice(this.listeners.indexOf(i),1)}setUnexpectedErrorHandler(i){this.unexpectedErrorHandler=i}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(i){this.unexpectedErrorHandler(i),this.emit(i)}onUnexpectedExternalError(i){this.unexpectedErrorHandler(i)}},xZ=new yZ;function nf(i){wZ(i)||xZ.onUnexpectedError(i)}var dm="Canceled";function wZ(i){return i instanceof SZ?!0:i instanceof Error&&i.name===dm&&i.message===dm}var SZ=class extends Error{constructor(){super(dm),this.name=this.message}},XO=class fm extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof fm)return e;let t=new fm;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},kZ;(i=>{function e(n){return n<0}i.isLessThan=e;function t(n){return n<=0}i.isLessThanOrEqual=t;function r(n){return n>0}i.isGreaterThan=r;function s(n){return n===0}i.isNeitherLessOrGreaterThan=s,i.greaterThan=1,i.lessThan=-1,i.neitherLessOrGreaterThan=0})(kZ||={});function CZ(i,e){let t=this,r=!1,s;return function(){return r||(r=!0,e||(s=i.apply(t,arguments))),s}}var US;(i=>{function e(w){return w&&typeof w=="object"&&typeof w[Symbol.iterator]=="function"}i.is=e;let t=Object.freeze([]);function r(){return t}i.empty=r;function*s(w){yield w}i.single=s;function n(w){return e(w)?w:s(w)}i.wrap=n;function o(w){return w||t}i.from=o;function*a(w){for(let C=w.length-1;C>=0;C--)yield w[C]}i.reverse=a;function l(w){return!w||w[Symbol.iterator]().next().done===!0}i.isEmpty=l;function c(w){return w[Symbol.iterator]().next().value}i.first=c;function h(w,C){let M=0;for(let D of w)if(C(D,M++))return!0;return!1}i.some=h;function u(w,C){for(let M of w)if(C(M))return M}i.find=u;function*d(w,C){for(let M of w)C(M)&&(yield M)}i.filter=d;function*f(w,C){let M=0;for(let D of w)yield C(D,M++)}i.map=f;function*p(w,C){let M=0;for(let D of w)yield*C(D,M++)}i.flatMap=p;function*g(...w){for(let C of w)yield*C}i.concat=g;function O(w,C,M){let D=M;for(let j of w)D=C(D,j);return D}i.reduce=O;function*_(w,C,M=w.length){for(C<0&&(C+=w.length),M<0?M+=w.length:M>w.length&&(M=w.length);C<M;C++)yield w[C]}i.slice=_;function k(w,C=Number.POSITIVE_INFINITY){let M=[];if(C===0)return[M,w];let D=w[Symbol.iterator]();for(let j=0;j<C;j++){let oe=D.next();if(oe.done)return[M,i.empty()];M.push(oe.value)}return[M,{[Symbol.iterator](){return D}}]}i.consume=k;async function P(w){let C=[];for await(let M of w)C.push(M);return Promise.resolve(C)}i.asyncToArray=P})(US||={});function YS(i){if(US.is(i)){let e=[];for(let t of i)if(t)try{t.dispose()}catch(r){e.push(r)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(i)?[]:i}else if(i)return i.dispose(),i}function jS(...i){return Ci(()=>YS(i))}function Ci(i){return{dispose:CZ(()=>{i()})}}var GS=class KS{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{YS(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?KS.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};GS.DISABLE_DISPOSED_WARNING=!1;var Zo=GS,Br=class{constructor(){this._store=new Zo,this._store}dispose(){this._store.dispose()}_register(i){if(i===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(i)}};Br.None=Object.freeze({dispose(){}});var ja=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},Wg=typeof process<"u"&&"title"in process,Gu=Wg?"node":navigator.userAgent,$Z=Wg?"node":navigator.platform,PZ=Gu.includes("Firefox"),TZ=Gu.includes("Edge"),JS=/^((?!chrome|android).)*safari/i.test(Gu);function MZ(){if(!JS)return 0;let i=Gu.match(/Version\/(\d+)/);return i===null||i.length<2?0:parseInt(i[1])}$Z.indexOf("Linux")>=0;var QZ="",ni=0,oi=0,ai=0,Bt=0,dr={css:"#00000000",rgba:0},Bi;(i=>{function e(s,n,o,a){return a!==void 0?`#${An(s)}${An(n)}${An(o)}${An(a)}`:`#${An(s)}${An(n)}${An(o)}`}i.toCss=e;function t(s,n,o,a=255){return(s<<24|n<<16|o<<8|a)>>>0}i.toRgba=t;function r(s,n,o,a){return{css:i.toCss(s,n,o,a),rgba:i.toRgba(s,n,o,a)}}i.toColor=r})(Bi||={});var hl;(i=>{function e(l,c){if(Bt=(c.rgba&255)/255,Bt===1)return{css:c.css,rgba:c.rgba};let h=c.rgba>>24&255,u=c.rgba>>16&255,d=c.rgba>>8&255,f=l.rgba>>24&255,p=l.rgba>>16&255,g=l.rgba>>8&255;ni=f+Math.round((h-f)*Bt),oi=p+Math.round((u-p)*Bt),ai=g+Math.round((d-g)*Bt);let O=Bi.toCss(ni,oi,ai),_=Bi.toRgba(ni,oi,ai);return{css:O,rgba:_}}i.blend=e;function t(l){return(l.rgba&255)===255}i.isOpaque=t;function r(l,c,h){let u=jn.ensureContrastRatio(l.rgba,c.rgba,h);if(u)return Bi.toColor(u>>24&255,u>>16&255,u>>8&255)}i.ensureContrastRatio=r;function s(l){let c=(l.rgba|255)>>>0;return[ni,oi,ai]=jn.toChannels(c),{css:Bi.toCss(ni,oi,ai),rgba:c}}i.opaque=s;function n(l,c){return Bt=Math.round(c*255),[ni,oi,ai]=jn.toChannels(l.rgba),{css:Bi.toCss(ni,oi,ai,Bt),rgba:Bi.toRgba(ni,oi,ai,Bt)}}i.opacity=n;function o(l,c){return Bt=l.rgba&255,n(l,Bt*c/255)}i.multiplyOpacity=o;function a(l){return[l.rgba>>24&255,l.rgba>>16&255,l.rgba>>8&255]}i.toColorRGB=a})(hl||={});var AZ;(i=>{let e,t;try{let s=document.createElement("canvas");s.width=1,s.height=1;let n=s.getContext("2d",{willReadFrequently:!0});n&&(e=n,e.globalCompositeOperation="copy",t=e.createLinearGradient(0,0,1,1))}catch{}function r(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return ni=parseInt(s.slice(1,2).repeat(2),16),oi=parseInt(s.slice(2,3).repeat(2),16),ai=parseInt(s.slice(3,4).repeat(2),16),Bi.toColor(ni,oi,ai);case 5:return ni=parseInt(s.slice(1,2).repeat(2),16),oi=parseInt(s.slice(2,3).repeat(2),16),ai=parseInt(s.slice(3,4).repeat(2),16),Bt=parseInt(s.slice(4,5).repeat(2),16),Bi.toColor(ni,oi,ai,Bt);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let n=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return ni=parseInt(n[1]),oi=parseInt(n[2]),ai=parseInt(n[3]),Bt=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Bi.toColor(ni,oi,ai,Bt);if(!e||!t)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=t,e.fillStyle=s,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[ni,oi,ai,Bt]=e.getImageData(0,0,1,1).data,Bt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Bi.toRgba(ni,oi,ai,Bt),css:s}}i.toColor=r})(AZ||={});var Qi;(i=>{function e(r){return t(r>>16&255,r>>8&255,r&255)}i.relativeLuminance=e;function t(r,s,n){let o=r/255,a=s/255,l=n/255,c=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),h=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),u=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4);return c*.2126+h*.7152+u*.0722}i.relativeLuminance2=t})(Qi||={});var jn;(i=>{function e(o,a){if(Bt=(a&255)/255,Bt===1)return a;let l=a>>24&255,c=a>>16&255,h=a>>8&255,u=o>>24&255,d=o>>16&255,f=o>>8&255;return ni=u+Math.round((l-u)*Bt),oi=d+Math.round((c-d)*Bt),ai=f+Math.round((h-f)*Bt),Bi.toRgba(ni,oi,ai)}i.blend=e;function t(o,a,l){let c=Qi.relativeLuminance(o>>8),h=Qi.relativeLuminance(a>>8);if(ws(c,h)<l){if(h<c){let f=r(o,a,l),p=ws(c,Qi.relativeLuminance(f>>8));if(p<l){let g=s(o,a,l),O=ws(c,Qi.relativeLuminance(g>>8));return p>O?f:g}return f}let u=s(o,a,l),d=ws(c,Qi.relativeLuminance(u>>8));if(d<l){let f=r(o,a,l),p=ws(c,Qi.relativeLuminance(f>>8));return d>p?u:f}return u}}i.ensureContrastRatio=t;function r(o,a,l){let c=o>>24&255,h=o>>16&255,u=o>>8&255,d=a>>24&255,f=a>>16&255,p=a>>8&255,g=ws(Qi.relativeLuminance2(d,f,p),Qi.relativeLuminance2(c,h,u));for(;g<l&&(d>0||f>0||p>0);)d-=Math.max(0,Math.ceil(d*.1)),f-=Math.max(0,Math.ceil(f*.1)),p-=Math.max(0,Math.ceil(p*.1)),g=ws(Qi.relativeLuminance2(d,f,p),Qi.relativeLuminance2(c,h,u));return(d<<24|f<<16|p<<8|255)>>>0}i.reduceLuminance=r;function s(o,a,l){let c=o>>24&255,h=o>>16&255,u=o>>8&255,d=a>>24&255,f=a>>16&255,p=a>>8&255,g=ws(Qi.relativeLuminance2(d,f,p),Qi.relativeLuminance2(c,h,u));for(;g<l&&(d<255||f<255||p<255);)d=Math.min(255,d+Math.ceil((255-d)*.1)),f=Math.min(255,f+Math.ceil((255-f)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),g=ws(Qi.relativeLuminance2(d,f,p),Qi.relativeLuminance2(c,h,u));return(d<<24|f<<16|p<<8|255)>>>0}i.increaseLuminance=s;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}i.toChannels=n})(jn||={});function An(i){let e=i.toString(16);return e.length<2?"0"+e:e}function ws(i,e){return i<e?(e+.05)/(i+.05):(i+.05)/(e+.05)}function Zt(i){if(!i)throw new Error("value must not be falsy");return i}function Zg(i){return 57508<=i&&i<=57558}function RZ(i){return 57520<=i&&i<=57527}function BZ(i){return 57344<=i&&i<=63743}function LZ(i){return 9472<=i&&i<=9631}function EZ(i){return i>=128512&&i<=128591||i>=127744&&i<=128511||i>=128640&&i<=128767||i>=9728&&i<=9983||i>=9984&&i<=10175||i>=65024&&i<=65039||i>=129280&&i<=129535||i>=127462&&i<=127487}function DZ(i,e,t,r){return e===1&&t>Math.ceil(r*1.5)&&i!==void 0&&i>255&&!EZ(i)&&!Zg(i)&&!BZ(i)}function e2(i){return Zg(i)||LZ(i)}function IZ(){return{css:{canvas:ah(),cell:ah()},device:{canvas:ah(),cell:ah(),char:{width:0,height:0,left:0,top:0}}}}function ah(){return{width:0,height:0}}function zZ(i,e,t=0){return(i-(Math.round(e)*2-t))%(Math.round(e)*2)}var pi=0,ei=0,Yr=!1,Ss=!1,lh=!1,Ni,of=0,NZ=class{constructor(i,e,t,r,s,n){this._terminal=i,this._optionService=e,this._selectionRenderModel=t,this._decorationService=r,this._coreBrowserService=s,this._themeService=n,this.result={fg:0,bg:0,ext:0}}resolve(i,e,t,r){if(this.result.bg=i.bg,this.result.fg=i.fg,this.result.ext=i.bg&268435456?i.extended.ext:0,ei=0,pi=0,Ss=!1,Yr=!1,lh=!1,Ni=this._themeService.colors,of=0,i.getCode()!==0&&i.extended.underlineStyle===4){let s=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));of=e*r%(Math.round(s)*2)}if(this._decorationService.forEachDecorationAtCell(e,t,"bottom",s=>{s.backgroundColorRGB&&(ei=s.backgroundColorRGB.rgba>>8&16777215,Ss=!0),s.foregroundColorRGB&&(pi=s.foregroundColorRGB.rgba>>8&16777215,Yr=!0)}),lh=this._selectionRenderModel.isCellSelected(this._terminal,e,t),lh){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:ei=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:ei=(this.result.fg&16777215)<<8|255;break;default:ei=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:ei=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:ei=(this.result.bg&16777215)<<8|255;break}ei=jn.blend(ei,(this._coreBrowserService.isFocused?Ni.selectionBackgroundOpaque:Ni.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else ei=(this._coreBrowserService.isFocused?Ni.selectionBackgroundOpaque:Ni.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Ss=!0,Ni.selectionForeground&&(pi=Ni.selectionForeground.rgba>>8&16777215,Yr=!0),e2(i.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)pi=(this._coreBrowserService.isFocused?Ni.selectionBackgroundOpaque:Ni.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:pi=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:pi=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:pi=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:pi=(this.result.fg&16777215)<<8|255;break;default:pi=this._themeService.colors.foreground.rgba}pi=jn.blend(pi,(this._coreBrowserService.isFocused?Ni.selectionBackgroundOpaque:Ni.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}Yr=!0}}this._decorationService.forEachDecorationAtCell(e,t,"top",s=>{s.backgroundColorRGB&&(ei=s.backgroundColorRGB.rgba>>8&16777215,Ss=!0),s.foregroundColorRGB&&(pi=s.foregroundColorRGB.rgba>>8&16777215,Yr=!0)}),Ss&&(lh?ei=i.bg&-16777216&-134217729|ei|50331648:ei=i.bg&-16777216|ei|50331648),Yr&&(pi=i.fg&-16777216&-67108865|pi|50331648),this.result.fg&67108864&&(Ss&&!Yr&&((this.result.bg&50331648)===0?pi=this.result.fg&-134217728|Ni.background.rgba>>8&16777215&16777215|50331648:pi=this.result.fg&-134217728|this.result.bg&67108863,Yr=!0),!Ss&&Yr&&((this.result.fg&50331648)===0?ei=this.result.bg&-67108864|Ni.foreground.rgba>>8&16777215&16777215|50331648:ei=this.result.bg&-67108864|this.result.fg&67108863,Ss=!0)),Ni=void 0,this.result.bg=Ss?ei:this.result.bg,this.result.fg=Yr?pi:this.result.fg,this.result.ext&=536870911,this.result.ext|=of<<29&3758096384}},WZ=.5,t2=PZ||TZ?"bottom":"ideographic",ZZ={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},XZ={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},FZ={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(i,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"║":{1:(i,e)=>`M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1`},"╒":{1:(i,e)=>`M.5,1 L.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╓":{1:(i,e)=>`M${.5-i},1 L${.5-i},.5 L1,.5 M${.5+i},.5 L${.5+i},1`},"╔":{1:(i,e)=>`M1,${.5-e} L${.5-i},${.5-e} L${.5-i},1 M1,${.5+e} L${.5+i},${.5+e} L${.5+i},1`},"╕":{1:(i,e)=>`M0,${.5-e} L.5,${.5-e} L.5,1 M0,${.5+e} L.5,${.5+e}`},"╖":{1:(i,e)=>`M${.5+i},1 L${.5+i},.5 L0,.5 M${.5-i},.5 L${.5-i},1`},"╗":{1:(i,e)=>`M0,${.5+e} L${.5-i},${.5+e} L${.5-i},1 M0,${.5-e} L${.5+i},${.5-e} L${.5+i},1`},"╘":{1:(i,e)=>`M.5,0 L.5,${.5+e} L1,${.5+e} M.5,${.5-e} L1,${.5-e}`},"╙":{1:(i,e)=>`M1,.5 L${.5-i},.5 L${.5-i},0 M${.5+i},.5 L${.5+i},0`},"╚":{1:(i,e)=>`M1,${.5-e} L${.5+i},${.5-e} L${.5+i},0 M1,${.5+e} L${.5-i},${.5+e} L${.5-i},0`},"╛":{1:(i,e)=>`M0,${.5+e} L.5,${.5+e} L.5,0 M0,${.5-e} L.5,${.5-e}`},"╜":{1:(i,e)=>`M0,.5 L${.5+i},.5 L${.5+i},0 M${.5-i},.5 L${.5-i},0`},"╝":{1:(i,e)=>`M0,${.5-e} L${.5-i},${.5-e} L${.5-i},0 M0,${.5+e} L${.5+i},${.5+e} L${.5+i},0`},"╞":{1:(i,e)=>`M.5,0 L.5,1 M.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╟":{1:(i,e)=>`M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1 M${.5+i},.5 L1,.5`},"╠":{1:(i,e)=>`M${.5-i},0 L${.5-i},1 M1,${.5+e} L${.5+i},${.5+e} L${.5+i},1 M1,${.5-e} L${.5+i},${.5-e} L${.5+i},0`},"╡":{1:(i,e)=>`M.5,0 L.5,1 M0,${.5-e} L.5,${.5-e} M0,${.5+e} L.5,${.5+e}`},"╢":{1:(i,e)=>`M0,.5 L${.5-i},.5 M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1`},"╣":{1:(i,e)=>`M${.5+i},0 L${.5+i},1 M0,${.5+e} L${.5-i},${.5+e} L${.5-i},1 M0,${.5-e} L${.5-i},${.5-e} L${.5-i},0`},"╤":{1:(i,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e} M.5,${.5+e} L.5,1`},"╥":{1:(i,e)=>`M0,.5 L1,.5 M${.5-i},.5 L${.5-i},1 M${.5+i},.5 L${.5+i},1`},"╦":{1:(i,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L${.5-i},${.5+e} L${.5-i},1 M1,${.5+e} L${.5+i},${.5+e} L${.5+i},1`},"╧":{1:(i,e)=>`M.5,0 L.5,${.5-e} M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╨":{1:(i,e)=>`M0,.5 L1,.5 M${.5-i},.5 L${.5-i},0 M${.5+i},.5 L${.5+i},0`},"╩":{1:(i,e)=>`M0,${.5+e} L1,${.5+e} M0,${.5-e} L${.5-i},${.5-e} L${.5-i},0 M1,${.5-e} L${.5+i},${.5-e} L${.5+i},0`},"╪":{1:(i,e)=>`M.5,0 L.5,1 M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╫":{1:(i,e)=>`M0,.5 L1,.5 M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1`},"╬":{1:(i,e)=>`M0,${.5+e} L${.5-i},${.5+e} L${.5-i},1 M1,${.5+e} L${.5+i},${.5+e} L${.5+i},1 M0,${.5-e} L${.5-i},${.5-e} L${.5-i},0 M1,${.5-e} L${.5+i},${.5-e} L${.5+i},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5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,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(i,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,1,.5`},"╮":{1:(i,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,0,.5`},"╯":{1:(i,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,0,.5`},"╰":{1:(i,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,1,.5`}},Yl={"":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};Yl[""]=Yl[""];Yl[""]=Yl[""];function VZ(i,e,t,r,s,n,o,a){let l=ZZ[e];if(l)return qZ(i,l,t,r,s,n),!0;let c=XZ[e];if(c)return HZ(i,c,t,r,s,n),!0;let h=FZ[e];if(h)return UZ(i,h,t,r,s,n,a),!0;let u=Yl[e];return u?(YZ(i,u,t,r,s,n,o,a),!0):!1}function qZ(i,e,t,r,s,n){for(let o=0;o<e.length;o++){let a=e[o],l=s/8,c=n/8;i.fillRect(t+a.x*l,r+a.y*c,a.w*l,a.h*c)}}var FO=new Map;function HZ(i,e,t,r,s,n){let o=FO.get(e);o||(o=new Map,FO.set(e,o));let a=i.fillStyle;if(typeof a!="string")throw new Error(`Unexpected fillStyle type "${a}"`);let l=o.get(a);if(!l){let c=e[0].length,h=e.length,u=i.canvas.ownerDocument.createElement("canvas");u.width=c,u.height=h;let d=Zt(u.getContext("2d")),f=new ImageData(c,h),p,g,O,_;if(a.startsWith("#"))p=parseInt(a.slice(1,3),16),g=parseInt(a.slice(3,5),16),O=parseInt(a.slice(5,7),16),_=a.length>7&&parseInt(a.slice(7,9),16)||1;else if(a.startsWith("rgba"))[p,g,O,_]=a.substring(5,a.length-1).split(",").map(k=>parseFloat(k));else throw new Error(`Unexpected fillStyle color format "${a}" when drawing pattern glyph`);for(let k=0;k<h;k++)for(let P=0;P<c;P++)f.data[(k*c+P)*4]=p,f.data[(k*c+P)*4+1]=g,f.data[(k*c+P)*4+2]=O,f.data[(k*c+P)*4+3]=e[k][P]*(_*255);d.putImageData(f,0,0),l=Zt(i.createPattern(u,null)),o.set(a,l)}i.fillStyle=l,i.fillRect(t,r,s,n)}function UZ(i,e,t,r,s,n,o){i.strokeStyle=i.fillStyle;for(let[a,l]of Object.entries(e)){i.beginPath(),i.lineWidth=o*Number.parseInt(a);let c;if(typeof l=="function"){let h=.15/n*s;c=l(.15,h)}else c=l;for(let h of c.split(" ")){let u=h[0],d=i2[u];if(!d){console.error(`Could not find drawing instructions for "${u}"`);continue}let f=h.substring(1).split(",");!f[0]||!f[1]||d(i,r2(f,s,n,t,r,!0,o))}i.stroke(),i.closePath()}}function YZ(i,e,t,r,s,n,o,a){let l=new Path2D;l.rect(t,r,s,n),i.clip(l),i.beginPath();let c=o/12;i.lineWidth=a*c;for(let h of e.d.split(" ")){let u=h[0],d=i2[u];if(!d){console.error(`Could not find drawing instructions for "${u}"`);continue}let f=h.substring(1).split(",");!f[0]||!f[1]||d(i,r2(f,s,n,t,r,!1,a,(e.leftPadding??0)*(c/2),(e.rightPadding??0)*(c/2)))}e.type===1?(i.strokeStyle=i.fillStyle,i.stroke()):i.fill(),i.closePath()}function VO(i,e,t=0){return Math.max(Math.min(i,e),t)}var i2={C:(i,e)=>i.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(i,e)=>i.lineTo(e[0],e[1]),M:(i,e)=>i.moveTo(e[0],e[1])};function r2(i,e,t,r,s,n,o,a=0,l=0){let c=i.map(h=>parseFloat(h)||parseInt(h));if(c.length<2)throw new Error("Too few arguments for instruction");for(let h=0;h<c.length;h+=2)c[h]*=e-a*o-l*o,n&&c[h]!==0&&(c[h]=VO(Math.round(c[h]+.5)-.5,e,0)),c[h]+=r+a*o;for(let h=1;h<c.length;h+=2)c[h]*=t,n&&c[h]!==0&&(c[h]=VO(Math.round(c[h]+.5)-.5,t,0)),c[h]+=s;return c}var qO=class{constructor(){this._data={}}set(i,e,t){this._data[i]||(this._data[i]={}),this._data[i][e]=t}get(i,e){return this._data[i]?this._data[i][e]:void 0}clear(){this._data={}}},HO=class{constructor(){this._data=new qO}set(e,t,r,s,n){this._data.get(e,t)||this._data.set(e,t,new qO),this._data.get(e,t).set(r,s,n)}get(e,t,r,s){return this._data.get(e,t)?.get(r,s)}clear(){this._data.clear()}},s2=class{constructor(){this._tasks=[],this._i=0}enqueue(i){this._tasks.push(i),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(i){this._idleCallback=void 0;let e=0,t=0,r=i.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(e=performance.now(),this._tasks[this._i]()||this._i++,e=Math.max(1,performance.now()-e),t=Math.max(e,t),s=i.timeRemaining(),t*1.5>s){r-e<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-e))}ms`),this._start();return}r=s}this.clear()}},jZ=class extends s2{_requestCallback(i){return setTimeout(()=>i(this._createDeadline(16)))}_cancelCallback(i){clearTimeout(i)}_createDeadline(i){let e=performance.now()+i;return{timeRemaining:()=>Math.max(0,e-performance.now())}}},GZ=class extends s2{_requestCallback(i){return requestIdleCallback(i)}_cancelCallback(i){cancelIdleCallback(i)}},KZ=!Wg&&"requestIdleCallback"in window?GZ:jZ,Ao=class n2{constructor(){this.fg=0,this.bg=0,this.extended=new o2}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new n2;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},o2=class a2{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new a2(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},JZ=globalThis.performance&&typeof globalThis.performance.now=="function",eX=class l2{static create(e){return new l2(e)}constructor(e){this._now=JZ&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Rs;(i=>{i.None=()=>Br.None;function e(x,b){return u(x,()=>{},0,void 0,!0,void 0,b)}i.defer=e;function t(x){return(b,T=null,$)=>{let R=!1,E;return E=x(Z=>{if(!R)return E?E.dispose():R=!0,b.call(T,Z)},null,$),R&&E.dispose(),E}}i.once=t;function r(x,b,T){return c(($,R=null,E)=>x(Z=>$.call(R,b(Z)),null,E),T)}i.map=r;function s(x,b,T){return c(($,R=null,E)=>x(Z=>{b(Z),$.call(R,Z)},null,E),T)}i.forEach=s;function n(x,b,T){return c(($,R=null,E)=>x(Z=>b(Z)&&$.call(R,Z),null,E),T)}i.filter=n;function o(x){return x}i.signal=o;function a(...x){return(b,T=null,$)=>{let R=jS(...x.map(E=>E(Z=>b.call(T,Z))));return h(R,$)}}i.any=a;function l(x,b,T,$){let R=T;return r(x,E=>(R=b(R,E),R),$)}i.reduce=l;function c(x,b){let T,$={onWillAddFirstListener(){T=x(R.fire,R)},onDidRemoveLastListener(){T?.dispose()}},R=new kt($);return b?.add(R),R.event}function h(x,b){return b instanceof Array?b.push(x):b&&b.add(x),x}function u(x,b,T=100,$=!1,R=!1,E,Z){let K,X,V,ie=0,q,ee={leakWarningThreshold:E,onWillAddFirstListener(){K=x(Oe=>{ie++,X=b(X,Oe),$&&!V&&(te.fire(X),X=void 0),q=()=>{let Te=X;X=void 0,V=void 0,(!$||ie>1)&&te.fire(Te),ie=0},typeof T=="number"?(clearTimeout(V),V=setTimeout(q,T)):V===void 0&&(V=0,queueMicrotask(q))})},onWillRemoveListener(){R&&ie>0&&q?.()},onDidRemoveLastListener(){q=void 0,K.dispose()}},te=new kt(ee);return Z?.add(te),te.event}i.debounce=u;function d(x,b=0,T){return i.debounce(x,($,R)=>$?($.push(R),$):[R],b,void 0,!0,void 0,T)}i.accumulate=d;function f(x,b=($,R)=>$===R,T){let $=!0,R;return n(x,E=>{let Z=$||!b(E,R);return $=!1,R=E,Z},T)}i.latch=f;function p(x,b,T){return[i.filter(x,b,T),i.filter(x,$=>!b($),T)]}i.split=p;function g(x,b=!1,T=[],$){let R=T.slice(),E=x(X=>{R?R.push(X):K.fire(X)});$&&$.add(E);let Z=()=>{R?.forEach(X=>K.fire(X)),R=null},K=new kt({onWillAddFirstListener(){E||(E=x(X=>K.fire(X)),$&&$.add(E))},onDidAddFirstListener(){R&&(b?setTimeout(Z):Z())},onDidRemoveLastListener(){E&&E.dispose(),E=null}});return $&&$.add(K),K.event}i.buffer=g;function O(x,b){return(T,$,R)=>{let E=b(new k);return x(function(Z){let K=E.evaluate(Z);K!==_&&T.call($,K)},void 0,R)}}i.chain=O;let _=Symbol("HaltChainable");class k{constructor(){this.steps=[]}map(b){return this.steps.push(b),this}forEach(b){return this.steps.push(T=>(b(T),T)),this}filter(b){return this.steps.push(T=>b(T)?T:_),this}reduce(b,T){let $=T;return this.steps.push(R=>($=b($,R),$)),this}latch(b=(T,$)=>T===$){let T=!0,$;return this.steps.push(R=>{let E=T||!b(R,$);return T=!1,$=R,E?R:_}),this}evaluate(b){for(let T of this.steps)if(b=T(b),b===_)break;return b}}function P(x,b,T=$=>$){let $=(...K)=>Z.fire(T(...K)),R=()=>x.on(b,$),E=()=>x.removeListener(b,$),Z=new kt({onWillAddFirstListener:R,onDidRemoveLastListener:E});return Z.event}i.fromNodeEventEmitter=P;function w(x,b,T=$=>$){let $=(...K)=>Z.fire(T(...K)),R=()=>x.addEventListener(b,$),E=()=>x.removeEventListener(b,$),Z=new kt({onWillAddFirstListener:R,onDidRemoveLastListener:E});return Z.event}i.fromDOMEventEmitter=w;function C(x){return new Promise(b=>t(x)(b))}i.toPromise=C;function M(x){let b=new kt;return x.then(T=>{b.fire(T)},()=>{b.fire(void 0)}).finally(()=>{b.dispose()}),b.event}i.fromPromise=M;function D(x,b){return x(T=>b.fire(T))}i.forward=D;function j(x,b,T){return b(T),x($=>b($))}i.runAndSubscribe=j;class oe{constructor(b,T){this._observable=b,this._counter=0,this._hasChanged=!1;let $={onWillAddFirstListener:()=>{b.addObserver(this)},onDidRemoveLastListener:()=>{b.removeObserver(this)}};this.emitter=new kt($),T&&T.add(this.emitter)}beginUpdate(b){this._counter++}handlePossibleChange(b){}handleChange(b,T){this._hasChanged=!0}endUpdate(b){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function ae(x,b){return new oe(x,b).emitter.event}i.fromObservable=ae;function G(x){return(b,T,$)=>{let R=0,E=!1,Z={beginUpdate(){R++},endUpdate(){R--,R===0&&(x.reportChanges(),E&&(E=!1,b.call(T)))},handlePossibleChange(){},handleChange(){E=!0}};x.addObserver(Z),x.reportChanges();let K={dispose(){x.removeObserver(Z)}};return $ instanceof Zo?$.add(K):Array.isArray($)&&$.push(K),K}}i.fromObservableLight=G})(Rs||={});var pm=class mm{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${mm._idPool++}`,mm.all.add(this)}start(e){this._stopWatch=new eX,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}}};pm.all=new Set,pm._idPool=0;var tX=pm,iX=-1,c2=class h2{constructor(e,t,r=(h2._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=t,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let r=this.threshold;if(r<=0||t<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=r*.5;let[n,o]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${o}):`;console.warn(a),console.warn(n);let l=new nX(a,n);this._errorHandler(l)}return()=>{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[r,s]of this._stacks)(!e||t<s)&&(e=[r,s],t=s);return e}};c2._idPool=1;var rX=c2,sX=class u2{constructor(e){this.value=e}static create(){let e=new Error;return new u2(e.stack??"")}print(){console.warn(this.value.split(`
86
+ `).slice(2).join(`
87
+ `))}},nX=class extends Error{constructor(i,e){super(i),this.name="ListenerLeakError",this.stack=e}},oX=class extends Error{constructor(i,e){super(i),this.name="ListenerRefusalError",this.stack=e}},aX=0,af=class{constructor(e){this.value=e,this.id=aX++}},lX=2,cX,kt=class{constructor(i){this._size=0,this._options=i,this._leakageMon=this._options?.leakWarningThreshold?new rX(i?.onListenerError??nf,this._options?.leakWarningThreshold??iX):void 0,this._perfMon=this._options?._profName?new tX(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??=(i,e,t)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let o=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(o);let a=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],l=new oX(`${o}. HINT: Stack shows most frequent listener (${a[1]}-times)`,a[0]);return(this._options?.onListenerError||nf)(l),Br.None}if(this._disposed)return Br.None;e&&(i=i.bind(e));let r=new af(i),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=sX.create(),s=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof af?(this._deliveryQueue??=new hX,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let n=Ci(()=>{s?.(),this._removeListener(r)});return t instanceof Zo?t.add(n):Array.isArray(t)&&t.push(n),n},this._event}_removeListener(i){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let e=this._listeners,t=e.indexOf(i);if(t===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,e[t]=void 0;let r=this._deliveryQueue.current===this;if(this._size*lX<=e.length){let s=0;for(let n=0;n<e.length;n++)e[n]?e[s++]=e[n]:r&&(this._deliveryQueue.end--,s<this._deliveryQueue.i&&this._deliveryQueue.i--);e.length=s}}_deliver(i,e){if(!i)return;let t=this._options?.onListenerError||nf;if(!t){i.value(e);return}try{i.value(e)}catch(r){t(r)}}_deliverQueue(i){let e=i.current._listeners;for(;i.i<i.end;)this._deliver(e[i.i++],i.value);i.reset()}fire(i){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof af)this._deliver(this._listeners,i);else{let e=this._deliveryQueue;e.enqueue(this,i,this._listeners.length),this._deliverQueue(e)}this._perfMon?.stop()}hasListeners(){return this._size>0}},hX=class{constructor(){this.i=-1,this.end=0}enqueue(i,e,t){this.i=0,this.end=t,this.current=i,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},UO={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},Ga=2,Ka,sn=class Co{constructor(e,t,r){this._document=e,this._config=t,this._unicodeService=r,this._didWarmUp=!1,this._cacheMap=new HO,this._cacheMapCombined=new HO,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Ao,this._textureSize=512,this._onAddTextureAtlasCanvas=new kt,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new kt,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=d2(e,this._config.deviceCellWidth*4+Ga*2,this._config.deviceCellHeight+Ga*2),this._tmpCtx=Zt(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let e=new KZ;for(let t=33;t<126;t++)e.enqueue(()=>{if(!this._cacheMap.get(t,0,0,0)){let r=this._drawToCache(t,0,0,0,!1,void 0);this._cacheMap.set(t,0,0,0,r)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(Co.maxAtlasPages&&this._pages.length>=Math.max(4,Co.maxAtlasPages)){let t=this._pages.filter(c=>c.canvas.width*2<=(Co.maxTextureSize||4096)).sort((c,h)=>h.canvas.width!==c.canvas.width?h.canvas.width-c.canvas.width:h.percentageUsed-c.percentageUsed),r=-1,s=0;for(let c=0;c<t.length;c++)if(t[c].canvas.width!==s)r=c,s=t[c].canvas.width;else if(c-r===3)break;let n=t.slice(r,r+4),o=n.map(c=>c.glyphs[0].texturePage).sort((c,h)=>c>h?1:-1),a=this.pages.length-n.length,l=this._mergePages(n,a);l.version++;for(let c=o.length-1;c>=0;c--)this._deletePage(o[c]);this.pages.push(l),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(l.canvas)}let e=new lf(this._document,this._textureSize);return this._pages.push(e),this._activePages.push(e),this._onAddTextureAtlasCanvas.fire(e.canvas),e}_mergePages(e,t){let r=e[0].canvas.width*2,s=new lf(this._document,r,e);for(let[n,o]of e.entries()){let a=n*o.canvas.width%r,l=Math.floor(n/2)*o.canvas.height;s.ctx.drawImage(o.canvas,a,l);for(let h of o.glyphs)h.texturePage=t,h.sizeClipSpace.x=h.size.x/r,h.sizeClipSpace.y=h.size.y/r,h.texturePosition.x+=a,h.texturePosition.y+=l,h.texturePositionClipSpace.x=h.texturePosition.x/r,h.texturePositionClipSpace.y=h.texturePosition.y/r;this._onRemoveTextureAtlasCanvas.fire(o.canvas);let c=this._activePages.indexOf(o);c!==-1&&this._activePages.splice(c,1)}return s}_deletePage(e){this._pages.splice(e,1);for(let t=e;t<this._pages.length;t++){let r=this._pages[t];for(let s of r.glyphs)s.texturePage--;r.version++}}getRasterizedGlyphCombinedChar(e,t,r,s,n,o){return this._getFromCacheMap(this._cacheMapCombined,e,t,r,s,n,o)}getRasterizedGlyph(e,t,r,s,n,o){return this._getFromCacheMap(this._cacheMap,e,t,r,s,n,o)}_getFromCacheMap(e,t,r,s,n,o,a){return Ka=e.get(t,r,s,n),Ka||(Ka=this._drawToCache(t,r,s,n,o,a),e.set(t,r,s,n,Ka)),Ka}_getColorFromAnsiIndex(e){if(e>=this._config.colors.ansi.length)throw new Error("No color found for idx "+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,t,r,s){if(this._config.allowTransparency)return dr;let n;switch(e){case 16777216:case 33554432:n=this._getColorFromAnsiIndex(t);break;case 50331648:let o=Ao.toColorRGB(t);n=Bi.toColor(o[0],o[1],o[2]);break;default:r?n=hl.opaque(this._config.colors.foreground):n=this._config.colors.background;break}return this._config.allowTransparency||(n=hl.opaque(n)),n}_getForegroundColor(e,t,r,s,n,o,a,l,c,h){let u=this._getMinimumContrastColor(e,t,r,s,n,o,a,c,l,h);if(u)return u;let d;switch(n){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&c&&o<8&&(o+=8),d=this._getColorFromAnsiIndex(o);break;case 50331648:let f=Ao.toColorRGB(o);d=Bi.toColor(f[0],f[1],f[2]);break;default:a?d=this._config.colors.background:d=this._config.colors.foreground}return this._config.allowTransparency&&(d=hl.opaque(d)),l&&(d=hl.multiplyOpacity(d,WZ)),d}_resolveBackgroundRgba(e,t,r){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return r?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,t,r,s){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&s&&t<8&&(t+=8),this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return r?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,t,r,s,n,o,a,l,c,h){if(this._config.minimumContrastRatio===1||h)return;let u=this._getContrastCache(c),d=u.getColor(e,s);if(d!==void 0)return d||void 0;let f=this._resolveBackgroundRgba(t,r,a),p=this._resolveForegroundRgba(n,o,a,l),g=jn.ensureContrastRatio(f,p,this._config.minimumContrastRatio/(c?2:1));if(!g){u.setColor(e,s,null);return}let O=Bi.toColor(g>>24&255,g>>16&255,g>>8&255);return u.setColor(e,s,O),O}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(e,t,r,s,n,o){let a=typeof e=="number"?String.fromCharCode(e):e;o&&this._tmpCanvas.parentElement!==o&&(this._tmpCanvas.style.display="none",o.append(this._tmpCanvas));let l=Math.min(this._config.deviceCellWidth*Math.max(a.length,2)+Ga*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<l&&(this._tmpCanvas.width=l);let c=Math.min(this._config.deviceCellHeight+Ga*4,this._textureSize);if(this._tmpCanvas.height<c&&(this._tmpCanvas.height=c),this._tmpCtx.save(),this._workAttributeData.fg=r,this._workAttributeData.bg=t,this._workAttributeData.extended.ext=s,!!this._workAttributeData.isInvisible())return UO;let h=!!this._workAttributeData.isBold(),u=!!this._workAttributeData.isInverse(),d=!!this._workAttributeData.isDim(),f=!!this._workAttributeData.isItalic(),p=!!this._workAttributeData.isUnderline(),g=!!this._workAttributeData.isStrikethrough(),O=!!this._workAttributeData.isOverline(),_=this._workAttributeData.getFgColor(),k=this._workAttributeData.getFgColorMode(),P=this._workAttributeData.getBgColor(),w=this._workAttributeData.getBgColorMode();if(u){let X=_;_=P,P=X;let V=k;k=w,w=V}let C=this._getBackgroundColor(w,P,u,d);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=C.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let M=h?this._config.fontWeightBold:this._config.fontWeight,D=f?"italic":"";this._tmpCtx.font=`${D} ${M} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=t2;let j=a.length===1&&Zg(a.charCodeAt(0)),oe=a.length===1&&RZ(a.charCodeAt(0)),ae=this._getForegroundColor(t,w,P,r,k,_,u,d,h,e2(a.charCodeAt(0)));this._tmpCtx.fillStyle=ae.css;let G=oe?0:Ga*2,x=!1;this._config.customGlyphs!==!1&&(x=VZ(this._tmpCtx,a,G,G,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let b=!j,T;if(typeof e=="number"?T=this._unicodeService.wcwidth(e):T=this._unicodeService.getStringCellWidth(e),p){this._tmpCtx.save();let X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),V=X%2===1?.5:0;if(this._tmpCtx.lineWidth=X,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())b=!1,this._tmpCtx.strokeStyle=`rgb(${Ao.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{b=!1;let Te=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Te<8&&(Te+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Te).css}this._tmpCtx.beginPath();let ie=G,q=Math.ceil(G+this._config.deviceCharHeight)-V-(n?X*2:0),ee=q+X,te=q+X*2,Oe=this._workAttributeData.getUnderlineVariantOffset();for(let Te=0;Te<T;Te++){this._tmpCtx.save();let ke=ie+Te*this._config.deviceCellWidth,Ze=ie+(Te+1)*this._config.deviceCellWidth,Je=ke+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(ke,q),this._tmpCtx.lineTo(Ze,q),this._tmpCtx.moveTo(ke,te),this._tmpCtx.lineTo(Ze,te);break;case 3:let Ve=X<=1?te:Math.ceil(G+this._config.deviceCharHeight-X/2)-V,I=X<=1?q:Math.ceil(G+this._config.deviceCharHeight+X/2)-V,L=new Path2D;L.rect(ke,q,this._config.deviceCellWidth,te-q),this._tmpCtx.clip(L),this._tmpCtx.moveTo(ke-this._config.deviceCellWidth/2,ee),this._tmpCtx.bezierCurveTo(ke-this._config.deviceCellWidth/2,I,ke,I,ke,ee),this._tmpCtx.bezierCurveTo(ke,Ve,Je,Ve,Je,ee),this._tmpCtx.bezierCurveTo(Je,I,Ze,I,Ze,ee),this._tmpCtx.bezierCurveTo(Ze,Ve,Ze+this._config.deviceCellWidth/2,Ve,Ze+this._config.deviceCellWidth/2,ee);break;case 4:let z=Oe===0?0:Oe>=X?X*2-Oe:X-Oe;Oe>=X||z===0?(this._tmpCtx.setLineDash([Math.round(X),Math.round(X)]),this._tmpCtx.moveTo(ke+z,q),this._tmpCtx.lineTo(Ze,q)):(this._tmpCtx.setLineDash([Math.round(X),Math.round(X)]),this._tmpCtx.moveTo(ke,q),this._tmpCtx.lineTo(ke+z,q),this._tmpCtx.moveTo(ke+z+X,q),this._tmpCtx.lineTo(Ze,q)),Oe=zZ(Ze-ke,X,Oe);break;case 5:let Q=.6,J=.3,de=Ze-ke,Y=Math.floor(Q*de),be=Math.floor(J*de),Ce=de-Y-be;this._tmpCtx.setLineDash([Y,be,Ce]),this._tmpCtx.moveTo(ke,q),this._tmpCtx.lineTo(Ze,q);break;default:this._tmpCtx.moveTo(ke,q),this._tmpCtx.lineTo(Ze,q);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!x&&this._config.fontSize>=12&&!this._config.allowTransparency&&a!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let Te=this._tmpCtx.measureText(a);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Te&&Te.actualBoundingBoxDescent>0){this._tmpCtx.save();let ke=new Path2D;ke.rect(ie,q-Math.ceil(X/2),this._config.deviceCellWidth*T,te-q+Math.ceil(X/2)),this._tmpCtx.clip(ke),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=C.css,this._tmpCtx.strokeText(a,G,G+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(O){let X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),V=X%2===1?.5:0;this._tmpCtx.lineWidth=X,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(G,G+V),this._tmpCtx.lineTo(G+this._config.deviceCharWidth*T,G+V),this._tmpCtx.stroke()}if(x||this._tmpCtx.fillText(a,G,G+this._config.deviceCharHeight),a==="_"&&!this._config.allowTransparency){let X=cf(this._tmpCtx.getImageData(G,G,this._config.deviceCellWidth,this._config.deviceCellHeight),C,ae,b);if(X)for(let V=1;V<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=C.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(a,G,G+this._config.deviceCharHeight-V),X=cf(this._tmpCtx.getImageData(G,G,this._config.deviceCellWidth,this._config.deviceCellHeight),C,ae,b),!!X);V++);}if(g){let X=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),V=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=X,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(G,G+Math.floor(this._config.deviceCharHeight/2)-V),this._tmpCtx.lineTo(G+this._config.deviceCharWidth*T,G+Math.floor(this._config.deviceCharHeight/2)-V),this._tmpCtx.stroke()}this._tmpCtx.restore();let $=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),R;if(this._config.allowTransparency?R=uX($):R=cf($,C,ae,b),R)return UO;let E=this._findGlyphBoundingBox($,this._workBoundingBox,l,oe,x,G),Z,K;for(;;){if(this._activePages.length===0){let X=this._createNewPage();Z=X,K=X.currentRow,K.height=E.size.y;break}Z=this._activePages[this._activePages.length-1],K=Z.currentRow;for(let X of this._activePages)E.size.y<=X.currentRow.height&&(Z=X,K=X.currentRow);for(let X=this._activePages.length-1;X>=0;X--)for(let V of this._activePages[X].fixedRows)V.height<=K.height&&E.size.y<=V.height&&(Z=this._activePages[X],K=V);if(E.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new lf(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),Z=this._overflowSizePage,K=this._overflowSizePage.currentRow,K.x+E.size.x>=Z.canvas.width&&(K.x=0,K.y+=K.height,K.height=0);break}if(K.y+E.size.y>=Z.canvas.height||K.height>E.size.y+2){let X=!1;if(Z.currentRow.y+Z.currentRow.height+E.size.y>=Z.canvas.height){let V;for(let ie of this._activePages)if(ie.currentRow.y+ie.currentRow.height+E.size.y<ie.canvas.height){V=ie;break}if(V)Z=V;else if(Co.maxAtlasPages&&this._pages.length>=Co.maxAtlasPages&&K.y+E.size.y<=Z.canvas.height&&K.height>=E.size.y&&K.x+E.size.x<=Z.canvas.width)X=!0;else{let ie=this._createNewPage();Z=ie,K=ie.currentRow,K.height=E.size.y,X=!0}}X||(Z.currentRow.height>0&&Z.fixedRows.push(Z.currentRow),K={x:0,y:Z.currentRow.y+Z.currentRow.height,height:E.size.y},Z.fixedRows.push(K),Z.currentRow={x:0,y:K.y+K.height,height:0})}if(K.x+E.size.x<=Z.canvas.width)break;K===Z.currentRow?(K.x=0,K.y+=K.height,K.height=0):Z.fixedRows.splice(Z.fixedRows.indexOf(K),1)}return E.texturePage=this._pages.indexOf(Z),E.texturePosition.x=K.x,E.texturePosition.y=K.y,E.texturePositionClipSpace.x=K.x/Z.canvas.width,E.texturePositionClipSpace.y=K.y/Z.canvas.height,E.sizeClipSpace.x/=Z.canvas.width,E.sizeClipSpace.y/=Z.canvas.height,K.height=Math.max(K.height,E.size.y),K.x+=E.size.x,Z.ctx.putImageData($,E.texturePosition.x-this._workBoundingBox.left,E.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,E.size.x,E.size.y),Z.addGlyph(E),Z.version++,E}_findGlyphBoundingBox(e,t,r,s,n,o){t.top=0;let a=s?this._config.deviceCellHeight:this._tmpCanvas.height,l=s?this._config.deviceCellWidth:r,c=!1;for(let h=0;h<a;h++){for(let u=0;u<l;u++){let d=h*this._tmpCanvas.width*4+u*4+3;if(e.data[d]!==0){t.top=h,c=!0;break}}if(c)break}t.left=0,c=!1;for(let h=0;h<o+l;h++){for(let u=0;u<a;u++){let d=u*this._tmpCanvas.width*4+h*4+3;if(e.data[d]!==0){t.left=h,c=!0;break}}if(c)break}t.right=l,c=!1;for(let h=o+l-1;h>=o;h--){for(let u=0;u<a;u++){let d=u*this._tmpCanvas.width*4+h*4+3;if(e.data[d]!==0){t.right=h,c=!0;break}}if(c)break}t.bottom=a,c=!1;for(let h=a-1;h>=0;h--){for(let u=0;u<l;u++){let d=h*this._tmpCanvas.width*4+u*4+3;if(e.data[d]!==0){t.bottom=h,c=!0;break}}if(c)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:t.right-t.left+1,y:t.bottom-t.top+1},sizeClipSpace:{x:t.right-t.left+1,y:t.bottom-t.top+1},offset:{x:-t.left+o+(s||n?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-t.top+o+(s||n?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},lf=class{constructor(e,t,r){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],r)for(let s of r)this._glyphs.push(...s.glyphs),this._usedPixels+=s._usedPixels;this.canvas=d2(e,t,t),this.ctx=Zt(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(e){this._glyphs.push(e),this._usedPixels+=e.size.x*e.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function cf(i,e,t,r){let s=e.rgba>>>24,n=e.rgba>>>16&255,o=e.rgba>>>8&255,a=t.rgba>>>24,l=t.rgba>>>16&255,c=t.rgba>>>8&255,h=Math.floor((Math.abs(s-a)+Math.abs(n-l)+Math.abs(o-c))/12),u=!0;for(let d=0;d<i.data.length;d+=4)i.data[d]===s&&i.data[d+1]===n&&i.data[d+2]===o||r&&Math.abs(i.data[d]-s)+Math.abs(i.data[d+1]-n)+Math.abs(i.data[d+2]-o)<h?i.data[d+3]=0:u=!1;return u}function uX(i){for(let e=0;e<i.data.length;e+=4)if(i.data[e+3]>0)return!1;return!0}function d2(i,e,t){let r=i.createElement("canvas");return r.width=e,r.height=t,r}function dX(i,e,t,r,s,n,o,a){let l={foreground:n.foreground,background:n.background,cursor:dr,cursorAccent:dr,selectionForeground:dr,selectionBackgroundTransparent:dr,selectionBackgroundOpaque:dr,selectionInactiveBackgroundTransparent:dr,selectionInactiveBackgroundOpaque:dr,overviewRulerBorder:dr,scrollbarSliderBackground:dr,scrollbarSliderHoverBackground:dr,scrollbarSliderActiveBackground:dr,ansi:n.ansi.slice(),contrastCache:n.contrastCache,halfContrastCache:n.halfContrastCache};return{customGlyphs:s.customGlyphs,devicePixelRatio:o,deviceMaxTextureSize:a,letterSpacing:s.letterSpacing,lineHeight:s.lineHeight,deviceCellWidth:i,deviceCellHeight:e,deviceCharWidth:t,deviceCharHeight:r,fontFamily:s.fontFamily,fontSize:s.fontSize,fontWeight:s.fontWeight,fontWeightBold:s.fontWeightBold,allowTransparency:s.allowTransparency,drawBoldTextInBrightColors:s.drawBoldTextInBrightColors,minimumContrastRatio:s.minimumContrastRatio,colors:l}}function YO(i,e){for(let t=0;t<i.colors.ansi.length;t++)if(i.colors.ansi[t].rgba!==e.colors.ansi[t].rgba)return!1;return i.devicePixelRatio===e.devicePixelRatio&&i.customGlyphs===e.customGlyphs&&i.lineHeight===e.lineHeight&&i.letterSpacing===e.letterSpacing&&i.fontFamily===e.fontFamily&&i.fontSize===e.fontSize&&i.fontWeight===e.fontWeight&&i.fontWeightBold===e.fontWeightBold&&i.allowTransparency===e.allowTransparency&&i.deviceCharWidth===e.deviceCharWidth&&i.deviceCharHeight===e.deviceCharHeight&&i.drawBoldTextInBrightColors===e.drawBoldTextInBrightColors&&i.minimumContrastRatio===e.minimumContrastRatio&&i.colors.foreground.rgba===e.colors.foreground.rgba&&i.colors.background.rgba===e.colors.background.rgba}function fX(i){return(i&50331648)===16777216||(i&50331648)===33554432}var mr=[];function f2(i,e,t,r,s,n,o,a,l){let c=dX(r,s,n,o,e,t,a,l);for(let d=0;d<mr.length;d++){let f=mr[d],p=f.ownedBy.indexOf(i);if(p>=0){if(YO(f.config,c))return f.atlas;f.ownedBy.length===1?(f.atlas.dispose(),mr.splice(d,1)):f.ownedBy.splice(p,1);break}}for(let d=0;d<mr.length;d++){let f=mr[d];if(YO(f.config,c))return f.ownedBy.push(i),f.atlas}let h=i._core,u={atlas:new sn(document,c,h.unicodeService),config:c,ownedBy:[i]};return mr.push(u),u.atlas}function jO(i){for(let e=0;e<mr.length;e++){let t=mr[e].ownedBy.indexOf(i);if(t!==-1){mr[e].ownedBy.length===1?(mr[e].atlas.dispose(),mr.splice(e,1)):mr[e].ownedBy.splice(t,1);break}}}var ch=600,pX=class{constructor(i,e){this._renderCallback=i,this._coreBrowserService=e,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(i=ch){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let e=ch-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0){this._restartInterval(e);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let e=ch-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(e);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},ch)},i)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function GO(i,e,t){let r=new e.ResizeObserver(s=>{let n=s.find(l=>l.target===i);if(!n)return;if(!("devicePixelContentBoxSize"in n)){r?.disconnect(),r=void 0;return}let o=n.devicePixelContentBoxSize[0].inlineSize,a=n.devicePixelContentBoxSize[0].blockSize;o>0&&a>0&&t(o,a)});try{r.observe(i,{box:["device-pixel-content-box"]})}catch{r.disconnect(),r=void 0}return Ci(()=>r?.disconnect())}function mX(i){return i>65535?(i-=65536,String.fromCharCode((i>>10)+55296)+String.fromCharCode(i%1024+56320)):String.fromCharCode(i)}var KO=class p2 extends Ao{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new o2,this.combinedData=""}static fromCharData(e){let t=new p2;return t.setFromCharData(e),t}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?mX(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){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:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},m2=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function g2(i,e,t){let r=Zt(i.createProgram());if(i.attachShader(r,Zt(JO(i,i.VERTEX_SHADER,e))),i.attachShader(r,Zt(JO(i,i.FRAGMENT_SHADER,t))),i.linkProgram(r),i.getProgramParameter(r,i.LINK_STATUS))return r;console.error(i.getProgramInfoLog(r)),i.deleteProgram(r)}function JO(i,e,t){let r=Zt(i.createShader(e));if(i.shaderSource(r,t),i.compileShader(r),i.getShaderParameter(r,i.COMPILE_STATUS))return r;console.error(i.getShaderInfoLog(r)),i.deleteShader(r)}function gX(i,e){let t=Math.min(i.length*2,e),r=new Float32Array(t);for(let s=0;s<i.length;s++)r[s]=i[s];return r}var vX=class{constructor(i){this.texture=i,this.version=-1}},OX=`#version 300 es
88
+ layout (location = 0) in vec2 a_unitquad;
89
+ layout (location = 1) in vec2 a_cellpos;
90
+ layout (location = 2) in vec2 a_offset;
91
+ layout (location = 3) in vec2 a_size;
92
+ layout (location = 4) in float a_texpage;
93
+ layout (location = 5) in vec2 a_texcoord;
94
+ layout (location = 6) in vec2 a_texsize;
95
+
96
+ uniform mat4 u_projection;
97
+ uniform vec2 u_resolution;
98
+
99
+ out vec2 v_texcoord;
100
+ flat out int v_texpage;
101
+
102
+ void main() {
103
+ vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
104
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
105
+ v_texpage = int(a_texpage);
106
+ v_texcoord = a_texcoord + a_unitquad * a_texsize;
107
+ }`;function _X(i){let e="";for(let t=1;t<i;t++)e+=` else if (v_texpage == ${t}) { outColor = texture(u_texture[${t}], v_texcoord); }`;return`#version 300 es
108
+ precision lowp float;
109
+
110
+ in vec2 v_texcoord;
111
+ flat in int v_texpage;
112
+
113
+ uniform sampler2D u_texture[${i}];
114
+
115
+ out vec4 outColor;
116
+
117
+ void main() {
118
+ if (v_texpage == 0) {
119
+ outColor = texture(u_texture[0], v_texcoord);
120
+ } ${e}
121
+ }`}var nn=11,yo=nn*Float32Array.BYTES_PER_ELEMENT,bX=2,At=0,wt,hf=0,Ja=0,yX=class extends Br{constructor(i,e,t,r){super(),this._terminal=i,this._gl=e,this._dimensions=t,this._optionsService=r,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let s=this._gl;sn.maxAtlasPages===void 0&&(sn.maxAtlasPages=Math.min(32,Zt(s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS))),sn.maxTextureSize=Zt(s.getParameter(s.MAX_TEXTURE_SIZE))),this._program=Zt(g2(s,OX,_X(sn.maxAtlasPages))),this._register(Ci(()=>s.deleteProgram(this._program))),this._projectionLocation=Zt(s.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=Zt(s.getUniformLocation(this._program,"u_resolution")),this._textureLocation=Zt(s.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=s.createVertexArray(),s.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=s.createBuffer();this._register(Ci(()=>s.deleteBuffer(o))),s.bindBuffer(s.ARRAY_BUFFER,o),s.bufferData(s.ARRAY_BUFFER,n,s.STATIC_DRAW),s.enableVertexAttribArray(0),s.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),l=s.createBuffer();this._register(Ci(()=>s.deleteBuffer(l))),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,l),s.bufferData(s.ELEMENT_ARRAY_BUFFER,a,s.STATIC_DRAW),this._attributesBuffer=Zt(s.createBuffer()),this._register(Ci(()=>s.deleteBuffer(this._attributesBuffer))),s.bindBuffer(s.ARRAY_BUFFER,this._attributesBuffer),s.enableVertexAttribArray(2),s.vertexAttribPointer(2,2,s.FLOAT,!1,yo,0),s.vertexAttribDivisor(2,1),s.enableVertexAttribArray(3),s.vertexAttribPointer(3,2,s.FLOAT,!1,yo,2*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(3,1),s.enableVertexAttribArray(4),s.vertexAttribPointer(4,1,s.FLOAT,!1,yo,4*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(4,1),s.enableVertexAttribArray(5),s.vertexAttribPointer(5,2,s.FLOAT,!1,yo,5*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(5,1),s.enableVertexAttribArray(6),s.vertexAttribPointer(6,2,s.FLOAT,!1,yo,7*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(6,1),s.enableVertexAttribArray(1),s.vertexAttribPointer(1,2,s.FLOAT,!1,yo,9*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(1,1),s.useProgram(this._program);let c=new Int32Array(sn.maxAtlasPages);for(let h=0;h<sn.maxAtlasPages;h++)c[h]=h;s.uniform1iv(this._textureLocation,c),s.uniformMatrix4fv(this._projectionLocation,!1,m2),this._atlasTextures=[];for(let h=0;h<sn.maxAtlasPages;h++){let u=new vX(Zt(s.createTexture()));this._register(Ci(()=>s.deleteTexture(u.texture))),s.activeTexture(s.TEXTURE0+h),s.bindTexture(s.TEXTURE_2D,u.texture),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,1,1,0,s.RGBA,s.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[h]=u}s.enable(s.BLEND),s.blendFunc(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(i,e,t,r,s,n,o,a,l){this._updateCell(this._vertices.attributes,i,e,t,r,s,n,o,a,l)}_updateCell(i,e,t,r,s,n,o,a,l,c){if(At=(t*this._terminal.cols+e)*nn,r===0||r===void 0){i.fill(0,At,At+nn-1-bX);return}this._atlas&&(a&&a.length>1?wt=this._atlas.getRasterizedGlyphCombinedChar(a,s,n,o,!1,this._terminal.element):wt=this._atlas.getRasterizedGlyph(r,s,n,o,!1,this._terminal.element),hf=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),s!==c&&wt.offset.x>hf?(Ja=wt.offset.x-hf,i[At]=-(wt.offset.x-Ja)+this._dimensions.device.char.left,i[At+1]=-wt.offset.y+this._dimensions.device.char.top,i[At+2]=(wt.size.x-Ja)/this._dimensions.device.canvas.width,i[At+3]=wt.size.y/this._dimensions.device.canvas.height,i[At+4]=wt.texturePage,i[At+5]=wt.texturePositionClipSpace.x+Ja/this._atlas.pages[wt.texturePage].canvas.width,i[At+6]=wt.texturePositionClipSpace.y,i[At+7]=wt.sizeClipSpace.x-Ja/this._atlas.pages[wt.texturePage].canvas.width,i[At+8]=wt.sizeClipSpace.y):(i[At]=-wt.offset.x+this._dimensions.device.char.left,i[At+1]=-wt.offset.y+this._dimensions.device.char.top,i[At+2]=wt.size.x/this._dimensions.device.canvas.width,i[At+3]=wt.size.y/this._dimensions.device.canvas.height,i[At+4]=wt.texturePage,i[At+5]=wt.texturePositionClipSpace.x,i[At+6]=wt.texturePositionClipSpace.y,i[At+7]=wt.sizeClipSpace.x,i[At+8]=wt.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&DZ(r,l,wt.size.x,this._dimensions.device.cell.width)&&(i[At+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let i=this._terminal,e=i.cols*i.rows*nn;this._vertices.count!==e?this._vertices.attributes=new Float32Array(e):this._vertices.attributes.fill(0);let t=0;for(;t<this._vertices.attributesBuffers.length;t++)this._vertices.count!==e?this._vertices.attributesBuffers[t]=new Float32Array(e):this._vertices.attributesBuffers[t].fill(0);this._vertices.count=e,t=0;for(let r=0;r<i.rows;r++)for(let s=0;s<i.cols;s++)this._vertices.attributes[t+9]=s/i.cols,this._vertices.attributes[t+10]=r/i.rows,t+=nn}handleResize(){let i=this._gl;i.useProgram(this._program),i.viewport(0,0,i.canvas.width,i.canvas.height),i.uniform2f(this._resolutionLocation,i.canvas.width,i.canvas.height),this.clear()}render(i){if(!this._atlas)return;let e=this._gl;e.useProgram(this._program),e.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let t=this._vertices.attributesBuffers[this._activeBuffer],r=0;for(let s=0;s<i.lineLengths.length;s++){let n=s*this._terminal.cols*nn,o=this._vertices.attributes.subarray(n,n+i.lineLengths[s]*nn);t.set(o,r),r+=o.length}e.bindBuffer(e.ARRAY_BUFFER,this._attributesBuffer),e.bufferData(e.ARRAY_BUFFER,t.subarray(0,r),e.STREAM_DRAW);for(let s=0;s<this._atlas.pages.length;s++)this._atlas.pages[s].version!==this._atlasTextures[s].version&&this._bindAtlasPageTexture(e,this._atlas,s);e.drawElementsInstanced(e.TRIANGLE_STRIP,4,e.UNSIGNED_BYTE,0,r/nn)}setAtlas(i){this._atlas=i;for(let e of this._atlasTextures)e.version=-1}_bindAtlasPageTexture(i,e,t){i.activeTexture(i.TEXTURE0+t),i.bindTexture(i.TEXTURE_2D,this._atlasTextures[t].texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,e.pages[t].canvas),i.generateMipmap(i.TEXTURE_2D),this._atlasTextures[t].version=e.pages[t].version}setDimensions(i){this._dimensions=i}},xX=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(i,e,t,r=!1){if(this.selectionStart=e,this.selectionEnd=t,!e||!t||e[0]===t[0]&&e[1]===t[1]){this.clear();return}let s=i.buffers.active.ydisp,n=e[1]-s,o=t[1]-s,a=Math.max(n,0),l=Math.min(o,i.rows-1);if(a>=i.rows||l<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=l,this.startCol=e[0],this.endCol=t[0]}isCellSelected(i,e,t){return this.hasSelection?(t-=i.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?e>=this.startCol&&t>=this.viewportCappedStartRow&&e<this.endCol&&t<=this.viewportCappedEndRow:e<this.startCol&&t>=this.viewportCappedStartRow&&e>=this.endCol&&t<=this.viewportCappedEndRow:t>this.viewportStartRow&&t<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&t===this.viewportStartRow&&e>=this.startCol&&e<this.endCol||this.viewportStartRow<this.viewportEndRow&&t===this.viewportEndRow&&e<this.endCol||this.viewportStartRow<this.viewportEndRow&&t===this.viewportStartRow&&e>=this.startCol):!1}};function wX(){return new xX}var ku=4,Ah=1,Rh=2,uf=3,SX=2147483648,kX=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=wX()}resize(i,e){let t=i*e*ku;t!==this.cells.length&&(this.cells=new Uint32Array(t),this.lineLengths=new Uint32Array(e))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},CX=`#version 300 es
122
+ layout (location = 0) in vec2 a_position;
123
+ layout (location = 1) in vec2 a_size;
124
+ layout (location = 2) in vec4 a_color;
125
+ layout (location = 3) in vec2 a_unitquad;
126
+
127
+ uniform mat4 u_projection;
128
+
129
+ out vec4 v_color;
130
+
131
+ void main() {
132
+ vec2 zeroToOne = a_position + (a_unitquad * a_size);
133
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
134
+ v_color = a_color;
135
+ }`,$X=`#version 300 es
136
+ precision lowp float;
137
+
138
+ in vec4 v_color;
139
+
140
+ out vec4 outColor;
141
+
142
+ void main() {
143
+ outColor = v_color;
144
+ }`,Ts=8,df=Ts*Float32Array.BYTES_PER_ELEMENT,PX=20*Ts,e_=class{constructor(){this.attributes=new Float32Array(PX),this.count=0}},ks=0,t_=0,i_=0,r_=0,s_=0,n_=0,o_=0,TX=class extends Br{constructor(i,e,t,r){super(),this._terminal=i,this._gl=e,this._dimensions=t,this._themeService=r,this._vertices=new e_,this._verticesCursor=new e_;let s=this._gl;this._program=Zt(g2(s,CX,$X)),this._register(Ci(()=>s.deleteProgram(this._program))),this._projectionLocation=Zt(s.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=s.createVertexArray(),s.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=s.createBuffer();this._register(Ci(()=>s.deleteBuffer(o))),s.bindBuffer(s.ARRAY_BUFFER,o),s.bufferData(s.ARRAY_BUFFER,n,s.STATIC_DRAW),s.enableVertexAttribArray(3),s.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),l=s.createBuffer();this._register(Ci(()=>s.deleteBuffer(l))),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,l),s.bufferData(s.ELEMENT_ARRAY_BUFFER,a,s.STATIC_DRAW),this._attributesBuffer=Zt(s.createBuffer()),this._register(Ci(()=>s.deleteBuffer(this._attributesBuffer))),s.bindBuffer(s.ARRAY_BUFFER,this._attributesBuffer),s.enableVertexAttribArray(0),s.vertexAttribPointer(0,2,s.FLOAT,!1,df,0),s.vertexAttribDivisor(0,1),s.enableVertexAttribArray(1),s.vertexAttribPointer(1,2,s.FLOAT,!1,df,2*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(1,1),s.enableVertexAttribArray(2),s.vertexAttribPointer(2,4,s.FLOAT,!1,df,4*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(c=>{this._updateCachedColors(c),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(i){let e=this._gl;e.useProgram(this._program),e.bindVertexArray(this._vertexArrayObject),e.uniformMatrix4fv(this._projectionLocation,!1,m2),e.bindBuffer(e.ARRAY_BUFFER,this._attributesBuffer),e.bufferData(e.ARRAY_BUFFER,i.attributes,e.DYNAMIC_DRAW),e.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,e.UNSIGNED_BYTE,0,i.count)}handleResize(){this._updateViewportRectangle()}setDimensions(i){this._dimensions=i}_updateCachedColors(i){this._bgFloat=this._colorToFloat32Array(i.background),this._cursorFloat=this._colorToFloat32Array(i.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(i){let e=this._terminal,t=this._vertices,r=1,s,n,o,a,l,c,h,u,d,f,p;for(s=0;s<e.rows;s++){for(o=-1,a=0,l=0,c=!1,n=0;n<e.cols;n++)h=(s*e.cols+n)*ku,u=i.cells[h+Ah],d=i.cells[h+Rh],f=!!(d&67108864),(u!==a||d!==l&&(c||f))&&((a!==0||c&&l!==0)&&(p=r++*Ts,this._updateRectangle(t,p,l,a,o,n,s)),o=n,a=u,l=d,c=f);(a!==0||c&&l!==0)&&(p=r++*Ts,this._updateRectangle(t,p,l,a,o,e.cols,s))}t.count=r}updateCursor(i){let e=this._verticesCursor,t=i.cursor;if(!t||t.style==="block"){e.count=0;return}let r,s=0;(t.style==="bar"||t.style==="outline")&&(r=s++*Ts,this._addRectangleFloat(e.attributes,r,t.x*this._dimensions.device.cell.width,t.y*this._dimensions.device.cell.height,t.style==="bar"?t.dpr*t.cursorWidth:t.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(t.style==="underline"||t.style==="outline")&&(r=s++*Ts,this._addRectangleFloat(e.attributes,r,t.x*this._dimensions.device.cell.width,(t.y+1)*this._dimensions.device.cell.height-t.dpr,t.width*this._dimensions.device.cell.width,t.dpr,this._cursorFloat)),t.style==="outline"&&(r=s++*Ts,this._addRectangleFloat(e.attributes,r,t.x*this._dimensions.device.cell.width,t.y*this._dimensions.device.cell.height,t.width*this._dimensions.device.cell.width,t.dpr,this._cursorFloat),r=s++*Ts,this._addRectangleFloat(e.attributes,r,(t.x+t.width)*this._dimensions.device.cell.width-t.dpr,t.y*this._dimensions.device.cell.height,t.dpr,this._dimensions.device.cell.height,this._cursorFloat)),e.count=s}_updateRectangle(i,e,t,r,s,n,o){if(t&67108864)switch(t&50331648){case 16777216:case 33554432:ks=this._themeService.colors.ansi[t&255].rgba;break;case 50331648:ks=(t&16777215)<<8;break;default:ks=this._themeService.colors.foreground.rgba}else switch(r&50331648){case 16777216:case 33554432:ks=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:ks=(r&16777215)<<8;break;default:ks=this._themeService.colors.background.rgba}i.attributes.length<e+4&&(i.attributes=gX(i.attributes,this._terminal.rows*this._terminal.cols*Ts)),t_=s*this._dimensions.device.cell.width,i_=o*this._dimensions.device.cell.height,r_=(ks>>24&255)/255,s_=(ks>>16&255)/255,n_=(ks>>8&255)/255,o_=1,this._addRectangle(i.attributes,e,t_,i_,(n-s)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,r_,s_,n_,o_)}_addRectangle(i,e,t,r,s,n,o,a,l,c){i[e]=t/this._dimensions.device.canvas.width,i[e+1]=r/this._dimensions.device.canvas.height,i[e+2]=s/this._dimensions.device.canvas.width,i[e+3]=n/this._dimensions.device.canvas.height,i[e+4]=o,i[e+5]=a,i[e+6]=l,i[e+7]=c}_addRectangleFloat(i,e,t,r,s,n,o){i[e]=t/this._dimensions.device.canvas.width,i[e+1]=r/this._dimensions.device.canvas.height,i[e+2]=s/this._dimensions.device.canvas.width,i[e+3]=n/this._dimensions.device.canvas.height,i[e+4]=o[0],i[e+5]=o[1],i[e+6]=o[2],i[e+7]=o[3]}_colorToFloat32Array(i){return new Float32Array([(i.rgba>>24&255)/255,(i.rgba>>16&255)/255,(i.rgba>>8&255)/255,(i.rgba&255)/255])}},MX=class extends Br{constructor(i,e,t,r,s,n,o,a){super(),this._container=e,this._alpha=s,this._coreBrowserService=n,this._optionsService=o,this._themeService=a,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${t}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(l=>{this._refreshCharAtlas(i,l),this.reset(i)})),this._register(Ci(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Zt(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(i){}handleFocus(i){}handleCursorMove(i){}handleGridChanged(i,e,t){}handleSelectionChanged(i,e,t,r=!1){}_setTransparency(i,e){if(e===this._alpha)return;let t=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,t),this._refreshCharAtlas(i,this._themeService.colors),this.handleGridChanged(i,0,i.rows-1)}_refreshCharAtlas(i,e){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=f2(i,this._optionsService.rawOptions,e,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(i,e){this._deviceCellWidth=e.device.cell.width,this._deviceCellHeight=e.device.cell.height,this._deviceCharWidth=e.device.char.width,this._deviceCharHeight=e.device.char.height,this._deviceCharLeft=e.device.char.left,this._deviceCharTop=e.device.char.top,this._canvas.width=e.device.canvas.width,this._canvas.height=e.device.canvas.height,this._canvas.style.width=`${e.css.canvas.width}px`,this._canvas.style.height=`${e.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(i,this._themeService.colors)}_fillBottomLineAtCells(i,e,t=1){this._ctx.fillRect(i*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,t*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(i,e,t,r){this._alpha?this._ctx.clearRect(i*this._deviceCellWidth,e*this._deviceCellHeight,t*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(i*this._deviceCellWidth,e*this._deviceCellHeight,t*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(i,e,t,r){this._ctx.font=this._getFont(i,!1,!1),this._ctx.textBaseline=t2,this._clipCell(t,r,e.getWidth()),this._ctx.fillText(e.getChars(),t*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(i,e,t){this._ctx.beginPath(),this._ctx.rect(i*this._deviceCellWidth,e*this._deviceCellHeight,t*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(i,e,t){let r=e?i.options.fontWeightBold:i.options.fontWeight;return`${t?"italic":""} ${r} ${i.options.fontSize*this._coreBrowserService.dpr}px ${i.options.fontFamily}`}},QX=class extends MX{constructor(i,e,t,r,s,n,o){super(t,i,"link",e,!0,s,n,o),this._register(r.onShowLinkUnderline(a=>this._handleShowLinkUnderline(a))),this._register(r.onHideLinkUnderline(a=>this._handleHideLinkUnderline(a)))}resize(i,e){super.resize(i,e),this._state=void 0}reset(i){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let i=this._state.y2-this._state.y1-1;i>0&&this._clearCells(0,this._state.y1+1,this._state.cols,i),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(i){if(i.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:i.fg!==void 0&&fX(i.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[i.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,i.y1===i.y2)this._fillBottomLineAtCells(i.x1,i.y1,i.x2-i.x1);else{this._fillBottomLineAtCells(i.x1,i.y1,i.cols-i.x1);for(let e=i.y1+1;e<i.y2;e++)this._fillBottomLineAtCells(0,e,i.cols);this._fillBottomLineAtCells(0,i.y2,i.x2)}this._state=i}_handleHideLinkUnderline(i){this._clearCurrentLink()}},qn=typeof window=="object"?window:globalThis,gm=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new kt,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new kt,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let r=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(r,e),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let r=this.getWindowId(t);this.mapWindowIdToFullScreen.set(r,e),this._onDidChangeFullscreen.fire(r)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};gm.INSTANCE=new gm;var v2=gm;function AX(i,e,t){typeof e=="string"&&(e=i.matchMedia(e)),e.addEventListener("change",t)}v2.INSTANCE.onDidChangeZoomLevel;v2.INSTANCE.onDidChangeFullscreen;var ha=typeof navigator=="object"?navigator.userAgent:"";ha.indexOf("Firefox")>=0;ha.indexOf("AppleWebKit")>=0;var RX=ha.indexOf("Chrome")>=0;!RX&&ha.indexOf("Safari")>=0;ha.indexOf("Electron/")>=0;ha.indexOf("Android")>=0;var ff=!1;if(typeof qn.matchMedia=="function"){let i=qn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=qn.matchMedia("(display-mode: fullscreen)");ff=i.matches,AX(qn,i,({matches:t})=>{ff&&e.matches||(ff=t)})}var Ro="en",pf=!1,O2=!1,hh,Bh=Ro,a_=Ro,BX,Ps,Gn=globalThis,er;typeof Gn.vscode<"u"&&typeof Gn.vscode.process<"u"?er=Gn.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(er=process);var LX=typeof er?.versions?.electron=="string",EX=LX&&er?.type==="renderer";if(typeof er=="object"){er.platform,er.platform,pf=er.platform==="linux",pf&&er.env.SNAP&&er.env.SNAP_REVISION,er.env.CI||er.env.BUILD_ARTIFACTSTAGINGDIRECTORY,hh=Ro,Bh=Ro;let i=er.env.VSCODE_NLS_CONFIG;if(i)try{let e=JSON.parse(i);hh=e.userLocale,a_=e.osLocale,Bh=e.resolvedLanguage||Ro,BX=e.languagePack?.translationsConfigFile}catch{}O2=!0}else typeof navigator=="object"&&!EX?(Ps=navigator.userAgent,Ps.indexOf("Windows")>=0,Ps.indexOf("Macintosh")>=0,(Ps.indexOf("Macintosh")>=0||Ps.indexOf("iPad")>=0||Ps.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,pf=Ps.indexOf("Linux")>=0,Ps?.indexOf("Mobi")>=0,Bh=globalThis._VSCODE_NLS_LANGUAGE||Ro,hh=navigator.language.toLowerCase(),a_=hh):console.error("Unable to resolve platform.");var l_=O2,ds=Ps,tn=Bh,DX;(i=>{function e(){return tn}i.value=e;function t(){return tn.length===2?tn==="en":tn.length>=3?tn[0]==="e"&&tn[1]==="n"&&tn[2]==="-":!1}i.isDefaultVariant=t;function r(){return tn==="en"}i.isDefault=r})(DX||={});var IX=typeof Gn.postMessage=="function"&&!Gn.importScripts;(()=>{if(IX){let i=[];Gn.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let r=0,s=i.length;r<s;r++){let n=i[r];if(n.id===t.data.vscodeScheduleAsyncWork){i.splice(r,1),n.callback();return}}});let e=0;return t=>{let r=++e;i.push({id:r,callback:t}),Gn.postMessage({vscodeScheduleAsyncWork:r},"*")}}return i=>setTimeout(i)})();var zX=!!(ds&&ds.indexOf("Chrome")>=0);ds&&ds.indexOf("Firefox")>=0;!zX&&ds&&ds.indexOf("Safari")>=0;ds&&ds.indexOf("Edg/")>=0;ds&&ds.indexOf("Android")>=0;var xo=typeof navigator=="object"?navigator:{};l_||document.queryCommandSupported&&document.queryCommandSupported("copy")||xo&&xo.clipboard&&xo.clipboard.writeText,l_||xo&&xo.clipboard&&xo.clipboard.readText;var Xg=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(i,e){this._keyCodeToStr[i]=e,this._strToKeyCode[e.toLowerCase()]=i}keyCodeToStr(i){return this._keyCodeToStr[i]}strToKeyCode(i){return this._strToKeyCode[i.toLowerCase()]||0}},mf=new Xg,c_=new Xg,h_=new Xg;new Array(230);var NX;(i=>{function e(a){return mf.keyCodeToStr(a)}i.toString=e;function t(a){return mf.strToKeyCode(a)}i.fromString=t;function r(a){return c_.keyCodeToStr(a)}i.toUserSettingsUS=r;function s(a){return h_.keyCodeToStr(a)}i.toUserSettingsGeneral=s;function n(a){return c_.strToKeyCode(a)||h_.strToKeyCode(a)}i.fromUserSettings=n;function o(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return mf.keyCodeToStr(a)}i.toElectronAccelerator=o})(NX||={});var _2=Object.freeze(function(i,e){let t=setTimeout(i.bind(e),0);return{dispose(){clearTimeout(t)}}}),WX;(i=>{function e(t){return t===i.None||t===i.Cancelled||t instanceof ZX?!0:!t||typeof t!="object"?!1:typeof t.isCancellationRequested=="boolean"&&typeof t.onCancellationRequested=="function"}i.isCancellationToken=e,i.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Rs.None}),i.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:_2})})(WX||={});var ZX=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?_2:(this._emitter||(this._emitter=new kt),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},XX;(i=>{async function e(r){let s,n=await Promise.all(r.map(o=>o.then(a=>a,a=>{s||(s=a)})));if(typeof s<"u")throw s;return n}i.settled=e;function t(r){return new Promise(async(s,n)=>{try{await r(s,n)}catch(o){n(o)}})}i.withAsyncBody=t})(XX||={});var u_=class fr{static fromArray(e){return new fr(t=>{t.emitMany(e)})}static fromPromise(e){return new fr(async t=>{t.emitMany(await e)})}static fromPromises(e){return new fr(async t=>{await Promise.all(e.map(async r=>t.emitOne(await r)))})}static merge(e){return new fr(async t=>{await Promise.all(e.map(async r=>{for await(let s of r)t.emitOne(s)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new kt,queueMicrotask(async()=>{let r={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(e(r)),this.resolve()}catch(s){this.reject(s)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await Rs.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(e,t){return new fr(async r=>{for await(let s of e)r.emitOne(t(s))})}map(e){return fr.map(this,e)}static filter(e,t){return new fr(async r=>{for await(let s of e)t(s)&&r.emitOne(s)})}filter(e){return fr.filter(this,e)}static coalesce(e){return fr.filter(e,t=>!!t)}coalesce(){return fr.coalesce(this)}static async toPromise(e){let t=[];for await(let r of e)t.push(r);return t}toPromise(){return fr.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};u_.EMPTY=u_.fromArray([]);var{getWindow:FX}=(function(){let i=new Map,e={window:qn,disposables:new Zo};i.set(qn.vscodeWindowId,e);let t=new kt,r=new kt,s=new kt;function n(o,a){return(typeof o=="number"?i.get(o):void 0)??(a?e:void 0)}return{onDidRegisterWindow:t.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:r.event,registerWindow(o){if(i.has(o.vscodeWindowId))return Br.None;let a=new Zo,l={window:o,disposables:a.add(new Zo)};return i.set(o.vscodeWindowId,l),a.add(Ci(()=>{i.delete(o.vscodeWindowId),r.fire(o)})),a.add(vm(o,qX.BEFORE_UNLOAD,()=>{s.fire(o)})),t.fire(l),a},getWindows(){return i.values()},getWindowsCount(){return i.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return i.has(o)},getWindowById:n,getWindow(o){let a=o;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;let l=o;return l?.view?l.view.window:qn},getDocument(o){return FX(o).document}}})(),VX=class{constructor(i,e,t,r){this._node=i,this._type=e,this._handler=t,this._options=r||!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 vm(i,e,t,r){return new VX(i,e,t,r)}var qX={BEFORE_UNLOAD:"beforeunload"},HX=class extends Br{constructor(i,e,t,r,s,n,o,a,l){super(),this._terminal=i,this._characterJoinerService=e,this._charSizeService=t,this._coreBrowserService=r,this._coreService=s,this._decorationService=n,this._optionsService=o,this._themeService=a,this._cursorBlinkStateManager=new ja,this._charAtlasDisposable=this._register(new ja),this._observerDisposable=this._register(new ja),this._model=new kX,this._workCell=new KO,this._workCell2=new KO,this._rectangleRenderer=this._register(new ja),this._glyphRenderer=this._register(new ja),this._onChangeTextureAtlas=this._register(new kt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new kt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new kt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new kt),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new kt),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let c={antialias:!1,depth:!1,preserveDrawingBuffer:l};if(this._gl=this._canvas.getContext("webgl2",c),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new NZ(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new QX(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=IZ(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(vm(this._canvas,"webglcontextlost",h=>{console.log("webglcontextlost event received"),h.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(h)},3e3)})),this._register(vm(this._canvas,"webglcontextrestored",h=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,jO(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=GO(this._canvas,this._coreBrowserService.window,(h,u)=>this._setCanvasDevicePixelDimensions(h,u)),this._register(this._coreBrowserService.onWindowChange(h=>{this._observerDisposable.value=GO(this._canvas,h,(u,d)=>this._setCanvasDevicePixelDimensions(u,d))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Ci(()=>{for(let h of this._renderLayers)h.dispose();this._canvas.parentElement?.removeChild(this._canvas),jO(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(i,e){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let t of this._renderLayers)t.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let i of this._renderLayers)i.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let i of this._renderLayers)i.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(i,e,t){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,i,e,t);this._model.selection.update(this._core,i,e,t),this._requestRedrawViewport()}handleCursorMove(){for(let i of this._renderLayers)i.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new TX(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new yX(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let i=f2(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==i&&(this._onChangeTextureAtlas.fire(i.pages[0].canvas),this._charAtlasDisposable.value=jS(Rs.forward(i.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Rs.forward(i.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=i,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(i){this._model.clear(),i&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let i of this._renderLayers)i.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(i,e){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let t of this._renderLayers)t.handleGridChanged(this._terminal,i,e);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(i,e),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new pX(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(i,e){let t=this._core,r=this._workCell,s,n,o,a,l,c,h=0,u=!0,d,f,p,g,O,_,k,P,w;i=d_(i,t.rows-1,0),e=d_(e,t.rows-1,0);let C=this._coreService.decPrivateModes.cursorStyle??t.options.cursorStyle??"block",M=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,D=M-t.buffer.ydisp,j=Math.min(this._terminal.buffer.active.cursorX,t.cols-1),oe=-1,ae=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let G=!1;for(n=i;n<=e;n++)for(o=n+t.buffer.ydisp,a=t.buffer.lines.get(o),this._model.lineLengths[n]=0,p=M===o,h=0,l=this._characterJoinerService.getJoinedCharacters(o),P=0;P<t.cols;P++){if(s=this._cellColorResolver.result.bg,a.loadCell(P,r),P===0&&(s=this._cellColorResolver.result.bg),c=!1,u=P>=h,d=P,l.length>0&&P===l[0][0]&&u){f=l.shift();let x=this._model.selection.isCellSelected(this._terminal,f[0],o);for(k=f[0]+1;k<f[1];k++)u&&=x===this._model.selection.isCellSelected(this._terminal,k,o);u&&=!p||j<f[0]||j>=f[1],u?(c=!0,r=new UX(r,a.translateToString(!0,f[0],f[1]),f[1]-f[0]),d=f[1]-1):h=f[1]}if(g=r.getChars(),O=r.getCode(),k=(n*t.cols+P)*ku,this._cellColorResolver.resolve(r,P,o,this.dimensions.device.cell.width),ae&&o===M&&(P===j&&(this._model.cursor={x:j,y:D,width:r.getWidth(),style:this._coreBrowserService.isFocused?C:t.options.cursorInactiveStyle,cursorWidth:t.options.cursorWidth,dpr:this._devicePixelRatio},oe=j+r.getWidth()-1),P>=j&&P<=oe&&(this._coreBrowserService.isFocused&&C==="block"||this._coreBrowserService.isFocused===!1&&t.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),O!==0&&(this._model.lineLengths[n]=P+1),!(this._model.cells[k]===O&&this._model.cells[k+Ah]===this._cellColorResolver.result.bg&&this._model.cells[k+Rh]===this._cellColorResolver.result.fg&&this._model.cells[k+uf]===this._cellColorResolver.result.ext)&&(G=!0,g.length>1&&(O|=SX),this._model.cells[k]=O,this._model.cells[k+Ah]=this._cellColorResolver.result.bg,this._model.cells[k+Rh]=this._cellColorResolver.result.fg,this._model.cells[k+uf]=this._cellColorResolver.result.ext,_=r.getWidth(),this._glyphRenderer.value.updateCell(P,n,O,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,g,_,s),c)){for(r=this._workCell,P++;P<=d;P++)w=(n*t.cols+P)*ku,this._glyphRenderer.value.updateCell(P,n,0,0,0,0,QZ,0,0),this._model.cells[w]=0,this._model.cells[w+Ah]=this._cellColorResolver.result.bg,this._model.cells[w+Rh]=this._cellColorResolver.result.fg,this._model.cells[w+uf]=this._cellColorResolver.result.ext;P--}}G&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(i,e){this._canvas.width===i&&this._canvas.height===e||(this._canvas.width=i,this._canvas.height=e,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let i=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:i,end:i})}},UX=class extends Ao{constructor(i,e,t){super(),this.content=0,this.combinedData="",this.fg=i.fg,this.bg=i.bg,this.combinedData=e,this._width=t}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(i){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function d_(i,e,t=0){return Math.max(Math.min(i,e),t)}var f_="di$target",p_="di$dependencies",gf=new Map;function ms(i){if(gf.has(i))return gf.get(i);let e=function(t,r,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");YX(e,t,s)};return e._id=i,gf.set(i,e),e}function YX(i,e,t){e[f_]===e?e[p_].push({id:i,index:t}):(e[p_]=[{id:i,index:t}],e[f_]=e)}ms("BufferService");ms("CoreMouseService");ms("CoreService");ms("CharsetService");ms("InstantiationService");ms("LogService");var jX=ms("OptionsService");ms("OscLinkService");ms("UnicodeService");ms("DecorationService");var GX={trace:0,debug:1,info:2,warn:3,error:4,off:5},KX="xterm.js: ",m_=class extends Br{constructor(i){super(),this._optionsService=i,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=GX[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(i){for(let e=0;e<i.length;e++)typeof i[e]=="function"&&(i[e]=i[e]())}_log(i,e,t){this._evalLazyOptionalParams(t),i.call(console,(this._optionsService.options.logger?"":KX)+e,...t)}trace(i,...e){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,i,e)}debug(i,...e){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,i,e)}info(i,...e){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,i,e)}warn(i,...e){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,i,e)}error(i,...e){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,i,e)}};m_=_Z([bZ(0,jX)],m_);var JX=class extends Br{constructor(i){if(JS&&MZ()<16){let e={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",e))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=i,this._onChangeTextureAtlas=this._register(new kt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new kt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new kt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new kt),this.onContextLoss=this._onContextLoss.event}activate(i){let e=i._core;if(!i.element){this._register(e.onWillOpen(()=>this.activate(i)));return}this._terminal=i;let t=e.coreService,r=e.optionsService,s=e,n=s._renderService,o=s._characterJoinerService,a=s._charSizeService,l=s._coreBrowserService,c=s._decorationService;s._logService;let h=s._themeService;this._renderer=this._register(new HX(i,o,a,l,t,c,r,h,this._preserveDrawingBuffer)),this._register(Rs.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Rs.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Rs.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Rs.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),n.setRenderer(this._renderer),this._register(Ci(()=>{if(this._terminal._core._store._isDisposed)return;let u=this._terminal._core._renderService;u.setRenderer(this._terminal._core._createRenderer()),u.handleResize(i.cols,i.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var vf=[[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]],eF=[[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]],Yt;function tF(i,e){let t=0,r=e.length-1,s;if(i<e[0][0]||i>e[r][1])return!1;for(;r>=t;)if(s=t+r>>1,i>e[s][1])t=s+1;else if(i<e[s][0])r=s-1;else return!0;return!1}var iF=class{constructor(){if(this.version="6",!Yt){Yt=new Uint8Array(65536),Yt.fill(1),Yt[0]=0,Yt.fill(0,1,32),Yt.fill(0,127,160),Yt.fill(2,4352,4448),Yt[9001]=2,Yt[9002]=2,Yt.fill(2,11904,42192),Yt[12351]=1,Yt.fill(2,44032,55204),Yt.fill(2,63744,64256),Yt.fill(2,65040,65050),Yt.fill(2,65072,65136),Yt.fill(2,65280,65377),Yt.fill(2,65504,65511);for(let i=0;i<vf.length;++i)Yt.fill(0,vf[i][0],vf[i][1]+1)}}wcwidth(i){return i<32?0:i<127?1:i<65536?Yt[i]:tF(i,eF)?0:i>=131072&&i<=196605||i>=196608&&i<=262141?2:1}charProperties(i,e){let t=this.wcwidth(i),r=t===0&&e!==0;if(r){let s=$u.extractWidth(e);s===0?r=!1:s>t&&(t=s)}return $u.createPropertyValue(0,t,r)}},rF=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(i){setTimeout(()=>{throw i.stack?g_.isErrorNoTelemetry(i)?new g_(i.message+`
145
+
146
+ `+i.stack):new Error(i.message+`
147
+
148
+ `+i.stack):i},0)}}addListener(i){return this.listeners.push(i),()=>{this._removeListener(i)}}emit(i){this.listeners.forEach(e=>{e(i)})}_removeListener(i){this.listeners.splice(this.listeners.indexOf(i),1)}setUnexpectedErrorHandler(i){this.unexpectedErrorHandler=i}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(i){this.unexpectedErrorHandler(i),this.emit(i)}onUnexpectedExternalError(i){this.unexpectedErrorHandler(i)}},sF=new rF;function Of(i){nF(i)||sF.onUnexpectedError(i)}var Om="Canceled";function nF(i){return i instanceof oF?!0:i instanceof Error&&i.name===Om&&i.message===Om}var oF=class extends Error{constructor(){super(Om),this.name=this.message}},g_=class _m extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof _m)return e;let t=new _m;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}};function aF(i,e){let t=this,r=!1,s;return function(){return r||(r=!0,e||(s=i.apply(t,arguments))),s}}var lF;(i=>{function e(n){return n<0}i.isLessThan=e;function t(n){return n<=0}i.isLessThanOrEqual=t;function r(n){return n>0}i.isGreaterThan=r;function s(n){return n===0}i.isNeitherLessOrGreaterThan=s,i.greaterThan=1,i.lessThan=-1,i.neitherLessOrGreaterThan=0})(lF||={});var b2;(i=>{function e(w){return w&&typeof w=="object"&&typeof w[Symbol.iterator]=="function"}i.is=e;let t=Object.freeze([]);function r(){return t}i.empty=r;function*s(w){yield w}i.single=s;function n(w){return e(w)?w:s(w)}i.wrap=n;function o(w){return w||t}i.from=o;function*a(w){for(let C=w.length-1;C>=0;C--)yield w[C]}i.reverse=a;function l(w){return!w||w[Symbol.iterator]().next().done===!0}i.isEmpty=l;function c(w){return w[Symbol.iterator]().next().value}i.first=c;function h(w,C){let M=0;for(let D of w)if(C(D,M++))return!0;return!1}i.some=h;function u(w,C){for(let M of w)if(C(M))return M}i.find=u;function*d(w,C){for(let M of w)C(M)&&(yield M)}i.filter=d;function*f(w,C){let M=0;for(let D of w)yield C(D,M++)}i.map=f;function*p(w,C){let M=0;for(let D of w)yield*C(D,M++)}i.flatMap=p;function*g(...w){for(let C of w)yield*C}i.concat=g;function O(w,C,M){let D=M;for(let j of w)D=C(D,j);return D}i.reduce=O;function*_(w,C,M=w.length){for(C<0&&(C+=w.length),M<0?M+=w.length:M>w.length&&(M=w.length);C<M;C++)yield w[C]}i.slice=_;function k(w,C=Number.POSITIVE_INFINITY){let M=[];if(C===0)return[M,w];let D=w[Symbol.iterator]();for(let j=0;j<C;j++){let oe=D.next();if(oe.done)return[M,i.empty()];M.push(oe.value)}return[M,{[Symbol.iterator](){return D}}]}i.consume=k;async function P(w){let C=[];for await(let M of w)C.push(M);return Promise.resolve(C)}i.asyncToArray=P})(b2||={});function y2(i){if(b2.is(i)){let e=[];for(let t of i)if(t)try{t.dispose()}catch(r){e.push(r)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(i)?[]:i}else if(i)return i.dispose(),i}function cF(...i){return x2(()=>y2(i))}function x2(i){return{dispose:aF(()=>{i()})}}var w2=class S2{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{y2(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?S2.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};w2.DISABLE_DISPOSED_WARNING=!1;var Fg=w2,Cu=class{constructor(){this._store=new Fg,this._store}dispose(){this._store.dispose()}_register(i){if(i===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(i)}};Cu.None=Object.freeze({dispose(){}});var hF=globalThis.performance&&typeof globalThis.performance.now=="function",uF=class k2{static create(e){return new k2(e)}constructor(e){this._now=hF&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},dF;(i=>{i.None=()=>Cu.None;function e(x,b){return u(x,()=>{},0,void 0,!0,void 0,b)}i.defer=e;function t(x){return(b,T=null,$)=>{let R=!1,E;return E=x(Z=>{if(!R)return E?E.dispose():R=!0,b.call(T,Z)},null,$),R&&E.dispose(),E}}i.once=t;function r(x,b,T){return c(($,R=null,E)=>x(Z=>$.call(R,b(Z)),null,E),T)}i.map=r;function s(x,b,T){return c(($,R=null,E)=>x(Z=>{b(Z),$.call(R,Z)},null,E),T)}i.forEach=s;function n(x,b,T){return c(($,R=null,E)=>x(Z=>b(Z)&&$.call(R,Z),null,E),T)}i.filter=n;function o(x){return x}i.signal=o;function a(...x){return(b,T=null,$)=>{let R=cF(...x.map(E=>E(Z=>b.call(T,Z))));return h(R,$)}}i.any=a;function l(x,b,T,$){let R=T;return r(x,E=>(R=b(R,E),R),$)}i.reduce=l;function c(x,b){let T,$={onWillAddFirstListener(){T=x(R.fire,R)},onDidRemoveLastListener(){T?.dispose()}},R=new on($);return b?.add(R),R.event}function h(x,b){return b instanceof Array?b.push(x):b&&b.add(x),x}function u(x,b,T=100,$=!1,R=!1,E,Z){let K,X,V,ie=0,q,ee={leakWarningThreshold:E,onWillAddFirstListener(){K=x(Oe=>{ie++,X=b(X,Oe),$&&!V&&(te.fire(X),X=void 0),q=()=>{let Te=X;X=void 0,V=void 0,(!$||ie>1)&&te.fire(Te),ie=0},typeof T=="number"?(clearTimeout(V),V=setTimeout(q,T)):V===void 0&&(V=0,queueMicrotask(q))})},onWillRemoveListener(){R&&ie>0&&q?.()},onDidRemoveLastListener(){q=void 0,K.dispose()}},te=new on(ee);return Z?.add(te),te.event}i.debounce=u;function d(x,b=0,T){return i.debounce(x,($,R)=>$?($.push(R),$):[R],b,void 0,!0,void 0,T)}i.accumulate=d;function f(x,b=($,R)=>$===R,T){let $=!0,R;return n(x,E=>{let Z=$||!b(E,R);return $=!1,R=E,Z},T)}i.latch=f;function p(x,b,T){return[i.filter(x,b,T),i.filter(x,$=>!b($),T)]}i.split=p;function g(x,b=!1,T=[],$){let R=T.slice(),E=x(X=>{R?R.push(X):K.fire(X)});$&&$.add(E);let Z=()=>{R?.forEach(X=>K.fire(X)),R=null},K=new on({onWillAddFirstListener(){E||(E=x(X=>K.fire(X)),$&&$.add(E))},onDidAddFirstListener(){R&&(b?setTimeout(Z):Z())},onDidRemoveLastListener(){E&&E.dispose(),E=null}});return $&&$.add(K),K.event}i.buffer=g;function O(x,b){return(T,$,R)=>{let E=b(new k);return x(function(Z){let K=E.evaluate(Z);K!==_&&T.call($,K)},void 0,R)}}i.chain=O;let _=Symbol("HaltChainable");class k{constructor(){this.steps=[]}map(b){return this.steps.push(b),this}forEach(b){return this.steps.push(T=>(b(T),T)),this}filter(b){return this.steps.push(T=>b(T)?T:_),this}reduce(b,T){let $=T;return this.steps.push(R=>($=b($,R),$)),this}latch(b=(T,$)=>T===$){let T=!0,$;return this.steps.push(R=>{let E=T||!b(R,$);return T=!1,$=R,E?R:_}),this}evaluate(b){for(let T of this.steps)if(b=T(b),b===_)break;return b}}function P(x,b,T=$=>$){let $=(...K)=>Z.fire(T(...K)),R=()=>x.on(b,$),E=()=>x.removeListener(b,$),Z=new on({onWillAddFirstListener:R,onDidRemoveLastListener:E});return Z.event}i.fromNodeEventEmitter=P;function w(x,b,T=$=>$){let $=(...K)=>Z.fire(T(...K)),R=()=>x.addEventListener(b,$),E=()=>x.removeEventListener(b,$),Z=new on({onWillAddFirstListener:R,onDidRemoveLastListener:E});return Z.event}i.fromDOMEventEmitter=w;function C(x){return new Promise(b=>t(x)(b))}i.toPromise=C;function M(x){let b=new on;return x.then(T=>{b.fire(T)},()=>{b.fire(void 0)}).finally(()=>{b.dispose()}),b.event}i.fromPromise=M;function D(x,b){return x(T=>b.fire(T))}i.forward=D;function j(x,b,T){return b(T),x($=>b($))}i.runAndSubscribe=j;class oe{constructor(b,T){this._observable=b,this._counter=0,this._hasChanged=!1;let $={onWillAddFirstListener:()=>{b.addObserver(this)},onDidRemoveLastListener:()=>{b.removeObserver(this)}};this.emitter=new on($),T&&T.add(this.emitter)}beginUpdate(b){this._counter++}handlePossibleChange(b){}handleChange(b,T){this._hasChanged=!0}endUpdate(b){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function ae(x,b){return new oe(x,b).emitter.event}i.fromObservable=ae;function G(x){return(b,T,$)=>{let R=0,E=!1,Z={beginUpdate(){R++},endUpdate(){R--,R===0&&(x.reportChanges(),E&&(E=!1,b.call(T)))},handlePossibleChange(){},handleChange(){E=!0}};x.addObserver(Z),x.reportChanges();let K={dispose(){x.removeObserver(Z)}};return $ instanceof Fg?$.add(K):Array.isArray($)&&$.push(K),K}}i.fromObservableLight=G})(dF||={});var bm=class ym{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${ym._idPool++}`,ym.all.add(this)}start(e){this._stopWatch=new uF,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}}};bm.all=new Set,bm._idPool=0;var fF=bm,pF=-1,C2=class $2{constructor(e,t,r=($2._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=t,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let r=this.threshold;if(r<=0||t<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=r*.5;let[n,o]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${o}):`;console.warn(a),console.warn(n);let l=new vF(a,n);this._errorHandler(l)}return()=>{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[r,s]of this._stacks)(!e||t<s)&&(e=[r,s],t=s);return e}};C2._idPool=1;var mF=C2,gF=class P2{constructor(e){this.value=e}static create(){let e=new Error;return new P2(e.stack??"")}print(){console.warn(this.value.split(`
149
+ `).slice(2).join(`
150
+ `))}},vF=class extends Error{constructor(i,e){super(i),this.name="ListenerLeakError",this.stack=e}},OF=class extends Error{constructor(i,e){super(i),this.name="ListenerRefusalError",this.stack=e}},_F=0,_f=class{constructor(i){this.value=i,this.id=_F++}},bF=2,yF,on=class{constructor(i){this._size=0,this._options=i,this._leakageMon=this._options?.leakWarningThreshold?new mF(i?.onListenerError??Of,this._options?.leakWarningThreshold??pF):void 0,this._perfMon=this._options?._profName?new fF(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??=(i,e,t)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let o=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(o);let a=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],l=new OF(`${o}. HINT: Stack shows most frequent listener (${a[1]}-times)`,a[0]);return(this._options?.onListenerError||Of)(l),Cu.None}if(this._disposed)return Cu.None;e&&(i=i.bind(e));let r=new _f(i),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=gF.create(),s=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof _f?(this._deliveryQueue??=new xF,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let n=x2(()=>{s?.(),this._removeListener(r)});return t instanceof Fg?t.add(n):Array.isArray(t)&&t.push(n),n},this._event}_removeListener(i){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let e=this._listeners,t=e.indexOf(i);if(t===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,e[t]=void 0;let r=this._deliveryQueue.current===this;if(this._size*bF<=e.length){let s=0;for(let n=0;n<e.length;n++)e[n]?e[s++]=e[n]:r&&(this._deliveryQueue.end--,s<this._deliveryQueue.i&&this._deliveryQueue.i--);e.length=s}}_deliver(i,e){if(!i)return;let t=this._options?.onListenerError||Of;if(!t){i.value(e);return}try{i.value(e)}catch(r){t(r)}}_deliverQueue(i){let e=i.current._listeners;for(;i.i<i.end;)this._deliver(e[i.i++],i.value);i.reset()}fire(i){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof _f)this._deliver(this._listeners,i);else{let e=this._deliveryQueue;e.enqueue(this,i,this._listeners.length),this._deliverQueue(e)}this._perfMon?.stop()}hasListeners(){return this._size>0}},xF=class{constructor(){this.i=-1,this.end=0}enqueue(i,e,t){this.i=0,this.end=t,this.current=i,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},$u=class Lh{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new on,this.onChange=this._onChange.event;let e=new iF;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!==0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,r=!1){return(e&16777215)<<3|(t&3)<<1|(r?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let t=0,r=0,s=e.length;for(let n=0;n<s;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=s)return t+this.wcwidth(o);let c=e.charCodeAt(n);56320<=c&&c<=57343?o=(o-55296)*1024+c-56320+65536:t+=this.wcwidth(c)}let a=this.charProperties(o,r),l=Lh.extractWidth(a);Lh.extractShouldJoin(a)&&(l-=Lh.extractWidth(r)),t+=l,r=a}return t}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},bf=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],wF=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],yf=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],SF=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]],Cs;function v_(i,e){let t=0,r=e.length-1,s;if(i<e[0][0]||i>e[r][1])return!1;for(;r>=t;)if(s=t+r>>1,i>e[s][1])t=s+1;else if(i<e[s][0])r=s-1;else return!0;return!1}var kF=class{constructor(){if(this.version="11",!Cs){Cs=new Uint8Array(65536),Cs.fill(1),Cs[0]=0,Cs.fill(0,1,32),Cs.fill(0,127,160);for(let i=0;i<bf.length;++i)Cs.fill(0,bf[i][0],bf[i][1]+1);for(let i=0;i<yf.length;++i)Cs.fill(2,yf[i][0],yf[i][1]+1)}}wcwidth(i){return i<32?0:i<127?1:i<65536?Cs[i]:v_(i,wF)?0:v_(i,SF)?2:1}charProperties(i,e){let t=this.wcwidth(i),r=t===0&&e!==0;if(r){let s=$u.extractWidth(e);s===0?r=!1:s>t&&(t=s)}return $u.createPropertyValue(0,t,r)}},CF=class{activate(i){i.unicode.register(new kF)}dispose(){}};const $F={class:"h-full min-h-0 flex flex-col bg-retro-black"},PF={class:"flex-shrink-0 h-9 flex items-center justify-between gap-3 px-3 border-b border-retro-border bg-retro-dark"},TF={class:"min-w-0 flex items-center gap-2 text-[11px] font-mono"},MF={class:"truncate text-retro-muted"},QF=Xe({__name:"TerminalPanel",props:{disabled:{type:Boolean}},setup(i,{expose:e}){const t={background:"#050807",foreground:"#d8f3dc",cursor:"#22d3ee",selectionBackground:"#164e63",black:"#050807",red:"#ef4444",green:"#22c55e",yellow:"#eab308",blue:"#38bdf8",magenta:"#d946ef",cyan:"#22d3ee",white:"#d8f3dc",brightBlack:"#475569",brightRed:"#f87171",brightGreen:"#4ade80",brightYellow:"#fde047",brightBlue:"#7dd3fc",brightMagenta:"#e879f9",brightCyan:"#67e8f9",brightWhite:"#f8fafc"},r={background:"#ffffff",foreground:"#1f2328",cursor:"#0969da",selectionBackground:"#b6e3ff",black:"#24292f",red:"#cf222e",green:"#116329",yellow:"#7d4e00",blue:"#0969da",magenta:"#8250df",cyan:"#1b7c83",white:"#6e7781",brightBlack:"#57606a",brightRed:"#a40e26",brightGreen:"#1a7f37",brightYellow:"#633c01",brightBlue:"#218bff",brightMagenta:"#a475f9",brightCyan:"#3192aa",brightWhite:"#8c959f"};function s(ce){return ce?t:r}const n=i,o=Lr(),{isDark:a}=wm(),l=N(null),c=ul(null),h=ul(null),u=ul(null),d=N("idle"),f=N(""),p=N(""),g=N(null),O=N(null),_=new Map,k=new Map;let P=null,w=null,C=0,M=0,D=0,j=0,oe="",ae="",G="",x=null;const b=new Map,T=new Map,$=he(()=>o.activeConversationId||"none"),R=he(()=>{const ce=o.activeConversation;return ce?.worktreePath||ce?.cwd||o.cwd||""});function E(){return typeof window>"u"?"":`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/terminal-ws`}function Z(){const ce=c.value,_e=h.value,Se=u.value;if(!(!ce||!_e))try{const Fe=_e.proposeDimensions();if(!Fe||!Fe.cols||!Fe.rows||Fe.cols===M&&Fe.rows===D)return;_e.fit(),M=ce.cols,D=ce.rows,Se?.readyState===WebSocket.OPEN&&Se.send(JSON.stringify({type:"resize",cols:ce.cols,rows:ce.rows}))}catch{}}function K(){typeof window>"u"||(cancelAnimationFrame(C),C=requestAnimationFrame(Z))}function X(){xi(()=>{c.value?.focus()})}e({focusTerminal:X});function V(){return o.activeConversationId||null}function ie(ce){c.value?.writeln(`\x1B[33m${ce}\x1B[0m`)}function q(ce){return ce.replace(/\r\n/g,`
151
+ `).replace(/\r/g,`
152
+ `)}function ee(ce,_e,Se){const Fe=c.value;if(!Fe||!_e)return;const Ct=q(_e);if(ce.role==="user"){Se&&Fe.write(`\r
153
+ \x1B[36m> ${Ct}\x1B[0m\r
154
+ `);return}Se&&Fe.write(`\r
155
+ `),Fe.write(Ct)}function te(ce=!1){const _e=c.value,Se=o.activeConversation;if(!(!_e||!Se)&&!(Se.source==="user"&&Se.finalized!==!0)){(ce||P!==Se.id)&&(k.clear(),P=Se.id);for(const Fe of Se.messages){const Ct=Fe.content||"",fi=k.get(Fe.id)??0;if(Ct.length<=fi)continue;const vt=Ct.slice(fi);ee(Fe,vt,fi===0),k.set(Fe.id,Ct.length)}}}function Oe(ce){let _e=Y2(ce).replace(/\r\n/g,`
156
+ `).replace(/\r/g,`
157
+ `).replace(/\u0007/g,"");for(;_e.includes("\b");)_e=_e.replace(/[^\n]?\b/g,"");if(ae){const Se=ae.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");_e=_e.replace(new RegExp(`^\\s*>?\\s*${Se}\\s*\\n?`),"").replace(new RegExp(`\\n\\s*>?\\s*${Se}\\s*\\n?`),`
158
+ `)}return _e}function Te(ce){return ce.split(`
159
+ `).some(_e=>_e.trim().length>0&&_e.trim()!==">")}function ke(ce){const _e=b.get(ce);_e&&clearTimeout(_e),b.delete(ce);const Se=T.get(ce);Se&&clearTimeout(Se),T.delete(ce)}function Ze(ce){O.value=ce,g.value=ce&&_.get(ce)||null}function Je(ce){const _e=o.conversations.find(Fe=>Fe.id===ce);if(!_e)return;let Se=!1;for(const Fe of _e.messages)Fe.role==="assistant"&&Fe.status==="streaming"&&(o.updateMessage(Fe.id,{status:"complete"},ce),Se=!0);Se&&o.saveConversation(ce,!0)}function Ve(ce){if(!ce)return;const _e=_.get(ce);if(!ce||!_e){O.value===ce&&Ze(null);return}ke(ce),o.completeMessageWithSave(_e,ce),Q(ce),_.delete(ce),O.value===ce&&Ze(null)}function I(){Ve(O.value||o.activeConversationId)}function L(ce){const _e=b.get(ce);_e&&clearTimeout(_e);const Se=setTimeout(()=>{Ve(ce)},2500);b.set(ce,Se)}function z(ce){const _e=_.get(ce);if(_e)return o.updateMessage(_e,{status:"complete"},ce),Ze(ce),_e;const Se=o.addAssistantMessage(ce);o.updateMessage(Se.id,{status:"complete"},ce),_.set(ce,Se.id),Ze(ce),o.saveConversation(ce);const Fe=T.get(ce);Fe&&clearTimeout(Fe);const Ct=setTimeout(()=>{J(),Ve(ce)},300*1e3);return T.set(ce,Ct),Se.id}function Q(ce){const _e=o.conversations.find(Se=>Se.id===ce);!_e?.hasWorktree||!_e.worktreePath||$fetch("/api/chat/worktree-commit",{method:"POST",body:{worktreePath:_e.worktreePath,conversationId:ce,previousBranch:_e.worktreeBranch}}).then(Se=>Se?.success&&_e.previewBranch&&_e.worktreePath?$fetch("/api/chat/preview-sync",{method:"POST",body:{previewBranch:_e.previewBranch,worktreePath:_e.worktreePath}}).then(Fe=>{if(!Fe.success)throw new Error(Fe.error||"Unknown preview sync failure");return Se}):Se).then(async Se=>{Se?.success&&(Se.currentBranch&&Se.currentBranch!==_e.worktreeBranch?(o.updateWorktreeBranch(ce,Se.currentBranch),await o.syncConversationFeatureFromBranch(ce)):_e.worktreeBranch&&o.updateWorktreeBranch(ce,_e.worktreeBranch),o.saveConversation(ce,!1))}).catch(Se=>{console.warn("[TerminalPanel] Auto-commit/preview-sync failed:",Se)})}function J(){x&&(clearTimeout(x),x=null);const ce=G;if(G="",!ce||!Te(ce))return;const _e=O.value||o.activeConversationId;if(!_e)return;const Se=z(_e);o.appendToMessageWithSave(Se,ce,_e),L(_e)}function de(ce){if(!g.value)return;const _e=Oe(ce);_e&&(G+=_e,x&&clearTimeout(x),x=setTimeout(J,120))}function Y(ce){const _e=ce.trim();if(oe="",!_e)return;I(),ae=_e;const Se=o.activeConversationId;Se&&(o.addUserMessage(_e,Se),o.saveConversation(Se,!0),z(Se))}function be(ce){const _e=U2(ce);for(const Se of _e){if(Se===""){oe="",I();continue}if(Se==="\r"||Se===`
160
+ `){Y(oe);continue}if(Se==="\b"||Se===""){oe=oe.slice(0,-1);continue}Se>=" "&&Se!=="\x1B"&&(oe+=Se)}}function Ce(ce){return new Promise(_e=>setTimeout(_e,ce))}async function rt(ce){const _e=Date.now();for(;Date.now()-_e<1e4;){const Se=o.activeConversation;if(!Se||Se.id!==ce||Se.worktreePath||Se.hasWorktree)return;const Fe=new Date(Se.createdAt).getTime();if(Number.isFinite(Fe)&&Date.now()-Fe>15e3)return;await Ce(150)}}function ot(){const ce=u.value;ce&&ce.readyState!==WebSocket.CLOSING&&ce.readyState!==WebSocket.CLOSED&&ce.close(),u.value=null}async function ut(){const ce=++j,_e=c.value;if(!_e)return;J(),ot(),d.value="connecting",f.value="Connecting terminal...";const Se=V();if(!Se||ce!==j){Ze(null),d.value="idle",f.value="Create or select a conversation to start Claude.";return}if(o.activeConversation?.finalized===!0){Ze(null),_e.clear(),te(!0),d.value="closed",f.value="Finalized conversation — read-only transcript.";return}if(Je(Se),Ze(Se),await rt(Se),ce!==j)return;const Fe=E();if(!Fe)return;_e.clear(),te(!0);const Ct=new WebSocket(Fe);u.value=Ct,Ct.onopen=()=>{if(ce!==j)return;Z();const fi=o.activeConversation;Ct.send(JSON.stringify({type:"start",conversationId:Se,cwd:R.value,featureId:fi?.featureId,baseBranch:fi?.baseBranch,providerId:fi?.providerId,providerModelKey:fi?.providerModelKey,cols:_e.cols,rows:_e.rows}))},Ct.onmessage=fi=>{const vt=JSON.parse(fi.data);if(vt.type==="started"){d.value="connected",p.value=vt.cwd||"",f.value=vt.cwd?`Terminal attached: ${vt.cwd}`:"Terminal attached",vt.hasWorktree&&o.updateConversationWorktree(Se,{worktreePath:vt.cwd,worktreeBranch:vt.worktreeBranch,baseBranch:vt.baseBranch});return}if(vt.type==="data"||vt.type==="replay"){vt.data&&_e.write(vt.data),vt.type==="data"&&vt.data&&de(vt.data);return}if(vt.type==="exit"){d.value="closed",f.value=`Terminal exited with code ${vt.exitCode??0}`,J(),Ve(Se),ie(f.value);return}vt.type==="error"&&(d.value="error",f.value=vt.error||"Terminal error",ie(f.value))},Ct.onerror=()=>{ce===j&&(d.value="error",f.value="Terminal connection error")},Ct.onclose=()=>{ce===j&&(d.value==="connecting"||d.value==="connected")&&(d.value="closed",f.value="Terminal connection closed")}}return Qt(async()=>{if(!l.value)return;const ce=new HS({cursorBlink:!0,convertEol:!0,fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',fontSize:13,lineHeight:1.25,scrollback:1e3,allowProposedApi:!0,theme:s(a.value)}),_e=new OZ;ce.loadAddon(_e);const Se=new CF;ce.loadAddon(Se),ce.unicode.activeVersion="11",ce.open(l.value);try{const Fe=new JX;Fe.onContextLoss(()=>Fe.dispose()),ce.loadAddon(Fe)}catch{}ce.onData(Fe=>{if(n.disabled)return;be(Fe);const Ct=u.value;Ct?.readyState===WebSocket.OPEN&&Ct.send(JSON.stringify({type:"input",data:Fe}))}),c.value=ce,h.value=_e,w=new ResizeObserver(()=>K()),w.observe(l.value),await xi(),Z(),await ut()}),Ye(a,ce=>{c.value&&(c.value.options.theme=s(ce))}),Ye($,()=>{if(c.value){if(!o.activeConversationId){j++,J(),Ze(null),ot(),c.value.clear(),p.value="",d.value="idle",f.value="Create or select a conversation to start Claude.";return}ut()}}),Ye(()=>{const ce=o.activeConversation;return!ce||ce.source==="user"&&ce.finalized!==!0?"":ce.messages.map(_e=>`${_e.id}:${_e.content.length}:${_e.status??""}`).join("|")},()=>{te()}),_i(()=>{j++,typeof window<"u"&&cancelAnimationFrame(C),w&&(w.disconnect(),w=null),ot(),J();for(const ce of b.values())clearTimeout(ce);b.clear();for(const ce of T.values())clearTimeout(ce);T.clear(),c.value?.dispose(),c.value=null,h.value=null}),(ce,_e)=>(y(),S("div",$F,[m("div",PF,[m("div",TF,[le(v(Q_),{class:"w-4 h-4 text-retro-cyan flex-shrink-0"}),m("span",{class:Ie(["w-2 h-2 rounded-full flex-shrink-0",{"bg-retro-green":v(d)==="connected","bg-retro-yellow animate-pulse":v(d)==="connecting","bg-retro-red":v(d)==="error","bg-retro-muted":v(d)==="idle"||v(d)==="closed"}])},null,2),m("span",MF,F(v(p)||v(f)||"Terminal"),1)])]),m("div",{ref_key:"terminalEl",ref:l,class:"terminal-host flex-1 min-h-0 w-full overflow-hidden"},null,512)]))}}),AF=zs(QF,[["__scopeId","data-v-9de56c8c"]]),RF={class:"live-terminal-host h-full min-h-0 w-full overflow-auto"},BF=Xe({__name:"LiveTerminalView",props:{sessionId:{}},setup(i){const e={background:"#050807",foreground:"#d8f3dc",cursor:"#22d3ee",selectionBackground:"#164e63",black:"#050807",red:"#ef4444",green:"#22c55e",yellow:"#eab308",blue:"#38bdf8",magenta:"#d946ef",cyan:"#22d3ee",white:"#d8f3dc",brightBlack:"#475569",brightRed:"#f87171",brightGreen:"#4ade80",brightYellow:"#fde047",brightBlue:"#7dd3fc",brightMagenta:"#e879f9",brightCyan:"#67e8f9",brightWhite:"#f8fafc"},t={background:"#ffffff",foreground:"#1f2328",cursor:"#0969da",selectionBackground:"#b6e3ff",black:"#24292f",red:"#cf222e",green:"#116329",yellow:"#7d4e00",blue:"#0969da",magenta:"#8250df",cyan:"#1b7c83",white:"#6e7781",brightBlack:"#57606a",brightRed:"#a40e26",brightGreen:"#1a7f37",brightYellow:"#633c01",brightBlue:"#218bff",brightMagenta:"#a475f9",brightCyan:"#3192aa",brightWhite:"#8c959f"};function r(d){return d?e:t}const s=i,{isDark:n}=wm(),o=N(null),a=ul(null),l=ul(null);function c(){return typeof window>"u"?"":`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/terminal-ws`}function h(){const d=l.value;d&&d.readyState!==WebSocket.CLOSING&&d.readyState!==WebSocket.CLOSED&&d.close(),l.value=null}function u(){const d=a.value;if(!d)return;const f=c();if(!f)return;h();const p=new WebSocket(f);l.value=p,p.onopen=()=>{p.send(JSON.stringify({type:"attach",sessionId:s.sessionId}))},p.onmessage=g=>{let O;try{O=JSON.parse(g.data)}catch{return}if(O.type==="started"){if(d&&O.cols&&O.rows)try{d.resize(O.cols,O.rows)}catch{}return}if((O.type==="data"||O.type==="replay")&&O.data){d.write(O.data);return}O.type==="error"&&O.error&&d.writeln(`\r
161
+ \x1B[31m${O.error}\x1B[0m`)}}return Qt(async()=>{if(!o.value)return;const d=new HS({cursorBlink:!1,disableStdin:!0,convertEol:!0,fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',fontSize:12,lineHeight:1.2,scrollback:5e3,theme:r(n.value)});d.open(o.value),a.value=d,await xi(),u()}),Ye(n,d=>{a.value&&(a.value.options.theme=r(d))}),_i(()=>{h(),a.value?.dispose(),a.value=null}),(d,f)=>(y(),S("div",RF,[m("div",{ref_key:"terminalEl",ref:o,class:"inline-block"},null,512)]))}}),LF=zs(BF,[["__scopeId","data-v-b4073335"]]),EF={class:"px-4 py-3 border-b border-retro-border bg-retro-dark/80 space-y-3"},DF={class:"flex items-center justify-between"},IF={class:"space-y-1 text-xs font-mono"},zF={class:"flex items-center gap-2"},NF={class:"relative"},WF=["disabled"],ZF=["value"],XF=["value"],FF={class:"flex items-center gap-2"},VF={class:"text-retro-text"},qF={class:"relative"},HF=["disabled"],UF=["disabled"],YF={key:0,class:"flex items-center justify-between gap-3 rounded border border-retro-border bg-retro-black px-2 py-1.5 text-xs font-mono"},jF={class:"min-w-0"},GF={class:"flex items-center gap-2"},KF={class:"text-retro-text truncate"},JF={key:0,class:"mt-0.5 text-retro-red truncate"},eV={key:1,class:"h-48 rounded border border-retro-border bg-retro-black overflow-hidden"},tV={class:"flex items-center gap-2"},iV=["disabled"],rV=["disabled"],sV=Xe({__name:"FinalizeConfirm",props:{conversationId:{},baseBranch:{},worktreeBranch:{},worktreePath:{}},emits:["confirm","cancel"],setup(i,{emit:e}){const t=i,r=e,s=N(""),n=N(null),o=N(!1),a=N(!1),l=N("idle"),c=N(""),h=N(null),u=N(""),d=N(fc(t.baseBranch)?t.baseBranch:""),f=N([]),p=N(!1),g=N(null),O=he(()=>tS(d.value||t.baseBranch));async function _(){if(a.value)return;a.value=!0,l.value="running",c.value="",u.value=`commitgen:${t.conversationId}:${Date.now()}-${Math.random().toString(36).slice(2,8)}`;const w=new AbortController;h.value=w;try{const C=await $fetch("/api/chat/generate-commit-message",{method:"POST",signal:w.signal,body:{conversationId:t.conversationId,worktreePath:t.worktreePath,worktreeBranch:t.worktreeBranch,baseBranch:d.value||t.baseBranch,previewSessionId:u.value}});C.success&&C.message?(s.value=C.message,l.value="done"):(l.value="error",c.value=C.error||"Failed to generate commit message")}catch(C){w.signal.aborted?l.value="aborted":(l.value="error",c.value=C instanceof Error?C.message:String(C))}finally{a.value=!1,h.value===w&&(h.value=null)}}function k(){h.value?.abort()}Qt(async()=>{const w=(async()=>{try{const M=t.worktreePath.split("/").pop()||"",D=await $fetch(`/api/commits/${encodeURIComponent(M)}`,{params:{workingDirectory:t.worktreePath}});n.value=D.aheadCount}catch{n.value=null}})(),C=(async()=>{p.value=!0;try{const M=t.worktreePath||(await $fetch("/api/cwd")).cwd,D=await $fetch("/api/git/branches",{query:{workingDirectory:M}});f.value=D.branches.filter(oe=>!oe.isRemote&&!oe.name.startsWith("sc/")).map(Mg).filter(oe=>!!oe);const j=Tg(d.value||t.baseBranch,f.value);j&&(d.value=j)}catch{f.value=[]}finally{p.value=!1}})();await Promise.all([w,C]),xi(()=>g.value?.focus())});function P(){!s.value.trim()||!d.value||(o.value=!0,r("confirm",s.value.trim(),d.value))}return(w,C)=>(y(),S("div",EF,[m("div",DF,[C[4]||(C[4]=m("span",{class:"text-xs font-mono text-retro-text font-semibold uppercase tracking-wide"}," Finalize ",-1)),m("button",{type:"button",class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",title:"Cancel",onClick:C[0]||(C[0]=M=>r("cancel"))},[le(v(hi),{class:"w-4 h-4"})])]),m("div",IF,[m("div",zF,[C[5]||(C[5]=m("span",{class:"text-retro-muted"},"target:",-1)),m("div",NF,[je(m("select",{"onUpdate:modelValue":C[1]||(C[1]=M=>d.value=M),disabled:o.value||p.value,class:"appearance-none bg-retro-black border border-retro-border rounded px-2 py-0.5 pr-6 text-xs font-mono text-retro-cyan focus:outline-none focus:border-retro-cyan cursor-pointer disabled:opacity-40"},[p.value?(y(),S("option",{key:0,value:d.value},F(O.value),9,ZF)):se("",!0),(y(!0),S(Me,null,Ke(f.value,M=>(y(),S("option",{key:M,value:M},F(M),9,XF))),128))],8,WF),[[gn,d.value]]),le(v(Dh),{class:"absolute right-1 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})])]),m("div",FF,[C[6]||(C[6]=m("span",{class:"text-retro-muted"},"commits:",-1)),m("span",VF,F(n.value!==null?n.value:"..."),1)])]),m("div",qF,[je(m("textarea",{ref_key:"textareaRef",ref:g,"onUpdate:modelValue":C[2]||(C[2]=M=>s.value=M),placeholder:"Squash commit message...",rows:"2",class:"w-full px-2 py-1.5 pr-8 text-xs font-mono bg-retro-black border border-retro-border rounded text-retro-text placeholder-retro-subtle focus:outline-none focus:border-retro-cyan resize-none",disabled:o.value||a.value},null,8,HF),[[$i,s.value]]),m("button",{type:"button",disabled:o.value||a.value||p.value||!d.value,class:"absolute right-1.5 top-1.5 p-0.5 rounded text-retro-muted hover:text-retro-cyan transition-colors disabled:opacity-40",title:"Generate commit message",onClick:_},[le(v(xl),{class:Ie(["w-4 h-4",{"animate-spin":a.value}])},null,8,["class"])],8,UF)]),l.value!=="idle"?(y(),S("div",YF,[m("div",jF,[m("div",GF,[le(v(xl),{class:Ie(["w-3.5 h-3.5 text-retro-cyan shrink-0",{"animate-spin":l.value==="running"}])},null,8,["class"]),m("span",KF,F(l.value==="running"?`Generating from ${d.value}...`:l.value==="done"?"Commit message generated":l.value==="aborted"?"Generation stopped":"Generation failed"),1)]),c.value?(y(),S("div",JF,F(c.value),1)):se("",!0)]),l.value==="running"?(y(),S("button",{key:0,type:"button",class:"shrink-0 p-0.5 rounded text-retro-muted hover:text-retro-red transition-colors",title:"Stop generation",onClick:k},[le(v(D_),{class:"w-4 h-4"})])):se("",!0)])):se("",!0),l.value==="running"&&u.value?(y(),S("div",eV,[(y(),xe(LF,{key:u.value,"session-id":u.value},null,8,["session-id"]))])):se("",!0),m("div",tV,[m("button",{type:"button",disabled:!s.value.trim()||!d.value||o.value,class:"flex items-center gap-1 px-3 py-1 text-xs font-mono rounded border transition-colors bg-retro-green/10 border-retro-green/50 text-retro-green hover:bg-retro-green/20 disabled:opacity-40 disabled:cursor-not-allowed",onClick:P},[le(v(km),{class:"w-3.5 h-3.5"}),We(" "+F(o.value?"Finalizing...":"Confirm"),1)],8,iV),m("button",{type:"button",disabled:o.value,class:"px-3 py-1 text-xs font-mono rounded border border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text/30 transition-colors disabled:opacity-40",onClick:C[3]||(C[3]=M=>r("cancel"))}," Cancel ",8,rV)])]))}}),nV={class:"px-4 py-3 border-b border-retro-border bg-retro-dark/80 space-y-3"},oV={class:"flex items-center justify-between"},aV={class:"space-y-1 text-xs font-mono"},lV={class:"flex items-center gap-2"},cV={class:"text-retro-cyan"},hV={class:"flex items-center gap-2"},uV={class:"relative"},dV=["disabled"],fV=["value"],pV=["value"],mV={class:"flex items-center gap-2"},gV={class:"text-retro-text"},vV={class:"flex items-center gap-2"},OV=["disabled"],_V=["disabled"],bV=Xe({__name:"RebaseConfirm",props:{baseBranch:{},worktreeBranch:{},worktreePath:{}},emits:["confirm","cancel"],setup(i,{emit:e}){const t=i,r=e,s=N(null),n=N(!1),o=N(fc(t.baseBranch)?t.baseBranch:""),a=N([]),l=N(!1),c=he(()=>tS(o.value||t.baseBranch));let h=0;async function u(f){if(!f){h++,s.value=null;return}const p=++h;try{const g=await $fetch("/api/chat/compare",{params:{worktreePath:t.worktreePath,baseBranch:f}});if(p!==h)return;s.value=g.ahead}catch{if(p!==h)return;s.value=null}}Qt(async()=>{const f=u(o.value),p=(async()=>{l.value=!0;try{const g=t.worktreePath||(await $fetch("/api/cwd")).cwd,O=await $fetch("/api/git/branches",{query:{workingDirectory:g}});a.value=O.branches.filter(k=>!k.isRemote&&!k.name.startsWith("sc/")).map(Mg).filter(k=>!!k);const _=Tg(o.value||t.baseBranch,a.value);_&&(o.value=_)}catch{a.value=[]}finally{l.value=!1}})();await Promise.all([f,p])}),Ye(o,f=>{u(f)});function d(){o.value&&(n.value=!0,r("confirm",o.value))}return(f,p)=>(y(),S("div",nV,[m("div",oV,[p[3]||(p[3]=m("span",{class:"text-xs font-mono text-retro-text font-semibold uppercase tracking-wide"}," Rebase Worktree ",-1)),m("button",{type:"button",class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",title:"Cancel",onClick:p[0]||(p[0]=g=>r("cancel"))},[le(v(hi),{class:"w-4 h-4"})])]),m("div",aV,[m("div",lV,[p[4]||(p[4]=m("span",{class:"text-retro-muted"},"worktree:",-1)),m("span",cV,F(i.worktreeBranch),1)]),m("div",hV,[p[5]||(p[5]=m("span",{class:"text-retro-muted"},"target:",-1)),m("div",uV,[je(m("select",{"onUpdate:modelValue":p[1]||(p[1]=g=>o.value=g),disabled:n.value||l.value,class:"appearance-none bg-retro-black border border-retro-border rounded px-2 py-0.5 pr-6 text-xs font-mono text-retro-cyan focus:outline-none focus:border-retro-cyan cursor-pointer disabled:opacity-40"},[l.value?(y(),S("option",{key:0,value:o.value},F(c.value),9,fV)):se("",!0),(y(!0),S(Me,null,Ke(a.value,g=>(y(),S("option",{key:g,value:g},F(g),9,pV))),128))],8,dV),[[gn,o.value]]),le(v(Dh),{class:"absolute right-1 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})])]),m("div",mV,[p[6]||(p[6]=m("span",{class:"text-retro-muted"},"commits ahead:",-1)),m("span",gV,F(s.value!==null?s.value:"..."),1)])]),m("div",vV,[m("button",{type:"button",disabled:n.value||!o.value,class:"flex items-center gap-1 px-3 py-1 text-xs font-mono rounded border transition-colors bg-retro-cyan/10 border-retro-cyan/50 text-retro-cyan hover:bg-retro-cyan/20 disabled:opacity-40 disabled:cursor-not-allowed",onClick:d},[le(v(km),{class:"w-3.5 h-3.5"}),We(" "+F(n.value?"Rebasing...":"Confirm"),1)],8,OV),m("button",{type:"button",disabled:n.value,class:"px-3 py-1 text-xs font-mono rounded border border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text/30 transition-colors disabled:opacity-40",onClick:p[2]||(p[2]=g=>r("cancel"))}," Cancel ",8,_V)])]))}}),yV={class:"flex-1 flex flex-col overflow-hidden"},xV={class:"flex-shrink-0 px-4 py-2 border-b border-retro-border flex items-center justify-between bg-retro-dark"},wV={class:"text-xs font-mono text-retro-text truncate"},SV={class:"flex items-center gap-2 flex-shrink-0"},kV={key:0,class:"text-xs font-mono text-retro-green"},CV={key:1,class:"text-[11px] font-mono text-retro-muted"},$V={key:0,class:"flex items-center justify-center h-full text-retro-muted text-xs font-mono"},PV=["innerHTML"],TV={key:0,class:"flex-shrink-0 px-4 py-2 border-t border-retro-border bg-retro-yellow/10 text-retro-yellow text-xs font-mono"},MV=Xe({__name:"ConflictFileEditor",props:{file:{},resolved:{type:Boolean},isAiResolving:{type:Boolean},strategy:{}},emits:["resolve","aiResolve","retry"],setup(i,{emit:e}){const t=i;N(t.file.content);const r=N(""),s=N(!1);Ye(()=>t.file.path,()=>{l()}),Ye(()=>t.file.content,()=>{l()});const n=he(()=>{const h=/^<{7}\s/gm;return(t.file.content.match(h)||[]).length});function o(h){const u=h.split(".").pop()?.toLowerCase()||"";return{ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",vue:"vue",html:"html",css:"css",scss:"scss",less:"less",json:"json",yaml:"yaml",yml:"yaml",md:"markdown",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",sh:"bash",zsh:"bash",sql:"sql",graphql:"graphql",xml:"xml",svg:"xml",toml:"toml",ini:"ini",dockerfile:"dockerfile"}[u]||"text"}let a=0;async function l(){const h=++a;s.value=!0;try{const{codeToHtml:u}=await dh(async()=>{const{codeToHtml:P}=await import("./DqFq1MXh.js");return{codeToHtml:P}},__vite__mapDeps([3,1,2]),import.meta.url),d=o(t.file.path),p=t.file.content.split(`
162
+ `);let g="",O=!1,_=!1,k=0;for(const P of p){k++;const w=/^<{7}\s/.test(P),C=/^={7}$/.test(P),M=/^>{7}\s/.test(P);if(w){O=!0,_=!1,g+=`<div class="conflict-line conflict-marker-line" data-line="${k}"><span class="line-number">${k}</span><span class="line-content conflict-marker">${c(P)}</span></div>
163
+ `;continue}if(C&&O){O=!1,_=!0,g+=`<div class="conflict-line conflict-marker-line" data-line="${k}"><span class="line-number">${k}</span><span class="line-content conflict-marker">${c(P)}</span></div>
164
+ `;continue}if(M){_=!1,g+=`<div class="conflict-line conflict-marker-line" data-line="${k}"><span class="line-number">${k}</span><span class="line-content conflict-marker">${c(P)}</span></div>
165
+ `;continue}let D=c(P);try{const ae=(await u(P||" ",{lang:d,theme:"vitesse-dark"})).match(/<code[^>]*><span class="line">(.*?)<\/span><\/code>/s);ae&&(D=ae[1])}catch{}let j="";O?j="conflict-ours":_&&(j="conflict-theirs"),g+=`<div class="conflict-line ${j}" data-line="${k}"><span class="line-number">${k}</span><span class="line-content">${D}</span></div>
166
+ `}if(h!==a)return;r.value=g}catch{if(h!==a)return;const u=t.file.content.split(`
167
+ `);r.value=u.map((d,f)=>{const p=f+1;return`<div class="conflict-line" data-line="${p}"><span class="line-number">${p}</span><span class="line-content">${c(d)}</span></div>`}).join(`
168
+ `)}finally{h===a&&(s.value=!1)}}function c(h){return h.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}return Qt(()=>{l()}),(h,u)=>(y(),S("div",yV,[m("div",xV,[m("span",wV,F(i.file.path),1),m("div",SV,[i.resolved?(y(),S("span",kV," Resolved ")):n.value>0?(y(),S("span",CV,F(n.value)+" conflict "+F(n.value===1?"block":"blocks"),1)):se("",!0)])]),m("div",{class:Ie(["flex-1 overflow-auto bg-retro-black conflict-viewer",{"opacity-60":i.resolved}])},[s.value?(y(),S("div",$V," Highlighting... ")):(y(),S("div",{key:1,class:"conflict-code",innerHTML:r.value},null,8,PV))],2),n.value>0&&!i.resolved?(y(),S("div",TV," File contains "+F(n.value)+" conflict "+F(n.value===1?"block":"blocks")+". Use AI resolution to resolve. ",1)):se("",!0)]))}}),QV={class:"flex flex-col h-full border-l border-retro-border bg-retro-dark"},AV={class:"flex-shrink-0 px-3 py-2 border-b border-retro-border"},RV={class:"flex items-center gap-2"},BV={class:"text-[10px] font-mono text-retro-muted mt-1"},LV={key:0,class:"text-xs font-mono text-retro-muted text-center py-8"},EV={key:0,class:"bg-retro-panel/50 rounded px-2 py-1.5 border border-retro-border"},DV={class:"mt-0.5"},IV={class:"inline-block w-3 text-center opacity-70"},zV={key:1,class:"flex items-center gap-2 text-xs font-mono text-retro-cyan"},NV={class:"flex-shrink-0 border-t border-retro-border p-3 space-y-2"},WV=["disabled"],ZV=["disabled"],XV={key:0},FV={key:1},VV=Xe({__name:"ConflictChatPanel",setup(i){const e=Lr(),t=Kl(),r=N(""),s=N(null),n=he(()=>e.conflictState?.chatMessages??[]),o=he(()=>e.conflictState?.lifecycleState==="resolving"),a=he(()=>{if(!e.conflictState)return!1;const p=e.conflictState.files.length,g=e.conflictState.resolvedFiles.size;return p>0&&g>=p}),l=he(()=>e.conflictState?e.conflictState.files.length-e.conflictState.resolvedFiles.size:0),c=he(()=>t.providerId);Ye(()=>n.value.length,async()=>{await xi(),s.value&&(s.value.scrollTop=s.value.scrollHeight)});function h(){!e.conflictState||o.value||(e.setConflictUserGuidance(r.value.trim()),e.aiResolveAllConflicts())}function u(){e.cancelConflictResolution()}function d(p){switch(p.type){case"success":return"text-retro-green";case"error":return"text-retro-red";case"progress":return"text-retro-cyan";case"summary":return"text-retro-yellow";default:return"text-retro-muted"}}function f(p){switch(p.type){case"success":return"✓";case"error":return"✗";case"progress":return"▶";case"summary":return"─";default:return"●"}}return(p,g)=>(y(),S("div",QV,[m("div",AV,[m("div",RV,[le(v(xl),{class:"w-4 h-4 text-retro-orange"}),g[1]||(g[1]=m("span",{class:"text-xs font-mono text-retro-text font-semibold"},"AI Conflict Resolution",-1))]),m("div",BV," Provider: "+F(c.value),1)]),m("div",{ref_key:"messagesContainer",ref:s,class:"flex-1 overflow-y-auto px-3 py-2 space-y-2"},[n.value.length===0?(y(),S("div",LV," Enter optional guidance below and click resolve to start AI conflict resolution. ")):se("",!0),(y(!0),S(Me,null,Ke(n.value,O=>(y(),S("div",{key:O.id,class:Ie(["text-xs font-mono leading-relaxed",O.role==="user"?"text-retro-text":d(O)])},[O.role==="user"?(y(),S("div",EV,[g[2]||(g[2]=m("span",{class:"text-retro-muted text-[10px]"},"Guidance:",-1)),m("div",DV,F(O.content),1)])):(y(),S(Me,{key:1},[m("span",IV,F(f(O)),1),We(" "+F(O.content),1)],64))],2))),128)),o.value?(y(),S("div",zV,[...g[3]||(g[3]=[m("span",{class:"animate-pulse"},"●",-1),We(" Processing... ",-1)])])):se("",!0)],512),m("div",NV,[je(m("textarea",{"onUpdate:modelValue":g[0]||(g[0]=O=>r.value=O),disabled:o.value,placeholder:'Optional: Add guidance for AI resolution (e.g., "prefer feature branch API changes", "keep both import sets")...',class:"w-full h-16 px-2 py-1.5 text-xs font-mono bg-retro-black text-retro-text border border-retro-border rounded resize-none focus:outline-none focus:border-retro-cyan/50 placeholder:text-retro-muted/50 disabled:opacity-50",spellcheck:"false"},null,8,WV),[[$i,r.value]]),o.value?(y(),S("button",{key:1,type:"button",class:"w-full flex items-center justify-center gap-2 px-3 py-2 text-xs font-mono rounded border transition-colors bg-retro-red/10 border-retro-red/50 text-retro-red hover:bg-retro-red/20",onClick:u},[le(v(D_),{class:"w-4 h-4"}),g[4]||(g[4]=We(" Stop Resolution ",-1))])):(y(),S("button",{key:0,type:"button",disabled:a.value||l.value===0,class:"w-full flex items-center justify-center gap-2 px-3 py-2 text-xs font-mono rounded border transition-colors bg-retro-orange/10 border-retro-orange/50 text-retro-orange hover:bg-retro-orange/20 disabled:opacity-40 disabled:cursor-not-allowed",onClick:h},[le(v(xl),{class:"w-4 h-4"}),a.value?(y(),S("span",XV,"All Conflicts Resolved")):(y(),S("span",FV,"Resolve Conflicts Automatically ("+F(l.value)+")",1))],8,ZV))])]))}}),qV={key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60"},HV={class:"w-full max-w-7xl mx-4 my-8 h-[85vh] bg-retro-dark border border-retro-border rounded-lg shadow-xl flex flex-col overflow-hidden"},UV={class:"flex-shrink-0 px-4 py-3 border-b border-retro-border flex items-center justify-between"},YV={class:"flex items-center gap-3"},jV={class:"text-xs font-mono text-retro-muted"},GV={class:"flex items-center gap-2"},KV=["disabled"],JV=["disabled"],eq={key:0,class:"flex-1 flex items-center justify-center text-retro-muted text-sm font-mono"},tq={key:1,class:"flex-1 flex items-center justify-center text-retro-red text-sm font-mono"},iq={key:2,class:"flex-1 flex overflow-hidden"},rq={class:"w-56 flex-shrink-0 border-r border-retro-border overflow-y-auto bg-retro-dark"},sq={class:"py-1"},nq=["onClick"],oq={class:"flex-1 flex flex-col overflow-hidden min-w-0"},aq={key:1,class:"flex-1 flex items-center justify-center text-retro-muted text-sm font-mono"},lq={class:"w-80 flex-shrink-0"},cq=Xe({__name:"ConflictResolutionModal",emits:["close"],setup(i,{emit:e}){const t=e,r=Lr(),s=N(null),n=N(!1),o=N(!1),a=he(()=>r.conflictState?.files??[]),l=he(()=>r.conflictState?.resolvedFiles??new Set),c=he(()=>a.value.length),h=he(()=>l.value.size),u=he(()=>c.value>0&&h.value>=c.value),d=he(()=>s.value?a.value.find(_=>_.path===s.value)??null:null);function f(_){return l.value.has(_)}function p(_){s.value=_}async function g(){n.value=!0;const _=await r.continueRebase();n.value=!1,_.success&&t("close")}async function O(){o.value=!0,await r.cancelConflictResolution(),o.value=!1,t("close")}return(_,k)=>(y(),xe(or,{to:"body"},[le(hs,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:gt(()=>[v(r).conflictState?(y(),S("div",qV,[m("div",HV,[m("div",UV,[m("div",YV,[le(v(vn),{class:"w-5 h-5 text-retro-yellow"}),k[0]||(k[0]=m("h3",{class:"text-sm font-mono text-retro-text font-semibold"},"Resolve Conflicts",-1)),m("span",jV,F(h.value)+"/"+F(c.value)+" resolved ",1)]),m("div",GV,[m("button",{type:"button",disabled:!u.value||n.value||o.value,class:"flex items-center gap-1 px-3 py-1.5 text-xs font-mono rounded border transition-colors bg-retro-green/10 border-retro-green/50 text-retro-green hover:bg-retro-green/20 disabled:opacity-40 disabled:cursor-not-allowed",onClick:g},F(n.value?"Continuing...":"Continue Rebase"),9,KV),m("button",{type:"button",disabled:n.value||o.value,class:"px-3 py-1.5 text-xs font-mono rounded border border-retro-red/50 text-retro-red hover:bg-retro-red/10 transition-colors disabled:opacity-40",onClick:O},F(o.value?"Aborting...":"Abort"),9,JV)])]),v(r).conflictState?.loading?(y(),S("div",eq," Loading conflict files... ")):v(r).conflictState?.error?(y(),S("div",tq,F(v(r).conflictState.error),1)):(y(),S("div",iq,[m("div",rq,[m("div",sq,[(y(!0),S(Me,null,Ke(a.value,P=>(y(),S("button",{key:P.path,type:"button",class:Ie(["w-full text-left px-3 py-2 text-xs font-mono flex items-center gap-2 transition-colors hover:bg-retro-panel",{"bg-retro-panel":s.value===P.path}]),onClick:w=>p(P.path)},[f(P.path)?(y(),xe(v(Sm),{key:0,class:"w-3.5 h-3.5 text-retro-green flex-shrink-0"})):(y(),xe(v(Tu),{key:1,class:"w-3.5 h-3.5 text-retro-yellow flex-shrink-0"})),m("span",{class:Ie(["truncate",f(P.path)?"text-retro-green":"text-retro-yellow"])},F(P.path),3)],10,nq))),128))])]),m("div",oq,[d.value?(y(),xe(MV,{key:0,file:d.value,resolved:f(d.value.path)},null,8,["file","resolved"])):(y(),S("div",aq," Select a file to view "))]),m("div",lq,[le(VV)])]))])])):se("",!0)]),_:1})]))}}),hq={key:0,class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},uq={class:"flex items-center justify-between p-4 border-b border-retro-border"},dq={class:"flex items-center gap-2"},fq={class:"p-4"},pq={class:"mt-2 text-sm text-retro-text font-mono truncate"},mq={class:"flex justify-end gap-3 p-4 border-t border-retro-border"},gq=Xe({__name:"DeleteConfirmModal",props:{show:{type:Boolean},title:{}},emits:["confirm","cancel"],setup(i,{emit:e}){const t=e;function r(s){s.target===s.currentTarget&&t("cancel")}return(s,n)=>(y(),xe(or,{to:"body"},[le(hs,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:gt(()=>[i.show?(y(),S("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:r},[le(hs,{"enter-active-class":"transition-all duration-200","enter-from-class":"opacity-0 scale-95","enter-to-class":"opacity-100 scale-100","leave-active-class":"transition-all duration-200","leave-from-class":"opacity-100 scale-100","leave-to-class":"opacity-0 scale-95"},{default:gt(()=>[i.show?(y(),S("div",hq,[m("div",uq,[m("div",dq,[le(v(vn),{class:"w-5 h-5 text-retro-red"}),n[3]||(n[3]=m("h3",{class:"text-lg font-mono text-retro-text"},"Delete Conversation",-1))]),m("button",{onClick:n[0]||(n[0]=o=>t("cancel")),class:"p-1 hover:bg-retro-panel rounded transition-colors"},[le(v(hi),{class:"w-5 h-5 text-retro-muted"})])]),m("div",fq,[n[4]||(n[4]=m("p",{class:"text-sm text-retro-muted font-mono"}," Are you sure you want to delete this conversation? ",-1)),m("p",pq,' "'+F(i.title)+'" ',1),n[5]||(n[5]=m("p",{class:"mt-3 text-xs text-retro-muted"}," This action cannot be undone. ",-1))]),m("div",mq,[m("button",{onClick:n[1]||(n[1]=o=>t("cancel")),class:"px-4 py-2 text-sm font-mono text-retro-muted border border-retro-border rounded hover:bg-retro-panel transition-colors"}," Cancel "),m("button",{onClick:n[2]||(n[2]=o=>t("confirm")),class:"px-4 py-2 text-sm font-mono text-white bg-retro-red/80 border border-retro-red rounded hover:bg-retro-red transition-colors"}," Delete ")])])):se("",!0)]),_:1})])):se("",!0)]),_:1})]))}}),vq={class:"h-full flex flex-col bg-retro-black"},Oq={class:"flex-shrink-0 h-12 flex items-center justify-between px-4 border-b border-retro-border bg-retro-dark"},_q={class:"flex items-center gap-2 min-w-0"},bq={class:"text-xs font-mono text-retro-text truncate"},yq={class:"flex items-center gap-1"},xq=["disabled","title"],wq=["disabled","title"],Sq=["title"],kq=["disabled"],Cq={key:4,class:"flex-shrink-0 px-4 py-2 border-b border-retro-border bg-retro-green/10 text-retro-green text-xs font-mono text-center"},$q={class:"flex-1 min-h-0"},O_=Xe({__name:"ChatPanel",setup(i){const e=Lr(),t=iS(),{disconnectConversation:r,abort:s}=Pg(),n=N(null);function o(){xi(()=>{n.value?.focusTerminal()})}Qt(async()=>{try{const V=await $fetch("/api/cwd");e.setCwd(V.cwd)}catch{}});const a=he(()=>e.activeConversation?.title||"New Chat"),l=N(!1),c=he(()=>t.isChatFullscreen);function h(){t.toggleChatFullscreen()}async function u(){l.value=!1;const V=e.activeConversationId;V&&(e.isConversationStreaming(V)&&s(V),r(V),await e.deleteConversation(V)),e.clearMessages()}function d(){e.hasMessages&&(l.value=!0)}function f(){l.value=!1}const p=N(!1),g=N(null),O=he(()=>e.activeConversation?.finalized===!0),_=he(()=>O.value),k=N(null),P=N(!1);let w=0;async function C(){const V=e.activeConversation;if(!V?.worktreePath||!V?.baseBranch){w++,k.value=null;return}const ie=++w;P.value=!0;try{const q=await $fetch("/api/chat/compare",{params:{worktreePath:V.worktreePath,baseBranch:V.baseBranch}});if(ie!==w)return;k.value=q}catch{if(ie!==w)return;k.value=null}finally{ie===w&&(P.value=!1)}}Ye(()=>[e.activeConversationId,e.activeConversation?.worktreePath,e.activeConversation?.baseBranch,e.activeConversation?.lastCommitTime,e.activeConversation?.updatedAt,e.isActiveConversationStreaming],()=>{C()},{immediate:!0}),Ye(()=>e.activeConversationId,()=>{p.value=!1,E.value=!1,g.value=null,o()});const M=he(()=>k.value?k.value.ahead===0&&k.value.behind===0:!1),D=he(()=>{const V=e.activeConversation;return V?.hasWorktree&&!V?.finalized}),j=he(()=>{const V=e.activeConversation;return!!V?.hasWorktree&&!V?.finalized&&!e.isActiveConversationStreaming&&!M.value}),oe=he(()=>{const V=e.activeConversation;return!!V?.hasWorktree&&!V?.finalized});function ae(){p.value=!0,g.value=null}async function G(V,ie){const q=e.activeConversationId;if(!q)return;const ee=await e.finalizeConversation(q,V,ie);if(p.value=!1,ee.success)g.value={type:"success",message:`Merged to ${ie}`},setTimeout(()=>{g.value=null},5e3);else if(ee.rebaseInProgress)g.value=null;else{const te=ee.conflictFiles?.length?`Conflict in: ${ee.conflictFiles.join(", ")}`:ee.error||"Finalize failed";g.value={type:"error",message:te}}}function x(){p.value=!1}function b(){if(!e.conflictState&&e.activeConversation?.hasWorktree){const V=e.activeConversation?.baseBranch||"main";g.value={type:"success",message:`Rebased onto ${V}`},setTimeout(()=>{g.value=null},5e3)}else g.value=null}const T=N(!1),$=he(()=>!!e.activeConversation?.previewBranch);async function R(){const V=e.activeConversationId;if(!V)return;T.value=!0,g.value=null;const ie=$.value,q=await e.togglePreview(V);if(q.success){const ee=ie?`Switched back to ${e.activeConversation?.baseBranch}`:"Preview active — main worktree updated";g.value={type:"success",message:ee},setTimeout(()=>{g.value=null},3e3)}else g.value={type:"error",message:q.error||"Preview toggle failed"};T.value=!1}const E=N(!1);function Z(){E.value=!0,g.value=null}async function K(V){const ie=e.activeConversationId;if(!ie)return;const q=await e.rebaseConversation(ie,V);E.value=!1,q.success?(g.value={type:"success",message:`Rebased onto ${V}`},setTimeout(()=>{g.value=null},5e3)):q.rebaseInProgress?g.value=null:g.value={type:"error",message:q.error||"Rebase failed"}}function X(){E.value=!1}return(V,ie)=>(y(),S("div",vq,[m("div",Oq,[m("div",_q,[m("span",bq,F(v(a)),1)]),m("div",yq,[v(D)?(y(),S("button",{key:0,disabled:v(T),class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:v($)?"End preview: switch back to base branch":"Preview: test worktree changes in main worktree",onClick:R},[v($)?(y(),xe(v(Ok),{key:0,class:"w-4 h-4 text-retro-cyan"})):(y(),xe(v(_k),{key:1,class:"w-4 h-4"}))],8,xq)):se("",!0),v(oe)?(y(),S("button",{key:1,disabled:v(e).isActiveConversationStreaming,class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:v(e).isActiveConversationStreaming?"Rebase unavailable while Claude is responding":"Rebase: sync worktree onto target base branch",onClick:Z},[...ie[1]||(ie[1]=[B2('<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><circle cx="7" cy="4.5" r="1.5" fill="currentColor"></circle><circle cx="18" cy="20" r="1.5" fill="currentColor"></circle><circle cx="12" cy="7" r="1.4" fill="currentColor" opacity="0.9"></circle><path d="M7 6V16M7 16L4.5 13.5M7 16L9.5 13.5" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path><path d="M8.4 7H12.5C15.5376 7 18 9.46243 18 12.5V18.5" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path><path d="M15.5 16L18 18.5L20.5 16" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path></svg>',1)])],8,wq)):se("",!0),v(j)?(y(),S("button",{key:2,class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"Finalize: squash & merge to base branch",onClick:ae},[le(v(Sm),{class:"w-4 h-4"})])):se("",!0),m("button",{class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:v(c)?"Exit fullscreen chat":"Fullscreen chat",onClick:h},[v(c)?(y(),xe(v(k_),{key:0,class:"w-4 h-4"})):(y(),xe(v(C_),{key:1,class:"w-4 h-4"}))],8,Sq),m("button",{disabled:!v(e).hasMessages,class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:"New conversation",onClick:d},[le(v(os),{class:"w-4 h-4"})],8,kq)])]),le(gq,{show:v(l),title:v(a),onConfirm:u,onCancel:f},null,8,["show","title"]),v(p)&&v(e).activeConversation?.hasWorktree?(y(),xe(sV,{key:0,"conversation-id":v(e).activeConversation.id,"base-branch":v(e).activeConversation.baseBranch||"main","worktree-branch":v(e).activeConversation.worktreeBranch||"","worktree-path":v(e).activeConversation.worktreePath||"",onConfirm:G,onCancel:x},null,8,["conversation-id","base-branch","worktree-branch","worktree-path"])):se("",!0),v(E)&&v(e).activeConversation?.hasWorktree?(y(),xe(bV,{key:1,"base-branch":v(e).activeConversation.baseBranch||"main","worktree-branch":v(e).activeConversation.worktreeBranch||"","worktree-path":v(e).activeConversation.worktreePath||"",onConfirm:K,onCancel:X},null,8,["base-branch","worktree-branch","worktree-path"])):se("",!0),v(e).conflictState?(y(),xe(cq,{key:2,onClose:b})):se("",!0),v(g)?(y(),S("div",{key:3,class:Ie(["flex-shrink-0 px-4 py-2 border-b border-retro-border text-xs font-mono",v(g).type==="success"?"bg-retro-green/10 text-retro-green":"bg-retro-red/10 text-retro-red"])},[We(F(v(g).message)+" ",1),v(g).type==="error"?(y(),S("button",{key:0,class:"ml-2 underline hover:no-underline",onClick:ie[0]||(ie[0]=q=>g.value=null)}," dismiss ")):se("",!0)],2)):se("",!0),v(O)?(y(),S("div",Cq," This conversation has been finalized and is read-only. ")):se("",!0),m("div",$q,[le(AF,{ref_key:"terminalPanelRef",ref:n,disabled:v(_)},null,8,["disabled"])])]))}}),Pq={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border bg-retro-panel"},Tq={class:"flex items-center gap-2 min-w-0"},Mq=["title"],Qq={class:"text-retro-text font-mono text-sm truncate"},Aq={class:"text-retro-muted"},Rq={class:"text-retro-text"},Bq={class:"text-retro-muted font-mono text-xs flex-shrink-0"},Lq={class:"flex-1 overflow-auto"},Eq={key:0,class:"flex items-center justify-center gap-2 text-retro-muted text-sm py-8"},Dq={key:1,class:"flex items-center justify-center text-retro-muted text-sm py-8"},Iq={key:2,class:"flex items-center justify-center text-retro-muted text-sm py-8"},zq={key:3,class:"w-full text-xs font-mono border-collapse diff-table"},Nq={key:0,class:"diff-warning"},Wq={key:0,colspan:"3",class:"diff-hunk-header px-4 py-1"},Zq={class:"diff-line-num select-none text-right px-2 w-12"},Xq={class:"diff-line-num select-none text-right px-2 w-12 border-r border-retro-border"},Fq={class:"diff-line-content px-3 whitespace-pre-wrap break-all"},Vq={key:0,class:"diff-sign"},qq={key:1,class:"diff-sign"},Hq={key:2,class:"diff-sign"},Uq={key:4,class:"flex items-center justify-center text-retro-muted text-sm py-8"},Yq=Xe({__name:"GitFileDiffViewer",props:{file:{},commitHash:{},content:{},loading:{type:Boolean}},emits:["close"],setup(i,{emit:e}){const t=i,r=e,s=N(null),n=he(()=>t.commitHash.substring(0,7)),o=he(()=>Fo[t.file.status]||{label:t.file.status,colorClass:"text-retro-muted"}),a=he(()=>t.file.status==="R"&&t.file.oldPath);function l(c){c.key==="Escape"&&(c.preventDefault(),c.stopPropagation(),r("close"))}return Qt(()=>{s.value?.focus()}),(c,h)=>(y(),S("div",{ref_key:"containerRef",ref:s,tabindex:0,onKeydown:l,class:"flex flex-col h-full bg-retro-dark focus:outline-none","aria-label":"File diff viewer",role:"region"},[m("div",Pq,[m("div",Tq,[m("span",{class:Ie(["flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs font-bold rounded",o.value.colorClass]),title:o.value.label},F(i.file.status),11,Mq),m("span",Qq,[a.value&&i.file.oldPath?(y(),S(Me,{key:0},[m("span",Aq,F(i.file.oldPath),1),h[1]||(h[1]=m("span",{class:"text-retro-yellow mx-1"},"→",-1)),m("span",Rq,F(i.file.path),1)],64)):(y(),S(Me,{key:1},[We(F(i.file.path),1)],64))]),m("span",Bq," @ "+F(n.value),1)]),m("button",{onClick:h[0]||(h[0]=u=>r("close")),class:"p-1 hover:bg-retro-dark rounded transition-colors flex-shrink-0 focus:outline-none focus:ring-2 focus:ring-retro-cyan","aria-label":"Close diff viewer",title:"Close (Esc)"},[le(v(hi),{class:"w-5 h-5 text-retro-muted hover:text-retro-text"})])]),m("div",Lq,[i.loading?(y(),S("div",Eq,[...h[2]||(h[2]=[m("div",{class:"w-4 h-4 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),We(" Loading diff... ",-1)])])):i.content&&i.content.binary?(y(),S("div",Dq,[...h[3]||(h[3]=[m("span",{class:"bg-retro-panel px-4 py-2 rounded font-mono"}," Binary file — cannot display diff ",-1)])])):i.content&&i.content.lines.length===0?(y(),S("div",Iq,[...h[4]||(h[4]=[m("span",{class:"bg-retro-panel px-4 py-2 rounded font-mono"}," No changes in this file ",-1)])])):i.content?(y(),S("table",zq,[m("tbody",null,[i.content.truncated?(y(),S("tr",Nq,[...h[5]||(h[5]=[m("td",{colspan:"3",class:"px-4 py-2 text-retro-yellow bg-retro-panel text-center"}," Diff truncated — file has more than 10,000 lines ",-1)])])):se("",!0),(y(!0),S(Me,null,Ke(i.content.lines,(u,d)=>(y(),S("tr",{key:d,class:Ie({"diff-add":u.type==="add","diff-delete":u.type==="delete","diff-context":u.type==="context","diff-header":u.type==="header"})},[u.type==="header"?(y(),S("td",Wq,F(u.content),1)):(y(),S(Me,{key:1},[m("td",Zq,F(u.oldLineNumber??""),1),m("td",Xq,F(u.newLineNumber??""),1),m("td",Fq,[u.type==="add"?(y(),S("span",Vq,"+")):u.type==="delete"?(y(),S("span",qq,"-")):(y(),S("span",Hq," ")),We(" "+F(u.content),1)])],64))],2))),128))])])):(y(),S("div",Uq," Failed to load diff content. "))])],544))}}),__=zs(Yq,[["__scopeId","data-v-74bf9bf3"]]),jq={class:"fixed inset-0 z-50 flex items-center justify-center"},Gq={class:"relative w-[90vw] max-w-lg bg-retro-black border border-retro-border rounded-lg shadow-2xl flex flex-col overflow-hidden"},Kq={class:"flex-shrink-0 h-12 flex items-center justify-between px-4 border-b border-retro-border bg-retro-dark"},Jq={class:"flex items-center gap-2"},eH={class:"text-sm font-mono text-retro-text"},tH={class:"p-6 overflow-y-auto max-h-[70vh] space-y-6"},iH={key:0},rH={class:"space-y-6"},sH={class:"space-y-1.5"},nH=["value","checked","onChange"],oH={class:"flex-1"},aH={class:"text-sm font-mono text-retro-text"},lH={class:"text-xs text-retro-muted leading-tight"},cH={class:"text-xs font-mono text-retro-muted"},hH={class:"text-xs text-retro-muted mb-3"},uH=["disabled"],dH={class:"space-y-1.5"},fH=["value","checked","onChange"],pH={class:"flex-1"},mH={class:"text-sm font-mono text-retro-text"},gH={class:"text-xs text-retro-muted leading-tight"},vH={key:1,class:"space-y-4"},OH={class:"flex items-center justify-between px-3 py-2 rounded border border-retro-border bg-retro-panel"},_H={class:"text-xs font-mono text-retro-cyan"},bH=Xe({__name:"SettingsModal",emits:["close"],setup(i,{emit:e}){const t=e,r=Kl(),s=L2(),n=Gl(),o=N("main"),a=N(!1),l=he(()=>s.public.appVersion||"unknown"),c=[{value:"dark",label:"Dark",description:"Retro terminal theme with dark backgrounds"},{value:"light",label:"Light",description:"Bright theme for well-lit environments"}],h=[{value:"plan",label:yc.plan,description:bc.plan,icon:T_,color:"text-retro-cyan"},{value:"ask",label:yc.ask,description:bc.ask,icon:B_,color:"text-retro-green"},{value:"auto",label:yc.auto,description:bc.auto,icon:ck,color:"text-retro-yellow"},{value:"bypass",label:yc.bypass,description:bc.bypass,icon:E_,color:"text-retro-red"}],{data:u,pending:d,error:f}=iv("ai-providers",()=>$fetch("/api/ai/providers"),{server:!1}),p=he(()=>u.value?.providers??[]),g=he(()=>{const x=f.value;return x?x instanceof Error?x.message:String(x):null}),{data:O,refresh:_}=iv("spec-search-status",()=>$fetch("/api/specs/status"),{server:!1,default:()=>null}),k=he(()=>{const x=O.value;return x?x.isIndexing?`Indexing (${x.currentJob||"running"})`:x.schedulerActive?`Indexed ${x.fileCount} files / ${x.chunkCount} chunks`:"Scheduler inactive":"Status unavailable"});Qt(()=>{r.hydrate()});const P=x=>{r.setProviderSelection(x),n.success("Settings saved")},w=()=>{o.value="provider"},C=()=>{o.value="main"},M=x=>{r.setTheme(x),n.success("Settings saved")},D=x=>{r.setPermissionMode(x),n.success("Settings saved")},j=()=>{t("close")},oe=async()=>{if(!a.value){a.value=!0;try{const x=await $fetch("/api/specs/reindex",{method:"POST",body:{}});!x.success&&x.status==="already-indexing"?n.info("Spec index is already running"):n.success("Spec reindex started"),await _()}catch(x){n.error(x instanceof Error?x.message:"Failed to start spec reindex")}finally{a.value=!1}}},ae=x=>{x.key==="Escape"&&t("close")};Qt(()=>{window.addEventListener("keydown",ae)}),_i(()=>{window.removeEventListener("keydown",ae)});let G=null;return Qt(()=>{G=$m(()=>{_()},5e3)}),_i(()=>{G&&clearInterval(G)}),(x,b)=>(y(),xe(or,{to:"body"},[m("div",jq,[m("div",{class:"absolute inset-0 bg-black/70",onClick:j}),m("div",Gq,[m("div",Kq,[m("div",Jq,[o.value==="provider"?(y(),S("button",{key:0,type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Back",onClick:C},[le(v(ak),{class:"h-4 w-4"})])):se("",!0),m("h2",eH,F(o.value==="provider"?"AI Provider Settings":"Settings"),1)]),m("button",{type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Close",onClick:b[0]||(b[0]=T=>t("close"))},[le(v(hi),{class:"h-4 w-4"})])]),m("div",tH,[o.value==="main"?(y(),S("section",iH,[m("div",rH,[m("section",null,[b[1]||(b[1]=m("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Theme",-1)),b[2]||(b[2]=m("p",{class:"text-xs text-retro-muted mb-3"}," Choose between dark and light appearance. ",-1)),m("div",sH,[(y(),S(Me,null,Ke(c,T=>m("label",{key:T.value,class:Ie(["flex items-center gap-3 px-3 py-2 rounded border cursor-pointer transition-colors",[v(r).theme===T.value?"border-retro-cyan bg-retro-cyan/10":"border-retro-border bg-retro-panel hover:border-retro-muted"]])},[m("input",{type:"radio",name:"theme",value:T.value,checked:v(r).theme===T.value,class:"w-3.5 h-3.5 text-retro-cyan accent-retro-cyan",onChange:$=>M(T.value)},null,40,nH),m("div",oH,[m("div",aH,F(T.label),1),m("div",lH,F(T.description),1)])],2)),64))])]),b[9]||(b[9]=m("div",{class:"border-t border-retro-border"},null,-1)),m("section",null,[b[4]||(b[4]=m("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"AI Provider",-1)),b[5]||(b[5]=m("p",{class:"text-xs text-retro-muted mb-3"}," Configure provider and model settings for new conversations. ",-1)),m("button",{type:"button",class:"w-full flex items-center justify-between px-3 py-2 rounded border border-retro-border bg-retro-panel hover:border-retro-muted transition-colors",onClick:w},[b[3]||(b[3]=m("span",{class:"text-sm font-mono text-retro-text"},"Provider Settings",-1)),m("span",cH,F(v(r).providerSelection.providerId)+" / "+F(v(r).providerSelection.modelKey),1)])]),b[10]||(b[10]=m("div",{class:"border-t border-retro-border"},null,-1)),m("section",null,[b[6]||(b[6]=m("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Spec Search Index",-1)),m("p",hH,F(k.value),1),m("button",{type:"button",class:"w-full flex items-center justify-center px-3 py-2 rounded border border-retro-border bg-retro-panel text-retro-text hover:border-retro-muted transition-colors disabled:opacity-60",disabled:a.value||v(O)?.isIndexing,onClick:oe},F(a.value?"Starting reindex...":"Reindex Specs"),9,uH)]),b[11]||(b[11]=m("div",{class:"border-t border-retro-border"},null,-1)),m("section",null,[b[7]||(b[7]=m("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Default Permission Mode",-1)),b[8]||(b[8]=m("p",{class:"text-xs text-retro-muted mb-3"}," Set the default permission mode for all new chat conversations. ",-1)),m("div",dH,[(y(),S(Me,null,Ke(h,T=>m("label",{key:T.value,class:Ie(["flex items-center gap-3 px-3 py-2 rounded border cursor-pointer transition-colors",[v(r).permissionMode===T.value?"border-retro-cyan bg-retro-cyan/10":"border-retro-border bg-retro-panel hover:border-retro-muted"]])},[m("input",{type:"radio",name:"permission-mode",value:T.value,checked:v(r).permissionMode===T.value,class:"w-3.5 h-3.5 text-retro-cyan accent-retro-cyan",onChange:$=>D(T.value)},null,40,fH),(y(),xe(jl(T.icon),{class:Ie(["w-4 h-4 flex-shrink-0",T.color])},null,8,["class"])),m("div",pH,[m("div",mH,F(T.label),1),m("div",gH,F(T.description),1)])],2)),64))])]),b[12]||(b[12]=m("div",{class:"border-t border-retro-border"},null,-1))])])):(y(),S("section",vH,[b[13]||(b[13]=m("div",null,[m("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"AI Provider"),m("p",{class:"text-xs text-retro-muted mb-3"}," Choose which registered provider and model powers new conversations. ")],-1)),le(ik,{providers:p.value,selected:v(r).providerSelection,permissionMode:v(r).permissionMode,pending:v(d),errorMessage:g.value,onSelect:P},null,8,["providers","selected","permissionMode","pending","errorMessage"])])),b[17]||(b[17]=m("div",{class:"border-t border-retro-border"},null,-1)),m("section",null,[b[15]||(b[15]=m("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Spec-Cat",-1)),b[16]||(b[16]=m("p",{class:"text-xs text-retro-muted mb-3"}," Application version. ",-1)),m("div",OH,[b[14]||(b[14]=m("span",{class:"text-sm font-mono text-retro-text"},"Version",-1)),m("span",_H,F(l.value),1)])])])])])]))}}),yH={class:"fixed top-4 right-4 z-50 flex flex-col gap-2 max-w-sm"},xH={class:"flex-1 text-sm font-mono text-retro-text"},wH=["onClick"],SH=Xe({__name:"ToastContainer",setup(i){const{toasts:e,remove:t}=Gl(),r={success:{bg:"bg-retro-green/20",icon:"text-retro-green",border:"border-retro-green/50"},error:{bg:"bg-retro-red/20",icon:"text-retro-red",border:"border-retro-red/50"},info:{bg:"bg-retro-cyan/20",icon:"text-retro-cyan",border:"border-retro-cyan/50"},warning:{bg:"bg-retro-yellow/20",icon:"text-retro-yellow",border:"border-retro-yellow/50"}},s=n=>{switch(n){case"success":return Sm;case"error":return Tu;case"warning":return vn;default:return wk}};return(n,o)=>(y(),xe(or,{to:"body"},[m("div",yH,[le(E2,{"enter-active-class":"transition-all duration-300 ease-out","leave-active-class":"transition-all duration-200 ease-in","enter-from-class":"opacity-0 translate-x-4","enter-to-class":"opacity-100 translate-x-0","leave-from-class":"opacity-100 translate-x-0","leave-to-class":"opacity-0 translate-x-4"},{default:gt(()=>[(y(!0),S(Me,null,Ke(v(e),a=>(y(),S("div",{key:a.id,class:Ie(["flex items-start gap-3 p-3 rounded-lg border shadow-lg",[r[a.type].bg,r[a.type].border]])},[(y(),xe(jl(s(a.type)),{class:Ie(["h-5 w-5 flex-shrink-0 mt-0.5",r[a.type].icon])},null,8,["class"])),m("p",xH,F(a.message),1),m("button",{type:"button",class:"p-0.5 rounded text-retro-muted hover:text-retro-text transition-colors",onClick:l=>v(t)(a.id)},[le(v(hi),{class:"h-4 w-4"})],8,wH)],2))),128))]),_:1})])]))}}),kH=Xe({__name:"SplashScreen",setup(i){const e=N(!0),t=N(!1);return Qt(()=>{setTimeout(()=>{t.value=!0,setTimeout(()=>{e.value=!1},600)},1800)}),(r,s)=>(y(),xe(or,{to:"body"},[e.value?(y(),S("div",{key:0,class:Ie(["fixed inset-0 z-[9999] flex items-center justify-center bg-retro-black transition-opacity duration-500",{"opacity-0":t.value}])},[...s[0]||(s[0]=[m("div",{class:"flex flex-col items-center gap-6"},[m("pre",{class:"text-retro-cyan font-mono text-xs leading-tight select-none splash-glow"},` ____ ____ _
169
+ / ___| _ __ ___ ___ / ___|__ _| |_
170
+ \\___ \\| '_ \\ / _ \\/ __|| | / _\` | __|
171
+ ___) | |_) | __/ (__ | |__| (_| | |_
172
+ |____/| .__/ \\___|\\___| \\____\\__,_|\\__|
173
+ |_|
174
+ `),m("div",{class:"flex items-center gap-2"},[m("span",{class:"inline-block w-2 h-2 rounded-full bg-retro-cyan animate-pulse"}),m("span",{class:"text-retro-muted font-mono text-xs tracking-widest uppercase"},"initializing")])],-1)])],2)):se("",!0)]))}}),CH=zs(kH,[["__scopeId","data-v-7fddb179"]]);let wi=null,wo=null,Rn=null;const $H=5e3,PH=500,TH=1e3,xf=5,Tr=new Map,Bn=new Map,rn=new Map,uh=new Map;function MH(){return typeof window>"u"?"":`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/_ws`}function QH(){const i=Lr();async function e(){console.log("[GlobalNotifications] Executing debounced refresh");const p=await i.refreshServerConversations();console.log("[GlobalNotifications] Refresh result:",p);const g=[];for(const[O,_]of Bn)Bn.delete(O),r(O,_)||g.push([O,_]);for(const[O,_]of g){const k=(rn.get(O)??0)+1;if(k<=xf){rn.set(O,k),console.log(`[GlobalNotifications] Scheduling retry ${k}/${xf} for ${O}`);const P=setTimeout(()=>{uh.delete(O),Bn.set(O,_),t()},TH*k);uh.set(O,P)}else console.warn(`[GlobalNotifications] Gave up streaming setup for ${O} after ${xf} retries`),rn.delete(O)}}function t(){Rn&&clearTimeout(Rn),Rn=setTimeout(()=>{Rn=null,e()},PH)}function r(p,g){if(!wi||wi.readyState!==WebSocket.OPEN)return!1;if(Tr.has(p)||i.isConversationActivelyStreaming(p))return rn.delete(p),!0;const O=i.conversations.find(P=>P.id===p);if(!O)return console.warn("[GlobalNotifications] Conversation not found for streaming:",p),!1;rn.delete(p),O.messages.length===0&&g&&i.addUserMessage(g,p);const _=[...O.messages].reverse().find(P=>P.role==="assistant");if(_)return i.resetMessageForReplay(_.id,p),i.startConversationStreaming(p),Tr.set(p,{conversationId:p,messageId:_.id,currentTextBlockId:null,currentToolBlockId:null,currentToolInputJson:"",isReplaying:!1,replayBuffer:[]}),wi.send(JSON.stringify({type:"subscribe",conversationId:p,cursor:0})),console.log("[GlobalNotifications] Resumed server job streaming (existing msg):",p),!0;const k=i.addAssistantMessage(p);return i.initContentBlocks(k.id,p),i.startConversationStreaming(p),Tr.set(p,{conversationId:p,messageId:k.id,currentTextBlockId:null,currentToolBlockId:null,currentToolInputJson:"",isReplaying:!1,replayBuffer:[]}),wi.send(JSON.stringify({type:"subscribe",conversationId:p,cursor:0})),console.log("[GlobalNotifications] Subscribed to server job streaming:",p),!0}function s(p){try{const g=JSON.parse(p.data);if(g.type==="notification"){n(g);return}const O=g.conversationId;if(!O)return;const _=Tr.get(O);_&&o(_,g)}catch{}}function n(p){if(console.log("[GlobalNotifications] Received:",p.notificationEvent,p.conversationId),p.notificationEvent==="job_created"){Bn.set(p.conversationId,p.message||""),t();return}if(p.notificationEvent==="job_persisted"){Tr.has(p.conversationId)&&(i.endConversationStreaming(p.conversationId),Tr.delete(p.conversationId)),Bn.delete(p.conversationId),rn.delete(p.conversationId),t();return}if(p.notificationEvent!=="job_completed"&&p.notificationEvent==="conversation_archived"){t();return}}function o(p,g){const O=p.conversationId;if(g.type==="replay_start"){p.isReplaying=!0,p.replayBuffer=[];return}if(g.type==="replay_end"){a(p),p.isReplaying=!1,p.replayBuffer=[];return}if(p.isReplaying){(g.type==="ui_event"||g.type==="done"||g.type==="error")&&p.replayBuffer.push(g);return}if(g.type==="ui_event"&&g.event){c(p,g.event,O);return}if(g.type!=="done"&&g.type==="error"){i.updateMessage(p.messageId,{status:"error"},O),i.setSessionError(g.error||"Server job error",O),i.endConversationStreaming(O),Tr.delete(O);return}}function a(p){const g=[];let O="",_=null,k=null,P="";for(const w of p.replayBuffer){if(w.type!=="ui_event"||!w.event)continue;const C=w.event;switch(C.type){case"block_start":if(C.blockType==="text"){const M=C.blockId||Zi();g.push({id:M,type:"text",text:C.text||""}),_=M,k=null,C.text&&(O+=C.text)}else if(C.blockType==="tool_use"&&C.toolUseId&&C.name){const M=C.blockId||Zi();g.push({id:M,type:"tool_use",toolUseId:C.toolUseId,name:C.name,input:{},inputSummary:"",status:"running"}),_=null,k=C.index??0,P=""}break;case"block_delta":if(C.text&&_){const M=g.find(D=>D.id===_);M&&M.type==="text"&&(M.text+=C.text,O+=C.text)}C.partialJson&&k!==null&&(P+=C.partialJson);break;case"block_end":if(_&&(_=null),k!==null){const M=[...g].reverse().find(D=>D.type==="tool_use");if(M){let D={};try{D=JSON.parse(P)}catch{}M.input=D,M.inputSummary=l(D),M.status="pending"}k=null,P=""}break;case"tool_result":{const M=[...g].reverse().find(D=>D.type==="tool_use"&&D.toolUseId===C.toolUseId);M&&(M.status=C.isError?"error":"complete"),g.push({id:Zi(),type:"tool_result",toolUseId:C.toolUseId,content:C.content||"",isError:!!C.isError});break}}}g.length>0&&i.batchSetMessageBlocks(p.messageId,g,O,"streaming",p.conversationId),p.currentTextBlockId=_,p.currentToolBlockId=null,p.currentToolInputJson="",console.log(`[GlobalNotifications] Replay batch: ${p.replayBuffer.length} events → ${g.length} blocks`)}function l(p){return p.file_path?String(p.file_path):p.path?String(p.path):p.command?String(p.command).slice(0,50):""}function c(p,g,O){switch(g.type){case"block_start":{if(g.blockType==="text"){const _=g.blockId||Zi(),k={id:_,type:"text",text:g.text||""};i.appendContentBlock(p.messageId,k,O),p.currentTextBlockId=_,p.currentToolBlockId=null,g.text&&i.appendToMessage(p.messageId,g.text,O)}else if(g.blockType==="tool_use"&&g.toolUseId&&g.name){const _=g.blockId||Zi(),k={id:_,type:"tool_use",toolUseId:g.toolUseId,name:g.name,input:{},inputSummary:"",status:"running"};i.appendContentBlock(p.messageId,k,O),p.currentToolBlockId=_,p.currentToolInputJson="",p.currentTextBlockId=null}break}case"block_delta":{g.text&&p.currentTextBlockId&&(i.updateBlockById(p.messageId,p.currentTextBlockId,_=>{_.type==="text"&&(_.text+=g.text)},O),i.appendToMessage(p.messageId,g.text,O)),g.partialJson&&p.currentToolBlockId&&(p.currentToolInputJson+=g.partialJson);break}case"block_end":{if(p.currentTextBlockId&&(p.currentTextBlockId=null),p.currentToolBlockId){const _=p.currentToolBlockId,k=p.currentToolInputJson;i.updateBlockById(p.messageId,_,P=>{if(P.type==="tool_use"){const w=P;let C={};try{C=JSON.parse(k)}catch{}w.input=C,w.inputSummary=l(C),w.status="pending"}},O),p.currentToolBlockId=null,p.currentToolInputJson=""}break}case"tool_result":{if(g.toolUseId){const _=i.findToolUseBlock(p.messageId,g.toolUseId,O);_&&i.updateBlockById(p.messageId,_.id,P=>{P.type==="tool_use"&&(P.status=g.isError?"error":"complete")},O);const k={id:Zi(),type:"tool_result",toolUseId:g.toolUseId,content:g.content||"",isError:!!g.isError};i.appendContentBlock(p.messageId,k,O)}break}}}function h(){if(typeof window>"u"||wi&&(wi.readyState===WebSocket.OPEN||wi.readyState===WebSocket.CONNECTING))return;const p=MH();wi=new WebSocket(p),wi.onopen=()=>{console.log("[GlobalNotifications] WebSocket connected")},wi.onmessage=s,wi.onclose=g=>{console.log("[GlobalNotifications] WebSocket closed",{code:g.code,reason:g.reason}),wi=null;for(const O of Tr.keys())i.endConversationStreaming(O);Tr.clear(),u()},wi.onerror=g=>{console.warn("[GlobalNotifications] WebSocket error",g)}}function u(){wo||(wo=setTimeout(()=>{wo=null,h()},$H))}function d(){wo&&(clearTimeout(wo),wo=null),Rn&&(clearTimeout(Rn),Rn=null);for(const p of uh.values())clearTimeout(p);uh.clear(),rn.clear(),Bn.clear();for(const p of Tr.keys())i.endConversationStreaming(p);Tr.clear(),wi&&(wi.close(),wi=null)}async function f(){try{const g=(await $fetch("/api/jobs")).filter(O=>O.source!=="user"&&(O.status==="running"||O.status==="waiting_permission"||O.status==="queued"||O.status==="done"&&O.eventCount>0));if(g.length===0)return;await i.refreshServerConversations();for(const O of g){if(i.isConversationActivelyStreaming(O.conversationId))continue;const _=i.conversations.find(w=>w.id===O.conversationId);if(!_)continue;const k=[..._.messages].reverse().find(w=>w.role==="assistant");if(k&&(k.status==="complete"||k.status==="error"||k.status==="stopped"))continue;console.log("[GlobalNotifications] Resuming active server job:",O.id,"for conversation:",O.conversationId),r(O.conversationId,"")||(console.log("[GlobalNotifications] WS not ready for resume, queuing for retry:",O.conversationId),Bn.set(O.conversationId,""),t())}}catch(p){console.warn("[GlobalNotifications] Failed to check for active server jobs:",p)}}return Qt(()=>{h()}),_i(()=>{d()}),{connect:h,disconnect:d,resumeActiveServerJobs:f}}const AH={class:"h-screen min-w-[320px] overflow-hidden bg-retro-black text-retro-text"},RH={key:0,class:"flex h-full flex-col overflow-hidden"},BH={class:"flex-shrink-0 border-b border-retro-border bg-retro-panel"},LH={class:"flex h-14 items-center justify-between gap-3 px-3"},EH={class:"flex items-center gap-2 min-w-0"},DH={class:"min-w-0"},IH={class:"text-[11px] text-retro-muted font-mono truncate"},zH={class:"flex items-center gap-1"},NH=["title"],WH={class:"relative flex-1 min-h-0 overflow-hidden"},ZH={class:"absolute inset-0 flex flex-col overflow-hidden","aria-label":"Git"},XH={class:"absolute inset-0 flex flex-col overflow-hidden","aria-label":"Specs"},FH={class:"absolute inset-0 flex flex-col overflow-hidden","aria-label":"Conversations"},VH={class:"absolute inset-0 flex flex-col overflow-hidden","aria-label":"Chat"},qH={key:0,class:"absolute inset-0 z-30 flex flex-col overflow-hidden bg-retro-black"},HH={class:"flex-shrink-0 border-t border-retro-border bg-retro-panel","aria-label":"Mobile primary navigation"},UH={class:"grid h-16 grid-cols-4"},YH=["aria-current","onClick"],jH={class:"truncate"},GH={key:1,class:"flex h-full overflow-x-auto"},KH={class:"flex flex-col overflow-hidden",style:{flex:"3"}},JH={class:"flex-shrink-0 h-14 flex items-center justify-between px-4 border-b border-retro-border bg-retro-panel"},eU={class:"flex items-center gap-2 min-w-0"},tU={key:0,class:"text-xs text-retro-muted font-mono truncate"},iU={class:"flex items-center gap-1"},rU=["title"],sU={class:"flex-1 min-h-0 overflow-y-auto"},nU={class:"relative flex min-w-0",style:{flex:"7"}},oU={key:0,class:"flex flex-col overflow-hidden border-l border-retro-border",style:{flex:"2"}},aU={key:1,class:"flex flex-col overflow-hidden border-l border-retro-border",style:{flex:"2"}},lU={key:2,class:"absolute inset-0 z-30 flex flex-col overflow-hidden border-l border-retro-border bg-retro-black"},XY=Xe({__name:"default",setup(i){const e=iS(),t=Kl(),r=Lr(),s=Qu(),{isDark:n,toggleTheme:o}=wm(),{tryResumeStreaming:a}=Pg(),{resumeActiveServerJobs:l}=QH(),c=he(()=>s.diffViewerFile!==null),h=he(()=>e.isMobile),u=he(()=>e.isChatFullscreen),d=he(()=>u.value),f=he(()=>u.value?7:3),p=N(!1),g=N(""),O=N("chat"),_=[{id:"git",label:"Git",icon:pk},{id:"features",label:"Specs",icon:Jn},{id:"conversations",label:"Threads",icon:$k},{id:"chat",label:"Chat",icon:P_}],k=he(()=>_.find(D=>D.id===O.value)?.label??"Chat"),P=he(()=>{if(!g.value)return"";const D=g.value.replace(/\/+$/,"").split("/");return D[D.length-1]||""}),w=he(()=>P.value?`spec cat :: ${P.value}`:"spec cat");function C(){return r.conversations.filter(D=>[...D.messages].reverse().find(oe=>oe.role==="assistant")?.status==="streaming").map(D=>D.id)}D2(()=>({title:w.value}));const M=()=>{typeof window<"u"&&e.updateViewport(window.innerWidth)};return Ye(h,D=>{D&&u.value&&e.setChatFullscreen(!1)}),Ye(()=>r.activeConversationId,(D,j)=>{h.value&&D&&D!==j&&(O.value="chat")}),Qt(async()=>{typeof window<"u"&&(e.updateViewport(window.innerWidth),window.addEventListener("resize",M)),await t.hydrate(),await r.initialize(),await r.loadConversations();const D=C();await Promise.allSettled(D.map(j=>a(j))),await l();try{const j=await $fetch("/api/cwd");g.value=j.cwd}catch{g.value=""}}),_i(()=>{typeof window<"u"&&window.removeEventListener("resize",M)}),(D,j)=>{const oe=lT;return y(),S("div",AH,[h.value?(y(),S("div",RH,[m("header",BH,[m("div",LH,[m("div",EH,[j[8]||(j[8]=m("img",{alt:"SpecCat",src:hv,class:"w-5 h-5 text-retro-cyan mb-1"},null,-1)),m("div",DH,[j[7]||(j[7]=m("div",{class:"text-xs font-bold text-retro-cyan font-mono uppercase tracking-wider"},"SPECCAT",-1)),m("div",IH,F(P.value?`${P.value} / ${k.value}`:k.value),1)])]),m("div",zH,[m("button",{type:"button",class:"p-2 rounded transition-colors text-retro-muted hover:text-retro-text hover:bg-retro-black",title:v(n)?"Switch to light theme":"Switch to dark theme",onClick:j[0]||(j[0]=(...ae)=>v(o)&&v(o)(...ae))},[v(n)?(y(),xe(v(Yg),{key:0,class:"w-5 h-5"})):(y(),xe(v(jg),{key:1,class:"w-5 h-5"}))],8,NH),m("button",{type:"button",class:"p-2 rounded transition-colors text-retro-muted hover:text-retro-text hover:bg-retro-black",title:"Settings",onClick:j[1]||(j[1]=ae=>p.value=!0)},[le(v(kf),{class:"w-5 h-5"})])])])]),m("main",WH,[je(m("section",ZH,[le(oe,{"working-directory":g.value,"is-active":O.value==="git"},null,8,["working-directory","is-active"])],512),[[_c,O.value==="git"]]),je(m("section",XH,[le(H1)],512),[[_c,O.value==="features"]]),je(m("section",FH,[le(U1)],512),[[_c,O.value==="conversations"]]),je(m("section",VH,[le(O_)],512),[[_c,O.value==="chat"]]),c.value?(y(),S("div",qH,[le(__,{file:v(s).diffViewerFile,"commit-hash":v(s).diffViewerCommitHash,content:v(s).diffViewerContent,loading:v(s).diffViewerLoading,onClose:j[2]||(j[2]=ae=>v(s).closeFileDiff())},null,8,["file","commit-hash","content","loading"])])):se("",!0)]),m("nav",HH,[m("div",UH,[(y(),S(Me,null,Ke(_,ae=>m("button",{key:ae.id,type:"button",class:Ie(["flex min-w-0 flex-col items-center justify-center gap-1 px-1 text-[11px] font-mono transition-colors",O.value===ae.id?"text-retro-cyan bg-retro-cyan/10":"text-retro-muted hover:text-retro-text hover:bg-retro-black"]),"aria-current":O.value===ae.id?"page":void 0,onClick:G=>O.value=ae.id},[(y(),xe(jl(ae.icon),{class:"h-5 w-5 flex-shrink-0"})),m("span",jH,F(ae.label),1)],10,YH)),64))])])])):(y(),S("div",GH,[m("div",KH,[m("div",JH,[m("div",eU,[j[9]||(j[9]=m("img",{alt:"SpecCat",src:hv,class:"w-5 h-5 text-retro-cyan mb-1"},null,-1)),j[10]||(j[10]=m("span",{class:"text-sm font-bold text-retro-cyan font-mono uppercase tracking-wider flex-shrink-0"},"SPECCAT",-1)),P.value?(y(),S("span",tU,"/ "+F(P.value),1)):se("",!0)]),m("div",iU,[m("button",{type:"button",class:"p-2 rounded transition-colors text-retro-muted hover:text-retro-text hover:bg-retro-panel",title:v(n)?"Switch to light theme":"Switch to dark theme",onClick:j[3]||(j[3]=(...ae)=>v(o)&&v(o)(...ae))},[v(n)?(y(),xe(v(Yg),{key:0,class:"w-5 h-5"})):(y(),xe(v(jg),{key:1,class:"w-5 h-5"}))],8,rU),m("button",{type:"button",class:"p-2 rounded transition-colors text-retro-muted hover:text-retro-text hover:bg-retro-panel",title:"Settings",onClick:j[4]||(j[4]=ae=>p.value=!0)},[le(v(kf),{class:"w-5 h-5"})])])]),m("div",sU,[le(oe,{"working-directory":g.value},null,8,["working-directory"])])]),m("div",nU,[d.value?se("",!0):(y(),S("div",oU,[le(H1)])),d.value?se("",!0):(y(),S("div",aU,[le(U1)])),m("div",{class:"flex flex-col overflow-hidden border-l border-retro-border",style:gr({flex:f.value})},[le(O_)],4),c.value?(y(),S("div",lU,[le(__,{file:v(s).diffViewerFile,"commit-hash":v(s).diffViewerCommitHash,content:v(s).diffViewerContent,loading:v(s).diffViewerLoading,onClose:j[5]||(j[5]=ae=>v(s).closeFileDiff())},null,8,["file","commit-hash","content","loading"])])):se("",!0)])])),p.value?(y(),xe(bH,{key:2,onClose:j[6]||(j[6]=ae=>p.value=!1)})):se("",!0),le(SH),le(CH),b_(D.$slots,"default")])}}});export{XY as default};